diff --git a/common/src/main/java/com/foreverwin/mesnac/common/constant/IntegrationTypeConstant.java b/common/src/main/java/com/foreverwin/mesnac/common/constant/IntegrationTypeConstant.java
new file mode 100644
index 00000000..adfc49ab
--- /dev/null
+++ b/common/src/main/java/com/foreverwin/mesnac/common/constant/IntegrationTypeConstant.java
@@ -0,0 +1,6 @@
+package com.foreverwin.mesnac.common.constant;
+
+public class IntegrationTypeConstant {
+
+ public static final String ITEM = "ITEM";
+}
diff --git a/console/src/main/resources/application-local.yml b/console/src/main/resources/application-local.yml
index 65e0358d..a232ddff 100644
--- a/console/src/main/resources/application-local.yml
+++ b/console/src/main/resources/application-local.yml
@@ -38,9 +38,9 @@ mobile:
#微信服务配置
wechat:
- corpId: ww1adffc974ec4f75f
+ corpId: wwe165c947675eca6e
agentId: 1000002
- secret: D1F_QMAUm2ZS5fsFwz6k-HDRkn1HhsWWc-dQjfm4CvQ
+ secret: 12xgztk0Z7RqehAl6CnoGmmyD0LTJKhQOldoMm5gYhE
accessTokenUrl: https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=ID&corpsecret=SECRET
postUrl: https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=ACCESS_TOKEN
diff --git a/console/src/main/resources/application.yml b/console/src/main/resources/application.yml
index 43014bd5..b6c5feaf 100644
--- a/console/src/main/resources/application.yml
+++ b/console/src/main/resources/application.yml
@@ -54,7 +54,7 @@ mybatis-plus:
typeAliasesPackage: com.foreverwin.**.model
# 配置mapper的扫描,找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
- statement-lazy-load: false
+ statement-lazy-load: true
#dialectClass: com.foreverwin.modular.core.mybatisplus.plugins.pagination.dialects.HanaDialect
# 加载全局的配置文件
# configuration:
diff --git a/dispatch/pom.xml b/dispatch/pom.xml
index a7310378..0eb43fec 100644
--- a/dispatch/pom.xml
+++ b/dispatch/pom.xml
@@ -57,16 +57,6 @@
3.8
-
- org.springframework.boot
- spring-boot-starter-activemq
-
-
-
- org.apache.activemq
- activemq-pool
-
-
commons-lang
commons-lang
diff --git a/integration/pom.xml b/integration/pom.xml
index e37e3348..7957ff05 100644
--- a/integration/pom.xml
+++ b/integration/pom.xml
@@ -34,5 +34,10 @@
com.foreverwin.mesnac
common
+
+
+ com.foreverwin.mesnac
+ meapi
+
\ No newline at end of file
diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/controller/IntegrationLogController.java b/integration/src/main/java/com/foreverwin/mesnac/integration/controller/IntegrationLogController.java
new file mode 100644
index 00000000..d7fb0e6f
--- /dev/null
+++ b/integration/src/main/java/com/foreverwin/mesnac/integration/controller/IntegrationLogController.java
@@ -0,0 +1,19 @@
+package com.foreverwin.mesnac.integration.controller;
+
+
+import com.foreverwin.mesnac.integration.service.IntegrationLogService;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *
+ * @author Leon.L
+ * @since 2021-06-16
+ */
+@RestController
+@RequestMapping("/Z-INTEGRATION-LOG")
+public class IntegrationLogController {
+
+
+}
\ No newline at end of file
diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/controller/TestController.java b/integration/src/main/java/com/foreverwin/mesnac/integration/controller/TestController.java
index b8559aed..2bfa7028 100644
--- a/integration/src/main/java/com/foreverwin/mesnac/integration/controller/TestController.java
+++ b/integration/src/main/java/com/foreverwin/mesnac/integration/controller/TestController.java
@@ -13,11 +13,12 @@ import org.springframework.web.bind.annotation.RestController;
public class TestController {
-
+ @Autowired
private SendMail sendMail;
+ @Autowired
private SendWeChat sendWeChat;
- @GetMapping()
+ @GetMapping("/sendMail")
public R test(String to, String subject, String content) {
sendMail.sendText(to, subject, content);
return R.ok(content);
diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/mapper/IntegrationLogMapper.java b/integration/src/main/java/com/foreverwin/mesnac/integration/mapper/IntegrationLogMapper.java
new file mode 100644
index 00000000..041088bb
--- /dev/null
+++ b/integration/src/main/java/com/foreverwin/mesnac/integration/mapper/IntegrationLogMapper.java
@@ -0,0 +1,18 @@
+package com.foreverwin.mesnac.integration.mapper;
+
+import com.foreverwin.mesnac.integration.model.IntegrationLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ *
+ * Mapper 接口
+ *
+ *
+ * @author Leon.L
+ * @since 2021-06-16
+ */
+@Repository
+public interface IntegrationLogMapper extends BaseMapper {
+
+}
\ No newline at end of file
diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/model/IntegrationLog.java b/integration/src/main/java/com/foreverwin/mesnac/integration/model/IntegrationLog.java
new file mode 100644
index 00000000..a96539c3
--- /dev/null
+++ b/integration/src/main/java/com/foreverwin/mesnac/integration/model/IntegrationLog.java
@@ -0,0 +1,263 @@
+package com.foreverwin.mesnac.integration.model;
+
+import java.io.Serializable;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.IdType;
+
+/**
+ *
+ *
+ *
+ *
+ * @author Leon.L
+ * @since 2021-06-16
+ */
+
+@TableName("Z_INTEGRATION_LOG")
+public class IntegrationLog extends Model {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键
+ */
+ @TableId(value = "HANDLE", type = IdType.INPUT)
+ private String handle;
+ /**
+ * 站点
+ */
+ @TableField("SITE")
+ private String site;
+ /**
+ * ITEM/物料,SHOP_ORDER/工单,ROUTER/工艺,BOM/物料清单,BJOB/报工
+ */
+ @TableField("INTEGRATION_TYPE")
+ private String integrationType;
+ /**
+ * REQUEST/请求,RESPONSE/回传
+ */
+ @TableField("CATEGORY")
+ private String category;
+ /**
+ * ERP/DNC/CAPP
+ */
+ @TableField("INTEGRATION_WAY")
+ private String integrationWay;
+ /**
+ * 接口实现方法
+ */
+ @TableField("INTEGRATION_METHOD")
+ private String integrationMethod;
+ /**
+ * 接口对应主表的handle
+ */
+ @TableField("HANDLE_OBJ")
+ private String handleObj;
+ /**
+ * SFC主键
+ */
+ @TableField("SFC_BO")
+ private String sfcBo;
+ /**
+ * 请求参数
+ */
+ @TableField("PARAM")
+ private String param;
+ /**
+ * S/成功,E/失败
+ */
+ @TableField("STATUS")
+ private String status;
+ /**
+ * 返回消息
+ */
+ @TableField("RESULT_MESSAGE")
+ private String resultMessage;
+ /**
+ * 唯一编码
+ */
+ @TableField("TRANSACTION_ID")
+ private String transactionId;
+ /**
+ * 请求时间
+ */
+ @TableField("REQUEST_DATE_TIME")
+ private LocalDateTime requestDateTime;
+ /**
+ * 创建时间
+ */
+ @TableField("CREATED_DATE_TIME")
+ private LocalDateTime createdDateTime;
+
+
+ public String getHandle() {
+ return handle;
+ }
+
+ public void setHandle(String handle) {
+ this.handle = handle;
+ }
+
+ public String getSite() {
+ return site;
+ }
+
+ public void setSite(String site) {
+ this.site = site;
+ }
+
+ public String getIntegrationType() {
+ return integrationType;
+ }
+
+ public void setIntegrationType(String integrationType) {
+ this.integrationType = integrationType;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ public String getIntegrationWay() {
+ return integrationWay;
+ }
+
+ public void setIntegrationWay(String integrationWay) {
+ this.integrationWay = integrationWay;
+ }
+
+ public String getIntegrationMethod() {
+ return integrationMethod;
+ }
+
+ public void setIntegrationMethod(String integrationMethod) {
+ this.integrationMethod = integrationMethod;
+ }
+
+ public String getHandleObj() {
+ return handleObj;
+ }
+
+ public void setHandleObj(String handleObj) {
+ this.handleObj = handleObj;
+ }
+
+ public String getSfcBo() {
+ return sfcBo;
+ }
+
+ public void setSfcBo(String sfcBo) {
+ this.sfcBo = sfcBo;
+ }
+
+ public String getParam() {
+ return param;
+ }
+
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getResultMessage() {
+ return resultMessage;
+ }
+
+ public void setResultMessage(String resultMessage) {
+ this.resultMessage = resultMessage;
+ }
+
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ public void setTransactionId(String transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ public LocalDateTime getRequestDateTime() {
+ return requestDateTime;
+ }
+
+ public void setRequestDateTime(LocalDateTime requestDateTime) {
+ this.requestDateTime = requestDateTime;
+ }
+
+ public LocalDateTime getCreatedDateTime() {
+ return createdDateTime;
+ }
+
+ public void setCreatedDateTime(LocalDateTime createdDateTime) {
+ this.createdDateTime = createdDateTime;
+ }
+
+ public static final String HANDLE = "HANDLE";
+
+ public static final String SITE = "SITE";
+
+ public static final String INTEGRATION_TYPE = "INTEGRATION_TYPE";
+
+ public static final String CATEGORY = "CATEGORY";
+
+ public static final String INTEGRATION_WAY = "INTEGRATION_WAY";
+
+ public static final String INTEGRATION_METHOD = "INTEGRATION_METHOD";
+
+ public static final String HANDLE_OBJ = "HANDLE_OBJ";
+
+ public static final String SFC_BO = "SFC_BO";
+
+ public static final String PARAM = "PARAM";
+
+ public static final String STATUS = "STATUS";
+
+ public static final String RESULT_MESSAGE = "RESULT_MESSAGE";
+
+ public static final String TRANSACTION_ID = "TRANSACTION_ID";
+
+ public static final String REQUEST_DATE_TIME = "REQUEST_DATE_TIME";
+
+ public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
+
+
+ @Override
+ protected Serializable pkVal() {
+ return this.handle;
+ }
+
+ @Override
+ public String toString() {
+ return "IntegrationLog{" +
+ "handle = " + handle +
+ ", site = " + site +
+ ", integrationType = " + integrationType +
+ ", category = " + category +
+ ", integrationWay = " + integrationWay +
+ ", integrationMethod = " + integrationMethod +
+ ", handleObj = " + handleObj +
+ ", sfcBo = " + sfcBo +
+ ", param = " + param +
+ ", status = " + status +
+ ", resultMessage = " + resultMessage +
+ ", transactionId = " + transactionId +
+ ", requestDateTime = " + requestDateTime +
+ ", createdDateTime = " + createdDateTime +
+ "}";
+ }
+}
\ No newline at end of file
diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/model/WebServiceDto.java b/integration/src/main/java/com/foreverwin/mesnac/integration/model/WebServiceDto.java
new file mode 100644
index 00000000..ce3bef47
--- /dev/null
+++ b/integration/src/main/java/com/foreverwin/mesnac/integration/model/WebServiceDto.java
@@ -0,0 +1,63 @@
+package com.foreverwin.mesnac.integration.model;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+public class WebServiceDto {
+
+ @JSONField(name="HANDLE")
+ private String HANDLE;
+ @JSONField(name="STATUS")
+ private String STATUS;
+ @JSONField(name="MESSAGE")
+ private String MESSAGE;
+
+ public static WebServiceDto success(String message) {
+ WebServiceDto webServiceDto = new WebServiceDto();
+ webServiceDto.setSTATUS("S");
+ webServiceDto.setMESSAGE(message);
+
+ return webServiceDto;
+ }
+
+ public static WebServiceDto success(String handle, String message) {
+ WebServiceDto webServiceDto = new WebServiceDto();
+ webServiceDto.setHANDLE(handle);
+ webServiceDto.setSTATUS("S");
+ webServiceDto.setMESSAGE(message);
+
+ return webServiceDto;
+ }
+
+ public static WebServiceDto fail(String handle, String message) {
+ WebServiceDto webServiceDto = new WebServiceDto();
+ webServiceDto.setHANDLE(handle);
+ webServiceDto.setSTATUS("E");
+ webServiceDto.setMESSAGE(message);
+
+ return webServiceDto;
+ }
+
+ public String getHANDLE() {
+ return HANDLE;
+ }
+
+ public void setHANDLE(String HANDLE) {
+ this.HANDLE = HANDLE;
+ }
+
+ public String getSTATUS() {
+ return STATUS;
+ }
+
+ public void setSTATUS(String STATUS) {
+ this.STATUS = STATUS;
+ }
+
+ public String getMESSAGE() {
+ return MESSAGE;
+ }
+
+ public void setMESSAGE(String MESSAGE) {
+ this.MESSAGE = MESSAGE;
+ }
+}
diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/IntegrationLogService.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/IntegrationLogService.java
new file mode 100644
index 00000000..2b207662
--- /dev/null
+++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/IntegrationLogService.java
@@ -0,0 +1,17 @@
+package com.foreverwin.mesnac.integration.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.foreverwin.mesnac.integration.model.IntegrationLog;
+
+/**
+ *
+ * 服务类
+ *
+ *
+ * @author Leon.L
+ * @since 2021-06-16
+ */
+public interface IntegrationLogService extends IService {
+
+ void saveIntegrationLog(IntegrationLog integrationLog);
+}
\ No newline at end of file
diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/InterfaceService.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/InterfaceService.java
new file mode 100644
index 00000000..b9a9105e
--- /dev/null
+++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/InterfaceService.java
@@ -0,0 +1,13 @@
+package com.foreverwin.mesnac.integration.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+public interface InterfaceService {
+
+ /**
+ * 物料创建或者更新
+ *
+ * @param jsonObject
+ */
+ void createOrUpdateItem(JSONObject jsonObject) throws Exception;
+}
diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/ERPWebServiceImpl.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/ERPWebServiceImpl.java
index 7dee9c86..f818e199 100644
--- a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/ERPWebServiceImpl.java
+++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/ERPWebServiceImpl.java
@@ -1,9 +1,23 @@
package com.foreverwin.mesnac.integration.service.impl;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.foreverwin.mesnac.common.constant.IntegrationTypeConstant;
+import com.foreverwin.mesnac.common.util.StringUtil;
+import com.foreverwin.mesnac.integration.model.IntegrationLog;
+import com.foreverwin.mesnac.integration.model.WebServiceDto;
import com.foreverwin.mesnac.integration.service.ERPWebService;
+import com.foreverwin.mesnac.integration.service.IntegrationLogService;
+import com.foreverwin.mesnac.integration.service.InterfaceService;
+import com.foreverwin.modular.core.exception.BusinessException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import javax.jws.WebParam;
import javax.jws.WebService;
+import java.time.LocalDateTime;
@Service
@WebService(serviceName = "ERPWebService",
@@ -11,9 +25,73 @@ import javax.jws.WebService;
endpointInterface = "com.foreverwin.mesnac.integration.service.ERPWebService")
public class ERPWebServiceImpl implements ERPWebService {
+ private static final Logger logger = LoggerFactory.getLogger(ERPWebService.class);
+
+ @Autowired
+ private InterfaceService interfaceService;
+ @Autowired
+ private IntegrationLogService integrationLogService;
+
+ /**
+ * {
+ * "TRANID": "2021052616434400028",
+ * "DATE_TIME": "2021-06-16 15:31:00",
+ * "SITE": "1000",
+ * "ITEM": "12053-000170A",
+ * "REVISION": "A",
+ * "MAKTX": "活扳手18\"(250mm) 87-371-1-23",
+ * "STATUS": "201",
+ * "ITEM_TYPE": "ROH",
+ * "PROCUREMENT_TYPE": "P",
+ * "LOT_SIZE": "9999999",
+ * "ASSY_DATA_TYPE": "",
+ * "INV_ASSY_DATA_TYPE": "",
+ * "UNIT_OF_MEASURE": "KG"
+ * }
+ *
+ * @param data
+ * @return
+ */
@Override
- public String createItem(String data) {
- return "{'result': 'OK'}";
+ public String createItem(@WebParam(name = "data") String data) {
+ logger.info("接收ERP传递物料参数:" + data);
+
+ String site = null;
+ String handle = null;
+ LocalDateTime dateTime = null;
+ JSONObject jsonObject = null;
+ WebServiceDto webServiceDto = WebServiceDto.success("物料保存/更新成功");
+ try {
+ jsonObject = JSON.parseObject(data);
+ site = jsonObject.getString("SITE");
+ handle = jsonObject.getString("TRANID");
+ String dateTimeStr = jsonObject.getString("DATE_TIME");
+ if (StringUtil.isBlank(dateTimeStr)) {
+ throw BusinessException.build("传送时间不能为空");
+ }
+
+ interfaceService.createOrUpdateItem(jsonObject);
+ } catch (Exception e) {
+ webServiceDto = WebServiceDto.fail(handle, e.getMessage());
+ return webServiceDto.toString();
+ }
+
+ //记录接口日志
+ IntegrationLog integrationLog = new IntegrationLog();
+ integrationLog.setHandle(handle);
+ integrationLog.setSite(site);
+ integrationLog.setIntegrationType(IntegrationTypeConstant.ITEM);
+ integrationLog.setCategory("REQUEST");
+ integrationLog.setIntegrationWay("ERP");
+ integrationLog.setIntegrationMethod("createOrUpdateItem");
+ integrationLog.setParam(jsonObject.toJSONString());
+ integrationLog.setStatus(webServiceDto.getSTATUS());
+ integrationLog.setResultMessage(webServiceDto.getMESSAGE());
+ integrationLog.setTransactionId(handle);
+ integrationLog.setCreatedDateTime(LocalDateTime.now());
+ integrationLogService.saveIntegrationLog(integrationLog);
+
+ return webServiceDto.toString();
}
}
diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/IntegrationLogServiceImpl.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/IntegrationLogServiceImpl.java
new file mode 100644
index 00000000..71342fd6
--- /dev/null
+++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/IntegrationLogServiceImpl.java
@@ -0,0 +1,34 @@
+package com.foreverwin.mesnac.integration.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.foreverwin.mesnac.integration.model.IntegrationLog;
+import com.foreverwin.mesnac.integration.mapper.IntegrationLogMapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.foreverwin.mesnac.integration.service.IntegrationLogService;
+import org.springframework.stereotype.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ *
+ * 服务实现类
+ *
+ *
+ * @author Leon.L
+ * @since 2021-06-16
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class IntegrationLogServiceImpl extends ServiceImpl implements IntegrationLogService {
+
+
+ @Autowired
+ private IntegrationLogMapper integrationLogMapper;
+
+ @Override
+ @Transactional(propagation = Propagation.REQUIRES_NEW)
+ public void saveIntegrationLog(IntegrationLog integrationLog) {
+ integrationLogMapper.insert(integrationLog);
+ }
+}
\ No newline at end of file
diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java
new file mode 100644
index 00000000..fc059ecd
--- /dev/null
+++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java
@@ -0,0 +1,127 @@
+package com.foreverwin.mesnac.integration.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.foreverwin.mesnac.common.enums.HandleEnum;
+import com.foreverwin.mesnac.common.util.StringUtil;
+import com.foreverwin.mesnac.integration.service.InterfaceService;
+import com.foreverwin.mesnac.meapi.model.Item;
+import com.foreverwin.mesnac.meapi.service.ItemService;
+import com.foreverwin.modular.core.meext.MEServices;
+import com.sap.me.common.CustomValue;
+import com.sap.me.common.MaterialType;
+import com.sap.me.common.ObjectReference;
+import com.sap.me.common.ProcurementType;
+import com.sap.me.productdefinition.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.i18n.LocaleContextHolder;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+/**
+ *
+ * @author Leon
+ * @date 2021-06-16
+ *
+ * 接口服务类
+ *
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class InterfaceServiceImpl implements InterfaceService {
+
+ @Autowired
+ private ItemService itemService;
+
+
+ @Override
+ public void createOrUpdateItem(JSONObject jsonObject) throws Exception{
+ //数据主键
+ String site = jsonObject.getString("SITE");
+ //物料
+ String item = jsonObject.getString("ITEM");
+ //版本:默认值A
+ String revision = jsonObject.getString("REVISION");
+ revision = StringUtil.notBlank(revision) ? revision : "A";
+ //物料描述
+ String itemDescription = jsonObject.getString("MAKTX");
+ //状态
+ String status = jsonObject.getString("STATUS");
+ String statusBo = HandleEnum.STATUS.getHandle(site, status);
+ //物料类型(FERT(已完成)/ROH(原始)/HALB(半成品)/KMAT(可配置)/INST(安装)/VERP(包装)/FHMI(生产资源/工具)/CSTM(自定义))
+ String itemType = jsonObject.getString("ITEM_TYPE");
+ //采购类型(M(制造)/P(采购)/B(制造/采购))
+ String procurementType = jsonObject.getString("PROCUREMENT_TYPE");
+ //批次大小
+ String lotSize = jsonObject.getString("LOT_SIZE");
+ lotSize = StringUtil.notBlank(lotSize) ? lotSize : "999999";
+ //装配时要收集的数据
+ String assyDataType = jsonObject.getString(" ASSY_DATA_TYPE");
+ //库存接收数据类型
+ String invAssyDataType = jsonObject.getString("INV_ASSY_DATA_TYPE");
+ //计量单位
+ String unitOfMeasure = jsonObject.getString("UNIT_OF_MEASURE");
+
+ //物料标准API
+ ItemConfigurationServiceInterface itemServiceInterFace = MEServices.create("com.sap.me.productdefinition", "ItemConfigurationService", site);
+
+
+ //物料是否存在
+ String itemBo = HandleEnum.ITEM.getHandle(site, item, revision);
+ Item itemModel = itemService.getById(itemBo);
+ if (itemModel == null){
+ //创建物料
+ ItemConfiguration itemConfiguration = new ItemConfiguration();
+ itemConfiguration.setItem(item);
+ itemConfiguration.setRevision(revision);
+ itemConfiguration.setProcurementType(ProcurementType.fromValue(procurementType));
+ itemConfiguration.setLotSize(new BigDecimal(lotSize));
+ itemConfiguration.setRef(itemBo);
+ itemConfiguration.setCurrentRevision(true);
+ itemConfiguration.setUnitOfMeasurement(unitOfMeasure);
+ itemConfiguration.setMaterialType(MaterialType.fromValue(itemType));
+
+ //物料描述赋值
+ List itemTranslationList = new ArrayList<>();
+ ItemTranslation itemTranslation = new ItemTranslation();
+ itemTranslation.setLocale("zh");
+ itemTranslation.setDescription(itemDescription);
+ itemTranslationList.add(itemTranslation);
+ itemConfiguration.setItemTranslationList(itemTranslationList);
+ itemConfiguration.setStatusRef(statusBo);
+
+ //数量限制为任意整数
+ itemConfiguration.setQuantityRestriction(QuantityRestriction.ANY_NUMBER);
+
+ //创建物料
+ itemServiceInterFace.createItem(itemConfiguration);
+ } else {
+ //更新物料
+ ObjectReference itemReference = new ObjectReference();
+ itemReference.setRef(itemBo);
+ ItemFullConfiguration itemFullConfiguration = itemServiceInterFace.readItem(itemReference);
+
+
+ //物料描述赋值
+ ItemFullConfiguration updateItem = itemFullConfiguration;
+ updateItem.setUnitOfMeasurement(unitOfMeasure);
+ updateItem.setMaterialType(MaterialType.fromValue(itemType));
+ updateItem.setProcurementType(ProcurementType.fromValue(procurementType));
+ updateItem.setLotSize(new BigDecimal(lotSize));
+ updateItem.setStatusRef(statusBo);
+
+ List itemTranslationList = new ArrayList<>();
+ ItemTranslation itemTranslation = new ItemTranslation();
+ Locale locale = LocaleContextHolder.getLocale();
+ itemTranslation.setLocale(locale.getLanguage());
+ itemTranslation.setDescription(itemDescription);
+ itemTranslationList.add(itemTranslation);
+ updateItem.setItemTranslationList(itemTranslationList);
+
+ //更新物料
+ itemServiceInterFace.updateItem(updateItem);
+ }
+ }
+}
diff --git a/integration/src/main/resources/mapper/IntegrationLogMapper.xml b/integration/src/main/resources/mapper/IntegrationLogMapper.xml
new file mode 100644
index 00000000..a5df18ea
--- /dev/null
+++ b/integration/src/main/resources/mapper/IntegrationLogMapper.xml
@@ -0,0 +1,466 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ HANDLE, SITE, INTEGRATION_TYPE, CATEGORY, INTEGRATION_WAY, INTEGRATION_METHOD, HANDLE_OBJ, SFC_BO, PARAM, STATUS, RESULT_MESSAGE, TRANSACTION_ID, REQUEST_DATE_TIME, CREATED_DATE_TIME
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ INSERT INTO Z_INTEGRATION_LOG
+
+ HANDLE,
+ SITE,
+ INTEGRATION_TYPE,
+ CATEGORY,
+ INTEGRATION_WAY,
+ INTEGRATION_METHOD,
+ HANDLE_OBJ,
+ SFC_BO,
+ PARAM,
+ STATUS,
+ RESULT_MESSAGE,
+ TRANSACTION_ID,
+ REQUEST_DATE_TIME,
+ CREATED_DATE_TIME,
+ VALUES
+
+ #{handle},
+ #{site},
+ #{integrationType},
+ #{category},
+ #{integrationWay},
+ #{integrationMethod},
+ #{handleObj},
+ #{sfcBo},
+ #{param},
+ #{status},
+ #{resultMessage},
+ #{transactionId},
+ #{requestDateTime},
+ #{createdDateTime},
+
+
+
+
+ INSERT INTO Z_INTEGRATION_LOG
+
+
+ VALUES
+
+ #{handle},
+ #{site},
+ #{integrationType},
+ #{category},
+ #{integrationWay},
+ #{integrationMethod},
+ #{handleObj},
+ #{sfcBo},
+ #{param},
+ #{status},
+ #{resultMessage},
+ #{transactionId},
+ #{requestDateTime},
+ #{createdDateTime},
+
+
+
+
+
+ UPDATE Z_INTEGRATION_LOG
+ SITE=#{et.site},
+ INTEGRATION_TYPE=#{et.integrationType},
+ CATEGORY=#{et.category},
+ INTEGRATION_WAY=#{et.integrationWay},
+ INTEGRATION_METHOD=#{et.integrationMethod},
+ HANDLE_OBJ=#{et.handleObj},
+ SFC_BO=#{et.sfcBo},
+ PARAM=#{et.param},
+ STATUS=#{et.status},
+ RESULT_MESSAGE=#{et.resultMessage},
+ TRANSACTION_ID=#{et.transactionId},
+ REQUEST_DATE_TIME=#{et.requestDateTime},
+ CREATED_DATE_TIME=#{et.createdDateTime},
+ WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}
+
+
+
+
+ UPDATE Z_INTEGRATION_LOG
+ SITE=#{et.site},
+ INTEGRATION_TYPE=#{et.integrationType},
+ CATEGORY=#{et.category},
+ INTEGRATION_WAY=#{et.integrationWay},
+ INTEGRATION_METHOD=#{et.integrationMethod},
+ HANDLE_OBJ=#{et.handleObj},
+ SFC_BO=#{et.sfcBo},
+ PARAM=#{et.param},
+ STATUS=#{et.status},
+ RESULT_MESSAGE=#{et.resultMessage},
+ TRANSACTION_ID=#{et.transactionId},
+ REQUEST_DATE_TIME=#{et.requestDateTime},
+ CREATED_DATE_TIME=#{et.createdDateTime},
+ WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}
+
+
+
+
+ UPDATE Z_INTEGRATION_LOG
+ SITE=#{et.site},
+ INTEGRATION_TYPE=#{et.integrationType},
+ CATEGORY=#{et.category},
+ INTEGRATION_WAY=#{et.integrationWay},
+ INTEGRATION_METHOD=#{et.integrationMethod},
+ HANDLE_OBJ=#{et.handleObj},
+ SFC_BO=#{et.sfcBo},
+ PARAM=#{et.param},
+ STATUS=#{et.status},
+ RESULT_MESSAGE=#{et.resultMessage},
+ TRANSACTION_ID=#{et.transactionId},
+ REQUEST_DATE_TIME=#{et.requestDateTime},
+ CREATED_DATE_TIME=#{et.createdDateTime},
+
+
+
+
+ HANDLE=#{ew.entity.handle}
+ AND SITE=#{ew.entity.site}
+ AND INTEGRATION_TYPE=#{ew.entity.integrationType}
+ AND CATEGORY=#{ew.entity.category}
+ AND INTEGRATION_WAY=#{ew.entity.integrationWay}
+ AND INTEGRATION_METHOD=#{ew.entity.integrationMethod}
+ AND HANDLE_OBJ=#{ew.entity.handleObj}
+ AND SFC_BO=#{ew.entity.sfcBo}
+ AND PARAM=#{ew.entity.param}
+ AND STATUS=#{ew.entity.status}
+ AND RESULT_MESSAGE=#{ew.entity.resultMessage}
+ AND TRANSACTION_ID=#{ew.entity.transactionId}
+ AND REQUEST_DATE_TIME=#{ew.entity.requestDateTime}
+ AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}
+
+
+ ${ew.sqlSegment}
+
+
+
+
+ ${ew.sqlSegment}
+
+
+
+
+ DELETE FROM Z_INTEGRATION_LOG WHERE HANDLE=#{handle}
+
+
+
+ DELETE FROM Z_INTEGRATION_LOG
+
+
+
+
+ ${k} = #{cm[${k}]}
+
+
+
+
+
+
+
+ DELETE FROM Z_INTEGRATION_LOG
+
+
+
+
+ HANDLE=#{ew.entity.handle}
+
+ AND SITE=#{ew.entity.site}
+ AND INTEGRATION_TYPE=#{ew.entity.integrationType}
+ AND CATEGORY=#{ew.entity.category}
+ AND INTEGRATION_WAY=#{ew.entity.integrationWay}
+ AND INTEGRATION_METHOD=#{ew.entity.integrationMethod}
+ AND HANDLE_OBJ=#{ew.entity.handleObj}
+ AND SFC_BO=#{ew.entity.sfcBo}
+ AND PARAM=#{ew.entity.param}
+ AND STATUS=#{ew.entity.status}
+ AND RESULT_MESSAGE=#{ew.entity.resultMessage}
+ AND TRANSACTION_ID=#{ew.entity.transactionId}
+ AND REQUEST_DATE_TIME=#{ew.entity.requestDateTime}
+ AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}
+
+
+ ${ew.sqlSegment}
+
+
+
+
+ ${ew.sqlSegment}
+
+
+
+
+ DELETE FROM Z_INTEGRATION_LOG WHERE HANDLE IN (
+ #{item}
+ )
+
+
+
+