Search in sources :

Example 1 with PurchaseOrderDTO

use of com.whoiszxl.dto.PurchaseOrderDTO in project shopzz by whoiszxl.

the class PurchaseStockUpdaterFactory method createCommand.

/**
 * 创建库存更新命令
 * @param parameter 参数
 * @return 库存更新命令
 */
@Override
public StockUpdater createCommand(T parameter) {
    PurchaseOrderDTO purchaseOrderDTO = (PurchaseOrderDTO) parameter;
    List<PurchaseOrderItemDTO> inboundOrderDTOItems = purchaseOrderDTO.getItems();
    Map<Long, PurchaseOrderItemDTO> itemDTOMap = new HashMap<>(100);
    if (ObjectUtils.isNotEmpty(inboundOrderDTOItems)) {
        for (PurchaseOrderItemDTO inboundOrderDTOItem : inboundOrderDTOItems) {
            itemDTOMap.put(inboundOrderDTOItem.getProductSkuId(), inboundOrderDTOItem);
        }
    }
    return new PurchaseInboundStockUpdater(productStockService, itemDTOMap);
}
Also used : PurchaseOrderItemDTO(com.whoiszxl.dto.PurchaseOrderItemDTO) HashMap(java.util.HashMap) PurchaseOrderDTO(com.whoiszxl.dto.PurchaseOrderDTO)

Example 2 with PurchaseOrderDTO

use of com.whoiszxl.dto.PurchaseOrderDTO in project shopzz by whoiszxl.

the class PurchaseSettlementOrderServiceImpl method createPurchaseSettlementOrder.

@Override
public boolean createPurchaseSettlementOrder(PurchaseOrderDTO purchaseOrderDTO) {
    // 1. 将采购入库单的数据填充到采购结算单中
    PurchaseSettlementOrderDTO settlementOrderDTO = purchaseOrderDTO.clone(PurchaseSettlementOrderDTO.class);
    settlementOrderDTO.setId(null);
    settlementOrderDTO.setStatus(null);
    settlementOrderDTO.setTotalSettlementAmount(BigDecimal.ZERO);
    settlementOrderDTO.setPurchaseOrderId(purchaseOrderDTO.getId());
    settlementOrderDTO.setComment("");
    // 2. 将采购入库条目信息填充到采购结算条目中
    List<PurchaseSettlementOrderItemDTO> items = new ArrayList<>();
    for (PurchaseOrderItemDTO purchaseOrderItemDTO : purchaseOrderDTO.getItems()) {
        PurchaseSettlementOrderItemDTO item = purchaseOrderItemDTO.clone(PurchaseSettlementOrderItemDTO.class);
        item.setId(null);
        items.add(item);
    }
    settlementOrderDTO.setItems(items);
    // 3. 将采购结算单与条目新增到数据库
    this.savePurchaseSettlementOrderAndItem(settlementOrderDTO);
    // 4. 更新采购单的状态为待结算
    PurchaseOrderDTO updateParams = purchaseOrderService.getPurchaseOrderById(settlementOrderDTO.getPurchaseOrderId());
    purchaseOrderService.updateStatus(updateParams.getId(), PurchaseOrderStatusConstants.WAIT_FOR_SETTLEMENT);
    return true;
}
Also used : PurchaseOrderItemDTO(com.whoiszxl.dto.PurchaseOrderItemDTO) ArrayList(java.util.ArrayList) PurchaseOrderDTO(com.whoiszxl.dto.PurchaseOrderDTO) PurchaseSettlementOrderItemDTO(com.whoiszxl.dto.PurchaseSettlementOrderItemDTO) PurchaseSettlementOrderDTO(com.whoiszxl.dto.PurchaseSettlementOrderDTO)

Example 3 with PurchaseOrderDTO

use of com.whoiszxl.dto.PurchaseOrderDTO in project shopzz by whoiszxl.

the class PurchaseStockUpdaterFactory method getProductSkuIds.

/**
 * 获取商品skuid集合
 * @param parameter 参数
 * @return 商品sku id集合
 */
@Override
protected List<Long> getProductSkuIds(T parameter) {
    PurchaseOrderDTO purchaseOrderDTO = (PurchaseOrderDTO) parameter;
    List<PurchaseOrderItemDTO> inboundOrderDTOItems = purchaseOrderDTO.getItems();
    if (ObjectUtils.isEmpty(inboundOrderDTOItems)) {
        return new ArrayList<>();
    }
    List<Long> productSkuIds = new ArrayList<>(inboundOrderDTOItems.size());
    for (PurchaseOrderItemDTO inboundOrderDTOItem : inboundOrderDTOItems) {
        productSkuIds.add(inboundOrderDTOItem.getProductSkuId());
    }
    return productSkuIds;
}
Also used : PurchaseOrderItemDTO(com.whoiszxl.dto.PurchaseOrderItemDTO) ArrayList(java.util.ArrayList) PurchaseOrderDTO(com.whoiszxl.dto.PurchaseOrderDTO)

Aggregations

PurchaseOrderDTO (com.whoiszxl.dto.PurchaseOrderDTO)3 PurchaseOrderItemDTO (com.whoiszxl.dto.PurchaseOrderItemDTO)3 ArrayList (java.util.ArrayList)2 PurchaseSettlementOrderDTO (com.whoiszxl.dto.PurchaseSettlementOrderDTO)1 PurchaseSettlementOrderItemDTO (com.whoiszxl.dto.PurchaseSettlementOrderItemDTO)1 HashMap (java.util.HashMap)1