|
|
|
@ -1,27 +1,22 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.excel.jx;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IExcelImportExtService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IPartExtDataService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.busi.bu3.ISxPartExtService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base.CommonExtService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.bean.MesOqcRuleNoteDetail;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.bean.MesOqcRuleNoteDetailTravel;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.model.ExcelImportErrorExtModel;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.model.ExcelImportResultExtModel;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.model.bu.PartCategoryModel;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.repository.MesOqcRuleNoteDetailRepository;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.repository.MesOqcRuleNoteDetailTravelRepository;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.mes.apiservice.util.MesCommonUtil;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.BaseResultBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPart;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPartCategory;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesPartRepository;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import org.apache.poi.ss.usermodel.CellType;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
@ -215,19 +210,27 @@ public class JxOqcProjectExcelService implements IExcelImportExtService {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//欠点值
|
|
|
|
|
String defectValueStr = null;
|
|
|
|
|
try {
|
|
|
|
|
row.getCell(6).setCellType(CellType.STRING);
|
|
|
|
|
defectValueStr = row.getCell(6, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//值类型
|
|
|
|
|
String valueTypeStr = null;
|
|
|
|
|
try {
|
|
|
|
|
row.getCell(6).setCellType(CellType.STRING);
|
|
|
|
|
valueTypeStr = row.getCell(6, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
row.getCell(7).setCellType(CellType.STRING);
|
|
|
|
|
valueTypeStr = row.getCell(7, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//进制类型
|
|
|
|
|
String baseTypeStr = null;
|
|
|
|
|
try {
|
|
|
|
|
row.getCell(7).setCellType(CellType.STRING);
|
|
|
|
|
baseTypeStr = row.getCell(7, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
row.getCell(8).setCellType(CellType.STRING);
|
|
|
|
|
baseTypeStr = row.getCell(8, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -235,40 +238,40 @@ public class JxOqcProjectExcelService implements IExcelImportExtService {
|
|
|
|
|
String standardValue = null;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
row.getCell(8).setCellType(CellType.STRING);
|
|
|
|
|
standardValue = row.getCell(8, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
row.getCell(9).setCellType(CellType.STRING);
|
|
|
|
|
standardValue = row.getCell(9, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//下限值
|
|
|
|
|
String downLimit = null;
|
|
|
|
|
try {
|
|
|
|
|
row.getCell(9).setCellType(CellType.STRING);
|
|
|
|
|
downLimit = row.getCell(9, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
row.getCell(10).setCellType(CellType.STRING);
|
|
|
|
|
downLimit = row.getCell(10, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//上限值
|
|
|
|
|
String upLimit = null;
|
|
|
|
|
try {
|
|
|
|
|
row.getCell(10).setCellType(CellType.STRING);
|
|
|
|
|
upLimit = row.getCell(10, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
row.getCell(11).setCellType(CellType.STRING);
|
|
|
|
|
upLimit = row.getCell(11, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//启用器具
|
|
|
|
|
String appliance = null;
|
|
|
|
|
try {
|
|
|
|
|
row.getCell(11).setCellType(CellType.STRING);
|
|
|
|
|
appliance = row.getCell(11, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
row.getCell(12).setCellType(CellType.STRING);
|
|
|
|
|
appliance = row.getCell(12, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//备注
|
|
|
|
|
String modifyRemark = null;
|
|
|
|
|
try {
|
|
|
|
|
row.getCell(12).setCellType(CellType.STRING);
|
|
|
|
|
modifyRemark = row.getCell(12, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
row.getCell(13).setCellType(CellType.STRING);
|
|
|
|
|
modifyRemark = row.getCell(13, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -352,12 +355,22 @@ public class JxOqcProjectExcelService implements IExcelImportExtService {
|
|
|
|
|
errorInfo += "第F列数据必填;";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Integer defectValue = null;
|
|
|
|
|
if (!StringUtils.isEmpty(defectValueStr)) {
|
|
|
|
|
defectValue = MesExtEnumUtil.OQC_DEFECT_TYPE.descriptionOfValue(defectValueStr);
|
|
|
|
|
if (defectValue == null) {
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "G;";
|
|
|
|
|
errorInfo += "欠点值无效;";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Integer baseType = MesExtEnumUtil.OQC_BASE_TYPE.DECIMALISM.getValue();
|
|
|
|
|
if (!StringUtils.isEmpty(baseTypeStr)) {
|
|
|
|
|
baseType = MesExtEnumUtil.OQC_BASE_TYPE.descriptionOfValue(baseTypeStr);
|
|
|
|
|
if (baseType == null) {
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "H;";
|
|
|
|
|
cellNum += "I;";
|
|
|
|
|
errorInfo += "进制类型无效;";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -365,14 +378,14 @@ public class JxOqcProjectExcelService implements IExcelImportExtService {
|
|
|
|
|
Integer valueType = MesExtEnumUtil.CHECK_JUDGE_TYPE.descriptionOfValue(valueTypeStr);
|
|
|
|
|
if (StringUtils.isEmpty(valueTypeStr)) {
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "G;";
|
|
|
|
|
errorInfo += "第G列数据必填;";
|
|
|
|
|
cellNum += "H;";
|
|
|
|
|
errorInfo += "第H列数据必填;";
|
|
|
|
|
}else{
|
|
|
|
|
if (valueType == null) {
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "G;";
|
|
|
|
|
errorInfo += "第G列数据无效;";
|
|
|
|
|
}else if(valueType == (MesExtEnumUtil.CHECK_JUDGE_TYPE.COMPARE_TYPE.getValue())){
|
|
|
|
|
cellNum += "H;";
|
|
|
|
|
errorInfo += "第H列数据无效;";
|
|
|
|
|
} else if(valueType == (MesExtEnumUtil.CHECK_JUDGE_TYPE.COMPARE_TYPE.getValue())){
|
|
|
|
|
try{
|
|
|
|
|
//标准值
|
|
|
|
|
Double standardValueCheck = null;
|
|
|
|
@ -389,15 +402,15 @@ public class JxOqcProjectExcelService implements IExcelImportExtService {
|
|
|
|
|
standardValueCheck = baseConvertToDecimalism(standardValue, baseType);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "I;";
|
|
|
|
|
errorInfo += "第I列数据无效,十进制最多3位小数,十六进制值无效;";
|
|
|
|
|
cellNum += "J;";
|
|
|
|
|
errorInfo += "第J列数据无效,十进制最多3位小数,十六进制值无效;";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String[] standardArray = standardValue.split(MesExtConstWords.DECIMAL_POINT);
|
|
|
|
|
if (null != standardArray && standardArray.length == 2 && standardArray[1].length() > 3) {
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "I;";
|
|
|
|
|
errorInfo += "第I列数据无效,最多3位小数;";
|
|
|
|
|
cellNum += "J;";
|
|
|
|
|
errorInfo += "第J列数据无效,最多3位小数;";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -408,15 +421,15 @@ public class JxOqcProjectExcelService implements IExcelImportExtService {
|
|
|
|
|
upLimitCheck = baseConvertToDecimalism(upLimit, baseType);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "K;";
|
|
|
|
|
errorInfo += "第K列数据无效,十进制最多3位小数,十六进制值无效;";
|
|
|
|
|
cellNum += "L;";
|
|
|
|
|
errorInfo += "第L列数据无效,十进制最多3位小数,十六进制值无效;";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String[] standardArray = upLimit.split(MesExtConstWords.DECIMAL_POINT);
|
|
|
|
|
if (null != standardArray && standardArray.length == 2 && standardArray[1].length() > 3) {
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "K;";
|
|
|
|
|
errorInfo += "第K列数据无效,最多3位小数;";
|
|
|
|
|
cellNum += "L;";
|
|
|
|
|
errorInfo += "第L列数据无效,最多3位小数;";
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
num++;
|
|
|
|
@ -428,15 +441,15 @@ public class JxOqcProjectExcelService implements IExcelImportExtService {
|
|
|
|
|
downLimitCheck = baseConvertToDecimalism(downLimit, baseType);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "J;";
|
|
|
|
|
errorInfo += "第J列数据无效,十进制最多3位小数,十六进制值无效;";
|
|
|
|
|
cellNum += "K;";
|
|
|
|
|
errorInfo += "第K列数据无效,十进制最多3位小数,十六进制值无效;";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String[] standardArray = downLimit.split(MesExtConstWords.DECIMAL_POINT);
|
|
|
|
|
if (null != standardArray && standardArray.length == 2 && standardArray[1].length() > 3) {
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "J;";
|
|
|
|
|
errorInfo += "第J列数据无效,最多3位小数;";
|
|
|
|
|
cellNum += "K;";
|
|
|
|
|
errorInfo += "第K列数据无效,最多3位小数;";
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
num++;
|
|
|
|
@ -444,8 +457,8 @@ public class JxOqcProjectExcelService implements IExcelImportExtService {
|
|
|
|
|
|
|
|
|
|
if(num == 2){
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "J+K;";
|
|
|
|
|
errorInfo += "第J+K列数据无效,需至少其中一个有值;";
|
|
|
|
|
cellNum += "K+L;";
|
|
|
|
|
errorInfo += "第K+L列数据无效,需至少其中一个有值;";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String computeType;
|
|
|
|
@ -465,39 +478,39 @@ public class JxOqcProjectExcelService implements IExcelImportExtService {
|
|
|
|
|
case ONE:
|
|
|
|
|
if(downLimitCheck > standardValueCheck || standardValueCheck > upLimitCheck || downLimitCheck > upLimitCheck){
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "I;";
|
|
|
|
|
cellNum += "J;";
|
|
|
|
|
errorInfo += "比值范围输入不合理;";
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case TWO:
|
|
|
|
|
if(standardValueCheck < downLimitCheck){
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "I;";
|
|
|
|
|
cellNum += "J;";
|
|
|
|
|
errorInfo += "标准值大于上限值;";
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case THREE:
|
|
|
|
|
if(standardValueCheck > upLimitCheck){
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "I;";
|
|
|
|
|
cellNum += "J;";
|
|
|
|
|
errorInfo += "标准值大于上限值;";
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case FOUR:
|
|
|
|
|
if(downLimitCheck > upLimitCheck){
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "K;";
|
|
|
|
|
cellNum += "L;";
|
|
|
|
|
errorInfo += "上限值小于下限值;";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "I+J+K;";
|
|
|
|
|
cellNum += "J+K+L;";
|
|
|
|
|
errorInfo += "不符合结果类型对应的请求参数类型;";
|
|
|
|
|
}
|
|
|
|
|
}else if(valueType == MesExtEnumUtil.CHECK_JUDGE_TYPE.EQUIVALENCE_TYPE.getValue() && StringUtils.isEmpty(standardValue)){
|
|
|
|
|
errorNum++;
|
|
|
|
|
cellNum += "I;";
|
|
|
|
|
cellNum += "J;";
|
|
|
|
|
errorInfo += "标准值不能为空;";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -544,6 +557,7 @@ public class JxOqcProjectExcelService implements IExcelImportExtService {
|
|
|
|
|
item.setCheckItem(oqcProject);
|
|
|
|
|
item.setBaseType(baseType);
|
|
|
|
|
item.setStandard(standard);
|
|
|
|
|
item.setDefectValue(defectValue);
|
|
|
|
|
item.setUpLimit(upLimit);
|
|
|
|
|
item.setDownLimit(downLimit);
|
|
|
|
|
item.setCheckTool(appliance);
|
|
|
|
@ -596,6 +610,9 @@ public class JxOqcProjectExcelService implements IExcelImportExtService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Double baseConvertToDecimalism(String value, int baseOfValue) {
|
|
|
|
|
|
|
|
|
|
if (MesExtEnumUtil.OQC_BASE_TYPE.DECIMALISM.getValue() == baseOfValue) return Double.valueOf(value);
|
|
|
|
|
|
|
|
|
|
return Double.valueOf(Integer.parseInt(value, MesExtEnumUtil.OQC_BASE_TYPE.baseOfValue(baseOfValue)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|