| | |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.asrs.entity.*; |
| | | import com.zy.asrs.wms.asrs.entity.enums.LocStsType; |
| | | import com.zy.asrs.wms.asrs.entity.enums.TaskStsType; |
| | | import com.zy.asrs.wms.asrs.service.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | |
| | | InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build()); |
| | | try { |
| | | //获取入库完成任务 |
| | | List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, 99)); |
| | | List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.COMPLETE_IN.id)); |
| | | if (list.isEmpty()) { |
| | | return; |
| | | } |
| | |
| | | throw new CoolException("未知任务类型"); |
| | | } |
| | | |
| | | task.setTaskSts(100L);//100.库存更新完成 |
| | | task.setTaskSts(TaskStsType.UPDATED_IN.id);//100.库存更新完成 |
| | | task.setUpdateTime(new Date()); |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("库存更新失败"); |
| | |
| | | InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build()); |
| | | try { |
| | | //获取出库完成任务 |
| | | List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, 199)); |
| | | List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.COMPLETE_OUT.id)); |
| | | if (list.isEmpty()) { |
| | | return; |
| | | } |
| | |
| | | throw new CoolException("未知任务类型"); |
| | | } |
| | | |
| | | task.setTaskSts(200L);//200.库存更新完成 |
| | | task.setTaskSts(TaskStsType.UPDATED_OUT.id);//200.库存更新完成 |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("库存更新失败"); |
| | | } |
| | |
| | | |
| | | //添加库存明细 |
| | | for (TaskDetl taskDetl : taskDetls) { |
| | | double anfme = taskDetl.getStock() - taskDetl.getAnfme(); |
| | | if (anfme <= 0) { |
| | | continue; |
| | | } |
| | | |
| | | LocDetl locDetl = new LocDetl(); |
| | | locDetl.setLocId(loc.getId()); |
| | | locDetl.setLocNo(loc.getLocNo()); |
| | |
| | | locDetl.setMatnr(taskDetl.getMat$().getMatnr()); |
| | | locDetl.setOrderNo(taskDetl.getOrderNo()); |
| | | locDetl.setBatch(taskDetl.getBatch()); |
| | | locDetl.setAnfme(taskDetl.getStock() - taskDetl.getAnfme()); |
| | | locDetl.setAnfme(anfme); |
| | | locDetl.setHostId(hostId); |
| | | if (!locDetlService.save(locDetl)) { |
| | | throw new CoolException("插入库存明细失败"); |