| | |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.EnumUtil; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | |
| | | |
| | | @Override |
| | | public IPage<StockOutRecordDto> listPage(Page page, StockOutRecordDto stockOutRecordDto) { |
| | | return stockOutRecordMapper.listPage(page, stockOutRecordDto); |
| | | IPage<StockOutRecordDto> result = stockOutRecordMapper.listPage(page, stockOutRecordDto); |
| | | for (StockOutRecordDto record : result.getRecords()) { |
| | | record.setRecordTypeName(resolveRecordTypeName(record.getType(), record.getRecordType(), record.getProcessName())); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | |
| | | List<StockOutRecordExportData> list = stockOutRecordMapper.listStockOutRecordExportData(stockOutRecordDto); |
| | | for (StockOutRecordExportData stockInRecordExportData : list) { |
| | | if (stockInRecordExportData.getType().equals("0")) { |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | stockInRecordExportData.setRecordType(resolveQualifiedRecordType(stockInRecordExportData.getRecordType(), stockInRecordExportData.getProcessName())); |
| | | }else { |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutUnQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | } |
| | |
| | | ExcelUtil<StockOutRecordExportData> util = new ExcelUtil<>(StockOutRecordExportData.class); |
| | | util.exportExcel(response,list, "出库记录信息"); |
| | | } |
| | | |
| | | private String resolveRecordTypeName(String type, String recordType, String processName) { |
| | | if ("0".equals(type)) { |
| | | return resolveQualifiedRecordType(recordType, processName); |
| | | } |
| | | return EnumUtil.fromCode(StockOutUnQualifiedRecordTypeEnum.class, Integer.parseInt(recordType)).getValue(); |
| | | } |
| | | |
| | | private String resolveQualifiedRecordType(String recordType, String processName) { |
| | | if (StockOutQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_OUT.getCode().equals(recordType) |
| | | && StringUtils.isNotEmpty(processName)) { |
| | | return "生产报工-" + processName + "-出库"; |
| | | } |
| | | if (recordType == null) { |
| | | return null; |
| | | } |
| | | try { |
| | | return EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(recordType)).getValue(); |
| | | } catch (NumberFormatException ex) { |
| | | return recordType; |
| | | } |
| | | } |
| | | } |