Merge branch '0.8.X' of http://49.232.154.205:10100/DeXun/klp-oa into 0.8.X
This commit is contained in:
@@ -42,6 +42,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="transferType" column="transfer_type"/>
|
||||
<result property="specId" column="spec_id"/>
|
||||
<result property="versionId" column="version_id"/>
|
||||
<result property="theoreticalThickness" column="theoretical_thickness"/>
|
||||
<result property="theoreticalLength" column="theoretical_length"/>
|
||||
<result property="chromePlateCoilNo" column="chrome_plate_coil_no"/>
|
||||
|
||||
</resultMap>
|
||||
|
||||
@@ -79,87 +82,91 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
GROUP BY w.warehouse_id, w.warehouse_name
|
||||
ORDER BY w.warehouse_id
|
||||
</select>
|
||||
<select id="selectVoPagePlus" resultType="com.klp.domain.vo.WmsMaterialCoilVo">
|
||||
SELECT
|
||||
mc.coil_id,
|
||||
mc.parent_coil_id,
|
||||
mc.export_time,
|
||||
mc.export_by,
|
||||
mc.enter_coil_no,
|
||||
mc.current_coil_no,
|
||||
mc.supplier_coil_no,
|
||||
mc.data_type,
|
||||
mc.material_type,
|
||||
mc.next_warehouse_id,
|
||||
mc.qrcode_record_id,
|
||||
mc.team,
|
||||
mc.has_merge_split,
|
||||
mc.parent_coil_nos,
|
||||
mc.item_type,
|
||||
mc.item_id,
|
||||
mc.gross_weight,
|
||||
mc.net_weight,
|
||||
mc.status,
|
||||
mc.remark,
|
||||
mc.warehouse_id,
|
||||
mc.actual_warehouse_id,
|
||||
mc.del_flag,
|
||||
mc.create_time,
|
||||
mc.update_time,
|
||||
mc.create_by,
|
||||
mc.update_by,
|
||||
mc.quality_status,
|
||||
mc.trimming_requirement,
|
||||
mc.packaging_requirement,
|
||||
mc.packing_status,
|
||||
mc.sale_id AS saleId,
|
||||
mc.length,
|
||||
mc.actual_length,
|
||||
mc.actual_width,
|
||||
mc.actual_thickness,
|
||||
mc.production_start_time,
|
||||
mc.production_end_time,
|
||||
mc.production_duration,
|
||||
mc.coil_surface_treatment,
|
||||
mc.reserved_width,
|
||||
mc.coating_type,
|
||||
mc.temper_grade,
|
||||
mc.business_purpose,
|
||||
mc.is_related_to_order,
|
||||
mc.exclusive_status,
|
||||
mc.transfer_type,
|
||||
mc.sale_name AS saleName,
|
||||
w.warehouse_name AS warehouseName,
|
||||
nw.warehouse_name AS nextWarehouseName,
|
||||
aw.actual_warehouse_name AS actualWarehouseName,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.specification
|
||||
WHEN mc.item_type = 'product' THEN p.specification
|
||||
ELSE NULL END AS specification,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.material
|
||||
WHEN mc.item_type = 'product' THEN p.material
|
||||
ELSE NULL END AS material,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.manufacturer
|
||||
WHEN mc.item_type = 'product' THEN p.manufacturer
|
||||
ELSE NULL END AS manufacturer,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.surface_treatment_desc
|
||||
WHEN mc.item_type = 'product' THEN p.surface_treatment_desc
|
||||
ELSE NULL END AS surfaceTreatmentDesc,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.zinc_layer
|
||||
WHEN mc.item_type = 'product' THEN p.zinc_layer
|
||||
ELSE NULL END AS zincLayer,
|
||||
-- 物品名称和编号(用于兼容)
|
||||
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,
|
||||
-- 异常数量统计
|
||||
COALESCE(ca.abnormal_count, 0) AS abnormalCount
|
||||
<!-- ==================== 公共 SQL 片段 ==================== -->
|
||||
<sql id="baseColumns">
|
||||
mc.coil_id,
|
||||
mc.parent_coil_id,
|
||||
mc.export_time,
|
||||
mc.export_by,
|
||||
mc.enter_coil_no,
|
||||
mc.current_coil_no,
|
||||
mc.supplier_coil_no,
|
||||
mc.data_type,
|
||||
mc.material_type,
|
||||
mc.next_warehouse_id,
|
||||
mc.qrcode_record_id,
|
||||
mc.team,
|
||||
mc.has_merge_split,
|
||||
mc.parent_coil_nos,
|
||||
mc.item_type,
|
||||
mc.item_id,
|
||||
mc.gross_weight,
|
||||
mc.net_weight,
|
||||
mc.status,
|
||||
mc.remark,
|
||||
mc.warehouse_id,
|
||||
mc.actual_warehouse_id,
|
||||
mc.del_flag,
|
||||
mc.create_time,
|
||||
mc.update_time,
|
||||
mc.create_by,
|
||||
mc.update_by,
|
||||
mc.quality_status,
|
||||
mc.trimming_requirement,
|
||||
mc.packaging_requirement,
|
||||
mc.packing_status,
|
||||
mc.sale_id AS saleId,
|
||||
mc.length,
|
||||
mc.actual_length,
|
||||
mc.actual_width,
|
||||
mc.actual_thickness,
|
||||
mc.production_start_time,
|
||||
mc.production_end_time,
|
||||
mc.production_duration,
|
||||
mc.coil_surface_treatment,
|
||||
mc.reserved_width,
|
||||
mc.coating_type,
|
||||
mc.temper_grade,
|
||||
mc.business_purpose,
|
||||
mc.is_related_to_order,
|
||||
mc.exclusive_status,
|
||||
mc.transfer_type,
|
||||
mc.theoretical_thickness,
|
||||
mc.theoretical_length,
|
||||
mc.chrome_plate_coil_no,
|
||||
mc.sale_name AS saleName,
|
||||
w.warehouse_name AS warehouseName,
|
||||
nw.warehouse_name AS nextWarehouseName,
|
||||
aw.actual_warehouse_name AS actualWarehouseName,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.specification
|
||||
WHEN mc.item_type = 'product' THEN p.specification
|
||||
ELSE NULL END AS specification,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.material
|
||||
WHEN mc.item_type = 'product' THEN p.material
|
||||
ELSE NULL END AS material,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.manufacturer
|
||||
WHEN mc.item_type = 'product' THEN p.manufacturer
|
||||
ELSE NULL END AS manufacturer,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.surface_treatment_desc
|
||||
WHEN mc.item_type = 'product' THEN p.surface_treatment_desc
|
||||
ELSE NULL END AS surfaceTreatmentDesc,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.zinc_layer
|
||||
WHEN mc.item_type = 'product' THEN p.zinc_layer
|
||||
ELSE NULL END AS zincLayer,
|
||||
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,
|
||||
COALESCE(ca.abnormal_count, 0) AS abnormalCount
|
||||
</sql>
|
||||
|
||||
<sql id="baseFrom">
|
||||
FROM wms_material_coil mc
|
||||
LEFT JOIN wms_warehouse w ON mc.warehouse_id = w.warehouse_id
|
||||
LEFT JOIN wms_warehouse nw ON mc.next_warehouse_id = nw.warehouse_id
|
||||
@@ -172,111 +179,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
WHERE del_flag = 0
|
||||
GROUP BY coil_id
|
||||
) ca ON mc.coil_id = ca.coil_id
|
||||
</sql>
|
||||
|
||||
<!-- ==================== 各场景查询 ==================== -->
|
||||
|
||||
<select id="selectVoPagePlus" resultType="com.klp.domain.vo.WmsMaterialCoilVo">
|
||||
SELECT <include refid="baseColumns"/>
|
||||
<include refid="baseFrom"/>
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
<!-- orderBy=true 专用:包含库位排序辅助字段(aw_sort_key/aw_layer_key/aw_id_key)以及父库位 join -->
|
||||
<select id="selectVoPagePlusOrderBy" resultType="com.klp.domain.vo.WmsMaterialCoilVo">
|
||||
SELECT
|
||||
mc.coil_id,
|
||||
mc.parent_coil_id,
|
||||
mc.export_time,
|
||||
mc.export_by,
|
||||
mc.enter_coil_no,
|
||||
mc.current_coil_no,
|
||||
mc.supplier_coil_no,
|
||||
mc.data_type,
|
||||
mc.material_type,
|
||||
mc.next_warehouse_id,
|
||||
mc.qrcode_record_id,
|
||||
mc.team,
|
||||
mc.has_merge_split,
|
||||
mc.parent_coil_nos,
|
||||
mc.item_type,
|
||||
mc.item_id,
|
||||
mc.gross_weight,
|
||||
mc.net_weight,
|
||||
mc.status,
|
||||
mc.remark,
|
||||
mc.warehouse_id,
|
||||
mc.actual_warehouse_id,
|
||||
mc.del_flag,
|
||||
mc.create_time,
|
||||
mc.update_time,
|
||||
mc.create_by,
|
||||
mc.update_by,
|
||||
mc.quality_status,
|
||||
mc.trimming_requirement,
|
||||
mc.packaging_requirement,
|
||||
mc.packing_status,
|
||||
mc.sale_id AS saleId,
|
||||
mc.length,
|
||||
mc.actual_length,
|
||||
mc.actual_width,
|
||||
mc.actual_thickness,
|
||||
mc.production_start_time,
|
||||
mc.production_end_time,
|
||||
mc.production_duration,
|
||||
mc.reserved_width,
|
||||
mc.coating_type,
|
||||
mc.temper_grade,
|
||||
mc.business_purpose,
|
||||
mc.is_related_to_order,
|
||||
mc.exclusive_status,
|
||||
mc.transfer_type,
|
||||
mc.sale_name AS saleName,
|
||||
su.nick_name AS saleNickName,
|
||||
w.warehouse_name AS warehouseName,
|
||||
nw.warehouse_name AS nextWarehouseName,
|
||||
aw.actual_warehouse_name AS actualWarehouseName,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.specification
|
||||
WHEN mc.item_type = 'product' THEN p.specification
|
||||
ELSE NULL END AS specification,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.material
|
||||
WHEN mc.item_type = 'product' THEN p.material
|
||||
ELSE NULL END AS material,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.manufacturer
|
||||
WHEN mc.item_type = 'product' THEN p.manufacturer
|
||||
ELSE NULL END AS manufacturer,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.surface_treatment_desc
|
||||
WHEN mc.item_type = 'product' THEN p.surface_treatment_desc
|
||||
ELSE NULL END AS surfaceTreatmentDesc,
|
||||
CASE WHEN mc.item_type = 'raw_material' THEN rm.zinc_layer
|
||||
WHEN mc.item_type = 'product' THEN p.zinc_layer
|
||||
ELSE NULL END AS zincLayer,
|
||||
-- 物品名称和编号(用于兼容)
|
||||
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,
|
||||
-- 库位排序辅助字段(用于全局交错排序,避免在 ORDER BY 中写复杂表达式触发 MP 注入拦截)
|
||||
<include refid="baseColumns"/>,
|
||||
COALESCE(CASE WHEN aw.actual_warehouse_type = 4 THEN awp.sort_no ELSE aw.sort_no END, 0) AS aw_sort_key,
|
||||
CASE WHEN aw.actual_warehouse_type = 4 THEN CAST(SUBSTRING_INDEX(aw.actual_warehouse_code, '-', -1) AS UNSIGNED) ELSE 0 END AS aw_layer_key,
|
||||
COALESCE(aw.actual_warehouse_id, 0) AS aw_id_key,
|
||||
-- 异常数量统计
|
||||
COALESCE(ca.abnormal_count, 0) AS abnormalCount
|
||||
FROM wms_material_coil mc
|
||||
LEFT JOIN wms_warehouse w ON mc.warehouse_id = w.warehouse_id
|
||||
LEFT JOIN wms_warehouse nw ON mc.next_warehouse_id = nw.warehouse_id
|
||||
LEFT JOIN wms_actual_warehouse aw ON mc.actual_warehouse_id = aw.actual_warehouse_id
|
||||
LEFT JOIN wms_actual_warehouse awp ON aw.parent_id = awp.actual_warehouse_id
|
||||
LEFT JOIN sys_user su ON mc.sale_id = su.user_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 (
|
||||
SELECT coil_id, COUNT(*) AS abnormal_count
|
||||
FROM wms_coil_abnormal
|
||||
WHERE del_flag = 0
|
||||
GROUP BY coil_id
|
||||
) ca ON mc.coil_id = ca.coil_id
|
||||
${ew.customSqlSegment}
|
||||
COALESCE(aw.actual_warehouse_id, 0) AS aw_id_key
|
||||
<include refid="baseFrom"/>
|
||||
LEFT JOIN wms_actual_warehouse awp ON aw.parent_id = awp.actual_warehouse_id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- orderByPlanDesc=true 专用:包含发货计划 join,支持按计划创建时间倒序排序 -->
|
||||
<select id="selectVoPagePlusPlanOrder" resultType="com.klp.domain.vo.WmsMaterialCoilVo">
|
||||
SELECT <include refid="baseColumns"/>
|
||||
<include refid="baseFrom"/>
|
||||
LEFT JOIN wms_delivery_waybill_detail d ON d.coil_id = mc.coil_id AND d.del_flag = 0
|
||||
LEFT JOIN wms_delivery_waybill wb ON wb.waybill_id = d.waybill_id AND wb.del_flag = 0
|
||||
LEFT JOIN wms_delivery_plan pl ON pl.plan_id = wb.plan_id AND pl.del_flag = 0
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
@@ -554,6 +486,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
mc.sale_name AS saleName,
|
||||
-- 调拨类型
|
||||
mc.transfer_type AS transferType,
|
||||
-- 理论厚度
|
||||
mc.theoretical_thickness AS theoreticalThickness,
|
||||
-- 理论长度
|
||||
mc.theoretical_length AS theoreticalLength,
|
||||
-- 镀铬卷号
|
||||
mc.chrome_plate_coil_no AS chromePlateCoilNo,
|
||||
-- 库存状态(中文显示)
|
||||
CASE
|
||||
WHEN mc.status = 0 THEN '在库'
|
||||
@@ -641,6 +579,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
mc.packing_status AS packingStatus,
|
||||
mc.sale_name AS saleName,
|
||||
mc.transfer_type AS transferType,
|
||||
mc.theoretical_thickness AS theoreticalThickness,
|
||||
mc.theoretical_length AS theoreticalLength,
|
||||
mc.chrome_plate_coil_no AS chromePlateCoilNo,
|
||||
CASE
|
||||
WHEN mc.status = 0 THEN '在库'
|
||||
WHEN mc.status = 1 THEN '已发货'
|
||||
@@ -759,6 +700,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
mc.packing_status AS packingStatus,
|
||||
mc.sale_name AS saleName,
|
||||
mc.transfer_type AS transferType,
|
||||
mc.theoretical_thickness AS theoreticalThickness,
|
||||
mc.theoretical_length AS theoreticalLength,
|
||||
mc.chrome_plate_coil_no AS chromePlateCoilNo,
|
||||
CASE
|
||||
WHEN mc.status = 0 THEN '在库'
|
||||
WHEN mc.status = 1 THEN '已发货'
|
||||
|
||||
Reference in New Issue
Block a user