From edd0f8c77bbd3e25f74ff4020b8b6a27c8db4c86 Mon Sep 17 00:00:00 2001 From: lgh0010 <1746689524@qq.com> Date: Sat, 5 Mar 2022 18:21:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E8=83=BD=E6=BA=90=E6=B6=88?= =?UTF-8?q?=E8=80=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../empty/controller/CurrTaskController.java | 4 +- .../empty/controller/EnergyController.java | 300 ++++++++++-------- .../com/mt/wms/empty/vo/CurrTaskQueryVo.java | 5 + 3 files changed, 174 insertions(+), 135 deletions(-) diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java index 8653857..2fb07c4 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java @@ -269,8 +269,8 @@ public class CurrTaskController extends BaseController { } @PostMapping(value = "runTask") @ApiOperation(value = "执行任务") - public R runTask(@Validated @RequestBody Long taskId) { + public R runTask(@Validated @RequestBody IdParam param) { //点击执行按钮会判断当前任务是否为自动任务,如果是自动任务会去自动任务查一下该自动任务的上一步是否已完成(仅非一步时) - return currTaskService.runTask(taskId); + return currTaskService.runTask(param.getId()); } } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/EnergyController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/EnergyController.java index 6c9d336..a4cccea 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/EnergyController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/EnergyController.java @@ -223,39 +223,48 @@ public class EnergyController extends BaseController { //传入任务号,窑炉号,查询消耗数据,返回json字符串 JSONObject jsonObject=new JSONObject(); ConsumeDataVo consumeDataVo=ConsumeDataVo.builder().build(); + + Map map=new HashMap(); //电能消耗 List parEleValueList = parEleValueServiceBiz.list(new QueryWrapper() - .eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId()) + .eq(ParEleValue.KILN_ID, kilnId) .eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId())); if (parEleValueList.size()>0){ List eleList=new ArrayList(); //电能消耗 - List eleConsume=new ArrayList<>(); + List eleConsume=new ArrayList<>(); //A向电压 - List aVolConsume=new ArrayList<>(); + List aVolConsume=new ArrayList<>(); //B向电压 - List bVolConsume=new ArrayList<>(); + List bVolConsume=new ArrayList<>(); //C向电压 - List cVolConsume=new ArrayList<>(); + List cVolConsume=new ArrayList<>(); for (ParEleValue parEleValue:parEleValueList ) { - consumeDataVo.setCreateTime(parEleValue.getCreateTime()); - consumeDataVo.setValue(parEleValue.getTotalBat()); - consumeDataVo.setName("耗电量"); - consumeDataVo.setUnit("KW"); - eleConsume.add(consumeDataVo); - consumeDataVo.setValue(parEleValue.getAVoltagevValue()); - consumeDataVo.setName("A向电压"); - consumeDataVo.setUnit("V"); - aVolConsume.add(consumeDataVo); - consumeDataVo.setValue(parEleValue.getBVoltagevValue()); - consumeDataVo.setName("B向电压"); - consumeDataVo.setUnit("V"); - bVolConsume.add(consumeDataVo); - consumeDataVo.setValue(parEleValue.getCVoltagevValue()); - consumeDataVo.setName("C向电压"); - consumeDataVo.setUnit("V"); - cVolConsume.add(consumeDataVo); + map.put("time",parEleValue.getCreateTime()); + map.put("value",parEleValue.getTotalBat()); + map.put("name","耗电量"); + map.put("unit","KW"); + eleConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parEleValue.getCreateTime()); + map.put("value",parEleValue.getAVoltagevValue()); + map.put("name","A向电压"); + map.put("unit","V"); + aVolConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parEleValue.getCreateTime()); + map.put("value",parEleValue.getBVoltagevValue()); + map.put("name","B向电压"); + map.put("unit","V"); + bVolConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parEleValue.getCreateTime()); + map.put("value",parEleValue.getCVoltagevValue()); + map.put("name","C向电压"); + map.put("unit","V"); + cVolConsume.add(JSONObject.toJSON(map)); + map.clear(); } eleList.add(eleConsume); eleList.add(aVolConsume); @@ -265,38 +274,45 @@ public class EnergyController extends BaseController { } //氮气、甲醇、丙烷、氨气消耗量 List parGasValueList = parGasValueServiceBiz.list(new QueryWrapper() - .eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId()) + .eq(ParEleValue.KILN_ID, kilnId) .eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId())); if (parGasValueList.size()>0){ if (kilnType==1){ List gasList=new ArrayList(); //氮气 - List nitConsume=new ArrayList<>(); + List nitConsume=new ArrayList<>(); //甲醇 - List metConsume=new ArrayList<>(); + List metConsume=new ArrayList<>(); //丙烷 - List propaneConsume=new ArrayList<>(); + List propaneConsume=new ArrayList<>(); //氨气 - List ammoniaConsume=new ArrayList<>(); + List ammoniaConsume=new ArrayList<>(); for (ParGasValue parGasValue:parGasValueList ) { - consumeDataVo.setCreateTime(parGasValue.getCreateTime()); - consumeDataVo.setValue(parGasValue.getNitFlowValue()); - consumeDataVo.setName("氮气"); - consumeDataVo.setUnit("m³"); - nitConsume.add(consumeDataVo); - consumeDataVo.setValue(parGasValue.getMethanolFlow()); - consumeDataVo.setName("甲醇"); - consumeDataVo.setUnit("m³"); - metConsume.add(consumeDataVo); - consumeDataVo.setValue(parGasValue.getPropaneFlow()); - consumeDataVo.setName("丙烷"); - consumeDataVo.setUnit("m³"); - propaneConsume.add(consumeDataVo); - consumeDataVo.setValue(parGasValue.getAmmoniaFlowValue()); - consumeDataVo.setName("氨气"); - consumeDataVo.setUnit("m³"); - ammoniaConsume.add(consumeDataVo); + map.put("time",parGasValue.getCreateTime()); + map.put("value",parGasValue.getNitFlowValue()); + map.put("name","氮气"); + map.put("unit","m³"); + nitConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parGasValue.getCreateTime()); + map.put("value",parGasValue.getMethanolFlow()); + map.put("name","甲醇"); + map.put("unit","m³"); + metConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parGasValue.getCreateTime()); + map.put("value",parGasValue.getPropaneFlow()); + map.put("name","丙烷"); + map.put("unit","m³"); + propaneConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parGasValue.getCreateTime()); + map.put("value",parGasValue.getAmmoniaFlowValue()); + map.put("name","氨气"); + map.put("unit","m³"); + ammoniaConsume.add(JSONObject.toJSON(map)); + map.clear(); } gasList.add(nitConsume); gasList.add(metConsume); @@ -307,26 +323,31 @@ public class EnergyController extends BaseController { if (kilnType==3){ List gasList=new ArrayList(); //氮气 - List nitConsume=new ArrayList<>(); + List nitConsume=new ArrayList<>(); //二氧化碳 - List carbonConsume=new ArrayList<>(); + List carbonConsume=new ArrayList<>(); //氨气 - List ammoniaConsume=new ArrayList<>(); + List ammoniaConsume=new ArrayList<>(); for (ParGasValue parGasValue:parGasValueList ) { - consumeDataVo.setCreateTime(parGasValue.getCreateTime()); - consumeDataVo.setValue(parGasValue.getNitFlowValue()); - consumeDataVo.setName("氮气"); - consumeDataVo.setUnit("m³"); - nitConsume.add(consumeDataVo); - consumeDataVo.setValue(parGasValue.getCarDioxideFlowValue()); - consumeDataVo.setName("二氧化碳"); - consumeDataVo.setUnit("m³"); - carbonConsume.add(consumeDataVo); - consumeDataVo.setValue(parGasValue.getAmmoniaFlowValue()); - consumeDataVo.setName("氨气"); - consumeDataVo.setUnit("m³"); - ammoniaConsume.add(consumeDataVo); + map.put("time",parGasValue.getCreateTime()); + map.put("value",parGasValue.getNitFlowValue()); + map.put("name","氮气"); + map.put("unit","m³"); + nitConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parGasValue.getCreateTime()); + map.put("value",parGasValue.getCarDioxideFlowValue()); + map.put("name","二氧化碳"); + map.put("unit","m³"); + carbonConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parGasValue.getCreateTime()); + map.put("value",parGasValue.getAmmoniaFlowValue()); + map.put("name","氨气"); + map.put("unit","m³"); + ammoniaConsume.add(JSONObject.toJSON(map)); + map.clear(); } gasList.add(nitConsume); gasList.add(carbonConsume); @@ -336,24 +357,27 @@ public class EnergyController extends BaseController { } //油搅拌转速趋势 List parRotSpeedValueList = parRotSpeedValueServiceBiz.list(new QueryWrapper() - .eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId()) + .eq(ParEleValue.KILN_ID, kilnId) .eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId())); if (parRotSpeedValueList.size()>0){ if (kilnType==1){ List rotList=new ArrayList(); - List rot1Consume=new ArrayList<>(); - List rot2Consume=new ArrayList<>(); + List rot1Consume=new ArrayList<>(); + List rot2Consume=new ArrayList<>(); for (ParRotSpeedValue parRotSpeedValue:parRotSpeedValueList ) { - consumeDataVo.setCreateTime(parRotSpeedValue.getCreateTime()); - consumeDataVo.setValue(parRotSpeedValue.getOilStiSpeedAValue()); - consumeDataVo.setName("1号油搅拌转速"); - consumeDataVo.setUnit("转/min"); - rot1Consume.add(consumeDataVo); - consumeDataVo.setValue(parRotSpeedValue.getOilStiSpeedBValue()); - consumeDataVo.setName("2号油搅拌转速"); - consumeDataVo.setUnit("转/min"); - rot2Consume.add(consumeDataVo); + map.put("time",parRotSpeedValue.getCreateTime()); + map.put("value",parRotSpeedValue.getOilStiSpeedAValue()); + map.put("name","1号油搅拌转速"); + map.put("unit","转/min"); + rot1Consume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parRotSpeedValue.getCreateTime()); + map.put("value",parRotSpeedValue.getOilStiSpeedBValue()); + map.put("name","2号油搅拌转速"); + map.put("unit","转/min"); + rot2Consume.add(JSONObject.toJSON(map)); + map.clear(); } rotList.add(rot1Consume); rotList.add(rot2Consume); @@ -362,37 +386,41 @@ public class EnergyController extends BaseController { } //温度趋势(实际温度、设定温度) List parTemValueList = parTemValueServiceBiz.list(new QueryWrapper() - .eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId()) + .eq(ParEleValue.KILN_ID, kilnId) .eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId())); if (parTemValueList.size()>0){ if (kilnType==1){ List tempList=new ArrayList(); - List actualTempConsume=new ArrayList<>(); - List setupTempConsume=new ArrayList<>(); - List actualOilTempConsume=new ArrayList<>(); - List setupOilTempConsume=new ArrayList<>(); + List actualTempConsume=new ArrayList<>(); + List setupTempConsume=new ArrayList<>(); + List actualOilTempConsume=new ArrayList<>(); + List setupOilTempConsume=new ArrayList<>(); for (ParTemValue parTemValue:parTemValueList ) { - consumeDataVo.setCreateTime(parTemValue.getCreateTime()); - consumeDataVo.setName("实际温度"); - consumeDataVo.setValue(parTemValue.getActTemValue()); - consumeDataVo.setUnit("℃"); - actualTempConsume.add(consumeDataVo); - consumeDataVo.setCreateTime(parTemValue.getCreateTime()); - consumeDataVo.setName("设定温度"); - consumeDataVo.setValue(parTemValue.getSetTemValue()); - consumeDataVo.setUnit("℃"); - setupTempConsume.add(consumeDataVo); - consumeDataVo.setCreateTime(parTemValue.getCreateTime()); - consumeDataVo.setName("油槽实际温度"); - consumeDataVo.setValue(parTemValue.getOilTankActTemValue()); - consumeDataVo.setUnit("℃"); - actualOilTempConsume.add(consumeDataVo); - consumeDataVo.setCreateTime(parTemValue.getCreateTime()); - consumeDataVo.setName("油槽设定温度"); - consumeDataVo.setValue(parTemValue.getOilTankSetTemValue()); - consumeDataVo.setUnit("℃"); - setupOilTempConsume.add(consumeDataVo); + map.put("time",parTemValue.getCreateTime()); + map.put("value",parTemValue.getActTemValue()); + map.put("name","实际温度"); + map.put("unit","℃"); + actualTempConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parTemValue.getCreateTime()); + map.put("value",parTemValue.getSetTemValue()); + map.put("name","设定温度"); + map.put("unit","℃"); + setupTempConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parTemValue.getCreateTime()); + map.put("value",parTemValue.getOilTankActTemValue()); + map.put("name","油槽实际温度"); + map.put("unit","℃"); + actualOilTempConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parTemValue.getCreateTime()); + map.put("value",parTemValue.getOilTankSetTemValue()); + map.put("name","油槽设定温度"); + map.put("unit","℃"); + setupOilTempConsume.add(JSONObject.toJSON(map)); + map.clear(); } tempList.add(actualTempConsume); tempList.add(setupTempConsume); @@ -402,20 +430,22 @@ public class EnergyController extends BaseController { } if (kilnType==2){ List tempList=new ArrayList(); - List actualTempConsume=new ArrayList<>(); - List setupTempConsume=new ArrayList<>(); + List actualTempConsume=new ArrayList<>(); + List setupTempConsume=new ArrayList<>(); for (ParTemValue parTemValue:parTemValueList ) { - consumeDataVo.setCreateTime(parTemValue.getCreateTime()); - consumeDataVo.setName("实际温度"); - consumeDataVo.setValue(parTemValue.getActTemValue()); - consumeDataVo.setUnit("℃"); - actualTempConsume.add(consumeDataVo); - consumeDataVo.setCreateTime(parTemValue.getCreateTime()); - consumeDataVo.setName("设定温度"); - consumeDataVo.setValue(parTemValue.getSetTemValue()); - consumeDataVo.setUnit("℃"); - setupTempConsume.add(consumeDataVo); + map.put("time",parTemValue.getCreateTime()); + map.put("value",parTemValue.getActTemValue()); + map.put("name","实际温度"); + map.put("unit","℃"); + actualTempConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parTemValue.getCreateTime()); + map.put("value",parTemValue.getSetTemValue()); + map.put("name","设定温度"); + map.put("unit","℃"); + setupTempConsume.add(JSONObject.toJSON(map)); + map.clear(); } tempList.add(actualTempConsume); tempList.add(setupTempConsume); @@ -424,32 +454,36 @@ public class EnergyController extends BaseController { if (kilnType==3){ List tempList=new ArrayList(); - List actualTempConsume=new ArrayList<>(); - List setupTempConsume=new ArrayList<>(); - List outerZone1TempConsume=new ArrayList<>(); - List outerZone2TempConsume=new ArrayList<>(); + List actualTempConsume=new ArrayList<>(); + List setupTempConsume=new ArrayList<>(); + List outerZone1TempConsume=new ArrayList<>(); + List outerZone2TempConsume=new ArrayList<>(); for (ParTemValue parTemValue:parTemValueList ) { - consumeDataVo.setCreateTime(parTemValue.getCreateTime()); - consumeDataVo.setName("实际温度"); - consumeDataVo.setValue(parTemValue.getActTemValue()); - consumeDataVo.setUnit("℃"); - actualTempConsume.add(consumeDataVo); - consumeDataVo.setCreateTime(parTemValue.getCreateTime()); - consumeDataVo.setName("设定温度"); - consumeDataVo.setValue(parTemValue.getSetTemValue()); - consumeDataVo.setUnit("℃"); - setupTempConsume.add(consumeDataVo); - consumeDataVo.setCreateTime(parTemValue.getCreateTime()); - consumeDataVo.setName("外一区温度"); - consumeDataVo.setValue(parTemValue.getOuterZone1Temp()); - consumeDataVo.setUnit("℃"); - outerZone1TempConsume.add(consumeDataVo); - consumeDataVo.setCreateTime(parTemValue.getCreateTime()); - consumeDataVo.setName("外二区温度"); - consumeDataVo.setValue(parTemValue.getOuterZone2Temp()); - consumeDataVo.setUnit("℃"); - outerZone2TempConsume.add(consumeDataVo); + map.put("time",parTemValue.getCreateTime()); + map.put("value",parTemValue.getActTemValue()); + map.put("name","实际温度"); + map.put("unit","℃"); + actualTempConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parTemValue.getCreateTime()); + map.put("value",parTemValue.getSetTemValue()); + map.put("name","设定温度"); + map.put("unit","℃"); + setupTempConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parTemValue.getCreateTime()); + map.put("value",parTemValue.getOuterZone1Temp()); + map.put("name","外一区温度"); + map.put("unit","℃"); + outerZone1TempConsume.add(JSONObject.toJSON(map)); + map.clear(); + map.put("time",parTemValue.getCreateTime()); + map.put("value",parTemValue.getOuterZone2Temp()); + map.put("name","外二区温度"); + map.put("unit","℃"); + outerZone2TempConsume.add(JSONObject.toJSON(map)); + map.clear(); } tempList.add(actualTempConsume); tempList.add(setupTempConsume); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/CurrTaskQueryVo.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/CurrTaskQueryVo.java index 94b3c15..3f2529c 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/CurrTaskQueryVo.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/CurrTaskQueryVo.java @@ -51,6 +51,11 @@ public class CurrTaskQueryVo extends BaseVo implements PageVo.ConvertVo { */ @ApiModelProperty("任务类型") private Integer taskType; + /** + * 是否自动执行: 0手动,1自动,如果是自动任务这里要监控进出和到缓存区的调度任务 + */ + @ApiModelProperty("是否自动执行:手动,1自动") + private Integer is_auto; /** * 开始加工时间 */