From 5e38c75bc9c609d5e41bf817756ef8ed7a0f4851 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期四, 21 八月 2025 15:28:27 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/asrs/utils/OutLocBoxExcelListener.java | 108 +++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 94 insertions(+), 14 deletions(-)
diff --git a/src/main/java/com/zy/asrs/utils/OutLocBoxExcelListener.java b/src/main/java/com/zy/asrs/utils/OutLocBoxExcelListener.java
index 19c0db8..0e81ddc 100644
--- a/src/main/java/com/zy/asrs/utils/OutLocBoxExcelListener.java
+++ b/src/main/java/com/zy/asrs/utils/OutLocBoxExcelListener.java
@@ -2,6 +2,7 @@
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
+import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.BaseRes;
import com.core.common.Cools;
@@ -15,6 +16,9 @@
import com.zy.asrs.service.*;
import com.zy.common.entity.OutLocBoxExcel;
import com.zy.common.model.LocDto;
+import com.zy.common.properties.SlaveProperties;
+import com.zy.system.entity.OperateLog;
+import com.zy.system.service.OperateLogService;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
@@ -29,14 +33,24 @@
public class OutLocBoxExcelListener extends AnalysisEventListener<OutLocBoxExcel> {
private int total = 0;
+ private String errorMsgOrderLoc = "";
private String orderOneNo = null;
+ private String cstmrName = null;
private Long userId;
+ private String remoteAddr;
+ private boolean sign = true;
+
List<String[]> OutLocBoxCs = new ArrayList<>();
public OutLocBoxExcelListener() {
}
public OutLocBoxExcelListener(Long userId) {
+ this.userId = userId;
+ }
+
+ public OutLocBoxExcelListener(String remoteAddr,Long userId) {
+ this.remoteAddr = remoteAddr;
this.userId = userId;
}
@@ -61,6 +75,8 @@
public void invoke(OutLocBoxExcel excel, AnalysisContext ctx) {
String batch = excel.getBatch();
String orderNo = excel.getOrderNo();
+// String cstmrName = excel.getCstmrName();
+ String memo = excel.getMemo();
if (Cools.isEmpty(orderOneNo)){
if (!Cools.isEmpty(excel.getOrderNo())){
orderOneNo = excel.getOrderNo();
@@ -68,9 +84,18 @@
throw new CoolException("璁㈠崟鍙峰弬鏁颁负绌�");
}
}
- String[] s=new String[2];
+ if (Cools.isEmpty(cstmrName)){
+ if (!Cools.isEmpty(excel.getCstmrName())){
+ cstmrName = excel.getCstmrName();
+ } else {
+ throw new CoolException("瀹㈡埛鍚嶇О鍙傛暟涓虹┖");
+ }
+ }
+ String[] s=new String[4];
s[0] = batch;
s[1] = orderOneNo;
+ s[2] = cstmrName;
+ s[3] = memo;
OutLocBoxCs.add(s);
total++;
}
@@ -84,6 +109,7 @@
if (!Cools.isEmpty(OutLocBoxCs) && OutLocBoxCs.size() != 0) {
LocDetlService locDetlService = SpringUtils.getBean(LocDetlService.class);
LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
+ SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class);
WorkService workService = SpringUtils.getBean(WorkService.class);
List<LocDto> locDtos = new ArrayList<>();
List<String[]> outLocBoxCList = new ArrayList<>();
@@ -93,24 +119,49 @@
if (!outLocBoxCNew.contains(outLocBoxC[0])){
LocDetl locDetlSou = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("batch", outLocBoxC[0]));
if (Cools.isEmpty(locDetlSou)){
- throw new CoolException("绠卞彿锛�"+outLocBoxC[0]+" 鏈煡璇㈠埌鏁版嵁锛侊紒锛�");
+ sign = false;
+ errorMsgOrderLoc = errorMsgOrderLoc + "[===銆�" +"绠卞彿锛�"+outLocBoxC[0]+" 鏈煡璇㈠埌鏁版嵁锛侊紒锛併��===]";
+ continue;
+// throw new CoolException("绠卞彿锛�"+outLocBoxC[0]+" 鏈煡璇㈠埌鏁版嵁锛侊紒锛�");
}
LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlSou.getLocNo()));
if (Cools.isEmpty(locMast)){
- throw new CoolException("绠卞彿锛�"+outLocBoxC[0]+" 鎵�鍦ㄥ簱浣嶄笉婊¤冻鍑哄簱鏉′欢锛侊紒锛佹湭鏌ヨ鍒版绠卞彿鎵�鍦ㄥ簱浣�");
+ sign = false;
+ errorMsgOrderLoc = errorMsgOrderLoc + "[===銆�" +"绠卞彿锛�"+outLocBoxC[0]+" 鎵�鍦ㄥ簱浣嶄笉婊¤冻鍑哄簱鏉′欢锛侊紒锛佹湭鏌ヨ鍒版绠卞彿鎵�鍦ㄥ簱浣�"+"銆�===]";
+ continue;
+// throw new CoolException("绠卞彿锛�"+outLocBoxC[0]+" 鎵�鍦ㄥ簱浣嶄笉婊¤冻鍑哄簱鏉′欢锛侊紒锛佹湭鏌ヨ鍒版绠卞彿鎵�鍦ㄥ簱浣�");
}
if (!locMast.getLocSts().equals("F")){
- throw new CoolException("绠卞彿锛�"+outLocBoxC[0]+" 鎵�鍦ㄥ簱浣嶄笉婊¤冻鍑哄簱鏉′欢锛侊紒锛佸簱浣嶇姸鎬佷笉涓篎锛侊紒锛佸簱浣嶇姸鎬侊細"+locMast.getLocSts$());
+ sign = false;
+ errorMsgOrderLoc = errorMsgOrderLoc + "[===銆�" +"绠卞彿锛�"+outLocBoxC[0]+" 鎵�鍦ㄥ簱浣嶄笉婊¤冻鍑哄簱鏉′欢锛侊紒锛佸簱浣嶇姸鎬佷笉涓篎锛侊紒锛佸簱浣嶇姸鎬侊細"+locMast.getLocSts$()+"銆�===]";
+ continue;
+// throw new CoolException("绠卞彿锛�"+outLocBoxC[0]+" 鎵�鍦ㄥ簱浣嶄笉婊¤冻鍑哄簱鏉′欢锛侊紒锛佸簱浣嶇姸鎬佷笉涓篎锛侊紒锛佸簱浣嶇姸鎬侊細"+locMast.getLocSts$());
}
- List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
- .eq("loc_no", locDetlSou.getLocNo()).eq("origin", locDetlSou.getOrigin()));
- for (LocDetl locDetl:locDetls){
- total++;
- String[] locDetlNow=new String[2];
- locDetlNow[0] = locDetl.getBatch();
- locDetlNow[1] = outLocBoxC[1];
- outLocBoxCList.add(locDetlNow);
- outLocBoxCNew.add(outLocBoxC[0]);
+
+ // 鐩爣搴撲綅 ===>> 娴呭簱浣�
+ if (Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) {
+ String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast.getLocNo());
+ LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", shallowLoc));
+ if (!Cools.isEmpty(locMast2)) {
+ if (locMast2.getLocSts().equals("P") || locMast2.getLocSts().equals("R")){
+ errorMsgOrderLoc = errorMsgOrderLoc + "[===銆�" +"绠卞彿锛�"+outLocBoxC[0]+" 鎵�鍦ㄥ簱浣嶆弧瓒冲嚭搴撴潯浠讹紒锛侊紒浣嗘槸娣卞簱浣嶅湪鍑哄簱涓紒锛侊紒鍥犳浼氬す鏉傚湪鍓嶈竟璁㈠崟鎵ц锛侊紒锛�"+"銆�===]";
+ }
+ }
+ }
+
+ if (sign){
+ List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
+ .eq("loc_no", locDetlSou.getLocNo()).eq("origin", locDetlSou.getOrigin()));
+ for (LocDetl locDetl:locDetls){
+ total++;
+ String[] locDetlNow=new String[4];
+ locDetlNow[0] = locDetl.getBatch();
+ locDetlNow[1] = outLocBoxC[1];
+ locDetlNow[2] = outLocBoxC[2];
+ locDetlNow[3] = outLocBoxC[3];
+ outLocBoxCList.add(locDetlNow);
+ outLocBoxCNew.add(outLocBoxC[0]);
+ }
}
}
}
@@ -124,6 +175,7 @@
// locDetl.getBatch(),locDetl.getBrand(),locDetl.getBarcode(), outLocBoxC[1],locDetl.getAnfme());
// locDto.setOrigin(locDetl.getOrigin());
// locDto.setWeight(locDetl.getWeight());
+ locDetl.setMemo(outLocBoxC[3]);
LocDto locDto = new LocDto(locDetl);
locDtos.add(locDto);
}
@@ -150,15 +202,35 @@
locDetl.setZpallet(locDto.getZpallet());
locDetl.setOrigin(locDto.getOrigin());
locDetl.setWeight(locDto.getWeight());
+ locDetl.setMemo(locDto.getMemo());
locDetls.add(locDetl);
}
param.setLocDetls(locDetls);
param.setOrderNo(orderOneNo);
+ param.setCstmrName(cstmrName);
- if (total>0){
+ if (sign && total>0){
workService.startupFullTakeStoreOrder(param,9999L);
}
+
+ try {
+ OperateLogService operateLogService = SpringUtils.getBean(OperateLogService.class);
+ // 璁板綍鎿嶄綔鏃ュ織
+ OperateLog operateLog = new OperateLog();
+ operateLog.setAction("瀵煎叆璁㈠崟鎵归噺鍑哄簱");
+ operateLog.setIp(remoteAddr);
+ operateLog.setUserId(userId);
+ operateLog.setRequest("鍗曞彿锛�"+orderOneNo+"銆佸鎴峰悕锛�"+cstmrName);
+ operateLog.setResponse(errorMsgOrderLoc.equals("")? "姝e父" : (sign && total>0)? "鎴愬姛:"+errorMsgOrderLoc : "澶辫触:"+errorMsgOrderLoc);
+ operateLogService.insert(operateLog);
+ } catch (Exception e){
+ log.error("璁板綍鎿嶄綔鏃ュ織澶辫触锛�"+e.getMessage());
+ }
+
+// if (!sign || total<1){
+// throw new CoolException("澶辫触锛�"+errorMsgOrderLoc);
+// }
}
@@ -168,4 +240,12 @@
public int getTotal() {
return total;
}
+
+ public boolean getSign() {
+ return sign;
+ }
+
+ public String getErrorMsgOrderLoc() {
+ return errorMsgOrderLoc;
+ }
}
--
Gitblit v1.9.1