| | |
| | | for(StockOutParam.LocDetl one : param.getLocDetls()){ |
| | | locs.add(one.getLocNo()); |
| | | } |
| | | |
| | | //出库时,如果当前库位组有相同的物料,则先出外侧物料 |
| | | for (StockOutParam.LocDetl locDetl : param.getLocDetls()) { |
| | | List<String> outerSingleLoc = Utils.getGroupOuterSingleLoc(locDetl.getLocNo()); |
| | | boolean flag = false; |
| | | Double useCount = 0D; |
| | | for (String locNo : outerSingleLoc) { |
| | | if(locs.contains(locNo)) continue; |
| | | for (LocDetl locDetl0 : locDetlService.selectByLocNo(locNo)) { |
| | | if (!locDetl0.getMatnr().equals(locDetl.getMatnr())) { |
| | | //获取同一库位组的外侧库位号 |
| | | List<String> groupOuterSingleLoc = Utils.getGroupOuterSingleLoc(locDetl.getLocNo()); |
| | | for (String locNo : groupOuterSingleLoc) { |
| | | //每个库位的库位明细 |
| | | for (LocDetl detl : locDetlService.selectByLocNo(locNo)) { |
| | | if (!detl.getMatnr().equals(locDetl.getMatnr())) { |
| | | //不是相同物料 |
| | | continue; |
| | | } |
| | | double lastCount = locDetl.getCount() - useCount;//剩余所需数量 |
| | | double realCount = 0;//实际提供数量 |
| | | if (lastCount==0){ |
| | | continue; |
| | | } |
| | | if (locDetl0.getAnfme() >= lastCount) {//实际数量大于所需数量,按所需数量提供 |
| | | realCount = lastCount; |
| | | } else { |
| | | //实际小于所需数量,按实际数量提供 |
| | | realCount = locDetl0.getAnfme(); |
| | | } |
| | | useCount += realCount;//已使用的数量 |
| | | |
| | | locDetls.add(new StockOutParam.LocDetl(locDetl0.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(), realCount)); |
| | | flag = true; |
| | | if (useCount >= locDetl.getCount()) { |
| | | //找到的库存 >= 所需库存,满足条件 |
| | | break; |
| | | } |
| | | locDetls.add(new StockOutParam.LocDetl(detl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(), detl.getAnfme())); |
| | | } |
| | | } |
| | | |
| | | if (!flag) { |
| | | locDetls.add(locDetl); |
| | | } |
| | | |
| | | locDetls.add(locDetl); |
| | | } |
| | | //出库时,如果当前库位组有相同的物料,则先出外侧物料 6.30日 注释 |
| | | //for (StockOutParam.LocDetl locDetl : param.getLocDetls()) { |
| | | // List<String> outerSingleLoc = Utils.getGroupOuterSingleLoc(locDetl.getLocNo()); |
| | | // boolean flag = false; |
| | | // Double useCount = 0D; |
| | | // for (String locNo : outerSingleLoc) { |
| | | // if(locs.contains(locNo)) continue; |
| | | // for (LocDetl locDetl0 : locDetlService.selectByLocNo(locNo)) { |
| | | // if (!locDetl0.getMatnr().equals(locDetl.getMatnr())) { |
| | | // //不是相同物料 |
| | | // continue; |
| | | // } |
| | | // double lastCount = locDetl.getCount() - useCount;//剩余所需数量 |
| | | // double realCount = 0;//实际提供数量 |
| | | // if (lastCount==0){ |
| | | // continue; |
| | | // } |
| | | // if (locDetl0.getAnfme() >= lastCount) {//实际数量大于所需数量,按所需数量提供 |
| | | // realCount = lastCount; |
| | | // } else { |
| | | // //实际小于所需数量,按实际数量提供 |
| | | // realCount = locDetl0.getAnfme(); |
| | | // } |
| | | // useCount += realCount;//已使用的数量 |
| | | // |
| | | // locDetls.add(new StockOutParam.LocDetl(locDetl0.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(), realCount)); |
| | | // flag = true; |
| | | // if (useCount >= locDetl.getCount()) { |
| | | // //找到的库存 >= 所需库存,满足条件 |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // if (!flag) { |
| | | // locDetls.add(locDetl); |
| | | // } |
| | | // |
| | | //} |
| | | |
| | | // TODO: 2023/6/28 等李薇确认是否使用 |
| | | // ---------------------------------------------- |
| | | //for(StockOutParam.LocDetl one : param.getLocDetls()){ |
| | |
| | | if (!locMast.getLocSts().equals("F")) { |
| | | continue; |
| | | } |
| | | if (locMast.getLocSts().equals("F")) { |
| | | throw new CoolException("浅库位在库不支持此任务"); |
| | | } |
| | | //if (locMast.getLocSts().equals("F")) { |
| | | // throw new CoolException("浅库位在库不支持此任务"); |
| | | //} |
| | | boolean flag = false; |
| | | for (LocDetl locDetl : locDetlService.selectByLocNo(locMast.getLocNo())) { |
| | | if (!locDetl.getMatnr().equals(matnr)) { |
| | |
| | | @Override |
| | | @Transactional |
| | | public void locCheckOut(StockOutParam param, Long userId) { |
| | | // if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 107)) > 0) { |
| | | // throw new CoolException("只能存在一笔盘点任务"); |
| | | // } |
| | | if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 107)) > 0) { |
| | | throw new CoolException("只能存在一笔盘点任务"); |
| | | } |
| | | // 目标站点状态检测 |
| | | BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite()); |
| | | // 获取库位明细 |