能源消耗

This commit is contained in:
李广豪 2022-03-04 17:08:09 +08:00
parent b2f279d9a6
commit ee05bbf7bb
13 changed files with 304 additions and 25 deletions

View File

@ -49,6 +49,12 @@ public class KilnInfoParam extends BaseParam {
@ApiModelProperty(value = "缩写(别名)", example = "1")
@NotNull(message = "别名不能为空")
private String kilnAlias;
/**
* 设备类型存储数据字典编码修改为1加工炉2回火炉3氮化炉4清洗炉
*/
@ApiModelProperty(value = "设备类型存储数据字典编码修改为1加工炉2回火炉3氮化炉4清洗炉", example = "1")
@NotNull(message = "设备类型不能为空")
private Integer type;
/**

View File

@ -32,6 +32,12 @@ public class KilnInfoVo extends BaseVo implements PageVo.ConvertVo {
@ApiModelProperty(value = "编码", example = "1")
private String code;
/**
* 类型存储数据字典编码修改为1加工炉2回火炉3氮化炉4清洗炉
*/
@ApiModelProperty(value = "类型存储数据字典编码修改为1加工炉2回火炉3氮化炉4清洗炉", example = "1")
private Integer type;
/**
* 名称
*/

View File

@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
* </p>
*
* @author mt
* @since 2022-03-03
* @since 2022-03-04
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ -46,7 +46,7 @@ public class AutoExeTask extends Model<AutoExeTask> {
private LocalDateTime createTime;
/**
* 状态0新增1执行中2完成
* 状态0新增1执行中2完成3 终止
*/
@TableField("status")
private Integer status;

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author mt
* @since 2022-03-03
* @since 2022-03-04
*/
public interface AutoExeTaskMapper extends BaseMapper<AutoExeTask> {

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
* </p>
*
* @author mt
* @since 2022-03-03
* @since 2022-03-04
*/
public interface AutoExeTaskServiceBiz extends IService<AutoExeTask> {

View File

@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
* </p>
*
* @author mt
* @since 2022-03-03
* @since 2022-03-04
*/
@Service
public class AutoExeTaskServiceBizImpl extends ServiceImpl<AutoExeTaskMapper, AutoExeTask> implements AutoExeTaskServiceBiz {

View File

@ -48,6 +48,8 @@ public class AutoTaskController extends BaseController {
return autoTaskService.page(autoTaskQueryParam);
}
@PostMapping(value = "stop")
@ApiOperation(value = "终止自动任务")
private R<IdVo> stop(@Validated @RequestBody IdParam idParam){
return autoTaskService.stop(idParam);
}

View File

@ -138,7 +138,7 @@ public class CurrTaskController extends BaseController {
@PostMapping(value = "createAutoTask")
@ApiOperation(value = "订单加工-创建多个个分步骤加工任务至任务队列")
public R<String> createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam){
List<TaskCreateParam> detParams = autoCurrTaskParam.getDetParams();
List<TaskCreateParam> detParams = autoCurrTaskParam.getTaskCreateParamList();
//自动任务循环添加多条currTask
AutoExeTask autoExeTask=new AutoExeTask();
for (TaskCreateParam param:detParams

View File

@ -5,16 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.gson.JsonObject;
import com.mt.wms.core.base.BaseController;
import com.mt.wms.core.constants.CommonConstant;
import com.mt.wms.core.dal.entity.ParEleValue;
import com.mt.wms.core.dal.entity.ParGasValue;
import com.mt.wms.core.dal.entity.ParRotSpeedValue;
import com.mt.wms.core.dal.entity.ParTemValue;
import com.mt.wms.core.dal.service.ParEleValueServiceBiz;
import com.mt.wms.core.dal.service.ParGasValueServiceBiz;
import com.mt.wms.core.dal.service.ParRotSpeedValueServiceBiz;
import com.mt.wms.core.dal.service.ParTemValueServiceBiz;
import com.mt.wms.core.dal.entity.*;
import com.mt.wms.core.dal.service.*;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.ElectricQueryParam;
import com.mt.wms.empty.vo.ConsumeDataVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -27,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.validation.groups.Default;
import java.time.DayOfWeek;
import java.time.LocalDate;
@ -34,9 +30,7 @@ import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @Author: liguanghao
@ -81,6 +75,8 @@ public class EnergyController extends BaseController {
private ParRotSpeedValueServiceBiz parRotSpeedValueServiceBiz;
@Autowired
private ParTemValueServiceBiz parTemValueServiceBiz;
@Autowired
private KilnInfoServiceBiz kilnInfoServiceBiz;
@PostMapping(value = "eletric")
@ApiOperation(value = "根据窑炉id获取消耗情况")
@ -217,28 +213,246 @@ public class EnergyController extends BaseController {
@PostMapping(value = "energyList")
@ApiOperation(value = "根据加工炉id获取能源消耗情况")
public R<String> energyList(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam){
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(electricQueryParam.getKilnId());
Integer kilnType = kilnInfo.getType();
//传入任务号窑炉号查询消耗数据返回json字符串
JSONObject jsonObject=new JSONObject();
ConsumeDataVo consumeDataVo=ConsumeDataVo.builder().build();
//电能消耗
List<ParEleValue> parEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
.eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId())
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
if (parEleValueList.size()>0){
List eleList=new ArrayList();
//电能消耗
List<ConsumeDataVo> eleConsume=new ArrayList<>();
//A向电压
List<ConsumeDataVo> aVolConsume=new ArrayList<>();
//B向电压
List<ConsumeDataVo> bVolConsume=new ArrayList<>();
//C向电压
List<ConsumeDataVo> 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);
}
eleList.add(eleConsume);
eleList.add(aVolConsume);
eleList.add(bVolConsume);
eleList.add(cVolConsume);
jsonObject.put("ele",eleList);
}
//氮气甲醇丙烷氨气消耗量
List<ParGasValue> parGasValueList = parGasValueServiceBiz.list(new QueryWrapper<ParGasValue>()
.eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId())
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
if (parGasValueList.size()>0){
if (kilnType==1){
List gasList=new ArrayList();
//氮气
List<ConsumeDataVo> nitConsume=new ArrayList<>();
//甲醇
List<ConsumeDataVo> metConsume=new ArrayList<>();
//丙烷
List<ConsumeDataVo> propaneConsume=new ArrayList<>();
//氨气
List<ConsumeDataVo> ammoniaConsume=new ArrayList<>();
for (ParGasValue parGasValue:parGasValueList
) {
consumeDataVo.setCreateTime(parGasValue.getCreateTime());
consumeDataVo.setValue(parGasValue.getNitFlowValue());
consumeDataVo.setName("氮气");
consumeDataVo.setUnit("");
nitConsume.add(consumeDataVo);
consumeDataVo.setValue(parGasValue.getMethanolFlow());
consumeDataVo.setName("甲醇");
consumeDataVo.setUnit("");
metConsume.add(consumeDataVo);
consumeDataVo.setValue(parGasValue.getPropaneFlow());
consumeDataVo.setName("丙烷");
consumeDataVo.setUnit("");
propaneConsume.add(consumeDataVo);
consumeDataVo.setValue(parGasValue.getAmmoniaFlowValue());
consumeDataVo.setName("氨气");
consumeDataVo.setUnit("");
ammoniaConsume.add(consumeDataVo);
}
gasList.add(nitConsume);
gasList.add(metConsume);
gasList.add(propaneConsume);
gasList.add(ammoniaConsume);
jsonObject.put("gas",gasList);
}
if (kilnType==3){
List gasList=new ArrayList();
//氮气
List<ConsumeDataVo> nitConsume=new ArrayList<>();
//二氧化碳
List<ConsumeDataVo> carbonConsume=new ArrayList<>();
//氨气
List<ConsumeDataVo> ammoniaConsume=new ArrayList<>();
for (ParGasValue parGasValue:parGasValueList
) {
consumeDataVo.setCreateTime(parGasValue.getCreateTime());
consumeDataVo.setValue(parGasValue.getNitFlowValue());
consumeDataVo.setName("氮气");
consumeDataVo.setUnit("");
nitConsume.add(consumeDataVo);
consumeDataVo.setValue(parGasValue.getCarDioxideFlowValue());
consumeDataVo.setName("二氧化碳");
consumeDataVo.setUnit("");
carbonConsume.add(consumeDataVo);
consumeDataVo.setValue(parGasValue.getAmmoniaFlowValue());
consumeDataVo.setName("氨气");
consumeDataVo.setUnit("");
ammoniaConsume.add(consumeDataVo);
}
gasList.add(nitConsume);
gasList.add(carbonConsume);
gasList.add(ammoniaConsume);
jsonObject.put("gas",gasList);
}
}
//油搅拌转速趋势
List<ParRotSpeedValue> parRotSpeedValueList = parRotSpeedValueServiceBiz.list(new QueryWrapper<ParRotSpeedValue>()
.eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId())
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
if (parRotSpeedValueList.size()>0){
if (kilnType==1){
List rotList=new ArrayList();
List<ConsumeDataVo> rot1Consume=new ArrayList<>();
List<ConsumeDataVo> 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);
}
rotList.add(rot1Consume);
rotList.add(rot2Consume);
jsonObject.put("rot",rotList);
}
}
//温度趋势实际温度设定温度
List<ParTemValue> parTemValueList = parTemValueServiceBiz.list(new QueryWrapper<ParTemValue>()
.eq(ParEleValue.KILN_ID, electricQueryParam.getKilnId())
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
JSONObject jsonObject=new JSONObject();
jsonObject.put("ele",parEleValueList);
jsonObject.put("gas",parGasValueList);
jsonObject.put("rot",parRotSpeedValueList);
jsonObject.put("tem",parTemValueList);
if (parTemValueList.size()>0){
if (kilnType==1){
List tempList=new ArrayList();
List<ConsumeDataVo> actualTempConsume=new ArrayList<>();
List<ConsumeDataVo> setupTempConsume=new ArrayList<>();
List<ConsumeDataVo> actualOilTempConsume=new ArrayList<>();
List<ConsumeDataVo> 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);
}
tempList.add(actualTempConsume);
tempList.add(setupTempConsume);
tempList.add(actualOilTempConsume);
tempList.add(setupOilTempConsume);
jsonObject.put("temp",tempList);
}
if (kilnType==2){
List tempList=new ArrayList();
List<ConsumeDataVo> actualTempConsume=new ArrayList<>();
List<ConsumeDataVo> 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);
}
tempList.add(actualTempConsume);
tempList.add(setupTempConsume);
jsonObject.put("temp",tempList);
}
if (kilnType==3){
List tempList=new ArrayList();
List<ConsumeDataVo> actualTempConsume=new ArrayList<>();
List<ConsumeDataVo> setupTempConsume=new ArrayList<>();
List<ConsumeDataVo> outerZone1TempConsume=new ArrayList<>();
List<ConsumeDataVo> 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);
}
tempList.add(actualTempConsume);
tempList.add(setupTempConsume);
tempList.add(outerZone1TempConsume);
tempList.add(outerZone2TempConsume);
jsonObject.put("temp",tempList);
}
}
return R.ok(jsonObject.toJSONString());
}

View File

@ -20,5 +20,5 @@ import java.util.List;
@ApiModel(value = "自动currTask参数", description = "自动currTask参数")
public class AutoCurrTaskParam extends BaseParam {
@ApiModelProperty(value = "详细信息", required = true)
private List<TaskCreateParam> detParams;
private List<TaskCreateParam> taskCreateParamList;
}

View File

@ -29,9 +29,9 @@ public class ElectricQueryParam extends BaseParam {
private Long taskId;
@ApiModelProperty(value = "时间节点", required = true)
@ApiModelProperty(value = "时间节点", required = false)
private LocalDateTime time;
@ApiModelProperty(value = "时间类型:1 天2 周3 月4 年", required = true)
@ApiModelProperty(value = "时间类型:1 天2 周3 月4 年", required = false)
private Integer dateType;
}

View File

@ -39,6 +39,11 @@ public class AlarmInfoVo extends BaseVo implements PageVo.ConvertVo{
*/
@ApiModelProperty(value = "设备名称",example = "0")
private String equipmentName;
/**
* currtask任务code
*/
@ApiModelProperty(value = "currtask任务code",example = "0")
private String taskCode;
/**
* 报警类型
*/

View File

@ -0,0 +1,46 @@
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: liguanghao
* @Date: 2022/3/4 10:47
* @Version 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder
@ApiModel(value = "消耗数据视图对象", description = "用于查询消耗数据")
public class ConsumeDataVo extends BaseVo implements PageVo.ConvertVo{
/**
* 时间
*/
@ApiModelProperty(value = "时间", example = "0")
private LocalDateTime createTime;
/**
* 消耗值
*/
@ApiModelProperty(value = "消耗值",example = "0.0")
private Float value;
/**
* 单位
*/
@ApiModelProperty(value = "单位",example = "0.0")
private String unit;
/**
* 名称
*/
@ApiModelProperty(value = "名称",example = "0.0")
private String name;
}