| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import zy.cloud.wms.common.model.OrderStoDto; |
| | | import zy.cloud.wms.common.utils.VersionUtils; |
| | | import zy.cloud.wms.manager.entity.CustOrder; |
| | | import zy.cloud.wms.manager.entity.LocDetl; |
| | | import zy.cloud.wms.manager.entity.Mat; |
| | | import zy.cloud.wms.manager.entity.Pakout; |
| | | import zy.cloud.wms.manager.service.*; |
| | | import zy.cloud.wms.manager.entity.*; |
| | | import zy.cloud.wms.manager.service.CustOrderService; |
| | | import zy.cloud.wms.manager.service.LocDetlService; |
| | | import zy.cloud.wms.manager.service.MatService; |
| | | import zy.cloud.wms.manager.service.PakoutService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | |
| | | @Transactional |
| | | public List<StoPreVo> stockOutPreview(OrderStoDto dto) { |
| | | if (Cools.isEmpty(dto) || Cools.isEmpty(dto.getCustOrders())) { |
| | | throw new CoolException("数据异常,请联系管理员"); |
| | | } |
| | | // 检查库存是否足够 |
| | | locDetlService.checkLocDetlCount(dto.getNumber()); |
| | | List<StoPreVo> result = new ArrayList<>(); |
| | | for (CustOrder custOrder : dto.getCustOrders()) { |
| | | // 判断物料是否存在 |
| | | Mat mat = matService.selectByMatnr(custOrder.getUserCode()); |
| | | if (null == mat) { |
| | | throw new CoolException(custOrder.getUserCode() + "物料尚未更新。" + custOrder.getNumber() +"单据因此中断!"); |
| | | } |
| | | // 查询存有当前物料的货位 |
| | | List<LocDetl> locDetls = locDetlService.findOfSort(mat.getMatnr()); |
| | | double issued = Optional.ofNullable(custOrder.getQty()).orElse(0.0D) ; |
| | | // 视图对象 |
| | | StoPreVo vo = new StoPreVo(); |
| | | vo.setMatnr(mat.getMatnr()); |
| | | vo.setMaktx(mat.getMaktx()); |
| | | vo.setAnfme(issued); |
| | | List<StoPreVo.StoPreLoc> locVos = new ArrayList<>(); |
| | | vo.setLocs(locVos); |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (issued > 0) { |
| | | StoPreVo.StoPreLoc locVo = new StoPreVo.StoPreLoc(); |
| | | locVo.setLocNo(locDetl.getLocNo()); |
| | | locVo.setNodeId(locDetl.getNodeId()); |
| | | locVo.setTotal(locDetl.getAnfme()); |
| | | locVo.setReduce(issued>=locDetl.getAnfme()?locDetl.getAnfme():issued); |
| | | locVo.setPrior(locDetlService.isPrior(locDetl.getNodeId(), mat.getMatnr())); |
| | | locVos.add(locVo); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | } |
| | | } |
| | | result.add(vo); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Transactional |
| | | public void stockOutProcess(OrderStoDto dto) { |
| | | if (Cools.isEmpty(dto) || Cools.isEmpty(dto.getCustOrders())) { |
| | | return; |
| | |
| | | return workService.stockOutCheck(number, getUserId()); |
| | | } |
| | | |
| | | @RequestMapping("/stock/out/preview") |
| | | @ManagerAuth(memo = "拣货预览") |
| | | public R stockOutPreview(@RequestBody StockOutParam stockOutParam) { |
| | | return workService.stockOutPreview(stockOutParam, getUserId()); |
| | | } |
| | | |
| | | @RequestMapping("/stock/out") |
| | | @ManagerAuth(memo = "拣货") |
| | | public R stockOut(@RequestBody StockOutParam stockOutParam) { |
New file |
| | |
| | | package zy.cloud.wms.manager.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by vincent on 2021/3/13 |
| | | */ |
| | | @Data |
| | | public class StoPreVo { |
| | | |
| | | private String matnr; |
| | | |
| | | private String maktx; |
| | | |
| | | private Double anfme; |
| | | |
| | | private List<StoPreLoc> locs; |
| | | |
| | | @Data |
| | | public static class StoPreLoc { |
| | | |
| | | private String locNo; |
| | | |
| | | private Long nodeId; |
| | | |
| | | private Double total; |
| | | |
| | | private Double reduce; |
| | | |
| | | private Boolean prior; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | Boolean removeStock(Long nodeId, String matnr); |
| | | |
| | | /** |
| | | * 是否属于推荐库位 |
| | | * @param nodeId |
| | | * @param matnr |
| | | * @return |
| | | */ |
| | | Boolean isPrior(Long nodeId, String matnr); |
| | | |
| | | } |
| | |
| | | |
| | | R stockOutPrint(StockOutParam param, Long userId); |
| | | |
| | | R stockOutPreview(StockOutParam param, Long userId); |
| | | |
| | | R stockOut(StockOutParam param, Long userId); |
| | | |
| | | R stockOutComplete(StockConfirmParam param, Long userId); |
| | |
| | | import zy.cloud.wms.manager.entity.CustOrder; |
| | | import zy.cloud.wms.manager.entity.LocDetl; |
| | | import zy.cloud.wms.manager.entity.Mat; |
| | | import zy.cloud.wms.manager.entity.Prior; |
| | | import zy.cloud.wms.manager.mapper.LocDetlMapper; |
| | | import zy.cloud.wms.manager.service.CustOrderService; |
| | | import zy.cloud.wms.manager.service.LocDetlService; |
| | | import zy.cloud.wms.manager.service.MatService; |
| | | import zy.cloud.wms.manager.service.PriorService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | private CustOrderService custOrderService; |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private PriorService priorService; |
| | | |
| | | @Override |
| | | public Page<LocDetl> getPage(Page<LocDetl> page) { |
| | |
| | | return this.baseMapper.removeStock(nodeId, matnr)>0; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean isPrior(Long nodeId, String matnr) { |
| | | return priorService.selectCount(new EntityWrapper<Prior>().eq("matnr", matnr).eq("node_id", nodeId).eq("status", 1))>0; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R stockOutPreview(StockOutParam param, Long userId) { |
| | | List<CustOrder> custOrders = custOrderService.selectList(new EntityWrapper<CustOrder>() |
| | | .eq("number", param.getNumber()) |
| | | .eq("status", 1) |
| | | ); |
| | | OrderStoDto dto = new OrderStoDto(); |
| | | dto.setNumber(param.getNumber()); |
| | | dto.setCustOrders(custOrders); |
| | | return R.ok().add(mainService.stockOutPreview(dto)); |
| | | } |
| | | |
| | | @Override |
| | | public R stockOut(StockOutParam param, Long userId) { |
| | | List<CustOrder> custOrders = custOrderService.selectList(new EntityWrapper<CustOrder>() |
| | | .eq("number", param.getNumber()) |
| | |
| | | select |
| | | mld.* |
| | | from man_loc_detl mld |
| | | left join man_prior mp on mld.node_id = mp.node_id |
| | | left join man_prior mp on mld.node_id = mp.node_id and mld.matnr = mp.matnr |
| | | where 1=1 |
| | | <if test="nodeId != null and nodeId != ''"> |
| | | and mld.node_id = #{nodeId} |
| | |
| | | switch (obj.event) { |
| | | // 拣货 |
| | | case 'stockOut': |
| | | layer.confirm(data.number + ' 订单开始拣货?', {shadeClose: true}, function(){ |
| | | layer.closeAll(); |
| | | $.ajax({ |
| | | url: baseUrl+"/work/stock/out", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | contentType:'application/json;charset=UTF-8', |
| | | data: JSON.stringify({ |
| | | number: data.number |
| | | }), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | // 成功 |
| | | if (res.code === 200){ |
| | | layer.confirm(res.msg, { |
| | | shadeClose: true |
| | | , btn: ['打印拣货单'] |
| | | }, function() { |
| | | layer.closeAll(); |
| | | printPakouts(data.number); |
| | | } |
| | | ) |
| | | // 缺料 |
| | | } else if (res.code === 20001) { |
| | | layer.confirm(res.msg, { |
| | | shadeClose: true |
| | | , btn: ['库存调拨', '取消'] |
| | | }, function() { |
| | | // todo 库存调拨 |
| | | layer.closeAll(); |
| | | }, function() { |
| | | // printPakouts(data.number); |
| | | layer.closeAll(); |
| | | } |
| | | ) |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | $(".layui-laypage-btn")[0].click(); |
| | | } |
| | | }) |
| | | }); |
| | | |
| | | $.ajax({ |
| | | url: baseUrl + "/work/stock/out/preview", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | contentType: 'application/json;charset=UTF-8', |
| | | data: JSON.stringify({ |
| | | number: data.number |
| | | }), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | console.log(res); |
| | | } |
| | | }) |
| | | // layer.open({ |
| | | // type: 1 |
| | | // ,title: false |
| | | // ,closeBtn: false |
| | | // ,offset: '100px' |
| | | // ,area: '300px;' |
| | | // ,shade: 0.5 |
| | | // ,id: 'LAY_layuipro' |
| | | // ,btn: ['火速围观', '残忍拒绝'] |
| | | // ,btnAlign: 'c' |
| | | // ,moveType: 1 //拖拽模式,0或者1 |
| | | // ,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">你知道吗?亲!<br>layer ≠ layui<br><br>layer只是作为Layui的一个弹层模块,由于其用户基数较大,所以常常会有人以为layui是layerui<br><br>layer虽然已被 Layui 收编为内置的弹层模块,但仍然会作为一个独立组件全力维护、升级。<br><br>我们此后的征途是星辰大海 ^_^</div>' |
| | | // ,success: function(layero){ |
| | | // var btn = layero.find('.layui-layer-btn'); |
| | | // btn.find('.layui-layer-btn0').attr({ |
| | | // href: 'http://www.layui.com/' |
| | | // ,target: '_blank' |
| | | // }); |
| | | // } |
| | | // }); |
| | | |
| | | // layer.confirm(data.number + ' 订单开始拣货?', {shadeClose: true}, function(){ |
| | | // layer.closeAll(); |
| | | // $.ajax({ |
| | | // url: baseUrl+"/work/stock/out", |
| | | // headers: {'token': localStorage.getItem('token')}, |
| | | // contentType:'application/json;charset=UTF-8', |
| | | // data: JSON.stringify({ |
| | | // number: data.number |
| | | // }), |
| | | // method: 'POST', |
| | | // success: function (res) { |
| | | // // 成功 |
| | | // if (res.code === 200){ |
| | | // layer.confirm(res.msg, { |
| | | // shadeClose: true |
| | | // , btn: ['打印拣货单'] |
| | | // }, function() { |
| | | // layer.closeAll(); |
| | | // printPakouts(data.number); |
| | | // } |
| | | // ) |
| | | // // 缺料 |
| | | // } else if (res.code === 20001) { |
| | | // layer.confirm(res.msg, { |
| | | // shadeClose: true |
| | | // , btn: ['库存调拨', '取消'] |
| | | // }, function() { |
| | | // // todo 库存调拨 |
| | | // layer.closeAll(); |
| | | // }, function() { |
| | | // // printPakouts(data.number); |
| | | // layer.closeAll(); |
| | | // } |
| | | // ) |
| | | // } else if (res.code === 403){ |
| | | // top.location.href = baseUrl+"/"; |
| | | // } else { |
| | | // layer.msg(res.msg) |
| | | // } |
| | | // $(".layui-laypage-btn")[0].click(); |
| | | // } |
| | | // }) |
| | | // }); |
| | | break; |
| | | // 详情 |
| | | case 'detail': |