This commit is contained in:
USER-20220102CG\noblelift
2022-12-19 08:58:50 +08:00
parent 3abfc2bb36
commit 1c49eb87bb
33 changed files with 1126 additions and 174 deletions

View File

@@ -33,7 +33,12 @@ public enum DriverTypeEnum {
BOX_PALLETIZING_MANIPULATOR(12, "box_palletizing_manipulator", "木箱码垛-行架机械手", "station"),
SIEMENS_CONVEYOR(13, "siemens_conveyor", "西门子-输送机驱动", "conveyor");
SIEMENS_CONVEYOR(13, "siemens_conveyor", "西门子-输送机驱动", "conveyor"),
HONGXIANG_CONVEYOR(13, "hongxiang_conveyor", "烘箱对接位", "conveyor"),
INSPECT_CONVEYOR_CONTROL_WITH_SCANNER(14, "standard_conveyor_control_with_scanner", "标准版-输送机-控制点-关联扫码", "conveyor");
//驱动索引

View File

@@ -79,8 +79,6 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
logger.info("Hello World");
HashMap param = new HashMap();
param.put("flag", "01");
if (whereJson.get("blurry") != null) {

View File

@@ -0,0 +1,60 @@
package org.nl.acs.device_driver.basedriver.hongxiang_conveyor;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
/**
* 烘箱设备对接位
*/
@Service
public class HongXiangStationDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "hongxiang_conveyor";
}
@Override
public String getDriverName() {
return "烘箱设备对接位";
}
@Override
public String getDriverDescription() {
return "烘箱设备对接位";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new HongXiangStationDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return HongXiangStationDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.conveyor);
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -0,0 +1,230 @@
package org.nl.acs.device_driver.basedriver.hongxiang_conveyor;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.server.AgvService;
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.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
/**
* 烘箱对接位
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
@Autowired
DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class);
@Autowired
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
@Autowired
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
@Autowired
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
@Autowired
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
@Autowired
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
@Autowired
AgvService agvService = SpringContextHolder.getBean(AgvService.class);
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
private Date instruction_apply_time = new Date();
private int instruction_require_time_out = 3000;
public int heartbeat = 0;
public int mode = 0;
public int move = 0;
public int action = 0;
public int error = 0;
public int door = 0;
public int temperature = 0;
public int countdown = 0;
public int finish = 0;
public int task = 0;
public int error1 = 0;
public int material = 0;
public int consumption = 0;
public int voltageA = 0;
public int voltageB = 0;
public int voltageC = 0;
public int currentA = 0;
public int currentB = 0;
public int currentC = 0;
public int last_heartbeat = 0;
public int last_mode = 0;
public int last_move = 0;
public int last_action = 0;
public int last_error = 0;
public int last_door = 0;
public int last_temperature = 0;
public int last_countdown = 0;
public int last_finish = 0;
public int last_task = 0;
public int last_error1 = 0;
public int last_material = 0;
public int last_consumption = 0;
public int last_voltageA = 0;
public int last_voltageB = 0;
public int last_voltageC = 0;
public int last_currentA = 0;
public int last_currentB = 0;
public int last_currentC = 0;
Boolean isonline = true;
Boolean iserror = false;
//1-执行任务2-取货完成3-放货完成;
int flag;
String device_code;
@Override
public Device getDevice() {
return this.device;
}
//请求成功标记
Boolean requireSucess = false;
@Override
public void execute() {
String message = null;
device_code = this.getDeviceCode();
}
public synchronized boolean instruction_apply(String container_code) throws Exception {
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.instruction_apply_time = date;
requireSucess = true;
return true;
}
}
protected void thingToNothing() {
this.setRequireSucess(false);
}
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 List<String> getExtraDeviceCodes(String extraName) {
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
if (StrUtil.isEmpty(extraValue)){
return new ArrayList<>();
}
String devicesString = extraValue.substring(1, extraValue.length() - 1);
List<String> devicesList = new ArrayList<>();
String[] devices = devicesString.split(",");
for (int i = 0; i < devices.length; i++) {
String s = devices[i].replace("\"", "").replace("\"", "");
devicesList.add(s);
}
return devicesList;
}
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, value);
// itemMap.put(to_param, Integer.parseInt(value));
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()
+ "." + org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.ItemProtocol.item_to_command;
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.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);
log.info("设备:" + device_code + ",下发PLC信号" + to_command + ",value:" + command);
} else if (type == 2) {
itemMap.put(to_target, command);
log.info("设备:" + device_code + ",下发PLC信号" + to_target + ",value:" + command);
} else if (type == 3) {
itemMap.put(to_task, command);
log.info("设备:" + device_code + ",下发PLC信号" + to_task + ",value:" + command);
}
ReadUtil.write(itemMap, server);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String move = "";
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", "联机");
jo.put("action", action);
jo.put("isOnline", true);
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("task", this.getTask());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -0,0 +1,59 @@
package org.nl.acs.device_driver.basedriver.hongxiang_conveyor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Data
public class ItemProtocol {
public static String item_action = "action";
public static String item_to_command = "to_command";
private HongXiangStationDeviceDriver driver;
public ItemProtocol(HongXiangStationDeviceDriver driver) {
this.driver = driver;
}
public int getItem_action(){
return this.getOpcIntegerValue(item_action);
};
Boolean isonline;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_action, "动作信号", "450"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "下发命令", "226"));
return list;
}
}

View File

@@ -11,7 +11,7 @@ import java.util.LinkedList;
import java.util.List;
/**
* 烘箱设备对接
* 烘箱
*/
@Service
public class HongXiangConveyorDefination implements OpcDeviceDriverDefination {
@@ -22,12 +22,12 @@ public class HongXiangConveyorDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverName() {
return "烘箱设备对接";
return "烘箱";
}
@Override
public String getDriverDescription() {
return "烘箱设备对接";
return "烘箱";
}
@Override

View File

@@ -32,7 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
/**
* 烘箱对接
* 烘箱
*/
@Slf4j
@Data

View File

@@ -3,6 +3,7 @@ package org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scann
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_plcscanner.StandardCoveyorControlWithPlcScannerDeviceDriver;
import java.util.ArrayList;
import java.util.List;
@@ -11,19 +12,35 @@ import java.util.List;
@Data
public class ItemProtocol {
//心跳
public static String item_heartbeat = "heartbeat";
//工作模式
public static String item_mode = "mode";
//光电信号
public static String item_move = "move";
public static String item_action = "action";
//托盘方向
public static String item_carrier_direction = "carrier_direction";
//报警
public static String item_error = "error";
//任务号
public static String item_task = "task";
//下发命令
public static String item_to_command = "to_command";
//下发目标站
public static String item_to_target = "to_target";
//下发托盘类型
public static String item_to_container_type = "to_container_type";
//下发任务号
public static String item_to_task = "to_task";
public static String item_to_door = "to_door";
public static String item_to_floor = "to_floor";
//困扎次数
public static String item_to_strap_times = "to_strap_times";
//木箱长度
public static String item_to_length = "to_length";
//木箱宽度
public static String item_to_weight = "to_weight";
//木箱高度
public static String item_to_height = "to_height";
private StandardCoveyorControlWithScannerDeviceDriver driver;
@@ -32,35 +49,37 @@ public class ItemProtocol {
this.driver = driver;
}
public int getItem_heartbeat() {
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getItem_mode() {
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getItem_move() {
public int getMove() {
return this.getOpcIntegerValue(item_move);
}
public int getItem_error() {
public int getCarrier_direction() {
return this.getOpcIntegerValue(item_carrier_direction);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getItem_action() {
return this.getOpcIntegerValue(item_action);
}
public int getItem_task() {
public int getTask() {
return this.getOpcIntegerValue(item_task);
}
Boolean isonline;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
@@ -70,25 +89,27 @@ public class ItemProtocol {
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "VW0"));
list.add(new ItemDto(item_mode, "工作模式", "VW2"));
list.add(new ItemDto(item_move, "光电信号", "VW4"));
list.add(new ItemDto(item_action, "取放信号", "VW6"));
list.add(new ItemDto(item_error, "故障", "VW8"));
list.add(new ItemDto(item_task, "任务号", "VD10"));
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(item_mode, "工作模式", "DB600.B2"));
list.add(new ItemDto(item_move, "光电信号", "DB600.B3"));
list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB600.B4"));
list.add(new ItemDto(item_error, "报警信号", "DB600.B6"));
list.add(new ItemDto(item_task, "任务号", "DB600.D10"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "下发命令", "VW102"));
list.add(new ItemDto(item_to_target, "下发目标站", "VW104"));
list.add(new ItemDto(item_to_task, "任务号", "VD108"));
list.add(new ItemDto(item_to_door, "", "VD112"));
list.add(new ItemDto(item_to_floor, "楼层", "VD114"));
list.add(new ItemDto(item_to_command, "下发命令", "DB601.W2"));
list.add(new ItemDto(item_to_target, "下发目标站", "DB601.W4"));
list.add(new ItemDto(item_to_task, "下发任务号", "DB601.D8"));
list.add(new ItemDto(item_to_strap_times, "捆扎次数", "DB601.W12"));
list.add(new ItemDto(item_to_length, "木箱长度", "DB601.W14"));
list.add(new ItemDto(item_to_weight, "木箱宽度", "DB601.W16"));
list.add(new ItemDto(item_to_height, "木箱高度", "DB601.W18"));
return list;
}

View File

@@ -11,8 +11,7 @@ import java.util.LinkedList;
import java.util.List;
/**
* 检测站点驱动定义
* 说明:该站点为普通带光电检测站点
* 说明:该站点为输送机-控制点-关联扫码
*/
@Service
public class StandardConveyorControlWithScannerDefination implements OpcDeviceDriverDefination {
@@ -23,12 +22,12 @@ public class StandardConveyorControlWithScannerDefination implements OpcDeviceDr
@Override
public String getDriverName() {
return "货梯对接线-关联扫码";
return "标准版-输送机-控制点-关联扫码";
}
@Override
public String getDriverDescription() {
return "货梯对接线-关联扫码";
return "标准版-输送机-控制点-关联扫码";
}
@Override

View File

@@ -45,6 +45,7 @@ import java.util.*;
@RequiredArgsConstructor
public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
@Autowired
@@ -169,12 +170,11 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
String message = null;
try {
device_code = this.getDeviceCode();
heartbeat = this.itemProtocol.getItem_heartbeat();
mode = this.itemProtocol.getItem_mode();
move = this.itemProtocol.getItem_move();
error = this.itemProtocol.getItem_error();
task = this.itemProtocol.getItem_task();
action = this.itemProtocol.getItem_action();
heartbeat = this.itemProtocol.getHeartbeat();
mode = this.itemProtocol.getMode();
move = this.itemProtocol.getMove();
error = this.itemProtocol.getError();
task = this.itemProtocol.getTask();
if (mode != last_mode) {
this.setRequireSucess(false);
@@ -325,10 +325,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
+ "." + 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 to_door = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_door;
String to_floor = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_floor;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
@@ -339,12 +335,9 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
} else if (type == 3) {
itemMap.put(to_task, command);
} else if (type == 4) {
itemMap.put(to_door, command);
} else if (type == 5) {
itemMap.put(to_floor, command);
}
ReadUtil.write(itemMap, server);
}

View File

@@ -21,27 +21,27 @@ public class CreateTaskRequest extends BaseRequest {
/**
* 取货点1
*/
String start_point_code;
String start_device_code;
/**
* 放货点1
*/
String next_point_code;
String next_device_code;
/**
* 取货点2
*/
String start_point_code2;
String start_device_code2;
/**
* 放货点2
*/
String next_point_code2;
String next_device_code2;
/**
* 烘箱对接位
*/
String put_point_code;
String put_device_code;
/**
* 优先级

View File

@@ -0,0 +1,30 @@
package org.nl.acs.ext.wms.data;
import lombok.Data;
import java.util.Map;
@Data
public class PutActionRequest extends BaseRequest {
/**
* 设备号
*/
String device_code;
/**
*
*/
String code;
/**
*
*/
String value;
/**
* 扩展属性
*/
Map<String,String> params;
}

View File

@@ -0,0 +1,7 @@
package org.nl.acs.ext.wms.data;
public class PutActionResponse extends BaseResponse {
}

View File

@@ -5,6 +5,7 @@ package org.nl.acs.ext.wms.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.ext.wms.data.CancelTaskResponse;
import org.nl.acs.ext.wms.data.CreateTaskResponse;
import org.nl.acs.ext.wms.data.PutActionResponse;
import java.util.Map;
@@ -47,7 +48,7 @@ public interface WmsToAcsService {
* @param jsonObject 条件
* @return Map<String, Object>
*/
Map<String, Object> putAction(String jsonObject) throws Exception;
PutActionResponse putAction(String jsonObject) throws Exception;
/**
* 查询设备状态

View File

@@ -11,6 +11,7 @@ import org.nl.acs.common.IDriverService;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.EmptyVehicleStackingPositionDeviceDriver;
import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.ext.wms.data.*;
import org.nl.acs.ext.wms.service.WmsToAcsService;
@@ -134,25 +135,31 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
@Override
public Map<String, Object> putAction(String jsonObject) throws Exception {
public PutActionResponse putAction(String jsonObject) throws Exception {
log.info("putAction--------------:输出参数" + jsonObject);
JSONArray datas = JSONArray.parseArray(jsonObject);
log.info("putAction--------------:输入参数" + datas.toString());
PutActionResponse response = new PutActionResponse();
JSONArray errArr = new JSONArray();
for (int i = 0; i < datas.size(); i++) {
JSONObject data = datas.getJSONObject(i);
String device_code = data.getString("device_code");
String code = data.getString("code");
String value = data.getString("value");
String data = datas.get(i).toString();
PutActionRequest request = JsonUtl.format(data, PutActionRequest.class);
String device_code = request.getDevice_code();
String code = request.getCode();
String value = request.getValue();
Device device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device)) {
throw new Exception("未找到对应设备:" + device_code);
}
HongXiangStationDeviceDriver hongXiangStationDeviceDriver;
if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
hongXiangStationDeviceDriver.writing(code,value);
}
}
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.OK);
resultJson.put("message", "操作成功");
resultJson.put("data", new JSONObject());
log.info("putAction--------------:输出参数" + resultJson.toString());
return resultJson;
response.setStatus(200);
response.setMessage("success");
log.info("putAction--------------:输出参数:" + response);
return response;
}
@Override
@@ -262,11 +269,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
CreateTaskRequest request = JsonUtl.format(data, CreateTaskRequest.class);
String ext_task_id = request.getExt_task_id();
String task_code = request.getTask_code();
String start_point_code = request.getStart_point_code();
String start_point_code2 = request.getStart_point_code2();
String next_point_code = request.getNext_point_code();
String next_point_code2 = request.getNext_point_code2();
String put_point_code = request.getPut_point_code();
String start_device_code = request.getStart_device_code();
String start_device_code2 = request.getStart_device_code2();
String next_device_code = request.getNext_device_code();
String next_device_code2 = request.getNext_device_code2();
String put_device_code = request.getPut_device_code();
String priority = request.getPriority();
String vehicle_code = request.getVehicle_code();
String vehicle_type = request.getVehicle_type();
@@ -276,41 +283,41 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
String remark = request.getRemark();
Map<String,String> params = request.getParams();
String start_device_code = "";
String start_device_code2 = "";
String next_device_code = "";
String next_device_code2 = "";
String put_device_code = "";
String start_point_code = "";
String start_point_code2 = "";
String next_point_code = "";
String next_point_code2 = "";
String put_point_code = "";
if (StrUtil.isEmpty(task_code)) {
throw new WDKException("任务号不能为空");
}
if (StrUtil.isEmpty(start_point_code)) {
if (StrUtil.isEmpty(start_device_code)) {
throw new WDKException("起点不能为空");
}
if (StrUtil.isEmpty(next_point_code)) {
if (StrUtil.isEmpty(next_device_code)) {
throw new WDKException("终点不能为空");
}
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_point_code + "'").uniqueResult(0);
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(start_device_json)) {
start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_point_code : (String) start_device_json.get("storage_code");
start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_device_code : (String) start_device_json.get("storage_code");
}
JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_point_code + "'").uniqueResult(0);
JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_device_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(next_device_json)) {
next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code");
}
JSONObject start_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_point_code2 + "'").uniqueResult(0);
JSONObject start_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code2 + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(start_device_json2)) {
start_point_code2 = (String) start_device_json2.get("parent_storage_code") == null ? start_point_code2 : (String) start_device_json.get("storage_code");
start_point_code2 = (String) start_device_json2.get("parent_storage_code") == null ? start_device_code2 : (String) start_device_json.get("storage_code");
}
JSONObject next_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_point_code2 + "'").uniqueResult(0);
JSONObject next_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_device_code2 + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(next_device_json2)) {
next_point_code2 = (String) next_device_json2.get("parent_storage_code") == null ? next_point_code2 : (String) next_device_json.get("storage_code");
next_point_code2 = (String) next_device_json2.get("parent_storage_code") == null ? next_device_code2 : (String) next_device_json.get("storage_code");
}
JSONObject put_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + put_point_code + "'").uniqueResult(0);
JSONObject put_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + put_device_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(put_device_json)) {
put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_point_code : (String) next_device_json.get("storage_code");
put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_device_code : (String) next_device_json.get("storage_code");
}
if (StrUtil.isNotEmpty(start_point_code) && start_point_code.indexOf("-") > 0) {
String str[] = start_point_code.split("-");
@@ -362,6 +369,23 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
}
if (StrUtil.isEmpty(start_point_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", request.getStart_device_code() +" 该设备号未找到对应点位");
errArr.add(json);
continue;
}
if (StrUtil.isEmpty(next_point_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", request.getNext_device_code() +" 该设备号未找到对应点位");
errArr.add(json);
continue;
}
JSONObject jo = new JSONObject();
jo.put("task_code", task_code);
jo.put("task_id", ext_task_id);

View File

@@ -21,6 +21,9 @@ import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyor
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.ext.wms.liKuData.InStoreRequest;
import org.nl.acs.ext.wms.service.AcsToLiKuService;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.opc.Device;
@@ -308,58 +311,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
Device startdevice = appService.findDeviceByCode(dto.getStart_device_code());
Device nextdevice = appService.findDeviceByCode(dto.getNext_device_code());
CargoLiftConveyorDeviceDriver cargoLiftConveyorDeviceDriver;
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
//输送线相关需要给任务字段进行赋值,通过任务来判断输送线当前执行到哪一步
if (startdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) startdevice.getDeviceDriver();
cargoLiftConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
if (nextdevice.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) nextdevice.getDeviceDriver();
standardCoveyorControlWithScannerDeviceDriver.writing(1, 1);
String address = standardCoveyorControlWithScannerDeviceDriver.getExtraValue().get("address").toString();
if (StrUtil.isEmpty(address)) {
throw new BadRequestException("设备:" + nextdevice.getDevice_code() + "未设置电气调度号!");
}
String door = standardCoveyorControlWithScannerDeviceDriver.getExtraValue().get("door").toString();
if (StrUtil.isEmpty(door)) {
throw new BadRequestException("设备:" + nextdevice.getDevice_code() + "未设置门!");
}
String floor = standardCoveyorControlWithScannerDeviceDriver.getExtraValue().get("floor").toString();
if (StrUtil.isEmpty(floor)) {
throw new BadRequestException("设备:" + nextdevice.getDevice_code() + "未设置楼层!");
}
standardCoveyorControlWithScannerDeviceDriver.writing(2, Integer.parseInt(address));
standardCoveyorControlWithScannerDeviceDriver.writing(3, Integer.parseInt(task_code));
standardCoveyorControlWithScannerDeviceDriver.writing(4, Integer.parseInt(door));
standardCoveyorControlWithScannerDeviceDriver.writing(5, Integer.parseInt(floor));
}
}
if (startdevice.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) startdevice.getDeviceDriver();
standardCoveyorControlWithScannerDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
if (nextdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) nextdevice.getDeviceDriver();
cargoLiftConveyorDeviceDriver.writing(1, 1);
String address = cargoLiftConveyorDeviceDriver.getExtraValue().get("address").toString();
if (StrUtil.isEmpty(address)) {
throw new BadRequestException("设备:" + nextdevice.getDevice_code() + "未设置电气调度号!");
}
String door = cargoLiftConveyorDeviceDriver.getExtraValue().get("door").toString();
if (StrUtil.isEmpty(door)) {
throw new BadRequestException("设备:" + nextdevice.getDevice_code() + "未设置门!");
}
String floor = cargoLiftConveyorDeviceDriver.getExtraValue().get("floor").toString();
if (StrUtil.isEmpty(floor)) {
throw new BadRequestException("设备:" + nextdevice.getDevice_code() + "未设置楼层!");
}
cargoLiftConveyorDeviceDriver.writing(2, Integer.parseInt(address));
cargoLiftConveyorDeviceDriver.writing(3, Integer.parseInt(task_code));
cargoLiftConveyorDeviceDriver.writing(4, Integer.parseInt(door));
cargoLiftConveyorDeviceDriver.writing(5, Integer.parseInt(floor));
}
}
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
@@ -384,12 +338,39 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
throw new BadRequestException("未查询到相关路由!");
}
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")){
String agvType = paramService.findByCode("agvType").getValue();
if (StrUtil.equals(agvType, "2")) {
// 0为输送、立库任务 1 1楼叉车系统 2 2楼1区域AGV系统 3 2楼2区域AGV系统
if (!StrUtil.equals(task.getAgv_system_type(), "0")) {
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(),dto);
} else {
//入库
AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuService.class);
if(StrUtil.equals(task.getStorage_task_type(),"1")){
InStoreRequest request = new InStoreRequest();
request.setFloorNo(Integer.parseInt(dto.getTo_z()));
acsToLiKuService.inStore(request);
//空托入库
} else if (StrUtil.equals(task.getStorage_task_type(),"2")){
//出库
} else if (StrUtil.equals(task.getStorage_task_type(),"3")){
//空托出库
} else if (StrUtil.equals(task.getStorage_task_type(),"4")) {
//转库
} else if (StrUtil.equals(task.getStorage_task_type(),"5")) {
}
}
}
} catch (Exception e) {
dto.setSend_status("2");

View File

@@ -45,15 +45,12 @@ public class DeviceOpcSynchronizeAutoRun extends AbstractAutoRunnable {
}while (ObjectUtil.isEmpty(pros));
Set<String> keys = pros.keySet();
Iterator var4 = keys.iterator();
System.out.println("test:" + var4.hasNext());
//代码执行一次
while (var4.hasNext()) {
String key = (String) var4.next();
List<List<OpcItemDto>> list = (List) pros.get(key);
OpcServerManageDto opcServer = (OpcServerManageDto) servers.get(key);
Iterator var8 = list.iterator();
System.out.println("test2:" + var8.hasNext());
while (var8.hasNext()) {
List<OpcItemDto> groupProtols = (List) var8.next();
DeviceOpcProtocolRunable runable = new DeviceOpcProtocolRunable();

View File

@@ -42,6 +42,11 @@ public class TaskDto implements Serializable {
*/
private String task_type = "1";
/**
* 立库任务类型
*/
private String storage_task_type;
/**
* 任务状态
*/

View File

@@ -604,7 +604,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (!StrUtil.startWith(dto.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_id", entity.getTask_id());
feed_jo.put("ext_task_id", entity.getExt_task_id());
feed_jo.put("task_code", dto.getTask_code());
feed_jo.put("task_status", dto.getTask_status());
JSONArray ja = new JSONArray();
@@ -973,8 +973,10 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
} else {
instdto.setAgv_inst_type("4");
}
instructionservice.create(instdto);
acsTask.setTask_status("1");
this.update(acsTask);
}
@Override

View File

@@ -6,11 +6,11 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_one_wcs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:yongyu_acs2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_one_wcs}?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
username: ${DB_USER:root}
password: ${DB_PWD:P@ssw0rd}
# password: ${DB_PWD:Root.123456}
# password: ${DB_PWD:P@ssw0rd}
password: ${DB_PWD:Root.123456}
# 初始连接数
initial-size: 5
# 最小连接数

View File

@@ -6,9 +6,9 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:10.16.1.25}:${DB_PORT:3306}/${DB_NAME:whxr_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root}
password: ${DB_PWD:whxr_root}
password: ${DB_PWD:123456}
# 初始连接数
initial-size: 5
# 最小连接数
@@ -54,7 +54,7 @@ spring:
redis:
#数据库索引
database: ${REDIS_DB:15}
host: ${REDIS_HOST:10.16.1.25}
host: ${REDIS_HOST:127.0.0.1}
port: ${REDIS_PORT:6379}
password: ${REDIS_PWD:}
#连接超时时间
@@ -137,3 +137,27 @@ logging:
file:
path: /app/jar/logs
config: classpath:logback-spring.xml
# Sa-Token配置
sa-token:
# token 名称 (同时也是cookie名称)
token-name: Authorization
# token 有效期单位s 默认30天, -1代表永不过期
timeout: 2592000
# token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
activity-timeout: -1
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
is-share: false
# token风格
token-style: random-128
# 是否输出操作日志
is-log: false
jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq
# token 前缀
token-prefix: Bearer
loki:
url: http://localhost:3100/loki/api/v1
systemName: acs