更新
This commit is contained in:
0
hd/logPath_IS_UNDEFINED/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/ACS请求ERP/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/ACS请求ERP/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/ACS请求ERP/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/ACS请求ERP/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/ACS请求ERP/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/ACS请求ERP/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/ACS请求WMS/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/ACS请求WMS/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/ACS请求WMS/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/ACS请求WMS/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/ACS请求WMS/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/ACS请求WMS/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/AGV请求离开/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/AGV请求离开/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/AGV请求离开/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/AGV请求离开/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/AGV请求离开/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/AGV请求离开/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/NDC/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/NDC/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/NDC/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/NDC/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/NDC/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/NDC/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/WMS下发ACS/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/WMS下发ACS/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/WMS下发ACS/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/WMS下发ACS/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/WMS下发ACS/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/WMS下发ACS/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/反馈AGV请求/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/反馈AGV请求/2022-12-02.0.log
Normal file
2
hd/logPath_IS_UNDEFINED/反馈AGV请求/2022-12-04.0.log
Normal file
2
hd/logPath_IS_UNDEFINED/反馈AGV请求/2022-12-04.0.log
Normal file
@@ -0,0 +1,2 @@
|
||||
2022-12-04 15:18:25.062 [nl-pool3-thread-9] INFO org.nl.acs.agv.server.impl.AgvServiceImpl - 任务号:-00024,指令号00067,下发agv订单序列参数:{"id":"00067","complete":true,"blocks":[{"blockId":"70e4860e52a74ac5ba66bb47075277b4","location":"1008IN","operation":"script","id":"1008IN","script_name":"userpy/interact.py","script_args":{"addr":"http://127.0.0.1:8010","data":{"reach":{"task_code":"00067","address":"1008IN"}},"protocol":"HTTP"}},{"blockId":"b35e8b1db3d34b0baf8f95c0b16aedd8","location":"1008","operation":"JackLoad"},{"blockId":"99baaed5c81c4c7b823a580817589ecd","location":"1008OUT","operation":"script","id":"1008OUT","script_name":"userpy/interact.py","script_args":{"addr":"http://127.0.0.1:8010","data":{"reach":{"task_code":"00067","address":"1008OUT"}},"protocol":"HTTP"}},{"blockId":"1769a1f2350c4f02b18ce72cc5f1bce0","location":"1005IN","operation":"script","id":"1005IN","script_name":"userpy/interact.py","script_args":{"addr":"http://127.0.0.1:8010","data":{"reach":{"task_code":"00067","address":"1005IN"}},"protocol":"HTTP"}},{"blockId":"0db76fae9e544408851348adb127e5ce","location":"1005","operation":"JackUnload"},{"blockId":"0ef593155f7941eda29cab8be8907425","location":"1005OUT","operation":"script","id":"1005OUT","script_name":"userpy/interact.py","script_args":{"addr":"http://127.0.0.1:8010","data":{"reach":{"task_code":"00067","address":"1005OUT"}},"protocol":"HTTP"}}]}
|
||||
2022-12-04 15:19:16.402 [http-nio-8010-exec-5] INFO org.nl.acs.agv.server.impl.AgvServiceImpl - 任务号:-00024,指令号00068,下发agv订单序列参数:{"id":"00068","complete":true,"blocks":[{"blockId":"0ae6f28e54b24ef1a7ab22c6f49313b5","location":"1008IN","operation":"script","id":"1008IN","script_name":"userpy/interact.py","script_args":{"addr":"http://127.0.0.1:8010","data":{"reach":{"task_code":"00068","address":"1008IN"}},"protocol":"HTTP"}},{"blockId":"5915e4a896ef41b495163780ca7e08d1","location":"1008","operation":"JackLoad"},{"blockId":"3c3e7d6d531b44d0a55817efbb3b8434","location":"1008OUT","operation":"script","id":"1008OUT","script_name":"userpy/interact.py","script_args":{"addr":"http://127.0.0.1:8010","data":{"reach":{"task_code":"00068","address":"1008OUT"}},"protocol":"HTTP"}},{"blockId":"af4d3333d2da48518e531eae74461411","location":"1005IN","operation":"script","id":"1005IN","script_name":"userpy/interact.py","script_args":{"addr":"http://127.0.0.1:8010","data":{"reach":{"task_code":"00068","address":"1005IN"}},"protocol":"HTTP"}},{"blockId":"5056dcd431ef4e0bbc20551e6b933b73","location":"1005","operation":"JackUnload"},{"blockId":"242f390e11b1401599ac3d2dcd81644c","location":"1005OUT","operation":"script","id":"1005OUT","script_name":"userpy/interact.py","script_args":{"addr":"http://127.0.0.1:8010","data":{"reach":{"task_code":"00068","address":"1005OUT"}},"protocol":"HTTP"}}]}
|
||||
0
hd/logPath_IS_UNDEFINED/反馈AGV请求/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/反馈AGV请求/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/扫码记录/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/扫码记录/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/扫码记录/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/扫码记录/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/扫码记录/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/扫码记录/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/查询AGV指令状态/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/查询AGV指令状态/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/查询AGV指令状态/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/查询AGV指令状态/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/查询AGV指令状态/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/查询AGV指令状态/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/自动创建指令/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/自动创建指令/2022-12-02.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/自动创建指令/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/自动创建指令/2022-12-04.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/自动创建指令/2022-12-05.0.log
Normal file
0
hd/logPath_IS_UNDEFINED/自动创建指令/2022-12-05.0.log
Normal file
@@ -8,79 +8,79 @@ import net.sf.json.JSONObject;
|
||||
* https://blog.csdn.net/moneyshi/article/details/82978073
|
||||
*/
|
||||
public enum DriverTypeEnum {
|
||||
ORDINARY_SITE(1, "standard_ordinary_site", "普通站点", "conveyor"),
|
||||
|
||||
WEIGHING_SITE(2, "weighing_site", "称重站点", "conveyor"),
|
||||
|
||||
INSPECT_SITE(3, "standard_inspect_site", "检测站点", "conveyor"),
|
||||
|
||||
NON_LINE_INSPECT_SITE(4, "non_line_inspect_site", "检测站点-无PLC", "conveyor"),
|
||||
|
||||
MACHINES_SITE(5, "machines_site", "机台设备-无光电", "conveyor"),
|
||||
|
||||
SPECIAL_SITE(6, "standard_special_inspect_site", "专机设备交互站点", "conveyor"),
|
||||
|
||||
MANIPULATOR_SITE(7, "standard_manipulator_inspect_site", "区域管制设备交互站点", "conveyor"),
|
||||
|
||||
NON_LINE_MANIPULATOR_SITE(8, "non_line_manipulator_inspect_site", "区域管制设备交互站点-无PLC", "conveyor"),
|
||||
|
||||
AUTODOOR(9, "standard_autodoor", "标准版-自动门", "autodoor"),
|
||||
|
||||
STACK_EMPUYPALLET_SITE(10, "standard_emptypallet_site", "标准版-空盘叠盘站点", "conveyor"),
|
||||
|
||||
LAMP_THREE_COLOR(11, "lamp_three_color", "标准版-三色灯", "三色灯"),
|
||||
|
||||
SPECIAL_ORDINARY_SITE(12, "special_ordinary_site", "特殊版-普通站点-关联锁定", "conveyor"),
|
||||
|
||||
STORAGE(13, "standard_storage", "标准版-货架", "storage"),
|
||||
|
||||
SCANNER(14, "standard_scanner", "标准版-扫码器", "scanner"),
|
||||
|
||||
INSPECT_CONVEYOR_CONTROL_WITH_SCANNER(15, "standard_conveyor_control_with_scanner", "标准版-输送机-控制点-关联扫码", "conveyor"),
|
||||
// ORDINARY_SITE(1, "standard_ordinary_site", "普通站点", "conveyor"),
|
||||
//
|
||||
// WEIGHING_SITE(2, "weighing_site", "称重站点", "conveyor"),
|
||||
//
|
||||
// INSPECT_SITE(3, "standard_inspect_site", "检测站点", "conveyor"),
|
||||
//
|
||||
// NON_LINE_INSPECT_SITE(4, "non_line_inspect_site", "检测站点-无PLC", "conveyor"),
|
||||
//
|
||||
// MACHINES_SITE(5, "machines_site", "机台设备-无光电", "conveyor"),
|
||||
//
|
||||
// SPECIAL_SITE(6, "standard_special_inspect_site", "专机设备交互站点", "conveyor"),
|
||||
//
|
||||
// MANIPULATOR_SITE(7, "standard_manipulator_inspect_site", "区域管制设备交互站点", "conveyor"),
|
||||
//
|
||||
// NON_LINE_MANIPULATOR_SITE(8, "non_line_manipulator_inspect_site", "区域管制设备交互站点-无PLC", "conveyor"),
|
||||
//
|
||||
// AUTODOOR(9, "standard_autodoor", "标准版-自动门", "autodoor"),
|
||||
//
|
||||
// STACK_EMPUYPALLET_SITE(10, "standard_emptypallet_site", "标准版-空盘叠盘站点", "conveyor"),
|
||||
//
|
||||
// LAMP_THREE_COLOR(11, "lamp_three_color", "标准版-三色灯", "三色灯"),
|
||||
//
|
||||
// SPECIAL_ORDINARY_SITE(12, "special_ordinary_site", "特殊版-普通站点-关联锁定", "conveyor"),
|
||||
//
|
||||
// STORAGE(13, "standard_storage", "标准版-货架", "storage"),
|
||||
//
|
||||
// SCANNER(14, "standard_scanner", "标准版-扫码器", "scanner"),
|
||||
//
|
||||
// INSPECT_CONVEYOR_CONTROL_WITH_SCANNER(15, "standard_conveyor_control_with_scanner", "标准版-输送机-控制点-关联扫码", "conveyor"),
|
||||
|
||||
INSPECT_CONVEYOR_CONTROL(16, "standard_conveyor_control", "标准版-输送机-控制点", "conveyor"),
|
||||
|
||||
INSPECT_CONVEYOR_MONITOR(17, "standard_conveyor_monitor", "标准版-输送机-监控点", "conveyor"),
|
||||
|
||||
MANIPULATOR_INSPECT_SITE_NDC(18, "manipulator_inspect_site_NDC", "区域管制设备交互站点-NDC", "conveyor"),
|
||||
|
||||
FEEDBACK_AGV_STATUS_SITE(19, "feedback_agv_status_site", "上报AGV状态站点", "conveyor"),
|
||||
|
||||
MANIPULATOR_STACKING_SITE(20, "standard_manipulator_stacking_site", "机械手码垛驱动(区分托盘类型)", "conveyor"),
|
||||
|
||||
PHOTOELECTRIC_INSPECT_SITE(21, "standard_photoelectric_inspect_site", "光电检测站点(优先出库)", "conveyor"),
|
||||
|
||||
HAILIANG_PACKING(22, "hailiang_packing", "海亮项目-包装机", "conveyor"),
|
||||
|
||||
HAILIANG_LABELING(23, "hailiang_labeling", "海亮项目-贴标机", "conveyor"),
|
||||
|
||||
HAILIANG_COATING(24, "hailiang_coating", "海亮项目-裹膜机", "conveyor"),
|
||||
|
||||
NDXY_SPECIAL(25, "ndxy_special", "纽迪希亚专用", "conveyor"),
|
||||
|
||||
NDXY_SPECIAL_TWO(26, "ndxy_special_two", "纽迪希亚专用2", "conveyor"),
|
||||
|
||||
INSPECT_CONVEYOR_CONTROL_WITH_PLCSCANNER(27, "standard_conveyor_control_with_plcscanner", "标准版-输送机-控制点-PLC扫码", "conveyor"),
|
||||
|
||||
WHXR_STORAGE_CONVEYOR(28, "whxr_storage_conveyor", "武汉新锐-立库对接位", "conveyor"),
|
||||
|
||||
WHXR_BALL_MILL_DEVICE(29, "whxr_ball_mill", "武汉新锐-球磨机", "conveyor"),
|
||||
|
||||
WHXR_SPRAY_TOWER_DEVICE(30, "whxr_spary_tower", "武汉新锐-喷雾塔", "conveyor"),
|
||||
|
||||
WHXR_WEIGHT_DEVICE(31, "whxr_weight", "武汉新锐-称重设备", "conveyor"),
|
||||
|
||||
ELECTRIC_FENCE(32, "electric_fence", "标准版-电子围栏", "safetydoor"),
|
||||
|
||||
OUMULONGPLC(33, "oumulong_plc", "标准版-自动门-欧姆龙plc", "autodoor"),
|
||||
|
||||
TRAFFIC_LIGHT(34, "traffic_light", "标准版-交通灯-欧姆龙plc", "三色灯"),
|
||||
|
||||
STANDARD_RGV(35, "standard_rgv", "标准版-RGV", "rgv"),
|
||||
|
||||
YKBK_SPECIAL(36, "ykbk_special", "伊科拜克默认物料", "conveyor"),
|
||||
|
||||
ssj_cache_site(37, "ssj_cache_site", "三时纪-缓存站点", "conveyor"),
|
||||
// INSPECT_CONVEYOR_MONITOR(17, "standard_conveyor_monitor", "标准版-输送机-监控点", "conveyor"),
|
||||
//
|
||||
// MANIPULATOR_INSPECT_SITE_NDC(18, "manipulator_inspect_site_NDC", "区域管制设备交互站点-NDC", "conveyor"),
|
||||
//
|
||||
// FEEDBACK_AGV_STATUS_SITE(19, "feedback_agv_status_site", "上报AGV状态站点", "conveyor"),
|
||||
//
|
||||
// MANIPULATOR_STACKING_SITE(20, "standard_manipulator_stacking_site", "机械手码垛驱动(区分托盘类型)", "conveyor"),
|
||||
//
|
||||
// PHOTOELECTRIC_INSPECT_SITE(21, "standard_photoelectric_inspect_site", "光电检测站点(优先出库)", "conveyor"),
|
||||
//
|
||||
// HAILIANG_PACKING(22, "hailiang_packing", "海亮项目-包装机", "conveyor"),
|
||||
//
|
||||
// HAILIANG_LABELING(23, "hailiang_labeling", "海亮项目-贴标机", "conveyor"),
|
||||
//
|
||||
// HAILIANG_COATING(24, "hailiang_coating", "海亮项目-裹膜机", "conveyor"),
|
||||
//
|
||||
// NDXY_SPECIAL(25, "ndxy_special", "纽迪希亚专用", "conveyor"),
|
||||
//
|
||||
// NDXY_SPECIAL_TWO(26, "ndxy_special_two", "纽迪希亚专用2", "conveyor"),
|
||||
//
|
||||
// INSPECT_CONVEYOR_CONTROL_WITH_PLCSCANNER(27, "standard_conveyor_control_with_plcscanner", "标准版-输送机-控制点-PLC扫码", "conveyor"),
|
||||
//
|
||||
// WHXR_STORAGE_CONVEYOR(28, "whxr_storage_conveyor", "武汉新锐-立库对接位", "conveyor"),
|
||||
//
|
||||
// WHXR_BALL_MILL_DEVICE(29, "whxr_ball_mill", "武汉新锐-球磨机", "conveyor"),
|
||||
//
|
||||
// WHXR_SPRAY_TOWER_DEVICE(30, "whxr_spary_tower", "武汉新锐-喷雾塔", "conveyor"),
|
||||
//
|
||||
// WHXR_WEIGHT_DEVICE(31, "whxr_weight", "武汉新锐-称重设备", "conveyor"),
|
||||
//
|
||||
// ELECTRIC_FENCE(32, "electric_fence", "标准版-电子围栏", "safetydoor"),
|
||||
//
|
||||
// OUMULONGPLC(33, "oumulong_plc", "标准版-自动门-欧姆龙plc", "autodoor"),
|
||||
//
|
||||
// TRAFFIC_LIGHT(34, "traffic_light", "标准版-交通灯-欧姆龙plc", "三色灯"),
|
||||
//
|
||||
// STANDARD_RGV(35, "standard_rgv", "标准版-RGV", "rgv"),
|
||||
//
|
||||
// YKBK_SPECIAL(36, "ykbk_special", "伊科拜克默认物料", "conveyor"),
|
||||
//
|
||||
// ssj_cache_site(37, "ssj_cache_site", "三时纪-缓存站点", "conveyor"),
|
||||
|
||||
STANDARDCONVEYORLINE(38, "standard_conveyor_line", "缓存架", "conveyor");
|
||||
|
||||
|
||||
@@ -11,21 +11,16 @@ import java.util.List;
|
||||
@Data
|
||||
public class ItemProtocol {
|
||||
|
||||
public static String item_heartbeat = "heartbeat";
|
||||
public static String item_mode = "mode";
|
||||
public static String item_move = "move";
|
||||
public static String item_action = "action";
|
||||
public static String item_ioaction = "ioaction";
|
||||
public static String item_height = "height";
|
||||
public static String item_error = "error";
|
||||
public static String item_direction = "direction";
|
||||
public static String item_operation_type = "operation_type";
|
||||
public static String item_task = "task";
|
||||
|
||||
public static String item_to_command = "to_command";
|
||||
public static String item_to_target = "to_target";
|
||||
public static String item_to_task = "to_task";
|
||||
public static String item_weight = "weight";
|
||||
public static String item_byMode = "Application_GVL_AGV_To_AGV_number_To_Mode";
|
||||
public static String item_bySignal = "Application_GVL_AGV_To_AGV_number_To_Signal";
|
||||
public static String item_byAction = "Application_GVL_AGV_To_AGV_number_To_Action";
|
||||
public static String item_byError = "Application_GVL_AGV_To_AGV_number_To_Error";
|
||||
public static String item_dwTaskNo = "Application_GVL_AGV_To_AGV_number_To_DwTaskNo";
|
||||
|
||||
public static String item_to_byTarget = "Application_GVL_AGV_To_AGV_number_Fr_Target";
|
||||
public static String item_to_byDwTaskNo = "Application_GVL_AGV_To_AGV_number_Fr_TaskNo";
|
||||
public static String item_to_byWCommand = "Application_GVL_AGV_To_AGV_number_Fr_Command";
|
||||
|
||||
private StandardCoveyorControlDeviceDriver driver;
|
||||
|
||||
@@ -33,44 +28,25 @@ public class ItemProtocol {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getHeartbeat() {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
|
||||
public int getByMode(String device_code) {
|
||||
return this.getOpcIntegerValue(item_byMode, device_code);
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
public int getBySignal(String device_code) {
|
||||
return this.getOpcIntegerValue(item_bySignal, device_code);
|
||||
}
|
||||
|
||||
public int getMove() {
|
||||
return this.getOpcIntegerValue(item_move);
|
||||
public int getByAction(String device_code) {
|
||||
return this.getOpcIntegerValue(item_byAction, device_code);
|
||||
}
|
||||
|
||||
public int getAction() {
|
||||
return this.getOpcIntegerValue(item_action);
|
||||
public int getByError(String device_code) {
|
||||
return this.getOpcIntegerValue(item_byError, device_code);
|
||||
}
|
||||
|
||||
public int getError() {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
|
||||
public int getOperation_type() {
|
||||
return this.getOpcIntegerValue(item_operation_type);
|
||||
}
|
||||
|
||||
public int getTask() {
|
||||
return this.getOpcIntegerValue(item_task);
|
||||
}
|
||||
|
||||
public int getToCommand() {
|
||||
return this.getOpcIntegerValue(item_to_command);
|
||||
}
|
||||
|
||||
public int getToTarget() {
|
||||
return this.getOpcIntegerValue(item_to_target);
|
||||
}
|
||||
|
||||
public int getToTask() {
|
||||
return this.getOpcIntegerValue(item_to_task);
|
||||
public int getDwTaskNo(String device_code) {
|
||||
return this.getOpcIntegerValue(item_dwTaskNo, device_code);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +57,8 @@ public class ItemProtocol {
|
||||
|
||||
Boolean isonline;
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
public int getOpcIntegerValue(String protocol, String device_code) {
|
||||
protocol = protocol.replace("number", device_code).replace("\"", "");
|
||||
Integer value = this.driver.getIntegerValue(protocol);
|
||||
if (value == null) {
|
||||
log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
@@ -96,24 +73,19 @@ public class ItemProtocol {
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作状态", "DB600.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B2"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "DB600.B3"));
|
||||
list.add(new ItemDto(item_ioaction, "进出类型", "DB600.B4"));
|
||||
list.add(new ItemDto(item_height, "高度类型", "DB600.B5"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB600.B6"));
|
||||
list.add(new ItemDto(item_direction, "电机方向", "DB600.B7"));
|
||||
list.add(new ItemDto(item_operation_type, "作业类型", "DB600.B8"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB600.D22"));
|
||||
list.add(new ItemDto(item_byMode, "工作模式", "DB600.B1"));
|
||||
list.add(new ItemDto(item_bySignal, "光电信号", "DB600.B2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_byAction, "动作信号", "DB600.B3"));
|
||||
list.add(new ItemDto(item_byError, "报警信号", "DB600.B4"));
|
||||
list.add(new ItemDto(item_dwTaskNo, "任务号", "DB600.D5"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_target, "目标站", "DB601.W4"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "DB601.D8"));
|
||||
list.add(new ItemDto(item_to_byWCommand, "作业命令", "DB601.W2"));
|
||||
list.add(new ItemDto(item_to_byTarget, "目标站", "DB601.W4"));
|
||||
list.add(new ItemDto(item_to_byDwTaskNo, "任务号", "DB601.D8"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,22 +52,7 @@ public class StandardConveyorControlDefination implements OpcDeviceDriverDefinat
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return getReadableItemDtos2();
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos2() {
|
||||
List<ItemDto> list = new ArrayList();
|
||||
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB600.B2"));
|
||||
list.add(new ItemDto(ItemProtocol.item_action, "取放信号", "DB600.B3"));
|
||||
list.add(new ItemDto(ItemProtocol.item_ioaction, "进出类型", "DB600.B4"));
|
||||
list.add(new ItemDto(ItemProtocol.item_height, "高度类型", "DB600.B5"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B6"));
|
||||
list.add(new ItemDto(ItemProtocol.item_direction, "电机方向", "DB600.B7"));
|
||||
list.add(new ItemDto(ItemProtocol.item_operation_type, "作业类型", "DB600.B8"));
|
||||
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB600.D22"));
|
||||
return list;
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -68,16 +68,17 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
||||
//有货标记
|
||||
protected boolean has_goods_tag = false;
|
||||
|
||||
int mode = 0;
|
||||
int error = 0;
|
||||
int move = 0;
|
||||
int task = 0;
|
||||
//出入库模式
|
||||
int operation_type = 0;
|
||||
int last_mode = 0;
|
||||
int last_error = 0;
|
||||
int last_move = 0;
|
||||
int last_task = 0;
|
||||
int byMode = 0;
|
||||
int bySignal = 0;
|
||||
int byAction = 0;
|
||||
int byError = 0;
|
||||
int dwTaskNo = 0;
|
||||
|
||||
int last_byMode = 0;
|
||||
int last_bySignal = 0;
|
||||
int last_byAction = 0;
|
||||
int last_byError = 0;
|
||||
int last_dwTaskNo = 0;
|
||||
|
||||
Boolean isonline = true;
|
||||
int hasGoods = 0;
|
||||
@@ -143,133 +144,90 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
||||
String message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
error = this.itemProtocol.getError();
|
||||
move = this.itemProtocol.getMove();
|
||||
task = this.itemProtocol.getTask();
|
||||
hasGoods = this.itemProtocol.getMove();
|
||||
operation_type = this.itemProtocol.getOperation_type();
|
||||
if (mode != last_mode) {
|
||||
byMode = this.itemProtocol.getByMode(device_code);
|
||||
bySignal = this.itemProtocol.getBySignal(device_code);
|
||||
byAction = this.itemProtocol.getByAction(device_code);
|
||||
byError = this.itemProtocol.getByError(device_code);
|
||||
dwTaskNo = this.itemProtocol.getDwTaskNo(device_code);
|
||||
if (byMode != last_byMode) {
|
||||
this.execute_log.setResource(this.device_code, this.device_code);
|
||||
this.execute_log.log("设备:" + device_code + ",last_mode -> mode:" + last_mode + "->" + mode);
|
||||
this.execute_log.log("设备:" + device_code + ",last_byMode -> byMode:" + last_byMode + "->" + byMode);
|
||||
}
|
||||
if (move != last_move) {
|
||||
if (bySignal != last_bySignal) {
|
||||
this.execute_log.setResource(this.device_code, this.device_code);
|
||||
this.execute_log.log("设备:" + device_code + ",last_move -> move:" + last_mode + "->" + move);
|
||||
if (move == 0) {
|
||||
thingToNothing();
|
||||
}
|
||||
this.setRequireSucess(false);
|
||||
|
||||
this.execute_log.log("设备:" + device_code + ",last_bySignal -> bySignal:" + last_bySignal + "->" + bySignal);
|
||||
}
|
||||
if (error != last_error) {
|
||||
if (byAction != last_byAction) {
|
||||
this.execute_log.setResource(this.device_code, this.device_code);
|
||||
this.execute_log.log("设备:" + device_code + ",last_error -> error:" + last_error + "->" + error);
|
||||
this.execute_log.log("设备:" + device_code + ",last_byAction -> byAction:" + last_byAction + "->" + byAction);
|
||||
}
|
||||
if (byError != last_byError) {
|
||||
this.execute_log.setResource(this.device_code, this.device_code);
|
||||
this.execute_log.log("设备:" + device_code + ",last_byError -> byError:" + last_byError + "->" + byError);
|
||||
}
|
||||
if (dwTaskNo != last_dwTaskNo) {
|
||||
this.execute_log.setResource(this.device_code, this.device_code);
|
||||
this.execute_log.log("设备:" + device_code + ",last_dwTaskNo -> dwTaskNo:" + last_dwTaskNo + "->" + dwTaskNo);
|
||||
}
|
||||
|
||||
if ( move != 0 && task > 0) {
|
||||
//inst_message
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (inst != null) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
|
||||
if(mode == 2){
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
finish_instruction();
|
||||
}
|
||||
}
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.itemProtocol.getIsonline()) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "信号量同步异常";
|
||||
//未联机
|
||||
} else if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "未联机";
|
||||
//有报警
|
||||
} else if (error != 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "有报警";
|
||||
//无报警
|
||||
if (1 > 2) {
|
||||
// this.setIsonline(false);
|
||||
// this.setIserror(true);
|
||||
// message = "信号量同步异常";
|
||||
// //未联机
|
||||
// } else if (mode == 0) {
|
||||
// this.setIsonline(false);
|
||||
// this.setIserror(true);
|
||||
// message = "未联机";
|
||||
// //有报警
|
||||
// } else if (error != 0) {
|
||||
// this.setIsonline(false);
|
||||
// this.setIserror(true);
|
||||
// message = "有报警";
|
||||
// //无报警
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
log.debug("设备运转模式:等待工作");
|
||||
break;
|
||||
case 2:
|
||||
//申请任务
|
||||
if (!StrUtil.isEmpty(material) && !StrUtil.isEmpty(qty) && material.length() > 0 && qty.length() > 0 && !requireSucess) {
|
||||
this.execute_log.log("设备:" + device_code + ",material:" + material + ",qty:" + qty);
|
||||
this.instruction_require(container);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
|
||||
break;
|
||||
case 4:
|
||||
//叫料
|
||||
|
||||
break;
|
||||
case 5:
|
||||
//申请空盘
|
||||
if (move == 0 && !requireSucess) {
|
||||
apply_OutEmpty();
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
//申请入库
|
||||
if (move != 0 && !applySucess) {
|
||||
instruction_apply();
|
||||
}
|
||||
if (move != 0 && !requireSucess) {
|
||||
apply_InEmpty();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
switch (flag) {
|
||||
//取货完成
|
||||
case 1:
|
||||
writing(2);
|
||||
break;
|
||||
//放货完成
|
||||
case 2:
|
||||
writing(3);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
last_mode = mode;
|
||||
last_error = error;
|
||||
last_move = move;
|
||||
last_task = task;
|
||||
last_byMode = byMode;
|
||||
last_bySignal = bySignal;
|
||||
last_byAction = byAction;
|
||||
last_byError = byError;
|
||||
last_dwTaskNo = dwTaskNo;
|
||||
}
|
||||
|
||||
public boolean exe_error() {
|
||||
if (this.error == 0) {
|
||||
return true;
|
||||
} else {
|
||||
log.debug("设备报警");
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void writing(int type, String value) {
|
||||
String param = "";
|
||||
if (type == 1){
|
||||
param = "Application_GVL_AGV_To_AGV_number_Fr_Command";
|
||||
param = param.replace("number", device_code).replace("\"", "");
|
||||
} else if (type == 2){
|
||||
param = "Application_GVL_AGV_To_AGV_number_Fr_Target";
|
||||
param = param.replace("number", device_code).replace("\"", "");
|
||||
} else if (type == 3){
|
||||
param = "Application_GVL_AGV_To_AGV_number_Fr_TaskNo";
|
||||
param = param.replace("number", device_code).replace("\"", "");
|
||||
}
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + param;
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_param, value);
|
||||
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
protected void thingToNothing() {
|
||||
@@ -299,336 +257,10 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void executing(Instruction instruction) {
|
||||
this.executing(1, instruction, "");
|
||||
}
|
||||
|
||||
public void executing(int command, Instruction instruction, String appendMessage) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_command;
|
||||
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_target;
|
||||
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_task;
|
||||
if (appendMessage == null) {
|
||||
appendMessage = "";
|
||||
}
|
||||
if (instruction != null) {
|
||||
instruction_num = Integer.parseInt(instruction.getInstruction_code());
|
||||
}
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_command, 1);
|
||||
itemMap.put(to_task, instruction_num);
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
}
|
||||
|
||||
public void executing(Server server, Map<String, Object> itemMap) {
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
public void writing(int command) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_command;
|
||||
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_command, command);
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
}
|
||||
|
||||
public void writing(int command, int target, int task) {
|
||||
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command;
|
||||
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_target;
|
||||
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_task;
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_command, command);
|
||||
itemMap.put(to_target, target);
|
||||
itemMap.put(to_task, task);
|
||||
this.execute_log.setResource(this.device_code, device_code);
|
||||
this.execute_log.log("设备:{},下发作业命令:{},目标站:{},任务号:{}", device_code, command, target, task);
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
public void writing(int type, int command) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_command;
|
||||
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_target;
|
||||
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_task;
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
if (type == 1) {
|
||||
itemMap.put(to_command, command);
|
||||
} else if (type == 2) {
|
||||
itemMap.put(to_target, command);
|
||||
|
||||
} else if (type == 3) {
|
||||
itemMap.put(to_task, command);
|
||||
}
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
}
|
||||
|
||||
public boolean instruction_apply() throws Exception {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_apply_time = date;
|
||||
//container_code
|
||||
List<TaskDto> taskList = taskserver.queryTaskByDeviceCode(this.device_code);
|
||||
//
|
||||
if (!ObjectUtil.isEmpty(taskList)) {
|
||||
TaskDto task = taskList.get(0);
|
||||
String taskid = task.getTask_id();
|
||||
String taskcode = task.getTask_code();
|
||||
String vehiclecode = task.getVehicle_code();
|
||||
String priority = task.getPriority();
|
||||
String start_point_code = task.getStart_point_code();
|
||||
String start_device_code = task.getStart_device_code();
|
||||
String route_plan_code = task.getRoute_plan_code();
|
||||
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
|
||||
RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||
|
||||
String path = routeLineDto.getPath();
|
||||
String type = routeLineDto.getType();
|
||||
String[] str = path.split("->");
|
||||
if (!StrUtil.equals(type, "0")) {
|
||||
return false;
|
||||
}
|
||||
List<String> pathlist = Arrays.asList(str);
|
||||
int index = 0;
|
||||
for (int m = 0; m < pathlist.size(); m++) {
|
||||
if (pathlist.get(m).equals(start_device_code)) {
|
||||
index = m + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String next_device_code = pathlist.get(index);
|
||||
Device startdevice = deviceAppservice.findDeviceByCode(start_device_code);
|
||||
Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code);
|
||||
String next_point_code;
|
||||
if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) {
|
||||
next_point_code = task.getTo_x() + "-" + task.getTo_y() + "-" + task.getTo_z();
|
||||
} else {
|
||||
next_point_code = next_device_code;
|
||||
}
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setRoute_plan_code(route_plan_code);
|
||||
instdto.setRemark(task.getRemark());
|
||||
instdto.setMaterial(task.getMaterial());
|
||||
instdto.setQuantity(task.getQuantity());
|
||||
instdto.setTask_id(taskid);
|
||||
instdto.setTask_code(taskcode);
|
||||
instdto.setVehicle_code(vehiclecode);
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by("auto");
|
||||
instdto.setStart_device_code(start_device_code);
|
||||
instdto.setNext_device_code(next_device_code);
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
task.setRemark("指令创建失败:" + e);
|
||||
taskserver.updateByCodeFromCache(task);
|
||||
throw new RuntimeException("指令创建失败:" + e);
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||
task.setTask_status("1");
|
||||
JSONObject json = JSONObject.fromObject(task);
|
||||
taskwo.update(json);
|
||||
applySucess = true;
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean instruction_require(String container_code) {
|
||||
return instruction_require(container_code, WcsConfig.task_container_type_default_desc);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求指令
|
||||
*
|
||||
* @param container_code
|
||||
* @param container_type
|
||||
*/
|
||||
public synchronized boolean instruction_require(String container_code, String container_type) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
TaskDto dto = new TaskDto();
|
||||
String now = DateUtil.now();
|
||||
dto.setTask_id(IdUtil.simpleUUID());
|
||||
dto.setCreate_by(this.getDevice().getDevice_code());
|
||||
dto.setUpdate_by(this.getDevice().getDevice_code());
|
||||
dto.setStart_point_code(this.getDevice().getDevice_code());
|
||||
dto.setVehicle_code(container_code);
|
||||
dto.setVehicle_type(container_type);
|
||||
|
||||
String taskcode = CodeUtil.getNewCode("TASK_NO");
|
||||
dto.setTask_code("-" + taskcode);
|
||||
dto.setTask_status("0");
|
||||
dto.setPriority("101");
|
||||
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
|
||||
String next_device_codecode = jo.getNext_device_code();
|
||||
if (StrUtil.isEmpty(next_device_codecode)) {
|
||||
throw new RuntimeException("该设备未找到对应路由");
|
||||
}
|
||||
dto.setNext_point_code(next_device_codecode);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = JSONObject.fromObject(dto);
|
||||
wo.insert(json);
|
||||
requireSucess = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public synchronized boolean finish_instruction() throws Exception {
|
||||
instructionService.finish(inst);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void apply_OutEmpty() {
|
||||
String result = acsToWmsService.apply_OutEmpty(this.getDeviceCode());
|
||||
JSONObject jo = JSONObject.fromObject(result);
|
||||
if (ObjectUtil.isEmpty(jo)) {
|
||||
message = "接口不通";
|
||||
} else {
|
||||
if (jo.getInt("status") == 200) {
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.setRequireSucess(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean apply_InEmpty() throws Exception {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < 6000) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
//container_code
|
||||
List<TaskDto> taskList = taskserver.queryTaskByDeviceCode(this.device_code);
|
||||
//
|
||||
if (!ObjectUtil.isEmpty(taskList)) {
|
||||
TaskDto task = taskList.get(0);
|
||||
String taskid = task.getTask_id();
|
||||
String taskcode = task.getTask_code();
|
||||
String vehiclecode = task.getVehicle_code();
|
||||
String priority = task.getPriority();
|
||||
String start_point_code = task.getStart_point_code();
|
||||
String start_device_code = task.getStart_device_code();
|
||||
String route_plan_code = task.getRoute_plan_code();
|
||||
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
|
||||
RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||
|
||||
String path = routeLineDto.getPath();
|
||||
String type = routeLineDto.getType();
|
||||
String[] str = path.split("->");
|
||||
if (!StrUtil.equals(type, "0")) {
|
||||
return false;
|
||||
}
|
||||
List<String> pathlist = Arrays.asList(str);
|
||||
int index = 0;
|
||||
for (int m = 0; m < pathlist.size(); m++) {
|
||||
if (pathlist.get(m).equals(start_device_code)) {
|
||||
index = m + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String next_device_code = pathlist.get(index);
|
||||
Device startdevice = deviceAppservice.findDeviceByCode(start_device_code);
|
||||
Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code);
|
||||
String next_point_code;
|
||||
if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) {
|
||||
next_point_code = task.getTo_x() + "-" + task.getTo_y() + "-" + task.getTo_z();
|
||||
} else {
|
||||
next_point_code = next_device_code;
|
||||
}
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setRoute_plan_code(route_plan_code);
|
||||
instdto.setRemark(task.getRemark());
|
||||
instdto.setMaterial(task.getMaterial());
|
||||
instdto.setQuantity(task.getQuantity());
|
||||
instdto.setTask_id(taskid);
|
||||
instdto.setTask_code(taskcode);
|
||||
instdto.setVehicle_code(vehiclecode);
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by("auto");
|
||||
instdto.setStart_device_code(start_device_code);
|
||||
instdto.setNext_device_code(next_device_code);
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
task.setRemark("指令创建失败:" + e);
|
||||
taskserver.updateByCodeFromCache(task);
|
||||
throw new RuntimeException("指令创建失败:" + e);
|
||||
} //创建指令后修改任务状态
|
||||
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||
task.setTask_status("1");
|
||||
JSONObject json = JSONObject.fromObject(task);
|
||||
taskwo.update(json);
|
||||
requireSucess = true;
|
||||
} else {
|
||||
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS).toString(), "1")) {
|
||||
//{"status":200,"message":"任务状态反馈成功!","data":{},"errArr":[]}
|
||||
String result = acsToWmsService.apply_InEmpty(this.getDeviceCode(), "1", "1", this.container);
|
||||
JSONObject jo = JSONObject.fromObject(result);
|
||||
if (ObjectUtil.isEmpty(jo)) {
|
||||
message = "接口不通";
|
||||
} else {
|
||||
if (jo.getInt("status") == 200) {
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.setRequireSucess(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public interface AcsToWmsZDService {
|
||||
*
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> taskFeedback(Map whereJson) throws Exception;
|
||||
Map<String, Object> taskFeedback(Map whereJson);
|
||||
|
||||
/**
|
||||
* 任务取消
|
||||
@@ -28,7 +28,7 @@ public interface AcsToWmsZDService {
|
||||
*
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> taskDeprecate(Map whereJson) throws Exception;
|
||||
Map<String, Object> taskDeprecate(Map whereJson);
|
||||
|
||||
/**
|
||||
* 设备查询
|
||||
@@ -36,5 +36,5 @@ public interface AcsToWmsZDService {
|
||||
*
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> checkDeviceStatus(Map whereJson) throws Exception;
|
||||
Map<String, Object> checkDeviceStatus(Map whereJson);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,315 @@
|
||||
package org.nl.acs.ext.wms.service;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device_driver.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
|
||||
import org.nl.acs.device_driver.standard_conveyor_line.StandardConveyorLineDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsZDServiceImpl;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author: geng by
|
||||
* @createDate: 2022/12/5
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AgvWaitUtil {
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final AcsToWmsZDServiceImpl acsToWmsZDService;
|
||||
private final InstructionService instructionService;
|
||||
@Autowired
|
||||
LogServer logServer;
|
||||
|
||||
//取货前等待
|
||||
public Map<String, Object> waitInGet(String device_code, Map<String, Object> feedMap, JSONObject param) {
|
||||
String inst_code = param.getString("task_code");
|
||||
Instruction instructionDto = instructionService.findByCode(inst_code);
|
||||
String task_code = String.valueOf(feedMap.get("taskCode"));
|
||||
StandardConveyorLineDeviceDriver standardConveyorLineDeviceDriver;
|
||||
StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
JSONObject map = new JSONObject();
|
||||
String type = "";
|
||||
if (device.getDeviceDriver() instanceof StandardConveyorLineDeviceDriver) {
|
||||
standardConveyorLineDeviceDriver = (StandardConveyorLineDeviceDriver) device.getDeviceDriver();
|
||||
if (standardConveyorLineDeviceDriver.getMove() == 1 && standardConveyorLineDeviceDriver.getAction() == 1) {
|
||||
feedMap.put("feedbackStatus", "applyTake");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = Integer.parseInt((String) feedback.get("responseCode"));
|
||||
String responseMessage = String.valueOf(feedback.get("responseMessage"));
|
||||
if (responseCode == 0) {
|
||||
feedback.put("feedbackStatus", "taking");
|
||||
acsToWmsZDService.taskFeedback(feedMap);
|
||||
map.put("status", 200);
|
||||
map.put("message", "请求成功");
|
||||
type = "info";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
} else {
|
||||
map.put("status", responseCode);
|
||||
map.put("message", responseMessage);
|
||||
type = "erro";
|
||||
logServer.log(task_code, "feedbackTask", type, param.toString(), String.valueOf(map), "400", "/restful/api/v3/feedbackTask", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败!");
|
||||
}
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,起点位置无货!move = " + standardConveyorLineDeviceDriver.getMove() + "action = " + standardConveyorLineDeviceDriver.getAction());
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,起点位置无货!");
|
||||
}
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
if (standardCoveyorControlDeviceDriver.getBySignal() == 1 && standardCoveyorControlDeviceDriver.getByAction() == 0) {
|
||||
feedMap.put("feedbackStatus", "applyTake");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = Integer.parseInt((String) feedback.get("responseCode"));
|
||||
String responseMessage = String.valueOf(feedback.get("responseMessage"));
|
||||
if (responseCode == 0) {
|
||||
feedback.put("feedbackStatus", "taking");
|
||||
acsToWmsZDService.taskFeedback(feedMap);
|
||||
map.put("status", 200);
|
||||
map.put("message", "请求成功");
|
||||
type = "info";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
} else {
|
||||
map.put("status", responseCode);
|
||||
map.put("message", responseMessage);
|
||||
type = "erro";
|
||||
logServer.log(task_code, "feedbackTask", type, param.toString(), String.valueOf(map), "400", "/restful/api/v3/feedbackTask", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败!");
|
||||
}
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,起点位置无货!move = " + standardCoveyorControlDeviceDriver.getBySignal());
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,起点位置无货!");
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
//取货完成等待
|
||||
public Map<String, Object> waitOutGet(String device_code, Map<String, Object> feedMap, JSONObject param) {
|
||||
String inst_code = param.getString("task_code");
|
||||
Instruction instructionDto = instructionService.findByCode(inst_code);
|
||||
String task_code = String.valueOf(feedMap.get("taskCode"));
|
||||
StandardConveyorLineDeviceDriver standardConveyorLineDeviceDriver;
|
||||
StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
JSONObject map = new JSONObject();
|
||||
String type = "";
|
||||
if (device.getDeviceDriver() instanceof StandardConveyorLineDeviceDriver) {
|
||||
standardConveyorLineDeviceDriver = (StandardConveyorLineDeviceDriver) device.getDeviceDriver();
|
||||
if (standardConveyorLineDeviceDriver.getMove() == 0) {
|
||||
standardConveyorLineDeviceDriver.writing(2);
|
||||
feedMap.put("feedbackStatus", "takeFinish");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = (int) feedback.get("responseCode");
|
||||
String responseMessage = (String) feedback.get("responseMessage");
|
||||
if (responseCode == 0) {
|
||||
map.put("status", 200);
|
||||
map.put("message", "请求成功");
|
||||
type = "info";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
} else {
|
||||
map.put("status", responseCode);
|
||||
map.put("message", responseMessage);
|
||||
type = "erro";
|
||||
logServer.log(task_code, "feedbackTask", type, param.toString(), String.valueOf(map), "400", "/restful/api/v3/feedbackTask", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败!");
|
||||
}
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,取货完成后,起点位置仍有货!move=" + standardConveyorLineDeviceDriver.getMove());
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,起点位置有货!");
|
||||
}
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
if (standardCoveyorControlDeviceDriver.getBySignal() == 0) {
|
||||
standardCoveyorControlDeviceDriver.writing(1, "2");
|
||||
feedMap.put("feedbackStatus", "takeFinish");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = (int) feedback.get("responseCode");
|
||||
String responseMessage = (String) feedback.get("responseMessage");
|
||||
if (responseCode == 0) {
|
||||
map.put("status", 200);
|
||||
map.put("message", "请求成功");
|
||||
type = "info";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
} else {
|
||||
map.put("status", responseCode);
|
||||
map.put("message", responseMessage);
|
||||
type = "erro";
|
||||
logServer.log(task_code, "feedbackTask", type, param.toString(), String.valueOf(map), "400", "/restful/api/v3/feedbackTask", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败!");
|
||||
}
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,取货完成后,起点位置仍有货!move=" + standardCoveyorControlDeviceDriver.getBySignal());
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,起点位置有货!");
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
//放货前等待
|
||||
public Map<String, Object> waitInPut(String device_code, Map<String, Object> feedMap, JSONObject param) {
|
||||
String inst_code = param.getString("task_code");
|
||||
Instruction instructionDto = instructionService.findByCode(inst_code);
|
||||
String task_code = String.valueOf(feedMap.get("taskCode"));
|
||||
StandardConveyorLineDeviceDriver standardConveyorLineDeviceDriver;
|
||||
StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
JSONObject map = new JSONObject();
|
||||
String type = "";
|
||||
if (device.getDeviceDriver() instanceof StandardConveyorLineDeviceDriver) {
|
||||
standardConveyorLineDeviceDriver = (StandardConveyorLineDeviceDriver) device.getDeviceDriver();
|
||||
if (standardConveyorLineDeviceDriver.getMove() == 0 && standardConveyorLineDeviceDriver.getAction() == 2) {
|
||||
feedMap.put("feedbackStatus", "applyPut");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = Integer.parseInt((String) feedback.get("responseCode"));
|
||||
String responseMessage = (String) feedback.get("responseMessage");
|
||||
if (responseCode == 0) {
|
||||
feedback.put("feedbackStatus", "puting");
|
||||
acsToWmsZDService.taskFeedback(feedMap);
|
||||
map.put("status", 200);
|
||||
map.put("message", "请求成功");
|
||||
type = "info";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
} else {
|
||||
map.put("status", responseCode);
|
||||
map.put("message", responseMessage);
|
||||
type = "erro";
|
||||
logServer.log(task_code, "feedbackTask", type, param.toString(), String.valueOf(map), "400", "/restful/api/v3/feedbackTask", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败!");
|
||||
}
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,终点位置有货!move = " + standardConveyorLineDeviceDriver.getMove() + "action = " + standardConveyorLineDeviceDriver.getAction());
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,终点位置有货!");
|
||||
}
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
if (standardCoveyorControlDeviceDriver.getBySignal() == 0 && standardCoveyorControlDeviceDriver.getByAction() == 0) {
|
||||
feedMap.put("feedbackStatus", "applyPut");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = Integer.parseInt((String) feedback.get("responseCode"));
|
||||
String responseMessage = (String) feedback.get("responseMessage");
|
||||
if (responseCode == 0) {
|
||||
feedback.put("feedbackStatus", "puting");
|
||||
acsToWmsZDService.taskFeedback(feedMap);
|
||||
map.put("status", 200);
|
||||
map.put("message", "请求成功");
|
||||
type = "info";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
} else {
|
||||
map.put("status", responseCode);
|
||||
map.put("message", responseMessage);
|
||||
type = "erro";
|
||||
logServer.log(task_code, "feedbackTask", type, param.toString(), String.valueOf(map), "400", "/restful/api/v3/feedbackTask", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败!");
|
||||
}
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,终点位置有货!move = " + standardCoveyorControlDeviceDriver.getBySignal());
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,终点位置有货!");
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
//放货完成等待
|
||||
public Map<String, Object> waitOutPut(String device_code, Map<String, Object> feedMap, JSONObject param) {
|
||||
String inst_code = param.getString("task_code");
|
||||
Instruction instructionDto = instructionService.findByCode(inst_code);
|
||||
String task_code = String.valueOf(feedMap.get("taskCode"));
|
||||
StandardConveyorLineDeviceDriver standardConveyorLineDeviceDriver;
|
||||
StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
JSONObject map = new JSONObject();
|
||||
String type = "";
|
||||
if (device.getDeviceDriver() instanceof StandardConveyorLineDeviceDriver) {
|
||||
standardConveyorLineDeviceDriver = (StandardConveyorLineDeviceDriver) device.getDeviceDriver();
|
||||
if (standardConveyorLineDeviceDriver.getMove() == 1) {
|
||||
standardConveyorLineDeviceDriver.writing(3);
|
||||
feedMap.put("feedbackStatus", "putFinish");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = (int) feedback.get("responseCode");
|
||||
String responseMessage = (String) feedback.get("responseMessage");
|
||||
if (responseCode == 0) {
|
||||
map.put("status", 200);
|
||||
map.put("message", "请求成功");
|
||||
type = "info";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
} else {
|
||||
map.put("status", responseCode);
|
||||
map.put("message", responseMessage);
|
||||
type = "erro";
|
||||
logServer.log(task_code, "feedbackTask", type, param.toString(), String.valueOf(map), "400", "/restful/api/v3/feedbackTask", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败");
|
||||
}
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,放货货完成后,终点位置仍无货!move=" + standardConveyorLineDeviceDriver.getMove());
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,放货货完成后,终点位置仍无货!");
|
||||
}
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
if (standardCoveyorControlDeviceDriver.getBySignal() == 1) {
|
||||
standardCoveyorControlDeviceDriver.writing(1, "3");
|
||||
feedMap.put("feedbackStatus", "putFinish");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = (int) feedback.get("responseCode");
|
||||
String responseMessage = (String) feedback.get("responseMessage");
|
||||
if (responseCode == 0) {
|
||||
map.put("status", 200);
|
||||
map.put("message", "请求成功");
|
||||
type = "info";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
} else {
|
||||
map.put("status", responseCode);
|
||||
map.put("message", responseMessage);
|
||||
type = "erro";
|
||||
logServer.log(task_code, "feedbackTask", type, param.toString(), String.valueOf(map), "400", "/restful/api/v3/feedbackTask", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败");
|
||||
}
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,放货货完成后,终点位置仍无货!move=" + standardCoveyorControlDeviceDriver.getBySignal());
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,放货货完成后,终点位置仍无货!");
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,9 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
TaskDto task_dto = (TaskDto) JSONObject.toBean(jo, TaskDto.class);
|
||||
try {
|
||||
taskService.create(task_dto);
|
||||
logServer.log(taskCode, "taskCreate", "success", whereJson.toString(), "创建成功", String.valueOf(200), "/createTask", "");
|
||||
} catch (Exception e) {
|
||||
logServer.log(taskCode, "taskCreate", "error", whereJson.toString(), e.getMessage(), String.valueOf(400), "/createTask", "");
|
||||
e.printStackTrace();
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", e.getMessage());
|
||||
@@ -182,17 +184,21 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
result = HttpRequest.post(url)
|
||||
.header("Authorization", token).body(String.valueOf(whereJson))
|
||||
.execute();
|
||||
logServer.log(taskCode, "taskFeedback", "success", whereJson.toString(), result.body(), String.valueOf(result.getStatus()), url, carId);
|
||||
JSONObject jo = JSONObject.fromObject(result.body());
|
||||
return jo;
|
||||
} catch (Exception e) {
|
||||
logServer.log(taskCode, "taskFeedback", "error", whereJson.toString(), result.body(), String.valueOf(result.getStatus()), url, carId);
|
||||
int status = 400;
|
||||
if (!ObjectUtil.isEmpty(result)) {
|
||||
status = result.getStatus();
|
||||
}
|
||||
logServer.log(taskCode, "taskFeedback", "error", whereJson.toString(), e.getMessage(), String.valueOf(status), url, carId);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", e.getMessage());
|
||||
map.put("parameters", new HashMap<>());
|
||||
return map;
|
||||
}
|
||||
logServer.log(taskCode, "taskFeedback", "success", whereJson.toString(), result.body(), String.valueOf(result.getStatus()), url, carId);
|
||||
JSONObject jo = JSONObject.fromObject(result.body());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -208,18 +214,20 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
result = HttpRequest.post(url)
|
||||
.header("Authorization", token).body(String.valueOf(whereJson))
|
||||
.execute();
|
||||
logServer.log(taskCode, "taskDeprecate", "success", whereJson.toString(), result.body(), String.valueOf(result.getStatus()), url, "");
|
||||
JSONObject jo = JSONObject.fromObject(result.body());
|
||||
return jo;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logServer.log(taskCode, "taskFeedback", "error", whereJson.toString(), e.getMessage(), String.valueOf(result.getStatus()), url, "");
|
||||
int status = 400;
|
||||
if (!ObjectUtil.isEmpty(result)) {
|
||||
status = result.getStatus();
|
||||
}
|
||||
logServer.log(taskCode, "taskFeedback", "error", whereJson.toString(), e.getMessage(), String.valueOf(status), url, "");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", e.getMessage());
|
||||
return map;
|
||||
}
|
||||
logServer.log(taskCode, "taskDeprecate", "success", whereJson.toString(), result.body(), String.valueOf(result.getStatus()), url, "");
|
||||
JSONObject jo = JSONObject.fromObject(result.body());
|
||||
log.info("taskDeprecate-----输出参数{}", jo.toString());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -241,16 +249,19 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
result = HttpRequest.post(url)
|
||||
.header("Authorization", token).body(String.valueOf(whereJson))
|
||||
.execute();
|
||||
JSONObject jo = JSONObject.fromObject(result.body());
|
||||
log.info("checkDeviceStatus-----输出参数{}", jo.toString());
|
||||
return jo;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logServer.log(deviceCode, "checkDeviceStatus", "error", whereJson.toString(), e.getMessage(), String.valueOf(result.getStatus()), url, "");
|
||||
int status = 400;
|
||||
if (!ObjectUtil.isEmpty(result)) {
|
||||
status = result.getStatus();
|
||||
}
|
||||
logServer.log(deviceCode, "checkDeviceStatus", "error", whereJson.toString(), e.getMessage(), String.valueOf(status), url, "");
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", e.getMessage());
|
||||
return map;
|
||||
}
|
||||
JSONObject jo = JSONObject.fromObject(result.body());
|
||||
log.info("checkDeviceStatus-----输出参数{}", jo.toString());
|
||||
return jo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.nl.acs.device_driver.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
|
||||
import org.nl.acs.device_driver.standard_conveyor_line.StandardConveyorLineDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AgvToAcsService;
|
||||
import org.nl.acs.ext.wms.service.AgvWaitUtil;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
@@ -28,6 +30,7 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final AcsToWmsZDServiceImpl acsToWmsZDService;
|
||||
private final InstructionService instructionService;
|
||||
private final AgvWaitUtil agvWaitUtil;
|
||||
@Autowired
|
||||
LogServer logServer;
|
||||
|
||||
@@ -36,7 +39,6 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
public Map<String, Object> waitpointRequest(JSONObject param) {
|
||||
String inst_code = param.getString("task_code");
|
||||
String address = param.getString("address");
|
||||
StandardConveyorLineDeviceDriver standardConveyorLineDeviceDriver;
|
||||
Instruction instructionDto = instructionService.findByCode(inst_code);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if (ObjectUtil.isEmpty(instructionDto)) {
|
||||
@@ -49,132 +51,25 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
Map<String, Object> feedMap = new HashMap();
|
||||
feedMap.put("taskCode", task_code);
|
||||
feedMap.put("taskType", instructionDto.getInstruction_type());
|
||||
feedMap.put("carId", instructionDto.getAgv_jobno());
|
||||
String type = "";
|
||||
String start_device_code = instructionDto.getStart_device_code();
|
||||
String next_device_code = instructionDto.getNext_device_code();
|
||||
if (address.contains("IN")) {
|
||||
String deviceCodeNow = address.substring(0, address.length() - 2);
|
||||
Device deviceNow = deviceAppService.findDeviceByCode(deviceCodeNow);
|
||||
if (deviceNow.getDeviceDriver() instanceof StandardConveyorLineDeviceDriver) {
|
||||
standardConveyorLineDeviceDriver = (StandardConveyorLineDeviceDriver) deviceNow.getDeviceDriver();
|
||||
if (start_device_code.equals(deviceCodeNow)) {
|
||||
if (standardConveyorLineDeviceDriver.getMove() == 1) {
|
||||
feedMap.put("feedbackStatus", "applyTake");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = Integer.parseInt((String) feedback.get("responseCode"));
|
||||
String responseMessage = (String) feedback.get("responseMessage");
|
||||
if (responseCode == 0) {
|
||||
feedback.put("feedbackStatus", "“taking");
|
||||
acsToWmsZDService.taskFeedback(feedMap);
|
||||
map.put("status", 200);
|
||||
map.put("message", "请求成功");
|
||||
type = "info";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "操作失败");
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败!");
|
||||
}
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,起点位置无货!");
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,起点位置无货!");
|
||||
}
|
||||
} else if (deviceCodeNow.equals(next_device_code)) {
|
||||
if (standardConveyorLineDeviceDriver.getMove() != 0) {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,终点位置有货!");
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,终点位置有货!");
|
||||
} else {
|
||||
feedMap.put("feedbackStatus", "applyPut");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = Integer.parseInt((String) feedback.get("responseCode"));
|
||||
String responseMessage = (String) feedback.get("responseMessage");
|
||||
if (responseCode == 0) {
|
||||
feedback.put("feedbackStatus", "puting");
|
||||
acsToWmsZDService.taskFeedback(feedMap);
|
||||
map.put("status", 200);
|
||||
map.put("message", "请求成功");
|
||||
type = "info";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
} else {
|
||||
logServer.log(task_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", "");
|
||||
map.put("status", 400);
|
||||
map.put("message", "操作失败");
|
||||
type = "erro";
|
||||
throw new BadRequestException("请求失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (start_device_code.equals(deviceCodeNow)) {
|
||||
return agvWaitUtil.waitInGet(deviceCodeNow,feedMap,param);
|
||||
}else if (next_device_code.equals(deviceCodeNow)) {
|
||||
return agvWaitUtil.waitOutGet(deviceCodeNow,feedMap,param);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
if (address.contains("OUT")) {
|
||||
String deviceCodeNow = address.substring(0, address.length() - 3);
|
||||
Device deviceNow = deviceAppService.findDeviceByCode(deviceCodeNow);
|
||||
if (deviceNow.getDeviceDriver() instanceof StandardConveyorLineDeviceDriver) {
|
||||
standardConveyorLineDeviceDriver = (StandardConveyorLineDeviceDriver) deviceNow.getDeviceDriver();
|
||||
if (start_device_code.equals(deviceCodeNow)) {
|
||||
if (standardConveyorLineDeviceDriver.getMove() == 0) {
|
||||
standardConveyorLineDeviceDriver.writing(1, 2);
|
||||
feedMap.put("feedbackStatus", "takeFinish");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = (int) feedback.get("responseCode");
|
||||
String responseMessage = (String) feedback.get("responseMessage");
|
||||
if (responseCode == 0) {
|
||||
map.put("status", 200);
|
||||
map.put("message", "请求成功");
|
||||
type = "info";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "操作失败");
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), feedback.toString(), responseCode + "", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败!");
|
||||
}
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,起点位置有货!");
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,起点位置有货!");
|
||||
}
|
||||
} else if (next_device_code.equals(deviceCodeNow)) {
|
||||
if (standardConveyorLineDeviceDriver.getMove() == 0) {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,终点位置无货!");
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,终点位置无货!");
|
||||
} else {
|
||||
standardConveyorLineDeviceDriver.writing(1, 3);
|
||||
feedMap.put("feedbackStatus", "putFinish");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = (int) feedback.get("responseCode");
|
||||
String responseMessage = (String) feedback.get("responseMessage");
|
||||
if (responseCode == 0) {
|
||||
map.put("status", 200);
|
||||
map.put("message", "请求成功");
|
||||
type = "info";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "200", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "操作失败");
|
||||
type = "erro";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (start_device_code.equals(deviceCodeNow)) {
|
||||
return agvWaitUtil.waitInPut(deviceCodeNow,feedMap,param);
|
||||
}else if (next_device_code.equals(deviceCodeNow)) {
|
||||
return agvWaitUtil.waitOutPut(deviceCodeNow,feedMap,param);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,IN OUT 站点错误!");
|
||||
|
||||
@@ -438,17 +438,17 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
continue;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
jo.put("device_code", device.getDevice_code());
|
||||
jo.put("mode", standardCoveyorControlDeviceDriver.getMode());
|
||||
jo.put("move", standardCoveyorControlDeviceDriver.getMove());
|
||||
jo.put("hasGoods", standardCoveyorControlDeviceDriver.getHasGoods());
|
||||
jo.put("isOnline", standardCoveyorControlDeviceDriver.getIsonline());
|
||||
jo.put("error", standardCoveyorControlDeviceDriver.getError());
|
||||
jo.put("isError", standardCoveyorControlDeviceDriver.getIserror());
|
||||
jo.put("requestSucess", standardCoveyorControlDeviceDriver.getRequireSucess());
|
||||
jo.put("applySucess", standardCoveyorControlDeviceDriver.getApplySucess());
|
||||
jo.put("message", standardCoveyorControlDeviceDriver.getMessage());
|
||||
// standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
// jo.put("device_code", device.getDevice_code());
|
||||
// jo.put("mode", standardCoveyorControlDeviceDriver.getMode());
|
||||
// jo.put("move", standardCoveyorControlDeviceDriver.getMove());
|
||||
// jo.put("hasGoods", standardCoveyorControlDeviceDriver.getHasGoods());
|
||||
// jo.put("isOnline", standardCoveyorControlDeviceDriver.getIsonline());
|
||||
// jo.put("error", standardCoveyorControlDeviceDriver.getError());
|
||||
// jo.put("isError", standardCoveyorControlDeviceDriver.getIserror());
|
||||
// jo.put("requestSucess", standardCoveyorControlDeviceDriver.getRequireSucess());
|
||||
// jo.put("applySucess", standardCoveyorControlDeviceDriver.getApplySucess());
|
||||
// jo.put("message", standardCoveyorControlDeviceDriver.getMessage());
|
||||
} else if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
|
||||
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
|
||||
jo.put("device_code", device.getDevice_code());
|
||||
@@ -686,16 +686,16 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
|
||||
standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver();
|
||||
jo.put("device_code", device.getDevice_code());
|
||||
jo.put("mode", standardCoveyorControlDeviceDriver.getMode());
|
||||
jo.put("move", standardCoveyorControlDeviceDriver.getMove());
|
||||
jo.put("hasGoods", standardCoveyorControlDeviceDriver.getHasGoods());
|
||||
jo.put("isOnline", standardCoveyorControlDeviceDriver.getIsonline());
|
||||
jo.put("error", standardCoveyorControlDeviceDriver.getError());
|
||||
jo.put("isError", standardCoveyorControlDeviceDriver.getIserror());
|
||||
jo.put("requestSucess", standardCoveyorControlDeviceDriver.getRequireSucess());
|
||||
jo.put("applySucess", standardCoveyorControlDeviceDriver.getApplySucess());
|
||||
jo.put("message", standardCoveyorControlDeviceDriver.getMessage());
|
||||
// jo.put("device_code", device.getDevice_code());
|
||||
// jo.put("mode", standardCoveyorControlDeviceDriver.getMode());
|
||||
// jo.put("move", standardCoveyorControlDeviceDriver.getMove());
|
||||
// jo.put("hasGoods", standardCoveyorControlDeviceDriver.getHasGoods());
|
||||
// jo.put("isOnline", standardCoveyorControlDeviceDriver.getIsonline());
|
||||
// jo.put("error", standardCoveyorControlDeviceDriver.getError());
|
||||
// jo.put("isError", standardCoveyorControlDeviceDriver.getIserror());
|
||||
// jo.put("requestSucess", standardCoveyorControlDeviceDriver.getRequireSucess());
|
||||
// jo.put("applySucess", standardCoveyorControlDeviceDriver.getApplySucess());
|
||||
// jo.put("message", standardCoveyorControlDeviceDriver.getMessage());
|
||||
} else if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
|
||||
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
|
||||
jo.put("device_code", device.getDevice_code());
|
||||
|
||||
@@ -121,6 +121,30 @@ public class TaskController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("任务异常完成")
|
||||
@ApiOperation("任务异常完成")
|
||||
@PostMapping(value = "/errorFinish/{id}")
|
||||
public ResponseEntity<Object> errorFinish(@RequestBody String id) throws Exception {
|
||||
taskService.errorFinish(id);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("任务异常")
|
||||
@ApiOperation("任务异常")
|
||||
@PostMapping(value = "/exception/{id}")
|
||||
public ResponseEntity<Object> exception(@RequestBody String id) throws Exception {
|
||||
taskService.exception(id);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("任务作废")
|
||||
@ApiOperation("任务异常")
|
||||
@PostMapping(value = "/deprecate/{id}")
|
||||
public ResponseEntity<Object> deprecate(@RequestBody String id) throws Exception {
|
||||
taskService.deprecate(id);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("手动创建指令")
|
||||
@ApiOperation("手动创建指令")
|
||||
@PostMapping(value = "/createInst/{id}")
|
||||
|
||||
@@ -147,6 +147,25 @@ public interface TaskService {
|
||||
*/
|
||||
void deleteAll(String[] ids) throws Exception;
|
||||
|
||||
/**
|
||||
* 异常完成任务
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void errorFinish(String ids);
|
||||
|
||||
/**
|
||||
* 异常
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void exception(String ids);
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
void deprecate(String ids);
|
||||
/**
|
||||
* 完成任务
|
||||
*
|
||||
|
||||
@@ -617,6 +617,87 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void errorFinish(String ids) {
|
||||
TaskDto entity = this.findById(ids);
|
||||
Instruction instruction = instructionService.findByTaskcode(entity.getTask_code());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
InstructionDto instdto = instructionservice.findByTaskid(ids, "instruction_status <2 ");
|
||||
if (instdto != null) throw new BadRequestException("有指令未完成!");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setTask_status("2");
|
||||
entity.setRemark("异常完成");
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = JSONObject.fromObject(entity);
|
||||
wo.update(json);
|
||||
Map<String, Object> feedMap = new HashMap();
|
||||
feedMap.put("taskCode", entity.getTask_code());
|
||||
feedMap.put("taskType", entity.getTask_type());
|
||||
feedMap.put("carId", instruction.getAgv_jobno());
|
||||
feedMap.put("feedbackStatus", "errorFinish");
|
||||
Map<String, Object> map = acsToWmsZDService.taskFeedback(feedMap);
|
||||
removeByCodeFromCache(entity.getTask_code());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void exception(String ids) {
|
||||
TaskDto entity = this.findById(ids);
|
||||
Instruction instruction = instructionService.findByTaskcode(entity.getTask_code());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
InstructionDto instdto = instructionservice.findByTaskid(ids, "instruction_status <2 ");
|
||||
if (instdto != null) throw new BadRequestException("有指令未完成!");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setTask_status("3");
|
||||
entity.setRemark("任务异常");
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = JSONObject.fromObject(entity);
|
||||
wo.update(json);
|
||||
Map<String, Object> feedMap = new HashMap();
|
||||
feedMap.put("taskCode", entity.getTask_code());
|
||||
feedMap.put("taskType", entity.getTask_type());
|
||||
feedMap.put("carId", instruction.getAgv_jobno());
|
||||
feedMap.put("feedbackStatus", "exception");
|
||||
acsToWmsZDService.taskFeedback(feedMap);
|
||||
removeByCodeFromCache(entity.getTask_code());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deprecate(String ids) {
|
||||
TaskDto entity = this.findById(ids);
|
||||
Instruction instruction = instructionService.findByTaskcode(entity.getTask_code());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
InstructionDto instdto = instructionservice.findByTaskid(ids, "instruction_status <2 ");
|
||||
if (instdto != null) throw new BadRequestException("有指令未完成!");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setTask_status("3");
|
||||
entity.setRemark("任务作废");
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = JSONObject.fromObject(entity);
|
||||
wo.update(json);
|
||||
Map<String, Object> feedMap = new HashMap();
|
||||
feedMap.put("taskCode", entity.getTask_code());
|
||||
feedMap.put("taskType", entity.getTask_type());
|
||||
feedMap.put("carId", instruction.getAgv_jobno());
|
||||
feedMap.put("feedbackStatus", "deprecate");
|
||||
acsToWmsZDService.taskFeedback(feedMap);
|
||||
removeByCodeFromCache(entity.getTask_code());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finish(String id) {
|
||||
@@ -653,7 +734,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
HttpResponse body = null;
|
||||
boolean flag = false;
|
||||
try {
|
||||
body = acstowmsService.feedbackTaskStatusToWms(ja);
|
||||
//body = acstowmsService.feedbackTaskStatusToWms(ja);
|
||||
} catch (Exception e) {
|
||||
flag = true;
|
||||
message = e.getMessage();
|
||||
@@ -688,8 +769,14 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
taskFeedbackService.update(feefbackdto);
|
||||
}
|
||||
} else {
|
||||
int status = body.getStatus();
|
||||
JSONObject jo = JSONObject.fromObject(body.body());
|
||||
int status = 400;
|
||||
String job = "";
|
||||
if (ObjectUtil.isNotEmpty(body)){
|
||||
status = body.getStatus();
|
||||
job = body.body();
|
||||
JSONObject jo = JSONObject.fromObject(job);
|
||||
job = jo.getString("message");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(feefbackdto)) {
|
||||
feefbackdto = new TaskFeedbackDto();
|
||||
feefbackdto.setTask_id(entity.getTask_id());
|
||||
@@ -697,7 +784,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
feefbackdto.setTask_status(entity.getTask_status());
|
||||
feefbackdto.setVehicle_type(entity.getVehicle_type());
|
||||
feefbackdto.setVehicle_code(entity.getVehicle_code());
|
||||
feefbackdto.setError_code(String.valueOf(body.getStatus()));
|
||||
feefbackdto.setError_code(String.valueOf(status));
|
||||
feefbackdto.setStart_device_code(entity.getStart_device_code());
|
||||
feefbackdto.setStart_point_code(entity.getNext_point_code());
|
||||
feefbackdto.setNext_device_code(entity.getNext_device_code());
|
||||
@@ -710,7 +797,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
} else {
|
||||
feefbackdto.setIs_finished("0");
|
||||
feefbackdto.setRemark(jo.getString("message"));
|
||||
feefbackdto.setRemark("失败");
|
||||
}
|
||||
taskFeedbackService.create(feefbackdto);
|
||||
} else {
|
||||
@@ -723,7 +810,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
} else {
|
||||
feefbackdto.setIs_finished("0");
|
||||
feefbackdto.setRemark(jo.getString("message"));
|
||||
feefbackdto.setRemark(job);
|
||||
}
|
||||
taskFeedbackService.update(feefbackdto);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,8 +2,6 @@ server:
|
||||
port: 8010
|
||||
#配置数据源
|
||||
spring:
|
||||
profiles:
|
||||
dev
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
|
||||
@@ -2,13 +2,11 @@ server:
|
||||
port: 8010
|
||||
#配置数据源
|
||||
spring:
|
||||
profiles:
|
||||
prod
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:zdtn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:tn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
@@ -137,4 +135,4 @@ file:
|
||||
avatarMaxSize: 5
|
||||
|
||||
agvToAcs:
|
||||
addr: http://192.168.200.128:8010
|
||||
addr: http://172.22.50.184:8010
|
||||
|
||||
@@ -2,7 +2,7 @@ spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: dev
|
||||
active: prod
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
|
||||
@@ -2,8 +2,8 @@ ENV = 'production'
|
||||
|
||||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
||||
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
||||
VUE_APP_BASE_API = 'http://192.168.200.128:8010'
|
||||
#VUE_APP_BASE_API = 'http://192.168.200.128:8010'
|
||||
VUE_APP_BASE_API = 'http://127.0.0.1:8010'
|
||||
#VUE_APP_BASE_API = 'http://127.0.0.1:8010'
|
||||
# 如果接口是 http 形式, wss 需要改为 ws
|
||||
VUE_APP_WS_API = 'ws://192.168.81.122:8010'
|
||||
VUE_APP_WS_API = 'ws://127.0.0.1:8010'
|
||||
#VUE_APP_WS_API = 'ws://127.0.0.1:8010'
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/instruction',
|
||||
@@ -63,4 +62,12 @@ export function reload() {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, finish, cancel, queryUnFinish, queryByTaskId,reload }
|
||||
export function forceCancel(instruction_id) {
|
||||
return request({
|
||||
url: 'api/instruction/forceCancel/' + instruction_id,
|
||||
method: 'post',
|
||||
data: instruction_id
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, finish, cancel, forceCancel, queryUnFinish, queryByTaskId, reload }
|
||||
|
||||
@@ -40,6 +40,30 @@ export function cancel(task_id) {
|
||||
})
|
||||
}
|
||||
|
||||
export function errorFinish(task_id) {
|
||||
return request({
|
||||
url: 'api/task/errorFinish/' + task_id,
|
||||
method: 'post',
|
||||
data: task_id
|
||||
})
|
||||
}
|
||||
|
||||
export function exceptions(task_id) {
|
||||
return request({
|
||||
url: 'api/task/exception/' + task_id,
|
||||
method: 'post',
|
||||
data: task_id
|
||||
})
|
||||
}
|
||||
|
||||
export function deprecate(task_id) {
|
||||
return request({
|
||||
url: 'api/task/deprecate/' + task_id,
|
||||
method: 'post',
|
||||
data: task_id
|
||||
})
|
||||
}
|
||||
|
||||
export function createInst(task_id) {
|
||||
return request({
|
||||
url: 'api/task/createInst/' + task_id,
|
||||
@@ -95,5 +119,5 @@ export function specialTaskCreate(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, finish, cancel, createTaskByClick, deviceAskTask, ordinaryTaskCreate, specialTaskCreate, createInst,reload }
|
||||
export default { add, edit, del, finish, cancel, createTaskByClick, deviceAskTask, ordinaryTaskCreate, specialTaskCreate, createInst, reload, errorFinish, exceptions, deprecate }
|
||||
|
||||
|
||||
@@ -268,6 +268,9 @@
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'a')">完成</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'b')">取消</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'c')">创建指令</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'d')">异常完成</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'e')">异常</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'f')">作废</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
@@ -440,6 +443,30 @@ export default {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
errorFinish(index, row) {
|
||||
crudTask.errorFinish(row.task_id).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
exception(index, row) {
|
||||
crudTask.exceptions(row.task_id).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
deprecate(index, row) {
|
||||
crudTask.deprecate(row.task_id).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
reload() {
|
||||
crudTask.reload().then(res => {
|
||||
this.crud.toQuery()
|
||||
@@ -466,6 +493,15 @@ export default {
|
||||
case 'c':// 创建指令
|
||||
this.createInst(command.index, command.row)
|
||||
break
|
||||
case 'd':// 异常完成
|
||||
this.errorFinish(command.index, command.row)
|
||||
break
|
||||
case 'e':// 异常
|
||||
this.exception(command.index, command.row)
|
||||
break
|
||||
case 'f':// 作废
|
||||
this.deprecate(command.index, command.row)
|
||||
break
|
||||
}
|
||||
},
|
||||
showStartStorage(val) {
|
||||
|
||||
Reference in New Issue
Block a user