From 7e3e333b70b1b92445d6a7117ff8e20746e1558e Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期二, 30 三月 2021 16:53:06 +0800 Subject: [PATCH] # --- src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java | 83 +++++++++++++++++++++++++++++++++-------- 1 files changed, 67 insertions(+), 16 deletions(-) diff --git a/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java b/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java index 99df66d..ded3345 100644 --- a/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java +++ b/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java @@ -1,18 +1,17 @@ package zy.cloud.wms.manager.service.impl; import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.core.common.Cools; -import com.core.common.DateUtils; -import com.core.common.R; -import com.core.common.SnowflakeIdWorker; +import com.core.common.*; import com.core.exception.CoolException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import zy.cloud.wms.common.config.CodeCoolException; import zy.cloud.wms.common.model.BillDto; import zy.cloud.wms.common.model.OrderStoDto; import zy.cloud.wms.common.service.MainService; import zy.cloud.wms.common.service.asrs.AsrsService; +import zy.cloud.wms.common.service.asrs.entity.Result1; import zy.cloud.wms.common.service.erp.ErpService; import zy.cloud.wms.common.utils.VersionUtils; import zy.cloud.wms.manager.entity.*; @@ -209,20 +208,23 @@ throw new CoolException("淇敼鍗曟嵁鐘舵�佸け璐�"); } // 閲囪喘閫�璐у崟 - if (param.getNumber().startsWith("PR-")) { - List<BillDto> dtos = new ArrayList<>(); - for (Pakout pakout : pakouts) { - BillDto billDto = new BillDto(); - billDto.setMatnr(pakout.getMatnr()); - billDto.setQty(pakout.getAnfme()); - dtos.add(billDto); - } - // erp鍗曟嵁涓婁紶 -- 閲囪喘閫�璐у崟 - if (!erpService.uploadBill(dtos, 6, pakouts.get(0).getDocNum())) { - throw new CoolException("鏃犳硶涓婃姤鑷砮rp"); +// if (param.getNumber().startsWith("PR-")) { + // erp鍗曟嵁涓婁紶 + Long docId = pakouts.get(0).getDocId(); + if (null != docId) { + List<BillDto> dtos = new ArrayList<>(); + for (Pakout pakout : pakouts) { + BillDto billDto = new BillDto(); + billDto.setMatnr(pakout.getMatnr()); + billDto.setQty(pakout.getAnfme()); + dtos.add(billDto); + } + if (!erpService.uploadBill(dtos, docId.intValue() , pakouts.get(0).getDocNum())) { + throw new CoolException("鏃犳硶涓婃姤鑷砮rp"); + } } - } +// } return R.ok(); } @@ -416,6 +418,28 @@ } @Override + public R asrsStockTransfer(AsrsTransferParam param, Long userId) { + if (Cools.isEmpty(param.getNode_id(), param.getMatnr(), param.getSafe_qua(), param.getAmount())) { + return R.error("鏁伴噺閿欒"); + } + List<StockTransferParam> params = new ArrayList<>(); + StockTransferParam transferParam = new StockTransferParam(); + transferParam.setMatnr(param.getMatnr()); + transferParam.setAnfme(Arith.subtract(2, param.getSafe_qua(), param.getAmount())); + transferParam.setAllotNo(param.getNode_id()+ "_" +param.getMatnr()); + params.add(transferParam); + Result1 result = asrsService.stockTransfer(params); + if (result.getCode() == 500) { + if (Cools.isEmpty(result.getData())) { + throw new CoolException(result.getMsg()); + } else { + throw new CodeCoolException("20001-" + result.getData()); + } + } + return R.ok("琛ヤ粨鎴愬姛锛岀瓑寰呯珛搴撹皟鎷�"); + } + + @Override public R stockCheck(StoCheckParam param, Long userId) { if (Cools.isEmpty(param.getLocNo())) { return R.error("璇烽�夋嫨璐т綅"); @@ -585,12 +609,39 @@ } // 淇敼鐩樼偣璁板綍 + String docNum = null; + Long docId = null; + switch (check.getSettle()) { + case 1: // 鐩樼泩 + docNum = "CS-" + String.valueOf(snowflakeIdWorker.nextId()).substring(0, 15); + docId = 14L; // 鎶ユ孩鍗� + break; + case 2: // 鐩樹簭 + docNum = "CD-" + String.valueOf(snowflakeIdWorker.nextId()).substring(0, 15); + docId = 9L; // 鎶ユ崯鍗� + break; + default: + throw new CoolException("鐩樼偣璁板綍鐩堜簭鎯呭喌寮傚父"); + } check.setStatus(2); + check.setDocId(docId); + check.setDocNum(docNum); check.setUpdateBy(userId); check.setUpdateTime(now); if (!checkService.updateById(check)) { throw new CoolException("淇敼鐩樼偣璁板綍鐘舵�佸け璐�"); } + + // 涓婃姤缁檈rp + List<BillDto> dtos = new ArrayList<>(); + BillDto billDto = new BillDto(); + billDto.setMatnr(check.getMatnr()); + billDto.setQty(Math.abs(check.getDiffQty())); + dtos.add(billDto); + if (!erpService.uploadBill(dtos, docId.intValue(), docNum)) { + throw new CoolException("鏃犳硶涓婃姤鑷砮rp"); + } + return R.ok(); } -- Gitblit v1.9.1