| | |
| | | import com.fasterxml.jackson.databind.cfg.CoercionAction; |
| | | import com.fasterxml.jackson.databind.cfg.CoercionInputShape; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.DateUtils; |
| | | import com.vincent.rsf.server.api.config.RemotesInfoProperties; |
| | | import com.vincent.rsf.server.api.controller.erp.params.TaskInParam; |
| | | import com.vincent.rsf.server.api.entity.CommonResponse; |
| | |
| | | import com.vincent.rsf.server.manager.enums.LocStsType; |
| | | import com.vincent.rsf.server.system.entity.Config; |
| | | import com.vincent.rsf.server.system.service.ConfigService; |
| | | import com.vincent.rsf.server.system.service.impl.ConfigServiceImpl; |
| | | import com.vincent.rsf.server.system.entity.FlowStepInstance; |
| | | import com.vincent.rsf.server.system.service.FlowStepInstanceService; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import com.vincent.rsf.server.system.utils.SystemAuthUtils; |
| | | import lombok.Synchronized; |
| | |
| | | private RestTemplate restTemplate; |
| | | @Autowired |
| | | private RemotesInfoProperties.RcsApi rcsApi; |
| | | @Autowired |
| | | private FlowStepInstanceService flowStepInstanceService; |
| | | @Autowired |
| | | private RemotesInfoProperties.WmsOpenApi wmsOpenApi; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | if (Objects.isNull(station) || !station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | throw new CoolException("站点不存在或站点不处于空库状态!!"); |
| | | } |
| | | station.setUseStatus(LocStsType.LOC_STS_TYPE_R.type); |
| | | if (!station.getType().equals(0)){ |
| | | station.setUseStatus(LocStsType.LOC_STS_TYPE_R.type); |
| | | } |
| | | |
| | | if (!basStationService.updateById(station)) { |
| | | throw new CoolException("站点状态更新失败!!"); |
| | |
| | | throw new CoolException("站点状态不为空闲"); |
| | | } |
| | | |
| | | List<Long> areaList = basStation.getCrossZoneArea(); |
| | | if (!areaList.contains(Long.parseLong(area))) { |
| | | if (!basStation.getCrossZoneArea().contains(Integer.parseInt(area))) { |
| | | throw new CoolException("当前站点不支持目标库区"); |
| | | } |
| | | if (!Cools.isEmpty(basStation.getContainerType())) { |
| | | List<Long> longs1 = basStation.getContainerType(); |
| | | List<Long> longs1 = basStation.getContainerType().stream() |
| | | .map(Integer::longValue) |
| | | .collect(Collectors.toList()); |
| | | List<BasContainer> containers = basContainerService.list( |
| | | new LambdaQueryWrapper<BasContainer>() |
| | | .in(BasContainer::getContainerType, longs1) |
| | |
| | | throw new CoolException("站点状态不为空闲"); |
| | | } |
| | | if (!Cools.isEmpty(basStation.getContainerType())) { |
| | | List<Long> longs1 = basStation.getContainerType(); |
| | | List<Long> longs1 = basStation.getContainerType().stream() |
| | | .map(Integer::longValue) |
| | | .collect(Collectors.toList()); |
| | | List<BasContainer> containers = basContainerService.list( |
| | | new LambdaQueryWrapper<BasContainer>() |
| | | .in(BasContainer::getContainerType, longs1) |
| | |
| | | } |
| | | warehouseAreasList.add(warehouseArea); |
| | | } else { |
| | | List<Long> areaList = basStation.getCrossZoneArea(); |
| | | List<Long> areaList = basStation.getCrossZoneArea().stream() |
| | | .map(Integer::longValue) |
| | | .collect(Collectors.toList()); |
| | | if (areaList.isEmpty()) { |
| | | throw new CoolException("当前站点库区未配置"); |
| | | } |
| | |
| | | //移库 |
| | | moveInStock(task, loginUserId); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_EMPTY_IN.type)) { |
| | | //移库 |
| | | //空板入库 |
| | | complateInstockE(task, loginUserId); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CROSS_DOCKING_OUT.type)) { |
| | | //越库 |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Task operateComplete(Long id, Long loginUserId) { |
| | | List<Integer> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); |
| | | Task task = taskService.getOne(new LambdaQueryWrapper<Task>() |
| | | .eq(Task::getId, id) |
| | | .in(Task::getTaskStatus, longs)); |
| | | |
| | | Task task = getById(id); |
| | | if (Objects.isNull(task)) { |
| | | throw new CoolException("数据错误:当前任务不可执行完结操作!!"); |
| | | throw new CoolException("数据错误:任务不存在!!"); |
| | | } |
| | | |
| | | if (task.getTaskStatus() != null && TERMINAL_OR_WAITING_STATUS.contains(task.getTaskStatus())) { |
| | | throw new CoolException("任务已处于终态或等待库存更新,无需完结"); |
| | | } |
| | | List<FlowStepInstance> steps = flowStepInstanceService.list( |
| | | new LambdaQueryWrapper<FlowStepInstance>() |
| | | .eq(FlowStepInstance::getTaskNo, task.getTaskCode()) |
| | | .orderByAsc(FlowStepInstance::getStepOrder)); |
| | | int maxCompletedOrder = steps.stream() |
| | | .filter(s -> s.getStepOrder() != null && s.getStatus() != null && s.getStatus() == 3) |
| | | .mapToInt(FlowStepInstance::getStepOrder) |
| | | .max().orElse(-1); |
| | | for (FlowStepInstance step : steps) { |
| | | if (step.getStepOrder() != null && step.getStepOrder() > maxCompletedOrder) { |
| | | step.setStatus((short) 5); |
| | | flowStepInstanceService.updateById(step); |
| | | } |
| | | } |
| | | modiftyTaskSort(task, loginUserId); |
| | | // |
| | | // if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | // task.setTaskStatus(TaskStsType.COMPLETE_OUT.id); |
| | | // } else { |
| | | task.setTaskStatus(task.getTaskType() < 100 ? TaskStsType.COMPLETE_IN.id : task.getTaskType()==101? TaskStsType.COMPLETE_OUT.id:TaskStsType.AWAIT.id); |
| | | // } |
| | | if (!this.updateById(task)) { |
| | | throw new CoolException("完成任务失败"); |
| | | applyTransferEndStatus(task); |
| | | // applyTransferEndStatus 未匹配到的任务类型(未置为 98/196/198/9999)时兜底置终态 |
| | | if (task.getTaskStatus() == null || (!task.getTaskStatus().equals(TaskStsType.COMPLETE_IN.id) |
| | | && !task.getTaskStatus().equals(TaskStsType.AWAIT.id) |
| | | && !task.getTaskStatus().equals(TaskStsType.COMPLETE_OUT.id) |
| | | && !task.getTaskStatus().equals(TaskStsType.MISSION_TRANSFER.id))) { |
| | | task.setTaskStatus(task.getTaskType() != null && task.getTaskType() < 100 |
| | | ? TaskStsType.COMPLETE_IN.id |
| | | : Integer.valueOf(101).equals(task.getTaskType()) ? TaskStsType.COMPLETE_OUT.id : TaskStsType.AWAIT.id); |
| | | updateById(task); |
| | | } |
| | | return task; |
| | | } |
| | | @Override |
| | | public void applyTransferEndStatus(Task task) { |
| | | if (TaskType.TASK_TYPE_IN.type.equals(task.getTaskType()) |
| | | || TaskType.TASK_TYPE_PICK_IN.type.equals(task.getTaskType()) |
| | | || TaskType.TASK_TYPE_CHECK_IN.type.equals(task.getTaskType()) |
| | | || TaskType.TASK_TYPE_EMPTY_IN.type.equals(task.getTaskType()) |
| | | || TaskType.TASK_TYPE_MERGE_IN.type.equals(task.getTaskType()) |
| | | || TaskType.TASK_TYPE_LOC_MOVE.type.equals(task.getTaskType()) |
| | | || TaskType.TASK_TYPE_OUT.type.equals(task.getTaskType()) |
| | | || TaskType.TASK_TYPE_PICK_AGAIN_OUT.type.equals(task.getTaskType()) |
| | | || TaskType.TASK_TYPE_MERGE_OUT.type.equals(task.getTaskType()) |
| | | || TaskType.TASK_TYPE_CHECK_OUT.type.equals(task.getTaskType()) |
| | | || TaskType.TASK_TYPE_CROSS_DOCKING_OUT.type.equals(task.getTaskType()) |
| | | || TaskType.TASK_TYPE_EMPTY_OUT.type.equals(task.getTaskType())) { |
| | | task.setTaskStatus(TaskStsType.MISSION_TRANSFER.id); |
| | | } else { |
| | | return; |
| | | } |
| | | updateById(task); |
| | | } |
| | | |
| | | /** 终态或等待定时任务更新库存的状态、9999,不展示完结按钮 */ |
| | | private static final Set<Integer> TERMINAL_OR_WAITING_STATUS = new HashSet<>(Arrays.asList( |
| | | TaskStsType.COMPLETE_IN.id, TaskStsType.REPORT_IN.id, TaskStsType.UPDATED_IN.id, |
| | | TaskStsType.COMPLETE_OUT.id, TaskStsType.WAVE_SEED.id, TaskStsType.UPDATED_OUT.id, |
| | | TaskStsType.MISSION_TRANSFER.id, TaskStsType.MISSION_TRANSFER_END.id)); |
| | | |
| | | /** 终态/9999 无按钮;状态在步骤中找不到或无下一步(最后一步)则无完结按钮 */ |
| | | @Override |
| | | public void fillCanComplete(List<Task> tasks) { |
| | | if (tasks == null || tasks.isEmpty()) { |
| | | return; |
| | | } |
| | | Set<Integer> terminalSet = TERMINAL_OR_WAITING_STATUS; |
| | | List<String> codes = tasks.stream().map(Task::getTaskCode).filter(Objects::nonNull).distinct().collect(Collectors.toList()); |
| | | if (codes.isEmpty()) { |
| | | tasks.forEach(t -> t.setCanComplete(Boolean.FALSE)); |
| | | return; |
| | | } |
| | | List<FlowStepInstance> steps = codes.size() == 1 |
| | | ? flowStepInstanceService.list(new LambdaQueryWrapper<FlowStepInstance>().eq(FlowStepInstance::getTaskNo, codes.get(0)).orderByAsc(FlowStepInstance::getStepOrder)) |
| | | : flowStepInstanceService.list(new LambdaQueryWrapper<FlowStepInstance>().in(FlowStepInstance::getTaskNo, codes).orderByAsc(FlowStepInstance::getStepOrder)); |
| | | Map<String, List<FlowStepInstance>> stepsByTaskNo = steps.stream().collect(Collectors.groupingBy(FlowStepInstance::getTaskNo)); |
| | | for (Task task : tasks) { |
| | | if (task.getTaskStatus() != null && terminalSet.contains(task.getTaskStatus())) { |
| | | task.setCanComplete(Boolean.FALSE); |
| | | continue; |
| | | } |
| | | List<FlowStepInstance> taskSteps = stepsByTaskNo.get(task.getTaskCode()); |
| | | if (taskSteps == null || taskSteps.isEmpty()) { |
| | | task.setCanComplete(Boolean.FALSE); |
| | | continue; |
| | | } |
| | | FlowStepInstance match = taskSteps.stream() |
| | | .filter(s -> s.getWmsNowTaskStatus() != null && s.getWmsNowTaskStatus().equals(task.getTaskStatus())) |
| | | .findFirst().orElse(null); |
| | | if (match == null) { |
| | | task.setCanComplete(Boolean.FALSE); |
| | | continue; |
| | | } |
| | | boolean isLastStep = match.getWmsNextTaskStatus() == null || match.getWmsNextTaskStatus().equals(TaskStsType.MISSION_TRANSFER.id); |
| | | task.setCanComplete(!isLastStep); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId())); |
| | | |
| | | String type = LocStsType.LOC_STS_TYPE_F.type; |
| | | if (!taskItems.isEmpty()) { |
| | | //移库有可能是空板 |
| | | try { |
| | |
| | | if (!locItemService.remove(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocCode, task.getOrgLoc()))) { |
| | | throw new CoolException("源库位明细删除失败!"); |
| | | } |
| | | } else { |
| | | type = LocStsType.LOC_STS_TYPE_D.type; |
| | | } |
| | | |
| | | /**修改库位状态为F.在库*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .set(Loc::getBarcode, task.getBarcode()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type) |
| | | .set(Loc::getUseStatus, type) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .eq(Loc::getCode, task.getTargLoc()))) { |
| | |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CROSS_DOCKING_OUT.type)) { |
| | | //109.备货 |
| | | complateOutStockDocking(task, loginUserId); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) { |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) { |
| | | //107.盘 |
| | | pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_CHECK); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) { |
| | | //103.拣选 |
| | | pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_PICK); |
| | | // pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_CHECK); |
| | | complateOutStock2(task, loginUserId); |
| | | // } else if () { |
| | | // //103.拣选 |
| | | //// pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_PICK); |
| | | // complateOutStock2(task, loginUserId); |
| | | } else { |
| | | complateOutStock(task, loginUserId); |
| | | } |
| | |
| | | .eq(LocItemWorking::getTaskId, taskItem.getTaskId()) |
| | | .eq(LocItemWorking::getFieldsIndex, taskItem.getFieldsIndex()) |
| | | .eq(StringUtils.isNotEmpty(taskItem.getBatch()), LocItemWorking::getBatch, taskItem.getBatch()) |
| | | .eq(LocItemWorking::getMatnrId, taskItem.getMatnrId())); |
| | | .eq(LocItemWorking::getMatnrId, taskItem.getMatnrId()).last("limit 1")); |
| | | if (Objects.isNull(locWorking)) { |
| | | continue; |
| | | } |
| | |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | // 盘点再入库任务结束:将关联的盘点差异单置为已审核 |
| | | if (TaskType.TASK_TYPE_CHECK_IN.type.equals(task.getTaskType())) { |
| | | markCheckDiffApprovedWhenCheckInDone(task); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 盘点再入库完成后,将关联的盘点差异单置为已审核(有单按 orderId,无单按 出库任务号 orderCode) |
| | | */ |
| | | @Override |
| | | public void markCheckDiffApprovedWhenCheckInDone(Task checkInTask) { |
| | | List<TaskItem> items = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, checkInTask.getId()).last("limit 1")); |
| | | Long orderId = items.isEmpty() ? null : items.get(0).getOrderId(); |
| | | CheckDiff checkDiff = null; |
| | | if (orderId != null && !orderId.equals(0L)) { |
| | | checkDiff = checkDiffService.getOne(new LambdaQueryWrapper<CheckDiff>().eq(CheckDiff::getOrderId, orderId).last("limit 1")); |
| | | } else { |
| | | Task outTask = taskService.getOne(new LambdaQueryWrapper<Task>() |
| | | .eq(Task::getBarcode, checkInTask.getBarcode()) |
| | | .eq(Task::getTaskType, TaskType.TASK_TYPE_CHECK_OUT.type) |
| | | .last("limit 1")); |
| | | if (outTask != null) { |
| | | checkDiff = checkDiffService.getOne(new LambdaQueryWrapper<CheckDiff>() |
| | | .eq(CheckDiff::getOrderCode, outTask.getTaskCode()) |
| | | .and(w -> w.isNull(CheckDiff::getOrderId).or().eq(CheckDiff::getOrderId, 0)) |
| | | .last("limit 1")); |
| | | } |
| | | } |
| | | if (checkDiff != null && !CheckDiffExceStatus.CHECK_DIFF_EXCE_STATUS_END.val.equals(checkDiff.getExceStatus())) { |
| | | checkDiffService.update(new LambdaUpdateWrapper<CheckDiff>() |
| | | .eq(CheckDiff::getId, checkDiff.getId()) |
| | | .set(CheckDiff::getExceStatus, CheckDiffExceStatus.CHECK_DIFF_EXCE_STATUS_END.val)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | if (null == basStation) { |
| | | throw new CoolException("站点状态错误!!"); |
| | | } |
| | | basStation.setUseStatus(LocStsType.LOC_STS_TYPE_F.type); |
| | | if (!basStation.getType().equals(0)){ |
| | | basStation.setUseStatus(LocStsType.LOC_STS_TYPE_F.type); |
| | | } |
| | | if (!basStationService.updateById(basStation)) { |
| | | throw new CoolException("更新站点状态失败!!"); |
| | | } |
| | |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getCode, task.getOrgLoc())); |
| | | if (Objects.isNull(loc)) { |
| | | throw new CoolException("没有空库位!!"); |
| | | throw new CoolException("源库位不存在!!"); |
| | | } |
| | | |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, task); |
| | |
| | | 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.getQty()) * 1000000) / 1000000.0; |
| | | minQty = Math.round((working.getAnfme() - taskItem.getAnfme()) * 1000000) / 1000000.0; |
| | | } |
| | | if (minQty.compareTo(0.0) >= 0) { |
| | | if (!minQty.equals(0D) && minQty>0D) { |
| | | taskItem.setAnfme(minQty); |
| | | if (!taskItemService.updateById(taskItem)) { |
| | | throw new CoolException("任务明细修改失败!!"); |
| | |
| | | throw new CoolException("库位预约入库失败!!"); |
| | | } |
| | | return task; |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/5/20 |
| | | * @description: 完成出库任务,更新出库库存信息 |
| | | * @version 1.0 |
| | | */ |
| | | @Synchronized |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void complateOutStock2(Task task, Long loginUserId) throws Exception { |
| | | if (Objects.isNull(task)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getOrgLoc())); |
| | | if (Objects.isNull(loc)) { |
| | | throw new CoolException("库位不存在!!"); |
| | | } |
| | | if (!loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) { |
| | | throw new CoolException("库位状态不处理于R.出库预约!!"); |
| | | } |
| | | |
| | | List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId())); |
| | | if (taskItems.isEmpty()) { |
| | | throw new CoolException("任务明细不存在!!"); |
| | | } |
| | | |
| | | List<LocItem> locItems = locItemService.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocId, loc.getId())); |
| | | if (locItems.isEmpty()) { |
| | | throw new CoolException("库位明细不存在!!"); |
| | | } |
| | | |
| | | // List<LocItemWorking> workings = new ArrayList<>(); |
| | | // for (LocItem item : locItems) { |
| | | // LocItemWorking working = new LocItemWorking(); |
| | | // BeanUtils.copyProperties(item, working); |
| | | // working.setId(null) |
| | | // .setTaskId(task.getId()) |
| | | // .setLocItemId(item.getId()) |
| | | // .setUpdateBy(loginUserId) |
| | | // .setUpdateTime(new Date()); |
| | | // workings.add(working); |
| | | // } |
| | | // |
| | | // if (!locItemWorkingService.saveBatch(workings)) { |
| | | // throw new CoolException("临时库存保存失败!!"); |
| | | // } |
| | | |
| | | try { |
| | | //更新库位明细 |
| | | subtractLocItem(loc); |
| | | } catch (Exception e) { |
| | | logger.error("<UNK>", e); |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | |
| | | //添加出入库记录信息 |
| | | Map<Short, List<TaskItem>> listMap = taskItems.stream().collect(Collectors.groupingBy(TaskItem::getWkType)); |
| | | /***获取库存出库值,如果为空表示正常单据出库,非空表明是库存出库 |
| | | * 1. 库存出库没有单据信息,单据信息默认为空 |
| | | * 2. 单据库存需通过波次查询原始单据信息,将单据信息填入stock中 |
| | | * */ |
| | | List<TaskItem> list = listMap.get(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type)); |
| | | if (Objects.isNull(list) || list.isEmpty()) { |
| | | Map<Long, List<TaskItem>> maps = taskItems.stream().collect(Collectors.groupingBy(TaskItem::getSource)); |
| | | maps.keySet().forEach(key -> { |
| | | if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_WAVE_TYPE.val)) { |
| | | WaveItem waveItem = waveItemService.getById(key); |
| | | if (Objects.isNull(waveItem)) { |
| | | throw new CoolException("波次明细不存在!!"); |
| | | } |
| | | // try { |
| | | // saveOutStockItem(maps.get(key), null, waveItem, null, loginUserId); |
| | | // } catch (Exception e) { |
| | | // throw new CoolException(e.getMessage()); |
| | | // } |
| | | } else if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_ORDER_TYPE.val)) { |
| | | WkOrderItem orderItem = asnOrderItemService.getById(key); |
| | | if (Objects.isNull(orderItem)) { |
| | | throw new CoolException("单据明细不存在!!"); |
| | | } |
| | | try { |
| | | saveOutStockItem(maps.get(key), orderItem, loginUserId); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | } else if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_CHECK_TYPE.val)) { |
| | | WkOrderItem orderItem = asnOrderItemService.getById(key); |
| | | if (Objects.isNull(orderItem)) { |
| | | throw new CoolException("单据明细不存在!!"); |
| | | } |
| | | try { |
| | | saveOutStockItem(maps.get(key), null, null, orderItem, loginUserId); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | } else { |
| | | |
| | | } |
| | | }); |
| | | } else { |
| | | try { |
| | | saveOutStockItem(taskItems, null, null, null, loginUserId); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /**修改为库位状态为O.空库*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | .set(Loc::getBarcode, null) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .eq(Loc::getId, loc.getId()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | |
| | | if (!this.update(new LambdaUpdateWrapper<Task>() |
| | | .eq(Task::getId, task.getId()) |
| | | .set(Task::getUpdateBy, loginUserId) |
| | | .set(Task::getUpdateTime, new Date()) |
| | | .set(Task::getTaskStatus, TaskStsType.WAVE_SEED.id))) { |
| | | throw new CoolException("库存状态更新失败!!"); |
| | | } |
| | | |
| | | // if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) { |
| | | // if (!this.update(new LambdaUpdateWrapper<Task>() |
| | | // .eq(Task::getId, task.getId()) |
| | | // .set(Task::getUpdateBy, loginUserId) |
| | | // .set(Task::getUpdateTime, new Date()) |
| | | // .set(Task::getTaskStatus, TaskStsType.WAVE_SEED.id))) { |
| | | // throw new CoolException("库存状态更新失败!!"); |
| | | // } |
| | | // } else { |
| | | // if (!this.update(new LambdaUpdateWrapper<Task>() |
| | | // .eq(Task::getId, task.getId()) |
| | | // .set(Task::getUpdateBy, loginUserId) |
| | | // .set(Task::getUpdateTime, new Date()) |
| | | // .set(Task::getTaskStatus, TaskStsType.WAVE_SEED.id))) { |
| | | // throw new CoolException("库存状态更新失败!!"); |
| | | // } |
| | | //// //全板出库,删除临时库存 |
| | | //// if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) { |
| | | //// throw new CoolException("临时库存清除失败!!"); |
| | | //// } |
| | | // } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | /**判断是否光电站点,非光店站点需管控站点状态*/ |
| | | if (!Objects.isNull(station) && station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) { |
| | | if (task.getTaskType() <= TaskType.TASK_TYPE_CHECK_IN.type && !task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | station.setUseStatus(LocStsType.LOC_STS_TYPE_R.type); |
| | | if (!station.getType().equals(0)){ |
| | | station.setUseStatus(LocStsType.LOC_STS_TYPE_R.type); |
| | | } |
| | | if (!basStationService.updateById(station)) { |
| | | throw new CoolException("站点状态更新失败!!"); |
| | | } |
| | | } else if (task.getTaskType() >= TaskType.TASK_TYPE_OUT.type) { |
| | | station.setUseStatus(LocStsType.LOC_STS_TYPE_S.type); |
| | | if (!station.getType().equals(0)){ |
| | | station.setUseStatus(LocStsType.LOC_STS_TYPE_S.type); |
| | | } |
| | | if (!basStationService.updateById(station)) { |
| | | throw new CoolException("站点状态更新失败!!"); |
| | | } |