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

BIN
acs/nladmin-ui/dist.7z Normal file

Binary file not shown.

View File

@@ -91,6 +91,8 @@ import oven_manipulator from '@/views/acs/device/driver/oven_manipulator'
import siemens_conveyor from '@/views/acs/device/driver/siemens_conveyor'
import slit_two_manipulator from '@/views/acs/device/driver/slit_two_manipulator'
import hongxiang_device from '@/views/acs/device/driver/hongxiang_device'
import hongxiang_conveyor from '@/views/acs/device/driver/hongxiang_conveyor'
export default {
name: 'DeviceConfig',
@@ -109,6 +111,7 @@ export default {
agv_ndc_two,
agv_ndc_one,
hongxiang_device,
hongxiang_conveyor,
box_palletizing_manipulator,
oven_manipulator,
siemens_conveyor,

View File

@@ -30,6 +30,7 @@
v-model="plc_id"
placeholder="无"
clearable
filterable
@change="changePlc"
>
<el-option

View File

@@ -0,0 +1,489 @@
<template>
<!--检测站点-->
<div>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">设备协议</span>
</div>
<el-row>
<el-col :span="12">
OpcServer:
<el-select
v-model="opc_id"
placeholder="无"
clearable
filterable
@change="changeOpc"
>
<el-option
v-for="item in dataOpcservers"
:key="item.opc_id"
:label="item.opc_name"
:value="item.opc_id"
/>
</el-select>
</el-col>
<el-col :span="12">
PLC:
<el-select
v-model="plc_id"
placeholder="无"
clearable
filterable
@change="changePlc"
>
<el-option
v-for="item in dataOpcPlcs"
:key="item.plc_id"
:label="item.plc_name"
:value="item.plc_id"
/>
</el-select>
</el-col>
</el-row>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">输送系统</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="8">
<el-form-item label="电气调度号" label-width="150px">
<el-input v-model="form.OPCServer" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">指令相关</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="8">
<el-form-item label="检验有货">
<el-switch v-model="form.inspect_in_stocck" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="忽视取货校验" label-width="150px">
<el-switch v-model="form.ignore_pickup_check" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="忽视放货校验" label-width="150px">
<el-switch v-model="form.ignore_release_check" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="呼叫">
<el-switch v-model="form.apply_task" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="响应" label-width="150px">
<el-switch v-model="form.manual_create_task" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="关联设备" prop="device_code">
<el-select
v-model="form.link_device_code"
filterable
multiple
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="关联三色灯" prop="device_code" label-width="100px">
<el-select
v-model="form.link_three_lamp"
filterable
clearable
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否输入物料" label-width="150px">
<el-switch v-model="form.input_material" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">AGV相关</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="8">
<el-form-item label="取货">
<el-switch v-model="form.is_pickup" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="放货">
<el-switch v-model="form.is_release" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC读取字段</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-table
v-loading="false"
:data="data1"
:max-height="550"
size="small"
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
v-model="data1[scope.$index].db"
size="mini"
class="edit-input"
@input="finishReadEdit(data1[scope.$index])"
/>
</template>
</el-table-column>
<el-table-column prop="dbr_value">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC写入字段</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-table
v-loading="false"
:data="data2"
:max-height="550"
size="small"
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
v-model="data2[scope.$index].db"
size="mini"
class="edit-input"
@input="finishWriteEdit(data2[scope.$index])"
/>
</template>
</el-table-column>
<el-table-column prop="dbw_value">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span" />
<el-button
:loading="false"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="doSubmit"
>保存
</el-button>
</div>
</el-card>
</div>
</template>
<script>
import {
queryDriverConfig,
updateConfig,
testRead,
testwrite
} from '@/api/acs/device/driverConfig'
import { selectOpcList } from '@/api/acs/device/opc'
import { selectPlcList } from '@/api/acs/device/opcPlc'
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
import crud from '@/mixins/crud'
import deviceCrud from '@/api/acs/device/device'
export default {
name: 'StandardInspectSite',
mixins: [crud],
props: {
parentForm: {
type: Object,
require: true
}
},
data() {
return {
device_code: '',
device_id: '',
plc_id: '',
plc_code: '',
opc_id: '',
opc_code: '',
configLoading: false,
dataOpcservers: [],
dataOpcPlcs: [],
deviceList: [],
data1: [],
data2: [],
form: {
inspect_in_stocck: true,
ignore_pickup_check: true,
ignore_release_check: true,
apply_task: true,
link_three_lamp: '',
manual_create_task: true,
is_pickup: true,
is_release: true,
link_device_code: []
},
rules: {}
}
},
created() {
this.$nextTick(() => {
// 从父表单获取设备编码
this.device_id = this.$props.parentForm.device_id
this.device_code = this.$props.parentForm.device_code
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
// 给表单赋值,并且属性不能为空
if (data.form) {
const arr = Object.keys(data.form)
// 不为空
if (arr.length > 0) {
this.form = data.form
}
}
// 给表单赋值,并且属性不能为空
if (data.parentForm) {
const arr = Object.keys(data.parentForm)
// 不为空
if (arr.length > 0) {
this.opc_code = data.parentForm.opc_code
this.plc_code = data.parentForm.plc_code
}
}
this.data1 = data.rs
this.data2 = data.ws
this.sliceItem()
})
selectPlcList().then(data => {
this.dataOpcPlcs = data
this.plc_id = this.$props.parentForm.opc_plc_id
})
selectOpcList().then(data => {
this.dataOpcservers = data
this.opc_id = this.$props.parentForm.opc_server_id
})
deviceCrud.selectDeviceList().then(data => {
this.deviceList = data
})
})
},
methods: {
finishReadEdit(data) {
// 编辑的是code列,并且值包含mode
if (data.code.indexOf('mode') !== -1) {
debugger
const dbValue = data.db
// .之前的字符串
const beforeStr = dbValue.match(/(\S*)\./)[1]
// .之后的字符串
const afterStr = dbValue.match(/\.(\S*)/)[1]
// 取最后数字
const endNumber = afterStr.substring(1)
// 最后为非数字
if (isNaN(parseInt(endNumber))) {
return
}
for (const val in this.data1) {
if (this.data1[val].code.indexOf('move') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
}
if (this.data1[val].code.indexOf('error') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 5)
}
if (this.data1[val].code.indexOf('task') !== -1) {
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 7)
}
}
}
},
finishWriteEdit(data) {
// 编辑的是code列,并且值包含mode
if (data.code.indexOf('to_command') !== -1) {
const dbValue = data.db
// .之前的字符串
const beforeStr = dbValue.match(/(\S*)\./)[1]
// .之后的字符串
const afterStr = dbValue.match(/\.(\S*)/)[1]
// 取最后数字
const endNumber = afterStr.substring(1)
// 最后为非数字
if (isNaN(parseInt(endNumber))) {
return
}
for (const val in this.data2) {
if (this.data2[val].code.indexOf('to_target') !== -1) {
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
}
if (this.data2[val].code.indexOf('to_task') !== -1) {
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
}
}
}
},
changeOpc(val) {
this.dataOpcservers.forEach(item => {
if (item.opc_id === val) {
this.opc_code = item.opc_code
}
})
selectListByOpcID(val).then(data => {
this.dataOpcPlcs = data
this.plc_id = ''
this.plc_code = ''
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
this.plc_id = this.dataOpcPlcs[0].plc_id
this.plc_code = this.dataOpcPlcs[0].plc_code
}
this.sliceItem()
})
},
changePlc(val) {
this.dataOpcPlcs.forEach(item => {
if (item.plc_id === val) {
this.plc_code = item.plc_code
this.sliceItem()
return
}
})
},
test_read1() {
testRead(this.data1, this.opc_id).then(data => {
this.data1 = data
this.notify('操作成功!', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
test_write1() {
testwrite(this.data2, this.opc_id).then(data => {
this.notify('操作成功!', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.configLoading = true
// 根据驱动类型判断是否为路由设备
const parentForm = this.parentForm
parentForm.is_route = true
parentForm.plc_id = this.plc_id
parentForm.opc_id = this.opc_id
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
this.notify('保存成功', 'success')
this.configLoading = false
}).catch(err => {
this.configLoading = false
console.log(err.response.data.message)
})
}
})
},
sliceItem() { // 拼接DB的Item值
this.data1.forEach(item => {
const str = item.code
// 是否包含.
if (str.search('.') !== -1) {
// 截取最后一位
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
} else {
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
}
})
this.data2.forEach(item => {
const str = item.code
// 是否包含.
if (str.search('.') !== -1) {
// 截取最后一位
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
} else {
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
}
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -13,6 +13,7 @@
v-model="opc_id"
placeholder="无"
clearable
filterable
@change="changeOpc"
>
<el-option

View File

@@ -13,6 +13,7 @@
v-model="opc_id"
placeholder="无"
clearable
filterable
@change="changeOpc"
>
<el-option

View File

@@ -13,6 +13,7 @@
v-model="opc_id"
placeholder="无"
clearable
filterable
@change="changeOpc"
>
<el-option

View File

@@ -13,6 +13,7 @@
v-model="opc_id"
placeholder="无"
clearable
filterable
@change="changeOpc"
>
<el-option

View File

@@ -13,6 +13,7 @@
v-model="opc_id"
placeholder="无"
clearable
filterable
@change="changeOpc"
>
<el-option

View File

@@ -13,6 +13,7 @@
v-model="opc_id"
placeholder="无"
clearable
filterable
@change="changeOpc"
>
<el-option

View File

@@ -13,6 +13,7 @@
v-model="opc_id"
placeholder="无"
clearable
filterable
@change="changeOpc"
>
<el-option

View File

@@ -117,6 +117,22 @@
/>
</el-select>
</el-form-item>
<el-form-item label="立库任务类型" v-if = "form.task_type == '7'">
<el-select
v-model="form.storage_task_type"
style="width: 370px;"
filterable
placeholder="请选择"
@change="isDisabled=false"
>
<el-option
v-for="item in dict.storage_task_type"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="agv系统">
<el-select
v-model="form.agv_system_type"
@@ -297,41 +313,40 @@
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="25" />
<el-table-column v-if="false" prop="task_id" label="任务标识" />
<el-table-column prop="task_code" label="任务号" />
<el-table-column prop="task_type" label="任务类型" />
<el-table-column prop="link_num" label="关联编号" />
<el-table-column prop="vehicle_code" label="载具号" />
<el-table-column prop="task_status" label="任务状态">
<el-table-column prop="task_code" label="任务号" width="100" />
<el-table-column prop="task_type" label="任务类型" width="120">
<template slot-scope="scope">
{{ dict.label.task_type[scope.row.task_type] }}
</template>
</el-table-column>
<!-- <el-table-column prop="link_num" label="关联编号" />-->
<el-table-column prop="vehicle_code" label="载具号" width="100" />
<el-table-column prop="task_status" label="任务状态" width="60">
<template slot-scope="scope" width="60">
<span v-if="scope.row.task_status==='0' ">就绪</span>
<span v-if="scope.row.task_status==='1' ">执行中</span>
<span v-if="scope.row.task_status==='2' ">完成</span>
</template>
</el-table-column>
<!--<el-table-column prop="task_type" label="任务类型">
<template slot-scope="scope">
{{ dict.label.task_type[scope.row.task_type] }}
</template>
</el-table-column>-->
<el-table-column prop="priority" label="任务优先级" width="120px" />
<el-table-column prop="start_point_code" label="取货点1" width="120px" />
<el-table-column prop="put_point_code" label="倒料点" />
<el-table-column prop="priority" label="优先级" width="100"/>
<el-table-column prop="start_point_code" label="取货点1" width="100px" />
<el-table-column prop="put_point_code" label="倒料点" width="100" />
<el-table-column prop="next_point_code" label="放货点1" width="120px" />
<el-table-column prop="start_point_code2" label="取货点2" width="120px" />
<el-table-column prop="next_point_code2" label="放货点2" width="120px" />
<el-table-column prop="compound_task" label="复合任务">
<template slot-scope="scope">
<span v-if="scope.row.compound_task==='0' "></span>
<span v-if="scope.row.compound_task==='1' "></span>
</template>
</el-table-column>
<el-table-column prop="compound_task_data" width="200" label="复合路线" />
<!-- <el-table-column prop="compound_task" label="复合任务">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="scope.row.compound_task==='0' "></span>-->
<!-- <span v-if="scope.row.compound_task==='1' "></span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="compound_task_data" width="200" label="复合路线" />-->
<el-table-column prop="matarial" label="物料" />
<el-table-column prop="quantity" label="数量" />
<el-table-column prop="remark" label="备注" />
<el-table-column prop="create_by" label="创建者" />
<el-table-column prop="create_time" label="创建时间" width="135" />
<el-table-column v-permission="['admin','task:edit','task:del']" fixed="left" label="操作" width="150px" align="center">
<el-table-column v-permission="['admin','task:edit','task:del']" fixed="left" label="操作" width="80px" align="center">
<template slot-scope="scope">
<el-dropdown trigger="click" @command="handleCommand">
<span class="el-dropdown-link">
@@ -446,6 +461,7 @@ export default {
vehicle_code: null,
vehicle_type: null,
task_type: '1',
storage_task_type: '',
task_status: null,
priority: 1,
start_point_code: null,