| | |
| | | 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()); |
| | | } |
| | |
| | | |
| | | @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") |
| | |
| | | @Data |
| | | public class SafeStoDo { |
| | | |
| | | private Long nodeId; |
| | | private Long node_id; |
| | | |
| | | private String node_name; |
| | | |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | |
| | | private Double total; |
| | | |
| | | private String allotNo; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | R stockTransfer(String number, Long userId); |
| | | |
| | | R asrsStockTransfer(AsrsTransferParam param, Long userId); |
| | | |
| | | R stockCheck(StoCheckParam param, Long userId); |
| | | |
| | | R stockCheckAuditing(Long checkId, Long userId); |
| | |
| | | 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.*; |
| | |
| | | } |
| | | |
| | | @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("请选择货位"); |
| | |
| | | }); |
| | | // 缺料 |
| | | } 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}) |
| | | } |
| | | } |
| | | }) |
| | |
| | | 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; |
| | | } |