fix(工序出站):报工物料消耗261逻辑放在扣料之后

This commit is contained in:
liaohechuan 2024-12-28 14:01:02 +08:00
parent fb7a94f3c9
commit bcf9cd3987

View File

@ -324,6 +324,7 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
ZLotMaterialCompleteTransaction resultZLotMaterialCompleteTransaction = new ZLotMaterialCompleteTransaction();
resultZLotMaterialCompleteTransaction.setResource(resrce);
resultZLotMaterialCompleteTransaction.setTransactionDate(nowTime);
resultZLotMaterialCompleteTransaction.setUserWorkShift(operationOutDTO.getUserWorkShift());
// 通过资源查询自定义字段完工线边仓存储位置
CustomFields storageLocationCustomFields = customFieldsService.getOne(Wrappers.<CustomFields>lambdaQuery()
.eq(CustomFields::getSite, site)
@ -549,7 +550,7 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
}
// 2:物料消耗
List<OperationOutMaterialDTO> sourceMasterLotList = this.itemConsume(site, shopOrder, operationBo, group, resrceBo, resrce, operation, user, nowTime, ef1List, operationOutDTO.getEqpCombineFeeding());
List<OperationOutMaterialDTO> sourceMasterLotList = this.itemConsume(site, shopOrder, operationBo, group, resrceBo, resrce, operation, user, nowTime, ef1List, operationOutDTO.getEqpCombineFeeding(), resultZLotMaterialCompleteTransaction);
// 来源母批
String sourceMasterLot = null;
if (CollectionUtils.isNotEmpty(sourceMasterLotList)) {
@ -586,7 +587,7 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
// 5:末工序需要报工
if (Objects.equals("E", jsonObject.get("endOp"))) {
BigDecimal outQty = this.bgStorage(group, resultZLotMaterialCompleteTransaction, site, shopOrderObj, resrce, operationOutDTO.getRollType(), shopOrder, operationOutDTO.getUserWorkShift(), operation);
BigDecimal outQty = this.bgStorage(group, resultZLotMaterialCompleteTransaction, site, shopOrderObj, resrce, operationOutDTO.getRollType(), shopOrder, operation);
sumQtyDone = sumQtyDone.add(outQty);
}
@ -594,7 +595,7 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
// 海门特殊场景,副产品需要创建库存
for (OperationOutListDTO operationOutListDTO : group) {
if (Objects.equals("B", operationOutListDTO.getBomComponentType())) {
BigDecimal outQty = this.bgBStorage(operationOutListDTO, resultZLotMaterialCompleteTransaction, site, shopOrderObj, resrce, operationOutDTO.getRollType(), shopOrder, operationOutDTO.getUserWorkShift(), operation);
BigDecimal outQty = this.bgBStorage(operationOutListDTO, resultZLotMaterialCompleteTransaction, site, shopOrderObj, resrce, operationOutDTO.getRollType(), shopOrder, operation);
sumQtyDone = sumQtyDone.add(outQty);
}
}
@ -647,9 +648,10 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
* @param nowTime
* @param ef1List
* @param eqpCombineFeeding
* @param resultZLotMaterialCompleteTransaction
*/
private List<OperationOutMaterialDTO> itemConsume(String site, String shopOrder, String operationBo, List<OperationOutListDTO> group, String resrceBo, String resrce,
String operation, String user, LocalDateTime nowTime, List<FastCodeDetail> ef1List, String eqpCombineFeeding) {
String operation, String user, LocalDateTime nowTime, List<FastCodeDetail> ef1List, String eqpCombineFeeding, ZLotMaterialCompleteTransaction resultZLotMaterialCompleteTransaction) {
// 来源母批和膜卷类型
List<OperationOutMaterialDTO> sourceMasterLotList = new ArrayList<>();
// 需要删除的上料记录
@ -831,6 +833,10 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
// 保存生产批用料履历
if (CollectionUtils.isNotEmpty(lotMaterialList)) {
lotMaterialService.saveBatch(lotMaterialList);
for (OperationOutListDTO operationOutListDTO : group) {
// 报工物料消耗261,这里并不呼叫SAP,只是将数据存储到我们自己的数据表
zLotMaterialConsumptionTransactionService.saveMaterialConsumptionData(site, operationOutListDTO.getLotNo(), resultZLotMaterialCompleteTransaction);
}
}
return sourceMasterLotList;
@ -846,10 +852,10 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
* @param resrce
* @param rollType
* @param shopOrder
* @param userWorkShift
* @param operation
*/
private BigDecimal bgStorage(List<OperationOutListDTO> group, ZLotMaterialCompleteTransaction resultZLotMaterialCompleteTransaction,
String site, ShopOrder shopOrderObj, String resrce, String rollType, String shopOrder, String userWorkShift, String operation) {
String site, ShopOrder shopOrderObj, String resrce, String rollType, String shopOrder, String operation) {
if (StrUtil.isBlank(resultZLotMaterialCompleteTransaction.getFabNo())) {
throw BusinessException.build("根据设备【" + resrce + "】未查询到车间!");
}
@ -899,7 +905,6 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
resultZLotMaterialCompleteTransaction.setMainQty(operationOutListDTO.getOutMeter());
resultZLotMaterialCompleteTransaction.setSubUom(operationOutListDTO.getUnitAuxiliary());
resultZLotMaterialCompleteTransaction.setSubQty(operationOutListDTO.getOutWeight());
resultZLotMaterialCompleteTransaction.setUserWorkShift(userWorkShift);
resultZLotMaterialCompleteTransaction.setSoNo(salesOrder);
resultZLotMaterialCompleteTransaction.setSoLineNo(salesOrderLine);
resultZLotMaterialCompleteTransaction.setInventoryMark(specialRemark);
@ -932,8 +937,8 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
throw BusinessException.build("MES:联系IT维护设备【"+resrce+"】对应的线边仓【"+resultZLotMaterialCompleteTransaction.getStorageLocation()+"】对应的货格");
}
createInventory(bomItem, operationOutListDTO.getLotNo(), rollType, operationOutListDTO.getOutMeter(), resultZLotMaterialCompleteTransaction, sapBatchNo, operationOutListDTO.getInspectionLevel(), inventoryStatus, parentInventoryBo);
// 报工物料消耗261,这里并不呼叫SAP,只是将数据存储到我们自己的数据表
zLotMaterialConsumptionTransactionService.saveMaterialConsumptionData(site, operationOutListDTO.getLotNo(), resultZLotMaterialCompleteTransaction);
// // 报工物料消耗261,这里并不呼叫SAP,只是将数据存储到我们自己的数据表
// zLotMaterialConsumptionTransactionService.saveMaterialConsumptionData(site, operationOutListDTO.getLotNo(), resultZLotMaterialCompleteTransaction);
// 生产工单报工
// zShoporderStatisticsTransactionService.saveSoStatisticsTransData(site, operation, resrce, workCenter, shopOrder);
// 汇总工单的完工数量
@ -952,11 +957,10 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
* @param resrce
* @param rollType
* @param shopOrder
* @param userWorkShift
* @param operation
*/
private BigDecimal bgBStorage(OperationOutListDTO operationOutListDTO, ZLotMaterialCompleteTransaction resultZLotMaterialCompleteTransaction,
String site, ShopOrder shopOrderObj, String resrce, String rollType, String shopOrder, String userWorkShift, String operation) {
String site, ShopOrder shopOrderObj, String resrce, String rollType, String shopOrder, String operation) {
if (StrUtil.isBlank(resultZLotMaterialCompleteTransaction.getFabNo())) {
throw BusinessException.build("根据设备【" + resrce + "】未查询到车间!");
}
@ -990,7 +994,6 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
resultZLotMaterialCompleteTransaction.setSoNo(salesOrder);
resultZLotMaterialCompleteTransaction.setSoLineNo(salesOrderLine);
resultZLotMaterialCompleteTransaction.setInventoryMark(specialRemark);
resultZLotMaterialCompleteTransaction.setUserWorkShift(userWorkShift);
// 先完工入库获取到SAP的批次号再回写到仓库表
String sapBatchNo = zLotMaterialCompleteTransactionService.saveMaterialCompleteData(item, operationOutListDTO.getLotNo(), shopOrder, resultZLotMaterialCompleteTransaction);
@ -1036,8 +1039,8 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
throw BusinessException.build("MES:联系IT维护设备【"+resrce+"】对应的线边仓【"+resultZLotMaterialCompleteTransaction.getStorageLocation()+"】对应的货格");
}
createInventory(bomItem, operationOutListDTO.getLotNo(), rollType, operationOutListDTO.getOutMeter(), resultZLotMaterialCompleteTransaction, sapBatchNo, operationOutListDTO.getInspectionLevel(), inventoryStatus, parentInventoryBo);
// 报工物料消耗261,这里并不呼叫SAP,只是将数据存储到我们自己的数据表
zLotMaterialConsumptionTransactionService.saveMaterialConsumptionData(site, operationOutListDTO.getLotNo(), resultZLotMaterialCompleteTransaction);
// // 报工物料消耗261,这里并不呼叫SAP,只是将数据存储到我们自己的数据表
// zLotMaterialConsumptionTransactionService.saveMaterialConsumptionData(site, operationOutListDTO.getLotNo(), resultZLotMaterialCompleteTransaction);
// 生产工单报工
// zShoporderStatisticsTransactionService.saveSoStatisticsTransData(site, operation, resrce, workCenter, shopOrder);
// 汇总工单的完工数量
@ -1117,7 +1120,7 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
);
// 末工序报工入库
if (customFields != null && "E".equals(customFields.getFieldValue())) {
outQtyDone = this.bgStorage(group, resultZLotMaterialCompleteTransaction, site, shopOrderObj, resrce, operationOutDTO.getRollType(), shopOrder, operationOutDTO.getUserWorkShift(), autoOperationOutDTO.getOperation());
outQtyDone = this.bgStorage(group, resultZLotMaterialCompleteTransaction, site, shopOrderObj, resrce, operationOutDTO.getRollType(), shopOrder, autoOperationOutDTO.getOperation());
}
// 生产批调整数据
@ -1486,7 +1489,7 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
operationOutListDTOS.add(operationOutListDTO);
// 2UP:物料消耗
List<OperationOutMaterialDTO> sourceMasterLotList = this.itemConsume(site, shopOrder, operationBoUp, operationOutListDTOS, resrceBoUp, resrceUp, operationUp, user, nowTime, ef1List, operationOutDTO.getEqpCombineFeeding());
List<OperationOutMaterialDTO> sourceMasterLotList = this.itemConsume(site, shopOrder, operationBoUp, operationOutListDTOS, resrceBoUp, resrceUp, operationUp, user, nowTime, ef1List, operationOutDTO.getEqpCombineFeeding(), resultZLotMaterialCompleteTransaction);
// 来源母批
String sourceMasterLot = null;
if (CollectionUtils.isNotEmpty(sourceMasterLotList)) {