| | |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/6/11 |
| | |
| | | } |
| | | // 获取库位 |
| | | LocMast locMast = locMastService.selectById(taskDto.getLocNo()); |
| | | // 构建出库明细(用于 isAll 判断) |
| | | List<LocDetlDto> locDetlDtos = locDtos.stream().map(locDto -> { |
| | | LocDetl locDetl = new LocDetl(); |
| | | locDetl.setMatnr(locDto.getMatnr()); |
| | | locDetl.setBatch(locDto.getBatch()); |
| | | locDetl.setAnfme(locDto.getAnfme()); |
| | | |
| | | LocDetlDto dto = new LocDetlDto(); |
| | | dto.setLocDetl(locDetl); |
| | | dto.setCount(locDto.getAnfme()); |
| | | return dto; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | taskDto.setLocDetlDtos(locDetlDtos); |
| | | |
| | | // 获取路径 |
| | | int ioType = taskDto.isAll() ? 101 : 103; |
| | | StaDesc staDesc = staDescService.queryCrnStnAuto(ioType, locMast.getCrnNo(), staNo.getDevNo()); |
| | |
| | | // } |
| | | // return sameNumber == locDetls.size(); |
| | | // } |
| | | public boolean isAll(){ |
| | | public boolean isAll() { |
| | | // 深拷贝,防止原集合被修改 |
| | | List<LocDetlDto> locDetlDtosCp = new ArrayList<>(this.locDetlDtos); |
| | | // 查询当前库位号所有的库存明细 |
| | | |
| | | // 查询当前库位号所有库存明细 |
| | | LocDetlService locDetlService = SpringUtils.getBean(LocDetlService.class); |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", this.locNo)); |
| | | if (locDetls == null || locDetls.isEmpty()){ |
| | | List<LocDetl> locDetls = locDetlService.selectList( |
| | | new EntityWrapper<LocDetl>().eq("loc_no", this.locNo) |
| | | ); |
| | | |
| | | if (locDetls == null || locDetls.isEmpty()) { |
| | | throw new CoolException("检索库存明细失败,库位号=" + this.locNo); |
| | | } |
| | | |
| | | int sameNumber = 0; |
| | | |
| | | for (LocDetl locDetl : locDetls) { |
| | | boolean matched = false; |
| | | |
| | | System.out.println("当前库存明细: matnr=" + locDetl.getMatnr() + ", batch=" + locDetl.getBatch() + ", anfme=" + locDetl.getAnfme()); |
| | | |
| | | Iterator<LocDetlDto> iterator = locDetlDtosCp.iterator(); |
| | | while (iterator.hasNext()) { |
| | | LocDetlDto next = iterator.next(); |
| | | if (!next.getLocDetl().getMatnr().equals(locDetl.getMatnr())) { |
| | | continue; |
| | | LocDetlDto dto = iterator.next(); |
| | | String dtoMatnr = dto.getLocDetl().getMatnr(); |
| | | String dtoBatch = dto.getLocDetl().getBatch(); |
| | | Double dtoCount = dto.getCount(); |
| | | |
| | | System.out.println("比较对象: matnr=" + dtoMatnr + ", batch=" + dtoBatch + ", count=" + dtoCount); |
| | | |
| | | if (!dtoMatnr.equals(locDetl.getMatnr())) continue; |
| | | if (!Cools.eq(dtoBatch, locDetl.getBatch())) continue; |
| | | |
| | | if (dtoCount > locDetl.getAnfme()) { |
| | | throw new CoolException("服务器内部错误,数量大于库存"); |
| | | } |
| | | if (!Cools.eq(next.getLocDetl().getBatch(), locDetl.getBatch())) { |
| | | continue; |
| | | } |
| | | if (next.getCount() > locDetl.getAnfme()) { |
| | | throw new CoolException("服务器内部错误"); |
| | | } |
| | | if (next.getCount().equals(locDetl.getAnfme())) { |
| | | |
| | | if (dtoCount.equals(locDetl.getAnfme())) { |
| | | sameNumber++; |
| | | matched = true; |
| | | iterator.remove(); |
| | | System.out.println("匹配成功并移除该项,当前 sameNumber = " + sameNumber + ",剩余匹配数: " + locDetlDtosCp.size()); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (!matched) { |
| | | System.out.println("未匹配成功: matnr=" + locDetl.getMatnr() + ", batch=" + locDetl.getBatch()); |
| | | } |
| | | } |
| | | |
| | | return sameNumber == locDetls.size(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | ,{field: 'updateBy$', align: 'center',title: '修改人员', hide: true} |
| | | ,{field: 'updateTime$', align: 'center',title: '修改时间', hide: true} |
| | | ,{field: 'memo', align: 'center',title: '备注', hide: true} |
| | | ,{field: 'proType', align: 'center',title: '属性', hide: true} |
| | | ,{field: 'proType', align: 'center',title: '属性', hide: false} |
| | | ,{field: 'temp1', align: 'center',title: '名称总称', hide: false} |
| | | ,{field: 'outOrderNo', align: 'center',title: '合同号', hide: true} |
| | | |
| | |
| | | ,{field: 'model', align: 'center',title: '代码'} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称', sort:true} |
| | | ,{field: 'spgNO', align: 'center',title: '派工单号', hide:true,sort:true} |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', hide: true} |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', hide: false} |
| | | ,{field: 'batch', align: 'center',title: '批号', width: 200,hide:true, sort:true} |
| | | ,{field: 'outOrderNo', align: 'center',title: '合同号'} |
| | | ,{field: 'anfme', align: 'center',title: '数量'} |
| | |
| | | ,{field: 'manuDate', align: 'center',title: '生产日期', hide: true} |
| | | ,{field: 'itemNum', align: 'center',title: '品项数', hide: true} |
| | | ,{field: 'safeQty', align: 'center',title: '安全库存量', hide: true} |
| | | ,{field: 'weight', align: 'center',title: '总重', hide: true} |
| | | ,{field: 'weight', align: 'center',title: '总重', hide: false} |
| | | ,{field: 'length', align: 'center',title: '单箱毛重', hide: true} |
| | | ,{field: 'volume', align: 'center',title: '单箱体积', hide: true} |
| | | ,{field: 'threeCode', align: 'center',title: '箱子尺寸', hide: true} |
| | |
| | | ,{field: 'source$', align: 'center',title: '制购', hide: true} |
| | | ,{field: 'check$', align: 'center',title: '要求检验', hide: true} |
| | | ,{field: 'danger$', align: 'center',title: '危险品', hide: true} |
| | | ,{field: 'proType', align: 'center',title: '属性', hide: false} |
| | | ,{field: 'temp1', align: 'center',title: '名称总称', hide: false} |
| | | |
| | | ]; |
| | | |
| | |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', templet: '#orderNoTpl', width: 160} |
| | | ,{field: 'matnr', align: 'center',title: '商品编码', width: 160} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称', width: 200} |
| | | ,{field: 'batch', align: 'center',title: '序列码'} |
| | | ,{field: 'batch', align: 'center',title: '批号'} |
| | | ,{field: 'specs', align: 'center',title: '规格'} |
| | | ,{field: 'sPgNO', align: 'center',title: '派工单号',hide:true} |
| | | // ,{field: 'anfme', align: 'center',title: '数量'} |
| | |
| | | // {type: 'checkbox', merge: ['orderNo']}, |
| | | {field: 'orderNo', title: '单据编号', merge: true, align: 'center'}, |
| | | {field: 'title', title: '商品', merge: true, align: 'center', width: 350}, |
| | | {field: 'model', title: '产品编号', align: 'center'}, |
| | | {field: 'model', title: '代号', align: 'center'}, |
| | | {field: 'batch', title: '批次', align: 'center'}, |
| | | {field: 'sPgNO', title: '派工单号', align: 'center',hide:true}, |
| | | {field: 'anfme', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'}, |
| | | {field: 'zpallet', align: 'center',title: '托盘码'}, |
| | | {field: 'locNo', title: '货位', align: 'center', width: 100, templet: '#locNoTpl'}, |
| | | {field: 'staNos', align: 'center', title: '出库站', merge: ['locNo'], templet: '#tbBasicTbStaNos'}, |
| | | {field: 'outOrderNo', hide: true}, |
| | | {field: 'outOrderNo', hide: false}, |
| | | {field: 'luHao', hide: true}, |
| | | {field: 'packing', hide: true}, |
| | | {field: 'proType', hide: true}, |
| | | {field: 'proType', hide: false}, |
| | | {type: 'checkbox', merge: ['locNo']}, |
| | | ]], |
| | | done: function (res) { |