| | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.basic.service.IProductModelService; |
| | | import com.ruoyi.basic.service.IProductService; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.R; |
| | |
| | | private StockOutRecordService stockOutRecordService; |
| | | private SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private ISalesLedgerProductFrozenService salesLedgerProductFrozenService; |
| | | |
| | | private final IProductModelService productModelService; |
| | | private final IProductService productService; |
| | | |
| | | @Override |
| | | public IPage<StockInventoryDto> pagestockInventory(Page page, StockInventoryDto stockInventoryDto) { |
| | | return stockInventoryMapper.pagestockInventory(page, stockInventoryDto); |
| | |
| | | stockOutRecordService.add(stockOutRecordDto); |
| | | StockInventory oldStockInventory = stockInventoryMapper.selectOne(new QueryWrapper<StockInventory>().lambda().eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId())); |
| | | if (ObjectUtils.isEmpty(oldStockInventory)) { |
| | | throw new RuntimeException("产品库存不存在"); |
| | | throw new RuntimeException(getProductName(stockInventoryDto.getProductModelId()) + " 产品库存不存在"); |
| | | } |
| | | BigDecimal lockedQty = oldStockInventory.getLockedQuantity(); |
| | | if (lockedQty == null) { |
| | |
| | | return true; |
| | | } |
| | | |
| | | private String getProductName(Long productModelId) { |
| | | if (productModelId == null) { |
| | | return ""; |
| | | } |
| | | |
| | | ProductModel productModel = productModelService.getById(productModelId); |
| | | if (productModel == null) { |
| | | return ""; |
| | | } |
| | | |
| | | Product product = productService.getById(productModel.getProductId()); |
| | | if (product == null) { |
| | | return ""; |
| | | } |
| | | |
| | | return product.getProductName() + " - " + productModel.getModel(); |
| | | } |
| | | |
| | | @Override |
| | | public R importStockInventory(MultipartFile file) { |
| | | try { |