From 0ffa7a000fee8d7bde4d9a4cd91327b063b41f7f Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期五, 26 三月 2021 15:59:49 +0800 Subject: [PATCH] # --- src/main/java/zy/cloud/wms/manager/entity/param/StockTransferParam.java | 2 src/main/webapp/static/js/custOrder/custOrder.js | 29 +++++---- src/main/java/zy/cloud/wms/manager/controller/WorkController.java | 4 src/main/java/zy/cloud/wms/manager/entity/param/AsrsTransferParam.java | 21 +++++++ src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java | 29 ++++++++- src/main/java/zy/cloud/wms/manager/entity/SafeStoDo.java | 2 src/main/java/zy/cloud/wms/manager/service/WorkService.java | 2 src/main/webapp/static/js/safeSto/safeSto.js | 42 +++++++++----- src/main/java/zy/cloud/wms/common/service/MainService.java | 2 9 files changed, 96 insertions(+), 37 deletions(-) diff --git a/src/main/java/zy/cloud/wms/common/service/MainService.java b/src/main/java/zy/cloud/wms/common/service/MainService.java index 4c10481..a2007e9 100644 --- a/src/main/java/zy/cloud/wms/common/service/MainService.java +++ b/src/main/java/zy/cloud/wms/common/service/MainService.java @@ -121,7 +121,7 @@ Result1 result = asrsService.stockTransfer(transferParams); if (result.getCode() == 500) { if (Cools.isEmpty(result.getData())) { - throw new CodeCoolException(result.getMsg()); + throw new CoolException(result.getMsg()); } else { throw new CodeCoolException("20001-" + result.getData()); } diff --git a/src/main/java/zy/cloud/wms/manager/controller/WorkController.java b/src/main/java/zy/cloud/wms/manager/controller/WorkController.java index 756728f..2307188 100644 --- a/src/main/java/zy/cloud/wms/manager/controller/WorkController.java +++ b/src/main/java/zy/cloud/wms/manager/controller/WorkController.java @@ -140,8 +140,8 @@ @RequestMapping("/stock/transfer") @ManagerAuth(memo = "搴撳瓨璋冩嫧") - public R stockTransfer(@RequestParam String number) { - return workService.stockTransfer(number, getUserId()); + public R stockTransfer(@RequestBody AsrsTransferParam number) { + return workService.asrsStockTransfer(number, getUserId()); } @RequestMapping("/stock/check") diff --git a/src/main/java/zy/cloud/wms/manager/entity/SafeStoDo.java b/src/main/java/zy/cloud/wms/manager/entity/SafeStoDo.java index 8ef6f5d..7939f53 100644 --- a/src/main/java/zy/cloud/wms/manager/entity/SafeStoDo.java +++ b/src/main/java/zy/cloud/wms/manager/entity/SafeStoDo.java @@ -8,7 +8,7 @@ @Data public class SafeStoDo { - private Long nodeId; + private Long node_id; private String node_name; diff --git a/src/main/java/zy/cloud/wms/manager/entity/param/AsrsTransferParam.java b/src/main/java/zy/cloud/wms/manager/entity/param/AsrsTransferParam.java new file mode 100644 index 0000000..1700e90 --- /dev/null +++ b/src/main/java/zy/cloud/wms/manager/entity/param/AsrsTransferParam.java @@ -0,0 +1,21 @@ +package zy.cloud.wms.manager.entity.param; + +import lombok.Data; + +/** + * Created by vincent on 2021/3/26 + */ +@Data +public class AsrsTransferParam { + + private Long node_id; + + private String matnr; + + private Double anfme; + + private Double safe_qua; + + private Double amount; + +} diff --git a/src/main/java/zy/cloud/wms/manager/entity/param/StockTransferParam.java b/src/main/java/zy/cloud/wms/manager/entity/param/StockTransferParam.java index fe809f4..5ca3f7b 100644 --- a/src/main/java/zy/cloud/wms/manager/entity/param/StockTransferParam.java +++ b/src/main/java/zy/cloud/wms/manager/entity/param/StockTransferParam.java @@ -14,5 +14,7 @@ private Double total; + private String allotNo; + } diff --git a/src/main/java/zy/cloud/wms/manager/service/WorkService.java b/src/main/java/zy/cloud/wms/manager/service/WorkService.java index 5334253..feb8c9f 100644 --- a/src/main/java/zy/cloud/wms/manager/service/WorkService.java +++ b/src/main/java/zy/cloud/wms/manager/service/WorkService.java @@ -29,6 +29,8 @@ R stockTransfer(String number, Long userId); + R asrsStockTransfer(AsrsTransferParam param, Long userId); + R stockCheck(StoCheckParam param, Long userId); R stockCheckAuditing(Long checkId, Long userId); 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 c610d49..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.*; @@ -419,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("璇烽�夋嫨璐т綅"); diff --git a/src/main/webapp/static/js/custOrder/custOrder.js b/src/main/webapp/static/js/custOrder/custOrder.js index beae1f1..f79ac41 100644 --- a/src/main/webapp/static/js/custOrder/custOrder.js +++ b/src/main/webapp/static/js/custOrder/custOrder.js @@ -250,23 +250,24 @@ }); // 缂烘枡 } else if (res.code === 20001) { - layer.confirm(res.msg, { - shadeClose: true - , area: ['400px'] - , btn: ['搴撳瓨璋冩嫧', '鍙栨秷'] - }, function() { - // 搴撳瓨璋冩嫧 - stockTransfer(data.number); - layer.closeAll(); - }, function() { - // printPakouts(data.number); - layer.closeAll(); - } - ) + // layer.confirm(res.msg, { + // shadeClose: true + // , area: ['400px'] + // , btn: ['搴撳瓨璋冩嫧', '鍙栨秷'] + // }, function() { + // // 搴撳瓨璋冩嫧 + // stockTransfer(data.number); + // layer.closeAll(); + // }, function() { + // // printPakouts(data.number); + // layer.closeAll(); + // } + // ) + layer.msg(res.msg, {icon: 2}) } else if (res.code === 403){ top.location.href = baseUrl+"/"; } else { - layer.msg(res.msg, {icon: 1}) + layer.msg(res.msg, {icon: 2}) } } }) diff --git a/src/main/webapp/static/js/safeSto/safeSto.js b/src/main/webapp/static/js/safeSto/safeSto.js index 2dfc78d..c1769e1 100644 --- a/src/main/webapp/static/js/safeSto/safeSto.js +++ b/src/main/webapp/static/js/safeSto/safeSto.js @@ -105,21 +105,33 @@ switch (obj.event) { // 琛ヤ粨 case 'allot': - layer.open({ - type: 2, - title: '琛ヤ粨', - maxmin: true, - area: ['30%', top.detailHeight], - shadeClose: true, - content: 'prior_detail.html', - success: function(layero, index){ - setFormVal(layer.getChildFrame('#detail', index), data, true); - top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true); - layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide(); - layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); - layero.find('iframe')[0].contentWindow.layui.form.render('select'); - layero.find('iframe')[0].contentWindow.layui.form.render('checkbox'); - } + console.log(data) + layer.confirm(data.node_name +'琛ヤ粨 '+ data.matnr + '锛屾暟閲忥細' + (data.safe_qua - data.amount), function(){ + var index = layer.load(1, {shade: [0.1,'#000']}); + $.ajax({ + url: baseUrl+"/work/stock/transfer", + headers: {'token': localStorage.getItem('token')}, + contentType:'application/json;charset=UTF-8', + data: JSON.stringify({ + node_id: data.node_id, + matnr: data.matnr, + safe_qua: data.safe_qua, + amount: data.amount + }), + dataType:'json', + method: 'POST', + success: function (res) { + if (res.code === 200) { + layer.msg(res.msg, {icon: 1}) + $(".layui-laypage-btn")[0].click(); + } else if (res.code === 403) { + top.location.href = baseUrl+"/"; + } else { + layer.msg(res.msg, {icon: 2}) + } + layer.close(index); + } + }); }); break; } -- Gitblit v1.9.1