diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IDcsForEquipmentService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IDcsForEquipmentService.java
new file mode 100644
index 0000000..c7196d5
--- /dev/null
+++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IDcsForEquipmentService.java
@@ -0,0 +1,20 @@
+package cn.estsh.i3plus.ext.mes.pcn.api.busi;
+
+public interface IDcsForEquipmentService {
+
+ String doGetConsoleItemCode(String organizeCode,String barcode,String custCode,String custPlantCode,String workCenterCode, String workCellCode);
+
+
+ /**
+ *
+ * @param organizeCode
+ * @param barcode
+ * @param partNo 客户零件号
+ * @param result
+ * @param workCenterCode
+ * @param workCellCode
+ * @param custCode
+ * @return
+ */
+ String doFillConsoleResultExt(String organizeCode,String barcode,String partNo,String result,String workCenterCode, String workCellCode,String custCode);
+}
diff --git a/modules/i3plus-ext-mes-pcn-apiservice/pom.xml b/modules/i3plus-ext-mes-pcn-apiservice/pom.xml
index 37467ed..b7eacef 100644
--- a/modules/i3plus-ext-mes-pcn-apiservice/pom.xml
+++ b/modules/i3plus-ext-mes-pcn-apiservice/pom.xml
@@ -14,6 +14,11 @@
jar
+
+
+ org.apache.cxf
+ cxf-spring-boot-starter-jaxws
+
com.google.guava
guava
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
new file mode 100644
index 0000000..edfdb17
--- /dev/null
+++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/config/WebServiceConfig.java
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache ImppLicense, Version 2.0 (the
+ * "ImppLicense"); you may not use this file except in compliance
+ * with the ImppLicense. You may obtain a copy of the ImppLicense at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the ImppLicense is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the ImppLicense for the
+ * specific language governing permissions and limitations
+ * under the ImppLicense.
+ */
+package cn.estsh.i3plus.ext.mes.pcn.apiservice.config;
+
+
+
+import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice.DcsForEquipmentServer;
+import org.apache.cxf.Bus;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.transport.servlet.CXFServlet;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.xml.ws.Endpoint;
+
+/**
+ * @Description : WebService Server 服务配置
+ * WSDL URL: /block/softswitch/server/web-service?wsdl
+ * @Reference :
+ * @Author : wei.peng
+ * @CreateDate : 2019/9/10 下午3:13
+ * @Modify:
+ **/
+@Configuration
+public class WebServiceConfig {
+
+ @Autowired
+ private Bus bus;
+
+ @Bean("cxfServletRegistration")
+ public ServletRegistrationBean dispatcherServlet() {
+ return new ServletRegistrationBean(new CXFServlet(), "/*");
+ }
+
+ @Bean
+ public Endpoint endpoint() {
+ EndpointImpl endpoint = new EndpointImpl(bus, new DcsForEquipmentServer());
+ endpoint.publish("/DCSForEquipmentService");
+ return endpoint;
+ }
+}
diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/model/MesConsoleItemCodeExt.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/model/MesConsoleItemCodeExt.java
new file mode 100644
index 0000000..4f55b5d
--- /dev/null
+++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/model/MesConsoleItemCodeExt.java
@@ -0,0 +1,23 @@
+package cn.estsh.i3plus.ext.mes.pcn.apiservice.model;
+
+import lombok.Data;
+
+/**
+ * 点测试 GetConsoleItemCodeExt
+ */
+@Data
+public class MesConsoleItemCodeExt {
+
+ //条码
+ private String barcode;
+ //客户编码
+ private String custCode;
+ //客户工厂
+ private String custPlantCode;
+ //装配线
+ private String assemblyLine;
+ //工位
+ private String location;
+ //工厂代码
+ private String organizeCode;
+}
diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/model/MesConsoleResultExt.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/model/MesConsoleResultExt.java
new file mode 100644
index 0000000..d58ac93
--- /dev/null
+++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/model/MesConsoleResultExt.java
@@ -0,0 +1,15 @@
+package cn.estsh.i3plus.ext.mes.pcn.apiservice.model;
+
+import lombok.Data;
+
+@Data
+public class MesConsoleResultExt {
+ private String barcode;
+ private String partNO;
+ private String result;
+ private String assemblyLine;
+ private String location;
+ private String custCode;
+ private String organizeCode;
+
+}
diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/DcsForEquipmentServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/DcsForEquipmentServiceImpl.java
new file mode 100644
index 0000000..d33d46e
--- /dev/null
+++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/DcsForEquipmentServiceImpl.java
@@ -0,0 +1,141 @@
+package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
+
+import cn.estsh.i3plus.ext.mes.pcn.api.busi.IDcsForEquipmentService;
+import cn.estsh.i3plus.platform.common.convert.ConvertBean;
+import cn.estsh.i3plus.platform.common.tool.TimeTool;
+import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
+import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
+import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
+import cn.estsh.i3plus.pojo.mes.bean.*;
+import cn.estsh.i3plus.pojo.mes.repository.*;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class DcsForEquipmentServiceImpl implements IDcsForEquipmentService {
+
+ @Autowired
+ private MesCustomerSnTransformService mesCustomerSnTransformService;
+
+ @Autowired
+ private MesProduceSnRepository mesProduceSnRao;
+
+ @Autowired
+ private MesConfigRepository mesConfigRao;
+
+ @Autowired
+ private MesPcScanLogRepository scanLogRao;
+
+
+ @Autowired
+ private MesCustomerPartRepository customerPartRao;
+
+ @Override
+ public String doGetConsoleItemCode(String organizeCode,String barcode, String custCode, String custPlantCode, String workCenterCode, String workCellCode) {
+ //通用二维码组成部分('RS'为记录分隔符ASCII:30,'GS'为分组符ASCII:29,'EOT'为传输结束符ASCII:04)
+ //[)>+'RS'+06+'GS'+Y+vpps+'GS'+P+8位客户零件号+'GS'+12V+DUNS+'GS'+T+1位line num+1位班次号+2位年份+3位天数+1位追溯(精确追溯A,批次追溯@)+2工程更改记录+2位自定义+4位流水号+'RS'+'EOT'
+ //如:[)>+'RS'+06+'GS'+Y+4110000000000X+'GS'+P+12345678+'GS'+12V+545295227+'GS'+T+1A13304A2B4C0001+'RS'+'EOT'
+ //包含ASCII码的条码 65位,不包含的 58位
+
+ barcode = mesCustomerSnTransformService.transformBarCodeGm(barcode);
+
+ //todo 读取配置文件 获取工厂
+ if (StringUtils.isBlank(organizeCode)) {
+ DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
+ DdlPreparedPack.getStringEqualPack("ORGANIZE_CODE","cfgCode",ddlPackBean);
+ List organizeConfig = mesConfigRao.findByHqlWhere(ddlPackBean);
+ if (!organizeConfig.isEmpty()) {
+ organizeCode = organizeConfig.get(0).getCfgValue();
+ }
+ }
+ //2.根据条码表查询一条,排序条码表条码唯一
+ DdlPackBean producePackBean = DdlPackBean.getDdlPackBean(organizeCode);
+ DdlPreparedPack.getStringEqualPack(barcode,"custSn",producePackBean);
+ DdlPreparedPack.getOrderBy("createDatetime", CommonEnumUtil.ASC_OR_DESC.DESC.getValue(), producePackBean);
+ List produceSnList = mesProduceSnRao.findByHqlTopWhere(producePackBean, 1);
+
+
+ //4.如果在条码表中能查询出数据,插入到scanMonitor一条记录
+ if (!produceSnList.isEmpty()) {
+ MesPcScanLog scanLog = new MesPcScanLog();
+ scanLog.setScanTime(TimeTool.getNowTime(true));
+ scanLog.setWorkCenterCode(workCenterCode);
+ scanLog.setWorkCellCode(workCellCode);
+ scanLog.setCustSn(barcode);
+ scanLog.setOrganizeCode(organizeCode);
+ ConvertBean.saveOrUpdate(scanLog,"JOB");
+ scanLogRao.insert(scanLog);
+ //4.返回客户条码
+ return produceSnList.get(0).getCustPartNo();
+ }
+ return "";
+ }
+
+ @Override
+ public String doFillConsoleResultExt(String organizeCode, String barcode, String partNo, String result, String workCenterCode, String workCellCode, String custCode) {
+ barcode = mesCustomerSnTransformService.transformBarCodeGm(barcode);
+
+ if (StringUtils.isBlank(organizeCode)) {
+ DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
+ DdlPreparedPack.getStringEqualPack("ORGANIZE_CODE","cfgCode",ddlPackBean);
+ List organizeConfig = mesConfigRao.findByHqlWhere(ddlPackBean);
+ if (!organizeConfig.isEmpty()) {
+ organizeCode = organizeConfig.get(0).getCfgValue();
+ }
+ }
+
+ MesPcScanLog scanLog = new MesPcScanLog();
+ scanLog.setScanTime(TimeTool.getNowTime(true));
+ scanLog.setWorkCenterCode(workCenterCode);
+ scanLog.setWorkCellCode(workCellCode);
+ scanLog.setCustSn(barcode);
+ scanLog.setOrganizeCode(organizeCode);
+ scanLog.setRemark(partNo+":"+result);
+ ConvertBean.saveOrUpdate(scanLog,"JOB");
+ scanLogRao.insert(scanLog);
+
+ String erpPartNo = "";
+ //查询erp零件号 根据客户零件号
+ DdlPackBean custPartPackBean = DdlPackBean.getDdlPackBean(organizeCode);
+ DdlPreparedPack.getStringEqualPack(partNo,"custPartNo",custPartPackBean);
+ DdlPreparedPack.getStringEqualPack(custCode,"custCode",custPartPackBean);
+ List customerPartList = customerPartRao.findByHqlTopWhere(custPartPackBean, 1);
+ if (!customerPartList.isEmpty()){
+ erpPartNo = customerPartList.get(0).getErpPartNo();
+ }
+
+ if (StringUtils.isNotBlank(erpPartNo)){
+ //更新条码表的状态
+
+ //插入生产记录表
+
+ //插入装配件生产记录表
+ }
+ return "1";
+ }
+
+
+ private String createBarCode(String barcode){
+ String barcodeResult = "";
+ if (StringUtils.isEmpty(barcode)){
+ return barcodeResult;
+ }
+ //缺少了ascii码,根据规则拼接出来
+ //正常65 [)>06Y4110000000000XP2656085012V545238347T1A24269A2B4C0003
+ //异常58 [)>06Y4110000000000XP2656085012V545238347T1A24269A2B4C0003
+ if (barcode.length() == 58){
+ String part1 = barcode.substring(0, 3);
+ String part2 = barcode.substring(3, 5);
+ String part3 = barcode.substring(5, 20);
+ String part4 = barcode.substring(20, 29);
+ String part5 = barcode.substring(29,41);
+ String part6 = barcode.substring(41);
+
+ barcodeResult = part1 + (char)30 + part2 +(char)29 + part3 + (char)29 + part4 +(char)29 + part5 +(char)29 + part6 + (char)30 + (char)04;
+ }
+ return barcodeResult;
+ }
+}
diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesCustomerSnTransformService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesCustomerSnTransformService.java
index 51e69df..b3993dc 100644
--- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesCustomerSnTransformService.java
+++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesCustomerSnTransformService.java
@@ -16,6 +16,7 @@ public class MesCustomerSnTransformService implements IMesCustomerSnTransformSer
if (StringUtils.isEmpty(barCode)) return barCode;
if (barCode.length() != MesPcnExtConstWords.CUSTOMER_SN_LENGTH_GM) return barCode;
String a = barCode.substring(0, 3);
+ //todo 增加3-5截取
String b = barCode.substring(5, 20);
String c = barCode.substring(20, 29);
String d = barCode.substring(29, 41);
diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnAndOrderStrategyServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnAndOrderStrategyServiceImpl.java
index e5de1c4..6bccefa 100644
--- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnAndOrderStrategyServiceImpl.java
+++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/shippingscan/strategy/MesShippingScanSnAndOrderStrategyServiceImpl.java
@@ -114,8 +114,8 @@ public class MesShippingScanSnAndOrderStrategyServiceImpl implements IMesShippin
throw new ImppBusiException(String.format("目视单【%s】状态为【%s】质量状态为【%s】,不允许发运!", model.getSn(), MesExtEnumUtil.ORDER_STATUS.valueOfDescription(workOrder.getWorkOrderStatus()), MesExtEnumUtil.PRODUCE_QC_STATUS.valueOfDescription(workOrder.getQcStatus())));
}
//校验条码是否匹配
- if (!Objects.equals(detail.getBarcode(), workOrder.getSn())) {
- throw new ImppBusiException(String.format("目视单【%s】条码【%s】与扫描条码【%s】,不匹配!", model.getSn(), workOrder.getSn(), detail.getBarcode()));
+ if (!Objects.equals(detail.getBarcode(), workOrder.getCustSn())) {
+ throw new ImppBusiException(String.format("目视单【%s】条码【%s】与扫描条码【%s】,不匹配!", model.getSn(), workOrder.getCustSn(), detail.getBarcode()));
}
//校验零件是否匹配
if (!Objects.equals(detail.getPartNo(), workOrder.getPartNo())) {
diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/webservice/DcsForEquipmentServer.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/webservice/DcsForEquipmentServer.java
new file mode 100644
index 0000000..4867571
--- /dev/null
+++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/webservice/DcsForEquipmentServer.java
@@ -0,0 +1,50 @@
+package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice;
+
+import cn.estsh.i3plus.ext.mes.pcn.apiservice.model.MesConsoleItemCodeExt;
+import cn.estsh.i3plus.ext.mes.pcn.apiservice.model.MesConsoleResultExt;
+import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.DcsForEquipmentServiceImpl;
+import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+@Component
+@WebService(targetNamespace = "http://tempuri.org/")
+public class DcsForEquipmentServer {
+ public static final Logger LOGGER = LoggerFactory.getLogger(DcsForEquipmentServer.class);
+// @WebMethod(action = "GetConsoleItemCodeExt", operationName = "GetConsoleItemCodeExt")
+// public String getConsoleItemCodeExt(@WebParam(name = "GetConsoleItemCodeExt") MesConsoleItemCodeExt mesConsoleItemCodeExt) {
+// DcsForEquipmentServiceImpl bean = (DcsForEquipmentServiceImpl) SpringContextsUtil.getBean("DcsForEquipmentServiceImpl");
+// String organizeCode = mesConsoleItemCodeExt.getOrganizeCode();
+// String custCode = mesConsoleItemCodeExt.getCustCode();
+// String assemblyLine = mesConsoleItemCodeExt.getAssemblyLine();
+// String location = mesConsoleItemCodeExt.getLocation();
+// String barcode = mesConsoleItemCodeExt.getBarcode();
+// String custPlantCode = mesConsoleItemCodeExt.getCustPlantCode();
+// return bean.doGetConsoleItemCode(organizeCode,barcode,custCode,custPlantCode,assemblyLine,location);
+// }
+
+ @WebMethod(action = "GetConsoleItemCodeExt", operationName = "GetConsoleItemCodeExt")
+ public String getConsoleItemCodeExt(@WebParam(name = "organizeCode") String organizeCode, @WebParam(name = "custCode") String custCode,@WebParam(name = "assemblyLine")String assemblyLine,@WebParam(name = "location")String location,@WebParam(name = "barcode")String barcode,@WebParam(name = "custPlantCode")String custPlantCode) {
+ DcsForEquipmentServiceImpl bean = (DcsForEquipmentServiceImpl) SpringContextsUtil.getBean("DcsForEquipmentServiceImpl");
+ return bean.doGetConsoleItemCode(organizeCode,barcode,custCode,custPlantCode,assemblyLine,location);
+ }
+
+
+ @WebMethod(action = "FillConsoleResultExt", operationName = "FillConsoleResultExt")
+ public String getConsoleItemCodeExt(@WebParam(name = "FillConsoleResultExt") MesConsoleResultExt mesConsoleResultExt) {
+ DcsForEquipmentServiceImpl bean = (DcsForEquipmentServiceImpl) SpringContextsUtil.getBean("DcsForEquipmentServiceImpl");
+ String organizeCode = mesConsoleResultExt.getOrganizeCode();
+ String custCode = mesConsoleResultExt.getCustCode();
+ String assemblyLine = mesConsoleResultExt.getAssemblyLine();
+ String location = mesConsoleResultExt.getLocation();
+ String barcode = mesConsoleResultExt.getBarcode();
+ String result = mesConsoleResultExt.getResult();
+ String partNo = mesConsoleResultExt.getPartNO();
+ return bean.doFillConsoleResultExt(organizeCode,barcode,partNo,result,assemblyLine,location,custCode);
+ }
+}
diff --git a/pom.xml b/pom.xml
index 8a4dcfd..77012b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,7 +41,18 @@
-
+
+
+ org.apache.cxf
+ cxf-spring-boot-starter-jaxws
+ 3.3.6
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
+
org.springframework
spring-web