From 076f4b8c177731339adf2ab30b22655b8bd6dd13 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期五, 02 八月 2024 10:58:50 +0800
Subject: [PATCH] #
---
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/WaitPakinController.java | 64 ++-----------------------------
1 files changed, 5 insertions(+), 59 deletions(-)
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/WaitPakinController.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/WaitPakinController.java
index f8d976b..d7f845a 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/WaitPakinController.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/WaitPakinController.java
@@ -5,9 +5,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.R;
-import com.zy.asrs.framework.exception.CoolException;
import com.zy.asrs.wms.asrs.entity.*;
-import com.zy.asrs.wms.asrs.entity.enums.OrderSettleType;
import com.zy.asrs.wms.asrs.service.*;
import com.zy.asrs.wms.common.annotation.OperationLog;
import com.zy.asrs.wms.common.domain.BaseParam;
@@ -29,14 +27,6 @@
@Autowired
private WaitPakinService waitPakinService;
- @Autowired
- private OrderService orderService;
- @Autowired
- private OrderDetlService orderDetlService;
- @Autowired
- private LocService locService;
- @Autowired
- private TaskService taskService;
@PreAuthorize("hasAuthority('asrs:waitPakin:list')")
@PostMapping("/waitPakin/page")
@@ -67,56 +57,12 @@
@PreAuthorize("hasAuthority('asrs:waitPakin:save')")
@OperationLog("娣诲姞缁勬墭閫氱煡妗�")
@PostMapping("/waitPakin/save")
- @Transactional
public R save(@RequestBody WaitPakin waitPakin) {
- if (waitPakin.getAnfme() <= 0) {
- return R.error("缁勬墭鏁伴噺閿欒");
- }
-
- List<Loc> locList = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, waitPakin.getBarcode()));
- if (!locList.isEmpty()) {
- return R.error("鎵樼洏宸插湪搴�");
- }
-
- List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, waitPakin.getBarcode()));
- if (!taskList.isEmpty()) {
- return R.error("鎵樼洏姝e湪鍏ュ簱涓�");
- }
-
- //鏌ヨ鏄惁瀛樺湪鐩稿悓鏄庣粏鍜屾墭鐩樼爜鐨勭粍鎵橀�氱煡妗�
- WaitPakin waitPakin1 = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, waitPakin.getBarcode()).eq(WaitPakin::getDetlId, waitPakin.getDetlId()));
- if (waitPakin1 == null) {
- //涓嶅瓨鍦ㄧ粍鎵橀�氱煡妗o紝鍒涘缓
- if (!waitPakinService.save(waitPakin)) {
- return R.error("娣诲姞澶辫触");
- }
- }else {
- //瀛樺湪缁勬墭閫氱煡妗o紝鏇存柊
- waitPakin1.setAnfme(waitPakin1.getAnfme() + waitPakin.getAnfme());
- waitPakin1.setUpdateTime(new Date());
- if (!waitPakinService.updateById(waitPakin1)) {
- return R.error("娣诲姞澶辫触");
- }
- }
-
- OrderDetl orderDetl = orderDetlService.getById(waitPakin.getDetlId());
- if (orderDetl == null) {
- throw new CoolException("璁㈠崟鏄庣粏涓嶅瓨鍦�");
- }
-
- //鑾峰彇璁㈠崟
- Order order = orderService.getById(orderDetl.getOrderId());
- if(order == null){
- throw new CoolException("璁㈠崟涓嶅瓨鍦�");
- }
-
- //鏇存柊璁㈠崟鐘舵��
- if (order.getOrderSettle().equals(OrderSettleType.INIT.val())) {
- order.setOrderSettle(OrderSettleType.WAIT.val());
- order.setUpdateTime(new Date());
- if (!orderService.updateById(order)) {
- throw new CoolException("璁㈠崟鏁版嵁鏇存柊澶辫触");
- }
+ try {
+ waitPakinService.comb(waitPakin);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return R.error(e.getMessage());
}
return R.ok("娣诲姞鎴愬姛");
}
--
Gitblit v1.9.1