| | |
| | | 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.utils.SerialRuleUtils; |
| | | import com.vincent.rsf.server.system.utils.SystemAuthUtils; |
| | | import lombok.Synchronized; |
| | |
| | | } 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); |
| | | complateOutStock2(task, loginUserId); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) { |
| | | //103.拣选 |
| | | // pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_PICK); |
| | | 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)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | 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) { |
| | | taskItem.setAnfme(minQty); |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public synchronized void complateInstock(Task task, Long loginUserId) { |
| | | if (Objects.isNull(task)) { |
| | | if (Objects.isNull(task) |
| | | ||task.getId().equals(5614L/*临时跳过*/) |
| | | ) { |
| | | return; |
| | | } |
| | | |