#
18516761980
2022-08-02 33cc8de8a39b88d619cce6e80f13564a85e5dce0
src/main/java/com/zy/asrs/service/impl/OutStockServiceImpl.java
@@ -73,13 +73,13 @@
            if (tempLocList.size() > 0) {
                for (Integer j = 0; j < tempLocList.size(); j ++) {
                    locNum = locNum.add(new BigDecimal(tempLocList.get(j).getAnfme()));
                    /* 计算需要的数量,符合数量后结束循环 */
                    if (needNum.compareTo(locNum) == 1) {
//                    /* 计算需要的数量,符合数量后结束循环 */
//                    if (needNum.compareTo(locNum) == 1) {
                        locList.add(tempLocList.get(j));
                    } else {
                        locList.add(tempLocList.get(j));
                        break;
                    }
//                    } else {
//                        locList.add(tempLocList.get(j));
//                        break;
//                    }
                }
            }
        }
@@ -112,9 +112,12 @@
                }
            }
            if (complete) {
                if (!completeCPakOut(FBillNo)) {
                    log.error("{}出库单标记完成失败", FBillNo);
                }
                List<OutStockBillEntry> select1 = this.selectList(new EntityWrapper<OutStockBillEntry>().eq("FInterID", FInterID));
               if(select1.size()<=1){
                    if (!completeCPakOut(FBillNo) )  {
                        log.error("{}出库单标记完成失败", FBillNo);
                    }
               }
            }
            return true;
        } else {
@@ -163,7 +166,8 @@
        // 获取库位明细
        List<LocDetlDto> locDetlDtos = new ArrayList<>();
        for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) {
            if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())) {
            if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())
                && paramLocDetl.getCount() > 0) {
                LocDetl sqlParam = new LocDetl();
                sqlParam.setLocNo(paramLocDetl.getLocNo());
                sqlParam.setMatnr(paramLocDetl.getMatnr());
@@ -201,11 +205,15 @@
        // 生成工作档
        for (OutLocDto dto : dtos) {
            // 判断入出库类型:101.全板出库 or 103.拣料出库
            if (ioType == null) {
//            if (ioType == null) {
                ioType = dto.isAll() ? 101 : 103;
            }
//            }
            // 获取库位
            LocMast locMast = locMastService.selectById(dto.getLocNo());
            //如果托盘条码为空,就不能进行拣料,无法再入库
            if(ioType==103 && null!=locMast && Cools.isEmpty(locMast.getBarcode())){
                throw new CoolException("库位没有托盘码,无法拣料作业===>>" + locMast.getLocNo());
            }
            // 获取路径
            Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
                    .eq("type_no", ioType)
@@ -272,7 +280,8 @@
                Integer FInterI = outStockService.queryOutStockFInterID(fbillNo); // 获取出库单主表主键
                Wrapper wrapper1 = new EntityWrapper<OutStockBillEntry>().eq("FInterID",FInterI).eq("Fnumber",detlDto.getLocDetl().getMatnr());
                OutStockBillEntry outStockBillEntry = outStockService.selectOne(wrapper1);
                outStockBillEntry.setFAmount(outStockBillEntry.getFAmount().add(BigDecimal.valueOf(anfme)));  //借用amount字段,控制下发出库任务数量
                outStockBillEntry.setFAmount(outStockBillEntry.getFAmount().add(BigDecimal.valueOf(anfme)));  //借用famount字段,控制下发出库任务数量
                outStockBillEntry.setFAuxQty(outStockBillEntry.getFAuxQty().subtract(BigDecimal.valueOf(anfme)));
                if(!outStockService.update(outStockBillEntry,wrapper1)){
                    throw new CoolException("更新出库通知档明细FAmount失败[FInterID="+FInterI+",Fnumber="+detlDto.getLocDetl().getMatnr()+"]");
                }