更新
This commit is contained in:
@@ -163,7 +163,7 @@ public class AbstractDriverService<T> implements DriverDeviceService {
|
||||
Method methodMode = driverClass.getMethod("getMode");
|
||||
Integer nowMode = (Integer) methodMode.invoke(driver);
|
||||
Integer nowMove = (Integer) methodMove.invoke(driver);
|
||||
if (nowMode != mode || nowMove != move) {
|
||||
if (nowMove != move) {
|
||||
log.info("指令创建失败,起点mode或move不满足条件! 任务号:" + taskDto.getTask_code() + ",终点:" + startDeviceCode);
|
||||
taskDto.setRemark("指令创建失败,起点mode或move不满足条件! 起点:" + startDeviceCode);
|
||||
taskService.updateByCodeFromCache(taskDto);
|
||||
@@ -187,7 +187,7 @@ public class AbstractDriverService<T> implements DriverDeviceService {
|
||||
Method methodMode = driverClass.getMethod("getMode");
|
||||
Integer nowMode = (Integer) methodMode.invoke(driver);
|
||||
Integer nowMove = (Integer) methodMove.invoke(driver);
|
||||
if (nowMode != mode || nowMove != move) {
|
||||
if (nowMove != move) {
|
||||
log.info("指令创建失败,终点mode或move不满足条件! 任务号:" + taskDto.getTask_code() + ",终点:" + nextDeviceCode);
|
||||
taskDto.setRemark("指令创建失败,终点mode或move不满足条件! 终点:" + nextDeviceCode);
|
||||
taskService.updateByCodeFromCache(taskDto);
|
||||
|
||||
Binary file not shown.
@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device_driver.standard_conveyor_line.ItemProtocol;
|
||||
import org.nl.acs.device_driver.standard_conveyor_line.StandardConveyorLineDeviceDriver;
|
||||
import org.nl.acs.opc.OpcConfig;
|
||||
import org.nl.modules.udw.UnifiedDataAccessor;
|
||||
import org.nl.modules.udw.UnifiedDataAccessorFactory;
|
||||
@@ -156,46 +157,8 @@ public class AbstractOpcDeviceDriver<T> extends AbstractDeviceDriver implements
|
||||
}
|
||||
}
|
||||
|
||||
public void commonCreateTask(T driver){
|
||||
|
||||
}
|
||||
|
||||
//首字母转大写
|
||||
public String initialUpperCase(String str) {
|
||||
return str.substring(0, 1).toUpperCase() + str.substring(1, str.length());
|
||||
}
|
||||
|
||||
public void writing(int command) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_command;
|
||||
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_command, command);
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
}
|
||||
|
||||
public void writing(int type, int command) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_command;
|
||||
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_target;
|
||||
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_task;
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
if (type == 1) {
|
||||
itemMap.put(to_command, command);
|
||||
} else if (type == 2) {
|
||||
itemMap.put(to_target, command);
|
||||
|
||||
} else if (type == 3) {
|
||||
itemMap.put(to_task, command);
|
||||
}
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,14 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.common.aspect.TaskAnnotation;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.OpcDeviceDriver;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.opc.Device;
|
||||
@@ -17,7 +19,11 @@ import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.aop.framework.AopContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -39,6 +45,7 @@ public class StandardConveyorLineDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||
@Autowired
|
||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||
|
||||
String container;
|
||||
String container_type_desc;
|
||||
String last_container_type_desc;
|
||||
@@ -134,9 +141,11 @@ public class StandardConveyorLineDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
return null;
|
||||
|
||||
}
|
||||
return null;
|
||||
return "createTask";
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean exe_business() {
|
||||
return true;
|
||||
}
|
||||
@@ -171,7 +180,39 @@ public class StandardConveyorLineDeviceDriver extends AbstractOpcDeviceDriver im
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
public void writing(int command) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_command;
|
||||
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_command, command);
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
}
|
||||
|
||||
public void writing(int type, int command) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_command;
|
||||
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_target;
|
||||
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_task;
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
if (type == 1) {
|
||||
itemMap.put(to_command, command);
|
||||
} else if (type == 2) {
|
||||
itemMap.put(to_target, command);
|
||||
|
||||
} else if (type == 3) {
|
||||
itemMap.put(to_task, command);
|
||||
}
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
}
|
||||
|
||||
public void writeLogInfo(String device_code, String name, int lastNumber, int nowNumber) {
|
||||
super.writeLogInfo(device_code, name, lastNumber, nowNumber);
|
||||
|
||||
@@ -178,7 +178,7 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
String taskCode = (String) whereJson.get("task_code");
|
||||
String vehicle_code = (String) whereJson.get("carId");
|
||||
HttpResponse result = null;
|
||||
AddressDto addressDto = addressService.findByCode("feedbackTask");
|
||||
AddressDto addressDto = addressService.findByCode("taskFeedback");
|
||||
String wcsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WCSURL);
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wcsurl + methods_url;
|
||||
|
||||
@@ -64,6 +64,7 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
private final TaskService taskService;
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final AcsToWmsZDServiceImpl acsToWmsZDService;
|
||||
private final InstructionService instructionService;
|
||||
@Autowired
|
||||
LogServer logServer;
|
||||
|
||||
@@ -71,25 +72,26 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
@Override
|
||||
public Map<String, Object> waitpointRequest(JSONObject param) {
|
||||
// TODO 待定
|
||||
String task_code = param.getString("task_code");
|
||||
String inst_code = param.getString("task_code");
|
||||
String car_id = param.getString("device_code");
|
||||
String address = param.getString("address");
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||
StandardConveyorLineDeviceDriver standardConveyorLineDeviceDriver;
|
||||
TaskDto taskDto = taskService.findByCode(task_code);
|
||||
Instruction instructionDto = instructionService.findByCode(inst_code);
|
||||
String task_code = instructionDto.getTask_code();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Map<String, Object> feedMap = new HashMap();
|
||||
feedMap.put("taskCode", task_code);
|
||||
feedMap.put("carId", car_id);
|
||||
feedMap.put("taskType", taskDto.getTask_type());
|
||||
if (ObjectUtil.isEmpty(taskDto)) {
|
||||
feedMap.put("taskType", instructionDto.getInstruction_type());
|
||||
if (ObjectUtil.isEmpty(instructionDto)) {
|
||||
map.put("status", 400);
|
||||
map.put("message", "操作失败");
|
||||
return map;
|
||||
}
|
||||
String type = "";
|
||||
String start_device_code = taskDto.getStart_device_code();
|
||||
String next_device_code = taskDto.getNext_device_code();
|
||||
String start_device_code = instructionDto.getStart_device_code();
|
||||
String next_device_code = instructionDto.getNext_device_code();
|
||||
if (address.contains("IN")) {
|
||||
String deviceCodeNow = address.substring(0, address.length() - 2);
|
||||
Device deviceNow = deviceAppService.findDeviceByCode(deviceCodeNow);
|
||||
@@ -99,14 +101,16 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
if (standardConveyorLineDeviceDriver.getMove() == 1) {
|
||||
feedMap.put("feedbackStatus", "applyTake");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = (int) feedback.get("responseCode");
|
||||
int responseCode = Integer.parseInt((String) feedback.get("responseCode"));
|
||||
String responseMessage = (String) feedback.get("responseMessage");
|
||||
if (responseCode == 0) {
|
||||
feedback.put("feedbackStatus","“taking");
|
||||
acsToWmsZDService.taskFeedback(feedMap);
|
||||
map.put("status", 200);
|
||||
map.put("message", "操作成功");
|
||||
type = "info";
|
||||
} else {
|
||||
logServer.log(task_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id);
|
||||
logServer.log(inst_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id);
|
||||
map.put("status", 400);
|
||||
map.put("message", "操作失败");
|
||||
type = "erro";
|
||||
@@ -124,14 +128,16 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
} else {
|
||||
feedMap.put("feedbackStatus", "applyPut");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = (int) feedback.get("responseCode");
|
||||
int responseCode = Integer.parseInt((String) feedback.get("responseCode")) ;
|
||||
String responseMessage = (String) feedback.get("responseMessage");
|
||||
if (responseCode == 0) {
|
||||
feedback.put("feedbackStatus","puting");
|
||||
acsToWmsZDService.taskFeedback(feedMap);
|
||||
map.put("status", 200);
|
||||
map.put("message", "操作成功");
|
||||
type = "info";
|
||||
} else {
|
||||
logServer.log(task_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id);
|
||||
logServer.log(inst_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id);
|
||||
map.put("status", 400);
|
||||
map.put("message", "操作失败");
|
||||
type = "erro";
|
||||
@@ -140,6 +146,7 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
if (address.contains("OUT")) {
|
||||
String deviceCodeNow = address.substring(0, address.length() - 3);
|
||||
@@ -158,7 +165,7 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
map.put("message", "操作成功");
|
||||
type = "info";
|
||||
} else {
|
||||
logServer.log(task_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id);
|
||||
logServer.log(inst_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id);
|
||||
map.put("status", 400);
|
||||
map.put("message", "操作失败");
|
||||
type = "erro";
|
||||
@@ -166,13 +173,14 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
} else {
|
||||
map.put("status", 400);
|
||||
map.put("message", "操作失败");
|
||||
type = "erro";
|
||||
}
|
||||
} else if (next_device_code.equals(deviceCodeNow)) {
|
||||
if (standardConveyorLineDeviceDriver.getMove() == 0) {
|
||||
map.put("status", 400);
|
||||
map.put("message", "操作失败");
|
||||
type = "info";
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), "取货完成时,光电信号为0", "400", "waitpointRequest", car_id);
|
||||
logServer.log(inst_code, "waitpointRequest", type, param.toString(), "取货完成时,光电信号为0", "400", "waitpointRequest", car_id);
|
||||
} else {
|
||||
//standardConveyorLineDeviceDriver.writing(1,2);
|
||||
feedMap.put("feedbackStatus", "putFinish");
|
||||
@@ -191,7 +199,10 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
map.put("status",400);
|
||||
map.put("message","操作失败,IN OUT 站点错误!");
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,6 @@ public class AutoCreateInst {
|
||||
instdto.setTask_id(taskid);
|
||||
instdto.setTask_code(taskcode);
|
||||
instdto.setVehicle_code(vehiclecode);
|
||||
instdto.setRoute_plan_code(route_plan_code);
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by("auto");
|
||||
|
||||
@@ -36,7 +36,6 @@ public class Init implements ApplicationRunner {
|
||||
//初始化WQL
|
||||
initWql();
|
||||
//随线程启动
|
||||
Thread.sleep(1000);
|
||||
initApplicationAutoInitialExecuter();
|
||||
initWebAutoInitialExecuter();
|
||||
//初始化任务调度
|
||||
|
||||
Reference in New Issue
Block a user