|
@@ -1,6 +1,7 @@
|
|
|
package com.lc.ibps.components.verification.excel;
|
|
package com.lc.ibps.components.verification.excel;
|
|
|
|
|
|
|
|
import com.lc.ibps.components.poi.util.PoiPublicUtil;
|
|
import com.lc.ibps.components.poi.util.PoiPublicUtil;
|
|
|
|
|
+import com.lc.ibps.components.verification.model.FunctionEnum;
|
|
|
import com.lc.ibps.components.verification.model.InspectionConfigVO;
|
|
import com.lc.ibps.components.verification.model.InspectionConfigVO;
|
|
|
import com.lc.ibps.components.verification.model.InspectionItemVO;
|
|
import com.lc.ibps.components.verification.model.InspectionItemVO;
|
|
|
import com.lc.ibps.components.verification.model.InspectionVO;
|
|
import com.lc.ibps.components.verification.model.InspectionVO;
|
|
@@ -14,16 +15,15 @@ import java.util.*;
|
|
|
public class PVTest {
|
|
public class PVTest {
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
|
- public void mapTest() throws FileNotFoundException {
|
|
|
|
|
|
|
+ public void testExcelImport() throws FileNotFoundException {
|
|
|
|
|
|
|
|
|
|
+ InspectionConfigVO config = new InspectionConfigVO("批内精密度",1,2,
|
|
|
|
|
+ new String[]{"高溶度(R1)","低浓度(R2)"},10, LocalDate.now(),true);
|
|
|
|
|
+ InspectionItemVO item = new InspectionItemVO(config);
|
|
|
|
|
|
|
|
- long start = new Date().getTime();
|
|
|
|
|
- File file = new File(PoiPublicUtil.getWebRootPath("Excel1.xlsx"));
|
|
|
|
|
|
|
+ File file = new File(String.format("C:/tmp/%s.xlsx",config.getName()));
|
|
|
FileInputStream in = new FileInputStream(file);
|
|
FileInputStream in = new FileInputStream(file);
|
|
|
|
|
|
|
|
- InspectionConfigVO config = new InspectionConfigVO("批间精密度",5,2,
|
|
|
|
|
- new String[]{"高溶度(R1)","低浓度(R2)"},10, LocalDate.now(),true);
|
|
|
|
|
- InspectionItemVO item = new InspectionItemVO(config);
|
|
|
|
|
item.importExcelRecord(in);
|
|
item.importExcelRecord(in);
|
|
|
|
|
|
|
|
System.out.println(item);
|
|
System.out.println(item);
|
|
@@ -34,30 +34,46 @@ public class PVTest {
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
|
public void testExcelTemplateExport() throws IOException {
|
|
public void testExcelTemplateExport() throws IOException {
|
|
|
- InspectionConfigVO config = new InspectionConfigVO("批间精密度",5,2,
|
|
|
|
|
- new String[]{"高溶度(R1)","低浓度(R2)"},10, LocalDate.now(),true);
|
|
|
|
|
|
|
+// InspectionConfigVO config = new InspectionConfigVO("批内精密度",1,2,
|
|
|
|
|
+// new String[]{"高溶度(R1)","低浓度(R2)"},10, LocalDate.now(),true);
|
|
|
|
|
+
|
|
|
|
|
+ InspectionConfigVO config = new InspectionConfigVO("正确度",5,2,
|
|
|
|
|
+ new String[]{"L2","L4"},2, LocalDate.now(),true);
|
|
|
|
|
+
|
|
|
InspectionItemVO item = new InspectionItemVO(config);
|
|
InspectionItemVO item = new InspectionItemVO(config);
|
|
|
Workbook workbook = item.exportExcelTemplate();
|
|
Workbook workbook = item.exportExcelTemplate();
|
|
|
- FileOutputStream fos = new FileOutputStream(String.format("D:/excel/%s.xlsx",config.getName()));
|
|
|
|
|
|
|
+ FileOutputStream fos = new FileOutputStream(String.format("C:/tmp/%s.xlsx",config.getName()));
|
|
|
workbook.write(fos);
|
|
workbook.write(fos);
|
|
|
fos.close();
|
|
fos.close();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
|
public void testExcelReportExport() throws IOException {
|
|
public void testExcelReportExport() throws IOException {
|
|
|
- File file = new File(PoiPublicUtil.getWebRootPath("Excel1.xlsx"));
|
|
|
|
|
- FileInputStream in = new FileInputStream(file);
|
|
|
|
|
|
|
|
|
|
|
|
+ //批间精密度
|
|
|
InspectionConfigVO config = new InspectionConfigVO("批间精密度",5,2,
|
|
InspectionConfigVO config = new InspectionConfigVO("批间精密度",5,2,
|
|
|
- new String[]{"高溶度(R1)","低浓度(R2)"},10, LocalDate.now(),true);
|
|
|
|
|
|
|
+ new String[]{"高溶度(R1)","低浓度(R2)"},3, LocalDate.now(),true);
|
|
|
|
|
+ config.setFunc(new FunctionEnum[]{FunctionEnum.AVERAGE,FunctionEnum.SD,FunctionEnum.CV});
|
|
|
InspectionItemVO item = new InspectionItemVO(config);
|
|
InspectionItemVO item = new InspectionItemVO(config);
|
|
|
|
|
+ File file = new File(String.format("C:/tmp/%sdata.xlsx",config.getName()));
|
|
|
|
|
+ FileInputStream in = new FileInputStream(file);
|
|
|
item.importExcelRecord(in);
|
|
item.importExcelRecord(in);
|
|
|
|
|
+ //批内精密度
|
|
|
|
|
+ InspectionConfigVO config2 = new InspectionConfigVO("批内精密度",1,2,
|
|
|
|
|
+ new String[]{"高溶度(R1)","低浓度(R2)"},10, LocalDate.now(),true);
|
|
|
|
|
+ config2.setFunc(new FunctionEnum[]{FunctionEnum.AVERAGE,FunctionEnum.SD,FunctionEnum.CV});
|
|
|
|
|
+ InspectionItemVO item2 = new InspectionItemVO(config2);
|
|
|
|
|
+ File file2 = new File(String.format("C:/tmp/%sdata.xlsx",config2.getName()));
|
|
|
|
|
+ FileInputStream in2 = new FileInputStream(file2);
|
|
|
|
|
+ item2.importExcelRecord(in2);
|
|
|
|
|
|
|
|
InspectionVO vo = new InspectionVO();
|
|
InspectionVO vo = new InspectionVO();
|
|
|
vo.setName("TEST");
|
|
vo.setName("TEST");
|
|
|
vo.getItem().add(item);
|
|
vo.getItem().add(item);
|
|
|
|
|
+ vo.getItem().add(item2);
|
|
|
|
|
+
|
|
|
final Workbook workbook = vo.exportExcelReport();
|
|
final Workbook workbook = vo.exportExcelReport();
|
|
|
- FileOutputStream fos = new FileOutputStream(String.format("D:/excel/%s.xlsx",vo.getName()));
|
|
|
|
|
|
|
+ FileOutputStream fos = new FileOutputStream(String.format("C:/tmp/%s.xlsx",vo.getName()));
|
|
|
workbook.write(fos);
|
|
workbook.write(fos);
|
|
|
fos.close();
|
|
fos.close();
|
|
|
|
|
|