| | |
| | | import com.vincent.rsf.server.manager.service.impl.LocItemWorkingServiceImpl; |
| | | import com.vincent.rsf.server.manager.service.impl.StockItemServiceImpl; |
| | | import com.vincent.rsf.server.manager.service.impl.StockServiceImpl; |
| | | import com.vincent.rsf.server.system.constant.GlobalConfigCode; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.entity.Config; |
| | | import com.vincent.rsf.server.system.entity.Fields; |
| | | import com.vincent.rsf.server.system.entity.FieldsItem; |
| | | import com.vincent.rsf.server.system.service.FieldsItemService; |
| | | import com.vincent.rsf.server.system.service.FieldsService; |
| | | import com.vincent.rsf.server.system.service.impl.ConfigServiceImpl; |
| | | import com.vincent.rsf.server.system.service.impl.FieldsItemServiceImpl; |
| | | import com.vincent.rsf.server.system.service.impl.FieldsServiceImpl; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | |
| | | private LocItemService locItemService; |
| | | @Autowired |
| | | private LocItemWorkingService locItemWorkingService; |
| | | @Autowired |
| | | private ConfigServiceImpl configService; |
| | | |
| | | @Override |
| | | public R getOutStockTaskItem(String barcode) { |
| | |
| | | if (Objects.isNull(orderItem)) { |
| | | throw new CoolException("数据错误,拣料不在单据需求中!!"); |
| | | } |
| | | |
| | | Double summed = items.stream().mapToDouble(TaskItem::getAnfme).sum(); |
| | | //加上历史拣料数量 |
| | | Double pickQty = Math.round((orderItem.getQty() + summed) * 100) / 100.0; |
| | | if (pickQty.compareTo(orderItem.getAnfme()) > 0.0) { |
| | | throw new CoolException("播种数量不能超出订单需求数量"); |
| | | Config config = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.ALLOW_OVER_CHANGE)); |
| | | //判断是否允许超收,不允许超收添加拒收判断 |
| | | if (!Objects.isNull(config)) { |
| | | if (!Boolean.parseBoolean(config.getVal())) { |
| | | if (pickQty.compareTo(orderItem.getAnfme()) > 0.0) { |
| | | throw new CoolException("播种数量不能超出订单需求数量"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | orderItem.setQty(pickQty); |
| | | |
| | | if (!asnOrderItemService.updateById(orderItem)) { |
| | |
| | | |
| | | List<StockItem> stockItems = new ArrayList<>(); |
| | | items.forEach(taskItem -> { |
| | | taskItem.setQty(taskItem.getAnfme()).setOrderId(order.getId()).setOrderItemId(orderItem.getId()); |
| | | if (!taskItemService.updateById(taskItem)) { |
| | | TaskItem item = taskItemService.getById(taskItem.getId()); |
| | | //判断是否允许超收,不允许超收添加拒收判断 |
| | | if (!Objects.isNull(config)) { |
| | | if (!Boolean.parseBoolean(config.getVal())) { |
| | | if (item.getAnfme().compareTo(item.getQty() + taskItem.getAnfme()) < 0.0) { |
| | | throw new CoolException("前当物料已超出可拣范围,请核对后再操作!!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | item.setQty(item.getQty() + taskItem.getAnfme()).setOrderId(order.getId()).setOrderItemId(orderItem.getId()); |
| | | if (!taskItemService.updateById(item)) { |
| | | throw new CoolException("状态完成失败!!"); |
| | | } |
| | | StockItem stockItem = new StockItem(); |
| | |
| | | |
| | | List<WkOrderItem> orderItems = asnOrderItemService.list(new LambdaQueryWrapper<WkOrderItem>().eq(WkOrderItem::getOrderId, params.getOrderId())); |
| | | double total = orderItems.stream().mapToDouble(WkOrderItem::getQty).sum(); |
| | | double wkQty = orderItems.stream().mapToDouble(WkOrderItem::getWorkQty).sum(); |
| | | order.setQty(total).setWorkQty(order.getWorkQty() - wkQty); |
| | | Double wkQty = orderItems.stream().mapToDouble(WkOrderItem::getWorkQty).sum(); |
| | | order.setQty(total).setWorkQty(order.getWorkQty().compareTo(wkQty) < 0 ? 0.0 : (total - wkQty)); |
| | | if (!asnOrderService.updateById(order)) { |
| | | throw new CoolException("订单数量更新失败!!"); |
| | | } |
| | |
| | | return R.error("任务状态不是待揀狀態"); |
| | | } |
| | | |
| | | List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId())); |
| | | taskItems.forEach(taskItem -> { |
| | | if (!(taskItem.getQty().compareTo(taskItem.getAnfme()) == 0)) { |
| | | throw new CoolException("有单据物料未拣,请拣完后再确认!!"); |
| | | } |
| | | }); |
| | | Config config = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.ALLOW_OVER_CHANGE)); |
| | | //判断是否允许超收,不允许超收添加拒收判断 |
| | | if (!Objects.isNull(config)) { |
| | | if (!Boolean.parseBoolean(config.getVal())) { |
| | | List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId())); |
| | | taskItems.forEach(taskItem -> { |
| | | if ((taskItem.getQty().compareTo(taskItem.getAnfme()) < 0)) { |
| | | throw new CoolException("有单据物料未拣,请拣完后再确认!!"); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | try { |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) { |