diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/utils/IDGenerator.java b/6.program/wms-core/src/main/java/com/mt/wms/core/utils/IDGenerator.java index cdda0c9..35f3861 100644 --- a/6.program/wms-core/src/main/java/com/mt/wms/core/utils/IDGenerator.java +++ b/6.program/wms-core/src/main/java/com/mt/wms/core/utils/IDGenerator.java @@ -157,6 +157,7 @@ public class IDGenerator { int second = (int)(tomorrowDate.getTimeInMillis() - curDate.getTimeInMillis()) / 1000; idGenerator.redisTemplate.opsForValue().set(KEY_PREFIX_SEQUENCE + sequenceName, sequence, second, TimeUnit.SECONDS); idGenerator.redisTemplate.opsForValue().getOperations(); + if (sequenceLength > 0) { if (sequenceLength > MAX_SEQUENCE_LENGTH) { sequenceLength = MAX_SEQUENCE_LENGTH; 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 09a2794..137a08b 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 @@ -1,5 +1,6 @@ package com.mt.wms.empty.controller; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.gson.JsonObject; @@ -7,9 +8,12 @@ import com.mt.wms.core.base.BaseController; import com.mt.wms.core.constants.CommonConstant; import com.mt.wms.core.dal.entity.*; import com.mt.wms.core.dal.service.*; +import com.mt.wms.core.utils.BeanUtils; import com.mt.wms.core.vo.R; import com.mt.wms.empty.params.ElectricQueryParam; +import com.mt.wms.empty.vo.ApmsCheckResultVo; import com.mt.wms.empty.vo.ConsumeDataVo; +import com.mt.wms.empty.vo.EnergyVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -64,71 +68,71 @@ public class EnergyController extends BaseController { @PostMapping(value = "energyList") @ApiOperation(value = "根据加工炉id获取能源消耗情况") - public R energyList(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam){ + public R energyList(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam) { List taskIds = electricQueryParam.getTaskIds(); - JSONObject json=new JSONObject(); - for (Long taskId:taskIds - ) { + JSONObject json = new JSONObject(); + for (Long taskId : taskIds + ) { //TaskHis currTask = taskHisServiceBiz.getById(electricQueryParam.getTaskId()); TaskHis currTask = taskHisServiceBiz.getOne(new QueryWrapper().eq(TaskHis.TASK_ID, taskId)); Long kilnId = currTask.getKilnId(); KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId); Integer kilnType = kilnInfo.getType(); //传入任务号,工业炉号,查询消耗数据,返回json字符串 - JSONObject jsonObject=new JSONObject(); - ConsumeDataVo consumeDataVo=ConsumeDataVo.builder().build(); + JSONObject jsonObject = new JSONObject(); + ConsumeDataVo consumeDataVo = ConsumeDataVo.builder().build(); - Map map=new HashMap<>(); + Map map = new HashMap<>(); //电能消耗 List parEleValueList = parEleValueServiceBiz.list(new QueryWrapper() .eq(ParEleValue.KILN_ID, kilnId) .eq(ParEleValue.TASK_ID, taskId)); - if (parEleValueList.size()>0){ - List eleList=new ArrayList<>(); + 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<>(); - Float talBat=0F; - int i=0; - for (ParEleValue parEleValue:parEleValueList + List cVolConsume = new ArrayList<>(); + Float talBat = 0F; + int i = 0; + for (ParEleValue parEleValue : parEleValueList ) { //首位置为0 - if (i==0){ - talBat=parEleValue.getTotalBat(); + if (i == 0) { + talBat = parEleValue.getTotalBat(); } i++; - map.put("time",parEleValue.getCreateTime()); - map.put("value",floatSubtract(parEleValue.getTotalBat(),talBat)); - map.put("name","耗电量"); - map.put("unit","KW"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parEleValue.getCreateTime()); + map.put("value", floatSubtract(parEleValue.getTotalBat(), talBat)); + map.put("name", "耗电量"); + map.put("unit", "KW"); + map.put("炉号", currTask.getSheetNo()); 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"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parEleValue.getCreateTime()); + map.put("value", parEleValue.getAVoltagevValue()); + map.put("name", "A向电压"); + map.put("unit", "V"); + map.put("炉号", currTask.getSheetNo()); 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"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parEleValue.getCreateTime()); + map.put("value", parEleValue.getBVoltagevValue()); + map.put("name", "B向电压"); + map.put("unit", "V"); + map.put("炉号", currTask.getSheetNo()); 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"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parEleValue.getCreateTime()); + map.put("value", parEleValue.getCVoltagevValue()); + map.put("name", "C向电压"); + map.put("unit", "V"); + map.put("炉号", currTask.getSheetNo()); cVolConsume.add(JSONObject.toJSON(map)); map.clear(); } @@ -136,64 +140,64 @@ public class EnergyController extends BaseController { eleList.add(aVolConsume); eleList.add(bVolConsume); eleList.add(cVolConsume); - jsonObject.put("ele",eleList); + jsonObject.put("ele", eleList); } //氮气、甲醇、丙烷、氨气消耗量 List parGasValueList = parGasValueServiceBiz.list(new QueryWrapper() .eq(ParEleValue.KILN_ID, kilnId) .eq(ParEleValue.TASK_ID, taskId)); - if (parGasValueList.size()>0){ - if (kilnType==1){ - List gasList=new ArrayList<>(); + if (parGasValueList.size() > 0) { + if (kilnType == 1) { + List gasList = new ArrayList<>(); //氮气 - List nitConsume=new ArrayList<>(); - Float nit=0F; + List nitConsume = new ArrayList<>(); + Float nit = 0F; //甲醇 - List metConsume=new ArrayList<>(); - Float met=0F; + List metConsume = new ArrayList<>(); + Float met = 0F; //丙烷 - List propaneConsume=new ArrayList<>(); - Float propane=0F; + List propaneConsume = new ArrayList<>(); + Float propane = 0F; //氨气 - List ammoniaConsume=new ArrayList<>(); - Float ammonia=0F; - int i=0; - for (ParGasValue parGasValue:parGasValueList + List ammoniaConsume = new ArrayList<>(); + Float ammonia = 0F; + int i = 0; + for (ParGasValue parGasValue : parGasValueList ) { //累计值的量首位置为0 - if (i==0){ - nit=parGasValue.getNitFlowValue(); - met=parGasValue.getMethanolFlow(); - propane=parGasValue.getPropaneFlow(); - ammonia=parGasValue.getAmmoniaFlowValue(); + if (i == 0) { + nit = parGasValue.getNitFlowValue(); + met = parGasValue.getMethanolFlow(); + propane = parGasValue.getPropaneFlow(); + ammonia = parGasValue.getAmmoniaFlowValue(); } i++; - map.put("time",parGasValue.getCreateTime()); - map.put("value",floatSubtract(parGasValue.getNitFlowValue(),nit)); - map.put("name","氮气"); - map.put("unit","m³"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parGasValue.getCreateTime()); + map.put("value", floatSubtract(parGasValue.getNitFlowValue(), nit)); + map.put("name", "氮气"); + map.put("unit", "m³"); + map.put("炉号", currTask.getSheetNo()); nitConsume.add(JSONObject.toJSON(map)); map.clear(); - map.put("time",parGasValue.getCreateTime()); - map.put("value",floatSubtract(parGasValue.getMethanolFlow(),met)); - map.put("name","甲醇"); - map.put("unit","m³"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parGasValue.getCreateTime()); + map.put("value", floatSubtract(parGasValue.getMethanolFlow(), met)); + map.put("name", "甲醇"); + map.put("unit", "m³"); + map.put("炉号", currTask.getSheetNo()); metConsume.add(JSONObject.toJSON(map)); map.clear(); - map.put("time",parGasValue.getCreateTime()); - map.put("value",floatSubtract(parGasValue.getPropaneFlow(),propane)); - map.put("name","丙烷"); - map.put("unit","m³"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parGasValue.getCreateTime()); + map.put("value", floatSubtract(parGasValue.getPropaneFlow(), propane)); + map.put("name", "丙烷"); + map.put("unit", "m³"); + map.put("炉号", currTask.getSheetNo()); propaneConsume.add(JSONObject.toJSON(map)); map.clear(); - map.put("time",parGasValue.getCreateTime()); - map.put("value",floatSubtract(parGasValue.getAmmoniaFlowValue(),ammonia)); - map.put("name","氨气"); - map.put("unit","m³"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parGasValue.getCreateTime()); + map.put("value", floatSubtract(parGasValue.getAmmoniaFlowValue(), ammonia)); + map.put("name", "氨气"); + map.put("unit", "m³"); + map.put("炉号", currTask.getSheetNo()); ammoniaConsume.add(JSONObject.toJSON(map)); map.clear(); } @@ -201,127 +205,127 @@ public class EnergyController extends BaseController { gasList.add(metConsume); gasList.add(propaneConsume); gasList.add(ammoniaConsume); - jsonObject.put("gas",gasList); + jsonObject.put("gas", gasList); } - if (kilnType==3){ - List gasList=new ArrayList<>(); + if (kilnType == 3) { + List gasList = new ArrayList<>(); //氮气 - List nitConsume=new ArrayList<>(); - Float nit=0F; + List nitConsume = new ArrayList<>(); + Float nit = 0F; //二氧化碳 - List carbonConsume=new ArrayList<>(); - Float carbon=0F; + List carbonConsume = new ArrayList<>(); + Float carbon = 0F; //氨气 - List ammoniaConsume=new ArrayList<>(); - Float ammonia=0F; - int i=0; - for (ParGasValue parGasValue:parGasValueList + List ammoniaConsume = new ArrayList<>(); + Float ammonia = 0F; + int i = 0; + for (ParGasValue parGasValue : parGasValueList ) { //累计值的量首位置为0 - if (i==0){ - nit=parGasValue.getNitFlowValue(); - carbon=parGasValue.getCarDioxideFlowValue(); - ammonia=parGasValue.getAmmoniaFlowValue(); + if (i == 0) { + nit = parGasValue.getNitFlowValue(); + carbon = parGasValue.getCarDioxideFlowValue(); + ammonia = parGasValue.getAmmoniaFlowValue(); } i++; - map.put("time",parGasValue.getCreateTime()); - map.put("value",floatSubtract(parGasValue.getNitFlowValue(),nit)); - map.put("name","氮气"); - map.put("unit","m³"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parGasValue.getCreateTime()); + map.put("value", floatSubtract(parGasValue.getNitFlowValue(), nit)); + map.put("name", "氮气"); + map.put("unit", "m³"); + map.put("炉号", currTask.getSheetNo()); nitConsume.add(JSONObject.toJSON(map)); map.clear(); - map.put("time",parGasValue.getCreateTime()); - map.put("value",floatSubtract(parGasValue.getCarDioxideFlowValue(),carbon)); - map.put("name","二氧化碳"); - map.put("unit","m³"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parGasValue.getCreateTime()); + map.put("value", floatSubtract(parGasValue.getCarDioxideFlowValue(), carbon)); + map.put("name", "二氧化碳"); + map.put("unit", "m³"); + map.put("炉号", currTask.getSheetNo()); carbonConsume.add(JSONObject.toJSON(map)); map.clear(); - map.put("time",parGasValue.getCreateTime()); - map.put("value",floatSubtract(parGasValue.getAmmoniaFlowValue(),ammonia)); - map.put("name","氨气"); - map.put("unit","m³"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parGasValue.getCreateTime()); + map.put("value", floatSubtract(parGasValue.getAmmoniaFlowValue(), ammonia)); + map.put("name", "氨气"); + map.put("unit", "m³"); + map.put("炉号", currTask.getSheetNo()); ammoniaConsume.add(JSONObject.toJSON(map)); map.clear(); } gasList.add(nitConsume); gasList.add(carbonConsume); gasList.add(ammoniaConsume); - jsonObject.put("gas",gasList); + jsonObject.put("gas", gasList); } } //油搅拌转速趋势 List parRotSpeedValueList = parRotSpeedValueServiceBiz.list(new QueryWrapper() .eq(ParEleValue.KILN_ID, kilnId) .eq(ParEleValue.TASK_ID, taskId)); - if (parRotSpeedValueList.size()>0){ - if (kilnType==1){ - List rotList=new ArrayList<>(); - List rot1Consume=new ArrayList<>(); - List rot2Consume=new ArrayList<>(); - for (ParRotSpeedValue parRotSpeedValue:parRotSpeedValueList + if (parRotSpeedValueList.size() > 0) { + if (kilnType == 1) { + List rotList = new ArrayList<>(); + List rot1Consume = new ArrayList<>(); + List rot2Consume = new ArrayList<>(); + for (ParRotSpeedValue parRotSpeedValue : parRotSpeedValueList ) { - map.put("time",parRotSpeedValue.getCreateTime()); - map.put("value",parRotSpeedValue.getOilStiSpeedAValue()); - map.put("name","1号油搅拌转速"); - map.put("unit","转/min"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parRotSpeedValue.getCreateTime()); + map.put("value", parRotSpeedValue.getOilStiSpeedAValue()); + map.put("name", "1号油搅拌转速"); + map.put("unit", "转/min"); + map.put("炉号", currTask.getSheetNo()); 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"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parRotSpeedValue.getCreateTime()); + map.put("value", parRotSpeedValue.getOilStiSpeedBValue()); + map.put("name", "2号油搅拌转速"); + map.put("unit", "转/min"); + map.put("炉号", currTask.getSheetNo()); rot2Consume.add(JSONObject.toJSON(map)); map.clear(); } rotList.add(rot1Consume); rotList.add(rot2Consume); - jsonObject.put("rot",rotList); + jsonObject.put("rot", rotList); } } //温度趋势(实际温度、设定温度) List parTemValueList = parTemValueServiceBiz.list(new QueryWrapper() .eq(ParEleValue.KILN_ID, kilnId) .eq(ParEleValue.TASK_ID, taskId)); - 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<>(); - for (ParTemValue parTemValue:parTemValueList + 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<>(); + for (ParTemValue parTemValue : parTemValueList ) { - map.put("time",parTemValue.getCreateTime()); - map.put("value",parTemValue.getActTemValue()); - map.put("name","实际温度"); - map.put("unit","℃"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parTemValue.getCreateTime()); + map.put("value", parTemValue.getActTemValue()); + map.put("name", "实际温度"); + map.put("unit", "℃"); + map.put("炉号", currTask.getSheetNo()); actualTempConsume.add(JSONObject.toJSON(map)); map.clear(); - map.put("time",parTemValue.getCreateTime()); - map.put("value",parTemValue.getSetTemValue()); - map.put("name","设定温度"); - map.put("unit","℃"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parTemValue.getCreateTime()); + map.put("value", parTemValue.getSetTemValue()); + map.put("name", "设定温度"); + map.put("unit", "℃"); + map.put("炉号", currTask.getSheetNo()); setupTempConsume.add(JSONObject.toJSON(map)); map.clear(); - map.put("time",parTemValue.getCreateTime()); - map.put("value",parTemValue.getOilTankActTemValue()); - map.put("name","油槽实际温度"); - map.put("unit","℃"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parTemValue.getCreateTime()); + map.put("value", parTemValue.getOilTankActTemValue()); + map.put("name", "油槽实际温度"); + map.put("unit", "℃"); + map.put("炉号", currTask.getSheetNo()); actualOilTempConsume.add(JSONObject.toJSON(map)); map.clear(); - map.put("time",parTemValue.getCreateTime()); - map.put("value",parTemValue.getOilTankSetTemValue()); - map.put("name","油槽设定温度"); - map.put("unit","℃"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parTemValue.getCreateTime()); + map.put("value", parTemValue.getOilTankSetTemValue()); + map.put("name", "油槽设定温度"); + map.put("unit", "℃"); + map.put("炉号", currTask.getSheetNo()); setupOilTempConsume.add(JSONObject.toJSON(map)); map.clear(); } @@ -329,69 +333,69 @@ public class EnergyController extends BaseController { tempList.add(setupTempConsume); tempList.add(actualOilTempConsume); tempList.add(setupOilTempConsume); - jsonObject.put("temp",tempList); + jsonObject.put("temp", tempList); } - if (kilnType==2){ - List tempList=new ArrayList<>(); - List actualTempConsume=new ArrayList<>(); - List setupTempConsume=new ArrayList<>(); - for (ParTemValue parTemValue:parTemValueList + if (kilnType == 2) { + List tempList = new ArrayList<>(); + List actualTempConsume = new ArrayList<>(); + List setupTempConsume = new ArrayList<>(); + for (ParTemValue parTemValue : parTemValueList ) { - map.put("time",parTemValue.getCreateTime()); - map.put("value",parTemValue.getActTemValue()); - map.put("name","实际温度"); - map.put("unit","℃"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parTemValue.getCreateTime()); + map.put("value", parTemValue.getActTemValue()); + map.put("name", "实际温度"); + map.put("unit", "℃"); + map.put("炉号", currTask.getSheetNo()); actualTempConsume.add(JSONObject.toJSON(map)); map.clear(); - map.put("time",parTemValue.getCreateTime()); - map.put("value",parTemValue.getSetTemValue()); - map.put("name","设定温度"); - map.put("unit","℃"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parTemValue.getCreateTime()); + map.put("value", parTemValue.getSetTemValue()); + map.put("name", "设定温度"); + map.put("unit", "℃"); + map.put("炉号", currTask.getSheetNo()); setupTempConsume.add(JSONObject.toJSON(map)); map.clear(); } tempList.add(actualTempConsume); tempList.add(setupTempConsume); - jsonObject.put("temp",tempList); + jsonObject.put("temp", tempList); } - if (kilnType==3){ + if (kilnType == 3) { - List tempList=new ArrayList<>(); - List actualTempConsume=new ArrayList<>(); - List setupTempConsume=new ArrayList<>(); - List outerZone1TempConsume=new ArrayList<>(); - List outerZone2TempConsume=new ArrayList<>(); - for (ParTemValue parTemValue:parTemValueList + List tempList = new ArrayList<>(); + List actualTempConsume = new ArrayList<>(); + List setupTempConsume = new ArrayList<>(); + List outerZone1TempConsume = new ArrayList<>(); + List outerZone2TempConsume = new ArrayList<>(); + for (ParTemValue parTemValue : parTemValueList ) { - map.put("time",parTemValue.getCreateTime()); - map.put("value",parTemValue.getActTemValue()); - map.put("name","实际温度"); - map.put("unit","℃"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parTemValue.getCreateTime()); + map.put("value", parTemValue.getActTemValue()); + map.put("name", "实际温度"); + map.put("unit", "℃"); + map.put("炉号", currTask.getSheetNo()); actualTempConsume.add(JSONObject.toJSON(map)); map.clear(); - map.put("time",parTemValue.getCreateTime()); - map.put("value",parTemValue.getSetTemValue()); - map.put("name","设定温度"); - map.put("unit","℃"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parTemValue.getCreateTime()); + map.put("value", parTemValue.getSetTemValue()); + map.put("name", "设定温度"); + map.put("unit", "℃"); + map.put("炉号", currTask.getSheetNo()); setupTempConsume.add(JSONObject.toJSON(map)); map.clear(); - map.put("time",parTemValue.getCreateTime()); - map.put("value",parTemValue.getOuterZone1Temp()); - map.put("name","外一区温度"); - map.put("unit","℃"); - map.put("炉号",currTask.getSheetNo()); + map.put("time", parTemValue.getCreateTime()); + map.put("value", parTemValue.getOuterZone1Temp()); + map.put("name", "外一区温度"); + map.put("unit", "℃"); + map.put("炉号", currTask.getSheetNo()); outerZone1TempConsume.add(JSONObject.toJSON(map)); map.clear(); - map.put("time",parTemValue.getCreateTime()); + map.put("time", parTemValue.getCreateTime()); - map.put("value",parTemValue.getOuterZone2Temp()); - map.put("name","外二区温度"); - map.put("unit","℃"); - map.put("炉号",currTask.getSheetNo()); + map.put("value", parTemValue.getOuterZone2Temp()); + map.put("name", "外二区温度"); + map.put("unit", "℃"); + map.put("炉号", currTask.getSheetNo()); outerZone2TempConsume.add(JSONObject.toJSON(map)); map.clear(); } @@ -399,154 +403,487 @@ public class EnergyController extends BaseController { tempList.add(setupTempConsume); tempList.add(outerZone1TempConsume); tempList.add(outerZone2TempConsume); - jsonObject.put("temp",tempList); + jsonObject.put("temp", tempList); } } - json.put(String.valueOf(taskId),jsonObject); + json.put(String.valueOf(taskId), jsonObject); } return R.ok(json.toJSONString()); } - private Float floatSubtract(Float a,Float b){ + + private Float floatSubtract(Float a, Float b) { BigDecimal a1 = new BigDecimal(Float.toString(a)); BigDecimal b1 = new BigDecimal(Float.toString(b)); - return a1.floatValue(); + return a1.subtract(b1).floatValue(); } + @PostMapping(value = "checkResultList") @ApiOperation(value = "根据生产单号获取apms检验结果") - public List getApmsCheckResult(@RequestBody ElectricQueryParam electricQueryParam){ - return apmsCheckResultServiceBiz.list(new QueryWrapper().eq(ApmsCheckResult.SHEET_NO,electricQueryParam.getSheetNo())); + public List getApmsCheckResult(@RequestBody ElectricQueryParam electricQueryParam) { + return apmsCheckResultServiceBiz.list(new QueryWrapper().eq(ApmsCheckResult.SHEET_NO, electricQueryParam.getSheetNo())); } @PostMapping(value = "eletric") - @ApiOperation(value = "根据任务id获取消耗情况",hidden = true) - public R list(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam) { - Long kiln = electricQueryParam.getKilnId(); - //工业炉id为0代表全部,存储的时候计算全部 - JSONObject jsonObject=new JSONObject(); - //指定时间节点 - LocalDate timeDate = electricQueryParam.getTime().toLocalDate(); - LocalDateTime timeStart = LocalDateTime.of(timeDate, LocalTime.MIN); - LocalDateTime timeEnd = LocalDateTime.of(timeDate, LocalTime.MAX); - //当前时间节点 - LocalDateTime todayStart = LocalDateTime.of(LocalDate.now(), LocalTime.MIN); - LocalDateTime todayEnd = LocalDateTime.of(LocalDate.now(), LocalTime.MAX); - - //总电能消耗 - List todayEleValueList = parEleValueServiceBiz.list(new QueryWrapper() - .eq("kiln_id", kiln) - .between("create_time", todayStart, todayEnd) - .orderByDesc("create_time")); - Float countEleValue = todayEleValueList.get(0).getTotalBat(); - jsonObject.put("countEle",countEleValue); - - //昨日电能消耗 - LocalDateTime yesterdayStart = LocalDateTime.of(LocalDate.now().plus(1, ChronoUnit.DAYS), LocalTime.MIN); - LocalDateTime yesterdayEnd = LocalDateTime.of(LocalDate.now().plus(1, ChronoUnit.DAYS), LocalTime.MAX); - List yesterdayEleValueList = parEleValueServiceBiz.list(new QueryWrapper() - .eq("kiln_id", kiln) - .between("create_time", yesterdayStart, yesterdayEnd) - .eq("date_type",0) - .orderByAsc("create_time")); - Float yesterdayTotalBat= yesterdayEleValueList.get(yesterdayEleValueList.size()-1).getTotalBat()-yesterdayEleValueList.get(0).getTotalBat(); - jsonObject.put("yesterdayCountEle",yesterdayTotalBat); - - //指定日期当天的电能消耗 - if (electricQueryParam.getDateType()==0){ - List dateEleValueList = parEleValueServiceBiz.list(new QueryWrapper() - .eq("kiln_id", kiln) - .between("create_time", timeStart, timeEnd) - .orderByAsc("create_time")); - //总耗电量 - Float dateCountEle=0F; - if (dateEleValueList.size()!=0){ - dateCountEle= dateEleValueList.get(dateEleValueList.size()-1).getTotalBat()-dateEleValueList.get(0).getTotalBat(); + @ApiOperation(value = "根据任务id获取消耗情况", hidden = false) + public R list(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam) { + List taskIds = electricQueryParam.getTaskIds(); + Map map = new HashMap<>(); + //电度值 + List> eleConsumeList = new ArrayList<>(); + //A向电压 + List> aVolConsumeList = new ArrayList<>(); + //B向电压 + List> bVolConsumeList = new ArrayList<>(); + //C向电压 + List> cVolConsumeList = new ArrayList<>(); + //A向电流 + List> aCurrentList = new ArrayList<>(); + //B向电流 + List> bCurrentList = new ArrayList<>(); + //C向电流 + List> cCurrentList = new ArrayList<>(); + //氮气 + List> nitConsumeList = new ArrayList<>(); + //甲醇 + List> metConsumeList = new ArrayList<>(); + //丙烷 + List> propaneConsumeList = new ArrayList<>(); + //氨气 + List> ammoniaConsumeList = new ArrayList<>(); + //二氧化碳 + List> carbonConsumeList = new ArrayList<>(); + //1号油搅拌转速 + List> rot1ConsumeList = new ArrayList<>(); + //2号油搅拌转速 + List> rot2ConsumeList = new ArrayList<>(); + //温度 + List> tempConsumeList = new ArrayList<>(); + //油槽温度 + List> oilTempConsumeList = new ArrayList<>(); + //外一区温度 + List> outerZone1TempConsumeList = new ArrayList<>(); + //外二区温度 + List> outerZone2TempConsumeList = new ArrayList<>(); + //碳/氮势 + List> carbonList = new ArrayList<>(); + List> checkResultList = new ArrayList<>(); + for (Long taskId : taskIds + ) { + TaskHis currTask = taskHisServiceBiz.getOne(new QueryWrapper().eq(TaskHis.TASK_ID, taskId)); + //防止早期没有炉号的报错 + if (currTask.getStoveCode() == null) { + currTask.setStoveCode(currTask.getSheetNo()); } - jsonObject.put("dateCountEle",dateCountEle); - //分时消耗量 - Map timeJsonObject=new LinkedHashMap(); - for (int i = 0; i < dateEleValueList.size() - 1; ++i) { - // TODO: 2021/12/16 - float eleValue = dateEleValueList.get(i).getTotalBat() - dateEleValueList.get(i - 1).getTotalBat(); - int j=i+1; - if (j%2==0){ - String time=(j-1)/2+":30"; - timeJsonObject.put(time,eleValue); - }else { - String time=(j-1)/2+":00"; - timeJsonObject.put(time,eleValue); + //获取检验结果 + List apmsCheckResults = apmsCheckResultServiceBiz.list(new QueryWrapper() + .eq(ApmsCheckResult.SHEET_NO, currTask.getSheetNo())); + List apmsCheckResultVos = BeanUtils.copyList(apmsCheckResults, ApmsCheckResultVo.class); + for (ApmsCheckResultVo apmsCheckResultVo : apmsCheckResultVos + ) { + apmsCheckResultVo.setStoveCode(currTask.getStoveCode()); + } + Long kilnId = currTask.getKilnId(); + KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId); + Integer kilnType = kilnInfo.getType(); + //电能消耗 + List parEleValueList = parEleValueServiceBiz.list(new QueryWrapper() + .eq(ParEleValue.KILN_ID, kilnId) + .eq(ParEleValue.TASK_ID, taskId)); + if (parEleValueList.size() > 0) { + List eleList = new ArrayList<>(); + //电能消耗 + List eleConsume = new ArrayList<>(); + //A向电压 + List aVolConsume = new ArrayList<>(); + //B向电压 + List bVolConsume = new ArrayList<>(); + //C向电压 + List cVolConsume = new ArrayList<>(); + //A向电流 + List aCurrentConsume = new ArrayList<>(); + //B向电流 + List bCurrentConsume = new ArrayList<>(); + //C向电流 + List cCurrentConsume = new ArrayList<>(); + Float talBat = 0F; + int i = 0; + for (ParEleValue parEleValue : parEleValueList + ) { + //首位置为0 + if (i == 0) { + talBat = parEleValue.getTotalBat(); + } + i++; + EnergyVo eleVo = EnergyVo.builder().build(); + eleVo.setCode(currTask.getStoveCode()); + eleVo.setName("耗电量"); + eleVo.setUnit("KW"); + eleVo.setTime(parEleValue.getCreateTime()); + eleVo.setValue(floatSubtract(parEleValue.getTotalBat(), talBat)); + eleConsume.add(eleVo); + + EnergyVo aVolVo = EnergyVo.builder().build(); + aVolVo.setCode(currTask.getStoveCode()); + aVolVo.setName("A向电压"); + aVolVo.setUnit("V"); + aVolVo.setTime(parEleValue.getCreateTime()); + aVolVo.setValue(parEleValue.getAVoltagevValue()); + aVolConsume.add(aVolVo); + + EnergyVo bVolVo = EnergyVo.builder().build(); + bVolVo.setCode(currTask.getStoveCode()); + bVolVo.setName("B向电压"); + bVolVo.setUnit("V"); + bVolVo.setTime(parEleValue.getCreateTime()); + bVolVo.setValue(parEleValue.getBVoltagevValue()); + bVolConsume.add(bVolVo); + + EnergyVo cVolVo = EnergyVo.builder().build(); + cVolVo.setCode(currTask.getStoveCode()); + cVolVo.setName("C向电压"); + cVolVo.setUnit("V"); + cVolVo.setTime(parEleValue.getCreateTime()); + cVolVo.setValue(parEleValue.getCVoltagevValue()); + cVolConsume.add(cVolVo); + + EnergyVo aCurrVo = EnergyVo.builder().build(); + aCurrVo.setCode(currTask.getStoveCode()); + aCurrVo.setName("A向电流"); + aCurrVo.setUnit("A"); + aCurrVo.setTime(parEleValue.getCreateTime()); + aCurrVo.setValue(parEleValue.getACurrentValue()); + aCurrentConsume.add(aCurrVo); + + EnergyVo bCurrVo = EnergyVo.builder().build(); + bCurrVo.setCode(currTask.getStoveCode()); + bCurrVo.setName("B向电流"); + bCurrVo.setUnit("A"); + bCurrVo.setTime(parEleValue.getCreateTime()); + bCurrVo.setValue(parEleValue.getBCurrentValue()); + bCurrentConsume.add(bCurrVo); + + EnergyVo cCurrVo = EnergyVo.builder().build(); + cCurrVo.setCode(currTask.getStoveCode()); + cCurrVo.setName("C向电流"); + cCurrVo.setUnit("A"); + cCurrVo.setTime(parEleValue.getCreateTime()); + cCurrVo.setValue(parEleValue.getCCurrentValue()); + cCurrentConsume.add(cCurrVo); + } + eleConsumeList.add(eleConsume); + aVolConsumeList.add(aVolConsume); + bVolConsumeList.add(bVolConsume); + cVolConsumeList.add(cVolConsume); + aCurrentList.add(aCurrentConsume); + bCurrentList.add(bCurrentConsume); + cCurrentList.add(cCurrentConsume); + + } + //氮气、甲醇、丙烷、氨气二氧化碳消耗量碳势 + List parGasValueList = parGasValueServiceBiz.list(new QueryWrapper() + .eq(ParEleValue.KILN_ID, kilnId) + .eq(ParEleValue.TASK_ID, taskId)); + if (parGasValueList.size() > 0) { + if (kilnType == 1) { + //碳/氮势 + List carbon = new ArrayList<>(); + //碳/氮势-设定 + List carbonSet = new ArrayList<>(); + //氮气 + List nitConsume = new ArrayList<>(); + //甲醇 + List metConsume = new ArrayList<>(); + //丙烷 + List propaneConsume = new ArrayList<>(); + //氨气 + List ammoniaConsume = new ArrayList<>(); + for (ParGasValue parGasValue : parGasValueList + ) { + EnergyVo carbonSetVo = EnergyVo.builder().build(); + carbonSetVo.setTime(parGasValue.getCreateTime()); + carbonSetVo.setCode(currTask.getStoveCode().concat("-设定")); + carbonSetVo.setUnit("%"); + carbonSetVo.setName("碳/氮势"); + carbonSetVo.setValue(parGasValue.getSetNitPotValue()); + carbonSet.add(carbonSetVo); + EnergyVo carbonActVo = EnergyVo.builder().build(); + carbonActVo.setValue(parGasValue.getActualNitPotValue()); + carbonActVo.setUnit("%"); + carbonActVo.setName("碳/氮势"); + carbonActVo.setCode(currTask.getStoveCode()); + carbon.add(carbonActVo); + + EnergyVo nitVo = EnergyVo.builder().build(); + nitVo.setTime(parGasValue.getCreateTime()); + nitVo.setUnit("m³/h"); + nitVo.setValue(parGasValue.getNitFlowValue()); + nitVo.setName("氮气"); + nitVo.setCode(currTask.getStoveCode()); + nitConsume.add(nitVo); + + EnergyVo metVo = EnergyVo.builder().build(); + metVo.setCode(currTask.getStoveCode()); + metVo.setValue(parGasValue.getMethanolFlow()); + metVo.setName("甲醇"); + metVo.setUnit("m³/h"); + metVo.setTime(parGasValue.getCreateTime()); + metConsume.add(metVo); + + EnergyVo propaneVo = EnergyVo.builder().build(); + propaneVo.setTime(parGasValue.getCreateTime()); + propaneVo.setCode(currTask.getStoveCode()); + propaneVo.setUnit("m³/h"); + propaneVo.setValue(parGasValue.getPropaneFlow()); + propaneVo.setName("丙烷"); + propaneConsume.add(propaneVo); + + EnergyVo ammoniaVo = EnergyVo.builder().build(); + ammoniaVo.setName("氨气"); + ammoniaVo.setCode(currTask.getStoveCode()); + ammoniaVo.setValue(parGasValue.getAmmoniaFlowValue()); + ammoniaVo.setUnit("m³/h"); + ammoniaVo.setTime(parGasValue.getCreateTime()); + ammoniaConsume.add(ammoniaVo); + } + carbonList.add(carbon); + carbonList.add(carbonSet); + nitConsumeList.add(nitConsume); + metConsumeList.add(metConsume); + propaneConsumeList.add(propaneConsume); + ammoniaConsumeList.add(ammoniaConsume); + } + if (kilnType == 3) { + //碳/氮势 + List carbon = new ArrayList<>(); + //碳/氮势-设定 + List carbonSet = new ArrayList<>(); + //氮气 + List nitConsume = new ArrayList<>(); + //二氧化碳 + List carbonConsume = new ArrayList<>(); + //氨气 + List ammoniaConsume = new ArrayList<>(); + for (ParGasValue parGasValue : parGasValueList + ) { + EnergyVo carbonSetVo = EnergyVo.builder().build(); + carbonSetVo.setTime(parGasValue.getCreateTime()); + carbonSetVo.setCode(currTask.getStoveCode().concat("-设定")); + carbonSetVo.setUnit("%"); + carbonSetVo.setName("碳/氮势"); + carbonSetVo.setValue(parGasValue.getSetNitPotValue()); + carbonSet.add(carbonSetVo); + EnergyVo carbonActVo = EnergyVo.builder().build(); + carbonActVo.setValue(parGasValue.getActualNitPotValue()); + carbonActVo.setUnit("%"); + carbonActVo.setName("碳/氮势"); + carbonActVo.setCode(currTask.getStoveCode()); + carbon.add(carbonActVo); + + EnergyVo nitVo = EnergyVo.builder().build(); + nitVo.setTime(parGasValue.getCreateTime()); + nitVo.setUnit("m³/h"); + nitVo.setValue(parGasValue.getNitFlowValue()); + nitVo.setName("氮气"); + nitVo.setCode(currTask.getStoveCode()); + nitConsume.add(nitVo); + + EnergyVo carbonVo = EnergyVo.builder().build(); + carbonVo.setTime(parGasValue.getCreateTime()); + carbonVo.setCode(currTask.getStoveCode()); + carbonVo.setUnit("m³/h"); + carbonVo.setValue(parGasValue.getCarDioxideFlowValue()); + carbonVo.setName("二氧化碳"); + carbonConsume.add(carbonVo); + + EnergyVo ammoniaVo = EnergyVo.builder().build(); + ammoniaVo.setName("氨气"); + ammoniaVo.setCode(currTask.getStoveCode()); + ammoniaVo.setValue(parGasValue.getAmmoniaFlowValue()); + ammoniaVo.setUnit("m³/h"); + ammoniaVo.setTime(parGasValue.getCreateTime()); + ammoniaConsume.add(ammoniaVo); + } + carbonList.add(carbon); + carbonList.add(carbonSet); + carbonConsumeList.add(carbonConsume); + nitConsumeList.add(nitConsume); + ammoniaConsumeList.add(ammoniaConsume); } } - jsonObject.put("timeEle",timeJsonObject); + //油搅拌转速趋势 + List parRotSpeedValueList = parRotSpeedValueServiceBiz.list(new QueryWrapper() + .eq(ParEleValue.KILN_ID, kilnId) + .eq(ParEleValue.TASK_ID, taskId)); + if (parRotSpeedValueList.size() > 0) { + if (kilnType == 1) { + List rot1Consume = new ArrayList<>(); + List rot2Consume = new ArrayList<>(); + for (ParRotSpeedValue parRotSpeedValue : parRotSpeedValueList + ) { + EnergyVo rot1Vo = EnergyVo.builder().build(); + rot1Vo.setCode(currTask.getStoveCode()); + rot1Vo.setUnit("转/min"); + rot1Vo.setName("1号油搅拌转速"); + rot1Vo.setValue(parRotSpeedValue.getOilStiSpeedAValue()); + rot1Vo.setTime(parRotSpeedValue.getCreateTime()); + rot1Consume.add(rot1Vo); + + EnergyVo rot2Vo = EnergyVo.builder().build(); + rot2Vo.setCode(currTask.getStoveCode()); + rot2Vo.setUnit("转/min"); + rot2Vo.setName("2号油搅拌转速"); + rot2Vo.setValue(parRotSpeedValue.getOilStiSpeedBValue()); + rot2Vo.setTime(parRotSpeedValue.getCreateTime()); + rot1Consume.add(rot2Vo); + } + rot1ConsumeList.add(rot1Consume); + rot2ConsumeList.add(rot2Consume); + } + } + //温度趋势(实际温度、设定温度)油槽温度外区温度 + List parTemValueList = parTemValueServiceBiz.list(new QueryWrapper() + .eq(ParEleValue.KILN_ID, kilnId) + .eq(ParEleValue.TASK_ID, taskId)); + if (parTemValueList.size() > 0) { + if (kilnType == 1) { + List actualTempConsume = new ArrayList<>(); + List setupTempConsume = new ArrayList<>(); + List actualOilTempConsume = new ArrayList<>(); + List setupOilTempConsume = new ArrayList<>(); + for (ParTemValue parTemValue : parTemValueList + ) { + EnergyVo actTempVo = EnergyVo.builder().build(); + actTempVo.setTime(parTemValue.getCreateTime()); + actTempVo.setCode(currTask.getStoveCode()); + actTempVo.setUnit("℃"); + actTempVo.setValue(parTemValue.getActTemValue()); + actTempVo.setName("实际温度"); + actualTempConsume.add(actTempVo); + + EnergyVo setTempVo = EnergyVo.builder().build(); + setTempVo.setTime(parTemValue.getCreateTime()); + setTempVo.setCode(currTask.getStoveCode().concat("-设定")); + setTempVo.setUnit("℃"); + setTempVo.setValue(parTemValue.getSetTemValue()); + setTempVo.setName("设定温度"); + setupTempConsume.add(setTempVo); + + EnergyVo oilSetTempVo = EnergyVo.builder().build(); + oilSetTempVo.setTime(parTemValue.getCreateTime()); + oilSetTempVo.setCode(currTask.getStoveCode().concat("-设定")); + oilSetTempVo.setUnit("℃"); + oilSetTempVo.setValue(parTemValue.getOilTankSetTemValue()); + oilSetTempVo.setName("油槽设定温度"); + setupOilTempConsume.add(oilSetTempVo); + + EnergyVo oilActTempVo = EnergyVo.builder().build(); + oilActTempVo.setTime(parTemValue.getCreateTime()); + oilActTempVo.setCode(currTask.getStoveCode()); + oilActTempVo.setUnit("℃"); + oilActTempVo.setValue(parTemValue.getOilTankActTemValue()); + oilActTempVo.setName("油槽实际温度"); + actualOilTempConsume.add(oilActTempVo); + + } + tempConsumeList.add(actualTempConsume); + tempConsumeList.add(setupTempConsume); + oilTempConsumeList.add(actualOilTempConsume); + oilTempConsumeList.add(setupOilTempConsume); + } + if (kilnType == 2) { + List actualTempConsume = new ArrayList<>(); + List setupTempConsume = new ArrayList<>(); + for (ParTemValue parTemValue : parTemValueList + ) { + EnergyVo actTempVo = EnergyVo.builder().build(); + actTempVo.setTime(parTemValue.getCreateTime()); + actTempVo.setCode(currTask.getStoveCode()); + actTempVo.setUnit("℃"); + actTempVo.setValue(parTemValue.getActTemValue()); + actTempVo.setName("实际温度"); + actualTempConsume.add(actTempVo); + + EnergyVo setTempVo = EnergyVo.builder().build(); + setTempVo.setTime(parTemValue.getCreateTime()); + setTempVo.setCode(currTask.getStoveCode().concat("-设定")); + setTempVo.setUnit("℃"); + setTempVo.setValue(parTemValue.getSetTemValue()); + setTempVo.setName("设定温度"); + setupTempConsume.add(setTempVo); + } + tempConsumeList.add(actualTempConsume); + tempConsumeList.add(setupTempConsume); + ; + } + if (kilnType == 3) { + + List actualTempConsume = new ArrayList<>(); + List setupTempConsume = new ArrayList<>(); + List outerZone1TempConsume = new ArrayList<>(); + List outerZone2TempConsume = new ArrayList<>(); + for (ParTemValue parTemValue : parTemValueList + ) { + EnergyVo actTempVo = EnergyVo.builder().build(); + actTempVo.setTime(parTemValue.getCreateTime()); + actTempVo.setCode(currTask.getStoveCode()); + actTempVo.setUnit("℃"); + actTempVo.setValue(parTemValue.getActTemValue()); + actTempVo.setName("实际温度"); + actualTempConsume.add(actTempVo); + + EnergyVo setTempVo = EnergyVo.builder().build(); + setTempVo.setTime(parTemValue.getCreateTime()); + setTempVo.setCode(currTask.getStoveCode().concat("-设定")); + setTempVo.setUnit("℃"); + setTempVo.setValue(parTemValue.getSetTemValue()); + setTempVo.setName("设定温度"); + setupTempConsume.add(setTempVo); + + EnergyVo outer1TempVo = EnergyVo.builder().build(); + outer1TempVo.setTime(parTemValue.getCreateTime()); + outer1TempVo.setCode(currTask.getStoveCode()); + outer1TempVo.setUnit("℃"); + outer1TempVo.setValue(parTemValue.getOuterZone1Temp()); + outer1TempVo.setName("外一区温度"); + setupTempConsume.add(outer1TempVo); + + EnergyVo outer2TempVo = EnergyVo.builder().build(); + outer2TempVo.setTime(parTemValue.getCreateTime()); + outer2TempVo.setCode(currTask.getStoveCode()); + outer2TempVo.setUnit("℃"); + outer2TempVo.setValue(parTemValue.getOuterZone2Temp()); + outer2TempVo.setName("外二区温度"); + setupTempConsume.add(outer2TempVo); + + } + tempConsumeList.add(actualTempConsume); + tempConsumeList.add(setupTempConsume); + outerZone1TempConsumeList.add(outerZone1TempConsume); + outerZone2TempConsumeList.add(outerZone2TempConsume); + } + } + checkResultList.add(apmsCheckResultVos); } - //指定日期当周的每天电能消耗 - if(electricQueryParam.getDateType()==1){ - LocalDate monday = timeDate.with(DayOfWeek.MONDAY); - LocalDate sunday = timeDate.with(DayOfWeek.SUNDAY); - List timeWeekEleValueList = parEleValueServiceBiz.list(new QueryWrapper() - .eq("kiln_id", kiln) - .between("create_time", monday, sunday.plusDays(1)) - .eq("date_type", 1) - .orderByAsc("create_time")); - //总耗电量 - Float dateCountEle=0F; - if (timeWeekEleValueList.size()!=0){ - dateCountEle= timeWeekEleValueList.get(timeWeekEleValueList.size()-1).getTotalBat()-timeWeekEleValueList.get(0).getTotalBat(); - } - jsonObject.put("dateCountEle",dateCountEle); - Map timeJsonObject=new LinkedHashMap(); - for (ParEleValue parEleValue:timeWeekEleValueList - ) { - LocalDate localDate = parEleValue.getCreateTime().toLocalDate(); - timeJsonObject.put(localDate.toString(),parEleValue.getTotalBat()); - } - jsonObject.put("timeEle",timeJsonObject); - } - //指定日期当月的每天电能消耗 - if(electricQueryParam.getDateType()==2){ - LocalDate firstday = LocalDate.of(timeDate.getYear(), timeDate.getMonthValue(), 1); - LocalDate lastDay = timeDate.with(TemporalAdjusters.lastDayOfMonth()); - List timeMonthEleValueList = parEleValueServiceBiz.list(new QueryWrapper() - .eq("kiln_id", kiln) - .between("create_time", firstday, lastDay.plusDays(1)) - .eq("date_type", 1) - .orderByAsc("create_time")); - //总耗电量 - Float dateCountEle=0F; - if (timeMonthEleValueList.size()!=0){ - dateCountEle= timeMonthEleValueList.get(timeMonthEleValueList.size()-1).getTotalBat()-timeMonthEleValueList.get(0).getTotalBat(); - } - jsonObject.put("dateCountEle",dateCountEle); - Map timeJsonObject=new LinkedHashMap(); - for (ParEleValue parEleValue:timeMonthEleValueList - ) { - LocalDate localDate = parEleValue.getCreateTime().toLocalDate(); - timeJsonObject.put(localDate.toString(),parEleValue.getTotalBat()); - } - jsonObject.put("timeEle",timeJsonObject); - } - //指定日期当年的每月电能消耗 - if(electricQueryParam.getDateType()==2){ - LocalDate firstDay = timeDate.with(TemporalAdjusters.firstDayOfYear()); - LocalDate lastDay = timeDate.with(TemporalAdjusters.lastDayOfYear()); - List timeYearEleValueList = parEleValueServiceBiz.list(new QueryWrapper() - .eq("kiln_id", kiln) - .between("create_time", firstDay, lastDay.plusDays(1)) - .eq("date_type", 2) - .orderByAsc("create_time")); - //总耗电量 - Float dateCountEle=0F; - if (timeYearEleValueList.size()!=0){ - dateCountEle= timeYearEleValueList.get(timeYearEleValueList.size()-1).getTotalBat()-timeYearEleValueList.get(0).getTotalBat(); - } - jsonObject.put("dateCountEle",dateCountEle); - Map timeJsonObject=new LinkedHashMap(); - for (ParEleValue parEleValue:timeYearEleValueList - ) { - LocalDate localDate = parEleValue.getCreateTime().toLocalDate(); - timeJsonObject.put(localDate.toString(),parEleValue.getTotalBat()); - } - jsonObject.put("timeEle",timeJsonObject); - } - return successful(jsonObject.toJSONString()); + map.put("checkResult", checkResultList); + map.put("ele", eleConsumeList); + map.put("aVol", aVolConsumeList); + map.put("bVol", bVolConsumeList); + map.put("cVol", cVolConsumeList); + map.put("aCurr", aCurrentList); + map.put("bCurr", bCurrentList); + map.put("cCurr", cCurrentList); + map.put("carbon", carbonList); + map.put("nit", nitConsumeList); + map.put("met", metConsumeList); + map.put("propane", propaneConsumeList); + map.put("ammon", ammoniaConsumeList); + map.put("car", carbonConsumeList); + map.put("rot1", rot1ConsumeList); + map.put("rot2", rot2ConsumeList); + map.put("temp", tempConsumeList); + map.put("oilTemp", oilTempConsumeList); + map.put("outer1Temp", outerZone1TempConsumeList); + map.put("outer2Temp", outerZone2TempConsumeList); + return successful(JSONObject.parseObject(JSON.toJSONString(map))); } } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/ApmsCheckResultVo.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/ApmsCheckResultVo.java new file mode 100644 index 0000000..b90f770 --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/ApmsCheckResultVo.java @@ -0,0 +1,174 @@ +package com.mt.wms.empty.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.Version; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; + +/** + * @Author: LGH + * @Date: 2022/11/17 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@Builder +@ApiModel(value = "APMS检验结果视图对象", description = "用于查询APMS检验结果视图对象") +public class ApmsCheckResultVo { + + /** + * 添加时间,入库时间 + */ + @ApiModelProperty(value = "创建时间", example = "1") + private LocalDateTime createTime; + + /** + * 生产单号 + */ + @ApiModelProperty(value = "生产单号", example = "1") + private String sheetNo; + + /** + * 炉号 + */ + @ApiModelProperty(value = "炉号", example = "1") + private String stoveCode; + + /** + * 标识卡号 + */ + @ApiModelProperty(value = "标识卡号", example = "1") + private String idenCardNum; + + /** + * 硬度检验结果(待检验、合格、不合格、返工、作废) + */ + @ApiModelProperty(value = "硬度检验结果(待检验、合格、不合格、返工、作废)", example = "1") + private String hardness; + + /** + * 金相检验结果(合格、不合格) + */ + @ApiModelProperty(value = "金相检验结果(合格、不合格)", example = "1") + private String metallography; + + /** + * 心部硬度检验值 + */ + @ApiModelProperty(value = "心部硬度检验值", example = "1") + private String heartHardness; + + /** + * 备注,特殊注释等 + */ + @ApiModelProperty(value = "备注", example = "1") + private String remake; + + /** + * 硬度检验结果1 + */ + @ApiModelProperty(value = "硬度检验结果1", example = "1") + private String hardnessValueOne; + + /** + * 硬度检验结果2 + */ + @ApiModelProperty(value = "硬度检验结果2", example = "1") + private String hardnessValueTwo; + + /** + * 硬度检验结果3 + */ + @ApiModelProperty(value = "硬度检验结果3", example = "1") + private String hardnessValueThree; + + /** + * 金相检验渗碳淬火 渗碳层深度 + */ + @ApiModelProperty(value = "金相检验渗碳淬火 渗碳层深度", example = "1") + private Float metallographyStchStccsd; + + /** + * 金相检验渗碳淬火 表面为马氏体、残余奥氏体(级) + */ + @ApiModelProperty(value = "金相检验渗碳淬火 表面为马氏体、残余奥氏体(级)", example = "1") + private String metallographyStchMstost; + + /** + * 金相检验渗碳淬火 细小颗粒状碳化物 + */ + @ApiModelProperty(value = "金相检验渗碳淬火 细小颗粒状碳化物", example = "1") + private String metallographyStchXxklzthw; + + /** + * 金相检验渗碳淬火 心部为低碳马氏体加游离铁素体(级) + */ + @ApiModelProperty(value = "金相检验渗碳淬火 心部为低碳马氏体加游离铁素体(级)", example = "1") + private String metallographyStchDtmstyltst; + + /** + * 金相检验整体淬火 基体为回火马氏体(级) + */ + @ApiModelProperty(value = "金相检验整体淬火 基体为回火马氏体(级)", example = "1") + private String metallographyZtchHhmst; + + /** + * 金相检验整体淬火 基体为回火托式体(级) + */ + @ApiModelProperty(value = "金相检验整体淬火 基体为回火托式体(级)", example = "1") + private String metallographyZtchHhtst; + + /** + * 金相检验整体淬火 基体为回火素式体(级) + */ + @ApiModelProperty(value = "金相检验整体淬火 基体为回火素式体(级)", example = "1") + private String metallographyZtchHhsst; + + /** + * 金相检验氮化 表面亮白色的为氮化合物层深 + */ + @ApiModelProperty(value = "金相检验氮化 表面亮白色的为氮化合物层深", example = "1") + private Float metallographyDhDhhwcs; + + /** + * 金相检验氮化 向内为扩散层深 + */ + @ApiModelProperty(value = "金相检验氮化 向内为扩散层深", example = "1") + private Float metallographyDhKscs; + + /** + * 金相检验氮化 心部 + */ + @ApiModelProperty(value = "金相检验氮化 心部", example = "1") + private String metallographyDhXb; + + /** + * 金相检验表面淬火 表面为板条马氏体(级) + */ + @ApiModelProperty(value = "金相检验表面淬火 表面为板条马氏体(级)", example = "1") + private String metallographyBmchBtmst; + + /** + * 金相检验表面淬火 心部 + */ + @ApiModelProperty(value = "金相检验表面淬火 心部", example = "1") + private String metallographyBmchXb; + + /** + * 金相检验 备注 + */ + @ApiModelProperty(value = "金相检验 备注", example = "1") + private String metallographyBz; + + /** + * 金相检验心部硬度 心部硬度检验结果 + */ + @ApiModelProperty(value = "金相检验心部硬度 心部硬度检验结果", example = "1") + private Float metallographyXbydXbydjyjg; +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/EnergyVo.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/EnergyVo.java new file mode 100644 index 0000000..dc4955a --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/EnergyVo.java @@ -0,0 +1,50 @@ +package com.mt.wms.empty.vo; + +import com.mt.wms.core.base.BaseVo; +import com.mt.wms.core.vo.PageVo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; + +/** + * @Author: LGH + * @Date: 2022/11/16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@Builder +@ApiModel(value = "能源消耗视图对象", description = "用于查询能源消耗视图对象") +public class EnergyVo extends BaseVo implements PageVo.ConvertVo{ + /** + * 名称 + */ + @ApiModelProperty(value = "名称",example = "0") + private String name; + /** + * 值 + */ + @ApiModelProperty(value = "名称",example = "0") + private Object value; + /** + * 单位 + */ + @ApiModelProperty(value = "单位",example = "0") + private String unit; + /** + * 时间 + */ + @ApiModelProperty(value = "时间",example = "0") + private LocalDateTime time; + + /** + * code + */ + @ApiModelProperty(value = "编码",example = "0") + private String code; +}