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);
}
Aggregations