From 1044d25ccaa5350b68fa259788246812139267b1 Mon Sep 17 00:00:00 2001 From: zhangc <zc@123> Date: 星期三, 05 三月 2025 12:06:27 +0800 Subject: [PATCH] 四期 --- src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java | 91 +++++++++++++++++++++++---------------------- 1 files changed, 46 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java index 18650b8..db118c7 100644 --- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java @@ -1,5 +1,6 @@ package com.zy.asrs.service.impl; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.common.BaseRes; import com.core.common.Cools; @@ -24,9 +25,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; /** @@ -77,8 +76,7 @@ DocType docType = docTypeService.selectOrAdd(param.getOrderType(), Boolean.TRUE); Date now = new Date(); // 鍗曟嵁涓绘。 - order = new Order( - String.valueOf(snowflakeIdWorker.nextId()), // 缂栧彿[闈炵┖] + order = new Order(String.valueOf(snowflakeIdWorker.nextId()), // 缂栧彿[闈炵┖] param.getOrderNo(), // 璁㈠崟缂栧彿 DateUtils.convert(now), // 鍗曟嵁鏃ユ湡 docType.getDocId(), // 鍗曟嵁绫诲瀷 @@ -156,8 +154,7 @@ } // 鐢熸垚璋冩嫧鍗� if (docType.getDocId().intValue() == 32) { - order = new Order( - String.valueOf(snowflakeIdWorker.nextId()), // 缂栧彿[闈炵┖] + order = new Order(String.valueOf(snowflakeIdWorker.nextId()), // 缂栧彿[闈炵┖] "DB" + param.getOrderNo(), // 璁㈠崟缂栧彿 DateUtils.convert(now), // 鍗曟嵁鏃ユ湡 33L, // 鍗曟嵁绫诲瀷 @@ -254,7 +251,7 @@ if (order.getSettle() == 4L) { // 淇敼璁㈠崟鐘舵�� 4.瀹屾垚 ===>> 6.宸蹭笂鎶� if (!orderService.updateSettle(order.getId(), 6L, null)) { - throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳"); + throw new CoolException("璁㈠崟鐘舵�佷慨鏀�(4-6)澶辫触"); } } } @@ -273,7 +270,7 @@ } // 淇敼璁㈠崟鐘舵�� 4.瀹屾垚 ===>> 6.宸蹭笂鎶� if (!orderService.updateSettle(order.getId(), 6L, null)) { - throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳"); + throw new CoolException("璁㈠崟鐘舵�佷慨鏀�(4-6)澶辫触"); } } } @@ -294,8 +291,7 @@ DocType docType = docTypeService.selectOrAdd(param.getOrderType(), Boolean.FALSE); Date now = new Date(); // 鍗曟嵁涓绘。 - order = new Order( - String.valueOf(snowflakeIdWorker.nextId()), // 缂栧彿[闈炵┖] + order = new Order(String.valueOf(snowflakeIdWorker.nextId()), // 缂栧彿[闈炵┖] param.getOrderNo(), // 璁㈠崟缂栧彿 DateUtils.convert(now), // 鍗曟嵁鏃ユ湡 docType.getDocId(), // 鍗曟嵁绫诲瀷 @@ -369,8 +365,7 @@ } } if (docType.getDocId().intValue() == 32) { - order = new Order( - String.valueOf(snowflakeIdWorker.nextId()), // 缂栧彿[闈炵┖] + order = new Order(String.valueOf(snowflakeIdWorker.nextId()), // 缂栧彿[闈炵┖] "DB" + param.getOrderNo(), // 璁㈠崟缂栧彿 DateUtils.convert(now), // 鍗曟嵁鏃ユ湡 33L, // 鍗曟嵁绫诲瀷 @@ -465,7 +460,7 @@ if (order.getSettle() == 4L) { // 淇敼璁㈠崟鐘舵�� 4.瀹屾垚 ===>> 6.宸蹭笂鎶� if (!orderService.updateSettle(order.getId(), 6L, null)) { - throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳"); + throw new CoolException("璁㈠崟鐘舵�佷慨鏀�(4-6)澶辫触"); } } } @@ -484,7 +479,7 @@ } // 淇敼璁㈠崟鐘舵�� 4.瀹屾垚 ===>> 6.宸蹭笂鎶� if (!orderService.updateSettle(order.getId(), 6L, null)) { - throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳"); + throw new CoolException("璁㈠崟鐘舵�佷慨鏀�(4-6)澶辫触"); } } } @@ -509,8 +504,7 @@ throw new CoolException(param.getBarcode() + "閲嶅鎻愪氦"); } Date now = new Date(); - pack = new Pack( - param.getBarcode(), // 鏉$爜[闈炵┖] + pack = new Pack(param.getBarcode(), // 鏉$爜[闈炵┖] analyse.getMatnr(), // 鐗╂枡鍙� analyse.getBarcode(), // 搴忓垪鐮� 1L, // 璁㈠崟鐘舵�� @@ -522,7 +516,7 @@ null // 澶囨敞 ); if (!packService.insert(pack)) { - throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳"); + throw new CoolException("鎵撳寘澶辫触"); } Mat mat = matService.selectByMatnr(analyse.getMatnr()); @@ -537,8 +531,7 @@ Tag top = tagService.getTop(); NodeUtils nodeUtils = new NodeUtils(); nodeUtils.executePath(top.getId()); - priTag = new Tag( - null, // 缂栧彿 + priTag = new Tag(null, // 缂栧彿 param.getGroupCode(), // 鍚嶇О top.getId(), // 鐖剁骇 top.getName(), // 鐖剁骇鍚嶇О @@ -559,7 +552,7 @@ null // 澶囨敞 ); if (tagMapper.insert(priTag) == 0) { - throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳"); + throw new CoolException("鍒嗙被娣诲姞澶辫触"); } } // 浜岀骇鍒嗙被 @@ -567,8 +560,7 @@ if (secTag == null) { NodeUtils nodeUtils = new NodeUtils(); nodeUtils.executePath(priTag.getId()); - secTag = new Tag( - null, // 缂栧彿 + secTag = new Tag(null, // 缂栧彿 param.getGroupName(), // 鍚嶇О priTag.getId(), // 鐖剁骇 priTag.getName(), // 鐖剁骇鍚嶇О @@ -589,7 +581,7 @@ null // 澶囨敞 ); if (tagMapper.insert(secTag) == 0) { - throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳"); + throw new CoolException("鍒嗙被娣诲姞澶辫触"); } } tagId = secTag.getId(); @@ -605,7 +597,7 @@ mat.setCreateTime(now); mat.setUpdateTime(now); if (!matService.insert(mat)) { - throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳"); + throw new CoolException("鐗╂枡娣诲姞澶辫触"); } else { log.info("鎵撳寘涓婄嚎娣诲姞鏂扮墿鏂橻鐗╂枡鍙凤細{}]", mat.getMatnr()); } @@ -655,6 +647,7 @@ mat.setBeBatch(Cools.eq("true", param.getBInvBatch()) ? 1 : 0); mat.setStatus(param.getStates()); + mat.setModel(param.getIGroupType());//0:鏃犳崲绠� 1锛氬浐瀹氭崲绠� 2锛氭诞鍔ㄦ崲绠� 涓嶆槸0鐨勯兘寰椾紶 榛樿涓�0 mat.setCreateBy(9999L);//9999琛ㄧずerp涓嬪彂 mat.setCreateTime(date); mat.setUpdateBy(9999L);//9999琛ㄧずerp涓嬪彂 @@ -664,9 +657,7 @@ } public void callApiLogSave(Mat mat, String tableName, String response, Boolean bool) { - apiLogService.save("ERP涓嬪彂鍟嗗搧淇℃伅", tableName, "null", "10.10.10.1", - "鐗╂枡缂栫爜锛�" + mat.getMatnr() + "銆佺墿鏂欏悕绉帮細" + mat.getMaktx() + "銆佽鏍硷細" + mat.getSpecs() + "銆佸娉細" + mat.getMemo(), - response, bool); + apiLogService.save("ERP涓嬪彂鍟嗗搧淇℃伅", tableName, "null", "10.10.10.1", "鐗╂枡缂栫爜锛�" + mat.getMatnr() + "銆佺墿鏂欏悕绉帮細" + mat.getMaktx() + "銆佽鏍硷細" + mat.getSpecs() + "銆佸娉細" + mat.getMemo(), response, bool); } @@ -683,8 +674,7 @@ throw new CoolException("鏉$爜闀垮害涓嶆槸8浣�===>>" + param.getBarcode()); } // 鍒ゆ柇鏄惁鏈夌浉鍚屾潯鐮佺殑鏁版嵁 - if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). - eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { + if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { callApiLogSaveMES(param, null, param.getBarcode() + "鏁版嵁姝e湪杩涜鍏ュ簱", false); throw new CoolException(param.getBarcode() + "鏁版嵁姝e湪杩涜鍏ュ簱"); } @@ -745,17 +735,11 @@ public void callApiLogSaveMES(CombParam combParam, CombParam.CombMat combMat, String response, Boolean bool) { if (Cools.isEmpty(combParam)) { - apiLogService.save("MES涓嬪彂鍏ュ簱閫氱煡鍗�", "/open/asrs/comb/v1", "null", "10.10.10.1", - "", - response, bool); + apiLogService.save("MES涓嬪彂鍏ュ簱閫氱煡鍗�", "/open/asrs/comb/v1", "null", "10.10.10.1", "", response, bool); } else if (Cools.isEmpty(combMat)) { - apiLogService.save("MES涓嬪彂鍏ュ簱閫氱煡鍗�", "/open/asrs/comb/v1", "null", "10.10.10.1", - "鎵樼洏鐮侊細" + combParam.getBarcode(), - response, bool); + apiLogService.save("MES涓嬪彂鍏ュ簱閫氱煡鍗�", "/open/asrs/comb/v1", "null", "10.10.10.1", "鎵樼洏鐮侊細" + combParam.getBarcode(), response, bool); } else { - apiLogService.save("MES涓嬪彂鍏ュ簱閫氱煡鍗�", "/open/asrs/comb/v1", "null", "10.10.10.1", - "鎵樼洏鐮侊細" + combParam.getBarcode() + "銆佺墿鏂欑紪鍙凤細" + combMat.getMatnr() + "銆佹暟閲忥細" + combMat.getAnfme(), - response, bool); + apiLogService.save("MES涓嬪彂鍏ュ簱閫氱煡鍗�", "/open/asrs/comb/v1", "null", "10.10.10.1", "鎵樼洏鐮侊細" + combParam.getBarcode() + "銆佺墿鏂欑紪鍙凤細" + combMat.getMatnr() + "銆佹暟閲忥細" + combMat.getAnfme(), response, bool); } } @@ -870,6 +854,12 @@ throw new CoolException("鍗曟嵁鍙傛暟涓虹┖鎴栬�呭崟鎹鎯呬负绌猴紝鏃犳硶鐢熸垚鍗曟嵁淇℃伅"); } + if ("閾跺骇鐢熶骇閫�鏂欑敵璇峰崟".equalsIgnoreCase(docName)) { + if (Cools.isEmpty(param.getBackOrderNo())){ + throw new CoolException("閫�鏂欏崟鐨勯��鏂欑紪鍙穊ackOrderNo涓嶈兘涓虹┖"); + } + } + Order orderOld = null; if (!Cools.isEmpty(orderService.selectByNo(param.getCPOID()))) { @@ -901,6 +891,11 @@ } Date now = new Date(); Order order = orderMapping(param, now, pakin, docName); + Set<String> set = new HashSet<>(); + for (OrderSyncParam.OrderDetl child : param.getChildren()) { + set.add(child.getCDefine22()); + } + order.setTel(JSON.toJSONString(set)); orderService.insert(order); param.getChildren().forEach(od -> { OrderDetl orderDetl = orderDetlMapping(order, od, now); @@ -999,8 +994,11 @@ order.setDefNumber(param.get鎿嶄綔绯荤粺鍙�()); + order.setCreateBy(9999L); order.setCreateTime(now); + order.setUpdateBy(9999L); order.setUpdateTime(now); + order.setSalesman(param.getBackOrderNo()); order.setUpstreamcode(param.getUpstreamcode()); //璁㈠崟鐘舵�� order.setSettle(1L); @@ -1035,8 +1033,13 @@ od.setAnfme(odParam.getIQuantity()); //閿�鍞鍗曞彿 od.setThreeCode(odParam.getCDefine22()); + od.setDevNo(odParam.getDevNo()); //鑷敱椤� - od.setBatch(Cools.isEmpty(odParam.getBatch()) ? "" : odParam.getBatch() + "__" + (Cools.isEmpty(odParam.getBFree1()) ? "" : odParam.getBFree1())); + if (!Cools.isEmpty(odParam.getBatch()) || !Cools.isEmpty(odParam.getBFree1())) { + od.setBrand((Cools.isEmpty(odParam.getBatch()) ? "" : odParam.getBatch()) + "__" + (Cools.isEmpty(odParam.getBFree1()) ? "" : odParam.getBFree1())); + } + od.setWeight(odParam.getINum()); + od.setVolume(odParam.getIinvexchrate()); //IDs od.setSku(odParam.getId()); @@ -1045,6 +1048,7 @@ od.setSource(order.getDocType().intValue()); od.setStatus(1); od.setQty(0.0D); + od.setReportQty(0.0D); od.setCreateBy(9999L); od.setCreateTime(now); od.setUpdateBy(9999L); @@ -1063,14 +1067,11 @@ public void callApiLogSave(MatInfoParam matParam, String tableName, String response, Boolean bool) { - apiLogService.save("ERP涓嬪彂鍟嗗搧淇℃伅", tableName, "null", "10.10.10.1", - "鐗╂枡缂栫爜锛�" + matParam.getCinvcode() + "銆佺墿鏂欏悕绉帮細" + matParam.getCinvname() + "銆佽鏍硷細" + matParam.getCInvStd() + "銆佸娉細" + matParam.getMemo(), - response, bool); + apiLogService.save("ERP涓嬪彂鍟嗗搧淇℃伅", tableName, "null", "10.10.10.1", "鐗╂枡缂栫爜锛�" + matParam.getCinvcode() + "銆佺墿鏂欏悕绉帮細" + matParam.getCinvname() + "銆佽鏍硷細" + matParam.getCInvStd() + "銆佸娉細" + matParam.getMemo(), response, bool); } public void callApiLogSave(OrderSyncParam param, String tableName, String response, Boolean bool) { - apiLogService.save("ERP璁㈠崟鍚屾", tableName, "null", "10.10.10.1", - param.toString(), response, bool); + apiLogService.save("ERP璁㈠崟鍚屾", tableName, "null", "10.10.10.1", param.toString(), response, bool); } public static void main(String[] args) { -- Gitblit v1.9.1