merge dev 冲突解决

tags/yfai-pcn-ext-v2.3
王杰 7 months ago
commit 838d1f82db

@ -415,6 +415,14 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
} }
if (Objects.isNull(srcLocateNo)) { if (Objects.isNull(srcLocateNo)) {
srcLocateNo = configService.getCfgValue(org, "LGORT"); srcLocateNo = configService.getCfgValue(org, "LGORT");
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean);
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
if (version != null) {
srcLocateNo = version.getShipInventoryPoint();
}
} }
if (model.getOptType() != 2) { if (model.getOptType() != 2) {
//移库 //移库
@ -480,7 +488,17 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
//移库 //移库
if (model.getOptType() != 2) { if (model.getOptType() != 2) {
MesMove move = createMove(model, configService.getCfgValue(org, "LGORT"), configService.getCfgValue(org, "UMLGO"), org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); String srcLocateNo = configService.getCfgValue(org, "LGORT");
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean);
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
if (version != null) {
srcLocateNo = version.getShipInventoryPoint();
}
MesMove move = createMove(model, srcLocateNo, configService.getCfgValue(org, "UMLGO"), org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode());
moveRepository.save(move); moveRepository.save(move);
} }
@ -734,10 +752,10 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
* @return * @return
*/ */
private MesMove createMove(MesPartInspectionInputModel model, String source, String target, String org, String workCenterCode) { private MesMove createMove(MesPartInspectionInputModel model, String source, String target, String org, String workCenterCode) {
if (StringUtils.isEmpty(model.getUserInfo())) model.setUserInfo("系统");
GenSerialNoModel serialNoModel = new GenSerialNoModel("INPUT_DEFECT_ZRSUM"); GenSerialNoModel serialNoModel = new GenSerialNoModel("INPUT_DEFECT_ZRSUM");
serialNoModel.setPartNo(model.getPart().getPartNo()); serialNoModel.setPartNo(model.getPart().getPartNo());
// ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, AuthUtil.getSessionUser().getUserName(), org, 1); ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, model.getUserInfo(), org, 1);
ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, "系统", org, 1);
String zrsum = ""; String zrsum = "";
if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) { if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) {
zrsum = (rb.getResultList().get(0)).toString(); zrsum = (rb.getResultList().get(0)).toString();
@ -758,8 +776,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
move.setMoveType(MesExtEnumUtil.MOVE_TYPE.SUSPICIOUS_MOVE.getValue()); move.setMoveType(MesExtEnumUtil.MOVE_TYPE.SUSPICIOUS_MOVE.getValue());
move.setProductSn(model.getSn()); move.setProductSn(model.getSn());
move.setWorkCenter(prodOrgExtService.getErpWorkCenterCode(org, workCenterCode)); move.setWorkCenter(prodOrgExtService.getErpWorkCenterCode(org, workCenterCode));
// ConvertBean.serviceModelInitialize(move, AuthUtil.getSessionUser().getUserName()); ConvertBean.serviceModelInitialize(move, model.getUserInfo());
ConvertBean.serviceModelInitialize(move, "系统");
return move; return move;
} }
@ -935,7 +952,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
private List<MesPartInspectionDetail> checkPartInspectionDetail(MesPartInspection partInspection, String org) { private List<MesPartInspectionDetail> checkPartInspectionDetail(MesPartInspection partInspection, String org) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
DdlPreparedPack.getNumEqualPack(partInspection.getId(), "pid", packBean); DdlPreparedPack.getNumEqualPack(partInspection.getId(), MesPcnExtConstWords.PID, packBean);
List<MesPartInspectionDetail> detailList = partInspectionDetailRepository.findByHqlWhere(packBean); List<MesPartInspectionDetail> detailList = partInspectionDetailRepository.findByHqlWhere(packBean);
return detailList; return detailList;
@ -945,7 +962,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
public void saveSusPartInspection(MesPartInspectionInputModel model, String org) { public void saveSusPartInspection(MesPartInspectionInputModel model, String org) {
MesPartInspection partInspection = new MesPartInspection(); MesPartInspection partInspection = new MesPartInspection();
BeanUtils.copyProperties(model, partInspection); BeanUtils.copyProperties(model, partInspection, MesPcnExtConstWords.ID);
partInspection.setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue()); partInspection.setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue());
partInspection.setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue()); partInspection.setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue());
partInspection.setOrganizeCode(org); partInspection.setOrganizeCode(org);
@ -959,8 +976,8 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
partInspection.setDefectTypeCode(defectType.getDefectTypeCode()); partInspection.setDefectTypeCode(defectType.getDefectTypeCode());
partInspection.setDefectTypeId(defectType.getId()); partInspection.setDefectTypeId(defectType.getId());
ConvertBean.serviceModelInitialize(partInspection, model.getUserInfo());
partInspectionRepository.save(partInspection); partInspection = partInspectionRepository.insert(partInspection);
log.info("生成的缺陷记录id ={}", partInspection); log.info("生成的缺陷记录id ={}", partInspection);
MesPartInspectionDetail detail = new MesPartInspectionDetail(); MesPartInspectionDetail detail = new MesPartInspectionDetail();
@ -974,7 +991,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
detail.setDefectTypeName(defectType.getDefectTypeName()); detail.setDefectTypeName(defectType.getDefectTypeName());
detail.setId(null); detail.setId(null);
detail.setOrganizeCode(org); detail.setOrganizeCode(org);
ConvertBean.serviceModelInitialize(detail, "系统"); ConvertBean.serviceModelInitialize(detail, model.getUserInfo());
partInspectionDetailRepository.insert(detail); partInspectionDetailRepository.insert(detail);
// //
String source = configService.getCfgValue(org, "LGORT"); String source = configService.getCfgValue(org, "LGORT");
@ -996,7 +1013,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
} }
} }
MesMove move = createMove(model, source, configService.getCfgValue(org, "UMLGO"), org, model.getWorkCenterCode()); MesMove move = createMove(model, source, configService.getCfgValue(org, "UMLGO"), org, model.getWorkCenterCode());
moveRepository.save(move); moveRepository.insert(move);
} }
@ApiOperation(value = "客退品查询") @ApiOperation(value = "客退品查询")

@ -397,8 +397,17 @@ public class MesNcProcessingService implements IMesNcProcessingService {
partInspectionRepository.save(model.getPartInspection()); partInspectionRepository.save(model.getPartInspection());
String target = configService.getCfgValue(org, "LGORT");
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(model.getPart().getPartNo(), "partNo", ddlPackBean);
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
if (version != null) {
target = version.getShipInventoryPoint();
}
//移库 转正常、放行8000移至2000 //移库 转正常、放行8000移至2000
MesMove move = createMove(model, sourceValue, configService.getCfgValue(org, "LGORT"), org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); MesMove move = createMove(model, sourceValue, target, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE);
ConvertBean.serviceModelInitialize(move,model.getUserName()); ConvertBean.serviceModelInitialize(move,model.getUserName());
moveRepository.save(move); moveRepository.save(move);

@ -10,7 +10,6 @@ import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.common.PagerHelper; import cn.estsh.i3plus.pojo.base.common.PagerHelper;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesProdShiftRecord;
import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn;
import cn.estsh.i3plus.pojo.mes.bean.MesQueueOrder; import cn.estsh.i3plus.pojo.mes.bean.MesQueueOrder;
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
@ -160,10 +159,12 @@ public class MesProduceSnExtService implements IMesProduceSnExtService {
@Override @Override
public void saveProduceSnList(StationRequestBean reqBean, Integer snStatus, List<Long> idList) { public void saveProduceSnList(StationRequestBean reqBean, Integer snStatus, List<Long> idList) {
idList = CollectionUtils.isEmpty(idList) ? idList : idList.stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList());
if (CollectionUtils.isEmpty(idList)) return;
DdlPackBean packBean = new DdlPackBean(); DdlPackBean packBean = new DdlPackBean();
DdlPreparedPack.getStringEqualPack(reqBean.getOrganizeCode(), MesPcnExtConstWords.ORGANIZE_CODE, packBean); DdlPreparedPack.getStringEqualPack(reqBean.getOrganizeCode(), MesPcnExtConstWords.ORGANIZE_CODE, packBean);
DdlPreparedPack.getInPackList(idList, MesPcnExtConstWords.ID, packBean); if (idList.size() == 1) DdlPreparedPack.getNumEqualPack(idList.get(0), MesPcnExtConstWords.ID, packBean);
else DdlPreparedPack.getInPackList(idList, MesPcnExtConstWords.ID, packBean);
produceSnRepository.updateByProperties( produceSnRepository.updateByProperties(
new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.WORK_CENTER_CODE, MesPcnExtConstWords.WORK_CELL_CODE, MesPcnExtConstWords.SN_STATUS}, new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.WORK_CENTER_CODE, MesPcnExtConstWords.WORK_CELL_CODE, MesPcnExtConstWords.SN_STATUS},
new Object[]{reqBean.getUserInfo(), TimeTool.getNowTime(true), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), snStatus}, new Object[]{reqBean.getUserInfo(), TimeTool.getNowTime(true), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), snStatus},

@ -128,11 +128,15 @@ public class MesRawPartChargingServiceImpl implements IMesRawPartChargingService
if (!CollectionUtils.isEmpty(mesRawPartCharging)) { if (!CollectionUtils.isEmpty(mesRawPartCharging)) {
MesPcnException.throwMesBusiException("料筒条码【%s】与原料条码【%s】已绑定", mesRawPartChargingModel.getPackageSn(), mesRawPartCharging.iterator().next().getSn()); MesPcnException.throwMesBusiException("料筒条码【%s】与原料条码【%s】已绑定", mesRawPartChargingModel.getPackageSn(), mesRawPartCharging.iterator().next().getSn());
} }
//保存生产控制加料 //保存生产控制加料 43302 加料防错扫码流程优化
String[] split = mesRawPartChargingModel.getSn().split(",");
for (String sn : split) {
mesRawPartChargingModel.setSn(sn);
MesRawPartCharging charging = insertRawPartCharging(mesRawPartChargingModel); MesRawPartCharging charging = insertRawPartCharging(mesRawPartChargingModel);
//保存日志 //保存日志
saveLog(mesRawPartChargingModel, charging, MesExtEnumUtil.CHARGING_LOG_STATUS.FEEDING); saveLog(mesRawPartChargingModel, charging, MesExtEnumUtil.CHARGING_LOG_STATUS.FEEDING);
} }
}
public void doMesRawPartChargingInit(MesRawPartChargingModel mesRawPartChargingModel) { public void doMesRawPartChargingInit(MesRawPartChargingModel mesRawPartChargingModel) {

@ -162,14 +162,14 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
if (CollectionUtils.isEmpty(workOrderList)) { if (CollectionUtils.isEmpty(workOrderList)) {
StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(), StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(),
new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", MesPcnExtConstWords.ZERO_STR), new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", MesPcnExtConstWords.ZERO_STR),
new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", MesPcnExtConstWords.ZERO_STR)); new StationKvBean(MesPcnExtConstWords.COMPLETE_QTY, "工单完成数", MesPcnExtConstWords.ZERO_STR));
} else { } else {
Double qty = workOrderList.stream().map(MesWorkOrder::getQty).reduce((a, b) -> a + b).get(); Double qty = workOrderList.stream().map(MesWorkOrder::getQty).reduce((a, b) -> a + b).get();
Double complateQty = workOrderList.stream().map(MesWorkOrder::getCompleteQty).reduce((a, b) -> a + b).get(); Double complateQty = workOrderList.stream().map(MesWorkOrder::getCompleteQty).reduce((a, b) -> a + b).get();
StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(), StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(),
new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", qty.toString()), new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", qty.toString()),
new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", complateQty.toString())); new StationKvBean(MesPcnExtConstWords.COMPLETE_QTY, "工单完成数", complateQty.toString()));
} }
if (!CollectionUtils.isEmpty(productionPartContextList)) { if (!CollectionUtils.isEmpty(productionPartContextList)) {

@ -104,14 +104,14 @@ public class MesFunctionProductionStatisticsService extends BaseSwsService imple
if (CollectionUtils.isEmpty(workOrderList)) { if (CollectionUtils.isEmpty(workOrderList)) {
StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(), StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(),
new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", 0 + ""), new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", 0 + ""),
new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", 0 + "")); new StationKvBean(MesPcnExtConstWords.COMPLETE_QTY, "工单完成数", 0 + ""));
} else { } else {
double qty = workOrderList.stream().map(MesWorkOrder::getQty).reduce((a, b) -> a + b).get(); double qty = workOrderList.stream().map(MesWorkOrder::getQty).reduce((a, b) -> a + b).get();
double complateQty = workOrderList.stream().map(MesWorkOrder::getCompleteQty).reduce((a, b) -> a + b).get(); double complateQty = workOrderList.stream().map(MesWorkOrder::getCompleteQty).reduce((a, b) -> a + b).get();
StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(), StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(),
new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", qty + ""), new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", qty + ""),
new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", complateQty + "")); new StationKvBean(MesPcnExtConstWords.COMPLETE_QTY, "工单完成数", complateQty + ""));
} }
resultBean.setResultList(orderQtyKvBeans); resultBean.setResultList(orderQtyKvBeans);
} else if (Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.PROD_VIDEO.getValue(), mesWorkCell.getIsShowMsg())) { } else if (Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.PROD_VIDEO.getValue(), mesWorkCell.getIsShowMsg())) {

@ -157,6 +157,7 @@ public class MesProductResultErrorHandleStepService extends BaseStepService {
model.setPart(mesPartSap); model.setPart(mesPartSap);
model.setPartInspectionDetailList(Arrays.asList(mesPartInspectionDetail)); model.setPartInspectionDetailList(Arrays.asList(mesPartInspectionDetail));
if (Objects.equal(MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.PRODUCT_SCRAP.getValue(), result)) { if (Objects.equal(MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.PRODUCT_SCRAP.getValue(), result)) {
//TODO 有问题 需要修改条码质量状态
ncProcessingService.saveNc(model, reqBean.getOrganizeCode(), true); ncProcessingService.saveNc(model, reqBean.getOrganizeCode(), true);
} else { } else {
MesPartInspectionInputModel inspectModel = new MesPartInspectionInputModel(); MesPartInspectionInputModel inspectModel = new MesPartInspectionInputModel();
@ -169,6 +170,7 @@ public class MesProductResultErrorHandleStepService extends BaseStepService {
inspectModel.setPartInspection(partInspection); inspectModel.setPartInspection(partInspection);
inspectModel.setShiftCode(mesProduceSn.getShiftCode()); inspectModel.setShiftCode(mesProduceSn.getShiftCode());
inspectModel.setProductVersion(productVersion); inspectModel.setProductVersion(productVersion);
inspectModel.setUserInfo(reqBean.getUserInfo());
inputDefectRecordService.saveSusPartInspection(inspectModel, reqBean.getOrganizeCode()); inputDefectRecordService.saveSusPartInspection(inspectModel, reqBean.getOrganizeCode());
} }

@ -9,7 +9,6 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.mes.pcn.util.StringUtil; import cn.estsh.i3plus.mes.pcn.util.StringUtil;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.tool.MathOperation; import cn.estsh.i3plus.platform.common.tool.MathOperation;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
@ -126,8 +125,6 @@ public class MesWorkOrderSaveNosortStepService extends BaseStepService {
reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(),
StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), workOrder.getWorkOrderNo(), JSONObject.toJSONString(workOrder), calcCompleteQty, prodResult); StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), workOrder.getWorkOrderNo(), JSONObject.toJSONString(workOrder), calcCompleteQty, prodResult);
entityManager.detach(workOrder);
//工单状态分 排序工单 和非排序工单; 现在必须是非排序工单 //工单状态分 排序工单 和非排序工单; 现在必须是非排序工单
if (!MesExtEnumUtil.ORDER_STATUS.checkNosortAllowStatus(workOrder.getWorkOrderStatus())) if (!MesExtEnumUtil.ORDER_STATUS.checkNosortAllowStatus(workOrder.getWorkOrderStatus()))
stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("请检查工单信息,加工单[%s]信息工单状态[%s]!", entry.getKey(), MesExtEnumUtil.ORDER_STATUS.valueOfDescription(workOrder.getWorkOrderStatus()))); stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("请检查工单信息,加工单[%s]信息工单状态[%s]!", entry.getKey(), MesExtEnumUtil.ORDER_STATUS.valueOfDescription(workOrder.getWorkOrderStatus())));
@ -135,17 +132,16 @@ public class MesWorkOrderSaveNosortStepService extends BaseStepService {
if (!workOrder.getWorkCenterCode().equals(reqBean.getWorkCenterCode())) if (!workOrder.getWorkCenterCode().equals(reqBean.getWorkCenterCode()))
stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("请检查工单信息,加工单[%s]信息所属生产线[%s]与当前生产线[%s]不一致!", entry.getKey(), workOrder.getWorkCenterCode(), reqBean.getWorkCenterCode())); stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("请检查工单信息,加工单[%s]信息所属生产线[%s]与当前生产线[%s]不一致!", entry.getKey(), workOrder.getWorkCenterCode(), reqBean.getWorkCenterCode()));
List<String> propertyNameList = new ArrayList<>(); Map<String, Object> propertyMap = new HashMap<>();
//修改完成数量 //修改完成数量
if (calcCompleteQty.compareTo(MesPcnExtConstWords.ZERO) > 0) { if (calcCompleteQty.compareTo(MesPcnExtConstWords.ZERO) > 0) {
workOrder.setCompleteQty(MathOperation.add(workOrder.getCompleteQty(), calcCompleteQty)); propertyMap.put(MesPcnExtConstWords.COMPLETE_QTY, MathOperation.add(workOrder.getCompleteQty(), calcCompleteQty));
propertyNameList.add(MesPcnExtConstWords.COMPLATED_QTY);
} }
//修改未完成数量 //修改未完成数量
if (calcCompleteQty.compareTo(MesPcnExtConstWords.ZERO) > 0 && workOrder.getUnCompleteQty().compareTo(new Double(0)) > 0 && if (calcCompleteQty.compareTo(MesPcnExtConstWords.ZERO) > 0 && workOrder.getUnCompleteQty().compareTo(new Double(0)) > 0 &&
MathOperation.compareTo(MathOperation.sub(workOrder.getUnCompleteQty(), new Double(calcCompleteQty)), new Double(0)) >= 0) { MathOperation.compareTo(MathOperation.sub(workOrder.getUnCompleteQty(), new Double(calcCompleteQty)), new Double(0)) >= 0) {
workOrder.setUnCompleteQty(MathOperation.sub(workOrder.getUnCompleteQty(), new Double(calcCompleteQty))); propertyMap.put(MesPcnExtConstWords.UN_COMPLETE_QTY, MathOperation.sub(workOrder.getUnCompleteQty(), new Double(calcCompleteQty)));
propertyNameList.add(MesPcnExtConstWords.UN_COMPLATED_QTY);
} }
/** /**
@ -155,43 +151,46 @@ public class MesWorkOrderSaveNosortStepService extends BaseStepService {
* *
*/ */
if (!StringUtils.isEmpty(prodResult)) { if (!StringUtils.isEmpty(prodResult)) {
//可疑品 //可疑品
boolean isSuspicious = MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue() == Integer.parseInt(prodResult); if (Integer.valueOf(prodResult).compareTo(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()) == 0 && !CollectionUtils.isEmpty(productionPsOutContextList)){
if (isSuspicious && !productionPsOutContextList.isEmpty()){ propertyMap.put(MesPcnExtConstWords.SUSPICIOUS_PART_QTY, MathOperation.add(workOrder.getSuspiciousPartQty(), new Double(productionPsOutContextList.size())));
int suspiciousQty = productionPsOutContextList.size();
workOrder.setSuspiciousPartQty(MathOperation.add(workOrder.getSuspiciousPartQty(), new Double(suspiciousQty)));
propertyNameList.add(MesPcnExtConstWords.SUSPICIOUS_PART_QTY);
} }
//报废数量 //报废数量
boolean isScrap = MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue() == Integer.parseInt(prodResult); if (Integer.valueOf(prodResult).compareTo(MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue()) == 0 && !CollectionUtils.isEmpty(productionPsOutContextList)){
if (isScrap && !productionPsOutContextList.isEmpty()){ propertyMap.put(MesPcnExtConstWords.SCRAP_PART_QTY, MathOperation.add(workOrder.getScrapPartQty(), new Double(productionPsOutContextList.size())));
int scrapQty = productionPsOutContextList.size();
workOrder.setScrapPartQty(MathOperation.add(workOrder.getScrapPartQty(), new Double(scrapQty)));
propertyNameList.add(MesPcnExtConstWords.SCRAP_PART_QTY);
} }
} }
if (MathOperation.compareTo(workOrder.getCompleteQty(), workOrder.getQty()) >= 0 && workOrder.getWorkOrderStatus().compareTo(MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()) != 0) { if (MathOperation.compareTo(workOrder.getCompleteQty(), workOrder.getQty()) >= 0 && workOrder.getWorkOrderStatus().compareTo(MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()) != 0) {
workOrder.setWorkOrderStatus(MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()); propertyMap.put(MesPcnExtConstWords.WORK_ORDER_STATUS, MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue());
propertyNameList.add(MesPcnExtConstWords.WORK_ORDER_STATUS);
} else if (workOrder.getCompleteQty() > 0 && workOrder.getWorkOrderStatus() == MesExtEnumUtil.ORDER_STATUS.RELEASE.getValue()) { } else if (workOrder.getCompleteQty() > 0 && workOrder.getWorkOrderStatus() == MesExtEnumUtil.ORDER_STATUS.RELEASE.getValue()) {
workOrder.setWorkOrderStatus(MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()); propertyMap.put(MesPcnExtConstWords.WORK_ORDER_STATUS, MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue());
propertyNameList.add(MesPcnExtConstWords.WORK_ORDER_STATUS);
} }
//如果数量都没有修改,不操作数据库
if (!propertyNameList.isEmpty()) {
ConvertBean.serviceModelUpdate(workOrder, reqBean.getUserInfo());
workOrder.setModifyDatetime((new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()));
workOrderExtService.update(workOrder);
log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- ORDER:{} --- UPDATE:{}", if (CollectionUtils.isEmpty(propertyMap)) continue;
reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(),
StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), workOrder.getWorkOrderNo(), JSONObject.toJSONString(workOrder)); propertyMap.put(MesPcnExtConstWords.MODIFY_DATE_TIME, (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")).format(new Date()));
propertyMap.put(MesPcnExtConstWords.MODIFY_USER, reqBean.getUserInfo());
String[] propertyName = new String[propertyMap.size()];
Object[] propertyValue = new Object[propertyMap.size()];
Integer index = 0;
for (Map.Entry<String, Object> innerEntry : propertyMap.entrySet()) {
if (null == innerEntry) continue;
propertyName[index] = innerEntry.getKey();
propertyValue[index] = innerEntry.getValue();
index ++;
} }
workOrderRepository.updateByProperties(new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE}, new Object[]{workOrder.getId(), reqBean.getOrganizeCode()}, propertyName, propertyValue);
log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- ORDER:{} --- UPDATE:{}",
reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(),
StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), workOrder.getWorkOrderNo(), JSONObject.toJSONString(propertyMap));
} }
} }
} }

@ -107,7 +107,7 @@ public class MesWorkOrderSaveSortStepService extends BaseStepService {
workOrderRepository.updateByProperties( workOrderRepository.updateByProperties(
new String[]{MesPcnExtConstWords.ID}, new String[]{MesPcnExtConstWords.ID},
new Object[]{productionPartContext.getId()}, new Object[]{productionPartContext.getId()},
new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.WORK_ORDER_STATUS, MesPcnExtConstWords.COMPLATED_QTY, MesPcnExtConstWords.UN_COMPLATED_QTY, MesPcnExtConstWords.OFFLINE_TIME}, new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.WORK_ORDER_STATUS, MesPcnExtConstWords.COMPLETE_QTY, MesPcnExtConstWords.UN_COMPLETE_QTY, MesPcnExtConstWords.OFFLINE_TIME},
new Object[]{reqBean.getUserInfo(), (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue(), new Double(1), new Double(0), TimeTool.getNowTime(true)}); new Object[]{reqBean.getUserInfo(), (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue(), new Double(1), new Double(0), TimeTool.getNowTime(true)});
} }

@ -94,9 +94,9 @@ public class MesPcnExtConstWords {
// 模具号 // 模具号
public static final String MOULD_NO = "mouldNo"; public static final String MOULD_NO = "mouldNo";
// 工单完成数 // 工单完成数
public static final String COMPLATED_QTY = "complateQty"; public static final String COMPLETE_QTY = "completeQty";
// 工单未完成数 // 工单未完成数
public static final String UN_COMPLATED_QTY = "unCompleteQty"; public static final String UN_COMPLETE_QTY = "unCompleteQty";
// 工单可疑品数 // 工单可疑品数
public static final String SUSPICIOUS_PART_QTY = "suspiciousPartQty"; public static final String SUSPICIOUS_PART_QTY = "suspiciousPartQty";
// 工单报废品数 // 工单报废品数

Loading…
Cancel
Save