Merge remote-tracking branch 'origin/0.8.X' into 0.8.X
This commit is contained in:
@@ -68,7 +68,8 @@ public class WmsStockServiceImpl implements IWmsStockService {
|
||||
// 固定条件:未删除的现存数据
|
||||
qw.eq("mc.del_flag", 0);
|
||||
qw.eq("mc.data_type", 1);
|
||||
|
||||
qw.eq("mc.status", 0);
|
||||
qw.in("mc.material_type", Arrays.asList("成品", "原料"));
|
||||
// 处理仓库ID查询,支持递归查询子节点
|
||||
if (bo.getActualWarehouseId() != null) {
|
||||
List<Long> warehouseIds = getActualWarehouseIdsWithChildren(bo.getActualWarehouseId());
|
||||
@@ -82,6 +83,7 @@ public class WmsStockServiceImpl implements IWmsStockService {
|
||||
qw.eq(bo.getItemId() != null, "mc.item_id", bo.getItemId());
|
||||
qw.like(StringUtils.isNotBlank(bo.getBatchNo()), "mc.enter_coil_no", bo.getBatchNo());
|
||||
|
||||
|
||||
// 使用 groupBy 进行分组
|
||||
qw.groupBy(
|
||||
"mc.actual_warehouse_id",
|
||||
|
||||
@@ -51,6 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
LEFT JOIN wms_material_coil mc ON w.warehouse_id = mc.warehouse_id
|
||||
AND mc.data_type = 1
|
||||
AND mc.del_flag = '0'
|
||||
and (mc.material_type='成品' or mc.material_type='原料')
|
||||
and mc.status!=1
|
||||
WHERE w.del_flag = '0'
|
||||
<if test="itemType != null and itemType != ''">
|
||||
AND mc.item_type = #{itemType}
|
||||
@@ -103,12 +105,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
w.warehouse_name,
|
||||
COUNT(mc.coil_id) as coil_count,
|
||||
COALESCE(SUM(mc.gross_weight), 0) as total_gross_weight,
|
||||
COALESCE(SUM(mc.net_weight), 0) as total_net_weight
|
||||
COALESCE(SUM(mc.net_weight), 0) as total_net_weight,
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_name
|
||||
WHEN mc.item_type = 'product' THEN p.product_name
|
||||
ELSE NULL
|
||||
END as itemName,
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_code
|
||||
WHEN mc.item_type = 'product' THEN p.product_code
|
||||
ELSE NULL
|
||||
END as itemCode
|
||||
FROM wms_material_coil mc
|
||||
LEFT JOIN wms_warehouse w ON mc.warehouse_id = w.warehouse_id
|
||||
LEFT JOIN wms_raw_material rm ON mc.item_type = 'raw_material' AND mc.item_id = rm.raw_material_id
|
||||
LEFT JOIN wms_product p ON mc.item_type = 'product' AND mc.item_id = p.product_id
|
||||
WHERE mc.data_type = 1
|
||||
AND mc.del_flag = '0'
|
||||
AND (w.del_flag = '0' OR w.del_flag IS NULL)
|
||||
and (mc.material_type='成品' or mc.material_type='原料')
|
||||
and mc.status!=1
|
||||
<if test="itemType != null and itemType != ''">
|
||||
AND mc.item_type = #{itemType}
|
||||
</if>
|
||||
@@ -123,17 +139,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
w.warehouse_name AS warehouseName,
|
||||
aw.warehouse_name AS actualWarehouseName,
|
||||
CASE
|
||||
WHEN mc.item_type = 'row_material' THEN rm.raw_material_name
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_name
|
||||
WHEN mc.item_type = 'product' THEN p.product_name
|
||||
ELSE NULL
|
||||
END as itemName,
|
||||
CASE
|
||||
WHEN mc.item_type = 'row_material' THEN rm.raw_material_code
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_code
|
||||
WHEN mc.item_type = 'product' THEN p.product_code
|
||||
ELSE NULL
|
||||
END as itemCode
|
||||
FROM wms_material_coil mc
|
||||
LEFT JOIN wms_raw_material rm ON mc.item_type = 'row_material' AND mc.item_id = rm.raw_material_id
|
||||
LEFT JOIN wms_raw_material rm ON mc.item_type = 'raw_material' AND mc.item_id = rm.raw_material_id
|
||||
LEFT JOIN wms_product p ON mc.item_type = 'product' AND mc.item_id = p.product_id
|
||||
LEFT JOIN wms_warehouse w ON mc.warehouse_id = w.warehouse_id
|
||||
LEFT JOIN wms_actual_warehouse aw ON mc.actual_warehouse_id = aw.actual_warehouse_id
|
||||
@@ -150,6 +166,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
LEFT JOIN wms_material_coil mc ON w.actual_warehouse_id = mc.actual_warehouse_id
|
||||
AND mc.data_type = 1
|
||||
AND mc.del_flag = '0'
|
||||
and (mc.material_type='成品' or mc.material_type='原料')
|
||||
and mc.status!=1
|
||||
WHERE w.del_flag = '0'
|
||||
<if test="itemType != null and itemType != ''">
|
||||
AND mc.item_type = #{itemType}
|
||||
|
||||
Reference in New Issue
Block a user