| | |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.stock.enums.StockInventorySourceEnum; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.R; |
| | |
| | | |
| | | @Override |
| | | public IPage<StockInventoryDto> pageListCombinedStockInventory(Page page, StockInventoryDto stockInventoryDto) { |
| | | return stockInventoryMapper.pageListCombinedStockInventory(page, stockInventoryDto); |
| | | IPage<StockInventoryDto> result = stockInventoryMapper.pageListCombinedStockInventory(page, stockInventoryDto); |
| | | // 转换来源编码为来源名称 |
| | | for (StockInventoryDto dto : result.getRecords()) { |
| | | // 合格库存来源 |
| | | if (StringUtils.isNotBlank(dto.getQualifiedSource())) { |
| | | StockInventorySourceEnum qualifiedSourceEnum = StockInventorySourceEnum.fromCode(dto.getQualifiedSource()); |
| | | if (qualifiedSourceEnum != null) { |
| | | dto.setQualifiedSourceText(qualifiedSourceEnum.getValue()); |
| | | } |
| | | } |
| | | // 不合格库存来源 |
| | | if (StringUtils.isNotBlank(dto.getUnQualifiedSource())) { |
| | | StockInventorySourceEnum unQualifiedSourceEnum = StockInventorySourceEnum.fromCode(dto.getUnQualifiedSource()); |
| | | if (unQualifiedSourceEnum != null) { |
| | | dto.setUnQualifiedSourceText(unQualifiedSourceEnum.getValue()); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //入库调用 |
| | |
| | | stockInRecordDto.setRemark(stockInventoryDto.getRemark()); |
| | | stockInRecordDto.setWarnNum(stockInventoryDto.getWarnNum()); |
| | | stockInRecordDto.setManufacturerId(stockInventoryDto.getManufacturerId()); |
| | | stockInRecordDto.setSource(stockInventoryDto.getSource()); |
| | | stockInRecordService.add(stockInRecordDto); |
| | | return true; |
| | | } |
| | |
| | | |
| | | @Override |
| | | public IPage<StockInventoryDto> getBatchNoQty(Page page, StockInventoryDto stockInventoryDto) { |
| | | return stockInventoryMapper.getBatchNoQty(page, stockInventoryDto); |
| | | IPage<StockInventoryDto> resultPage = stockInventoryMapper.getBatchNoQty(page, stockInventoryDto); |
| | | |
| | | // 遍历结果,设置来源中文名 |
| | | resultPage.getRecords().forEach(dto -> { |
| | | // 设置合格库存来源中文名 |
| | | if (StringUtils.isNotEmpty(dto.getQualifiedSource())) { |
| | | System.out.println("合格库存来源:" + dto.getQualifiedSource()); |
| | | StockInventorySourceEnum qualifiedSourceEnum = StockInventorySourceEnum.fromCode(dto.getQualifiedSource()); |
| | | if (qualifiedSourceEnum != null) { |
| | | dto.setQualifiedSourceText(qualifiedSourceEnum.getValue()); |
| | | System.out.println("合格库存来源值:" + qualifiedSourceEnum.getValue()); |
| | | } |
| | | } |
| | | |
| | | // 设置不合格库存来源中文名 |
| | | if (StringUtils.isNotEmpty(dto.getUnQualifiedSource())) { |
| | | StockInventorySourceEnum unQualifiedSourceEnum = StockInventorySourceEnum.fromCode(dto.getUnQualifiedSource()); |
| | | if (unQualifiedSourceEnum != null) { |
| | | dto.setUnQualifiedSourceText(unQualifiedSourceEnum.getValue()); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | return resultPage; |
| | | } |
| | | } |