New file |
| | |
| | | package zy.cloud.wms.common.model; |
| | | |
| | | import lombok.Data; |
| | | import zy.cloud.wms.manager.entity.OrderDetl; |
| | | import zy.cloud.wms.manager.entity.WaveDetl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class WaveStoDto { |
| | | |
| | | private String orderNo; |
| | | |
| | | private List<MatnrDto> dtos; |
| | | |
| | | public WaveStoDto() { |
| | | } |
| | | |
| | | public WaveStoDto create(String id, List<WaveDetl> orderDetls){ |
| | | this.setOrderNo(id); |
| | | List<MatnrDto> matnrDtos = new ArrayList<>(); |
| | | for (WaveDetl waveDetl : orderDetls) { |
| | | MatnrDto matnrDto = new MatnrDto(); |
| | | matnrDto.setMatnr(waveDetl.getMatnr()); |
| | | matnrDto.setCount(waveDetl.getAnfme()); |
| | | matnrDto.setBatch(waveDetl.getBatch()); |
| | | matnrDtos.add(matnrDto); |
| | | } |
| | | this.setDtos(matnrDtos); |
| | | return this; |
| | | } |
| | | } |
| | |
| | | import zy.cloud.wms.common.model.MatnrDto; |
| | | import zy.cloud.wms.common.model.OrderStoDto; |
| | | import zy.cloud.wms.common.model.ReceiveStoDto; |
| | | import zy.cloud.wms.common.model.WaveStoDto; |
| | | import zy.cloud.wms.common.utils.VersionUtils; |
| | | import zy.cloud.wms.manager.entity.*; |
| | | import zy.cloud.wms.manager.service.*; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | public Object waveOutPreview(WaveStoDto waveStoDto, Long hostId) { |
| | | if (Cools.isEmpty(waveStoDto) || Cools.isEmpty(waveStoDto.getDtos())) { |
| | | throw new CoolException("数据异常,请联系管理员"); |
| | | } |
| | | List<StoPreTab> res = new ArrayList<>(); |
| | | // 检查库存是否足够 |
| | | // locDetlService.checkLocDetlCount(orderStoDto.getDtos()); |
| | | |
| | | for (MatnrDto matnrDto : waveStoDto.getDtos()) { |
| | | // 判断物料是否存在 |
| | | Mat mat = matService.selectByMatnr(hostId, matnrDto.getMatnr()); |
| | | if (null == mat) { |
| | | throw new CoolException(matnrDto.getMatnr() + "物料尚未更新。" + waveStoDto.getOrderNo() +"单据因此中断!"); |
| | | } |
| | | |
| | | Double sumAnfme = Optional.ofNullable(locDetlService.selectCountByMatnr(mat.getMatnr(), hostId)).orElse(0.0D); |
| | | double lack = 0.0D; |
| | | // 缺货 |
| | | if (sumAnfme < matnrDto.getCount()) { |
| | | lack = matnrDto.getCount() - sumAnfme; |
| | | // 视图对象 |
| | | StoPreTab tab = new StoPreTab(); |
| | | tab.setTitle(mat.getMaktx() + "(" + mat.getMatnr() + ")"); |
| | | tab.setMatnr(mat.getMatnr()); |
| | | tab.setMaktx(mat.getMaktx()); |
| | | tab.setAnfme(matnrDto.getCount()); |
| | | tab.setLocNo("缺货"); |
| | | tab.setTotal(lack); |
| | | tab.setReduce(lack); |
| | | tab.setRemQty(0.0D); |
| | | tab.setPrior(false); |
| | | tab.setPrior$("×"); |
| | | tab.setType(0); |
| | | res.add(tab); |
| | | } |
| | | |
| | | // 查询存有当前物料的货位 |
| | | List<LocDetl> locDetls = locDetlService.findOfSort(hostId, mat.getMatnr()); |
| | | double issued = Optional.of(matnrDto.getCount() - lack).orElse(0.0D) ; |
| | | double anfme = issued; |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (issued > 0) { |
| | | // 视图对象 |
| | | StoPreTab tab = new StoPreTab(); |
| | | tab.setTitle(mat.getMaktx() + "(" + mat.getMatnr() + ")"); |
| | | tab.setMatnr(mat.getMatnr()); |
| | | tab.setMaktx(mat.getMaktx()); |
| | | tab.setAnfme(matnrDto.getCount()); |
| | | |
| | | tab.setLocNo(locDetl.getLocNo()); |
| | | tab.setNodeId(locDetl.getNodeId()); |
| | | tab.setTotal(locDetl.getAnfme()); |
| | | tab.setReduce(issued>=locDetl.getAnfme()?locDetl.getAnfme():issued); |
| | | tab.setRemQty(tab.getTotal() - tab.getReduce()); |
| | | tab.setPrior(locDetlService.isPrior(locDetl.getNodeId(), mat.getMatnr())); |
| | | tab.setPrior$(tab.getPrior()?"✔":"×"); |
| | | tab.setType(1); |
| | | res.add(tab); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | res.sort(new Comparator<StoPreTab>() { |
| | | @Override |
| | | public int compare(StoPreTab o1, StoPreTab o2) { |
| | | // return o1.getMatnr().length() - o2.getMatnr().length(); |
| | | return (int) (o1.getAnfme() - o2.getAnfme()); |
| | | } |
| | | }); |
| | | return res; |
| | | |
| | | } |
| | | } |
| | |
| | | import com.core.common.DateUtils; |
| | | import zy.cloud.wms.manager.entity.Wave; |
| | | import zy.cloud.wms.manager.entity.WaveDetl; |
| | | import zy.cloud.wms.manager.entity.param.StockOutParam; |
| | | import zy.cloud.wms.manager.service.OrderService; |
| | | import zy.cloud.wms.manager.service.WaveDetlService; |
| | | import zy.cloud.wms.manager.service.WaveService; |
| | |
| | | import zy.cloud.wms.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import zy.cloud.wms.manager.service.WorkService; |
| | | |
| | | import java.util.*; |
| | | |
| | | |
| | | @RestController |
| | | public class WaveController extends BaseController { |
| | |
| | | private WaveDetlService waveDetlService; |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private WorkService workService; |
| | | |
| | | @RequestMapping(value = "/wave/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | @RequestMapping("/wave/createOut") |
| | | @ManagerAuth |
| | | public R createWaveOut(@RequestBody Wave wave){ |
| | | waveService.createOut(wave,getUserId(),getHostId()); |
| | | return R.ok(); |
| | | |
| | | return waveService.createOut(wave,getUserId(),getHostId()); |
| | | } |
| | | |
| | | @RequestMapping("/wave/preview") |
| | | @ManagerAuth |
| | | public R createWavePreview(@RequestBody StockOutParam stockOutParam){ |
| | | return workService.wavePreview(stockOutParam, getUserId(), getHostId()); |
| | | } |
| | | |
| | | } |
| | |
| | | package zy.cloud.wms.manager.service; |
| | | |
| | | import com.core.common.R; |
| | | import zy.cloud.wms.manager.entity.Wave; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface WaveService extends IService<Wave> { |
| | | |
| | | void createOut(Wave wave, Long userId, Long hostId); |
| | | R createOut(Wave wave, Long userId, Long hostId); |
| | | } |
| | |
| | | R stockCheckAuditing(Long checkId, Long userId, Long hostId); |
| | | |
| | | R initOutOrder(InitOrderParam param, Long userId, Long hostId); |
| | | |
| | | R wavePreview(StockOutParam stockOutParam, Long userId, Long hostId); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import zy.cloud.wms.manager.entity.WaveDetl; |
| | |
| | | * @param hostId |
| | | */ |
| | | @Override |
| | | public void createOut(Wave wave, Long userId, Long hostId) { |
| | | public R createOut(Wave wave, Long userId, Long hostId) { |
| | | HashSet<String> orderIds = new HashSet<>(); |
| | | /** |
| | | * 控管 |
| | |
| | | wave.setStatus((short) 1); |
| | | waveService.update(wave,new EntityWrapper<Wave>() |
| | | .eq("id",wave.getId())); |
| | | |
| | | /** |
| | | * 生成拣货单 |
| | | */ |
| | | |
| | | |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | import zy.cloud.wms.common.model.MatnrDto; |
| | | import zy.cloud.wms.common.model.OrderStoDto; |
| | | import zy.cloud.wms.common.model.ReceiveStoDto; |
| | | import zy.cloud.wms.common.model.WaveStoDto; |
| | | import zy.cloud.wms.common.service.MainService; |
| | | import zy.cloud.wms.common.utils.VersionUtils; |
| | | import zy.cloud.wms.manager.entity.*; |
| | |
| | | private ReceiveDetlService receiveDetlService; |
| | | @Autowired |
| | | ReceiveLogService receiveLogService; |
| | | @Autowired |
| | | private WaveService waveService; |
| | | @Autowired |
| | | private WaveDetlService waveDetlService; |
| | | |
| | | |
| | | @Override |
| | |
| | | return R.ok("创建订单成功"); |
| | | } |
| | | |
| | | @Override |
| | | public R wavePreview(StockOutParam stockOutParam, Long userId, Long hostId) { |
| | | Wrapper<Wave> wrapper = new EntityWrapper<Wave>() |
| | | .eq("id", stockOutParam.getOrderNo()); |
| | | |
| | | if (hostId != null) { |
| | | wrapper.eq("host_id", hostId); |
| | | } |
| | | Wave wave = waveService.selectOne(wrapper); |
| | | |
| | | if (wave.getStatus() != 0){ |
| | | return R.error("此单据无法生成拣货单"); |
| | | } |
| | | // Order order = orderService.selectByOrderNo(param.getOrderNo(), hostId); |
| | | // if (order.getSettle() != 1) { |
| | | // return R.error("此单据无法生成拣货单"); |
| | | // } |
| | | List<WaveDetl> waveDetls = waveDetlService.selectList(new EntityWrapper<WaveDetl>() |
| | | .eq("wave_id", stockOutParam.getOrderNo())); |
| | | if (Cools.isEmpty(waveDetls)) { |
| | | return R.error("此单据已失效,请联系管理员"); |
| | | } |
| | | // List<OrderDetl> orderDetls = orderDetlService.selectByOrderNo(order.getOrderNo(), hostId); |
| | | // if (Cools.isEmpty(orderDetls)) { |
| | | // return R.error("此单据已失效,请联系管理员"); |
| | | // } |
| | | |
| | | WaveStoDto waveStoDto = new WaveStoDto().create(stockOutParam.getOrderNo(),waveDetls); |
| | | // OrderStoDto dto = new OrderStoDto().create(order.getOrderNo(), orderDetls); |
| | | return R.ok().add(mainService.waveOutPreview(waveStoDto, hostId)); |
| | | } |
| | | |
| | | } |
| | |
| | | var pageCurr; |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).use(['table','laydate', 'form', 'admin'], function(){ |
| | | }).use(['table','laydate', 'form', 'admin','tableMerge'], function(){ |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | var admin = layui.admin; |
| | | var tableMerge = layui.tableMerge; |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | |
| | | } |
| | | }); |
| | | |
| | | function createWaveOut(mData) { |
| | | function createWaveOut(data) { |
| | | console.log(data) |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl + "/wave/preview", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | contentType: 'application/json;charset=UTF-8', |
| | | data: JSON.stringify({ |
| | | orderNo: data.id |
| | | }), |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.open({ |
| | | type: 1 |
| | | ,title: false |
| | | ,closeBtn: false |
| | | ,offset: '100px' |
| | | ,area: '1000px' |
| | | ,shade: 0.5 |
| | | ,shadeClose: true |
| | | ,btn: ['立即生成', '稍后处理'] |
| | | ,btnAlign: 'c' |
| | | ,moveType: 1 //拖拽模式,0或者1 |
| | | ,content: $('#stoukOutPreview') |
| | | ,success: function(layero, index){ |
| | | table.render({ |
| | | elem: '#stoPreTab', |
| | | data: res.data, |
| | | page: true, |
| | | cellMinWidth: 100, |
| | | height: 432, |
| | | cols: [[ |
| | | {field: 'title', title: '商品', merge: true, align: 'center'}, |
| | | {field: 'anfme', title: '总数量', merge: ['title'], align: 'center', style: 'font-weight: bold', width: 90}, |
| | | {field: 'type', title: '仓库', merge: true, align: 'center', templet: '#typeTpl', width: 90}, |
| | | {field: 'locNo', title: '货位', align: 'center'}, |
| | | {field: 'prior$', title: '推荐货位', align: 'center', width: 100}, |
| | | {field: 'reduce', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'}, |
| | | // {field: 'remQty', title: '余量', align: 'center', width: 80}, |
| | | {field: 'total', title: '总量', align: 'center', width: 90}, |
| | | ]], |
| | | done: function () { |
| | | tableMerge.render(this); |
| | | $('.layui-table-body.layui-table-main').css("overflow", "auto") |
| | | } |
| | | }); |
| | | |
| | | } |
| | | ,yes: function(index, layero){ |
| | | //按钮【马上拣货】的回调 |
| | | stockOut(res.data); |
| | | } |
| | | ,btn2: function(index, layero){ |
| | | //按钮【稍后处理】的回调 |
| | | //return false 开启该代码可禁止点击该按钮关闭 |
| | | } |
| | | }); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | |
| | | } |
| | | function stockOut(mData){ |
| | | |
| | | console.log(mData); |
| | | layer.confirm('确定生成该波次的拣货单?', { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | |
| | | } |
| | | }) |
| | | }); |
| | | |
| | | } |
| | | // 监听行工具事件 |
| | | table.on('tool(wave)', function(obj){ |
| | |
| | | <div class="layui-form"> |
| | | <table class="layui-hide" id="wave" lay-filter="wave"></table> |
| | | </div> |
| | | <div id="stoukOutPreview" style="display: none"> |
| | | <div style="padding: 25px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;"> |
| | | <span style="font-size: large; font-weight: bold">拣货单预览</span> |
| | | </div> |
| | | <table id="stoPreTab" lay-filter="stoPreTab"></table> |
| | | </div> |
| | | |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <!-- <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData" >新增</button>--> |