|
@@ -0,0 +1,54 @@
|
|
|
+package com.ruoyi.ams.agv.ndc.thread;
|
|
|
+
|
|
|
+import com.ruoyi.ams.nieyan.service.AgvCallProxyService;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.hard.modbus.tcp.ButtonBoxClient;
|
|
|
+import com.ruoyi.hard.modbus.tcp.ModbusTcpWeigherClient;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Service
|
|
|
+public class AutoPhotoelectricTask {
|
|
|
+
|
|
|
+ @Autowired(required = false)
|
|
|
+ private ModbusTcpWeigherClient modbusTcpWeigherClient;
|
|
|
+ @Autowired
|
|
|
+ private AgvCallProxyService agvCallProxyService;
|
|
|
+ // 空托1 3个点位
|
|
|
+ public static final String EMPTY_PALLET_POINT_01 = "218";
|
|
|
+ public static final String EMPTY_PALLET_POINT_02 = "219";
|
|
|
+ public static final String EMPTY_PALLET_POINT_03 = "220";
|
|
|
+
|
|
|
+ public void run() {
|
|
|
+ boolean b = modbusTcpWeigherClient.readPhotoelectricity01();
|
|
|
+ if (b) {
|
|
|
+ photoelectricTask(EMPTY_PALLET_POINT_01, "1号光电");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void run01() {
|
|
|
+ boolean b = modbusTcpWeigherClient.readPhotoelectricity01();
|
|
|
+ if (b) {
|
|
|
+ photoelectricTask(EMPTY_PALLET_POINT_02, "2号光电");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void run02() {
|
|
|
+ boolean b = modbusTcpWeigherClient.readPhotoelectricity01();
|
|
|
+ if (b) {
|
|
|
+ photoelectricTask(EMPTY_PALLET_POINT_03, "2号光电");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void photoelectricTask(String locationFrom, String remark) {
|
|
|
+ log.info(remark + "-光电已经触发");
|
|
|
+ AjaxResult ajaxResult = agvCallProxyService.supplementEmptyTray(locationFrom, null
|
|
|
+ , "光电");
|
|
|
+ if (!ajaxResult.isSuccess()) {
|
|
|
+ log.info(ajaxResult.getMsg());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|