更新
This commit is contained in:
@@ -133,10 +133,10 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
if (type == 1) {
|
||||
b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X1A,
|
||||
(byte) 0X00, (byte) 0X16,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X16,
|
||||
(byte) 0X00, (byte) 0X12,
|
||||
(byte) 0X01, prioritylow,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
@@ -145,17 +145,15 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
(byte) qhdhigh, (byte) qhdlow,
|
||||
(byte) qhdhigh2, (byte) qhdlow2,
|
||||
(byte) fhdhigh, (byte) fhdlow,
|
||||
(byte) fhdhigh2, (byte) fhdlow2,
|
||||
(byte) 0X00, (byte) 0X00,
|
||||
(byte) 0X00, (byte) 0X00
|
||||
(byte) fhdhigh2, (byte) fhdlow2
|
||||
};
|
||||
} else if (type == 2) {
|
||||
b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X1A,
|
||||
(byte) 0X00, (byte) 0X16,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X16,
|
||||
(byte) 0X00, (byte) 0X12,
|
||||
(byte) 0X01, prioritylow,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
@@ -164,27 +162,23 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
(byte) qhdhigh, (byte) qhdlow,
|
||||
(byte) 0X00, (byte) 0X00,
|
||||
(byte) fhdhigh, (byte) fhdlow,
|
||||
(byte) 0X00, (byte) 0X00,
|
||||
(byte) 0X00, (byte) 0X00,
|
||||
(byte) 0X00, (byte) 0X00
|
||||
};
|
||||
} else if (type == 3) {
|
||||
b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X1A,
|
||||
(byte) 0X00, (byte) 0X16,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X16,
|
||||
(byte) 0X00, (byte) 0X12,
|
||||
(byte) 0X01, prioritylow,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) typehigh, (byte) typelow,
|
||||
(byte) qhdhigh, (byte) qhdlow,
|
||||
(byte) 0X00, (byte) 0X00,
|
||||
(byte) fhdhigh, (byte) fhdlow,
|
||||
(byte) 0X00, (byte) 0X00,
|
||||
(byte) qhdhigh2, (byte) qhdlow2,
|
||||
(byte) fhdhigh, (byte) fhdlow,
|
||||
(byte) fhdhigh2, (byte) fhdlow2
|
||||
};
|
||||
}
|
||||
|
||||
@@ -129,8 +129,16 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//判断普通站点驱动是否开启等待
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
if (standardOrdinarySiteDeviceDriver.getHasGoods() != 0) {
|
||||
|
||||
if(StrUtil.equals("true",this.getDevice().getExtraValue().get("max_emptypalletnum").toString())){
|
||||
if(standardOrdinarySiteDeviceDriver.getStatus() == 1){
|
||||
data = NDCAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
} else {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "上位系统未允许取货");
|
||||
}
|
||||
} else {
|
||||
data = NDCAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +151,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
|
||||
//取货完毕/取满框完毕1/点对点取货完毕
|
||||
|
||||
} else if (phase == 0x64) {//param,agv货位id待定
|
||||
|
||||
//取货完毕
|
||||
|
||||
@@ -83,31 +83,34 @@ public class ItemProtocol {
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "VW0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "VW2"));
|
||||
list.add(new ItemDto(item_move, "光电信号", "VW4"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "VW6"));
|
||||
list.add(new ItemDto(item_error, "故障", "VW8"));
|
||||
list.add(new ItemDto(item_error1, "故障1", "VW8"));
|
||||
list.add(new ItemDto(item_door, "门状态", "VW8"));
|
||||
list.add(new ItemDto(item_temperature, "工位温度", "VW8"));
|
||||
list.add(new ItemDto(item_countdown, "恒温倒计时", "VW8"));
|
||||
list.add(new ItemDto(item_finish, "烘干完成", "VW8"));
|
||||
list.add(new ItemDto(item_consumption, "电能耗", "VD10"));
|
||||
list.add(new ItemDto(item_voltage, "电压", "VD10"));
|
||||
list.add(new ItemDto(item_current, "电流", "VD10"));
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "251"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "7990"));
|
||||
list.add(new ItemDto(item_move, "光电信号", "550"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "450"));
|
||||
list.add(new ItemDto(item_error, "故障", "8055"));
|
||||
list.add(new ItemDto(item_error1, "故障1", "216"));
|
||||
list.add(new ItemDto(item_door, "门状态", "450"));
|
||||
list.add(new ItemDto(item_temperature, "工位温度", "7991"));
|
||||
list.add(new ItemDto(item_countdown, "恒温倒计时", "200"));
|
||||
list.add(new ItemDto(item_finish, "烘干完成", "8025"));
|
||||
list.add(new ItemDto(item_consumption, "电能耗", "8092"));
|
||||
list.add(new ItemDto(item_voltage, "电压", "8086"));
|
||||
list.add(new ItemDto(item_current, "电流", "8080"));
|
||||
list.add(new ItemDto(item_task, "任务号", "220"));
|
||||
list.add(new ItemDto(item_material, "物料", "223"));
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "VW102"));
|
||||
list.add(new ItemDto(item_to_door, "开关门", "VD108"));
|
||||
list.add(new ItemDto(item_to_temperature, "生产温度", "VD108"));
|
||||
list.add(new ItemDto(item_to_material, "生产物料", "VD108"));
|
||||
list.add(new ItemDto(item_to_time, "生产时间", "VD108"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "VD108"));
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "226"));
|
||||
list.add(new ItemDto(item_to_door, "开关门", "8030"));
|
||||
list.add(new ItemDto(item_to_temperature, "生产温度", "8100"));
|
||||
list.add(new ItemDto(item_to_material, "生产物料", "229"));
|
||||
list.add(new ItemDto(item_to_time, "生产时间", "210"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "232"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,6 +106,8 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
|
||||
|
||||
String message;
|
||||
|
||||
// 1 上位系统允许进入 2 上位系统允许离开
|
||||
int status = 0;
|
||||
|
||||
int agvphase = 0;
|
||||
int index = 0;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Data
|
||||
public class BaseRequest {
|
||||
private Map<String, String> parameters = new HashMap();
|
||||
private String systemCode;
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class BaseResponse {
|
||||
|
||||
private Integer status = 0;
|
||||
private String message;
|
||||
private JSONArray errArr = new JSONArray();
|
||||
private Map<String, String> parameters = new HashMap();
|
||||
|
||||
public BaseResponse() {
|
||||
|
||||
@@ -2,17 +2,80 @@ package org.nl.acs.ext.wms.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class CreateTaskRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 设备号
|
||||
* 任务标识
|
||||
*/
|
||||
private String deviceCode;
|
||||
private String ext_task_id;
|
||||
|
||||
/**
|
||||
* 容器码
|
||||
* 任务编号
|
||||
*/
|
||||
private String containerCode;
|
||||
private String task_code;
|
||||
|
||||
|
||||
/**
|
||||
* 取货点1
|
||||
*/
|
||||
String start_point_code;
|
||||
|
||||
/**
|
||||
* 放货点1
|
||||
*/
|
||||
String next_point_code;
|
||||
|
||||
/**
|
||||
* 取货点2
|
||||
*/
|
||||
String start_point_code2;
|
||||
|
||||
/**
|
||||
* 放货点2
|
||||
*/
|
||||
String next_point_code2;
|
||||
|
||||
/**
|
||||
* 烘箱对接位
|
||||
*/
|
||||
String put_point_code;
|
||||
|
||||
/**
|
||||
* 优先级
|
||||
*/
|
||||
String priority;
|
||||
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
String vehicle_code;
|
||||
|
||||
/**
|
||||
* 载具类型
|
||||
*/
|
||||
String vehicle_type;
|
||||
|
||||
/**
|
||||
* 路由方案
|
||||
*/
|
||||
String route_plan_code;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
String task_type;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
String remark;
|
||||
|
||||
/**
|
||||
* 扩展属性
|
||||
*/
|
||||
Map<String,String> params;
|
||||
|
||||
}
|
||||
|
||||
@@ -63,6 +63,11 @@ public interface WmsToAcsService {
|
||||
*/
|
||||
Map<String, Object> queryDeviceDBValue(String whereJson);
|
||||
|
||||
/**
|
||||
* 创建任务
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
CreateTaskResponse crateTask(String whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -375,14 +375,161 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateTaskResponse crateTask(String json) {
|
||||
JSONArray datas = JSONArray.parseArray(json);
|
||||
|
||||
public CreateTaskResponse crateTask(String param) {
|
||||
JSONArray datas = JSONArray.parseArray(param);
|
||||
CreateTaskResponse response = new CreateTaskResponse();
|
||||
CreateTaskRequest request = JsonUtl.format(json, CreateTaskRequest.class);
|
||||
String containerCode = request.getContainerCode();
|
||||
response.setStatus(200);
|
||||
JSONArray errArr = new JSONArray();
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
String data = datas.get(i).toString();
|
||||
CreateTaskRequest request = JsonUtl.format(data, CreateTaskRequest.class);
|
||||
String ext_task_id = request.getExt_task_id();
|
||||
String task_code = request.getTask_code();
|
||||
String start_point_code = request.getStart_point_code();
|
||||
String start_point_code2 = request.getStart_point_code2();
|
||||
String next_point_code = request.getNext_point_code();
|
||||
String next_point_code2 = request.getNext_point_code2();
|
||||
String put_point_code = request.getPut_point_code();
|
||||
String priority = request.getPriority();
|
||||
String vehicle_code = request.getVehicle_code();
|
||||
String vehicle_type = request.getVehicle_type();
|
||||
String route_plan_code = request.getRoute_plan_code();
|
||||
String task_type = request.getTask_type();
|
||||
String remark = request.getRemark();
|
||||
String params = request.getParams().toString();
|
||||
|
||||
String start_device_code = "";
|
||||
String start_device_code2 = "";
|
||||
String next_device_code = "";
|
||||
String next_device_code2 = "";
|
||||
String put_device_code = "";
|
||||
if (StrUtil.isEmpty(task_code)) {
|
||||
throw new WDKException("任务号不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(start_point_code)) {
|
||||
throw new WDKException("起点不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(next_point_code)) {
|
||||
throw new WDKException("终点不能为空");
|
||||
}
|
||||
|
||||
|
||||
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_point_code + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(start_device_json)) {
|
||||
start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_point_code : (String) start_device_json.get("storage_code");
|
||||
}
|
||||
JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_point_code + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(next_device_json)) {
|
||||
next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code");
|
||||
}
|
||||
JSONObject start_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_point_code2 + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(start_device_json2)) {
|
||||
start_point_code2 = (String) start_device_json2.get("parent_storage_code") == null ? start_point_code2 : (String) start_device_json.get("storage_code");
|
||||
}
|
||||
JSONObject next_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_point_code2 + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(next_device_json)) {
|
||||
next_point_code2 = (String) next_device_json2.get("parent_storage_code") == null ? next_point_code2 : (String) next_device_json.get("storage_code");
|
||||
}
|
||||
JSONObject put_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + put_point_code + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(put_device_json)) {
|
||||
put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_point_code : (String) next_device_json.get("storage_code");
|
||||
}
|
||||
if (start_point_code.indexOf("-") > 0) {
|
||||
String str[] = start_point_code.split("-");
|
||||
start_device_code = str[0];
|
||||
} else {
|
||||
start_device_code = start_point_code;
|
||||
}
|
||||
|
||||
if (next_point_code.indexOf("-") > 0) {
|
||||
String str[] = next_point_code.split("-");
|
||||
next_device_code = str[0];
|
||||
} else {
|
||||
next_device_code = next_point_code;
|
||||
}
|
||||
|
||||
if (start_point_code2.indexOf("-") > 0) {
|
||||
String str[] = start_point_code2.split("-");
|
||||
start_device_code2 = str[0];
|
||||
} else {
|
||||
start_device_code2 = start_point_code2;
|
||||
}
|
||||
|
||||
if (next_point_code2.indexOf("-") > 0) {
|
||||
String str[] = next_point_code2.split("-");
|
||||
next_device_code2 = str[0];
|
||||
} else {
|
||||
next_device_code2 = next_point_code2;
|
||||
}
|
||||
|
||||
if (put_point_code.indexOf("-") > 0) {
|
||||
String str[] = put_point_code.split("-");
|
||||
put_device_code = str[0];
|
||||
} else {
|
||||
put_device_code = put_point_code;
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(route_plan_code)) {
|
||||
route_plan_code = "normal";
|
||||
}
|
||||
|
||||
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
|
||||
if (taskDto != null) {
|
||||
throw new WDKException("不能存在相同的任务号!");
|
||||
}
|
||||
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||
TaskDto vehicle_dto = taskService.findByContainer(vehicle_code);
|
||||
if (vehicle_dto != null) {
|
||||
throw new WDKException("已存在该载具号的任务!");
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_code", task_code);
|
||||
jo.put("task_id", ext_task_id);
|
||||
jo.put("start_point_code", start_point_code);
|
||||
jo.put("next_point_code", next_point_code);
|
||||
jo.put("start_point_code2", start_point_code2);
|
||||
jo.put("next_point_code2", next_point_code2);
|
||||
jo.put("put_point_code", put_point_code);
|
||||
jo.put("start_parent_code", start_point_code);
|
||||
jo.put("next_parent_code", next_point_code);
|
||||
jo.put("start_device_code", start_device_code);
|
||||
jo.put("next_device_code", next_device_code);
|
||||
jo.put("start_device_code2", start_device_code2);
|
||||
jo.put("next_device_code2", next_device_code2);
|
||||
jo.put("put_device_code", put_device_code);
|
||||
jo.put("priority", priority);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("vehicle_type", vehicle_type);
|
||||
jo.put("remark", remark);
|
||||
jo.put("params", params);
|
||||
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
|
||||
|
||||
if (!StrUtil.isEmpty(ext_task_id)) {
|
||||
jo.put("ext_task_id", ext_task_id);
|
||||
}
|
||||
|
||||
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
||||
try {
|
||||
taskService.create(task_dto);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", e.getMessage());
|
||||
errArr.add(json);
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(errArr)) {
|
||||
response.setStatus(200);
|
||||
} else {
|
||||
response.setStatus(400);
|
||||
}
|
||||
response.setMessage("success");
|
||||
response.setErrArr(errArr);
|
||||
log.info("createFromWms--------------:输出参数:" + response);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 128 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 MiB |
Reference in New Issue
Block a user