From a8751468c7b6ecbe84199cf6b184bc6405b53d65 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Tue, 19 Dec 2023 18:11:08 +0800 Subject: [PATCH] jx pcn work cell scan busi change line off merge and recheck key part --- .../api/busi/jx/IJxProdBindRecordExtService.java | 13 ++++++ .../busi/jx/JxProdBindRecordExtService.java | 22 +++++++++ .../jx/JxSnLineOffCheckPartKeyStepService.java | 54 ---------------------- .../jx/JxSnLineOffUnBindKeyPartStepService.java | 42 +++++++++++++++++ 4 files changed, 77 insertions(+), 54 deletions(-) delete mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/step/jx/JxSnLineOffCheckPartKeyStepService.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/step/jx/JxSnLineOffUnBindKeyPartStepService.java diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/jx/IJxProdBindRecordExtService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/jx/IJxProdBindRecordExtService.java index 18d8b0a..e282fc0 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/jx/IJxProdBindRecordExtService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/jx/IJxProdBindRecordExtService.java @@ -58,4 +58,17 @@ public interface IJxProdBindRecordExtService { */ @ApiOperation(value = "判断是否存在部品条码绑定记录信息", notes = "判断是否存在部品条码绑定记录信息") Boolean getProdBindRecordIsExist(String organizeCode, String workOrderNo, String serialNumber, String workCenterCode, String workCellCode, String kpSn); + + /** + * 解绑产品绑定记录信息 + * @param organizeCode 组织代码 + * @param userInfo 操作人 + * @param workOrderNo 生产工单号 + * @param serialNumber 过程条码 + * @param workCenterCode 生产线代码 + * @param workCellCode 工位代码 + * @return 解绑条数 + */ + @ApiOperation(value = "解绑产品绑定记录信息", notes = "解绑产品绑定记录信息") + Integer doUnBindKeyPartList(String organizeCode, String userInfo, String workOrderNo, String serialNumber, String workCenterCode, String workCellCode); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/jx/JxProdBindRecordExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/jx/JxProdBindRecordExtService.java index 148382c..7465926 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/jx/JxProdBindRecordExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/jx/JxProdBindRecordExtService.java @@ -3,8 +3,10 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.jx; import cn.estsh.i3plus.ext.mes.pcn.api.busi.jx.IJxProdBindRecordExtService; import cn.estsh.i3plus.ext.mes.pcn.pojo.bean.MesProdBindRecordExt; import cn.estsh.i3plus.ext.mes.pcn.pojo.repository.MesProdBindRecordExtRepository; +import cn.estsh.i3plus.ext.mes.pcn.pojo.util.ConvertBeanExt; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtEnumUtil; +import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; @@ -74,4 +76,24 @@ public class JxProdBindRecordExtService implements IJxProdBindRecordExtService { Optional option = CollectionUtils.isEmpty(prodBindRecordList) ? null : prodBindRecordList.stream().filter(o -> (null != o && MesPcnExtEnumUtil.MES_ACTION_TYPE.BIND.getValue() == o.getActionType())).findFirst(); return (null == option || !option.isPresent()) ? false : true; } + + @Override + public Integer doUnBindKeyPartList(String organizeCode, String userInfo, String workOrderNo, String serialNumber, String workCenterCode, String workCellCode) { + if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(workOrderNo) || StringUtils.isEmpty(serialNumber) || StringUtils.isEmpty(workCenterCode) || StringUtils.isEmpty(workCellCode)) return MesPcnExtConstWords.ZERO; + List prodBindRecordExtList = prodBindRecordExtRepository.findByProperty( + new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, + MesPcnExtConstWords.WORK_ORDER_NO, MesPcnExtConstWords.SERIAL_NUMBER, MesPcnExtConstWords.WORK_CENTER_CODE, MesPcnExtConstWords.WORK_CELL_CODE}, + new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workOrderNo, serialNumber, workCenterCode, workCellCode}); + prodBindRecordExtList = CollectionUtils.isEmpty(prodBindRecordExtList) ? null : + prodBindRecordExtList.stream().filter(o -> (null != o && MesPcnExtEnumUtil.MES_ACTION_TYPE.BIND.getValue() == o.getActionType())).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(prodBindRecordExtList)) return MesPcnExtConstWords.ZERO; + for (MesProdBindRecordExt prodBindRecordExt : prodBindRecordExtList) { + if (null == prodBindRecordExt) continue; + prodBindRecordExt.setActionType(MesPcnExtEnumUtil.MES_ACTION_TYPE.UNTYING.getValue()); + ConvertBean.serviceModelUpdate(prodBindRecordExt, userInfo); + new ConvertBeanExt(prodBindRecordExt).convertBean(prodBindRecordExt); + prodBindRecordExtRepository.save(prodBindRecordExt); + } + return prodBindRecordExtList.size(); + } } \ No newline at end of file diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/step/jx/JxSnLineOffCheckPartKeyStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/step/jx/JxSnLineOffCheckPartKeyStepService.java deleted file mode 100644 index e01c62e..0000000 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/step/jx/JxSnLineOffCheckPartKeyStepService.java +++ /dev/null @@ -1,54 +0,0 @@ -package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.step.jx; - -import cn.estsh.i3plus.ext.mes.pcn.api.busi.jx.IJxProdBindRecordExtService; -import cn.estsh.i3plus.mes.pcn.serviceimpl.base.BaseStepService; -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 lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.StringUtils; - -/** - * @Description : 嘉兴下线箱包二检工步 - * @Reference : - * @Author : wangjie - * @CreateDate : 2019-07-11 - * @Modify: - **/ -@Slf4j -@Service("jxSnLineOffCheckPartKeyStepService") -public class JxSnLineOffCheckPartKeyStepService extends BaseStepService { - - @Autowired - private IJxProdBindRecordExtService prodBindRecordExtService; - - @Override - public StepResult guide(StationRequestBean reqBean) { - return execSuccessCompleteAndSendGuideReturn(reqBean, new StationResultBean(), String.format("当前产品[%s]已被标记为出货检验还线品,请扫描关键件进行复检!", reqBean.getProductSn())); - } - - @Override - public StepResult execute(StationRequestBean reqBean) { - - log.info("工厂{}生产线{}工位{}: --- STEP EXECUTE --- JxSnLineOffCheckPartKeyStepService --- START --- ", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode()); - - StationResultBean resultBean = new StationResultBean(); - - if (StringUtils.isEmpty(reqBean.getScanInfo())) execSendGuideAndThrowEx(reqBean, resultBean, String.format("当前产品[%s]已被标记为出货检验还线品,请扫描关键件进行复检!", reqBean.getProductSn())); - - String kpSn = reqBean.getScanInfo(); - - reqBean.setScanInfo(null); - - Boolean result = prodBindRecordExtService.getProdBindRecordIsExist(reqBean.getOrganizeCode(), reqBean.getWorkOrderNo(), reqBean.getSerialNumber(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), kpSn); - - log.info("工厂{}生产线{}工位{}: --- STEP EXECUTE --- JxSnLineOffCheckPartKeyStepService --- SUCCESS ---", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode()); - - if (!result) return execNonCompleteAndSendMsgReturn(reqBean, resultBean, String.format("复检失败!关键件条码[%s]复检不匹配当前出货检验还线品[%s]!", kpSn, reqBean.getProductSn())); - - return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean, String.format("复检成功!关键件条码[%s]复检已匹配当前出货检验还线品[%s]!", kpSn, reqBean.getProductSn())); - } - -} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/step/jx/JxSnLineOffUnBindKeyPartStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/step/jx/JxSnLineOffUnBindKeyPartStepService.java new file mode 100644 index 0000000..85f4643 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/step/jx/JxSnLineOffUnBindKeyPartStepService.java @@ -0,0 +1,42 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.step.jx; + +import cn.estsh.i3plus.ext.mes.pcn.api.busi.jx.IJxProdBindRecordExtService; +import cn.estsh.i3plus.mes.pcn.serviceimpl.base.BaseStepService; +import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; +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 lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @Description : 嘉兴下线关键件解绑工步 + * @Reference : + * @Author : wangjie + * @CreateDate : 2019-07-11 + * @Modify: + **/ +@Slf4j +@Service("jxSnLineOffUnBindKeyPartStepService") +public class JxSnLineOffUnBindKeyPartStepService extends BaseStepService { + + @Autowired + private IJxProdBindRecordExtService prodBindRecordExtService; + + @Override + public StepResult execute(StationRequestBean reqBean) { + + log.info("工厂{}生产线{}工位{}: --- STEP EXECUTE --- JxSnLineOffUnBindKeyPartStepService --- START --- ", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode()); + + StationResultBean resultBean = new StationResultBean(); + + Integer count = prodBindRecordExtService.doUnBindKeyPartList(reqBean.getOrganizeCode(), reqBean.getUserInfo(), reqBean.getWorkOrderNo(), reqBean.getSerialNumber(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode()); + + log.info("工厂{}生产线{}工位{}: --- STEP EXECUTE --- JxSnLineOffUnBindKeyPartStepService --- SUCCESS ---", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode()); + + return execDynamicsCompleteAndSendMsgReturn(reqBean, resultBean, StepResult.getSuccessComplete(), true, + MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, String.format("当前产品[%s]已被标记为出货检验还线品,源关键件信息[%s条]均已完成解绑!", reqBean.getProductSn(), count)); + } + +}