rev:光栅、输送线、AGV等修改
This commit is contained in:
@@ -180,7 +180,7 @@ public class AgvWaitUtil {
|
||||
|
||||
|
||||
//放货完成等待
|
||||
public JSONObject waitOutPut(String deviceCode, TaskDto task) {
|
||||
public JSONObject waitOutPut(String deviceCode, TaskDto taskDto) {
|
||||
log.info("仙工AGV放货完成后请求离开,设备号 - {}", deviceCode);
|
||||
boolean flag = false;
|
||||
|
||||
@@ -190,10 +190,11 @@ public class AgvWaitUtil {
|
||||
}
|
||||
|
||||
if (code.contains(deviceCode)) {
|
||||
// 通知输送线取货完成-2
|
||||
// 通知输送线放货完成离开-4
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("toCommand",XgAgvEnum.APPLY_PUT_SUCCESS.getCode());
|
||||
param.put("deviceCode",deviceCode);
|
||||
param.put("isEmpBarcode", ObjectUtil.isEmpty(taskDto.getIs_empvehicle()) ? "0" : taskDto.getIs_empvehicle());
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("DATA", param);
|
||||
|
||||
@@ -166,7 +166,7 @@ public interface XianGongAgvService {
|
||||
public JSONObject xgAGVWaitPointRequest(JSONObject requestParam);
|
||||
|
||||
/**
|
||||
* 下发运单急停
|
||||
* 下发运单急停(互斥组)
|
||||
*
|
||||
* @param requestParam
|
||||
* @return
|
||||
@@ -175,7 +175,7 @@ public interface XianGongAgvService {
|
||||
public <T> UnifiedResponse<T> sendOrderStopToXZ(JSONObject requestParam);
|
||||
|
||||
/**
|
||||
* 下发运单继续
|
||||
* 下发运单继续(互斥组)
|
||||
*
|
||||
* @param requestParam
|
||||
* @return
|
||||
|
||||
@@ -113,7 +113,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
return xgHttpUtil.sendGetRequest(path, type);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <T> UnifiedResponse<T> deleteXZAgvInst(String instCode) {
|
||||
//String path = "/api/route/transportOrders/" + instCode + "/withdrawal";
|
||||
@@ -769,7 +768,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
block.put("blockId", IdUtil.simpleUUID());
|
||||
block.put("location", inst.getNext_point_code() + "OUTPUT");
|
||||
if ("CPJSSX,BZXXL".contains(inst.getNext_device_code())) {
|
||||
block.put("operation", "script");
|
||||
block.put("operation", "ForkHeight");
|
||||
} else {
|
||||
block.put("operation", "ForkHeight");
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.XgAgvEnum;
|
||||
import org.nl.acs.agv.server.XianGongAgvService;
|
||||
import org.nl.acs.agv.server.impl.XianGongAgvServiceImpl;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.DeviceDriverBaseReader;
|
||||
@@ -19,9 +20,11 @@ import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.modules.quartz.task.QueryXGTGroupStatus;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Getter
|
||||
@@ -147,28 +150,66 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
}
|
||||
|
||||
private void executeLogicBefore() {
|
||||
// 告诉agv急停
|
||||
if (error == 1 && ObjectUtil.isNotEmpty(car_no)) {
|
||||
String[] carArr = {car_no};
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("vehicles", carArr);
|
||||
// 请求下发agv急停
|
||||
XianGongAgvServiceImpl xianGongAgv = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
|
||||
//创建订单序列
|
||||
xianGongAgv.sendOrderStopToXZ(json);
|
||||
// 告诉agv急停(车辆)
|
||||
if (error == 1) {
|
||||
// 只给agv下发第二个互斥组,例如GS01A2
|
||||
String substring = this.currentDeviceCode.substring(this.currentDeviceCode.length() - 1);
|
||||
if (substring.equals("2")) {
|
||||
// 根据当前互斥组设备里的状态
|
||||
JSONObject param = new JSONObject();
|
||||
String[] paramArr = {this.currentDeviceCode};
|
||||
param.put("blockGroup", paramArr);
|
||||
|
||||
UnifiedResponse<List<JSONObject>> objectUnifiedResponse = SpringContextHolder.getBean(XianGongAgvService.class).blockGroupStatus(param);
|
||||
List<JSONObject> dataList = objectUnifiedResponse.getData();
|
||||
|
||||
String[] carArr = {dataList.get(0).getString("id")};
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("vehicles", carArr);
|
||||
// 请求下发agv急停
|
||||
XianGongAgvServiceImpl xianGongAgv = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
|
||||
//创建订单序列
|
||||
xianGongAgv.sendOrderStopToXZ(json);
|
||||
}
|
||||
|
||||
}
|
||||
/* // 告诉agv急停(互斥组)
|
||||
if (error == 1) {
|
||||
JSONObject json = new JSONObject();
|
||||
// 只给agv下发第二个互斥组,例如GS01A2
|
||||
|
||||
String substring = this.currentDeviceCode.substring(this.currentDeviceCode.length() - 1);
|
||||
if (substring.equals("2")) {
|
||||
json.put("block_name", this.currentDeviceCode);
|
||||
|
||||
// 请求下发agv急停
|
||||
XianGongAgvServiceImpl xianGongAgv = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
|
||||
//创建订单序列
|
||||
xianGongAgv.sendOrderStopToXZ(json);
|
||||
}
|
||||
}*/
|
||||
|
||||
// 给光栅下发命令5
|
||||
if (error == 5) {
|
||||
String[] key = {"toCommand"};
|
||||
Integer[] value = {5};
|
||||
writing(Arrays.asList(key),Arrays.asList(value));
|
||||
String substring = this.currentDeviceCode.substring(this.currentDeviceCode.length() - 1);
|
||||
if (substring.equals("2")) {
|
||||
// 给输送线写5
|
||||
String[] key = {"toCommand"};
|
||||
Integer[] value = {5};
|
||||
writing(Arrays.asList(key),Arrays.asList(value));
|
||||
|
||||
// 如果车号不为空则告诉agv继续作业
|
||||
if (ObjectUtil.isNotEmpty(car_no)) {
|
||||
String[] carArr = {car_no};
|
||||
// 根据当前互斥组设备里的状态
|
||||
JSONObject param = new JSONObject();
|
||||
String[] paramArr = {this.currentDeviceCode};
|
||||
param.put("blockGroup", paramArr);
|
||||
|
||||
UnifiedResponse<List<JSONObject>> objectUnifiedResponse = SpringContextHolder.getBean(XianGongAgvService.class).blockGroupStatus(param);
|
||||
List<JSONObject> dataList = objectUnifiedResponse.getData();
|
||||
|
||||
String[] carArr = {dataList.get(0).getString("id")};
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("vehicles", carArr);
|
||||
|
||||
// 请求下发agv继续
|
||||
XianGongAgvServiceImpl xianGongAgv = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
|
||||
//创建订单序列
|
||||
@@ -192,7 +233,7 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.acs.ext.xg;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.config.AcsConfig;
|
||||
import org.nl.acs.ext.RequestAdapter;
|
||||
@@ -13,6 +14,9 @@ import org.nl.modules.system.service.ParamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author Gengby
|
||||
@@ -54,6 +58,7 @@ public class XgHttpUtil {
|
||||
return new UnifiedResponse<>(false, "未开启连接该系统!");
|
||||
}
|
||||
try {
|
||||
|
||||
String body = HttpRequest
|
||||
.post(REQUEST_ADAPTER.getUrl() + path)
|
||||
.setConnectionTimeout(10000)
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package org.nl.modules.quartz.task;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.XgAgvEnum;
|
||||
import org.nl.acs.agv.server.XianGongAgvService;
|
||||
import org.nl.acs.device_driver.lamp_three_color.LampThreecolorDeviceDriver;
|
||||
import org.nl.acs.ext.UnifiedResponse;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 查询AGV互斥组状态
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("queryXGTGroupStatus")
|
||||
@RequiredArgsConstructor
|
||||
public class QueryXGTGroupStatus {
|
||||
|
||||
@Autowired
|
||||
private XianGongAgvService agvService;
|
||||
|
||||
@Autowired
|
||||
private DeviceAppService deviceAppService;
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
// 查询所有光栅设备
|
||||
List<JSONObject> deviceList = WQLObject.getWQLObject("acs_device").query("device_type = 'color' and device_code LIKE '%A2'")
|
||||
.getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
// 组织数据查询
|
||||
List<String> deviceCodeList = deviceList.stream()
|
||||
.map(row -> row.getString("device_code"))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("blockGroup", deviceCodeList);
|
||||
|
||||
// 调用接口
|
||||
UnifiedResponse<List<JSONObject>> objectUnifiedResponse = agvService.blockGroupStatus(param);
|
||||
List<JSONObject> dataList = objectUnifiedResponse.getData();
|
||||
|
||||
for (JSONObject json : dataList) {
|
||||
// true 占用,false 没占用
|
||||
if (json.getBoolean("status")) {
|
||||
// 下发光电颜色为红色
|
||||
Device device = deviceAppService.findDeviceByCode(json.getString("name"));
|
||||
|
||||
LampThreecolorDeviceDriver driver = (LampThreecolorDeviceDriver) device.getDeviceDriver();
|
||||
// 给三色灯写入进入颜色红色-3
|
||||
String[] key = {"toColor"};
|
||||
Integer[] value = {XgAgvEnum.GS_COLOR_RED.getCode()};
|
||||
driver.writing(Arrays.asList(key),Arrays.asList(value));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user