| | |
| | | import com.vincent.rsf.server.manager.enums.AsnExceStatus; |
| | | import com.vincent.rsf.server.manager.enums.TaskStsType; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | 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.SerialRuleCode; |
| | | 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.FieldsItemServiceImpl; |
| | | import com.vincent.rsf.server.system.service.impl.FieldsServiceImpl; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import com.vincent.rsf.server.system.utils.SystemAuthUtils; |
| | | import lombok.Synchronized; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | private FieldsItemService fieldsItemService; |
| | | @Autowired |
| | | private FieldsService fieldsService; |
| | | @Autowired |
| | | private StockService stockService; |
| | | @Autowired |
| | | private StockItemServiceImpl stockItemService; |
| | | |
| | | @Override |
| | | public R getOutStockTaskItem(String barcode) { |
| | |
| | | throw new CoolException("出库单明细更新失败!!"); |
| | | } |
| | | |
| | | Stock stock = new Stock(); |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_STOCK_CODE, null); |
| | | if (StringUtils.isBlank(ruleCode)) { |
| | | throw new CoolException("当前业务:" + SerialRuleCode.SYS_STOCK_CODE + ",编码规则不存在!!"); |
| | | } |
| | | Double sum = taskItems.stream().mapToDouble(TaskItem::getAnfme).sum(); |
| | | stock.setCode(ruleCode) |
| | | .setUpdateBy(SystemAuthUtils.getLoginUserId()) |
| | | .setBarcode(task.getBarcode()) |
| | | .setLocCode(task.getOrgLoc()) |
| | | .setType(order.getType()) |
| | | .setWkType(Short.parseShort(order.getWkType())) |
| | | .setSourceId(orderItem.getOrderId()) |
| | | .setSourceCode(orderItem.getOrderCode()) |
| | | .setUpdateTime(new Date()) |
| | | .setAnfme(sum); |
| | | |
| | | if (!stockService.save(stock)) { |
| | | throw new CoolException("出入库历史保存失败!!"); |
| | | } |
| | | |
| | | List<StockItem> stockItems = new ArrayList<>(); |
| | | items.forEach(taskItem -> { |
| | | taskItem.setQty(taskItem.getAnfme()); |
| | | taskItem.setQty(taskItem.getAnfme()).setOrderId(order.getId()).setOrderItemId(orderItem.getId()); |
| | | if (!taskItemService.updateById(taskItem)) { |
| | | throw new CoolException("状态完成失败!!"); |
| | | } |
| | | StockItem stockItem = new StockItem(); |
| | | BeanUtils.copyProperties(taskItem, stockItem); |
| | | stockItem.setStockId(stock.getId()).setStockCode(stock.getCode()).setSourceItemId(orderItem.getId()); |
| | | stockItems.add(stockItem); |
| | | }); |
| | | if (!stockItemService.saveBatch(stockItems)) { |
| | | throw new CoolException("出入库历史明细保存失败!!"); |
| | | } |
| | | }); |
| | | |
| | | List<WkOrderItem> orderItems = asnOrderItemService.list(new LambdaQueryWrapper<WkOrderItem>().eq(WkOrderItem::getOrderId, params.getOrderId())); |
| | |
| | | throw new CoolException("出库单更新状态失败"); |
| | | } |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | private void saveOrderToStock(Order order) { |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | }); |
| | | |
| | | orderItems.forEach(orderItem -> { |
| | | try { |
| | | taskService.saveOutStockItem(taskItems, orderItem, null, null, SystemAuthUtils.getLoginUserId()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | // orderItems.forEach(orderItem -> { |
| | | // try { |
| | | // taskService.saveOutStockItem(taskItems, orderItem, null, null, SystemAuthUtils.getLoginUserId()); |
| | | // } catch (Exception e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // }); |
| | | |
| | | // containerWaveParam.getOrderItems().forEach(orderItem -> { |
| | | // |