From 9b30b12a00d20a0e18148dbf3e7903cd2a9af35f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=AE=E7=AC=91=E7=9D=80=E9=9D=A2=E5=AF=B9=E6=98=8E?= =?UTF-8?q?=E5=A4=A9?= <752558143@qq.com> Date: Wed, 5 Jun 2024 18:02:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E6=AD=A5=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../busi/MesInputDefectRecordController.java | 2 +- .../controller/busi/MesReworkTaskController.java | 7 +- .../pcn/apiservice/dao/IMesNcProcessingDao.java | 4 +- .../pcn/apiservice/daoimpl/MesNcProcessingDao.java | 16 ++-- .../serviceimpl/base/MesReworkTaskServiceImpl.java | 7 +- .../busi/MesInputDefectRecordService.java | 6 +- .../serviceimpl/busi/MesNcProcessingService.java | 6 +- .../MesProductResultErrorHandleStepService.java | 101 ++++++++++++++------- .../step/MesProductSnGenerateStepService.java | 18 +++- .../MesVariableWhenFinishedReadStepService.java | 3 + .../src/main/resources/application-71.properties | 4 +- .../pcn/pojo/model/MesNcProcessingInputModel.java | 2 +- .../pojo/model/MesNcProcessingPartAndLotModel.java | 2 +- .../pojo/model/MesPartInspectionInputModel.java | 2 +- .../pcn/pojo/model/MesReworkTaskRequestModel.java | 2 +- 15 files changed, 118 insertions(+), 64 deletions(-) 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 166684e..cf44f99 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 @@ -68,7 +68,7 @@ public class MesInputDefectRecordController { try { if (StringUtils.isEmpty(model.getSn()) && - (StringUtils.isEmpty(model.getPartNo()) || StringUtils.isEmpty(model.getLot()) || StringUtils.isEmpty(model.getQty()) || model.getQty() == 0)) { + (StringUtils.isEmpty(model.getPartNo()) || StringUtils.isEmpty(model.getLotNo()) || StringUtils.isEmpty(model.getQty()) || model.getQty() == 0)) { throw new ImppBusiException("条码为空或零件号+批次+数量为空"); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesReworkTaskController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesReworkTaskController.java index 8cf9716..ff10713 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesReworkTaskController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesReworkTaskController.java @@ -18,6 +18,7 @@ import cn.estsh.impp.framework.boot.util.ResultBean; import cn.estsh.impp.framework.boot.util.ValidatorBean; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -82,7 +83,9 @@ public class MesReworkTaskController { @ApiOperation(value = "装配件查询") public ResultBean assemblyQuery(MesReworkTaskRequestModel requestModel) { // 数据校验 - ValidatorBean.checkNotNull(requestModel.getCustSn(), "客户条码不能为空"); + if (StringUtils.isEmpty(requestModel.getCustSn())) { + ResultBean.success("返工成功").setResultObject(null); + } /*ValidatorBean.checkNotNull(requestModel.getPartNo(), "零件号不能为空");*/ try { List mesProductionRecords = mesReworkTaskService.assemblyQuery(requestModel); @@ -117,7 +120,7 @@ public class MesReworkTaskController { @ApiOperation(value = "返工成功") public ResultBean reworkSuccess(MesReworkTaskRequestModel requestModel) { // 数据校验 - ValidatorBean.checkNotNull(requestModel.getSn(), "条码不能为空"); + //ValidatorBean.checkNotNull(requestModel.getSn(), "条码不能为空"); try { mesReworkTaskService.reworkSuccess(requestModel); return ResultBean.success("返工成功"); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/dao/IMesNcProcessingDao.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/dao/IMesNcProcessingDao.java index 6adbd14..a0066ff 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/dao/IMesNcProcessingDao.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/dao/IMesNcProcessingDao.java @@ -9,9 +9,9 @@ import java.util.List; public interface IMesNcProcessingDao { @ApiOperation(value = "查询返工返修数据") - int queryDefectRecordByPagerCount(String partNo, String lot, String org); + int queryDefectRecordByPagerCount(String partNo, String lotNo, String org); @ApiOperation(value = "查询停工统计数据") - List queryDefectRecordByPager(String partNo, String lot, String org, Pager pager); + List queryDefectRecordByPager(String partNo, String lotNo, String org, Pager pager); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/daoimpl/MesNcProcessingDao.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/daoimpl/MesNcProcessingDao.java index 5cd3d91..5cf65fa 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/daoimpl/MesNcProcessingDao.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/daoimpl/MesNcProcessingDao.java @@ -21,7 +21,7 @@ public class MesNcProcessingDao implements IMesNcProcessingDao { private EntityManager entityManager; @Override - public int queryDefectRecordByPagerCount(String partNo, String lot, String org) { + public int queryDefectRecordByPagerCount(String partNo, String lotNo, String org) { StringBuffer hql = new StringBuffer(); hql.append("select count(1) from mes_defect_record as mdr "); @@ -29,9 +29,9 @@ public class MesNcProcessingDao implements IMesNcProcessingDao { hql.append(" and mdr.isValid = :isValid "); hql.append(" and mdr.isDeleted = :isDeleted "); hql.append(" and mdr.part_no = :partNo "); - hql.append(" and mdr.lot = :lot "); + hql.append(" and mdr.lotNo = :lotNo "); hql.append(" and mdr.nc_type = 0 "); - hql.append(" group by mdr.part_no , mdr.lot "); + hql.append(" group by mdr.part_no , mdr.lotNo "); Query query = entityManager.createNativeQuery(hql.toString()); @@ -47,17 +47,17 @@ public class MesNcProcessingDao implements IMesNcProcessingDao { } @Override - public List queryDefectRecordByPager(String partNo, String lot, String org, Pager pager) { + public List queryDefectRecordByPager(String partNo, String lotNo, String org, Pager pager) { StringBuffer hql = new StringBuffer(); - hql.append("select mdr.part_no ,mdr.part_name , mdr.lot from mes_defect_record as mdr "); + hql.append("select mdr.part_no ,mdr.part_name , mdr.lotNo from mes_defect_record as mdr "); hql.append(" where mdr.organizeCode = :organizeCode "); hql.append(" and mdr.isValid = :isValid "); hql.append(" and mdr.isDeleted = :isDeleted "); hql.append(" and mdr.part_no = :partNo "); - hql.append(" and mdr.lot = :lot "); + hql.append(" and mdr.lotNo = :lotNo "); hql.append(" and mdr.nc_type = 0 "); - hql.append(" group by mdr.part_no ,mdr.part_name , mdr.lot "); + hql.append(" group by mdr.part_no ,mdr.part_name , mdr.lotNo "); Query query = entityManager.createNativeQuery(hql.toString()); @@ -83,7 +83,7 @@ public class MesNcProcessingDao implements IMesNcProcessingDao { String defectLot = String.valueOf(cells[2]); model.setPartNo(defectPartNo); model.setPartName(defectPartName); - model.setLot(defectLot); + model.setLotNo(defectLot); modelList.add(model); } return modelList; diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java index c2912e9..6b8ba42 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java @@ -267,7 +267,12 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { private MesReworkTask getMesReworkTask(MesReworkTaskRequestModel requestModel) { DdlPackBean packBean = DdlPackBean.getDdlPackBean(requestModel.getOrganizeCode()); - DdlPreparedPack.getStringEqualPack(requestModel.getSn(), "sn", packBean); + if (!StringUtils.isEmpty(requestModel.getSn())) { + DdlPreparedPack.getStringEqualPack(requestModel.getSn(), "sn", packBean); + } + if (!StringUtils.isEmpty(requestModel.getReworkOrder())) { + DdlPreparedPack.getStringEqualPack(requestModel.getReworkOrder(), "reworkOrder", packBean); + } DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.REWORK_TASK_STATUS.CREATE.getValue(), "status", packBean); MesReworkTask res = mesReworkTaskRepository.getByProperty(packBean); 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 4835585..bd1b0e9 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 @@ -108,7 +108,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService } else { // 数据校验 ValidatorBean.checkNotNull(inputModel.getPartNo(), "物料不能为空"); - ValidatorBean.checkNotNull(inputModel.getLot(), "批次不能为空"); + ValidatorBean.checkNotNull(inputModel.getLotNo(), "批次不能为空"); ValidatorBean.checkNotNull(inputModel.getFrontBack(), "正反面不能为空"); ValidatorBean.checkNotNull(inputModel.getQty(), "数量不能为空"); @@ -408,7 +408,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //根据扫描的条码查询条码是否存在 DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); DdlPreparedPack.getStringEqualPack(inputModel.getPartNo(), "partNo", packBean); - DdlPreparedPack.getStringEqualPack(inputModel.getLot(), "lot", packBean); + DdlPreparedPack.getStringEqualPack(inputModel.getLotNo(), "lotNo", packBean); DdlPreparedPack.getNumEqualPack(inputModel.getQty(), "qty", packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue(), "sourceType", packBean); DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean); @@ -547,7 +547,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService partInspection.setInspectionStatus(inspectionStatus); partInspection.setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue()); partInspection.setSn(model.getSn()); - partInspection.setLotNo(model.getLot()); + partInspection.setLotNo(model.getLotNo()); partInspection.setQty(model.getQty()); partInspection.setWorkCenterCode(model.getWorkCenterCode()); partInspection.setShiftCode(model.getShiftCode()); 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 90bd10b..1f4de79 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 @@ -148,11 +148,11 @@ public class MesNcProcessingService implements IMesNcProcessingService { } @Override - public ListPager queryPartLot(String partNo, String lot, String org, Pager pager) { + public ListPager queryPartLot(String partNo, String lotNo, String org, Pager pager) { - pager = PagerHelper.getPager(pager, ncProcessingDao.queryDefectRecordByPagerCount(partNo, lot, org)); + pager = PagerHelper.getPager(pager, ncProcessingDao.queryDefectRecordByPagerCount(partNo, lotNo, org)); - List modelList = ncProcessingDao.queryDefectRecordByPager(partNo, lot, org, pager); + List modelList = ncProcessingDao.queryDefectRecordByPager(partNo, lotNo, org, pager); return new ListPager(modelList, pager); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java index 8e8900c..7b741a1 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java @@ -2,25 +2,39 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; import akka.actor.ActorRef; import akka.actor.ActorSystem; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesNcProcessingService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesCellEquipContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.ActorMessage; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesNcProcessingInputModel; import cn.estsh.i3plus.mes.pcn.config.SpringExtProvider; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; +import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; +import cn.estsh.i3plus.pojo.base.enumutil.MesEnumUtil; +import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; +import cn.estsh.i3plus.pojo.mes.bean.MesDefectType; import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; +import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection; +import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionDetail; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; import cn.estsh.i3plus.pojo.mes.model.StationResultBean; import cn.estsh.i3plus.pojo.mes.model.StepResult; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; +import com.google.common.base.Objects; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -36,12 +50,10 @@ public class MesProductResultErrorHandleStepService extends BaseStepService { private SnowflakeIdMaker snowflakeIdMaker; @Autowired - private ActorSystem actorSystem; - - @Autowired private IMesProductionProcessContextStepService productionProcessContextStepService; - + @Autowired + private IMesNcProcessingService ncProcessingService; @Autowired private IMesProductionDispatchContextStepService mesProductionDispatchContextStepService; @@ -53,38 +65,61 @@ public class MesProductResultErrorHandleStepService extends BaseStepService { @Override public StepResult execute(StationRequestBean reqBean) { + StepResult stepResult = StepResult.getSuccessComplete(); StationResultBean resultBean = new StationResultBean(); - StepResult stepResult = StepResult.getSuccessComplete(); + MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getEquipmentVariableList(reqBean, MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PRODUCTION.getValue()); - // 获取上下文信息 - MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getCurCellEquipment(reqBean); + String result = mesProductionDispatchContextStepService.getProductResultContext(reqBean); + // 如果是报废或者可疑,需要编辑条码状态为不合格、并且nc判定需要新增一条记录 + if (!Objects.equal(MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.PRODUCT_SCRAP.getValue(), result)) { + return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "加工结果合格,无需记录异常"); + } + String defectTypeCode = MesEnumUtil.DEFECT_TYPE_CODE.BACK_SPRAY.getValue(); - // 获取条码信息 List mesProduceSns = mesProductionDispatchContextStepService.getOutProduceSnDataContext(reqBean); - // 通过上下文获取工位设备信息 - MesCellEquipContext curCellEquip = productionProcessContext.getCurCellEquip(); - - String mesProduceSnsStr = !CollectionUtils.isEmpty(mesProduceSns) ? JSONObject.toJSONString(mesProduceSns) : null; - ActorMessage actorMessage = ActorMessage.builder() - .equipmentCode(curCellEquip.getEquipmentCode()) - .equipId(curCellEquip.getEquipId()) - .organizeCode(reqBean.getOrganizeCode()) - .organizeName(reqBean.getOrganizeName()) - .workCellCode(reqBean.getWorkCellCode()) - .workCenterCode(reqBean.getWorkCenterCode()) - .areaCode(reqBean.getAreaCode()) - .craftCode(productionProcessContext.getCraftCode()) - .processCode(reqBean.getProcessCode()) - .produceSnJson(mesProduceSnsStr) - .userName(reqBean.getUserInfo()) - .build(); - // 数据采集信息需要存放到 redis中 - String key = this.getFsmBusikey(reqBean, MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.name()); - ActorRef ref = refMap.computeIfAbsent(key, - k -> actorSystem.actorOf(SpringExtProvider.getInstance().get(actorSystem).create("mesHandlerEquipLogActor"), key)); - ref.tell(actorMessage, ActorRef.noSender()); - - return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "保存工艺参数成功"); - } + + mesProduceSns.forEach(mesProduceSn -> { + MesNcProcessingInputModel model = new MesNcProcessingInputModel(); + MesDefectType mesDefectType = new MesDefectType(); + mesDefectType.setBackDefect(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + mesDefectType.setDefectTypeCode(defectTypeCode); + mesDefectType.setDefectTypeName(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getDescription()); + //mesDefectType.setDefectType(MesExtEnumUtil.MES_DEFECT_TYPE); + model.setSn(mesProduceSn.getProductSn()); + model.setPerson(mesDefectType); + + MesPartInspection partInspection = new MesPartInspection(); + + Long id = snowflakeIdMaker.nextId(); + partInspection.setWorkCenterCode(reqBean.getWorkCenterCode()); + partInspection.setSourceType(MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()); + partInspection.setPartNo(mesProduceSn.getPartNo()); + partInspection.setPartName(mesProduceSn.getPartNameRdd()); + partInspection.setDefectTypeCode(mesDefectType.getDefectTypeCode()); + partInspection.setInspectionDate(DateUtil.format(new Date(), DatePattern.NORM_DATETIME_FORMATTER)); + partInspection.setLotNo(mesProduceSn.getLotNo()); + partInspection.setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue()); + partInspection.setRejectQty(mesProduceSn.getQty().intValue()); + partInspection.setShiftCode(mesProduceSn.getShiftCode()); + partInspection.setSn(mesProduceSn.getProductSn()); + partInspection.setQty(mesProduceSn.getQty().intValue()); + partInspection.setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue()); + partInspection.setId(id); + ConvertBean.serviceModelInitialize(partInspection, reqBean.getUserInfo()); + + MesPartInspectionDetail mesPartInspectionDetail = new MesPartInspectionDetail(); + mesPartInspectionDetail.setPid(id); + mesPartInspectionDetail.setStatus(10); + mesPartInspectionDetail.setDefectTypeCode(mesDefectType.getDefectTypeCode()); + mesPartInspectionDetail.setDefectTypeName(mesDefectType.getDefectTypeName()); + model.setPartInspection(partInspection); + model.setPartInspectionDetailList(Arrays.asList(mesPartInspectionDetail)); + ncProcessingService.saveNc(model, reqBean.getOrganizeCode()); + }); + + return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "加工异常处理成功"); + + + } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnGenerateStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnGenerateStepService.java index bfc29db..eac6cb9 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnGenerateStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnGenerateStepService.java @@ -22,6 +22,7 @@ import cn.estsh.i3plus.pojo.mes.repository.MesPartRepository; import cn.estsh.i3plus.pojo.mes.repository.MesProduceSnRepository; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import cn.hutool.core.date.DateUtil; +import com.google.common.base.Objects; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -65,6 +66,7 @@ public class MesProductSnGenerateStepService extends BaseStepService { StationResultBean resultBean = new StationResultBean(); StepResult stepResult = StepResult.getSuccessComplete(); + String result = mesProductionDispatchContextStepService.getProductResultContext(reqBean); // 获取上下文信息 MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getEquipmentVariableList(reqBean, MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PRODUCTION.getValue()); MesWorkCell mesWorkCell = productionProcessContext.getWorkCell(); @@ -73,7 +75,7 @@ public class MesProductSnGenerateStepService extends BaseStepService { // 获取零件号,可能存在多个 List partNoList = productionPartContextList.stream().map(MesProductionPartContext::getPartNo).collect(Collectors.toList()); // 根据零件号组装产品条码信息 - List mesProduceSns = generateSn(reqBean, productionProcessContext, mesWorkCell, partNoList); + List mesProduceSns = generateSn(reqBean, productionProcessContext, mesWorkCell, partNoList, result); // 保存条码信息 mesProduceSnRepository.saveAll(mesProduceSns); // 放到上下文 @@ -90,7 +92,7 @@ public class MesProductSnGenerateStepService extends BaseStepService { * @param partNoList * @return */ - private List generateSn(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext, MesWorkCell mesWorkCell, List partNoList) { + private List generateSn(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext, MesWorkCell mesWorkCell, List partNoList, String result) { List mesProduceSns = new ArrayList<>(); for (String partNo : partNoList) { DdlPackBean packBean = DdlPackBean.getDdlPackBean(reqBean.getOrganizeCode()); @@ -102,7 +104,7 @@ public class MesProductSnGenerateStepService extends BaseStepService { // 根据条码规则生成条码 String sn = generateByRule(mesPart); // 组装条码信息 - MesProduceSn mesProduceSn = generateMesProduceSn(mesPart, sn, mesWorkCell, productionProcessContext, reqBean); + MesProduceSn mesProduceSn = generateMesProduceSn(mesPart, sn, mesWorkCell, productionProcessContext, reqBean, result); ConvertBean.serviceModelInitialize(mesProduceSn, reqBean.getUserInfo()); mesProduceSns.add(mesProduceSn); } @@ -122,7 +124,7 @@ public class MesProductSnGenerateStepService extends BaseStepService { return resultList.get(0); } - private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, MesWorkCell mesWorkCell,MesProductionProcessContext productionProcessContext, StationRequestBean reqBean) { + private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, MesWorkCell mesWorkCell,MesProductionProcessContext productionProcessContext, StationRequestBean reqBean, String result) { long serialNum = snowflakeIdMaker.nextId(); MesProduceSn mesProduceSn = new MesProduceSn(); @@ -139,7 +141,13 @@ public class MesProductSnGenerateStepService extends BaseStepService { mesProduceSn.setProcessLabelTemplate(mesPart.getProcessLabelTemplate()); mesProduceSn.setQty(1d); mesProduceSn.setSnStatus(10); - mesProduceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); + Integer qcStatus = MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue(); + if (Objects.equal(MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.PRODUCT_SCRAP.getValue(), result)) { + qcStatus = MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue(); + } else if (Objects.equal(MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.PRODUCT_SUSPICIOUS.getValue(), result)) { + qcStatus = MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue(); + } + mesProduceSn.setQcStatus(qcStatus); mesProduceSn.setLotNo(DateUtil.format(new Date(), "YYYYMMDD")); mesProduceSn.setRouteCode(reqBean.getRouteCode()); mesProduceSn.setProcessCode(productionProcessContext.getProcessCode()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesVariableWhenFinishedReadStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesVariableWhenFinishedReadStepService.java index e663395..6825d19 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesVariableWhenFinishedReadStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesVariableWhenFinishedReadStepService.java @@ -80,6 +80,9 @@ public class MesVariableWhenFinishedReadStepService extends BaseStepService { .userName(reqBean.getUserInfo()) .build(); // 数据采集信息需要存放到 redis中 + + // 需要保存磨具号 + String key = this.getFsmBusikey(reqBean, MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.name()); ActorRef ref = refMap.computeIfAbsent(key, k -> actorSystem.actorOf(SpringExtProvider.getInstance().get(actorSystem).create("mesHandlerEquipLogActor"), key)); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/resources/application-71.properties b/modules/i3plus-ext-mes-pcn-apiservice/src/main/resources/application-71.properties index 1f61c78..2486caf 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/resources/application-71.properties +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/resources/application-71.properties @@ -1,7 +1,7 @@ #\u9879\u76EE\u7AEF\u53E3 server.port=8350 #\u672C\u673Aip -impp.server.ip=10.196.77.226 +impp.server.ip=10.196.76.180 #impp.server.ip=192.168.0.105 #andon ip impp.andon.url=http://10.195.88.71:8750 @@ -24,7 +24,7 @@ impp.cluster.regist.center=http://10.195.88.71:8000/eureka/ logging.config=classpath:log4j2-spring.xml mes.ws=ws://10.197.190.121:8300/ws/pcn-regist/ #mes-pcn.ws.path=ws://10.197.176.77:8350 -mes-pcn.ws.path=ws://10.196.77.226:8350 +mes-pcn.ws.path=ws://10.196.76.180:8350 pcn.code=PCN-U7 ########\u5E73\u53F0\u76F8\u5173\u53C2\u6570########## #\u662F\u5426\u5F00\u542Fredis\u7F13\u5B58 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 768958d..32d267a 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 @@ -18,7 +18,7 @@ import java.util.List; * @Modify: **/ @Data -public class MesNcProcessingInputModel { +public class MesNcProcessingInputModel { @ApiParam("类型") private Integer type; diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingPartAndLotModel.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingPartAndLotModel.java index 169b00c..9cf0da5 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingPartAndLotModel.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingPartAndLotModel.java @@ -21,7 +21,7 @@ public class MesNcProcessingPartAndLotModel { private String partName; @ApiParam("批次") - private String lot; + private String lotNo; } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartInspectionInputModel.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartInspectionInputModel.java index b846ec5..eb1c9a5 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartInspectionInputModel.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartInspectionInputModel.java @@ -38,7 +38,7 @@ public class MesPartInspectionInputModel { private Integer frontBack; @ApiParam("批次") - private String lot; + private String lotNo; @ApiParam("数量") private Integer qty; diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesReworkTaskRequestModel.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesReworkTaskRequestModel.java index 8860716..310ba54 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesReworkTaskRequestModel.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesReworkTaskRequestModel.java @@ -19,11 +19,11 @@ public class MesReworkTaskRequestModel { * 条码 */ private String custSn; + /** * 返工单 */ private String reworkOrder; - /** * 零件号 */