|
|
@ -3,11 +3,9 @@ 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.IExcelImportExtService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base.CommonExtService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base.CommonExtService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.bean.SxWorkCellTaktCollectPlcCfg;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.bean.SxWorkCellTaktCollectPlcCfg;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.bean.MesWorkCenterExt;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.model.ExcelImportErrorExtModel;
|
|
|
|
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.ExcelImportResultExtModel;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.repository.SxWorkCellTaktCollectPlcCfgRepository;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.repository.SxWorkCellTaktCollectPlcCfgRepository;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.repository.MesWorkCenterExtRepository;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
@ -15,7 +13,7 @@ import cn.estsh.i3plus.platform.common.util.MesConstWords;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesWorkCellRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesWorkCellRepository;
|
|
|
|
import org.apache.poi.ss.usermodel.CellType;
|
|
|
|
import org.apache.poi.ss.usermodel.DataFormatter;
|
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
@ -128,36 +126,34 @@ public class SxWorkCellTaktCollectPlcCfgExcelService implements IExcelImportExtS
|
|
|
|
String cellNum = ""; //错误列号
|
|
|
|
String cellNum = ""; //错误列号
|
|
|
|
String errorInfo = ""; //错误信息
|
|
|
|
String errorInfo = ""; //错误信息
|
|
|
|
|
|
|
|
|
|
|
|
//松下工位节拍PLC配置
|
|
|
|
String workCenterCode;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
//第一列必须有值,否则跳过
|
|
|
|
workCenterCode = new DataFormatter().formatCellValue(row.getCell(0, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
|
|
|
|
row.getCell(0).setCellType(CellType.STRING);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String workCenterCode = row.getCell(0, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//产线代码
|
|
|
|
|
|
|
|
String workCellCode = null;
|
|
|
|
String workCellCode = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
row.getCell(1).setCellType(CellType.STRING);
|
|
|
|
workCellCode = new DataFormatter().formatCellValue(row.getCell(1, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
|
|
|
|
workCellCode = row.getCell(1, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String scanCellCode = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
scanCellCode = new DataFormatter().formatCellValue(row.getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//PLC代码
|
|
|
|
|
|
|
|
String plcCode = null;
|
|
|
|
String plcCode = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
row.getCell(2).setCellType(CellType.STRING);
|
|
|
|
plcCode = new DataFormatter().formatCellValue(row.getCell(3, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
|
|
|
|
plcCode = row.getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//产线代码
|
|
|
|
|
|
|
|
String status = null;
|
|
|
|
String status = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
row.getCell(3).setCellType(CellType.STRING);
|
|
|
|
status = new DataFormatter().formatCellValue(row.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK));
|
|
|
|
status = row.getCell(3, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim();
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -179,16 +175,27 @@ public class SxWorkCellTaktCollectPlcCfgExcelService implements IExcelImportExtS
|
|
|
|
errorInfo += "第B列数据无效;";
|
|
|
|
errorInfo += "第B列数据无效;";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(plcCode)) {
|
|
|
|
//产线代码
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(scanCellCode)) {
|
|
|
|
errorNum++;
|
|
|
|
errorNum++;
|
|
|
|
cellNum += "C;";
|
|
|
|
cellNum += "C;";
|
|
|
|
errorInfo += "第C列数据必填;";
|
|
|
|
errorInfo += "第C列数据必填;";
|
|
|
|
|
|
|
|
} else if (StringUtils.isEmpty(scanCellCode) || (CollectionUtils.isEmpty(workCellMap)) || (!workCellMap.containsKey(new StringJoiner(MesExtConstWords.AND).add(workCenterCode).add(scanCellCode).toString()))){
|
|
|
|
|
|
|
|
errorNum++;
|
|
|
|
|
|
|
|
cellNum += "C;";
|
|
|
|
|
|
|
|
errorInfo += "第C列数据无效;";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(status) && MesExtEnumUtil.IS_ENABLE.descriptionOfValue(status) == null) {
|
|
|
|
if (StringUtils.isEmpty(plcCode)) {
|
|
|
|
errorNum++;
|
|
|
|
errorNum++;
|
|
|
|
cellNum += "D;";
|
|
|
|
cellNum += "D;";
|
|
|
|
errorInfo += "第D列数据无效;";
|
|
|
|
errorInfo += "第D列数据必填;";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(status) && MesExtEnumUtil.IS_ENABLE.descriptionOfValue(status) == null) {
|
|
|
|
|
|
|
|
errorNum++;
|
|
|
|
|
|
|
|
cellNum += "E;";
|
|
|
|
|
|
|
|
errorInfo += "第E列数据无效;";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String key = new StringJoiner(MesExtConstWords.AND).add(workCenterCode).add(workCellCode).toString();
|
|
|
|
String key = new StringJoiner(MesExtConstWords.AND).add(workCenterCode).add(workCellCode).toString();
|
|
|
@ -231,6 +238,7 @@ public class SxWorkCellTaktCollectPlcCfgExcelService implements IExcelImportExtS
|
|
|
|
sxWorkCellTaktCollectPlcCfg.setWorkCellCode(workCellCode);
|
|
|
|
sxWorkCellTaktCollectPlcCfg.setWorkCellCode(workCellCode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sxWorkCellTaktCollectPlcCfg.setScanCellCode(scanCellCode);
|
|
|
|
sxWorkCellTaktCollectPlcCfg.setPlcCode(plcCode);
|
|
|
|
sxWorkCellTaktCollectPlcCfg.setPlcCode(plcCode);
|
|
|
|
sxWorkCellTaktCollectPlcCfg.setStatus(StringUtils.isEmpty(status) ? MesExtEnumUtil.IS_ENABLE.ENABLE.getValue() : MesExtEnumUtil.IS_ENABLE.descriptionOfValue(status));
|
|
|
|
sxWorkCellTaktCollectPlcCfg.setStatus(StringUtils.isEmpty(status) ? MesExtEnumUtil.IS_ENABLE.ENABLE.getValue() : MesExtEnumUtil.IS_ENABLE.descriptionOfValue(status));
|
|
|
|
sxWorkCellTaktCollectPlcCfg.setSystemSyncStatus(MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue());
|
|
|
|
sxWorkCellTaktCollectPlcCfg.setSystemSyncStatus(MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue());
|
|
|
|