From 1717a12c83db01e3b31ea9ed913e5bacaf9edbf3 Mon Sep 17 00:00:00 2001 From: hdy <1105738590@qq.com> Date: 星期六, 29 三月 2025 14:24:06 +0800 Subject: [PATCH] 修改 --- billion-main/src/main/java/com/billion/main/da/service/impl/DaMaterialCollectionServiceImpl.java | 104 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 80 insertions(+), 24 deletions(-) diff --git a/billion-main/src/main/java/com/billion/main/da/service/impl/DaMaterialCollectionServiceImpl.java b/billion-main/src/main/java/com/billion/main/da/service/impl/DaMaterialCollectionServiceImpl.java index 354b3da..445a12c 100644 --- a/billion-main/src/main/java/com/billion/main/da/service/impl/DaMaterialCollectionServiceImpl.java +++ b/billion-main/src/main/java/com/billion/main/da/service/impl/DaMaterialCollectionServiceImpl.java @@ -1,6 +1,7 @@ package com.billion.main.da.service.impl; import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -33,8 +34,9 @@ { @Autowired private DaMaterialCollectionMapper daMaterialCollectionMapper; - + @Autowired public IBsBomChildInfoService bsBomChildInfoService; + @Autowired public IOmOrderSchedulingService omOrderSchedulingService; /** * 鏌ヨ鐗╂枡閲囬泦 @@ -74,36 +76,41 @@ DaMaterialCollection daMaterialCollection1 = new DaMaterialCollection(); BsBomChildInfo bsBomChildInfo = new BsBomChildInfo(); OmOrderScheduling omOrderScheduling = new OmOrderScheduling(); + daMaterialCollection1.setSfcCode(daMaterialCollection.getSfcCode()); daMaterialCollection1.setLocationCode(daMaterialCollection.getLocationCode()); daMaterialCollection1.setParamValue(daMaterialCollection.getParamValue()); daMaterialCollection1.setCollectTime(daMaterialCollection.getCollectTime()); + omOrderScheduling.setSfcCode(daMaterialCollection.getSfcCode()); - if(Objects.equals(daMaterialCollection.getLocationCode(), "OP130") || Objects.equals(daMaterialCollection.getLocationCode(), "OP020")){ - daMaterialCollection1.setMaterialCode(""); - daMaterialCollection1.setMaterialName(daMaterialCollection.getMaterialName()); - collectMT.setMaterial1(daMaterialCollection1.getParamName()); - }else{ - bsBomChildInfo.setLocationCode(daMaterialCollection.getLocationCode()); - String materialCode = daMaterialCollection.getSfcCode().length() > 9 ? daMaterialCollection.getSfcCode().substring(0, daMaterialCollection.getSfcCode().length() - 9) : daMaterialCollection.getSfcCode(); - bsBomChildInfo.setMaterialCode(materialCode); - List<BsBomChildInfo> bsBomChildInfoList = bsBomChildInfoService.selectBsBomChildInfoList(bsBomChildInfo); - daMaterialCollection1.setMaterialCode(bsBomChildInfoList.get(0).getMaterialCode()); - daMaterialCollection1.setMaterialName(bsBomChildInfoList.get(0).getMaterialName()); - collectMT.setMaterial1(bsBomChildInfoList.get(0).getMaterialName()); - } - if(Objects.equals(daMaterialCollection.getLocationCode(), Constants.PLC1.toString()) || - Objects.equals(daMaterialCollection.getLocationCode(), Constants.C005) || - Objects.equals(daMaterialCollection.getLocationCode(), Constants.C060)) + if( Constants.PLC1.contains(daMaterialCollection.getLocationCode()) || + Constants.C005.equals(daMaterialCollection.getLocationCode()) || + Constants.C060.equals(daMaterialCollection.getLocationCode()) ) {omOrderScheduling.setRemarks("Head");} - else if(Objects.equals(daMaterialCollection.getLocationCode(), Constants.PLC2.toString()) || - Objects.equals(daMaterialCollection.getLocationCode(), Constants.OP005) || - Objects.equals(daMaterialCollection.getLocationCode(), Constants.OP310)) + else if( + Constants.PLC2.contains(daMaterialCollection.getLocationCode()) || + Constants.OP005.equals(daMaterialCollection.getLocationCode()) || + Constants.OP310.equals(daMaterialCollection.getLocationCode())) {omOrderScheduling.setRemarks("Body");} - else if(Objects.equals(daMaterialCollection.getLocationCode(), Constants.P010)) + else if(Constants.P010.equals(daMaterialCollection.getLocationCode())) {omOrderScheduling.setRemarks("Pre");} List<OmOrderScheduling> omOrderSchedulingList = omOrderSchedulingService.selectOmOrderSchedulingList(omOrderScheduling); - collectMT.setOrderNumber(omOrderSchedulingList.get(0).getWorkOrderNo()); + String OrderNumber = omOrderSchedulingList.get(0).getWorkOrderNo(); + + bsBomChildInfo.setLocationCode(daMaterialCollection.getLocationCode()); + bsBomChildInfo.setBomCode(OrderNumber); + String[] parts = daMaterialCollection.getParamValue().split("#"); + String targetValue = parts[1]; // 鍙栫浜屼釜鍏冪礌锛堢储寮�1锛� + bsBomChildInfo.setMaterialCode(targetValue); + List<BsBomChildInfo> bsBomChildInfoList = bsBomChildInfoService.selectBsBomChildInfoList(bsBomChildInfo); + String MaterialCode = bsBomChildInfoList.get(0).getMaterialCode(); + String MaterialName = bsBomChildInfoList.get(0).getMaterialName(); + daMaterialCollection1.setMaterialCode(MaterialCode); + daMaterialCollection1.setMaterialName(MaterialName); + + this.save(daMaterialCollection1); + collectMT.setMaterial1(MaterialName); + collectMT.setOrderNumber(OrderNumber); collectMT.setEngineNumber(daMaterialCollection.getSfcCode()); collectMT.setStationName(daMaterialCollection.getLocationCode()); collectMT.setPartsNumber(daMaterialCollection.getParamValue()); @@ -116,9 +123,57 @@ // 璁板綍鏃ュ織 log.error("鎺ㄩ�佸け璐�"); } - this.save(daMaterialCollection1); // this.save(daMaterialCollection); } + + + @Override + public void plusSave(DaMaterialCollection daMaterialCollection) { + String url = "http://172.40.161.71:8890/Interaction/CollectMT"; + CollectMT collectMT = new CollectMT(); + DaMaterialCollection daMaterialCollection1 = new DaMaterialCollection(); + BsBomChildInfo bsBomChildInfo = new BsBomChildInfo(); + OmOrderScheduling omOrderScheduling = new OmOrderScheduling(); + daMaterialCollection1.setSfcCode(daMaterialCollection.getSfcCode()); + daMaterialCollection1.setLocationCode(daMaterialCollection.getLocationCode()); + daMaterialCollection1.setParamValue(daMaterialCollection.getParamValue()); + daMaterialCollection1.setCollectTime(daMaterialCollection.getCollectTime()); + omOrderScheduling.setSfcCode(daMaterialCollection.getSfcCode()); + omOrderScheduling.setSfcCode(daMaterialCollection.getSfcCode()); + if( Constants.PLC1.contains(daMaterialCollection.getLocationCode()) || + Constants.C005.equals(daMaterialCollection.getLocationCode()) || + Constants.C060.equals(daMaterialCollection.getLocationCode()) ) + {omOrderScheduling.setRemarks("Head");} + else if( + Constants.PLC2.contains(daMaterialCollection.getLocationCode()) || + Constants.OP005.equals(daMaterialCollection.getLocationCode()) || + Constants.OP310.equals(daMaterialCollection.getLocationCode())) + {omOrderScheduling.setRemarks("Body");} + else if(Constants.P010.equals(daMaterialCollection.getLocationCode())) + {omOrderScheduling.setRemarks("Pre");} + List<OmOrderScheduling> omOrderSchedulingList = omOrderSchedulingService.selectOmOrderSchedulingList(omOrderScheduling); + String OrderNumber = omOrderSchedulingList.get(0).getWorkOrderNo(); + String[] parts = daMaterialCollection.getParamValue().split("#"); + String targetValue = parts[1]; // 鍙栫浜屼釜鍏冪礌锛堢储寮�1锛� + daMaterialCollection1.setMaterialCode(targetValue); + daMaterialCollection1.setMaterialName(daMaterialCollection.getParamName()); + this.save(daMaterialCollection1); + collectMT.setMaterial1(daMaterialCollection.getMaterialName()); + collectMT.setOrderNumber(OrderNumber); + collectMT.setEngineNumber(daMaterialCollection.getSfcCode()); + collectMT.setStationName(daMaterialCollection.getLocationCode()); + collectMT.setPartsNumber(daMaterialCollection.getParamValue()); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + collectMT.setInsertTime(sdf.format(daMaterialCollection.getCollectTime())); + try { + HttpResponse response = HttpRequest.post(url).body(JSONUtil.toJsonStr(collectMT)).execute(); + log.info("鎺ㄩ�佹垚鍔燂紝鍝嶅簲鎶ユ枃: {}", response); + } catch (Exception e) { + // 璁板綍鏃ュ織 + log.error("鎺ㄩ�佸け璐�"); + } + } + /** * 淇敼鐗╂枡閲囬泦 @@ -155,4 +210,5 @@ { return daMaterialCollectionMapper.deleteDaMaterialCollectionById(id); } -} + +} \ No newline at end of file -- Gitblit v1.9.3