From 28145447cb3edf4b0e89f775930edddb7880f5d8 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Thu, 2 Nov 2023 09:03:18 +0800 Subject: [PATCH] =?UTF-8?q?sap=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ABAP_AS_WITH_POOL.jcoDestination | 11 -- dev_jco_rfc.trc | 114 ------------------ .../com/op/system/api/domain/SysSapLog.java | 90 ++++++++++++++ .../api/domain/sap/SapShopOrderQuery.java | 11 ++ .../com/op/plan/mapper/ProOrderMapper.java | 3 + .../service/impl/ProOrderServiceImpl.java | 44 +++++-- .../impl/ProOrderWorkorderServiceImpl.java | 11 ++ .../resources/mapper/plan/ProOrderMapper.xml | 6 + .../impl/QcCheckTaskIncomeServiceImpl.java | 14 ++- .../impl/QcCheckTaskProduceServiceImpl.java | 14 +-- .../QcCheckTaskWarehousingServiceImpl.java | 14 +-- .../sap/service/impl/SapOrderServiceImpl.java | 2 +- .../technology/ProRouteProductMapper.xml | 7 +- 13 files changed, 180 insertions(+), 161 deletions(-) delete mode 100644 ABAP_AS_WITH_POOL.jcoDestination delete mode 100644 dev_jco_rfc.trc create mode 100644 op-api/op-api-system/src/main/java/com/op/system/api/domain/SysSapLog.java diff --git a/ABAP_AS_WITH_POOL.jcoDestination b/ABAP_AS_WITH_POOL.jcoDestination deleted file mode 100644 index 836417d9..00000000 --- a/ABAP_AS_WITH_POOL.jcoDestination +++ /dev/null @@ -1,11 +0,0 @@ -#for test only! -#Tue Oct 17 09:57:19 CST 2023 -jco.destination.pool_capacity=true -jco.client.lang=zh -jco.client.ashost=192.168.0.53 -jco.client.saprouter= -jco.client.user=MES -jco.client.sysnr=0 -jco.destination.peak_limit=20 -jco.client.passwd=123456 -jco.client.client=800 diff --git a/dev_jco_rfc.trc b/dev_jco_rfc.trc deleted file mode 100644 index 9731a6f6..00000000 --- a/dev_jco_rfc.trc +++ /dev/null @@ -1,114 +0,0 @@ - -**** Error file opened at 20230724 105509 China Standard Time Rel. 3.0.17 (2017-07-17) [721.913] -Error: >Mon Jul 24 10:55:09,173< RfcException: - message: Connect to SAP gateway failed -Connection parameters: TYPE=A DEST=ABAP_AS_WITH_POOL ASHOST=192.168.0.53 SYSNR=00 PCS=1 - -LOCATION CPIC (TCP/IP) on local host with Unicode -ERROR partner '192.168.0.53:3300' not reached -TIME Mon Jul 24 10:55:09 2023 -RELEASE 721 -COMPONENT NI (network interface) -VERSION 40 -RC -10 -MODULE nixxi.cpp -LINE 3289 -DETAIL NiPConnect2: 192.168.0.53:3300 -SYSTEM CALL connect -ERRNO 10060 -ERRNO TEXT WSAETIMEDOUT: Connection timed out -COUNTER 2 - - return code: RFC_FAILURE (1) - error group: 102 - key: RFC_ERROR_COMMUNICATION - -Error: >Mon Jul 24 10:55:30,220< RfcException: - message: Connect to SAP gateway failed -Connection parameters: TYPE=A DEST=ABAP_AS_WITH_POOL ASHOST=192.168.0.53 SYSNR=00 PCS=1 - -LOCATION CPIC (TCP/IP) on local host with Unicode -ERROR partner '192.168.0.53:3300' not reached -TIME Mon Jul 24 10:55:30 2023 -RELEASE 721 -COMPONENT NI (network interface) -VERSION 40 -RC -10 -MODULE nixxi.cpp -LINE 3289 -DETAIL NiPConnect2: 192.168.0.53:3300 -SYSTEM CALL connect -ERRNO 10060 -ERRNO TEXT WSAETIMEDOUT: Connection timed out -COUNTER 4 - - return code: RFC_FAILURE (1) - error group: 102 - key: RFC_ERROR_COMMUNICATION - - -**** Error file opened at 20230725 103104 China Standard Time Rel. 3.0.17 (2017-07-17) [721.913] -Error: >Tue Jul 25 10:31:04,628< RfcException: - message: Connect to SAP gateway failed -Connection parameters: TYPE=A DEST=ABAP_AS_WITH_POOL ASHOST=192.168.0.53 SYSNR=00 PCS=1 - -LOCATION CPIC (TCP/IP) on local host with Unicode -ERROR partner '192.168.0.53:3300' not reached -TIME Tue Jul 25 10:31:04 2023 -RELEASE 721 -COMPONENT NI (network interface) -VERSION 40 -RC -10 -MODULE nixxi.cpp -LINE 3289 -DETAIL NiPConnect2: 192.168.0.53:3300 -SYSTEM CALL connect -ERRNO 10060 -ERRNO TEXT WSAETIMEDOUT: Connection timed out -COUNTER 2 - - return code: RFC_FAILURE (1) - error group: 102 - key: RFC_ERROR_COMMUNICATION - -Error: >Tue Jul 25 10:31:25,675< RfcException: - message: Connect to SAP gateway failed -Connection parameters: TYPE=A DEST=ABAP_AS_WITH_POOL ASHOST=192.168.0.53 SYSNR=00 PCS=1 - -LOCATION CPIC (TCP/IP) on local host with Unicode -ERROR partner '192.168.0.53:3300' not reached -TIME Tue Jul 25 10:31:25 2023 -RELEASE 721 -COMPONENT NI (network interface) -VERSION 40 -RC -10 -MODULE nixxi.cpp -LINE 3289 -DETAIL NiPConnect2: 192.168.0.53:3300 -SYSTEM CALL connect -ERRNO 10060 -ERRNO TEXT WSAETIMEDOUT: Connection timed out -COUNTER 4 - - return code: RFC_FAILURE (1) - error group: 102 - key: RFC_ERROR_COMMUNICATION - - -**** Error file opened at 20230816 113444 China Standard Time Rel. 3.0.17 (2017-07-17) [721.913] -Error: >Wed Aug 16 11:34:44,064< >RfcGetException rc (7) message: Invalid value in OPTION field of value table for IN itab operator. operator. -Wed Aug 16 17:42:53,538< >RfcGetException rc (7) message: Invalid value in OPTION field of value table for IN itab operator. operator. -Wed Aug 16 17:44:47,079< >RfcGetException rc (7) message: Invalid value in OPTION field of value table for IN itab operator. operator. -=20230923的sap数据 R> rSapProOrder = remoteSapService.shopOrderSync(sapqo);//sap只能同步指定日期的数据 - if(rSapProOrder == null){ - return AjaxResult.error("无"+sapqo.getErdat()+"之后的最新订单"); - } - List newOrders = rSapProOrder.getData(); - - - syncSAPFunc(newOrders,SecurityUtils.getUsername()); + if(CollectionUtils.isEmpty(newOrders)){ + System.out.println("无"+sapqo.getErdat()+"之后的最新订单"); + }else { + syncSAPFunc(newOrders, "Job"); + } return success(); } @@ -703,12 +713,22 @@ public class ProOrderServiceImpl implements IProOrderService { sapqo.setErdat(maxCreateTime.getCreateTimeStr());//S_ERDAT(创建日期) 例如:20230923 } + //添加调用sap日志 + SysSapLog sysSapLog = new SysSapLog(); + sysSapLog.setId(IdUtils.fastSimpleUUID()); + sysSapLog.setMesssge(sapqo.toString()); + sysSapLog.setMethod("shopOrderSync"); + sysSapLog.setReqcode("请求"); + sysSapLog.setCreateTime(DateUtils.getNowDate()); + proOrderMapper.addSapLog(sysSapLog); + R> rSapProOrder = remoteSapService.shopOrderSync(sapqo); List newOrders = rSapProOrder.getData(); if(CollectionUtils.isEmpty(newOrders)){ - logger.error("无"+sapqo.getErdat()+"之后的最新订单"); + System.out.println("无"+sapqo.getErdat()+"之后的最新订单"); + }else { + syncSAPFunc(newOrders, "Job"); } - syncSAPFunc(newOrders,"Job"); } /** diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java index df172021..386b1296 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java @@ -17,6 +17,7 @@ import com.op.plan.domain.vo.CascaderDTO; import com.op.plan.mapper.*; import com.op.plan.service.IProOrderWorkorderService; import com.op.system.api.RemoteSapService; +import com.op.system.api.domain.SysSapLog; import com.op.system.api.domain.dto.MesPrepareDTO; import com.op.system.api.domain.dto.MesPrepareDetailDTO; import com.op.system.api.domain.sap.SapCreateOrder; @@ -264,6 +265,16 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { sap.setDates(DateUtils.parseDateToStr("yyyy-MM-dd", whiteOrder.getProductDate()));//开始时间 sap.setDatee(DateUtils.parseDateToStr("yyyy-MM-dd", whiteOrder.getProductDate()));//完成时间 sapList.add(sap); + + //添加调用sap日志 + SysSapLog sysSapLog = new SysSapLog(); + sysSapLog.setId(IdUtils.fastSimpleUUID()); + sysSapLog.setMesssge(StringUtils.join(sapList,",")); + sysSapLog.setMethod("downProOrderWorkorderByWorkorderIds"); + sysSapLog.setReqcode("请求"); + sysSapLog.setCreateTime(DateUtils.getNowDate()); + proOrderMapper.addSapLog(sysSapLog); + R> r = remoteSapService.SapCreateOrder(sapList); logger.info("sap工单回传:" + r.getMsg()); if (500 == r.getCode()) { diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml index e51f9e40..9d8cdd6d 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml @@ -256,6 +256,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" GETDATE(), + + insert into sys_sap_log + (id,messsge,create_time,reqcode,method,remark,status) + values( + #{id},#{messsge}, #{createTime}, #{reqcode},#{method},#{remark},#{status}) + update pro_order diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java index dbf6ab7f..aa4c805a 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java @@ -16,6 +16,7 @@ import com.op.system.api.domain.SysUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.quality.service.IQcCheckTaskIncomeService; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -99,12 +100,6 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { qcCheckTaskIncome.setCheckNo(bpDD+liushuiStr); - /**qc_check_task_income**/ - String beLongId = IdUtils.fastSimpleUUID(); - qcCheckTaskIncome.setRecordId(beLongId); - qcCheckTaskIncome.setFactoryCode(factoryCode); - qcCheckTaskIncome.setCreateTime(nowDate); - qcCheckTaskIncomeMapper.insertQcCheckTaskIncome(qcCheckTaskIncome); /**取检测项**/ QcCheckTypeProject qctp= new QcCheckTypeProject(); @@ -127,6 +122,13 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { return 0;//没有找到检测项目 } + /**qc_check_task**/ + String beLongId = IdUtils.fastSimpleUUID(); + qcCheckTaskIncome.setRecordId(beLongId); + qcCheckTaskIncome.setFactoryCode(factoryCode); + qcCheckTaskIncome.setCreateTime(nowDate); + qcCheckTaskIncomeMapper.insertQcCheckTaskIncome(qcCheckTaskIncome); + /**qc_check_task_detail**/ for(QcCheckTaskDetail item:items){ item.setRecordId(IdUtils.fastSimpleUUID()); item.setBelongTo(beLongId); diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java index 8c21e88b..c8b075cc 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java @@ -99,13 +99,6 @@ public class QcCheckTaskProduceServiceImpl implements IQcCheckTaskProduceService qcCheckTaskProduce.setCheckNo(bpDD+liushuiStr); - /**qc_check_task_produce**/ - String beLongId = IdUtils.fastSimpleUUID(); - qcCheckTaskProduce.setRecordId(beLongId); - qcCheckTaskProduce.setFactoryCode(factoryCode); - qcCheckTaskProduce.setCreateTime(nowDate); - qcCheckTaskProduceMapper.insertQcCheckTaskProduce(qcCheckTaskProduce); - /**取检测项**/ QcCheckTypeProject qctp= new QcCheckTypeProject(); qctp.setTypeId(qcCheckTaskProduce.getCheckType());//生产过程检验 @@ -127,6 +120,13 @@ public class QcCheckTaskProduceServiceImpl implements IQcCheckTaskProduceService return 0;//没有找到检测项目 } + /**qc_check_task**/ + String beLongId = IdUtils.fastSimpleUUID(); + qcCheckTaskProduce.setRecordId(beLongId); + qcCheckTaskProduce.setFactoryCode(factoryCode); + qcCheckTaskProduce.setCreateTime(nowDate); + qcCheckTaskProduceMapper.insertQcCheckTaskProduce(qcCheckTaskProduce); + /**qc_check_task_detail**/ for(QcCheckTaskDetail item:items){ item.setRecordId(IdUtils.fastSimpleUUID()); item.setBelongTo(beLongId); diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskWarehousingServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskWarehousingServiceImpl.java index c278f5dd..95a810f3 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskWarehousingServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskWarehousingServiceImpl.java @@ -100,13 +100,6 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin qcCheckTaskWarehousing.setCheckNo(bpDD+liushuiStr); - /**qc_check_task_warehousing**/ - String beLongId = IdUtils.fastSimpleUUID(); - qcCheckTaskWarehousing.setRecordId(beLongId); - qcCheckTaskWarehousing.setFactoryCode(factoryCode); - qcCheckTaskWarehousing.setCreateTime(nowDate); - qcCheckTaskWarehousingMapper.insertQcCheckTaskWarehousing(qcCheckTaskWarehousing); - /**取检测项**/ QcCheckTypeProject qctp= new QcCheckTypeProject(); qctp.setTypeId(qcCheckTaskWarehousing.getCheckType());//生产过程检验 @@ -128,6 +121,13 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin return 0;//没有找到检测项目 } + /**qc_check_task**/ + String beLongId = IdUtils.fastSimpleUUID(); + qcCheckTaskWarehousing.setRecordId(beLongId); + qcCheckTaskWarehousing.setFactoryCode(factoryCode); + qcCheckTaskWarehousing.setCreateTime(nowDate); + qcCheckTaskWarehousingMapper.insertQcCheckTaskWarehousing(qcCheckTaskWarehousing); + /**qc_check_task_detail**/ for(QcCheckTaskDetail item:items){ item.setRecordId(IdUtils.fastSimpleUUID()); item.setBelongTo(beLongId); diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java index 713846e6..796dfbf6 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapOrderServiceImpl.java @@ -47,7 +47,7 @@ public class SapOrderServiceImpl implements SapOrderService { // S_WERKS(工厂) S_AUFNR(订单号) S_MATNR(物料号) S_ERDAT(创建日期) 例如:20230923 if (!StringUtils.isNull(sapShopOrderQuery.getWerk())){ - JCoTable S_WERKS = func.getTableParameterList().getTable("S_WERKS"); + JCoTable S_WERKS = func.getTableParameterList().getTable("S_PWERK"); S_WERKS.appendRow(); S_WERKS.setValue(Constants.SIGN, "I"); S_WERKS.setValue(Constants.OPTION, "EQ"); diff --git a/op-modules/op-technology/src/main/resources/mapper/technology/ProRouteProductMapper.xml b/op-modules/op-technology/src/main/resources/mapper/technology/ProRouteProductMapper.xml index dcc8b5bf..a0af3125 100644 --- a/op-modules/op-technology/src/main/resources/mapper/technology/ProRouteProductMapper.xml +++ b/op-modules/op-technology/src/main/resources/mapper/technology/ProRouteProductMapper.xml @@ -63,8 +63,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from pro_route_product pp where pp.route_id = #{routeId} ) - and bp.product_desc_zh like concat('%', #{itemName}, '%') - + and (bp.product_desc_zh like concat('%', #{itemName}, '%') + or bp.product_code like concat('%', #{itemName}, '%')) @@ -81,7 +81,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from pro_route_product pp left join base_product bp on pp.item_code = bp.product_code where pp.route_id = #{routeId} - and bp.product_desc_zh like concat('%', #{itemName}, '%') + and (bp.product_desc_zh like concat('%', #{itemName}, '%') + or bp.product_code like concat('%', #{itemName}, '%'))