update:
能源消耗比较 生成炉号
This commit is contained in:
parent
9d8b6c065f
commit
d5464eed6c
@ -21,9 +21,9 @@ public class MyGenerator {
|
||||
/**
|
||||
* 数据库地址
|
||||
*/
|
||||
static String dbUrl = "jdbc:mysql://mysql.picaiba.com:30307/mt_wms_qj";
|
||||
static String dbUrl = "jdbc:mysql://localhost:3306/mt_wms_qj";
|
||||
static String userName = "root";
|
||||
static String password = "1qaz@WSX3edc$RFV";
|
||||
static String password = "123456";
|
||||
/**
|
||||
* 是否去掉生成实体的属性名前缀
|
||||
*/
|
||||
@ -106,7 +106,7 @@ public class MyGenerator {
|
||||
|
||||
@Test
|
||||
public void generateCodeWithInjectConfigForAllTable() {
|
||||
generateByTablesWithInjectConfig(new String[]{"t_auto_exe_task"});
|
||||
generateByTablesWithInjectConfig(new String[]{"t_question_answer"});
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -228,6 +228,12 @@ public class CurrTask extends Model<CurrTask> {
|
||||
@TableField("process_type")
|
||||
private Integer processType;
|
||||
|
||||
/**
|
||||
* 炉号
|
||||
*/
|
||||
@TableField("stove_code")
|
||||
private String stoveCode;
|
||||
|
||||
|
||||
public static final String ID = "id";
|
||||
|
||||
@ -297,6 +303,8 @@ public class CurrTask extends Model<CurrTask> {
|
||||
|
||||
public static final String PROCESS_TYPE = "process_type";
|
||||
|
||||
public static final String STOVE_CODE = "stove_code";
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
|
@ -238,6 +238,12 @@ public class TaskHis extends Model<TaskHis> {
|
||||
@TableField("task_id")
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 炉号
|
||||
*/
|
||||
@TableField("stove_code")
|
||||
private String stoveCode;
|
||||
|
||||
public static final String ID = "id";
|
||||
|
||||
public static final String VALID = "valid";
|
||||
@ -308,6 +314,8 @@ public class TaskHis extends Model<TaskHis> {
|
||||
|
||||
public static final String TASK_ID = "task_id";
|
||||
|
||||
public static final String STOVE_CODE = "stove_code";
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
|
@ -50,6 +50,10 @@ public class CodeGeneratorHelper {
|
||||
public static String getStoveCode(String kilnNameAndCraft) {
|
||||
return IDGenerator.gen(kilnNameAndCraft, "yyMMdd", 2, STOVE_CODE);
|
||||
}
|
||||
|
||||
public static String getStoveCode(String kilnName,String craft) {
|
||||
return IDGenerator.gen(kilnName+"-"+craft+"-", "yyMMdd", 4,kilnName);
|
||||
}
|
||||
/**
|
||||
* 生成自动任务编码
|
||||
*
|
||||
|
@ -22,6 +22,7 @@ import com.mt.wms.empty.params.*;
|
||||
import com.mt.wms.empty.service.CurrTaskDetService;
|
||||
import com.mt.wms.empty.service.CurrTaskService;
|
||||
import com.mt.wms.empty.service.OrderInfoService;
|
||||
import com.mt.wms.empty.task.StoveCodeUtils;
|
||||
import com.mt.wms.empty.task.TaskDistanceUtils;
|
||||
import com.mt.wms.empty.vo.*;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -347,4 +348,10 @@ public class CurrTaskController extends BaseController {
|
||||
JSONObject jsonObject = JSON.parseObject(result);
|
||||
return Integer.parseInt(String.valueOf(jsonObject.get("msg")));
|
||||
}
|
||||
|
||||
@PostMapping(value = "testStoveCode")
|
||||
@ApiOperation(value = "测试炉号生成")
|
||||
public String testStoveCode(@RequestBody TestStoveCode testStoveCode){
|
||||
return StoveCodeUtils.getStoveCode(testStoveCode.getKilnName(),testStoveCode.getCraft());
|
||||
}
|
||||
}
|
||||
|
@ -44,30 +44,6 @@ import java.util.*;
|
||||
@Api(value = "电能消耗相关接口", tags = "电能消耗相关接口", hidden = false)
|
||||
public class EnergyController extends BaseController {
|
||||
|
||||
|
||||
//@PostConstruct
|
||||
public void test(){
|
||||
LocalDateTime time=LocalDateTime.of(2021, 3, 31, 0, 0, 0);
|
||||
Float f=29000F;
|
||||
|
||||
LocalDate timeDate=time.toLocalDate();
|
||||
LocalDateTime timeEnd = LocalDateTime.of(timeDate, LocalTime.MAX).minus(5,ChronoUnit.SECONDS);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
|
||||
ParEleValue parEleValue=new ParEleValue();
|
||||
parEleValue.setDateType(2);
|
||||
parEleValue.setParId(1);
|
||||
parEleValue.setKilnId(1L);
|
||||
parEleValue.setTotalBat(Float.valueOf(String.valueOf(f+(Math.random()*24000))));
|
||||
parEleValue.setCreateTime(timeEnd);
|
||||
timeEnd=timeEnd.plus(1,ChronoUnit.MONTHS);
|
||||
f=parEleValue.getTotalBat();
|
||||
parEleValueServiceBiz.save(parEleValue);
|
||||
System.out.println(parEleValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ParEleValueServiceBiz parEleValueServiceBiz;
|
||||
@Autowired
|
||||
@ -89,322 +65,351 @@ public class EnergyController extends BaseController {
|
||||
@PostMapping(value = "energyList")
|
||||
@ApiOperation(value = "根据加工炉id获取能源消耗情况")
|
||||
public R<String> energyList(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam){
|
||||
//TaskHis currTask = taskHisServiceBiz.getById(electricQueryParam.getTaskId());
|
||||
TaskHis currTask = taskHisServiceBiz.getOne(new QueryWrapper<TaskHis>().eq(TaskHis.TASK_ID, electricQueryParam.getTaskId()));
|
||||
Long kilnId = currTask.getKilnId();
|
||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
|
||||
Integer kilnType = kilnInfo.getType();
|
||||
//传入任务号,工业炉号,查询消耗数据,返回json字符串
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
ConsumeDataVo consumeDataVo=ConsumeDataVo.builder().build();
|
||||
List<Long> taskIds = electricQueryParam.getTaskIds();
|
||||
JSONObject json=new JSONObject();
|
||||
for (Long taskId:taskIds
|
||||
) {
|
||||
//TaskHis currTask = taskHisServiceBiz.getById(electricQueryParam.getTaskId());
|
||||
TaskHis currTask = taskHisServiceBiz.getOne(new QueryWrapper<TaskHis>().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();
|
||||
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
//电能消耗
|
||||
List<ParEleValue> parEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
|
||||
.eq(ParEleValue.KILN_ID, kilnId)
|
||||
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
|
||||
if (parEleValueList.size()>0){
|
||||
List<Object> eleList=new ArrayList<>();
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
//电能消耗
|
||||
List<Object> eleConsume=new ArrayList<>();
|
||||
//A向电压
|
||||
List<Object> aVolConsume=new ArrayList<>();
|
||||
//B向电压
|
||||
List<Object> bVolConsume=new ArrayList<>();
|
||||
//C向电压
|
||||
List<Object> cVolConsume=new ArrayList<>();
|
||||
Float talBat=0F;
|
||||
int i=0;
|
||||
for (ParEleValue parEleValue:parEleValueList
|
||||
) {
|
||||
//首位置为0
|
||||
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");
|
||||
eleConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
map.put("time",parEleValue.getCreateTime());
|
||||
map.put("value",parEleValue.getAVoltagevValue());
|
||||
map.put("name","A向电压");
|
||||
map.put("unit","V");
|
||||
aVolConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
map.put("time",parEleValue.getCreateTime());
|
||||
map.put("value",parEleValue.getBVoltagevValue());
|
||||
map.put("name","B向电压");
|
||||
map.put("unit","V");
|
||||
bVolConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
map.put("time",parEleValue.getCreateTime());
|
||||
map.put("value",parEleValue.getCVoltagevValue());
|
||||
map.put("name","C向电压");
|
||||
map.put("unit","V");
|
||||
cVolConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
}
|
||||
eleList.add(eleConsume);
|
||||
eleList.add(aVolConsume);
|
||||
eleList.add(bVolConsume);
|
||||
eleList.add(cVolConsume);
|
||||
jsonObject.put("ele",eleList);
|
||||
}
|
||||
//氮气、甲醇、丙烷、氨气消耗量
|
||||
List<ParGasValue> parGasValueList = parGasValueServiceBiz.list(new QueryWrapper<ParGasValue>()
|
||||
.eq(ParEleValue.KILN_ID, kilnId)
|
||||
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
|
||||
if (parGasValueList.size()>0){
|
||||
if (kilnType==1){
|
||||
List<Object> gasList=new ArrayList<>();
|
||||
//氮气
|
||||
List<Object> nitConsume=new ArrayList<>();
|
||||
Float nit=0F;
|
||||
//甲醇
|
||||
List<Object> metConsume=new ArrayList<>();
|
||||
Float met=0F;
|
||||
//丙烷
|
||||
List<Object> propaneConsume=new ArrayList<>();
|
||||
Float propane=0F;
|
||||
//氨气
|
||||
List<Object> ammoniaConsume=new ArrayList<>();
|
||||
Float ammonia=0F;
|
||||
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<Object> eleConsume=new ArrayList<>();
|
||||
//A向电压
|
||||
List<Object> aVolConsume=new ArrayList<>();
|
||||
//B向电压
|
||||
List<Object> bVolConsume=new ArrayList<>();
|
||||
//C向电压
|
||||
List<Object> cVolConsume=new ArrayList<>();
|
||||
Float talBat=0F;
|
||||
int i=0;
|
||||
for (ParGasValue parGasValue:parGasValueList
|
||||
) {
|
||||
//累计值的量首位置为0
|
||||
for (ParEleValue parEleValue:parEleValueList
|
||||
) {
|
||||
//首位置为0
|
||||
if (i==0){
|
||||
nit=parGasValue.getNitFlowValue();
|
||||
met=parGasValue.getMethanolFlow();
|
||||
propane=parGasValue.getPropaneFlow();
|
||||
ammonia=parGasValue.getAmmoniaFlowValue();
|
||||
talBat=parEleValue.getTotalBat();
|
||||
}
|
||||
|
||||
i++;
|
||||
map.put("time",parGasValue.getCreateTime());
|
||||
map.put("value",floatSubtract(parGasValue.getNitFlowValue(),nit));
|
||||
map.put("name","氮气");
|
||||
map.put("unit","m³");
|
||||
nitConsume.add(JSONObject.toJSON(map));
|
||||
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",parGasValue.getCreateTime());
|
||||
map.put("value",floatSubtract(parGasValue.getMethanolFlow(),met));
|
||||
map.put("name","甲醇");
|
||||
map.put("unit","m³");
|
||||
metConsume.add(JSONObject.toJSON(map));
|
||||
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",parGasValue.getCreateTime());
|
||||
map.put("value",floatSubtract(parGasValue.getPropaneFlow(),propane));
|
||||
map.put("name","丙烷");
|
||||
map.put("unit","m³");
|
||||
propaneConsume.add(JSONObject.toJSON(map));
|
||||
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",parGasValue.getCreateTime());
|
||||
map.put("value",floatSubtract(parGasValue.getAmmoniaFlowValue(),ammonia));
|
||||
map.put("name","氨气");
|
||||
map.put("unit","m³");
|
||||
ammoniaConsume.add(JSONObject.toJSON(map));
|
||||
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();
|
||||
}
|
||||
gasList.add(nitConsume);
|
||||
gasList.add(metConsume);
|
||||
gasList.add(propaneConsume);
|
||||
gasList.add(ammoniaConsume);
|
||||
jsonObject.put("gas",gasList);
|
||||
eleList.add(eleConsume);
|
||||
eleList.add(aVolConsume);
|
||||
eleList.add(bVolConsume);
|
||||
eleList.add(cVolConsume);
|
||||
jsonObject.put("ele",eleList);
|
||||
}
|
||||
if (kilnType==3){
|
||||
List<Object> gasList=new ArrayList<>();
|
||||
//氮气
|
||||
List<Object> nitConsume=new ArrayList<>();
|
||||
Float nit=0F;
|
||||
//二氧化碳
|
||||
List<Object> carbonConsume=new ArrayList<>();
|
||||
Float carbon=0F;
|
||||
//氨气
|
||||
List<Object> 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();
|
||||
//氮气、甲醇、丙烷、氨气消耗量
|
||||
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<Object> gasList=new ArrayList<>();
|
||||
//氮气
|
||||
List<Object> nitConsume=new ArrayList<>();
|
||||
Float nit=0F;
|
||||
//甲醇
|
||||
List<Object> metConsume=new ArrayList<>();
|
||||
Float met=0F;
|
||||
//丙烷
|
||||
List<Object> propaneConsume=new ArrayList<>();
|
||||
Float propane=0F;
|
||||
//氨气
|
||||
List<Object> 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();
|
||||
}
|
||||
i++;
|
||||
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());
|
||||
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());
|
||||
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());
|
||||
ammoniaConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
}
|
||||
i++;
|
||||
map.put("time",parGasValue.getCreateTime());
|
||||
map.put("value",floatSubtract(parGasValue.getNitFlowValue(),nit));
|
||||
map.put("name","氮气");
|
||||
map.put("unit","m³");
|
||||
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³");
|
||||
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³");
|
||||
ammoniaConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
gasList.add(nitConsume);
|
||||
gasList.add(metConsume);
|
||||
gasList.add(propaneConsume);
|
||||
gasList.add(ammoniaConsume);
|
||||
jsonObject.put("gas",gasList);
|
||||
}
|
||||
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, kilnId)
|
||||
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
|
||||
if (parRotSpeedValueList.size()>0){
|
||||
if (kilnType==1){
|
||||
List<Object> rotList=new ArrayList<>();
|
||||
List<Object> rot1Consume=new ArrayList<>();
|
||||
List<Object> 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");
|
||||
rot1Consume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
map.put("time",parRotSpeedValue.getCreateTime());
|
||||
map.put("value",parRotSpeedValue.getOilStiSpeedBValue());
|
||||
map.put("name","2号油搅拌转速");
|
||||
map.put("unit","转/min");
|
||||
rot2Consume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
if (kilnType==3){
|
||||
List<Object> gasList=new ArrayList<>();
|
||||
//氮气
|
||||
List<Object> nitConsume=new ArrayList<>();
|
||||
Float nit=0F;
|
||||
//二氧化碳
|
||||
List<Object> carbonConsume=new ArrayList<>();
|
||||
Float carbon=0F;
|
||||
//氨气
|
||||
List<Object> 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();
|
||||
}
|
||||
i++;
|
||||
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());
|
||||
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());
|
||||
ammoniaConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
}
|
||||
gasList.add(nitConsume);
|
||||
gasList.add(carbonConsume);
|
||||
gasList.add(ammoniaConsume);
|
||||
jsonObject.put("gas",gasList);
|
||||
}
|
||||
rotList.add(rot1Consume);
|
||||
rotList.add(rot2Consume);
|
||||
jsonObject.put("rot",rotList);
|
||||
}
|
||||
}
|
||||
//温度趋势(实际温度、设定温度)
|
||||
List<ParTemValue> parTemValueList = parTemValueServiceBiz.list(new QueryWrapper<ParTemValue>()
|
||||
.eq(ParEleValue.KILN_ID, kilnId)
|
||||
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
|
||||
if (parTemValueList.size()>0){
|
||||
if (kilnType==1){
|
||||
List<Object> tempList=new ArrayList<>();
|
||||
List<Object> actualTempConsume=new ArrayList<>();
|
||||
List<Object> setupTempConsume=new ArrayList<>();
|
||||
List<Object> actualOilTempConsume=new ArrayList<>();
|
||||
List<Object> setupOilTempConsume=new ArrayList<>();
|
||||
for (ParTemValue parTemValue:parTemValueList
|
||||
) {
|
||||
map.put("time",parTemValue.getCreateTime());
|
||||
map.put("value",parTemValue.getActTemValue());
|
||||
map.put("name","实际温度");
|
||||
map.put("unit","℃");
|
||||
actualTempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
map.put("time",parTemValue.getCreateTime());
|
||||
map.put("value",parTemValue.getSetTemValue());
|
||||
map.put("name","设定温度");
|
||||
map.put("unit","℃");
|
||||
setupTempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
map.put("time",parTemValue.getCreateTime());
|
||||
map.put("value",parTemValue.getOilTankActTemValue());
|
||||
map.put("name","油槽实际温度");
|
||||
map.put("unit","℃");
|
||||
actualOilTempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
map.put("time",parTemValue.getCreateTime());
|
||||
map.put("value",parTemValue.getOilTankSetTemValue());
|
||||
map.put("name","油槽设定温度");
|
||||
map.put("unit","℃");
|
||||
setupOilTempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
//油搅拌转速趋势
|
||||
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<Object> rotList=new ArrayList<>();
|
||||
List<Object> rot1Consume=new ArrayList<>();
|
||||
List<Object> 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());
|
||||
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());
|
||||
rot2Consume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
}
|
||||
rotList.add(rot1Consume);
|
||||
rotList.add(rot2Consume);
|
||||
jsonObject.put("rot",rotList);
|
||||
}
|
||||
tempList.add(actualTempConsume);
|
||||
tempList.add(setupTempConsume);
|
||||
tempList.add(actualOilTempConsume);
|
||||
tempList.add(setupOilTempConsume);
|
||||
jsonObject.put("temp",tempList);
|
||||
}
|
||||
if (kilnType==2){
|
||||
List<Object> tempList=new ArrayList<>();
|
||||
List<Object> actualTempConsume=new ArrayList<>();
|
||||
List<Object> setupTempConsume=new ArrayList<>();
|
||||
for (ParTemValue parTemValue:parTemValueList
|
||||
) {
|
||||
map.put("time",parTemValue.getCreateTime());
|
||||
map.put("value",parTemValue.getActTemValue());
|
||||
map.put("name","实际温度");
|
||||
map.put("unit","℃");
|
||||
actualTempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
map.put("time",parTemValue.getCreateTime());
|
||||
map.put("value",parTemValue.getSetTemValue());
|
||||
map.put("name","设定温度");
|
||||
map.put("unit","℃");
|
||||
setupTempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
//温度趋势(实际温度、设定温度)
|
||||
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<Object> tempList=new ArrayList<>();
|
||||
List<Object> actualTempConsume=new ArrayList<>();
|
||||
List<Object> setupTempConsume=new ArrayList<>();
|
||||
List<Object> actualOilTempConsume=new ArrayList<>();
|
||||
List<Object> 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());
|
||||
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());
|
||||
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());
|
||||
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());
|
||||
setupOilTempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
}
|
||||
tempList.add(actualTempConsume);
|
||||
tempList.add(setupTempConsume);
|
||||
tempList.add(actualOilTempConsume);
|
||||
tempList.add(setupOilTempConsume);
|
||||
jsonObject.put("temp",tempList);
|
||||
}
|
||||
tempList.add(actualTempConsume);
|
||||
tempList.add(setupTempConsume);
|
||||
jsonObject.put("temp",tempList);
|
||||
}
|
||||
if (kilnType==3){
|
||||
if (kilnType==2){
|
||||
List<Object> tempList=new ArrayList<>();
|
||||
List<Object> actualTempConsume=new ArrayList<>();
|
||||
List<Object> 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());
|
||||
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());
|
||||
setupTempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
}
|
||||
tempList.add(actualTempConsume);
|
||||
tempList.add(setupTempConsume);
|
||||
jsonObject.put("temp",tempList);
|
||||
}
|
||||
if (kilnType==3){
|
||||
|
||||
List<Object> tempList=new ArrayList<>();
|
||||
List<Object> actualTempConsume=new ArrayList<>();
|
||||
List<Object> setupTempConsume=new ArrayList<>();
|
||||
List<Object> outerZone1TempConsume=new ArrayList<>();
|
||||
List<Object> outerZone2TempConsume=new ArrayList<>();
|
||||
for (ParTemValue parTemValue:parTemValueList
|
||||
) {
|
||||
map.put("time",parTemValue.getCreateTime());
|
||||
map.put("value",parTemValue.getActTemValue());
|
||||
map.put("name","实际温度");
|
||||
map.put("unit","℃");
|
||||
actualTempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
map.put("time",parTemValue.getCreateTime());
|
||||
map.put("value",parTemValue.getSetTemValue());
|
||||
map.put("name","设定温度");
|
||||
map.put("unit","℃");
|
||||
setupTempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
map.put("time",parTemValue.getCreateTime());
|
||||
map.put("value",parTemValue.getOuterZone1Temp());
|
||||
map.put("name","外一区温度");
|
||||
map.put("unit","℃");
|
||||
outerZone1TempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
map.put("time",parTemValue.getCreateTime());
|
||||
List<Object> tempList=new ArrayList<>();
|
||||
List<Object> actualTempConsume=new ArrayList<>();
|
||||
List<Object> setupTempConsume=new ArrayList<>();
|
||||
List<Object> outerZone1TempConsume=new ArrayList<>();
|
||||
List<Object> 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());
|
||||
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());
|
||||
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());
|
||||
outerZone1TempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
map.put("time",parTemValue.getCreateTime());
|
||||
|
||||
map.put("value",parTemValue.getOuterZone2Temp());
|
||||
map.put("name","外二区温度");
|
||||
map.put("unit","℃");
|
||||
outerZone2TempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
map.put("value",parTemValue.getOuterZone2Temp());
|
||||
map.put("name","外二区温度");
|
||||
map.put("unit","℃");
|
||||
map.put("炉号",currTask.getSheetNo());
|
||||
outerZone2TempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
}
|
||||
tempList.add(actualTempConsume);
|
||||
tempList.add(setupTempConsume);
|
||||
tempList.add(outerZone1TempConsume);
|
||||
tempList.add(outerZone2TempConsume);
|
||||
jsonObject.put("temp",tempList);
|
||||
}
|
||||
tempList.add(actualTempConsume);
|
||||
tempList.add(setupTempConsume);
|
||||
tempList.add(outerZone1TempConsume);
|
||||
tempList.add(outerZone2TempConsume);
|
||||
jsonObject.put("temp",tempList);
|
||||
}
|
||||
json.put(String.valueOf(taskId),jsonObject);
|
||||
}
|
||||
return R.ok(jsonObject.toJSONString());
|
||||
return R.ok(json.toJSONString());
|
||||
}
|
||||
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();
|
||||
return a1.floatValue();
|
||||
}
|
||||
@PostMapping(value = "checkResultList")
|
||||
@ApiOperation(value = "根据生产单号获取apms检验结果")
|
||||
|
@ -34,16 +34,8 @@ public class TaskHisController extends BaseController {
|
||||
private TaskHisService taskHisService;
|
||||
|
||||
@PostMapping(value = "taskHis")
|
||||
@ApiOperation(value = "获取历史执行的任务 (车辆名称传id)")
|
||||
@ApiOperation(value = "获取历史执行的任务")
|
||||
public R<PageVo<TaskHisQueryVo>> currentTask(@Validated @RequestBody TaskHisQueryParam param) {
|
||||
if (Objects.nonNull(param.getStartTime()))
|
||||
{
|
||||
param.setStartTime(LocalDateTimeUtils.getDayStart(param.getStartTime()));
|
||||
}
|
||||
if (Objects.nonNull(param.getEndTime()))
|
||||
{
|
||||
param.setEndTime(LocalDateTimeUtils.getDayEnd(param.getEndTime()));
|
||||
}
|
||||
return taskHisService.taskHisPage(param);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: liguanghao
|
||||
@ -26,7 +27,7 @@ public class ElectricQueryParam extends BaseParam {
|
||||
private Long kilnId;
|
||||
|
||||
@ApiModelProperty(value = "任务id", required = true)
|
||||
private Long taskId;
|
||||
private List<Long> taskIds;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "时间节点", required = false)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.mt.wms.empty.params;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mt.wms.core.params.BasePageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -22,12 +23,17 @@ public class TaskHisQueryParam extends BasePageParam {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "车辆id")
|
||||
private String vehicleId;
|
||||
@ApiModelProperty(value = "加工炉id")
|
||||
private String kilnId;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "开始时间", example = "2021-11-20T12:05:20")
|
||||
private LocalDateTime startTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "结束时间", example = "2021-11-25T12:05:20")
|
||||
private LocalDateTime endTime;
|
||||
@ApiModelProperty(value = "生产单号", example = "1219391")
|
||||
private String sheetNo;
|
||||
|
||||
@ApiModelProperty(value = "炉号", example = "BMA1-01-200011030001")
|
||||
private String stoveCode;
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.mt.wms.empty.params;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Author: LGH
|
||||
* @Date: 2022/8/3
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "测试stoveCode", description = "测试stoveCode")
|
||||
public class TestStoveCode {
|
||||
private String kilnName;
|
||||
private Integer craft;
|
||||
}
|
@ -54,9 +54,11 @@ public class TaskHisServiceImpl extends BaseService implements TaskHisService {
|
||||
@Override
|
||||
public R<PageVo<TaskHisQueryVo>> taskHisPage(TaskHisQueryParam param) {
|
||||
QueryWrapper<TaskHis> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(param.getSheetNo()),TaskHis.SHEET_NO,param.getSheetNo());
|
||||
queryWrapper.between(Objects.nonNull(param.getStartTime()) && Objects.nonNull(param.getEndTime()), TaskHis.CREATE_TIME, param.getStartTime(), param.getEndTime())
|
||||
.eq(TaskHis.VALID, 1).orderByDesc(TaskHis.CREATE_TIME);
|
||||
queryWrapper.eq(StringUtils.isNotBlank(param.getKilnId()),TaskHis.KILN_ID,param.getKilnId());
|
||||
queryWrapper.like(StringUtils.isNotBlank(param.getSheetNo()),TaskHis.SHEET_NO,param.getSheetNo());
|
||||
queryWrapper.like(StringUtils.isNotBlank(param.getStoveCode()),TaskHis.STOVE_CODE,param.getStoveCode());
|
||||
queryWrapper.between(Objects.nonNull(param.getStartTime()) && Objects.nonNull(param.getEndTime()), TaskHis.BEGIN_TIME, param.getStartTime(), param.getEndTime())
|
||||
.eq(TaskHis.VALID, 1).orderByDesc(TaskHis.BEGIN_TIME);
|
||||
Page<TaskHis> page = taskHisService.page(new Page<>(param.getCurrent(), param.getSize()), queryWrapper);
|
||||
return successful(new PageVo<>(page, TaskHisQueryVo.class));
|
||||
}
|
||||
|
@ -123,6 +123,8 @@ public class AsynRunTaskService extends BaseService {
|
||||
currTask.setUpdateTime(LocalDateTime.now());
|
||||
currTask.setBeginTime(LocalDateTime.now());
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
//生成炉号
|
||||
createStoveCode(currTask);
|
||||
//程序休眠10秒.防止进炉后允许入炉信号还没消失,就又发了下一个入炉任务.
|
||||
Thread.sleep(10000);
|
||||
//更新小车状态
|
||||
@ -227,6 +229,8 @@ public class AsynRunTaskService extends BaseService {
|
||||
currTask.setUpdateTime(LocalDateTime.now());
|
||||
currTask.setBeginTime(LocalDateTime.now());
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
//生成炉号
|
||||
createStoveCode(currTask);
|
||||
//更新小车状态
|
||||
vehicle.setStatus(0);
|
||||
vehicleInfoServiceBiz.updateById(vehicle);
|
||||
@ -1205,6 +1209,21 @@ public class AsynRunTaskService extends BaseService {
|
||||
return Integer.parseInt(String.valueOf(jsonObject.get("msg")));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成炉号
|
||||
* 多步骤任务除了第一步为清洗炉外,每步都生成炉号
|
||||
* 单步骤任务都生成炉号
|
||||
*/
|
||||
private void createStoveCode(CurrTask currTask){
|
||||
if (!(isFirstTask(currTask)&&currTask.getKilnId()==3)) {
|
||||
String stoveCode = CodeGeneratorHelper.getStoveCode(currTask.getKilnName(), currTask.getPlcValue().toString());
|
||||
currTask.setStoveCode(stoveCode);
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
}else {
|
||||
logger.info(currTask.getId()+"任务为多步骤任务且第一步为清洗,不生产清洗炉炉号.");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 上报apms创建生产单并开始处理
|
||||
*
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.mt.wms.empty.task;
|
||||
|
||||
import com.mt.wms.core.utils.CodeGeneratorHelper;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* @Author: LGH
|
||||
* @Date: 2022/11/2
|
||||
*/
|
||||
public class StoveCodeUtils {
|
||||
public static String getStoveCode(String kilnName,Integer craft){
|
||||
DecimalFormat df=new DecimalFormat();
|
||||
df.applyPattern("00");
|
||||
String craftCode = df.format(craft);
|
||||
return CodeGeneratorHelper.getStoveCode(kilnName, craftCode);
|
||||
}
|
||||
}
|
@ -34,6 +34,11 @@ public class CurrTaskInfoVo extends BaseVo implements PageVo.ConvertVo{
|
||||
*/
|
||||
@ApiModelProperty("生产单号")
|
||||
private String sheetNo;
|
||||
/**
|
||||
* 炉号
|
||||
*/
|
||||
@ApiModelProperty("炉号")
|
||||
private String stoveCode;
|
||||
/**
|
||||
* auto_Curr_Task_id
|
||||
*/
|
||||
|
@ -153,4 +153,10 @@ public class CurrTaskVo extends BaseVo implements PageVo.ConvertVo {
|
||||
*/
|
||||
@ApiModelProperty("auto_exe_task_id")
|
||||
private Long craftCodeId;
|
||||
|
||||
/**
|
||||
* 炉号
|
||||
*/
|
||||
@ApiModelProperty("stove_code")
|
||||
private String stoveCode;
|
||||
}
|
||||
|
@ -30,6 +30,12 @@ public class TaskHisQueryVo extends BaseVo implements PageVo.ConvertVo {
|
||||
*/
|
||||
@ApiModelProperty("任务编码")
|
||||
private String taskCode;
|
||||
|
||||
/**
|
||||
* 炉号
|
||||
*/
|
||||
@ApiModelProperty("炉号")
|
||||
private String stoveCode;
|
||||
/**
|
||||
* 发起任务时间
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user