From 404b2025163c2dc8aff0c811a0445fc0e9c45d54 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Wed, 13 Sep 2023 11:47:07 +0800 Subject: [PATCH] sap --- .../op-sap/src/main/java/com/op/sap.rar | Bin 0 -> 17797 bytes .../com/op/sap/controller/SapController.java | 61 +++- .../op/sap/domain/SapMaterialPreparation.java | 125 +++++++++ .../java/com/op/sap/mapper/SapBomMapper.java | 8 +- .../com/op/sap/service/SapBomService.java | 3 + .../op/sap/service/SapItemSyncService.java | 17 ++ .../com/op/sap/service/SapOrderService.java | 26 ++ .../op/sap/service/SapWorkCenterService.java | 12 + .../sap/service/impl/SapBomServiceImpl.java | 187 +++++++++---- .../op/sap/service/impl/SapItemSyncImpl.java | 130 +++++++++ .../impl/SapWorkCenterServiceImpl.java | 169 ++++++++++++ .../main/java/com/op/sap/util/HandleEnum.java | 260 ++++++++++++++++++ .../op-sap/src/main/resources/bootstrap.yml | 4 +- .../mapper/sap/SapBomComponentMapper.xml | 2 + .../resources/mapper/sap/SapBomMapper.xml | 65 ++++- 15 files changed, 1000 insertions(+), 69 deletions(-) create mode 100644 op-modules/op-sap/src/main/java/com/op/sap.rar create mode 100644 op-modules/op-sap/src/main/java/com/op/sap/domain/SapMaterialPreparation.java create mode 100644 op-modules/op-sap/src/main/java/com/op/sap/service/SapItemSyncService.java create mode 100644 op-modules/op-sap/src/main/java/com/op/sap/service/SapWorkCenterService.java create mode 100644 op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java create mode 100644 op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapWorkCenterServiceImpl.java create mode 100644 op-modules/op-sap/src/main/java/com/op/sap/util/HandleEnum.java diff --git a/op-modules/op-sap/src/main/java/com/op/sap.rar b/op-modules/op-sap/src/main/java/com/op/sap.rar new file mode 100644 index 0000000000000000000000000000000000000000..ff9aae695ecc89af12422f68bfd0a13ee80a0fef GIT binary patch literal 17797 zcmZ^~b983k(lr{}cAnU_?WAMdwv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^e^k`oy8x(cSqw0vsqe*Zee`f0Z3ZZ;Iucs4s}91~m4%y9`Sf#a&9SFX|XU zHDAQufce+F&rw5BkldSOBZY-0MgN2nt6<}9%+`bd>!2qzr#YnZmc`7E4BVglDqoVG zbQ<~_P8|ic8<7J@{wcV>nxZ@SpP-uzg2JMc3t}@&2(I|O_eGz_&do9hiCSD57yH6w z|E7?H!a)qiTwuBsVwgOwyDDp{HIndxekAsxs1*l_{)tC$0iGbpJLskDnQYdvG|Qq@ zq#Z|BqWJfm5|@U;iS%Kwo=xOWFPb*D$(0$GMk;dEu9T^*x8l7?=WgOt4Gy`@JvKX`3LD13@0Yr>3oXr6$hQ?G=YGIm z%}4+AYtR4TCsQm3;^GB+AX4m2dv*>u5)q-!X-X?jxUjO>j8qY*e54|KpFQ@@B1lnX zn_pZgsSYcfAG;c=!1;ot`@Kjya2H0Q1rptp0{2j0RG&Pjr1MihC+FbJ&L>BmF!FJze-PKU zwfp3TIjtXaWAD!G#Rq~yfLl+<`{U!uvB`TNMUW2G!G{luemr-UB73Y`k8 zoQ6%yGNQs}p-9n;gy(Z3h!;5bmW8gHv>K8k}poPL{xKKlUH=yN@C6Z`A;w` zd%-t{-X{lYI}XmC*4r7x_wJt^_x}C&>)q$nzSG{v_w>&pm5V}p2m9BlZ8wMHPP%HY?kUT%4kK-koQ~g|)$f z4<<%?&QS*zPYkRK0t`UVz`(!@Dx9GE`O5Nvhi_DS*uD^6ca!l-)L%m_RJ8)gl{#pC z9jJUu)f4bU`mMZAZ&Xl~bAgmYPW=EXy!Alb<34a;A^7~K7!6c~d{BkZow7j1{}uhf zn`A@xU)_VvREUFt3Qw$60h^l2SsbB?YAQF#)U?FplKi4dpvps1656M?-DKQ*#g+k^ zk&u;AK!t|ibihVVQ45g8W@IsBH33lN$x~)vmDYSN?nT-UJD< literal 0 HcmV?d00001 diff --git a/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java b/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java index 5ac5b038..62579b68 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java @@ -2,14 +2,10 @@ package com.op.sap.controller; import com.op.common.core.domain.R; import com.op.common.core.web.controller.BaseController; -import com.op.common.core.web.domain.AjaxResult; import com.op.common.log.annotation.Log; import com.op.common.log.enums.BusinessType; -import com.op.sap.service.SapBomService; +import com.op.sap.service.*; -import com.op.sap.service.SapMaterialPreparationService; -import com.op.sap.service.SapOrderService; -import com.op.sap.service.SapRouterService; import com.op.system.api.domain.sap.SapCreateOrder; import com.op.system.api.domain.sap.SapMaterialPreparation; import com.op.system.api.domain.sap.SapRFW; @@ -35,6 +31,12 @@ public class SapController extends BaseController { @Autowired private SapRouterService sapRouterService; + @Autowired + private SapItemSyncService sapItemSyncService; + + @Autowired + private SapWorkCenterService sapWorkCenterService; + /** * 订单同步接口 * @return @@ -49,17 +51,18 @@ public class SapController extends BaseController { * 物料同步接口 * @return */ -// @PostMapping("/itemSync") -// public List itemSync(){ -// return sapService.itemSync(); -// } + @PostMapping("/itemSync") + @Log(title = "同步SAP物料清单", businessType = BusinessType.SAP) + public R itemSync(){ + return sapItemSyncService.itemSync(); + } /** * 物料清单同步接口 * @return */ @PostMapping("/bomSync") - @Log(title = "同步SAP物料清单", businessType = BusinessType.SAP) + @Log(title = "同步SAP物料组件清单", businessType = BusinessType.SAP) public R bomSync(){ return sapBomService.bomSync(); } @@ -99,6 +102,11 @@ public class SapController extends BaseController { return sapOrderService.sapCloseOrder(shopOrder); } + /** + * 报工 + * @param sapRFW + * @return + */ @PostMapping("/sapRFWOrder") @Log(title = "生产订单报工接口", businessType = BusinessType.SAP) public R sapRFWOrder(@RequestBody SapRFW sapRFW){ @@ -106,9 +114,42 @@ public class SapController extends BaseController { } + /** + * 工艺路线同步 + * @return + */ @PostMapping("/sapRouterSync") + @Log(title = "工艺路线同步接口", businessType = BusinessType.SAP) public R sapRouerSync() { return sapRouterService.sapRouterSync(); } + /** + * 工作中心 + */ + @PostMapping("/sapWorkCenterSync") + @Log(title = "工作中心接口", businessType = BusinessType.SAP) + public R sapWorkCenterSync(){ + return sapWorkCenterService.sapWorkCenterSync(); + } + /** + *供应商主数据接口 + */ + @PostMapping("/sapSupplierSync") + @Log(title = "供应商主数据", businessType = BusinessType.SAP) + public R sapSupplierSync(){ + return sapWorkCenterService.sapSupplierSync(); + } + + /** + * 客户主数据接口 + * @return + */ + + @PostMapping("/sapCustomSync") + @Log(title = "客户主数据", businessType = BusinessType.SAP) + public R sapCustomSync(){ + return sapWorkCenterService.sapCustomSync(); + } + } diff --git a/op-modules/op-sap/src/main/java/com/op/sap/domain/SapMaterialPreparation.java b/op-modules/op-sap/src/main/java/com/op/sap/domain/SapMaterialPreparation.java new file mode 100644 index 00000000..2981cdd7 --- /dev/null +++ b/op-modules/op-sap/src/main/java/com/op/sap/domain/SapMaterialPreparation.java @@ -0,0 +1,125 @@ +package com.op.sap.domain; + + +public class SapMaterialPreparation { + //订单号 + private String AUFNR; + //预留/相关需求的项目编号 + private String RSPOS; + //物料号 + private String MATNR; + //物料描述(短文本) + private String MAKTX; + //工厂 + private String WERKS; + //库存地点 + private String LGORT; + //组件的需求日期 + private String BDTER; + //需求量 + private String BDMNG; + //欠料数量 + private String ZQLSL; + //基本计量单位 + private String MEINS; + //标识:反冲 + private String RGEKZ; + //直接采购标识 + private String DBSKZ; + + public String getAUFNR() { + return AUFNR; + } + + public void setAUFNR(String AUFNR) { + this.AUFNR = AUFNR; + } + + public String getRSPOS() { + return RSPOS; + } + + public void setRSPOS(String RSPOS) { + this.RSPOS = RSPOS; + } + + public String getMATNR() { + return MATNR; + } + + public void setMATNR(String MATNR) { + this.MATNR = MATNR; + } + + public String getMAKTX() { + return MAKTX; + } + + public void setMAKTX(String MAKTX) { + this.MAKTX = MAKTX; + } + + public String getWERKS() { + return WERKS; + } + + public void setWERKS(String WERKS) { + this.WERKS = WERKS; + } + + public String getLGORT() { + return LGORT; + } + + public void setLGORT(String LGORT) { + this.LGORT = LGORT; + } + + public String getBDTER() { + return BDTER; + } + + public void setBDTER(String BDTER) { + this.BDTER = BDTER; + } + + public String getBDMNG() { + return BDMNG; + } + + public void setBDMNG(String BDMNG) { + this.BDMNG = BDMNG; + } + + public String getZQLSL() { + return ZQLSL; + } + + public void setZQLSL(String ZQLSL) { + this.ZQLSL = ZQLSL; + } + + public String getMEINS() { + return MEINS; + } + + public void setMEINS(String MEINS) { + this.MEINS = MEINS; + } + + public String getRGEKZ() { + return RGEKZ; + } + + public void setRGEKZ(String RGEKZ) { + this.RGEKZ = RGEKZ; + } + + public String getDBSKZ() { + return DBSKZ; + } + + public void setDBSKZ(String DBSKZ) { + this.DBSKZ = DBSKZ; + } +} diff --git a/op-modules/op-sap/src/main/java/com/op/sap/mapper/SapBomMapper.java b/op-modules/op-sap/src/main/java/com/op/sap/mapper/SapBomMapper.java index 725a9ee9..95e1a4e6 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/mapper/SapBomMapper.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/mapper/SapBomMapper.java @@ -4,16 +4,20 @@ import com.op.system.api.domain.sap.SapBom; import com.op.system.api.domain.sap.SapBomComponent; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + @Mapper public interface SapBomMapper { /** * 新增BOM物料管理 * - * @param sapBom BOM物料管理 - * @return 结果 */ + List selectBaseBomByBomCode(String bomCode); + public int insertBaseBom(SapBom sapBom); + void insertBaseBomBatch(List sapBomList); + public int insertBasetBomComponent(SapBomComponent sapBomComponent); } diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/SapBomService.java b/op-modules/op-sap/src/main/java/com/op/sap/service/SapBomService.java index ff1c1cbe..8de4fe3f 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/SapBomService.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/SapBomService.java @@ -2,7 +2,10 @@ package com.op.sap.service; import com.op.common.core.domain.R; import com.op.common.core.web.domain.AjaxResult; +import com.op.system.api.domain.sap.SapBom; public interface SapBomService { public R bomSync(); + + SapBom getMaxRevisionBom(String STLNR); } diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/SapItemSyncService.java b/op-modules/op-sap/src/main/java/com/op/sap/service/SapItemSyncService.java new file mode 100644 index 00000000..1260ae77 --- /dev/null +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/SapItemSyncService.java @@ -0,0 +1,17 @@ +package com.op.sap.service; + +import com.op.common.core.domain.R; + +import java.util.List; + +/** + * 杨万里 2023年8月 + */ +public interface SapItemSyncService { + + /** + * 物料同步 + * @return + */ + R itemSync(); +} diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java b/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java index bcb7437a..f5dfa4be 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/SapOrderService.java @@ -8,12 +8,38 @@ import com.op.system.api.model.SapProOrder; import java.util.List; +/** + * 杨万里 2023年8月 + */ public interface SapOrderService { + /** + * 订单同步 + * @param sapProOrder + * @return + */ R> shopOrderSync(SapProOrder sapProOrder); + + /** + * 订单创建 + * @param sapCreateOrderList + * @return + */ R> SapCreateOrder(List sapCreateOrderList); + /** + * 订单关闭 + * @param shopOrder + * @return + */ + R sapCloseOrder(String shopOrder); + /** + * 订单报工 + * @param sapRFW + * @return + */ + R sapRFWOrder(SapRFW sapRFW); } diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/SapWorkCenterService.java b/op-modules/op-sap/src/main/java/com/op/sap/service/SapWorkCenterService.java new file mode 100644 index 00000000..db9a72fd --- /dev/null +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/SapWorkCenterService.java @@ -0,0 +1,12 @@ +package com.op.sap.service; + +import com.op.common.core.domain.R; + +public interface SapWorkCenterService { + + R sapWorkCenterSync(); + + R sapSupplierSync(); + + R sapCustomSync(); +} diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapBomServiceImpl.java b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapBomServiceImpl.java index 6aca333e..9cfd7cb6 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapBomServiceImpl.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapBomServiceImpl.java @@ -4,7 +4,11 @@ import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.op.common.core.constant.Constants; import com.op.common.core.domain.R; import com.op.common.core.exception.ServiceException; +import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.StringUtils; +import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.web.domain.AjaxResult; +import com.op.sap.util.HandleEnum; import com.op.system.api.domain.sap.SapBom; import com.op.system.api.domain.sap.SapBomComponent; import com.op.sap.mapper.SapBomComponentMapper; @@ -13,14 +17,15 @@ import com.op.sap.service.SapBomService; import com.op.sap.util.SAPConnUtils; import com.sap.conn.jco.*; +import org.apache.ibatis.session.ExecutorType; +import org.apache.ibatis.session.SqlSession; +import org.apache.ibatis.session.SqlSessionFactory; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.TreeSet; +import java.util.*; import java.util.stream.Collectors; @Service @@ -32,6 +37,9 @@ public class SapBomServiceImpl implements SapBomService { @Autowired private SapBomComponentMapper sapBomComponentMapper; + @Autowired + private SqlSessionFactory sqlSessionFactory; + @Override public R bomSync() { @@ -52,10 +60,10 @@ public class SapBomServiceImpl implements SapBomService { // jCoTable.setValue(Constants.LOW, "00012222"); JCoTable jCoTables = func.getTableParameterList().getTable("S_MATNR"); - jCoTables.appendRow(); - jCoTables.setValue(Constants.SIGN, "I"); - jCoTables.setValue(Constants.OPTION, "EQ"); - jCoTables.setValue(Constants.LOW, "000000010101000115"); +// jCoTables.appendRow(); +// jCoTables.setValue(Constants.SIGN, "I"); +// jCoTables.setValue(Constants.OPTION, "EQ"); +// jCoTables.setValue(Constants.LOW, "000000010101000115"); JCoTable S_WERKS_jCoTables = func.getTableParameterList().getTable("S_WERKS"); S_WERKS_jCoTables.appendRow(); @@ -68,15 +76,14 @@ public class SapBomServiceImpl implements SapBomService { JCoTable maraTable = func.getTableParameterList().getTable("LT_BOM"); JCoRecordMetaData metaData = maraTable.getRecordMetaData(); System.out.println("###" + metaData.toString()); - SapBom sapBom = new SapBom(); - SapBomComponent sapBomComponent=new SapBomComponent(); - DynamicDataSourceContextHolder.push("op_xiaolan"); + + + List sapBomList=new ArrayList<>(); + List sapBomComponentList=new ArrayList<>(); + for (int i = 0; i < maraTable.getNumRows(); i++) { maraTable.setRow(i); String STLNR = maraTable.getString("STLNR"); - if (STLNR == null || STLNR.equals("")){ - throw new ServiceException("组件清单码为空"); - } String MATNR = maraTable.getString("MATNR"); String MAKTX = maraTable.getString("MAKTX"); String WERKS = maraTable.getString("WERKS"); @@ -107,40 +114,59 @@ public class SapBomServiceImpl implements SapBomService { String BEIKZ = maraTable.getString("BEIKZ"); String BEIKZ_NM = maraTable.getString("BEIKZ_NM"); String SANKA = maraTable.getString("SANKA"); - System.out.println("物料编码:" + MATNR + - " - 物料名称:" + MAKTX + " - 工厂:" + WERKS + - " - 生产版本:" + VERID + " - BOM单号:" + STLNR - + " - 可选BOM:" + STLAL + " - 创建日期:" + ANDAT + " - 创建者:" + ANNAM + - " - 修改日期:" + AEDAT + " - 修改者:" + AENAM - + " - 生产版本有效期:" + ADATU + " - 生产版本截止日期:" + BDATU + " - BOM计算数量:" + LOSGR + - " - BOM计算单位:" + MEINS + - " - BOM基本数量:" + BMENG + " - BOM基本单位:" + BMEIN + " - BOM层次:" + STUFE + " - 项目编号:" + WEGXX - + " - 组件编码:" + PMATNR + " - 组件名称:" + PMAKTX + " - 组件上层物料名称:" + OJTXB - + " - 标准用量:" + PMENGE + " - 损耗率:" + PAUSCH + " - 损耗额:" + PXHLCE + " - 含损耗用量:" + PMNGKO - + " - 组件数量单位:" + PMEINS + " - 组件采购标志:" + PBESKZ + " - 物料供应标识:" + BEIKZ + " - 物料供应标识:" + BEIKZ_NM - + " - 成本核算标识相关:" + SANKA); -// sapBom.setFactoryCode(WERKS); -// sapBom.setProductionVersion(VERID); -// sapBom.setBomCode(STLNR); -// sapBom.setOptionalBom(STLAL); -// sapBom.setPvvd(DateUtils.dateTime("yyyy-MM-dd", ADATU)); -// sapBom.setPved(DateUtils.dateTime("yyyy-MM-dd", BDATU)); -// sapBom.setBomCalculateNumber(new BigDecimal(LOSGR)); -// sapBom.setBomCalculateUnit(MEINS); -// sapBom.setBomBaseNumber(new BigDecimal(BMENG)); -// sapBom.setBomBaseUnit(BMEIN); -// sapBom.setComponentUnit(PMEINS); -// sapBom.setComponentProFlag(PBESKZ); -// sapBom.setCreateBy(ANNAM); -// // sapBom.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT)); -// sapBom.setUpdateBy(AENAM); -// // sapBom.setUpdateTime(DateUtils.dateTime("yyyy-MM-dd", AEDAT)); + String OJMBR = maraTable.getString("OJMBR"); + + if (!StringUtils.isEmpty(STLAL)){ + System.out.println("物料编码:" + MATNR + + " - 物料名称:" + MAKTX + " - 工厂:" + WERKS + + " - 生产版本:" + VERID + " - BOM单号:" + STLNR + + " - 可选BOM:" + STLAL + " - 创建日期:" + ANDAT + " - 创建者:" + ANNAM + + " - 修改日期:" + AEDAT + " - 修改者:" + AENAM + + " - 生产版本有效期:" + ADATU + " - 生产版本截止日期:" + BDATU + " - BOM计算数量:" + LOSGR + + " - BOM计算单位:" + MEINS + + " - BOM基本数量:" + BMENG + " - BOM基本单位:" + BMEIN + " - BOM层次:" + STUFE + " - 项目编号:" + WEGXX + + " - 组件编码:" + PMATNR + " - 组件名称:" + PMAKTX + " - 组件上层物料编码:" + OJMBR+" - 组件上层物料名称:" + OJTXB + + " - 标准用量:" + PMENGE + " - 损耗率:" + PAUSCH + " - 损耗额:" + PXHLCE + " - 含损耗用量:" + PMNGKO + + " - 组件数量单位:" + PMEINS + " - 组件采购标志:" + PBESKZ + " - 物料供应标识:" + BEIKZ + " - 物料供应标识:" + BEIKZ_NM + + " - 成本核算标识相关:" + SANKA); + } + + + + //插入BOM表 + //BomBO + /** + * 查询是否有此BOM清单 + */ + SapBom sapBom = new SapBom(); + sapBom.setFactoryCode(WERKS); + sapBom.setProductionVersion(STLAL); + sapBom.setBomCode(STLNR); + sapBom.setCumc(OJMBR); + sapBom.setComponent(PMATNR); + sapBom.setOptionalBom(STLAL); + sapBom.setPvvd(DateUtils.dateTime("yyyy-MM-dd", ADATU)); + sapBom.setPved(DateUtils.dateTime("yyyy-MM-dd", BDATU)); + sapBom.setBomCalculateNumber(new BigDecimal(LOSGR)); + sapBom.setBomCalculateUnit(MEINS); + sapBom.setBomBaseNumber(new BigDecimal(BMENG)); + sapBom.setBomBaseUnit(BMEIN); + sapBom.setComponentUnit(PMEINS); + sapBom.setComponentProFlag(PBESKZ); + // sapBom.setCurrentVersion(""); + sapBom.setCreateBy(ANNAM); + sapBom.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT)); + sapBom.setUpdateBy(AENAM); + sapBom.setUpdateTime(DateUtils.dateTime("yyyy-MM-dd", AEDAT)); + + SapBomComponent sapBomComponent=new SapBomComponent(); sapBomComponent.setBomCode(STLNR); - sapBomComponent.setSite(WERKS); + sapBomComponent.setSite("1000"); sapBomComponent.setMsi(BEIKZ); sapBomComponent.setSanka(SANKA); sapBomComponent.setProductCode(MATNR); - sapBomComponent.setCumc(OJTXB); + sapBomComponent.setCumc(OJMBR); + sapBomComponent.setComponent(PMATNR); sapBomComponent.setBomHierarchy(STUFE); sapBomComponent.setProjectNo(WEGXX); sapBomComponent.setStandardDosage(new BigDecimal(PMENGE)); @@ -148,13 +174,13 @@ public class SapBomServiceImpl implements SapBomService { sapBomComponent.setLossAmount(new BigDecimal(PXHLCE)); sapBomComponent.setCilosses(new BigDecimal(PMNGKO)); sapBomComponent.setCreateBy(ANNAM); - // sapBomComponent.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT)); + sapBomComponent.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT)); sapBomComponent.setUpdateBy(AENAM); - // sapBomComponent.setUpdateTime(DateUtils.dateTime("yyyy-MM-dd", AEDAT)); - // sapBomList.add(sapBom); - // sapBomComponentMapper.insertSapBomComponent(sapBomComponent); + sapBomComponent.setUpdateTime(DateUtils.dateTime("yyyy-MM-dd", AEDAT)); + sapBomComponentList.add(sapBomComponent); + sapBomList.add(sapBom); } - // inserBaseBom(sapBomList); + createBOM(sapBomList,sapBomComponentList); return R.ok(); } catch (Exception e) { return R.fail(e.getMessage()); @@ -162,10 +188,65 @@ public class SapBomServiceImpl implements SapBomService { } } - public void inserBaseBom(List sapBomList){ - sapBomList = sapBomList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(SapBom::getBomCode))), ArrayList::new)); - for (SapBom sapBom:sapBomList) { - sapBomMapper.insertBaseBom(sapBom); + @Override + public SapBom getMaxRevisionBom(String STLNR) { + List list = sapBomMapper.selectBaseBomByBomCode(STLNR); + if (list == null || list.size() <= 0) { + return null; + } + + return list.get(0); + } + + public void createBOM(List sapBomList,List sapBomComponentList){ + List newBomList = sapBomList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(SapBom::getBomCode))), ArrayList::new)); + if (newBomList.size()>0){ + DynamicDataSourceContextHolder.push("ds_1000"); + SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH,false); + for (SapBom sapBom:newBomList) { + List sapBomComponents; + //查询Bom号是否存在 + SapBom bomModel = this.getMaxRevisionBom(sapBom.getBomCode()); + //存在且版本号大于现有版本 + if (bomModel!=null&&sapBom.getOptionalBom()!=null&&Float.parseFloat(sapBom.getOptionalBom())>Float.parseFloat(bomModel.getOptionalBom())) + { + //升级BOM + String bomBo = HandleEnum.BOM.getHandle(sapBom.getFactoryCode(),sapBom.getBomCode(),sapBom.getOptionalBom()); + sapBom.setBomBo(bomBo); + //插入BOM表 + sapBomMapper.insertBaseBom(sapBom); + //筛选组件清单 + sapBomComponents = sapBomComponentList.stream().filter(sbc-> + sbc.getBomCode().equals(sapBom.getBomCode())).collect(Collectors.toList()); + //执行插入 + + sapBomComponents.stream().forEach(components -> { + components.setBomBo(bomBo); + sapBomComponentMapper.insertSapBomComponent(components); + }); + + } + else if (bomModel==null&&sapBom.getOptionalBom()!=null){ + //插入初始BOM + String bomBo = HandleEnum.BOM.getHandle(sapBom.getFactoryCode(),sapBom.getBomCode(),sapBom.getOptionalBom()); + sapBom.setBomBo(bomBo); + //插入BOM表 + sapBomMapper.insertBaseBom(sapBom); + //筛选组件清单 + sapBomComponents = sapBomComponentList.stream().filter(sbc-> + sbc.getBomCode().equals(sapBom.getBomCode())).collect(Collectors.toList()); + //执行插入 + sapBomComponents.stream().forEach(components -> { + components.setBomBo(bomBo); + sapBomComponentMapper.insertSapBomComponent(components); + }); + + } + sqlSession.commit(); + sqlSession.clearCache(); + + } + } } diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java new file mode 100644 index 00000000..10f7206d --- /dev/null +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java @@ -0,0 +1,130 @@ +package com.op.sap.service.impl; + +import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; +import com.op.common.core.constant.Constants; +import com.op.common.core.domain.R; +import com.op.sap.mapper.SapBaseProductMapper; +import com.op.sap.service.SapItemSyncService; +import com.op.sap.util.SAPConnUtils; +import com.op.system.api.domain.sap.SapBaseProduct; +import com.sap.conn.jco.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; + +@Service +public class SapItemSyncImpl implements SapItemSyncService { + @Autowired + private SapBaseProductMapper sapBaseProductMapper; + @Override + public R itemSync() { + try { + // 获取调用 RFC 函数对象 + //获取连接 + JCoDestination dest = SAPConnUtils.connect(); + JCoRepository repository = dest.getRepository(); + JCoFunction func = repository.getFunction("ZMMR_MES_MAT_GET"); + if (func == null) { + throw new RuntimeException("Function does not exist in SAP"); + } + + JCoTable jCoTables = func.getTableParameterList().getTable("S_MATNR"); + System.out.println(jCoTables); +// jCoTables.appendRow(); +// jCoTables.setValue(Constants.SIGN, "I"); +// jCoTables.setValue(Constants.OPTION, "EQ"); +// jCoTables.setValue(Constants.LOW, "000000010101000115"); + // 获取调用 RFC 函数对象 + func.execute(dest); + // 获取 内表 - ZMES_PRO + JCoTable maraTable = func.getTableParameterList().getTable("LT_MARA"); + JCoRecordMetaData metaData = maraTable.getRecordMetaData(); + System.out.println("###" + metaData.toString()); + DynamicDataSourceContextHolder.push("ds_1000"); + for (int i = 0; i < maraTable.getNumRows(); i++) { + SapBaseProduct baseProduct = new SapBaseProduct(); + maraTable.setRow(i); + String MATNR = maraTable.getString("MATNR"); + String MAKTX = maraTable.getString("MAKTX"); + String EAN11 = maraTable.getString("EAN11"); + String MTART = maraTable.getString("MTART"); + String MTBEZ = maraTable.getString("MTBEZ"); + String MATKL = maraTable.getString("MATKL"); + String WGBEZ = maraTable.getString("WGBEZ"); + BigDecimal BRGEW = maraTable.getBigDecimal("BRGEW"); + BigDecimal NTGEW = maraTable.getBigDecimal("NTGEW"); + BigDecimal VOLUM = maraTable.getBigDecimal("VOLUM"); + String VOLEH = maraTable.getString("VOLEH"); + String MEINS = maraTable.getString("MEINS"); + String MEINH = maraTable.getString("MEINH"); + String UMREZ = maraTable.getString("UMREZ"); + String UMREN = maraTable.getString("UMREN"); + String LVORM = maraTable.getString("LVORM"); + String MENGE = maraTable.getString("MENGE"); + String MHDHB = maraTable.getString("MHDHB"); + String SPART = maraTable.getString("SPART"); + String SPART_NM = maraTable.getString("SPART_NM"); + String MVGR1 = maraTable.getString("MVGR1"); + String MVGR1_NM = maraTable.getString("MVGR1_NM"); + String MVGR2 = maraTable.getString("MVGR2"); + String MVGR2_NM = maraTable.getString("MVGR2_NM"); + String MVGR3 = maraTable.getString("MVGR3"); + String MVGR3_NM = maraTable.getString("MVGR3_NM"); + String MVGR4 = maraTable.getString("MVGR4"); + String MVGR4_NM = maraTable.getString("MVGR4_NM"); + String MVGR5 = maraTable.getString("MVGR5"); + String MVGR5_NM = maraTable.getString("MVGR5_NM"); + // String SANKA = maraTable.getString("SANKA"); + System.out.println( + "物料号:" + MATNR+ + "物料描述(短文本):" + MAKTX+ + "国际文件号(EAN/UPC):" + EAN11+ + "物料类型:" + MTART+ + "物料类型描述:" + MTBEZ+ + "物料组:" + MATKL+ + "物料组描述:" + WGBEZ+ + "毛重:" + BRGEW+ + "净重:" + NTGEW+ + "体积:" + VOLUM+ + "体积单位:" + VOLEH+ + "基本计量单位:" + MEINS+ + "帐面库存单位的可选计量单位 :" + MEINH+ + "基本计量单位转换分子:" + UMREZ+ + "转换为基本计量单位的分母:" + UMREN+ + "在客户级标记要删除的物料:" + LVORM+ + "数量:" + MENGE+ + "总货架寿命 :" + MHDHB+ + "产品组:" + SPART+ + "产品组描述:" + SPART_NM+ + "物料组1:" + MVGR1+ + "物料组1描述:" + MVGR1_NM+ + "物料组2:" + MVGR2+ + "物料组2描述:" + MVGR2_NM+ + " 物料组3:" + MVGR3+ + " 物料组描述 :" + MVGR3_NM); + //查询物料存不存在 + baseProduct.setProductCode(MATNR); + SapBaseProduct sapBaseProduct=sapBaseProductMapper.selectBaseProductByProductCode(baseProduct); + if (sapBaseProduct==null){ + sapBaseProduct.setProductCode(MATNR); + sapBaseProduct.setProductDescZh(MAKTX); +// baseProduct.setProductean11(EAN11); + sapBaseProduct.setProductGroup(MATKL); + sapBaseProduct.setProductGroupName(WGBEZ); + sapBaseProduct.setGrossWeight(BRGEW); + sapBaseProduct.setNetWeight(NTGEW); + sapBaseProduct.setVolume(VOLUM); + sapBaseProduct.setDelFlag("0"); + // sapBaseProductMapper.insertBaseProduct(sapBaseProduct); + } + + + } + return R.ok(); + + }catch (Exception e){ + return R.fail(e.getMessage()); + } + } +} diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapWorkCenterServiceImpl.java b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapWorkCenterServiceImpl.java new file mode 100644 index 00000000..f47253d6 --- /dev/null +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapWorkCenterServiceImpl.java @@ -0,0 +1,169 @@ +package com.op.sap.service.impl; + +import com.op.common.core.domain.R; +import com.op.common.core.utils.DateUtils; +import com.op.sap.service.SapWorkCenterService; +import com.op.sap.util.SAPConnUtils; +import com.op.system.api.domain.sap.SapWorkCenter; +import com.sap.conn.jco.*; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class SapWorkCenterServiceImpl implements SapWorkCenterService { + + @Override + public R sapWorkCenterSync() { + try { + // 获取调用 RFC 函数对象 + //获取连接 + JCoDestination dest = SAPConnUtils.connect(); + JCoRepository repository = dest.getRepository(); + JCoFunction func = repository.getFunction("ZMES_GET_ARBPL"); + if (func == null) { + throw new RuntimeException("Function does not exist in SAP"); + } + // 配置传入参数 + JCoTable jCoTable = func.getTableParameterList().getTable("S_WERKS"); +// jCoTable.appendRow(); +// jCoTable.setValue("SIGN", "I"); +// jCoTable.setValue("OPTION", "EQ"); +// jCoTable.setValue("LOW", "1000"); + func.execute(dest);//执行调用函数 + // 获取 内表 - ZMES_PRO + JCoTable maraTable = func.getTableParameterList().getTable("LT_ARBPL"); + JCoRecordMetaData metaData = maraTable.getRecordMetaData(); + System.out.println("###" + metaData.toString()); + List sapWorkCenterList=new ArrayList<>(); + for (int i = 0; i sapWorkCenterList=new ArrayList<>(); + for (int i = 0; i sapWorkCenterList=new ArrayList<>(); + for (int i = 0; i = parts.length) { + return null; + } else { + return parts[position]; + } + } + + public String getPrefix() { + return prefix; + } +} diff --git a/op-modules/op-sap/src/main/resources/bootstrap.yml b/op-modules/op-sap/src/main/resources/bootstrap.yml index 14dae316..6981aeea 100644 --- a/op-modules/op-sap/src/main/resources/bootstrap.yml +++ b/op-modules/op-sap/src/main/resources/bootstrap.yml @@ -14,12 +14,12 @@ spring: nacos: discovery: namespace: lanju-op - group: zxl + group: ywl # 服务注册地址 server-addr: 140.249.53.142:8848 config: namespace: lanju-op - group: zxl + group: ywl #命名空间 #group: local # 配置中心地址 diff --git a/op-modules/op-sap/src/main/resources/mapper/sap/SapBomComponentMapper.xml b/op-modules/op-sap/src/main/resources/mapper/sap/SapBomComponentMapper.xml index 0465b9e6..85282fa3 100644 --- a/op-modules/op-sap/src/main/resources/mapper/sap/SapBomComponentMapper.xml +++ b/op-modules/op-sap/src/main/resources/mapper/sap/SapBomComponentMapper.xml @@ -68,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into base_bom_component id, + bom_bo, bom_code, site, product_code, @@ -94,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id}, + #{bomBo}, #{bomCode}, #{site}, #{productCode}, diff --git a/op-modules/op-sap/src/main/resources/mapper/sap/SapBomMapper.xml b/op-modules/op-sap/src/main/resources/mapper/sap/SapBomMapper.xml index d1cdb9e2..34b049ec 100644 --- a/op-modules/op-sap/src/main/resources/mapper/sap/SapBomMapper.xml +++ b/op-modules/op-sap/src/main/resources/mapper/sap/SapBomMapper.xml @@ -60,14 +60,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - where factory_code = #{factoryCode} + where bom_code = #{bomCode} + order by production_version desc insert into base_bom + bom_bo, factory_code, production_version, bom_code, @@ -94,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" current_version, + #{bomBo}, #{factoryCode}, #{productionVersion}, #{bomCode}, @@ -120,6 +123,64 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{currentVersion}, + + insert into base_bom + + bom_bo, + factory_code, + production_version, + bom_code, + optional_bom, + optional_bom_text, + pvvd, + pved, + bom_calculate_number, + bom_calculate_unit, + bom_base_number, + bom_base_unit, + component_unit, + component_pro_flag, + msi, + sanka, + attr1, + attr2, + attr3, + create_by, + create_time, + update_by, + update_time, + remark, + current_version, + + VALUES + + #{bomBo}, + #{factoryCode}, + #{productionVersion}, + #{bomCode}, + #{optionalBom}, + #{optionalBomText}, + #{pvvd}, + #{pved}, + #{bomCalculateNumber}, + #{bomCalculateUnit}, + #{bomBaseNumber}, + #{bomBaseUnit}, + #{componentUnit}, + #{componentProFlag}, + #{msi}, + #{sanka}, + #{attr1}, + #{attr2}, + #{attr3}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + #{currentVersion}, + + update base_bom