Search in sources :

Example 1 with ProductAllocation

use of com.whoiszxl.entity.ProductAllocation in project shopzz by whoiszxl.

the class ProductAllocationController method save.

@SaCheckLogin
@PostMapping
@ApiOperation(value = "新增货位", notes = "新增货位", response = ResponseResult.class)
public ResponseResult<Boolean> save(@RequestBody ProductAllocationVO productAllocationVO) {
    ProductAllocation productAllocation = productAllocationVO.clone(ProductAllocation.class);
    boolean saveFlag = productAllocationService.save(productAllocation);
    return ResponseResult.buildByFlag(saveFlag);
}
Also used : ProductAllocation(com.whoiszxl.entity.ProductAllocation) SaCheckLogin(cn.dev33.satoken.annotation.SaCheckLogin) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with ProductAllocation

use of com.whoiszxl.entity.ProductAllocation in project shopzz by whoiszxl.

the class ProductAllocationController method update.

@SaCheckLogin
@PutMapping
@ApiOperation(value = "更新货位", notes = "更新货位", response = ResponseResult.class)
public ResponseResult<Boolean> update(@RequestBody ProductAllocationVO productAllocationVO) {
    ProductAllocation productAllocation = productAllocationVO.clone(ProductAllocation.class);
    boolean updateFlag = productAllocationService.updateById(productAllocation);
    return ResponseResult.buildByFlag(updateFlag);
}
Also used : ProductAllocation(com.whoiszxl.entity.ProductAllocation) SaCheckLogin(cn.dev33.satoken.annotation.SaCheckLogin) ApiOperation(io.swagger.annotations.ApiOperation)

Example 3 with ProductAllocation

use of com.whoiszxl.entity.ProductAllocation 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)3 ApiOperation (io.swagger.annotations.ApiOperation)3 SaCheckLogin (cn.dev33.satoken.annotation.SaCheckLogin)2 PurchaseInboundOnItem (com.whoiszxl.entity.PurchaseInboundOnItem)1 PurchaseOrderItem (com.whoiszxl.entity.PurchaseOrderItem)1 PurchaseInboundOnItemVO (com.whoiszxl.entity.vo.PurchaseInboundOnItemVO)1