|
@@ -1846,55 +1846,58 @@ public class CustomExcelImportUtil {
|
|
|
// System.out.println("index:" + index);
|
|
|
try {
|
|
|
record.setId(row.getCell(0).getStringCellValue());
|
|
|
- String no = getCellValue(row.getCell(1));
|
|
|
+ String no = getCellValue(row.getCell(2));
|
|
|
if(StringUtils.isNotBlank(no) && no.contains(".")){
|
|
|
record.setNo(no.split(".")[0]);
|
|
|
}else{
|
|
|
record.setNo(no);
|
|
|
}
|
|
|
- record.setName(row.getCell(2).getStringCellValue());
|
|
|
- record.setTypeName(row.getCell(3).getStringCellValue());
|
|
|
- String value = getCellValue(row.getCell(4));
|
|
|
+ record.setName(row.getCell(3).getStringCellValue());
|
|
|
+ record.setTypeName(row.getCell(1).getStringCellValue());
|
|
|
+ String value = getCellValue(row.getCell(6));
|
|
|
if (StringUtils.isBlank(value)) {
|
|
|
record.setInitialValue(0.0);
|
|
|
} else {
|
|
|
record.setInitialValue(new Double(value));
|
|
|
}
|
|
|
- record.setUnit(getCellValue(row.getCell(5)));
|
|
|
- record.setGgxh(getCellValue(row.getCell(6)));
|
|
|
- record.setInitNo(getCellValue(row.getCell(7)));
|
|
|
- record.setLevel(getSpareLevel(getCellValue(row.getCell(8))));
|
|
|
- String usePeriod = getCellValue(row.getCell(9));
|
|
|
- if(StringUtils.isBlank(usePeriod)){
|
|
|
- record.setUsePeriod(new BigDecimal(0));
|
|
|
- }else{
|
|
|
- record.setUsePeriod(new BigDecimal(usePeriod));
|
|
|
- }
|
|
|
- String agePeriod = getCellValue(row.getCell(10));
|
|
|
- if(StringUtils.isBlank(agePeriod)){
|
|
|
- record.setAgePeriod(new BigDecimal(0));
|
|
|
- }else{
|
|
|
- record.setAgePeriod(new BigDecimal(agePeriod));
|
|
|
- }
|
|
|
- String purchasePeriod = getCellValue(row.getCell(11));
|
|
|
- if(StringUtils.isBlank(purchasePeriod)){
|
|
|
- record.setPurchasePeriod(new BigDecimal(0));
|
|
|
- }else{
|
|
|
- record.setPurchasePeriod(new BigDecimal(purchasePeriod));
|
|
|
- }
|
|
|
+ record.setUnit(getCellValue(row.getCell(7)));
|
|
|
+ record.setGgxh(getCellValue(row.getCell(4)));
|
|
|
+
|
|
|
+ record.setLevel(getSpareLevel(getCellValue(row.getCell(11))));
|
|
|
+// String usePeriod = getCellValue(row.getCell(9));
|
|
|
+// if(StringUtils.isBlank(usePeriod)){
|
|
|
+// record.setUsePeriod(new BigDecimal(0));
|
|
|
+// }else{
|
|
|
+// record.setUsePeriod(new BigDecimal(usePeriod));
|
|
|
+// }
|
|
|
+// String agePeriod = getCellValue(row.getCell(10));
|
|
|
+// if(StringUtils.isBlank(agePeriod)){
|
|
|
+// record.setAgePeriod(new BigDecimal(0));
|
|
|
+// }else{
|
|
|
+// record.setAgePeriod(new BigDecimal(agePeriod));
|
|
|
+// }
|
|
|
+// String purchasePeriod = getCellValue(row.getCell(11));
|
|
|
+// if(StringUtils.isBlank(purchasePeriod)){
|
|
|
+// record.setPurchasePeriod(new BigDecimal(0));
|
|
|
+// }else{
|
|
|
+// record.setPurchasePeriod(new BigDecimal(purchasePeriod));
|
|
|
+// }
|
|
|
record.setProducerId(getCellValue(row.getCell(12)));
|
|
|
- String maxStock = getCellValue(row.getCell(13));
|
|
|
+ String maxStock = getCellValue(row.getCell(9));
|
|
|
if(StringUtils.isBlank(maxStock)){
|
|
|
record.setMaxStock(new BigDecimal(0));
|
|
|
}else{
|
|
|
record.setMaxStock(new BigDecimal(maxStock));
|
|
|
}
|
|
|
- String mixStock = getCellValue(row.getCell(14));
|
|
|
+ String mixStock = getCellValue(row.getCell(10));
|
|
|
if(StringUtils.isBlank(mixStock)){
|
|
|
record.setMinStock(new BigDecimal(0));
|
|
|
}else{
|
|
|
record.setMinStock(new BigDecimal(mixStock));
|
|
|
}
|
|
|
+ record.setYt(getYt(getCellValue(row.getCell(13))));
|
|
|
+ record.setRemark(getCellValue(row.getCell(14)));
|
|
|
+// record.setCreatedTime(LocalDateTime.parse(getCellValue(row.getCell(15)),DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
|
|
record.setUpdateTime(LocalDateTime.now());
|
|
|
record.setUpdateUserId("1");
|
|
|
result.add(record);
|
|
@@ -1926,6 +1929,19 @@ public class CustomExcelImportUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private static Integer getYt(String stringCellValue) {
|
|
|
+ if (StringUtils.isBlank(stringCellValue)) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ if ("设备配件".equals(stringCellValue)) {
|
|
|
+ return 1;
|
|
|
+ } else if ("工程物资".equals(stringCellValue)) {
|
|
|
+ return 2;
|
|
|
+ }else {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 导入总需求计划明细-设备型号类
|
|
|
*
|