skyouc
6 天以前 1aa6e5963e5c4eca765924e9b2b094e6e2c525b3
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -79,6 +79,10 @@
    private LocItemWorkingService locItemWorkingService;
    @Autowired
    private WcsService wcsService;
    @Autowired
    private OutStockService outStockService;
    @Autowired
    private OutStockItemService outStockItemService;
    @Override
    @Transactional(rollbackFor = Exception.class)
@@ -519,6 +523,7 @@
    /**
     * 任务完成后,判断深库位是否为空,如果为空生成移库任务
     *
     * @param loginUserId
     * @param curLoc
     */
@@ -785,9 +790,7 @@
            if (!taskItems.isEmpty()) {
                for (TaskItem item : taskItems) {
                    if (item.getOrderType().equals(OrderType.ORDER_OUT.type)) {
                        //出库
                        if (item.getWkType().equals(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type))) {
                            //库存出库
                            Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getId, item.getSourceId()));
                            if (Objects.isNull(loc)) {
                                throw new CoolException("数据错误:库位信息不存在!!");
@@ -797,6 +800,39 @@
                            if (!locService.updateById(loc)) {
                                throw new CoolException("库位信息修改失败!!");
                            }
                        //出库
                        if (item.getWkType().equals(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type))) {
                            //库存出库
                        } else if (item.getWkType().equals(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_OTHER.type))) {
                            //其它出库
                        } else {
                            //出库单出库
                            AsnOrder asnOrder = outStockService.getById(item.getSourceId());
                            if (Objects.isNull(asnOrder)) {
                                throw new CoolException("数据错误:单据已不存在!!");
                            }
                            Double workQty = Math.round((asnOrder.getWorkQty() - item.getAnfme()) * 10000) / 10000.0;
                            asnOrder.setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_INIT.val)
                                    .setWorkQty(workQty.compareTo(0.00) > 0 ? workQty : 0.00 )
                                    .setUpdateBy(loginUserId)
                                    .setUpdateTime(new Date());
                            if (!outStockService.updateById(asnOrder)) {
                                throw new CoolException("原单据状态修改失败!!");
                            }
                            AsnOrderItem orderItem = outStockItemService.getById(item.getSource());
                            if (Objects.isNull(orderItem)) {
                                throw new CoolException("数据错误:单据明细已不存在!!");
                            }
                            Double workItmQty = Math.round((orderItem.getWorkQty() - item.getAnfme()) * 10000) / 10000.0;
                            orderItem.setWorkQty(workItmQty);
                            if (!outStockItemService.updateById(orderItem)) {
                                throw new CoolException("原单据明细修改失败!!");
                            }
                        }
                    } else {
                        //入库