diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesPullingOrderInfoController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesPullingOrderInfoController.java index cb8eac5..3a68523 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesPullingOrderInfoController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesPullingOrderInfoController.java @@ -121,7 +121,7 @@ public class MesPullingOrderInfoController { throw new ImppBusiException("拉动单明细状态不为未送料状态!"); } MesPullingOrderPartInfo pullingOrderInfo = mesPullingOrderInfoService.doMesPullingOrderInfoJisScan(info, AuthUtil.getSessionUser().getUserName()); - return ResultBean.success("拉动单打印成功") + return ResultBean.success("JIS物料拉动校验条码成功") .setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()) .setResultObject(pullingOrderInfo); } catch (ImppBusiException e) { @@ -134,9 +134,16 @@ public class MesPullingOrderInfoController { @ApiOperation(value = "JIS物料拉动-送料按钮") public ResultBean doMesPullingOrderInfoSend(@RequestBody List infoList) { try { - + for (MesPullingOrderPartInfo partInfo : infoList) { + if (MesExtEnumUtil.PULL_ORDER_PART_STATUS.SENTED.getValue()==partInfo.getStatus()) { + throw new ImppBusiException("JIS物料拉动状态不为未送料状态!"); + } + if (MesExtEnumUtil.PART_PULL_DETAIL_COLOR.RED.getCode()==partInfo.getColor()) { + throw new ImppBusiException("JIS物料拉动需要扫描条码校验!"); + } + } List pullingOrderInfos = mesPullingOrderInfoService.doMesPullingOrderInfoSend(infoList, AuthUtil.getSessionUser().getUserName()); - return ResultBean.success("拉动单打印成功") + return ResultBean.success("拉动单送料成功") .setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()) .setResultList(pullingOrderInfos); } catch (ImppBusiException e) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPullingOrderInfoService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPullingOrderInfoService.java index dca9466..506087e 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPullingOrderInfoService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPullingOrderInfoService.java @@ -184,9 +184,9 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService { //查询拉动单主表是JIS拉动且拉动状态为10 String append = packBean.getWhereAppend() + " AND EXISTS (select 1 from MesPullingOrderInfo po where po.pullingOrderNo = model.pullingOrderNo" + - " and po.pullOrderType=20 and po.pullOrderStatus =10 and po.workCenterCode ='"+bean.getWorkCenterCode()+"' " ; - packBean.setWhereAppend(append+ " )"); - DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue(), CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"status", "createDatetime"}, packBean); + " and po.pullOrderType=20 and po.workCenterCode ='" + bean.getWorkCenterCode() + "' "; + packBean.setWhereAppend(append + " )"); + DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue(), CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"status", "pullingOrderNo"}, packBean); pager = PagerHelper.getPager(pager, mesPullingOrderPartInfoRepository.findByHqlWhereCount(packBean)); @@ -203,13 +203,11 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService { MesPartPullDetail mesPartPullDetail = pullCodePartMap.get(partInfo.getPullCode() + "=" + partInfo.getPartNo()).get(0); partInfo.setScanValidationType(StringUtil.isEmpty(mesPartPullDetail.getScanValidationType()) ? 10 : mesPartPullDetail.getScanValidationType()); partInfo.setRuleValidation(StringUtil.isEmpty(mesPartPullDetail.getRuleValidation()) ? "" : mesPartPullDetail.getRuleValidation()); - if (partInfo.getScanValidationType() == 10) { + if (mesPartPullDetail.getScanValidationType() == MesExtEnumUtil.PART_PULL_DETAIL_SCAN_VALIDATION_TYPE.UN_VALIDATE.getValue()) { partInfo.setColor(MesExtEnumUtil.PART_PULL_DETAIL_COLOR.WHITE.getCode()); - } else { + }else if (partInfo.getColor()==MesExtEnumUtil.PART_PULL_DETAIL_COLOR.WHITE.getCode()){ partInfo.setColor(MesExtEnumUtil.PART_PULL_DETAIL_COLOR.RED.getCode()); } - }else { - partInfo.setColor(MesExtEnumUtil.PART_PULL_DETAIL_COLOR.WHITE.getCode()); } } } @@ -224,40 +222,41 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService { if (!StringUtil.isEmpty(partInfo)) { //查拉动单明细对应的拉动组规则 DdlPackBean packBeanDetail = DdlPackBean.getDdlPackBean(partInfo.getOrganizeCode()); - DdlPreparedPack.getStringEqualPack(partInfo.getPullCode(), "pullCode", packBeanDetail); + DdlPreparedPack.getStringEqualPack(partInfo.getPullCode(), "pullCode", packBeanDetail); DdlPreparedPack.getStringEqualPack(partInfo.getPartNo(), "partNo", packBeanDetail); - MesPartPullDetail mesPartPullDetail = mesPartPullDetailRDao.getByProperty(packBeanDetail); - if (StringUtil.isEmpty(mesPartPullDetail)){ - MesPcnException.throwMesBusiException("工单【%s】拉动组数据为空", mesPullingOrderInfo.getWorkOrderNo()); - } + MesPartPullDetail mesPartPullDetail = mesPartPullDetailRDao.getByProperty(packBeanDetail); + if (StringUtil.isEmpty(mesPartPullDetail)) { + MesPcnException.throwMesBusiException("工单【%s】拉动组数据为空", mesPullingOrderInfo.getWorkOrderNo()); + } //校验规则 - if (checkRule(mesPullingOrderInfo,mesPartPullDetail)){ + if (checkRule(mesPullingOrderInfo, mesPartPullDetail)) { //校验成功修改颜色为黄色2 partInfo.setColor(MesExtEnumUtil.PART_PULL_DETAIL_COLOR.YELLOW.getCode()); ConvertBean.serviceModelUpdate(partInfo, userName); mesPullingOrderPartInfoRepository.update(partInfo); - }else { + } else { MesPcnException.throwMesBusiException("工单拉动组明细【%s】数据为空", mesPullingOrderInfo.getWorkOrderNo()); } - }else { + } else { MesPcnException.throwMesBusiException("工单拉动组明细【%s】数据为空", mesPullingOrderInfo.getWorkOrderNo()); } return partInfo; } private boolean checkRule(MesPullingOrderPartInfo mesPullingOrderInfo, MesPartPullDetail mesPartPullDetail) { - String rule=mesPartPullDetail.getRuleValidation(); - if (mesPullingOrderInfo.getScanValidationType()==MesExtEnumUtil.PART_PULL_DETAIL_SCAN_VALIDATION_TYPE.HOMEMADE_VALIDATE.getValue()){ + String rule = mesPartPullDetail.getRuleValidation(); + if (mesPullingOrderInfo.getScanValidationType() == MesExtEnumUtil.PART_PULL_DETAIL_SCAN_VALIDATION_TYPE.HOMEMADE_VALIDATE.getValue()) { List produceSnList = mesProduceSnExtService.getProduceSnList(mesPullingOrderInfo.getOrganizeCode(), mesPullingOrderInfo.getProductSn()); return mesPartPullDetail.getPullPartNo().equals(produceSnList.get(0).getPartNo()); - }else if (mesPullingOrderInfo.getScanValidationType()==MesExtEnumUtil.PART_PULL_DETAIL_SCAN_VALIDATION_TYPE.COOPERATION_VALIDATE.getValue()){ + } else if (mesPullingOrderInfo.getScanValidationType() == MesExtEnumUtil.PART_PULL_DETAIL_SCAN_VALIDATION_TYPE.COOPERATION_VALIDATE.getValue()) { return (Boolean) ((IMesNumberRuleMatchDispatchService) SpringContextsUtil.getBean(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_20.getStrategyClass())) .matchNumberRule(mesPullingOrderInfo.getOrganizeCode(), mesPullingOrderInfo.getProductSn(), rule, rule) .get(MesPcnExtConstWords.RESULT); - }else { + } else { return true; } } + @Override public List doMesPullingOrderInfoSend(List infoList, String userName) { List result = new ArrayList<>();