|
|
|
@ -1,14 +1,20 @@ |
|
|
|
package com.gaotao.modules.schedule.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.gaotao.modules.schedule.entity.ProductionReportData; |
|
|
|
import com.gaotao.modules.schedule.entity.ShiftAbnormalRollReportEntity; |
|
|
|
import com.gaotao.modules.schedule.mapper.ProcedureMapper; |
|
|
|
import com.gaotao.modules.schedule.mapper.ShiftAbnormalRollReportMapper; |
|
|
|
import com.gaotao.modules.schedule.service.SchedulingService; |
|
|
|
import com.gaotao.modules.schedule.service.ShiftAbnormalRollReportService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* 异常截卷未完成产量记录Service实现 |
|
|
|
@ -21,6 +27,12 @@ public class ShiftAbnormalRollReportServiceImpl |
|
|
|
@Autowired |
|
|
|
private ShiftAbnormalRollReportMapper shiftAbnormalRollReportMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ProcedureMapper procedureMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private SchedulingService schedulingService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ShiftAbnormalRollReportEntity> getUnprocessedData(String site, String orderNo, Integer seqNo) { |
|
|
|
return shiftAbnormalRollReportMapper.selectUnprocessedData(site, orderNo, seqNo); |
|
|
|
@ -64,8 +76,79 @@ public class ShiftAbnormalRollReportServiceImpl |
|
|
|
@Transactional |
|
|
|
public void continueRoll(List<ShiftAbnormalRollReportEntity> dataList, String processedBy) { |
|
|
|
if (dataList != null && !dataList.isEmpty()) { |
|
|
|
shiftAbnormalRollReportMapper.batchUpdateByRollNos(dataList, processedBy); |
|
|
|
// 逐条更新,避免多语句SQL注入问题 |
|
|
|
for (ShiftAbnormalRollReportEntity entity : dataList) { |
|
|
|
shiftAbnormalRollReportMapper.updateSingleRow( |
|
|
|
entity.getId(), |
|
|
|
entity.getGoodQty(), |
|
|
|
entity.getDefectQty(), |
|
|
|
entity.getSurfaceLossQty(), |
|
|
|
entity.getPoorPerformanceQty(), |
|
|
|
entity.getRemark(), |
|
|
|
processedBy |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public List<Map<String, Object>> executeAbnormalContinueRoll(String site, String orderNo, Float itemNo, Integer seqNo, |
|
|
|
String batchRollNo, String rollNo, |
|
|
|
Double rollQty, String userid, String remark, |
|
|
|
List<Map<String, Object>> rowDataList) { |
|
|
|
// 1. 调用存储过程 updateWorkbenchCreateslittingrollAction |
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
params.add(site); |
|
|
|
params.add(batchRollNo); // 主卷号 |
|
|
|
params.add(rollNo); // 分卷卷号 |
|
|
|
params.add(rollQty); // 续卷数量 |
|
|
|
params.add(userid); // 操作用户 |
|
|
|
params.add(remark); // 备注 |
|
|
|
|
|
|
|
// 调用存储过程 |
|
|
|
List<Map<String, Object>> resultList = procedureMapper.getProcedureData("updateWorkbenchCreateslittingrollAction", params); |
|
|
|
|
|
|
|
// 2. 保存ProductionReport和SFDC_DefectHist(同产量报告) |
|
|
|
if (rowDataList != null && !rowDataList.isEmpty()) { |
|
|
|
List<ProductionReportData> reportList = new ArrayList<>(); |
|
|
|
for (Map<String, Object> rowData : rowDataList) { |
|
|
|
ProductionReportData report = new ProductionReportData(); |
|
|
|
report.setRowNumber(rowData.get("rowBumber") != null ? Integer.valueOf(rowData.get("rowBumber").toString()) : 0); |
|
|
|
report.setGoodQty(rowData.get("goodQty") != null ? Float.valueOf(rowData.get("goodQty").toString()) : 0f); |
|
|
|
report.setDefectQty(rowData.get("defectQty") != null ? Float.valueOf(rowData.get("defectQty").toString()) : 0f); |
|
|
|
report.setSurfaceLossQty(rowData.get("surfaceLossQty") != null ? Float.valueOf(rowData.get("surfaceLossQty").toString()) : 0f); |
|
|
|
report.setPoorPerformanceQty(rowData.get("poorPerformanceQty") != null ? Float.valueOf(rowData.get("poorPerformanceQty").toString()) : 0f); |
|
|
|
report.setTotalQty(rowData.get("totalQty") != null ? Float.valueOf(rowData.get("totalQty").toString()) : 0f); |
|
|
|
report.setRemark(rowData.get("remark") != null ? rowData.get("remark").toString() : ""); |
|
|
|
reportList.add(report); |
|
|
|
} |
|
|
|
|
|
|
|
// 调用保存方法 |
|
|
|
schedulingService.saveProductionReportAndDefect(site, orderNo, itemNo, seqNo, rollNo, userid, reportList, batchRollNo); |
|
|
|
} |
|
|
|
|
|
|
|
// 3. 构建打印数据 |
|
|
|
List<Map<String, Object>> printList = new ArrayList<>(); |
|
|
|
if (resultList != null && !resultList.isEmpty()) { |
|
|
|
for (Map<String, Object> result : resultList) { |
|
|
|
Map<String, Object> printData = new HashMap<>(); |
|
|
|
printData.put("rollNo", rollNo); |
|
|
|
printData.put("rollQty", rollQty); |
|
|
|
// 从存储过程返回结果中获取其他打印需要的数据 |
|
|
|
printData.putAll(result); |
|
|
|
printList.add(printData); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 如果存储过程没有返回数据,构建基本的打印数据 |
|
|
|
Map<String, Object> printData = new HashMap<>(); |
|
|
|
printData.put("rollNo", rollNo); |
|
|
|
printData.put("rollQty", rollQty); |
|
|
|
printData.put("batchRollNo", batchRollNo); |
|
|
|
printList.add(printData); |
|
|
|
} |
|
|
|
|
|
|
|
return printList; |
|
|
|
} |
|
|
|
} |
|
|
|
|