From 0531316b080ca77616387c1f86c0399e6f2d2875 Mon Sep 17 00:00:00 2001 From: zwl <1051256694@qq.com> Date: 星期三, 08 二月 2023 10:29:00 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/controller/MatController.java | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/MatController.java b/src/main/java/com/zy/asrs/controller/MatController.java index b842a73..ed235bd 100644 --- a/src/main/java/com/zy/asrs/controller/MatController.java +++ b/src/main/java/com/zy/asrs/controller/MatController.java @@ -10,10 +10,12 @@ import com.core.annotations.ManagerAuth; import com.core.common.*; import com.core.exception.CoolException; +import com.zy.asrs.entity.LocDetl; import com.zy.asrs.entity.Mat; import com.zy.asrs.entity.MatPrint; import com.zy.asrs.entity.OrderDetl; import com.zy.asrs.entity.result.KeyValueVo; +import com.zy.asrs.service.LocDetlService; import com.zy.asrs.service.MatService; import com.zy.asrs.utils.MatExcelListener; import com.zy.common.CodeRes; @@ -39,6 +41,8 @@ @Autowired private MatService matService; + @Autowired + private LocDetlService locDetlService; @Autowired private SnowflakeIdWorker snowflakeIdWorker; @@ -75,7 +79,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))); @@ -145,12 +149,18 @@ @RequestMapping(value = "/mat/delete/auth") @ManagerAuth + @Transactional public R delete(@RequestParam String param){ List<Mat> list = JSONArray.parseArray(param, Mat.class); if (Cools.isEmpty(list)){ return R.error(); } + for (Mat entity : list){ + LocDetl locDetl = locDetlService.selectByMatnr(entity.getMatnr()); + if (!Cools.isEmpty(locDetl)) { + throw new CoolException("褰撳墠鐗╂枡鍦ㄥ簱锛屾棤娉曞垹闄わ紒"); + } if (!matService.delete(new EntityWrapper<>(entity))) { throw new CoolException("鍒犻櫎澶辫触锛岃鑱旂郴绠$悊鍛�"); } @@ -203,7 +213,7 @@ return R.ok(); } OrderDetl orderDetl = new OrderDetl(); - orderDetl.sync(orderDetl); + orderDetl.sync(mat); orderDetl.setAnfme(0.0D); return R.ok().add(orderDetl); } @@ -299,7 +309,7 @@ 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