rev:清洗上、下料

Signed-off-by: jiaoliming <dawnjiao@foxmail.com>
This commit is contained in:
jiaoliming
2023-09-01 09:58:08 +08:00
parent 79ab3099fa
commit 01fd8b0d19
2 changed files with 176 additions and 82 deletions

View File

@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.Data; import lombok.Data;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.acsEnum.WorkerOrderEnum;
import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.ApplyTaskTime; import org.nl.acs.device_driver.basedriver.hailiang_one.ApplyTaskTime;
@@ -122,7 +123,6 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
allowed_in = this.itemProtocol.getItem_allowed_in(); allowed_in = this.itemProtocol.getItem_allowed_in();
error = this.itemProtocol.getItem_error(); error = this.itemProtocol.getItem_error();
in_pcsn = this.itemProtocol.getItem_in_pcsn(); in_pcsn = this.itemProtocol.getItem_in_pcsn();
to_in_confirm_finish = this.itemProtocol.getItem_to_in_confirm_finish();
if (mode != last_mode) { if (mode != last_mode) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
} }
@@ -224,19 +224,37 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
// } // }
// } // }
// 修改工单状态为生产中
// if (mode == 1 && allowed_in == 1 && in_pcsn > 0) {
if (mode == 1 && in_pcsn > 0 && task_finish == 0) {
ProduceshiftorderDto pdto = produceshiftorderService.findOrderByDeviceCode(this.getDevice_code());
if (pdto != null) {
if (pdto.getOrder_status().equals(WorkerOrderEnum.READY.getCode())) {
pdto.setOrder_status(WorkerOrderEnum.PRODUCTING.getCode());
produceshiftorderService.update(pdto);
// TODO 反馈mes
JSONObject reqParam = new JSONObject();
reqParam.put("in_pcsn", in_pcsn);
reqParam.put("status", StatusEnum.TASK_RUNNING.getCode());
HttpResponse httpResponse = acsToWmsService.washTask(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
requireSucess = true;
this.message = "反馈清洗上料执行中成功";
}
}
}
}
if (mode == 1 && task_finish == 1 ) { if (mode == 1 && task_finish == 1 ) {
boolean flag = washTask(in_pcsn); logServer.deviceExecuteLog(this.device_code, "", "", "task_finish"+task_finish+"电气完成任务后信号last_in_pcsn" + last_in_pcsn + "last_in_pcsn任务号不为空则查询工单更新状态自动完成");
logServer.deviceExecuteLog(this.device_code, "", "", "this.device_code"+this.device_code+ "device_code不为空则查询工单更新状态自动完成");
boolean flag = washTask(last_in_pcsn);
if (flag) { if (flag) {
this.message = "反馈清洗上料完成成功"; this.message = "反馈清洗上料完成成功";
} }
} }
if (mode == 1 && to_in_confirm_finish == 1 ) {
boolean flag = washTaskRun(in_pcsn);
if (flag) {
this.message = "反馈清洗上料执行中";
}
}
} }
last_mode = mode; last_mode = mode;
last_is_open = is_open; last_is_open = is_open;
@@ -369,32 +387,31 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
private boolean washTask(int in_pcsn) { private boolean washTask(int in_pcsn) {
ProduceshiftorderDto dto = produceshiftorderService.findOrderByDeviceCode(this.getDevice_code()); ProduceshiftorderDto dto = produceshiftorderService.findOrderByDeviceCode(this.getDevice_code());
if (dto != null) { if (dto != null) {
if (!StrUtil.equals(dto.getOrder_code(),String.valueOf(in_pcsn))){ if (dto.getOrder_status().equals(WorkerOrderEnum.PRODUCTING.getCode())) {
return false; this.writing("to_confirm_finished", "1");
} this.writing("to_pcsn","0");
this.writing("to_confirm_finished", "1"); String[] in_devices = dto.getIn_devices().split(",");
String[] in_devices = dto.getIn_devices().split(","); //上料完成清除储料仓内存中的物料信息
//上料完成清除储料仓内存中的物料信息 Arrays.stream(in_devices).forEach(device_code -> {
Arrays.stream(in_devices).forEach(device_code -> { Device device = deviceAppService.findDeviceByCode(device_code);
Device device = deviceAppService.findDeviceByCode(device_code); if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) { HailiangCleaningMachineStorageStationDeviceDriver hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
HailiangCleaningMachineStorageStationDeviceDriver hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver(); hailiangCleaningMachineStorageStationDeviceDriver.setMaterial_code(null);
hailiangCleaningMachineStorageStationDeviceDriver.setMaterial_code(null); //下发储料仓去皮
//下发储料仓去皮 hailiangCleaningMachineStorageStationDeviceDriver.writing("to_peel","1");
hailiangCleaningMachineStorageStationDeviceDriver.writing("to_peel","1"); }
});
//修改工单状态为完成
dto.setOrder_status(WorkerOrderEnum.COMPLETE.getCode());
produceshiftorderService.update(dto);
// TODO 反馈mes
JSONObject reqParam = new JSONObject();
reqParam.put("in_pcsn", dto.getOrder_code());
reqParam.put("status", StatusEnum.TASK_FINISH.getCode());
HttpResponse httpResponse = acsToWmsService.washTask(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
this.message = "反馈清洗上料任务完成成功";
} }
});
//修改工单状态为执行中
dto.setOrder_status("2");
produceshiftorderService.update(dto);
// TODO 反馈mes
JSONObject reqParam = new JSONObject();
reqParam.put("in_pcsn", in_pcsn);
reqParam.put("status", StatusEnum.TASK_FINISH.getCode());
HttpResponse httpResponse = acsToWmsService.washTask(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
requireSucess = true;
return true;
} }
} }
return false; return false;
@@ -477,30 +494,51 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
@Override @Override
public void issuedOrderInfo(ProduceshiftorderDto dto) { public void issuedOrderInfo(ProduceshiftorderDto dto) {
String[] in_devices = dto.getIn_devices().split(","); try {
//上料储料仓总重量 this.writing("to_confirm_finished", "1");
int weightSum = 0; this.writing("to_del_task","1");
//上料储料仓总数量 Thread.sleep(2000L);
int qtySum = 0; String[] in_devices = dto.getIn_devices().split(",");
//遍历上料储料仓设备 求重量和数量和下发给清洗上料位 //上料储料仓总重量
for (int i = 0; i < in_devices.length; i++) { int weightSum = 0;
String in_device = in_devices[i]; //上料储料仓总数量
Device device = deviceAppService.findDeviceByCode(in_device); int qtySum = 0;
if (device != null) {
HailiangCleaningMachineStorageStationDeviceDriver hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver(); //下发电气信号
weightSum += hailiangCleaningMachineStorageStationDeviceDriver.getSilo_weight(); Map<String, Object> map = new LinkedHashMap<>();
qtySum += hailiangCleaningMachineStorageStationDeviceDriver.getFull_number(); map.put("task_finish","0");
hailiangCleaningMachineStorageStationDeviceDriver.writing("to_feeding", "1"); map.put("to_pcsn",dto.getOrder_code());//下发批次号,暂时用工单号
map.put("to_all_num", String.valueOf(qtySum));
map.put("to_all_weight", String.valueOf(weightSum));
map.put("to_in_confirm_finish", "1");
map.put("allowed_in","1");
this.writing(map);
//遍历上料储料仓设备 求重量和数量和下发给清洗上料位
for (int i = 0; i < in_devices.length; i++) {
String in_device = in_devices[i];
Device device = deviceAppService.findDeviceByCode(in_device);
if (device != null) {
HailiangCleaningMachineStorageStationDeviceDriver hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
weightSum += hailiangCleaningMachineStorageStationDeviceDriver.getSilo_weight();
qtySum += hailiangCleaningMachineStorageStationDeviceDriver.getFull_number();
hailiangCleaningMachineStorageStationDeviceDriver.writing("to_feeding", "1");
}
} }
} catch (InterruptedException e) {
e.printStackTrace();
} }
//下发电气信号
Map<String, Object> map = new LinkedHashMap<>(); // this.writing("to_compel_finished","1");
map.put("to_pcsn",dto.getOrder_code());//下发批次号,暂时用工单号
map.put("to_all_num", String.valueOf(qtySum));
map.put("to_all_weight", String.valueOf(weightSum)); // //修改工单状态为执行中
map.put("to_in_confirm_finish", "1"); // dto.setOrder_status(StatusEnum.TASK_RUNNING.getCode());
map.put("allowed_in","1"); // // TODO 反馈mes
this.writing(map); // JSONObject reqParam = new JSONObject();
// reqParam.put("in_pcsn", dto.getOrder_code());
// reqParam.put("status", StatusEnum.TASK_RUNNING.getCode());
// HttpResponse httpResponse = acsToWmsService.washTask(reqParam);
} }
/** /**
@@ -508,6 +546,8 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
*/ */
@Override @Override
public void issuedOrderFinish(String autoFinish) { public void issuedOrderFinish(String autoFinish) {
this.writing("to_compel_finished","1");
this.writing("to_del_task","1");
} }

View File

@@ -1,7 +1,6 @@
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_put_line; package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_put_line;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.Data; import lombok.Data;
@@ -11,7 +10,7 @@ import org.nl.acs.acsEnum.InstActionEnum;
import org.nl.acs.acsEnum.StatusEnum; import org.nl.acs.acsEnum.StatusEnum;
import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl; import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun; import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun;
import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.ApplyTaskTime; import org.nl.acs.device_driver.basedriver.hailiang_one.ApplyTaskTime;
@@ -28,7 +27,7 @@ import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device; import org.nl.acs.opc.Device;
import org.nl.acs.order.service.dto.ProduceshiftorderDto; import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.utils.RedisUtils; import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
@@ -57,6 +56,8 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class); NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class);
@Autowired @Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@Autowired
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
//工作模式 //工作模式
int mode = 0; int mode = 0;
@@ -133,7 +134,7 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
int last_full_weight = 0; int last_full_weight = 0;
//上料批次号 //上料批次号
int last_in_pcsn = 0; int last_in_pcsn = 0;
int last_barcode = 0; String last_barcode = null;
//收料位1批次入料总数量 //收料位1批次入料总数量
int last_all_num = 0; int last_all_num = 0;
//收料位1批次入料总重量 //收料位1批次入料总重量
@@ -141,7 +142,10 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
int last_open_ready_time = 0; int last_open_ready_time = 0;
int last_device_running_time = 0; int last_device_running_time = 0;
int last_await_time = 0; int last_await_time = 0;
int last_barcode_1 = 0;
int last_barcode_2 = 0;
int last_barcode_3 = 0;
int last_barcode_4 = 0;
Boolean isonline = true; Boolean isonline = true;
@@ -207,6 +211,9 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
} }
if (move != last_move) { if (move != last_move) {
if (move == 1) {
requireSucess = false;
}
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move); logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
} }
if (is_open != last_is_open) { if (is_open != last_is_open) {
@@ -257,6 +264,18 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
if (await_time != last_await_time) { if (await_time != last_await_time) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号await_time" + last_await_time + "->" + await_time); logServer.deviceExecuteLog(this.device_code, "", "", "信号await_time" + last_await_time + "->" + await_time);
} }
if (barcode_1 != last_barcode_1) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号barcode_1" + last_barcode_1 + "->" + barcode_1);
}
if (barcode_2 != last_barcode_2) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号barcode_2" + last_barcode_2 + "->" + barcode_2);
}
if (barcode_3 != last_barcode_3) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号barcode_3" + last_barcode_3 + "->" + barcode_3);
}
if (barcode_4 != last_barcode_4) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号barcode_4" + last_barcode_4 + "->" + barcode_4);
}
if (error != last_error) { if (error != last_error) {
if (error != 0) { if (error != 0) {
@@ -286,15 +305,17 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
this.setIserror(false); this.setIserror(false);
message = ""; message = "";
//工作模式联机、满框请求 就申请agv任务 //工作模式联机、满框请求 就申请agv任务
if (mode == 1 && full_req == 1 && put_line_ready ==0 && !requireSucess) { // if (mode == 1 && full_req == 1 && !requireSucess) {
boolean flag = apply_task(StatusEnum.QXXL_FULL_REQ.getCode()); // boolean flag = apply_task(StatusEnum.QXXL_FULL_REQ.getCode());
this.noApplyTaskMessage = null; // this.noApplyTaskMessage = null;
if (flag) { // if (flag) {
this.message = "申请满框请求任务成功"; // this.message = "申请满框请求任务成功";
} // }
} // }
//工作模式联机、强制搬出请求 就申请agv任务 //工作模式联机、强制搬出请求 就申请agv任务
if (mode == 1 && compel_full_req == 1 && put_line_ready ==0 && !requireSucess) { logServer.deviceExecuteLog(device_code, "", "", "mode="+this.mode+"----compel_full_req="+compel_full_req+"-------requireSucess="+requireSucess);
if (mode == 1 && compel_full_req == 1) {
logServer.deviceExecuteLog(device_code, "", "", "mode="+this.mode+"----compel_full_req="+compel_full_req+"-------requireSucess="+requireSucess);
boolean flag = apply_task(StatusEnum.QXXL_COMPEL_REQ.getCode()); boolean flag = apply_task(StatusEnum.QXXL_COMPEL_REQ.getCode());
this.noApplyTaskMessage = null; this.noApplyTaskMessage = null;
if (flag) { if (flag) {
@@ -302,7 +323,9 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
} }
} }
//工作模式联机、空框请求 就申请agv任务 //工作模式联机、空框请求 就申请agv任务
if (mode == 1 && empty_req == 1 && put_line_ready ==0 && !requireSucess) { logServer.deviceExecuteLog(device_code, "", "", "mode="+this.mode+"----empty_req="+empty_req+"-------requireSucess="+requireSucess);
if (mode == 1 && empty_req == 1 && !requireSucess) {
logServer.deviceExecuteLog(device_code, "", "", "mode="+this.mode+"----empty_req="+empty_req+"-------requireSucess="+requireSucess);
boolean flag = apply_task(StatusEnum.QXXL_EMPTY_REQ.getCode()); boolean flag = apply_task(StatusEnum.QXXL_EMPTY_REQ.getCode());
this.noApplyTaskMessage = null; this.noApplyTaskMessage = null;
if (flag) { if (flag) {
@@ -311,11 +334,11 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
} }
//agv到达取货位 //agv到达取货位
if (agvphase == 0x03) { if (agvphase == 0x03) {
if (ObjectUtil.isNotEmpty(inst) && mode == 1 && move == 1 && is_up== 1) { if (ObjectUtil.isNotEmpty(inst) && mode == 1 && move == 1) {
inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode()); inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode());
instructionService.update(inst); instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0); byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data); OneNDCSocketConnectionAutoRun.write(data);
this.set(0, 0, null); this.set(0, 0, null);
noFeedAgvMessage = null; noFeedAgvMessage = null;
message = this.messageInfo(agvphase); message = this.messageInfo(agvphase);
@@ -337,13 +360,21 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
//agv取货完成 //agv取货完成
if (agvphase == 0x05) { if (agvphase == 0x05) {
if (ObjectUtil.isNotEmpty(inst) && mode == 1 && move == 0) { if (ObjectUtil.isNotEmpty(inst) && mode == 1 && is_up == 1) {
//下发取货位AGV取货完成
this.writing("to_agv_take_finish", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_GET_FINISH.getCode()); inst.setExecute_status(InstActionEnum.EXECUTE_GET_FINISH.getCode());
instructionService.update(inst); instructionService.update(inst);
//下发取货位AGV取货完成 if (inst != null) {
writing("to_agv_take_finish", "1"); TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
taskDto.setExt_param(new HashMap<>());
taskDto.getExt_param().put("take_finish", "1");
taskserver.update(taskDto);
}
}
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0); byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data); OneNDCSocketConnectionAutoRun.write(data);
this.set(0, 0, null); this.set(0, 0, null);
noFeedAgvMessage = null; noFeedAgvMessage = null;
message = this.messageInfo(agvphase); message = this.messageInfo(agvphase);
@@ -364,11 +395,11 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
} }
//agv到达放框位 //agv到达放框位
if (agvphase == 0x07) { if (agvphase == 0x07) {
if (ObjectUtil.isNotEmpty(inst) && mode == 1 && move == 0 && is_up== 1) { if (ObjectUtil.isNotEmpty(inst) && mode == 1 && move == 0 && is_up == 1) {
inst.setExecute_status(InstActionEnum.EXECUTE_TO_PUT_FALL_SEND_FULL.getCode()); inst.setExecute_status(InstActionEnum.EXECUTE_TO_PUT_FALL_SEND_FULL.getCode());
instructionService.update(inst); instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0); byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data); OneNDCSocketConnectionAutoRun.write(data);
this.set(0, 0, null); this.set(0, 0, null);
noFeedAgvMessage = null; noFeedAgvMessage = null;
message = this.messageInfo(agvphase); message = this.messageInfo(agvphase);
@@ -390,17 +421,32 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
//agv放框完成 //agv放框完成
if (agvphase == 0x09) { if (agvphase == 0x09) {
if (ObjectUtil.isNotEmpty(inst) && mode == 1 && move == 1 && is_up == 0) { if (ObjectUtil.isNotEmpty(inst) && mode == 1 && move == 1) {
inst.setExecute_status(InstActionEnum.EXECUTE_PUT_FALL_SEND_FULL_FINISH.getCode());
instructionService.update(inst);
//下发AGV放框完成 //下发AGV放框完成
writing("to_agv_release_finish", "1"); writing("to_agv_release_finish", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_PUT_FALL_SEND_FULL_FINISH.getCode());
instructionService.update(inst);
if (inst != null) {
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
taskDto.setExt_param(new HashMap<>());
taskDto.getExt_param().put("put_finish", "1");
taskserver.update(taskDto);
}
}
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0); byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data); OneNDCSocketConnectionAutoRun.write(data);
this.set(0, 0, null); this.set(0, 0, null);
noFeedAgvMessage = null; noFeedAgvMessage = null;
message = this.messageInfo(agvphase); message = this.messageInfo(agvphase);
logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase)); logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase));
try {
logServer.deviceExecuteLog(device_code, "", "", "PS20放完空框后延迟3秒去皮");
Thread.sleep(3000L);
this.writing("to_peel","1");
} catch (InterruptedException e) {
e.printStackTrace();
}
} else { } else {
String notFeedAgvMessage = ""; String notFeedAgvMessage = "";
if (mode != 1) { if (mode != 1) {
@@ -437,6 +483,12 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
last_open_ready_time = open_ready_time; last_open_ready_time = open_ready_time;
last_device_running_time = device_running_time; last_device_running_time = device_running_time;
last_await_time = await_time; last_await_time = await_time;
last_barcode_1 = barcode_1;
last_barcode_2 = barcode_2;
last_barcode_3 = barcode_3;
last_barcode_4 = barcode_4;
last_barcode = barcode;
} }
public String stringToascii(int num) { public String stringToascii(int num) {
@@ -664,9 +716,11 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
* @return * @return
*/ */
public synchronized boolean apply_task(String code) { public synchronized boolean apply_task(String code) {
logServer.deviceExecuteLog(device_code,"", "", "开始申请任务类型"+code+"mode="+this.mode+"----compel_full_req="+compel_full_req+"-------requireSucess="+requireSucess);
if (redisUtils.hasKey("apply:" + this.device_code)) { if (redisUtils.hasKey("apply:" + this.device_code)) {
return false; return false;
} else { } else {
logServer.deviceExecuteLog(device_code,"", "", "执行申请任务类型"+code+"mode="+this.mode+"----compel_full_req="+compel_full_req+"-------requireSucess="+requireSucess);
redisUtils.setExpire(this.device_code, null, ApplyTaskTime.APPLY_TIME, TimeUnit.SECONDS); redisUtils.setExpire(this.device_code, null, ApplyTaskTime.APPLY_TIME, TimeUnit.SECONDS);
JSONObject reqParam = new JSONObject(); JSONObject reqParam = new JSONObject();
reqParam.put("type", code); reqParam.put("type", code);
@@ -674,7 +728,7 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
reqParam.put("in_pcsn", this.getIn_pcsn()); reqParam.put("in_pcsn", this.getIn_pcsn());
reqParam.put("workorder_code", this.getIn_pcsn()); reqParam.put("workorder_code", this.getIn_pcsn());
reqParam.put("vehicle_code", this.getBarcode()); reqParam.put("vehicle_code", this.getBarcode());
reqParam.put("weight", this.getFull_weight()); reqParam.put("weight", this.getNow_weight());
reqParam.put("qty",this.getAll_num()); reqParam.put("qty",this.getAll_num());
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam); HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {