From e6ec6cd0e0fab11bf79f052be352a66db2dd51d3 Mon Sep 17 00:00:00 2001 From: pang.jiabao <pang_jiabao@163.com> Date: 星期二, 26 十一月 2024 13:18:54 +0800 Subject: [PATCH] 项目搭建完成 --- src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java | 77 ++++++++++++++++++++++++++++++++++---- 1 files changed, 68 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java index 0e0df7e..3b652a7 100644 --- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java @@ -9,10 +9,12 @@ import com.zy.asrs.entity.*; import com.zy.asrs.entity.param.CombParam; import com.zy.asrs.entity.param.MobileAdjustParam; +import com.zy.asrs.entity.param.OffSaleParam; import com.zy.asrs.entity.param.OpenOrderPakinParam; +import com.zy.asrs.mapper.ManLocDetlMapper; import com.zy.asrs.service.*; import com.zy.asrs.utils.MatUtils; -import com.zy.common.CodeRes; +import com.zy.asrs.utils.SaasUtils; import com.zy.common.constant.MesConstant; import com.zy.common.entity.Parameter; import com.zy.common.model.DetlDto; @@ -73,6 +75,8 @@ private NodeService nodeService; @Autowired private ManLocDetlService manLocDetlService; + @Autowired + private ManLocDetlMapper manLocDetlMapper; @Override @@ -81,16 +85,27 @@ if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { throw new CoolException(BaseRes.PARAM); } + if(param.getCombMats().size()>1){ + throw new CoolException("璇锋彁鍙栦竴涓晢鍝侊紝鎴栬�呭埛鏂伴噸鏂扮粍鎵橈紒"); + } // 鍒ゆ柇鏄惁鏈夌浉鍚屾潯鐮佺殑鏁版嵁 if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { throw new CoolException(param.getBarcode() + "鏁版嵁姝e湪杩涜鍏ュ簱"); } + if(param.getBarcode().length()!=8){ + throw new CoolException("鏉$爜闀垮害涓嶆槸8浣�===>>" + param.getBarcode()); + } + if (param.getCombMats().size()>1){ + throw new CoolException("涓嶅厑璁告贩鏂�===>>" + param.getBarcode()); + } + int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode())); - if (countLoc > 0 || countWrk > 0) { - throw new CoolException("宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�===>>" + param.getBarcode()); + int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet",param.getBarcode())); + if (countLoc > 0 || countWrk > 0 || countwait > 0) { + throw new CoolException("缁勬墭妗�/宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�===>>" + param.getBarcode()); } Date now = new Date(); @@ -135,7 +150,7 @@ // 鍏宠仈缁勬墭 } else { Order order = orderService.selectByNo(param.getOrderNo()); - if (order.getSettle() > 2) { + if (Cools.isEmpty(order) || order.getSettle() > 2) { throw new CoolException("鍗曟嵁缂栧彿宸茶繃鏈�"); } // 鐢熸垚鍏ュ簱閫氱煡妗� @@ -187,14 +202,21 @@ } + // 鍟嗗搧涓婃灦 @Override - public void onSale(CombParam param) { + public void onSale(CombParam param, Long userId) { + Date now = new Date(); // 鑾峰彇搴撲綅鍙� String locno = param.getLocno(); Node node = nodeService.selectByUuid(locno); if (Cools.isEmpty(node)) { throw new CoolException(param.getLocno() + ":搴撲綅涓嶅瓨鍦�"); + } + + String barcode = param.getBarcode(); + if (Cools.isEmpty(barcode)) { + throw new CoolException("鏉$爜涓嶈兘涓虹┖锛�"); } // 鑾峰彇鍟嗗搧鍒楄〃 @@ -206,23 +228,60 @@ if (Cools.isEmpty(combMat.getAnfme()) || combMat.getAnfme()==0){ throw new CoolException(combMat.getMatnr() + ":鍟嗗搧鏁伴噺鏈夎锛�"); } - if (Cools.isEmpty(combMat.getBatch())){ - throw new CoolException(combMat.getMatnr() + ":鍟嗗搧鎵瑰彿鏈夎锛�"); - } + ManLocDetl manLocDetl = new ManLocDetl(); manLocDetl.setLocNo(locno); +// manLocDetl.setBarcode(barcode); + manLocDetl.setZpallet(barcode); manLocDetl.setNodeId(node.getId()); manLocDetl.setMaktx(mat.getMaktx()); manLocDetl.setMatnr(mat.getMatnr()); - manLocDetl.setBatch(combMat.getBatch()); + manLocDetl.setSpecs(mat.getSpecs()); + manLocDetl.setBatch(Cools.isEmpty(combMat.getBatch()) ? "" : combMat.getBatch()); manLocDetl.setAnfme(combMat.getAnfme()); + manLocDetl.setCreateBy(userId); + manLocDetl.setCreateTime(now); + manLocDetl.setUpdateBy(userId); manLocDetl.setModiTime(now); if (!manLocDetlService.insert(manLocDetl)) { throw new CoolException("鍟嗗搧涓婃灦澶辫触锛�"); } + + // 鏇存柊搴撲綅鏉$爜 + node.setBarcode(barcode); + node.setUpdateBy(userId); + node.setUpdateTime(now); + nodeService.updateById(node); + SaasUtils.insertLog(0,manLocDetl.getLocNo(), manLocDetl.getMatnr(),combMat.getAnfme(),userId); + } } + // 鍟嗗搧涓嬫灦 + @Override + public void offSale(OffSaleParam offSaleParam, Long userId) { + ManLocDetl manLocDetl = manLocDetlMapper.selectLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr()); + if (Cools.isEmpty(manLocDetl)){ + throw new CoolException("鏃犳鍟嗗搧锛�"); + } + double anfme = manLocDetl.getAnfme() - offSaleParam.getAnfme(); + if (anfme < 0) { + throw new CoolException("鍟嗗搧搴撳瓨涓嶈冻锛�"); + } else if (anfme == 0){ + SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),offSaleParam.getAnfme(),userId); + manLocDetlMapper.deleteLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr()); + // 娓呯┖搴撲綅鏉$爜 + Node node = nodeService.selectByUuid(offSaleParam.getLocNo()); + node.setUpdateTime(new Date()); + node.setUpdateBy(userId); + node.setBarcode(""); + } + manLocDetlMapper.updateAnfme0(anfme,manLocDetl.getNodeId()); + } + + // 鏌ユ壘鍟嗗搧 + + @Override @Transactional public void adjust(MobileAdjustParam param, Long userId) { -- Gitblit v1.9.1