6 changed files with 277 additions and 136 deletions
@ -0,0 +1,50 @@ |
|||
package org.nl.modules.quartz.task; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver; |
|||
import org.nl.acs.opc.Device; |
|||
import org.nl.acs.opc.DeviceAppService; |
|||
import org.nl.acs.opc.DeviceType; |
|||
import org.nl.acs.wsdl.org.tempuri.RTMSAGVSERVICE; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author: geng by |
|||
* @createDate: 2023/5/9 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
public class AutoFeedAgvStatus { |
|||
|
|||
@Autowired |
|||
private DeviceAppService deviceAppService; |
|||
|
|||
public void run() throws Exception { |
|||
List<Device> devices = deviceAppService.findDevice(DeviceType.agv); |
|||
JSONArray data = new JSONArray(); |
|||
if (ObjectUtil.isNotEmpty(devices)) { |
|||
for (int i = 0; i < devices.size(); i++) { |
|||
Device device = devices.get(i); |
|||
Device agvDevice = deviceAppService.findDeviceByCode(device.getDevice_code()); |
|||
if (agvDevice.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { |
|||
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) agvDevice.getDeviceDriver(); |
|||
JSONObject jo = agvNdcOneDeviceDriver.getDeviceStatusName(); |
|||
data.add(jo); |
|||
} |
|||
} |
|||
try { |
|||
log.info("atrAgvCallback 请求参数:" + data.toJSONString()); |
|||
String str = new RTMSAGVSERVICE().getBasicHttpBindingIRTMSAGVSERVICE().atrAgvCallback(data.toJSONString()); |
|||
log.info("atrAgvCallback 返回参数:" + str); |
|||
} catch (Exception e) { |
|||
log.error("atrAgvCallback,反馈失败:{}", e.getMessage()); |
|||
} |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue