|
|
|
@ -330,16 +330,33 @@ public class QcServiceImpl implements QcService { |
|
|
|
task.setBuNo(buNo); |
|
|
|
} |
|
|
|
|
|
|
|
// 检验项目名称 |
|
|
|
// 检验项目编码 |
|
|
|
XSSFCell cell2 = row.getCell(2); |
|
|
|
if (cell2 == null) { |
|
|
|
throw new RuntimeException("请填写[检验项目编码]!"); |
|
|
|
} else { |
|
|
|
String itemNo; |
|
|
|
if (cell2.getCellType() == CellType.NUMERIC) { |
|
|
|
itemNo = df.format(cell2.getNumericCellValue()); |
|
|
|
} else { |
|
|
|
itemNo = cell2.getStringCellValue(); |
|
|
|
} |
|
|
|
if (itemNo.isEmpty()) { // 检查字符串是否为空 |
|
|
|
throw new RuntimeException("请填写[检验项目编码]!"); |
|
|
|
} |
|
|
|
task.setItemNo(itemNo); |
|
|
|
} |
|
|
|
|
|
|
|
// 检验项目名称 |
|
|
|
XSSFCell cell3 = row.getCell(3); |
|
|
|
if (cell3 == null) { |
|
|
|
throw new RuntimeException("请填写[检验项目名称]!"); |
|
|
|
} else { |
|
|
|
String itemDesc; |
|
|
|
if (cell2.getCellType() == CellType.NUMERIC) { |
|
|
|
itemDesc = df.format(cell2.getNumericCellValue()); |
|
|
|
if (cell3.getCellType() == CellType.NUMERIC) { |
|
|
|
itemDesc = df.format(cell3.getNumericCellValue()); |
|
|
|
} else { |
|
|
|
itemDesc = cell2.getStringCellValue(); |
|
|
|
itemDesc = cell3.getStringCellValue(); |
|
|
|
} |
|
|
|
if (itemDesc.isEmpty()) { // 检查字符串是否为空 |
|
|
|
throw new RuntimeException("请填写[检验项目名称]!"); |
|
|
|
@ -348,15 +365,15 @@ public class QcServiceImpl implements QcService { |
|
|
|
} |
|
|
|
|
|
|
|
// 检验类型 |
|
|
|
XSSFCell cell3 = row.getCell(3); |
|
|
|
if (cell3 == null) { |
|
|
|
XSSFCell cell4 = row.getCell(4); |
|
|
|
if (cell4 == null) { |
|
|
|
throw new RuntimeException("请填写[检验类型]!"); |
|
|
|
} else { |
|
|
|
String inspectionTypeNo; |
|
|
|
if (cell3.getCellType() == CellType.NUMERIC) { |
|
|
|
inspectionTypeNo = df.format(cell3.getNumericCellValue()); |
|
|
|
if (cell4.getCellType() == CellType.NUMERIC) { |
|
|
|
inspectionTypeNo = df.format(cell4.getNumericCellValue()); |
|
|
|
} else { |
|
|
|
inspectionTypeNo = cell3.getStringCellValue(); |
|
|
|
inspectionTypeNo = cell4.getStringCellValue(); |
|
|
|
} |
|
|
|
if (inspectionTypeNo.isEmpty()) { // 检查字符串是否为空 |
|
|
|
throw new RuntimeException("请填写[检验类型]!"); |
|
|
|
@ -369,11 +386,11 @@ public class QcServiceImpl implements QcService { |
|
|
|
task.setItemNo(inspectionTypePrefixes.getOrDefault(task.getInspectionTypeNo(), "") + itemNo); |
|
|
|
|
|
|
|
// 检验值类型 |
|
|
|
XSSFCell cell4 = row.getCell(4); |
|
|
|
if (cell4 == null) { |
|
|
|
XSSFCell cell5 = row.getCell(5); |
|
|
|
if (cell5 == null) { |
|
|
|
throw new RuntimeException("请填写[检验值类型]!"); |
|
|
|
} else { |
|
|
|
String valueType = cell4.getStringCellValue(); |
|
|
|
String valueType = cell5.getStringCellValue(); |
|
|
|
if (valueType.isEmpty()) { |
|
|
|
throw new RuntimeException("请填写[检验值类型]!"); |
|
|
|
} |
|
|
|
@ -385,24 +402,24 @@ public class QcServiceImpl implements QcService { |
|
|
|
} else if ("数字".equals(valueType)) { |
|
|
|
task.setValueTypeDb("N"); |
|
|
|
// 上限值 |
|
|
|
task.setMaxValue(getCellValueAsBigDecimal(row.getCell(6))); |
|
|
|
task.setMaxValue(getCellValueAsBigDecimal(row.getCell(7))); |
|
|
|
// 下限值 |
|
|
|
task.setMinValue(getCellValueAsBigDecimal(row.getCell(7))); |
|
|
|
task.setMinValue(getCellValueAsBigDecimal(row.getCell(8))); |
|
|
|
} else { |
|
|
|
task.setValueTypeDb(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 标准值 |
|
|
|
XSSFCell cell5 = row.getCell(5); |
|
|
|
if (cell5 == null) { |
|
|
|
XSSFCell cell6 = row.getCell(6); |
|
|
|
if (cell6 == null) { |
|
|
|
task.setDefaultValue(null); |
|
|
|
} else { |
|
|
|
String defaultValue; |
|
|
|
if (cell5.getCellType() == CellType.NUMERIC) { |
|
|
|
defaultValue = df.format(cell5.getNumericCellValue()); |
|
|
|
if (cell6.getCellType() == CellType.NUMERIC) { |
|
|
|
defaultValue = df.format(cell6.getNumericCellValue()); |
|
|
|
} else { |
|
|
|
defaultValue = cell5.getStringCellValue(); |
|
|
|
defaultValue = cell6.getStringCellValue(); |
|
|
|
} |
|
|
|
task.setDefaultValue(defaultValue); |
|
|
|
} |
|
|
|
@ -413,15 +430,15 @@ public class QcServiceImpl implements QcService { |
|
|
|
task.setCreatedBy(data.getCreateBy()); |
|
|
|
|
|
|
|
// 检验方法编码 |
|
|
|
XSSFCell cell8 = row.getCell(8); |
|
|
|
if (cell8 == null) { |
|
|
|
XSSFCell cell9 = row.getCell(9); |
|
|
|
if (cell9 == null) { |
|
|
|
throw new RuntimeException("请填写[检验方法编码]!"); |
|
|
|
} else { |
|
|
|
String methodNo; |
|
|
|
if (cell8.getCellType() == CellType.NUMERIC) { |
|
|
|
methodNo = df.format(cell8.getNumericCellValue()); |
|
|
|
if (cell9.getCellType() == CellType.NUMERIC) { |
|
|
|
methodNo = df.format(cell9.getNumericCellValue()); |
|
|
|
} else { |
|
|
|
methodNo = cell8.getStringCellValue(); |
|
|
|
methodNo = cell9.getStringCellValue(); |
|
|
|
} |
|
|
|
if (methodNo.isEmpty()) { // 检查字符串是否为空 |
|
|
|
throw new RuntimeException("请填写[检验方法编码]!"); |
|
|
|
@ -430,43 +447,43 @@ public class QcServiceImpl implements QcService { |
|
|
|
} |
|
|
|
|
|
|
|
// 抽样方案编码 |
|
|
|
XSSFCell cell9 = row.getCell(9); |
|
|
|
if (cell9 == null) { |
|
|
|
XSSFCell cell10 = row.getCell(10); |
|
|
|
if (cell10 == null) { |
|
|
|
task.setSamplingProgrammeNo(null); |
|
|
|
} else { |
|
|
|
String samplingProgrammeNo; |
|
|
|
if (cell9.getCellType() == CellType.NUMERIC) { |
|
|
|
samplingProgrammeNo = df.format(cell9.getNumericCellValue()); |
|
|
|
if (cell10.getCellType() == CellType.NUMERIC) { |
|
|
|
samplingProgrammeNo = df.format(cell10.getNumericCellValue()); |
|
|
|
} else { |
|
|
|
samplingProgrammeNo = cell9.getStringCellValue(); |
|
|
|
samplingProgrammeNo = cell10.getStringCellValue(); |
|
|
|
} |
|
|
|
task.setSamplingProgrammeNo(samplingProgrammeNo); |
|
|
|
} |
|
|
|
|
|
|
|
// 检验水平编码 |
|
|
|
XSSFCell cell10 = row.getCell(10); |
|
|
|
if (cell10 == null) { |
|
|
|
XSSFCell cell11 = row.getCell(11); |
|
|
|
if (cell11 == null) { |
|
|
|
task.setSamplingLevelNo(null); |
|
|
|
} else { |
|
|
|
String samplingLevelNo; |
|
|
|
if (cell10.getCellType() == CellType.NUMERIC) { |
|
|
|
samplingLevelNo = df.format(cell10.getNumericCellValue()); |
|
|
|
if (cell11.getCellType() == CellType.NUMERIC) { |
|
|
|
samplingLevelNo = df.format(cell11.getNumericCellValue()); |
|
|
|
} else { |
|
|
|
samplingLevelNo = cell10.getStringCellValue(); |
|
|
|
samplingLevelNo = cell11.getStringCellValue(); |
|
|
|
} |
|
|
|
task.setSamplingLevelNo(samplingLevelNo); |
|
|
|
} |
|
|
|
|
|
|
|
// 缺陷等级 |
|
|
|
XSSFCell cell11 = row.getCell(11); |
|
|
|
XSSFCell cell12 = row.getCell(12); |
|
|
|
if (cell11 == null) { |
|
|
|
throw new RuntimeException("请填写[缺陷等级编码]!"); |
|
|
|
} else { |
|
|
|
String defectLevelCode; |
|
|
|
if (cell11.getCellType() == CellType.NUMERIC) { |
|
|
|
defectLevelCode = df.format(cell11.getNumericCellValue()); |
|
|
|
if (cell12.getCellType() == CellType.NUMERIC) { |
|
|
|
defectLevelCode = df.format(cell12.getNumericCellValue()); |
|
|
|
} else { |
|
|
|
defectLevelCode = cell11.getStringCellValue(); |
|
|
|
defectLevelCode = cell12.getStringCellValue(); |
|
|
|
} |
|
|
|
if (defectLevelCode.isEmpty()) { // 检查字符串是否为空 |
|
|
|
throw new RuntimeException("请填写[缺陷等级编码]!"); |
|
|
|
@ -475,9 +492,9 @@ public class QcServiceImpl implements QcService { |
|
|
|
} |
|
|
|
|
|
|
|
// 抽样数量 |
|
|
|
task.setItemSamplingQuantity(getCellValueAsBigDecimal(row.getCell(12))); |
|
|
|
task.setItemSamplingQuantity(getCellValueAsBigDecimal(row.getCell(13))); |
|
|
|
// 抽样比例 |
|
|
|
task.setDefaultSamplingProportion(getCellValueAsBigDecimal(row.getCell(13))); |
|
|
|
task.setDefaultSamplingProportion(getCellValueAsBigDecimal(row.getCell(14))); |
|
|
|
|
|
|
|
// 新增 |
|
|
|
qcMapper.qcItemSave(task); |
|
|
|
|