|
|
@ -1282,29 +1282,46 @@ public class QcServiceImpl implements QcService { |
|
|
task = new QcPartAttributeData(); |
|
|
task = new QcPartAttributeData(); |
|
|
// 获得该行 |
|
|
// 获得该行 |
|
|
XSSFRow row = sheet.getRow(j); |
|
|
XSSFRow row = sheet.getRow(j); |
|
|
|
|
|
String templateId = row.getCell(1).getStringCellValue(); |
|
|
|
|
|
// 截取检验类型 |
|
|
|
|
|
String type = templateId.substring(0, templateId.indexOf("-")); |
|
|
|
|
|
String operation = row.getCell(2).getStringCellValue(); |
|
|
|
|
|
String resourceId = row.getCell(3).getStringCellValue(); |
|
|
|
|
|
String supplierNo = row.getCell(4).getStringCellValue(); |
|
|
|
|
|
if ("IQC".equals(type)) { |
|
|
|
|
|
if (Objects.isNull(supplierNo)||supplierNo.equals("")){ |
|
|
|
|
|
throw new RuntimeException("第"+j+"条数据,检验模板类型为"+type+"时,供应商不能为空!"); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
if (Objects.isNull(operation)|| Objects.isNull(resourceId)||operation.equals("") || resourceId.equals("")) { |
|
|
|
|
|
throw new RuntimeException("第"+j+"条数据,检验模板类型为"+type+"时,工序和机台不能为空!"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
// 为对象赋值 |
|
|
// 为对象赋值 |
|
|
task.setSite(paramData.getSite()); |
|
|
|
|
|
|
|
|
task.setSite(paramData.getSite().split("_")[0]); |
|
|
|
|
|
task.setBuNo(paramData.getSite().split("_")[1]); |
|
|
task.setPartNo(row.getCell(0).getRawValue()); |
|
|
task.setPartNo(row.getCell(0).getRawValue()); |
|
|
task.setSupplierNo(row.getCell(1).getRawValue()); |
|
|
|
|
|
|
|
|
task.setSupplierNo(row.getCell(4).getStringCellValue()); |
|
|
task.setAttributeType("A"); |
|
|
task.setAttributeType("A"); |
|
|
task.setAttributeRemark(row.getCell(2).getStringCellValue()); |
|
|
|
|
|
|
|
|
task.setAttributeRemark(row.getCell(5).getStringCellValue()); |
|
|
task.setCreateBy(paramData.getCreateBy()); |
|
|
task.setCreateBy(paramData.getCreateBy()); |
|
|
// 查重 |
|
|
// 查重 |
|
|
task.setAttributeNo(task.getPartNo()); |
|
|
task.setAttributeNo(task.getPartNo()); |
|
|
QcPartAttributeData partAttributeData = qcMapper.selectPartAttributeByNo(task); |
|
|
QcPartAttributeData partAttributeData = qcMapper.selectPartAttributeByNo(task); |
|
|
if(partAttributeData != null){ |
|
|
|
|
|
throw new RuntimeException("该物料属性已存在!"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(partAttributeData == null){ |
|
|
// 新增物料属性 |
|
|
// 新增物料属性 |
|
|
qcMapper.qcPartAttributeSave(task); |
|
|
qcMapper.qcPartAttributeSave(task); |
|
|
|
|
|
} |
|
|
|
|
|
// 新增物料属性中的模板 |
|
|
QcTemplateData templateData = new QcTemplateData(); |
|
|
QcTemplateData templateData = new QcTemplateData(); |
|
|
templateData.setSite(task.getSite()); |
|
|
templateData.setSite(task.getSite()); |
|
|
|
|
|
templateData.setBuNo(task.getBuNo()); |
|
|
templateData.setAttributeNo(task.getPartNo()); |
|
|
templateData.setAttributeNo(task.getPartNo()); |
|
|
// 新增物料属性中的模板 |
|
|
|
|
|
int cells = row.getLastCellNum(); |
|
|
|
|
|
for (int i = 1; i <= cells - 3; i++) { |
|
|
|
|
|
templateData.setTemplateId(row.getCell(2 + i).getRawValue()); |
|
|
|
|
|
|
|
|
templateData.setTemplateId(templateId); |
|
|
QcTemplateData data = qcMapper.selectTemplateData(templateData); |
|
|
QcTemplateData data = qcMapper.selectTemplateData(templateData); |
|
|
|
|
|
if (data == null) { |
|
|
|
|
|
throw new RuntimeException("BU:"+templateData.getBuNo()+" 模板不存在,请检查模板编码:" + templateId); |
|
|
|
|
|
} |
|
|
templateData.setSamplingLevelNo(data.getSamplingLevelNo()); |
|
|
templateData.setSamplingLevelNo(data.getSamplingLevelNo()); |
|
|
templateData.setInspectionCycle(data.getInspectionCycle()); |
|
|
templateData.setInspectionCycle(data.getInspectionCycle()); |
|
|
templateData.setSamplingProgrammeNo(data.getSamplingProgrammeNo()); |
|
|
templateData.setSamplingProgrammeNo(data.getSamplingProgrammeNo()); |
|
|
@ -1313,10 +1330,11 @@ public class QcServiceImpl implements QcService { |
|
|
templateData.setRe(data.getRe()); |
|
|
templateData.setRe(data.getRe()); |
|
|
templateData.setInspectionTypeNo(data.getInspectionTypeNo()); |
|
|
templateData.setInspectionTypeNo(data.getInspectionTypeNo()); |
|
|
templateData.setAttributeType(task.getAttributeType()); |
|
|
templateData.setAttributeType(task.getAttributeType()); |
|
|
|
|
|
templateData.setOperation(operation); |
|
|
|
|
|
templateData.setResourceID(resourceId); |
|
|
// 新增 |
|
|
// 新增 |
|
|
qcMapper.savePartAttributeDetails(templateData); |
|
|
qcMapper.savePartAttributeDetails(templateData); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
}catch (Exception e){ |
|
|
}catch (Exception e){ |
|
|
throw new RuntimeException("导入失败:"+e.getMessage()); |
|
|
throw new RuntimeException("导入失败:"+e.getMessage()); |
|
|
} |
|
|
} |
|
|
|