Commit 44111b1e by 胡懿

修改出库报错的问题,升级poi,

parent e88c9986
......@@ -178,11 +178,14 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
typeId = "4657ffc36fcf4feb922eb571231234b0";
beginTime = "2023-01-01 00:00:00";
endTime = "2023-12-01 00:00:00";
Date bTime = DateUtil.parseStrToDate(beginTime, "yyyy-MM-dd HH:mm:ss");
Date eTime = DateUtil.parseStrToDate(endTime, "yyyy-MM-dd HH:mm:ss");
MaterialType materialType = materialTypeMapper.get(typeId);
StorageInfo temSi = new StorageInfo();
temSi.setType(materialType);
temSi.setBeginTime(DateUtil.parseStrToDate(beginTime, "yyyy-MM-dd HH:mm:ss"));
temSi.setEndTime(DateUtil.parseStrToDate(endTime, "yyyy-MM-dd HH:mm:ss"));
temSi.setBeginTime(bTime);
temSi.setEndTime(eTime);
List<StorageInfo> storageInfoList = storageInfoMapper.findList(temSi);
......@@ -192,8 +195,8 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
OutboundInfo outboundInfo = new OutboundInfo();
outboundInfo.setLedgerInfo(temLi);
outboundInfo.setBeginTime(DateUtil.parseStrToDate(beginTime, "yyyy-MM-dd HH:mm:ss"));
outboundInfo.setEndTime(DateUtil.parseStrToDate(endTime, "yyyy-MM-dd HH:mm:ss"));
outboundInfo.setBeginTime(bTime);
outboundInfo.setEndTime(eTime);
List<OutboundInfo> outboundInfoList = outboundInfoMapper.findList(outboundInfo);
int sunRowNum = 5 + storageInfoList.size() + outboundInfoList.size();
......@@ -221,20 +224,65 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
cell.setCellValue("品名代码:" + materialType.getCode());
cell.setCellStyle(ExcelStyleUtils.topTwoCellStyle(workbook));
XSSFCell cell1 = sheetRow.createCell(1);
XSSFCell cell1 = sheetRow.createCell(4);
cell1.setCellValue("品名:" + materialType.getName());
cell1.setCellStyle(ExcelStyleUtils.topTwoCellStyle(workbook));
XSSFCell cell2 = sheetRow.createCell(2);
XSSFCell cell2 = sheetRow.createCell(12);
cell2.setCellValue("计量单位:" + materialType.getUnit());
cell2.setCellStyle(ExcelStyleUtils.topTwoCellStyle(workbook));
}
if (2 == row) {
sheetRow.setHeightInPoints(20);
XSSFCell cell = sheetRow.createCell(0);
cell.setCellValue(DateUtil.getYear(eTime) + " 年");
cell.setCellStyle(ExcelStyleUtils.topTwoCellStyle(workbook));
sheetRow.setHeightInPoints(20);
XSSFCell cell1 = sheetRow.createCell(2);
cell1.setCellValue("凭证批号");
cell1.setCellStyle(ExcelStyleUtils.topTwoCellStyle(workbook));
sheetRow.setHeightInPoints(20);
XSSFCell cell2 = sheetRow.createCell(3);
cell2.setCellValue("摘要");
cell2.setCellStyle(ExcelStyleUtils.topTwoCellStyle(workbook));
sheetRow.setHeightInPoints(20);
XSSFCell cell3 = sheetRow.createCell(4);
cell3.setCellValue("收入");
cell3.setCellStyle(ExcelStyleUtils.topTwoCellStyle(workbook));
sheetRow.setHeightInPoints(20);
XSSFCell cell4 = sheetRow.createCell(5);
cell4.setCellValue("支出");
cell4.setCellStyle(ExcelStyleUtils.topTwoCellStyle(workbook));
sheetRow.setHeightInPoints(20);
XSSFCell cell5 = sheetRow.createCell(6);
cell5.setCellValue("结存");
cell5.setCellStyle(ExcelStyleUtils.topTwoCellStyle(workbook));
sheetRow.setHeightInPoints(20);
XSSFCell cell6 = sheetRow.createCell(21);
cell6.setCellValue("摘要");
cell6.setCellStyle(ExcelStyleUtils.topTwoCellStyle(workbook));
}
// 设置列宽 sheet.setColumnWidth(0, 16 * 256); 第一个参数为第几个单元格,第二个为16个字符宽度
}
sheet.addMergedRegion(new CellRangeAddress(0,0,0,22));
sheet.addMergedRegion(new CellRangeAddress(1,1,0,4));
sheet.addMergedRegion(new CellRangeAddress(1,1,5,12));
sheet.addMergedRegion(new CellRangeAddress(1,1,13,22));
sheet.addMergedRegion(new CellRangeAddress(0,0,0,21));
sheet.addMergedRegion(new CellRangeAddress(1,1,0,3));
sheet.addMergedRegion(new CellRangeAddress(1,1,4,11));
sheet.addMergedRegion(new CellRangeAddress(1,1,12,21));
sheet.addMergedRegion(new CellRangeAddress(2,3,0,1));
sheet.addMergedRegion(new CellRangeAddress(2,4,2,2));
sheet.addMergedRegion(new CellRangeAddress(2,4,3,3));
sheet.addMergedRegion(new CellRangeAddress(2,4,4,4));
sheet.addMergedRegion(new CellRangeAddress(2,4,5,5));
sheet.addMergedRegion(new CellRangeAddress(2,2,6,20));
sheet.addMergedRegion(new CellRangeAddress(2,4,21,21));
FileOutputStream out = null;
try {
out = new FileOutputStream(new File("D:/excel.xlsx"));
......
......@@ -43,7 +43,6 @@ import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.ibatis.transaction.TransactionFactory;
import org.apache.ibatis.type.TypeHandler;
import org.apache.poi.util.PackageHelper;
import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment