From 7331f7ad8a9f4511fc740238dbafc4e4d53b9730 Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期二, 31 十二月 2024 16:24:12 +0800
Subject: [PATCH] 盘点单
---
src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java | 15 +++++++
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java | 9 +++-
src/main/java/com/zy/asrs/controller/OutController.java | 87 ++++++++++++++++++++++++++++++++-----------
3 files changed, 87 insertions(+), 24 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/OutController.java b/src/main/java/com/zy/asrs/controller/OutController.java
index 752e5b6..fb01a95 100644
--- a/src/main/java/com/zy/asrs/controller/OutController.java
+++ b/src/main/java/com/zy/asrs/controller/OutController.java
@@ -7,7 +7,6 @@
import com.core.common.R;
import com.zy.asrs.entity.*;
import com.zy.asrs.service.*;
-import com.zy.asrs.utils.OrderInAndOutUtil;
import com.zy.common.model.LocDto;
import com.zy.common.model.TaskDto;
import com.zy.common.web.BaseController;
@@ -17,6 +16,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
+import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@@ -44,6 +44,9 @@
@Autowired
private BasDevpService basDevpService;
+ @Resource
+ private OrderPakoutService orderPakOutService;
+
@PostMapping("/out/pakout/orderDetlIds/auth")
@ManagerAuth
@@ -60,35 +63,75 @@
}
List<OrderDetlPakout> orderDetlPakouts = orderDetlPakoutService.selectBatchIds(ids);
+ if (orderDetlPakouts.size() == 0) {
+ return R.parse("璁㈠崟鏄庣粏涓虹┖");
+ }
+
List<LocDto> locDtos = new ArrayList<>();
Set<String> exist = new HashSet<>();
- for (OrderDetlPakout orderDetl : orderDetlPakouts) {
- double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D);
- if (issued <= 0.0D) { continue; }
- List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist);
- for (LocDetl locDetl : locDetls) {
+ // 鑾峰彇璁㈠崟涓昏〃
+ OrderPakout orderPakOut = orderPakOutService.selectByNo(orderDetlPakouts.get(0).getOrderNo());
+ // 鐩樼偣鍗曞嚭搴�
+ if (orderPakOut.getDocType() == 8) {
+ for (OrderDetlPakout orderDetl : orderDetlPakouts) {
+ double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D);
+ if (issued <= 0.0D) {
+ continue;
+ }
+ List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist);
+ for (LocDetl locDetl : locDetls) {
+ if (issued > 0) {
+ LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(),
+ issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued);
+ 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(), 107);
+ locDto.setStaNos(staNos);
+ locDtos.add(locDto);
+ // 鍓╀綑寰呭嚭鏁伴噺閫掑噺
+ issued = issued - locDetl.getAnfme();
+ } else {
+ break;
+ }
+ }
if (issued > 0) {
- LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(),
- issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued);
- 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);
- locDto.setStaNos(staNos);
+ LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued);
+ locDto.setLack(Boolean.TRUE);
locDtos.add(locDto);
- exist.add(locDetl.getLocNo());
- // 鍓╀綑寰呭嚭鏁伴噺閫掑噺
- issued = issued - locDetl.getAnfme();
- } else {
- break;
}
}
- if (issued > 0) {
- LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued);
- locDto.setLack(Boolean.TRUE);
- locDtos.add(locDto);
+ } else {
+ for (OrderDetlPakout orderDetl : orderDetlPakouts) {
+ double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D);
+ if (issued <= 0.0D) {
+ continue;
+ }
+ List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist);
+ for (LocDetl locDetl : locDetls) {
+ if (issued > 0) {
+ LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(),
+ issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued);
+ 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);
+ locDto.setStaNos(staNos);
+ locDtos.add(locDto);
+ exist.add(locDetl.getLocNo());
+ // 鍓╀綑寰呭嚭鏁伴噺閫掑噺
+ issued = issued - locDetl.getAnfme();
+ } else {
+ break;
+ }
+ }
+ if (issued > 0) {
+ LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued);
+ locDto.setLack(Boolean.TRUE);
+ locDtos.add(locDto);
+ }
}
}
return R.ok().add(locDtos);
diff --git a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
index 1e71210..64d70f8 100644
--- a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -91,6 +91,9 @@
@Resource
private LocMastMapper locMastMapper;
+ @Resource
+ private OrderPakoutService orderPakOutService;
+
@Override
@Transactional
public String startupFullPutStore(FullStoreParam param, Long userId) {
@@ -396,8 +399,10 @@
}
// 鑾峰彇搴撲綅
LocMast locMast = locMastService.selectById(taskDto.getLocNo());
- // 鑾峰彇璺緞
- int ioType = taskDto.isAll() ? 101 : 103;
+ // 鍒ゆ柇鏄惁鏄洏鐐瑰崟
+ String orderNo = taskDto.getLocDtos().get(0).getOrderNo();
+ OrderPakout orderPakout = orderPakOutService.selectByNo(orderNo);
+ int ioType = orderPakout.getDocType() == 8 ? 107 : (taskDto.isAll() ? 101 : 103);
StaDesc staDesc = staDescService.queryCrnStnAuto(ioType, locMast.getCrnNo(), staNo.getDevNo());
// 鐢熸垚宸ヤ綔鍙�
int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(ioType));
diff --git a/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java b/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
index 2616ec9..2326428 100644
--- a/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
+++ b/src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
@@ -333,6 +333,21 @@
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return FAIL.setMsg("鐩樼偣鍏ュ簱 ===>> 宸ヤ綔鏄庣粏妗d负绌�; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]");
}
+ for (WrkDetl wrkDetl : wrkDetls57) {
+ if (!Cools.isEmpty(wrkDetl.getOrderNo())) {
+ // 鏇存柊璁㈠崟瀹屾垚鏁伴噺
+ OrderDetlPakout orderDetlPakout = orderDetlPakoutService.selectItem(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getBrand(), wrkDetl.getStandby1(), wrkDetl.getStandby2(), wrkDetl.getStandby3(),
+ wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3());
+ if (!Cools.isEmpty(orderDetlPakout)) {
+ if (!orderDetlPakoutService.increaseQtyByOrderNo(wrkDetl.getOrderNo(), wrkDetl.getMatnr(),
+ orderDetlPakout.getBatch(), wrkDetl.getBrand(), wrkDetl.getStandby1(), wrkDetl.getStandby2(), wrkDetl.getStandby3(),
+ wrkDetl.getBoxType1(), wrkDetl.getBoxType2(), wrkDetl.getBoxType3(), wrkDetl.getAnfme())) {
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ return FAIL.setMsg("鐩樼偣鍏ュ簱 ===>> 鏇存柊璁㈠崟瀹屾垚鏁伴噺澶辫触; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getSourceLocNo() + "]");
+ }
+ }
+ }
+ }
// 淇敼搴撲綅鐘舵�� Q ====>> F
if (locMast.getLocSts().equals("Q")) {
locMast.setLocSts(wrkMast.getFullPlt().equals("Y")?"F":"D");
--
Gitblit v1.9.1