|
@@ -478,21 +478,14 @@ public class CustomExcelImportUtil {
|
|
|
"C:\\Users\\cyz\\Desktop\\固定资产0207(1)\\固定资产折旧明细表-2020年12月-苏丹.xls",
|
|
|
"C:\\Users\\cyz\\Desktop\\固定资产0207(1)\\固定资产折旧明细表-2020年12月-坦桑尼亚.xls",
|
|
|
"C:\\Users\\cyz\\Desktop\\固定资产0207(1)\\固定资产折旧明细表-2020年12月-苏丹.xls"};*/
|
|
|
- String[] files = {"C:\\Users\\cyz\\Desktop\\备件基础信息 导入版.xls"};
|
|
|
+ String[] files = {"C:\\Users\\cyz\\Desktop\\2021.5.31 注塑设备台账导入文件.xls"};
|
|
|
InputStream inputstream = new FileInputStream(files[0]);
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
- List<SparePartInfoVO> list = importSparePartInfoList(now, inputstream);
|
|
|
- //List<SbInfo> list = importSbInfoList(inputstream);
|
|
|
+ // List<SparePartInfoVO> list = importSparePartInfoList(now, inputstream);
|
|
|
+ List<SbInfoVO> list = importSbInfoList(inputstream);
|
|
|
// List<SbModel> list = importModelList(inputstream);
|
|
|
//List<SbInfo> list = importSbInfoListForUpdateValue(inputstream);
|
|
|
|
|
|
-
|
|
|
- /* List<SpareStore> list = importSpareStoreList(inputstream);
|
|
|
- list.forEach(item -> {
|
|
|
- System.out.println(item.toString());
|
|
|
- });*/
|
|
|
-
|
|
|
-
|
|
|
//List<SparePartInfoVO> list = importSparePartInfoListForUpdate(LocalDateTime.now(), inputstream);
|
|
|
list.forEach(item -> {
|
|
|
System.out.println(item.toString());
|
|
@@ -847,15 +840,28 @@ public class CustomExcelImportUtil {
|
|
|
for (int i = 2; i <= rowCounts; i++) {
|
|
|
record = new SbInfoVO();
|
|
|
Row row = sheet.getRow(i);
|
|
|
- String index = row.getCell(0).getStringCellValue() + "";
|
|
|
+ if(isRowEmpty(row)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String index = row.getCell(1).getStringCellValue() + "";
|
|
|
try {
|
|
|
//i,j i:行 j:列
|
|
|
record.setNo(row.getCell(1).getStringCellValue().trim());
|
|
|
record.setZbh(getCellValue(row.getCell(2)));
|
|
|
record.setName(row.getCell(3).getStringCellValue().trim().replace("'", ""));
|
|
|
record.setModel(getCellValue(row.getCell(4)).trim());
|
|
|
- record.setLevel(getLevel(row.getCell(5).getStringCellValue()));
|
|
|
- record.setInitialValue(new Double(getCellValue(row.getCell(6))));
|
|
|
+ String level = getCellValue(row.getCell(5));
|
|
|
+ if(StringUtils.isBlank(level)){
|
|
|
+ record.setLevel(1);
|
|
|
+ }else{
|
|
|
+ record.setLevel(getLevel(level));
|
|
|
+ }
|
|
|
+ String value = getCellValue(row.getCell(6));
|
|
|
+ if(StringUtils.isBlank(value)){
|
|
|
+ record.setInitialValue(0.0);
|
|
|
+ }else{
|
|
|
+ record.setInitialValue(new Double(value));
|
|
|
+ }
|
|
|
record.setTypeId(row.getCell(7).getStringCellValue().trim());
|
|
|
record.setUseType(getUseType(row.getCell(8).getStringCellValue().trim()));
|
|
|
record.setZz(getCellValue(row.getCell(9)));
|