Browse Source

2025-12-15

过站采集-》车间工作平台->异常续卷功能
master
fengyuan_yang 3 months ago
parent
commit
65f561a4d7
  1. 72
      src/main/java/com/gaotao/modules/schedule/controller/ShiftAbnormalRollReportController.java
  2. 34
      src/main/java/com/gaotao/modules/schedule/mapper/ShiftAbnormalRollReportMapper.java
  3. 25
      src/main/java/com/gaotao/modules/schedule/service/ShiftAbnormalRollReportService.java
  4. 18
      src/main/java/com/gaotao/modules/schedule/service/impl/ShiftAbnormalRollReportServiceImpl.java
  5. 64
      src/main/resources/mapper/schedule/ShiftAbnormalRollReportMapper.xml

72
src/main/java/com/gaotao/modules/schedule/controller/ShiftAbnormalRollReportController.java

@ -127,5 +127,77 @@ public class ShiftAbnormalRollReportController {
return R.error(500, "操作失败:" + e.getMessage());
}
}
/**
* 查询卷号列表去重用于异常续卷
*/
@PostMapping("/getRollNoList")
public R getRollNoList(@RequestBody Map<String, Object> params) {
String site = (String) params.get("site");
String orderNo = (String) params.get("orderNo");
List<Map<String, Object>> list = shiftAbnormalRollReportService.getRollNoList(site, orderNo);
return R.ok()
.put("code", 0)
.put("data", list)
.put("count", list != null ? list.size() : 0);
}
/**
* 根据卷号组合查询详细数据
*/
@PostMapping("/getByRollNos")
public R getByRollNos(@RequestBody Map<String, Object> params) {
String site = (String) params.get("site");
String orderNo = (String) params.get("orderNo");
String currentRollNo = (String) params.get("currentRollNo");
String newRollNo = (String) params.get("newRollNo");
List<ShiftAbnormalRollReportEntity> list = shiftAbnormalRollReportService.getByRollNos(site, orderNo, currentRollNo, newRollNo);
return R.ok()
.put("code", 0)
.put("data", list)
.put("count", list != null ? list.size() : 0);
}
/**
* 异常续卷更新数据
*/
@PostMapping("/continueRoll")
public R continueRoll(@RequestBody Map<String, Object> params) {
try {
String processedBy = (String) params.get("processedBy");
// 获取行数据列表
@SuppressWarnings("unchecked")
List<Map<String, Object>> rowDataList = (List<Map<String, Object>>) params.get("rowDataList");
// 构建实体列表
List<ShiftAbnormalRollReportEntity> entityList = new ArrayList<>();
if (rowDataList != null) {
for (Map<String, Object> rowData : rowDataList) {
ShiftAbnormalRollReportEntity entity = new ShiftAbnormalRollReportEntity();
entity.setId(rowData.get("id") != null ? Long.valueOf(rowData.get("id").toString()) : null);
entity.setGoodQty(rowData.get("goodQty") != null ? new BigDecimal(rowData.get("goodQty").toString()) : BigDecimal.ZERO);
entity.setDefectQty(rowData.get("defectQty") != null ? new BigDecimal(rowData.get("defectQty").toString()) : BigDecimal.ZERO);
entity.setSurfaceLossQty(rowData.get("surfaceLossQty") != null ? new BigDecimal(rowData.get("surfaceLossQty").toString()) : BigDecimal.ZERO);
entity.setPoorPerformanceQty(rowData.get("poorPerformanceQty") != null ? new BigDecimal(rowData.get("poorPerformanceQty").toString()) : BigDecimal.ZERO);
entity.setRemark(rowData.get("remark") != null ? rowData.get("remark").toString() : "");
entityList.add(entity);
}
}
// 更新数据
shiftAbnormalRollReportService.continueRoll(entityList, processedBy);
return R.ok()
.put("code", 0)
.put("msg", "异常续卷数据更新成功");
} catch (Exception e) {
return R.error(500, "操作失败:" + e.getMessage());
}
}
}

34
src/main/java/com/gaotao/modules/schedule/mapper/ShiftAbnormalRollReportMapper.java

@ -59,5 +59,39 @@ public interface ShiftAbnormalRollReportMapper extends BaseMapper<ShiftAbnormalR
@Param("orderNo") String orderNo,
@Param("seqNo") Integer seqNo,
@Param("processedBy") String processedBy);
/**
* 查询卷号列表去重
* @param site 工厂
* @param orderNo 工单号
* @return 卷号列表
*/
List<java.util.Map<String, Object>> selectRollNoList(
@Param("site") String site,
@Param("orderNo") String orderNo);
/**
* 根据卷号组合查询详细数据
* @param site 工厂
* @param orderNo 工单号
* @param currentRollNo 当前卷号
* @param newRollNo 新卷号
* @return 详细数据列表
*/
List<ShiftAbnormalRollReportEntity> selectByRollNos(
@Param("site") String site,
@Param("orderNo") String orderNo,
@Param("currentRollNo") String currentRollNo,
@Param("newRollNo") String newRollNo);
/**
* 批量更新异常截卷数据续卷
* @param list 数据列表
* @param processedBy 处理人
* @return 更新的行数
*/
int batchUpdateByRollNos(
@Param("list") List<ShiftAbnormalRollReportEntity> list,
@Param("processedBy") String processedBy);
}

25
src/main/java/com/gaotao/modules/schedule/service/ShiftAbnormalRollReportService.java

@ -45,5 +45,30 @@ public interface ShiftAbnormalRollReportService extends IService<ShiftAbnormalRo
* @return 缓存数据条数
*/
int getCachedDataCount(String site, String orderNo, Integer seqNo);
/**
* 查询卷号列表去重
* @param site 工厂
* @param orderNo 工单号
* @return 卷号列表
*/
List<java.util.Map<String, Object>> getRollNoList(String site, String orderNo);
/**
* 根据卷号组合查询详细数据
* @param site 工厂
* @param orderNo 工单号
* @param currentRollNo 当前卷号
* @param newRollNo 新卷号
* @return 详细数据列表
*/
List<ShiftAbnormalRollReportEntity> getByRollNos(String site, String orderNo, String currentRollNo, String newRollNo);
/**
* 异常续卷更新数据
* @param dataList 数据列表
* @param processedBy 处理人
*/
void continueRoll(List<ShiftAbnormalRollReportEntity> dataList, String processedBy);
}

18
src/main/java/com/gaotao/modules/schedule/service/impl/ShiftAbnormalRollReportServiceImpl.java

@ -49,5 +49,23 @@ public class ShiftAbnormalRollReportServiceImpl
List<ShiftAbnormalRollReportEntity> list = shiftAbnormalRollReportMapper.selectUnprocessedData(site, orderNo, seqNo);
return list != null ? list.size() : 0;
}
@Override
public List<java.util.Map<String, Object>> getRollNoList(String site, String orderNo) {
return shiftAbnormalRollReportMapper.selectRollNoList(site, orderNo);
}
@Override
public List<ShiftAbnormalRollReportEntity> getByRollNos(String site, String orderNo, String currentRollNo, String newRollNo) {
return shiftAbnormalRollReportMapper.selectByRollNos(site, orderNo, currentRollNo, newRollNo);
}
@Override
@Transactional
public void continueRoll(List<ShiftAbnormalRollReportEntity> dataList, String processedBy) {
if (dataList != null && !dataList.isEmpty()) {
shiftAbnormalRollReportMapper.batchUpdateByRollNos(dataList, processedBy);
}
}
}

64
src/main/resources/mapper/schedule/ShiftAbnormalRollReportMapper.xml

@ -96,5 +96,69 @@
AND is_processed = 0
</update>
<!-- 查询卷号列表(去重) -->
<select id="selectRollNoList" resultType="java.util.Map">
SELECT DISTINCT
current_roll_no AS currentRollNo,
new_roll_no AS newRollNo
FROM shift_abnormal_roll_report
WHERE site = #{site}
AND order_no = #{orderNo}
AND is_processed = 0
ORDER BY current_roll_no
</select>
<!-- 根据卷号组合查询详细数据 -->
<select id="selectByRollNos" resultType="com.gaotao.modules.schedule.entity.ShiftAbnormalRollReportEntity">
SELECT
id,
site,
bu_no AS buNo,
order_no AS orderNo,
seq_no AS seqNo,
fixture_no AS fixtureNo,
shift_from AS shiftFrom,
shift_to AS shiftTo,
row_count,
roll_count AS rollCount,
row_bumber AS rowBumber,
good_qty AS goodQty,
defect_qty AS defectQty,
surface_loss_qty AS surfaceLossQty,
poor_performance_qty AS poorPerformanceQty,
remark,
created_by AS createdBy,
created_time AS createdTime,
is_processed AS isProcessed,
processed_by AS processedBy,
processed_time AS processedTime,
current_roll_no AS currentRollNo,
new_roll_no AS newRollNo,
operator_id AS operatorId,
operation_time AS operationTime
FROM shift_abnormal_roll_report
WHERE site = #{site}
AND order_no = #{orderNo}
AND current_roll_no = #{currentRollNo}
AND new_roll_no = #{newRollNo}
AND is_processed = 0
ORDER BY row_bumber ASC
</select>
<!-- 批量更新异常截卷数据(续卷) -->
<update id="batchUpdateByRollNos">
<foreach collection="list" item="item" separator=";">
UPDATE shift_abnormal_roll_report
SET good_qty = #{item.goodQty},
defect_qty = #{item.defectQty},
surface_loss_qty = #{item.surfaceLossQty},
poor_performance_qty = #{item.poorPerformanceQty},
remark = #{item.remark},
processed_by = #{processedBy},
processed_time = GETDATE()
WHERE id = #{item.id}
</foreach>
</update>
</mapper>
Loading…
Cancel
Save