From ab14726215678ac69adfeafbd845ebc5b0776ea2 Mon Sep 17 00:00:00 2001
From: zhangc <zc@123>
Date: 星期二, 14 一月 2025 14:56:41 +0800
Subject: [PATCH] 优化订单同步逻辑及库位查找
---
src/main/java/com/zy/asrs/controller/AgvWaitPakinController.java | 42 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/AgvWaitPakinController.java b/src/main/java/com/zy/asrs/controller/AgvWaitPakinController.java
index 7a29307..787de8b 100644
--- a/src/main/java/com/zy/asrs/controller/AgvWaitPakinController.java
+++ b/src/main/java/com/zy/asrs/controller/AgvWaitPakinController.java
@@ -1,5 +1,6 @@
package com.zy.asrs.controller;
+import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
@@ -10,13 +11,17 @@
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
+import com.core.exception.CoolException;
import com.zy.asrs.entity.AgvBasDevp;
import com.zy.asrs.entity.AgvWaitPakin;
+import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.entity.WaitPakin;
import com.zy.asrs.service.AgvBasDevpService;
import com.zy.asrs.service.AgvWaitPakinService;
+import com.zy.asrs.service.OrderDetlService;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
@@ -32,6 +37,8 @@
private AgvWaitPakinService agvWaitPakinService;
@Autowired
private AgvBasDevpService agvBasDevpService;
+ @Autowired
+ private OrderDetlService orderDetlService;
@RequestMapping(value = "/waitPakin/{id}/auth")
@ManagerAuth
@@ -88,6 +95,7 @@
@RequestMapping(value = "/waitPakin/delete/auth")
@ManagerAuth
+ @Transactional
public R delete(@RequestParam String param){
List<AgvWaitPakin> list = JSONArray.parseArray(param, AgvWaitPakin.class);
if (Cools.isEmpty(list)){
@@ -95,10 +103,36 @@
}
for (AgvWaitPakin entity : list){
AgvBasDevp agvBasDevp = agvBasDevpService.selectOne(new EntityWrapper<AgvBasDevp>().eq("barcode", entity.getSuppCode()));
- if(Cools.isEmpty(agvBasDevp)){
- agvWaitPakinService.delete(new EntityWrapper<>(entity));
- }else {
- return R.error("鏂欑鐮佷负" + entity.getSuppCode() + "宸茬粦瀹氱珯鐐癸紝璇峰厛浠嶢GV绔欑偣绠$悊瑙g粦璇ユ枡绠�");
+
+ if(!Cools.isEmpty(agvBasDevp)){
+ if(!Cools.eq("F",agvBasDevp.getLocSts())){
+ throw new CoolException("璇ュ叆搴撻�氱煡妗e凡缁忓湪浣滀笟涓紝鏃犳硶鍒犻櫎");
+ }
+ //瑙g粦绔欑偣
+ agvBasDevp.setLocSts("O");
+ agvBasDevp.setBarcode("");
+ agvBasDevp.setLocType2(null);
+ agvBasDevpService.update(agvBasDevp,new EntityWrapper<AgvBasDevp>().eq("dev_no",agvBasDevp.getDevNo()));
+ }
+ agvWaitPakinService.delete(new EntityWrapper<>(entity));
+
+ //璁㈠崟鍥炴粴
+ if(!Cools.isEmpty(entity.getOrderNo())){
+ String orderNo = entity.getOrderNo();
+ if(orderNo.contains("{")){
+ JSONArray orderArray = JSON.parseArray(orderNo);
+ for (Object o : orderArray){
+ JSONObject jsonobject = (JSONObject) o;
+ OrderDetl orderDetl = orderDetlService.selectByOrderNoAndMatnr(jsonobject.get("orderNo").toString(),entity.getMatnr(),entity.getThreeCode(),entity.getDeadTime());
+ orderDetl.setQty(orderDetl.getQty() - entity.getAnfme());
+ orderDetlService.updateById(orderDetl);
+ }
+
+ }else {
+ OrderDetl orderDetl = orderDetlService.selectByOrderNoAndMatnr(entity.getOrderNo(),entity.getMatnr(),entity.getThreeCode(),entity.getDeadTime());
+ orderDetl.setQty(orderDetl.getQty() - entity.getAnfme());
+ orderDetlService.updateById(orderDetl);
+ }
}
}
--
Gitblit v1.9.1