This commit is contained in:
2024-01-27 16:29:38 +08:00
43 changed files with 1632 additions and 502 deletions

View File

@@ -340,6 +340,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
jo.put("finish", finish);
jo.put("isOnline", this.getIsonline());
jo.put("error", ErrorUtil.getDictDetail("hx_error_type", String.valueOf(this.getError())));
jo.put("error1", ErrorUtil.getDictDetail("hx_error_type", String.valueOf(this.getError1())));
jo.put("isError", this.getIserror());
jo.put("countdown_house", countdown_house);
jo.put("countdown_min", countdown_min);
@@ -348,9 +349,6 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
jo.put("mode", mode);
jo.put("move", move);
jo.put("action", action);
// jo.put("isOnline", this.getIsonline());
// jo.put("error", this.getError());
// jo.put("isError", this.getIserror());
jo.put("task", this.getTask());
return jo;
}
@@ -402,4 +400,29 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
}
}
public void writing(List list) {
Map<String, Object> itemMap = new HashMap<String, Object>();
for (int i = 0; i < list.size(); i++) {
Object ob = list.get(i);
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
if (!StrUtil.isEmpty(json.getString("value"))) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + json.getString("code");
itemMap.put(to_param, json.getString("value"));
}
}
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
try {
this.checkcontrol(itemMap);
} catch (Exception e) {
e.printStackTrace();
try {
this.checkcontrol(itemMap);
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
}

View File

@@ -39,6 +39,7 @@ import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
@@ -457,11 +458,29 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
this.writing("to_command", "1");
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
List list = new ArrayList();
Map map = new HashMap();
map.put("code", "to_open_door");
map.put("value", "1");
list.add(map);
try {
hongXiangConveyorDeviceDriver.writing(list);
} catch (Exception e) {
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "起点设备:" + start_device_code + "未打开烘箱门,导致now_steps_type不等于: 2 ;now_steps_type:" + now_steps_type);
}
}
if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
List list = new ArrayList();
Map map = new HashMap();
map.put("code", "to_open_door");
map.put("value", "1");
list.add(map);
try {
hongXiangConveyorDeviceDriver.writing(list);
} catch (Exception e) {
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "终点设备:" + next_device_code + "未打开烘箱门,导致now_steps_type不等于: 2;now_steps_type:" + now_steps_type);
}
}
this.setNow_steps_type(2);
this.setRequireSucess(true);
@@ -561,6 +580,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
instdto.setPriority(priority);
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
//判断关联的同一列烘箱设备是否都关门 都关门返回false有一个不关门就返回true
boolean isCloseDoor = this.judgeCloseDoor(instdto.getStart_device_code(), instdto.getNext_device_code());
@@ -596,7 +616,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ instdto.getInstruction_code() +";指令号: "+ CodeUtil.getNewCode("INSTRUCT_NO") + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code());
this.writing("to_onset", start_addr);
this.writing("to_target", next_addr);
@@ -605,13 +625,29 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
//HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
List list = new ArrayList();
Map map = new HashMap();
map.put("code", "to_open_door");
map.put("value", "1");
list.add(map);
try {
hongXiangConveyorDeviceDriver.writing(list);
} catch (Exception e) {
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "终点设备:" + next_device_code + "未打开烘箱门,导致now_steps_type不等于: 2;now_steps_type:" + now_steps_type);
}
}
if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
List list = new ArrayList();
Map map = new HashMap();
map.put("code", "to_open_door");
map.put("value", "1");
list.add(map);
try {
hongXiangConveyorDeviceDriver.writing(list);
} catch (Exception e) {
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "起点设备:" + start_device_code + "未打开烘箱门,导致now_steps_type不等于: 2;now_steps_type:" + now_steps_type);
}
}
this.setNow_steps_type(2);
this.setRequireSucess(true);
@@ -800,11 +836,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
steps_type = "更新指令状态";
} else if (now_steps_type == 2) {
steps_type = "下发电气信号";
}else if(now_steps_type == 3){
} else if (now_steps_type == 3) {
steps_type = "允许取货";
}else if (now_steps_type ==4 ){
} else if (now_steps_type == 4) {
steps_type += "允许放货";
}else if (now_steps_type == 5){
} else if (now_steps_type == 5) {
steps_type += "放货完成";
}

View File

@@ -469,16 +469,24 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
applyManipulatorActionRequest.setTask_code1(inst.getTask_code());
logServer.deviceExecuteLog(this.device_code, "", "", "task变化请求LMS,参数:" + applyManipulatorActionRequest);
try {
final ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll();
EXECUTOR.submit(() -> {
for (int i = 0; i < 5; i++) {
ApplyManipulatorActionResponse response = acsToWmsService.actionFinishRequest(applyManipulatorActionRequest);
if (response == null || response.getstatus() == 200) {
logServer.deviceExecuteLog(this.device_code, "", "", "task变化请求LMS,接口返回:" + response.getMessage());
break;
} else {
logServer.deviceExecuteLog(this.device_code, "", "", "任务变化请求LMS失败:" + response.getMessage());
message = "task变化请求LMS失败: " + response.getMessage();
Thread.sleep(5000);
try {
Thread.sleep(15000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
} catch (Exception e) {
e.printStackTrace();
logServer.deviceExecuteLog(this.device_code, "", "", "task变化请求LMS失败" + e.getMessage());

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@@ -70,8 +70,8 @@ export default {
width: 100%;
& .sidebar-logo {
width: 32px;
height: 32px;
width: 55px;
height: 15px;
vertical-align: middle;
margin-right: 6px;
}

View File

@@ -109,11 +109,11 @@
<el-table-column prop="domain" label="domain"/>
<el-table-column prop="remark" label="备注" min-width="100"/>
<el-table-column prop="createtime" label="创建时间"/>
<el-table-column label="操作" width="200px" align="center" fixed="right">
<el-table-column label="操作" width="180px" align="center" fixed="right">
<template slot-scope="scope">
<el-button type="text" size="small" @click="handleClick(scope.row,'1')">修改</el-button>
<el-button type="text" size="small" @click="handleClick(scope.row,'2')">删除</el-button>
<el-button v-if="scope.row.opc_flag === '1'" type="text" size="small" @click="handleClick(scope.row,'0')">
<el-button type="text" icon="el-icon-edit" size="small" @click="handleClick(scope.row,'1')">修改</el-button>
<el-button type="text" icon="el-icon-delete" size="small" @click="handleClick(scope.row,'2')">删除</el-button>
<el-button v-if="scope.row.opc_flag === '1'" type="text" icon="el-icon-plus" size="small" @click="handleClick(scope.row,'0')">
新增PLC
</el-button>
</template>

View File

@@ -43,7 +43,7 @@
<el-dialog
:close-on-click-modal="false"
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:visible.sync="crud.status.cu"
:title="crud.status.title"
width="500px"
>
@@ -63,10 +63,10 @@
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="device_code" label="设备编码" />
<el-table-column prop="error_code" label="报警编码" />
<el-table-column prop="error_info" label="报警信息" />
<el-table-column prop="error_time" label="报警时间" />
<el-table-column prop="device_code" label="设备编码" :min-width="flexWidth('device_code',crud.data,'设备编码')" />
<el-table-column prop="error_code" label="报警编码" :min-width="flexWidth('error_code',crud.data,'报警编码')" />
<el-table-column prop="error_info" label="报警信息" :min-width="flexWidth('error_info',crud.data,'报警信息')" />
<el-table-column prop="error_time" label="报警时间" :min-width="flexWidth('error_time',crud.data,'报警时间')" />
<el-table-column
v-permission="['admin','acsDeviceErrorLog:edit','acsDeviceErrorLog:del']"
label="操作"

View File

@@ -63,7 +63,7 @@
<el-dialog
:close-on-click-modal="false"
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:visible.sync="crud.status.cu"
:title="crud.status.title"
width="500px"
>
@@ -95,45 +95,45 @@
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column v-if="false" prop="instruction_id" label="指令标识" />
<el-table-column prop="instruction_code" label="指令编号" width="200" />
<el-table-column prop="task_code" label="任务号" />
<el-table-column prop="vehicle_code" label="载具号" />
<el-table-column prop="instruction_type" label="指令类型" width="120">
<el-table-column v-if="false" prop="instruction_id" label="指令标识" :min-width="flexWidth('instruction_id',crud.data,'指令标识')" />
<el-table-column prop="instruction_code" label="指令编号" :min-width="flexWidth('instruction_code',crud.data,'指令编号')" />
<el-table-column prop="task_code" label="任务号" :min-width="flexWidth('task_code',crud.data,'任务号')" />
<el-table-column prop="vehicle_code" label="载具号" :min-width="flexWidth('vehicle_code',crud.data,'载具号')" />
<el-table-column prop="instruction_type" label="指令类型" width="120" >
<template slot-scope="scope">
{{ dict.label.task_type[scope.row.instruction_type] }}
</template>
</el-table-column>
<el-table-column prop="instruction_status" label="指令状态">
<el-table-column prop="instruction_status" label="指令状态" :min-width="flexWidth('instruction_status',crud.data,'指令状态')" >
<template slot-scope="scope">
{{ dict.label.task_status[scope.row.instruction_status] }}
</template>
</el-table-column>
<el-table-column prop="start_point_code" label="起点" />
<el-table-column prop="next_point_code" label="终点" />
<el-table-column prop="start_point_code2" label="起点2" />
<el-table-column prop="next_point_code2" label="终点2" />
<el-table-column prop="put_point_code" label="中转点" />
<el-table-column prop="start_height" label="取货高度" />
<el-table-column prop="next_height" label="放货高度" />
<el-table-column prop="carno" label="车号" />
<el-table-column prop="agv_system_type" label="AGV系统类型">
<el-table-column prop="start_point_code" label="起点" :min-width="flexWidth('start_point_code',crud.data,'起点')" />
<el-table-column prop="next_point_code" label="终点" :min-width="flexWidth('next_point_code',crud.data,'终点')" />
<el-table-column prop="start_point_code2" label="起点2" :min-width="flexWidth('start_point_code2',crud.data,'起点2')" />
<el-table-column prop="next_point_code2" label="终点2" :min-width="flexWidth('next_point_code2',crud.data,'终点2')" />
<el-table-column prop="put_point_code" label="中转点" :min-width="flexWidth('put_point_code',crud.data,'中转点')" />
<el-table-column prop="start_height" label="取货高度" :min-width="flexWidth('start_height',crud.data,'取货高度')" />
<el-table-column prop="next_height" label="放货高度" :min-width="flexWidth('next_height',crud.data,'放货高度')" />
<el-table-column prop="carno" label="车号" :min-width="flexWidth('carno',crud.data,'车号')" />
<el-table-column prop="agv_system_type" label="AGV系统类型" width="120" >
<template slot-scope="scope">
{{ dict.label.agv_system_type[scope.row.agv_system_type] }}
</template>
</el-table-column>
<el-table-column prop="agv_inst_type" label="AGV指令类型">
<el-table-column prop="agv_inst_type" label="AGV指令类型" :min-width="flexWidth('agv_inst_type',crud.data,'AGV指令类型')" >
<!-- <template slot-scope="scope">-->
<!-- {{ dict.label.agv_inst_type[scope.row.agv_inst_type] }}-->
<!-- </template>-->
</el-table-column>
<el-table-column prop="weight" label="重量" />
<el-table-column prop="quantity" label="数量" />
<el-table-column prop="remark" label="描述" />
<el-table-column prop="create_by" label="创建者" />
<el-table-column prop="create_time" label="创建时间" width="135" />
<el-table-column prop="update_by" label="修改者" />
<el-table-column prop="update_time" label="修改时间" width="135" />
<el-table-column prop="weight" label="重量" :min-width="flexWidth('weight',crud.data,'重量')" />
<el-table-column prop="quantity" label="数量" :min-width="flexWidth('quantity',crud.data,'数量')" />
<el-table-column prop="remark" label="描述" :min-width="flexWidth('remark',crud.data,'描述')" />
<el-table-column prop="create_by" label="创建者" :min-width="flexWidth('create_by',crud.data,'创建者')" />
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
<el-table-column prop="update_by" label="修改者" :min-width="flexWidth('update_by',crud.data,'修改者')" />
<el-table-column prop="update_time" label="修改时间" :min-width="flexWidth('update_time',crud.data,'修改时间')" />
</el-table>
<!--分页组件-->
<pagination />
@@ -202,7 +202,7 @@ export default {
edit: false,
del: false,
reset: false,
download: true
download: false
}
})
},

View File

@@ -229,47 +229,47 @@
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column v-if="false" prop="task_id" label="任务标识" />
<el-table-column prop="task_code" label="任务号" width="200" />
<el-table-column prop="vehicle_code" label="载具号" />
<el-table-column prop="task_type" label="任务类型" width="120">
<el-table-column v-if="false" prop="task_id" label="任务标识" :min-width="flexWidth('task_id',crud.data,'任务标识')" />
<el-table-column prop="task_code" label="任务号" :min-width="flexWidth('task_code',crud.data,'任务号')" />
<el-table-column prop="vehicle_code" label="载具号" :min-width="flexWidth('vehicle_code',crud.data,'载具号')" />
<el-table-column prop="task_type" label="任务类型" width="120" >
<template slot-scope="scope">
{{ dict.label.task_type[scope.row.task_type] }}
</template>
</el-table-column>
<el-table-column prop="task_status" label="任务状态">
<el-table-column prop="task_status" label="任务状态" :min-width="flexWidth('task_status',crud.data,'任务状态')" >
<template slot-scope="scope">
{{ dict.label.task_status[scope.row.task_status] }}
</template>
</el-table-column>
<el-table-column prop="priority" label="任务优先级" />
<el-table-column prop="start_point_code" label="起点" />
<el-table-column prop="next_point_code" label="终点" />
<el-table-column prop="start_point_code2" label="起点2" />
<el-table-column prop="start_point_code2" label="终点2" />
<el-table-column prop="put_point_code" label="中转点" />
<el-table-column prop="start_height" label="取货高度" />
<el-table-column prop="next_height" label="放货高度" />
<el-table-column prop="car_no" label="车号" />
<el-table-column prop="agv_system_type" label="AGV系统类型">
<el-table-column prop="priority" label="任务优先级" :min-width="flexWidth('priority',crud.data,'任务优先级')" />
<el-table-column prop="start_point_code" label="起点" :min-width="flexWidth('start_point_code',crud.data,'起点')" />
<el-table-column prop="next_point_code" label="终点" :min-width="flexWidth('next_point_code',crud.data,'终点')" />
<el-table-column prop="start_point_code2" label="起点2" :min-width="flexWidth('start_point_code2',crud.data,'起点2')" />
<el-table-column prop="next_point_code2" label="终点2" :min-width="flexWidth('next_point_code2',crud.data,'终点2')" />
<el-table-column prop="put_point_code" label="中转点" :min-width="flexWidth('put_point_code',crud.data,'中转点')" />
<el-table-column prop="start_height" label="取货高度" :min-width="flexWidth('start_height',crud.data,'取货高度')" />
<el-table-column prop="next_height" label="放货高度" :min-width="flexWidth('next_height',crud.data,'放货高度')" />
<el-table-column prop="car_no" label="车号" :min-width="flexWidth('car_no',crud.data,'车号')" />
<el-table-column prop="agv_system_type" label="AGV系统类型" width="120" >
<template slot-scope="scope">
{{ dict.label.agv_system_type[scope.row.agv_system_type] }}
</template>
</el-table-column>
<el-table-column prop="storage_task_type" label="立库任务类型">
<el-table-column prop="storage_task_type" label="立库任务类型" :min-width="flexWidth('storage_task_type',crud.data,'立库任务类型')" >
<template slot-scope="scope">
{{ dict.label.storage_task_type[scope.row.storage_task_type] }}
</template>
</el-table-column>
<el-table-column prop="weight" label="重量" />
<el-table-column prop="temperature" label="温度" />
<el-table-column prop="oven_time" label="烘箱时间" />
<el-table-column prop="quantity" label="数量" />
<el-table-column prop="remark" label="备注" />
<el-table-column prop="create_by" label="创建者" />
<el-table-column prop="create_time" label="创建时间" width="135" />
<el-table-column prop="update_by" label="修改者" />
<el-table-column prop="update_time" label="结束时间" width="135" />
<el-table-column prop="weight" label="重量" :min-width="flexWidth('weight',crud.data,'重量')" />
<el-table-column prop="temperature" label="温度" :min-width="flexWidth('temperature',crud.data,'温度')" />
<el-table-column prop="oven_time" label="烘箱时间" :min-width="flexWidth('oven_time',crud.data,'烘箱时间')" />
<el-table-column prop="quantity" label="数量" :min-width="flexWidth('quantity',crud.data,'数量')" />
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
<el-table-column prop="create_by" label="创建者" :min-width="flexWidth('create_by',crud.data,'创建者')" />
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
<el-table-column prop="update_by" label="修改者" :min-width="flexWidth('update_by',crud.data,'修改者')" />
<el-table-column prop="update_time" label="结束时间" :min-width="flexWidth('update_time',crud.data,'结束时间')" />
</el-table>
<!--分页组件-->
<pagination />
@@ -325,7 +325,7 @@ export default {
edit: false,
del: false,
reset: false,
download: true
download: false
}
})
},

View File

@@ -86,51 +86,51 @@
@select-all="crud.selectAllChange"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column v-if="false" prop="task_id" label="任务标识" />
<el-table-column prop="task_code" label="任务号(指令编号)" width="200" />
<el-table-column prop="vehicle_code" label="载具号" />
<el-table-column v-if="false" prop="task_id" label="任务标识" :min-width="flexWidth('task_id',crud.data,'任务标识')" />
<el-table-column prop="task_code" label="任务号(指令编号)" :min-width="flexWidth('task_code',crud.data,'任务号(指令编号)')" />
<el-table-column prop="vehicle_code" label="载具号" :min-width="flexWidth('vehicle_code',crud.data,'载具号')" />
<el-table-column prop="task_type" label="任务类型" width="120">
<template slot-scope="scope">
{{ dict.label.task_type[scope.row.task_type] }}
</template>
</el-table-column>
<el-table-column prop="task_status" label="状态">
<el-table-column prop="task_status" label="状态" width="60">
<template slot-scope="scope">
{{ dict.label.task_status[scope.row.task_status] }}
</template>
</el-table-column>
<el-table-column prop="priority" label="任务优先级" />
<el-table-column prop="start_point_code" label="起点" />
<el-table-column prop="next_point_code" label="终点" />
<el-table-column prop="start_point_code2" label="起点2" />
<el-table-column prop="next_point_code2" label="终点2" />
<el-table-column prop="put_point_code" label="中转点" />
<el-table-column prop="start_height" label="取货高度" />
<el-table-column prop="next_height" label="放货高度" />
<el-table-column prop="car_no" label="车号" />
<el-table-column prop="agv_system_type" label="AGV系统类型">
<el-table-column prop="priority" label="任务优先级" :min-width="flexWidth('priority',crud.data,'任务优先级')" />
<el-table-column prop="start_point_code" label="起点" :min-width="flexWidth('start_point_code',crud.data,'起点')" />
<el-table-column prop="next_point_code" label="终点" :min-width="flexWidth('next_point_code',crud.data,'终点')" />
<el-table-column prop="start_point_code2" label="起点2" :min-width="flexWidth('start_point_code2',crud.data,'起点2')" />
<el-table-column prop="next_point_code2" label="终点2" :min-width="flexWidth('next_point_code2',crud.data,'终点2')" />
<el-table-column prop="put_point_code" label="中转点" :min-width="flexWidth('put_point_code',crud.data,'中转点')" />
<el-table-column prop="start_height" label="取货高度" :min-width="flexWidth('start_height',crud.data,'取货高度')" />
<el-table-column prop="next_height" label="放货高度" :min-width="flexWidth('next_height',crud.data,'放货高度')" />
<el-table-column prop="car_no" label="车号" :min-width="flexWidth('car_no',crud.data,'车号')" />
<el-table-column prop="agv_system_type" label="AGV系统类型" width="120px">
<template slot-scope="scope">
{{ dict.label.agv_system_type[scope.row.agv_system_type] }}
</template>
</el-table-column>
<el-table-column prop="agv_inst_type" label="AGV指令类型">
<el-table-column prop="agv_inst_type" label="AGV指令类型" width="120px">
<!-- <template slot-scope="scope">-->
<!-- {{ dict.label.agv_inst_type[scope.row.agv_inst_type] }}-->
<!-- </template>-->
</el-table-column>
<el-table-column prop="storage_task_type" label="立库任务类型">
<el-table-column prop="storage_task_type" label="立库任务类型" width="120px">
<template slot-scope="scope">
{{ dict.label.storage_task_type[scope.row.storage_task_type] }}
</template>
</el-table-column>
<el-table-column prop="weight" label="重量" />
<el-table-column prop="temperature" label="温度" />
<el-table-column prop="quantity" label="数量" />
<el-table-column prop="remark" label="备注" />
<el-table-column prop="create_by" label="创建者" />
<el-table-column prop="create_time" label="创建时间" width="135" />
<el-table-column prop="update_by" label="修改者" />
<el-table-column prop="update_time" label="结束时间" width="135" />
<el-table-column prop="weight" label="重量" :min-width="flexWidth('weight',crud.data,'重量')" />
<el-table-column prop="temperature" label="温度" :min-width="flexWidth('temperature',crud.data,'温度')" />
<el-table-column prop="quantity" label="数量" :min-width="flexWidth('quantity',crud.data,'数量')" />
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
<el-table-column prop="create_by" label="创建者" :min-width="flexWidth('create_by',crud.data,'创建者')" />
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
<el-table-column prop="update_by" label="修改者" :min-width="flexWidth('update_by',crud.data,'修改者')" />
<el-table-column prop="update_time" label="结束时间" :min-width="flexWidth('update_time',crud.data,'结束时间')" />
</el-table>
<!--分页组件-->
<pagination />

View File

@@ -31,7 +31,7 @@
<el-dialog
:close-on-click-modal="false"
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:visible.sync="crud.status.cu"
:title="crud.status.title"
width="500px"
>

View File

@@ -32,7 +32,7 @@
style="width: 190px"
@change="crud.toQuery"
>
<el-option v-for="item in materialList" :key="item.id" :label="item.label" :value="item.value" />
<el-option v-for="item in dict.materialList" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
<el-select
v-model="query.status"
@@ -86,7 +86,7 @@
<el-dialog
:close-on-click-modal="false"
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:visible.sync="crud.status.cu"
:title="crud.status.title"
width="500px"
>
@@ -119,48 +119,52 @@
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" />
<el-table-column v-if="false" prop="instruction_id" label="指令标识" />
<el-table-column prop="instruction_code" label="指令编号" />
<el-table-column prop="instruction_type" label="指令类型">
<el-table-column v-if="false" prop="instruction_id" label="指令标识" :min-width="flexWidth('instruction_id',crud.data,'指令标识')" />
<el-table-column prop="instruction_code" label="指令编号" :min-width="flexWidth('instruction_code',crud.data,'指令编号')" />
<el-table-column prop="instruction_type" label="指令类型" width="120px" >
<template slot-scope="scope">
{{ dict.label.task_type[scope.row.instruction_type] }}
</template>
</el-table-column>
<!-- <el-table-column prop="link_num" label="关联编号" />-->
<el-table-column prop="task_code" label="任务号" />
<el-table-column prop="vehicle_code" label="载具号" />
<el-table-column prop="instruction_status" label="指令状态">
<el-table-column prop="task_code" label="任务号" :min-width="flexWidth('task_code',crud.data,'任务号')" />
<el-table-column prop="vehicle_code" label="载具号" :min-width="flexWidth('vehicle_code',crud.data,'载具号')" />
<el-table-column prop="instruction_status" label="指令状态" :min-width="flexWidth('instruction_status',crud.data,'指令状态')">
<template slot-scope="scope">
<span v-if="scope.row.instruction_status=='0' ">就绪</span>
<span v-if="scope.row.instruction_status=='1' ">执行中</span>
<span v-if="scope.row.instruction_status=='2' ">完成</span>
</template>
</el-table-column>
<el-table-column prop="send_status" label="下发状态">
<el-table-column prop="send_status" label="下发状态" :min-width="flexWidth('send_status',crud.data,'下发状态')" >
<template slot-scope="scope">
<span v-if="scope.row.send_status=='0' ">未下发</span>
<span v-if="scope.row.send_status=='1' ">成功</span>
<span v-if="scope.row.send_status=='2' ">失败</span>
</template>
</el-table-column>
<el-table-column prop="start_point_code" label="取货点1" />
<el-table-column prop="next_point_code" label="放货点1" />
<el-table-column prop="start_point_code2" label="取货点2" />
<el-table-column prop="next_point_code2" label="放货点2" />
<el-table-column prop="put_point_code" label="中转点" />
<el-table-column prop="execute_device_code" label="当前执行设备" />
<el-table-column prop="carno" label="车号" />
<el-table-column prop="weight" label="重量" />
<el-table-column prop="agv_jobno" label="AGV任务号" />
<el-table-column prop="agv_inst_type" label="AGV任务类型" />
<el-table-column prop="agv_system_type" label="AGV系统类型" />
<el-table-column prop="start_height" label="取货高度" />
<el-table-column prop="next_height" label="放货高度" />
<el-table-column prop="remark" label="描述" />
<el-table-column prop="create_by" label="创建者" />
<el-table-column prop="create_time" label="创建时间" width="135" />
<el-table-column prop="start_point_code" label="取货点1" :min-width="flexWidth('start_point_code',crud.data,'取货点1')" />
<el-table-column prop="next_point_code" label="放货点1" :min-width="flexWidth('next_point_code',crud.data,'放货点1')" />
<el-table-column prop="start_point_code2" label="取货点2" :min-width="flexWidth('start_point_code2',crud.data,'取货点2')" />
<el-table-column prop="next_point_code2" label="放货点2" :min-width="flexWidth('next_point_code2',crud.data,'放货点2')" />
<el-table-column prop="put_point_code" label="中转点" :min-width="flexWidth('put_point_code',crud.data,'中转点')" />
<el-table-column prop="execute_device_code" label="当前执行设备" :min-width="flexWidth('execute_device_code',crud.data,'当前执行设备')" />
<el-table-column prop="carno" label="车号" :min-width="flexWidth('carno',crud.data,'车号')" />
<el-table-column prop="weight" label="重量" :min-width="flexWidth('weight',crud.data,'重量')" />
<el-table-column prop="agv_jobno" label="AGV任务号" :min-width="flexWidth('agv_jobno',crud.data,'AGV任务号')" />
<el-table-column prop="agv_inst_type" label="AGV任务类型" :min-width="flexWidth('agv_inst_type',crud.data,'AGV任务类型')" />
<el-table-column prop="agv_system_type" label="AGV系统类型" width="120px">
<template slot-scope="scope">
{{ dict.label.agv_system_type[scope.row.agv_system_type] }}
</template>
</el-table-column>
<el-table-column prop="start_height" label="取货高度" :min-width="flexWidth('start_height',crud.data,'取货高度')" />
<el-table-column prop="next_height" label="放货高度" :min-width="flexWidth('next_height',crud.data,'放货高度')" />
<el-table-column prop="remark" label="描述" :min-width="flexWidth('remark',crud.data,'描述')" />
<el-table-column prop="create_by" label="创建者" :min-width="flexWidth('create_by',crud.data,'创建者')" />
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
<el-table-column
<!-- <el-table-column
v-permission="['admin','instruction:edit','instruction:del']"
fixed="left"
label="操作"
@@ -180,6 +184,94 @@
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column> -->
<el-table-column
v-permission="['admin','instruction:edit','instruction:del']"
label="操作"
width="100"
align="center"
fixed="right"
>
<template slot-scope="scope">
<!-- <el-button-group>
<el-button
type="text"
icon="el-icon-finished"
@click="handleCommand({ index: scope.$index, row: scope.row, command: 'a' })"
>
完成
</el-button>
<el-button
type="text"
icon="el-icon-circle-close"
@click="handleCommand({ index: scope.$index, row: scope.row, command: 'b' })"
>
取消
</el-button>
<el-button
type="text"
icon="el-icon-folder-add"
@click="handleCommand({ index: scope.$index, row: scope.row, command: 'c' })"
>
强制取消
</el-button>
<el-button
type="text"
icon="el-icon-folder-add"
@click="handleCommand({ index: scope.$index, row: scope.row, command: 'd' })"
>
初始化
</el-button>
</el-button-group> -->
<el-dropdown>
<span class="el-dropdown-link">
<i class="el-icon-setting">More</i>
<!-- <el-icon class="el-icon--right">
<arrow-down />
</el-icon> -->
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>
<el-button
type="text"
icon="el-icon-finished"
@click="handleCommand({ index: scope.$index, row: scope.row, command: 'a' })"
>
完成
</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button
type="text"
icon="el-icon-circle-close"
@click="handleCommand({ index: scope.$index, row: scope.row, command: 'b' })"
>
取消
</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button
type="text"
icon="el-icon-folder-add"
@click="handleCommand({ index: scope.$index, row: scope.row, command: 'c' })"
>
强制取消
</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button
type="text"
icon="el-icon-check"
@click="handleCommand({ index: scope.$index, row: scope.row, command: 'd' })"
>
初始化
</el-button>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
@@ -232,7 +324,7 @@ const defaultForm = {
update_time: null
}
export default {
dicts: ['task_status', 'task_type'],
dicts: ['task_status', 'task_type', 'agv_system_type'],
name: 'Instruction',
components: { crudOperation, pagination },
mixins: [presenter(), header(), form(defaultForm), crud()],
@@ -370,4 +462,5 @@ export default {
.el-icon-arrow-down {
font-size: 12px;
}
</style>

View File

@@ -408,47 +408,46 @@
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="25" />
<el-table-column v-if="false" prop="task_id" label="任务标识" />
<el-table-column prop="task_code" label="任务号" width="100" />
<el-table-column prop="task_type" label="任务类型" width="120">
<el-table-column type="selection" width="50" />
<el-table-column v-if="false" prop="task_id" label="任务标识" :min-width="flexWidth('task_id',crud.data,'任务标识')" />
<el-table-column prop="task_code" label="任务号" :min-width="flexWidth('task_code',crud.data,'任务号')" />
<el-table-column prop="task_type" label="任务类型" width="120px" >
<template slot-scope="scope">
{{ dict.label.task_type[scope.row.task_type] }}
</template>
</el-table-column>
<!-- <el-table-column prop="link_num" label="关联编号" />-->
<el-table-column prop="vehicle_code" label="载具号" width="100" />
<el-table-column prop="task_status" label="任务状态" width="60">
<el-table-column prop="vehicle_code" label="载具号" :min-width="flexWidth('vehicle_code',crud.data,'载具号')" />
<el-table-column prop="task_status" label="任务状态" :min-width="flexWidth('task_status',crud.data,'任务状态')" >
<template slot-scope="scope">
{{ dict.label.task_status[scope.row.task_status] }}
</template>
</el-table-column>
<el-table-column prop="priority" label="优先级" width="100" />
<el-table-column prop="start_point_code" label="取货点1" width="100px" />
<el-table-column prop="next_point_code" label="放货点1" width="120px" />
<el-table-column prop="start_point_code2" label="取货点2" width="120px" />
<el-table-column prop="next_point_code2" label="放货点2" width="120px" />
<el-table-column prop="put_point_code" label="中转点" width="100px" />
<!-- <el-table-column prop="agv_task_type" label="AGV任务类型" width="120px" />-->
<el-table-column prop="agv_system_type" label="AGV系统类型" width="120px">
<el-table-column prop="priority" label="优先级" :min-width="flexWidth('priority',crud.data,'优先级')" />
<el-table-column prop="start_point_code" label="取货点1" :min-width="flexWidth('start_point_code',crud.data,'取货点1')" />
<el-table-column prop="next_point_code" label="放货点1" :min-width="flexWidth('next_point_code',crud.data,'放货点1')" />
<el-table-column prop="start_point_code2" label="取货点2" :min-width="flexWidth('start_point_code2',crud.data,'取货点2')" />
<el-table-column prop="next_point_code2" label="放货点2" :min-width="flexWidth('next_point_code2',crud.data,'放货点2')" />
<el-table-column prop="put_point_code" label="中转点" :min-width="flexWidth('put_point_code',crud.data,'中转点')" />
<el-table-column prop="agv_system_type" label="AGV系统类型" width="120px" >
<template slot-scope="scope">
{{ dict.label.agv_system_type[scope.row.agv_system_type] }}
</template>
</el-table-column>
<el-table-column prop="storage_task_type" label="立库任务类型" width="120px">
<el-table-column prop="storage_task_type" label="立库任务类型" :min-width="flexWidth('storage_task_type',crud.data,'立库任务类型')" >
<template slot-scope="scope">
{{ dict.label.storage_task_type[scope.row.storage_task_type] }}
</template>
</el-table-column>
<el-table-column prop="start_height" label="取货高度" />
<el-table-column prop="next_height" label="放货高度" />
<el-table-column prop="device_code" label="纸管库出库仓位" />
<el-table-column prop="qty" label="纸管库出库数量" />
<el-table-column prop="truss_type" label="内包间行架任务类型" />
<el-table-column prop="remark" label="备注" />
<el-table-column prop="create_by" label="创建者" />
<el-table-column prop="create_time" label="创建时间" width="135" />
<el-table-column
<el-table-column prop="start_height" label="取货高度" :min-width="flexWidth('start_height',crud.data,'取货高度')" />
<el-table-column prop="next_height" label="放货高度" :min-width="flexWidth('next_height',crud.data,'放货高度')" />
<el-table-column prop="device_code" label="纸管库出库仓位" :min-width="flexWidth('device_code',crud.data,'纸管库出库仓位')" />
<el-table-column prop="qty" label="纸管库出库数量" :min-width="flexWidth('qty',crud.data,'纸管库出库数量')" />
<el-table-column prop="truss_type" label="内包间行架任务类型" :min-width="flexWidth('truss_type',crud.data,'内包间行架任务类型')" />
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
<el-table-column prop="create_by" label="创建者" :min-width="flexWidth('create_by',crud.data,'创建者')" />
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
<!-- <el-table-column
v-permission="['admin','task:edit','task:del']"
fixed="left"
label="操作"
@@ -467,6 +466,39 @@
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column> -->
<el-table-column
v-permission="['admin','task:edit','task:del']"
label="操作"
width="200"
align="center"
fixed="right"
>
<template slot-scope="scope">
<el-button-group>
<el-button
type="text"
icon="el-icon-finished"
@click="handleCommand({ index: scope.$index, row: scope.row, command: 'a' })"
>
完成
</el-button>
<el-button
type="text"
icon="el-icon-circle-close"
@click="handleCommand({ index: scope.$index, row: scope.row, command: 'b' })"
>
取消
</el-button>
<el-button
type="text"
icon="el-icon-folder-add"
@click="handleCommand({ index: scope.$index, row: scope.row, command: 'c' })"
>
创建指令
</el-button>
</el-button-group>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
@@ -497,7 +529,7 @@ export default {
edit: true,
del: true,
reset: false,
download: true
download: false
},
crudMethod: { ...crudTask }
})
@@ -707,14 +739,16 @@ export default {
// })
// },
beforeHandleCommand(index, row, command) {
/* beforeHandleCommand(index, row, command) {
console.log(command.command)
return {
'index': index,
'row': row,
'command': command
}
},
}, */
handleCommand(command) {
console.log(command.command)
switch (command.command) {
case 'a':// 完成
this.finish(command.index, command.row)
@@ -836,4 +870,11 @@ export default {
.el-icon-arrow-down {
font-size: 12px;
}
.custom-cell {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>

View File

@@ -56,8 +56,8 @@ export default {
codeUrl: '',
cookiePass: '',
loginForm: {
username: 'admin',
password: '123456',
username: '',
password: '',
rememberMe: false,
code: '',
uuid: ''

View File

@@ -470,6 +470,9 @@ export default {
} else if (val === 'error') {
const obj = { name: '报警', value: data[val] }
this.arr.push(obj)
} else if (val === 'error1') {
const obj = { name: '报警2', value: data[val] }
this.arr.push(obj)
} else if (val === 'ip') {
const obj = { name: 'IP地址', value: data[val] }
this.arr.push(obj)

View File

@@ -10,7 +10,7 @@ import org.springframework.stereotype.Component;
@Data
public class CommonFinalParam {
private final String DELETE = "0";
public static final String DELETE = "0";
/**
* 分隔符
*/

View File

@@ -2,6 +2,7 @@ package org.nl.acs.device_driver.agv.xg_agv_car;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -123,6 +124,31 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
*/
private int manua_confirm = 0;
/**
* 是否推送场景的状态 0=可推送 1=正在更新场景 2=正在执行运单
*/
private String upload_scene_status;
/**
* 机器人当前运单
*/
private String current_order;
/**
* 机器人连接状态 0表示断连 1表示连接上
*/
private String connection_status;
/**
* 机器人可接单状态 true=可接单 false=不可接单
*/
private String dispatchable;
/**
* core出错标识
*/
private boolean is_error;
/**
* 是否正在执行用户下发的运单
*/
private boolean procBusiness;
String device_code = null;
String container;
String container_type_desc;
@@ -152,7 +178,28 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
@Override
public JSONObject getDeviceStatusName() {
return null;
getAgvStatus();
JSONObject jo = new JSONObject();
String isError;
if(is_error){
isError = "报错";
}else{
isError = "正常";
}
if(CommonFinalParam.ONE.equals(upload_scene_status)){
upload_scene_status = "正在更新场景";
}else if(CommonFinalParam.TWO.equals(upload_scene_status)){
upload_scene_status = "正在执行运单";
}else if(CommonFinalParam.DELETE.equals(upload_scene_status)){
upload_scene_status = "可推送";
}
jo.put("is_error",isError);
jo.put("upload_scene_status",upload_scene_status);
jo.put("procBusiness",procBusiness);
jo.put("current_order",current_order);
jo.put("connection_status",connection_status);
jo.put("dispatchable",dispatchable);
return jo;
}
@@ -162,6 +209,7 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
}
/**
* 获取机器人信息
*/
@@ -169,7 +217,23 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
HttpResponse robotInfo = xianGongAgvService.getRobotInfo(this.getDevice().getDevice_name());
if(robotInfo.getStatus() == 200){
JSONObject jsonObject = JSONObject.parseObject(robotInfo.body());
String report = jsonObject.getString("report");
//core出错标识
is_error = jsonObject.getBooleanValue("is_error");
//是否推送场景的状态 0=可推送 1=正在更新场景 2=正在执行运单
upload_scene_status = jsonObject.getString("upload_scene_status");
JSONArray objects = JSONObject.parseArray(report);
for (int i = 0; i < objects.size(); i++) {
JSONObject json = (JSONObject)objects.get(i);
//是否正在执行用户下发的运单
procBusiness = json.getBooleanValue("procBusiness");
//机器人当前运单
current_order = json.getString("current_order");
//机器人连接状态 0表示断连 1表示连接上
connection_status = json.getString("connection_status");
//机器人可接单状态 true=可接单 false=不可接单
dispatchable = json.getString("dispatchable");
}
}else{
log.info("请求{}机器人状态失败", this.getDevice().getDevice_name());
}

View File

@@ -36,6 +36,8 @@ import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.config.SpringContextHolder;
@@ -232,62 +234,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记:" + requireSucess);
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
}
if (container_direction != last_container_direction) {
logServer.deviceItemValue(this.device_code, "carrier_direction", String.valueOf(container_direction));
logServer.deviceExecuteLog(this.device_code, "", "", "信号container_direction" + last_container_direction + "->" + container_direction);
}
if (container_type != last_container_type) {
logServer.deviceItemValue(this.device_code, "container_type", String.valueOf(container_type));
logServer.deviceExecuteLog(this.device_code, "", "", "信号container_type" + last_container_type + "->" + container_type);
}
if (container_no != last_container_no) {
logServer.deviceItemValue(this.device_code, "container_no", String.valueOf(container_no));
logServer.deviceExecuteLog(this.device_code, "", "", "信号container_no" + last_container_no + "->" + container_no);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
}
if (to_command != last_to_command) {
logServer.deviceItemValue(this.device_code, "to_command", String.valueOf(to_command));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
}
if (to_target != last_to_target) {
logServer.deviceItemValue(this.device_code, "to_target", String.valueOf(to_target));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target" + last_to_target + "->" + to_target);
}
if (to_task != last_to_task) {
logServer.deviceItemValue(this.device_code, "to_task", String.valueOf(to_task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + last_to_task + "->" + to_task);
}
if (to_container_no != last_to_container_no) {
logServer.deviceItemValue(this.device_code, "to_container_no", String.valueOf(to_container_no));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_container_no" + last_to_container_no + "->" + to_container_no);
}
if (to_container_type != last_to_container_type) {
logServer.deviceItemValue(this.device_code, "to_container_type", String.valueOf(to_container_type));
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_container_type" + last_to_container_type + "->" + to_container_type);
}
if (error != last_error) {
if (error != 0) {
DeviceErrorLogDto acsDeviceErrorLog = new DeviceErrorLogDto();
acsDeviceErrorLog.setDevice_code(this.device_code);
acsDeviceErrorLog.setError_code(String.valueOf(error));
String errorInfo = ErrorUtil.getDictDetail(ErrorType.CONVEYOR_ERROR.getErrorType(), String.valueOf(error));
acsDeviceErrorLog.setError_info(errorInfo);
errorLogServer.create(acsDeviceErrorLog);
}
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
}
if (task != last_task) {
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
}
if (move != 0 && task > 0) {
@@ -346,6 +292,13 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
applyManipulatorTask();
}
break;
case 7:
//申请空托盘到叠盘位的任务
//TODO 申请行架任务
if (move == 1 && !requireSucess) {
applyEmpotyTask();
}
break;
default:
break;
}
@@ -367,6 +320,16 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
}
private void applyEmpotyTask() {
JSONObject param = new JSONObject();
param.put("device_code", device_code);
logServer.deviceExecuteLog(this.device_code, "", "", "二楼到一楼输送线申请行架任务,参数:" + param);
HttpResponse response = acsToWmsService.shipDeviceUpdate(param);
if (response == null || response.getStatus() == 200) {
logServer.deviceExecuteLog(this.device_code, "", "", "二楼到一楼输送线申请行架任务,接口返回:" + response.body());
}
}
private void applyManipulatorTask() {
JSONObject param = new JSONObject();
@@ -488,19 +451,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
}
public void writing(Map<String, Object> map) {
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
Map<String, Object> itemMap = new LinkedHashMap<>();
map.forEach((key, value) -> {
if (ObjectUtil.isNotEmpty(value)) {
itemMap.put(getToParam() + key, value);
}
});
if (ObjectUtil.isNotEmpty(itemMap)) {
this.control(itemMap);
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
}
}
/*public synchronized void request_for_shipment(String mode, String item_out_seq_arr, int[] item_out_qty_arr) {
@@ -591,13 +541,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
if (ObjectUtil.isEmpty(inst)) {
return false;
}
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_target", next_addr);
map.put("to_task", inst.getInstruction_code());
map.put("to_command", CommonFinalParam.ONE);
map.put("to_container_type", CommonFinalParam.ONE);
map.put("to_container_no", CommonFinalParam.ONE);
this.writing(map);
List list = new ArrayList();
writeData(next_addr, list, inst);
led_message = getLedMessage(inst);
requireSucess = true;
return true;
@@ -607,7 +552,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
if (ObjectUtil.isNull(taskdto)) {
return false;
}
if (ObjectUtil.isNotNull(taskdto) && CommonFinalParam.ONE.equals(taskdto.getTask_type())) {
if (ObjectUtil.isNotNull(taskdto) && TaskTypeEnum.Conveyor_Task.getIndex().equals(taskdto.getTask_type())) {
//判断指令的起点和当前的设备号相同
if (!taskdto.getStart_device_code().equals(device_code)) {
return false;
@@ -658,6 +603,56 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
next_point_code = next_device_code;
}
Instruction instdto = new Instruction();
packageData(instdto, route_plan_code, taskdto, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code, priority);
log.error("=================================,{}", instdto.getCreate_by());
try {
instructionService.create(instdto);
} catch (Exception e) {
e.printStackTrace();
log.error("指令创建失败!,{}", e.getMessage());
return false;
}
taskdto.setTask_status(TaskStatusEnum.BUSY.getIndex());
taskserver.update(taskdto);
requireSucess = true;
String next_addr = nextdevice.getExtraValue().get("address").toString();
List list = new ArrayList();
writeData(next_addr, list, instdto);
led_message = getLedMessage(instdto);
requireSucess = true;
return true;
}
}
return false;
}
}
private void writeData(String next_addr, List list, Instruction inst) {
Map map = new HashMap();
map.put("code", "to_target");
map.put("value", next_addr);
list.add(map);
Map map1 = new HashMap();
map1.put("code", "to_task");
map1.put("value", inst.getInstruction_code());
list.add(map1);
Map map2 = new HashMap();
map2.put("code", "to_command");
map2.put("value", "1");
list.add(map2);
Map map3 = new HashMap();
map3.put("code", "to_container_type");
map3.put("value", "1");
list.add(map3);
Map map4 = new HashMap();
map4.put("code", "to_container_no");
map4.put("value", "1");
list.add(map4);
this.writing(list);
}
private static void packageData(Instruction instdto, String route_plan_code, TaskDto taskdto, String taskid, String taskcode, String start_device_code, String next_device_code, String start_point_code, String next_point_code, String priority) {
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(route_plan_code);
instdto.setRemark(taskdto.getRemark());
@@ -675,32 +670,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
instdto.setPriority(priority);
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
log.error("=================================,{}", instdto.getCreate_by());
try {
instructionService.create(instdto);
} catch (Exception e) {
e.printStackTrace();
log.error("指令创建失败!,{}", e.getMessage());
return false;
}
taskdto.setTask_status(CommonFinalParam.ONE);
taskserver.update(taskdto);
requireSucess = true;
Map<String, Object> map = new LinkedHashMap<>();
String next_addr = nextdevice.getExtraValue().get("address").toString();
map.put("to_target", next_addr);
map.put("to_task", instdto.getInstruction_code());
map.put("to_command", CommonFinalParam.ONE);
map.put("to_container_type", CommonFinalParam.ONE);
map.put("to_container_no", CommonFinalParam.ONE);
this.writing(map);
led_message = getLedMessage(instdto);
requireSucess = true;
return true;
}
}
return false;
}
}
public void writeData(String next_addr, Instruction instdto, Map map) {
@@ -821,7 +790,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task);
}
//当货物到达b点,实现完成指令
if (StrUtil.equals(inst.getInstruction_status(), CommonFinalParam.ONE) || StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex()) || StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
inst.setExecute_device_code(this.device_code);
finish_instruction();

View File

@@ -190,7 +190,7 @@ public interface OpcDeviceDriver extends DeviceDriver {
* @return
*/
default String getStringValue(String protocol) {
return this.getOpcValueAccessor().getValue(this.getItem(protocol)).toString();
return (String) this.getOpcValueAccessor().getValue(this.getItem(protocol));
}
/**

View File

@@ -153,7 +153,7 @@ public class ItemProtocol {
} else {
return value;
}
return "0";
return "";
}
public static List<ItemDto> getReadableItemDtos() {

View File

@@ -19,6 +19,7 @@ import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.enums.InstructionStatusEnum;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
@@ -130,6 +131,9 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
String notCreateTaskMessage = "";
String notCreateInstMessage = "";
String feedMessage = "";
String vehicle_code;
String inst_message;
String task_code = null;
List<String> getDeviceCodeList = null;
@@ -161,69 +165,9 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
container_type = this.itemProtocol.getContainer_type();
carrier_direction = this.itemProtocol.getCarrier_direction();
if (to_container_type != last_to_container_type) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_container_type" + last_to_container_type + "->" + to_container_type);
}
if (container_type != last_container_type) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号container_type" + last_container_type + "->" + container_type);
}
if (qty != last_qty) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号qty" + last_qty + "->" + qty);
}
if (carrier_direction != last_carrier_direction) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号carrier_direction" + last_carrier_direction + "->" + carrier_direction);
}
if (to_command != last_to_command) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
}
if (to_target != last_to_target) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target" + last_to_target + "->" + to_target);
}
if (to_task != last_to_task) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + last_to_task + "->" + to_task);
}
if (mode != last_mode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
}
if (task != last_task) {
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
}
// 更新指令状态
if (mode == 3 && task > 0) {
Date date = new Date();
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
} else {
this.instruction_update_time = date;
//更改指令状态
if (task > 0) {
Instruction inst = checkInst();
if (inst != null) {
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
inst.setInstruction_status(CommonFinalParam.ONE);
inst.setExecute_device_code(this.device_code);
instructionService.update(inst);
}
}
}
}
if (move != 0 && task > 0) {
update_instruction_status();
}
} catch (Exception var17) {
@@ -360,6 +304,53 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
}
}
/**
* 更新指令状态
*/
public synchronized void update_instruction_status() throws Exception {
Date date = new Date();
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
} else {
this.instruction_update_time = date;
inst = checkInst();
if (inst != null) {
inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
vehicle_code = inst.getVehicle_code();
task_code = inst.getTask_code();
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
inst.setExecute_device_code(this.device_code);
instructionService.update(inst);
logServer.deviceExecuteLog(device_code, "", "", "纸箱入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task + ",载具号:" + inst.getVehicle_code());
}
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex()) || StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
inst.setExecute_device_code(this.device_code);
if (mode == 2) {
finish_instruction();
}
logServer.deviceExecuteLog(device_code, "", "", "纸箱入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task + ",载具号:" + inst.getVehicle_code());
} else {
}
}
} else {
// message = "输送线任务反馈状态,查询不到指令号:" + task +"指令已完成";
inst_message = null;
}
}
}
public synchronized boolean finish_instruction() throws Exception {
instructionService.finish(inst);
return true;
}
@Override
public JSONObject feedLmsRealFailedInfo() {
JSONObject jo = new JSONObject();

View File

@@ -379,7 +379,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
String vehiclecode = taskdto.getVehicle_code();
String priority = taskdto.getPriority();
Instruction instdto = new Instruction();
if (TaskTypeEnum.AGV_Task.equals(taskdto.getTask_type())){
if (TaskTypeEnum.AGV_Task.getIndex().equals(taskdto.getTask_type())){
String route_plan_code = taskdto.getRoute_plan_code();
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(taskdto.getStart_device_code(), taskdto.getNext_device_code(), route_plan_code);

View File

@@ -354,9 +354,6 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage());
return false;
}
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString());
//创建指令后修改任务状态
taskDto.setTask_status("1");
taskserver.update(taskDto);
@@ -379,6 +376,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
map4.put("code", "to_task");
map4.put("value", instdto.getInstruction_code());
list.add(map4);
if (ObjectUtil.isNotEmpty(interactionJsonDTO)) {
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getSeq())) {
Map<String, Object> map5 = new HashMap<>();
map5.put("code", "to_seq");
@@ -403,6 +401,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
map8.put("value", interactionJsonDTO.getMaxNo());
list.add(map8);
}
}
try {
this.writing(list);

View File

@@ -336,7 +336,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString());
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO);
//创建指令后修改任务状态
taskDto.setTask_status("1");
taskserver.update(taskDto);
@@ -359,6 +359,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
map4.put("code", "to_task");
map4.put("value", instdto.getInstruction_code());
list.add(map4);
if (ObjectUtil.isNotEmpty(interactionJsonDTO)) {
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getWeight())) {
Map<String, Object> map5 = new HashMap<>();
map5.put("code", "to_weight");
@@ -389,6 +390,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
map9.put("value", interactionJsonDTO.getLayer());
list.add(map9);
}
}
try {
this.writing(list);

View File

@@ -333,7 +333,7 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString());
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO);
//创建指令后修改任务状态
taskDto.setTask_status("1");
taskserver.update(taskDto);
@@ -356,6 +356,7 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
map4.put("code", "to_task");
map4.put("value", instdto.getInstruction_code());
list.add(map4);
if (ObjectUtil.isNotEmpty(interactionJsonDTO)) {
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getWeight())) {
Map<String, Object> map5 = new HashMap<>();
map5.put("code", "to_weight");
@@ -386,6 +387,7 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
map9.put("value", interactionJsonDTO.getContainerType());
list.add(map9);
}
}
try {
this.writing(list);

View File

@@ -332,7 +332,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
}
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString());
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO);
//创建指令后修改任务状态
taskDto.setTask_status("1");
taskserver.update(taskDto);
@@ -355,6 +355,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
map4.put("code", "to_task");
map4.put("value", instdto.getInstruction_code());
list.add(map4);
if (ObjectUtil.isNotEmpty(interactionJsonDTO)) {
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getWeight())) {
Map<String, Object> map5 = new HashMap<>();
map5.put("code", "to_weight");
@@ -385,6 +386,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
map9.put("value", interactionJsonDTO.getIsLastOne());
list.add(map9);
}
}
try {
this.writing(list);
} catch (Exception e) {

View File

@@ -0,0 +1,209 @@
package org.nl.acs.device_driver.one_manipulator.volume_two_manipulator;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@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_task = "task";
/**
* 报警
*/
public static String item_error = "error";
/**
* 行走列
*/
public static String item_walk_y = "walk_y";
/**
* 行走列
*/
public static String item_x = "x";
/**
* 行走层号
*/
public static String item_y = "y";
/**
* 下发命令
*/
public static String item_to_command = "to_command";
/**
* 下发起始站
*/
public static String item_to_onset1 = "to_onset1";
/**
* 下发目标站
*/
public static String item_to_target1 = "to_target1";
/**
* 下发起始站
*/
public static String item_to_onset2 = "to_onset2";
/**
* 下发目标站
*/
public static String item_to_target2 = "to_target2";
/**
* 下发任务号
*/
public static String item_to_task = "to_task";
/**
* 下发任务类型
*/
public static String item_to_type = "to_type";
private VolumeTwoManipulatorManipulatorDeviceDriver driver;
public ItemProtocol(VolumeTwoManipulatorManipulatorDeviceDriver driver){
this.driver=driver;
}
public int getTo_onset1() {
return this.getOpcIntegerValue(item_to_onset1);
}
public int getTo_target1() {
return this.getOpcIntegerValue(item_to_target1);
}
public int getTo_onset2() {
return this.getOpcIntegerValue(item_to_onset2);
}
public int getTo_target2() {
return this.getOpcIntegerValue(item_to_target2);
}
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getMove() {
return this.getOpcIntegerValue(item_move);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getTask() {
return this.getOpcIntegerValue(item_task);
}
public int getWalk_y() {
return this.getOpcIntegerValue(item_walk_y);
}
public Integer getItem_x() {
return this.getOpcIntegerValue(item_x);
}
public Integer getItem_y() {
return this.getOpcIntegerValue(item_y);
}
public int getTo_task() {
return this.getOpcIntegerValue(item_to_task);
}
public int getTo_type() {
return this.getOpcIntegerValue(item_to_type);
}
public int getTo_command() {
return this.getOpcIntegerValue(item_to_command);
}
Boolean isonline;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList<ItemDto> list = new ArrayList<>();
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
list.add(new ItemDto(item_mode, "工作模式", "DB1.B1"));
list.add(new ItemDto(item_move, "光电信号", "DB1.B2"));
list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
list.add(new ItemDto(item_x, "行走列号", "DB101.B10"));
list.add(new ItemDto(item_y, "行走层号", "DB101.B11"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList<ItemDto> list = new ArrayList<>();
list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0"));
list.add(new ItemDto(item_to_target1, "下发目标站1", "DB2.W4"));
list.add(new ItemDto(item_to_onset1, "下发起始站1", "DB2.W2"));
list.add(new ItemDto(item_to_target2, "下发目标站2", "DB2.W14"));
list.add(new ItemDto(item_to_onset2, "下发起始站2", "DB2.W12"));
list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D6"));
list.add(new ItemDto(item_to_type, "木箱长度", "DB601.W10"));
return list;
}
}

View File

@@ -0,0 +1,56 @@
package org.nl.acs.device_driver.one_manipulator.volume_two_manipulator;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
@Service
public class VolumeTwoManipulatorDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "trapped_manipulator";
}
@Override
public String getDriverName() {
return "堆叠行架";
}
@Override
public String getDriverDescription() {
return "堆叠行架";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new VolumeTwoManipulatorManipulatorDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return VolumeTwoManipulatorManipulatorDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.robot);
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -0,0 +1,569 @@
package org.nl.acs.device_driver.one_manipulator.volume_two_manipulator;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceExtraService;
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.FeedLmsRealFailed;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.one_manipulator.trapped_manipulator.InteractionJsonDTO;
import org.nl.acs.enums.VolumeTwoTypeEnum;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.config.SpringContextHolder;
import java.util.*;
/**
* 捆扎智能行架
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
DeviceExtraService deviceExtraService = SpringContextHolder.getBean(DeviceExtraServiceImpl.class);
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
int mode = 0;
int last_mode = 0;
int move = 0;
int last_move = 0;
int action = 0;
int last_action = 0;
int error = 0;
int last_error = 0;
int task = 0;
int last_task = 0;
int walk_y = 0;
int last_walk_y = 0;
int heartbeat = 0;
int last_heartbeat = 0;
int to_command = 0;
int last_to_command = 0;
int to_target1 = 0;
int last_to_target1 = 0;
int to_onset1 = 0;
int last_to_onset1 = 0;
int to_target2 = 0;
int last_to_target2 = 0;
int to_onset2 = 0;
int last_to_onset2 = 0;
int to_type = 0;
int last_to_type = 0;
/**
* 行走列
*/
Integer x = null;
Integer last_x = null;
/**
* 行走层号
*/
Integer y = 0;
Integer last_y = 0;
int to_task = 0;
int last_to_task = 0;
int to_layer = 0;
Boolean isonline = true;
int hasGoods = 0;
String message = null;
Boolean iserror = false;
private Date instruction_update_time = new Date();
private int instruction_update_time_out = 1000;
Integer heartbeat_tag;
private Date instruction_require_time = new Date();
private int instruction_require_time_out = 3000;
//行架机械手申请任务成功标识
boolean requireSucess = false;
private int instruction_finished_time_out;
int branchProtocol = 0;
private String error_type = "hxhj_error_type";
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
int flag;
String device_code;
//当前指令
Instruction inst = null;
String notCreateTaskMessage = "";
String notCreateInstMessage = "";
String feedMessage = "";
List<String> getDeviceCodeList = null;
List<String> putDeviceCodeList = null;
@Override
public Device getDevice() {
return this.device;
}
@Override
public void execute() {
String message = null;
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
move = this.itemProtocol.getMove();
action = this.itemProtocol.getAction();
error = this.itemProtocol.getError();
task = this.itemProtocol.getTask();
heartbeat = this.itemProtocol.getHeartbeat();
x = this.itemProtocol.getItem_x();
y = this.itemProtocol.getItem_y();
to_command = this.itemProtocol.getTo_command();
to_target1 = this.itemProtocol.getTo_target1();
to_onset1 = this.itemProtocol.getTo_onset1();
to_target2 = this.itemProtocol.getTo_target2();
to_onset2 = this.itemProtocol.getTo_onset2();
to_task = this.itemProtocol.getTo_task();
to_type = this.itemProtocol.getTo_type();
// 更新指令状态
if (mode == 3 && task > 0) {
updateInstructionStatus();
}
} catch (Exception var17) {
var17.printStackTrace();
feedMessage = var17.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
}
if (mode == 0) {
this.setIsonline(false);
message = "未联机";
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "有报警";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
//行架机械手申请任务
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
boolean res = applyTask();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
} else {
String remark = "未查找任务原因为:";
if (mode != 2) {
remark = remark + "工作模式(mode)不是待机状态,";
}
if (move != 0) {
remark = remark + "光电信号(move)为有货状态,";
}
if (task != 0) {
remark = remark + "当前上报任务号(task)应该为0,";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = remark + "请右击该图标,将请求任务复位标记(requireSucess)改为否。";
}
this.setNotCreateTaskMessage(remark);
}
}
last_mode = mode;
last_move = move;
last_action = action;
last_error = error;
last_task = task;
last_heartbeat = heartbeat;
last_walk_y = walk_y;
last_x = x;
last_y = y;
last_to_task = to_task;
last_to_command = to_command;
last_to_target1 = to_target1;
last_to_onset1 = to_onset1;
last_to_target2 = to_target2;
last_to_onset2 = to_onset2;
last_to_type = to_type;
}
private void updateInstructionStatus() {
Date date = new Date();
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
} else {
this.instruction_update_time = date;
//更改指令状态
if (task > 0) {
Instruction inst = checkInst();
if (inst != null) {
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
inst.setInstruction_status(CommonFinalParam.ONE);
inst.setExecute_device_code(this.device_code);
instructionService.update(inst);
}
}
}
//放货完成
if ( action == 4 && move == 0) {
if (inst != null) {
try {
logServer.deviceExecuteLog(this.device_code,"","","放货完成");
finish_instruction(inst);
Map<String, Object> map1 = new HashMap<>();
List list = new ArrayList();
map1.put("code", "to_command");
map1.put("value", 5);
list.add(map1);
this.writing(list);
message = "放货完成";
} catch (Exception e) {
message = "放货失败";
e.printStackTrace();
}
feedMessage = "";
}else {
feedMessage = "行架机械手:";
if (mode != 3) {
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
}
if (action != 8) {
feedMessage = feedMessage + "动作信号(action)不为放货完成状态,";
}
if (move != 0) {
feedMessage = feedMessage + "光电信号(move)不为无货状态,";
}
if (task == 0) {
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
}
}
}
}
}
public synchronized boolean applyTask() {
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;
//抓取工位
if (ObjectUtil.isEmpty(getDeviceCodeList)) {
getDeviceCodeList = this.getExtraDeviceCodes("get_device_code");
}
//放货工位
if (ObjectUtil.isEmpty(putDeviceCodeList)) {
putDeviceCodeList = this.getExtraDeviceCodes("put_device_code");
}
//找终点为入库输送线工位任务类型为行架的任务
for (int i = 0; i < getDeviceCodeList.size(); i++) {
String startDeviceCode = getDeviceCodeList.get(i);
TaskDto taskDto = taskserver.findByStartCodeAndReady(startDeviceCode);
if (ObjectUtil.isNotEmpty(taskDto) && TaskTypeEnum.Truss_Task.getIndex().equals(taskDto.getTask_type())) {
String start_device_code = taskDto.getStart_device_code();
String next_device_code = taskDto.getNext_device_code();
String start_device_code2 = taskDto.getStart_device_code2();
String next_device_code2 = taskDto.getNext_device_code2();
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
String taskid = taskDto.getTask_id();
String taskcode = taskDto.getTask_code();
String start_point_code = taskDto.getStart_point_code();
String next_point_code = taskDto.getNext_point_code();
String start_point_code2 = taskDto.getStart_point_code2();
String next_point_code2 = taskDto.getNext_point_code2();
String route_plan_code = taskDto.getRoute_plan_code();
Instruction instdto = new Instruction();
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(route_plan_code);
instdto.setTask_id(taskid);
instdto.setTask_code(taskcode);
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.setStart_device_code2(start_device_code2);
instdto.setNext_device_code2(next_device_code2);
instdto.setStart_point_code2(start_point_code2);
instdto.setNext_point_code2(next_point_code2);
instdto.setInstruction_status("0");
instdto.setExecute_device_code(device_code);
try {
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage());
return false;
}
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code() );
//创建指令后修改任务状态
taskDto.setTask_status("1");
taskserver.update(taskDto);
requireSucess = true;
Map<String, Object> map1 = new HashMap<>();
List list = new ArrayList();
map1.put("code", "to_command");
map1.put("value", 1);
list.add(map1);
Map<String, Object> map2 = new HashMap<>();
map2.put("code", "to_target");
map2.put("value", next_addr);
list.add(map2);
Map<String, Object> map3 = new HashMap<>();
map3.put("code", "to_onset");
map3.put("value", start_addr);
list.add(map3);
Map<String, Object> map4 = new HashMap<>();
map4.put("code", "to_task");
map4.put("value", instdto.getInstruction_code());
list.add(map4);
String toType = VolumeTwoTypeEnum.TOW.getType();
if (StrUtil.isNotEmpty(start_device_code2)) {
toType = VolumeTwoTypeEnum.FOUR.getType();
Device startDevice2 = deviceAppService.findDeviceByCode(start_device_code2);
Device nextDevice2 = deviceAppService.findDeviceByCode(next_device_code2);
String start_addr2 = startDevice2.getExtraValue().get("address").toString();
String next_addr2 = nextDevice2.getExtraValue().get("address").toString();
Map<String, Object> map5 = new HashMap<>();
map5.put("code", "to_target2");
map5.put("value", next_addr2);
list.add(map5);
Map<String, Object> map6 = new HashMap<>();
map6.put("code", "to_onset2");
map6.put("value", start_addr2);
list.add(map6);
}
Map<String, Object> map7 = new HashMap<>();
map7.put("code", "to_type");
map7.put("value", toType);
list.add(map7);
try {
this.writing(list);
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code() + ",指令执行失败:" + e.getMessage());
}
this.setRequireSucess(true);
return true;
}else{
notCreateInstMessage = "未找到关联设备的任务,指令无法创建";
}
}
return true;
}
}
/**
* 完成指令
* @param inst
* @return
* @throws Exception
*/
public synchronized boolean finish_instruction(Instruction inst) throws Exception {
instructionService.finish(inst);
return true;
}
/**
* 下发信号
* @param list
*/
public void writing(List list) {
Map<String, Object> itemMap = new HashMap<String, Object>();
for (int i = 0; i < list.size(); i++) {
Object ob = list.get(i);
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
if (!StrUtil.isEmpty(json.getString("value"))) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + json.getString("code");
itemMap.put(to_param, json.getString("value"));
}
}
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
try {
this.checkcontrol(itemMap);
} catch (Exception e) {
e.printStackTrace();
try {
this.checkcontrol(itemMap);
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
/**
* 抽取统一下发电气信号前缀
*
* @return
*/
public String getToParam() {
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String move = "";
String action = "";
String walk_y = "";
if (this.getMode() == 0) {
mode = "脱机";
} else if (this.getMode() == 1) {
mode = "单机";
} else if (this.getMode() == 2) {
mode = "待机";
} else if (this.getMode() == 3) {
mode = "运行中";
}
if (this.getMove() == 0) {
move = "无货";
} else if (this.getMove() == 1) {
move = "有货";
}
String requireSucess = "0";
if (this.requireSucess) {
requireSucess = "1";
}
jo.put("requireSucess", requireSucess);
if (this.getAction() == 1) {
action = "取货中";
} else if (this.getAction() == 2) {
action = "取货完成";
} else if (this.getAction() == 3) {
action = "放货中";
} else if (this.getAction() == 4) {
action = "放货完成";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("action", action);
jo.put("task", task);
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
jo.put("notCreateTaskMessage", notCreateTaskMessage);
jo.put("notCreateInstMessage", notCreateInstMessage);
jo.put("feedMessage", feedMessage);
jo.put("driver_type", "siemens_conveyor");
jo.put("is_click", true);
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
String requestSucess = data.getString("requireSucess");
if (StrUtil.equals(requestSucess, "0")) {
this.requireSucess = false;
} else if (StrUtil.equals(requestSucess, "1")) {
this.requireSucess = true;
}
}
@Override
public JSONObject feedLmsRealFailedInfo() {
JSONObject jo = new JSONObject();
jo.put("device_code", this.getDevice().getDevice_code());
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("fault_code", String.valueOf(error));
jo.put("fault_info", ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
jo.put("fault_type", error_type);
return jo;
}
public Instruction checkInst() {
if (ObjectUtil.isNotEmpty(this.inst)) {
if (this.task > 0) {
if (this.inst.getInstruction_code().equals(String.valueOf(this.task))) {
return this.inst;
} else {
inst = instructionService.findByCodeFromCache(String.valueOf(task));
return inst;
}
}
} else {
inst = instructionService.findByCodeFromCache(String.valueOf(task));
return inst;
}
return null;
}
}

View File

@@ -456,7 +456,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_type, "物料类型", "DB100.B3"));
list.add(new ItemDto(item_to_task, "任务号", "DB100.D4"));
list.add(new ItemDto(item_to_z, "作业排", "DB100.B8"));
list.add(new ItemDto(item_to_x, "作业列", "DN100.B9"));
list.add(new ItemDto(item_to_x, "作业列", "DB100.B9"));
list.add(new ItemDto(item_to_y, "作业层", "DB100.B10"));
list.add(new ItemDto(item_to_trayCode, "托盘号", "DB100.B11.20"));
return list;

View File

@@ -347,7 +347,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
} else {
Map<String, Object> map = new LinkedHashMap<>();
List list = new ArrayList();
switch (command) {
case 0:
boolean b = applyTask();
@@ -365,28 +366,52 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.conveyor.name())) {
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("z"))) {
map.put("to_x", nextDevice.getExtraValue().get("z"));
Map map = new HashMap();
map.put("code", "to_x");
map.put("value", nextDevice.getExtraValue().get("z"));
list.add(map);
}
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("x"))) {
map.put("to_z", nextDevice.getExtraValue().get("x"));
Map<String, Object> map = new HashMap<>();
map.put("code", "to_z");
map.put("value", nextDevice.getExtraValue().get("x"));
list.add(map);
}
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("y"))) {
map.put("to_y", nextDevice.getExtraValue().get("y"));
Map<String, Object> map = new HashMap<>();
map.put("code", "to_y");
map.put("value", nextDevice.getExtraValue().get("y"));
list.add(map);
}
}
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.storage.name())) {
String pattern = "\\d+";
Pattern compile = Pattern.compile(pattern);
map.put("to_y", inst.getTo_z());
Map<String, Object> map = new HashMap<>();
map.put("code", "to_y");
map.put("value", inst.getTo_z());
list.add(map);
if (inst.getTo_x().length() > 1 && !compile.matcher(inst.getTo_x()).matches()) {
String substring = inst.getTo_x().substring(1);
map.put("to_z", substring);
Map<String, Object> map1 = new HashMap<>();
map1.put("code", "to_z");
map1.put("value", substring);
list.add(map1);
} else {
map.put("to_z", inst.getTo_x());
Map<String, Object> map2 = new HashMap<>();
map2.put("code", "to_z");
map2.put("value", inst.getTo_x());
list.add(map2);
}
map.put("to_x", inst.getTo_y());
Map<String, Object> map3 = new HashMap<>();
map3.put("code", "to_x");
map3.put("value", inst.getTo_y());
list.add(map3);
}
map.put("to_command", 2);
Map<String, Object> map4 = new HashMap<>();
map4.put("code", "to_command");
map4.put("value", 2);
list.add(map4);
requireSucess = true;
break;
case 3:
@@ -408,13 +433,19 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
return;
}
}
map.put("to_command", 3);
Map<String, Object> map = new HashMap<>();
map.put("code", "to_command");
map.put("value", 4);
list.add(map);
}
requireSucess = true;
break;
case 5:
message = "放货完成";
map.put("to_command", 5);
Map<String, Object> map = new HashMap<>();
map.put("code", "to_command");
map.put("value", 5);
list.add(map);
Instruction inst = checkInst();
try {
finish_instruction(inst);
@@ -425,17 +456,26 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
break;
case 6:
message = "取货准备(会库位台)";
map.put("to_command", 6);
Map<String, Object> map1 = new HashMap<>();
map1.put("code", "to_command");
map1.put("value", 6);
list.add(map1);
requireSucess = true;
break;
case 7:
message = "召回";
map.put("to_command", 7);
Map<String, Object> map2 = new HashMap<>();
map2.put("code", "to_command");
map2.put("value", 7);
list.add(map2);
requireSucess = true;
break;
case 8:
message = "急停";
map.put("to_command", 8);
Map<String, Object> map3 = new HashMap<>();
map3.put("code", "to_command");
map3.put("value", 8);
list.add(map3);
requireSucess = true;
break;
default:
@@ -443,8 +483,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
requireSucess = true;
break;
}
if (ObjectUtil.isNotNull(map)) {
this.writing(map);
if (ObjectUtil.isNotNull(list)) {
this.writing(list);
}
}

View File

@@ -161,6 +161,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_move2, "后工位光电信号", "DB15.B3"));
list.add(new ItemDto(item_action, "动作信号", "DB15.B4"));
list.add(new ItemDto(item_walk_y, "行走列", "DB15.B5"));
list.add(new ItemDto(item_task, "任务号", "DB15.D3"));
list.add(new ItemDto(item_error, "报警信号", "DB15.B6"));
list.add(new ItemDto(item_x_position, "x坐标", "DB15.REAL10"));
list.add(new ItemDto(item_y_position, "y坐标", "DB15.REAL14"));

View File

@@ -0,0 +1,21 @@
package org.nl.acs.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum VolumeTwoTypeEnum {
TOW("1", "2点取放任务"),
FOUR("2", "4点任务取放满卷后取放空架子任务");
/**
* 索引
*/
private String type;
/**
* 编码
*/
private String value;
}

View File

@@ -29,7 +29,6 @@ public class DeviceStageMonitorController {
private final DeviceStageMonitorService deviceStageMonitorService;
@Log("获取舞台设备信息")
@PostMapping("/getDeviceByCodes")
public ResponseEntity<Object> getDeviceByCodes(@RequestBody String json) throws Exception {
JSONArray jsonArray = JSONArray.parseArray(json);

View File

@@ -202,15 +202,13 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
Object his = accessor_value.getValue(itemId);
if (!ObjectUtl.isEquals(itemState.getQuality(), QualityTypeValue.OPC_QUALITY_GOOD) && his != null) {
log.warn("opc 值不健康 item: {}, 状态: {}", itemId, itemState.getQuality());
valueAllNotNull = true;
valueAllNotNull = false;
}
if (!UnifiedDataAppService.isEquals(value, his)) {
OpcItemDto itemDto = this.getItem(itemId);
if (true) {
this.logItemChanged(itemId, accessor_value, value, itemDto);
}
if (!ObjectUtil.isEmpty(value)) {
this.logItemChanged(itemId, accessor_value, value, itemDto);
accessor_value.setValue(itemId, value);
}
}
@@ -233,29 +231,30 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
random *= 1000;
if (this.all_null < 3) {
if (log.isWarnEnabled()) {
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null, 5000 + random);
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null,3);
}
ThreadUtl.sleep((long) (5000 + random));
ThreadUtl.sleep( 3000);
break start;
} else if (this.all_null < 6) {
if (log.isWarnEnabled()) {
log.warn(tag + "重新创建server");
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null, 30000 + random);
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null,3);
}
// ThreadUtl.sleep((long) (30000 + random));
ThreadUtl.sleep((long) ((new Random()).nextInt(3) + 1) * 1000);
ThreadUtl.sleep(3000);
break start;
} else if (this.all_null < 12) {
if (log.isWarnEnabled()) {
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}ms", tag, all_null, '\uea60' + random);
log.warn(tag + "重新创建server");
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null,3);
}
ThreadUtl.sleep((long) ('\uea60' + random));
ThreadUtl.sleep(3000);
break start;
} else {
if (log.isWarnEnabled()) {
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}ms", tag, all_null, 120000 + random);
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}ms", tag, all_null, 5000);
}
ThreadUtl.sleep((long) (120000 + random));
ThreadUtl.sleep((long) (5000));
}
++this.all_null;
@@ -436,7 +435,6 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
String.valueOf(itemDto.getHis_item_value()), String.valueOf(itemDto.getItem_value()));
luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc());
log.info("{}", JSON.toJSONString(luceneLogDto));
}
} else {
if(his instanceof int[]){

View File

@@ -21,6 +21,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.config.SpringContextHolder;
@@ -49,7 +50,7 @@ public class AutoCreateInst {
List<TaskDto> list = taskserver.queryAllByStatus("0");
for (int i = 0; i < list.size(); i++) {
TaskDto acsTask = list.get(i);
if (StrUtil.equals(acsTask.getTask_type(), "7") && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
if (StrUtil.equals(acsTask.getTask_type(), TaskTypeEnum.AGV_Task.getIndex()) && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
continue;
}
String taskid = acsTask.getTask_id();

View File

@@ -110,7 +110,7 @@
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<!-- <el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC读取字段</span>
</div>
@@ -145,9 +145,9 @@
</el-table-column>
</el-table>
</el-form>
</el-card>
</el-card> -->
<el-card class="box-card" shadow="never">
<!-- <el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC写入字段</span>
</div>
@@ -190,7 +190,7 @@
</el-table-column>
</el-table>
</el-form>
</el-card>
</el-card> -->
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">

View File

@@ -483,7 +483,7 @@
<!-- <el-table-column prop="link_num" label="关联编号" />-->
<el-table-column prop="vehicle_code" :label="$t('task.txt_box.Vehicle_number')" :min-width="flexWidth('vehicle_code',crud.data,$t('task.txt_box.Vehicle_number'))" />
<el-table-column prop="task_status" :label="$t('task.txt_box.Task_status')" width="150px">
<template slot-scope="scope" width="120px">
<template slot-scope="scope">
<span v-if="scope.row.task_status==='0' ">{{ $t('task.select.Ready') }}</span>
<span v-if="scope.row.task_status==='1' ">{{ $t('task.select.In_progress') }}</span>
<span v-if="scope.row.task_status==='2' ">{{ $t('task.select.Completed') }}</span>

View File

@@ -7,9 +7,9 @@
v-model="query.createTime"
type="datetimerange"
:picker-options="pickerOptions"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
:range-separator="$t('monitor.lucence.until')"
:start-placeholder="$t('auto.common.startDate')"
:end-placeholder="$t('auto.common.endDate')"
align="right"
/>
<rrOperation />

View File

@@ -97,7 +97,7 @@
type="primary"
icon="el-icon-plus"
@click="$refs.dictDetail && $refs.dictDetail.crud.toAdd()"
>{{ $t('common.Create') }}
>{{ $t('auto.common.Create') }}
</el-button>
</div>
<dictDetail ref="dictDetail" :permission="permission" />

View File

@@ -201,7 +201,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String type = whereJson.getString("type");
JSONObject result = new JSONObject();
RLock lock = redissonClient.getLock("acs_to_wms:" + type);
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
boolean tryLock = lock.tryLock(5,20, TimeUnit.SECONDS);
try {
if (tryLock) {
String device_code = whereJson.getString("device_code");
@@ -625,8 +625,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return result;
}
} finally {
if (tryLock) {
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
try {
lock.unlock();
}catch (Exception ex){}
}
}
result.put("status", HttpStatus.BAD_REQUEST.value());