PLCfix
This commit is contained in:
@@ -85,8 +85,8 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
|
||||
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
|
||||
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
|
||||
byte typehigh = (byte) IntToHexHigh(type);
|
||||
byte typelow = (byte) IntToHexLow(type);
|
||||
byte typehigh = (byte) IntToHexHigh(1);
|
||||
byte typelow = (byte) IntToHexLow(1);
|
||||
byte qhdhigh = (byte) IntToHexHigh(startAddress);
|
||||
byte qhdlow = (byte) IntToHexLow(startAddress);
|
||||
byte fhdhigh = (byte) IntToHexHigh(nextAddress);
|
||||
@@ -145,20 +145,15 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
|
||||
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X12,
|
||||
(byte) 0X00, (byte) 0X0A,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X6D,
|
||||
(byte) 0X00, (byte) 0X0E,
|
||||
(byte) 0X00, (byte) 0X06,
|
||||
(byte) indexhigh, (byte) indexlow,
|
||||
(byte) 0X01, (byte) 0X14,
|
||||
(byte) phasehigh, (byte) phaselow,
|
||||
(byte) startPointHigh, (byte) startPointLow,
|
||||
(byte) nextPointHigh, (byte) nextPointLow,
|
||||
(byte) startHighHigh, (byte) startHighLow,
|
||||
(byte) nextHighHigh, (byte) nextHighLow
|
||||
(byte) 0X01, (byte) 0X12,
|
||||
(byte) phasehigh, (byte) phaselow
|
||||
};
|
||||
|
||||
|
||||
log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF));
|
||||
|
||||
System.out.println("反馈agv动作数据:" + Bytes2HexString(b));
|
||||
|
||||
@@ -77,9 +77,9 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + inst.getInstruction_code();
|
||||
agvurl = agvurl + ":" + agvport + "/transportOrders/" + inst.getInstruction_code();
|
||||
|
||||
log.info("下发agv任务请求:{}", agvurl);
|
||||
log.info("下发agv任务请求:{}内容为:{}", agvurl,String.valueOf(jo));
|
||||
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
.body(String.valueOf(jo))//表单内容
|
||||
@@ -103,12 +103,13 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
|
||||
agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
|
||||
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/v1/transportOrders";
|
||||
HttpResponse result = HttpRequest.get(agvurl)
|
||||
agvurl = agvurl + ":" + agvport + "/transportOrders/query";
|
||||
log.info("下发agv查询状态请求:{}内容为:{}", agvurl);
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
.body(String.valueOf(new JSONObject()))//表单内容
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute();
|
||||
System.out.println("查询agv指令数据:" + result.body());
|
||||
log.info("查询agv指令数据:" + result.body());
|
||||
|
||||
return result;
|
||||
} else {
|
||||
@@ -149,85 +150,10 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
//取货的进入前等待和离开等待
|
||||
if (action.equals("Load")) {
|
||||
if ("EntryRequired".equals(type)) {
|
||||
//共挤线三工位
|
||||
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
|
||||
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver();
|
||||
if ((hailiangSmartplcTestDeviceDriver.getAction() == 1 || hailiangSmartplcTestDeviceDriver.getAction() == 3) && hailiangSmartplcTestDeviceDriver.getMove() == 1) {
|
||||
inst.setExecute_status("1");
|
||||
is_feedback = true;
|
||||
}
|
||||
}
|
||||
//叠盘位
|
||||
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
|
||||
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
|
||||
int number = emptyVehicleStackingPositionDeviceDriver.getNumber();
|
||||
if (number < Integer.valueOf(str)) {
|
||||
log.info("叠盘位:" + jobno + "当前层高为:" + number + ",不存在第" + str + "的托盘!");
|
||||
return null;
|
||||
}
|
||||
inst.setExecute_status("1");
|
||||
is_feedback = true;
|
||||
}
|
||||
//货梯对接线
|
||||
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
|
||||
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||
if ((cargoLiftConveyorDeviceDriver.getAction() == 1 || cargoLiftConveyorDeviceDriver.getAction() == 3) && cargoLiftConveyorDeviceDriver.getMove() == 1) {
|
||||
inst.setExecute_status("1");
|
||||
is_feedback = true;
|
||||
}
|
||||
}
|
||||
//豪凯自动线对接位
|
||||
if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||
if ((hongXiangConveyorDeviceDriver.getAction() == 1 || hongXiangConveyorDeviceDriver.getAction() == 3) && hongXiangConveyorDeviceDriver.getMove() == 1) {
|
||||
inst.setExecute_status("1");
|
||||
is_feedback = true;
|
||||
}
|
||||
}
|
||||
//油漆线
|
||||
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) {
|
||||
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||
if ((paintConveyorDeviceDriver.getAction() == 1 || paintConveyorDeviceDriver.getAction() == 3) && paintConveyorDeviceDriver.getMove() == 1) {
|
||||
inst.setExecute_status("1");
|
||||
is_feedback = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if ("PauseOnStation".equals(type)) {
|
||||
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
|
||||
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver();
|
||||
inst.setExecute_status("2");
|
||||
hailiangSmartplcTestDeviceDriver.writing(2);
|
||||
is_feedback = true;
|
||||
}
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
|
||||
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
|
||||
inst.setExecute_status("2");
|
||||
emptyVehicleStackingPositionDeviceDriver.writing(2);
|
||||
is_feedback = true;
|
||||
}
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
|
||||
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||
inst.setExecute_status("2");
|
||||
cargoLiftConveyorDeviceDriver.writing(2);
|
||||
is_feedback = true;
|
||||
}
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||
inst.setExecute_status("2");
|
||||
hongXiangConveyorDeviceDriver.writing(2);
|
||||
is_feedback = true;
|
||||
}
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) {
|
||||
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||
inst.setExecute_status("2");
|
||||
paintConveyorDeviceDriver.writing(2);
|
||||
is_feedback = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -238,21 +164,6 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
jo.put("task_code", inst.getInstruction_code());
|
||||
JSONArray destinations = new JSONArray();
|
||||
String inst_type = inst.getInstruction_type();
|
||||
//如果任务类型为1,在点位进行等待,则查询当前叠盘位的数量,取当前数量的层数进行追加任务
|
||||
// if ("1".equals(inst_type)) {
|
||||
// emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
|
||||
// int current_num = emptyVehicleStackingPositionDeviceDriver.getNumber();
|
||||
// if (current_num > 12) {
|
||||
// log.info("当前叠盘架:" + jobno + "已放满!");
|
||||
// return null;
|
||||
// }
|
||||
// String start_point_code = inst.getStart_point_code();
|
||||
// String next_point_code = inst.getNext_point_code();
|
||||
// start_point_code = start_point_code + "." + (current_num + 1);
|
||||
// destinations.add(destination(start_point_code, "Load", "1", "1"));
|
||||
// destinations.add(destination(next_point_code, "Unload", "1", "1"));
|
||||
//
|
||||
// }
|
||||
|
||||
String resp = acsToWmsService.requestTaskAgain(address,task.getExt_task_id(),inst.getVehicle_code());
|
||||
JSONObject respjson = JSONObject.parseObject(resp);
|
||||
@@ -281,7 +192,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
JSONObject complete = new JSONObject();
|
||||
complete.put("task_code", inst.getInstruction_code());
|
||||
|
||||
String url2 = agvurl + ":" + agvport + "markComplete";
|
||||
String url2 = agvurl + ":" + agvport + "/markComplete";
|
||||
log.info("下发agv任务请求:{}", url2);
|
||||
|
||||
HttpResponse result2 = HttpRequest.post(url2)
|
||||
@@ -294,85 +205,51 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
//放货的进入前等待和离开等待
|
||||
if (action.equals("Unload")) {
|
||||
if ("EntryRequired".equals(type)) {
|
||||
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
|
||||
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver();
|
||||
if ((hailiangSmartplcTestDeviceDriver.getAction() == 2 || hailiangSmartplcTestDeviceDriver.getAction() == 3) && hailiangSmartplcTestDeviceDriver.getMove() == 0) {
|
||||
inst.setExecute_status("3");
|
||||
is_feedback = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
|
||||
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
|
||||
int number = emptyVehicleStackingPositionDeviceDriver.getNumber();
|
||||
if (number >= Integer.valueOf(str)) {
|
||||
log.info("叠盘位:" + jobno + "第" + str + "上有货!");
|
||||
return null;
|
||||
}
|
||||
inst.setExecute_status("3");
|
||||
is_feedback = true;
|
||||
}
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
|
||||
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||
if ((cargoLiftConveyorDeviceDriver.getAction() == 2 || cargoLiftConveyorDeviceDriver.getAction() == 3) && cargoLiftConveyorDeviceDriver.getMove() == 0) {
|
||||
inst.setExecute_status("3");
|
||||
is_feedback = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||
if ((hongXiangConveyorDeviceDriver.getAction() == 2 || hongXiangConveyorDeviceDriver.getAction() == 3) && hongXiangConveyorDeviceDriver.getMove() == 0) {
|
||||
inst.setExecute_status("3");
|
||||
is_feedback = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) {
|
||||
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||
if ((paintConveyorDeviceDriver.getAction() == 2 || paintConveyorDeviceDriver.getAction() == 3) && paintConveyorDeviceDriver.getMove() == 0) {
|
||||
inst.setExecute_status("3");
|
||||
is_feedback = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("PauseOnStation".equals(type)) {
|
||||
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
|
||||
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver();
|
||||
inst.setExecute_status("4");
|
||||
hailiangSmartplcTestDeviceDriver.writing(3);
|
||||
is_feedback = true;
|
||||
}
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
|
||||
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
|
||||
inst.setExecute_status("4");
|
||||
emptyVehicleStackingPositionDeviceDriver.writing(3);
|
||||
is_feedback = true;
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_code", inst.getInstruction_code());
|
||||
JSONArray destinations = new JSONArray();
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
|
||||
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||
inst.setExecute_status("4");
|
||||
cargoLiftConveyorDeviceDriver.writing(3);
|
||||
is_feedback = true;
|
||||
}
|
||||
String resp = acsToWmsService.requestTaskAgain(address,task.getExt_task_id(),inst.getVehicle_code());
|
||||
JSONObject respjson = JSONObject.parseObject(resp);
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||
inst.setExecute_status("4");
|
||||
hongXiangConveyorDeviceDriver.writing(3);
|
||||
is_feedback = true;
|
||||
}
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) {
|
||||
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||
inst.setExecute_status("4");
|
||||
paintConveyorDeviceDriver.writing(3);
|
||||
is_feedback = true;
|
||||
}
|
||||
String next_device_code = respjson.getString("next_point_code");
|
||||
DeviceDto device= deviceService.findByCode(next_device_code);
|
||||
|
||||
destinations.add(destination(device.getRemark(), "Unload", "1", "1"));
|
||||
|
||||
jo.put("destinations", destinations);
|
||||
|
||||
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
|
||||
|
||||
String url = agvurl + ":" + agvport + "/addDestinations";
|
||||
log.info("下发agv任务请求:{}", url);
|
||||
|
||||
HttpResponse result = HttpRequest.post(url)
|
||||
.body(String.valueOf(jo))//表单内容
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute();
|
||||
log.info("下发agv任务请求反馈:{}", result);
|
||||
|
||||
//对任务进行封口
|
||||
JSONObject complete = new JSONObject();
|
||||
complete.put("task_code", inst.getInstruction_code());
|
||||
|
||||
String url2 = agvurl + ":" + agvport + "/markComplete";
|
||||
log.info("下发agv任务请求:{}", url2);
|
||||
|
||||
HttpResponse result2 = HttpRequest.post(url2)
|
||||
.body(String.valueOf(complete))//表单内容
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute();
|
||||
log.info("下发agv任务请求反馈:{}", result2);
|
||||
}
|
||||
|
||||
}
|
||||
JSONObject requestjo = new JSONObject();
|
||||
if (is_feedback) {
|
||||
@@ -388,7 +265,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
|
||||
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
|
||||
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + jobno + "/interact";
|
||||
agvurl = agvurl + ":" + agvport + "/transportOrders/" + jobno + "/interact";
|
||||
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
.body(String.valueOf(requestjo))
|
||||
@@ -406,7 +283,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/v1/" + code + "/markComplete";
|
||||
agvurl = agvurl + ":" + agvport + "/" + code + "/markComplete";
|
||||
log.info("关闭agv运单序列请求:{}", agvurl);
|
||||
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
@@ -542,7 +419,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
|
||||
Instruction instruction = instructionService.findByCode(instCode);
|
||||
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/" + instCode + "/withdrawal";
|
||||
agvurl = agvurl + ":" + agvport + "/transportOrders/" + instCode + "/withdrawal";
|
||||
log.info("删除agv指令请求agvurl:{}", agvurl);
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
.body("{}")
|
||||
|
||||
@@ -195,7 +195,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
if (phase == 0x67) {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[27]));
|
||||
} else {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
|
||||
device = deviceAppService.findDeviceByCode("AGV0" + Integer.toString(arr[20]));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(device)) {
|
||||
if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
|
||||
@@ -32,7 +32,9 @@ public enum DriverTypeEnum {
|
||||
AUTODOOR(10, "standard_autodoor", "标准版-自动门", "autodoor"),
|
||||
TUBANXIAN_SITE(11, "tubanxian_site", "涂板线", "conveyor"),
|
||||
GUHUASHI_SITE(12, "guhuashi_site", "固化室", "conveyor"),
|
||||
TIANNENG_SITE(13, "tianneng_site", "天能-检测站点", "conveyor");
|
||||
TIANNENG_SITE(13, "tianneng_site", "天能-检测站点", "conveyor"),
|
||||
|
||||
BAOSHIJIAN_SITE(14,"baoshijian_site","保湿间","conveyor");
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1738,7 +1738,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
Iterator iterator = storageCells.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
StorageCellDto storageCellDto = (StorageCellDto) iterator.next();
|
||||
if (storageCellDto.getAddress() == code) {
|
||||
if (storageCellDto.getAddress()!=null && storageCellDto.getAddress() == code) {
|
||||
return storageCellDto.getStorage_code();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.nl.acs.device_driver.tianneng.baoshijian;
|
||||
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.enums.DeviceType;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 保湿间驱动
|
||||
* 说明:该站点为保湿间驱动
|
||||
*/
|
||||
@Service
|
||||
public class BaoshijianDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "baoshijian_site";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "保湿间";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "保湿间";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new BaoshijianSiteDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return BaoshijianSiteDeviceDriver.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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
package org.nl.acs.device_driver.tianneng.baoshijian;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
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.data.BaseRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 检测站点驱动
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class BaoshijianSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
|
||||
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||
|
||||
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||
|
||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||
|
||||
TaskMapper taskMapper;
|
||||
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
|
||||
|
||||
String container;
|
||||
String container_type_desc;
|
||||
String last_container_type_desc;
|
||||
String last_container;
|
||||
//放货准备锁
|
||||
String putReadyLock = null;
|
||||
//有货标记
|
||||
protected boolean has_goods_tag = false;
|
||||
|
||||
private Date time = new Date();
|
||||
|
||||
int mode = 0;
|
||||
int error = 0;
|
||||
int move = 0;
|
||||
int task = 0;
|
||||
int action = 0;
|
||||
int last_mode = 0;
|
||||
int last_error = 0;
|
||||
int last_move = 0;
|
||||
int last_task = 0;
|
||||
Boolean isonline = true;
|
||||
int hasGoods = 0;
|
||||
String message = null;
|
||||
Boolean iserror = false;
|
||||
|
||||
int io_action = 0;
|
||||
int last_io_action = 0;
|
||||
int material_type = 0;
|
||||
int last_material_type = 0;
|
||||
int barcode = 0;
|
||||
int last_barcode = 0;
|
||||
|
||||
|
||||
boolean hasVehicle = false;
|
||||
boolean isReady = false;
|
||||
protected int instruction_num = 0;
|
||||
protected int instruction_num_truth = 0;
|
||||
boolean isFold = false;
|
||||
private String assemble_check_tag;
|
||||
|
||||
protected String current_stage_instruction_message;
|
||||
protected String last_stage_instruction_message;
|
||||
Integer heartbeat_tag;
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date instruction_finished_time = new Date();
|
||||
|
||||
private int instruction_require_time_out;
|
||||
boolean in = false;
|
||||
boolean out =false;
|
||||
|
||||
private int instruction_finished_time_out;
|
||||
|
||||
int branchProtocol = 0;
|
||||
//备注
|
||||
String remark;
|
||||
//数量
|
||||
String qty;
|
||||
//物料
|
||||
String material;
|
||||
//批次
|
||||
String batch;
|
||||
//当前指令
|
||||
Instruction inst = null;
|
||||
//上次指令
|
||||
Instruction last_inst = null;
|
||||
|
||||
//触摸屏手动触发任务
|
||||
private Boolean is_has_task = false;
|
||||
|
||||
//满盅入库请求标记
|
||||
boolean Sucess = false;
|
||||
|
||||
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
||||
int flag;
|
||||
|
||||
String devicecode;
|
||||
|
||||
int x0 = 0;
|
||||
int last_x0 = 0;
|
||||
int x1 = 0;
|
||||
int last_x1 = 0;
|
||||
int x2 = 0;
|
||||
int last_x2 = 0;
|
||||
int x3 = 0;
|
||||
int last_x3 = 0;
|
||||
int x4 = 0;
|
||||
int last_x4 = 0;
|
||||
int x5 = 0;
|
||||
int last_x5 = 0;
|
||||
int x6 = 0;
|
||||
int last_x6 = 0;
|
||||
int x7 = 0;
|
||||
int last_x7 = 0;
|
||||
int x8 = 0;
|
||||
int last_x8 = 0;
|
||||
int x9 = 0;
|
||||
int last_x9 = 0;
|
||||
int x10 = 0;
|
||||
int last_x10 = 0;
|
||||
int x35 = 0;
|
||||
int last_x35 = 0;
|
||||
int x36 = 0;
|
||||
int last_x36 = 0;
|
||||
int x37 = 0;
|
||||
int last_x37 = 0;
|
||||
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
String message = null;
|
||||
try {
|
||||
devicecode = this.getDeviceCode();
|
||||
log.info("123:"+devicecode);
|
||||
x0 = this.itemProtocol.getX0();
|
||||
x1 = this.itemProtocol.getX1();
|
||||
x2 = this.itemProtocol.getX2();
|
||||
x3 = this.itemProtocol.getX3();
|
||||
x4 = this.itemProtocol.getX4();
|
||||
x5 = this.itemProtocol.getX5();
|
||||
x6 = this.itemProtocol.getX6();
|
||||
x7 = this.itemProtocol.getX7();
|
||||
x8 = this.itemProtocol.getX8();
|
||||
x9 = this.itemProtocol.getX9();
|
||||
x10 = this.itemProtocol.getX10();
|
||||
x35 = this.itemProtocol.getX35();
|
||||
x36 = this.itemProtocol.getX36();
|
||||
x37 = this.itemProtocol.getX37();
|
||||
|
||||
if (x1 != last_x1 && x1 == 0) {
|
||||
log.info("设备{}反馈收片任务完成", this.devicecode);
|
||||
this.writing("x6", 0);
|
||||
this.writing("x8", 0);
|
||||
} else if (x1 != last_x1 && x1 == 1 ) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
String device_code = this.devicecode + "DJW01";
|
||||
jsonObject.put("device_code", device_code);
|
||||
jsonObject.put("requestDate", new Date());
|
||||
jsonObject.put("requestNo", IdUtil.simpleUUID());
|
||||
jsonObject.put("request_method_code", "TBXMLTASK");
|
||||
String result=acsToWmsService.applyTaskToWms(jsonObject);
|
||||
JSONObject res_jo = JSONObject.parseObject(result);
|
||||
if (res_jo.getString("status").equals("200")){
|
||||
this.writing("x6", 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (x2 != last_x2 && x2 == 0) {
|
||||
log.info("设备{}反馈上空架完成", this.devicecode);
|
||||
this.writing("x5", 0);
|
||||
this.writing("x7", 0);
|
||||
} else if (x2 != last_x2 && x2 == 1) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
String device_code = this.devicecode + "DJW02";
|
||||
jsonObject.put("device_code", device_code);
|
||||
jsonObject.put("requestDate", new Date());
|
||||
jsonObject.put("requestNo", IdUtil.simpleUUID());
|
||||
jsonObject.put("request_method_code", "TBXQKTask");
|
||||
String result=acsToWmsService.applyTaskToWms(jsonObject);
|
||||
JSONObject res_jo = JSONObject.parseObject(result);
|
||||
if (res_jo.getString("status").equals("200")){
|
||||
this.writing("x5", 1);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
}
|
||||
|
||||
last_x0 = x0;
|
||||
last_x1 = x1;
|
||||
last_x2 = x2;
|
||||
last_x3 = x3;
|
||||
last_x4 = x4;
|
||||
last_x5 = x5;
|
||||
last_x6 = x6;
|
||||
last_x7 = x7;
|
||||
last_x8 = x8;
|
||||
last_x9 = x9;
|
||||
last_x10 = x10;
|
||||
last_x35 = x35;
|
||||
last_x36 = x36;
|
||||
last_x37 = x37;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean exe_error() {
|
||||
if (this.error == 0) {
|
||||
return true;
|
||||
} else {
|
||||
log.debug("设备报警");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void executing(Server server, Map<String, Object> itemMap) {
|
||||
this.control(itemMap);
|
||||
}
|
||||
|
||||
|
||||
public void writing(String param, int command) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + param;
|
||||
Map<String, Object> itemMap = new HashMap<>();
|
||||
itemMap.put(to_command, command);
|
||||
this.control(itemMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
String mode = "";
|
||||
String action = "";
|
||||
String move = "";
|
||||
if (this.getMode() == 0) {
|
||||
mode = "未联机";
|
||||
} else if (this.getMode() == 1) {
|
||||
mode = "单机";
|
||||
} else if (this.getMode() == 2) {
|
||||
mode = "联机";
|
||||
} else if (this.getMode() == 3) {
|
||||
mode = "运行中";
|
||||
}
|
||||
|
||||
if (this.getMove() == 0) {
|
||||
move = "无货";
|
||||
jo.put("hasGoods", false);
|
||||
} else if (this.getMove() == 1) {
|
||||
move = "有货";
|
||||
jo.put("hasGoods", true);
|
||||
} else if (this.getMove() == 2) {
|
||||
move = "有托盘有货";
|
||||
jo.put("hasGoods", true);
|
||||
}
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("mode", mode);
|
||||
jo.put("move", move);
|
||||
jo.put("action", action);
|
||||
jo.put("isOnline", this.getIsonline());
|
||||
jo.put("error", this.getError());
|
||||
jo.put("isError", this.getIserror());
|
||||
jo.put("task", this.getTask());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package org.nl.acs.device_driver.tianneng.baoshijian;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device_driver.tianneng.guhuashi.GuhuashiSiteDeviceDriver;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Data
|
||||
public class ItemProtocol {
|
||||
|
||||
public static String item_x0 = "x0";
|
||||
public static String item_x1 = "x1";
|
||||
public static String item_x2 = "x2";
|
||||
public static String item_x3 = "x3";
|
||||
public static String item_x4 = "x4";
|
||||
public static String item_x5 = "x5";
|
||||
public static String item_x6 = "x6";
|
||||
public static String item_x7 = "x7";
|
||||
public static String item_x8 = "x8";
|
||||
public static String item_x9 = "x9";
|
||||
public static String item_x10 = "x10";
|
||||
public static String item_x35 = "x35";
|
||||
public static String item_x36 = "x36";
|
||||
public static String item_x37 = "x37";
|
||||
|
||||
|
||||
private BaoshijianSiteDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(BaoshijianSiteDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getX0() {
|
||||
return this.getOpcIntegerValue(item_x0);
|
||||
}
|
||||
|
||||
public int getX1() {
|
||||
return this.getOpcIntegerValue(item_x1);
|
||||
}
|
||||
|
||||
public int getX2() {
|
||||
return this.getOpcIntegerValue(item_x2);
|
||||
}
|
||||
|
||||
public int getX3() {
|
||||
return this.getOpcIntegerValue(item_x3);
|
||||
}
|
||||
|
||||
public int getX4() {
|
||||
return this.getOpcIntegerValue(item_x4);
|
||||
}
|
||||
|
||||
public int getX5() {
|
||||
return this.getOpcIntegerValue(item_x5);
|
||||
}
|
||||
|
||||
public int getX6() {
|
||||
return this.getOpcIntegerValue(item_x6);
|
||||
}
|
||||
|
||||
public int getX7() {
|
||||
return this.getOpcIntegerValue(item_x7);
|
||||
}
|
||||
|
||||
public int getX8() {
|
||||
return this.getOpcIntegerValue(item_x8);
|
||||
}
|
||||
|
||||
public int getX9() {
|
||||
return this.getOpcIntegerValue(item_x9);
|
||||
}
|
||||
|
||||
public int getX10() {
|
||||
return this.getOpcIntegerValue(item_x10);
|
||||
}
|
||||
|
||||
public int getX35() {
|
||||
return this.getOpcIntegerValue(item_x35);
|
||||
}
|
||||
|
||||
public int getX36() {
|
||||
return this.getOpcIntegerValue(item_x36);
|
||||
}
|
||||
|
||||
public int getX37() {
|
||||
return this.getOpcIntegerValue(item_x37);
|
||||
}
|
||||
|
||||
|
||||
Boolean isonline;
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
try {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public String getOpcStringValue(String protocol) {
|
||||
|
||||
try {
|
||||
String value = this.driver.getStringValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_x0, "系统状态", "400001"));
|
||||
list.add(new ItemDto(item_x1, "收片完成", "400002"));
|
||||
list.add(new ItemDto(item_x2, "需上空架", "400003"));
|
||||
list.add(new ItemDto(item_x3, "门开到位", "400004"));
|
||||
list.add(new ItemDto(item_x4, "门关到位", "400005"));
|
||||
list.add(new ItemDto(item_x10, "备用字", "400011"));
|
||||
list.add(new ItemDto(item_x35, "架数", "400036"));
|
||||
list.add(new ItemDto(item_x36, "备用字", "400037"));
|
||||
list.add(new ItemDto(item_x37, "机号", "400038"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_x5, "上空架中", "400006"));
|
||||
list.add(new ItemDto(item_x6, "下满架中", "400007"));
|
||||
list.add(new ItemDto(item_x7, "上架完成", "400008"));
|
||||
list.add(new ItemDto(item_x8, "下架完成(关门)", "400009"));
|
||||
list.add(new ItemDto(item_x9, "开门请求", "400010"));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -153,16 +153,19 @@ public class ItemProtocol {
|
||||
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);
|
||||
return value;
|
||||
try {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
|
||||
@@ -148,7 +148,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Override
|
||||
public String requestTaskAgain(String address, String task_id, String vehicle_code) {
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
String device_code = deviceService.queryDeviceCodeByAddress(Integer.parseInt(address));
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_id", task_id);
|
||||
String result2 = null;
|
||||
|
||||
@@ -1019,29 +1019,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
if (flag) {
|
||||
|
||||
if (StrUtil.equals(entity.getInstruction_type(), "7")) {
|
||||
CancelTaskRequest cancelTaskRequest = new CancelTaskRequest();
|
||||
cancelTaskRequest.setOrderId(entity.getInstruction_code());
|
||||
cancelTaskRequest.setPalletCode(entity.getVehicle_code());
|
||||
cancelTaskRequest.setSrcLocation(entity.getStart_point_code());
|
||||
cancelTaskRequest.setDestLocation(entity.getNext_point_code());
|
||||
// 1 入库,2 出库,3 移库,4 空托盘入库,5 空托盘出库
|
||||
int type = 0;
|
||||
if (StrUtil.equals(task.getStorage_task_type(), "1")) {
|
||||
type = 1;
|
||||
} else if (StrUtil.equals(task.getStorage_task_type(), "2")) {
|
||||
type = 4;
|
||||
} else if (StrUtil.equals(task.getStorage_task_type(), "3")) {
|
||||
type = 2;
|
||||
} else if (StrUtil.equals(task.getStorage_task_type(), "4")) {
|
||||
type = 5;
|
||||
} else if (StrUtil.equals(task.getStorage_task_type(), "5")) {
|
||||
type = 3;
|
||||
}
|
||||
cancelTaskRequest.setTaskType(type);
|
||||
acsToLiKuService.cancelTask(cancelTaskRequest);
|
||||
}
|
||||
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
@@ -1086,6 +1063,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
return;
|
||||
}
|
||||
removeByCodeFromCache(entity.getInstruction_code());
|
||||
// taskService.cancel(entity.getTask_id());
|
||||
}
|
||||
// this.reload();
|
||||
}
|
||||
|
||||
@@ -234,13 +234,14 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
|
||||
|
||||
@Override
|
||||
public <T extends DeviceDriver> List<T> findDeviceDriver(Class<T> clazz) {
|
||||
List<T> list = new ArrayList();
|
||||
Iterator var3 = this.findAllDevice().iterator();
|
||||
List<T> list = new ArrayList<>();
|
||||
List<Device> devices = new ArrayList<>(this.findAllDevice()); // Create a copy of the collection
|
||||
Iterator<Device> var3 = devices.iterator();
|
||||
|
||||
while (var3.hasNext()) {
|
||||
Device device = (Device) var3.next();
|
||||
Device device = var3.next();
|
||||
DeviceDriver deviceDriver = device.getDeviceDriver();
|
||||
//查找某驱动的所有子类
|
||||
// 查找某驱动的所有子类
|
||||
if (deviceDriver != null && clazz.isAssignableFrom(deviceDriver.getClass())) {
|
||||
list.add((T) device.getDeviceDriver());
|
||||
}
|
||||
@@ -249,6 +250,7 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, String> findDeviceOptions(DeviceType deviceType) {
|
||||
List<Device> list = this.findDevice(deviceType);
|
||||
|
||||
@@ -871,6 +871,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
|
||||
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
request.setTask_code(entity.getTask_code());
|
||||
request.setTask_id(entity.getExt_task_id());
|
||||
request.setTask_status(entity.getTask_status());
|
||||
request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());
|
||||
|
||||
@@ -28,9 +28,11 @@ public class QueryZDAgvTaskStatus {
|
||||
|
||||
public void run() throws Exception {
|
||||
try {
|
||||
log.info("自动线程开始查询浙大AGV任务状态");
|
||||
HttpResponse response2 = agvService.queryAgvInstStatus("1");
|
||||
//查询AGV指令列表
|
||||
JSONArray inst_rows2 = JSONArray.parseArray(response2.body());
|
||||
// JSONArray inst_rows2 = JSONArray.parseArray("");
|
||||
for (int i = 0; i < inst_rows2.size(); i++) {
|
||||
JSONObject inst_jo = inst_rows2.getJSONObject(i);
|
||||
String inst_code = inst_jo.getString("task_code");
|
||||
|
||||
@@ -127,7 +127,7 @@ file:
|
||||
avatarMaxSize: 5
|
||||
logging:
|
||||
file:
|
||||
path: C:\log\wms
|
||||
path: C:\log\acs
|
||||
config: classpath:logback-spring.xml
|
||||
|
||||
# Sa-Token配置
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="AgvNdcOneDeviceDriver" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/AGV驱动与NDC交互/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
</logger>-->
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver" level="info" additivity="false">
|
||||
<appender-ref ref="AgvNdcOneDeviceDriver"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="AutoCreateInst" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/自动创建指令/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
</logger>-->
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.modules.quartz.task.AutoCreateInst" level="info" additivity="false">
|
||||
<appender-ref ref="AutoCreateInst"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="LnshRGVDeviceDriver" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/RGV日志/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
</logger>-->
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.acs.device_driver.lnsh.lnsh_rgv.LnshRGVDeviceDriver" level="info" additivity="false">
|
||||
<appender-ref ref="LnshRGVDeviceDriver"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<define name="DEVICECODE" class="org.nl.modules.logging.DeviceCodeDir"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE_LUCENE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/lucene/${DEVICECODE}/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<appender name="luceneAppender" class="org.nl.modules.lucene.common.LuceneAppender" />
|
||||
<appender name="asyncLuceneAppender" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<appender-ref ref="luceneAppender" />
|
||||
<!-- 设置队列大小,根据您的需求调整 -->
|
||||
<queueSize>512</queueSize>
|
||||
</appender>
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
</logger>-->
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.modules.lucene.service.impl.LuceneExecuteLogServiceImpl" level="info" additivity="true">
|
||||
<appender-ref ref="FILE_LUCENE"/>
|
||||
<appender-ref ref="asyncLuceneAppender"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="NDCAgvServiceImpl" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/NDCAGV服务/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
</logger>-->
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.acs.agv.server.impl.NDCAgvServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="NDCAgvServiceImpl"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="OneNDCSocketConnectionAutoRun" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/NDC交互日志/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
</logger>-->
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.start.auto.run.OneNDCSocketConnectionAutoRun" level="info" additivity="false">
|
||||
<appender-ref ref="OneNDCSocketConnectionAutoRun"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="WmsToAcs" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/WMS请求ACS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
</logger>-->
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.acs.ext.wms.service.impl.WmsToAcsServiceImpl" level="info" additivity="false">
|
||||
<appender-ref ref="WmsToAcs"/>
|
||||
</logger>
|
||||
</included>
|
||||
@@ -11,7 +11,7 @@
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
|
||||
@@ -18,12 +18,19 @@ https://juejin.cn/post/6844903775631572999
|
||||
<!--引入默认的一些设置-->
|
||||
<!--<include resource="log/XrToMes.xml"/>
|
||||
<include resource="log/MesToErp.xml"/>-->
|
||||
<include resource="log/XgAgvDeviceDriver.xml"/>
|
||||
<include resource="log/AutoCreateInst.xml"/>
|
||||
<include resource="log/AcsToWms.xml"/>
|
||||
<include resource="log/WmsToAcs.xml"/>
|
||||
<include resource="log/OneNDCSocketConnectionAutoRun.xml"/>
|
||||
<!-- <include resource="log/Lucene.xml"/>-->
|
||||
<include resource="log/AgvNdcOneDeviceDriver.xml"/>
|
||||
<include resource="log/NDCAgvServiceImpl.xml"/>
|
||||
<include resource="log/LnshRGVDeviceDriver.xml"/>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<withJansi>true</withJansi>
|
||||
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
||||
<!-- <encoder>-->
|
||||
<!-- <encoder>-->
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
@@ -38,13 +45,13 @@ https://juejin.cn/post/6844903775631572999
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>20GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
|
||||
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
||||
<!-- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">-->
|
||||
<!-- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">-->
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
</encoder>
|
||||
@@ -52,9 +59,9 @@ https://juejin.cn/post/6844903775631572999
|
||||
</appender>
|
||||
|
||||
<!--异步到文件-->
|
||||
<!-- <appender name="asyncFileAppender" class="ch.qos.logback.classic.AsyncAppender">-->
|
||||
<!-- <appender name="asyncFileAppender" class="ch.qos.logback.classic.AsyncAppender">-->
|
||||
<appender name="asyncFileAppender" class="com.yomahub.tlog.core.enhance.logback.async.AspectLogbackAsyncAppender">
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<queueSize>500</queueSize>
|
||||
<appender-ref ref="FILE"/>
|
||||
</appender>
|
||||
@@ -65,9 +72,8 @@ https://juejin.cn/post/6844903775631572999
|
||||
|
||||
<!--开发环境:打印控制台-->
|
||||
<springProfile name="dev">
|
||||
<root level="debug">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="MY_FILE"/>
|
||||
<root level="info">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</root>
|
||||
<logger name="org.springframework" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
|
||||
@@ -91,11 +91,13 @@ import xg_agv from '@/views/acs/device/driver/agv/xg_agv'
|
||||
import tubanxian_site from './driver/tubanxian_site.vue'
|
||||
import tianneng_site from './driver/tianneng_site.vue'
|
||||
import guhuashi_site from './driver/guhuashi_site.vue'
|
||||
import baoshijian_site from './driver/baoshijian_site.vue'
|
||||
export default {
|
||||
name: 'DeviceConfig',
|
||||
components: {
|
||||
tianneng_site,
|
||||
guhuashi_site,
|
||||
baoshijian_site,
|
||||
standard_autodoor,
|
||||
tubanxian_site,
|
||||
standard_ordinary_site,
|
||||
|
||||
488
acs/nladmin-ui/src/views/acs/device/driver/baoshijian_site.vue
Normal file
488
acs/nladmin-ui/src/views/acs/device/driver/baoshijian_site.vue
Normal file
@@ -0,0 +1,488 @@
|
||||
<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
|
||||
@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.address" />
|
||||
</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: [],
|
||||
address: ''
|
||||
},
|
||||
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>
|
||||
Reference in New Issue
Block a user