skyouc
1 天以前 1068673dcf41cdf7a7a06a26aaeb5652d734eb2d
添加是否允许超收判断
出库上报明细问题修复
4个文件已修改
88 ■■■■■ 已修改文件
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReportMsgServiceImpl.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java
@@ -280,7 +280,7 @@
            if (Objects.isNull(orderItem)) {
                throw new CoolException("数据错误,拣料不在单据需求中!!");
            }
            //taskItems为拣货明细,作参数上报
            Double summed = items.stream().mapToDouble(TaskItem::getAnfme).sum();
            //加上历史拣料数量
            Double pickQty = Math.round((orderItem.getQty() + summed) * 100) / 100.0;
@@ -326,6 +326,14 @@
                TaskItem item = taskItemService.getById(taskItem.getId());
                //判断是否允许超收,不允许超收添加拒收判断
                if (!Objects.isNull(config)) {
                    LocItemWorking serviceOne = locItemWorkingService.getOne(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getFieldsIndex, item.getFieldsIndex()));
                    if (Objects.isNull(serviceOne)) {
                        throw new CoolException("缓存数据丢失!!");
                    }
                    //不管是否允许超收,都需判断是否超出库存范围
                    if (taskItem.getAnfme().compareTo(serviceOne.getAnfme()) > 0) {
                        throw new CoolException("拣货数量超出当前票号库存数量!!");
                    }
                    if (!Boolean.parseBoolean(config.getVal())) {
                        if (item.getAnfme().compareTo(item.getQty() + taskItem.getAnfme()) < 0.0) {
                            throw new CoolException("前当物料已超出可拣范围,请核对后再操作!!");
@@ -338,8 +346,9 @@
                    throw new CoolException("状态完成失败!!");
                }
                StockItem stockItem = new StockItem();
                BeanUtils.copyProperties(taskItem, stockItem);
                stockItem.setStockId(stock.getId()).setStockCode(stock.getCode()).setSourceItemId(orderItem.getId());
                BeanUtils.copyProperties(item, stockItem);
                //taskItem为上报数据
                stockItem.setStockId(stock.getId()).setAnfme(taskItem.getAnfme()).setStockCode(stock.getCode()).setSourceItemId(orderItem.getId());
                stockItems.add(stockItem);
            });
            if (!stockItemService.saveBatch(stockItems)) {
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReportMsgServiceImpl.java
@@ -382,44 +382,34 @@
                    throw new RuntimeException(e);
                }
            } else if (order.getType().equals(OrderType.ORDER_OUT.type)){
                List<Stock> stocks = stockService.list(new LambdaQueryWrapper<Stock>().eq(Stock::getSourceCode, order.getCode()));
                if (stocks.isEmpty()) {
                    throw new CoolException("出庫歷史不存在!!");
                List<StockItem> stockItems = stockItemService.list(new LambdaQueryWrapper<StockItem>().eq(StockItem::getSourceItemId, orderItem.getId()));
                if (stockItems.isEmpty()) {
                    return;
                }
                String finalNickName = nickName;
                stocks.forEach(stock -> {
                    //筛选当前唯一字段所有出入库信息
                    List<StockItem> stockItems = stockItemService.list(new LambdaQueryWrapper<StockItem>()
                            .eq(StockItem::getStockId, stock.getId()));
                    if (stockItems.isEmpty()) {
                        throw new CoolException("出庫單明細不存在!!");
                    }
                    //获取库存中订单库位
//                Set<Long> longSet = stockItems.stream().map(StockItem::getStockId).collect(Collectors.toSet());
                    stockItems.forEach(items -> {
                stockItems.forEach(stockItem -> {
                        List<ReportDataParam> dataParams = new ArrayList<>();
                        //获取索引内容
                        Map<String, String> fields = FieldsUtils.getFields(items.getFieldsIndex());
                    Map<String, String> fields = FieldsUtils.getFields(stockItem.getFieldsIndex());
                        //设置通用参数
                        param.setWMSNO(order.getCode())
                                .setPONO(order.getPoCode())
                                .setOrderNO(order.getPoCode())
                                .setOrderDate(order.getCreateTime())
                                .setItemCode(items.getMatnrCode())
                            .setItemCode(stockItem.getMatnrCode())
                                .setEditUser(finalNickName)
                                .setEditDate(order.getUpdateTime())
                                .setGoodsNO(fields.get("crushNo"))
                                .setMemoDtl(order.getMemo());
                        if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_DONE_IN.type)) {
                            //采购入库单
                            params.setOrderType("PO_Instock").setAction("Update");
                            //获取指定查询字段CrushNo 票号
                            param.setInQty(items.getQty());
                        param.setInQty(stockItem.getAnfme());
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_PURCHASE_RETURN.type)) {
                            //采购退货
                            params.setOrderType("PR_Outstock").setAction("Update");
                            param.setOutQty(items.getQty());
                        param.setOutQty(stockItem.getAnfme());
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_OTHER_TERANSFER_IN.type)) {
                            //调拔入库单
                            params.setOrderType("Mv_Instock").setAction("Update");
@@ -429,27 +419,27 @@
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_PURCHASE.type)) {
                            //生产退料
                            params.setOrderType("WR_Instock").setAction("Update");
                            param.setInQty(items.getQty());
                        param.setInQty(stockItem.getAnfme());
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_RETURN_ORDER.type)) {
                            //生产领料
                            params.setOrderType("WO_Outstock").setAction("Update");
                            param.setOutQty(items.getQty());
                        param.setOutQty(stockItem.getAnfme());
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_PROD_ADDITION.type)) {
                            //生产补料
                            params.setOrderType("WR_Instock_BL").setAction("Update");
                            param.setOutQty(items.getQty());
                        param.setOutQty(stockItem.getAnfme());
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_FIX_OUT.type)) {
                            params.setOrderType("WO_Outstock_WR").setAction("Update");
                            param.setOutQty(items.getQty());
                        param.setOutQty(stockItem.getAnfme());
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_OTHER_IN.type)) {
                            //其它入库单/手动入库单
                            params.setOrderType("In_Instock").setAction("Update");
                            param.setInQty(items.getQty());
                        param.setInQty(stockItem.getAnfme());
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_OTHER.type)) {
                            //其它出库单/手动出库单
                            params.setOrderType("Io_Outstock").setAction("Update");
                            param.setOutQty(items.getQty());
                        param.setOutQty(stockItem.getAnfme());
                        }
                        dataParams.add(param);
@@ -469,7 +459,6 @@
                        } catch (InterruptedException e) {
                            throw new RuntimeException(e);
                        }
                    });
                });
            }
        });
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
@@ -611,19 +611,30 @@
                if (wkOrders.isEmpty()) {
                    throw new CoolException("单据不存在!!");
                }
                Config allowChang = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.ALLOW_OVER_CHANGE));
                wkOrders.forEach(order -> {
                    //检查单据是否完成
                    //判断是否允许超收,不允许超收添加拒收判断
                    if (!Objects.isNull(allowChang)) {
                        if (!Boolean.parseBoolean(allowChang.getVal())) {
                    if (order.getAnfme().compareTo(order.getQty()) == 0) {
                        order.setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_DONE.val);
//                        if (order.getType().equals(OrderType.ORDER_IN)) {
//                            order.setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_TASK_DONE.val);
//                        } else {
//                            order.setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_DONE.val);
//                        }
                        if (!asnOrderService.updateById(order)) {
                            throw new CoolException("出库单更新状态失败");
                        }
                    }
                        } else {
                            if (order.getAnfme().compareTo(order.getQty()) <= 0) {
                                order.setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_DONE.val);
                                if (!asnOrderService.updateById(order)) {
                                    throw new CoolException("出库单更新状态失败");
                                }
                            }
                        }
                    }
                    //检查单据是否完成
                });
                //出库单上报RCS修改库位状态
                try {
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -737,10 +737,10 @@
            LocItemWorking locWorking = locItemWorkingService.getOne(new LambdaQueryWrapper<LocItemWorking>()
                    .eq(LocItemWorking::getTaskId, taskItem.getTaskId())
                    .eq(LocItemWorking::getFieldsIndex, taskItem.getFieldsIndex())
                    .eq(StringUtils.isNotBlank(taskItem.getBatch()), LocItemWorking::getBatch, taskItem.getBatch())
                    .eq(StringUtils.isNotEmpty(taskItem.getBatch()), LocItemWorking::getBatch, taskItem.getBatch())
                    .eq(LocItemWorking::getMatnrId, taskItem.getMatnrId()));
            if (Objects.isNull(locWorking)) {
                throw new CoolException("数据错误,作业中库存数据丢失!!");
               continue;
            }
            if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) {
                locWorking.setAnfme(taskItem.getAnfme());
@@ -1048,12 +1048,12 @@
        tempLocs.forEach(working -> {
            taskItems.forEach(taskItem -> {
                if (taskItem.getId().equals(working.getMatnrId()) && taskItem.getFieldsIndex().equals(working.getFieldsIndex())) {
                if (taskItem.getFieldsIndex().equals(working.getFieldsIndex())) {
                    Double minQty = taskItem.getAnfme();
                    if (!task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) {
                        minQty = Math.round((working.getAnfme() - taskItem.getAnfme()) * 100) / 100.0;
                        minQty = Math.round((working.getAnfme() - taskItem.getQty()) * 100) / 100.0;
                    }
                    if (minQty.compareTo(0.0) > 0) {
                    if (minQty.compareTo(0.0) >= 0) {
                        taskItem.setAnfme(minQty);
                        if (!taskItemService.updateById(taskItem)) {
                            throw new CoolException("任务明细修改失败!!");
@@ -1104,6 +1104,7 @@
                LocItemWorking itemWorking = new LocItemWorking();
                BeanUtils.copyProperties(taskItem, itemWorking);
                itemWorking.setTaskId(task.getId())
                        .setQty(0.0)
                        .setLocId(loc1.getId())
                        .setLocCode(loc1.getCode());
                workings.add(itemWorking);