|
|
@ -99,6 +99,10 @@ public class MesProductionRecordGenerateStepService extends BaseStepService {
|
|
|
|
MesWorkCenter workCenter = productionProcessContext.getWorkCenter();
|
|
|
|
MesWorkCenter workCenter = productionProcessContext.getWorkCenter();
|
|
|
|
MesWorkCell workCell = productionProcessContext.getWorkCell();
|
|
|
|
MesWorkCell workCell = productionProcessContext.getWorkCell();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取上下文产出零件信息【当前非排序才需要查询, 用于验证P单则不汇报】
|
|
|
|
|
|
|
|
List<MesProductionPartContext> productionPartContextList = workCenter.getCenterType().compareTo(MesExtEnumUtil.WORK_CENTER_TYPE.NOSORT.getValue()) == 0 ? productionDispatchContextStepService.getProductionPartContext(reqBean) : null;
|
|
|
|
|
|
|
|
Map<Integer, MesProductionPartContext> ppcMap = CollectionUtils.isEmpty(productionPartContextList) ? null : productionPartContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getForeignKey()))).collect(Collectors.toMap(MesProductionPartContext::getForeignKey, o -> o));
|
|
|
|
|
|
|
|
|
|
|
|
//获取上下文(头道)模具号
|
|
|
|
//获取上下文(头道)模具号
|
|
|
|
String mouldNo = getMouldNo(reqBean, workCenter, prodRuleContextList);
|
|
|
|
String mouldNo = getMouldNo(reqBean, workCenter, prodRuleContextList);
|
|
|
|
|
|
|
|
|
|
|
@ -107,7 +111,8 @@ public class MesProductionRecordGenerateStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
|
|
//生成加工记录
|
|
|
|
//生成加工记录
|
|
|
|
productionPsOutContextList.stream().filter(o -> null != o).forEach(o ->
|
|
|
|
productionPsOutContextList.stream().filter(o -> null != o).forEach(o ->
|
|
|
|
saveProductionRecordData(reqBean, workCenter, scanMonitorContext, mouldNo, prodRuleContextList, productionProcessContext, o, prMap, cellEquipContext, CollectionUtils.isEmpty(psiMap) ? null : psiMap.get(o.getForeignKey()))
|
|
|
|
saveProductionRecordData(reqBean, workCenter, scanMonitorContext, mouldNo, prodRuleContextList, productionProcessContext, o, prMap, cellEquipContext,
|
|
|
|
|
|
|
|
CollectionUtils.isEmpty(psiMap) ? null : psiMap.get(o.getForeignKey()), CollectionUtils.isEmpty(ppcMap) ? null : ppcMap.get(o.getForeignKey()))
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
//保存上下文产品加工规则信息集合
|
|
|
|
//保存上下文产品加工规则信息集合
|
|
|
@ -126,7 +131,7 @@ public class MesProductionRecordGenerateStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
|
|
private void saveProductionRecordData(StationRequestBean reqBean, MesWorkCenter workCenter, MesScanMonitorContext scanMonitorContext, String mouldNo,
|
|
|
|
private void saveProductionRecordData(StationRequestBean reqBean, MesWorkCenter workCenter, MesScanMonitorContext scanMonitorContext, String mouldNo,
|
|
|
|
List<MesProdRuleContext> prodRuleContextList, MesProductionProcessContext productionProcessContext, MesProductionPsOutContext productionPsOutContext,
|
|
|
|
List<MesProdRuleContext> prodRuleContextList, MesProductionProcessContext productionProcessContext, MesProductionPsOutContext productionPsOutContext,
|
|
|
|
Map<Integer, MesProdRuleContext> prMap, MesCellEquipContext cellEquipContext, MesProductionPsInContext productionPsInContext) {
|
|
|
|
Map<Integer, MesProdRuleContext> prMap, MesCellEquipContext cellEquipContext, MesProductionPsInContext productionPsInContext, MesProductionPartContext productionPartContext) {
|
|
|
|
|
|
|
|
|
|
|
|
MesProdRuleContext prodRuleContext = CollectionUtils.isEmpty(prMap) ? null : prMap.get(productionPsOutContext.getForeignKey());
|
|
|
|
MesProdRuleContext prodRuleContext = CollectionUtils.isEmpty(prMap) ? null : prMap.get(productionPsOutContext.getForeignKey());
|
|
|
|
|
|
|
|
|
|
|
@ -161,9 +166,19 @@ public class MesProductionRecordGenerateStepService extends BaseStepService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//非排序验证: 判断工单是否是试制工单
|
|
|
|
|
|
|
|
if (productionRecord.getReportStatus().compareTo(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_10.getValue()) == 0 &&
|
|
|
|
|
|
|
|
workCenter.getCenterType().compareTo(MesExtEnumUtil.WORK_CENTER_TYPE.NOSORT.getValue()) == 0 &&
|
|
|
|
|
|
|
|
null != productionPartContext && !StringUtils.isEmpty(productionPartContext.getOrderFlag()) &&
|
|
|
|
|
|
|
|
productionPartContext.getOrderFlag().equals(MesExtEnumUtil.ORDER_TYPE_IDENTIFICATION.P.getValue())) {
|
|
|
|
|
|
|
|
productionRecord.setReportStatus(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_30.getValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//非排序与排序 相同验证: 判断是否已经存在汇报状态的加工记录
|
|
|
|
//非排序与排序 相同验证: 判断是否已经存在汇报状态的加工记录
|
|
|
|
if (productionRecord.getReportStatus().compareTo(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_10.getValue()) == 0 && isSamePart(productionPsInContext, productionPsOutContext) &&
|
|
|
|
if (productionRecord.getReportStatus().compareTo(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_10.getValue()) == 0 && isSamePart(productionPsInContext, productionPsOutContext) &&
|
|
|
|
checkPsIsReported(reqBean.getOrganizeCode(), productionPsOutContext.getProductSn(), productionPsOutContext.getPartNo())) productionRecord.setReportStatus(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_30.getValue());
|
|
|
|
checkPsIsReported(reqBean.getOrganizeCode(), productionPsOutContext.getProductSn(), productionPsOutContext.getPartNo())) {
|
|
|
|
|
|
|
|
productionRecord.setReportStatus(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_30.getValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
productionRecord.setModuleStatisticsStatus(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
|
|
|
productionRecord.setModuleStatisticsStatus(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
|
|
|
|
|
|
|
|
|
|
|