From 08b0b58982b7c9c55689eae1a166b7fc4ddc5556 Mon Sep 17 00:00:00 2001 From: "castle.zang" Date: Wed, 23 Oct 2024 15:30:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84sps=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pcn/api/busi/IMesPullingOrderInfoService.java | 9 +- .../pcn/apiservice/config/WebServiceConfig.java | 12 +- .../busi/MesPullingOrderInfoService.java | 145 +++++++++++++++++---- .../webservice/WebServiceServerSPS.java | 23 ++-- .../webservice/WebServiceServerSPS200.java | 35 +++++ .../ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 8 ++ 6 files changed, 186 insertions(+), 46 deletions(-) create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/webservice/WebServiceServerSPS200.java diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPullingOrderInfoService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPullingOrderInfoService.java index 63421c8..848e524 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPullingOrderInfoService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPullingOrderInfoService.java @@ -28,5 +28,12 @@ public interface IMesPullingOrderInfoService { List doMesPullingOrderInfoSend(List infoList, String userName); - Map doSPSForEquipment(String assemblyLine, String pullingGroupCode, String organizeCode); + MesPullingOrderInfo doSPSForEquipment100(); + + String doSPSForEquipmentString100(); + + MesPullingOrderInfo doSPSForEquipment200(); + + String doSPSForEquipmentString200(); + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/config/WebServiceConfig.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/config/WebServiceConfig.java index 6b259c8..4f9f813 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/config/WebServiceConfig.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/config/WebServiceConfig.java @@ -22,6 +22,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.config; import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice.DcsForEquipmentServer; import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice.WebServiceServerSPS; +import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice.WebServiceServerSPS200; import org.apache.cxf.Bus; import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.transport.servlet.CXFServlet; @@ -59,9 +60,16 @@ public class WebServiceConfig { } @Bean - public Endpoint endpointSpsEqu() { + public Endpoint endpointSpsEqu100() { EndpointImpl endpoint = new EndpointImpl(bus, new WebServiceServerSPS()); - endpoint.publish("/mes-service-spsEqu"); + endpoint.publish("/mes-service-spsEqu100"); + return endpoint; + } + + @Bean + public Endpoint endpointSpsEqu200() { + EndpointImpl endpoint = new EndpointImpl(bus, new WebServiceServerSPS200()); + endpoint.publish("/mes-service-spsEqu200"); return endpoint; } } 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 f128320..4e8e55a 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 @@ -19,6 +19,7 @@ import cn.estsh.i3plus.pojo.mes.bean.*; import cn.estsh.i3plus.pojo.mes.repository.*; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import cn.estsh.impp.framework.boot.util.SpringContextsUtil; +import com.alibaba.fastjson.JSON; import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -59,6 +60,10 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService { @Autowired private IMesPrintedSnLogRepository snLogRao; + @Autowired + private MesConfigRepository configRao; + + @Override public ListPager queryMesPullingOrderInfoByPager(MesPullingOrderInfo bean, Pager pager) { DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode()); @@ -291,40 +296,96 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService { } @Override - public Map doSPSForEquipment(String assemblyLine, String pullingGroupCode, String organizeCode) { - Map resultMap = new HashMap(); - //查询拉动单状态为已扫描=20的 拉动单 - DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_PULL_ORDER_TYPE.SPS_PULL.getValue(), "pullOrderType", seriesPackBean); - DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PULL_ORDER_STATUS.JIS_PULL.getValue(), "pullOrderStatus", seriesPackBean); - seriesPackBean.setWhereAppend(seriesPackBean.getWhereAppend() + " order by modifyDatetime desc"); + public MesPullingOrderInfo doSPSForEquipment100() { + String organizeCode = ""; + String assemblyLine = ""; - MesPullingOrderInfo mesPullingOrder = mesPullingOrderInfoRepository.getByProperty(seriesPackBean); - if (StringUtil.isEmpty(mesPullingOrder)) { - resultMap.put("success", false); - String message = "SPS拉动数据已扫描数据为空,请检查拉动单数据"; - resultMap.put("message", message); - return resultMap; + DdlPackBean packBean = DdlPackBean.getDdlPackBean(); + DdlPreparedPack.getStringEqualPack(MesPcnExtConstWords.WU_HAN_SPS_CFG_CODE,"cfgCode",packBean); + List configList = configRao.findByHqlWhere(packBean); + for (MesConfig mesConfig : configList) { + if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_WORK_CENTER_CODE_100)){ + assemblyLine = mesConfig.getCfgValue(); + }else if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_ORGANIZE_CODE)){ + organizeCode = mesConfig.getCfgValue(); + } } - //更新主表状态 源系统为25配料完成 现在-【已发送设备-30】 - mesPullingOrder.setPullOrderStatus(MesExtEnumUtil.PULL_ORDER_STATUS.SPS_PULL.getValue()); - ConvertBean.serviceModelUpdate(mesPullingOrder, "WS.SPS"); - mesPullingOrderInfoRepository.update(mesPullingOrder); - String message = "更新SPS状态成功,已发送SPS信息给设备! id:" + mesPullingOrder.getId() + "Code:" + mesPullingOrder.getPullingOrderNo() + "产线" + assemblyLine + "拉动组" + pullingGroupCode + ""; - //查询拉动组明细 - DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(mesPullingOrder.getOrganizeCode()); - DdlPreparedPack.getStringEqualPack(mesPullingOrder.getPullingOrderNo(), "pullingOrderNo", partPackBean); - List pullingOrderPartInfos = mesPullingOrderPartInfoRepository.findByHqlWhere(partPackBean); - if (!org.apache.shiro.util.CollectionUtils.isEmpty(pullingOrderPartInfos)) { - mesPullingOrder.setPartList(pullingOrderPartInfos); + if (organizeCode.isEmpty() || assemblyLine.isEmpty()) { + log.error("没有配置表mes_config,cfg_code为WU_HAN_SPS_CODE,key为WU_HAN_WORK_CENTER_CODE_100 或者 WU_HAN_ORGANIZE_CODE没有配置"); + return null; + } + return getPullingOrder(organizeCode, assemblyLine); + + } + + @Override + public String doSPSForEquipmentString100() { + String organizeCode = ""; + String assemblyLine = ""; + DdlPackBean packBean = DdlPackBean.getDdlPackBean(); + DdlPreparedPack.getStringEqualPack(MesPcnExtConstWords.WU_HAN_SPS_CFG_CODE,"cfgCode",packBean); + List configList = configRao.findByHqlWhere(packBean); + for (MesConfig mesConfig : configList) { + if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_WORK_CENTER_CODE_100)){ + assemblyLine = mesConfig.getCfgValue(); + }else if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_ORGANIZE_CODE)){ + organizeCode = mesConfig.getCfgValue(); + } + } + if (organizeCode.isEmpty() || assemblyLine.isEmpty()) { + log.error("没有配置表mes_config,cfg_code为WU_HAN_SPS_CODE,key为WU_HAN_WORK_CENTER_CODE_100 或者 WU_HAN_ORGANIZE_CODE没有配置"); + return null; + } + return JSON.toJSONString(getPullingOrder(organizeCode, assemblyLine)); + } + + @Override + public MesPullingOrderInfo doSPSForEquipment200() { + String organizeCode = ""; + String assemblyLine = ""; + DdlPackBean packBean = DdlPackBean.getDdlPackBean(); + DdlPreparedPack.getStringEqualPack(MesPcnExtConstWords.WU_HAN_SPS_CFG_CODE,"cfgCode",packBean); + List configList = configRao.findByHqlWhere(packBean); + for (MesConfig mesConfig : configList) { + if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_WORK_CENTER_CODE_200)){ + assemblyLine = mesConfig.getCfgValue(); + }else if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_ORGANIZE_CODE)){ + organizeCode = mesConfig.getCfgValue(); + } + } + if (organizeCode.isEmpty() || assemblyLine.isEmpty()) { + log.error("没有配置表mes_config,cfg_code为WU_HAN_SPS_CODE,key为WU_HAN_WORK_CENTER_CODE_100 或者 WU_HAN_ORGANIZE_CODE没有配置"); + return null; } - resultMap.put("orderInfo", mesPullingOrder); - resultMap.put("success", true); - resultMap.put("message", message); + return getPullingOrder(organizeCode, assemblyLine); + } - return resultMap; + @Override + public String doSPSForEquipmentString200() { + String organizeCode = ""; + String assemblyLine = ""; + DdlPackBean packBean = DdlPackBean.getDdlPackBean(); + DdlPreparedPack.getStringEqualPack(MesPcnExtConstWords.WU_HAN_SPS_CFG_CODE,"cfgCode",packBean); + List configList = configRao.findByHqlWhere(packBean); + for (MesConfig mesConfig : configList) { + if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_WORK_CENTER_CODE_200)){ + assemblyLine = mesConfig.getCfgValue(); + }else if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_ORGANIZE_CODE)){ + organizeCode = mesConfig.getCfgValue(); + } + } + if (organizeCode.isEmpty() || assemblyLine.isEmpty()) { + log.error("没有配置表mes_config,cfg_code为WU_HAN_SPS_CODE,key为WU_HAN_WORK_CENTER_CODE_100 或者 WU_HAN_ORGANIZE_CODE没有配置"); + return null; + } + return JSON.toJSONString(getPullingOrder(organizeCode, assemblyLine)); } +// @Override +// public Map doSPSForEquipment() { +// return Collections.emptyMap(); +// } + private boolean checkRule(MesPullingOrderPartInfo mesPullingOrderInfo, MesPartPullDetail mesPartPullDetail) { String rule = mesPartPullDetail.getRuleValidation(); if (mesPullingOrderInfo.getScanValidationType() == MesExtEnumUtil.PART_PULL_DETAIL_SCAN_VALIDATION_TYPE.HOMEMADE_VALIDATE.getValue()) { @@ -378,4 +439,32 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService { } return partInfo; } + + + + private MesPullingOrderInfo getPullingOrder(String organizeCode, String assemblyLine){ + //查询拉动单状态为已扫描=20的 拉动单 + DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(organizeCode); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_PULL_ORDER_TYPE.SPS_PULL.getValue(), "pullOrderType", seriesPackBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PULL_ORDER_STATUS.JIS_PULL.getValue(), "pullOrderStatus", seriesPackBean); + seriesPackBean.setWhereAppend(seriesPackBean.getWhereAppend() + " order by modifyDatetime desc"); + + MesPullingOrderInfo mesPullingOrder = mesPullingOrderInfoRepository.getByProperty(seriesPackBean); + if (StringUtil.isEmpty(mesPullingOrder)) { + return null; + } + //更新主表状态 源系统为25配料完成 现在-【已发送设备-30】 + DdlPackBean pullingOrderPackBean = DdlPackBean.getDdlPackBean(organizeCode); + DdlPreparedPack.getStringEqualPack(organizeCode, "organizeCode", pullingOrderPackBean); + DdlPreparedPack.getNumEqualPack(mesPullingOrder.getId(),"id", pullingOrderPackBean); + mesPullingOrderInfoRepository.updateByProperties(new String[]{"pullOrderStatus","modifyDatetime"},new Object[]{MesExtEnumUtil.PULL_ORDER_STATUS.SPS_PULL.getValue(),TimeTool.getNowTime(true)},pullingOrderPackBean); + //查询拉动组明细 + DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(mesPullingOrder.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(mesPullingOrder.getPullingOrderNo(), "pullingOrderNo", partPackBean); + List pullingOrderPartInfos = mesPullingOrderPartInfoRepository.findByHqlWhere(partPackBean); + if (!org.apache.shiro.util.CollectionUtils.isEmpty(pullingOrderPartInfos)) { + mesPullingOrder.setPartList(pullingOrderPartInfos); + } + return mesPullingOrder; + } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/webservice/WebServiceServerSPS.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/webservice/WebServiceServerSPS.java index 28212f7..fb78282 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/webservice/WebServiceServerSPS.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/webservice/WebServiceServerSPS.java @@ -1,17 +1,13 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice; import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.MesPullingOrderInfoService; -import cn.estsh.i3plus.ext.mes.pcn.pojo.model.SpsInfo; -import cn.estsh.i3plus.pojo.base.util.StringUtil; +import cn.estsh.i3plus.pojo.mes.bean.MesPullingOrderInfo; import cn.estsh.impp.framework.boot.util.SpringContextsUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.jws.WebMethod; -import javax.jws.WebParam; import javax.jws.WebService; -import java.util.HashMap; -import java.util.Map; /** * @Description : soapUI调用 http://10.193.30.22:8300/i3plus-pcn/mes-service-spsEqu?wsdl @@ -26,18 +22,15 @@ public class WebServiceServerSPS { public static final Logger LOGGER = LoggerFactory.getLogger(WebServiceServerSPS.class); @WebMethod(action = "SyncSPSForEquipmentService", operationName = "SyncSPSForEquipmentService") - public Map syncSPSForEquipment(@WebParam(name = "info") SpsInfo spsInfo) { - LOGGER.info("syncSPSForEquipment主数据:{}", spsInfo); + public MesPullingOrderInfo syncSPSForEquipment() { + MesPullingOrderInfoService bean = (MesPullingOrderInfoService) SpringContextsUtil.getBean("mesPullingOrderInfoService"); + return bean.doSPSForEquipment100(); + } + @WebMethod(action = "GetCurrentOrderJson", operationName = "GetCurrentOrderJson") + public String syncSPSForEquipmentJson() { MesPullingOrderInfoService bean = (MesPullingOrderInfoService) SpringContextsUtil.getBean("mesPullingOrderInfoService"); - if (StringUtil.isEmpty(spsInfo.getOrganizeCode())) { - Map resultMap = new HashMap(); - resultMap.put("success", false); - String message = "SPS拉动数据已扫描数据为空,请检查拉动单数据"; - resultMap.put("message", message); - return resultMap; - } - return bean.doSPSForEquipment("", "", spsInfo.getOrganizeCode()); + return bean.doSPSForEquipmentString100(); } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/webservice/WebServiceServerSPS200.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/webservice/WebServiceServerSPS200.java new file mode 100644 index 0000000..902230f --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/webservice/WebServiceServerSPS200.java @@ -0,0 +1,35 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice; + +import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.MesPullingOrderInfoService; +import cn.estsh.i3plus.pojo.mes.bean.MesPullingOrderInfo; +import cn.estsh.impp.framework.boot.util.SpringContextsUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.jws.WebMethod; +import javax.jws.WebService; + +/** + * @Description : soapUI调用 http://10.193.30.22:8300/i3plus-pcn/mes-service-spsEqu?wsdl + * @Reference : + * @Author : junsheng.li + * @CreateDate 2024/10/22 9:29 + * @Modify: + **/ + +@WebService(targetNamespace = "http://tempuri.org/services/SyncSPSForEquipmentService") +public class WebServiceServerSPS200 { + public static final Logger LOGGER = LoggerFactory.getLogger(WebServiceServerSPS200.class); + + @WebMethod(action = "GetCurrentOrder", operationName = "GetCurrentOrder") + public MesPullingOrderInfo syncSPSForEquipment() { + MesPullingOrderInfoService bean = (MesPullingOrderInfoService) SpringContextsUtil.getBean("mesPullingOrderInfoService"); + return bean.doSPSForEquipment200(); + } + + @WebMethod(action = "GetCurrentOrderJson", operationName = "GetCurrentOrderJson") + public String syncSPSForEquipmentJson() { + MesPullingOrderInfoService bean = (MesPullingOrderInfoService) SpringContextsUtil.getBean("mesPullingOrderInfoService"); + return bean.doSPSForEquipmentString200(); + } +} 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 f0ca68d..ae6f921 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 @@ -8,6 +8,14 @@ package cn.estsh.i3plus.ext.mes.pcn.pojo.util; * @Modify: **/ public class MesPcnExtConstWords { + //SPS拉动 + public static final String WU_HAN_SPS_CFG_CODE ="WU_HAN_SPS_CODE"; + //产线100 + public static final String WU_HAN_WORK_CENTER_CODE_100 ="WU_HAN_WORK_CENTER_CODE_100"; + //产线200 + public static final String WU_HAN_WORK_CENTER_CODE_200 ="WU_HAN_WORK_CENTER_CODE_200"; + + public static final String WU_HAN_ORGANIZE_CODE ="WU_HAN_ORGANIZE_CODE"; //-----------------COMMON-------------------------- //拼接00时:00分:00秒