Compare commits
	
		
			2 Commits
		
	
	
		
			4531db10da
			...
			14b05bae7e
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 14b05bae7e | |||
| 0dd56c1e8b | 
| @@ -24,7 +24,7 @@ | ||||
|     <packaging>pom</packaging> | ||||
|     <version>1.0</version> | ||||
|  | ||||
|     <name>wms</name> | ||||
|     <name>wms-qj</name> | ||||
|     <description>wms</description> | ||||
|     <url>https://wms.picaiba.com</url> | ||||
|  | ||||
| @@ -51,10 +51,12 @@ | ||||
|                 <spring.redis.password><![CDATA["@WSXcde3"]]></spring.redis.password> | ||||
|                 <spring.redis.database>5</spring.redis.database>--> | ||||
|                 <!-- database --> | ||||
|                 <spring.datasource.url>jdbc:p6spy:mysql://192.168.6.51:30306/mt_wms_qj?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false | ||||
|                 <!--<spring.datasource.url>jdbc:p6spy:mysql://localhost:3036/mt_wms_qj?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false--> | ||||
|                 <spring.datasource.url>jdbc:p6spy:mysql://mysql.picaiba.com:30307/mt_wms_qj?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false | ||||
|                 </spring.datasource.url> | ||||
|                 <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 --> | ||||
|                 <spring.mail.host>smtp.mxhichina.com</spring.mail.host> | ||||
|                 <!-- #25 ssl 465 --> | ||||
| @@ -98,11 +100,11 @@ | ||||
|                 <spring.rabbitmq.username>wms</spring.rabbitmq.username> | ||||
|                 <spring.rabbitmq.password>wms</spring.rabbitmq.password> | ||||
|                 <!-- 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.port>6380</spring.redis.port> | ||||
|                 <spring.redis.password><![CDATA["@WSXcde3"]]></spring.redis.password> | ||||
|                 <spring.redis.database>10</spring.redis.database>--> | ||||
|                 <spring.redis.database>10</spring.redis.database> | ||||
|                 <!-- database --> | ||||
|                 <spring.datasource.url>jdbc:p6spy:mysql://mysql.picaiba.com:30306/wms?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false | ||||
|                 </spring.datasource.url> | ||||
| @@ -149,11 +151,11 @@ | ||||
|                 <spring.rabbitmq.username>wms</spring.rabbitmq.username> | ||||
|                 <spring.rabbitmq.password>wms</spring.rabbitmq.password> | ||||
|                 <!-- 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.port>6379</spring.redis.port> | ||||
|                 <spring.redis.password>2018</spring.redis.password> | ||||
|                 <spring.redis.database>10</spring.redis.database>--> | ||||
|                 <spring.redis.database>10</spring.redis.database> | ||||
|                 <!-- database --> | ||||
|                 <spring.datasource.url>jdbc:p6spy:mysql://localhost:3306/wms?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false | ||||
|                 </spring.datasource.url> | ||||
| @@ -422,6 +424,14 @@ | ||||
|                         <skip>true</skip> | ||||
|                     </configuration> | ||||
|                 </plugin> | ||||
|                 <plugin> | ||||
|                     <groupId>org.apache.maven.plugins</groupId> | ||||
|                     <artifactId>maven-resources-plugin</artifactId> | ||||
|                     <configuration> | ||||
|                         <delimiters>@</delimiters> | ||||
|                         <useDefaultDelimiters>false</useDefaultDelimiters> | ||||
|                     </configuration> | ||||
|                 </plugin> | ||||
|             </plugins> | ||||
|         </pluginManagement> | ||||
|     </build> | ||||
|   | ||||
| @@ -63,7 +63,7 @@ public class CraftInfoServiceImpl extends BaseService implements CraftInfoServic | ||||
|     public R<PageVo<CraftInfoVo>> page(CraftInfoQueryParam craftInfoQueryParam) { | ||||
|         QueryWrapper<CraftInfo> wrapper=new QueryWrapper<>(); | ||||
|         wrapper.like(StringUtils.isNotBlank(craftInfoQueryParam.getCraftCode()),CraftInfo.CRAFT_CODE,craftInfoQueryParam.getCraftCode()) | ||||
|                 .orderByDesc(CraftInfo.CREATE_TIME); | ||||
|                 .orderByAsc(CraftInfo.CREATE_TIME); | ||||
|         Page<CraftInfo> page = craftInfoServiceBiz.page(new Page<>(craftInfoQueryParam.getCurrent(), craftInfoQueryParam.getSize()), wrapper); | ||||
|         return successful(new PageVo<>(page,CraftInfoVo.class)); | ||||
|     } | ||||
|   | ||||
| @@ -20,10 +20,7 @@ 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.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.service.*; | ||||
| import com.mt.wms.empty.task.RunTaskUtils; | ||||
| import com.mt.wms.empty.task.TaskDistanceUtils; | ||||
| import com.mt.wms.empty.vo.ApmsEndProcessVo; | ||||
| @@ -77,6 +74,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService | ||||
|     TaskDistanceUtils taskDistanceUtils; | ||||
|     @Autowired | ||||
|     RunTaskUtils runTaskUtils; | ||||
|     @Autowired | ||||
|     AutoExeTaskServiceBiz autoExeTaskServiceBiz; | ||||
|  | ||||
|     @Override | ||||
|     public CurrTaskVo getCurrTask(IdParam idParam) { | ||||
| @@ -202,6 +201,13 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService | ||||
|     @Override | ||||
|     public R runTask(Long taskId) throws InterruptedException, IOException { | ||||
|         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); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -176,7 +176,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic | ||||
|                     CurrTaskVo currTask = currTaskService.getCurrTask(IdParam.builder().id(orderInfo.getCurrTaskId()).build()); | ||||
|                     orderInfo.setABeginTime(currTask.getABeginTime()); | ||||
|                     orderInfo.setAEndTime(currTask.getAEndTime()); | ||||
|                     orderInfo.setTaskType(currTask.getTaskType()); | ||||
|                     orderInfo.setTaskType(currTask.getProcessType()); | ||||
|                     orderInfo.setStatus(currTask.getStatus()); | ||||
|                     orderInfo.setKilnId(currTask.getKilnId()); | ||||
|                     orderInfo.setStartPosition(currTask.getStartPosition()); | ||||
|   | ||||
| @@ -117,6 +117,8 @@ public class AsynRunTaskService extends BaseService { | ||||
|         Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue()); | ||||
|         //执行成功,托盘进炉 | ||||
|         if (status==1){ | ||||
|             //开始记录能源消耗 | ||||
|             asynStartRecordConsume(currTaskId,currTask.getKilnId()); | ||||
|             logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功==="); | ||||
|             //更新调度表状态为完成 | ||||
|             runTask.setUpdateTime(LocalDateTime.now()); | ||||
| @@ -197,6 +199,7 @@ public class AsynRunTaskService extends BaseService { | ||||
|         Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue()); | ||||
|         //执行成功,托盘进炉 | ||||
|         if (status==1){ | ||||
|             asynStartRecordConsume(currTaskId,currTask.getKilnId()); | ||||
|             logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功==="); | ||||
|             //更新调度表状态为完成 | ||||
|             runTask.setUpdateTime(LocalDateTime.now()); | ||||
| @@ -392,6 +395,8 @@ 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){ | ||||
|             //加工完成,记录结束时能源消耗 | ||||
|             asynEndRecordConsume(currTaskId,currTask.getKilnId()); | ||||
|             logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功==="); | ||||
|             //更新关系表状态为完成 | ||||
|             runTask.setUpdateTime(LocalDateTime.now()); | ||||
|   | ||||
| @@ -260,7 +260,7 @@ public class RunTaskUtils { | ||||
|             currTask.setOutTargetPosition(location.getCode()); | ||||
|             currTaskServiceBiz.updateById(currTask); | ||||
|             //  2022/2/16 异步调用车辆 | ||||
|             asynRunTaskService.asynRunTaskForKilnToWarehouse(currTask.getId(),vehicleInfoList.get(0).getId()); | ||||
|             asynRunTaskService.asynRunTaskForKilnToWarehouse(currTask.getId(),vehicleId); | ||||
|             return R.ok("操作成功!当前目标窑炉已满,托盘加入缓存区待加工队列。"); | ||||
|         }else { | ||||
|             return R.ok("当前缓存区已满,无法从加工炉出炉到缓存区。"); | ||||
|   | ||||
| @@ -6,9 +6,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.mt.wms.core.base.BaseService; | ||||
| import com.mt.wms.core.dal.entity.*; | ||||
| import com.mt.wms.core.dal.service.*; | ||||
| import com.mt.wms.core.utils.BeanUtils; | ||||
| import com.mt.wms.core.utils.CodeGeneratorHelper; | ||||
| import com.mt.wms.core.utils.HttpClient; | ||||
| 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 org.junit.jupiter.api.Test; | ||||
| import org.slf4j.Logger; | ||||
| @@ -32,7 +35,7 @@ import java.util.Map; | ||||
| @Component | ||||
| public class ScheduledTask extends BaseService { | ||||
|  | ||||
|     private final static Logger logger = LoggerFactory.getLogger(AsynRunTaskService.class); | ||||
|     private final static Logger logger = LoggerFactory.getLogger(ScheduledTask.class); | ||||
|  | ||||
|     @Resource | ||||
|     private KilnInfoServiceBiz kilnInfoServiceBiz; | ||||
| @@ -66,14 +69,109 @@ public class ScheduledTask extends BaseService { | ||||
|     private RunTaskUtils runTaskUtils; | ||||
|     @Resource | ||||
|     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 { | ||||
|         webSocketServer.sendtoAll(LocalDateTime.now()+"测试"); | ||||
|         //查询出正在进炉加工的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 = 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 { | ||||
|         //两辆车是否都空闲,只有两辆车都空闲才被允许做任务 | ||||
|         List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 0)); | ||||
| @@ -97,6 +195,7 @@ public class ScheduledTask extends BaseService { | ||||
|                 Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); | ||||
|                 if (resultBoolean){ | ||||
|                     //调用RunTaskUtils.runTaskForOutKiln | ||||
|                     logger.info(kilnInfo.getCode()+kilnInfo.getKilnAlias()+"识别到允许出炉信号,进入出库程序!"); | ||||
|                     runTaskUtils.runTaskForOutKiln(kilnId); | ||||
|                     break; | ||||
|                 } | ||||
| @@ -104,7 +203,6 @@ public class ScheduledTask extends BaseService { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|  | ||||
|     //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集高频数据能源消耗。暂定30秒 | ||||
|     //@Scheduled(fixedDelay = 1000*30) | ||||
|     public void getFastValue(){ | ||||
| @@ -192,6 +290,7 @@ public class ScheduledTask extends BaseService { | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集低频数据能源消耗。暂定3分钟一次 | ||||
|     //@Scheduled(fixedDelay = 1000*60*3) | ||||
|     public void getSlowValue(){ | ||||
| @@ -337,7 +436,7 @@ public class ScheduledTask extends BaseService { | ||||
|  | ||||
|     //遍历窑炉,空窑炉查询缓存区是否有等待加工的任务, | ||||
|     //待加工任务存在且没有状态为正在进炉的情况下,按照先进先出的规则选择待加工任务呼叫车辆进炉 | ||||
|     //@Scheduled(fixedDelay = 1000*30) | ||||
|     //@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)); | ||||
| @@ -354,7 +453,7 @@ public class ScheduledTask extends BaseService { | ||||
|                 //查询炉子是否allowIn | ||||
|                 Boolean kilnAllowIn = kilnAllowIn(kilnInfo.getId()); | ||||
|                 if (kilnAllowIn){ | ||||
|                     //缓存去是否有目标位置为窑炉的待加工任务 | ||||
|                     //缓存区是否有目标位置为窑炉的待加工任务 | ||||
|                     List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>() | ||||
|                             .eq(InStockInfo.TYPE, 1) | ||||
|                             .eq(InStockInfo.KILN_ID, kilnInfo.getId()) | ||||
| @@ -384,6 +483,7 @@ public class ScheduledTask extends BaseService { | ||||
|     } | ||||
|  | ||||
|     //遍历正在工作炉子的报警变量,记录报警 | ||||
|     //@Scheduled(fixedDelay = 1000*30) | ||||
|     public void listenKilnAlarm(){ | ||||
|         List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(); | ||||
|         for (KilnInfo kilnInfo:kilnInfoList | ||||
| @@ -440,10 +540,10 @@ public class ScheduledTask extends BaseService { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     //监听车辆是否在线 | ||||
|     //监听车辆是否在线(暂时不用) | ||||
|     public void listenVehicleOnline() throws IOException { | ||||
|         List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>() | ||||
|                 .eq(VehicleInfo.STATUS, 2)); | ||||
|                 .eq(VehicleInfo.STATUS, 0)); | ||||
|         for (VehicleInfo vehicleInfo:vehicleInfoList | ||||
|              ) { | ||||
|  | ||||
| @@ -503,4 +603,15 @@ public class ScheduledTask extends BaseService { | ||||
|         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()); | ||||
|     } | ||||
|  | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,73 @@ | ||||
| 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; | ||||
| } | ||||
| @@ -26,13 +26,14 @@ public class WebSocketServer { | ||||
|  | ||||
|     //前端的id 右后端给他 | ||||
|     public synchronized String getUniqeId(){ | ||||
|         return UUID.randomUUID().toString()+System.currentTimeMillis(); | ||||
|         //return UUID.randomUUID().toString()+System.currentTimeMillis(); | ||||
|         return id; | ||||
|     } | ||||
|  | ||||
|     //与某个客户端的连接会话,需要通过它来给客户端发送数据 | ||||
|     private Session session; | ||||
|     private static Logger log = LogManager.getLogger(WebSocketServer.class); | ||||
|     private String id = ""; | ||||
|     private String id = getUniqeId(); | ||||
|  | ||||
|     public Integer getCurrentNum(){ | ||||
|         return webSocketSet.size(); | ||||
| @@ -135,15 +136,15 @@ public class WebSocketServer { | ||||
|      */ | ||||
|     public void sendtoUser(String message,String sendUserId) throws IOException { | ||||
|         if (webSocketSet.get(sendUserId) != null) { | ||||
|             if(!id.equals(sendUserId)){ | ||||
|                 webSocketSet.get(sendUserId).sendMessage( "用户" + id + "发来消息:" + " <br/> " + message); | ||||
|             } | ||||
|             else{ | ||||
|             //if(!id.equals(sendUserId)){ | ||||
|                 //webSocketSet.get(sendUserId).sendMessage( "用户" + id + "发来消息:" + " <br/> " + message); | ||||
|            // } | ||||
|             //else{ | ||||
|                 webSocketSet.get(sendUserId).sendMessage(message); | ||||
|             } | ||||
|             //} | ||||
|         } else { | ||||
|             //如果用户不在线则返回不在线信息给自己 | ||||
|             sendtoUser("当前用户不在线",id); | ||||
|             //sendtoUser("当前用户不在线",id); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user