From cec59e4bc461c66a829d824c82ea05c1c9581d9c Mon Sep 17 00:00:00 2001 From: Yangwl <1726150332@qq.com> Date: Tue, 14 Nov 2023 10:54:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=83=98=E6=88=BF=E7=9C=8B=E6=9D=BF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ABAP_AS_WITH_POOL.jcoDestination | 2 +- .../com/op/system/api/domain/sap/SapRFW.java | 4 +- op-auth/src/main/resources/bootstrap.yml | 12 +- .../op/common/core/utils/http/HttpUtils.java | 3 +- op-gateway/src/main/resources/bootstrap.yml | 12 +- .../controller/WCSInterfaceController.java | 15 ++- .../java/com/op/mes/mapper/MesMapper.java | 2 + .../op/mes/service/IWCSInterfaceService.java | 4 +- .../service/impl/IWCInterfaceServiceImpl.java | 116 ++++++++++++++++-- .../op-mes/src/main/resources/bootstrap.yml | 12 +- .../main/resources/mapper/mes/MesMapper.xml | 25 +++- .../com/op/sap/controller/SapController.java | 2 + .../op/sap/domain/vo/SapMaterialPosting.java | 8 +- .../op/sap/service/impl/SapItemSyncImpl.java | 76 ++++++++++++ .../op-sap/src/main/resources/bootstrap.yml | 12 +- .../src/main/resources/bootstrap.yml | 12 +- 16 files changed, 265 insertions(+), 52 deletions(-) diff --git a/ABAP_AS_WITH_POOL.jcoDestination b/ABAP_AS_WITH_POOL.jcoDestination index 3c6ea9bb..61113970 100644 --- a/ABAP_AS_WITH_POOL.jcoDestination +++ b/ABAP_AS_WITH_POOL.jcoDestination @@ -1,5 +1,5 @@ #for test only! -#Fri Oct 13 09:43:21 CST 2023 +#Mon Nov 06 18:11:07 CST 2023 jco.destination.pool_capacity=true jco.client.lang=zh jco.client.ashost=192.168.0.54 diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapRFW.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapRFW.java index e5100666..e6df8f1a 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapRFW.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapRFW.java @@ -42,7 +42,7 @@ public class SapRFW { } - public static class lt_gs + public class lt_gs { String conf_activity1; String conf_activity2; @@ -112,7 +112,7 @@ public class SapRFW { } } - public static class lt_hw{ + public class lt_hw{ String material; String entry_qnt; diff --git a/op-auth/src/main/resources/bootstrap.yml b/op-auth/src/main/resources/bootstrap.yml index 068f4b57..86db65b8 100644 --- a/op-auth/src/main/resources/bootstrap.yml +++ b/op-auth/src/main/resources/bootstrap.yml @@ -16,16 +16,16 @@ spring: # password: sfnacos2023 # 服务注册地址 #--spring.cloud.nacos.discovery.namespace=chj --spring.cloud.nacos.config.namespace=chj - namespace: lanju-op - group: zxl + namespace: lanju-op-test + group: test # 服务注册地址 - server-addr: 140.249.53.142:8848 + server-addr: 192.168.202.20:8848 config: #命名空间 - namespace: lanju-op - group: zxl + namespace: lanju-op-test + group: test # 服务注册地址 - server-addr: 140.249.53.142:8848 + server-addr: 192.168.202.20:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/op-common/op-common-core/src/main/java/com/op/common/core/utils/http/HttpUtils.java b/op-common/op-common-core/src/main/java/com/op/common/core/utils/http/HttpUtils.java index afa0423d..15833cf5 100644 --- a/op-common/op-common-core/src/main/java/com/op/common/core/utils/http/HttpUtils.java +++ b/op-common/op-common-core/src/main/java/com/op/common/core/utils/http/HttpUtils.java @@ -84,7 +84,8 @@ public class HttpUtils { conn.setRequestProperty("connection" , "Keep-Alive"); conn.setRequestProperty("user-agent" , "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); conn.setRequestProperty("Accept-Charset" , "utf-8"); - conn.setRequestProperty("contentType" , "utf-8"); +// conn.setRequestProperty("contentType" , "utf-8"); + conn.setRequestProperty("content-Type", "application/json; charset=utf-8"); conn.setDoOutput(true); conn.setDoInput(true); out = new PrintWriter(conn.getOutputStream()); diff --git a/op-gateway/src/main/resources/bootstrap.yml b/op-gateway/src/main/resources/bootstrap.yml index bd1f68ea..2e36e4a9 100644 --- a/op-gateway/src/main/resources/bootstrap.yml +++ b/op-gateway/src/main/resources/bootstrap.yml @@ -16,16 +16,16 @@ spring: # username: nacos # password: sfnacos2023 # namespace: lanju-op - namespace: lanju-op - group: zxl + namespace: lanju-op-test + group: test # 服务注册地址 - server-addr: 140.249.53.142:8848 + server-addr: 192.168.202.20:8848 config: #命名空间 - namespace: lanju-op - group: zxl + namespace: lanju-op-test + group: test # 服务注册地址 - server-addr: 140.249.53.142:8848 + server-addr: 192.168.202.20:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java index 45ba3d3a..e3ff55c4 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java @@ -142,15 +142,20 @@ public class WCSInterfaceController extends BaseController { * @param */ - @PostMapping("/dryRoomData") - public AjaxResult getDryRoomData(@RequestBody BoardDTO boardDTO){ + @PostMapping("/dryRoomDataHeader") + public AjaxResult dryRoomDataHeader(@RequestBody BoardDTO boardDTO){ if(StringUtils.isBlank(boardDTO.getFactory())){ return error("[factory] is not null"); } - return success(wCInterfaceService.getDryRoomData(boardDTO)); + return success(wCInterfaceService.dryRoomDataHeader(boardDTO)); } - public static void main(String args[]){ - System.out.println(DateUtils.getDate()); + @PostMapping("/dryRoomDataCarousel") + public AjaxResult getDryRoomData(@RequestBody BoardDTO boardDTO){ + if(StringUtils.isBlank(boardDTO.getFactory())){ + return error("[factory] is not null"); + } + return success(wCInterfaceService.dryRoomDataCarousel(boardDTO)); } + } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java index d9c8a5e9..8fc742f8 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java @@ -54,4 +54,6 @@ public interface MesMapper { void addSapLog(SysSapLog sysSapLog); List> selectcxjList(); + + List> selectdryingRoomListInfo(); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java index 44cec1cd..129e6d27 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java @@ -37,5 +37,7 @@ public interface IWCSInterfaceService { R reportWork(MesReportWork mesReportWork); - Map getDryRoomData(BoardDTO boardDTO); + Map dryRoomDataHeader(BoardDTO boardDTO); + + Map dryRoomDataCarousel(BoardDTO boardDTO); } 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 203a6c7a..5cb366a1 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 @@ -1,14 +1,19 @@ package com.op.mes.service.impl; +import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.op.common.core.domain.R; import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.bean.BeanUtils; +import com.op.common.core.utils.http.HttpUtils; import com.op.common.core.utils.uuid.IdUtils; +import com.op.mes.domain.BufferInfoParam; import com.op.mes.domain.MesReportWork; import com.op.mes.domain.MesShift; import com.op.mes.domain.ProOrderWorkorder; +import com.op.mes.domain.buffer.JsonRootBean; import com.op.mes.domain.dto.LGInfoDto; import com.op.mes.mapper.MesMapper; import com.op.mes.mapper.MesReportWorkMapper; @@ -403,21 +408,118 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { } @Override - public Map getDryRoomData(BoardDTO boardDTO) { + public Map dryRoomDataHeader(BoardDTO boardDTO) { DynamicDataSourceContextHolder.push("ds_"+boardDTO.getFactory());// 这是数据源的key //成型机清单 Map map=new HashMap(); List> eqmapList = mesMapper.selectcxjList(); + /** + * 成型机 + */ + long cxzc = eqmapList.stream() + .filter(e -> e.get("status").equals("1")&&e.get("equipment_type_code").equals("equ_type_cxj")&&!e.get("del_flag").equals("1")) + .count(); + /** + * 烘房 + */ + long hfauto = eqmapList.stream() + .filter(e -> e.get("status").equals("1") &&e.get("equipment_type_code").equals("equ_type_hf")&&!e.get("del_flag").equals("1")) + .count(); + /** + * 收胚机台 + */ + long spzc = eqmapList.stream() + .filter(e -> e.get("status").equals("1") &&e.get("equipment_type_code").equals("equ_type_spj")&&!e.get("del_flag").equals("1")) + .count(); + + BufferInfoParam bufferInfoParam=new BufferInfoParam(); + bufferInfoParam.setReqCode(IdUtils.fastSimpleUUID()); + bufferInfoParam.setReqTime(DateUtils.dateTimeNow()); + //成型缓存区 + bufferInfoParam.setBufferType("10"); + bufferInfoParam.setFactory(boardDTO.getFactory()); + try { + String res= HttpUtils.sendPost("http://192.168.202.23:5001/api/ReceivingAndFeedingMaterials/bufferInfoSync", JSON.toJSONString(bufferInfoParam)); + JsonRootBean jsonRootBean=JSONObject.parseObject(res,JsonRootBean.class); + long count = jsonRootBean.getLocations().stream() + .filter(obj -> !obj.getRfid().isEmpty()) + .count(); + map.put("hcnumber",count); + }catch (Exception e){ + e.printStackTrace(); + } + map.put("cxzc",cxzc); + map.put("hfauto",hfauto); + map.put("spzc",spzc); + + map.put("result",eqmapList); + return map; } - public static void main(String args[]){ - DateTimeFormatter ymdhms = DateTimeFormatter.ofPattern("yyyy-MM-dd"); - LocalDate today = LocalDate.now(); - LocalDate lastMonth3 = today.plus(-3, ChronoUnit.MONTHS); - - System.out.println("7天之前的日期为:"+lastMonth3.getYear()); + @Override + public Map dryRoomDataCarousel(BoardDTO boardDTO) { + DynamicDataSourceContextHolder.push("ds_"+boardDTO.getFactory());// 这是数据源的key + Map map=new HashMap(); + //查询烘房信息 + List> dryingRoomListInfo = mesMapper.selectdryingRoomListInfo(); + map.put("dryingroomList",dryingRoomListInfo); + return map; } + + +// public static void main(String[] args) { +// param param=new param(); +// param.setReqCode(IdUtils.fastSimpleUUID()); +// param.setReqTime(DateUtils.dateTimeNow()); +// param.setBufferType("10"); +// param.setFactory("999"); +// try { +// String res= HttpUtils.sendPost("http://192.168.109.36:5001/api/ReceivingAndFeedingMaterials/bufferInfoSync", JSON.toJSONString(param)); +// System.out.println(res); +// }catch (Exception e){ +// System.out.println(e.getMessage()); +// } +// +// } +// static class param{ +// String reqCode; +// String reqTime; +// String factory; +// String bufferType; +// +// public String getReqCode() { +// return reqCode; +// } +// +// public void setReqCode(String reqCode) { +// this.reqCode = reqCode; +// } +// +// public String getReqTime() { +// return reqTime; +// } +// +// public void setReqTime(String reqTime) { +// this.reqTime = reqTime; +// } +// +// public String getFactory() { +// return factory; +// } +// +// public void setFactory(String factory) { +// this.factory = factory; +// } +// +// public String getBufferType() { +// return bufferType; +// } +// +// public void setBufferType(String bufferType) { +// this.bufferType = bufferType; +// } +// } } diff --git a/op-modules/op-mes/src/main/resources/bootstrap.yml b/op-modules/op-mes/src/main/resources/bootstrap.yml index 014cd085..0804f616 100644 --- a/op-modules/op-mes/src/main/resources/bootstrap.yml +++ b/op-modules/op-mes/src/main/resources/bootstrap.yml @@ -13,15 +13,15 @@ spring: cloud: nacos: discovery: - namespace: lanju-op - group: zxl + namespace: lanju-op-test + group: test # 服务注册地址 - server-addr: 140.249.53.142:8848 + server-addr: 192.168.202.20:8848 config: - namespace: lanju-op - group: zxl + namespace: lanju-op-test + group: test # 服务注册地址 - server-addr: 140.249.53.142:8848 + server-addr: 192.168.202.20:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml index ae338574..353c9177 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml @@ -168,8 +168,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where create_time >= #{startDate} and #{endDate}>create_time + + delete from mes_material_transfer_result where create_time >= #{startDate} and #{endDate}>create_time 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 a7e0d9a1..802bb59a 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 @@ -352,4 +352,6 @@ public class SapController extends BaseController { return R.ok(); } + + } diff --git a/op-modules/op-sap/src/main/java/com/op/sap/domain/vo/SapMaterialPosting.java b/op-modules/op-sap/src/main/java/com/op/sap/domain/vo/SapMaterialPosting.java index e6010f63..078c47cc 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/domain/vo/SapMaterialPosting.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/domain/vo/SapMaterialPosting.java @@ -14,21 +14,21 @@ package com.op.sap.domain.vo; */ public class SapMaterialPosting { - private String aufnr; + /** * 订单物料领料过账、原材料补料的移动类型值为261 * 订单物料退料过账为262 * */ + private String aufnr; private String bwart; - private String plant; private String lgort; private String matnr; - private String quantity; + private String quantity; private String meins; - private String batch; + private String batch; public String getAufnr() { return aufnr; 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 index 264492cd..a501a668 100644 --- 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 @@ -205,6 +205,82 @@ public class SapItemSyncImpl implements SapItemSyncService { JCoTable jCoTable = func.getTableParameterList().getTable("L_ITEM"); System.out.println(jCoTable); + JCoParameterList AUFNR = func.getImportParameterList(); + System.out.println(AUFNR); + + //订单 + if (!StringUtils.isNull(sapMaterialPosting.getAufnr())){ + +// AUFNR.appendRow(); +// AUFNR.setValue(Constants.SIGN, "I"); +// AUFNR.setValue(Constants.OPTION, "EQ"); +// AUFNR.setValue(Constants.LOW, sapMaterialPosting.getAufnr()); + } +// //移动类型 +// if (!StringUtils.isNull(sapMaterialPosting.getBwart())){ +// JCoTable S_MATNR = func.getTableParameterList().getTable("BWART"); +// S_MATNR.appendRow(); +// S_MATNR.setValue(Constants.SIGN, "I"); +// S_MATNR.setValue(Constants.OPTION, "EQ"); +// S_MATNR.setValue(Constants.LOW, sapMaterialPosting.getBwart()); +// } +// //工厂 +// if (!StringUtils.isNull(sapMaterialPosting.getPlant())){ +// JCoTable S_MATNR = func.getTableParameterList().getTable("PLANT"); +// S_MATNR.appendRow(); +// S_MATNR.setValue(Constants.SIGN, "I"); +// S_MATNR.setValue(Constants.OPTION, "EQ"); +// S_MATNR.setValue(Constants.LOW, sapMaterialPosting.getPlant()); +// } +// /** +// * 物料信息 +// */ +// if (!StringUtils.isNull(sapMaterialPosting.getMatnr())){ +// JCoTable S_MATNR = func.getTableParameterList().getTable("MATNR"); +// S_MATNR.appendRow(); +// S_MATNR.setValue(Constants.SIGN, "I"); +// S_MATNR.setValue(Constants.OPTION, "EQ"); +// S_MATNR.setValue(Constants.LOW, sapMaterialPosting.getMatnr()); +// } +// //数量 +// if (!StringUtils.isNull(sapMaterialPosting.getQuantity())){ +// JCoTable S_MATNR = func.getTableParameterList().getTable("QUANTITY"); +// S_MATNR.appendRow(); +// S_MATNR.setValue(Constants.SIGN, "I"); +// S_MATNR.setValue(Constants.OPTION, "EQ"); +// S_MATNR.setValue(Constants.LOW, sapMaterialPosting.getQuantity()); +// } +// //单位 +// if (!StringUtils.isNull(sapMaterialPosting.getMeins())){ +// JCoTable S_MATNR = func.getTableParameterList().getTable("MEINS"); +// S_MATNR.appendRow(); +// S_MATNR.setValue(Constants.SIGN, "I"); +// S_MATNR.setValue(Constants.OPTION, "EQ"); +// S_MATNR.setValue(Constants.LOW, sapMaterialPosting.getMeins()); +// } +// //批号 +// JCoTable S_MATNR = func.getTableParameterList().getTable("BATCH"); +// S_MATNR.appendRow(); +// S_MATNR.setValue(Constants.SIGN, "I"); +// S_MATNR.setValue(Constants.OPTION, "EQ"); +// S_MATNR.setValue(Constants.LOW, sapMaterialPosting.getBatch()); + + // 获取调用 RFC 函数对象 + func.execute(dest); + // 获取 内表 - ZMES_PRO + JCoTable maraTable = func.getTableParameterList().getTable("LT_RETURN"); + JCoRecordMetaData metaData = maraTable.getRecordMetaData(); + System.out.println("###" + metaData.toString()); + for (int i = 0; i < maraTable.getNumRows(); i++) { + maraTable.setRow(i); + String RETCODE = maraTable.getString("RETCODE"); + System.out.println(RETCODE); + } + +// JCoRecordMetaData metaData = maraTable.getRecordMetaData(); +// System.out.println("###" + metaData.toString()); + + if (func == null) { throw new RuntimeException("Function does not exist in SAP"); } diff --git a/op-modules/op-sap/src/main/resources/bootstrap.yml b/op-modules/op-sap/src/main/resources/bootstrap.yml index f4268061..ce8e98df 100644 --- a/op-modules/op-sap/src/main/resources/bootstrap.yml +++ b/op-modules/op-sap/src/main/resources/bootstrap.yml @@ -13,15 +13,15 @@ spring: cloud: nacos: discovery: - namespace: lanju-op - group: zxl + namespace: lanju-op-test + group: test # 服务注册地址 - server-addr: 140.249.53.142:8848 + server-addr: 192.168.202.20:8848 config: - namespace: lanju-op - group: zxl + namespace: lanju-op-test + group: test # 服务注册地址 - server-addr: 140.249.53.142:8848 + server-addr: 192.168.202.20:8848 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/op-modules/op-system/src/main/resources/bootstrap.yml b/op-modules/op-system/src/main/resources/bootstrap.yml index f1c89ab1..0cc2a7ba 100644 --- a/op-modules/op-system/src/main/resources/bootstrap.yml +++ b/op-modules/op-system/src/main/resources/bootstrap.yml @@ -13,15 +13,15 @@ spring: cloud: nacos: discovery: - namespace: lanju-op - group: zxl + namespace: lanju-op-test + group: test # 服务注册地址 - server-addr: 140.249.53.142:8848 + server-addr: 192.168.202.20:8848 config: - namespace: lanju-op - group: zxl + namespace: lanju-op-test + group: test # 服务注册地址 - server-addr: 140.249.53.142:8848 + server-addr: 192.168.202.20:8848 # 配置文件格式 file-extension: yml # 共享配置