| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void complateInTask(List<Task> tasks) throws Exception { |
| | | public void complateInTask(List<Task> tasks) { |
| | | AtomicBoolean success = new AtomicBoolean(false); |
| | | if (success.compareAndSet(false, true)) { |
| | | Long loginUserId = SystemAuthUtils.getLoginUserId(); |
| | | for (Task task : tasks) { |
| | | try { |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)) { |
| | | //1.入库 |
| | | complateInstock(task, loginUserId); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { |
| | | //53.拣料再入库 |
| | | //57.盘点再入库 |
| | | pickComplateInStock(task, loginUserId); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | //移库 |
| | | moveInStock(task, loginUserId); |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)) { |
| | | //1.入库 |
| | | complateInstock(task, loginUserId); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { |
| | | //53.拣料再入库 |
| | | //57.盘点再入库 |
| | | pickComplateInStock(task, loginUserId); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) { |
| | | //移库 |
| | | moveInStock(task, loginUserId); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (taskItems.isEmpty()) { |
| | | throw new CoolException("任务明细不存在!!"); |
| | | } |
| | | try { |
| | | //更新库位明细 |
| | | saveLocItem(taskItems, task.getId(), loginUserId); |
| | | } catch (Exception e) { |
| | | throw new CoolException("库位明细更新失败!!"); |
| | | } |
| | | |
| | | //更新库位明细 |
| | | saveLocItem(taskItems, task.getId(), loginUserId); |
| | | |
| | | /**对任务明细按组拖明细进行分组*/ |
| | | Map<Long, List<TaskItem>> orderMap = taskItems.stream().collect(Collectors.groupingBy(TaskItem::getSource)); |
| | |
| | | throw new CoolException("数据错误:组拖数据不存在,请联系管理员!!"); |
| | | } |
| | | List<TaskItem> items = orderMap.get(key); |
| | | try { |
| | | //保存库存明细 |
| | | saveStockItems(items, task, pakinItem.getId(), pakinItem.getAsnCode(), pakinItem.getWkType(), pakinItem.getType(), loginUserId); |
| | | //移出收货区库存, 修改组托状态 |
| | | removeReceiptStock(pakinItem, loginUserId); |
| | | } catch (Exception e) { |
| | | logger.error("<UNK>", e); |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | //保存入出库明细 |
| | | saveStockItems(items, task, pakinItem.getId(), pakinItem.getAsnCode(), pakinItem.getWkType(), pakinItem.getType(), loginUserId); |
| | | //移出收货区库存, 修改组托状态 |
| | | removeReceiptStock(pakinItem, loginUserId); |
| | | }); |
| | | /**修改库位状态为F.在库*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>().set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type).eq(Loc::getCode, task.getTargLoc()))) { |
| | |
| | | throw new CoolException("库位明细更新失败!!"); |
| | | } |
| | | } else { |
| | | throw new CoolException("当前票号已在库内,请检查后再操作!!"); |
| | | logger.error("当前票号:" + locItem.getFieldsIndex() + " 已在库内,请检查后再操作!!"); |
| | | // throw new CoolException("当前票号已在库内,请检查后再操作!!"); |
| | | // locItem.setAnfme(Math.round((locItem.getAnfme() + taskItem.getAnfme()) * 1000000) / 1000000.0) |
| | | // .setUpdateTime(new Date()); |
| | | // if (!locItemService.saveOrUpdate(locItem)) { |