Search in sources :

Example 1 with PurchaseInboundOnItemVO

use of com.whoiszxl.entity.vo.PurchaseInboundOnItemVO in project shopzz by whoiszxl.

the class PurchaseOrderController method batchOnShelves.

@PutMapping("/shelves/on")
@ApiOperation(value = "批量新增采购入库单的上架条目", notes = "批量新增采购入库单的上架条目", response = ResponseResult.class)
public ResponseResult<Boolean> batchOnShelves(@RequestBody List<PurchaseInboundOnItemVO> putOnItems) {
    // 采购入库单状态判断
    for (PurchaseInboundOnItemVO putOnItem : putOnItems) {
        Long purchaseOrderItemId = putOnItem.getPurchaseOrderItemId();
        PurchaseOrderItem purchaseOrderItem = purchaseOrderItemService.getById(purchaseOrderItemId);
        if (purchaseOrderItem == null) {
            return ResponseResult.buildError("采购单条目不存在");
        }
        ProductAllocation productAllocation = productAllocationService.getById(putOnItem.getProductAllocationId());
        if (productAllocation == null) {
            return ResponseResult.buildError("采购单条目上架的货位不存在");
        }
        if (putOnItem.getPutOnShelvesCount() > purchaseOrderItem.getPurchaseQuantity()) {
            return ResponseResult.buildError(putOnItem.getProductSkuId() + "上架条目数量大于采购数量");
        }
    }
    List<PurchaseInboundOnItem> items = BeanCopierUtils.copyListProperties(putOnItems, PurchaseInboundOnItem::new);
    boolean saveFlag = purchaseInboundOnItemService.saveBatch(items);
    return ResponseResult.buildByFlag(saveFlag);
}
Also used : PurchaseOrderItem(com.whoiszxl.entity.PurchaseOrderItem) PurchaseInboundOnItemVO(com.whoiszxl.entity.vo.PurchaseInboundOnItemVO) ProductAllocation(com.whoiszxl.entity.ProductAllocation) PurchaseInboundOnItem(com.whoiszxl.entity.PurchaseInboundOnItem) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

ProductAllocation (com.whoiszxl.entity.ProductAllocation)1 PurchaseInboundOnItem (com.whoiszxl.entity.PurchaseInboundOnItem)1 PurchaseOrderItem (com.whoiszxl.entity.PurchaseOrderItem)1 PurchaseInboundOnItemVO (com.whoiszxl.entity.vo.PurchaseInboundOnItemVO)1 ApiOperation (io.swagger.annotations.ApiOperation)1