更新
This commit is contained in:
@@ -16,6 +16,7 @@ import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.Empty
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test.HailiangSmartplcTestDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.haokai_auto_conveyor.HaoKaiAutoConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.paint_conveyor.PaintConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
@@ -38,6 +39,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
private final ParamService paramService;
|
||||
private final TaskService taskService;
|
||||
private final InstructionService instructionService;
|
||||
|
||||
@LokiLog(type = LokiLogType.AGV)
|
||||
@Override
|
||||
public HttpResponse sendAgvInstToAgv(Instruction inst) throws Exception {
|
||||
@@ -127,6 +129,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.AGV)
|
||||
@Override
|
||||
//ZDAGV
|
||||
@@ -212,7 +215,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
is_feedback = true;
|
||||
|
||||
}
|
||||
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver){
|
||||
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
is_feedback = true;
|
||||
}
|
||||
}
|
||||
@@ -251,7 +254,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
paintConveyorDeviceDriver.writing(2);
|
||||
is_feedback = true;
|
||||
}
|
||||
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver){
|
||||
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
is_feedback = true;
|
||||
}
|
||||
|
||||
@@ -264,17 +267,17 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
jo.put("task_code", inst.getInstruction_code());
|
||||
JSONArray destinations = new JSONArray();
|
||||
String inst_type = inst.getInstruction_type();
|
||||
String resp = acsToWmsService.requestTaskAgain(address,task.getExt_task_id(),inst.getVehicle_code());
|
||||
String resp = acsToWmsService.requestTaskAgain(address, task.getExt_task_id(), inst.getVehicle_code());
|
||||
JSONObject respjson = JSONObject.parseObject(resp);
|
||||
|
||||
if(StrUtil.equals(inst.getInstruction_type(),"3")){
|
||||
if (StrUtil.equals(inst.getInstruction_type(), "3")) {
|
||||
//2楼AGV起点追加任务
|
||||
String start_device_code = respjson.getString("device_code");
|
||||
String next_device_code = inst.getNext_device_code();
|
||||
destinations.add(destination(start_device_code, "Load", "1", "1"));
|
||||
destinations.add(destination(next_device_code, "Unload", "1", "1"));
|
||||
|
||||
} else if(StrUtil.equals(inst.getInstruction_type(),"4")){
|
||||
} else if (StrUtil.equals(inst.getInstruction_type(), "4")) {
|
||||
//2楼AGV终点追加任务
|
||||
String next_device_code = respjson.getString("device_code");
|
||||
destinations.add(destination(next_device_code, "Unload", "1", "1"));
|
||||
@@ -362,11 +365,18 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
|
||||
}
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver){
|
||||
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
is_feedback = true;
|
||||
}
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
is_feedback = true;
|
||||
}
|
||||
}
|
||||
if ("PauseOnStation".equals(type)) {
|
||||
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
is_feedback = true;
|
||||
}
|
||||
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
|
||||
// hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver();
|
||||
// inst.setExecute_status("4");
|
||||
@@ -401,7 +411,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
// paintConveyorDeviceDriver.writing(3);
|
||||
is_feedback = true;
|
||||
}
|
||||
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver){
|
||||
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
is_feedback = true;
|
||||
}
|
||||
}
|
||||
@@ -434,6 +444,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
return requestjo.toString();
|
||||
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.AGV)
|
||||
@Override
|
||||
public HttpResponse markComplete(String code) {
|
||||
@@ -578,7 +589,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL2).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT2).getValue();
|
||||
Instruction instruction = instructionService.findByCode(instCode);
|
||||
if (instruction.getInstruction_type().equals("1")){
|
||||
if (instruction.getInstruction_type().equals("1")) {
|
||||
agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
}
|
||||
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/" + instCode + "/withdrawal";
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.*;
|
||||
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
|
||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||
import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.EmptyVehicleStackingPositionDeviceDriver;
|
||||
@@ -27,6 +28,7 @@ import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanne
|
||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
@@ -77,7 +79,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
RouteLineService routeLineService;
|
||||
@Autowired
|
||||
TaskService taskService;
|
||||
|
||||
@Autowired
|
||||
DeviceExecuteLogService logServer;
|
||||
|
||||
@Override
|
||||
public void autoInitial() {
|
||||
@@ -381,18 +384,23 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
throw new BadRequestException("未查询到相关路由!");
|
||||
}
|
||||
if (startdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
|
||||
logServer.createInstInfo("创建指令", task_code, start_device_code, next_device_code, "开始创建取叠盘架指令~");
|
||||
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) startdevice.getDeviceDriver();
|
||||
//已经生成指令得取空托盘数量
|
||||
Integer emptyNum = taskService.queryStartNum(dto.getStart_device_code(), dto.getNext_device_code());
|
||||
logServer.createInstInfo("创建指令", task_code, start_device_code, next_device_code, "查询到同一起点任务已经生成指令的搬运托盘的数量为:" + emptyNum);
|
||||
//当前任务取得空托盘数量
|
||||
Integer now_need_emptypallet_num = Integer.parseInt(taskService.findByCode(dto.getTask_code()).getEmptypallet_num());
|
||||
logServer.createInstInfo("创建指令", task_code, start_device_code, next_device_code, "当前任务需要搬运空托盘数量:" + now_need_emptypallet_num);
|
||||
//当前叠盘架有空托盘数量
|
||||
int now_number = emptyVehicleStackingPositionDeviceDriver.getNumber();
|
||||
if (now_number == 0){
|
||||
now_number = 1;
|
||||
logServer.createInstInfo("创建指令", task_code, start_device_code, next_device_code, "当前叠盘架上空托盘数量为:" + now_number);
|
||||
if (now_number == 0) {
|
||||
throw new BadRequestException("当前叠盘架:" + dto.getStart_device_code() + "叠盘数为0!");
|
||||
}
|
||||
//判断从第几层取
|
||||
int i = now_number - now_need_emptypallet_num - emptyNum + 1;
|
||||
logServer.createInstInfo("创建指令", task_code, start_device_code, next_device_code, "该任务需要从第:" + i + "层取,即当前叠盘架上空托盘数量" + now_number + "-当前任务需要搬运的托盘数量" + now_need_emptypallet_num + "-已经生成指令的同一起点的托盘数量" + emptyNum + "+ 1");
|
||||
if (i <= 0) {
|
||||
throw new BadRequestException("当前叠盘架:" + dto.getStart_device_code() + "叠盘数为0!");
|
||||
}
|
||||
@@ -401,16 +409,22 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
dto.setStart_point_code(start_device_code + "." + i);
|
||||
}
|
||||
if (nextdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
|
||||
logServer.createInstInfo("创建指令", task_code, start_device_code, next_device_code, "开始创建放叠盘架指令~");
|
||||
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) startdevice.getDeviceDriver();
|
||||
//已经生成指令得放空托盘数量
|
||||
Integer emptyNum = taskService.queryEndNum(dto.getStart_device_code(), dto.getNext_device_code());
|
||||
logServer.createInstInfo("创建指令", task_code, start_device_code, next_device_code, "查询到同一终点任务已经生成指令的搬运托盘的数量为:" + emptyNum);
|
||||
//当前任务放空托盘数量
|
||||
Integer now_need_emptypallet_num = Integer.parseInt(taskService.findByCode(dto.getTask_code()).getEmptypallet_num());
|
||||
logServer.createInstInfo("创建指令", task_code, start_device_code, next_device_code, "当前任务需要放空托盘数量:" + now_need_emptypallet_num);
|
||||
//当前叠盘架有空托盘数量
|
||||
int now_number = emptyVehicleStackingPositionDeviceDriver.getNumber();
|
||||
logServer.createInstInfo("创建指令", task_code, start_device_code, next_device_code, "当前放叠盘架上空托盘数量为:" + now_number);
|
||||
int i = now_number + emptyNum + 1;
|
||||
logServer.createInstInfo("创建指令", task_code, start_device_code, next_device_code, "该任务需要从第:" + i + "层放,即当前叠盘架上空托盘数量" + now_number + "-已经生成指令的同一终点的托盘数量" + emptyNum + "+ 1");
|
||||
//判断当前放叠盘架位置叠盘数量+已经生成指令的需要搬运的叠盘数量是否大于最大叠盘数量
|
||||
if (i - 1 + now_need_emptypallet_num > 12) {
|
||||
logServer.createInstInfo("创建指令", task_code, start_device_code, next_device_code, "该任务需要放的托盘数量加原有的托盘数量之和大于叠盘架最大数量!");
|
||||
throw new BadRequestException("当前叠盘架:" + dto.getStart_device_code() + "超出最大叠盘数量!");
|
||||
}
|
||||
dto.setNext_device_code(next_device_code + "." + i);
|
||||
|
||||
@@ -23,7 +23,9 @@ public interface DeviceExecuteLogService {
|
||||
|
||||
void acsToLms(String title, String requestUrl, String requestParam, String responseCode, String responseMessage);
|
||||
|
||||
void acsToLms(String title,String requestUrl,String requestParam,String result);
|
||||
void acsToLms(String title, String requestUrl, String requestParam, String result);
|
||||
|
||||
void lmsToAcs(String title, String requestType, String requestParam);
|
||||
|
||||
void createInstInfo(String title, String task_code, String start_device_code, String end_device_code, String message);
|
||||
}
|
||||
|
||||
@@ -71,6 +71,16 @@ public class DeviceExecuteLogServiceImpl implements DeviceExecuteLogService {
|
||||
MDC.remove("device_code_log");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createInstInfo(String title, String task_code, String start_device_code, String end_device_code, String message) {
|
||||
try {
|
||||
MDC.put("device_code_log", title);
|
||||
log.info("日志主题:{},任务号:{},起始点位:{},终点点位:{},消息:{}", title, task_code, start_device_code, end_device_code, message);
|
||||
} finally {
|
||||
MDC.remove("device_code_log");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user