Compare commits

61 Commits

Author SHA1 Message Date
lgh
d14d142472 update: 2023-02-22 08:40:56 +08:00
lgh
571cee49a0 update: 2023-01-05 16:57:24 +08:00
lgh
f1878910e3 Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd 2022-12-29 11:53:34 +08:00
lgh
f5aa87d7e9 update: 2022-12-29 11:53:23 +08:00
LGH
fa189331b8 update:
2号油搅拌速度;
1,2外区温度;
2022-12-29 11:52:22 +08:00
lgh
0616844403 update: 2022-12-27 20:08:59 +08:00
LGH
ac476e936e Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd 2022-12-27 18:04:03 +08:00
LGH
6259a0237e update: 2022-12-27 18:03:59 +08:00
LGH
b0540ce4dc update: 2022-12-27 18:02:13 +08:00
lgh
395817f10e update: 2022-12-27 18:01:05 +08:00
lgh
21a4cfab23 update:
监听到加工炉完成加工后就结束当前工艺,防止开始新的工艺时上报出错
2022-12-02 15:42:02 +08:00
lgh
63d251325f update:
安全距离3.8米;
停止接收任务启用;
订单作废;
修改任务状态提交apms;
2022-11-28 17:02:29 +08:00
LGH
a002354d49 update:
出库液压台在线且高位则选为出库台
2022-11-24 09:09:38 +08:00
lgh
7e9d8f5e64 update:
任务明细非空判定,
手动进炉的任务生成炉号
2022-11-24 08:41:38 +08:00
LGH
bcff5830f4 Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd
 Conflicts:
	6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java
	6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java
2022-11-21 15:59:56 +08:00
LGH
75471b7166 update:
炉号生成规则修改;
新增未成功报工列表接口;
新增报工接口;
2022-11-21 15:55:19 +08:00
LGH
ec7f364ccf update:
炉号生成规则修改;
新增未成功报工列表接口;
新增报工接口;
2022-11-21 15:54:43 +08:00
lgh
5582a6929c update:
任务列表信息缺失补全
2022-11-21 15:49:07 +08:00
lgh
74b42527c6 update:
bug修改,float转double精度丢失
2022-11-21 09:16:26 +08:00
LGH
b407f99872 update:
上报apms炉号修改
2022-11-18 10:43:09 +08:00
LGH
292c511c22 update:
上报apms炉号修改
2022-11-18 10:37:06 +08:00
LGH
59921c28ca update:
上报apms炉号
2022-11-18 10:15:35 +08:00
LGH
5eed777f0a update:
上报apms炉号
2022-11-18 10:12:54 +08:00
LGH
592d27b858 update:
上报apms炉号
2022-11-18 10:09:47 +08:00
LGH
59f008f19e Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd 2022-11-18 09:06:34 +08:00
LGH
3ecf06ae6a update:
能源消耗结构修改
2022-11-18 09:05:14 +08:00
lgh
605cdb5aa0 Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd 2022-11-10 10:30:15 +08:00
lgh
647e3f5761 update:
bug修改
2022-11-10 10:30:00 +08:00
LGH
85299bb26a update:
编码生成redis设置key有效期为当天,次日凌晨失效重新开始计数
2022-11-09 13:58:23 +08:00
LGH
1a6c19bf14 update:
工艺号显示
2022-11-04 15:36:06 +08:00
LGH
7cfa7168e1 update:
生成炉号
2022-11-03 16:18:44 +08:00
LGH
d5464eed6c update:
能源消耗比较
生成炉号
2022-11-03 16:14:01 +08:00
LGH
9d8b6c065f Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd 2022-10-26 15:25:09 +08:00
LGH
e6995b99a3 update:
执行任务按钮校验任务状态防止重复发起
2022-10-26 15:24:07 +08:00
lgh
ef0ba77715 update:
删除bug修改
2022-09-26 14:24:10 +08:00
lgh
2def9c889f update:
安全距离修改;
缓存任务进炉前校验任务状态;
2022-09-21 10:56:32 +08:00
LGH
17f5ddbfa0 Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd 2022-09-20 09:58:08 +08:00
LGH
6ed7a735ed update:
订单列表增加筛选项
2022-09-20 09:57:56 +08:00
lgh
f359470fc4 update:
bug修改
2022-09-16 15:26:32 +08:00
LGH
5e54011371 Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd 2022-09-09 23:17:39 +08:00
LGH
8643ca11d7 update:
currTask列表总览及操作方式修改-bug修改
2022-09-09 23:17:34 +08:00
lgh
5711a2acf6 update:
bug修改
2022-09-09 23:16:45 +08:00
LGH
cb0be1cbbf update:
currTask列表总览及操作方式修改-bug修改
2022-09-09 22:04:20 +08:00
LGH
9a7170d9e9 update:
currTask列表总览及操作方式修改-bug修改
2022-09-09 21:56:48 +08:00
LGH
18590dafb9 update:
currTask列表总览及操作方式修改
2022-09-09 16:46:26 +08:00
LGH
d107699d2c update:
currTask列表修改
2022-09-05 17:01:56 +08:00
LGH
d49759efdf update:
currTask列表修改-bug修改
2022-09-01 15:22:17 +08:00
LGH
412dbd04d4 update:
currTask列表修改
2022-09-01 14:53:12 +08:00
LGH
249ca25963 Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd
 Conflicts:
	6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java
2022-09-01 13:46:49 +08:00
LGH
942bde619f update:
apms上报失败msg推送
2022-09-01 13:46:36 +08:00
lgh
bd14fe3ed9 update:
取消定时修改车辆状态
2022-09-01 13:25:00 +08:00
lgh
1ea55bd39a Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd 2022-08-15 11:05:44 +08:00
lgh
dd1a4b448e update:
finishQuantity计算bug修改
2022-08-15 11:05:34 +08:00
LGH
4af20b8551 update:
//多用炉因为存在多个识别号且炉子给的DischargeIdentNumber为下油槽后的识别号,所以使用表里记录的任务id根据状态和进炉时间查出正在炉里且先进去的那个
2022-08-15 10:44:08 +08:00
lgh
1616215534 update:
验证多步骤任务必须有标识卡才能提交
2022-08-13 11:04:44 +08:00
lgh
ddf6078774 Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd 2022-08-11 16:52:23 +08:00
lgh
f125fac9ee update:
bug修改
2022-08-11 16:52:12 +08:00
LGH
8abbc7193a Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd 2022-08-11 16:43:06 +08:00
LGH
17c0c1e973 update:
新增常见问题汇总curd
2022-08-11 16:40:48 +08:00
lgh
c19066792c update:
计算车辆是否冲突起终点bug修改
2022-08-06 00:15:42 +08:00
lgh
40f44f57d9 update:
bug修改
2022-08-05 11:35:05 +08:00
53 changed files with 4063 additions and 988 deletions

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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;
}
}

View File

@@ -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;

View File

@@ -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> {
}

View File

@@ -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>

View File

@@ -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> {
}

View File

@@ -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 {
}

View File

@@ -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);
}
/**
* 生成自动任务编码
*

View File

@@ -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;

View File

@@ -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
{

View File

@@ -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 + "失败!");
}
@@ -122,17 +117,17 @@ public class CurrTaskController extends BaseController {
//if (processSheet.getData().getSuccess())
//{
//apms创建成功后写入数据库
param.setAutoTaskType(0);
R<IdVo> mainTask = currTaskService.createProcessTask(param);
currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
//String sheetNo = processSheet.getData().getSheetNo();
//将返回的生产单号写入到主任务中。
//CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
//currTaskById.setSheetNo(sheetNo);
//currTaskService.updateCurrTaskById(currTaskById);
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
return successful(0,"创建成功,任务添加至等待执行队列。","");
//apms创建成功后写入数据库
param.setAutoTaskType(0);
R<IdVo> mainTask = currTaskService.createProcessTask(param);
currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
//String sheetNo = processSheet.getData().getSheetNo();
//将返回的生产单号写入到主任务中。
//CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
//currTaskById.setSheetNo(sheetNo);
//currTaskService.updateCurrTaskById(currTaskById);
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
return successful(0, "创建成功,任务添加至等待执行队列。详情请在订单加工管理下当前任务列表查看", "");
//}
//else
//{
@@ -142,16 +137,19 @@ public class CurrTaskController extends BaseController {
@PostMapping(value = "createAutoTask")
@ApiOperation(value = "订单加工-创建多个个分步骤加工任务至任务队列")
public R<String> createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam){
public R<String> createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam) {
List<TaskCreateParam> detParams = autoCurrTaskParam.getTaskCreateParamList();
Boolean apmsCreateProcessSheet=false;
String sheetNo=null;
int i=1;
R<ApmsCreateProcessSheetVo> processSheet=null;
Boolean apmsCreateProcessSheet = false;
String sheetNo = null;
int i = 1;
R<ApmsCreateProcessSheetVo> processSheet = null;
//自动任务循环添加多条currTask
AutoExeTask autoExeTask=new AutoExeTask();
for (TaskCreateParam param:detParams
) {
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 + "失败!");
}
/*
@@ -204,50 +199,50 @@ public class CurrTaskController extends BaseController {
//if (apmsCreateProcessSheet)
//{
//apms创建成功后写入数据库
R<IdVo> mainTask = currTaskService.createProcessTask(param);
currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
CurrTask currTask = currTaskServiceBiz.getById(mainTask.getData().getId());
//工艺步骤中第一步
if (param.getAutoTaskStep()==1){
autoExeTask.setInterCode(CodeGeneratorHelper.getAutoTaskCode());
autoExeTask.setProcessFlowType(param.getAutoTaskType());
autoExeTask.setFTaskId(currTask.getId());
autoExeTask.setFDetTaskCode(currTask.getTaskCode());
autoExeTask.setFEquipmentId(currTask.getKilnId());
autoExeTask.setFEquipmentName(currTask.getKilnName());
autoExeTask.setFCraftCodeId(currTask.getCraftCodeId());
autoExeTask.setFPlcValue(currTask.getPlcValue());
setCommonField(autoExeTask);
autoExeTaskServiceBiz.save(autoExeTask);
}
if (param.getAutoTaskStep()==2){
autoExeTask.setTTaskId(currTask.getId());
autoExeTask.setTDetTaskCode(currTask.getTaskCode());
autoExeTask.setTEquipmentId(currTask.getKilnId());
autoExeTask.setTEquipmentName(currTask.getKilnName());
autoExeTask.setTCraftCodeId(currTask.getCraftCodeId());
autoExeTask.setTPlcValue(currTask.getPlcValue());
setUpdateCommonField(autoExeTask);
autoExeTaskServiceBiz.updateById(autoExeTask);
}
if (param.getAutoTaskStep()==3){
autoExeTask.setThTaskId(currTask.getId());
autoExeTask.setThDetTaskCode(currTask.getTaskCode());
autoExeTask.setThEquipmentId(currTask.getKilnId());
autoExeTask.setThEquipmentName(currTask.getKilnName());
autoExeTask.setThCraftCodeId(currTask.getCraftCodeId());
autoExeTask.setThPlcValue(currTask.getPlcValue());
setUpdateCommonField(autoExeTask);
autoExeTaskServiceBiz.updateById(autoExeTask);
}
//将返回的生产单号写入到主任务中。
CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
//currTaskById.setSheetNo(sheetNo);
currTaskById.setAutoExeTaskId(autoExeTask.getId());
currTaskService.updateCurrTaskById(currTaskById);
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
//return successful("创建成功,任务添加至等待执行队列。");
//apms创建成功后写入数据库
R<IdVo> mainTask = currTaskService.createProcessTask(param);
currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
CurrTask currTask = currTaskServiceBiz.getById(mainTask.getData().getId());
//工艺步骤中第一步
if (param.getAutoTaskStep() == 1) {
autoExeTask.setInterCode(CodeGeneratorHelper.getAutoTaskCode());
autoExeTask.setProcessFlowType(param.getAutoTaskType());
autoExeTask.setFTaskId(currTask.getId());
autoExeTask.setFDetTaskCode(currTask.getTaskCode());
autoExeTask.setFEquipmentId(currTask.getKilnId());
autoExeTask.setFEquipmentName(currTask.getKilnName());
autoExeTask.setFCraftCodeId(currTask.getCraftCodeId());
autoExeTask.setFPlcValue(currTask.getPlcValue());
setCommonField(autoExeTask);
autoExeTaskServiceBiz.save(autoExeTask);
}
if (param.getAutoTaskStep() == 2) {
autoExeTask.setTTaskId(currTask.getId());
autoExeTask.setTDetTaskCode(currTask.getTaskCode());
autoExeTask.setTEquipmentId(currTask.getKilnId());
autoExeTask.setTEquipmentName(currTask.getKilnName());
autoExeTask.setTCraftCodeId(currTask.getCraftCodeId());
autoExeTask.setTPlcValue(currTask.getPlcValue());
setUpdateCommonField(autoExeTask);
autoExeTaskServiceBiz.updateById(autoExeTask);
}
if (param.getAutoTaskStep() == 3) {
autoExeTask.setThTaskId(currTask.getId());
autoExeTask.setThDetTaskCode(currTask.getTaskCode());
autoExeTask.setThEquipmentId(currTask.getKilnId());
autoExeTask.setThEquipmentName(currTask.getKilnName());
autoExeTask.setThCraftCodeId(currTask.getCraftCodeId());
autoExeTask.setThPlcValue(currTask.getPlcValue());
setUpdateCommonField(autoExeTask);
autoExeTaskServiceBiz.updateById(autoExeTask);
}
//将返回的生产单号写入到主任务中。
CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
//currTaskById.setSheetNo(sheetNo);
currTaskById.setAutoExeTaskId(autoExeTask.getId());
currTaskService.updateCurrTaskById(currTaskById);
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
//return successful("创建成功,任务添加至等待执行队列。");
//}
//else
@@ -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,26 +313,30 @@ 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());
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 {
Long aLong = taskDistanceUtils.chooseVehicle(testRgv.getStartPoint(), testRgv.getEndPoint());
Boolean aBoolean = taskDistanceUtils.conflictForVehicle(testRgv.getVehicleId(), testRgv.getStartPoint(), testRgv.getEndPoint(), testRgv.getOtherVehicle());
return String.valueOf(aLong)+String.valueOf(aBoolean);
return String.valueOf(aLong) + String.valueOf(aBoolean);
}
private Integer sendTaskToRgv(Integer taskType,Long vehicleId, Long currTaskId, Long startPoint, Long endPoint, Integer processNumber) {
private Integer sendTaskToRgv(Integer taskType, Long vehicleId, Long currTaskId, Long startPoint, Long endPoint, Integer processNumber) {
Map<String, Object> json = new HashMap();
// taskType 1 搬运
json.put("taskType", taskType);
@@ -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());
}
}

View File

@@ -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);
}
}

View File

@@ -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());
}
}

View File

@@ -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();
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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)

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -32,5 +32,11 @@ public class OrderInfoBasePageParam extends BasePageParam {
@ApiModelProperty(value = "标识卡号", required = true)
private String idenCardNum;
/**
* 客户名称APMS系统获取
*/
@ApiModelProperty(value = "客户名称", required = true)
private String customerName;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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删除生产单
*

View File

@@ -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);
}

View File

@@ -29,4 +29,8 @@ public interface StockInfoService {
* @return xx列表
*/
R<List<StockInfoVo>> list();
/**
* 置顶缓存库位顺序
*/
R<String> top(IdParam idParam);
}

View File

@@ -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;
}
}
}

View File

@@ -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) {
@@ -111,7 +110,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
BeanUtils.copyProperties(param, currTask);
currTask.setTaskType(TaskTypeEnum.WTK.getValue());
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
if (param.getAutoTaskType()!=0){
if (param.getAutoTaskType() != 0) {
currTask.setIsAuto(1);
}
@@ -131,11 +130,406 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
public R<PageVo<CurrTaskQueryVo>> currentTaskPage(CurrTaskQueryParam param) {
QueryWrapper<CurrTask> currTaskQueryWrapper = new QueryWrapper<>();
currTaskQueryWrapper.eq(CurrTask.VALID, 1);
currTaskQueryWrapper.in(CurrTask.STATUS,0,1);
currTaskQueryWrapper.in(CurrTask.STATUS, 0, 1);
Page<CurrTask> page = currTaskServiceBiz.page(new Page<>(param.getCurrent(), param.getSize()), currTaskQueryWrapper);
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());
@@ -163,22 +557,22 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
public R<String> deleteBySheetNo(String sheetNo) {
//一个生产单可能对应多个currTask,删除的时候查询是否对应多个如果对应多个自动循环删除所有currTask,当删除最后一条currTask时上报apms
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.SHEET_NO, sheetNo));
if (currTaskList.size()>1){
int i=0;
for (CurrTask currTask:currTaskList
) {
if (currTaskList.size() > 1) {
int i = 0;
for (CurrTask currTask : currTaskList
) {
i++;
if(currTask.getStatus()==0){
if (i==currTaskList.size()){
if (currTask.getStatus() == 0) {
if (i == currTaskList.size()) {
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
if (!apmsStartProcessR.getData().getSuccess()){
if (!apmsStartProcessR.getData().getSuccess()) {
return failed(apmsStartProcessR.getData().getMsg());
}
}
Long currTaskId = currTask.getId();
if (currTask.getIsAuto()==1){
if (currTask.getIsAuto() == 1) {
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
if (currTaskList2.size()==1){
if (currTaskList2.size() == 1) {
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
}
}
@@ -186,45 +580,44 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
currTaskDetService.deleteByCurrTaskId(currTaskId);
}
if (currTask.getStatus()==2){
if (currTask.getStatus() == 2) {
return failed("无法删除,任务已加工完成。");
}if (currTask.getStatus()==1){
}
if (currTask.getStatus() == 1) {
return failed("无法删除,任务正在执行中。");
}
}
return successful(0,"APMS生产单删除成功。","");
}else {
for (CurrTask currTask:currTaskList
) {
if (currTask.getStatus()==0){
return successful(0, "APMS生产单删除成功。", "");
} else {
for (CurrTask currTask : currTaskList
) {
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){
if (currTask.getIsAuto() == 1) {
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
if (currTaskList2.size()==1){
if (currTaskList2.size() == 1) {
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
}
}
currTaskServiceBiz.removeById(currTaskId);
currTaskDetService.deleteByCurrTaskId(currTaskId);
if (currTask.getIsAuto()==1){
if (currTask.getIsAuto() == 1) {
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
if (currTaskList2.size()==0){
if (currTaskList2.size() == 0) {
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
}
}
return successful(0,"APMS生产单删除成功。","");
}
else
{
return successful(0, "APMS生产单删除成功。", "");
} else {
return failed(apmsStartProcessR.getData().getMsg());
}
}
if (currTask.getStatus()==2){
if (currTask.getStatus() == 2) {
return failed("无法删除,任务已加工完成。");
}if (currTask.getStatus()==1){
}
if (currTask.getStatus() == 1) {
return failed("无法删除,任务正在执行中。");
}
@@ -237,24 +630,31 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
@Override
public R<String> deleteById(IdParam idParam) {
CurrTask currTask = currTaskServiceBiz.getById(idParam.getId());
if (currTask.getIsAuto()==1){
if (currTask.getIsAuto() == 1) {
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
for (CurrTask currTask1:currTaskList
) {
if (currTask1.getStatus()!=0){
for (CurrTask currTask1 : currTaskList
) {
if (currTask1.getStatus() != 0) {
return R.failed("该自动任务已有步骤在执行中或执行完成,不能删除!");
}
}
//能删除
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
for (CurrTask currTask1:currTaskList
) {
currTaskDetServiceBiz.remove(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID,currTask1.getId()));
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);
}
return R.ok(idParam.getId().toString());
}else {
currTaskDetServiceBiz.remove(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID,currTask.getId()));
} else {
currTaskDetServiceBiz.remove(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId()));
currTaskServiceBiz.removeById(idParam);
return R.ok(idParam.getId().toString());
}
@@ -299,10 +699,16 @@ 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){
if (currTask.getIsAuto() == 1) {
List<AutoExeTask> exeTaskList = autoExeTaskServiceBiz.list(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, taskId));
if (exeTaskList.size()==0){
if (exeTaskList.size() == 0) {
return R.failed("该任务为多步骤加工任务且该步骤不是第一步,请选择第一步骤任务执行!");
}
}
@@ -316,6 +722,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
/**
* 传入任务id,查询任务炉子,然后根据炉子查询等待列表,然后时间置为早
*
* @param idParam
* @return
*/
@@ -323,24 +730,154 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
public R<String> top(IdParam idParam) {
CurrTask currTask = currTaskServiceBiz.getById(idParam.getId());
currTask.getIsCache();
if (currTask.getIsCache()==0){
if (currTask.getIsCache() == 0) {
return R.failed("当前任务未进入等待队列,不能置顶");
}
Long kilnId = currTask.getKilnId();
List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>()
.eq(InStockInfo.KILN_ID, kilnId)
.eq(InStockInfo.TYPE,1)
.eq(InStockInfo.STATUS,0)
.eq(InStockInfo.TYPE, 1)
.eq(InStockInfo.STATUS, 2)
.orderByAsc(InStockInfo.IN_TIME));
if (inStockInfoList.size()<2){
if (inStockInfoList.size() < 2) {
return R.failed("当前加工炉等待队列只有一个任务,无需置顶");
}
LocalDateTime inTime=null;
LocalDateTime inTime = null;
inTime = inStockInfoList.get(0).getInTime();
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.LOCATION_ID, currTask.getLocationId()));
inStockInfo.setInTime(inTime.minusHours(1));
inStockInfoServiceBiz.updateById(inStockInfo);
return R.ok("当前任务置顶成功","");
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() + "任务为多步骤任务但该步骤不生成洗炉炉号.");
}
}
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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("当前任务置顶成功","");
}
}

View File

@@ -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();
}
}

View File

@@ -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));
}

View File

@@ -91,7 +91,7 @@ public class AsynRunTaskService extends BaseService {
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask));
//检查车辆是否冲突,冲突则避让
rgvStatus(vehicleId, currTask,currTask.getStartPosition(),currTask.getTargetPosition());
rgvStatus(vehicleId, currTask, currTask.getStartPosition(), currTask.getTargetPosition());
//新建一条执行任务的关系表存放任务执行信息
RunTask runTask = new RunTask();
runTask.setTaskId(currTask.getId());
@@ -105,7 +105,7 @@ public class AsynRunTaskService extends BaseService {
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
PointInfo pointInfo = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition()));
Long endPoint = pointInfo.getCode();
logger.info("加工炉: "+pointInfo.getName()+"可用未满,调用车辆: "+vehicleId+" 起点为提升台终点为工业炉");
logger.info("加工炉: " + pointInfo.getName() + "可用未满,调用车辆: " + vehicleId + " 起点为提升台终点为工业炉");
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
logger.info(String.valueOf(status));
//执行成功,托盘进炉
@@ -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);
//更新小车状态
@@ -134,7 +136,7 @@ public class AsynRunTaskService extends BaseService {
apmsCreateProcess(currTask);
} else {
int secondSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
if (secondSetp>0){
if (secondSetp > 0) {
//当前任务为自动任务里的第二步先上报第一步的apms-endProcess
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
CurrTask firstCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
@@ -146,7 +148,7 @@ public class AsynRunTaskService extends BaseService {
apmsStartProcess(currTask);
}
int threeSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
if (threeSetp>0){
if (threeSetp > 0) {
//当前任务为自动任务里的第三步先上报第二步的apms处理endProcess
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
@@ -169,8 +171,8 @@ public class AsynRunTaskService extends BaseService {
vehicleInfoServiceBiz.updateById(vehicle);
logger.info(String.valueOf(status));
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败===");
logger.info("任务 " + currTask.getTaskCode() + " 车辆从起点"+startPoint+"台到加工炉过程中失败。");
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从起点"+startPoint+"台到加工炉过程中失败。");
logger.info("任务 " + currTask.getTaskCode() + " 车辆从起点" + startPoint + "台到加工炉过程中失败。");
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从起点" + startPoint + "台到加工炉过程中失败。");
}
}
@@ -183,7 +185,7 @@ public class AsynRunTaskService extends BaseService {
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask));
//检查车辆是否冲突,冲突则避让
rgvStatus(vehicleId, currTask,location.getCode(),currTask.getTargetPosition());
rgvStatus(vehicleId, currTask, location.getCode(), currTask.getTargetPosition());
//新建一条执行任务的关系表存放任务执行信息
RunTask runTask = new RunTask();
runTask.setTaskId(currTask.getId());
@@ -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);
@@ -236,7 +240,7 @@ public class AsynRunTaskService extends BaseService {
apmsCreateProcess(currTask);
} else {
int secondSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
if (secondSetp>0){
if (secondSetp > 0) {
//从缓存区到加工炉的任务,其上一步已经报告了apmsend
//当前任务为自动任务里的第二步先上报第一步的apms-endProcess
//AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
@@ -248,7 +252,7 @@ public class AsynRunTaskService extends BaseService {
apmsStartProcess(currTask);
}
int threeSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
if (threeSetp>0){
if (threeSetp > 0) {
//当前任务为自动任务里的第三步先上报第二步的apms处理endProcess
//AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
//CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
@@ -282,12 +286,13 @@ public class AsynRunTaskService extends BaseService {
//工业炉已满,调用车辆起点为提升台,终点为缓存区
@Async("asyncServiceExecutor")
public void asynRunTaskToWarehouse(Long currTaskId, Long vehicleId,Location location) throws IOException {
public void asynRunTaskToWarehouse(Long currTaskId, Long vehicleId, Location location) throws IOException {
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());
rgvStatus(vehicleId, currTask, currTask.getStartPosition(), location.getCode());
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
RunTask runTask = new RunTask();
runTask.setTaskId(currTask.getId());
@@ -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表
@@ -334,17 +343,17 @@ public class AsynRunTaskService extends BaseService {
vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle);
//如果任务为多步骤任务的非第一步置前置任务isIn为2
if (currTask.getIsAuto()==1){
if (currTask.getIsAuto() == 1) {
int count = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTaskId));
if (count==0){
if (count == 0) {
int secondCount = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
if (secondCount==1){
if (secondCount == 1) {
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
CurrTask firstCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
firstCurrTask.setIsIn(2);
firstCurrTask.setStatus(2);
currTaskServiceBiz.updateById(firstCurrTask);
}else {
} else {
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
secondCurrTask.setIsIn(2);
@@ -378,7 +387,7 @@ public class AsynRunTaskService extends BaseService {
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
Location location = locationServiceBiz.getOne(new QueryWrapper<Location>().eq(Location.CODE, currTask.getOutTargetPosition()));
//检查车辆是否冲突,冲突则避让
rgvStatus(vehicleId, currTask,currTask.getStartPosition(),location.getCode());
rgvStatus(vehicleId, currTask, currTask.getStartPosition(), location.getCode());
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
RunTask runTask = new RunTask();
runTask.setTaskId(currTask.getId());
@@ -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());
@@ -434,33 +444,33 @@ public class AsynRunTaskService extends BaseService {
vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle);
//任务为非自动任务上报apms-end-finish
if (currTask.getIsAuto()==0) {
if (currTask.getIsAuto() == 0) {
//上报apms完成处理
logger.info("此任务为单步骤任务任务结束上报apms-end-finish");
apmsEndProcess(currTask);
apmsFinishProcess(currTask);
} else {
int firstSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTaskId));
if (firstSetp>0){
if (firstSetp > 0) {
//当前任务为自动任务的第一步
apmsEndProcess(currTask);
}
int secondSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
if (secondSetp>0){
if (secondSetp > 0) {
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
if (autoExeTask.getProcessFlowType()==1){
if (autoExeTask.getProcessFlowType() == 1) {
logger.info("此任务为为自动任务里的第二步且一共只有两步任务结束上报apms-end-finish");
//当前任务为自动任务里的第三步且一共只有两步先上报apms处理endProcess
apmsEndProcess(currTask);
//再上报apms-finishProcess
apmsFinishProcess(currTask);
}else {
} else {
//当前任务为三步中的第二步
apmsEndProcess(currTask);
}
}
int threeSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
if (threeSetp>0){
if (threeSetp > 0) {
logger.info("此任务为为自动任务里的第三步任务结束上报apms-end-finish");
//当前任务为自动任务里的第三步先上报apms处理endProcess
apmsEndProcess(currTask);
@@ -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 {
} else {
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2,执行成功===");
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位1,执行成功===");
}
}
} else {
@@ -525,7 +536,7 @@ public class AsynRunTaskService extends BaseService {
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + 1 + "移动到点位12执行失败===");
// 2022/3/6 websocket通知页面
webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + 1 + "移动到点位12执行失败");
}else {
} else {
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + 1 + "移动到点位12执行成功===");
}
}
@@ -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);
@@ -1235,13 +1282,13 @@ public class AsynRunTaskService extends BaseService {
currTask.setSheetNo(processSheet.getData().getSheetNo());
currTaskServiceBiz.updateById(currTask);
//多步骤任务除了第一步写入sheetNo
if (currTask.getIsAuto()==1){
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){
if (autoExeTask.getProcessFlowType() == 2) {
CurrTask threeCurrTask = currTaskServiceBiz.getById(autoExeTask.getThTaskId());
threeCurrTask.setSheetNo(currTask.getSheetNo());
currTaskServiceBiz.updateById(threeCurrTask);
@@ -1253,17 +1300,21 @@ public class AsynRunTaskService extends BaseService {
/**
* 上报apms开始加工
*
* @param currTask
* @return
*/
private Boolean apmsStartProcess(CurrTask currTask) {
String code = kilnInfoServiceBiz.getById(currTask.getKilnId()).getCode();
ApmsStartProcess apmsStartProcess=new ApmsStartProcess();
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());
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){
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,10 +1350,11 @@ public class AsynRunTaskService extends BaseService {
/**
* 上报apms-finish
*
* @param currTask
* @return
*/
private Boolean apmsFinishProcess(CurrTask currTask){
private Boolean apmsFinishProcess(CurrTask currTask) {
logger.info("任务:" + currTask.getTaskCode() + "开始上报apms完成生产单");
ApmsFinishProcessSheet apmsFinishProcessSheet = new ApmsFinishProcessSheet();
apmsFinishProcessSheet.setSheetNo(currTask.getSheetNo());
@@ -1322,30 +1379,32 @@ public class AsynRunTaskService extends BaseService {
}
return true;
}
/**
* 车辆是否在线
*
* @param vehicleId 车辆id
* @return true/false
* @throws IOException plc访问失败
* @throws IOException plc访问失败
*/
private Boolean rgvOnline(Long vehicleId) throws IOException {
String identifier=null;
if (vehicleId==1){
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Online";
String identifier = null;
if (vehicleId == 1) {
identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Online";
}
if (vehicleId==2){
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Online";
if (vehicleId == 2) {
identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Online";
}
Map<String, Object> json = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier",identifier);
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("获取车辆"+vehicleId+"当前是否在线失败");
logger.info("获取车辆" + vehicleId + "当前是否在线失败");
}
Boolean online = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
return online;
@@ -1353,55 +1412,56 @@ public class AsynRunTaskService extends BaseService {
/**
* 传入车辆ID,检查另一辆车是否在线,如果在线,检查是否位置冲突,冲突则避让。若另一辆车不在线,则不检查是否冲突。
*
* @param vehicleId
* @param currTask
* @throws IOException
*/
private void rgvStatus(Long vehicleId,CurrTask currTask,String startPosition,String targetPosition) throws IOException {
private void rgvStatus(Long vehicleId, CurrTask currTask, String startPosition, String targetPosition) throws IOException {
Long currTaskId = currTask.getId();
if (vehicleId==1){
Long anotherVehicleId=2L;
if (vehicleId == 1) {
Long anotherVehicleId = 2L;
Boolean rgv2Online = rgvOnline(anotherVehicleId);
if (rgv2Online){
if (rgv2Online) {
//获取RGV2当前位置
Double rgv2CurrPosition = RGVCurrPosition(2);
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, startPosition, targetPosition, rgv2CurrPosition);
if (conflictBoolean){
Integer status = moveRgv(2, currTaskId, 2,0);
if (conflictBoolean) {
Integer status = moveRgv(2, currTaskId, 1, 0);
logger.info(status.toString());
if (status!=1){
logger.info("===执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位2,执行失败===");
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位2执行失败");
}else {
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位2,执行成功===");
if (status != 1) {
logger.info("===执行任务:" + currTask.getTaskCode() + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位1,执行失败===");
webSocketServer.sendtoAll(LocalDateTime.now() + "执行任务:" + currTask.getTaskCode() + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2执行失败");
} else {
logger.info("===执行任务:" + currTaskId + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位1,执行成功===");
}
}
}else {
} else {
logger.info("RGV2不在线跳过检测是否避让。");
}
}else {
Long anotherVehicleId=1L;
} else {
Long anotherVehicleId = 1L;
Boolean rgv1Online = rgvOnline(anotherVehicleId);
if (rgv1Online){
if (rgv1Online) {
//获取RGV1当前位置
Double rgv1CurrPosition = RGVCurrPosition(1);
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), currTask.getTargetPosition(), rgv1CurrPosition);
if (conflictBoolean){
Integer status = moveRgv(1, currTaskId, 39,0);
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, startPosition, targetPosition, rgv1CurrPosition);
if (conflictBoolean) {
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执行失败");
}else {
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位12执行成功===");
if (status != 1) {
logger.info("===执行任务:" + currTaskId + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位12执行失败===");
webSocketServer.sendtoAll(LocalDateTime.now() + "执行任务:" + currTask.getTaskCode() + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位12执行失败");
} else {
logger.info("===执行任务:" + currTaskId + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位12执行成功===");
}
}
}else {
} else {
logger.info("RGV1不在线跳过检测是否避让。");
}
}
@@ -1409,14 +1469,15 @@ public class AsynRunTaskService extends BaseService {
/**
* 判断任务是否为单步骤任务,多步骤任务第一步
*
* @param currTask 任务
* @return 单步骤任务true多步骤任务第一步true,其他false
*/
public Boolean isFirstTask(CurrTask currTask){
if (currTask.getIsAuto()==1){
public Boolean isFirstTask(CurrTask currTask) {
if (currTask.getIsAuto() == 1) {
int count = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTask.getId()));
return count>0;
}else {
return count > 0;
} else {
return true;
}
}

View File

@@ -63,6 +63,7 @@ public class RunTaskUtils {
/**
* 进炉加工
*
* @param currTaskId 任务id
* @return R
* @throws InterruptedException
@@ -74,25 +75,25 @@ public class RunTaskUtils {
PointInfo startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, startPosition));
// 可以根据点位类型判断起点是否为液压台(2是液压台)
Integer startPointType = startPoint.getType();
if (startPointType==2){
if (startPointType == 2) {
Map<String, Object> yeya = new HashMap();
//type=1为 入
yeya.put("type", 1);
if ("YYT003".equals(currTask.getStartPosition())){
if ("YYT003".equals(currTask.getStartPosition())) {
yeya.put("number", 3);
}
if ("YYT004".equals(currTask.getStartPosition())){
if ("YYT004".equals(currTask.getStartPosition())) {
yeya.put("number", 4);
}
if ("YYT002".equals(currTask.getStartPosition())){
if ("YYT002".equals(currTask.getStartPosition())) {
yeya.put("number", 2);
}
if ("YYT001".equals(currTask.getStartPosition())){
if ("YYT001".equals(currTask.getStartPosition())) {
yeya.put("number", 1);
}
String yeyaJudgeStatus = JSON.toJSONString(yeya);
//判断起点液压台是否已放货且提升到位
String yeyaStatus=null;
String yeyaStatus = null;
try {
yeyaStatus = HttpClient.httpPost("http://192.168.6.51:8009/yeya/isReadyForYeyaStatus", yeyaJudgeStatus);
} catch (IOException e) {
@@ -100,13 +101,13 @@ public class RunTaskUtils {
logger.error(new Date() + "WCS接口超时未响应");
}
//taskStatus==3满足条件其他状态值说明液压台不满足开始任务的条件无货物或者有货物但是没提升到位
if (Integer.parseInt(JSONObject.parseObject(yeyaStatus).get("taskStatus").toString()) != 1){
return R.failed(startPoint.getName()+"号液压台不满足任务执行所必须的条件,请检查液压台是否有货物且提升到位!");
if (Integer.parseInt(JSONObject.parseObject(yeyaStatus).get("taskStatus").toString()) != 1) {
return R.failed(startPoint.getName() + "号液压台不满足任务执行所必须的条件,请检查液压台是否有货物且提升到位!");
}
}
//是否有小车在运行
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
if (vehicleInfoList.size()>0){
if (vehicleInfoList.size() > 0) {
//有小车在运行,提示当前有车辆在运行,请稍后
return R.failed("当前轨道有RGV车辆在运动请等待当前RGV车辆执行完毕再执行任务");
}
@@ -122,10 +123,10 @@ public class RunTaskUtils {
return R.failed("目标工业炉不可用!");
}
//工业炉可用未满
if (resultBoolean){
if (resultBoolean) {
//计算出路径最短的车辆id
Long vehicleId = taskDistanceUtils.chooseVehicle(currTask.getStartPosition(), currTask.getTargetPosition());
if (vehicleId==0){
if (vehicleId == 0) {
logger.info("两辆车都不在线,请检查后重试!");
return R.failed("两辆车都不在线,请检查后重试!");
}
@@ -139,7 +140,7 @@ public class RunTaskUtils {
currTask.setUpdateTime(LocalDateTime.now());
currTaskServiceBiz.updateById(currTask);
//异步调用车辆
asynRunTaskService.asynRunTask(currTask.getId(),vehicleId);
asynRunTaskService.asynRunTask(currTask.getId(), vehicleId);
return R.ok("操作成功,任务已开始执行。");
} else {
//工业炉已满
@@ -148,14 +149,14 @@ public class RunTaskUtils {
.eq(Location.STATUS, 0)
.eq(Location.VALID, 1));
//缓存区未满
if (count >0) {
if (count > 0) {
//分配一个缓存区库位
Location location = locationServiceBiz.list(new QueryWrapper<Location>()
.eq(Location.STATUS, 0)
.eq(Location.VALID, 1)).get(0);
//计算出路径最短的车辆id,起点液压台,终点缓存区库位点
Long vehicleId = taskDistanceUtils.chooseVehicle(currTask.getStartPosition(), location.getCode());
if (vehicleId==0){
if (vehicleId == 0) {
logger.info("两辆车都不在线,请检查后重试!");
return R.failed("两辆车都不在线,请检查后重试!");
}
@@ -177,9 +178,10 @@ 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);
asynRunTaskService.asynRunTaskToWarehouse(currTask.getId(), vehicleId, location);
return R.ok("操作成功!当前目标工业炉已满,托盘准备加入缓存区待加工队列。");
}
return R.failed("当前目标工业炉已满!缓存区已满!请稍后重试!");
@@ -190,6 +192,7 @@ public class RunTaskUtils {
* 加工完成、出炉。传入工业炉id查询正在该工业炉加工的currTask,查询是否有空闲车辆,有,
* (查询是否为自动任务,是,查询下一步的工业炉是否空闲,是,调车去下一工业炉加工,否,暂存缓存区)
* 呼叫车辆暂存缓存区车辆调度任务结束后结束后再查询缓R存区队列避免车辆路线冲突查询该工业炉的缓存区队列开始下一托盘货物调度进工业炉
*
* @return R
*/
public R runTaskForOutKiln(Long kilnId) throws IOException {
@@ -198,7 +201,7 @@ public class RunTaskUtils {
.eq("is_in", 1)
.eq("status", 1)
.eq("kiln_id", kilnId).orderByAsc(CurrTask.BEGIN_TIME));
if (currTaskList.size()==0){
if (currTaskList.size() == 0) {
return R.failed();
}
CurrTask currTask = currTaskList.get(0);
@@ -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,49 +329,50 @@ public class RunTaskUtils {
/**
* 从缓存区出库
* @param locationId 库位id
*
* @param locationId 库位id
* @param yeyaTaiCode 液压台code
* @return R
*/
public R runTaskForOut(Long locationId,String yeyaTaiCode) throws IOException {
public R runTaskForOut(Long locationId, String yeyaTaiCode) throws IOException {
Location location = locationServiceBiz.getById(locationId);
//是否有小车在运行
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
if (vehicleInfoList.size()>0){
if (vehicleInfoList.size() > 0) {
//有小车在运行,提示当前有车辆在运行,请稍后
return R.failed("当前轨道有RGV车辆在运动请等待当前RGV车辆执行完毕再执行任务");
}
Map<String, Object> yeya = new HashMap();
//type=1随意赋值不用type了
yeya.put("type", 1);
if ("YYT003".equals(yeyaTaiCode)){
yeya.put("number", 3);
}
if ("YYT004".equals(yeyaTaiCode)){
yeya.put("number", 4);
}
if ("YYT002".equals(yeyaTaiCode)){
yeya.put("number", 2);
}
if ("YYT001".equals(yeyaTaiCode)){
yeya.put("number", 1);
}
String yeyaJudgeStatus = JSON.toJSONString(yeya);
//判断起点液压台是否在线且提升到位
String yeyaStatus=null;
try {
yeyaStatus = HttpClient.httpPost("http://192.168.6.51:8009/yeya/isReadyForYeyaStatus", yeyaJudgeStatus);
} catch (IOException e) {
e.printStackTrace();
logger.error(new Date() + "WCS接口超时未响应");
}
//taskStatus==3满足条件其他状态值说明液压台不满足开始任务的条件无货物或者有货物但是没提升到位
if (Integer.parseInt(JSONObject.parseObject(yeyaStatus).get("taskStatus").toString()) != 1){
return R.failed("液压台"+yeyaTaiCode+"不满足任务执行所必须的条件,请检查液压台是否有货物且提升到位!");
}
Map<String, Object> yeya = new HashMap();
//type=1随意赋值不用type了
yeya.put("type", 1);
if ("YYT003".equals(yeyaTaiCode)) {
yeya.put("number", 3);
}
if ("YYT004".equals(yeyaTaiCode)) {
yeya.put("number", 4);
}
if ("YYT002".equals(yeyaTaiCode)) {
yeya.put("number", 2);
}
if ("YYT001".equals(yeyaTaiCode)) {
yeya.put("number", 1);
}
String yeyaJudgeStatus = JSON.toJSONString(yeya);
//判断起点液压台是否在线且提升到位
String yeyaStatus = null;
try {
yeyaStatus = HttpClient.httpPost("http://192.168.6.51:8009/yeya/isReadyForYeyaStatus", yeyaJudgeStatus);
} catch (IOException e) {
e.printStackTrace();
logger.error(new Date() + "WCS接口超时未响应");
}
//taskStatus==3满足条件其他状态值说明液压台不满足开始任务的条件无货物或者有货物但是没提升到位
if (Integer.parseInt(JSONObject.parseObject(yeyaStatus).get("taskStatus").toString()) != 1) {
return R.failed("液压台" + yeyaTaiCode + "不满足任务执行所必须的条件,请检查液压台是否有货物且提升到位!");
}
//计算出路径最短的车辆id
Long vehicleId = taskDistanceUtils.chooseVehicle(location.getCode(), yeyaTaiCode);
if (vehicleId==0){
if (vehicleId == 0) {
return R.failed("两辆车都不在线,请检查后重试!");
}
//占用车辆
@@ -368,7 +381,7 @@ public class RunTaskUtils {
vehicleInfo.setUpdateTime(LocalDateTime.now());
vehicleInfoServiceBiz.updateById(vehicleInfo);
//异步调用车辆
asynRunTaskService.asynRunOutStock(locationId,yeyaTaiCode,vehicleInfo.getId());
asynRunTaskService.asynRunOutStock(locationId, yeyaTaiCode, vehicleInfo.getId());
// TODO: 2022/3/19
System.out.println("操作成功,任务已开始执行。");
return R.ok("操作成功,任务已开始执行。");
@@ -376,39 +389,41 @@ public class RunTaskUtils {
/**
* 获取变量值
* @param nameSpace nameSpace前缀
*
* @param nameSpace nameSpace前缀
* @param variableName 变量名称
* @return result字符串
*/
private String readPlcToString(String nameSpace, String variableName){
String identifier=nameSpace.concat(variableName);
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);
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+" 的值失败");
logger.info("readPLC " + identifier + " 的值失败");
}
return result;
}
/**
* 判断液压台是否准备好放货
*
* @param platFormCode 液压台编码
* @return 是/否
*/
private Boolean platFormStatus(String platFormCode){
String identifier=null;
if ("YYT001".equals(platFormCode)){
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.Platform4ToWCS.";
private Boolean platFormStatus(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");
json.put("identifier", identifier + "Online");
String result = null;
try {
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
@@ -417,11 +432,11 @@ public class RunTaskUtils {
logger.info("获取液压台1当前是否在线失败");
}
Boolean aBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
if (aBoolean){
if (aBoolean) {
Map<String, Object> statusJson = new HashMap();
statusJson.put("nameSpace", 6);
statusJson.put("plcName", "plc1");
statusJson.put("identifier",identifier+"TaskState");
statusJson.put("identifier", identifier + "TaskState");
String statusResult = null;
try {
statusResult = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(statusJson));
@@ -430,21 +445,21 @@ public class RunTaskUtils {
logger.info("获取液压台1当前状态失败");
}
Integer status = Integer.valueOf(JSONObject.parseObject(statusResult).get("result").toString());
if (status==1){
if (status == 1) {
return true;
}else {
} else {
return false;
}
}else {
} else {
return false;
}
}
if ("YYT002".equals(platFormCode)){
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.Platform3ToWCS.";
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");
json.put("identifier", identifier + "Online");
String result = null;
try {
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
@@ -453,11 +468,11 @@ public class RunTaskUtils {
logger.info("获取液压台2当前是否在线失败");
}
Boolean aBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
if (aBoolean){
if (aBoolean) {
Map<String, Object> statusJson = new HashMap();
statusJson.put("nameSpace", 6);
statusJson.put("plcName", "plc1");
statusJson.put("identifier",identifier+"TaskState");
statusJson.put("identifier", identifier + "TaskState");
String statusResult = null;
try {
statusResult = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(statusJson));
@@ -466,41 +481,124 @@ public class RunTaskUtils {
logger.info("获取液压台2当前状态失败");
}
Integer status = Integer.valueOf(JSONObject.parseObject(statusResult).get("result").toString());
if (status==1){
if (status == 1) {
return true;
}else {
} else {
return false;
}
}else {
} else {
return false;
}
}
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访问失败
* @throws IOException plc访问失败
*/
private Boolean rgvOnline(Long vehicleId) throws IOException {
String identifier=null;
if (vehicleId==1){
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Online";
String identifier = null;
if (vehicleId == 1) {
identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Online";
}
if (vehicleId==2){
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Online";
if (vehicleId == 2) {
identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Online";
}
Map<String, Object> json = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier",identifier);
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("获取车辆"+vehicleId+"当前是否在线失败");
logger.info("获取车辆" + vehicleId + "当前是否在线失败");
}
Boolean online = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
return online;
@@ -508,28 +606,29 @@ public class RunTaskUtils {
/**
* 车辆是否空闲
*
* @param vehicleId 车辆id
* @return true/false
* @throws IOException plc访问失败
* @throws IOException plc访问失败
*/
private Boolean rgvFree(Long vehicleId) throws IOException {
String identifier=null;
if (vehicleId==1){
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Free";
String identifier = null;
if (vehicleId == 1) {
identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Free";
}
if (vehicleId==2){
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Free";
if (vehicleId == 2) {
identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Free";
}
Map<String, Object> json = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier",identifier);
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("获取车辆"+vehicleId+"当前是否空闲失败");
logger.info("获取车辆" + vehicleId + "当前是否空闲失败");
}
Boolean free = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
return free;

View File

@@ -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,20 +94,21 @@ public class ScheduledTask extends BaseService {
public void test() throws IOException {
}
//@Scheduled(fixedDelay = 1000*60)
public void testWebsocket() throws IOException {
//查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间,剩余时间,查询标识卡详情
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.IS_IN, 1));
if (currTaskList.size()==0){
if (currTaskList.size() == 0) {
return;
}
List<NowCurrTaskDetVo> nowCurrTaskDetVoList = BeanUtils.copyList(currTaskList, NowCurrTaskDetVo.class);
for (NowCurrTaskDetVo nowCurrTask:nowCurrTaskDetVoList
for (NowCurrTaskDetVo nowCurrTask : nowCurrTaskDetVoList
) {
Long kilnId = nowCurrTask.getKilnId();
Boolean kilnWorking = true;
//查询对应炉号是否Working
if (kilnWorking){
if (kilnWorking) {
String nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 0)
.eq(PlcNameSpace.TYPE, 0)
@@ -113,13 +120,13 @@ public class ScheduledTask extends BaseService {
Integer remainingTime = 122;
nowCurrTask.setSetupTime(setupTime);
nowCurrTask.setRemainingTime(remainingTime);
int completeness =(int) (((float)remainingTime/(float)setupTime )*100);
int completeness = (int) (((float) remainingTime / (float) setupTime) * 100);
nowCurrTask.setCompleteness(completeness);
nowCurrTask.setKilnCode("BMA1");
//标识卡详情
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
for (CurrTaskDetVo currTaskDetVo : currTaskDetVoList
) {
String customerName = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, currTaskDetVo.getIdenCardNum())).getCustomerName();
currTaskDetVo.setCustomer(customerName);
@@ -128,28 +135,28 @@ public class ScheduledTask extends BaseService {
}
}
System.out.println(JSON.toJSONString(nowCurrTaskDetVoList));
webSocketServer.sendtoUser(JSON.toJSONString(nowCurrTaskDetVoList),"2");
webSocketServer.sendtoUser(JSON.toJSONString(nowCurrTaskDetVoList), "2");
}
/**
* 正在加工的加工任务详情
*/
@Scheduled(fixedDelay = 1000*60)
@Scheduled(fixedDelay = 1000 * 60)
public void screen() throws IOException {
//查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间,剩余时间,查询标识卡详情
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>()
.eq(CurrTask.IS_IN, 1)
.eq(CurrTask.STATUS,1));
if (currTaskList.size()==0){
.eq(CurrTask.STATUS, 1));
if (currTaskList.size() == 0) {
return;
}
List<NowCurrTaskDetVo> nowCurrTaskDetVoList = BeanUtils.copyList(currTaskList, NowCurrTaskDetVo.class);
for (NowCurrTaskDetVo nowCurrTask:nowCurrTaskDetVoList
) {
for (NowCurrTaskDetVo nowCurrTask : nowCurrTaskDetVoList
) {
Long kilnId = nowCurrTask.getKilnId();
Boolean kilnWorking = kilnWorking(kilnId);
//查询对应炉号是否Working
if (kilnWorking){
if (kilnWorking) {
String nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 0)
.eq(PlcNameSpace.TYPE, 0)
@@ -157,80 +164,82 @@ 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;
Integer setupTime = 1;
//剩余时间
Integer remainingTime=0;
if (kilnInfo.getType()!=4){
if (kilnInfo.getType()==3){
Integer remainingTime = 0;
if (kilnInfo.getType() != 4) {
if (kilnInfo.getType() == 3) {
remainingTime = readPlc(nameSpace, "ProgramTimeRemaining").intValue();
}else {
} else {
remainingTime = readPlc(nameSpace, "ProgramTimeRemain").intValue();
}
}
if(kilnInfo.getType()==1||kilnInfo.getType()==3){
if (kilnInfo.getType() == 1 || kilnInfo.getType() == 3) {
//运行时间
Integer runTime = readPlc(nameSpace, "ProgramRunTime").intValue();
setupTime=runTime+remainingTime;
setupTime = runTime + remainingTime;
}
if (kilnInfo.getType()==2){
setupTime=readPlc(nameSpace, "SetTime").intValue();
if (kilnInfo.getType() == 2) {
setupTime = readPlc(nameSpace, "SetTime").intValue();
}
nowCurrTask.setSetupTime(setupTime);
nowCurrTask.setRemainingTime(remainingTime);
int completeness =(int) (((float)remainingTime/(float)setupTime )*100);
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
) {
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);
}
}
webSocketServer.sendtoUser(JSON.toJSONString(nowCurrTaskDetVoList),"2");
webSocketServer.sendtoUser(JSON.toJSONString(nowCurrTaskDetVoList), "2");
}
/**
* 查询加工完成的工业炉
*/
@Scheduled(fixedDelay = 1000*30)
@Scheduled(fixedDelay = 1000 * 30)
public void taskForStockToKiln() throws IOException {
//两辆车是否都空闲,只有两辆车都空闲才被允许做任务
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 0));
if (vehicleInfoList.size()==2){
if (vehicleInfoList.size() == 2) {
//遍历currTask为进行中且is_in为正在加工的工业炉状态若加工完毕调用runTaskForOutKiln
// 2022/3/6 有两托的判定哪一托好了(通过开始加工时间顺序排列)
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>()
.eq(CurrTask.STATUS, 1)
.eq(CurrTask.IS_IN, 1)
.orderByAsc(CurrTask.BEGIN_TIME));
for (CurrTask currTask :currTaskList
) {
for (CurrTask currTask : currTaskList
) {
Long kilnId = currTask.getKilnId();
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
PlcNameSpace plcNameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 0)
.eq(PlcNameSpace.TYPE, 0)
.eq(PlcNameSpace.EQ_ID,kilnId));
.eq(PlcNameSpace.EQ_ID, kilnId));
//通过允许出炉信号来判定是否加工完成
String result = readPlcToString(plcNameSpace.getName(), "AllowOut");
Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
if (resultBoolean){
if (resultBoolean) {
//调用RunTaskUtils.runTaskForOutKiln
logger.info(kilnInfo.getCode()+kilnInfo.getKilnAlias()+"识别到允许出炉信号,进入出库程序!");
logger.info(kilnInfo.getCode() + kilnInfo.getKilnAlias() + "识别到允许出炉信号,进入出库程序!");
//更新加工单工艺结束时间,只更新一次,因为可能因为不满住出炉条件而进入到下一次定时任务,
if ("null".equals(String.valueOf(currTask.getEndTime()))){
if ("null".equals(String.valueOf(currTask.getEndTime()))) {
currTask.setEndTime(LocalDateTime.now());
currTaskServiceBiz.updateById(currTask);
//存入历史任务表以便查询能源消耗
TaskHis taskHis=new TaskHis();
org.springframework.beans.BeanUtils.copyProperties(currTask,taskHis);
TaskHis taskHis = new TaskHis();
org.springframework.beans.BeanUtils.copyProperties(currTask, taskHis);
taskHis.setStatus(2);
taskHis.setIsIn(2);
taskHis.setTaskId(currTask.getId());
@@ -239,8 +248,10 @@ public class ScheduledTask extends BaseService {
List<TaskDetHis> taskDetHisList = BeanUtils.copyList(currTaskDets, TaskDetHis.class);
taskDetHisServiceBiz.saveBatch(taskDetHisList);
//加工结束而没有立马出炉,加工结束记录能源消耗值只记录一次
asynRunTaskService.asynEndRecordConsume(currTask.getId(),kilnId);
logger.info(kilnInfo.getCode()+"炉子中的任务:"+currTask.getId()+"已加工结束,记录加工结束能源消耗值");
asynRunTaskService.asynEndRecordConsume(currTask.getId(), kilnId);
apmsEndProcess(currTask);
logger.info(currTask+"上报apms结束当前工艺加工");
logger.info(kilnInfo.getCode() + "炉子中的任务:" + currTask.getId() + "已加工结束,记录加工结束能源消耗值");
}
runTaskUtils.runTaskForOutKiln(kilnId);
break;
@@ -250,49 +261,60 @@ public class ScheduledTask extends BaseService {
}
//查询出正在加工的工业炉遍历根据采集频率的不同采集高频数据能源消耗。暂定30秒
@Scheduled(fixedDelay = 1000*30)
public void getFastValue(){
@Scheduled(fixedDelay = 1000 * 30)
public void getFastValue() {
//加工炉列表
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>().in(KilnInfo.TYPE,1,3));
for (KilnInfo kilnInfo:kilnInfoList
) {
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>().in(KilnInfo.TYPE, 1, 3));
for (KilnInfo kilnInfo : kilnInfoList
) {
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 0)
.eq(PlcNameSpace.EQ_ID, kilnInfo.getId())
.eq(PlcNameSpace.TYPE,0));
.eq(PlcNameSpace.TYPE, 0));
String nameSpaceNote = nameSpace.getName();
String result = readPlcToString(nameSpaceNote, "Working");
Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
//该炉子在工作中
if (resultBoolean){
if (resultBoolean) {
Long kilnId = kilnInfo.getId();
String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber");
Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
if (currTaskId==0){
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");
currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
}
if (currTaskId == 0) {
continue;
}
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
//任务为null说明是已删除的任务不记录
if (currTask==null){
if (currTask == null) {
continue;
}
//任务结束时间不为null说明是已结束的任务不记录
if (currTask.getEndTime()!=null){
if (currTask.getEndTime() != null) {
continue;
}
//任务不在加工状态,不记录
if (currTask.getIsIn()!=1){
if (currTask.getIsIn() != 1) {
continue;
}
//加工炉
if (kilnInfo.getType()==1){
if (kilnInfo.getType() == 1) {
//一号油搅拌转速
Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1");
//二号油搅拌转速
Double oilStirringSpeed2 = readPlc(nameSpaceNote, "OilStirringSpeed2");
ParRotSpeedValue parRotSpeedValue=new ParRotSpeedValue();
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());
@@ -309,7 +331,7 @@ public class ScheduledTask extends BaseService {
Double actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
//设定碳势
Double setupCarbon = readPlc(nameSpaceNote, "SetupCarbon");
ParGasValue parGasValue=new ParGasValue();
ParGasValue parGasValue = new ParGasValue();
parGasValue.setNitFlowValue(nitrogenFlow.floatValue());
parGasValue.setAmmoniaFlowValue(ammoniaFlow.floatValue());
parGasValue.setMethanolFlow(methanolFlow.floatValue());
@@ -322,7 +344,7 @@ public class ScheduledTask extends BaseService {
parGasValueServiceBiz.save(parGasValue);
}
//氮化炉
if (kilnInfo.getType()==3){
if (kilnInfo.getType() == 3) {
//实际氮势
Double actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
//设定氮势
@@ -332,12 +354,12 @@ public class ScheduledTask extends BaseService {
//分解率
Double decompositionRate = readPlc(nameSpaceNote, "DecompositionRate");
//氨气量
Double ammoniaFlow=readPlc(nameSpaceNote,"AmmoniaFlow");
Double ammoniaFlow = readPlc(nameSpaceNote, "AmmoniaFlow");
//氮气量
Double nitrogenFlow=readPlc(nameSpaceNote,"NitrogenFlow");
Double nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow");
//二氧化碳量
Double carbonDioxideFlow = readPlc(nameSpaceNote, "CO2Flow");
ParGasValue parGasValue3=new ParGasValue();
ParGasValue parGasValue3 = new ParGasValue();
parGasValue3.setNitFlowValue(nitrogenFlow.floatValue());
parGasValue3.setAmmoniaFlowValue(ammoniaFlow.floatValue());
parGasValue3.setActualNitPotValue(actualCarbon.floatValue());
@@ -355,50 +377,63 @@ public class ScheduledTask extends BaseService {
}
//查询出正在加工的工业炉遍历根据采集频率的不同采集低频数据能源消耗。暂定3分钟一次
@Scheduled(fixedDelay = 1000*60*3)
public void getSlowValue(){
@Scheduled(fixedDelay = 1000 * 60 * 3)
public void getSlowValue() {
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list();
for (KilnInfo kilnInfo:kilnInfoList
) {
for (KilnInfo kilnInfo : kilnInfoList
) {
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 0)
.eq(PlcNameSpace.EQ_ID, kilnInfo.getId())
.eq(PlcNameSpace.TYPE,0));
.eq(PlcNameSpace.TYPE, 0));
String nameSpaceNote = nameSpace.getName();
String result = readPlcToString(nameSpaceNote, "Working");
Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
if (resultBoolean){
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");
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());
Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());*/
//任务id为0说明不是自动任务不记录
if (currTaskId==0){
if (currTaskId == 0) {
continue;
}
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
//任务为null说明是已删除的任务不记录
if (currTask==null){
if (currTask == null) {
continue;
}
//任务结束时间不为null说明是已结束的任务不记录
if (currTask.getEndTime()!=null){
if (currTask.getEndTime() != null) {
continue;
}
//任务不在加工状态,不记录
if (currTask.getIsIn()!=1){
if (currTask.getIsIn() != 1) {
continue;
}
//加工炉
if (kilnInfo.getType()==1){
if (kilnInfo.getType() == 1) {
//实际温度
Double actualTemp =readPlc(nameSpaceNote,"ActualTemp");
Double actualTemp = readPlc(nameSpaceNote, "ActualTemp");
//设定温度
Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
Double setUpTemp = readPlc(nameSpaceNote, "SetUpTemp");
//油槽实际温度
Double actualOilTemp = readPlc(nameSpaceNote, "ActualOilTemp");
//油槽设定温度
Double setUpOilTemp = readPlc(nameSpaceNote,"SetUpOilTemp");
ParTemValue parTemValue=new ParTemValue();
Double setUpOilTemp = readPlc(nameSpaceNote, "SetUpOilTemp");
ParTemValue parTemValue = new ParTemValue();
parTemValue.setSetTemValue(setUpTemp.floatValue());
parTemValue.setActTemValue(actualTemp.floatValue());
parTemValue.setOilTankSetTemValue(setUpOilTemp.floatValue());
@@ -408,15 +443,24 @@ public class ScheduledTask extends BaseService {
parTemValue.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue);
//电度值
Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
Double electricalValue = readPlc(nameSpaceNote, "ElectricalValue");
//A向电压
Double phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
Double phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage");
Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
ParEleValue parEleValue=new ParEleValue();
//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);
@@ -424,12 +468,12 @@ public class ScheduledTask extends BaseService {
parEleValueServiceBiz.save(parEleValue);
}
//回火炉
if (kilnInfo.getType()==2){
if (kilnInfo.getType() == 2) {
//实际温度
Double actualTemp =readPlc(nameSpaceNote,"ActualTemp");
Double actualTemp = readPlc(nameSpaceNote, "ActualTemp");
//设定温度
Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
ParTemValue parTemValue2=new ParTemValue();
Double setUpTemp = readPlc(nameSpaceNote, "SetUpTemp");
ParTemValue parTemValue2 = new ParTemValue();
parTemValue2.setSetTemValue(setUpTemp.floatValue());
parTemValue2.setActTemValue(actualTemp.floatValue());
parTemValue2.setKilnId(kilnId);
@@ -437,15 +481,22 @@ public class ScheduledTask extends BaseService {
parTemValue2.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue2);
//电度值
Double electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
Double electricalValue = readPlc(nameSpaceNote, "TotalElectricity");
//A向电压
Double phaseAVoltage = readPlc(nameSpaceNote,"AVoltage");
Double phaseAVoltage = readPlc(nameSpaceNote, "AVoltage");
Double phaseBVoltage = readPlc(nameSpaceNote, "BVoltage");
Double phaseCVoltage = readPlc(nameSpaceNote, "CVoltage");
ParEleValue parEleValue2=new ParEleValue();
//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);
@@ -453,18 +504,18 @@ public class ScheduledTask extends BaseService {
parEleValueServiceBiz.save(parEleValue2);
}
//氮化炉
if (kilnInfo.getType()==3){
if (kilnInfo.getType() == 3) {
//实际温度
Double actualTemp =readPlc(nameSpaceNote,"ActualTemp");
Double actualTemp = readPlc(nameSpaceNote, "ActualTemp");
//设定温度
Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
Double setUpTemp = readPlc(nameSpaceNote, "SetUpTemp");
//炉压
Double furnacePressure = readPlc(nameSpaceNote, "FurnacePressure");
//外一区温度
Double outerZoneITemperature = readPlc(nameSpaceNote, "OuterZoneITemperature");
//外二区温度
Double outerZone2Temperature = readPlc(nameSpaceNote, "OuterZone2Temperature");
ParTemValue parTemValue3=new ParTemValue();
ParTemValue parTemValue3 = new ParTemValue();
parTemValue3.setSetTemValue(setUpTemp.floatValue());
parTemValue3.setActTemValue(actualTemp.floatValue());
parTemValue3.setOuterZone1Temp(outerZoneITemperature.floatValue());
@@ -475,15 +526,22 @@ public class ScheduledTask extends BaseService {
parTemValue3.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue3);
//电度值
Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
Double electricalValue = readPlc(nameSpaceNote, "ElectricalValue");
//A向电压
Double phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
Double phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage");
Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
ParEleValue parEleValue3=new ParEleValue();
//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);
@@ -491,17 +549,24 @@ public class ScheduledTask extends BaseService {
parEleValueServiceBiz.save(parEleValue3);
}
//清洗炉
if (kilnInfo.getType()==4){
if (kilnInfo.getType() == 4) {
//电度值
Double electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
Double electricalValue = readPlc(nameSpaceNote, "TotalElectricity");
//A向电压
Double phaseAVoltage = readPlc(nameSpaceNote,"AVoltage");
Double phaseAVoltage = readPlc(nameSpaceNote, "AVoltage");
Double phaseBVoltage = readPlc(nameSpaceNote, "BVoltage");
Double phaseCVoltage = readPlc(nameSpaceNote, "CVoltage");
ParEleValue parEleValue4=new ParEleValue();
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);
@@ -514,36 +579,39 @@ public class ScheduledTask extends BaseService {
//遍历工业炉,空工业炉查询缓存区是否有等待加工的任务,
//待加工任务存在且没有状态为正在进炉的情况下,按照先进先出的规则选择待加工任务呼叫车辆进炉
@Scheduled(fixedDelay = 1000*60)
@Scheduled(fixedDelay = 1000 * 60)
public void runTaskForEmptyKiln() throws IOException {
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>()
.eq(KilnInfo.VALID, 1).eq(KilnInfo.STATUS, 0).orderByAsc(KilnInfo.TYPE));
// 呼叫车辆运送货物给炉子
//存在空闲工业炉
if (kilnInfoList.size()!=0) {
for (KilnInfo kilnInfo:kilnInfoList
) {
if (kilnInfoList.size() != 0) {
for (KilnInfo kilnInfo : kilnInfoList
) {
//查询是否有车辆正在执行任务如果有等。根据车辆是否正在运行可以避免出现前一个任务获取还没进去炉子炉子状态依然为allowIn从而继续发送任务的情况
List<VehicleInfo> vehicleInfos = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
if (vehicleInfos.size()>0){
if (vehicleInfos.size() > 0) {
return;
}
Boolean kilnReadyIn=false;
if (kilnInfo.getType()==1){
kilnReadyIn=kilnReadyIn(kilnInfo.getId());
if (kilnStopRecTask(kilnInfo.getId())){
continue;
}
Boolean kilnReadyIn = false;
if (kilnInfo.getType() == 1) {
kilnReadyIn = kilnReadyIn(kilnInfo.getId());
}
//查询炉子是否allowIn
Boolean kilnAllowIn = kilnAllowIn(kilnInfo.getId());
if (kilnReadyIn||kilnAllowIn){
if (kilnReadyIn || kilnAllowIn) {
//因为readyIn在多用炉第一托盘下油后一直存在,到出炉为止.所以查询当前炉子在加工的任务,大于一条,则不再根据readyIn发起任务
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>()
.eq(CurrTask.KILN_ID, kilnInfo.getId()).eq(CurrTask.IS_IN, 1).eq(CurrTask.STATUS,1));
if (kilnInfo.getType()==1){
if (currTaskList.size()>1){
.eq(CurrTask.KILN_ID, kilnInfo.getId()).eq(CurrTask.IS_IN, 1).eq(CurrTask.STATUS, 1));
if (kilnInfo.getType() == 1) {
if (currTaskList.size() > 1) {
continue;
}
}else {
if (currTaskList.size()>0){
} else {
if (currTaskList.size() > 0) {
continue;
}
}
@@ -555,9 +623,13 @@ public class ScheduledTask extends BaseService {
.orderByAsc(InStockInfo.IN_TIME));
if (inStockInfoList.size() > 0) {
InStockInfo inStockInfo = inStockInfoList.get(0);
logger.info("加工炉"+kilnInfo.getCode()+"readyIn为"+kilnReadyIn.toString()+" allowIn为"+kilnAllowIn.toString());
logger.info("缓存区等待队列第一位:"+inStockInfo.toString());
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));
@@ -566,13 +638,13 @@ public class ScheduledTask extends BaseService {
//计算出路径最短的车辆id
Long vehicleId = taskDistanceUtils.chooseVehicle(location.getCode(), kilnInfo.getCode());
//占用车辆
if (vehicleId!=0){
if (vehicleId != 0) {
VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
vehicleInfo.setStatus(1);
vehicleInfo.setUpdateTime(LocalDateTime.now());
vehicleInfoServiceBiz.updateById(vehicleInfo);
asynRunTaskService.asynRunTaskForStockToKiln(inStockInfo.getId(), vehicleId);
}else {
} else {
logger.info("当前两辆车都不在线.无法发起任务!");
}
}
@@ -584,11 +656,11 @@ public class ScheduledTask extends BaseService {
}
//遍历正在工作炉子的报警变量,记录报警
@Scheduled(fixedDelay = 1000*60)
public void listenKilnAlarm(){
@Scheduled(fixedDelay = 1000 * 60)
public void listenKilnAlarm() {
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list();
for (KilnInfo kilnInfo:kilnInfoList
) {
for (KilnInfo kilnInfo : kilnInfoList
) {
PlcNameSpace kilnNameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 0)
.eq(PlcNameSpace.EQ_ID, kilnInfo.getId()));
@@ -596,53 +668,53 @@ public class ScheduledTask extends BaseService {
String working = readPlcToString(kilnNameSpace.getName(), "Working");
JSONObject jsonObject = JSON.parseObject(working);
Boolean aBoolean = Boolean.valueOf(String.valueOf(jsonObject.get("result")));
if (aBoolean){
if (aBoolean) {
//命名空间前缀
String nameSpace = kilnNameSpace.getName();
//炉子的报警变量
List<PlcNameSpace> alarmNameList = plcNameSpaceServiceBiz.list(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 1)
.eq(PlcNameSpace.TYPE, 1)
.eq(PlcNameSpace.EQ_ID,kilnInfo.getId()));;
for (PlcNameSpace plcNameSpace:alarmNameList
.eq(PlcNameSpace.EQ_ID, kilnInfo.getId()));
;
for (PlcNameSpace plcNameSpace : alarmNameList
) {
String name = plcNameSpace.getName();
Map<String, Object> json = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier",nameSpace+name);
json.put("identifier", nameSpace + name);
String jsonString = JSON.toJSONString(json);
try {
String result = HttpClient.httpPost("http://localhost:8009/opcua/read", jsonString);
Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
//报警状态为true
if (resultBoolean){
if (resultBoolean) {
//任务状态为执行中且正在炉子中加工的任务
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>()
.eq(CurrTask.KILN_ID, kilnInfo.getId())
.eq(CurrTask.IS_IN, 1)
.eq(CurrTask.STATUS, 1));
if (currTaskList.size()!=0){
for (CurrTask currTask:currTaskList
) {
AlarmInfo alarmInfo=new AlarmInfo();
if (currTaskList.size() != 0) {
for (CurrTask currTask : currTaskList
) {
AlarmInfo alarmInfo = new AlarmInfo();
alarmInfo.setEquipmentId(currTask.getKilnId());
alarmInfo.setEquipmentName(currTask.getKilnName());
alarmInfo.setType(0);
alarmInfo.setAlarmCode(CodeGeneratorHelper.getAlarmCode());
alarmInfo.setAlarmInfo(plcNameSpace.getEqName()+""+plcNameSpace.getNote());
alarmInfo.setAlarmInfo(plcNameSpace.getEqName() + "" + plcNameSpace.getNote());
alarmInfo.setTaskCode(currTask.getTaskCode());
alarmInfo.setCreateTime(LocalDateTime.now());
alarmInfoServiceBiz.save(alarmInfo);
}
}
else {
AlarmInfo alarmInfo=new AlarmInfo();
} else {
AlarmInfo alarmInfo = new AlarmInfo();
alarmInfo.setEquipmentId(kilnInfo.getId());
alarmInfo.setEquipmentName(kilnInfo.getKilnName());
alarmInfo.setType(0);
alarmInfo.setAlarmCode(CodeGeneratorHelper.getAlarmCode());
alarmInfo.setAlarmInfo(plcNameSpace.getEqName()+""+plcNameSpace.getNote());
alarmInfo.setAlarmInfo(plcNameSpace.getEqName() + "" + plcNameSpace.getNote());
alarmInfo.setTaskCode("0");
alarmInfo.setCreateTime(LocalDateTime.now());
alarmInfoServiceBiz.save(alarmInfo);
@@ -656,91 +728,105 @@ 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
) {
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
for (VehicleInfo vehicleInfo : vehicleInfoList
) {
Boolean rgvOnline = rgvOnline(vehicleInfo.getId());
Boolean rgvFree = rgvFree(vehicleInfo.getId());
if (!rgvOnline){
webSocketServer.sendtoUser("当前存在车辆不在线,请移动停用的车辆到轨道尽头处或者改车辆为线上模式,如果已经车辆停用,请忽略本提示消息。","1");
if (!rgvOnline) {
webSocketServer.sendtoUser("当前存在车辆不在线,请移动停用的车辆到轨道尽头处或者改车辆为线上模式,如果已经车辆停用,请忽略本提示消息。", "1");
}
if (rgvOnline&&rgvFree){
if (rgvOnline && rgvFree) {
vehicleInfo.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicleInfo);
logger.info("检测到车辆:"+vehicleInfo.getId()+" 显示状态为占用,实际状态为空闲。自动置车辆状态为空闲。");
logger.info("检测到车辆:" + vehicleInfo.getId() + " 显示状态为占用,实际状态为空闲。自动置车辆状态为空闲。");
}
}
}
/**
* 获取变量值
* @param nameSpace nameSpace前缀
*
* @param nameSpace nameSpace前缀
* @param variableName 变量名称
* @return result字符串
*/
private String readPlcToString(String nameSpace, String variableName){
String identifier=nameSpace.concat(variableName);
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);
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+" 的值失败");
logger.info("readPLC " + identifier + " 的值失败");
}
return result;
}
/**
* 获取变量值
* @param nameSpace nameSpace前缀
*
* @param nameSpace nameSpace前缀
* @param variableName 变量名称
* @return 变量值
*/
private Double readPlc(String nameSpace, String variableName){
String identifier=nameSpace.concat(variableName);
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);
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+" 的值失败");
logger.info("能源消耗统计:获取 " + identifier + " 的值失败");
}
return Double.valueOf(JSONObject.parseObject(result).get("result").toString());
}
private Boolean kilnAllowIn(Long kilnId){
private Boolean kilnAllowIn(Long kilnId) {
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 0)
.eq(PlcNameSpace.EQ_ID, kilnId)
.eq(PlcNameSpace.TYPE,0));
.eq(PlcNameSpace.TYPE, 0));
String nameSpaceNote = nameSpace.getName();
String result = readPlcToString(nameSpaceNote, "AllowIn");
return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
}
private Boolean kilnReadyIn(Long kilnId){
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));
.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)
.eq(PlcNameSpace.EQ_ID, kilnId)
.eq(PlcNameSpace.TYPE, 0));
String nameSpaceNote = nameSpace.getName();
String result = readPlcToString(nameSpaceNote, "ReadyIn");
return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
}
private Boolean kilnWorking(Long kilnId){
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));
.eq(PlcNameSpace.TYPE, 0));
String nameSpaceNote = nameSpace.getName();
String result = readPlcToString(nameSpaceNote, "Working");
return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
@@ -748,28 +834,29 @@ public class ScheduledTask extends BaseService {
/**
* 车辆是否在线
*
* @param vehicleId 车辆id
* @return true/false
* @throws IOException plc访问失败
* @throws IOException plc访问失败
*/
private Boolean rgvOnline(Long vehicleId) throws IOException {
String identifier=null;
if (vehicleId==1){
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Online";
String identifier = null;
if (vehicleId == 1) {
identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Online";
}
if (vehicleId==2){
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Online";
if (vehicleId == 2) {
identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Online";
}
Map<String, Object> json = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier",identifier);
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("获取车辆"+vehicleId+"当前是否在线失败");
logger.info("获取车辆" + vehicleId + "当前是否在线失败");
}
Boolean online = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
return online;
@@ -777,30 +864,54 @@ public class ScheduledTask extends BaseService {
/**
* 车辆是否空闲
*
* @param vehicleId 车辆id
* @return true/false
* @throws IOException plc访问失败
* @throws IOException plc访问失败
*/
private Boolean rgvFree(Long vehicleId) throws IOException {
String identifier=null;
if (vehicleId==1){
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Free";
String identifier = null;
if (vehicleId == 1) {
identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Free";
}
if (vehicleId==2){
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Free";
if (vehicleId == 2) {
identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Free";
}
Map<String, Object> json = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier",identifier);
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("获取车辆"+vehicleId+"当前是否空闲失败");
logger.info("获取车辆" + vehicleId + "当前是否空闲失败");
}
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;
}
}

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -97,4 +97,9 @@ public class CurrTaskQueryVo extends BaseVo implements PageVo.ConvertVo {
*/
@ApiModelProperty("车辆名称")
private Integer isAuto;
/**
* 是否缓存
*/
@ApiModelProperty("是否缓存")
private Integer isCache;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -9,6 +9,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import java.util.List;
/**
@@ -20,59 +21,74 @@ import java.util.List;
@Accessors(chain = true)
@Builder
@ApiModel(value = "当前正在加工炉任务详情视图对象", description = "用于查询当前正在加工炉任务详情")
public class NowCurrTaskDetVo extends BaseVo implements PageVo.ConvertVo{
public class NowCurrTaskDetVo extends BaseVo implements PageVo.ConvertVo {
/**
* 主键,自增
*/
@ApiModelProperty(value = "主键", example = "1")
private Long id;
/**
* currtask任务id
*/
@ApiModelProperty(value = "currtask任务id", example = "0")
private Long taskId;
/**
* currtask任务code
*/
@ApiModelProperty(value = "currtask任务code",example = "0")
@ApiModelProperty(value = "currtask任务code", example = "0")
private String taskCode;
/**
* 炉号
*/
@ApiModelProperty(value = "炉号", example = "0")
private String stoveCode;
/**
* 生产单号
*/
@ApiModelProperty(value = "生产单号",example = "0")
@ApiModelProperty(value = "生产单号", example = "0")
private String sheetNo;
/**
* 炉子id
*/
@ApiModelProperty(value = "炉子id",example = "0")
@ApiModelProperty(value = "炉子id", example = "0")
private Long kilnId;
/**
* 炉子code
*/
@ApiModelProperty(value = "炉子code",example = "0")
@ApiModelProperty(value = "炉子code", example = "0")
private String kilnCode;
/**
* 工艺plc值
*/
@ApiModelProperty(value = "工艺plc值",example = "0")
@ApiModelProperty(value = "工艺plc值", example = "0")
private Integer plcValue;
/**
* 工艺设定时间
*/
@ApiModelProperty(value = "工艺设定时间",example = "0")
@ApiModelProperty(value = "工艺设定时间", example = "0")
private Integer setupTime;
/**
* 工艺剩余时间
*/
@ApiModelProperty(value = "工艺剩余时间",example = "0")
@ApiModelProperty(value = "工艺剩余时间", example = "0")
private Integer remainingTime;
/**
* 工艺进度
*/
@ApiModelProperty(value = "工艺进度",example = "0")
@ApiModelProperty(value = "工艺进度", example = "0")
private Integer completeness;
/**
* 开始加工时间
*/
@ApiModelProperty(value = "开始加工时间", example = "0")
private LocalDateTime beginTime;
/**
* 标识卡list
*/
@ApiModelProperty(value = "标识卡list",example = "0")
@ApiModelProperty(value = "标识卡list", example = "0")
private List<CurrTaskDetVo> currTaskDetVoList;
}

View File

@@ -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;
}

View File

@@ -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;
/**
* 任务来源, 暂时只有人工
*/

View 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>