REV 修改

This commit is contained in:
2023-05-25 19:56:34 +08:00
29 changed files with 458 additions and 106 deletions

View File

@@ -42,6 +42,7 @@ public interface AcsConfig {
String ERPURL = "erpurl";
//是否存在wms系统
String HASWMS = "hasWms";
String ISFEEDDEVICESTATUS = "isFeedDeviceStatus";
//路由选择
String ROUTE = "route";
//忽略取放货校验

View File

@@ -0,0 +1,9 @@
package org.nl.acs.device_driver.basedriver.hailiang_one;
/**
* @author: geng by
* @createDate: 2023/5/24
*/
public class ApplyTaskTime {
public final static long APPLY_TIME = 30l;
}

View File

@@ -477,6 +477,18 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
//agv送满框1完毕或送满框2完毕
//需要判断缓存线工作模式联机对接位有货任务号不为0对接位条码正常才反馈agv以及电气放货完成
if (mode == 1 && move == 1 && task != 0 && prepare_barcode != 99999 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task) {
if (inst != null) {
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
if (docking_barcode != 0) {
taskDto.getExt_param().put("inbox", "" + docking_barcode);
}
taskDto.setVehicle_code(String.valueOf(docking_barcode));
taskserver.update(taskDto);
}
}
this.writing("to_agv_put_finish", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_PUT_FALL_SEND_FULL_FINISH.getCode());
instructionService.update(inst);
@@ -530,7 +542,7 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
} else if (agvphase == 0x10 || agvphase == 0x27) {
//agv取空框1完毕或取空框2完毕
if (mode == 1 && move == 0 && ObjectUtil.isNotEmpty(inst)) {
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_agv_get_finish", "1");
map.put("to_agv_put_finish", "0");
this.writing(map);
@@ -625,7 +637,7 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
instructionService.update(inst);
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_agv_get_finish", "1");
if (task == 0 || Integer.parseInt(inst.getTask_code()) == task) {
map.put("to_task_finish", "1");

View File

@@ -620,7 +620,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_pause, "专机暂停", "DB2.W22"));
list.add(new ItemDto(item_to_priority_layer, "优先层", "DB2.W24"));
list.add(new ItemDto(item_to_start_checking, "开始盘点", "DB2.W28"));
list.add(new ItemDto(item_to_check_finish, "盘点完成清零", "DB2.W30"));
list.add(new ItemDto(item_to_check_finish, "盘点强制完成", "DB2.W32"));
list.add(new ItemDto(item_to_pause_out_check, "暂停出箱匹配", "DB2.W34"));
list.add(new ItemDto(item_to_material_spec1, "物料规格1", "DB2.W40"));
list.add(new ItemDto(item_to_material_spec2, "物料规格2", "DB2.W42"));

View File

@@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device_driver.DeviceDriver;
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.IssuedDeviceOrderInfo;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_machine_storage_station.HailiangCleaningMachineStorageStationDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
@@ -28,10 +29,12 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.acs.order.service.impl.ProduceshiftorderServiceImpl;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* 海亮-清洗上料线体
@@ -51,6 +54,8 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
@Autowired
ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean(ProduceshiftorderServiceImpl.class);
@Autowired
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
//工作模式
int mode = 0;
//开机状态
@@ -167,7 +172,7 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
message = "未联机";
//有报警
} else {
// this.setIsonline(true);
// this.setIsonline(true);
this.setIserror(false);
//申请清洗上料
@@ -227,9 +232,7 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
* 上料完成以后反馈mes 上料设备号
*/
private boolean feedMesTaskClear() {
Date date = new Date();
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (redisUtils.hasKey(this.device_code)) {
return false;
} else {
this.writing("to_confirm_finished", "1");
@@ -260,17 +263,49 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
}
return false;
}
// Date date = new Date();
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
// return false;
// } else {
// this.writing("to_confirm_finished", "1");
// ProduceshiftorderDto dto = produceshiftorderService.findOrderByDeviceCode(this.getDevice_code());
// if (dto != null) {
// String[] in_devices = dto.getIn_devices().split(",");
// //上料完成清除储料仓内存中的物料信息
// Arrays.stream(in_devices).forEach(device_code -> {
// Device device = deviceAppService.findDeviceByCode(device_code);
// if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
// HailiangCleaningMachineStorageStationDeviceDriver hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
// hailiangCleaningMachineStorageStationDeviceDriver.setMaterial_code(null);
// }
// });
// //修改工单状态为执行中
// dto.setOrder_status("1");
// produceshiftorderService.update(dto);
// // TODO 反馈接口未确定
// JSONObject reqParam = new JSONObject();
// reqParam.put("device_code", this.getDevice_code());
// reqParam.put("type", StatusEnum.QX_FULL_REQ.getCode());
// reqParam.put("in_devices", dto.getIn_devices());
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
// requireSucess = true;
// return true;
// }
// }
// return false;
// }
}
/**
* 申请清洗上料
*/
private synchronized boolean applyForLoading() {
Date date = new Date();
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (redisUtils.hasKey("apply:" + this.device_code)) {
return false;
} else {
redisUtils.setExpire(this.device_code, null, ApplyTaskTime.APPLY_TIME, TimeUnit.SECONDS);
JSONObject reqParam = new JSONObject();
reqParam.put("device_code", this.getDevice_code());
reqParam.put("type", StatusEnum.QX_LACK_REQ.getCode());
@@ -282,6 +317,22 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
}
return false;
}
// Date date = new Date();
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
// return false;
// } else {
// JSONObject reqParam = new JSONObject();
// reqParam.put("device_code", this.getDevice_code());
// reqParam.put("type", StatusEnum.QX_LACK_REQ.getCode());
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
// this.writing("to_in_confirm_req", "1");
// requireSucess = true;
// return true;
// }
// return false;
// }
}
@@ -351,7 +402,7 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
}
}
//下发电气信号
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_all_num", String.valueOf(qtySum));
map.put("to_all_weight", String.valueOf(weightSum));
map.put("to_in_confirm_finish", "1");

View File

@@ -26,6 +26,7 @@ import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -184,7 +185,7 @@ public class HailiangCleaningMachineStorageStationDeviceDriver extends AbstractO
if (agvphase == 0x0D || agvphase == 0x11) {
if (ObjectUtil.isNotEmpty(inst)) {
//下发储料仓倒料数量及开始称重
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_dumping_num", inst.getQuantity());
map.put("to_open_weight", "1");
this.writing(map);

View File

@@ -23,10 +23,7 @@ import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 装箱机
@@ -269,7 +266,7 @@ public class EalingMachineDeviceDriver extends AbstractOpcDeviceDriver implement
x = xys[0];
y = xys[1];
}
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_clear", "1");
map.put("to_order", ealingOrderDto.getOrder_code());
map.put("to_order_box_num", ealingOrderDto.getOrder_box_num());
@@ -297,10 +294,11 @@ public class EalingMachineDeviceDriver extends AbstractOpcDeviceDriver implement
@Override
public void issuedOrderFinish(String autoFinish) {
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())){
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
this.writing("to_order_compel_finished", "1");
} else {
this.writing("to_confirm_finished", "1");
}
this.writing("to_confirm_finished", "1");
}
@Override

View File

@@ -14,6 +14,7 @@ import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun;
import org.nl.acs.device_driver.DeviceDriver;
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.IssuedDeviceOrderInfo;
import org.nl.acs.device_driver.basedriver.hailiang_one.MonitoringLargeScreenData;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
@@ -35,12 +36,15 @@ 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.impl.TaskServiceImpl;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* 海亮刻字机工位
@@ -64,6 +68,8 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
@Autowired
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
//线体状态
int status = 0;
@@ -542,11 +548,10 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
* @return
*/
public synchronized boolean apply_empty_task() {
Date date = new Date();
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (redisUtils.hasKey("apply:" + this.device_code)) {
return false;
} else {
redisUtils.setExpire(this.device_code, null, ApplyTaskTime.APPLY_TIME, TimeUnit.SECONDS);
ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
TaskDto taskDto = taskService.findByNextCode(device_code);
if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode()) && taskDto == null) {
@@ -562,6 +567,26 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
}
return false;
}
// Date date = new Date();
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
// return false;
// } else {
// ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
// TaskDto taskDto = taskService.findByNextCode(device_code);
// if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode()) && taskDto == null) {
// JSONObject reqParam = new JSONObject();
// reqParam.put("type", StatusEnum.KZ_EMPTY_REQ.getCode());
// reqParam.put("device_code", this.getDevice_code());
// reqParam.put("workorder_code", this.getOrder());
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
// requireSucess = true;
// return true;
// }
// }
// return false;
// }
}
/**
@@ -570,11 +595,10 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
* @return
*/
public synchronized boolean apply_task() {
Date date = new Date();
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (redisUtils.hasKey("apply:" + this.device_code)) {
return false;
} else {
redisUtils.setExpire(this.device_code, null, ApplyTaskTime.APPLY_TIME, TimeUnit.SECONDS);
ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
TaskDto taskDto = taskService.findByStartCode(device_code);
if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode()) && taskDto == null) {
@@ -594,6 +618,30 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
}
return false;
}
// Date date = new Date();
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
// return false;
// } else {
// ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
// TaskDto taskDto = taskService.findByStartCode(device_code);
// if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode()) && taskDto == null) {
// JSONObject reqParam = new JSONObject();
// reqParam.put("device_code", this.getDevice_code());
// reqParam.put("type", StatusEnum.KZ_FULL_REQ.getCode());
// reqParam.put("quantity", this.getPort_full_num());
// reqParam.put("workorder_code", this.getOrder());
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
// if (resp.getInteger("status") == 200) {
// requireSucess = true;
// return true;
// }
// }
// }
// return false;
// }
}
@@ -607,7 +655,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
// if (!this.getItemProtocol().getIsonline()) {
// throw new BadRequestException("设备未开机,工单下发失败!");
// }
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_clear", "1");
map.put("to_order", dto.getOrder_code());
map.put("to_one_box_num", String.valueOf(dto.getOne_qty()));
@@ -620,14 +668,14 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
*/
@Override
public void issuedOrderFinish(String autoFinish) {
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_order_compel_finished", "1");
} else {
map.put("to_confirm_finished", "1");
}
//map.put("to_order", "0");
//map.put("to_clear", "1");
map.put("to_clear", "1");
this.writing(map);
}

View File

@@ -31,6 +31,7 @@ import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
@@ -307,7 +308,7 @@ public class HailiangOldSpecialDeviceDriver extends AbstractOpcDeviceDriver impl
// if (!this.getItemProtocol().getIsonline()) {
// throw new BadRequestException("设备未开机,开工失败!");
// }
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_clear", "1");
map.put("to_order", dto.getOrder_code());
map.put("to_one_box_num", String.valueOf(dto.getOne_qty()));
@@ -321,14 +322,14 @@ public class HailiangOldSpecialDeviceDriver extends AbstractOpcDeviceDriver impl
*/
@Override
public void issuedOrderFinish(String autoFinish) {
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_order_compel_finished", "1");
} else {
map.put("to_confirm_finished", "1");
}
//map.put("to_order", "0");
//map.put("to_clear", "1");
map.put("to_clear", "1");
this.writing(map);
}

View File

@@ -22,6 +22,8 @@ import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
@@ -42,7 +44,8 @@ public class HailiangOldSpecialEmptyStationDeviceDriver extends AbstractOpcDevic
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
@Autowired
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
String device_code;
@@ -180,6 +183,13 @@ public class HailiangOldSpecialEmptyStationDeviceDriver extends AbstractOpcDevic
this.writing("to_agv_finish", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_PUT_EMPTY_FINISH.getCode());
instructionService.update(inst);
if (inst != null) {
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
taskDto.getExt_param().put("put_finish", "1");
taskserver.update(taskDto);
}
}
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
this.set(0, 0, null);

View File

@@ -13,6 +13,7 @@ import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.ApplyTaskTime;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
@@ -30,10 +31,14 @@ import org.nl.acs.opc.Device;
import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.acs.order.service.impl.ProduceshiftorderServiceImpl;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* 海亮老车间专机设备满框位
@@ -55,7 +60,10 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired
ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean(ProduceshiftorderServiceImpl.class);
@Autowired
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
@Autowired
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
int mode = 0;
int error = 0;
int move = 0;
@@ -166,7 +174,7 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
message = "未联机";
//有报警
} else {
// this.setIsonline(true);
// this.setIsonline(true);
this.setIserror(false);
message = "";
@@ -231,6 +239,13 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
writing("to_agv_finish", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_GET_FINISH.getCode());
instructionService.update(inst);
if (inst != null) {
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
taskDto.getExt_param().put("take_finish", "1");
taskserver.update(taskDto);
}
}
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
this.set(0, 0, null);
@@ -267,11 +282,10 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
* @return
*/
public synchronized boolean apply_task() {
Date date = new Date();
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (redisUtils.hasKey("apply:" + this.device_code)) {
return false;
} else {
redisUtils.setExpire(this.device_code, null, ApplyTaskTime.APPLY_TIME, TimeUnit.SECONDS);
//判断是否需要AGV搬运 需要就申请任务 不需要不申请
ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(this.getOrder()));
if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode())) {
@@ -291,6 +305,30 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
}
return false;
}
// Date date = new Date();
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
// return false;
// } else {
// //判断是否需要AGV搬运 需要就申请任务 不需要不申请
// ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(this.getOrder()));
// if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode())) {
// JSONObject reqParam = new JSONObject();
// reqParam.put("device_code", this.getDevice_code());
// reqParam.put("type", StatusEnum.FULL_REQ.getCode());
// reqParam.put("quantity", this.getFull_number());
// reqParam.put("workorder_code", this.getOrder());
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
// if (resp.getInteger("status") == 200) {
// requireSucess = true;
// return true;
// }
// }
// }
// return false;
// }
}

View File

@@ -13,6 +13,7 @@ import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
import org.nl.acs.device_driver.DeviceDriver;
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.MonitoringLargeScreenData;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
@@ -31,10 +32,12 @@ import org.nl.acs.opc.Device;
import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.acs.order.service.impl.ProduceshiftorderServiceImpl;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* 海亮专机设备倒料位
@@ -56,6 +59,8 @@ public class HailiangOldSpecialPourStationDeviceDriver extends AbstractOpcDevice
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired
ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean(ProduceshiftorderServiceImpl.class);
@Autowired
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
private Date instruction_require_time = new Date();
private int instruction_require_time_out = 3000;
@@ -239,11 +244,10 @@ public class HailiangOldSpecialPourStationDeviceDriver extends AbstractOpcDevice
* @return
*/
public synchronized boolean applyOutCacheLineTask() {
Date date = new Date();
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (redisUtils.hasKey("apply:" + this.device_code)) {
return false;
} else {
redisUtils.setExpire(this.device_code, null, ApplyTaskTime.APPLY_TIME, TimeUnit.SECONDS);
ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode())) {
JSONObject reqParam = new JSONObject();
@@ -261,6 +265,28 @@ public class HailiangOldSpecialPourStationDeviceDriver extends AbstractOpcDevice
}
return false;
}
// Date date = new Date();
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
// return false;
// } else {
// ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
// if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode())) {
// JSONObject reqParam = new JSONObject();
// reqParam.put("device_code", this.getDevice_code());
// reqParam.put("type", StatusEnum.LACK_REQ.getCode());
// reqParam.put("workorder_code", this.getOrder());
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
// if (httpResponse != null && httpResponse.getStatus() == 200) {
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
// if (resp.getInteger("status") == 200) {
// requireSucess = true;
// return true;
// }
// }
// }
// return false;
// }
}

View File

@@ -15,6 +15,7 @@ import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun;
import org.nl.acs.device_driver.DeviceDriver;
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.IssuedDeviceOrderInfo;
import org.nl.acs.device_driver.basedriver.hailiang_one.MonitoringLargeScreenData;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
@@ -36,12 +37,15 @@ 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.impl.TaskServiceImpl;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* 海亮包装机工位
@@ -65,6 +69,8 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
@Autowired
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
int heartbeat = 0;
int running = 0;
@@ -512,11 +518,10 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
* @return
*/
public synchronized boolean apply_take_empty_task() {
Date date = new Date();
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (redisUtils.hasKey("apply:" + this.device_code)) {
return false;
} else {
redisUtils.setExpire(this.device_code, null, ApplyTaskTime.APPLY_TIME, TimeUnit.SECONDS);
ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
TaskDto taskDto = taskService.findByStartCode(device_code);
if (produceshiftorderDto != null && produceshiftorderDto.getIs_needmove().equals(StatusEnum.NEED_MOVE.getCode()) && taskDto == null) {
@@ -532,6 +537,26 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
}
return false;
}
// Date date = new Date();
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
// return false;
// } else {
// ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
// TaskDto taskDto = taskService.findByStartCode(device_code);
// if (produceshiftorderDto != null && produceshiftorderDto.getIs_needmove().equals(StatusEnum.NEED_MOVE.getCode()) && taskDto == null) {
// JSONObject reqParam = new JSONObject();
// reqParam.put("device_code", this.getDevice_code());
// reqParam.put("type", StatusEnum.BZ_EMPTY_REQ.getCode());
// reqParam.put("workorder_code", this.getOrder());
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
// requireSucess = true;
// return true;
// }
// }
// return false;
// }
}
/**
@@ -540,11 +565,10 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
* @return
*/
public synchronized boolean apply_task() {
Date date = new Date();
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (redisUtils.hasKey("apply:" + this.device_code)) {
return false;
} else {
redisUtils.setExpire(this.device_code, null, ApplyTaskTime.APPLY_TIME, TimeUnit.SECONDS);
ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
TaskDto taskDto = taskService.findByNextCode(device_code);
if (produceshiftorderDto != null && produceshiftorderDto.getIs_needmove().equals(StatusEnum.NEED_MOVE.getCode()) && taskDto == null) {
@@ -563,6 +587,29 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
}
return false;
}
// Date date = new Date();
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
// return false;
// } else {
// ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
// TaskDto taskDto = taskService.findByNextCode(device_code);
// if (produceshiftorderDto != null && produceshiftorderDto.getIs_needmove().equals(StatusEnum.NEED_MOVE.getCode()) && taskDto == null) {
// JSONObject reqParam = new JSONObject();
// reqParam.put("device_code", this.getDevice_code());
// reqParam.put("type", StatusEnum.BZ_FULL_REQ.getCode());
// reqParam.put("workorder_code", this.getOrder());
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
// if (resp.getInteger("status") == 200) {
// requireSucess = true;
// return true;
// }
// }
// }
// return false;
// }
}
@@ -581,7 +628,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
// if (!this.getItemProtocol().getIsonline()) {
// throw new BadRequestException("设备未开机,工单下发失败");
// }
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_clear", "1");
map.put("to_order", dto.getOrder_code());
map.put("to_order_prod_num", String.valueOf(dto.getQty()));
@@ -593,14 +640,14 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
*/
@Override
public void issuedOrderFinish(String autoFinish) {
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_order_compel_finished", "1");
} else {
map.put("to_confirm_finished", "1");
}
//map.put("to_order", "0");
//map.put("to_clear", "1");
map.put("to_clear", "1");
this.writing(map);
}

View File

@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
@@ -86,7 +87,7 @@ public class SealingMachineDeviceDriver extends AbstractOpcDeviceDriver implemen
if (ealingOrderDto != null) {
String is_auto_confirm = ealingOrderDto.getIs_auto_confirm();
String time = ealingOrderDto.getTime();
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_is_auto_confirm", is_auto_confirm);
map.put("to_time", time);
this.writing(map);

View File

@@ -33,6 +33,7 @@ import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
@@ -131,31 +132,38 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
if (mode == 1 && finish == 1) {
MonitoringLargeScreenData.orderData.put(String.valueOf(order), -1);
}
luceneExecuteLogService.deviceExecuteLog(new LuceneLogDto(this.getDevice().getOpc_server_code(), this.getDevice().getOpc_plc_code(), this.device_code, ItemProtocol.item_finish, String.valueOf(this.last_finish), String.valueOf(this.finish)));
logServer.deviceExecuteLog(this.device_code, "", "", "信号finish" + last_finish + "->" + finish);
}
if (order_compel_finish != last_order_compel_finish) {
luceneExecuteLogService.deviceExecuteLog(new LuceneLogDto(this.getDevice().getOpc_server_code(), this.getDevice().getOpc_plc_code(), this.device_code, ItemProtocol.item_order_compel_finish, String.valueOf(this.last_order_compel_finish), String.valueOf(this.order_compel_finish)));
logServer.deviceExecuteLog(this.device_code, "", "", "信号order_compel_finish" + last_order_compel_finish + "->" + order_compel_finish);
}
if (order != last_order) {
luceneExecuteLogService.deviceExecuteLog(new LuceneLogDto(this.getDevice().getOpc_server_code(), this.getDevice().getOpc_plc_code(), this.device_code, ItemProtocol.item_order, String.valueOf(this.last_order), String.valueOf(this.order)));
logServer.deviceExecuteLog(this.device_code, "", "", "信号order" + last_order + "->" + order);
}
if (now_order_prod_num != last_now_order_prod_num) {
if (mode == 1 && order > 0) {
MonitoringLargeScreenData.orderData.put(String.valueOf(order), now_order_prod_num);
}
luceneExecuteLogService.deviceExecuteLog(new LuceneLogDto(this.getDevice().getOpc_server_code(), this.getDevice().getOpc_plc_code(), this.device_code, ItemProtocol.item_now_order_prod_num, String.valueOf(this.last_now_order_prod_num), String.valueOf(this.now_order_prod_num)));
logServer.deviceExecuteLog(this.device_code, "", "", "信号now_order_prod_num" + last_now_order_prod_num + "->" + now_order_prod_num);
}
if (now_one_box_num != last_now_one_box_num) {
luceneExecuteLogService.deviceExecuteLog(new LuceneLogDto(this.getDevice().getOpc_server_code(), this.getDevice().getOpc_plc_code(), this.device_code, ItemProtocol.item_now_one_box_num, String.valueOf(this.last_now_one_box_num), String.valueOf(this.now_one_box_num)));
logServer.deviceExecuteLog(this.device_code, "", "", "信号now_one_box_num" + last_now_one_box_num + "->" + now_one_box_num);
}
if (line_stock_num != last_line_stock_num) {
luceneExecuteLogService.deviceExecuteLog(new LuceneLogDto(this.getDevice().getOpc_server_code(), this.getDevice().getOpc_plc_code(), this.device_code, ItemProtocol.item_line_stock_num, String.valueOf(this.last_line_stock_num), String.valueOf(this.line_stock_num)));
logServer.deviceExecuteLog(this.device_code, "", "", "信号line_stock_num" + last_line_stock_num + "->" + line_stock_num);
}
if (order_prod_allnum != last_order_prod_allnum) {
luceneExecuteLogService.deviceExecuteLog(new LuceneLogDto(this.getDevice().getOpc_server_code(), this.getDevice().getOpc_plc_code(), this.device_code, ItemProtocol.item_order_prod_allnum, String.valueOf(this.last_order_prod_allnum), String.valueOf(this.order_prod_allnum)));
logServer.deviceExecuteLog(this.device_code, "", "", "信号order_prod_allnum" + last_order_prod_allnum + "->" + order_prod_allnum);
}
@@ -274,7 +282,7 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
// if (!this.getItemProtocol().getIsonline()) {
// throw new BadRequestException("设备未开机,开工失败!");
// }
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_clear", "1");
map.put("to_order", dto.getOrder_code());
map.put("to_one_box_num", String.valueOf(dto.getOne_qty()));
@@ -288,14 +296,14 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
*/
@Override
public void issuedOrderFinish(String autoFinish) {
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_order_compel_finished", "1");
} else {
map.put("to_confirm_finished", "1");
}
//map.put("to_order", "0");
//map.put("to_clear", "1");
map.put("to_clear", "1");
this.writing(map);
}

View File

@@ -22,6 +22,8 @@ import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
@@ -41,7 +43,8 @@ public class HailiangSpecialEmptyStationDeviceDriver extends AbstractOpcDeviceDr
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class);
@Autowired
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
String device_code;
@@ -180,6 +183,13 @@ public class HailiangSpecialEmptyStationDeviceDriver extends AbstractOpcDeviceDr
if (mode == 1 && move == 0 && ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status(InstActionEnum.EXECUTE_PUT_EMPTY_FINISH.getCode());
instructionService.update(inst);
if (inst != null) {
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
taskDto.getExt_param().put("put_finish", "1");
taskserver.update(taskDto);
}
}
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
this.set(0, 0, null);

View File

@@ -13,6 +13,7 @@ import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.ApplyTaskTime;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
@@ -30,10 +31,14 @@ import org.nl.acs.opc.Device;
import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.acs.order.service.impl.ProduceshiftorderServiceImpl;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* 海亮专机设备满框位
@@ -55,8 +60,10 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired
ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean(ProduceshiftorderServiceImpl.class);
@Autowired
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
@Autowired
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
int mode = 0;
int error = 0;
int move = 0;
@@ -153,9 +160,6 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
logServer.deviceExecuteLog(this.device_code, "", "", "信号order" + last_order + "->" + order);
}
if (device_code.equals("A1_XY_50_8_M")) {
logServer.deviceExecuteLog(device_code, "", "", "进来了........");
}
} catch (Exception var17) {
var17.printStackTrace();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17 + ",inst == null :" + ObjectUtil.isEmpty(inst));
@@ -236,6 +240,13 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
this.writing("to_agv_finish", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_GET_FINISH.getCode());
instructionService.update(inst);
if (inst != null) {
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
taskDto.getExt_param().put("take_finish", "1");
taskserver.update(taskDto);
}
}
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
NDCSocketConnectionAutoRun.write(data);
this.set(0, 0, null);
@@ -274,11 +285,11 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
* @return
*/
public synchronized boolean apply_task() {
Date date = new Date();
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (redisUtils.hasKey("apply:" + this.device_code)) {
return false;
} else {
redisUtils.setExpire(this.device_code, null, ApplyTaskTime.APPLY_TIME, TimeUnit.SECONDS);
//判断是否需要AGV搬运 需要就申请任务 不需要不申请
JSONObject reqParam = new JSONObject();
ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(this.getOrder()));
@@ -298,6 +309,31 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
}
return false;
}
// Date date = new Date();
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
// return false;
// } else {
// //判断是否需要AGV搬运 需要就申请任务 不需要不申请
// JSONObject reqParam = new JSONObject();
// ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(this.getOrder()));
// if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode())) {
// reqParam.put("type", StatusEnum.FULL_REQ.getCode());
// reqParam.put("device_code", this.getDevice_code());
// reqParam.put("quantity", this.getFull_number());
// reqParam.put("workorder_code", this.getOrder());
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
// if (resp.getInteger("status") == 200) {
// requireSucess = true;
// return true;
// }
// }
// }
// return false;
// }
}

View File

@@ -13,6 +13,7 @@ import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
import org.nl.acs.device_driver.DeviceDriver;
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.MonitoringLargeScreenData;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
@@ -31,10 +32,12 @@ import org.nl.acs.opc.Device;
import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.acs.order.service.impl.ProduceshiftorderServiceImpl;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* 海亮专机设备倒料位
@@ -56,7 +59,8 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired
ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean(ProduceshiftorderServiceImpl.class);
@Autowired
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
private int instruction_require_time_out = 3000;
int mode = 0;
@@ -243,11 +247,10 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
* @return
*/
public synchronized boolean applyOutCacheLineTask() {
Date date = new Date();
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (redisUtils.hasKey("apply:" + this.device_code)) {
return false;
} else {
redisUtils.setExpire(this.device_code, null, ApplyTaskTime.APPLY_TIME, TimeUnit.SECONDS);
ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode())) {
JSONObject reqParam = new JSONObject();
@@ -269,6 +272,32 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
}
return false;
}
// Date date = new Date();
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
// return false;
// } else {
// ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
// if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode())) {
// JSONObject reqParam = new JSONObject();
// reqParam.put("device_code", this.getDevice_code());
// reqParam.put("type", StatusEnum.LACK_REQ.getCode());
// reqParam.put("workorder_code", this.getOrder());
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
// if (httpResponse != null && httpResponse.getStatus() == 200) {
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
// if (resp.getInteger("status") == 200) {
// requireSucess = true;
// return true;
// } else {
// message = "申请任务失败,原因:" + resp.getString("message");
// }
// } else {
// message = "申请任务失败,原因:接口不通!";
// }
// }
// return false;
// }
}

View File

@@ -31,6 +31,7 @@ import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
@@ -400,7 +401,7 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
if (StrUtil.isEmpty(dto.getTray_num())) {
dto.setTray_num("1");
}
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_clear", "1");
map.put("to_order", dto.getOrder_code());
map.put("to_order_prod_num", dto.getQty().toString());
@@ -414,7 +415,7 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
*/
@Override
public void issuedOrderFinish(String autoFinish) {
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_compel_finish", "1");
} else {

View File

@@ -25,6 +25,7 @@ import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -196,7 +197,7 @@ public class UnboxingMachineDeviceDriver extends AbstractOpcDeviceDriver impleme
EalingOrderDto ealingOrderDto = dto.getEalingOrderDto();
if (ealingOrderDto != null) {
String is_foreward = ealingOrderDto.getIs_foreward();
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_clear", "1");
map.put("to_is_foreward", is_foreward);
map.put("to_order_box_num", ealingOrderDto.getOrder_box_num());

View File

@@ -165,10 +165,8 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
* @param map
*/
public void writing(Map<String, Object> map) {
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
LuceneExecuteLogService lucene = SpringContextHolder.getBean(LuceneExecuteLogService.class);
Map<String, Object> itemMap = new HashMap<String, Object>();
Map<String, Object> itemMap = new LinkedHashMap<>();
map.forEach((key, value) -> {
if (ObjectUtil.isNotEmpty(value)) {
itemMap.put(getToParam() + key, value);
@@ -177,7 +175,6 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
if (ObjectUtil.isNotEmpty(itemMap)) {
this.control(itemMap);
lucene.deviceExecuteLog(new LuceneLogDto(this.getDeviceCode(),"下发多个电气信号:" + itemMap));
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
}
}

View File

@@ -120,10 +120,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public HttpResponse feedDeviceStatusType(JSONObject param) {
log.info("acs开始向mes反馈设备状态,请求参数:{}", JSON.toJSONString(param));
try {
MDC.put(log_file_type, log_type);
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1") && StrUtil.equals(paramService.findByCode(AcsConfig.ISFEEDDEVICESTATUS).getValue(), "1")) {
log.info("acs开始向mes反馈设备状态,请求参数:{}", JSON.toJSONString(param));
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("feedDeviceStatusType");
String methods_url = addressDto.getMethods_url();
@@ -597,7 +597,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
JSONObject jo = JSONObject.parseObject(result.body());
return jo;
} finally {
} finally {
MDC.remove(log_file_type);
}
}

View File

@@ -248,25 +248,33 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
String unboxing_device_code = param.getString("unboxing_device_code");
Map<String, Object> extra_map = param.getJSONObject("extra_map");
//老车间包装工单信息
//每箱袋数
String one_box_package_qty = extra_map.get("one_box_package_qty").toString();
//袋数
String package_qty = extra_map.get("package_qty").toString();
//每袋数量
String one_package_qty = extra_map.get("one_package_qty").toString();
//箱数
String box_num = extra_map.get("box_num").toString();
//箱型
String box_type = extra_map.get("box_type").toString();
//目标巷道
String target_roadway = extra_map.get("target_roadway").toString();
//是否翻转
String is_flip = extra_map.get("is_flip").toString();
//托盘满托数量
String tray_full_num = extra_map.get("tray_full_num").toString();
String one_box_package_qty = "";
String package_qty = "";
String one_package_qty = "";
String box_num = "";
String box_type = "";
String target_roadway = "";
String is_flip = "";
String tray_full_num = "";
if (ObjectUtil.isNotEmpty(extra_map)) {
//老车间包装工单信息
//每箱袋数
one_box_package_qty = extra_map.get("one_box_package_qty").toString();
//袋数
package_qty = extra_map.get("package_qty").toString();
//每袋数量
one_package_qty = extra_map.get("one_package_qty").toString();
//箱数
box_num = extra_map.get("box_num").toString();
//箱型
box_type = extra_map.get("box_type").toString();
//目标巷道
target_roadway = extra_map.get("target_roadway").toString();
//是否翻转
is_flip = extra_map.get("is_flip").toString();
//托盘满托数量
tray_full_num = extra_map.get("tray_full_num").toString();
}
Map<String, Object> params = param.getJSONObject("params");
EalingOrderDto ealingOrderDto = null;
@@ -700,6 +708,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
if (device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
hailiangAutoCacheLineDeviceDriver.writing(code, value);
if (code.equals("to_start_checking")) {
hailiangAutoCacheLineDeviceDriver.writing("to_task", "1001");
}
}
}
JSONObject resultJson = new JSONObject();

View File

@@ -3,6 +3,8 @@ package org.nl.acs.task.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* @author ldjun
@@ -309,4 +311,6 @@ public class TaskDto implements Serializable {
*/
private String material_code;
private Map<String, String> ext_param = new HashMap<>();
}

View File

@@ -83,6 +83,15 @@ public class RedisUtils {
return true;
}
public void setExpire(String key, Object value, long time, TimeUnit timeUnit) {
try {
redisTemplate.opsForValue().set("apply:" + key, null, time, timeUnit);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
/**
* 根据 key 获取过期时间
*
@@ -216,7 +225,7 @@ public class RedisUtils {
public List<Object> multiGet(List<String> keys) {
List list = redisTemplate.opsForValue().multiGet(Sets.newHashSet(keys));
List resultList = Lists.newArrayList();
Optional.ofNullable(list).ifPresent(e-> list.forEach(ele-> Optional.ofNullable(ele).ifPresent(resultList::add)));
Optional.ofNullable(list).ifPresent(e -> list.forEach(ele -> Optional.ofNullable(ele).ifPresent(resultList::add)));
return resultList;
}

View File

@@ -13,11 +13,11 @@ spring:
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:lzhl_one_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hl_acs_one_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.225}:${DB_PORT:3306}/${DB_NAME:hl_acs_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
# password: ${DB_PWD:P@ssw0rd}
# password: ${DB_PWD:Root.123456}
password: ${DB_PWD:password}
password: ${DB_PWD:123456}
# 初始连接数
initial-size: 5

View File

@@ -1,5 +1,5 @@
server:
port: 8011
port: 8089
tomcat:
accept-count: 1000
max-connections: 10000
@@ -168,4 +168,4 @@ sa-token:
loki:
url: http://localhost:3100/loki/api/v1
systemName: acs
systemName: acs_test

View File

@@ -1,14 +1,14 @@
server:
port: 8011
port: 8089
#配置数据源
spring:
datasource:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:hl_one_acs2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.225}:${DB_PORT:3306}/${DB_NAME:hl_acs_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root}
password: ${DB_PWD:Root.123456}
password: ${DB_PWD:123456}
# 初始连接数
initial-size: 5
# 最小连接数
@@ -135,8 +135,11 @@ file:
avatarMaxSize: 5
logging:
file:
path: /app/jar/logs
path: E:\acs_log
config: classpath:logback-spring.xml
lucene:
index:
path: D:\lucene\index
# Sa-Token配置
sa-token:
@@ -160,4 +163,4 @@ sa-token:
loki:
url: http://localhost:3100/loki/api/v1
systemName: acs
systemName: acs_test

View File

@@ -2,7 +2,7 @@ spring:
freemarker:
check-template-location: false
profiles:
active: dev
active: prod
jackson:
time-zone: GMT+8
data: