|
@@ -578,30 +578,33 @@ public class RegistrationServiceImpl implements RegistrationService{
|
578
|
578
|
HSSFSheet sheet = wb.createSheet(name);
|
579
|
579
|
// 表格合并单元格的样式:参数分别为[起始行、结束行、起始列、结束列],0代表第一行或者第一列
|
580
|
580
|
//不需要合并的格子不需要专门设置单元格的样式
|
581
|
|
- CellRangeAddress rangeAddress = new CellRangeAddress(0,0,0,19);//第一行:天津市粮食储备有限公司市级储备小麦轮换入库情况登统表
|
582
|
|
- CellRangeAddress rangeAddress1 = new CellRangeAddress(2,4,1,1);//车号
|
583
|
|
- CellRangeAddress rangeAddress2 = new CellRangeAddress(2,4,2,2);//仓号
|
584
|
|
- CellRangeAddress rangeAddress3 = new CellRangeAddress(2,4,3,3);//品名
|
585
|
|
- CellRangeAddress rangeAddress4 = new CellRangeAddress(2,4,4,4);//生产年度
|
586
|
|
- CellRangeAddress rangeAddress5 = new CellRangeAddress(2,4,5,5);//入库日期
|
587
|
|
- CellRangeAddress rangeAddress6 = new CellRangeAddress(2,4,6,6);//入库数量
|
588
|
|
- CellRangeAddress rangeAddress7 = new CellRangeAddress(2,2,7,16);//入库质量指标
|
589
|
|
- CellRangeAddress rangeAddress8 = new CellRangeAddress(2,4,17,17);//硬度指数
|
590
|
|
- CellRangeAddress rangeAddress9 = new CellRangeAddress(2,4,18,18);//存储方式
|
591
|
|
- CellRangeAddress rangeAddress10 = new CellRangeAddress(2,4,19,19);//备注
|
592
|
|
- CellRangeAddress rangeAddress11 = new CellRangeAddress(3,4,7,7);//等级
|
593
|
|
- CellRangeAddress rangeAddress12 = new CellRangeAddress(3,4,8,8);//容重
|
594
|
|
- CellRangeAddress rangeAddress13 = new CellRangeAddress(3,4,9,9);//不完善粒
|
595
|
|
- CellRangeAddress rangeAddress14 = new CellRangeAddress(3,3,10,11);//杂质
|
596
|
|
- CellRangeAddress rangeAddress15 = new CellRangeAddress(1,1,0,5);//收货单位
|
597
|
|
- CellRangeAddress rangeAddress16 = new CellRangeAddress(1,1,6,15);//填报日期
|
598
|
|
- CellRangeAddress rangeAddress17 = new CellRangeAddress(3,3,10,14);//杂质
|
599
|
|
- CellRangeAddress rangeAddress18 = new CellRangeAddress(2,4,0,0);//序号
|
600
|
|
- CellRangeAddress rangeAddress22 = new CellRangeAddress(1,1,16,19);//计量单位
|
601
|
|
- CellRangeAddress rangeAddress23 = new CellRangeAddress(3,4,15,15);//水分
|
602
|
|
- CellRangeAddress rangeAddress24 = new CellRangeAddress(3,4,16,16);//色泽气味
|
|
581
|
+ CellRangeAddress rangeAddress1 = new CellRangeAddress(0,0,0,18);//第一行:天津市粮食储备有限公司市级储备小麦轮换入库情况登统表
|
|
582
|
+ CellRangeAddress rangeAddress2 = new CellRangeAddress(1,1,0,5);//收货单位
|
|
583
|
+ CellRangeAddress rangeAddress3 = new CellRangeAddress(1,1,6,14);//填报日期
|
|
584
|
+ CellRangeAddress rangeAddress4 = new CellRangeAddress(1,1,15,18);//计量单位
|
|
585
|
+ CellRangeAddress rangeAddress5 = new CellRangeAddress(2,4,0,0);//序号
|
|
586
|
+ CellRangeAddress rangeAddress6 = new CellRangeAddress(2,4,1,1);//车号
|
|
587
|
+ CellRangeAddress rangeAddress7 = new CellRangeAddress(2,4,2,2);//仓号
|
|
588
|
+ CellRangeAddress rangeAddress8 = new CellRangeAddress(2,4,3,3);//品名
|
|
589
|
+ CellRangeAddress rangeAddress9 = new CellRangeAddress(2,4,4,4);//生产年度
|
|
590
|
+ CellRangeAddress rangeAddress10 = new CellRangeAddress(2,4,5,5);//入库日期
|
|
591
|
+ CellRangeAddress rangeAddress11 = new CellRangeAddress(2,4,6,6);//入库数量
|
|
592
|
+ CellRangeAddress rangeAddress12 = new CellRangeAddress(2,2,7,15);//入库质量指标
|
|
593
|
+ CellRangeAddress rangeAddress13 = new CellRangeAddress(2,4,16,16);//硬度指数
|
|
594
|
+ CellRangeAddress rangeAddress14 = new CellRangeAddress(2,4,17,17);//存储方式
|
|
595
|
+ CellRangeAddress rangeAddress15 = new CellRangeAddress(2,4,18,18);//备注
|
|
596
|
+ CellRangeAddress rangeAddress16 = new CellRangeAddress(3,4,7,7);//等级
|
|
597
|
+ CellRangeAddress rangeAddress17 = new CellRangeAddress(3,4,8,8);//容重
|
|
598
|
+ CellRangeAddress rangeAddress18 = new CellRangeAddress(3,4,9,9);//不完善粒
|
|
599
|
+ CellRangeAddress rangeAddress19 = new CellRangeAddress(3,3,10,13);//杂质
|
|
600
|
+ CellRangeAddress rangeAddress20 = new CellRangeAddress(3,4,14,14);//水分
|
|
601
|
+ CellRangeAddress rangeAddress21 = new CellRangeAddress(3,4,15,15);//色泽气味
|
|
602
|
+ CellRangeAddress rangeAddress22 = new CellRangeAddress(4,4,10,10);//杂质总量
|
|
603
|
+ CellRangeAddress rangeAddress23 = new CellRangeAddress(4,4,11,11);//有机杂质
|
|
604
|
+ CellRangeAddress rangeAddress24 = new CellRangeAddress(4,4,12,12);//无机杂质
|
|
605
|
+ CellRangeAddress rangeAddress25 = new CellRangeAddress(4,4,13,13);//筛下物
|
603
|
606
|
|
604
|
|
- sheet.addMergedRegion(rangeAddress);
|
|
607
|
+ sheet.addMergedRegion(rangeAddress1);
|
605
|
608
|
sheet.addMergedRegion(rangeAddress1);
|
606
|
609
|
sheet.addMergedRegion(rangeAddress2);
|
607
|
610
|
sheet.addMergedRegion(rangeAddress3);
|
|
@@ -620,9 +623,13 @@ public class RegistrationServiceImpl implements RegistrationService{
|
620
|
623
|
sheet.addMergedRegion(rangeAddress16);
|
621
|
624
|
sheet.addMergedRegion(rangeAddress17);
|
622
|
625
|
sheet.addMergedRegion(rangeAddress18);
|
|
626
|
+ sheet.addMergedRegion(rangeAddress19);
|
|
627
|
+ sheet.addMergedRegion(rangeAddress20);
|
|
628
|
+ sheet.addMergedRegion(rangeAddress21);
|
623
|
629
|
sheet.addMergedRegion(rangeAddress22);
|
624
|
630
|
sheet.addMergedRegion(rangeAddress23);
|
625
|
631
|
sheet.addMergedRegion(rangeAddress24);
|
|
632
|
+ sheet.addMergedRegion(rangeAddress25);
|
626
|
633
|
|
627
|
634
|
HSSFCellStyle headStyle = wb.createCellStyle();
|
628
|
635
|
HSSFFont headFont = wb.createFont();
|
|
@@ -651,15 +658,17 @@ public class RegistrationServiceImpl implements RegistrationService{
|
651
|
658
|
contentStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
652
|
659
|
contentStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
653
|
660
|
|
|
661
|
+ //第一行
|
654
|
662
|
HSSFRow sheetRow = sheet.createRow(0);
|
655
|
663
|
HSSFCell cell = sheetRow.createCell(0);
|
656
|
664
|
cell.setCellValue("天津市粮食储备有限公司市级储备小麦轮换入库情况登统表");
|
657
|
665
|
cell.setCellStyle(headStyle);
|
658
|
666
|
|
|
667
|
+ //第二行
|
659
|
668
|
HSSFRow sheetRow1 = sheet.createRow(1);
|
660
|
669
|
HSSFCell cell1 = sheetRow1.createCell(0);
|
661
|
670
|
HSSFCell cell2 = sheetRow1.createCell(6);
|
662
|
|
- HSSFCell cell3 = sheetRow1.createCell(16);
|
|
671
|
+ HSSFCell cell3 = sheetRow1.createCell(15);
|
663
|
672
|
cell1.setCellValue("收货单位:"+ (shdw==null?"":shdw));
|
664
|
673
|
cell1.setCellStyle(titleStyle);
|
665
|
674
|
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日");
|
|
@@ -668,8 +677,8 @@ public class RegistrationServiceImpl implements RegistrationService{
|
668
|
677
|
cell3.setCellValue("计量单位:吨(保留小数)");
|
669
|
678
|
cell3.setCellStyle(titleStyle);
|
670
|
679
|
|
671
|
|
- //在表格的第一行设置与数据库列名对应的列的名称
|
672
|
|
- int rowNum = 2;//第三行
|
|
680
|
+ //第三行:在表格的第一行设置与数据库列名对应的列的名称
|
|
681
|
+ int rowNum = 2;
|
673
|
682
|
HSSFRow row = sheet.createRow(rowNum);
|
674
|
683
|
HSSFCell rowCell1 = row.createCell(0);
|
675
|
684
|
HSSFCell rowCell2 = row.createCell(1);
|
|
@@ -690,7 +699,6 @@ public class RegistrationServiceImpl implements RegistrationService{
|
690
|
699
|
HSSFCell rowCell17 = row.createCell(16);
|
691
|
700
|
HSSFCell rowCell18 = row.createCell(17);
|
692
|
701
|
HSSFCell rowCell19 = row.createCell(18);
|
693
|
|
- HSSFCell rowCell20 = row.createCell(19);
|
694
|
702
|
|
695
|
703
|
rowCell1.setCellValue("序号");
|
696
|
704
|
rowCell2.setCellValue("车号");
|
|
@@ -700,9 +708,9 @@ public class RegistrationServiceImpl implements RegistrationService{
|
700
|
708
|
rowCell6.setCellValue("入库日期");
|
701
|
709
|
rowCell7.setCellValue("入库数量");
|
702
|
710
|
rowCell8.setCellValue("入库质量指标");
|
703
|
|
- rowCell18.setCellValue("硬度指数H1");
|
704
|
|
- rowCell19.setCellValue("存储方式");
|
705
|
|
- rowCell20.setCellValue("备注");
|
|
711
|
+ rowCell17.setCellValue("硬度指数H1");
|
|
712
|
+ rowCell18.setCellValue("存储方式");
|
|
713
|
+ rowCell19.setCellValue("备注");
|
706
|
714
|
rowCell1.setCellStyle(contentStyle);
|
707
|
715
|
rowCell2.setCellStyle(contentStyle);
|
708
|
716
|
rowCell3.setCellStyle(contentStyle);
|
|
@@ -722,7 +730,6 @@ public class RegistrationServiceImpl implements RegistrationService{
|
722
|
730
|
rowCell17.setCellStyle(contentStyle);
|
723
|
731
|
rowCell18.setCellStyle(contentStyle);
|
724
|
732
|
rowCell19.setCellStyle(contentStyle);
|
725
|
|
- rowCell20.setCellStyle(contentStyle);
|
726
|
733
|
|
727
|
734
|
rowNum+=1;//第四行
|
728
|
735
|
HSSFRow row1 = sheet.createRow(rowNum);
|
|
@@ -745,14 +752,13 @@ public class RegistrationServiceImpl implements RegistrationService{
|
745
|
752
|
HSSFCell row1Cell17 = row1.createCell(16);
|
746
|
753
|
HSSFCell row1Cell18 = row1.createCell(17);
|
747
|
754
|
HSSFCell row1Cell19 = row1.createCell(18);
|
748
|
|
- HSSFCell row1Cell20 = row1.createCell(19);
|
749
|
755
|
|
750
|
756
|
row1Cell8.setCellValue("等级");
|
751
|
757
|
row1Cell9.setCellValue("容重g/L");
|
752
|
758
|
row1Cell10.setCellValue("不完善粒%");
|
753
|
759
|
row1Cell11.setCellValue("杂质%");
|
754
|
|
- row1Cell16.setCellValue("水分%");
|
755
|
|
- row1Cell17.setCellValue("色泽气味");
|
|
760
|
+ row1Cell15.setCellValue("水分%");
|
|
761
|
+ row1Cell16.setCellValue("色泽气味");
|
756
|
762
|
row1Cell1.setCellStyle(contentStyle);
|
757
|
763
|
row1Cell2.setCellStyle(contentStyle);
|
758
|
764
|
row1Cell3.setCellStyle(contentStyle);
|
|
@@ -772,7 +778,6 @@ public class RegistrationServiceImpl implements RegistrationService{
|
772
|
778
|
row1Cell17.setCellStyle(contentStyle);
|
773
|
779
|
row1Cell18.setCellStyle(contentStyle);
|
774
|
780
|
row1Cell19.setCellStyle(contentStyle);
|
775
|
|
- row1Cell20.setCellStyle(contentStyle);
|
776
|
781
|
|
777
|
782
|
rowNum+=1;//第五行
|
778
|
783
|
HSSFRow row2 = sheet.createRow(rowNum);
|
|
@@ -795,12 +800,10 @@ public class RegistrationServiceImpl implements RegistrationService{
|
795
|
800
|
HSSFCell row2Cell17 = row2.createCell(16);
|
796
|
801
|
HSSFCell row2Cell18 = row2.createCell(17);
|
797
|
802
|
HSSFCell row2Cell19 = row2.createCell(18);
|
798
|
|
- HSSFCell row2Cell20 = row2.createCell(19);
|
799
|
803
|
row2Cell11.setCellValue("总量");
|
800
|
|
- row2Cell12.setCellValue("矿物质");
|
801
|
|
- row2Cell13.setCellValue("有机杂质");
|
802
|
|
- row2Cell14.setCellValue("无机杂质");
|
803
|
|
- row2Cell15.setCellValue("筛下物%");
|
|
804
|
+ row2Cell12.setCellValue("有机杂质");
|
|
805
|
+ row2Cell13.setCellValue("无机杂质");
|
|
806
|
+ row2Cell14.setCellValue("筛下物%");
|
804
|
807
|
row2Cell1.setCellStyle(contentStyle);
|
805
|
808
|
row2Cell2.setCellStyle(contentStyle);
|
806
|
809
|
row2Cell3.setCellStyle(contentStyle);
|
|
@@ -820,8 +823,6 @@ public class RegistrationServiceImpl implements RegistrationService{
|
820
|
823
|
row2Cell17.setCellStyle(contentStyle);
|
821
|
824
|
row2Cell18.setCellStyle(contentStyle);
|
822
|
825
|
row2Cell19.setCellStyle(contentStyle);
|
823
|
|
- row2Cell20.setCellStyle(contentStyle);
|
824
|
|
-
|
825
|
826
|
|
826
|
827
|
Integer xh=1;
|
827
|
828
|
double rksl = 0d;
|
|
@@ -846,7 +847,6 @@ public class RegistrationServiceImpl implements RegistrationService{
|
846
|
847
|
HSSFCell hssfCell17 = hssfRow.createCell(16);
|
847
|
848
|
HSSFCell hssfCell18 = hssfRow.createCell(17);
|
848
|
849
|
HSSFCell hssfCell19 = hssfRow.createCell(18);
|
849
|
|
- HSSFCell hssfCell20 = hssfRow.createCell(19);
|
850
|
850
|
hssfCell1.setCellValue(xh);
|
851
|
851
|
hssfCell2.setCellValue((String)list.get(i).get("cphm"));
|
852
|
852
|
hssfCell3.setCellValue((String)list.get(i).get("cf"));
|
|
@@ -864,15 +864,14 @@ public class RegistrationServiceImpl implements RegistrationService{
|
864
|
864
|
hssfCell9.setCellValue((String)list.get(i).get("rz"));
|
865
|
865
|
hssfCell10.setCellValue((String)list.get(i).get("bwslzl"));
|
866
|
866
|
hssfCell11.setCellValue((String)list.get(i).get("zzzl"));
|
867
|
|
- hssfCell12.setCellValue((String)list.get(i).get("kwz"));
|
868
|
|
- hssfCell13.setCellValue((String)list.get(i).get("yjzz"));
|
869
|
|
- hssfCell14.setCellValue((String)list.get(i).get("wjzz"));
|
870
|
|
- hssfCell15.setCellValue((String)list.get(i).get("sxw"));
|
871
|
|
- hssfCell16.setCellValue((String)list.get(i).get("sf"));
|
872
|
|
- hssfCell17.setCellValue((String)list.get(i).get("szqw"));
|
873
|
|
- hssfCell18.setCellValue((String)list.get(i).get("ydzs"));
|
874
|
|
- hssfCell19.setCellValue((String)list.get(i).get("ccfs"));
|
875
|
|
- hssfCell20.setCellValue("");
|
|
867
|
+ hssfCell12.setCellValue((String)list.get(i).get("yjzz"));
|
|
868
|
+ hssfCell13.setCellValue((String)list.get(i).get("wjzz"));
|
|
869
|
+ hssfCell14.setCellValue((String)list.get(i).get("sxw"));
|
|
870
|
+ hssfCell15.setCellValue((String)list.get(i).get("sf"));
|
|
871
|
+ hssfCell16.setCellValue((String)list.get(i).get("szqw"));
|
|
872
|
+ hssfCell17.setCellValue((String)list.get(i).get("ydzs"));
|
|
873
|
+ hssfCell18.setCellValue((String)list.get(i).get("ccfs"));
|
|
874
|
+ hssfCell19.setCellValue("");
|
876
|
875
|
hssfCell1.setCellStyle(contentStyle);
|
877
|
876
|
hssfCell2.setCellStyle(contentStyle);
|
878
|
877
|
hssfCell3.setCellStyle(contentStyle);
|
|
@@ -892,19 +891,18 @@ public class RegistrationServiceImpl implements RegistrationService{
|
892
|
891
|
hssfCell17.setCellStyle(contentStyle);
|
893
|
892
|
hssfCell18.setCellStyle(contentStyle);
|
894
|
893
|
hssfCell19.setCellStyle(contentStyle);
|
895
|
|
- hssfCell20.setCellStyle(contentStyle);
|
896
|
894
|
++xh;
|
897
|
895
|
}
|
898
|
896
|
HSSFRow hssfRow = sheet.createRow(rowNum+1);
|
899
|
897
|
hssfRow.createCell(0).setCellValue("单位负责人:" + (dwfzr==null?"":dwfzr));
|
900
|
898
|
hssfRow.createCell(6).setCellValue("科长:");
|
901
|
899
|
hssfRow.createCell(13).setCellValue("制表人:"+ (zbr==null?"":zbr));
|
902
|
|
- CellRangeAddress rangeAddress19 = new CellRangeAddress(rowNum+1,rowNum+1,0,5);//单位负责人
|
903
|
|
- CellRangeAddress rangeAddress20 = new CellRangeAddress(rowNum+1,rowNum+1,6,12);//科长
|
904
|
|
- CellRangeAddress rangeAddress21 = new CellRangeAddress(rowNum+1,rowNum+1,13,19);//制表人
|
905
|
|
- sheet.addMergedRegion(rangeAddress19);
|
906
|
|
- sheet.addMergedRegion(rangeAddress20);
|
907
|
|
- sheet.addMergedRegion(rangeAddress21);
|
|
900
|
+ CellRangeAddress rangeAddress26 = new CellRangeAddress(rowNum+1,rowNum+1,0,5);//单位负责人
|
|
901
|
+ CellRangeAddress rangeAddress27 = new CellRangeAddress(rowNum+1,rowNum+1,6,12);//科长
|
|
902
|
+ CellRangeAddress rangeAddress28 = new CellRangeAddress(rowNum+1,rowNum+1,13,18);//制表人
|
|
903
|
+ sheet.addMergedRegion(rangeAddress26);
|
|
904
|
+ sheet.addMergedRegion(rangeAddress27);
|
|
905
|
+ sheet.addMergedRegion(rangeAddress28);
|
908
|
906
|
}
|
909
|
907
|
|
910
|
908
|
return wb;
|