| | |
| | | @Override |
| | | @Synchronized |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void generateTask(Short resouce, LocToTaskParams map, Long loginUserId) throws Exception { |
| | | public synchronized void generateTask(Short resouce, LocToTaskParams map, Long loginUserId) throws Exception { |
| | | if (Objects.isNull(map.getSiteNo())) { |
| | | throw new CoolException("站点不能为空!"); |
| | | } |
| | |
| | | if (map.getType().equals(Constants.TASK_TYPE_ORDER_OUT_STOCK)) { |
| | | taskItem.setWkType(Short.parseShort(order.getWkType())) |
| | | .setSourceCode(order.getCode()) |
| | | .setSourceId(order.getId()); |
| | | .setSourceId(order.getId()) |
| | | .setOrderItemId(item.getOrderItemId()); |
| | | } else if (map.getType().equals(Constants.TASK_TYPE_WAVE_OUT_STOCK)) { |
| | | taskItem.setSourceId(wave.getId()) |
| | | .setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_OTHER.type)) |
| | |
| | | } |
| | | taskItems.add(taskItem); |
| | | |
| | | Double qty = Math.round((item.getWorkQty() + item.getOutQty()) * 100) / 100.0; |
| | | Double qty = Math.round((item.getWorkQty() + item.getOutQty()) * 1000000) / 1000000.0; |
| | | LocItem locItem = locItemService.getById(item.getId()); |
| | | if (Objects.isNull(locItem)) { |
| | | throw new CoolException("库存信息不存在!"); |
| | |
| | | } |
| | | |
| | | if (locItem.getAnfme().compareTo(qty) < 0) { |
| | | Double minusQty = Math.round((locItem.getAnfme() - locItem.getWorkQty()) * 100) / 100.0; |
| | | Double minusQty = Math.round((locItem.getAnfme() - locItem.getWorkQty()) * 1000000) / 1000000.0; |
| | | item.setWorkQty(minusQty); |
| | | } else { |
| | | item.setWorkQty(qty); |