diff --git a/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/controller/base/jx/SxWorkCellTaktCollectPlcCfgController.java b/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/controller/base/jx/SxWorkCellTaktCollectPlcCfgController.java index a9541c4..e89342d 100644 --- a/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/controller/base/jx/SxWorkCellTaktCollectPlcCfgController.java +++ b/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/controller/base/jx/SxWorkCellTaktCollectPlcCfgController.java @@ -41,8 +41,9 @@ public class SxWorkCellTaktCollectPlcCfgController { try { //条件验证 ValidatorBean.beginValid(workCellTaktCollectPlcCfg) - .notNull(MesExtConstWords.WORK_CENTER_CODE,workCellTaktCollectPlcCfg.getWorkCenterCode()) - .notNull(MesExtConstWords.WORK_CELL_CODE,workCellTaktCollectPlcCfg.getWorkCellCode()) + .notNull(MesExtConstWords.WORK_CENTER_CODE, workCellTaktCollectPlcCfg.getWorkCenterCode()) + .notNull(MesExtConstWords.WORK_CELL_CODE, workCellTaktCollectPlcCfg.getWorkCellCode()) + .notNull("scanCellCode", workCellTaktCollectPlcCfg.getScanCellCode()) .notNull(MesExtConstWords.PLC_CODE, workCellTaktCollectPlcCfg.getPlcCode()) .notNull(MesExtConstWords.STATUS, workCellTaktCollectPlcCfg.getStatus()); workCellTaktCollectPlcCfg.setOrganizeCode(AuthUtil.getOrganize().getOrganizeCode()); @@ -64,6 +65,7 @@ public class SxWorkCellTaktCollectPlcCfgController { ValidatorBean.beginValid(workCellTaktCollectPlcCfg) .notNull(MesExtConstWords.WORK_CENTER_CODE,workCellTaktCollectPlcCfg.getWorkCenterCode()) .notNull(MesExtConstWords.WORK_CELL_CODE,workCellTaktCollectPlcCfg.getWorkCellCode()) + .notNull("scanCellCode", workCellTaktCollectPlcCfg.getScanCellCode()) .notNull(MesExtConstWords.PLC_CODE, workCellTaktCollectPlcCfg.getPlcCode()) .notNull(MesExtConstWords.STATUS, workCellTaktCollectPlcCfg.getStatus()); diff --git a/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/base/jx/SxWorkCellTaktCollectPlcCfgService.java b/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/base/jx/SxWorkCellTaktCollectPlcCfgService.java index 00776ca..4c0875d 100644 --- a/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/base/jx/SxWorkCellTaktCollectPlcCfgService.java +++ b/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/base/jx/SxWorkCellTaktCollectPlcCfgService.java @@ -1,6 +1,5 @@ package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base.jx; -import cn.estsh.i3plus.ext.mes.api.base.jx.IManageCodeService; import cn.estsh.i3plus.ext.mes.api.base.jx.ISxWorkCellTaktCollectPlcCfgService; import cn.estsh.i3plus.ext.mes.pojo.bean.SxWorkCellTaktCollectPlcCfg; import cn.estsh.i3plus.ext.mes.pojo.repository.SxWorkCellTaktCollectPlcCfgRepository; @@ -88,6 +87,7 @@ public class SxWorkCellTaktCollectPlcCfgService implements ISxWorkCellTaktCollec sxWorkCellTaktCollectPlcCfgDb.setWorkCenterCode(sxWorkCellTaktCollectPlcCfg.getWorkCenterCode()); sxWorkCellTaktCollectPlcCfgDb.setWorkCellCode(sxWorkCellTaktCollectPlcCfg.getWorkCellCode()); + sxWorkCellTaktCollectPlcCfgDb.setScanCellCode(sxWorkCellTaktCollectPlcCfg.getScanCellCode()); sxWorkCellTaktCollectPlcCfgDb.setPlcCode(sxWorkCellTaktCollectPlcCfg.getPlcCode()); sxWorkCellTaktCollectPlcCfgDb.setStatus(sxWorkCellTaktCollectPlcCfg.getStatus()); sxWorkCellTaktCollectPlcCfgDb.setSystemSyncStatus(MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue()); diff --git a/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/excel/jx/SxWorkCellTaktCollectPlcCfgExcelService.java b/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/excel/jx/SxWorkCellTaktCollectPlcCfgExcelService.java index 122ac86..a5307bf 100644 --- a/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/excel/jx/SxWorkCellTaktCollectPlcCfgExcelService.java +++ b/modules/i3plus-ext-mes-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/apiservice/serviceimpl/excel/jx/SxWorkCellTaktCollectPlcCfgExcelService.java @@ -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.apiservice.serviceimpl.base.CommonExtService; 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.ExcelImportResultExtModel; 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.MesExtEnumUtil; 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.mes.bean.MesWorkCell; 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.Sheet; import org.apache.poi.ss.usermodel.Workbook; @@ -128,36 +126,34 @@ public class SxWorkCellTaktCollectPlcCfgExcelService implements IExcelImportExtS String cellNum = ""; //错误列号 String errorInfo = ""; //错误信息 - //松下工位节拍PLC配置 + String workCenterCode; try { - //第一列必须有值,否则跳过 - row.getCell(0).setCellType(CellType.STRING); + workCenterCode = new DataFormatter().formatCellValue(row.getCell(0, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK)); } catch (Exception e) { continue; } - String workCenterCode = row.getCell(0, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); - //产线代码 String workCellCode = null; try { - row.getCell(1).setCellType(CellType.STRING); - workCellCode = row.getCell(1, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); + workCellCode = new DataFormatter().formatCellValue(row.getCell(1, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK)); + } catch (Exception e) { + } + + String scanCellCode = null; + try { + scanCellCode = new DataFormatter().formatCellValue(row.getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK)); } catch (Exception e) { } - //PLC代码 String plcCode = null; try { - row.getCell(2).setCellType(CellType.STRING); - plcCode = row.getCell(2, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); + plcCode = new DataFormatter().formatCellValue(row.getCell(3, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK)); } catch (Exception e) { } - //产线代码 String status = null; try { - row.getCell(3).setCellType(CellType.STRING); - status = row.getCell(3, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK).getStringCellValue().trim(); + status = new DataFormatter().formatCellValue(row.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK)); } catch (Exception e) { } @@ -179,16 +175,27 @@ public class SxWorkCellTaktCollectPlcCfgExcelService implements IExcelImportExtS errorInfo += "第B列数据无效;"; } - if (StringUtils.isEmpty(plcCode)) { + //产线代码 + if (StringUtils.isEmpty(scanCellCode)) { errorNum++; cellNum += "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++; 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(); @@ -231,6 +238,7 @@ public class SxWorkCellTaktCollectPlcCfgExcelService implements IExcelImportExtS sxWorkCellTaktCollectPlcCfg.setWorkCellCode(workCellCode); } + sxWorkCellTaktCollectPlcCfg.setScanCellCode(scanCellCode); sxWorkCellTaktCollectPlcCfg.setPlcCode(plcCode); sxWorkCellTaktCollectPlcCfg.setStatus(StringUtils.isEmpty(status) ? MesExtEnumUtil.IS_ENABLE.ENABLE.getValue() : MesExtEnumUtil.IS_ENABLE.descriptionOfValue(status)); sxWorkCellTaktCollectPlcCfg.setSystemSyncStatus(MesExtEnumUtil.IF_SYNC_STATUS.NO_SYNC.getValue()); diff --git a/modules/i3plus-ext-mes-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pojo/bean/SxWorkCellTaktCollectPlcCfg.java b/modules/i3plus-ext-mes-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pojo/bean/SxWorkCellTaktCollectPlcCfg.java index 2caa3ed..3be542b 100644 --- a/modules/i3plus-ext-mes-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pojo/bean/SxWorkCellTaktCollectPlcCfg.java +++ b/modules/i3plus-ext-mes-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pojo/bean/SxWorkCellTaktCollectPlcCfg.java @@ -29,7 +29,9 @@ import java.io.Serializable; @EqualsAndHashCode(callSuper = true) @Table(name = "SX_WORK_CELL_TAKT_COLLECT_PLC_CFG", indexes = { @Index(columnList = "SYSTEM_SYNC_STATUS"), - @Index(columnList = "WORK_CENTER_CODE") + @Index(columnList = "WORK_CENTER_CODE"), + @Index(columnList = "WORK_CELL_CODE"), + @Index(columnList = "SCAN_CELL_CODE") }) @Api("松下工位节拍PLC配置表") public class SxWorkCellTaktCollectPlcCfg extends BaseBean implements Serializable { @@ -44,6 +46,10 @@ public class SxWorkCellTaktCollectPlcCfg extends BaseBean implements Serializabl @ApiParam("工位代码") private String workCellCode; + @Column(name = "SCAN_CELL_CODE") + @ApiParam("扫码工位代码") + private String scanCellCode; + @Column(name = "PLC_CODE") @ApiParam("PLC代码") private String plcCode; diff --git a/modules/i3plus-ext-mes-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pojo/bean/SxWorkCellTaktCollectRecord.java b/modules/i3plus-ext-mes-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pojo/bean/SxWorkCellTaktCollectRecord.java index f58bfe5..38188b2 100644 --- a/modules/i3plus-ext-mes-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pojo/bean/SxWorkCellTaktCollectRecord.java +++ b/modules/i3plus-ext-mes-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pojo/bean/SxWorkCellTaktCollectRecord.java @@ -47,6 +47,36 @@ public class SxWorkCellTaktCollectRecord extends BaseBean implements Serializabl @ApiParam("生产节拍") private String workTakt; + @Column(name = "SCAN_CELL_CODE") + @ApiParam("扫码工位代码") + private String scanCellCode; + + @Column(name = "SHIFT_CODE") + @ApiParam("班次代码") + private String shiftCode; + + @Column(name = "WORK_TIME") + @ApiParam("作业时间") + private String workTime; + + @Column(name = "PART_NO") + @ApiParam("物料编码") + private String partNo; + + @Column(name = "PART_NAME_RDD") + @ApiParam("物料名称") + private String partNameRdd; + + @Column(name = "STANDARD_WORK", columnDefinition = "decimal(18,8)") + @ColumnDefault("0") + @ApiParam("标准工数") + private Double standardWork; + + @Column(name = "WORKER_QTY", columnDefinition = "decimal(18,8)") + @ColumnDefault("0") + @ApiParam("作业人数") + private Double workerQty; + @Column(name = "SYSTEM_SYNC_STATUS") @ColumnDefault("2") @ApiParam(value = "系统同步标志") diff --git a/modules/i3plus-ext-mes-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pojo/sqlpack/MesExtHqlPack.java b/modules/i3plus-ext-mes-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pojo/sqlpack/MesExtHqlPack.java index 90e70d6..1ff34a8 100644 --- a/modules/i3plus-ext-mes-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pojo/sqlpack/MesExtHqlPack.java +++ b/modules/i3plus-ext-mes-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pojo/sqlpack/MesExtHqlPack.java @@ -945,6 +945,7 @@ public class MesExtHqlPack { DdlPackBean packBean = getAllBaseDataByNormalPro(workCellTaktCollectPlcCfg, workCellTaktCollectPlcCfg.getOrganizeCode()); DdlPreparedPack.getStringLikerPack(workCellTaktCollectPlcCfg.getWorkCenterCode(), MesExtConstWords.WORK_CENTER_CODE, packBean); DdlPreparedPack.getStringLikerPack(workCellTaktCollectPlcCfg.getWorkCellCode(), MesExtConstWords.WORK_CELL_CODE, packBean); + DdlPreparedPack.getStringLikerPack(workCellTaktCollectPlcCfg.getScanCellCode(), "scanCellCode", packBean); DdlPreparedPack.getStringLikerPack(workCellTaktCollectPlcCfg.getPlcCode(), MesExtConstWords.PLC_CODE, packBean); DdlPreparedPack.getNumEqualPack(workCellTaktCollectPlcCfg.getStatus(), MesExtConstWords.STATUS, packBean); if (!StringUtils.isEmpty(workCellTaktCollectPlcCfg.getModifyDateTimeStart()) || !StringUtils.isEmpty(workCellTaktCollectPlcCfg.getModifyDateTimeEnd())) {