Compare commits
3 Commits
395817f10e
...
ac476e936e
Author | SHA1 | Date | |
---|---|---|---|
ac476e936e | |||
6259a0237e | |||
b0540ce4dc |
@ -678,6 +678,7 @@ public class EnergyController extends BaseController {
|
||||
carbonSetVo.setValue(parGasValue.getSetNitPotValue());
|
||||
carbonSet.add(carbonSetVo);
|
||||
EnergyVo carbonActVo = EnergyVo.builder().build();
|
||||
carbonActVo.setTime(parGasValue.getCreateTime());
|
||||
carbonActVo.setValue(parGasValue.getActualNitPotValue());
|
||||
carbonActVo.setUnit("%");
|
||||
carbonActVo.setName("碳/氮势");
|
||||
|
@ -0,0 +1,657 @@
|
||||
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.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.params.IdParam;
|
||||
import com.mt.wms.core.utils.BeanUtils;
|
||||
import com.mt.wms.core.utils.HttpClient;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.params.ElectricQueryParam;
|
||||
import com.mt.wms.empty.service.EleService;
|
||||
import com.mt.wms.empty.task.ScheduledTask;
|
||||
import com.mt.wms.empty.vo.ApmsCheckResultVo;
|
||||
import com.mt.wms.empty.vo.CurrTaskDetVo;
|
||||
import com.mt.wms.empty.vo.EnergyVo;
|
||||
import com.mt.wms.empty.vo.NowCurrTaskDetVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.groups.Default;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: LGH
|
||||
* @Date: 2022/12/27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(CommonConstant.API_MODULE_BASE + "screenInfo")
|
||||
@Slf4j
|
||||
@Api(value = "大屏信息相关接口", tags = "大屏信息相关接口", hidden = false)
|
||||
public class ScreenController extends BaseController {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(ScreenController.class);
|
||||
@Autowired
|
||||
private PlcNameSpaceServiceBiz plcNameSpaceServiceBiz;
|
||||
@Autowired
|
||||
private CurrTaskDetServiceBiz currTaskDetServiceBiz;
|
||||
@Autowired
|
||||
private OrderInfoServiceBiz orderInfoServiceBiz;
|
||||
@Autowired
|
||||
private CurrTaskServiceBiz currTaskServiceBiz;
|
||||
@Autowired
|
||||
private KilnInfoServiceBiz kilnInfoServiceBiz;
|
||||
@Autowired
|
||||
private ParEleValueServiceBiz parEleValueServiceBiz;
|
||||
@Autowired
|
||||
private ParGasValueServiceBiz parGasValueServiceBiz;
|
||||
@Autowired
|
||||
private ParRotSpeedValueServiceBiz parRotSpeedValueServiceBiz;
|
||||
@Autowired
|
||||
private ParTemValueServiceBiz parTemValueServiceBiz;
|
||||
@Autowired
|
||||
private EleService eleService;
|
||||
|
||||
@PostMapping(value = "getKilnList")
|
||||
@ApiOperation(value = "获取加工炉信息")
|
||||
public R<List<KilnInfo>> getKilnList() {
|
||||
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list();
|
||||
for (KilnInfo kilnInfo : kilnInfoList
|
||||
) {
|
||||
Boolean kilnWorking = kilnWorking(kilnInfo.getId());
|
||||
if (kilnWorking) {
|
||||
kilnInfo.setStatus(2);
|
||||
}
|
||||
Boolean kilnOnline = kilnOnline(kilnInfo.getId());
|
||||
if (!kilnOnline) {
|
||||
//不在线视为损坏
|
||||
kilnInfo.setStatus(1);
|
||||
}
|
||||
}
|
||||
return successful(kilnInfoList);
|
||||
}
|
||||
|
||||
public R countEleByKiln(@Validated @RequestBody IdParam idParam) {
|
||||
return eleService.list(idParam.getId());
|
||||
}
|
||||
|
||||
@PostMapping(value = "CurrTaskInfo")
|
||||
@ApiOperation(value = "获取当前加工任务基础信息")
|
||||
public R<List<NowCurrTaskDetVo>> CurrTaskInfo() {
|
||||
//查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间,剩余时间,查询标识卡详情
|
||||
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>()
|
||||
.eq(CurrTask.IS_IN, 1)
|
||||
.eq(CurrTask.STATUS, 1));
|
||||
if (currTaskList.size() == 0) {
|
||||
return failed("");
|
||||
}
|
||||
List<NowCurrTaskDetVo> nowCurrTaskDetVoList = BeanUtils.copyList(currTaskList, NowCurrTaskDetVo.class);
|
||||
for (NowCurrTaskDetVo nowCurrTask : nowCurrTaskDetVoList
|
||||
) {
|
||||
Long kilnId = nowCurrTask.getKilnId();
|
||||
Boolean kilnWorking = kilnWorking(kilnId);
|
||||
//查询对应炉号是否Working
|
||||
if (kilnWorking) {
|
||||
String nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
|
||||
.eq(PlcNameSpace.EQ_TYPE, 0)
|
||||
.eq(PlcNameSpace.TYPE, 0)
|
||||
.eq(PlcNameSpace.EQ_ID, kilnId)).getName();
|
||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
|
||||
nowCurrTask.setTaskCode(nowCurrTask.getSheetNo());
|
||||
nowCurrTask.setKilnCode(kilnInfo.getCode());
|
||||
nowCurrTask.setTaskId(nowCurrTask.getId());
|
||||
//设定时间
|
||||
Integer setupTime = 1;
|
||||
//剩余时间
|
||||
Integer remainingTime = 0;
|
||||
if (kilnInfo.getType() != 4) {
|
||||
if (kilnInfo.getType() == 3) {
|
||||
remainingTime = readPlc(nameSpace, "ProgramTimeRemaining").intValue();
|
||||
} else {
|
||||
remainingTime = readPlc(nameSpace, "ProgramTimeRemain").intValue();
|
||||
}
|
||||
|
||||
}
|
||||
if (kilnInfo.getType() == 1 || kilnInfo.getType() == 3) {
|
||||
//运行时间
|
||||
Integer runTime = readPlc(nameSpace, "ProgramRunTime").intValue();
|
||||
setupTime = runTime + remainingTime;
|
||||
}
|
||||
if (kilnInfo.getType() == 2) {
|
||||
setupTime = readPlc(nameSpace, "SetTime").intValue();
|
||||
}
|
||||
nowCurrTask.setSetupTime(setupTime);
|
||||
nowCurrTask.setRemainingTime(remainingTime);
|
||||
int completeness = (int) (((float) remainingTime / (float) setupTime) * 100);
|
||||
nowCurrTask.setCompleteness(completeness);
|
||||
nowCurrTask.setKilnCode(kilnInfo.getCode());
|
||||
//标识卡详情
|
||||
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>()
|
||||
.eq(CurrTaskDet.CURR_TASK_ID, nowCurrTask.getId()));
|
||||
List<CurrTaskDetVo> currTaskDetVoList = BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class);
|
||||
for (CurrTaskDetVo currTaskDetVo : currTaskDetVoList
|
||||
) {
|
||||
String customerName = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, currTaskDetVo.getIdenCardNum())).getCustomerName();
|
||||
currTaskDetVo.setCustomer(customerName);
|
||||
}
|
||||
nowCurrTask.setCurrTaskDetVoList(currTaskDetVoList);
|
||||
}
|
||||
}
|
||||
return successful(nowCurrTaskDetVoList);
|
||||
}
|
||||
|
||||
@PostMapping(value = "energyInfo")
|
||||
@ApiOperation(value = "获取当前加工任务能源消耗信息")
|
||||
public R<JSONObject> list(@Validated @RequestBody IdParam idParam) {
|
||||
Long taskId = idParam.getId();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
//电度值
|
||||
List<List<EnergyVo>> eleConsumeList = new ArrayList<>();
|
||||
//A向电压
|
||||
List<List<EnergyVo>> aVolConsumeList = new ArrayList<>();
|
||||
//B向电压
|
||||
List<List<EnergyVo>> bVolConsumeList = new ArrayList<>();
|
||||
//C向电压
|
||||
List<List<EnergyVo>> cVolConsumeList = new ArrayList<>();
|
||||
//A向电流
|
||||
List<List<EnergyVo>> aCurrentList = new ArrayList<>();
|
||||
//B向电流
|
||||
List<List<EnergyVo>> bCurrentList = new ArrayList<>();
|
||||
//C向电流
|
||||
List<List<EnergyVo>> cCurrentList = new ArrayList<>();
|
||||
//氮气
|
||||
List<List<EnergyVo>> nitConsumeList = new ArrayList<>();
|
||||
//甲醇
|
||||
List<List<EnergyVo>> metConsumeList = new ArrayList<>();
|
||||
//丙烷
|
||||
List<List<EnergyVo>> propaneConsumeList = new ArrayList<>();
|
||||
//氨气
|
||||
List<List<EnergyVo>> ammoniaConsumeList = new ArrayList<>();
|
||||
//二氧化碳
|
||||
List<List<EnergyVo>> carbonConsumeList = new ArrayList<>();
|
||||
//1号油搅拌转速
|
||||
List<List<EnergyVo>> rot1ConsumeList = new ArrayList<>();
|
||||
//2号油搅拌转速
|
||||
List<List<EnergyVo>> rot2ConsumeList = new ArrayList<>();
|
||||
//温度
|
||||
List<List<EnergyVo>> tempConsumeList = new ArrayList<>();
|
||||
//油槽温度
|
||||
List<List<EnergyVo>> oilTempConsumeList = new ArrayList<>();
|
||||
//外一区温度
|
||||
List<List<EnergyVo>> outerZone1TempConsumeList = new ArrayList<>();
|
||||
//外二区温度
|
||||
List<List<EnergyVo>> outerZone2TempConsumeList = new ArrayList<>();
|
||||
//碳/氮势
|
||||
List<List<EnergyVo>> carbonList = new ArrayList<>();
|
||||
List<List<ApmsCheckResultVo>> checkResultList = new ArrayList<>();
|
||||
CurrTask currTask = currTaskServiceBiz.getById(taskId);
|
||||
//防止早期没有炉号的报错
|
||||
if (currTask.getStoveCode() == null) {
|
||||
currTask.setStoveCode(currTask.getSheetNo());
|
||||
}
|
||||
|
||||
Long kilnId = currTask.getKilnId();
|
||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
|
||||
Integer kilnType = kilnInfo.getType();
|
||||
//电能消耗
|
||||
List<ParEleValue> parEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
|
||||
.eq(ParEleValue.KILN_ID, kilnId)
|
||||
.eq(ParEleValue.TASK_ID, taskId));
|
||||
if (parEleValueList.size() > 0) {
|
||||
List<Object> eleList = new ArrayList<>();
|
||||
//电能消耗
|
||||
List<EnergyVo> eleConsume = new ArrayList<>();
|
||||
//A向电压
|
||||
List<EnergyVo> aVolConsume = new ArrayList<>();
|
||||
//B向电压
|
||||
List<EnergyVo> bVolConsume = new ArrayList<>();
|
||||
//C向电压
|
||||
List<EnergyVo> cVolConsume = new ArrayList<>();
|
||||
//A向电流
|
||||
List<EnergyVo> aCurrentConsume = new ArrayList<>();
|
||||
//B向电流
|
||||
List<EnergyVo> bCurrentConsume = new ArrayList<>();
|
||||
//C向电流
|
||||
List<EnergyVo> 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<ParGasValue> parGasValueList = parGasValueServiceBiz.list(new QueryWrapper<ParGasValue>()
|
||||
.eq(ParEleValue.KILN_ID, kilnId)
|
||||
.eq(ParEleValue.TASK_ID, taskId));
|
||||
if (parGasValueList.size() > 0) {
|
||||
if (kilnType == 1) {
|
||||
//碳/氮势
|
||||
List<EnergyVo> carbon = new ArrayList<>();
|
||||
//碳/氮势-设定
|
||||
List<EnergyVo> carbonSet = new ArrayList<>();
|
||||
//氮气
|
||||
List<EnergyVo> nitConsume = new ArrayList<>();
|
||||
//甲醇
|
||||
List<EnergyVo> metConsume = new ArrayList<>();
|
||||
//丙烷
|
||||
List<EnergyVo> propaneConsume = new ArrayList<>();
|
||||
//氨气
|
||||
List<EnergyVo> 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<EnergyVo> carbon = new ArrayList<>();
|
||||
//碳/氮势-设定
|
||||
List<EnergyVo> carbonSet = new ArrayList<>();
|
||||
//氮气
|
||||
List<EnergyVo> nitConsume = new ArrayList<>();
|
||||
//二氧化碳
|
||||
List<EnergyVo> carbonConsume = new ArrayList<>();
|
||||
//氨气
|
||||
List<EnergyVo> 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.setTime(parGasValue.getCreateTime());
|
||||
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);
|
||||
}
|
||||
}
|
||||
//油搅拌转速趋势
|
||||
List<ParRotSpeedValue> parRotSpeedValueList = parRotSpeedValueServiceBiz.list(new QueryWrapper<ParRotSpeedValue>()
|
||||
.eq(ParEleValue.KILN_ID, kilnId)
|
||||
.eq(ParEleValue.TASK_ID, taskId));
|
||||
if (parRotSpeedValueList.size() > 0) {
|
||||
if (kilnType == 1) {
|
||||
List<EnergyVo> rot1Consume = 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);
|
||||
}
|
||||
rot1ConsumeList.add(rot1Consume);
|
||||
}
|
||||
}
|
||||
//温度趋势(实际温度、设定温度)油槽温度外区温度
|
||||
List<ParTemValue> parTemValueList = parTemValueServiceBiz.list(new QueryWrapper<ParTemValue>()
|
||||
.eq(ParEleValue.KILN_ID, kilnId)
|
||||
.eq(ParEleValue.TASK_ID, taskId));
|
||||
if (parTemValueList.size() > 0) {
|
||||
if (kilnType == 1) {
|
||||
List<EnergyVo> actualTempConsume = new ArrayList<>();
|
||||
List<EnergyVo> setupTempConsume = new ArrayList<>();
|
||||
List<EnergyVo> actualOilTempConsume = new ArrayList<>();
|
||||
List<EnergyVo> 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<EnergyVo> actualTempConsume = new ArrayList<>();
|
||||
List<EnergyVo> 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<EnergyVo> actualTempConsume = new ArrayList<>();
|
||||
List<EnergyVo> setupTempConsume = new ArrayList<>();
|
||||
List<EnergyVo> outerZone1TempConsume = new ArrayList<>();
|
||||
List<EnergyVo> 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);
|
||||
|
||||
}
|
||||
tempConsumeList.add(actualTempConsume);
|
||||
tempConsumeList.add(setupTempConsume);
|
||||
}
|
||||
}
|
||||
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("temp", tempConsumeList);
|
||||
map.put("oilTemp", oilTempConsumeList);
|
||||
return successful(JSONObject.parseObject(JSON.toJSONString(map)));
|
||||
}
|
||||
|
||||
private Boolean kilnWorking(Long kilnId) {
|
||||
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
|
||||
.eq(PlcNameSpace.EQ_TYPE, 0)
|
||||
.eq(PlcNameSpace.EQ_ID, kilnId)
|
||||
.eq(PlcNameSpace.TYPE, 0));
|
||||
String nameSpaceNote = nameSpace.getName();
|
||||
String result = readPlcToString(nameSpaceNote, "Working");
|
||||
return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
}
|
||||
|
||||
private Boolean kilnOnline(Long kilnId) {
|
||||
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
|
||||
.eq(PlcNameSpace.EQ_TYPE, 0)
|
||||
.eq(PlcNameSpace.EQ_ID, kilnId)
|
||||
.eq(PlcNameSpace.TYPE, 0));
|
||||
String nameSpaceNote = nameSpace.getName();
|
||||
String result = readPlcToString(nameSpaceNote, "ManualAutomatic");
|
||||
return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取变量值
|
||||
*
|
||||
* @param nameSpace nameSpace前缀
|
||||
* @param variableName 变量名称
|
||||
* @return 变量值
|
||||
*/
|
||||
private Double readPlc(String nameSpace, String variableName) {
|
||||
String identifier = nameSpace.concat(variableName);
|
||||
Map<String, Object> json = new HashMap();
|
||||
json.put("nameSpace", 6);
|
||||
json.put("plcName", "plc1");
|
||||
json.put("identifier", identifier);
|
||||
String result = null;
|
||||
try {
|
||||
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("能源消耗统计:获取 " + identifier + " 的值失败");
|
||||
}
|
||||
return Double.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取变量值
|
||||
*
|
||||
* @param nameSpace nameSpace前缀
|
||||
* @param variableName 变量名称
|
||||
* @return result字符串
|
||||
*/
|
||||
private String readPlcToString(String nameSpace, String variableName) {
|
||||
String identifier = nameSpace.concat(variableName);
|
||||
Map<String, Object> json = new HashMap();
|
||||
json.put("nameSpace", 6);
|
||||
json.put("plcName", "plc1");
|
||||
json.put("identifier", identifier);
|
||||
String result = null;
|
||||
try {
|
||||
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("readPLC: " + identifier + " 的值失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Float floatSubtract(Float a, Float b) {
|
||||
BigDecimal a1 = new BigDecimal(Float.toString(a));
|
||||
BigDecimal b1 = new BigDecimal(Float.toString(b));
|
||||
return a1.subtract(b1).floatValue();
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.mt.wms.empty.mapper;
|
||||
|
||||
import com.mt.wms.empty.vo.CountEleVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: LGH
|
||||
* @Date: 2022/12/27
|
||||
*/
|
||||
public interface EleMapper {
|
||||
/**
|
||||
* 获取最近十条电能统计值
|
||||
*/
|
||||
List<CountEleVo> list(@Param("kilnId") Long kilnId);
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.mt.wms.empty.service;
|
||||
|
||||
import com.mt.wms.core.vo.R;
|
||||
|
||||
/**
|
||||
* @Author: LGH
|
||||
* @Date: 2022/12/27
|
||||
*/
|
||||
public interface EleService {
|
||||
R list(Long kilnId);
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.mt.wms.empty.service.impl;
|
||||
|
||||
import com.mt.wms.core.base.BaseService;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.mapper.EleMapper;
|
||||
import com.mt.wms.empty.service.EleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author: LGH
|
||||
* @Date: 2022/12/27
|
||||
*/
|
||||
@Service
|
||||
public class EleServiceImpl extends BaseService implements EleService {
|
||||
|
||||
@Resource
|
||||
EleMapper eleMapper;
|
||||
|
||||
@Override
|
||||
public R list(Long kilnId) {
|
||||
return successful(eleMapper.list(kilnId));
|
||||
}
|
||||
}
|
@ -164,6 +164,7 @@ public class ScheduledTask extends BaseService {
|
||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
|
||||
nowCurrTask.setTaskCode(nowCurrTask.getSheetNo());
|
||||
nowCurrTask.setKilnCode(kilnInfo.getCode());
|
||||
nowCurrTask.setTaskId(nowCurrTask.getId());
|
||||
//设定时间
|
||||
Integer setupTime = 1;
|
||||
//剩余时间
|
||||
|
@ -0,0 +1,38 @@
|
||||
package com.mt.wms.empty.vo;
|
||||
|
||||
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/12/27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@Builder
|
||||
@ApiModel(value = "消耗数据视图对象", description = "用于查询消耗数据")
|
||||
public class CountEleVo {
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
@ApiModelProperty(value = "时间", example = "0")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 消耗值
|
||||
*/
|
||||
@ApiModelProperty(value = "消耗值", example = "0.0")
|
||||
private Float value;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ApiModelProperty(value = "任务id", example = "0.0")
|
||||
private Long taskId;
|
||||
}
|
@ -20,59 +20,69 @@ import java.util.List;
|
||||
@Accessors(chain = true)
|
||||
@Builder
|
||||
@ApiModel(value = "当前正在加工炉任务详情视图对象", description = "用于查询当前正在加工炉任务详情")
|
||||
public class NowCurrTaskDetVo extends BaseVo implements PageVo.ConvertVo{
|
||||
public class NowCurrTaskDetVo extends BaseVo implements PageVo.ConvertVo {
|
||||
/**
|
||||
* 主键,自增
|
||||
*/
|
||||
@ApiModelProperty(value = "主键", example = "1")
|
||||
private Long id;
|
||||
/**
|
||||
* currtask任务id
|
||||
*/
|
||||
@ApiModelProperty(value = "currtask任务id", example = "0")
|
||||
private Long taskId;
|
||||
/**
|
||||
* currtask任务code
|
||||
*/
|
||||
@ApiModelProperty(value = "currtask任务code",example = "0")
|
||||
@ApiModelProperty(value = "currtask任务code", example = "0")
|
||||
private String taskCode;
|
||||
/**
|
||||
* 炉号
|
||||
*/
|
||||
@ApiModelProperty(value = "炉号", example = "0")
|
||||
private String stoveCode;
|
||||
/**
|
||||
* 生产单号
|
||||
*/
|
||||
@ApiModelProperty(value = "生产单号",example = "0")
|
||||
@ApiModelProperty(value = "生产单号", example = "0")
|
||||
private String sheetNo;
|
||||
|
||||
/**
|
||||
* 炉子id
|
||||
*/
|
||||
@ApiModelProperty(value = "炉子id",example = "0")
|
||||
@ApiModelProperty(value = "炉子id", example = "0")
|
||||
private Long kilnId;
|
||||
/**
|
||||
* 炉子code
|
||||
*/
|
||||
@ApiModelProperty(value = "炉子code",example = "0")
|
||||
@ApiModelProperty(value = "炉子code", example = "0")
|
||||
private String kilnCode;
|
||||
/**
|
||||
* 工艺plc值
|
||||
*/
|
||||
@ApiModelProperty(value = "工艺plc值",example = "0")
|
||||
@ApiModelProperty(value = "工艺plc值", example = "0")
|
||||
private Integer plcValue;
|
||||
|
||||
/**
|
||||
* 工艺设定时间
|
||||
*/
|
||||
@ApiModelProperty(value = "工艺设定时间",example = "0")
|
||||
@ApiModelProperty(value = "工艺设定时间", example = "0")
|
||||
private Integer setupTime;
|
||||
|
||||
/**
|
||||
* 工艺剩余时间
|
||||
*/
|
||||
@ApiModelProperty(value = "工艺剩余时间",example = "0")
|
||||
@ApiModelProperty(value = "工艺剩余时间", example = "0")
|
||||
private Integer remainingTime;
|
||||
/**
|
||||
* 工艺进度
|
||||
*/
|
||||
@ApiModelProperty(value = "工艺进度",example = "0")
|
||||
@ApiModelProperty(value = "工艺进度", example = "0")
|
||||
private Integer completeness;
|
||||
|
||||
/**
|
||||
* 标识卡list
|
||||
*/
|
||||
@ApiModelProperty(value = "标识卡list",example = "0")
|
||||
@ApiModelProperty(value = "标识卡list", example = "0")
|
||||
private List<CurrTaskDetVo> currTaskDetVoList;
|
||||
}
|
||||
|
39
6.program/wms-empty/src/main/resources/mapper/EleMapper.xml
Normal file
39
6.program/wms-empty/src/main/resources/mapper/EleMapper.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2018.
|
||||
~ http://www.ulabcare.com
|
||||
-->
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mt.wms.empty.mapper.EleMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.mt.wms.empty.vo.CountEleVo">
|
||||
<id column="task_id" property="taskId"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="total_bat" property="value"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 根据角色查询菜单,角色已分配的菜单标记为选中状态 -->
|
||||
<select id="list"
|
||||
resultType="com.mt.wms.empty.vo.CountEleVo">
|
||||
SELECT menu.id AS id,
|
||||
menu.parent_id AS parentId,
|
||||
menu.code AS code,
|
||||
menu.name AS name,
|
||||
menu.category AS category,
|
||||
menu.type AS type,
|
||||
menu.order_num AS orderNum,
|
||||
roleMenu.id AS checked
|
||||
FROM t_sys_menu AS menu
|
||||
LEFT JOIN t_sys_role_menu AS roleMenu ON menu.id = roleMenu.menu_id
|
||||
AND roleMenu.role_id = #{roleId}
|
||||
AND roleMenu.valid = 1
|
||||
WHERE menu.valid = 1
|
||||
AND menu.enabled = 1
|
||||
AND menu.category = #{category}
|
||||
ORDER BY menu.order_num
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user