diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java index cc9bbd0..a2ec41a 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java @@ -116,7 +116,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService currTask.setCraftCodeId(one.getId()); currTask.setPlcValue(one.getPlcValue()); currTask.setInterCode(IDGenerator.gen("RW", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "TASK_CODE")); - currTask.setTaskCode(IDGenerator.gen("RW", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "TASK_CODE")); + currTask.setTaskCode(currTask.getInterCode()); setCommonField(currTask); currTaskServiceBiz.save(currTask); return successful(IdVo.builder().id(currTask.getId()).build()); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java index fdda8ce..a702815 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java @@ -605,9 +605,9 @@ public class AsynRunTaskService extends BaseService { //电度值 electricalValue = readPlc(nameSpaceNote, "TotalElectricity"); //A向电压 - phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage"); - phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage"); - phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage"); + phaseAVoltage = readPlc(nameSpaceNote, "AVoltage"); + phaseBVoltage = readPlc(nameSpaceNote, "BVoltage"); + phaseCVoltage = readPlc(nameSpaceNote, "CVoltage"); ParEleValue parEleValue2 = new ParEleValue(); parEleValue2.setAVoltagevValue(phaseAVoltage.floatValue()); parEleValue2.setAVoltagevValue(phaseBVoltage.floatValue()); @@ -799,9 +799,9 @@ public class AsynRunTaskService extends BaseService { //电度值 electricalValue = readPlc(nameSpaceNote, "TotalElectricity"); //A向电压 - phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage"); - phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage"); - phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage"); + phaseAVoltage = readPlc(nameSpaceNote, "AVoltage"); + phaseBVoltage = readPlc(nameSpaceNote, "BVoltage"); + phaseCVoltage = readPlc(nameSpaceNote, "CVoltage"); ParEleValue parEleValue2 = new ParEleValue(); parEleValue2.setAVoltagevValue(phaseAVoltage.floatValue()); parEleValue2.setAVoltagevValue(phaseBVoltage.floatValue()); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java index 57d4609..7a58632 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java @@ -127,7 +127,9 @@ public class ScheduledTask extends BaseService { @Scheduled(fixedDelay = 1000*60) public void screen() throws IOException { //查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间,剩余时间,查询标识卡详情 - List currTaskList = currTaskServiceBiz.list(new QueryWrapper().eq(CurrTask.IS_IN, 1)); + List currTaskList = currTaskServiceBiz.list(new QueryWrapper() + .eq(CurrTask.IS_IN, 1) + .eq(CurrTask.STATUS,1)); if (currTaskList.size()==0){ return; } @@ -171,7 +173,8 @@ public class ScheduledTask extends BaseService { nowCurrTask.setCompleteness(completeness); nowCurrTask.setKilnCode(kilnInfo.getCode()); //标识卡详情 - List currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper().eq(CurrTaskDet.CURR_TASK_ID, nowCurrTask.getId())); + List currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper() + .eq(CurrTaskDet.CURR_TASK_ID, nowCurrTask.getId())); List currTaskDetVoList = BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class); for (CurrTaskDetVo currTaskDetVo:currTaskDetVoList ) { @@ -211,6 +214,12 @@ public class ScheduledTask extends BaseService { if (resultBoolean){ //调用RunTaskUtils.runTaskForOutKiln logger.info(kilnInfo.getCode()+kilnInfo.getKilnAlias()+"识别到允许出炉信号,进入出库程序!"); + asynRunTaskService.asynEndRecordConsume(currTask.getId(),kilnId); + logger.info(kilnInfo.getCode()+"炉子中的任务:"+currTask.getId()+"已加工结束,记录加工结束能源消耗值"); + //更新加工单工艺结束时间 + currTask.setEndTime(LocalDateTime.now()); + currTaskServiceBiz.updateById(currTask); + //上报apms结束加工 runTaskUtils.runTaskForOutKiln(kilnId); break; } @@ -221,7 +230,6 @@ public class ScheduledTask extends BaseService { //查询出正在加工的工业炉,遍历,根据采集频率的不同,采集高频数据能源消耗。暂定30秒 @Scheduled(fixedDelay = 1000*30) public void getFastValue(){ - logger.info("==采集高频能耗数据开始=="); //加工炉列表 List kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper().in(KilnInfo.TYPE,1,3)); for (KilnInfo kilnInfo:kilnInfoList @@ -239,7 +247,6 @@ public class ScheduledTask extends BaseService { String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber"); Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString()); if (currTaskId==0){ - logger.info("==当前加工的为手动加工任务,不记录能耗=="); continue; } //加工炉 @@ -310,13 +317,11 @@ public class ScheduledTask extends BaseService { } } - logger.info("==采集高频能耗数据结束=="); } //查询出正在加工的工业炉,遍历,根据采集频率的不同,采集低频数据能源消耗。暂定3分钟一次 @Scheduled(fixedDelay = 1000*60*3) public void getSlowValue(){ - logger.info("==开始采集低频数据=="); List kilnInfoList = kilnInfoServiceBiz.list(); for (KilnInfo kilnInfo:kilnInfoList ) { @@ -332,7 +337,6 @@ public class ScheduledTask extends BaseService { String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber"); Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString()); if (currTaskId==0){ - logger.info("==当前加工的为手动加工任务,不记录能耗=="); continue; } //加工炉 @@ -457,7 +461,6 @@ public class ScheduledTask extends BaseService { } } } - logger.info("==结束采集低频数据=="); } //遍历工业炉,空工业炉查询缓存区是否有等待加工的任务, @@ -518,7 +521,6 @@ public class ScheduledTask extends BaseService { @Scheduled(fixedDelay = 1000*60) public void listenKilnAlarm(){ List kilnInfoList = kilnInfoServiceBiz.list(); - logger.info("==开始查询炉子是否有报警=="); for (KilnInfo kilnInfo:kilnInfoList ) { PlcNameSpace kilnNameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper() @@ -586,7 +588,6 @@ public class ScheduledTask extends BaseService { } } } - logger.info("==结束查询炉子是否有报警=="); } //监听车辆是否在线