From bb1975d8505229818207225b71d72683616c183b Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期三, 19 十一月 2025 12:54:46 +0800
Subject: [PATCH] 根据客户需求清单修改程序
---
src/main/java/com/zy/asrs/controller/MatController.java | 109 +++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 94 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/MatController.java b/src/main/java/com/zy/asrs/controller/MatController.java
index 8616858..bd16c36 100644
--- a/src/main/java/com/zy/asrs/controller/MatController.java
+++ b/src/main/java/com/zy/asrs/controller/MatController.java
@@ -10,11 +10,10 @@
import com.core.annotations.ManagerAuth;
import com.core.common.*;
import com.core.exception.CoolException;
-import com.zy.asrs.entity.Mat;
-import com.zy.asrs.entity.MatPrint;
-import com.zy.asrs.entity.OrderDetl;
+import com.zy.asrs.entity.*;
+import com.zy.asrs.entity.param.EmptyPlateOutParam;
import com.zy.asrs.entity.result.KeyValueVo;
-import com.zy.asrs.service.MatService;
+import com.zy.asrs.service.*;
import com.zy.asrs.utils.MatExcelListener;
import com.zy.common.CodeRes;
import com.zy.common.config.AdminInterceptor;
@@ -41,6 +40,16 @@
private MatService matService;
@Autowired
private SnowflakeIdWorker snowflakeIdWorker;
+ @Autowired
+ private InOutService inOutService;
+ @Autowired
+ private MatBarcodeService matBarcodeService;
+ @Autowired
+ private WaitPakinService waitPakinService;
+ @Autowired
+ private LocDetlService locDetlService;
+ @Autowired
+ private WrkDetlService wrkDetlService;
@RequestMapping(value = "/mat/auto/matnr/auth")
public R autoMatnr(){
@@ -62,7 +71,8 @@
public R pdaSearch(@RequestParam(required = false)String condition){
EntityWrapper<Mat> wrapper = new EntityWrapper<>();
if (!Cools.isEmpty(condition)) {
- wrapper.like("matnr", condition).or().like("maktx", condition);
+// wrapper.like("matnr", condition).or().like("maktx", condition);
+ wrapper.like("matnr", condition).or().like("maktx", condition).or().like("model", condition);
}
wrapper.orderBy("create_time", false);
List<Mat> mats = matService.selectList(wrapper);
@@ -75,7 +85,7 @@
return R.ok(matService.selectById(String.valueOf(id)));
}
- @RequestMapping(value = "/matCode/auth0")
+ @RequestMapping(value = "/mat/auth")
@ManagerAuth
public R find(@RequestParam("matnr") String matnr) {
return R.ok(matService.selectOne(new EntityWrapper<Mat>().eq("matnr", matnr)));
@@ -92,10 +102,11 @@
if (Cools.isEmpty(tagId)) {
tagId = getOriginTag().getId();
}
- return R.ok(matService.getPage(new Page<>(curr, limit)
+ return R.ok(matService.getPage2(new Page<>(curr, limit)
, String.valueOf(tagId)
, param.get("matnr")
- , param.get("maktx"))
+ , param.get("name")
+ , param.get("specs"))
);
}
@@ -120,13 +131,22 @@
return R.error("缂栧彿宸插瓨鍦�");
}
Date now = new Date();
+ InOut inOut=new InOut();
mat.setCreateBy(getUserId());
mat.setCreateTime(now);
mat.setUpdateBy(getUserId());
mat.setUpdateTime(now);
mat.setStatus(1);
+ inOut.setMatnr(mat.getMatnr());
+ inOut.setMaktx(mat.getMaktx());
+ inOut.setColor(mat.getColor());
+ inOut.setSpecs(mat.getSpecs());
+ inOut.setTemp1("");
if (!matService.insert(mat)) {
- throw new CoolException("娣诲姞澶辫触锛岃鑱旂郴绠$悊鍛�");
+ throw new CoolException("鍟嗗搧妗f娣诲姞澶辫触锛岃鑱旂郴绠$悊鍛�");
+ }
+ if (!inOutService.insert(inOut)){
+ throw new CoolException("鍟嗗搧淇℃伅娣诲姞澶辫触锛岃鑱旂郴绠$悊鍛�");
}
return R.ok();
}
@@ -137,9 +157,37 @@
if (Cools.isEmpty(mat) || null==mat.getId()){
return R.error();
}
+ if (mat.getColor().equals("姝e父")){
+ mat.setColor("鎶ュ簾");
+ }else if (mat.getColor().equals("鎶ュ簾")){
+ mat.setColor("姝e父");
+ }
+ InOut inOut = inOutService.selectByMatnr(mat.getMatnr());
+ inOut.setMatnr(mat.getMatnr());
+ inOut.setMaktx(mat.getMaktx());
+ inOut.setColor(mat.getColor());
+ inOut.setSpecs(mat.getSpecs());
mat.setUpdateBy(getUserId());
mat.setUpdateTime(new Date());
matService.updateById(mat);
+ inOutService.updateById(inOut);
+ return R.ok();
+ }
+
+ /*鐗╂枡鎵樼洏缁戝畾*/
+ @RequestMapping(value = "/mat/barcode/auth")
+ @ManagerAuth
+ public R addBarcodeMatnr(Mat mat) {
+ if (Cools.isEmpty(mat.getUnit())){
+ return R.error(BaseRes.PARAM);
+ }
+ if (!mat.getUnit().startsWith("6")&&!mat.getUnit().startsWith("7")&&!mat.getUnit().startsWith("8")){
+ throw new CoolException("鎵樼洏鐮侀浣嶄笉绗﹀悎瑙勮寖");
+ }
+ if (mat.getUnit().length()!= 8){
+ throw new CoolException("鎵樼洏鐮佷笉鏄叓浣嶏紝璇锋鏌�");
+ }
+ matBarcodeService.addBarcodeMatnrTwo(mat);
return R.ok();
}
@@ -151,11 +199,42 @@
return R.error();
}
for (Mat entity : list){
- if (!matService.delete(new EntityWrapper<>(entity))) {
- throw new CoolException("鍒犻櫎澶辫触锛岃鑱旂郴绠$悊鍛�");
+ Integer locCount = locDetlService.selectCountByMatNr(entity.getMatnr());
+ Integer waitCount = waitPakinService.selectCountByMatNr(entity.getMatnr());
+ Integer wrkCount = wrkDetlService.selectCountByMatNr(entity.getMatnr());
+ InOut inOut = inOutService.selectByMatnr(entity.getMatnr());
+ if (locCount > 0 || waitCount > 0 || wrkCount >0){
+ throw new CoolException(entity.getMatnr() + "妯″叿搴撳瓨/缁勬墭/宸ヤ綔妗f暟鎹凡瀛樺湪,涓嶈兘鍒犻櫎");
+ }else {
+ if (!matService.delete(new EntityWrapper<>(entity)) && !inOutService.delete(new EntityWrapper<>(inOut))) {
+ throw new CoolException("鍒犻櫎鍟嗗搧妗f/鍟嗗搧淇℃伅澶辫触锛岃鑱旂郴绠$悊鍛�");
+ }
}
+
}
return R.ok();
+ }
+
+ @RequestMapping(value = "/mat/turn/over/list/auth")
+ @ManagerAuth
+ public R turnOverList(@RequestParam(defaultValue = "1")Integer curr,
+ @RequestParam(defaultValue = "10")Integer limit,
+ @RequestParam Map<String, Object> param){
+ return R.ok(matService.getMatTurnPage(toPage(curr, limit, param, Mat.class)));
+ }
+
+ @RequestMapping("/mat/turn/over/take/site")
+ @ManagerAuth()
+ public R availableTakeSite(@RequestParam(required = false) String matnr){
+ List<Map<String, Object>> result = new ArrayList<>();
+ List<Mat> mats = matService.selectByMatnrLink(matnr);
+ for (Mat mat : mats) {
+ Map<String, Object> map = new HashMap<>();
+ map.put("siteId", mat.getId());
+ map.put("desc", mat.getMatnr());
+ result.add(map);
+ }
+ return R.ok().add(result);
}
@RequestMapping(value = "/mat/export/auth")
@@ -203,7 +282,7 @@
return R.ok();
}
OrderDetl orderDetl = new OrderDetl();
- orderDetl.sync(orderDetl);
+ orderDetl.sync(mat);
orderDetl.setAnfme(0.0D);
return R.ok().add(orderDetl);
}
@@ -288,18 +367,18 @@
/*************************************** xm-select ***********************************************/
// xm-select 鎼滅储鍟嗗搧鍒楄〃
- @RequestMapping("/mat/all/get/kv0") // todo:luxiaotao
+ @RequestMapping("/mat/all/get/kv")
@ManagerAuth
public R getMatDataKV(@RequestParam(required = false) String condition) {
Wrapper<Mat> wrapper = new EntityWrapper<Mat>()
- .andNew().like("matnr", condition).or().like("maktx", condition)
+ .andNew().like("matnr", condition).or().like("maktx", condition).or().like("model",condition)
.orderBy("create_time", false);
List<Mat> mats = matService.selectPage(new Page<>(1, 30), wrapper).getRecords();
List<KeyValueVo> valueVos = new ArrayList<>();
for (Mat mat : mats) {
KeyValueVo vo = new KeyValueVo();
vo.setName(mat.getMatnr() + " - " + mat.getMaktx());
- vo.setValue(mat.getId());
+ vo.setValue(mat.getMatnr());
valueVos.add(vo);
}
return R.ok().add(valueVos);
--
Gitblit v1.9.1