diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesNcProcessingService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesNcProcessingService.java index 77c9a51..8eeb4dc 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesNcProcessingService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesNcProcessingService.java @@ -5,9 +5,12 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesNcProcessingModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesNcProcessingPartAndLotModel; import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.common.Pager; +import cn.estsh.i3plus.pojo.mes.bean.MesDefectType; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection; import io.swagger.annotations.ApiOperation; +import java.util.List; + /** * @Description : * @Reference : @@ -24,6 +27,9 @@ public interface IMesNcProcessingService { @ApiOperation(value = "查询NC-零件检测-单据") public MesNcProcessingModel queryPartInspection(MesPartInspection partInspection); + @ApiOperation(value = "查询责任人") + public List queryPerson(String org); + @ApiOperation(value = "查询标记不良的物料及批次") public ListPager queryPartLot(String partNo, String lot, String org, Pager pager); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesInputDefectRecordController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesInputDefectRecordController.java index 07744b0..7f7d939 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesInputDefectRecordController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesInputDefectRecordController.java @@ -33,8 +33,8 @@ public class MesInputDefectRecordController { try { - return ResultBean.success("查询成功").setResultObject(inputDefectRecordService.queryPartInspection(model, "CK01")); -// return ResultBean.success("查询成功").setResultObject(inputDefectRecordService.queryPartInspection(model, AuthUtil.getOrganizeCode())); +// return ResultBean.success("查询成功").setResultObject(inputDefectRecordService.queryPartInspection(model, "CK01")); + return ResultBean.success("查询成功").setResultObject(inputDefectRecordService.queryPartInspection(model, AuthUtil.getOrganizeCode())); } catch (ImppBusiException imppException) { return ResultBean.fail(imppException); } catch (Exception e) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesNcProcessingController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesNcProcessingController.java index c382dde..4abb633 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesNcProcessingController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesNcProcessingController.java @@ -61,6 +61,20 @@ public class MesNcProcessingController { } } + @GetMapping("/query-person") + @ApiOperation(value = "查询责任人") + public ResultBean queryPerson() { + + try { + + return ResultBean.success("查询成功").setResultList(ncProcessingService.queryPerson(AuthUtil.getOrganizeCode())); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } + @PostMapping("/save-nc") @ApiOperation(value = "NC处理") @@ -71,16 +85,12 @@ public class MesNcProcessingController { ValidatorBean.checkNotNull(model.getPartInspection(), "单据不能为空"); ValidatorBean.checkNotNull(model.getPartInspectionDetailList(), "单据明细不能为空"); ValidatorBean.checkNotNull(model.getPerson(), "责任人不能为空"); -// if (StringUtils.isEmpty(model.getSn()) && (StringUtils.isEmpty(model.getPartNo()) || StringUtils.isEmpty(model.getLot()))) { -// throw new ImppBusiException("产品条码为空或零件号+批次为空"); -// } String description = MesExtEnumUtil.NC_TYPE.valueOfDescription(model.getType()); if (StringUtils.isEmpty(description)) { throw new ImppBusiException(String.format("【%s】类型不存在,请检查数据", model.getType())); } - ncProcessingService.saveNc(model, AuthUtil.getOrganizeCode()); return ResultBean.success("NC处理成功"); } catch (ImppBusiException imppException) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShippingLoadingCheckController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShippingLoadingCheckController.java index d57972f..6972ecf 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShippingLoadingCheckController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShippingLoadingCheckController.java @@ -93,8 +93,8 @@ public class MesShippingLoadingCheckController { try { - MesLoadingList order = shippingLoadingCheckService.queryLoadingOrderNoByAutoPushOrder(shippingGroupNo, "CK01"); -// MesLoadingList order = shippingLoadingCheckService.queryLoadingOrderNoByAutoPushOrder(shippingGroupNo, AuthUtil.getOrganizeCode()); +// MesLoadingList order = shippingLoadingCheckService.queryLoadingOrderNoByAutoPushOrder(shippingGroupNo, "CK01"); + MesLoadingList order = shippingLoadingCheckService.queryLoadingOrderNoByAutoPushOrder(shippingGroupNo, AuthUtil.getOrganizeCode()); return ResultBean.success("查询成功").setResultObject(order); } catch (ImppBusiException imppException) { return ResultBean.fail(imppException); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesSortShippingCheckController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesSortShippingCheckController.java index c6831f3..fc1fc00 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesSortShippingCheckController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesSortShippingCheckController.java @@ -44,6 +44,7 @@ public class MesSortShippingCheckController { // 数据校验 ValidatorBean.checkNotNull(shippingOrderManagement.getShippingCode(), "发运单不能为空"); +// shippingOrderManagement.setOrganizeCode("CK01"); shippingOrderManagement.setOrganizeCode(AuthUtil.getOrganizeCode()); MesSortShippingCheckModel model = sortShippingCheckService.queryShippingOrderNo(shippingOrderManagement); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java index 78d0ad8..bfa5960 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java @@ -80,6 +80,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService @Autowired private ISyncFuncService syncFuncService; + @Autowired + private MesDefectTypeRepository defectTypeRepository; + @Override public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel inputModel, String org) { @@ -228,12 +231,31 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //查询当前单据明细 List resultDetailList = queryResultDetailList(model, org); - model.getPartInspectionDetailList().forEach(k -> { - k.setId(null); - k.setOrganizeCode(org); - k.setPid(model.getPartInspection().getId()); - ConvertBean.serviceModelInitialize(k, AuthUtil.getSessionUser().getUserName()); - }); + List defectTypeNoExitList = new ArrayList<>(); + for (MesPartInspectionDetail detail : model.getPartInspectionDetailList()) { + + //根据页面上选择的位置 查询位置,若不存在则提示 位置不存在,请检查数据 + DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(detail.getDefectLocation(), "defectTypeCode", packBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.DEFECT_CATEGORY.POSITION.getValue(), "defectType", packBean); + MesDefectType defectType = defectTypeRepository.getByProperty(packBean); + + if (StringUtils.isEmpty(defectType)) { + defectTypeNoExitList.add(detail.getDefectLocation()); + continue; + } + + detail.setDefectTypeId(defectType.getId()); + detail.setId(null); + detail.setOrganizeCode(org); + detail.setPid(model.getPartInspection().getId()); + ConvertBean.serviceModelInitialize(detail, AuthUtil.getSessionUser().getUserName()); + + } + if (!CollectionUtils.isEmpty(defectTypeNoExitList)) { + throw new ImppBusiException(String.format("【%s】位置不存在,请检查数据", defectTypeNoExitList)); + } + partInspectionDetailRepository.saveAll(resultDetailList); partInspectionDetailRepository.saveAll(model.getPartInspectionDetailList()); @@ -260,11 +282,30 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService partInspection = createPartInspection(model, MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue(), org); partInspectionRepository.save(partInspection); - model.getPartInspectionDetailList().forEach(k -> { - k.setOrganizeCode(org); - k.setPid(partInspection.getId()); - ConvertBean.serviceModelInitialize(k, AuthUtil.getSessionUser().getUserName()); - }); + List defectTypeNoExitList = new ArrayList<>(); + for (MesPartInspectionDetail detail : model.getPartInspectionDetailList()) { + + //根据页面上选择的位置 查询位置,若不存在则提示 位置不存在,请检查数据 + DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(detail.getDefectLocation(), "defectTypeCode", packBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.DEFECT_CATEGORY.POSITION.getValue(), "defectType", packBean); + MesDefectType defectType = defectTypeRepository.getByProperty(packBean); + + if (StringUtils.isEmpty(defectType)) { + defectTypeNoExitList.add(detail.getDefectLocation()); + continue; + } + + detail.setDefectTypeId(defectType.getId()); + detail.setId(null); + detail.setOrganizeCode(org); + detail.setPid(model.getPartInspection().getId()); + ConvertBean.serviceModelInitialize(detail, AuthUtil.getSessionUser().getUserName()); + + } + if (!CollectionUtils.isEmpty(defectTypeNoExitList)) { + throw new ImppBusiException(String.format("【%s】位置不存在,请检查数据", defectTypeNoExitList)); + } partInspectionDetailRepository.saveAll(model.getPartInspectionDetailList()); @@ -288,12 +329,31 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //查询当前单据明细 List resultDetailList = queryResultDetailList(model, org); - model.getPartInspectionDetailList().forEach(k -> { - k.setId(null); - k.setOrganizeCode(org); - k.setPid(model.getPartInspection().getId()); - ConvertBean.serviceModelInitialize(k, AuthUtil.getSessionUser().getUserName()); - }); + List defectTypeNoExitList = new ArrayList<>(); + for (MesPartInspectionDetail detail : model.getPartInspectionDetailList()) { + + //根据页面上选择的位置 查询位置,若不存在则提示 位置不存在,请检查数据 + DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(detail.getDefectLocation(), "defectTypeCode", packBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.DEFECT_CATEGORY.POSITION.getValue(), "defectType", packBean); + MesDefectType defectType = defectTypeRepository.getByProperty(packBean); + + if (StringUtils.isEmpty(defectType)) { + defectTypeNoExitList.add(detail.getDefectLocation()); + continue; + } + + detail.setDefectTypeId(defectType.getId()); + detail.setId(null); + detail.setOrganizeCode(org); + detail.setPid(model.getPartInspection().getId()); + ConvertBean.serviceModelInitialize(detail, AuthUtil.getSessionUser().getUserName()); + + } + if (!CollectionUtils.isEmpty(defectTypeNoExitList)) { + throw new ImppBusiException(String.format("【%s】位置不存在,请检查数据", defectTypeNoExitList)); + } + if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { MesProduceSn produceSn = checkProduceSn(model.getSn(), org); @@ -645,17 +705,6 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService detailList = checkPartInspectionDetail(partInspection, org); } - -// if (sourceType == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { -// -// partInspection.getSn(); -// DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); -// DdlPreparedPack.getStringEqualPack(partInspection.getSn(), "sn", packBean); -// List partInspectionList = partInspectionRepository.findByHqlWhere(packBean); -// -// for() -// -// } //位置 List locationConfigList = checkLocationConfig(org); List locationCodeList = locationConfigList.stream().map(k -> k.getDefectLocation()).collect(Collectors.toList()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java index 231b277..2746857 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java @@ -19,6 +19,7 @@ import cn.estsh.i3plus.pojo.mes.bean.*; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionDetail; import cn.estsh.i3plus.pojo.mes.bean.rework.MesReworkTask; +import cn.estsh.i3plus.pojo.mes.bean.rework.MesReworkTaskDetail; import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel; import cn.estsh.i3plus.pojo.mes.repository.*; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; @@ -31,6 +32,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -82,6 +84,11 @@ public class MesNcProcessingService implements IMesNcProcessingService { private MesPartInspectionDetailRepository partInspectionDetailRepository; @Autowired private MesReworkTaskRepository reworkTaskRepository; + @Autowired + private MesReworkTaskDetailRepository reworkTaskDetailRepository; + + @Autowired + private MesDefectTypeRepository defectTypeRepository; @Override @@ -127,11 +134,20 @@ public class MesNcProcessingService implements IMesNcProcessingService { //构造返回结果 MesNcProcessingModel model = getModel(part, detailList, partInspection.getOrganizeCode()); + model.setPartInspection(partInspection); return model; } @Override + public List queryPerson(String org) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.DEFECT_CATEGORY.RESPONSIBILITY.getValue(), "", packBean); + List defectTypeList = defectTypeRepository.findByHqlWhere(packBean); + return defectTypeList; + } + + @Override public ListPager queryPartLot(String partNo, String lot, String org, Pager pager) { pager = PagerHelper.getPager(pager, ncProcessingDao.queryDefectRecordByPagerCount(partNo, lot, org)); @@ -145,27 +161,18 @@ public class MesNcProcessingService implements IMesNcProcessingService { public void saveNc(MesNcProcessingInputModel model, String org) { if (model.getPartInspection().getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { - String serialNumber = model.getPartInspection().getSn(); Integer type = model.getType(); - Integer person = model.getPerson(); - - //检查物料 - MesPart part = checkPartByPartNo(model.getPartInspection().getPartNo(), org); + MesDefectType person = model.getPerson(); //保存数据 - saveDate(model, part, type, person, org); + saveDate(model, model.getPart(), type, person, org); } else { - String partNo = model.getPartInspection().getPartNo(); - String lot = model.getPartInspection().getLot(); Integer type = model.getType(); - Integer person = model.getPerson(); - - //检查物料 - MesPart part = checkPartByPartNo(partNo, org); + MesDefectType person = model.getPerson(); //保存数据 - saveDate(model, part, type, person, org); + saveDate(model, model.getPart(), type, person, org); } } @@ -210,58 +217,6 @@ public class MesNcProcessingService implements IMesNcProcessingService { return part; } - /** - * 检查不良条码 - * - * @param serialNumber - * @param org - * @return - */ - - private List queryDefectRecordBySerialNumber(String serialNumber, String org) { - - //查询扫描的条码 - DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); - DdlPreparedPack.getStringEqualPack(serialNumber, "serialNumber", packBean); - DdlPreparedPack.getNumEqualPack(0, "ncType", packBean); - List defectRecordList = defectRecordRepository.findByHqlWhere(packBean); - - if (CollectionUtils.isEmpty(defectRecordList)) { - throw new ImppBusiException(String.format("【%s】此条码不存在可疑品记录或已经过NC处理,请检查数据", serialNumber)); - } -// -// defectRecordList.forEach(k -> { -// if (k.getNcType() != 0) { -// throw new ImppBusiException(String.format("【%s】此条码已经过NC处理,请检查数据", serialNumber)); -// } -// }); - - - return defectRecordList; - } - - private List queryDefectRecordByPartAndLot(String partNo, String Lot, String org) { - - //查询扫描的条码 - DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); - DdlPreparedPack.getStringEqualPack(partNo, "partNo", packBean); - DdlPreparedPack.getStringEqualPack(Lot, "lot", packBean); -// DdlPreparedPack.getNumEqualPack(0, "ncType", packBean); - List defectRecordList = defectRecordRepository.findByHqlWhere(packBean); - - if (CollectionUtils.isEmpty(defectRecordList)) { - throw new ImppBusiException(String.format("【%s】此物料号+【%s】批次不存在可疑品记录,请检查数据", partNo, Lot)); - } - - defectRecordList.forEach(k -> { - if (k.getNcType() != 0) { - throw new ImppBusiException(String.format("【%s】此物料号+【%s】批次已经过NC处理,请检查数据", partNo, Lot)); - } - }); - - - return defectRecordList; - } private MesPartTypePicture checkPartTypePicture(MesPart part, String org) { @@ -365,49 +320,37 @@ public class MesNcProcessingService implements IMesNcProcessingService { * @param person * @param org */ - private void saveDate(MesNcProcessingInputModel model, MesPart part, Integer type, Integer person, String org) { + private void saveDate(MesNcProcessingInputModel model, MesPart part, Integer type, MesDefectType person, String org) { if (type == MesExtEnumUtil.NC_TYPE.NORMAL.getValue()) { + //更新条码质量状态 MesProduceSn sn = checkProduceSn(model.getSn(), org); sn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName()); produceSnRepository.save(sn); + //更新检验单 + model.getPartInspection().setDefectTypeId(person.getId()); model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue()); model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.NORMAL.getValue()); ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName()); partInspectionRepository.save(model.getPartInspection()); - GenSerialNoModel serialNoModel = new GenSerialNoModel("NC_DEFECT_ZRSUM"); - serialNoModel.setPartNo(part.getPartNo()); - ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, AuthUtil.getSessionUser().getUserName(), org, 1); - String zrsum = ""; - if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) { - zrsum = (rb.getResultList().get(0)).toString(); - } - - MesMove move = new MesMove(); - move.setMatnr(part.getPartNo()); - move.setOrganizeCode(org); - move.setFactoryCode(org); - move.setLgort(configService.getCfgValue(org, "UMLGO")); - move.setUmlgo(configService.getCfgValue(org, "LGORT")); - move.setMenge(model.getPartInspection().getQty().intValue()); - move.setMeins(part.getUnit()); - move.setZrsum(zrsum); - move.setPostDate(TimeTool.getToday()); - move.setPostTime(TimeTool.getTimeShortWithColon()); - ConvertBean.serviceModelInitialize(move, AuthUtil.getSessionUser().getUserName()); + //移库 转正常 + MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "LGORT"), org); moveRepository.save(move); + } else if (type == MesExtEnumUtil.NC_TYPE.REWORK.getValue()) { - GenSerialNoModel serialNoModel1 = new GenSerialNoModel("NC_REWORK"); - serialNoModel1.setPartNo(part.getPartNo()); - ResultBean rb1 = syncFuncService.syncSerialNo(serialNoModel1, AuthUtil.getSessionUser().getUserName(), org, 1); + + //生成返工单 + GenSerialNoModel serialNoModel = new GenSerialNoModel("NC_REWORK"); + serialNoModel.setPartNo(part.getPartNo()); + ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, AuthUtil.getSessionUser().getUserName(), org, 1); String rework = ""; - if (null != rb1 && !CollectionUtils.isEmpty(rb1.getResultList())) { - rework = (rb1.getResultList().get(0)).toString(); + if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) { + rework = (rb.getResultList().get(0)).toString(); } MesReworkTask reworkTask = new MesReworkTask(); @@ -421,75 +364,65 @@ public class MesNcProcessingService implements IMesNcProcessingService { ConvertBean.serviceModelInitialize(reworkTask, AuthUtil.getSessionUser().getUserName()); reworkTaskRepository.save(reworkTask); + List taskDetailList = new ArrayList<>(); + for (MesPartInspectionDetail detail : model.getPartInspectionDetailList()) { + + MesReworkTaskDetail taskDetail = new MesReworkTaskDetail(); + taskDetail.setPid(reworkTask.getId()); + taskDetail.setStatus(MesExtEnumUtil.REWORK_TASK_DETAIL_STATUS.REWORK_TASK_DETAIL_STATUS_10.getValue()); + taskDetail.setPartInspectionDetailId(detail.getId()); + taskDetail.setOrganizeCode(org); + ConvertBean.serviceModelInitialize(taskDetail, AuthUtil.getSessionUser().getUserName()); + taskDetailList.add(taskDetail); + + } + + reworkTaskDetailRepository.saveAll(taskDetailList); + + model.getPartInspection().setDefectTypeId(person.getId()); model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.REWORK.getValue()); model.getPartInspection().setDefectTypeId(reworkTask.getId()); partInspectionRepository.save(model.getPartInspection()); + } else if (type == MesExtEnumUtil.NC_TYPE.SCRAP.getValue()) { + + //更新条码质量状态 MesProduceSn sn = checkProduceSn(model.getSn(), org); sn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue()); ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName()); produceSnRepository.save(sn); + //更新检验单 + model.getPartInspection().setDefectTypeId(person.getId()); model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue()); model.getPartInspection().setRejectQty(model.getPartInspection().getQty()); ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName()); partInspectionRepository.save(model.getPartInspection()); - GenSerialNoModel serialNoModel = new GenSerialNoModel("NC_DEFECT_ZRSUM"); - serialNoModel.setPartNo(part.getPartNo()); - ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, AuthUtil.getSessionUser().getUserName(), org, 1); - String zrsum = ""; - if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) { - zrsum = (rb.getResultList().get(0)).toString(); - } - - MesMove move = new MesMove(); - move.setMatnr(part.getPartNo()); - move.setOrganizeCode(org); - move.setFactoryCode(org); - move.setLgort(configService.getCfgValue(org, "UMLGO")); - move.setUmlgo(configService.getCfgValue(org, "LGORT")); - move.setMenge(model.getPartInspection().getQty().intValue()); - move.setMeins(part.getUnit()); - move.setZrsum(zrsum); - move.setPostDate(TimeTool.getToday()); - move.setPostTime(TimeTool.getTimeShortWithColon()); - ConvertBean.serviceModelInitialize(move, AuthUtil.getSessionUser().getUserName()); + //移库 转报废 + MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "LGORT"), org); moveRepository.save(move); } else if (type == MesExtEnumUtil.NC_TYPE.RELEASE.getValue()) { + //更新条码质量状态 MesProduceSn sn = checkProduceSn(model.getSn(), org); sn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName()); produceSnRepository.save(sn); + //更新检验单 + model.getPartInspection().setDefectTypeId(person.getId()); model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue()); model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.RELEASE.getValue()); ConvertBean.serviceModelUpdate(sn, AuthUtil.getSessionUser().getUserName()); partInspectionRepository.save(model.getPartInspection()); - GenSerialNoModel serialNoModel = new GenSerialNoModel("NC_DEFECT_ZRSUM"); - serialNoModel.setPartNo(part.getPartNo()); - ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, AuthUtil.getSessionUser().getUserName(), org, 1); - String zrsum = ""; - if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) { - zrsum = (rb.getResultList().get(0)).toString(); - } - MesMove move = new MesMove(); - move.setMatnr(part.getPartNo()); - move.setOrganizeCode(org); - move.setFactoryCode(org); - move.setLgort(configService.getCfgValue(org, "UMLGO")); - move.setUmlgo(configService.getCfgValue(org, "LGORT")); - move.setMenge(model.getPartInspection().getQty().intValue()); - move.setMeins(part.getUnit()); - move.setZrsum(zrsum); - move.setPostDate(TimeTool.getToday()); - move.setPostTime(TimeTool.getTimeShortWithColon()); - ConvertBean.serviceModelInitialize(move, AuthUtil.getSessionUser().getUserName()); + //移库 转正常 + MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "LGORT"), org); moveRepository.save(move); + } } @@ -508,4 +441,28 @@ public class MesNcProcessingService implements IMesNcProcessingService { return produceSn; } + + private MesMove createMove(MesNcProcessingInputModel model, String source, String target, String org) { + GenSerialNoModel serialNoModel = new GenSerialNoModel("INPUT_DEFECT_ZRSUM"); + serialNoModel.setPartNo(model.getPart().getPartNo()); + ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, AuthUtil.getSessionUser().getUserName(), org, 1); + String zrsum = ""; + if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) { + zrsum = (rb.getResultList().get(0)).toString(); + } + + MesMove move = new MesMove(); + move.setMatnr(model.getPart().getPartNo()); + move.setOrganizeCode(org); + move.setFactoryCode(org); + move.setLgort(source); + move.setUmlgo(target); + move.setMenge(model.getPartInspection().getQty()); + move.setMeins(model.getPart().getUnit()); + move.setZrsum(zrsum); + move.setPostDate(TimeTool.getToday()); + move.setPostTime(TimeTool.getTimeShortWithColon()); + ConvertBean.serviceModelInitialize(move, AuthUtil.getSessionUser().getUserName()); + return move; + } } 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 fc76549..553c960 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 @@ -109,7 +109,7 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS //查询最近需要扫描的装车单号 DdlPackBean orderPackBean = DdlPackBean.getDdlPackBean(org); - DdlPreparedPack.getStringEqualPack(shippingGroupNo, "partShippingGroupCode", orderPackBean); +// DdlPreparedPack.getStringEqualPack(shippingGroupNo, "partShippingGroupCode", orderPackBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.LOADING_ORDER_STATUS.CREATE.getValue(), "status", orderPackBean); DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"seq"}, orderPackBean); MesLoadingList loadingList = vehiclesOrderRepository.getByProperty(orderPackBean); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java index 042ced7..d961b78 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java @@ -114,11 +114,14 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService List detailList = shippingOrderManagementDetailRepository.findByHqlWhere(orderDetailPackBean); detailList.forEach(k -> { - if(!StringUtils.isEmpty(k.getBarcode())){ + if (!StringUtils.isEmpty(k.getBarcode())) { k.setIsScanFlg(MesCommonConstant.TRUE_INTEGER); } }); + Long count = detailList.stream().filter(k -> k.getIsScanFlg() == MesCommonConstant.TRUE_INTEGER).count(); + model.setIsScanCount(count.intValue()); + //查询最近扫描完成的装车单号 DdlPackBean recentlyOrderPackBean = DdlPackBean.getDdlPackBean(shippingOrderManagement.organizeCode); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.SHIPPING_ORDER_STATUS.SHIPPED.getValue(), "status", recentlyOrderPackBean); @@ -240,8 +243,8 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService //查询最近扫描完成的装车单号 DdlPackBean orderPackBean = DdlPackBean.getDdlPackBean(org); - DdlPreparedPack.getStringEqualPack(shippingGroupNo, "status", orderPackBean); - DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.SHIPPING_ORDER_STATUS.PUBLISHED.getValue(), "shippingGroupCode", orderPackBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.SHIPPING_ORDER_STATUS.PUBLISHED.getValue(), "status", orderPackBean); +// DdlPreparedPack.getStringEqualPack(shippingGroupNo, "shippingGroupCode", orderPackBean); DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"seq"}, orderPackBean); MesShippingOrderManagement orderManagement = shippingOrderManagementRepository.getByProperty(orderPackBean); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java index 2517f15..e0add86 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java @@ -156,7 +156,10 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService { if (setMap.containsKey(result.getSetEquipVariableId())) { String value = setMap.get(result.getSetEquipVariableId()).get(0).getEquipVariableValue(); result.setSpotCheckSetValue(value); + result.setSetValueRecordType(MesExtEnumUtil.SPOT_VALUE_RECORD_TYPE.EQUIPMENT_INPUT.getValue()); + } else { + result.setSetValueRecordType(MesExtEnumUtil.SPOT_VALUE_RECORD_TYPE.ARTIFICIAL_INPUT.getValue()); } //获取实际值地址数据 if (realMap.containsKey(result.getRealEquipVariableId())) { diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingInputModel.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingInputModel.java index bfb5bcd..7033e7a 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingInputModel.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingInputModel.java @@ -1,5 +1,7 @@ package cn.estsh.i3plus.ext.mes.pcn.pojo.model; +import cn.estsh.i3plus.pojo.mes.bean.MesDefectType; +import cn.estsh.i3plus.pojo.mes.bean.MesPart; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionDetail; import io.swagger.annotations.ApiParam; @@ -24,7 +26,10 @@ public class MesNcProcessingInputModel { private String sn; @ApiParam("责任人") - private Integer person; + private MesDefectType person; + + @ApiParam("物料") + private MesPart part; @ApiParam("NC-零件检测详情") private List partInspectionDetailList; diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingModel.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingModel.java index 8af2405..04c37cb 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingModel.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingModel.java @@ -21,13 +21,7 @@ import java.util.List; public class MesNcProcessingModel { - @ApiParam("正面位置") - List frontLocationConfigList; - - @ApiParam("背面位置") - List BackLocationConfigList; - - @ApiParam("背面位置") + @ApiParam("位置") List locationConfigList;