Compare commits
66 Commits
2c186a6ff4
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d14d142472 | ||
|
|
571cee49a0 | ||
|
|
f1878910e3 | ||
|
|
f5aa87d7e9 | ||
| fa189331b8 | |||
|
|
0616844403 | ||
| ac476e936e | |||
| 6259a0237e | |||
| b0540ce4dc | |||
|
|
395817f10e | ||
|
|
21a4cfab23 | ||
|
|
63d251325f | ||
| a002354d49 | |||
|
|
7e9d8f5e64 | ||
| bcff5830f4 | |||
| 75471b7166 | |||
| ec7f364ccf | |||
|
|
5582a6929c | ||
|
|
74b42527c6 | ||
| b407f99872 | |||
| 292c511c22 | |||
| 59921c28ca | |||
| 5eed777f0a | |||
| 592d27b858 | |||
| 59f008f19e | |||
| 3ecf06ae6a | |||
|
|
605cdb5aa0 | ||
|
|
647e3f5761 | ||
| 85299bb26a | |||
| 1a6c19bf14 | |||
| 7cfa7168e1 | |||
| d5464eed6c | |||
| 9d8b6c065f | |||
| e6995b99a3 | |||
|
|
ef0ba77715 | ||
|
|
2def9c889f | ||
| 17f5ddbfa0 | |||
| 6ed7a735ed | |||
|
|
f359470fc4 | ||
| 5e54011371 | |||
| 8643ca11d7 | |||
|
|
5711a2acf6 | ||
| cb0be1cbbf | |||
| 9a7170d9e9 | |||
| 18590dafb9 | |||
| d107699d2c | |||
| d49759efdf | |||
| 412dbd04d4 | |||
| 249ca25963 | |||
| 942bde619f | |||
|
|
bd14fe3ed9 | ||
|
|
1ea55bd39a | ||
|
|
dd1a4b448e | ||
| 4af20b8551 | |||
|
|
1616215534 | ||
|
|
ddf6078774 | ||
|
|
f125fac9ee | ||
| 8abbc7193a | |||
| 17c0c1e973 | |||
|
|
c19066792c | ||
|
|
40f44f57d9 | ||
|
|
fbdb10ace7 | ||
|
|
05fb4a348a | ||
|
|
771351b12f | ||
|
|
7000c02653 | ||
|
|
2013d5b815 |
@@ -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;
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.mt.wms.core.dal.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 问题解答表
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2022-08-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("t_question_answer")
|
||||
public class QuestionAnswer extends Model<QuestionAnswer> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 删除标志,是否有效:1 可用 0不可用
|
||||
*/
|
||||
@TableField("valid")
|
||||
@TableLogic
|
||||
private Integer valid;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@TableField("create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@TableField("creator_id")
|
||||
private Integer creatorId;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
@TableField("updater_id")
|
||||
private Integer updaterId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField("update_time")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 版本号 默认为 1
|
||||
*/
|
||||
@TableField("version")
|
||||
@Version
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* 状态 0初始化
|
||||
*/
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 内部编码
|
||||
*/
|
||||
@TableField("inter_code")
|
||||
private String interCode;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@TableField("code")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 问题
|
||||
*/
|
||||
@TableField("question")
|
||||
private String question;
|
||||
|
||||
/**
|
||||
* 解答
|
||||
*/
|
||||
@TableField("answer")
|
||||
private String answer;
|
||||
|
||||
/**
|
||||
* 描述信息
|
||||
*/
|
||||
@TableField("description")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField("note")
|
||||
private String note;
|
||||
|
||||
|
||||
public static final String ID = "id";
|
||||
|
||||
public static final String VALID = "valid";
|
||||
|
||||
public static final String CREATE_TIME = "create_time";
|
||||
|
||||
public static final String CREATOR_ID = "creator_id";
|
||||
|
||||
public static final String UPDATER_ID = "updater_id";
|
||||
|
||||
public static final String UPDATE_TIME = "update_time";
|
||||
|
||||
public static final String VERSION = "version";
|
||||
|
||||
public static final String STATUS = "status";
|
||||
|
||||
public static final String INTER_CODE = "inter_code";
|
||||
|
||||
public static final String CODE = "code";
|
||||
|
||||
public static final String QUESTION = "question";
|
||||
|
||||
public static final String ANSWER = "answer";
|
||||
|
||||
public static final String DESCRIPTION = "description";
|
||||
|
||||
public static final String NOTE = "note";
|
||||
|
||||
@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;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mt.wms.core.dal.mapper;
|
||||
|
||||
import com.mt.wms.core.dal.entity.QuestionAnswer;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 问题解答表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2022-08-11
|
||||
*/
|
||||
public interface QuestionAnswerMapper extends BaseMapper<QuestionAnswer> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mt.wms.core.dal.mapper.QuestionAnswerMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.mt.wms.core.dal.entity.QuestionAnswer">
|
||||
<id column="id" property="id" />
|
||||
<result column="valid" property="valid" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="creator_id" property="creatorId" />
|
||||
<result column="updater_id" property="updaterId" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="version" property="version" />
|
||||
<result column="status" property="status" />
|
||||
<result column="inter_code" property="interCode" />
|
||||
<result column="code" property="code" />
|
||||
<result column="question" property="question" />
|
||||
<result column="answer" property="answer" />
|
||||
<result column="description" property="description" />
|
||||
<result column="note" property="note" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, code, question, answer, description, note
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mt.wms.core.dal.service;
|
||||
|
||||
import com.mt.wms.core.dal.entity.QuestionAnswer;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 问题解答表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2022-08-11
|
||||
*/
|
||||
public interface QuestionAnswerServiceBiz extends IService<QuestionAnswer> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mt.wms.core.dal.service.impl;
|
||||
|
||||
import com.mt.wms.core.dal.entity.QuestionAnswer;
|
||||
import com.mt.wms.core.dal.mapper.QuestionAnswerMapper;
|
||||
import com.mt.wms.core.dal.service.QuestionAnswerServiceBiz;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 问题解答表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2022-08-11
|
||||
*/
|
||||
@Service
|
||||
public class QuestionAnswerServiceBizImpl extends ServiceImpl<QuestionAnswerMapper, QuestionAnswer> implements QuestionAnswerServiceBiz {
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
/**
|
||||
* 生成自动任务编码
|
||||
*
|
||||
|
||||
@@ -11,10 +11,8 @@ import org.springframework.stereotype.Component;
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* id生成器,使用redis自增接口实现
|
||||
@@ -153,6 +151,13 @@ public class IDGenerator {
|
||||
}
|
||||
if (!isEmpty(sequenceName)) {
|
||||
long sequence = gen(sequenceName);
|
||||
//设置key有效期为当天,次日凌晨失效
|
||||
Calendar curDate = Calendar.getInstance();
|
||||
Calendar tomorrowDate = new GregorianCalendar(curDate.get(Calendar.YEAR), curDate.get(Calendar.MONTH), curDate.get(Calendar.DATE) + 1, 0, 0, 0);
|
||||
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;
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.mt.wms.core.base.BaseController;
|
||||
import com.mt.wms.core.constants.CommonConstant;
|
||||
import com.mt.wms.core.dal.entity.CommunicationLog;
|
||||
@@ -17,6 +18,7 @@ import com.mt.wms.empty.vo.ApmsCreateProcessSheetVo;
|
||||
import com.mt.wms.empty.vo.ApmsEndProcessVo;
|
||||
import com.mt.wms.empty.vo.ApmsFinishProcessSheetVo;
|
||||
import com.mt.wms.empty.vo.ApmsStoveVo;
|
||||
import com.mt.wms.empty.websocket.WebSocketServer;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -27,6 +29,8 @@ 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 java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
@@ -46,6 +50,8 @@ public class ApmsController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CommunicationLogServiceBiz communicationLogServiceBiz;
|
||||
@Autowired
|
||||
private WebSocketServer webSocketServer;
|
||||
|
||||
static String Token = "";
|
||||
static LocalDateTime TokenExpireTime = LocalDateTime.now();
|
||||
@@ -134,9 +140,20 @@ public class ApmsController extends BaseController {
|
||||
communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body());
|
||||
setCommonField(communicationLog);
|
||||
communicationLogServiceBiz.save(communicationLog);
|
||||
String body = response.body();
|
||||
JSONObject jsonObject = com.alibaba.fastjson.JSON.parseObject(body);
|
||||
Object success = jsonObject.get("success");
|
||||
if (status == 200)
|
||||
{
|
||||
return successful(JSONUtil.toBean(response.body(), ApmsCreateProcessSheetVo.class));
|
||||
ApmsCreateProcessSheetVo apmsCreateProcessSheetVo = JSONUtil.toBean(response.body(), ApmsCreateProcessSheetVo.class);
|
||||
if (!apmsCreateProcessSheetVo.getSuccess()){
|
||||
try {
|
||||
webSocketServer.sendtoAll(apmsCreateProcessSheetVo.getMsg());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return successful(apmsCreateProcessSheetVo);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -22,11 +22,9 @@ 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.ApmsCreateProcessSheetVo;
|
||||
import com.mt.wms.empty.vo.ApmsStoveVo;
|
||||
import com.mt.wms.empty.vo.CurrTaskMainQueryVo;
|
||||
import com.mt.wms.empty.vo.CurrTaskQueryVo;
|
||||
import com.mt.wms.empty.vo.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -88,16 +86,13 @@ public class CurrTaskController extends BaseController {
|
||||
stoveCodes.forEach(kilnMap -> {
|
||||
codeStr.add(kilnMap.get("code"));
|
||||
});
|
||||
for (String s : codeStr)
|
||||
{
|
||||
if (s.equals(kilnCode))
|
||||
{
|
||||
for (String s : codeStr) {
|
||||
if (s.equals(kilnCode)) {
|
||||
verifyCodes = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!verifyCodes)
|
||||
{
|
||||
if (!verifyCodes) {
|
||||
return failed("创建失败,APMS中验证炉号" + kilnCode + "失败!");
|
||||
}
|
||||
|
||||
@@ -132,7 +127,7 @@ public class CurrTaskController extends BaseController {
|
||||
//currTaskById.setSheetNo(sheetNo);
|
||||
//currTaskService.updateCurrTaskById(currTaskById);
|
||||
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
|
||||
return successful(0,"创建成功,任务添加至等待执行队列。","");
|
||||
return successful(0, "创建成功,任务添加至等待执行队列。详情请在订单加工管理下当前任务列表查看", "");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
@@ -152,6 +147,9 @@ public class CurrTaskController extends BaseController {
|
||||
AutoExeTask autoExeTask = new AutoExeTask();
|
||||
for (TaskCreateParam param : detParams
|
||||
) {
|
||||
if(param.getDetParams().size()==0){
|
||||
return failed("请添加至少一个标识卡!");
|
||||
}
|
||||
//验证标识卡号正确无误。
|
||||
orderInfoService.verifyTaskInfoByIdenCardNum(param.getDetParams());
|
||||
//验证炉子编码信息在apms正确无误
|
||||
@@ -165,16 +163,13 @@ public class CurrTaskController extends BaseController {
|
||||
stoveCodes.forEach(kilnMap -> {
|
||||
codeStr.add(kilnMap.get("code"));
|
||||
});
|
||||
for (String s : codeStr)
|
||||
{
|
||||
if (s.equals(kilnCode))
|
||||
{
|
||||
for (String s : codeStr) {
|
||||
if (s.equals(kilnCode)) {
|
||||
verifyCodes = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!verifyCodes)
|
||||
{
|
||||
if (!verifyCodes) {
|
||||
return failed("创建失败,APMS中验证炉号" + kilnCode + "失败!");
|
||||
}
|
||||
/*
|
||||
@@ -256,7 +251,7 @@ public class CurrTaskController extends BaseController {
|
||||
//}
|
||||
//i++;
|
||||
}
|
||||
return successful(0,"操作成功,任务加入待执行队列","");
|
||||
return successful(0, "操作成功,任务加入待执行队列,详情请在订单加工管理下当前任务列表查看!", "");
|
||||
}
|
||||
|
||||
@PostMapping(value = "mainCurrentTaskNow")
|
||||
@@ -266,11 +261,35 @@ public class CurrTaskController extends BaseController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "currentTaskNow")
|
||||
@ApiOperation(value = "获取当前执行的任务 (车辆名称传id)")
|
||||
@ApiOperation(value = "获取当前执行的任务")
|
||||
public R<PageVo<CurrTaskQueryVo>> currentTask(@Validated @RequestBody CurrTaskQueryParam param) {
|
||||
return currTaskService.currentTaskPage(param);
|
||||
}
|
||||
|
||||
@PostMapping(value = "currentTaskInfo")
|
||||
@ApiOperation(value = "获取当前任务列表以及详情")
|
||||
public R<List<CurrTaskInfoVo>> currentTaskInfo(@Validated @RequestBody CurrTaskQueryParam param) {
|
||||
return currTaskService.currentTaskInfoPage(param);
|
||||
}
|
||||
|
||||
@PostMapping(value = "taskInfoNotToApms")
|
||||
@ApiOperation(value = "获取未报工任务列表以及详情")
|
||||
public R<List<CurrTaskInfoVo>> taskInfoNotToApms(@Validated @RequestBody CurrTaskQueryParam param) {
|
||||
return currTaskService.currentTaskInfoPageForNotToApms(param);
|
||||
}
|
||||
|
||||
@PostMapping(value = "oneStepToApms")
|
||||
@ApiOperation(value = "手动报工")
|
||||
public R<String> oneStepToApms(@Validated @RequestBody CurrTaskInfoVo currTaskInfoVo) {
|
||||
return currTaskService.oneStepToApms(currTaskInfoVo);
|
||||
}
|
||||
|
||||
@PostMapping(value = "updateCurrTaskStatus")
|
||||
@ApiOperation(value = "更新任务状态")
|
||||
public R<String> updateCurrTaskStatus(@Validated @RequestBody CurrTaskParam param) {
|
||||
return currTaskService.updateCurrTaskStatus(param);
|
||||
}
|
||||
|
||||
@PostMapping(value = "completeTask")
|
||||
@ApiOperation(value = "执行任务完成(仅wms,不通知apms)")
|
||||
public R<String> completeTask(@Validated @RequestBody IdParam param) {
|
||||
@@ -294,18 +313,21 @@ public class CurrTaskController extends BaseController {
|
||||
public R<String> top(@Validated @RequestBody IdParam param) {
|
||||
return currTaskService.top(param);
|
||||
}
|
||||
|
||||
@PostMapping(value = "runTask")
|
||||
@ApiOperation(value = "执行任务")
|
||||
public R<String> runTask(@Validated @RequestBody IdParam param) throws InterruptedException, IOException {
|
||||
//点击执行按钮会判断当前任务是否为自动任务,如果是自动任务会去自动任务查一下该自动任务的上一步是否已完成(仅非一步时)
|
||||
return currTaskService.runTask(param.getId());
|
||||
}
|
||||
|
||||
@PostMapping(value = "testRunTask")
|
||||
@ApiOperation(value = "执行任务")
|
||||
public R<String> testRunTask(@RequestBody RGVTask rgvTask) {
|
||||
sendTaskToRgv(rgvTask.getTaskType(), rgvTask.getVehicleId(), rgvTask.getTaskNo(), rgvTask.getPickRow(), rgvTask.getSendRow(), rgvTask.getProcessNumber());
|
||||
return null;
|
||||
}
|
||||
|
||||
@PostMapping(value = "testRgv")
|
||||
@ApiOperation(value = "测试rgv避让逻辑")
|
||||
private String testRgv(@RequestBody TestRgv testRgv) throws IOException {
|
||||
@@ -313,6 +335,7 @@ public class CurrTaskController extends BaseController {
|
||||
Boolean aBoolean = taskDistanceUtils.conflictForVehicle(testRgv.getVehicleId(), testRgv.getStartPoint(), testRgv.getEndPoint(), testRgv.getOtherVehicle());
|
||||
return String.valueOf(aLong) + String.valueOf(aBoolean);
|
||||
}
|
||||
|
||||
private Integer sendTaskToRgv(Integer taskType, Long vehicleId, Long currTaskId, Long startPoint, Long endPoint, Integer processNumber) {
|
||||
Map<String, Object> json = new HashMap();
|
||||
// taskType 1 搬运
|
||||
@@ -337,4 +360,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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -44,30 +48,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,8 +69,12 @@ public class EnergyController extends BaseController {
|
||||
@PostMapping(value = "energyList")
|
||||
@ApiOperation(value = "根据加工炉id获取能源消耗情况")
|
||||
public R<String> energyList(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam) {
|
||||
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, 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();
|
||||
@@ -102,7 +86,7 @@ public class EnergyController extends BaseController {
|
||||
//电能消耗
|
||||
List<ParEleValue> parEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
|
||||
.eq(ParEleValue.KILN_ID, kilnId)
|
||||
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
|
||||
.eq(ParEleValue.TASK_ID, taskId));
|
||||
if (parEleValueList.size() > 0) {
|
||||
List<Object> eleList = new ArrayList<>();
|
||||
//电能消耗
|
||||
@@ -127,24 +111,28 @@ public class EnergyController extends BaseController {
|
||||
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());
|
||||
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());
|
||||
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());
|
||||
cVolConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
}
|
||||
@@ -157,7 +145,7 @@ public class EnergyController extends BaseController {
|
||||
//氮气、甲醇、丙烷、氨气消耗量
|
||||
List<ParGasValue> parGasValueList = parGasValueServiceBiz.list(new QueryWrapper<ParGasValue>()
|
||||
.eq(ParEleValue.KILN_ID, kilnId)
|
||||
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
|
||||
.eq(ParEleValue.TASK_ID, taskId));
|
||||
if (parGasValueList.size() > 0) {
|
||||
if (kilnType == 1) {
|
||||
List<Object> gasList = new ArrayList<>();
|
||||
@@ -188,24 +176,28 @@ public class EnergyController extends BaseController {
|
||||
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();
|
||||
}
|
||||
@@ -240,18 +232,21 @@ public class EnergyController extends BaseController {
|
||||
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();
|
||||
}
|
||||
@@ -264,7 +259,7 @@ public class EnergyController extends BaseController {
|
||||
//油搅拌转速趋势
|
||||
List<ParRotSpeedValue> parRotSpeedValueList = parRotSpeedValueServiceBiz.list(new QueryWrapper<ParRotSpeedValue>()
|
||||
.eq(ParEleValue.KILN_ID, kilnId)
|
||||
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
|
||||
.eq(ParEleValue.TASK_ID, taskId));
|
||||
if (parRotSpeedValueList.size() > 0) {
|
||||
if (kilnType == 1) {
|
||||
List<Object> rotList = new ArrayList<>();
|
||||
@@ -276,12 +271,14 @@ public class EnergyController extends BaseController {
|
||||
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();
|
||||
}
|
||||
@@ -293,7 +290,7 @@ public class EnergyController extends BaseController {
|
||||
//温度趋势(实际温度、设定温度)
|
||||
List<ParTemValue> parTemValueList = parTemValueServiceBiz.list(new QueryWrapper<ParTemValue>()
|
||||
.eq(ParEleValue.KILN_ID, kilnId)
|
||||
.eq(ParEleValue.TASK_ID, electricQueryParam.getTaskId()));
|
||||
.eq(ParEleValue.TASK_ID, taskId));
|
||||
if (parTemValueList.size() > 0) {
|
||||
if (kilnType == 1) {
|
||||
List<Object> tempList = new ArrayList<>();
|
||||
@@ -307,24 +304,28 @@ public class EnergyController extends BaseController {
|
||||
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();
|
||||
}
|
||||
@@ -344,12 +345,14 @@ public class EnergyController extends BaseController {
|
||||
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();
|
||||
}
|
||||
@@ -370,18 +373,21 @@ public class EnergyController extends BaseController {
|
||||
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());
|
||||
@@ -389,6 +395,7 @@ public class EnergyController extends BaseController {
|
||||
map.put("value", parTemValue.getOuterZone2Temp());
|
||||
map.put("name", "外二区温度");
|
||||
map.put("unit", "℃");
|
||||
map.put("炉号", currTask.getSheetNo());
|
||||
outerZone2TempConsume.add(JSONObject.toJSON(map));
|
||||
map.clear();
|
||||
}
|
||||
@@ -399,13 +406,17 @@ public class EnergyController extends BaseController {
|
||||
jsonObject.put("temp", tempList);
|
||||
}
|
||||
}
|
||||
return R.ok(jsonObject.toJSONString());
|
||||
json.put(String.valueOf(taskId), jsonObject);
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
@PostMapping(value = "checkResultList")
|
||||
@ApiOperation(value = "根据生产单号获取apms检验结果")
|
||||
public List<ApmsCheckResult> getApmsCheckResult(@RequestBody ElectricQueryParam electricQueryParam) {
|
||||
@@ -413,135 +424,441 @@ public class EnergyController extends BaseController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "eletric")
|
||||
@ApiOperation(value = "根据任务id获取消耗情况",hidden = true)
|
||||
public R<String> 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<ParEleValue> todayEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
|
||||
.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<ParEleValue> yesterdayEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
|
||||
.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<ParEleValue> dateEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
|
||||
.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();
|
||||
}
|
||||
jsonObject.put("dateCountEle",dateCountEle);
|
||||
//分时消耗量
|
||||
Map<String,Float> 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);
|
||||
}
|
||||
}
|
||||
jsonObject.put("timeEle",timeJsonObject);
|
||||
}
|
||||
//指定日期当周的每天电能消耗
|
||||
if(electricQueryParam.getDateType()==1){
|
||||
LocalDate monday = timeDate.with(DayOfWeek.MONDAY);
|
||||
LocalDate sunday = timeDate.with(DayOfWeek.SUNDAY);
|
||||
List<ParEleValue> timeWeekEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
|
||||
.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<String,Float> timeJsonObject=new LinkedHashMap();
|
||||
for (ParEleValue parEleValue:timeWeekEleValueList
|
||||
@ApiOperation(value = "根据任务id获取消耗情况", hidden = false)
|
||||
public R<JSONObject> list(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam) {
|
||||
List<Long> taskIds = electricQueryParam.getTaskIds();
|
||||
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<>();
|
||||
for (Long taskId : taskIds
|
||||
) {
|
||||
LocalDate localDate = parEleValue.getCreateTime().toLocalDate();
|
||||
timeJsonObject.put(localDate.toString(),parEleValue.getTotalBat());
|
||||
TaskHis currTask = taskHisServiceBiz.getOne(new QueryWrapper<TaskHis>().eq(TaskHis.TASK_ID, taskId));
|
||||
//防止早期没有炉号的报错
|
||||
if (currTask.getStoveCode() == null) {
|
||||
currTask.setStoveCode(currTask.getSheetNo());
|
||||
}
|
||||
jsonObject.put("timeEle",timeJsonObject);
|
||||
}
|
||||
//指定日期当月的每天电能消耗
|
||||
if(electricQueryParam.getDateType()==2){
|
||||
LocalDate firstday = LocalDate.of(timeDate.getYear(), timeDate.getMonthValue(), 1);
|
||||
LocalDate lastDay = timeDate.with(TemporalAdjusters.lastDayOfMonth());
|
||||
List<ParEleValue> timeMonthEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
|
||||
.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<String,Float> timeJsonObject=new LinkedHashMap();
|
||||
for (ParEleValue parEleValue:timeMonthEleValueList
|
||||
//获取检验结果
|
||||
List<ApmsCheckResult> apmsCheckResults = apmsCheckResultServiceBiz.list(new QueryWrapper<ApmsCheckResult>()
|
||||
.eq(ApmsCheckResult.SHEET_NO, currTask.getSheetNo()));
|
||||
if (apmsCheckResults.size() != 0) {
|
||||
List<ApmsCheckResultVo> apmsCheckResultVos = BeanUtils.copyList(apmsCheckResults, ApmsCheckResultVo.class);
|
||||
for (ApmsCheckResultVo apmsCheckResultVo : apmsCheckResultVos
|
||||
) {
|
||||
LocalDate localDate = parEleValue.getCreateTime().toLocalDate();
|
||||
timeJsonObject.put(localDate.toString(),parEleValue.getTotalBat());
|
||||
apmsCheckResultVo.setStoveCode(currTask.getStoveCode());
|
||||
}
|
||||
jsonObject.put("timeEle",timeJsonObject);
|
||||
checkResultList.add(apmsCheckResultVos);
|
||||
}
|
||||
//指定日期当年的每月电能消耗
|
||||
if(electricQueryParam.getDateType()==2){
|
||||
LocalDate firstDay = timeDate.with(TemporalAdjusters.firstDayOfYear());
|
||||
LocalDate lastDay = timeDate.with(TemporalAdjusters.lastDayOfYear());
|
||||
List<ParEleValue> timeYearEleValueList = parEleValueServiceBiz.list(new QueryWrapper<ParEleValue>()
|
||||
.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<String,Float> timeJsonObject=new LinkedHashMap();
|
||||
for (ParEleValue parEleValue:timeYearEleValueList
|
||||
|
||||
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
|
||||
) {
|
||||
LocalDate localDate = parEleValue.getCreateTime().toLocalDate();
|
||||
timeJsonObject.put(localDate.toString(),parEleValue.getTotalBat());
|
||||
//首位置为0
|
||||
if (i == 0) {
|
||||
talBat = parEleValue.getTotalBat();
|
||||
}
|
||||
jsonObject.put("timeEle",timeJsonObject);
|
||||
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);
|
||||
}
|
||||
return successful(jsonObject.toJSONString());
|
||||
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.setTime(parGasValue.getCreateTime());
|
||||
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.setTime(parGasValue.getCreateTime());
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.mt.wms.empty.controller;
|
||||
|
||||
import com.mt.wms.core.base.BaseController;
|
||||
import com.mt.wms.core.constants.CommonConstant;
|
||||
import com.mt.wms.core.params.IdParam;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.service.StockInfoService;
|
||||
import com.mt.wms.empty.vo.CurrTaskDetVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: LGH
|
||||
* @Date: 2022/9/9
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(CommonConstant.API_MODULE_BASE + "inStockInfo")
|
||||
@Slf4j
|
||||
@Api(value = "缓存库位相关接口", tags = "缓存库位相关接口", hidden = false)
|
||||
public class InStockInfoController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private StockInfoService stockInfoService;
|
||||
@PostMapping(value = "top")
|
||||
@ApiOperation(value = "置顶改缓存库位")
|
||||
private R<String> top(@Validated @RequestBody IdParam idParam) {
|
||||
return stockInfoService.top(idParam);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.mt.wms.empty.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mt.wms.basic.params.AlarmBaseParam;
|
||||
import com.mt.wms.basic.params.AlarmBaseQueryParam;
|
||||
import com.mt.wms.basic.service.AlarmBaseService;
|
||||
import com.mt.wms.basic.vo.AlarmBaseVo;
|
||||
import com.mt.wms.core.base.BaseController;
|
||||
import com.mt.wms.core.constants.CommonConstant;
|
||||
import com.mt.wms.core.dal.entity.AlarmBase;
|
||||
import com.mt.wms.core.dal.entity.QuestionAnswer;
|
||||
import com.mt.wms.core.dal.service.QuestionAnswerServiceBiz;
|
||||
import com.mt.wms.core.params.IdParam;
|
||||
import com.mt.wms.core.validator.groups.AddGroup;
|
||||
import com.mt.wms.core.validator.groups.PageGroup;
|
||||
import com.mt.wms.core.validator.groups.UpdateGroup;
|
||||
import com.mt.wms.core.vo.IdVo;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.params.QuestionAnswerParam;
|
||||
import com.mt.wms.empty.params.QuestionAnswerQueryparam;
|
||||
import com.mt.wms.empty.vo.QuestionAnswerVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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.validation.groups.Default;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: LGH
|
||||
* @Date: 2022/8/11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(CommonConstant.API_MODULE_BASE + "questionAnswer")
|
||||
@Slf4j
|
||||
@Api(value = "问题解答相关接口", tags = "问题解答相关接口", hidden = false)
|
||||
public class QuestionAnswerController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private QuestionAnswerServiceBiz questionAnswerServiceBiz;
|
||||
|
||||
@PostMapping(value = "get")
|
||||
@ApiOperation(value = "获取报警基础信息")
|
||||
private R<QuestionAnswerVo> get(@Validated @RequestBody IdParam idParam) {
|
||||
QuestionAnswer questionAnswer = questionAnswerServiceBiz.getById(idParam.getId());
|
||||
QuestionAnswerVo questionAnswerVo= QuestionAnswerVo.builder().build();
|
||||
BeanUtils.copyProperties(questionAnswer,QuestionAnswerVo.class);
|
||||
return successful(questionAnswerVo);
|
||||
}
|
||||
|
||||
@PostMapping(value = "list")
|
||||
@ApiOperation(value = "获取报警基础信息列表")
|
||||
private R<List<QuestionAnswerVo>> list(@Validated({Default.class}) @RequestBody QuestionAnswerQueryparam questionAnswerQueryparam) {
|
||||
List<QuestionAnswer> questionAnswerList = questionAnswerServiceBiz.list(new QueryWrapper<QuestionAnswer>()
|
||||
.like(StringUtils.isNotBlank(questionAnswerQueryparam.getKey()), QuestionAnswer.QUESTION, questionAnswerQueryparam.getKey()));
|
||||
List<QuestionAnswerVo> questionAnswerVos = com.mt.wms.core.utils.BeanUtils.copyList(questionAnswerList, QuestionAnswerVo.class);
|
||||
return successful(questionAnswerVos);
|
||||
}
|
||||
|
||||
@PostMapping(value = "page")
|
||||
@ApiOperation(value = "获取分页报警基础信息")
|
||||
private R<PageVo<QuestionAnswerVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody QuestionAnswerQueryparam questionAnswerQueryparam) {
|
||||
QueryWrapper<QuestionAnswer> wrapper=new QueryWrapper<>();
|
||||
wrapper.like(StringUtils.isNotBlank(questionAnswerQueryparam.getKey()), QuestionAnswer.QUESTION, questionAnswerQueryparam.getKey());
|
||||
Page<QuestionAnswer> page = questionAnswerServiceBiz.page(new Page<>(questionAnswerQueryparam.getCurrent(), questionAnswerQueryparam.getSize()), wrapper);
|
||||
return successful(new PageVo<>(page,QuestionAnswerVo.class));
|
||||
}
|
||||
|
||||
@PostMapping(value = "add")
|
||||
@ApiOperation(value = "新增")
|
||||
private R<IdVo> add(@Validated({AddGroup.class, Default.class}) @RequestBody QuestionAnswerParam questionAnswerParam) {
|
||||
QuestionAnswer questionAnswer=new QuestionAnswer();
|
||||
BeanUtils.copyProperties(questionAnswerParam,questionAnswer);
|
||||
setCommonField(questionAnswer);
|
||||
questionAnswerServiceBiz.save(questionAnswer);
|
||||
return successful(IdVo.builder().id(questionAnswer.getId()).build());
|
||||
}
|
||||
|
||||
@PostMapping(value = "update")
|
||||
@ApiOperation(value = "更新")
|
||||
private R<IdVo> update(@Validated({UpdateGroup.class, Default.class}) @RequestBody QuestionAnswerParam questionAnswerParam) {
|
||||
QuestionAnswer questionAnswer=new QuestionAnswer();
|
||||
BeanUtils.copyProperties(questionAnswerParam,questionAnswer);
|
||||
setCommonField(questionAnswer);
|
||||
questionAnswerServiceBiz.save(questionAnswer);
|
||||
return successful(IdVo.builder().id(questionAnswer.getId()).build());
|
||||
}
|
||||
|
||||
@PostMapping(value = "delete")
|
||||
@ApiOperation(value = "删除报警基础信息")
|
||||
private R<IdVo> delete(@Validated @RequestBody IdParam idParam) {
|
||||
questionAnswerServiceBiz.removeById(idParam.getId());
|
||||
return successful(IdVo.builder().id(idParam.getId()).build());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,693 @@
|
||||
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.time.LocalDateTime;
|
||||
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);
|
||||
}
|
||||
|
||||
@PostMapping(value = "getEleList")
|
||||
@ApiOperation(value = "获取加工炉最近十条加工任务电能消耗信息")
|
||||
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<>();
|
||||
List<EnergyVo> 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());
|
||||
rot2Consume.add(rot2Vo);
|
||||
}
|
||||
rot1ConsumeList.add(rot1Consume);
|
||||
rot2ConsumeList.add(rot2Consume);
|
||||
}
|
||||
}
|
||||
//温度趋势(实际温度、设定温度)油槽温度外区温度
|
||||
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);
|
||||
|
||||
EnergyVo outer1TempVo = EnergyVo.builder().build();
|
||||
outer1TempVo.setTime(parTemValue.getCreateTime());
|
||||
outer1TempVo.setCode(currTask.getStoveCode());
|
||||
outer1TempVo.setUnit("℃");
|
||||
outer1TempVo.setValue(parTemValue.getOuterZone1Temp());
|
||||
outer1TempVo.setName("外一区温度");
|
||||
outerZone1TempConsume.add(outer1TempVo);
|
||||
|
||||
EnergyVo outer2TempVo = EnergyVo.builder().build();
|
||||
outer2TempVo.setTime(parTemValue.getCreateTime());
|
||||
outer2TempVo.setCode(currTask.getStoveCode());
|
||||
outer2TempVo.setUnit("℃");
|
||||
outer2TempVo.setValue(parTemValue.getOuterZone2Temp());
|
||||
outer2TempVo.setName("外二区温度");
|
||||
outerZone2TempConsume.add(outer2TempVo);
|
||||
|
||||
}
|
||||
tempConsumeList.add(actualTempConsume);
|
||||
tempConsumeList.add(setupTempConsume);
|
||||
outerZone1TempConsumeList.add(outerZone1TempConsume);
|
||||
outerZone2TempConsumeList.add(outerZone2TempConsume);
|
||||
}
|
||||
}
|
||||
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("outerZone1Temp",outerZone1TempConsumeList);
|
||||
map.put("outerZone2Temp",outerZone2TempConsumeList);
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class ApmsCreateProcessSheet extends BaseParam {
|
||||
@ApiModelProperty(value = "开始加工人:为APMS账号", required = true)
|
||||
private String startUser;
|
||||
|
||||
@ApiModelProperty(value = "配炉号", required = true)
|
||||
@ApiModelProperty(value = "配炉号", required = false)
|
||||
private String stoveCode;
|
||||
|
||||
@ApiModelProperty(value = "炉号备注", required = false)
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ApmsStartProcess extends BaseParam {
|
||||
@ApiModelProperty(value = "开始加工人:为APMS账号", required = true)
|
||||
private String startUser;
|
||||
|
||||
@ApiModelProperty(value = "配炉号", required = true)
|
||||
@ApiModelProperty(value = "配炉号", required = false)
|
||||
private String stoveCode;
|
||||
|
||||
@ApiModelProperty(value = "工艺号", required = false)
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mt.wms.empty.params;
|
||||
|
||||
import com.mt.wms.core.base.BaseParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Author: LGH
|
||||
* @Date: 2022/9/5
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "任务参数对象", description = "任务参数对象")
|
||||
public class CurrTaskParam extends BaseParam {
|
||||
@ApiModelProperty(value = "id", required = true)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = false)
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "加工炉", required = false)
|
||||
private Long kilnId;
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -32,5 +32,11 @@ public class OrderInfoBasePageParam extends BasePageParam {
|
||||
@ApiModelProperty(value = "标识卡号", required = true)
|
||||
private String idenCardNum;
|
||||
|
||||
/**
|
||||
* 客户名称,APMS系统获取
|
||||
*/
|
||||
@ApiModelProperty(value = "客户名称", required = true)
|
||||
private String customerName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mt.wms.empty.params;
|
||||
|
||||
import com.mt.wms.core.base.BaseParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Author: LGH
|
||||
* @Date: 2022/8/11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "问题解答参数对象", description = "问题解答参数对象")
|
||||
public class QuestionAnswerParam extends BaseParam {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "问题", required = true)
|
||||
private String question;
|
||||
|
||||
@ApiModelProperty(value = "解答", required = true)
|
||||
private String answer;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.mt.wms.empty.params;
|
||||
|
||||
import com.mt.wms.core.params.BasePageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Author: LGH
|
||||
* @Date: 2022/8/11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "问题解答查询对象", description = "问题解答查询对象")
|
||||
public class QuestionAnswerQueryparam extends BasePageParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "问题", required = false)
|
||||
private String key;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -7,13 +7,16 @@ import com.mt.wms.core.vo.IdVo;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.params.AutoCurrTaskParam;
|
||||
import com.mt.wms.empty.params.CurrTaskParam;
|
||||
import com.mt.wms.empty.params.CurrTaskQueryParam;
|
||||
import com.mt.wms.empty.params.TaskCreateParam;
|
||||
import com.mt.wms.empty.vo.CurrTaskInfoVo;
|
||||
import com.mt.wms.empty.vo.CurrTaskMainQueryVo;
|
||||
import com.mt.wms.empty.vo.CurrTaskQueryVo;
|
||||
import com.mt.wms.empty.vo.CurrTaskVo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 拆分任务相关服务
|
||||
@@ -63,6 +66,38 @@ public interface CurrTaskService {
|
||||
*/
|
||||
R<PageVo<CurrTaskQueryVo>> currentTaskPage(CurrTaskQueryParam param);
|
||||
|
||||
/**
|
||||
* 查询分页信息
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
R<List<CurrTaskInfoVo>> currentTaskInfoPage(CurrTaskQueryParam param);
|
||||
|
||||
/**
|
||||
* 未成功报工任务查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
R<List<CurrTaskInfoVo>> currentTaskInfoPageForNotToApms(CurrTaskQueryParam param);
|
||||
|
||||
/**
|
||||
* 未成功报工任务查询
|
||||
*
|
||||
* @param
|
||||
* @return 结果
|
||||
*/
|
||||
R<String> oneStepToApms(CurrTaskInfoVo currTaskInfoVo);
|
||||
|
||||
/**
|
||||
* 更新任务状态
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
R<String> updateCurrTaskStatus(CurrTaskParam param);
|
||||
|
||||
/**
|
||||
* 完成执行任务 不会物理删除,会将删除值置为0,同时在历史表复制一份记录 方便在订单未完成时查询任务详情
|
||||
*
|
||||
@@ -78,6 +113,7 @@ public interface CurrTaskService {
|
||||
* @return 结果
|
||||
*/
|
||||
R<String> deleteBySheetNo(String sheetNo);
|
||||
|
||||
/**
|
||||
* 通过id删除生产单
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -29,4 +29,8 @@ public interface StockInfoService {
|
||||
* @return xx列表
|
||||
*/
|
||||
R<List<StockInfoVo>> list();
|
||||
/**
|
||||
* 置顶缓存库位顺序
|
||||
*/
|
||||
R<String> top(IdParam idParam);
|
||||
}
|
||||
|
||||
@@ -122,16 +122,22 @@ public class CurrTaskDetServiceImpl extends BaseService implements CurrTaskDetSe
|
||||
while (iterator.hasNext()){
|
||||
CurrTaskDet currTaskDet = iterator.next();
|
||||
CurrTaskVo byId = currTaskService.getCurrTask(IdParam.builder().id(currTaskDet.getCurrTaskId()).build());
|
||||
if (byId.getStatus()==2){
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
//如果加工类型是复加工,或者任务作废。移除对象
|
||||
if (byId.getProcessType().equals(2) || byId.getValid() != 1)
|
||||
{
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
//如果是多步骤任务且不是第一步,移除对象
|
||||
if (byId.getIsAuto()==1){
|
||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(byId.getAutoExeTaskId());
|
||||
if (!byId.getId().equals(autoExeTask.getFTaskId())){
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mt.wms.empty.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mt.wms.core.api.Assert;
|
||||
@@ -10,23 +8,19 @@ import com.mt.wms.core.dal.entity.*;
|
||||
import com.mt.wms.core.dal.service.*;
|
||||
import com.mt.wms.core.params.BasePageParam;
|
||||
import com.mt.wms.core.params.IdParam;
|
||||
import com.mt.wms.core.utils.HttpClient;
|
||||
import com.mt.wms.core.utils.IDGenerator;
|
||||
import com.mt.wms.core.vo.IdVo;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.controller.ApmsController;
|
||||
import com.mt.wms.empty.enums.TaskTypeEnum;
|
||||
import com.mt.wms.empty.params.AutoCurrTaskParam;
|
||||
import com.mt.wms.empty.params.CurrTaskQueryParam;
|
||||
import com.mt.wms.empty.params.TaskCreateParam;
|
||||
import com.mt.wms.empty.params.*;
|
||||
import com.mt.wms.empty.service.*;
|
||||
import com.mt.wms.empty.task.RunTaskUtils;
|
||||
import com.mt.wms.empty.task.StoveCodeUtils;
|
||||
import com.mt.wms.empty.task.TaskDistanceUtils;
|
||||
import com.mt.wms.empty.vo.ApmsEndProcessVo;
|
||||
import com.mt.wms.empty.vo.CurrTaskMainQueryVo;
|
||||
import com.mt.wms.empty.vo.CurrTaskQueryVo;
|
||||
import com.mt.wms.empty.vo.CurrTaskVo;
|
||||
import com.mt.wms.empty.vo.*;
|
||||
import com.mt.wms.empty.websocket.WebSocketServer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -34,9 +28,13 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
@@ -49,22 +47,18 @@ import java.util.*;
|
||||
@Transactional
|
||||
public class CurrTaskServiceImpl extends BaseService implements CurrTaskService {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Autowired
|
||||
CurrTaskServiceBiz currTaskServiceBiz;
|
||||
|
||||
@Autowired
|
||||
CurrTaskDetService currTaskDetService;
|
||||
|
||||
@Autowired
|
||||
TaskHisService taskHisService;
|
||||
|
||||
@Autowired
|
||||
TaskDetHisService taskDetHisService;
|
||||
|
||||
@Autowired
|
||||
ApmsController apmsControl;
|
||||
|
||||
@Autowired
|
||||
WebSocketServer webSocketServer;
|
||||
@Autowired
|
||||
OrderInfoServiceBiz orderInfoServiceBiz;
|
||||
@Autowired
|
||||
@@ -85,6 +79,11 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
||||
CurrTaskDetServiceBiz currTaskDetServiceBiz;
|
||||
@Autowired
|
||||
InStockInfoServiceBiz inStockInfoServiceBiz;
|
||||
@Autowired
|
||||
TaskDetHisServiceBiz taskDetHisServiceBiz;
|
||||
@Autowired
|
||||
TaskHisServiceBiz taskHisServiceBiz;
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Override
|
||||
public CurrTaskVo getCurrTask(IdParam idParam) {
|
||||
@@ -136,6 +135,401 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
||||
return successful(new PageVo<>(page, CurrTaskQueryVo.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<CurrTaskInfoVo>> currentTaskInfoPage(CurrTaskQueryParam param) {
|
||||
QueryWrapper<CurrTask> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(CurrTask.VALID, 1);
|
||||
wrapper.in(CurrTask.STATUS, 0, 1);
|
||||
List<CurrTask> currTaskList = currTaskServiceBiz.list(wrapper);
|
||||
List<CurrTaskInfoVo> list = new ArrayList<>();
|
||||
for (CurrTask currTask : currTaskList
|
||||
) {
|
||||
CurrTaskInfoVo currTaskInfoVo = CurrTaskInfoVo.builder().build();
|
||||
//是否多步骤任务
|
||||
currTaskInfoVo.setIsAuto(currTask.getIsAuto());
|
||||
//任务状态
|
||||
if (currTask.getStatus() == 1) {
|
||||
currTaskInfoVo.setStatus(currTask.getStatus());
|
||||
} else if (currTask.getIsCache() == 1) {
|
||||
currTaskInfoVo.setStatus(2);
|
||||
} else {
|
||||
currTaskInfoVo.setStatus(0);
|
||||
}
|
||||
//生产单号
|
||||
if (currTask.getSheetNo() != null) {
|
||||
currTaskInfoVo.setSheetNo(currTask.getSheetNo());
|
||||
}
|
||||
currTaskInfoVo.setCreateTime(currTask.getCreateTime());
|
||||
//开始位置
|
||||
currTaskInfoVo.setStartPosition(currTask.getStartPosition());
|
||||
//currTask
|
||||
if (currTask.getIsAuto() == 1) {
|
||||
List<CurrTask> currTasks = currTaskServiceBiz
|
||||
.list(new QueryWrapper<CurrTask>()
|
||||
.eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId())
|
||||
.orderByAsc(CurrTask.ID));
|
||||
List<CurrTaskVo> currTaskVos = com.mt.wms.core.utils.BeanUtils.copyList(currTasks, CurrTaskVo.class);
|
||||
currTaskInfoVo.setCurrTaskVoList(currTaskVos);
|
||||
String allStep = "液压台";
|
||||
String nowStep = "未开始";
|
||||
for (CurrTask currTask1 : currTasks
|
||||
) {
|
||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask1.getId()));
|
||||
if (inStockInfo != null) {
|
||||
List<InStockInfoVo> inStockInfoVoList = new ArrayList<>();
|
||||
InStockInfoVo inStockInfoVo = InStockInfoVo.builder().build();
|
||||
BeanUtils.copyProperties(inStockInfo, inStockInfoVo);
|
||||
inStockInfoVoList.add(inStockInfoVo);
|
||||
currTaskInfoVo.setInStockInfoVoList(inStockInfoVoList);
|
||||
}
|
||||
if (currTask1.getStatus() == 1) {
|
||||
nowStep = currTask1.getTargetPosition();
|
||||
} else if (currTask1.getIsCache() == 1) {
|
||||
nowStep = currTask.getLocationName();
|
||||
}
|
||||
if (currTaskInfoVo.getInStockInfoVoList() != null) {
|
||||
if (currTaskInfoVo.getCurrTaskVoList().size() > 0) {
|
||||
|
||||
nowStep = currTaskInfoVo.getInStockInfoVoList().get(0).getLocationName();
|
||||
}
|
||||
}
|
||||
allStep = allStep.concat("->").concat(currTask1.getTargetPosition());
|
||||
}
|
||||
//
|
||||
currTaskInfoVo.setAllStep(allStep);
|
||||
currTaskInfoVo.setNowStep(nowStep);
|
||||
currTaskInfoVo.setAutoExeTaskId(currTask.getAutoExeTaskId());
|
||||
} else {
|
||||
currTaskInfoVo.setAllStep(currTask.getTargetPosition());
|
||||
if (currTask.getStatus() == 1) {
|
||||
currTaskInfoVo.setNowStep(currTask.getTargetPosition());
|
||||
} else if (currTask.getIsCache() == 1) {
|
||||
currTaskInfoVo.setNowStep(currTask.getLocationName());
|
||||
}
|
||||
currTaskInfoVo.setAutoExeTaskId(currTask.getId());
|
||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId()));
|
||||
if (inStockInfo != null) {
|
||||
List<InStockInfoVo> inStockInfoVoList = new ArrayList<>();
|
||||
InStockInfoVo inStockInfoVo = InStockInfoVo.builder().build();
|
||||
BeanUtils.copyProperties(inStockInfo, inStockInfoVo);
|
||||
inStockInfoVoList.add(inStockInfoVo);
|
||||
currTaskInfoVo.setInStockInfoVoList(inStockInfoVoList);
|
||||
}
|
||||
}
|
||||
//currTaskDet
|
||||
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId()));
|
||||
currTaskInfoVo.setCurrTaskDetVoList(com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class));
|
||||
for (CurrTaskDetVo currTaskDetVo : currTaskInfoVo.getCurrTaskDetVoList()
|
||||
) {
|
||||
String idenCardNum = currTaskDetVo.getIdenCardNum();
|
||||
OrderInfo orderInfo = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, idenCardNum));
|
||||
currTaskDetVo.setCustomer(orderInfo.getCustomerName());
|
||||
currTaskDetVo.setCraftIll(orderInfo.getCraftIll());
|
||||
currTaskDetVo.setProductModel(orderInfo.getProductModel());
|
||||
}
|
||||
list.add(currTaskInfoVo);
|
||||
}
|
||||
list = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CurrTaskInfoVo::getAutoExeTaskId))), ArrayList::new));
|
||||
|
||||
return successful(list);
|
||||
}
|
||||
|
||||
//获取未成功报工apms的任务,判定标准:没有生产单号,状态为完成
|
||||
@Override
|
||||
public R<List<CurrTaskInfoVo>> currentTaskInfoPageForNotToApms(CurrTaskQueryParam param) {
|
||||
QueryWrapper<CurrTask> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(CurrTask.VALID, 1);
|
||||
wrapper.in(CurrTask.STATUS, 2);
|
||||
wrapper.isNull(CurrTask.SHEET_NO);
|
||||
wrapper.between(CurrTask.CREATE_TIME, "2022-11-19 05:14:11", LocalDateTime.now());
|
||||
List<CurrTask> currTaskList = currTaskServiceBiz.list(wrapper);
|
||||
List<CurrTaskInfoVo> list = new ArrayList<>();
|
||||
for (CurrTask currTask : currTaskList
|
||||
) {
|
||||
CurrTaskInfoVo currTaskInfoVo = CurrTaskInfoVo.builder().build();
|
||||
//currTask
|
||||
if (currTask.getIsAuto() == 1) {
|
||||
|
||||
|
||||
currTaskInfoVo.setAutoExeTaskId(currTask.getAutoExeTaskId());
|
||||
List<CurrTask> currTasks = currTaskServiceBiz
|
||||
.list(new QueryWrapper<CurrTask>()
|
||||
.eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId())
|
||||
.orderByAsc(CurrTask.ID));
|
||||
List<CurrTaskVo> currTaskVos = com.mt.wms.core.utils.BeanUtils.copyList(currTasks, CurrTaskVo.class);
|
||||
currTaskInfoVo.setCurrTaskVoList(currTaskVos);
|
||||
String allStep = "";
|
||||
for (CurrTask currTask1 : currTasks
|
||||
) {
|
||||
|
||||
allStep = allStep.concat("->").concat(currTask1.getTargetPosition());
|
||||
}
|
||||
currTaskInfoVo.setAllStep(allStep);
|
||||
} else {
|
||||
currTaskInfoVo.setAllStep(currTask.getTargetPosition());
|
||||
}
|
||||
//currTaskDet
|
||||
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId()));
|
||||
currTaskInfoVo.setCurrTaskDetVoList(com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class));
|
||||
for (CurrTaskDetVo currTaskDetVo : currTaskInfoVo.getCurrTaskDetVoList()
|
||||
) {
|
||||
String idenCardNum = currTaskDetVo.getIdenCardNum();
|
||||
OrderInfo orderInfo = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, idenCardNum));
|
||||
currTaskDetVo.setCustomer(orderInfo.getCustomerName());
|
||||
currTaskDetVo.setCraftIll(orderInfo.getCraftIll());
|
||||
currTaskDetVo.setProductModel(orderInfo.getProductModel());
|
||||
}
|
||||
list.add(currTaskInfoVo);
|
||||
}
|
||||
list = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CurrTaskInfoVo::getAutoExeTaskId))), ArrayList::new));
|
||||
|
||||
return successful(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<String> oneStepToApms(CurrTaskInfoVo currTaskInfoVo) {
|
||||
List<CurrTaskDetVo> currTaskDetVoList = currTaskInfoVo.getCurrTaskDetVoList();
|
||||
List<CurrTaskVo> currTaskVoList = currTaskInfoVo.getCurrTaskVoList();
|
||||
//报工apms
|
||||
List<CurrTaskDet> currTaskDetList = com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetVoList, CurrTaskDet.class);
|
||||
List<CurrTask> currTasks = com.mt.wms.core.utils.BeanUtils.copyList(currTaskVoList, CurrTask.class);
|
||||
for (CurrTask currTask1 : currTasks
|
||||
) {
|
||||
if (currTask1.getIsAuto() == 1) {
|
||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTaskInfoVo.getAutoExeTaskId());
|
||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask1.getKilnId());
|
||||
//加工炉为BMA或BMB时上报apms,其他的不需要上报
|
||||
if (kilnInfo.getType() == 1 || kilnInfo.getType() == 3) {
|
||||
if (currTask1.getStoveCode() == null) {
|
||||
return failed("该任务没有正常进炉加工生成炉号,不能上报apms!");
|
||||
}
|
||||
//通知apms创建一个生产单
|
||||
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
|
||||
apmsCreateSheet.setWorkShopCode("BM");
|
||||
apmsCreateSheet.setStartTime(currTask1.getBeginTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
apmsCreateSheet.setTechCode(currTask1.getCraftCodeId().toString());
|
||||
//fixme 暂时没有正式user,使用测试账户
|
||||
apmsCreateSheet.setStartUser("QJJP03");
|
||||
ArrayList<CreateItem> createItems = new ArrayList<>();
|
||||
currTaskDetList.forEach(e -> {
|
||||
CreateItem createItem = new CreateItem();
|
||||
createItem.setItemCode(e.getIdenCardNum());
|
||||
createItem.setQuantity(e.getQuantity().intValue());
|
||||
BigDecimal b = new BigDecimal(String.valueOf(e.getWeight()));
|
||||
createItem.setWeight(b.doubleValue());
|
||||
createItems.add(createItem);
|
||||
});
|
||||
//apmsCreateSheet.setStoveCode(code);
|
||||
if (currTask1.getStoveCode() != null) {
|
||||
apmsCreateSheet.setStoveCode(currTask1.getStoveCode());
|
||||
}
|
||||
apmsCreateSheet.setItems(createItems);
|
||||
logger.info(currTask1.getId() + "开始创建apms生产单号-手动上报");
|
||||
R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
|
||||
if (!processSheet.getData().getSuccess()) {
|
||||
logger.info(currTask1.getId() + "创建失败,APMS报错:" + processSheet.getData().getMsg());
|
||||
return failed(processSheet.getData().getMsg());
|
||||
} else {
|
||||
logger.info(currTask1.getId() + "创建apms生产单号成功");
|
||||
currTask1.setSheetNo(processSheet.getData().getSheetNo());
|
||||
currTaskServiceBiz.updateById(currTask1);
|
||||
//多步骤任务除了第一步写入sheetNo
|
||||
if (currTask1.getIsAuto() == 1) {
|
||||
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
|
||||
secondCurrTask.setSheetNo(currTask1.getSheetNo());
|
||||
currTaskServiceBiz.updateById(secondCurrTask);
|
||||
//三步任务
|
||||
if (autoExeTask.getProcessFlowType() == 2) {
|
||||
CurrTask threeCurrTask = currTaskServiceBiz.getById(autoExeTask.getThTaskId());
|
||||
threeCurrTask.setSheetNo(currTask1.getSheetNo());
|
||||
currTaskServiceBiz.updateById(threeCurrTask);
|
||||
}
|
||||
}
|
||||
return successful("上报APMS成功");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//通知apms创建一个生产单
|
||||
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
|
||||
apmsCreateSheet.setWorkShopCode("BM");
|
||||
apmsCreateSheet.setStartTime(currTask1.getBeginTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
apmsCreateSheet.setTechCode(currTask1.getCraftCodeId().toString());
|
||||
//fixme 暂时没有正式user,使用测试账户
|
||||
apmsCreateSheet.setStartUser("QJJP03");
|
||||
ArrayList<CreateItem> createItems = new ArrayList<>();
|
||||
currTaskDetList.forEach(e -> {
|
||||
CreateItem createItem = new CreateItem();
|
||||
createItem.setItemCode(e.getIdenCardNum());
|
||||
createItem.setQuantity(e.getQuantity().intValue());
|
||||
BigDecimal b = new BigDecimal(String.valueOf(e.getWeight()));
|
||||
createItem.setWeight(b.doubleValue());
|
||||
createItems.add(createItem);
|
||||
});
|
||||
//apmsCreateSheet.setStoveCode(code);
|
||||
if (currTask1.getStoveCode() != null) {
|
||||
apmsCreateSheet.setStoveCode(currTask1.getStoveCode());
|
||||
}
|
||||
apmsCreateSheet.setItems(createItems);
|
||||
logger.info(currTask1.getId() + "开始创建apms生产单号-手动上报");
|
||||
R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
|
||||
if (!processSheet.getData().getSuccess()) {
|
||||
logger.info(currTask1.getId() + "创建失败,APMS报错:" + processSheet.getData().getMsg());
|
||||
return failed(processSheet.getData().getMsg());
|
||||
} else {
|
||||
logger.info(currTask1.getId() + "创建apms生产单号成功");
|
||||
currTask1.setSheetNo(processSheet.getData().getSheetNo());
|
||||
currTaskServiceBiz.updateById(currTask1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<String> updateCurrTaskStatus(CurrTaskParam param) {
|
||||
CurrTask currTask = currTaskServiceBiz.getById(param.getId());
|
||||
Integer status = param.getStatus();
|
||||
Long kilnId = param.getKilnId();
|
||||
//修改任务状态
|
||||
if (!status.equals(currTask.getStatus())) {
|
||||
//修改为加工中,多步骤任务修改为加工中,查询缓存区,查询前置任务状态,并修改
|
||||
if (status == 1) {
|
||||
currTask.setStatus(1);
|
||||
currTask.setIsIn(1);
|
||||
currTask.setUpdaterId(99);
|
||||
currTask.setUpdateTime(LocalDateTime.now());
|
||||
currTask.setBeginTime(LocalDateTime.now());
|
||||
//生产炉号
|
||||
createStoveCode(currTask);
|
||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId()));
|
||||
if (inStockInfo != null) {
|
||||
//更新库位状态为未占用
|
||||
Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
|
||||
location.setStatus(0);
|
||||
locationServiceBiz.updateById(location);
|
||||
//删除库位缓存
|
||||
inStockInfoServiceBiz.removeById(inStockInfo);
|
||||
}
|
||||
if (currTask.getIsAuto() == 1) {
|
||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId());
|
||||
if (currTask.getId().equals(autoExeTask.getFTaskId())) {
|
||||
//该任务为自动任务第一条,是否有sheetNo,若无上报apms
|
||||
if (currTask.getSheetNo() == null) {
|
||||
try {
|
||||
apmsCreateProcess(currTask);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currTask.getId().equals(autoExeTask.getTTaskId())) {
|
||||
//该任务为自动任务第二条,修改自动任务第一条的状态
|
||||
CurrTask currTask1 = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
|
||||
currTask1.setStatus(2);
|
||||
currTask1.setIsIn(2);
|
||||
//99代表该条记录手动修改过
|
||||
currTask1.setUpdaterId(99);
|
||||
currTask1.setUpdateTime(LocalDateTime.now());
|
||||
currTaskServiceBiz.updateById(currTask1);
|
||||
apmsEndProcess(currTask1);
|
||||
apmsStartProcess(currTask);
|
||||
} else if (currTask.getId().equals(autoExeTask.getThTaskId())) {
|
||||
//该任务为自动任务第三条,修改自动任务第二条的状态
|
||||
CurrTask currTask2 = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
|
||||
currTask2.setStatus(2);
|
||||
currTask2.setIsIn(2);
|
||||
//99代表该条记录手动修改过
|
||||
currTask2.setUpdaterId(99);
|
||||
currTask2.setUpdateTime(LocalDateTime.now());
|
||||
currTaskServiceBiz.updateById(currTask2);
|
||||
apmsEndProcess(currTask2);
|
||||
apmsStartProcess(currTask);
|
||||
}
|
||||
}
|
||||
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
logger.info("修改任务" + currTask.getId() + "状态为加工中成功");
|
||||
}
|
||||
//修改为加工完成,查询缓存,并修改
|
||||
if (status == 2) {
|
||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId()));
|
||||
if (inStockInfo != null) {
|
||||
//更新库位状态为未占用
|
||||
Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
|
||||
location.setStatus(0);
|
||||
locationServiceBiz.updateById(location);
|
||||
//删除库位缓存
|
||||
inStockInfoServiceBiz.removeById(inStockInfo);
|
||||
|
||||
}
|
||||
currTask.setStatus(1);
|
||||
currTask.setCreatorId(99);
|
||||
currTask.setBeginTime(LocalDateTime.now());
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
logger.info("修改任务" + currTask.getId() + "状态为加工完成成功");
|
||||
//存入历史任务表以便查询能源消耗
|
||||
TaskHis taskHis = new TaskHis();
|
||||
org.springframework.beans.BeanUtils.copyProperties(currTask, taskHis);
|
||||
taskHis.setStatus(2);
|
||||
taskHis.setIsIn(2);
|
||||
taskHis.setTaskId(currTask.getId());
|
||||
taskHisServiceBiz.save(taskHis);
|
||||
List<CurrTaskDet> currTaskDets = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId()));
|
||||
List<TaskDetHis> taskDetHisList = com.mt.wms.core.utils.BeanUtils.copyList(currTaskDets, TaskDetHis.class);
|
||||
taskDetHisServiceBiz.saveBatch(taskDetHisList);
|
||||
}
|
||||
currTask.setStatus(status);
|
||||
currTask.setCreatorId(99);
|
||||
currTask.setBeginTime(LocalDateTime.now());
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
logger.info("修改任务" + currTask.getId() + "状态为未加工成功");
|
||||
}
|
||||
//修改目标加工炉
|
||||
if (!kilnId.equals(currTask.getKilnId())) {
|
||||
KilnInfo kiln = kilnInfoServiceBiz.getById(kilnId);
|
||||
//修改目标加工炉,修改终点
|
||||
currTask.setKilnId(kilnId);
|
||||
currTask.setTargetPosition(kiln.getCode());
|
||||
currTask.setUpdaterId(99);
|
||||
currTask.setUpdateTime(LocalDateTime.now());
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId()));
|
||||
//是否存在缓存
|
||||
if (inStockInfo != null) {
|
||||
//修改缓存后目标加工炉
|
||||
inStockInfo.setKilnId(kilnId);
|
||||
inStockInfo.setKilnName(kiln.getKilnName());
|
||||
inStockInfo.setUpdaterId(99);
|
||||
inStockInfo.setUpdateTime(LocalDateTime.now());
|
||||
inStockInfoServiceBiz.updateById(inStockInfo);
|
||||
}
|
||||
//任务为多步骤任务
|
||||
if (currTask.getIsAuto() == 1) {
|
||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId());
|
||||
//任务为多步骤任务第一步
|
||||
if (currTask.getId().equals(autoExeTask.getFTaskId())) {
|
||||
//修改多步骤第二步的起点
|
||||
CurrTask currTask2 = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
|
||||
currTask2.setStartPosition(kiln.getCode());
|
||||
currTask2.setUpdateTime(LocalDateTime.now());
|
||||
currTask2.setUpdaterId(99);
|
||||
currTaskServiceBiz.updateById(currTask2);
|
||||
} else if (currTask.getId().equals(autoExeTask.getTTaskId())) {
|
||||
//任务为多步骤任务第二步且有第三步,修改第三步起点
|
||||
if (autoExeTask.getProcessFlowType() == 2) {
|
||||
CurrTask currTask3 = currTaskServiceBiz.getById(autoExeTask.getThTaskId());
|
||||
currTask3.setStartPosition(kiln.getCode());
|
||||
currTask3.setUpdateTime(LocalDateTime.now());
|
||||
currTask3.setUpdaterId(99);
|
||||
currTaskServiceBiz.updateById(currTask3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return successful("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public R<String> completeTask(IdParam param) {
|
||||
CurrTask byId = currTaskServiceBiz.getById(param.getId());
|
||||
@@ -188,7 +582,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
||||
}
|
||||
if (currTask.getStatus() == 2) {
|
||||
return failed("无法删除,任务已加工完成。");
|
||||
}if (currTask.getStatus()==1){
|
||||
}
|
||||
if (currTask.getStatus() == 1) {
|
||||
return failed("无法删除,任务正在执行中。");
|
||||
}
|
||||
}
|
||||
@@ -198,8 +593,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
||||
) {
|
||||
if (currTask.getStatus() == 0) {
|
||||
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
|
||||
if (apmsStartProcessR.getData().getSuccess())
|
||||
{
|
||||
if (apmsStartProcessR.getData().getSuccess()) {
|
||||
Long currTaskId = currTask.getId();
|
||||
if (currTask.getIsAuto() == 1) {
|
||||
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
|
||||
@@ -216,15 +610,14 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
||||
}
|
||||
}
|
||||
return successful(0, "APMS生产单删除成功。", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return failed(apmsStartProcessR.getData().getMsg());
|
||||
}
|
||||
}
|
||||
if (currTask.getStatus() == 2) {
|
||||
return failed("无法删除,任务已加工完成。");
|
||||
}if (currTask.getStatus()==1){
|
||||
}
|
||||
if (currTask.getStatus() == 1) {
|
||||
return failed("无法删除,任务正在执行中。");
|
||||
}
|
||||
|
||||
@@ -249,6 +642,13 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
||||
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
|
||||
for (CurrTask currTask1 : currTaskList
|
||||
) {
|
||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask1.getId()));
|
||||
if (inStockInfo != null) {
|
||||
Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
|
||||
location.setStatus(0);
|
||||
locationServiceBiz.updateById(location);
|
||||
inStockInfoServiceBiz.removeById(inStockInfo);
|
||||
}
|
||||
currTaskDetServiceBiz.remove(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask1.getId()));
|
||||
currTaskServiceBiz.removeById(currTask1);
|
||||
}
|
||||
@@ -299,6 +699,12 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
||||
@Override
|
||||
public R runTask(Long taskId) throws InterruptedException, IOException {
|
||||
CurrTask currTask = currTaskServiceBiz.getById(taskId);
|
||||
if (currTask.getStatus() != 0) {
|
||||
return R.failed("该任务状态不为未执行,无法执行!");
|
||||
}
|
||||
if (currTask.getCacheSatatus()==2&&currTask.getIsCache()==1){
|
||||
return R.failed("该任务已在缓存队列,状态不为未执行,无法执行!");
|
||||
}
|
||||
//是否为自动任务
|
||||
if (currTask.getIsAuto() == 1) {
|
||||
List<AutoExeTask> exeTaskList = autoExeTaskServiceBiz.list(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, taskId));
|
||||
@@ -316,6 +722,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
||||
|
||||
/**
|
||||
* 传入任务id,查询任务炉子,然后根据炉子查询等待列表,然后时间置为早
|
||||
*
|
||||
* @param idParam
|
||||
* @return
|
||||
*/
|
||||
@@ -330,7 +737,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
||||
List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>()
|
||||
.eq(InStockInfo.KILN_ID, kilnId)
|
||||
.eq(InStockInfo.TYPE, 1)
|
||||
.eq(InStockInfo.STATUS,0)
|
||||
.eq(InStockInfo.STATUS, 2)
|
||||
.orderByAsc(InStockInfo.IN_TIME));
|
||||
|
||||
if (inStockInfoList.size() < 2) {
|
||||
@@ -343,4 +750,134 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
||||
inStockInfoServiceBiz.updateById(inStockInfo);
|
||||
return R.ok("当前任务置顶成功", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报apms创建生产单并开始处理
|
||||
*
|
||||
* @param currTask 任务
|
||||
* @return 成功与否
|
||||
* @throws IOException
|
||||
*/
|
||||
private Boolean apmsCreateProcess(CurrTask currTask) throws IOException {
|
||||
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId()));
|
||||
String code = kilnInfoServiceBiz.getById(currTask.getKilnId()).getCode();
|
||||
//通知apms创建一个生产单
|
||||
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
|
||||
apmsCreateSheet.setWorkShopCode("BM");
|
||||
apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
apmsCreateSheet.setTechCode(currTask.getCraftCodeId().toString());
|
||||
//fixme 暂时没有正式user,使用测试账户
|
||||
apmsCreateSheet.setStartUser("QJJP03");
|
||||
ArrayList<CreateItem> createItems = new ArrayList<>();
|
||||
currTaskDetList.forEach(e -> {
|
||||
CreateItem createItem = new CreateItem();
|
||||
createItem.setItemCode(e.getIdenCardNum());
|
||||
createItem.setQuantity(e.getQuantity().intValue());
|
||||
createItem.setWeight(e.getWeight().doubleValue());
|
||||
createItems.add(createItem);
|
||||
});
|
||||
apmsCreateSheet.setStoveCode(code);
|
||||
apmsCreateSheet.setItems(createItems);
|
||||
logger.info(currTask.getId() + "开始创建apms生产单号");
|
||||
R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
|
||||
if (!processSheet.getData().getSuccess()) {
|
||||
logger.info(currTask.getId() + "创建失败,APMS报错:" + processSheet.getData().getMsg());
|
||||
webSocketServer.sendtoUser("创建失败,APMS报错:" + processSheet.getData().getMsg(), "1");
|
||||
return false;
|
||||
} else {
|
||||
logger.info(currTask.getId() + "创建apms生产单号成功");
|
||||
currTask.setSheetNo(processSheet.getData().getSheetNo());
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
//多步骤任务除了第一步写入sheetNo
|
||||
if (currTask.getIsAuto() == 1) {
|
||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId());
|
||||
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
|
||||
secondCurrTask.setSheetNo(currTask.getSheetNo());
|
||||
currTaskServiceBiz.updateById(secondCurrTask);
|
||||
//三步任务
|
||||
if (autoExeTask.getProcessFlowType() == 2) {
|
||||
CurrTask threeCurrTask = currTaskServiceBiz.getById(autoExeTask.getThTaskId());
|
||||
threeCurrTask.setSheetNo(currTask.getSheetNo());
|
||||
currTaskServiceBiz.updateById(threeCurrTask);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 上报apms开始加工
|
||||
*
|
||||
* @param currTask
|
||||
* @return
|
||||
*/
|
||||
private Boolean apmsStartProcess(CurrTask currTask) {
|
||||
String code = kilnInfoServiceBiz.getById(currTask.getKilnId()).getCode();
|
||||
ApmsStartProcess apmsStartProcess = new ApmsStartProcess();
|
||||
apmsStartProcess.setStartUser("QJJP03");
|
||||
apmsStartProcess.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
apmsStartProcess.setTechName(currTask.getCraftCodeId().toString());
|
||||
apmsStartProcess.setSheetNo(currTask.getSheetNo());
|
||||
if (currTask.getStoveCode() != null) {
|
||||
apmsStartProcess.setStoveCode(currTask.getStoveCode());
|
||||
}
|
||||
|
||||
R<ApmsStartProcess> apmsStartProcessR = apmsControl.startProcess(apmsStartProcess);
|
||||
if (apmsStartProcessR.getCode() != 0) {
|
||||
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms失败");
|
||||
return false;
|
||||
}
|
||||
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms成功");
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报apms-end
|
||||
*
|
||||
* @param currTask
|
||||
* @return
|
||||
*/
|
||||
private Boolean apmsEndProcess(CurrTask currTask) {
|
||||
ApmsEndProcess apmsEndProcess = new ApmsEndProcess();
|
||||
LocalDateTime date=LocalDateTime.now();
|
||||
if (currTask.getEndTime()!=null){
|
||||
date=currTask.getEndTime();
|
||||
}
|
||||
apmsEndProcess.setEndTime(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
apmsEndProcess.setEndUser("QJJP03");
|
||||
apmsEndProcess.setSheetNo(currTask.getSheetNo());
|
||||
R<ApmsEndProcessVo> apmsEndProcessVoR = apmsControl.endProcess(apmsEndProcess);
|
||||
if (apmsEndProcessVoR.getCode() != 0) {
|
||||
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单完成处理上报apms失败");
|
||||
return false;
|
||||
}
|
||||
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单完成处理上报apms成功");
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 生成炉号
|
||||
* 多步骤任务除了第一步为清洗炉外,每步都生成炉号
|
||||
* 单步骤任务都生成炉号
|
||||
*/
|
||||
private void createStoveCode(CurrTask currTask) {
|
||||
//单步骤任务,直接生成炉号
|
||||
if (currTask.getIsAuto() == 0) {
|
||||
String stoveCode = StoveCodeUtils.getStoveCode(currTask.getTargetPosition(), currTask.getPlcValue());
|
||||
currTask.setStoveCode(stoveCode);
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
return;
|
||||
}
|
||||
//多步骤任务,只有BMA,BMB步骤生成炉号
|
||||
else {
|
||||
//获取加工炉
|
||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
|
||||
//只有BMA,BMB生成炉号
|
||||
if (kilnInfo.getType() == 1 || kilnInfo.getType() == 3) {
|
||||
String stoveCode = StoveCodeUtils.getStoveCode(currTask.getTargetPosition(), currTask.getPlcValue());
|
||||
currTask.setStoveCode(stoveCode);
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
} else {
|
||||
logger.info(currTask.getId() + "任务为多步骤任务但该步骤不生成洗炉炉号.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.mt.wms.empty.service.impl;
|
||||
|
||||
import com.mt.wms.core.base.BaseService;
|
||||
import com.mt.wms.core.dal.entity.CurrTask;
|
||||
import com.mt.wms.core.dal.service.CurrTaskServiceBiz;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.mapper.EleMapper;
|
||||
import com.mt.wms.empty.service.EleService;
|
||||
import com.mt.wms.empty.vo.CountEleVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: LGH
|
||||
* @Date: 2022/12/27
|
||||
*/
|
||||
@Service
|
||||
public class EleServiceImpl extends BaseService implements EleService {
|
||||
|
||||
@Resource
|
||||
EleMapper eleMapper;
|
||||
@Resource
|
||||
CurrTaskServiceBiz currTaskServiceBiz;
|
||||
|
||||
@Override
|
||||
public R list(Long kilnId) {
|
||||
List<CountEleVo> list = eleMapper.list(kilnId);
|
||||
for (CountEleVo countEleVo:list
|
||||
) {
|
||||
CurrTask currTask = currTaskServiceBiz.getById(countEleVo.getTaskId());
|
||||
if (currTask.getStoveCode()==null){
|
||||
if (currTask.getSheetNo()!=null){
|
||||
currTask.setStoveCode(currTask.getSheetNo());
|
||||
}else {
|
||||
currTask.setStoveCode(currTask.getTaskCode());
|
||||
}
|
||||
|
||||
}
|
||||
countEleVo.setStoveCode(currTask.getStoveCode());
|
||||
countEleVo.setCreateTime(currTask.getCreateTime());
|
||||
}
|
||||
return successful(list);
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,9 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
||||
QueryWrapper<OrderInfo> wrapper = new QueryWrapper<>();
|
||||
wrapper.like(StringUtils.isNotBlank(param.getIdenCardNum()), OrderInfo.IDEN_CARD_NUM, param.getIdenCardNum())
|
||||
.like(StringUtils.isNotBlank(param.getOrderNo()), OrderInfo.ORDER_NO, param.getOrderNo())
|
||||
.like(StringUtils.isNotBlank(param.getCustomerName()),OrderInfo.CUSTOMER_NAME,param.getCustomerName())
|
||||
.in(OrderInfo.STATUS,0,1)
|
||||
.eq(OrderInfo.ORDER_VOID,1)
|
||||
.orderByDesc(OrderInfo.CREATE_TIME);
|
||||
Page<OrderInfo> page = orderInfoService.page(new Page<>(param.getCurrent(), param.getSize()), wrapper);
|
||||
PageVo<OrderInfoVo> orderInfoVoPageVo = new PageVo<>(page, OrderInfoVo.class);
|
||||
@@ -165,7 +167,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
||||
BeanUtils.copyProperties(byId, build);
|
||||
R<OrderInfoVo> info = getTaskInfoByIdenCardNum(build.getIdenCardNum());
|
||||
build.setFinishWeight(info.getData().getFinishWeight());
|
||||
build.setFinishQuantity(info.getData().getQuantity());
|
||||
build.setFinishQuantity(info.getData().getFinishQuantity());
|
||||
build.setWaitWeight(info.getData().getWaitWeight());
|
||||
build.setWaitQuantity(info.getData().getWaitQuantity());
|
||||
build.setReProcessQuantity(info.getData().getReProcessQuantity());
|
||||
@@ -218,7 +220,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
||||
@Override
|
||||
public R<OrderInfoVo> getTaskInfoByIdenCardNum(String idenCardNum) {
|
||||
QueryWrapper<OrderInfo> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(OrderInfo.IDEN_CARD_NUM, idenCardNum).eq(OrderInfo.VALID, 1);
|
||||
wrapper.eq(OrderInfo.IDEN_CARD_NUM, idenCardNum).eq(OrderInfo.VALID, 1).eq(OrderInfo.ORDER_VOID,1);
|
||||
OrderInfo one = orderInfoService.getOne(wrapper);
|
||||
Assert.notNull("未找到该标识卡信息!", one);
|
||||
OrderInfoVo build = OrderInfoVo.builder().build();
|
||||
@@ -260,7 +262,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
||||
for (TaskCreateDetParam detParam : detParams)
|
||||
{
|
||||
QueryWrapper<OrderInfo> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(OrderInfo.IDEN_CARD_NUM, detParam.getIdenCardNum()).eq(OrderInfo.VALID, 1);
|
||||
wrapper.eq(OrderInfo.IDEN_CARD_NUM, detParam.getIdenCardNum()).eq(OrderInfo.VALID, 1).eq(OrderInfo.ORDER_VOID,1);
|
||||
OrderInfo one = orderInfoService.getOne(wrapper);
|
||||
Assert.notNull("错误,标识卡号" + detParam.getIdenCardNum() + "在订单中不存在!", one);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,7 @@ package com.mt.wms.empty.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mt.wms.core.base.BaseService;
|
||||
import com.mt.wms.core.dal.entity.CurrTaskDet;
|
||||
import com.mt.wms.core.dal.entity.InStockInfo;
|
||||
import com.mt.wms.core.dal.entity.Location;
|
||||
import com.mt.wms.core.dal.entity.OrderInfo;
|
||||
import com.mt.wms.core.dal.entity.*;
|
||||
import com.mt.wms.core.dal.service.CurrTaskDetServiceBiz;
|
||||
import com.mt.wms.core.dal.service.InStockInfoServiceBiz;
|
||||
import com.mt.wms.core.dal.service.LocationServiceBiz;
|
||||
@@ -21,6 +18,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -76,4 +74,24 @@ public class StockInfoServiceImpl extends BaseService implements StockInfoServic
|
||||
}
|
||||
return successful(stockInfoVoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<String> top(IdParam idParam) {
|
||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getById(idParam.getId());
|
||||
Long kilnId = inStockInfo.getKilnId();
|
||||
List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>()
|
||||
.eq(InStockInfo.KILN_ID, kilnId)
|
||||
.eq(InStockInfo.TYPE,1)
|
||||
.eq(InStockInfo.STATUS,2)
|
||||
.orderByAsc(InStockInfo.IN_TIME));
|
||||
|
||||
if (inStockInfoList.size()<2){
|
||||
return R.failed("当前加工炉等待队列只有一个任务,无需置顶");
|
||||
}
|
||||
LocalDateTime inTime=null;
|
||||
inTime = inStockInfoList.get(0).getInTime();
|
||||
inStockInfo.setInTime(inTime.minusHours(1));
|
||||
inStockInfoServiceBiz.updateById(inStockInfo);
|
||||
return R.ok("当前任务置顶成功","");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class TaskDetHisServiceImpl extends BaseService implements TaskDetHisServ
|
||||
//如果是多步骤任务且不是第一步,移除对象
|
||||
if (byId.getIsAuto()==1){
|
||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(byId.getAutoExeTaskId());
|
||||
if (!byId.getId().equals(autoExeTask.getFTaskId())){
|
||||
if (!byId.getTaskId().equals(autoExeTask.getFTaskId())){
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
//更新小车状态
|
||||
@@ -203,7 +205,7 @@ public class AsynRunTaskService extends BaseService {
|
||||
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
|
||||
//执行成功,托盘进炉
|
||||
if (status == 1) {
|
||||
|
||||
logger.info(String.valueOf(status));
|
||||
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
|
||||
//更新调度表状态为完成
|
||||
runTask.setUpdateTime(LocalDateTime.now());
|
||||
@@ -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);
|
||||
@@ -286,6 +290,7 @@ public class AsynRunTaskService extends BaseService {
|
||||
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
|
||||
//Location location = locationServiceBiz.getById(currTask.getLocationId());
|
||||
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
|
||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
|
||||
//检查车辆是否冲突,冲突则避让
|
||||
rgvStatus(vehicleId, currTask, currTask.getStartPosition(), location.getCode());
|
||||
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
|
||||
@@ -305,7 +310,7 @@ public class AsynRunTaskService extends BaseService {
|
||||
inStockInfo.setTaskId(currTask.getId());
|
||||
inStockInfo.setTaskCode(currTask.getTaskCode());
|
||||
inStockInfo.setKilnId(currTask.getKilnId());
|
||||
inStockInfo.setKilnName(currTask.getKilnName());
|
||||
inStockInfo.setKilnName(kilnInfo.getKilnName());
|
||||
inStockInfo.setLocationId(location.getId());
|
||||
inStockInfo.setLocationName(location.getLocationNameAlias());
|
||||
inStockInfo.setType(1);
|
||||
@@ -316,6 +321,7 @@ public class AsynRunTaskService extends BaseService {
|
||||
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
||||
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
|
||||
if (status == 1) {
|
||||
logger.info(String.valueOf(status));
|
||||
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
|
||||
//更新关系表状态为完成
|
||||
runTask.setUpdateTime(LocalDateTime.now());
|
||||
@@ -324,6 +330,9 @@ public class AsynRunTaskService extends BaseService {
|
||||
runTaskServiceBiz.updateById(runTask);
|
||||
//更新currTask表
|
||||
currTask.setCacheSatatus(2);
|
||||
currTask.setIsCache(1);
|
||||
currTask.setLocationId(location.getId());
|
||||
currTask.setLocationName(location.getLocationName());
|
||||
currTask.setUpdateTime(LocalDateTime.now());
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
//更新in_stock_info表
|
||||
@@ -412,6 +421,7 @@ public class AsynRunTaskService extends BaseService {
|
||||
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
||||
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
|
||||
if (status == 1) {
|
||||
logger.info(String.valueOf(status));
|
||||
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
|
||||
//更新关系表状态为完成
|
||||
runTask.setUpdateTime(LocalDateTime.now());
|
||||
@@ -481,6 +491,7 @@ public class AsynRunTaskService extends BaseService {
|
||||
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从工业炉到缓存区过程中失败。");
|
||||
}
|
||||
}
|
||||
|
||||
//出库。起点为加工炉,终点为提升台
|
||||
@Async("asyncServiceExecutor")
|
||||
public void asynRunOutStockForKilnToYYT(Long currTaskId, String yeyaTaiCode, Long vehicleId) throws IOException {
|
||||
@@ -496,15 +507,15 @@ public class AsynRunTaskService extends BaseService {
|
||||
//两辆小车是否冲突
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, kilnInfo.getCode(), yeyaTaiCode, rgv2CurrPosition);
|
||||
if (conflictBoolean) {
|
||||
Integer status = moveRgv(2, 1L, 2, 0);
|
||||
Integer status = moveRgv(2, 1L, 1, 0);
|
||||
logger.info(status.toString());
|
||||
if (status != 1) {
|
||||
logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2,执行失败===");
|
||||
logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位1,执行失败===");
|
||||
// 2022/3/6 websocket通知页面
|
||||
webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2,执行失败");
|
||||
} else {
|
||||
|
||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2,执行成功===");
|
||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位1,执行成功===");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -546,6 +557,7 @@ public class AsynRunTaskService extends BaseService {
|
||||
Integer status = sendTaskToRgv(vehicleId, 0L, startPoint, endPoint, 0);
|
||||
logger.info(status.toString());
|
||||
if (status == 1) {
|
||||
logger.info(String.valueOf(status));
|
||||
logger.info("===执行任务出库任务,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
|
||||
//更新调度任务表状态为完成
|
||||
runTask.setUpdateTime(LocalDateTime.now());
|
||||
@@ -578,6 +590,7 @@ public class AsynRunTaskService extends BaseService {
|
||||
webSocketServer.sendtoAll("出库任务车辆从加工炉到提升平台过程中失败。");
|
||||
}
|
||||
}
|
||||
|
||||
//出库。起点为缓存区库位,终点为提升台
|
||||
@Async("asyncServiceExecutor")
|
||||
public void asynRunOutStock(Long locationId, String yeyaTaiCode, Long vehicleId) throws IOException {
|
||||
@@ -593,14 +606,14 @@ public class AsynRunTaskService extends BaseService {
|
||||
//两辆小车是否冲突
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(), yeyaTaiCode, rgv2CurrPosition);
|
||||
if (conflictBoolean) {
|
||||
Integer status = moveRgv(2, 1L, 2, 0);
|
||||
Integer status = moveRgv(2, 1L, 1, 0);
|
||||
if (status != 1) {
|
||||
logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位39,执行失败===");
|
||||
logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1,执行失败===");
|
||||
// 2022/3/6 websocket通知页面
|
||||
webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位39,执行失败");
|
||||
return;
|
||||
}
|
||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位39,执行成功===");
|
||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1,执行成功===");
|
||||
}
|
||||
} else {
|
||||
logger.info("RGV2不在线,跳过检测是否避让。");
|
||||
@@ -616,12 +629,12 @@ public class AsynRunTaskService extends BaseService {
|
||||
if (conflictBoolean) {
|
||||
Integer status = moveRgv(1, 1L, 12, 0);
|
||||
if (status != 1) {
|
||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1,执行失败===");
|
||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位12,执行失败===");
|
||||
// 2022/3/6 websocket通知页面
|
||||
webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1,执行失败");
|
||||
return;
|
||||
}
|
||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1,执行成功===");
|
||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位12,执行成功===");
|
||||
}
|
||||
} else {
|
||||
logger.info("RGV1不在线,跳过检测是否避让。");
|
||||
@@ -645,6 +658,7 @@ public class AsynRunTaskService extends BaseService {
|
||||
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
||||
Integer status = sendTaskToRgv(vehicleId, 0L, startPoint, endPoint, 0);
|
||||
if (status == 1) {
|
||||
logger.info(String.valueOf(status));
|
||||
logger.info("===执行任务出库任务,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
|
||||
//更新调度任务表状态为完成
|
||||
runTask.setUpdateTime(LocalDateTime.now());
|
||||
@@ -1197,6 +1211,35 @@ public class AsynRunTaskService extends BaseService {
|
||||
return Integer.parseInt(String.valueOf(jsonObject.get("msg")));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成炉号
|
||||
* 多步骤任务除了第一步为清洗炉外,每步都生成炉号
|
||||
* 单步骤任务都生成炉号
|
||||
*/
|
||||
private void createStoveCode(CurrTask currTask) {
|
||||
//单步骤任务,直接生成炉号
|
||||
if (currTask.getIsAuto() == 0) {
|
||||
String stoveCode = StoveCodeUtils.getStoveCode(currTask.getTargetPosition(), currTask.getPlcValue());
|
||||
currTask.setStoveCode(stoveCode);
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
return;
|
||||
}
|
||||
//多步骤任务,只有BMA,BMB步骤生成炉号
|
||||
else {
|
||||
//获取加工炉
|
||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
|
||||
//只有BMA,BMB生成炉号
|
||||
if (kilnInfo.getType() == 1 || kilnInfo.getType() == 3) {
|
||||
String stoveCode = StoveCodeUtils.getStoveCode(currTask.getTargetPosition(), currTask.getPlcValue());
|
||||
currTask.setStoveCode(stoveCode);
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
} else {
|
||||
logger.info(currTask.getId() + "任务为多步骤任务但该步骤不生成洗炉炉号.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报apms创建生产单并开始处理
|
||||
*
|
||||
@@ -1218,11 +1261,15 @@ public class AsynRunTaskService extends BaseService {
|
||||
currTaskDetList.forEach(e -> {
|
||||
CreateItem createItem = new CreateItem();
|
||||
createItem.setItemCode(e.getIdenCardNum());
|
||||
BigDecimal b = new BigDecimal(String.valueOf(e.getWeight()));
|
||||
createItem.setWeight(b.doubleValue());
|
||||
createItem.setQuantity(e.getQuantity().intValue());
|
||||
createItem.setWeight(e.getWeight().doubleValue());
|
||||
createItems.add(createItem);
|
||||
});
|
||||
apmsCreateSheet.setStoveCode(code);
|
||||
//apmsCreateSheet.setStoveCode(code);
|
||||
if (currTask.getStoveCode() != null) {
|
||||
apmsCreateSheet.setStoveCode(currTask.getStoveCode());
|
||||
}
|
||||
apmsCreateSheet.setItems(createItems);
|
||||
logger.info(currTask.getId() + "开始创建apms生产单号");
|
||||
R<ApmsCreateProcessSheetVo> processSheet = apmsController.createProcessSheet(apmsCreateSheet);
|
||||
@@ -1253,6 +1300,7 @@ public class AsynRunTaskService extends BaseService {
|
||||
|
||||
/**
|
||||
* 上报apms开始加工
|
||||
*
|
||||
* @param currTask
|
||||
* @return
|
||||
*/
|
||||
@@ -1263,7 +1311,10 @@ public class AsynRunTaskService extends BaseService {
|
||||
apmsStartProcess.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
apmsStartProcess.setTechName(currTask.getCraftCodeId().toString());
|
||||
apmsStartProcess.setSheetNo(currTask.getSheetNo());
|
||||
apmsStartProcess.setStoveCode(code);
|
||||
if (currTask.getStoveCode() != null) {
|
||||
apmsStartProcess.setStoveCode(currTask.getStoveCode());
|
||||
}
|
||||
|
||||
R<ApmsStartProcess> apmsStartProcessR = apmsController.startProcess(apmsStartProcess);
|
||||
if (apmsStartProcessR.getCode() != 0) {
|
||||
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms失败");
|
||||
@@ -1275,12 +1326,17 @@ public class AsynRunTaskService extends BaseService {
|
||||
|
||||
/**
|
||||
* 上报apms-end
|
||||
*
|
||||
* @param currTask
|
||||
* @return
|
||||
*/
|
||||
private Boolean apmsEndProcess(CurrTask currTask) {
|
||||
LocalDateTime date=LocalDateTime.now();
|
||||
if (currTask.getEndTime()!=null){
|
||||
date=currTask.getEndTime();
|
||||
}
|
||||
ApmsEndProcess apmsEndProcess = new ApmsEndProcess();
|
||||
apmsEndProcess.setEndTime(currTask.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
apmsEndProcess.setEndTime(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
apmsEndProcess.setEndUser("QJJP03");
|
||||
apmsEndProcess.setSheetNo(currTask.getSheetNo());
|
||||
R<ApmsEndProcessVo> apmsEndProcessVoR = apmsController.endProcess(apmsEndProcess);
|
||||
@@ -1294,6 +1350,7 @@ public class AsynRunTaskService extends BaseService {
|
||||
|
||||
/**
|
||||
* 上报apms-finish
|
||||
*
|
||||
* @param currTask
|
||||
* @return
|
||||
*/
|
||||
@@ -1322,8 +1379,10 @@ public class AsynRunTaskService extends BaseService {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆是否在线
|
||||
*
|
||||
* @param vehicleId 车辆id
|
||||
* @return true/false
|
||||
* @throws IOException plc访问失败
|
||||
@@ -1353,6 +1412,7 @@ public class AsynRunTaskService extends BaseService {
|
||||
|
||||
/**
|
||||
* 传入车辆ID,检查另一辆车是否在线,如果在线,检查是否位置冲突,冲突则避让。若另一辆车不在线,则不检查是否冲突。
|
||||
*
|
||||
* @param vehicleId
|
||||
* @param currTask
|
||||
* @throws IOException
|
||||
@@ -1368,12 +1428,13 @@ public class AsynRunTaskService extends BaseService {
|
||||
//两辆小车是否冲突
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, startPosition, targetPosition, rgv2CurrPosition);
|
||||
if (conflictBoolean) {
|
||||
Integer status = moveRgv(2, currTaskId, 2,0);
|
||||
Integer status = moveRgv(2, currTaskId, 1, 0);
|
||||
logger.info(status.toString());
|
||||
if (status != 1) {
|
||||
logger.info("===执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位2,执行失败===");
|
||||
logger.info("===执行任务:" + currTask.getTaskCode() + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位1,执行失败===");
|
||||
webSocketServer.sendtoAll(LocalDateTime.now() + "执行任务:" + currTask.getTaskCode() + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2,执行失败");
|
||||
} else {
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位2,执行成功===");
|
||||
logger.info("===执行任务:" + currTaskId + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位1,执行成功===");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1389,9 +1450,10 @@ public class AsynRunTaskService extends BaseService {
|
||||
//获取RGV1当前位置
|
||||
Double rgv1CurrPosition = RGVCurrPosition(1);
|
||||
//两辆小车是否冲突
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), currTask.getTargetPosition(), rgv1CurrPosition);
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, startPosition, targetPosition, rgv1CurrPosition);
|
||||
if (conflictBoolean) {
|
||||
Integer status = moveRgv(1, currTaskId, 39,0);
|
||||
Integer status = moveRgv(1, currTaskId, 12, 0);
|
||||
logger.info(status.toString());
|
||||
if (status != 1) {
|
||||
logger.info("===执行任务:" + currTaskId + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位12,执行失败===");
|
||||
webSocketServer.sendtoAll(LocalDateTime.now() + "执行任务:" + currTask.getTaskCode() + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位12,执行失败");
|
||||
@@ -1407,6 +1469,7 @@ public class AsynRunTaskService extends BaseService {
|
||||
|
||||
/**
|
||||
* 判断任务是否为单步骤任务,多步骤任务第一步
|
||||
*
|
||||
* @param currTask 任务
|
||||
* @return 单步骤任务true,多步骤任务第一步true,其他false
|
||||
*/
|
||||
|
||||
@@ -63,6 +63,7 @@ public class RunTaskUtils {
|
||||
|
||||
/**
|
||||
* 进炉加工
|
||||
*
|
||||
* @param currTaskId 任务id
|
||||
* @return R
|
||||
* @throws InterruptedException
|
||||
@@ -177,6 +178,7 @@ public class RunTaskUtils {
|
||||
currTask.setCacheSatatus(1);
|
||||
currTask.setUpdateTime(LocalDateTime.now());
|
||||
currTask.setLocationId(location.getId());
|
||||
currTask.setLocationName(location.getLocationName());
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
//异步调用车辆
|
||||
asynRunTaskService.asynRunTaskToWarehouse(currTask.getId(), vehicleId, location);
|
||||
@@ -190,6 +192,7 @@ public class RunTaskUtils {
|
||||
* 加工完成、出炉。传入工业炉id,查询正在该工业炉加工的currTask,查询是否有空闲车辆,有,
|
||||
* (查询是否为自动任务,是,查询下一步的工业炉是否空闲,是,调车去下一工业炉加工,否,暂存缓存区)
|
||||
* 呼叫车辆暂存缓存区,车辆调度任务结束后,(结束后再查询缓R存区队列避免车辆路线冲突)查询该工业炉的缓存区队列,开始下一托盘货物调度进工业炉
|
||||
*
|
||||
* @return R
|
||||
*/
|
||||
public R runTaskForOutKiln(Long kilnId) throws IOException {
|
||||
@@ -266,8 +269,17 @@ public class RunTaskUtils {
|
||||
vehicleInfo.setStatus(1);
|
||||
vehicleInfo.setUpdateTime(LocalDateTime.now());
|
||||
vehicleInfoServiceBiz.updateById(vehicleInfo);
|
||||
asynRunTaskService.asynRunOutStockForKilnToYYT(currTask.getId(),"YYT001",vehicleId);
|
||||
return R.ok("操作成功!托盘即将出库到一号液压台。");
|
||||
String yytCode = "YYT001";
|
||||
//选择出库液压台
|
||||
if (platFormPosition("YYT001")) {
|
||||
yytCode = "YYT001";
|
||||
} else if (platFormPosition("YYT002")) {
|
||||
yytCode = "YYT002";
|
||||
} else {
|
||||
yytCode = "YYT001";
|
||||
}
|
||||
asynRunTaskService.asynRunOutStockForKilnToYYT(currTask.getId(), yytCode, vehicleId);
|
||||
return R.ok("操作成功!托盘即将出库到" + yytCode + "液压台。");
|
||||
} else {
|
||||
//查询缓存区库位是否已满
|
||||
int count = locationServiceBiz.count(new QueryWrapper<Location>()
|
||||
@@ -317,6 +329,7 @@ public class RunTaskUtils {
|
||||
|
||||
/**
|
||||
* 从缓存区出库
|
||||
*
|
||||
* @param locationId 库位id
|
||||
* @param yeyaTaiCode 液压台code
|
||||
* @return R
|
||||
@@ -376,6 +389,7 @@ public class RunTaskUtils {
|
||||
|
||||
/**
|
||||
* 获取变量值
|
||||
*
|
||||
* @param nameSpace nameSpace前缀
|
||||
* @param variableName 变量名称
|
||||
* @return result字符串
|
||||
@@ -398,6 +412,7 @@ public class RunTaskUtils {
|
||||
|
||||
/**
|
||||
* 判断液压台是否准备好放货
|
||||
*
|
||||
* @param platFormCode 液压台编码
|
||||
* @return 是/否
|
||||
*/
|
||||
@@ -477,8 +492,91 @@ public class RunTaskUtils {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择出库液压台;
|
||||
* 查询液压台1和液压台2是否为高位,都不为高位则选择液压台1
|
||||
*/
|
||||
private Boolean platFormPosition(String platFormCode) {
|
||||
String identifier = null;
|
||||
if ("YYT001".equals(platFormCode)) {
|
||||
identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.Platform4ToWCS.";
|
||||
Map<String, Object> json = new HashMap();
|
||||
json.put("nameSpace", 6);
|
||||
json.put("plcName", "plc1");
|
||||
json.put("identifier", identifier + "Online");
|
||||
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("获取液压台1当前是否在线失败");
|
||||
}
|
||||
Boolean aBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
if (aBoolean) {
|
||||
Map<String, Object> statusJson = new HashMap();
|
||||
statusJson.put("nameSpace", 6);
|
||||
statusJson.put("plcName", "plc1");
|
||||
statusJson.put("identifier", identifier + "LifterPosition");
|
||||
String statusResult = null;
|
||||
try {
|
||||
statusResult = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(statusJson));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取液压台1当前是否高位");
|
||||
}
|
||||
Integer status = Integer.valueOf(JSONObject.parseObject(statusResult).get("result").toString());
|
||||
if (status == 2) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ("YYT002".equals(platFormCode)) {
|
||||
identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.Platform3ToWCS.";
|
||||
Map<String, Object> json = new HashMap();
|
||||
json.put("nameSpace", 6);
|
||||
json.put("plcName", "plc1");
|
||||
json.put("identifier", identifier + "Online");
|
||||
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("获取液压台2当前是否在线失败");
|
||||
}
|
||||
Boolean aBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
if (aBoolean) {
|
||||
Map<String, Object> statusJson = new HashMap();
|
||||
statusJson.put("nameSpace", 6);
|
||||
statusJson.put("plcName", "plc1");
|
||||
statusJson.put("identifier", identifier + "LifterPosition");
|
||||
String statusResult = null;
|
||||
try {
|
||||
statusResult = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(statusJson));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取液压台2当前是否高位失败");
|
||||
}
|
||||
Integer status = Integer.valueOf(JSONObject.parseObject(statusResult).get("result").toString());
|
||||
if (status == 2) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆是否在线
|
||||
*
|
||||
* @param vehicleId 车辆id
|
||||
* @return true/false
|
||||
* @throws IOException plc访问失败
|
||||
@@ -508,6 +606,7 @@ public class RunTaskUtils {
|
||||
|
||||
/**
|
||||
* 车辆是否空闲
|
||||
*
|
||||
* @param vehicleId 车辆id
|
||||
* @return true/false
|
||||
* @throws IOException plc访问失败
|
||||
|
||||
@@ -12,6 +12,9 @@ import com.mt.wms.core.utils.CodeGeneratorHelper;
|
||||
import com.mt.wms.core.utils.HttpClient;
|
||||
import com.mt.wms.core.utils.StringUtils;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import com.mt.wms.empty.controller.ApmsController;
|
||||
import com.mt.wms.empty.params.ApmsEndProcess;
|
||||
import com.mt.wms.empty.vo.ApmsEndProcessVo;
|
||||
import com.mt.wms.empty.vo.CurrTaskDetVo;
|
||||
import com.mt.wms.empty.vo.NowCurrTaskDetVo;
|
||||
import com.mt.wms.empty.websocket.WebSocketServer;
|
||||
@@ -25,6 +28,7 @@ import org.springframework.stereotype.Component;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -81,6 +85,8 @@ public class ScheduledTask extends BaseService {
|
||||
private TaskHisServiceBiz taskHisServiceBiz;
|
||||
@Resource
|
||||
private TaskDetHisServiceBiz taskDetHisServiceBiz;
|
||||
@Resource
|
||||
private ApmsController apmsController;
|
||||
|
||||
|
||||
//@Scheduled(fixedDelay = 1000*20)
|
||||
@@ -88,6 +94,7 @@ public class ScheduledTask extends BaseService {
|
||||
public void test() throws IOException {
|
||||
|
||||
}
|
||||
|
||||
//@Scheduled(fixedDelay = 1000*60)
|
||||
public void testWebsocket() throws IOException {
|
||||
//查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间,剩余时间,查询标识卡详情
|
||||
@@ -157,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;
|
||||
//剩余时间
|
||||
@@ -196,6 +204,7 @@ public class ScheduledTask extends BaseService {
|
||||
}
|
||||
webSocketServer.sendtoUser(JSON.toJSONString(nowCurrTaskDetVoList), "2");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询加工完成的工业炉
|
||||
*/
|
||||
@@ -240,6 +249,8 @@ public class ScheduledTask extends BaseService {
|
||||
taskDetHisServiceBiz.saveBatch(taskDetHisList);
|
||||
//加工结束而没有立马出炉,加工结束记录能源消耗值只记录一次
|
||||
asynRunTaskService.asynEndRecordConsume(currTask.getId(), kilnId);
|
||||
apmsEndProcess(currTask);
|
||||
logger.info(currTask+"上报apms结束当前工艺加工");
|
||||
logger.info(kilnInfo.getCode() + "炉子中的任务:" + currTask.getId() + "已加工结束,记录加工结束能源消耗值");
|
||||
}
|
||||
runTaskUtils.runTaskForOutKiln(kilnId);
|
||||
@@ -266,8 +277,19 @@ public class ScheduledTask extends BaseService {
|
||||
//该炉子在工作中
|
||||
if (resultBoolean) {
|
||||
Long kilnId = kilnInfo.getId();
|
||||
Long currTaskId = 0L;
|
||||
//多用炉因为存在多个识别号且炉子给的DischargeIdentNumber为下油槽后的识别号,所以使用表里记录的任务id根据状态和进炉时间查出正在炉里且先进去的那个
|
||||
if (kilnInfo.getType() == 1) {
|
||||
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.STATUS, 1)
|
||||
.eq(CurrTask.KILN_ID, kilnId).eq(CurrTask.IS_IN, 1));
|
||||
if (currTaskList.size() != 0) {
|
||||
currTaskId = currTaskList.get(0).getId();
|
||||
}
|
||||
} else {
|
||||
String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber");
|
||||
Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
|
||||
currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
|
||||
}
|
||||
|
||||
if (currTaskId == 0) {
|
||||
continue;
|
||||
}
|
||||
@@ -292,7 +314,7 @@ public class ScheduledTask extends BaseService {
|
||||
Double oilStirringSpeed2 = readPlc(nameSpaceNote, "OilStirringSpeed2");
|
||||
ParRotSpeedValue parRotSpeedValue = new ParRotSpeedValue();
|
||||
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed1.floatValue());
|
||||
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue());
|
||||
parRotSpeedValue.setOilStiSpeedBValue(oilStirringSpeed2.floatValue());
|
||||
parRotSpeedValue.setKilnId(kilnId);
|
||||
parRotSpeedValue.setTaskId(currTaskId);
|
||||
parRotSpeedValue.setCreateTime(LocalDateTime.now());
|
||||
@@ -369,8 +391,21 @@ public class ScheduledTask extends BaseService {
|
||||
Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
if (resultBoolean) {
|
||||
Long kilnId = kilnInfo.getId();
|
||||
Long currTaskId = 0L;
|
||||
//多用炉因为存在多个识别号且炉子给的DischargeIdentNumber为下油槽后的识别号,所以使用表里记录的任务id根据状态和进炉时间查出正在炉里且先进去的那个
|
||||
if (kilnInfo.getType() == 1) {
|
||||
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.STATUS, 1)
|
||||
.eq(CurrTask.KILN_ID, kilnId).eq(CurrTask.IS_IN, 1));
|
||||
if (currTaskList.size() != 0) {
|
||||
currTaskId = currTaskList.get(0).getId();
|
||||
}
|
||||
} else {
|
||||
String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber");
|
||||
Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
|
||||
currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
|
||||
}
|
||||
/* Long kilnId = kilnInfo.getId();
|
||||
String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber");
|
||||
Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());*/
|
||||
//任务id为0说明不是自动任务,不记录
|
||||
if (currTaskId == 0) {
|
||||
continue;
|
||||
@@ -413,10 +448,19 @@ public class ScheduledTask extends BaseService {
|
||||
Double phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage");
|
||||
Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
||||
Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
||||
//ABC向电流
|
||||
Double phaseACurrent = readPlc(nameSpaceNote, "PhaseACurrent");
|
||||
Double phaseBCurrent = readPlc(nameSpaceNote, "PhaseBCurrent");
|
||||
Double phaseDCurrent = readPlc(nameSpaceNote, "PhaseDCurrent");
|
||||
ParEleValue parEleValue = new ParEleValue();
|
||||
parEleValue.setAVoltagevValue(phaseAVoltage.floatValue());
|
||||
parEleValue.setAVoltagevValue(phaseBVoltage.floatValue());
|
||||
parEleValue.setAVoltagevValue(phaseCVoltage.floatValue());
|
||||
parEleValue.setBVoltagevValue(phaseBVoltage.floatValue());
|
||||
parEleValue.setCVoltagevValue(phaseCVoltage.floatValue());
|
||||
|
||||
parEleValue.setACurrentValue(phaseACurrent.floatValue());
|
||||
parEleValue.setBCurrentValue(phaseBCurrent.floatValue());
|
||||
parEleValue.setCCurrentValue(phaseDCurrent.floatValue());
|
||||
|
||||
parEleValue.setTotalBat(electricalValue.floatValue());
|
||||
parEleValue.setKilnId(kilnId);
|
||||
parEleValue.setTaskId(currTaskId);
|
||||
@@ -442,10 +486,17 @@ public class ScheduledTask extends BaseService {
|
||||
Double phaseAVoltage = readPlc(nameSpaceNote, "AVoltage");
|
||||
Double phaseBVoltage = readPlc(nameSpaceNote, "BVoltage");
|
||||
Double phaseCVoltage = readPlc(nameSpaceNote, "CVoltage");
|
||||
//ABC三相电流
|
||||
Double aCurrent = readPlc(nameSpaceNote, "ACurrent");
|
||||
Double bCurrent = readPlc(nameSpaceNote, "BCurrent");
|
||||
Double cCurrent = readPlc(nameSpaceNote, "CCurrent");
|
||||
ParEleValue parEleValue2 = new ParEleValue();
|
||||
parEleValue2.setAVoltagevValue(phaseAVoltage.floatValue());
|
||||
parEleValue2.setAVoltagevValue(phaseBVoltage.floatValue());
|
||||
parEleValue2.setAVoltagevValue(phaseCVoltage.floatValue());
|
||||
parEleValue2.setBVoltagevValue(phaseBVoltage.floatValue());
|
||||
parEleValue2.setCVoltagevValue(phaseCVoltage.floatValue());
|
||||
parEleValue2.setACurrentValue(aCurrent.floatValue());
|
||||
parEleValue2.setBCurrentValue(bCurrent.floatValue());
|
||||
parEleValue2.setCCurrentValue(cCurrent.floatValue());
|
||||
parEleValue2.setTotalBat(electricalValue.floatValue());
|
||||
parEleValue2.setKilnId(kilnId);
|
||||
parEleValue2.setTaskId(currTaskId);
|
||||
@@ -480,10 +531,17 @@ public class ScheduledTask extends BaseService {
|
||||
Double phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage");
|
||||
Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
||||
Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
||||
//ABC三向电流
|
||||
Double phaseACurrent = readPlc(nameSpaceNote, "PhaseACurrent");
|
||||
Double phaseBCurrent = readPlc(nameSpaceNote, "PhaseBCurrent");
|
||||
Double phaseCCurrent = readPlc(nameSpaceNote, "PhaseCCurrent");
|
||||
ParEleValue parEleValue3 = new ParEleValue();
|
||||
parEleValue3.setAVoltagevValue(phaseAVoltage.floatValue());
|
||||
parEleValue3.setAVoltagevValue(phaseBVoltage.floatValue());
|
||||
parEleValue3.setAVoltagevValue(phaseCVoltage.floatValue());
|
||||
parEleValue3.setBVoltagevValue(phaseBVoltage.floatValue());
|
||||
parEleValue3.setCVoltagevValue(phaseCVoltage.floatValue());
|
||||
parEleValue3.setACurrentValue(phaseACurrent.floatValue());
|
||||
parEleValue3.setBCurrentValue(phaseBCurrent.floatValue());
|
||||
parEleValue3.setCCurrentValue(phaseCVoltage.floatValue());
|
||||
parEleValue3.setTotalBat(electricalValue.floatValue());
|
||||
parEleValue3.setKilnId(kilnId);
|
||||
parEleValue3.setTaskId(currTaskId);
|
||||
@@ -497,11 +555,18 @@ public class ScheduledTask extends BaseService {
|
||||
//A向电压
|
||||
Double phaseAVoltage = readPlc(nameSpaceNote, "AVoltage");
|
||||
Double phaseBVoltage = readPlc(nameSpaceNote, "BVoltage");
|
||||
Double phaseCVoltage = readPlc(nameSpaceNote, "CVoltage");
|
||||
Double phaseCVoltage = readPlc(nameSpaceNote, "Cvoltage");
|
||||
//ABC三向电流
|
||||
Double aCurrent = readPlc(nameSpaceNote, "ACurrent");
|
||||
Double bCurrent = readPlc(nameSpaceNote, "BCurrent");
|
||||
Double cCurrent = readPlc(nameSpaceNote, "CCurrent");
|
||||
ParEleValue parEleValue4 = new ParEleValue();
|
||||
parEleValue4.setAVoltagevValue(phaseAVoltage.floatValue());
|
||||
parEleValue4.setAVoltagevValue(phaseBVoltage.floatValue());
|
||||
parEleValue4.setAVoltagevValue(phaseCVoltage.floatValue());
|
||||
parEleValue4.setBVoltagevValue(phaseBVoltage.floatValue());
|
||||
parEleValue4.setCVoltagevValue(phaseCVoltage.floatValue());
|
||||
parEleValue4.setACurrentValue(aCurrent.floatValue());
|
||||
parEleValue4.setBCurrentValue(bCurrent.floatValue());
|
||||
parEleValue4.setCCurrentValue(cCurrent.floatValue());
|
||||
parEleValue4.setTotalBat(electricalValue.floatValue());
|
||||
parEleValue4.setKilnId(kilnId);
|
||||
parEleValue4.setTaskId(currTaskId);
|
||||
@@ -528,6 +593,9 @@ public class ScheduledTask extends BaseService {
|
||||
if (vehicleInfos.size() > 0) {
|
||||
return;
|
||||
}
|
||||
if (kilnStopRecTask(kilnInfo.getId())){
|
||||
continue;
|
||||
}
|
||||
Boolean kilnReadyIn = false;
|
||||
if (kilnInfo.getType() == 1) {
|
||||
kilnReadyIn = kilnReadyIn(kilnInfo.getId());
|
||||
@@ -558,6 +626,10 @@ public class ScheduledTask extends BaseService {
|
||||
logger.info("加工炉" + kilnInfo.getCode() + "readyIn为" + kilnReadyIn.toString() + " allowIn为" + kilnAllowIn.toString());
|
||||
logger.info("缓存区等待队列第一位:" + inStockInfo.toString());
|
||||
CurrTask currTask = currTaskServiceBiz.getById(inStockInfo.getTaskId());
|
||||
if (currTask.getStatus() != 0) {
|
||||
logger.info(inStockInfo.toString() + "该缓存对应的任务状态为:" + currTask.getStatus() + "不能发起任务。");
|
||||
webSocketServer.sendtoUser(inStockInfo.getLocationName() + "对应的缓存加工任务状态不为未加工,不能发起任务,请先确认任务状态!", "1");
|
||||
}
|
||||
Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
|
||||
//是否有小车在运行
|
||||
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
|
||||
@@ -603,7 +675,8 @@ public class ScheduledTask extends BaseService {
|
||||
List<PlcNameSpace> alarmNameList = plcNameSpaceServiceBiz.list(new QueryWrapper<PlcNameSpace>()
|
||||
.eq(PlcNameSpace.EQ_TYPE, 1)
|
||||
.eq(PlcNameSpace.TYPE, 1)
|
||||
.eq(PlcNameSpace.EQ_ID,kilnInfo.getId()));;
|
||||
.eq(PlcNameSpace.EQ_ID, kilnInfo.getId()));
|
||||
;
|
||||
for (PlcNameSpace plcNameSpace : alarmNameList
|
||||
) {
|
||||
String name = plcNameSpace.getName();
|
||||
@@ -635,8 +708,7 @@ public class ScheduledTask extends BaseService {
|
||||
alarmInfo.setCreateTime(LocalDateTime.now());
|
||||
alarmInfoServiceBiz.save(alarmInfo);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
AlarmInfo alarmInfo = new AlarmInfo();
|
||||
alarmInfo.setEquipmentId(kilnInfo.getId());
|
||||
alarmInfo.setEquipmentName(kilnInfo.getKilnName());
|
||||
@@ -656,8 +728,7 @@ public class ScheduledTask extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
//监听车辆是否在线,定时恢复车辆状态会导致避让时等待时间过久,再次发起任务,造成重复发起
|
||||
//@Scheduled(fixedDelay = 1000*60)
|
||||
//监听车辆是否在线,定时恢复车辆状态会导致避让时等待时间过久,再次发起任务,造成重复发起,废弃
|
||||
public void listenVehicleOnline() throws IOException {
|
||||
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
|
||||
for (VehicleInfo vehicleInfo : vehicleInfoList
|
||||
@@ -674,8 +745,10 @@ public class ScheduledTask extends BaseService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取变量值
|
||||
*
|
||||
* @param nameSpace nameSpace前缀
|
||||
* @param variableName 变量名称
|
||||
* @return result字符串
|
||||
@@ -696,8 +769,10 @@ public class ScheduledTask extends BaseService {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取变量值
|
||||
*
|
||||
* @param nameSpace nameSpace前缀
|
||||
* @param variableName 变量名称
|
||||
* @return 变量值
|
||||
@@ -727,6 +802,16 @@ public class ScheduledTask extends BaseService {
|
||||
String result = readPlcToString(nameSpaceNote, "AllowIn");
|
||||
return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
}
|
||||
|
||||
private Boolean kilnStopRecTask(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, "StopRecTask");
|
||||
return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
}
|
||||
private Boolean kilnReadyIn(Long kilnId) {
|
||||
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
|
||||
.eq(PlcNameSpace.EQ_TYPE, 0)
|
||||
@@ -736,6 +821,7 @@ public class ScheduledTask extends BaseService {
|
||||
String result = readPlcToString(nameSpaceNote, "ReadyIn");
|
||||
return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
}
|
||||
|
||||
private Boolean kilnWorking(Long kilnId) {
|
||||
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
|
||||
.eq(PlcNameSpace.EQ_TYPE, 0)
|
||||
@@ -748,6 +834,7 @@ public class ScheduledTask extends BaseService {
|
||||
|
||||
/**
|
||||
* 车辆是否在线
|
||||
*
|
||||
* @param vehicleId 车辆id
|
||||
* @return true/false
|
||||
* @throws IOException plc访问失败
|
||||
@@ -777,6 +864,7 @@ public class ScheduledTask extends BaseService {
|
||||
|
||||
/**
|
||||
* 车辆是否空闲
|
||||
*
|
||||
* @param vehicleId 车辆id
|
||||
* @return true/false
|
||||
* @throws IOException plc访问失败
|
||||
@@ -803,4 +891,27 @@ public class ScheduledTask extends BaseService {
|
||||
Boolean free = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
return free;
|
||||
}
|
||||
/**
|
||||
* 上报apms-end
|
||||
*
|
||||
* @param currTask
|
||||
* @return
|
||||
*/
|
||||
private Boolean apmsEndProcess(CurrTask currTask) {
|
||||
LocalDateTime date=LocalDateTime.now();
|
||||
if (currTask.getEndTime()!=null){
|
||||
date=currTask.getEndTime();
|
||||
}
|
||||
ApmsEndProcess apmsEndProcess = new ApmsEndProcess();
|
||||
apmsEndProcess.setEndTime(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
apmsEndProcess.setEndUser("QJJP03");
|
||||
apmsEndProcess.setSheetNo(currTask.getSheetNo());
|
||||
R<ApmsEndProcessVo> apmsEndProcessVoR = apmsController.endProcess(apmsEndProcess);
|
||||
if (apmsEndProcessVoR.getCode() != 0) {
|
||||
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单完成处理上报apms失败");
|
||||
return false;
|
||||
}
|
||||
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单完成处理上报apms成功");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -121,10 +121,10 @@ public class TaskDistanceUtils {
|
||||
if (otherNowPosition>=minDistance&&otherNowPosition<=maxDistance){
|
||||
return true;
|
||||
}else {
|
||||
if (Math.abs(otherNowPosition-maxDistance)<2){
|
||||
if (Math.abs(otherNowPosition-maxDistance)<4){
|
||||
return true;
|
||||
}
|
||||
if (Math.abs(otherNowPosition-minDistance)<2){
|
||||
if (Math.abs(otherNowPosition-minDistance)<4){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
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 totalBat;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ApiModelProperty(value = "任务id", example = "0.0")
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 炉号
|
||||
*/
|
||||
@ApiModelProperty(value = "炉号", example = "0.0")
|
||||
private String stoveCode;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.mt.wms.empty.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
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;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: LGH
|
||||
* @Date: 2022/9/1
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@Builder
|
||||
@ApiModel(value = "当前任务详细信息", description = "当前任务详细信息")
|
||||
public class CurrTaskInfoVo extends BaseVo implements PageVo.ConvertVo{
|
||||
|
||||
/**
|
||||
* 状态:0等待执行,1执行中,2缓存中
|
||||
*/
|
||||
@ApiModelProperty("状态:0等待执行,1执行中,2缓存中")
|
||||
private Integer status;
|
||||
/**
|
||||
* 生产单号
|
||||
*/
|
||||
@ApiModelProperty("生产单号")
|
||||
private String sheetNo;
|
||||
/**
|
||||
* 炉号
|
||||
*/
|
||||
@ApiModelProperty("炉号")
|
||||
private String stoveCode;
|
||||
/**
|
||||
* auto_Curr_Task_id
|
||||
*/
|
||||
@ApiModelProperty("auto_id")
|
||||
private Long autoExeTaskId;
|
||||
|
||||
/**
|
||||
* 发起任务时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
/**
|
||||
* 开始位置
|
||||
*/
|
||||
@ApiModelProperty("开始位置")
|
||||
private String startPosition;
|
||||
|
||||
/**
|
||||
* 所有步骤
|
||||
*/
|
||||
@ApiModelProperty("所有步骤")
|
||||
private String allStep;
|
||||
|
||||
/**
|
||||
* 是否多步骤任务
|
||||
*/
|
||||
@TableField("is_auto")
|
||||
private Integer isAuto;
|
||||
/**
|
||||
* 当前步骤,炉名或者缓存库位
|
||||
*/
|
||||
@ApiModelProperty("当前步骤,炉名或者缓存库位")
|
||||
private String nowStep;
|
||||
|
||||
/**
|
||||
* 标识卡详情列表
|
||||
*/
|
||||
@ApiModelProperty("标识卡详情列表")
|
||||
private List<CurrTaskDetVo> currTaskDetVoList;
|
||||
/**
|
||||
* 任务步骤详情
|
||||
*/
|
||||
@ApiModelProperty("任务步骤详情")
|
||||
private List<CurrTaskVo> currTaskVoList;
|
||||
|
||||
/**
|
||||
* 缓存详情
|
||||
*/
|
||||
@ApiModelProperty("任务步骤详情")
|
||||
private List<InStockInfoVo> inStockInfoVoList;
|
||||
}
|
||||
@@ -97,4 +97,9 @@ public class CurrTaskQueryVo extends BaseVo implements PageVo.ConvertVo {
|
||||
*/
|
||||
@ApiModelProperty("车辆名称")
|
||||
private Integer isAuto;
|
||||
/**
|
||||
* 是否缓存
|
||||
*/
|
||||
@ApiModelProperty("是否缓存")
|
||||
private Integer isCache;
|
||||
}
|
||||
|
||||
@@ -111,6 +111,11 @@ public class CurrTaskVo extends BaseVo implements PageVo.ConvertVo {
|
||||
*/
|
||||
@ApiModelProperty("目标工业炉id")
|
||||
private Long kilnId;
|
||||
/**
|
||||
* 目标工业炉id
|
||||
*/
|
||||
@ApiModelProperty("目标工业炉name")
|
||||
private String kilnName;
|
||||
|
||||
/**
|
||||
* 车辆id,关联车辆表:t_vehicle_info
|
||||
@@ -130,12 +135,28 @@ public class CurrTaskVo extends BaseVo implements PageVo.ConvertVo {
|
||||
/**
|
||||
* 是否自动执行: 0手动,1自动,如果是自动任务这里要监控进出和到缓存区的调度任务
|
||||
*/
|
||||
@TableField("is_auto")
|
||||
@ApiModelProperty("is_auto")
|
||||
private Integer isAuto;
|
||||
|
||||
/**
|
||||
* 任务流程ID,关联流程表:t_auto_exe_task
|
||||
*/
|
||||
@TableField("auto_exe_task_id")
|
||||
@ApiModelProperty("auto_exe_task_id")
|
||||
private Long autoExeTaskId;
|
||||
/**
|
||||
* currid
|
||||
*/
|
||||
@ApiModelProperty("auto_exe_task_id")
|
||||
private Long taskId;
|
||||
/**
|
||||
* 工艺id
|
||||
*/
|
||||
@ApiModelProperty("auto_exe_task_id")
|
||||
private Long craftCodeId;
|
||||
|
||||
/**
|
||||
* 炉号
|
||||
*/
|
||||
@ApiModelProperty("stove_code")
|
||||
private String stoveCode;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.mt.wms.empty.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
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/9/9
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@Builder
|
||||
@ApiModel(value = "缓存信息视图对象", description = "用于查询缓存信息")
|
||||
public class InStockInfoVo extends BaseVo implements PageVo.ConvertVo{
|
||||
/**
|
||||
* 主键,自增
|
||||
*/
|
||||
@ApiModelProperty(value = "主键", example = "1")
|
||||
private Long id;
|
||||
/**
|
||||
* 库位id
|
||||
*/
|
||||
@ApiModelProperty(value = "库位id",example = "0")
|
||||
private Long locationId;
|
||||
/**
|
||||
* 库位名称
|
||||
*/
|
||||
@ApiModelProperty(value = "库位名称",example = "0")
|
||||
private String locationName;
|
||||
/**
|
||||
* 任务id
|
||||
*/
|
||||
@ApiModelProperty(value = "任务id",example = "0")
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 进入缓存区的时间,插单任务按倒叙执行,正常任务按顺序执行
|
||||
*/
|
||||
@ApiModelProperty(value = "进入缓存区的时间",example = "0")
|
||||
private LocalDateTime inTime;
|
||||
|
||||
|
||||
/**
|
||||
* 工业炉id
|
||||
*/
|
||||
@ApiModelProperty(value = "工业炉id",example = "0")
|
||||
private Long kilnId;
|
||||
|
||||
/**
|
||||
* 工业炉名称
|
||||
*/
|
||||
@ApiModelProperty(value = "工业炉名称",example = "0")
|
||||
private String kilnName;
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -26,11 +27,21 @@ 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")
|
||||
private String taskCode;
|
||||
/**
|
||||
* 炉号
|
||||
*/
|
||||
@ApiModelProperty(value = "炉号", example = "0")
|
||||
private String stoveCode;
|
||||
/**
|
||||
* 生产单号
|
||||
*/
|
||||
@@ -69,6 +80,11 @@ public class NowCurrTaskDetVo extends BaseVo implements PageVo.ConvertVo{
|
||||
*/
|
||||
@ApiModelProperty(value = "工艺进度", example = "0")
|
||||
private Integer completeness;
|
||||
/**
|
||||
* 开始加工时间
|
||||
*/
|
||||
@ApiModelProperty(value = "开始加工时间", example = "0")
|
||||
private LocalDateTime beginTime;
|
||||
|
||||
/**
|
||||
* 标识卡list
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* @Author: LGH
|
||||
* @Date: 2022/8/11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@Builder
|
||||
@ApiModel(value = "问题解答视图对象", description = "问题解答视图对象")
|
||||
public class QuestionAnswerVo extends BaseVo implements PageVo.ConvertVo{
|
||||
|
||||
|
||||
@ApiModelProperty(value = "问题", required = true)
|
||||
private String question;
|
||||
|
||||
@ApiModelProperty(value = "解答", required = true)
|
||||
private String answer;
|
||||
}
|
||||
@@ -30,11 +30,28 @@ public class TaskHisQueryVo extends BaseVo implements PageVo.ConvertVo {
|
||||
*/
|
||||
@ApiModelProperty("任务编码")
|
||||
private String taskCode;
|
||||
|
||||
/**
|
||||
* 炉号
|
||||
*/
|
||||
@ApiModelProperty("炉号")
|
||||
private String stoveCode;
|
||||
/**
|
||||
* 工艺号
|
||||
*/
|
||||
@ApiModelProperty("工艺号")
|
||||
private Integer plcValue;
|
||||
/**
|
||||
* 发起任务时间
|
||||
*/
|
||||
@ApiModelProperty("发起时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 进炉时间
|
||||
*/
|
||||
@ApiModelProperty("进炉时间")
|
||||
private LocalDateTime beginTime;
|
||||
/**
|
||||
* 任务来源, 暂时只有人工
|
||||
*/
|
||||
|
||||
35
6.program/wms-empty/src/main/resources/mapper/EleMapper.xml
Normal file
35
6.program/wms-empty/src/main/resources/mapper/EleMapper.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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="totalBat"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 根据角色查询菜单,角色已分配的菜单标记为选中状态 -->
|
||||
<select id="list"
|
||||
resultType="com.mt.wms.empty.vo.CountEleVo">
|
||||
select
|
||||
max(total_bat) as total_bat ,
|
||||
task_id
|
||||
from
|
||||
t_par_ele_value tpev2
|
||||
where
|
||||
kiln_id = #{kilnId}
|
||||
group by
|
||||
task_id
|
||||
order by
|
||||
total_bat desc
|
||||
limit 11
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user