非排序CBR汇报,bom_size值错误

tags/yfai-pcn-ext-v2.3
jun 6 months ago
parent 93dd002b40
commit d8335872e4

@ -570,19 +570,18 @@ public class MesWorkOrderService implements IMesWorkOrderService {
bom.setItemPartNo(mesBom.getItemPartNo());
return bom;
}));
if(MesExtEnumUtil.NOSORT_REPORT_TYPE.REPORT.getValue() == productionRecord.getReportType()){
if (MesExtEnumUtil.NOSORT_REPORT_TYPE.REPORT.getValue() == productionRecord.getReportType()) {
for (Map.Entry<MesBom, List<MesBom>> entry : map.entrySet()) {
mesProductOffLineList.add(getMesProductOffLine(productionRecord, userName, oldMesWorkOrder, mesProductVersion, entry.getValue().get(0),productionRecord.getProductSn(),false));
mesProductOffLineList.add(getMesProductOffLine(productionRecord, userName, oldMesWorkOrder, mesProductVersion, entry.getValue().get(0), productionRecord.getProductSn(), false, map.size()));
}
} else if (MesExtEnumUtil.NOSORT_REPORT_TYPE.CUSTOMER_SUPPLY_MOVE.getValue() == productionRecord.getReportType()) {
customerSupplyMove(productionRecord,oldMesWorkOrder, mesProductVersion, mesBoms, productionRecord.getProductSn(), mesProductOffLineList, mesMoveList,userName);
customerSupplyMove(productionRecord, oldMesWorkOrder, mesProductVersion, mesBoms, mesProductOffLineList, mesMoveList, userName);
} else {
LOGGER.info("汇报类型不存在");
return;
}
if(!CollectionUtils.isEmpty(mesProductOffLineList)){
mesProductOffLineList.forEach(item -> item.setBomTotalSize(mesProductOffLineList.size()));
mesProductOffLineRDao.saveAll(mesProductOffLineList);
}
@ -606,7 +605,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
}
private MesProductOffLine getMesProductOffLine(MesProductionRecord productionRecord, String userName, MesWorkOrder oldMesWorkOrder, MesProductVersion mesProductVersion, MesBom mesBom,String reportSn,boolean isItemReport) {
private MesProductOffLine getMesProductOffLine(MesProductionRecord productionRecord, String userName, MesWorkOrder oldMesWorkOrder, MesProductVersion mesProductVersion, MesBom mesBom,String reportSn,boolean isItemReport,Integer bomSize) {
MesProductOffLine newMesProductOffLine = new MesProductOffLine();
BeanUtils.copyProperties(mesBom, newMesProductOffLine, MesPcnExtConstWords.BASE_BEAN_FIELDS);
@ -656,6 +655,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
newMesProductOffLine.setOrganizeCode(oldMesWorkOrder.getOrganizeCode());
newMesProductOffLine.setDescription(productionRecord.getCompleteDateTime());
newMesProductOffLine.setProductionRecordId(productionRecord.getId().toString());
newMesProductOffLine.setBomTotalSize(bomSize);
ConvertBean.serviceModelInitialize(newMesProductOffLine, userName);
return newMesProductOffLine;
}
@ -1024,12 +1024,15 @@ public class MesWorkOrderService implements IMesWorkOrderService {
return;
}
//排序汇报
List<MesProductOffLine> mesProductOffLineList = new ArrayList<>();
List<MesMove> mesMoveList = new ArrayList<>();
List<MesJisShipping> shippingList = new ArrayList<>();
List<MesProductOffLine> mesProductOffLineList = null;
List<MesMove> mesMoveList = null;
List<MesJisShipping> shippingList = null;
boolean isReport = false;
boolean isMove = false;
for (String orderNo : model.getMesProductionRecordMap().keySet()) {
mesProductOffLineList = new ArrayList<>();
mesMoveList = new ArrayList<>();
shippingList = new ArrayList<>();
try {
//加工记录
MesProductionRecord record = model.getMesProductionRecordMap().get(orderNo).iterator().next();
@ -1067,7 +1070,8 @@ public class MesWorkOrderService implements IMesWorkOrderService {
}
//保存报工记录 试制单不报工
if (CollectionUtils.isNotEmpty(mesProductOffLineList)) {
mesProductOffLineList.forEach(item -> item.setBomTotalSize(mesProductOffLineList.size()));
List<MesProductOffLine> finalMesProductOffLineList = mesProductOffLineList;
mesProductOffLineList.forEach(item -> item.setBomTotalSize(finalMesProductOffLineList.size()));
mesProductOffLineRDao.saveAll(mesProductOffLineList);
}
//保存移库记录
@ -1091,7 +1095,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
if (e instanceof ImppBusiException) {
msg = ((ImppBusiException) e).getErrorDetail();
}
log.error("工单:{}报工失败{}", orderNo, ExceptionUtils.getStackTrace(e));
log.error("工单:{}报工失败{}", orderNo, msg);
productionRecordService.updateProductionRecord(model.getMesProductionRecordMap().get(orderNo), userName, MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_40.getValue(), msg);
}
}
@ -1413,13 +1417,16 @@ public class MesWorkOrderService implements IMesWorkOrderService {
}
}
private void customerSupplyMove(MesProductionRecord productionRecord,MesWorkOrder mesWorkOrder, MesProductVersion mesProductVersion, List<MesBom> mesBoms, String sn, List<MesProductOffLine> mesProductOffLineList, List<MesMove> mesMoveList,String userName) {
private void customerSupplyMove(MesProductionRecord productionRecord,MesWorkOrder mesWorkOrder, MesProductVersion mesProductVersion, List<MesBom> mesBoms, List<MesProductOffLine> mesProductOffLineList, List<MesMove> mesMoveList,String userName) {
boolean isItemMove;
boolean isItemReport;
MesMoveRule moveRule;
//查询零件生产组的移库规则
List<MesMoveRule> moveRules = mesMoveRuleService.findMesMoveRuleByPartProdGroupCode(mesWorkOrder.getPartProdGroupCode(), mesWorkOrder.getOrganizeCode());
if(CollectionUtils.isEmpty(moveRules)) return;
if(CollectionUtils.isEmpty(moveRules)) {
LOGGER.info("工单:{} 生产组:{}移库规则信息不存在",mesWorkOrder.getWorkOrderNo(),mesWorkOrder.getPartProdGroupCode());
return;
}
Map<String, List<MesMoveRule>> mesMoveRuleMap = moveRules.stream().filter(t -> Objects.nonNull(t.getSrcType())).collect(Collectors.groupingBy(MesMoveRule::getSrcType));
List<String> itemPartNoList = mesBoms.stream().map(MesBom::getItemPartNo).collect(Collectors.toList());
//子物料SAP下发信息
@ -1457,10 +1464,10 @@ public class MesWorkOrderService implements IMesWorkOrderService {
//bom下的子节汇报
if (!CollectionUtils.isEmpty(bomList)) {
for (MesBom bom : bomList) {
mesProductOffLineList.add(getMesProductOffLine(productionRecord, userName, mesWorkOrder, itemVersion, bom, reportSn, true));
mesProductOffLineList.add(getMesProductOffLine(productionRecord, userName, mesWorkOrder, itemVersion, bom, reportSn, true, bomList.size()));
}
} else {
mesProductOffLineList.add(getMesProductOffLine(productionRecord, userName, mesWorkOrder, itemVersion, mesBom, reportSn, true));
mesProductOffLineList.add(getMesProductOffLine(productionRecord, userName, mesWorkOrder, itemVersion, mesBom, reportSn, true, MesPcnExtConstWords.ONE));
}
}
//移库
@ -1478,7 +1485,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
//bom下的子节汇报总成也需要汇报
if (!CollectionUtils.isEmpty(mesProductOffLineList)) {
for (MesBom mesBom : mesBoms) {
mesProductOffLineList.add(getMesProductOffLine(productionRecord, userName, mesWorkOrder, mesProductVersion, mesBom, productionRecord.getProductSn(), false));
mesProductOffLineList.add(getMesProductOffLine(productionRecord, userName, mesWorkOrder, mesProductVersion, mesBom, productionRecord.getProductSn(), false,mesBoms.size()));
}
}
}

Loading…
Cancel
Save