Browse Source

2024-11-15

master
fengyuan_yang 1 year ago
parent
commit
4cc6dd806b
  1. 2
      src/main/java/com/spring/modules/part/mapper/RoutingManagementMapper.java
  2. 30
      src/main/java/com/spring/modules/part/service/impl/RoutingManagementServiceImpl.java
  3. 6
      src/main/java/com/spring/modules/part/task/PartRelatedTask.java
  4. 37
      src/main/resources/mapper/part/PartInformationMapper.xml
  5. 242
      src/main/resources/mapper/part/RoutingManagementMapper.xml

2
src/main/java/com/spring/modules/part/mapper/RoutingManagementMapper.java

@ -177,7 +177,7 @@ public interface RoutingManagementMapper extends BaseMapper<RoutingHeaderEntity>
void syncSaveWorkCenter(List<WorkCenter> subList);
void syncUpdateWorkCenter(WorkCenter toUpdate);
void syncUpdateWorkCenter(List<WorkCenter> toUpdate);
RoutingComponentEntity getRoutingComponentRowKeyAndVersion(@Param("operationId") Integer operationId);

30
src/main/java/com/spring/modules/part/service/impl/RoutingManagementServiceImpl.java

@ -1392,15 +1392,12 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
// 修改
if (!toUpdate.isEmpty()) {
// 分批修改
int batchSize = 200; // 假设每批100条记录
int batchSize = 100; // 假设每批100条记录
for (int i = 0; i < toUpdate.size(); i += batchSize) {
int end = Math.min(i + batchSize, toUpdate.size());
List<LocationInformationEntity> subList = toUpdate.subList(i, end);
routingManagementMapper.syncUpdateLocation(subList);
}
// for (LocationInformationEntity locationInformationEntity : toUpdate) {
// routingManagementMapper.syncUpdateLocation(locationInformationEntity);
// }
}
}
@ -1470,15 +1467,12 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
// 修改
if (!toUpdate.isEmpty()) {
// 分批修改
int batchSize = 200; // 假设每批100条记录
int batchSize = 100; // 假设每批100条记录
for (int i = 0; i < toUpdate.size(); i += batchSize) {
int end = Math.min(i + batchSize, toUpdate.size());
List<PersonnelLevel> subList = toUpdate.subList(i, end);
routingManagementMapper.syncUpdateLaborClass(subList);
}
// for (PersonnelLevel personnelLevel : toUpdate) {
// routingManagementMapper.syncUpdateLaborClass(personnelLevel);
// }
}
}
@ -1538,7 +1532,7 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
// 新增
if (!toAdd.isEmpty()) {
// 分批插入
int batchSize = 100; // 假设每批100条记录
int batchSize = 50; // 假设每批100条记录
for (int i = 0; i < toAdd.size(); i += batchSize) {
int end = Math.min(i + batchSize, toAdd.size());
List<WorkCenter> subList = toAdd.subList(i, end);
@ -1547,16 +1541,16 @@ public class RoutingManagementServiceImpl extends ServiceImpl<RoutingManagementM
}
// 修改
if (!toUpdate.isEmpty()) {
// // 分批修改
// int batchSize = 100; // 假设每批100条记录
// for (int i = 0; i < toUpdate.size(); i += batchSize) {
// int end = Math.min(i + batchSize, toUpdate.size());
// List<WorkCenter> subList = toUpdate.subList(i, end);
//
// }
for (WorkCenter workCenter : toUpdate) {
routingManagementMapper.syncUpdateWorkCenter(workCenter);
// 分批修改
int batchSize = 50; // 假设每批100条记录
for (int i = 0; i < toUpdate.size(); i += batchSize) {
int end = Math.min(i + batchSize, toUpdate.size());
List<WorkCenter> subList = toUpdate.subList(i, end);
routingManagementMapper.syncUpdateWorkCenter(subList);
}
// for (WorkCenter workCenter : toUpdate) {
// routingManagementMapper.syncUpdateWorkCenter(workCenter);
// }
}
}

6
src/main/java/com/spring/modules/part/task/PartRelatedTask.java

@ -49,9 +49,9 @@ public class PartRelatedTask {
laborClassVo.setSiteCon(siteCon);
routingManagementService.syncLaborClassToPLM(laborClassVo);
// 同步加工中心
WorkCenterVo workCenterVo = new WorkCenterVo();
workCenterVo.setSiteCon(siteCon);
routingManagementService.syncWorkCenterToPLM(workCenterVo);
// WorkCenterVo workCenterVo = new WorkCenterVo();
// workCenterVo.setSiteCon(siteCon);
// routingManagementService.syncWorkCenterToPLM(workCenterVo);
// 同步unitValue
InventoryPartUnitCostSumVo unitCostVo = new InventoryPartUnitCostSumVo();
unitCostVo.setSiteCon(siteCon);

37
src/main/resources/mapper/part/PartInformationMapper.xml

@ -2007,16 +2007,35 @@
<!-- 批量更新 -->
<update id="syncUpdateUnitValue" parameterType="java.util.List">
UPDATE inventory_part_unit_cost_sum SET
<foreach item="item" index="index" collection="list" separator=",">
inventory_value = #{item.inventoryValue},
lot_batch_no = #{item.lotBatchNo},
serial_no = #{item.serialNo},
ifs_row_version = #{item.ifsRowVersion}
UPDATE inventory_part_unit_cost_sum
SET
inventory_value = CASE
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN site = #{item.site} AND part_no = #{item.partNo} AND configuration_id = #{item.configurationId} THEN #{item.inventoryValue}
</foreach>
WHERE
<foreach item="item" index="index" collection="list" open="(" separator=") OR (" close=")">
site = #{item.site} and part_no = #{item.partNo} and configuration_id = #{item.configurationId}
ELSE inventory_value
END,
lot_batch_no = CASE
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN site = #{item.site} AND part_no = #{item.partNo} AND configuration_id = #{item.configurationId} THEN #{item.lotBatchNo}
</foreach>
ELSE lot_batch_no
END,
serial_no = CASE
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN site = #{item.site} AND part_no = #{item.partNo} AND configuration_id = #{item.configurationId} THEN #{item.serialNo}
</foreach>
ELSE serial_no
END,
ifs_row_version = CASE
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN site = #{item.site} AND part_no = #{item.partNo} AND configuration_id = #{item.configurationId} THEN #{item.ifsRowVersion}
</foreach>
ELSE ifs_row_version
END
WHERE (site, part_no, configuration_id) IN
<foreach item="item" index="index" collection="list" open="(" separator="),(" close=")">
#{item.site}, #{item.partNo}, #{item.configurationId}
</foreach>
</update>
</mapper>

242
src/main/resources/mapper/part/RoutingManagementMapper.xml

@ -1174,18 +1174,43 @@
<!-- 批量更新 -->
<update id="syncUpdateLocation" parameterType="java.util.List">
UPDATE location SET
<foreach item="item" index="index" collection="list" separator=",">
location_name = #{item.locationName},
active = #{item.active},
warehouse_id = #{item.warehouseId},
location_type = #{item.locationType},
ifs_row_version = #{item.ifsRowVersion}
UPDATE location
SET
location_name = CASE location_id
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.locationId} THEN #{item.locationName}
</foreach>
WHERE
<foreach item="item" index="index" collection="list" open="(" separator=") OR (" close=")">
location_id = #{item.locationId} AND site = #{item.site}
ELSE location_name
END,
active = CASE location_id
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.locationId} THEN #{item.active}
</foreach>
ELSE active
END,
warehouse_id = CASE location_id
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.locationId} THEN #{item.warehouseId}
</foreach>
ELSE warehouse_id
END,
location_type = CASE location_id
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.locationId} THEN #{item.locationType}
</foreach>
ELSE location_type
END,
ifs_row_version = CASE location_id
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.locationId} THEN #{item.ifsRowVersion}
</foreach>
ELSE ifs_row_version
END
WHERE location_id IN
<foreach item="item" index="index" collection="list" open="(" close=")" separator=",">
#{item.locationId}
</foreach>
AND site = #{list[0].site}
</update>
<!-- &lt;!&ndash; 批量更新 &ndash;&gt;-->
@ -1233,17 +1258,37 @@
<!-- 批量更新 -->
<update id="syncUpdateLaborClass" parameterType="java.util.List">
UPDATE labor_class SET
<foreach item="item" index="index" collection="list" separator=",">
level_desc = #{item.levelDesc},
active = #{item.active},
level_cost = #{item.levelCost},
ifs_row_version = #{item.ifsRowVersion}
UPDATE labor_class
SET
level_desc = CASE level_id
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.levelId} THEN #{item.levelDesc}
</foreach>
WHERE
<foreach item="item" index="index" collection="list" open="(" separator=") OR (" close=")">
level_id = #{item.levelId} AND site = #{item.site}
ELSE level_desc
END,
active = CASE level_id
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.levelId} THEN #{item.active}
</foreach>
ELSE active
END,
level_cost = CASE level_id
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.levelId} THEN #{item.levelCost}
</foreach>
ELSE level_cost
END,
ifs_row_version = CASE level_id
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.levelId} THEN #{item.ifsRowVersion}
</foreach>
ELSE ifs_row_version
END
WHERE level_id IN
<foreach item="item" index="index" collection="list" open="(" close=")" separator=",">
#{item.levelId}
</foreach>
AND site = #{list[0].site}
</update>
<!-- &lt;!&ndash; 批量更新 &ndash;&gt;-->
@ -1301,51 +1346,126 @@
</foreach>
</insert>
<!-- 批量更新 -->
<update id="syncUpdateWorkCenter" parameterType="java.util.List">
UPDATE work_center
SET
work_center_desc = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.workCenterDesc}
</foreach>
ELSE work_center_desc
END,
work_center_type_db = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.workCenterTypeDB}
</foreach>
ELSE work_center_type_db
END,
work_center_type = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.workCenterType}
</foreach>
ELSE work_center_type
END,
average_capacity = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.averageCapacity,jdbcType=DECIMAL}
</foreach>
ELSE average_capacity
END,
efficiency = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.efficiency,jdbcType=DECIMAL}
</foreach>
ELSE efficiency
END,
utilization = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.utilization,jdbcType=DECIMAL}
</foreach>
ELSE utilization
END,
capacity_type_db = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.capacityTypeDB}
</foreach>
ELSE capacity_type_db
END,
capacity_type = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.capacityType}
</foreach>
ELSE capacity_type
END,
um_id = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.umId}
</foreach>
ELSE um_id
END,
active = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.active}
</foreach>
ELSE active
END,
remark = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.remark}
</foreach>
ELSE remark
END,
pro_line_no = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.proLineNo}
</foreach>
ELSE pro_line_no
END,
can_create_new_roll_flag = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.canCreateNewRollFlag}
</foreach>
ELSE can_create_new_roll_flag
END,
need_setup_flag = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.needSetupFlag}
</foreach>
ELSE need_setup_flag
END,
ifs_row_version = CASE work_center_no
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
WHEN #{item.workCenterNo} THEN #{item.ifsRowVersion}
</foreach>
ELSE ifs_row_version
END
WHERE work_center_no IN
<foreach item="item" index="index" collection="list" open="(" close=")" separator=",">
#{item.workCenterNo}
</foreach>
AND site = #{list[0].site}
</update>
<!-- &lt;!&ndash; 批量更新 &ndash;&gt;-->
<!-- <update id="syncUpdateWorkCenter" parameterType="java.util.List">-->
<!-- <update id="syncUpdateWorkCenter" parameterType="WorkCenter">-->
<!-- UPDATE work_center SET-->
<!-- <foreach item="item" index="index" collection="list" separator=",">-->
<!-- work_center_desc = #{item.workCenterDesc},-->
<!-- work_center_type_db = #{item.workCenterTypeDB},-->
<!-- work_center_type = #{item.workCenterType},-->
<!-- average_capacity = #{item.averageCapacity,jdbcType=DECIMAL},-->
<!-- efficiency = #{item.efficiency,jdbcType=DECIMAL},-->
<!-- utilization = #{item.utilization,jdbcType=DECIMAL},-->
<!-- capacity_type_db = #{item.capacityTypeDB},-->
<!-- capacity_type = #{item.capacityType},-->
<!-- um_id = #{item.umId},-->
<!-- active = #{item.active},-->
<!-- remark = #{item.remark},-->
<!-- pro_line_no = #{item.proLineNo},-->
<!-- can_create_new_roll_flag = #{item.canCreateNewRollFlag},-->
<!-- need_setup_flag = #{item.needSetupFlag},-->
<!-- ifs_row_version = #{item.ifsRowVersion}-->
<!-- </foreach>-->
<!-- WHERE-->
<!-- <foreach item="item" index="index" collection="list" open="(" separator=") OR (" close=")">-->
<!-- work_center_no = #{item.workCenterNo} AND site = #{item.site}-->
<!-- </foreach>-->
<!-- work_center_desc = #{workCenterDesc},-->
<!-- work_center_type_db = #{workCenterTypeDB},-->
<!-- work_center_type = #{workCenterType},-->
<!-- average_capacity = #{averageCapacity,jdbcType=DECIMAL},-->
<!-- efficiency = #{efficiency,jdbcType=DECIMAL},-->
<!-- utilization = #{utilization,jdbcType=DECIMAL},-->
<!-- capacity_type_db = #{capacityTypeDB},-->
<!-- capacity_type = #{capacityType},-->
<!-- um_id = #{umId},-->
<!-- active = #{active},-->
<!-- remark = #{remark},-->
<!-- pro_line_no = #{proLineNo},-->
<!-- can_create_new_roll_flag = #{canCreateNewRollFlag},-->
<!-- need_setup_flag = #{needSetupFlag},-->
<!-- ifs_row_version = #{ifsRowVersion}-->
<!-- WHERE work_center_no = #{workCenterNo} AND site = #{site}-->
<!-- </update>-->
<!-- 批量更新 -->
<update id="syncUpdateWorkCenter" parameterType="WorkCenter">
UPDATE work_center SET
work_center_desc = #{workCenterDesc},
work_center_type_db = #{workCenterTypeDB},
work_center_type = #{workCenterType},
average_capacity = #{averageCapacity,jdbcType=DECIMAL},
efficiency = #{efficiency,jdbcType=DECIMAL},
utilization = #{utilization,jdbcType=DECIMAL},
capacity_type_db = #{capacityTypeDB},
capacity_type = #{capacityType},
um_id = #{umId},
active = #{active},
remark = #{remark},
pro_line_no = #{proLineNo},
can_create_new_roll_flag = #{canCreateNewRollFlag},
need_setup_flag = #{needSetupFlag},
ifs_row_version = #{ifsRowVersion}
WHERE work_center_no = #{workCenterNo} AND site = #{site}
</update>
<select id="getRoutingComponentRowKeyAndVersion" resultType="RoutingComponentEntity">
select

Loading…
Cancel
Save