From bb61ed1b9565a9f920c4357d2ebd14531d496f43 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Wed, 27 Sep 2023 12:00:23 +0800 Subject: [PATCH] =?UTF-8?q?sap=20jar=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../op/system/api/domain/dto/WCSDataDTO.java | 9 ++++++++ .../op/system/api/domain/sap/SapSupplier.java | 7 +++++++ .../mapper/ProRfidProcessDetailMapper.java | 4 ++++ .../service/impl/IWCInterfaceServiceImpl.java | 16 +++++++++----- .../mapper/mes/ProRfidProcessDetailMapper.xml | 8 +++++++ op-modules/op-sap/pom.xml | 1 + op-modules/op-sap/push-sap.bat | 1 + .../impl/SapWorkCenterServiceImpl.java | 21 +++++++++++-------- .../resources/mapper/sap/SapBomMapper.xml | 8 +++---- 9 files changed, 57 insertions(+), 18 deletions(-) diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDataDTO.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDataDTO.java index 6dcefaeb..31c8690d 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDataDTO.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDataDTO.java @@ -13,6 +13,15 @@ public class WCSDataDTO { private String stationNo; private int qty; + private String mode; + + public String getMode() { + return mode; + } + + public void setMode(String mode) { + this.mode = mode; + } public int getQty() { return qty; diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapSupplier.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapSupplier.java index d4667590..4bb17434 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapSupplier.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapSupplier.java @@ -18,8 +18,15 @@ public class SapSupplier extends BaseEntity { private String telf1; private String stras; private String erdat; + private String recordId; + public String getRecordId() { + return recordId; + } + public void setRecordId(String recordId) { + this.recordId = recordId; + } public String getBukrs() { return bukrs; diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProRfidProcessDetailMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProRfidProcessDetailMapper.java index 00e2db1c..3f8d5241 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProRfidProcessDetailMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProRfidProcessDetailMapper.java @@ -68,4 +68,8 @@ public interface ProRfidProcessDetailMapper { String getActuaEquips(ProRfidProcessDetail rfidInfo); Integer getEquipNum(String machineCode); + + String getEquipStatus(String machineCode); + + String getEquipMode(String machineCode); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java index 7edfd17b..e9f88af5 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java @@ -118,12 +118,18 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { for (String machineCode : machineArray) { wCSDataDTO = new WCSDataDTO(); if (StringUtils.isNotBlank(machineCode)) { - wCSDataDTO.setStationNo(machineCode); - if ("2".equals(stationType)) { - Integer qty = proRfidProcessDetailMapper.getEquipNum(machineCode); - wCSDataDTO.setQty(qty == null ? 0 : qty); + //设备是否正常 + String status = proRfidProcessDetailMapper.getEquipStatus(machineCode); + if(StringUtils.isNotBlank(status) && "1".equals(status)){//正常设备且没被删除 + wCSDataDTO.setStationNo(machineCode); + if ("2".equals(stationType)) { + Integer qty = proRfidProcessDetailMapper.getEquipNum(machineCode); + wCSDataDTO.setQty(qty == null ? 0 : qty); + String mode = proRfidProcessDetailMapper.getEquipMode(machineCode); + wCSDataDTO.setMode(mode); + } + stationNos.add(wCSDataDTO); } - stationNos.add(wCSDataDTO); } } dto.setStationNos(stationNos); diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProRfidProcessDetailMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProRfidProcessDetailMapper.xml index 9c6ac474..bb08b9a7 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProRfidProcessDetailMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/ProRfidProcessDetailMapper.xml @@ -97,6 +97,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where property = 'dollyNumber' and device_code = #{machineCode} + + insert into pro_rfid_process_detail diff --git a/op-modules/op-sap/pom.xml b/op-modules/op-sap/pom.xml index e645e8b4..1a32bcb3 100644 --- a/op-modules/op-sap/pom.xml +++ b/op-modules/op-sap/pom.xml @@ -92,6 +92,7 @@ com.sap sapjco3 + 1.0.0 junit diff --git a/op-modules/op-sap/push-sap.bat b/op-modules/op-sap/push-sap.bat index 6bc197a4..93461c93 100644 --- a/op-modules/op-sap/push-sap.bat +++ b/op-modules/op-sap/push-sap.bat @@ -28,6 +28,7 @@ if exist %df% ( echo --------------------------------Dockerfile-------------------------------- echo FROM 192.168.202.36:30002/library/openjdk:8u131-jdk-alpine >> Dockerfile echo ADD libsapjco3.so /home/sap/libsapjco3.so >> Dockerfile +echo ADD sapjco3.jar /home/sap/sapjco3.jar >> Dockerfile echo ENV LD_LIBRARY_PATH /home/sap >> Dockerfile echo COPY %jarName% /application.jar >> Dockerfile echo RUN echo "Asia/Shanghai" ^> /etc/timezone >> Dockerfile 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 index f113fa3a..5ca6e4c7 100644 --- 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 @@ -3,6 +3,7 @@ package com.op.sap.service.impl; import com.op.common.core.domain.R; 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.sap.domain.vo.SapSupplierQuery; import com.op.sap.domain.vo.SapWorkCenterQuery; import com.op.sap.mapper.SapBomMapper; @@ -269,7 +270,8 @@ public class SapWorkCenterServiceImpl implements SapWorkCenterService { List updates = new ArrayList<>(); for(String exsitCode:exsitCodes){ - updates = dtos.stream().filter(dto -> dto.getArbpl().equals(exsitCode)).collect(Collectors.toList()); + List updates0 = dtos.stream().filter(dto -> dto.getArbpl().equals(exsitCode)).collect(Collectors.toList()); + updates.addAll(updates0); } if(!CollectionUtils.isEmpty(updates)){ int m = sapBomMapper.updateFactoryBatchs(updates); @@ -305,22 +307,23 @@ public class SapWorkCenterServiceImpl implements SapWorkCenterService { List updates = new ArrayList<>(); for(String exsitCode:exsitCodes){ - updates = dtos.stream().filter(dto -> dto.getLifnr().equals(exsitCode)).collect(Collectors.toList()); + List updates0 = dtos.stream().filter(dto -> dto.getLifnr().equals(exsitCode)).collect(Collectors.toList()); + updates.addAll(updates0); } - if(CollectionUtils.isEmpty(updates)){ + if(!CollectionUtils.isEmpty(updates)){ int m = sapBomMapper.updateSupplierBatchs(updates); System.out.println("供应商更新成功条数:"+m); } List adds = new ArrayList<>(); for(String noExsitCode:noExsitCodes){ - adds = dtos.stream().filter(dto -> dto.getLifnr().equals(noExsitCode)).collect(Collectors.toList()); + List adds0 = dtos.stream().filter(dto -> dto.getLifnr().equals(noExsitCode)).collect(Collectors.toList()); + adds.addAll(adds0); } - if(CollectionUtils.isEmpty(adds)){ - //工厂parentId - /*String parentId = sapBomMapper.getParentId(adds.get(0).getBukrs()); + if(!CollectionUtils.isEmpty(adds)){ + adds.stream().forEach(e->{ - e.setParentId(parentId); - });*/ + e.setRecordId(IdUtils.fastSimpleUUID()); + }); int n = sapBomMapper.addSupplierBatchs(adds); System.out.println("供应商新增成功条数:"+ n); } 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 2eae9ca2..27ee38eb 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 @@ -276,7 +276,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_time) VALUES - (#{item.bukrs},#{item.name1},#{item.telf1},#{item.stars} + (#{item.bukrs},#{item.name1},#{item.telf1},#{item.stras}, 'job', #{item.erdat}, #{item.erdat}) @@ -297,13 +297,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" (client_code,client_name,contact1_tel,address, create_by, create_time, - update_time) + update_time,factory_code) VALUES - (#{item.bukrs},#{item.name1},#{item.telf1},#{item.stars} + (#{item.lifnr},#{item.name1},#{item.telf1},#{item.stars} 'job', #{item.erdat}, - #{item.erdat}) + #{item.erdat},#{item.bukrs})