|
|
|
@ -59,18 +59,16 @@ public class QcServiceImpl implements QcService { |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void qcMethodSave(QcMethodData data) { |
|
|
|
// // 查询最大编码,自增后赋值 |
|
|
|
// String s = qcMapper.queryLastMethodNo(); |
|
|
|
// if (s == null){ |
|
|
|
// data.setMethodNo("10001"); |
|
|
|
// }else { |
|
|
|
// int no = Integer.parseInt(qcMapper.queryLastMethodNo()); |
|
|
|
// data.setMethodNo(String.valueOf(++no)); |
|
|
|
// } |
|
|
|
// 检验是否已存在该检验方法 |
|
|
|
List<QcMethodData> methodData = qcMapper.checkQcMethod(data); |
|
|
|
if(methodData.size() > 0){ |
|
|
|
throw new RuntimeException("该检验方法编码已存在!"); |
|
|
|
// 获取编码 |
|
|
|
String methodNo = qcMapper.getMethodNo(data); |
|
|
|
if ("101".equals(data.getInspectionTypeNo()) || "102".equals(data.getInspectionTypeNo()) || "103".equals(data.getInspectionTypeNo()) || "104".equals(data.getInspectionTypeNo())) { |
|
|
|
data.setMethodNo("IPQC-" + methodNo); |
|
|
|
} else if ("105".equals(data.getInspectionTypeNo())) { |
|
|
|
data.setMethodNo("IQC-" + methodNo); |
|
|
|
} else if ("106".equals(data.getInspectionTypeNo())) { |
|
|
|
data.setMethodNo("FAI-" + methodNo); |
|
|
|
} else if ("107".equals(data.getInspectionTypeNo())) { |
|
|
|
data.setMethodNo("FQC-" + methodNo); |
|
|
|
} |
|
|
|
// 新增数据 |
|
|
|
qcMapper.qcMethodSave(data); |
|
|
|
@ -87,11 +85,6 @@ public class QcServiceImpl implements QcService { |
|
|
|
public void qcMethodUpdate(QcMethodData data) { |
|
|
|
// 修改方法 |
|
|
|
qcMapper.qcMethodUpdate(data); |
|
|
|
// // 检验是否已存在该检验方法 |
|
|
|
// List<QcMethodData> methodData = qcMapper.checkQcMethod(data); |
|
|
|
// if(methodData.size() > 1){ |
|
|
|
// throw new RuntimeException("该方法名已存在!"); |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -149,18 +142,17 @@ public class QcServiceImpl implements QcService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
List<QcItemData> itemList = qcMapper.checkQcItem(data); |
|
|
|
if(itemList.size() > 0){ |
|
|
|
throw new RuntimeException("该检验项目编码已存在!"); |
|
|
|
} |
|
|
|
// // 查询最大编码,自增后赋值 |
|
|
|
// String s = qcMapper.queryLastItemNo(data); |
|
|
|
// if (s == null){ |
|
|
|
// data.setItemNo("10001"); |
|
|
|
// }else { |
|
|
|
// int no = Integer.parseInt(qcMapper.queryLastItemNo(data)); |
|
|
|
// data.setItemNo(String.valueOf(++no)); |
|
|
|
// } |
|
|
|
// 获取编码 |
|
|
|
String itemNo = qcMapper.getItemNo(data); |
|
|
|
if ("101".equals(data.getInspectionTypeNo()) || "102".equals(data.getInspectionTypeNo()) || "103".equals(data.getInspectionTypeNo()) || "104".equals(data.getInspectionTypeNo())) { |
|
|
|
data.setItemNo("IPQC-" + itemNo); |
|
|
|
} else if ("105".equals(data.getInspectionTypeNo())) { |
|
|
|
data.setItemNo("IQC-" + itemNo); |
|
|
|
} else if ("106".equals(data.getInspectionTypeNo())) { |
|
|
|
data.setItemNo("FAI-" + itemNo); |
|
|
|
} else if ("107".equals(data.getInspectionTypeNo())) { |
|
|
|
data.setItemNo("FQC-" + itemNo); |
|
|
|
} |
|
|
|
// 新增项目 |
|
|
|
qcMapper.qcItemSave(data); |
|
|
|
// 新增项目里的方法 |
|
|
|
@ -237,16 +229,6 @@ public class QcServiceImpl implements QcService { |
|
|
|
int rows = sheet.getPhysicalNumberOfRows(); |
|
|
|
// 声明对象 |
|
|
|
QcItemData task = null; |
|
|
|
int no = 0; |
|
|
|
// 查询最大编码,自增后赋值 |
|
|
|
String s = qcMapper.selectLastItemNo(); |
|
|
|
if (s == null){ |
|
|
|
no = 10001; |
|
|
|
}else { |
|
|
|
no = Integer.parseInt(qcMapper.selectLastItemNo()); |
|
|
|
} |
|
|
|
// 查出最大的编码值 |
|
|
|
//int no = Integer.parseInt(qcMapper.selectLastItemNo()); |
|
|
|
// 遍历每一行(从第二行开始) |
|
|
|
for (int j = 1; j < rows; j++) { |
|
|
|
// 实例化对象 |
|
|
|
@ -254,7 +236,19 @@ public class QcServiceImpl implements QcService { |
|
|
|
//获得该行 |
|
|
|
XSSFRow row = sheet.getRow(j); |
|
|
|
// 为对象赋值 |
|
|
|
task.setItemNo(String.valueOf(++no)); |
|
|
|
task.setSite(data.getSite()); |
|
|
|
task.setInspectionTypeNo(row.getCell(3).getRawValue()); |
|
|
|
// 获取编码 |
|
|
|
String itemNo = qcMapper.getItemNo(task); |
|
|
|
if ("101".equals(task.getInspectionTypeNo()) || "102".equals(task.getInspectionTypeNo()) || "103".equals(task.getInspectionTypeNo()) || "104".equals(task.getInspectionTypeNo())) { |
|
|
|
task.setItemNo("IPQC-" + itemNo); |
|
|
|
} else if ("105".equals(task.getInspectionTypeNo())) { |
|
|
|
task.setItemNo("IQC-" + itemNo); |
|
|
|
} else if ("106".equals(task.getInspectionTypeNo())) { |
|
|
|
task.setItemNo("FAI-" + itemNo); |
|
|
|
} else if ("107".equals(task.getInspectionTypeNo())) { |
|
|
|
task.setItemNo("FQC-" + itemNo); |
|
|
|
} |
|
|
|
task.setItemDesc(row.getCell(0).getStringCellValue()); |
|
|
|
task.setValueType(row.getCell(1).getStringCellValue()); |
|
|
|
if (row.getCell(1).getStringCellValue().equals("文本")){ |
|
|
|
@ -263,34 +257,27 @@ public class QcServiceImpl implements QcService { |
|
|
|
task.setMinValue(null); |
|
|
|
} else if (row.getCell(1).getStringCellValue().equals("数字")) { |
|
|
|
task.setValueTypeDb("N"); |
|
|
|
if(row.getCell(3) == null){ |
|
|
|
if (row.getCell(3) == null) { |
|
|
|
task.setMaxValue(null); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
task.setMaxValue(BigDecimal.valueOf(row.getCell(3).getNumericCellValue())); |
|
|
|
} |
|
|
|
if(row.getCell(4) == null){ |
|
|
|
if (row.getCell(4) == null) { |
|
|
|
task.setMinValue(null); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
task.setMinValue(BigDecimal.valueOf(row.getCell(4).getNumericCellValue())); |
|
|
|
} |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
task.setValueTypeDb(null); |
|
|
|
} |
|
|
|
if(row.getCell(2) == null){ |
|
|
|
if (row.getCell(2) == null) { |
|
|
|
task.setDefaultValue(null); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
task.setDefaultValue(row.getCell(2).getRawValue()); |
|
|
|
} |
|
|
|
task.setItemType("D"); |
|
|
|
task.setCreatedBy(data.getCreateBy()); |
|
|
|
task.setMethodNo(row.getCell(5).getRawValue()); |
|
|
|
// 查重 |
|
|
|
String itemDesc = task.getItemDesc(); |
|
|
|
String itemType = task.getItemType(); |
|
|
|
EamPropertiesItemData propertiesItem = qcMapper.getItemByItemNo(task); |
|
|
|
if(propertiesItem != null){ |
|
|
|
throw new Exception("项目已存在"); |
|
|
|
} |
|
|
|
// 新增 |
|
|
|
qcMapper.qcItemSave(task); |
|
|
|
// 新增项目里的方法 |
|
|
|
@ -472,18 +459,16 @@ public class QcServiceImpl implements QcService { |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void templateSave(QcTemplateData data) { |
|
|
|
// 根据模板名称查询模板 |
|
|
|
QcTemplateData templateData = qcMapper.selectTemplateByDesc(data); |
|
|
|
if (templateData != null){ |
|
|
|
throw new RuntimeException("该模板已存在!"); |
|
|
|
} |
|
|
|
// 查询最大编码,自增后赋值 |
|
|
|
String s = qcMapper.queryLastTemplateNo(); |
|
|
|
if (s == null){ |
|
|
|
data.setTemplateId("10001"); |
|
|
|
}else { |
|
|
|
int no = Integer.parseInt(qcMapper.queryLastTemplateNo()); |
|
|
|
data.setTemplateId(String.valueOf(++no)); |
|
|
|
// 获取编码 |
|
|
|
String templateNo = qcMapper.getTemplateNo(data); |
|
|
|
if ("101".equals(data.getInspectionTypeNo()) || "102".equals(data.getInspectionTypeNo()) || "103".equals(data.getInspectionTypeNo()) || "104".equals(data.getInspectionTypeNo())) { |
|
|
|
data.setTemplateId("IPQC-" + templateNo); |
|
|
|
} else if ("105".equals(data.getInspectionTypeNo())) { |
|
|
|
data.setTemplateId("IQC-" + templateNo); |
|
|
|
} else if ("106".equals(data.getInspectionTypeNo())) { |
|
|
|
data.setTemplateId("FAI-" + templateNo); |
|
|
|
} else if ("107".equals(data.getInspectionTypeNo())) { |
|
|
|
data.setTemplateId("FQC-" + templateNo); |
|
|
|
} |
|
|
|
// 新增 |
|
|
|
qcMapper.templateSave(data); |
|
|
|
@ -624,16 +609,6 @@ public class QcServiceImpl implements QcService { |
|
|
|
int rows = sheet.getPhysicalNumberOfRows(); |
|
|
|
// 声明对象 |
|
|
|
QcTemplateData task = null; |
|
|
|
int no = 0; |
|
|
|
// 查询最大编码,自增后赋值 |
|
|
|
String s = qcMapper.queryLastTemplateNo(); |
|
|
|
if (s == null){ |
|
|
|
no = 10001; |
|
|
|
}else { |
|
|
|
no = Integer.parseInt(qcMapper.queryLastTemplateNo()); |
|
|
|
} |
|
|
|
// 查出最大的编码值 |
|
|
|
// int no = Integer.parseInt(qcMapper.queryLastTemplateNo()); |
|
|
|
// 遍历每一行(从第二行开始) |
|
|
|
for (int j = 1; j < rows; j++) { |
|
|
|
// 实例化对象 |
|
|
|
@ -641,8 +616,19 @@ public class QcServiceImpl implements QcService { |
|
|
|
// 获得该行 |
|
|
|
XSSFRow row = sheet.getRow(j); |
|
|
|
// 为对象赋值 |
|
|
|
task.setTemplateId(String.valueOf(++no)); |
|
|
|
task.setSite(paraData.getSite()); |
|
|
|
task.setInspectionTypeNo(row.getCell(9).getRawValue()); |
|
|
|
// 获取编码 |
|
|
|
String templateNo = qcMapper.getTemplateNo(task); |
|
|
|
if ("101".equals(task.getInspectionTypeNo()) || "102".equals(task.getInspectionTypeNo()) || "103".equals(task.getInspectionTypeNo()) || "104".equals(task.getInspectionTypeNo())) { |
|
|
|
task.setTemplateId("IPQC-" + templateNo); |
|
|
|
} else if ("105".equals(task.getInspectionTypeNo())) { |
|
|
|
task.setTemplateId("IQC-" + templateNo); |
|
|
|
} else if ("106".equals(task.getInspectionTypeNo())) { |
|
|
|
task.setTemplateId("FAI-" + templateNo); |
|
|
|
} else if ("107".equals(task.getInspectionTypeNo())) { |
|
|
|
task.setTemplateId("FQC-" + templateNo); |
|
|
|
} |
|
|
|
task.setTemplateName(row.getCell(0).getStringCellValue()); |
|
|
|
task.setSamplingProgrammeNo(row.getCell(1).getRawValue()); |
|
|
|
task.setSamplingLevelNo(row.getCell(2).getRawValue()); |
|
|
|
@ -678,8 +664,6 @@ public class QcServiceImpl implements QcService { |
|
|
|
}else { |
|
|
|
task.setRe(BigDecimal.valueOf(row.getCell(8).getNumericCellValue())); |
|
|
|
} |
|
|
|
|
|
|
|
task.setInspectionTypeNo(row.getCell(9).getRawValue()); |
|
|
|
if (row.getCell(10) == null){ |
|
|
|
task.setTemplateRemark(null); |
|
|
|
}else { |
|
|
|
|