同步规程同步代码和录入监测代码

This commit is contained in:
2026-05-23 19:34:52 +08:00
parent 6b58f37616
commit 35ad50a79d
29 changed files with 2357 additions and 329 deletions

View File

@@ -182,7 +182,47 @@
WHERE action_id = #{actionId}
</update>
<!-- 规程同步:获取全部有效记录的 processed_coil_ids 字符串(用于 Java 层展开) -->
<select id="selectAllProcessedCoilIdStrings" resultType="java.lang.String">
SELECT processed_coil_ids
FROM wms_coil_pending_action
WHERE del_flag = 0
AND processed_coil_ids IS NOT NULL
AND processed_coil_ids != ''
</select>
<!-- 规程同步:同时返回 processed_coil_ids 和 action_status供 Java 层展开并构建录入状态映射 -->
<select id="selectAllProcessedCoilIdsAndActionStatus" resultMap="WmsCoilPendingActionResult">
SELECT action_type, action_status, processed_coil_ids
FROM wms_coil_pending_action
WHERE del_flag = 0
AND processed_coil_ids IS NOT NULL
AND processed_coil_ids != ''
</select>
<!-- 规程同步:按 actionType 集合查询全部待操作(含未录入 action_status!=2用于构建规程同步主数据源 -->
<select id="selectPendingByActionTypes" resultMap="WmsCoilPendingActionResult">
SELECT action_id, coil_id, action_type, action_status, processed_coil_ids
FROM wms_coil_pending_action
WHERE del_flag = 0
AND action_type IN
<foreach collection="actionTypes" item="at" open="(" separator="," close=")">
#{at}
</foreach>
</select>
<!-- 规程同步:批量查找 processed_coil_ids 中包含给定 coilId 的记录(每页最多 40 个 FIND_IN_SET 条件) -->
<select id="selectActionTypeByProcessedCoilIds" resultMap="WmsCoilPendingActionResult">
SELECT action_id, action_type, processed_coil_ids
FROM wms_coil_pending_action
WHERE del_flag = 0
AND processed_coil_ids IS NOT NULL
AND (
<foreach collection="coilIds" item="id" separator=" OR ">
FIND_IN_SET(#{id}, processed_coil_ids)
</foreach>
)
</select>
</mapper>

View File

@@ -40,6 +40,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="saleName" column="sale_name"/>
<result property="coilSurfaceTreatment" column="coil_surface_treatment"/>
<result property="transferType" column="transfer_type"/>
<result property="specId" column="spec_id"/>
<result property="versionId" column="version_id"/>
</resultMap>
@@ -1097,5 +1099,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LIMIT 1
</select>
<!-- 规程同步页面:一次 SQL 返回 total/synced/unsynced 三个计数 -->
<select id="selectCountForSpecSync" resultType="java.util.Map">
SELECT COUNT(*) AS total,
SUM(CASE WHEN mc.version_id IS NOT NULL THEN 1 ELSE 0 END) AS synced,
SUM(CASE WHEN mc.version_id IS NULL THEN 1 ELSE 0 END) AS unsynced,
SUM(CASE WHEN mc.data_type = 0 THEN 1 ELSE 0 END) AS movedOn
FROM wms_material_coil mc
LEFT JOIN wms_raw_material rm ON mc.item_type = 'raw_material' AND mc.item_id = rm.raw_material_id AND rm.del_flag = 0
LEFT JOIN wms_product p ON mc.item_type = 'product' AND mc.item_id = p.product_id AND p.del_flag = 0
${ew.customSqlSegment}
</select>
</mapper>

View File

@@ -14,6 +14,15 @@
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="remark" column="remark"/>
<result property="matchEntryThickMin" column="match_entry_thick_min"/>
<result property="matchEntryThickMax" column="match_entry_thick_max"/>
<result property="matchExitThickMin" column="match_exit_thick_min"/>
<result property="matchExitThickMax" column="match_exit_thick_max"/>
<result property="matchEntryWidthMin" column="match_entry_width_min"/>
<result property="matchEntryWidthMax" column="match_entry_width_max"/>
<result property="matchExitWidthMin" column="match_exit_width_min"/>
<result property="matchExitWidthMax" column="match_exit_width_max"/>
<result property="matchSteelGrade" column="match_steel_grade"/>
</resultMap>
</mapper>