From 2446d71ec7c273625cb21878a6638934dd79fa53 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 16 七月 2025 09:35:54 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/controller/OutController.java | 84 +++++++++++++++++++++++++++++++++++++----
1 files changed, 75 insertions(+), 9 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/OutController.java b/src/main/java/com/zy/asrs/controller/OutController.java
index 1c88b9f..1a0c62f 100644
--- a/src/main/java/com/zy/asrs/controller/OutController.java
+++ b/src/main/java/com/zy/asrs/controller/OutController.java
@@ -7,6 +7,7 @@
import com.core.common.R;
import com.zy.asrs.entity.*;
import com.zy.asrs.service.*;
+import com.zy.asrs.utils.MatUtils;
import com.zy.common.model.LocDto;
import com.zy.common.model.TaskDto;
import com.zy.common.web.BaseController;
@@ -17,6 +18,7 @@
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
+import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@@ -76,7 +78,8 @@
// 鐩樼偣鍗曞嚭搴�
if (orderPakOut.getDocType() == 8) {
for (OrderDetlPakout orderDetl : orderDetlPakouts) {
- double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D);
+ BigDecimal issuedBigDecimal = Optional.of(BigDecimal.valueOf(orderDetl.getAnfme()).subtract(BigDecimal.valueOf(orderDetl.getWorkQty()))).orElse(new BigDecimal(0));
+ double issued = issuedBigDecimal.doubleValue();
if (issued <= 0.0D) {
continue;
}
@@ -97,12 +100,18 @@
locDto.setBoxType1(orderDetl.getBoxType1());
locDto.setBoxType2(orderDetl.getBoxType2());
locDto.setBoxType3(orderDetl.getBoxType3());
- locDto.setWeight(orderDetl.getWeight());
+
+ //璁$畻杈呭崟浣�
+ Double weight = MatUtils.calcWeight(locDto.getMatnr(), locDto.getAnfme());
+ locDto.setWeight(weight);
+
+ locDto.setUnit(orderDetl.getUnit());
locDto.setStaNos(staNos);
locDtos.add(locDto);
// 鍓╀綑寰呭嚭鏁伴噺閫掑噺
- issued = issued - locDetl.getAnfme();
+ issuedBigDecimal = issuedBigDecimal.subtract(BigDecimal.valueOf(locDetl.getAnfme()));
+ issued = issuedBigDecimal.doubleValue();
} else {
break;
}
@@ -117,14 +126,20 @@
locDto.setBoxType1(orderDetl.getBoxType1());
locDto.setBoxType2(orderDetl.getBoxType2());
locDto.setBoxType3(orderDetl.getBoxType3());
- locDto.setWeight(orderDetl.getWeight());
+
+ //璁$畻杈呭崟浣�
+ Double weight = MatUtils.calcWeight(locDto.getMatnr(), locDto.getAnfme());
+ locDto.setWeight(weight);
+
+ locDto.setUnit(orderDetl.getUnit());
locDto.setLack(Boolean.TRUE);
locDtos.add(locDto);
}
}
} else {
for (OrderDetlPakout orderDetl : orderDetlPakouts) {
- double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D);
+ BigDecimal issuedBigDecimal = Optional.of(BigDecimal.valueOf(orderDetl.getAnfme()).subtract(BigDecimal.valueOf(orderDetl.getWorkQty()))).orElse(new BigDecimal(0));
+ double issued = issuedBigDecimal.doubleValue();
if (issued <= 0.0D) {
continue;
}
@@ -137,7 +152,8 @@
LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo()));
locDto.setFrozen(locDetl.getFrozen());
locDto.setFrozenLoc(locMast.getFrozen());
- List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103);
+ int ioType = (issued >= locDetl.getAnfme() && locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("loc_no", locDto.getLocNo())) == 1) ? 101 : 103;
+ List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), ioType);
locDto.setStaNos(staNos);
locDto.setBrand(orderDetl.getBrand());
@@ -147,11 +163,17 @@
locDto.setBoxType1(orderDetl.getBoxType1());
locDto.setBoxType2(orderDetl.getBoxType2());
locDto.setBoxType3(orderDetl.getBoxType3());
- locDto.setWeight(orderDetl.getWeight());
+ locDto.setUnit(orderDetl.getUnit());
+
+ //璁$畻杈呭崟浣�
+ Double weight = MatUtils.calcWeight(locDto.getMatnr(), locDto.getAnfme());
+ locDto.setWeight(weight);
+
locDtos.add(locDto);
exist.add(locDetl.getLocNo());
// 鍓╀綑寰呭嚭鏁伴噺閫掑噺
- issued = issued - locDetl.getAnfme();
+ issuedBigDecimal = issuedBigDecimal.subtract(BigDecimal.valueOf(locDetl.getAnfme()));
+ issued = issuedBigDecimal.doubleValue();
} else {
break;
}
@@ -165,12 +187,56 @@
locDto.setBoxType1(orderDetl.getBoxType1());
locDto.setBoxType2(orderDetl.getBoxType2());
locDto.setBoxType3(orderDetl.getBoxType3());
- locDto.setWeight(orderDetl.getWeight());
+
+ //璁$畻杈呭崟浣�
+ Double weight = MatUtils.calcWeight(locDto.getMatnr(), locDto.getAnfme());
+ locDto.setWeight(weight);
+
+ locDto.setUnit(orderDetl.getUnit());
locDto.setLack(Boolean.TRUE);
locDtos.add(locDto);
}
}
+
+ // 閲嶆柊璁$畻鍑哄簱绔欑偣锛屽彲鑳藉瓨鍦ㄤ竴涓墭鐩樺鏉℃槑缁嗭紝澶氭潯鏄庣粏缁熻涓嬫潵鍙叏鏉垮嚭搴擄紝浣嗗疄闄呯粰鍑虹殑绔欑偣鍙兘鎷i�夊嚭搴�
+ HashMap<String, Double> locAnfmeMap = new HashMap<>();
+ for (LocDto locDto : locDtos) {
+ if(locAnfmeMap.containsKey(locDto.getLocNo())) {
+ Double anfme = locAnfmeMap.get(locDto.getLocNo());
+ BigDecimal decimal = BigDecimal.valueOf(locDto.getAnfme()).add(BigDecimal.valueOf(anfme));
+ locAnfmeMap.put(locDto.getLocNo(), decimal.doubleValue());
+ }else {
+ locAnfmeMap.put(locDto.getLocNo(), locDto.getAnfme());
+ }
+ }
+
+ HashMap<String, List<Integer>> locStaNosMap = new HashMap<>();
+ for (Map.Entry<String, Double> entry : locAnfmeMap.entrySet()) {
+ String locNo = entry.getKey();
+ Double realAnfme = entry.getValue();
+
+ double stockAnfme = 0D;
+ List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", locNo));
+ for (LocDetl locDetl : locDetls) {
+ BigDecimal decimal = BigDecimal.valueOf(stockAnfme).add(BigDecimal.valueOf(locDetl.getAnfme()));
+ stockAnfme = decimal.doubleValue();
+ }
+
+ int ioType = 103;
+ if(stockAnfme == realAnfme) {
+ ioType = 101;
+ }
+
+ List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locNo, ioType);
+ locStaNosMap.put(locNo, staNos);
+ }
+
+ for (LocDto locDto : locDtos) {
+ List<Integer> staNos = locStaNosMap.get(locDto.getLocNo());
+ locDto.setStaNos(staNos);
+ }
}
+
return R.ok().add(locDtos);
}
--
Gitblit v1.9.1