diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesLabelTemplateExtController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesLabelTemplateExtController.java index ebd3a24..4f0eeff 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesLabelTemplateExtController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesLabelTemplateExtController.java @@ -4,6 +4,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesTemplateService; import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.api.iservice.base.IConfigService; +import cn.estsh.i3plus.pojo.mes.bean.MesConfig; import cn.estsh.impp.framework.boot.exception.ImppBusiException; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.util.ResultBean; @@ -11,12 +12,16 @@ import cn.estsh.impp.framework.boot.util.ValidatorBean; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.Arrays; +import java.util.List; import java.util.Map; +import java.util.Optional; @Api("获取系统配置的模版信息") @RestController @@ -54,4 +59,31 @@ public class MesLabelTemplateExtController { } } + @GetMapping("/label-template/by-module-or-template/get-custom") + @ApiOperation(value = "获取系统配置的模版信息") + public ResultBean queryModuleCodeCfg(String organizeCode, String moduleCode, String chooseCodes, String templateCode) { + try { + ValidatorBean.checkNotNull(organizeCode, "工厂代码不能为空"); + if (StringUtils.isEmpty(moduleCode) && StringUtils.isEmpty(templateCode)) { + ValidatorBean.checkNotNull(moduleCode, "模版配置代码不能为空"); + } + + if (StringUtils.isEmpty(chooseCodes)) return queryMesLabelTemplate(organizeCode, moduleCode, templateCode); + + List chooseCodeList = Arrays.asList(chooseCodes.split(MesPcnExtConstWords.COMMA)); + + List configList = configService.getMesConfigListByCfgCodeKey(moduleCode, MesPcnExtConstWords.CUSTOM_CFG, organizeCode); + Optional optional = CollectionUtils.isEmpty(configList) ? null : + configList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getCfgValue()) + && !StringUtils.isEmpty(o.getCfgType()) && chooseCodeList.contains(o.getCfgType()))).findFirst(); + + return queryMesLabelTemplate(organizeCode, (null == optional || !optional.isPresent()) ? moduleCode : optional.get().getCfgValue(), templateCode); + + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java index 6b69b21..94b0094 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java @@ -28,8 +28,10 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; +import java.util.Arrays; import java.util.List; import java.util.Objects; +import java.util.Optional; @Service @Slf4j @@ -71,7 +73,14 @@ public class MesPartShippingGroupService implements IMesPartShippingGroupService @Override public ResultBean doMesMesShippingOrderManagementPrint(MesShippingOrderManagement bean) { - MesConfig config = configService.getMesConfigByCfgCode(MesPcnExtConstWords.SORT_SHIPPING_PRINT_TEMPLATE, bean.getOrganizeCode()); + List chooseCodeList = Arrays.asList(bean.getShippingGroupCode().split(MesPcnExtConstWords.COMMA)); + List configList = configService.getMesConfigListByCfgCodeKey(MesPcnExtConstWords.SORT_SHIPPING_PRINT_TEMPLATE, MesPcnExtConstWords.CUSTOM_CFG, bean.getOrganizeCode()); + Optional optional = CollectionUtils.isEmpty(configList) ? null : + configList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getCfgValue()) + && !StringUtils.isEmpty(o.getCfgType()) && chooseCodeList.contains(o.getCfgType()))).findFirst(); + + String templeteCodeCfg = (null == optional || !optional.isPresent()) ? MesPcnExtConstWords.SORT_SHIPPING_PRINT_TEMPLATE : optional.get().getCfgValue(); + MesConfig config = configService.getMesConfigByCfgCodeKeyOrg(templeteCodeCfg, MesPcnExtConstWords.SORT_SHIPPING_PRINT_TEMPLATE, bean.getOrganizeCode()); if (null == config || StringUtils.isEmpty(config.getCfgValue())) MesPcnException.throwBusiException("未配置排序发运全局打印配置[%s]", MesPcnExtConstWords.SORT_SHIPPING_PRINT_TEMPLATE); MesLabelTemplate labelTemplate = templateService.getMesLabelTemplate(config.getCfgValue(), bean.getOrganizeCode()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingKanbanCfgServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingKanbanCfgServiceImpl.java index 7e699dc..1e8edfa 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingKanbanCfgServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingKanbanCfgServiceImpl.java @@ -875,8 +875,8 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer } String strCustInfoSeq = custInfoSeq != null ? Long.toString(custInfoSeq) : ""; - if (strCustInfoSeq.length() >= 6) { - values.add(strCustInfoSeq.substring(strCustInfoSeq.length() - 6)); + if (strCustInfoSeq.length() >= 5) { + values.add(strCustInfoSeq.substring(strCustInfoSeq.length() - 5)); } else { values.add(strCustInfoSeq); } @@ -1031,7 +1031,7 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer hql.append(" and l.modifyDatetime BETWEEN :startDateTime AND :endDateTime "); hql.append(" and s.shippingGroupCode in (:shippingGroupCode) "); hql.append(" group by s.shippingGroupCode "); - List ddd = entityManager.createQuery(hql.toString()) + List dataList = entityManager.createQuery(hql.toString()) .setParameter("organizeCode", cfg.getOrganizeCode()) .setParameter("isValid", CommonEnumUtil.VALID) .setParameter("isDeleted", CommonEnumUtil.FALSE) @@ -1042,11 +1042,11 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer .getResultList(); Map shippingGroupCount = new HashMap<>(); - if (!CollectionUtils.isEmpty(ddd)) { - for (Map dd : ddd) { - Object totalCount = dd.get("totalCount"); + if (!CollectionUtils.isEmpty(dataList)) { + for (Map data : dataList) { + Object totalCount = data.get("totalCount"); if (totalCount != null) { - shippingGroupCount.put(dd.get("shippingGroupCode").toString(), totalCount.toString()); + shippingGroupCount.put(data.get("shippingGroupCode").toString(), String.format("%.0f", (Double)totalCount)); } } } @@ -1129,8 +1129,8 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer .setParameter("organizeCode", cfg.getOrganizeCode()) .setParameter("isValid", CommonEnumUtil.VALID) .setParameter("isDeleted", CommonEnumUtil.FALSE) - .setParameter("startDateTime", DateUtil.formatDate(nowTime)) - .setParameter("endDateTime", DateUtil.formatDate(prevHourTime)) + .setParameter("startDateTime", DateUtil.formatDate(prevHourTime)) + .setParameter("endDateTime", DateUtil.formatDate(nowTime)) .getResultList(); // Use a map to store counts for quick access @@ -1138,7 +1138,7 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer .collect(Collectors.toMap( map -> map.get("workCenterCode").toString(), map -> map.get("totalCount").toString(), - (existing, replacement) -> existing // Handle duplicates if any + (existing, replacement) -> existing )); // Collect counts for each shipping group diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java index 3e3aee4..abf8095 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java @@ -262,6 +262,7 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS loadingList.setEndScanTime(TimeTool.getNowTime(true)); //装车单主表 loadingList.setStatus(MesExtEnumUtil.MES_LOADING_STATUS.SCANNED.getValue()); + loadingList.setSystemSyncStatus(CommonEnumUtil.FALSE); ConvertBean.serviceModelUpdate(loadingList, userInfo); //不记忆的数据持久化 if (!Objects.equals(loadingList.getIsEnableMemory(), MesCommonConstant.TRUE_INTEGER)) { @@ -282,6 +283,8 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS MesShippingOrderManagement orderManagement = shippingOrderManagementRepository.getByProperty(packBean); if (orderManagement != null) { orderManagement.setStatus(MesExtEnumUtil.SHIPPING_ORDER_STATUS.LOADING.getValue()); + orderManagement.setSystemSyncStatus(CommonEnumUtil.FALSE); + ConvertBean.serviceModelUpdate(orderManagement, userInfo); shippingOrderList.add(orderManagement); } }); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java index 0f1c1f0..b686f71 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java @@ -293,7 +293,7 @@ public class MesWorkOrderService implements IMesWorkOrderService { newMesProductOffLine.setWorkOrderType(mesWorkOrderDb.getWorkOrderType()); newMesProductOffLine.setWorkCenterCode(mesWorkOrderDb.getWorkCenterCode()); newMesProductOffLine.setWorkCellCode(mesWorkOrderDb.getWorkCellCode()); - newMesProductOffLine.setReportType(MesExtEnumUtil.MES_ALL_REPORT_TYPE.REPORT.getValue()); + newMesProductOffLine.setReportType(mesProductionRecord.getReportType()); newMesProductOffLine.setSapWorkCenter(mesWorkOrderDb.getErpWorkCenter()); newMesProductOffLine.setOrganizeCode(organizeCode); newMesProductOffLine.setDescription(mesProductionRecord.getCompleteDateTime()); @@ -769,7 +769,7 @@ public class MesWorkOrderService implements IMesWorkOrderService { newMesProductOffLine.setWorkOrderType(oldMesWorkOrder.getWorkOrderType()); newMesProductOffLine.setWorkCenterCode(oldMesWorkOrder.getWorkCenterCode()); newMesProductOffLine.setWorkCellCode(oldMesWorkOrder.getWorkCellCode()); - newMesProductOffLine.setReportType(MesExtEnumUtil.MES_ALL_REPORT_TYPE.REPORT.getValue()); + newMesProductOffLine.setReportType(productionRecord.getReportType()); if (Objects.equals(MesExtEnumUtil.ORDER_TYPE.BTO.getValue(), oldMesWorkOrder.getWorkOrderType())){ newMesProductOffLine.setWorkCenterCode(mesProductVersion.getWorkCenterCode()); } @@ -1733,7 +1733,7 @@ public class MesWorkOrderService implements IMesWorkOrderService { newMesProductOffLine.setWorkOrderType(workOrder.getWorkOrderType()); newMesProductOffLine.setWorkCenterCode(record.getWorkCenterCode()); newMesProductOffLine.setWorkCellCode(record.getWorkCellCode()); - newMesProductOffLine.setReportType(MesExtEnumUtil.MES_ALL_REPORT_TYPE.REPORT.getValue()); + newMesProductOffLine.setReportType(record.getReportType()); newMesProductOffLine.setOrganizeCode(model.getOrganizeCode()); newMesProductOffLine.setDescription(record.getCompleteDateTime()); ConvertBean.serviceModelInitialize(newMesProductOffLine, model.getUserName()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/sortshipping/strategy/ChengDuVolvoShippingPrintStrategyService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/sortshipping/strategy/ChengDuVolvoShippingPrintStrategyService.java index 462c2ac..40d48a3 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/sortshipping/strategy/ChengDuVolvoShippingPrintStrategyService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/sortshipping/strategy/ChengDuVolvoShippingPrintStrategyService.java @@ -183,6 +183,7 @@ public class ChengDuVolvoShippingPrintStrategyService extends SortShippingDispat model.setPackageId(rackId.getJisRackId()); model.setPackageBarCode(rackId.getJisRackId()); model.setProcess("LDJIS"); + model.setDate("P" + TimeTool.getDateTimeShort().substring(2)); return model; } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionRecordGenerateStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionRecordGenerateStepService.java index efac871..e2ff9c5 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionRecordGenerateStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionRecordGenerateStepService.java @@ -99,6 +99,10 @@ public class MesProductionRecordGenerateStepService extends BaseStepService { MesWorkCenter workCenter = productionProcessContext.getWorkCenter(); MesWorkCell workCell = productionProcessContext.getWorkCell(); + //获取上下文产出零件信息【当前非排序才需要查询, 用于验证P单则不汇报】 + List productionPartContextList = workCenter.getCenterType().compareTo(MesExtEnumUtil.WORK_CENTER_TYPE.NOSORT.getValue()) == 0 ? productionDispatchContextStepService.getProductionPartContext(reqBean) : null; + Map 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); @@ -107,7 +111,8 @@ public class MesProductionRecordGenerateStepService extends BaseStepService { //生成加工记录 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, List prodRuleContextList, MesProductionProcessContext productionProcessContext, MesProductionPsOutContext productionPsOutContext, - Map prMap, MesCellEquipContext cellEquipContext, MesProductionPsInContext productionPsInContext) { + Map prMap, MesCellEquipContext cellEquipContext, MesProductionPsInContext productionPsInContext, MesProductionPartContext productionPartContext) { 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) && - 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()); diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java index 17566a9..c4871fc 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java @@ -927,6 +927,8 @@ public class MesPcnExtConstWords { public static final String SORT_SHIPPING_PRINT_TEMPLATE = "SORT_SHIPPING_PRINT_TEMPLATE"; //由前端直接渲染模版的标志 public static final String TEMPLATE_CUSTOM_HTML = "TEMPLATE_CUSTOM_HTML"; + //客制化配置 + public static final String CUSTOM_CFG = "CUSTOM_CFG"; //生产过程控制非排序打印机配置【物料级别=1, 默认打印机=2】 public static final String PRODUCTION_CONTROL_NOSORT_PRINTER_CFG = "PRODUCTION_CONTROL_NOSORT_PRINTER_CFG";