Compare commits

..

No commits in common. "14b05bae7ed8f20e80695a8defdfca12447e7de3" and "4531db10da39e27346cf454c36ba24d417916d08" have entirely different histories.

9 changed files with 29 additions and 235 deletions

View File

@ -24,7 +24,7 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.0</version> <version>1.0</version>
<name>wms-qj</name> <name>wms</name>
<description>wms</description> <description>wms</description>
<url>https://wms.picaiba.com</url> <url>https://wms.picaiba.com</url>
@ -51,12 +51,10 @@
<spring.redis.password><![CDATA["@WSXcde3"]]></spring.redis.password> <spring.redis.password><![CDATA["@WSXcde3"]]></spring.redis.password>
<spring.redis.database>5</spring.redis.database>--> <spring.redis.database>5</spring.redis.database>-->
<!-- database --> <!-- database -->
<!--<spring.datasource.url>jdbc:p6spy:mysql://localhost:3036/mt_wms_qj?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;useSSL=false--> <spring.datasource.url>jdbc:p6spy:mysql://192.168.6.51:30306/mt_wms_qj?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;useSSL=false
<spring.datasource.url>jdbc:p6spy:mysql://mysql.picaiba.com:30307/mt_wms_qj?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;useSSL=false
</spring.datasource.url> </spring.datasource.url>
<spring.datasource.username>root</spring.datasource.username> <spring.datasource.username>root</spring.datasource.username>
<!--<spring.datasource.password>ABC.10086</spring.datasource.password>--> <spring.datasource.password>ABC.10086</spring.datasource.password>
<spring.datasource.password>1qaz@WSX3edc$RFV</spring.datasource.password>
<!-- email --> <!-- email -->
<spring.mail.host>smtp.mxhichina.com</spring.mail.host> <spring.mail.host>smtp.mxhichina.com</spring.mail.host>
<!-- #25 ssl 465 --> <!-- #25 ssl 465 -->
@ -100,11 +98,11 @@
<spring.rabbitmq.username>wms</spring.rabbitmq.username> <spring.rabbitmq.username>wms</spring.rabbitmq.username>
<spring.rabbitmq.password>wms</spring.rabbitmq.password> <spring.rabbitmq.password>wms</spring.rabbitmq.password>
<!-- redis --> <!-- redis -->
<spring.redis.cluster.nodes>redis.picaiba.com:6380</spring.redis.cluster.nodes> <!-- <spring.redis.cluster.nodes>redis.picaiba.com:6380</spring.redis.cluster.nodes>
<spring.redis.host>redis.picaiba.com</spring.redis.host> <spring.redis.host>redis.picaiba.com</spring.redis.host>
<spring.redis.port>6380</spring.redis.port> <spring.redis.port>6380</spring.redis.port>
<spring.redis.password><![CDATA["@WSXcde3"]]></spring.redis.password> <spring.redis.password><![CDATA["@WSXcde3"]]></spring.redis.password>
<spring.redis.database>10</spring.redis.database> <spring.redis.database>10</spring.redis.database>-->
<!-- database --> <!-- database -->
<spring.datasource.url>jdbc:p6spy:mysql://mysql.picaiba.com:30306/wms?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;useSSL=false <spring.datasource.url>jdbc:p6spy:mysql://mysql.picaiba.com:30306/wms?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;useSSL=false
</spring.datasource.url> </spring.datasource.url>
@ -151,11 +149,11 @@
<spring.rabbitmq.username>wms</spring.rabbitmq.username> <spring.rabbitmq.username>wms</spring.rabbitmq.username>
<spring.rabbitmq.password>wms</spring.rabbitmq.password> <spring.rabbitmq.password>wms</spring.rabbitmq.password>
<!-- redis --> <!-- redis -->
<spring.redis.cluster.nodes>127.0.0.1:6379</spring.redis.cluster.nodes> <!-- <spring.redis.cluster.nodes>127.0.0.1:6379</spring.redis.cluster.nodes>
<spring.redis.host>127.0.0.1</spring.redis.host> <spring.redis.host>127.0.0.1</spring.redis.host>
<spring.redis.port>6379</spring.redis.port> <spring.redis.port>6379</spring.redis.port>
<spring.redis.password>2018</spring.redis.password> <spring.redis.password>2018</spring.redis.password>
<spring.redis.database>10</spring.redis.database> <spring.redis.database>10</spring.redis.database>-->
<!-- database --> <!-- database -->
<spring.datasource.url>jdbc:p6spy:mysql://localhost:3306/wms?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;useSSL=false <spring.datasource.url>jdbc:p6spy:mysql://localhost:3306/wms?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;useSSL=false
</spring.datasource.url> </spring.datasource.url>
@ -424,14 +422,6 @@
<skip>true</skip> <skip>true</skip>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<delimiters>@</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>

View File

@ -63,7 +63,7 @@ public class CraftInfoServiceImpl extends BaseService implements CraftInfoServic
public R<PageVo<CraftInfoVo>> page(CraftInfoQueryParam craftInfoQueryParam) { public R<PageVo<CraftInfoVo>> page(CraftInfoQueryParam craftInfoQueryParam) {
QueryWrapper<CraftInfo> wrapper=new QueryWrapper<>(); QueryWrapper<CraftInfo> wrapper=new QueryWrapper<>();
wrapper.like(StringUtils.isNotBlank(craftInfoQueryParam.getCraftCode()),CraftInfo.CRAFT_CODE,craftInfoQueryParam.getCraftCode()) wrapper.like(StringUtils.isNotBlank(craftInfoQueryParam.getCraftCode()),CraftInfo.CRAFT_CODE,craftInfoQueryParam.getCraftCode())
.orderByAsc(CraftInfo.CREATE_TIME); .orderByDesc(CraftInfo.CREATE_TIME);
Page<CraftInfo> page = craftInfoServiceBiz.page(new Page<>(craftInfoQueryParam.getCurrent(), craftInfoQueryParam.getSize()), wrapper); Page<CraftInfo> page = craftInfoServiceBiz.page(new Page<>(craftInfoQueryParam.getCurrent(), craftInfoQueryParam.getSize()), wrapper);
return successful(new PageVo<>(page,CraftInfoVo.class)); return successful(new PageVo<>(page,CraftInfoVo.class));
} }

View File

@ -20,7 +20,10 @@ import com.mt.wms.empty.enums.TaskTypeEnum;
import com.mt.wms.empty.params.AutoCurrTaskParam; import com.mt.wms.empty.params.AutoCurrTaskParam;
import com.mt.wms.empty.params.CurrTaskQueryParam; import com.mt.wms.empty.params.CurrTaskQueryParam;
import com.mt.wms.empty.params.TaskCreateParam; import com.mt.wms.empty.params.TaskCreateParam;
import com.mt.wms.empty.service.*; import com.mt.wms.empty.service.CurrTaskDetService;
import com.mt.wms.empty.service.CurrTaskService;
import com.mt.wms.empty.service.TaskDetHisService;
import com.mt.wms.empty.service.TaskHisService;
import com.mt.wms.empty.task.RunTaskUtils; import com.mt.wms.empty.task.RunTaskUtils;
import com.mt.wms.empty.task.TaskDistanceUtils; import com.mt.wms.empty.task.TaskDistanceUtils;
import com.mt.wms.empty.vo.ApmsEndProcessVo; import com.mt.wms.empty.vo.ApmsEndProcessVo;
@ -74,8 +77,6 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
TaskDistanceUtils taskDistanceUtils; TaskDistanceUtils taskDistanceUtils;
@Autowired @Autowired
RunTaskUtils runTaskUtils; RunTaskUtils runTaskUtils;
@Autowired
AutoExeTaskServiceBiz autoExeTaskServiceBiz;
@Override @Override
public CurrTaskVo getCurrTask(IdParam idParam) { public CurrTaskVo getCurrTask(IdParam idParam) {
@ -201,13 +202,6 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
@Override @Override
public R runTask(Long taskId) throws InterruptedException, IOException { public R runTask(Long taskId) throws InterruptedException, IOException {
CurrTask currTask = currTaskServiceBiz.getById(taskId); CurrTask currTask = currTaskServiceBiz.getById(taskId);
//是否为自动任务
if (currTask.getIsAuto()==1){
List<AutoExeTask> exeTaskList = autoExeTaskServiceBiz.list(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, taskId));
if (exeTaskList.size()==0){
return R.failed("该任务为多步骤加工任务且该步骤不是第一步,请选择第一步骤任务执行!");
}
}
return runTaskUtils.runTaskForInKiln(taskId); return runTaskUtils.runTaskForInKiln(taskId);
} }

View File

@ -176,7 +176,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
CurrTaskVo currTask = currTaskService.getCurrTask(IdParam.builder().id(orderInfo.getCurrTaskId()).build()); CurrTaskVo currTask = currTaskService.getCurrTask(IdParam.builder().id(orderInfo.getCurrTaskId()).build());
orderInfo.setABeginTime(currTask.getABeginTime()); orderInfo.setABeginTime(currTask.getABeginTime());
orderInfo.setAEndTime(currTask.getAEndTime()); orderInfo.setAEndTime(currTask.getAEndTime());
orderInfo.setTaskType(currTask.getProcessType()); orderInfo.setTaskType(currTask.getTaskType());
orderInfo.setStatus(currTask.getStatus()); orderInfo.setStatus(currTask.getStatus());
orderInfo.setKilnId(currTask.getKilnId()); orderInfo.setKilnId(currTask.getKilnId());
orderInfo.setStartPosition(currTask.getStartPosition()); orderInfo.setStartPosition(currTask.getStartPosition());

View File

@ -117,8 +117,6 @@ public class AsynRunTaskService extends BaseService {
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue()); Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
//执行成功,托盘进炉 //执行成功,托盘进炉
if (status==1){ if (status==1){
//开始记录能源消耗
asynStartRecordConsume(currTaskId,currTask.getKilnId());
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功==="); logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
//更新调度表状态为完成 //更新调度表状态为完成
runTask.setUpdateTime(LocalDateTime.now()); runTask.setUpdateTime(LocalDateTime.now());
@ -199,7 +197,6 @@ public class AsynRunTaskService extends BaseService {
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue()); Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
//执行成功,托盘进炉 //执行成功,托盘进炉
if (status==1){ if (status==1){
asynStartRecordConsume(currTaskId,currTask.getKilnId());
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功==="); logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
//更新调度表状态为完成 //更新调度表状态为完成
runTask.setUpdateTime(LocalDateTime.now()); runTask.setUpdateTime(LocalDateTime.now());
@ -395,8 +392,6 @@ public class AsynRunTaskService extends BaseService {
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode(); Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue()); Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
if (status==1){ if (status==1){
//加工完成记录结束时能源消耗
asynEndRecordConsume(currTaskId,currTask.getKilnId());
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功==="); logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
//更新关系表状态为完成 //更新关系表状态为完成
runTask.setUpdateTime(LocalDateTime.now()); runTask.setUpdateTime(LocalDateTime.now());

View File

@ -260,7 +260,7 @@ public class RunTaskUtils {
currTask.setOutTargetPosition(location.getCode()); currTask.setOutTargetPosition(location.getCode());
currTaskServiceBiz.updateById(currTask); currTaskServiceBiz.updateById(currTask);
// 2022/2/16 异步调用车辆 // 2022/2/16 异步调用车辆
asynRunTaskService.asynRunTaskForKilnToWarehouse(currTask.getId(),vehicleId); asynRunTaskService.asynRunTaskForKilnToWarehouse(currTask.getId(),vehicleInfoList.get(0).getId());
return R.ok("操作成功!当前目标窑炉已满,托盘加入缓存区待加工队列。"); return R.ok("操作成功!当前目标窑炉已满,托盘加入缓存区待加工队列。");
}else { }else {
return R.ok("当前缓存区已满,无法从加工炉出炉到缓存区。"); return R.ok("当前缓存区已满,无法从加工炉出炉到缓存区。");

View File

@ -6,12 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mt.wms.core.base.BaseService; import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.*; import com.mt.wms.core.dal.entity.*;
import com.mt.wms.core.dal.service.*; import com.mt.wms.core.dal.service.*;
import com.mt.wms.core.utils.BeanUtils;
import com.mt.wms.core.utils.CodeGeneratorHelper; import com.mt.wms.core.utils.CodeGeneratorHelper;
import com.mt.wms.core.utils.HttpClient; import com.mt.wms.core.utils.HttpClient;
import com.mt.wms.core.vo.R; import com.mt.wms.core.vo.R;
import com.mt.wms.empty.vo.CurrTaskDetVo;
import com.mt.wms.empty.vo.NowCurrTaskDetVo;
import com.mt.wms.empty.websocket.WebSocketServer; import com.mt.wms.empty.websocket.WebSocketServer;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -35,7 +32,7 @@ import java.util.Map;
@Component @Component
public class ScheduledTask extends BaseService { public class ScheduledTask extends BaseService {
private final static Logger logger = LoggerFactory.getLogger(ScheduledTask.class); private final static Logger logger = LoggerFactory.getLogger(AsynRunTaskService.class);
@Resource @Resource
private KilnInfoServiceBiz kilnInfoServiceBiz; private KilnInfoServiceBiz kilnInfoServiceBiz;
@ -69,109 +66,14 @@ public class ScheduledTask extends BaseService {
private RunTaskUtils runTaskUtils; private RunTaskUtils runTaskUtils;
@Resource @Resource
private WebSocketServer webSocketServer; private WebSocketServer webSocketServer;
@Resource
private CurrTaskDetServiceBiz currTaskDetServiceBiz;
@Resource
private OrderInfoServiceBiz orderInfoServiceBiz;
@Test
public void test() throws IOException {
}
@Scheduled(fixedDelay = 1000*60)
public void testWebsocket() throws IOException { public void testWebsocket() throws IOException {
//查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间剩余时间查询标识卡详情 webSocketServer.sendtoAll(LocalDateTime.now()+"测试");
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.IS_IN, 1));
List<NowCurrTaskDetVo> nowCurrTaskDetVoList = BeanUtils.copyList(currTaskList, NowCurrTaskDetVo.class);
for (NowCurrTaskDetVo nowCurrTask:nowCurrTaskDetVoList
) {
Long kilnId = nowCurrTask.getKilnId();
Boolean kilnWorking = true;
//查询对应炉号是否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();
//设定时间
// TODO: 2022/4/11 PLC变量名称设定时间和剩余时间统一命名
Integer setupTime = 300;
//剩余时间
Integer remainingTime = 122;
nowCurrTask.setSetupTime(setupTime);
nowCurrTask.setRemainingTime(remainingTime);
int completeness =(int) (((float)remainingTime/(float)setupTime )*100);
nowCurrTask.setCompleteness(completeness);
//标识卡详情
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.ORDER_NO, currTaskDetVo.getOrderNo())).getCustomerName();
currTaskDetVo.setCustomer(customerName);
}
nowCurrTask.setCurrTaskDetVoList(currTaskDetVoList);
}
}
System.out.println(JSON.toJSONString(nowCurrTaskDetVoList));
webSocketServer.sendtoUser(JSON.toJSONString(nowCurrTaskDetVoList),"2");
} }
/**
* 正在加工的加工任务详情
*/
//@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));
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.setKilnCode(kilnInfo.getCode());
//设定时间
Integer setupTime =1;
//剩余时间
Integer remainingTime=0;
if (kilnInfo.getType()!=4){
remainingTime = Integer.parseInt(readPlcToString(nameSpace, "ProgramTimeRemain"));
}
if(kilnInfo.getType()==1||kilnInfo.getType()==3){
//运行时间
Integer runTime = Integer.parseInt(readPlcToString(nameSpace, "ProgramRunTime"));
setupTime=runTime+remainingTime;
}
if (kilnInfo.getType()==2){
setupTime=Integer.parseInt(readPlcToString(nameSpace, "SetTime"));
}
nowCurrTask.setSetupTime(setupTime);
nowCurrTask.setRemainingTime(remainingTime);
int completeness =(int) (((float)remainingTime/(float)setupTime )*100);
nowCurrTask.setCompleteness(completeness);
//标识卡详情
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.ORDER_NO, currTaskDetVo.getOrderNo())).getCustomerName();
currTaskDetVo.setCustomer(customerName);
}
nowCurrTask.setCurrTaskDetVoList(currTaskDetVoList);
}
}
webSocketServer.sendtoAll(JSONObject.toJSONString(nowCurrTaskDetVoList));
}
/** /**
* 查询加工完成的窑炉 * 查询加工完成的窑炉
*/ */
//@Scheduled(fixedDelay = 1000*60*3)
public void taskForStockToKiln() throws IOException { public void taskForStockToKiln() throws IOException {
//两辆车是否都空闲只有两辆车都空闲才被允许做任务 //两辆车是否都空闲只有两辆车都空闲才被允许做任务
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 0)); List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 0));
@ -195,7 +97,6 @@ public class ScheduledTask extends BaseService {
Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
if (resultBoolean){ if (resultBoolean){
//调用RunTaskUtils.runTaskForOutKiln //调用RunTaskUtils.runTaskForOutKiln
logger.info(kilnInfo.getCode()+kilnInfo.getKilnAlias()+"识别到允许出炉信号,进入出库程序!");
runTaskUtils.runTaskForOutKiln(kilnId); runTaskUtils.runTaskForOutKiln(kilnId);
break; break;
} }
@ -203,6 +104,7 @@ public class ScheduledTask extends BaseService {
} }
} }
//查询出正在加工的窑炉遍历根据采集频率的不同采集高频数据能源消耗暂定30秒 //查询出正在加工的窑炉遍历根据采集频率的不同采集高频数据能源消耗暂定30秒
//@Scheduled(fixedDelay = 1000*30) //@Scheduled(fixedDelay = 1000*30)
public void getFastValue(){ public void getFastValue(){
@ -290,7 +192,6 @@ public class ScheduledTask extends BaseService {
} }
} }
} }
//查询出正在加工的窑炉遍历根据采集频率的不同采集低频数据能源消耗暂定3分钟一次 //查询出正在加工的窑炉遍历根据采集频率的不同采集低频数据能源消耗暂定3分钟一次
//@Scheduled(fixedDelay = 1000*60*3) //@Scheduled(fixedDelay = 1000*60*3)
public void getSlowValue(){ public void getSlowValue(){
@ -436,7 +337,7 @@ public class ScheduledTask extends BaseService {
//遍历窑炉空窑炉查询缓存区是否有等待加工的任务 //遍历窑炉空窑炉查询缓存区是否有等待加工的任务
//待加工任务存在且没有状态为正在进炉的情况下按照先进先出的规则选择待加工任务呼叫车辆进炉 //待加工任务存在且没有状态为正在进炉的情况下按照先进先出的规则选择待加工任务呼叫车辆进炉
//@Scheduled(fixedDelay = 1000*60) //@Scheduled(fixedDelay = 1000*30)
public void runTaskForEmptyKiln() throws IOException { public void runTaskForEmptyKiln() throws IOException {
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>() List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>()
.eq(KilnInfo.VALID, 1).eq(KilnInfo.STATUS, 0)); .eq(KilnInfo.VALID, 1).eq(KilnInfo.STATUS, 0));
@ -453,7 +354,7 @@ public class ScheduledTask extends BaseService {
//查询炉子是否allowIn //查询炉子是否allowIn
Boolean kilnAllowIn = kilnAllowIn(kilnInfo.getId()); Boolean kilnAllowIn = kilnAllowIn(kilnInfo.getId());
if (kilnAllowIn){ if (kilnAllowIn){
//缓存是否有目标位置为窑炉的待加工任务 //缓存是否有目标位置为窑炉的待加工任务
List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>() List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>()
.eq(InStockInfo.TYPE, 1) .eq(InStockInfo.TYPE, 1)
.eq(InStockInfo.KILN_ID, kilnInfo.getId()) .eq(InStockInfo.KILN_ID, kilnInfo.getId())
@ -483,7 +384,6 @@ public class ScheduledTask extends BaseService {
} }
//遍历正在工作炉子的报警变量记录报警 //遍历正在工作炉子的报警变量记录报警
//@Scheduled(fixedDelay = 1000*30)
public void listenKilnAlarm(){ public void listenKilnAlarm(){
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(); List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list();
for (KilnInfo kilnInfo:kilnInfoList for (KilnInfo kilnInfo:kilnInfoList
@ -540,10 +440,10 @@ public class ScheduledTask extends BaseService {
} }
//监听车辆是否在线暂时不用 //监听车辆是否在线
public void listenVehicleOnline() throws IOException { public void listenVehicleOnline() throws IOException {
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>() List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>()
.eq(VehicleInfo.STATUS, 0)); .eq(VehicleInfo.STATUS, 2));
for (VehicleInfo vehicleInfo:vehicleInfoList for (VehicleInfo vehicleInfo:vehicleInfoList
) { ) {
@ -603,15 +503,4 @@ public class ScheduledTask extends BaseService {
return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
} }
private Boolean kilnWorking(Long kilnId){
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 0)
.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());
}
} }

View File

@ -1,73 +0,0 @@
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.util.List;
/**
* @Author: LGH
* @Date: 2022/4/12
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder
@ApiModel(value = "当前正在加工炉任务详情视图对象", description = "用于查询当前正在加工炉任务详情")
public class NowCurrTaskDetVo extends BaseVo implements PageVo.ConvertVo{
/**
* 主键自增
*/
@ApiModelProperty(value = "主键", example = "1")
private Long id;
/**
* currtask任务code
*/
@ApiModelProperty(value = "currtask任务code",example = "0")
private String taskCode;
/**
* 炉子id
*/
@ApiModelProperty(value = "炉子id",example = "0")
private Long kilnId;
/**
* 炉子code
*/
@ApiModelProperty(value = "炉子code",example = "0")
private String kilnCode;
/**
* 工艺plc值
*/
@ApiModelProperty(value = "工艺plc值",example = "0")
private Integer plcValue;
/**
* 工艺设定时间
*/
@ApiModelProperty(value = "工艺设定时间",example = "0")
private Integer setupTime;
/**
* 工艺剩余时间
*/
@ApiModelProperty(value = "工艺剩余时间",example = "0")
private Integer remainingTime;
/**
* 工艺进度
*/
@ApiModelProperty(value = "工艺进度",example = "0")
private Integer completeness;
/**
* 标识卡list
*/
@ApiModelProperty(value = "标识卡list",example = "0")
private List<CurrTaskDetVo> currTaskDetVoList;
}

View File

@ -26,14 +26,13 @@ public class WebSocketServer {
//前端的id 右后端给他 //前端的id 右后端给他
public synchronized String getUniqeId(){ public synchronized String getUniqeId(){
//return UUID.randomUUID().toString()+System.currentTimeMillis(); return UUID.randomUUID().toString()+System.currentTimeMillis();
return id;
} }
//与某个客户端的连接会话需要通过它来给客户端发送数据 //与某个客户端的连接会话需要通过它来给客户端发送数据
private Session session; private Session session;
private static Logger log = LogManager.getLogger(WebSocketServer.class); private static Logger log = LogManager.getLogger(WebSocketServer.class);
private String id = getUniqeId(); private String id = "";
public Integer getCurrentNum(){ public Integer getCurrentNum(){
return webSocketSet.size(); return webSocketSet.size();
@ -136,15 +135,15 @@ public class WebSocketServer {
*/ */
public void sendtoUser(String message,String sendUserId) throws IOException { public void sendtoUser(String message,String sendUserId) throws IOException {
if (webSocketSet.get(sendUserId) != null) { if (webSocketSet.get(sendUserId) != null) {
//if(!id.equals(sendUserId)){ if(!id.equals(sendUserId)){
//webSocketSet.get(sendUserId).sendMessage( "用户" + id + "发来消息:" + " <br/> " + message); webSocketSet.get(sendUserId).sendMessage( "用户" + id + "发来消息:" + " <br/> " + message);
// } }
//else{ else{
webSocketSet.get(sendUserId).sendMessage(message); webSocketSet.get(sendUserId).sendMessage(message);
//} }
} else { } else {
//如果用户不在线则返回不在线信息给自己 //如果用户不在线则返回不在线信息给自己
//sendtoUser("当前用户不在线",id); sendtoUser("当前用户不在线",id);
} }
} }