From 35ce7aaef10e30006bcef381d19302c0928c1194 Mon Sep 17 00:00:00 2001
From: 18516761980 <4761516tqsxp>
Date: 星期二, 14 九月 2021 08:24:00 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/ints/controller/WaitMatchkController.java | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 105 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/zy/ints/controller/WaitMatchkController.java b/src/main/java/com/zy/ints/controller/WaitMatchkController.java
index bd56002..81e14b2 100644
--- a/src/main/java/com/zy/ints/controller/WaitMatchkController.java
+++ b/src/main/java/com/zy/ints/controller/WaitMatchkController.java
@@ -10,22 +10,36 @@
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.LocDetl;
+import com.zy.asrs.entity.LocMast;
+import com.zy.asrs.entity.MatCode;
+import com.zy.asrs.service.LocDetlService;
+import com.zy.asrs.service.LocMastService;
+import com.zy.asrs.service.MatCodeService;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.WaitMatchk;
+import com.zy.ints.service.WaitMatchkLogService;
import com.zy.ints.service.WaitMatchkService;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
@RestController
public class WaitMatchkController extends BaseController {
@Autowired
private WaitMatchkService waitMatchkService;
+ @Autowired
+ private WaitMatchkLogService waitMatchkLogService;
+ @Autowired
+ private LocMastService locMastService;
+ @Autowired
+ private LocDetlService locDetlService;
+ @Autowired
+ private MatCodeService matCodeService;
//鐩樼偣閫氱煡妗�
@@ -81,15 +95,101 @@
return R.ok();
}
+ /**
+ * 鍒犻櫎鐩樼偣閫氱煡妗o紝鍒犻櫎鍓嶈浆鍘嗗彶妗�
+ * @param param
+ * @return
+ */
@RequestMapping(value = "/waitMatchk/delete/auth")
@ManagerAuth
+ @Transactional
public R delete(@RequestParam String param){
List<WaitMatchk> list = JSONArray.parseArray(param, WaitMatchk.class);
if (Cools.isEmpty(list)){
return R.error();
}
for (WaitMatchk entity : list){
- waitMatchkService.delete(new EntityWrapper<>(entity));
+ boolean res = waitMatchkLogService.save(entity.getBillNo(),entity.getLocNo(),entity.getMatNo());
+ if(!res){
+ throw new CoolException("杞巻鍙叉。鍑洪敊[locNo:"+entity.getLocNo()+"],[matNo:"+entity.getMatNo()+"]");
+ }else {
+ waitMatchkService.delete(new EntityWrapper<>(entity));
+ }
+ }
+ return R.ok();
+ }
+
+ /**
+ * 瀹℃牳鐩樼偣鍗曟嵁
+ * @param param
+ * @return
+ */
+ @RequestMapping(value = "/waitMatchk/verify/auth")
+ @ManagerAuth
+ @Transactional
+ public R verify(@RequestParam String param){
+ List<WaitMatchk> list = JSONArray.parseArray(param, WaitMatchk.class);
+ if (Cools.isEmpty(list)){
+ return R.error();
+ }
+ Date now = new Date();
+ for (WaitMatchk entity : list){
+ LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",entity.getLocNo()));
+ if(null != locMast && locMast.getLocSts().equals("F")){
+ Wrapper<LocDetl> wrapperDetl = new EntityWrapper<LocDetl>().eq("loc_no",entity.getLocNo()).eq("mat_no",entity.getMatNo());
+ LocDetl locDetl = locDetlService.selectOne(wrapperDetl);
+ if(null != locDetl) {//鏇存柊鏁伴噺锛屽垹闄ゆ槑缁�
+ if(entity.getCheckQty().equals(0)){
+ if(!locDetlService.delete(wrapperDetl)){
+ throw new CoolException("鍒犻櫎鏁伴噺涓�0鏄庣粏鍑洪敊[locNo:"+locDetl.getLocNo()+"],[matNo:"+locDetl.getMatNo()+"]");
+ }
+ }else{
+ if(!entity.getCheckQty().equals(locDetl.getQty())){ //搴撳瓨鏁伴噺涓庣洏鐐规暟閲忕浉鍚屼笉鐢ㄦ洿鏂�
+ locDetl.setQty(entity.getCheckQty());
+ if(!locDetlService.update(locDetl,wrapperDetl)){
+ throw new CoolException("鏇存柊搴撳瓨鏄庣粏鍑洪敊[locNo:"+locDetl.getLocNo()+"],[matNo:"+locDetl.getMatNo()+"]");
+ }
+ }
+
+ }
+ } else {//鎻掑叆鏄庣粏
+ LocDetl one = new LocDetl();
+ one.setLocNo(entity.getLocNo());
+ one.setMatNo(entity.getMatNo());
+ one.setQty(entity.getCheckQty());
+ one.setModiUser(getUserId());
+ one.setModiTime(now);
+ one.setAppeUser(getUserId());
+ one.setAppeTime(now);
+
+ WaitMatchk waitMatchk = waitMatchkService.selectOne(new EntityWrapper<WaitMatchk>().eq("loc_no",entity.getLocNo()));
+ if(null != waitMatchk){
+ one.setZpallet(waitMatchk.getZpallet());
+ }
+ MatCode matCode = matCodeService.selectOne(new EntityWrapper<MatCode>().eq("mat_no",entity.getMatNo()));
+ if(null != matCode) {
+ one.setMatName(matCode.getMatName());
+ one.setUnit(matCode.getUnit());
+ one.setSpecs(matCode.getSpecs());
+ one.setSize(matCode.getSize());
+ one.setColor(matCode.getColor());
+ } else {
+ throw new CoolException("鏂板鏄庣粏鐗╂枡缂栫爜涓嶅瓨鍦ㄥ嚭閿橻matNo:"+entity.getMatNo()+"]");
+ }
+
+ if(!locDetlService.insert(one)){
+ throw new CoolException("鎻掑叆搴撳瓨鏄庣粏鍑洪敊[locNo:"+entity.getLocNo()+"],[matNo:"+entity.getMatNo()+"]");
+ }
+ }
+
+ entity.setVerifyStatus(1);
+ entity.setVerifyUser(getUserId());
+ entity.setModiTime(now);
+ Wrapper<WaitMatchk> wrapper = new EntityWrapper<WaitMatchk>().eq("loc_no",entity.getLocNo()).eq("mat_no",entity.getMatNo());
+ waitMatchkService.update(entity,wrapper);
+ } else {
+ throw new CoolException("搴撲綅闈炲湪搴撶姸鎬�:" + locMast.getLocNo());
+ }
}
return R.ok();
}
--
Gitblit v1.9.1