Merge branch 'dev-ty1.2' into dev
This commit is contained in:
+3
-3
@@ -3,7 +3,7 @@ package com.mhd.wms.domain.inventoryAdjustmentRecord.service;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.aliyun.oss.ServiceException;
|
import com.mhd.common.core.exception.ServiceException;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.mhd.common.core.constant.SnowFlakeConstants;
|
import com.mhd.common.core.constant.SnowFlakeConstants;
|
||||||
import com.mhd.common.core.domain.po.UserPo;
|
import com.mhd.common.core.domain.po.UserPo;
|
||||||
@@ -175,7 +175,7 @@ public class InventoryAdjustmentRecordDomainService {
|
|||||||
}
|
}
|
||||||
materialInventory.setAllocationQuantity(materialInventory.getAllocationQuantity().subtract(inventoryAdjustmentRecordDO.getAdjustQuantity()));
|
materialInventory.setAllocationQuantity(materialInventory.getAllocationQuantity().subtract(inventoryAdjustmentRecordDO.getAdjustQuantity()));
|
||||||
if (materialInventory.getAllocationQuantity().compareTo(BigDecimal.ZERO) < 0) {
|
if (materialInventory.getAllocationQuantity().compareTo(BigDecimal.ZERO) < 0) {
|
||||||
throw new ServiceException("可用数量调整之后不能小于0");
|
throw new ServiceException("调整之后可用数量不能小于0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity());
|
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity());
|
||||||
@@ -231,7 +231,7 @@ public class InventoryAdjustmentRecordDomainService {
|
|||||||
}
|
}
|
||||||
materialInventory.setAllocationQuantity(materialInventory.getAllocationQuantity().subtract(inventoryAdjustmentRecordDO.getAdjustQuantity()));
|
materialInventory.setAllocationQuantity(materialInventory.getAllocationQuantity().subtract(inventoryAdjustmentRecordDO.getAdjustQuantity()));
|
||||||
if (materialInventory.getAllocationQuantity().compareTo(BigDecimal.ZERO) < 0) {
|
if (materialInventory.getAllocationQuantity().compareTo(BigDecimal.ZERO) < 0) {
|
||||||
throw new ServiceException("可用数量调整之后不能小于0");
|
throw new ServiceException("调整之后可用数量不能小于0");
|
||||||
}
|
}
|
||||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity());
|
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity());
|
||||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventory.getAllocationQuantity());
|
inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventory.getAllocationQuantity());
|
||||||
|
|||||||
+2
-1
@@ -78,7 +78,8 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
|||||||
if ("hz".equals(queryRule)) {
|
if ("hz".equals(queryRule)) {
|
||||||
return materialInventoryMapper.queryListByHz(materialInventoryDO);
|
return materialInventoryMapper.queryListByHz(materialInventoryDO);
|
||||||
} else if ("hzwl".equals(queryRule)) { // 货主查询
|
} else if ("hzwl".equals(queryRule)) { // 货主查询
|
||||||
return materialInventoryMapper.queryListByHzWl(materialInventoryDO);
|
return materialInventoryMapper.queryListByHz(materialInventoryDO);
|
||||||
|
// return materialInventoryMapper.queryListByHzWl(materialInventoryDO);
|
||||||
} else if ("wl".equals(queryRule)) { // 物料查询
|
} else if ("wl".equals(queryRule)) { // 物料查询
|
||||||
return materialInventoryMapper.queryListByWl(materialInventoryDO);
|
return materialInventoryMapper.queryListByWl(materialInventoryDO);
|
||||||
} else if ("kw".equals(queryRule)) {
|
} else if ("kw".equals(queryRule)) {
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<include refid="selectMaterialInventoryPo1"/>
|
<include refid="selectMaterialInventoryPo1"/>
|
||||||
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
||||||
</where>
|
</where>
|
||||||
GROUP BY a.MATERIAL_BASE_INFO_ID,a.WAREHOUSE_ID,a.STORAGE_SECTION_ID,a.STORAGE_LOCATION_ID order by sort_order, a.update_time desc
|
GROUP BY a.SHIPPER_ID,a.MATERIAL_BASE_INFO_ID,a.WAREHOUSE_ID,a.STORAGE_SECTION_ID,a.STORAGE_LOCATION_ID order by sort_order, a.update_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryListByKw" parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO" resultMap="MaterialInventoryResult">
|
<select id="queryListByKw" parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO" resultMap="MaterialInventoryResult">
|
||||||
@@ -429,30 +429,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
from material_inventory a
|
from material_inventory a
|
||||||
left join material_base_info b on a.material_base_info_id = b.material_base_info_id
|
left join material_base_info b on a.material_base_info_id = b.material_base_info_id
|
||||||
inner join (
|
inner join (
|
||||||
select material_base_info_id, warehouse_id, warehouse_code, warehouse_name,
|
select material_base_info_id, warehouse_id, warehouse_code, warehouse_name,
|
||||||
storage_section_id, storage_code, storage_name,
|
storage_section_id, storage_code, storage_name,
|
||||||
storage_location_id, storage_location_code, storage_location_name
|
storage_location_id, storage_location_code, storage_location_name
|
||||||
from (
|
from (
|
||||||
select mi.material_base_info_id, mi.warehouse_id, mi.warehouse_code, mi.warehouse_name,
|
select mi.material_base_info_id, mi.warehouse_id, mi.warehouse_code, mi.warehouse_name,
|
||||||
mi.storage_section_id, mi.storage_code, mi.storage_name,
|
mi.storage_section_id, mi.storage_code, mi.storage_name,
|
||||||
mi.storage_location_id, mi.storage_location_code, mi.storage_location_name,
|
mi.storage_location_id, mi.storage_location_code, mi.storage_location_name,
|
||||||
row_number() over (partition by mi.material_base_info_id order by mi.create_time desc, mi.material_inventory_id desc) as wl_rn
|
row_number() over (partition by mi.material_base_info_id, mi.warehouse_id order by mi.create_time desc, mi.material_inventory_id desc) as wl_rn
|
||||||
from material_inventory mi
|
from material_inventory mi
|
||||||
left join material_base_info b on mi.material_base_info_id = b.material_base_info_id
|
left join material_base_info b on mi.material_base_info_id = b.material_base_info_id
|
||||||
<where>
|
<where>
|
||||||
<include refid="selectMaterialInventoryPo1Mi"/>
|
<include refid="selectMaterialInventoryPo1Mi"/>
|
||||||
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
||||||
</where>
|
</where>
|
||||||
) wl_ranked where wl_ranked.wl_rn = 1
|
) wl_ranked where wl_ranked.wl_rn = 1
|
||||||
) loc on loc.material_base_info_id = a.material_base_info_id
|
) loc on loc.material_base_info_id = a.material_base_info_id and loc.warehouse_id = a.warehouse_id
|
||||||
<where>
|
<where>
|
||||||
<include refid="selectMaterialInventoryPo1"/>
|
<include refid="selectMaterialInventoryPo1"/>
|
||||||
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
||||||
</where>
|
</where>
|
||||||
GROUP BY a.MATERIAL_BASE_INFO_ID,
|
GROUP BY a.MATERIAL_BASE_INFO_ID, a.WAREHOUSE_ID,
|
||||||
loc.warehouse_id, loc.warehouse_code, loc.warehouse_name,
|
loc.warehouse_id, loc.warehouse_code, loc.warehouse_name,
|
||||||
loc.storage_section_id, loc.storage_code, loc.storage_name,
|
loc.storage_section_id, loc.storage_code, loc.storage_name,
|
||||||
loc.storage_location_id, loc.storage_location_code, loc.storage_location_name order by sort_order, a.update_time desc
|
loc.storage_location_id, loc.storage_location_code, loc.storage_location_name order by sort_order, a.update_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 按物料+过期日期汇总:相同物料+相同过期日期合并,不同过期日期分开 -->
|
<!-- 按物料+过期日期汇总:相同物料+相同过期日期合并,不同过期日期分开 -->
|
||||||
@@ -534,7 +534,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
a.shipper_id,
|
a.shipper_id,
|
||||||
MAX(a.shipper_code) AS shipper_code,
|
MAX(a.shipper_code) AS shipper_code,
|
||||||
MAX(a.shipper_name) AS shipper_name,
|
MAX(a.shipper_name) AS shipper_name,
|
||||||
b.material_base_info_id,
|
MAX(b.material_base_info_id) AS material_base_info_id,
|
||||||
MAX(b.material_code) AS material_code,
|
MAX(b.material_code) AS material_code,
|
||||||
MAX(b.material_name) AS material_name,
|
MAX(b.material_name) AS material_name,
|
||||||
MAX(b.SPECIFICATION_MODEL) AS SPECIFICATION_MODEL,
|
MAX(b.SPECIFICATION_MODEL) AS SPECIFICATION_MODEL,
|
||||||
@@ -551,7 +551,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
MAX(b.pack_id) AS pack_id,
|
MAX(b.pack_id) AS pack_id,
|
||||||
MAX(b.pack_code) AS pack_code,
|
MAX(b.pack_code) AS pack_code,
|
||||||
MAX(b.pack_name) AS pack_name,
|
MAX(b.pack_name) AS pack_name,
|
||||||
MAX(a.unit) AS unit,
|
MAX(a.unit) AS unit,
|
||||||
IFNULL(SUM(a.freeze_quantity), 0) AS freeze_quantity,
|
IFNULL(SUM(a.freeze_quantity), 0) AS freeze_quantity,
|
||||||
IFNULL(SUM(a.inventory_quantity), 0) AS inventory_quantity,
|
IFNULL(SUM(a.inventory_quantity), 0) AS inventory_quantity,
|
||||||
IFNULL(SUM(a.allocation_quantity), 0) AS allocation_quantity,
|
IFNULL(SUM(a.allocation_quantity), 0) AS allocation_quantity,
|
||||||
@@ -580,7 +580,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
GROUP BY a.shipper_id,
|
GROUP BY a.shipper_id,
|
||||||
b.material_base_info_id,
|
b.material_code,
|
||||||
a.warehouse_id,
|
a.warehouse_id,
|
||||||
a.organization_id, a.top_organization_id
|
a.organization_id, a.top_organization_id
|
||||||
ORDER BY sort_order, MAX(a.update_time) DESC
|
ORDER BY sort_order, MAX(a.update_time) DESC
|
||||||
@@ -596,7 +596,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<include refid="selectMaterialInventoryPo1"/>
|
<include refid="selectMaterialInventoryPo1"/>
|
||||||
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
||||||
</where>
|
</where>
|
||||||
GROUP BY a.SHIPPER_ID order by sort_order, a.update_time desc
|
GROUP BY a.SHIPPER_ID, a.WAREHOUSE_ID order by sort_order, a.update_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<resultMap type="com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryQueryListPO" id="MaterialQueryListResult">
|
<resultMap type="com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryQueryListPO" id="MaterialQueryListResult">
|
||||||
|
|||||||
Reference in New Issue
Block a user