From c13fe87d70e81d7dcb604f8f1227de8f313cbefc Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期三, 10 七月 2024 09:26:51 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java
index 0518fca..9df4890 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java
@@ -1,10 +1,19 @@
 package com.zy.asrs.wcs.core.timer;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.zy.asrs.wcs.core.action.LiftAction;
+import com.zy.asrs.wcs.core.action.ShuttleAction;
+import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
 import com.zy.asrs.wcs.core.utils.RedisUtil;
+import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant;
+import com.zy.asrs.wcs.rcs.entity.Device;
+import com.zy.asrs.wcs.rcs.service.DeviceService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
+
+import java.util.List;
 
 @Slf4j
 @Component
@@ -12,15 +21,52 @@
 
     @Autowired
     private RedisUtil redisUtil;
+    @Autowired
+    private DeviceService deviceService;
+    @Autowired
+    private ShuttleAction shuttleAction;
+    @Autowired
+    private LiftAction liftAction;
 
     @Scheduled(cron = "0/1 * * * * ? ")
     public synchronized void executeShuttle() {
+        List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
+                .eq(Device::getStatus, 1)
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()));
+        for (Device device : list) {
+            //灏忚溅绌洪棽涓旀湁璺戝簱绋嬪簭
+            shuttleAction.moveLoc(device);
 
+            Object object = redisUtil.get(DeviceRedisConstant.SHUTTLE_FLAG + device.getDeviceNo());
+            if (object == null) {
+                continue;
+            }
+
+            Integer taskNo = Integer.valueOf(String.valueOf(object));
+            if (taskNo != 0) {
+                //瀛樺湪浠诲姟闇�瑕佹墽琛�
+                boolean result = shuttleAction.executeWork(device, taskNo);
+            }
+        }
     }
 
     @Scheduled(cron = "0/1 * * * * ? ")
     public synchronized void executeLift() {
+        List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
+                .eq(Device::getStatus, 1)
+                .eq(Device::getDeviceType, DeviceCtgType.LIFT.val()));
+        for (Device device : list) {
+            Object object = redisUtil.get(DeviceRedisConstant.LIFT_FLAG + device.getDeviceNo());
+            if (object == null) {
+                continue;
+            }
 
+            Integer taskNo = Integer.valueOf(String.valueOf(object));
+            if (taskNo != 0) {
+                //瀛樺湪浠诲姟闇�瑕佹墽琛�
+                boolean result = liftAction.executeWork(device, taskNo);
+            }
+        }
     }
 
     @Scheduled(cron = "0/1 * * * * ? ")

--
Gitblit v1.9.1