This commit is contained in:
2023-02-14 00:13:42 +08:00
28 changed files with 1571 additions and 362 deletions

View File

@@ -20,7 +20,6 @@
<java.version>1.8</java.version>
<log4jdbc.version>1.16</log4jdbc.version>
<swagger.version>2.9.2</swagger.version>
<fastjson.version>1.2.70</fastjson.version>
<druid.version>1.1.22</druid.version>
<commons-pool2.version>2.5.0</commons-pool2.version>
<mapstruct.version>1.3.1.Final</mapstruct.version>
@@ -34,11 +33,11 @@
<dependencies>
<dependency>
<!--<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.50</version>
</dependency>
</dependency>-->
<!--导出CSV相关-->
<dependency>
<groupId>org.apache.commons</groupId>
@@ -65,21 +64,21 @@
<artifactId>poi-ooxml-schemas</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<!--<dependency>
<groupId>org.openscada.jinterop</groupId>
<artifactId>org.openscada.jinterop.core</artifactId>
<version>2.1.8</version>
</dependency>
<dependency>
</dependency>-->
<!--<dependency>
<groupId>org.openscada.jinterop</groupId>
<artifactId>org.openscada.jinterop.deps</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
</dependency>-->
<!-- <dependency>
<groupId>org.openscada.utgard</groupId>
<artifactId>org.openscada.opc.dcom</artifactId>
<version>1.5.0</version>
</dependency>
</dependency>-->
<dependency>
<groupId>org.openscada.utgard</groupId>
<artifactId>org.openscada.opc.lib</artifactId>
@@ -103,11 +102,11 @@
<version>1.8.0</version>
</dependency>
<dependency>
<!-- <dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.2</version>
</dependency>
</dependency>-->
<!--接口限流-->
<dependency>
@@ -116,11 +115,11 @@
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<!--<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
</dependency>
</dependency>-->
<!--模板引擎-->
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -231,6 +230,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>objenesis</artifactId>
<groupId>org.objenesis</groupId>
</exclusion>
</exclusions>
</dependency>
<!--Spring boot 安全框架-->
@@ -296,6 +301,10 @@
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
<exclusion>
<artifactId>mapstruct</artifactId>
<groupId>org.mapstruct</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
@@ -362,13 +371,6 @@
<version>2.12.0</version>
</dependency>
<!-- fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!--mapStruct依赖-->
<dependency>
<groupId>org.mapstruct</groupId>
@@ -453,6 +455,9 @@
<includes>
<include>**/*.*</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>

View File

@@ -43,7 +43,9 @@ public enum DriverTypeEnum {
SIEMENS_CONVEYOR_LABELING(16, "siemens_conveyor_labeling", "西门子-输送机驱动-贴标", "conveyor"),
SIEMENS_CONVEYOR_CKK(17, "siemens_conveyor_ckk", "西门子-输送机驱动-出库口", "conveyor");
SIEMENS_CONVEYOR_CKK(17, "siemens_conveyor_ckk", "西门子-输送机驱动-出库口", "conveyor"),
SIEMENS_ONEFLOOR_AGV_CONVEYOR(17, "siemens_onefloor_agv_conveyor", "西门子-1LAGV-输送机驱动", "conveyor");
//驱动索引

View File

@@ -20,6 +20,7 @@ import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device.service.*;
import org.nl.acs.device.service.dto.*;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.ScannerDeviceDriver;
import org.nl.acs.device_driver.basedriver.oven_manipulator.OvenGantryManipulatorDeviceDriver;
@@ -32,9 +33,7 @@ import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspect
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_scanner.StandardScannerDeviceDriver;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.opc.*;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.common.utils.RedisUtils;
@@ -76,6 +75,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
private final DeviceDriverDefinationAppService deviceDriverDefinationAppService;
private final DeviceAppService deviceAppService;
private final ParamService paramService;
private final DeviceManageService deviceManageService;
List<StorageCellDto> storageCells = new ArrayList<>();
private Map<String, Integer> storage_address = new HashMap();
@@ -629,27 +629,6 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
}
}
// for(int i=0; i<result.size(); i++) {
// JSONObject jo = (JSONObject) result.get(i);
// JSONObject devicejo = new JSONObject();
// String device_id = jo.getString("device_id");
// String device_code = jo.getString("device_code");
// String device_name = jo.getString("device_name");
// Device device = appService.findDeviceByCode(device_code);
// if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
// int branchProtocol = standardOrdinarySiteDeviceDriver.getBranchProtocol();
// devicejo.put("device_code",device_code);
// devicejo.put("branchProtocol",branchProtocol);
// devicejo.put("qty",standardOrdinarySiteDeviceDriver.getQty());
// devicejo.put("material",standardOrdinarySiteDeviceDriver.getMaterial());
// devicejo.put("status",standardOrdinarySiteDeviceDriver.isRequireSucess());
//
// deviceInfo.add(devicejo);
// }
// }
return deviceInfo;
}
@@ -847,8 +826,25 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
}
}
deviceAppService.removeDevice(device_code);
//deviceAppService.reload();
deviceAppService.addDevice(device_code);
// if (!StrUtil.isEmpty(device.getDriver_code())) {
// DeviceDriverDefination defination = this.deviceDriverDefinationAppService.getDeviceDriverDefination(deviceManage.getDriver_code());
// if (defination != null) {
// device.setDeviceDriverDefination(defination);
// DeviceDriver driver = defination.getDriverInstance(device);
// device.setDeviceDriver(driver);
//
// }
// }
// deviceAppService.reload();
}
@Override

View File

@@ -10,6 +10,7 @@ import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.siemens_onefloor_agv_conveyor.SiemensOneFloorAGVConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
@@ -117,6 +118,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
StandardStorageDeviceDriver standardStorageDeviceDriver;
//
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
//1LAGV取货
SiemensOneFloorAGVConveyorDeviceDriver siemensOneFloorAGVConveyorDeviceDriver;
//分配 车id
//(不需要WCS反馈)
@@ -179,6 +182,23 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
}
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
if (siemensConveyorDeviceDriver.getMove() == 1) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
} else {
log.info("请求取货条件不满足待机有货");
}
}
if (device.getDeviceDriver() instanceof SiemensOneFloorAGVConveyorDeviceDriver) {
siemensOneFloorAGVConveyorDeviceDriver = (SiemensOneFloorAGVConveyorDeviceDriver) device.getDeviceDriver();
if (siemensOneFloorAGVConveyorDeviceDriver.getMove() == 1) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
} else {
log.info("请求取货条件不满足待机有货");
}
}
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
@@ -247,6 +267,24 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
}
if (device.getDeviceDriver() instanceof SiemensOneFloorAGVConveyorDeviceDriver) {
siemensOneFloorAGVConveyorDeviceDriver = (SiemensOneFloorAGVConveyorDeviceDriver) device.getDeviceDriver();
if(siemensOneFloorAGVConveyorDeviceDriver.getTo_command() == 2){
log.info("取货完成请求离开当前输送to_command:"+siemensOneFloorAGVConveyorDeviceDriver.getTo_command());
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
} else {
log.info("取货完成请求离开下发输送信号当前输送to_command:"+siemensOneFloorAGVConveyorDeviceDriver.getTo_command());
List list = new ArrayList();
Map map = new HashMap();
map.put("code", "to_command");
map.put("value", "2");
list.add(map);
siemensOneFloorAGVConveyorDeviceDriver.writing(list);
siemensOneFloorAGVConveyorDeviceDriver.writing(list);
}
}
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);

View File

@@ -142,6 +142,26 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到指令号{}对应的指令", ikey);
return;
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if(ObjectUtil.isNotEmpty(this.device.getExtraValue().get("wait"))
&& StrUtil.equals("true",this.device.getExtraValue().get("wait").toString())){
//
if(standardOrdinarySiteDeviceDriver.getOption() == 1 ){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
log.info("等待LMS系统进行确认允许取货设备号{}", device_code);
}
}
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
}

View File

@@ -158,6 +158,9 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
currentB = this.itemProtocol.getItem_currentB();
currentC = this.itemProtocol.getItem_currentC();
to_temperature = this.itemProtocol.getItem_to_temperature();
if(door != last_door){
logServer.deviceExecuteLog(this.device_code, "", "", "信号door" + last_door + "->" + door);
}
if (mode != last_mode) {
//this.setRequireSucess(false);
}

View File

@@ -158,6 +158,9 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
requireEmptyOutSuccess = false;
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记");
}
if(mode == 6){
requireEmptyInSuccess = false;
}
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
@@ -211,15 +214,12 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
finish_instruction();
logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task);
} else {
// if (!StrUtil.equals(inst.getExecute_code(), this.device_code)) {
// inst.setExecute_device_code(this.device_code);
// instructionService.update(inst);
// }
}
}
} else {
// logServer.deviceExecuteLog(device_code, "", "", "输送线任务开始反馈任务状态,反馈失败,查询不到指令号:" + task);
message = "输送线任务反馈状态,查询不到指令号:" + task +"指令已完成";
inst_message = null;
}
@@ -230,21 +230,11 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage());
}
// if (!this.itemProtocol.getIsonline()) {
// this.setIsonline(false);
// this.setIserror(true);
// message = "信号量同步异常";
// //未联机
// } else
if (mode == 0) {
this.setIsonline(false);
message = "未联机";
//有报警
// } else if (error != 0) {
// this.setIsonline(false);
// this.setIserror(true);
// message = "有报警";
// //无报警
} else {
this.setIsonline(true);
this.setIserror(false);
@@ -257,21 +247,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
List toInstructions;
// if (mode == 2 && move != 0 && task > 0) {
// //inst_message
// inst = instructionService.findByCodeFromCache(String.valueOf(task));
// if (inst != null) {
// inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
// if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
// finish_instruction();
// }
// if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
// inst.setInstruction_status("1");
// instructionService.update(inst);
// }
// }
// }
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
@@ -881,13 +856,11 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
JSONObject jo = JSON.parseObject(str);
if (ObjectUtil.isEmpty(jo)) {
message = "申请空盘入库接口不通";
requireEmptyInSuccess = true;
} else {
if (jo.getInteger("status") == 200) {
message = "申请空盘入库成功";
requireEmptyInSuccess = true;
} else {
requireEmptyInSuccess = true;
message = "申请空盘入库失败," + jo.get("message").toString();
}
}

View File

@@ -0,0 +1,128 @@
package org.nl.acs.device_driver.basedriver.siemens_onefloor_agv_conveyor;
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 java.util.ArrayList;
import java.util.List;
@Slf4j
@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_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_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 SiemensOneFloorAGVConveyorDeviceDriver driver;
public ItemProtocol(SiemensOneFloorAGVConveyorDeviceDriver driver) {
this.driver = driver;
}
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getMove() {
return this.getOpcIntegerValue(item_move);
}
public int getCarrier_direction() {
return this.getOpcIntegerValue(item_carrier_direction);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getTask() {
return this.getOpcIntegerValue(item_task);
}
public int getTo_command() {
return this.getOpcIntegerValue(item_to_command);
}
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;
}
return 0;
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
} else {
return value;
}
return "0";
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_mode, "工作模式", "DB101.B152"));
list.add(new ItemDto(item_move, "光电信号", "DB101.B153"));
list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB101.B154"));
list.add(new ItemDto(item_error, "报警信号", "DB101.B156"));
list.add(new ItemDto(item_task, "任务号", "DB101.D160"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "下发命令", "DB102.W152"));
return list;
}
@Override
public String toString() {
return "";
}
}

View File

@@ -0,0 +1,64 @@
package org.nl.acs.device_driver.basedriver.siemens_onefloor_agv_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 SiemensOneFloorAGVConveyorDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "siemens_onefloor_agv_conveyor";
}
@Override
public String getDriverName() {
return "西门子-1LAGV-输送机驱动";
}
@Override
public String getDriverDescription() {
return "西门子-1LAGV-输送机驱动";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new SiemensOneFloorAGVConveyorDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return SiemensOneFloorAGVConveyorDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.station);
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -0,0 +1,341 @@
package org.nl.acs.device_driver.basedriver.siemens_onefloor_agv_conveyor;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.NDCAgvService;
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.ApplyLabelingAndBindingRequest;
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.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.route.service.dto.RouteLineDto;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
/**
* 西门子-1LAGV-输送机驱动
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
@Autowired
DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class);
@Autowired
RouteLineService routelineserver = SpringContextHolder.getBean(RouteLineService.class);
@Autowired
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
@Autowired
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
@Autowired
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
@Autowired
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
@Autowired
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsService.class);
@Autowired
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
@Autowired
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
//当前指令
Instruction inst = null;
//工作模式
int mode = 0;
int last_mode = 0;
//光电信号
int move = 0;
int last_move = 0;
//托盘方向
int carrier_direction = 0;
int last_carrier_direction = 0;
//报警信号
int error = 0;
int last_error = 0;
//任务号
int task = 0;
int last_task = 0;
int agvphase = 0;
String task_code = null;
int to_command = 0;
int phase = 0;
int index = 0;
Boolean isonline = true;
int hasGoods = 0;
String message = null;
Boolean iserror = false;
Integer heartbeat_tag;
private Date instruction_require_time = new Date();
private Date require_apply_labeling_time = new Date();
private Date require_apply_strangulation_time = new Date();
private Date require_empty_in_time = new Date();
private Date require_empty_out_time = new Date();
private int instruction_require_time_out = 3000;
//行架机械手申请任务成功标识
boolean requireSucess = false;
boolean requireApplyLabelingSuccess = false;
boolean requireApplyLaStrangulationSuccess = false;
boolean requireEmptyInSuccess = false;
boolean requireEmptyOutSuccess = false;
boolean requiresShipDeviceUpdate = true;
private int instruction_finished_time_out;
int branchProtocol = 0;
String inst_message;
String last_inst_message;
//当前指令
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
int flag;
String device_code;
String vehicle_code;
String last_vehicle_code;
@Override
public Device getDevice() {
return this.device;
}
@Override
public void execute() {
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
move = this.itemProtocol.getMove();
carrier_direction = this.itemProtocol.getCarrier_direction();
error = this.itemProtocol.getError();
task = this.itemProtocol.getTask();
to_command = this.itemProtocol.getTo_command();
} catch (Exception var17) {
inst_message = var17.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage());
}
if (mode == 0) {
this.setIsonline(false);
message = "未联机";
} else {
this.setIsonline(true);
this.setIserror(false);
if (error != 0) {
this.setIserror(true);
message = "有报警";
}
}
last_mode = mode;
last_move = move;
last_carrier_direction = carrier_direction;
last_error = error;
last_task = task;
}
public void clearWrite() {
List list = new ArrayList();
Map map = new HashMap();
map.put("code", "to_target");
map.put("value", "0");
list.add(map);
Map map2 = new HashMap();
map2.put("code", "to_task");
map2.put("value", "0");
list.add(map2);
Map map3 = new HashMap();
map3.put("code", "to_command");
map3.put("value", "0");
list.add(map3);
Map map4 = new HashMap();
map4.put("code", "to_strap_times");
map4.put("value", "0");
list.add(map4);
Map map5 = new HashMap();
map5.put("code", "to_length");
map5.put("value", "0");
list.add(map5);
Map map6 = new HashMap();
map6.put("code", "to_weight");
map6.put("value", "0");
list.add(map6);
Map map7 = new HashMap();
map7.put("code", "to_height");
map7.put("value", "0");
list.add(map7);
this.writing(list);
message = null;
vehicle_code = null;
}
public boolean exe_business() {
return true;
}
public synchronized boolean finish_instruction() throws Exception {
instructionService.finish(inst);
// requireSucess = false;
return true;
}
protected void thingToNothing() throws Exception {
requireSucess = false;
}
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;
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, Integer.parseInt(value));
this.control(itemMap);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
}
public void executing(Server server, Map<String, Object> itemMap) {
this.control(itemMap);
}
public void writing(int command) {
Map<String, Object> itemMap = new HashMap<String, Object>();
this.control(itemMap);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String move = "";
String carrier_direction = "";
if (this.getMode() == 0) {
mode = "脱机";
} else if (this.getMode() == 1) {
mode = "单机";
} else if (this.getMode() == 2) {
mode = "待机";
} else if (this.getMode() == 3) {
mode = "运行中";
} else if (this.getMode() == 4) {
mode = "申请捆扎中";
} else if (this.getMode() == 5) {
mode = "申请贴标中";
} else if (this.getMode() == 6) {
mode = "申请空盘入库中";
} else if (this.getMode() == 7) {
mode = "申请空盘出库中";
} else if (this.getMode() == 8) {
mode = "申请AGV任务中";
}
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);
}
if (this.carrier_direction == 1) {
carrier_direction = "正转";
} else if (this.carrier_direction == 2) {
carrier_direction = "反转";
}
String requireSucess = "0";
if (this.requireSucess) {
requireSucess = "1";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("carrier_direction", carrier_direction);
jo.put("task", task);
jo.put("last_task", last_task);
jo.put("task_code", task_code);
jo.put("inst_message", this.inst_message);
jo.put("last_inst_message", this.last_inst_message);
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
jo.put("is_click", true);
jo.put("requireSucess", requireSucess);
jo.put("driver_type", "siemens_conveyor");
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
String requestSucess = data.getString("requireSucess");
if (StrUtil.equals(requestSucess, "0")) {
this.requireSucess = false;
} else if (StrUtil.equals(requestSucess, "1")) {
this.requireSucess = true;
}
}
public void writing(List list) {
Map<String, Object> itemMap = new HashMap<String, Object>();
for (int i = 0; i < list.size(); i++) {
Object ob = list.get(i);
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
if (!StrUtil.isEmpty(json.getString("value"))) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + json.getString("code");
itemMap.put(to_param, json.getString("value"));
}
}
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
this.control(itemMap);
}
}

View File

@@ -112,6 +112,13 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_task2);
}
public int getTo_command1() {
return this.getOpcIntegerValue(item_to_command1);
}
public int getTo_command2() {
return this.getOpcIntegerValue(item_to_command2);
}
//是否有货
public int hasGoods(int move) {

View File

@@ -91,7 +91,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
int last_task1 = 0;
int task2 = 0;
int last_task2 = 0;
int to_command1 = 0;
int to_command2 = 0;
Boolean isonline = true;
//前工位申请任务请求标记
@@ -155,6 +156,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
type = this.itemProtocol.getType();
task1 = this.itemProtocol.getTask1();
task2 = this.itemProtocol.getTask2();
to_command1 = this.itemProtocol.getTo_command1();
to_command2 = this.itemProtocol.getTo_command2();
if (mode != last_mode) {
if (mode == 2) {
@@ -243,19 +246,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
inst2.setInstruction_status("1");
inst2.setExecute_device_code(this.device_code);
instructionService.update(inst2);
// TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code());
// if (!ObjectUtil.isEmpty(taskDto)) {
// if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
// JSONArray array = new JSONArray();
// JSONObject map = new JSONObject();
// map.put("task_id", taskDto.getExt_task_id());
// map.put("task_status", "1");
// array.add(map);
// acsToWmsService.feedbackTaskStatusToWms(array);
// }
// }
;
// this.setNow_steps_type2(1);
}
}
}
@@ -270,18 +260,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
inst2.setInstruction_status("1");
inst2.setExecute_device_code(this.device_code);
instructionService.update(inst2);
// TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code());
// if (!ObjectUtil.isEmpty(taskDto)) {
// if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
// JSONArray array = new JSONArray();
// JSONObject map = new JSONObject();
// map.put("task_id", taskDto.getExt_task_id());
// map.put("task_status", "1");
// array.add(map);
// acsToWmsService.feedbackTaskStatusToWms(array);
// }
// }
;
}
}
}
@@ -302,7 +280,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
int move = siemensConveyorDeviceDriver.getMove();
int mode = siemensConveyorDeviceDriver.getMode();
if (mode == 2 && move == 1) {
this.writing("to_command2", "2");
if(to_command2 != 2){
this.writing("to_command2", "2");
}
if (type == 2) {
this.setNow_steps_type2(3);
} else if (type == 3) {
@@ -340,7 +320,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//单任务/或双任务 后工位收到取货完成信号并反馈
if (mode == 3 && action2 == 2 && move2 == 1 && task2 > 0) {
this.writing("to_command2", "3");
if(to_command2 != 3){
this.writing("to_command2", "3");
}
if (type == 2) {
this.setNow_steps_type2(4);
}
@@ -367,7 +349,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//单任务/双任务 前工位取货时判断动作信号并反馈
if (mode == 3 && action1 == 1 && move1 == 0 && task1 > 0) {
this.writing("to_command1", "2");
if(to_command1 != 2){
this.writing("to_command1", "2");
}
if (type == 1) {
this.setNow_steps_type1(3);
} else if (type == 3) {
@@ -393,7 +377,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//单任务/双任务 前工位取货完成并反馈
if (mode == 3 && action1 == 2 && move1 == 1 && task1 > 0) {
this.writing("to_command1", "3");
if(to_command1 != 3){
this.writing("to_command1", "3");
}
if (type == 1) {
this.setNow_steps_type1(4);
}
@@ -421,7 +407,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//单任务/双任务 后工位放货时判断信号并反馈
if (mode == 3 && action2 == 3 && move2 == 1 && task2 > 0) {
this.writing("to_command2", "4");
if(to_command2 != 4){
this.writing("to_command2", "4");
}
if (type == 2) {
this.setNow_steps_type2(5);
} else if (type == 3) {
@@ -452,19 +440,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
if (inst2 != null) {
if (StrUtil.equals(inst2.getInstruction_status(), "1")) {
finish_instruction(inst2);
TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code());
if (!ObjectUtil.isEmpty(taskDto)) {
if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
JSONArray array = new JSONArray();
JSONObject map = new JSONObject();
map.put("task_id", taskDto.getExt_task_id());
map.put("task_status", "2");
array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array);
}
if(to_command2 != 5){
this.writing("to_command2", "5");
}
;
this.writing("to_command2", "5");
this.setNow_steps_type2(6);
this.setNow_steps_type2(0);
}
@@ -492,7 +470,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//双任务 后工位反馈任务完成 并反馈
if (mode == 3 && action2 == 4 && move2 == 0 && task1 > 0 && task2 > 0 && type == 3) {
this.writing("to_command2", "5");
if(to_command2 != 5){
this.writing("to_command2", "5");
}
this.setNow_steps_type3(8);
} else {
if (this.getNow_steps_type3() == 7) {
@@ -538,7 +518,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
int move = siemensConveyorDeviceDriver.getMove();
int mode = siemensConveyorDeviceDriver.getMode();
if (move == 1 && mode == 2) {
this.writing("to_command1", "4");
if(to_command1 != 4){
this.writing("to_command1", "4");
}
if (type == 1) {
this.setNow_steps_type1(5);
} else if (type == 3) {
@@ -582,19 +564,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
if (inst1 != null) {
if (StrUtil.equals(inst1.getInstruction_status(), "1")) {
this.finish_instruction(inst1);
TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code());
if (!ObjectUtil.isEmpty(taskDto)) {
if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
JSONArray array = new JSONArray();
JSONObject map = new JSONObject();
map.put("task_id", taskDto.getExt_task_id());
map.put("task_status", "2");
array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array);
}
if(to_command1 != 5){
this.writing("to_command1", "5");
}
;
this.writing("to_command1", "5");
this.setNow_steps_type1(6);
this.setNow_steps_type1(0);
}
@@ -628,19 +600,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
if (inst1 != null) {
if (StrUtil.equals(inst1.getInstruction_status(), "1")) {
this.finish_instruction(inst1);
TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code());
if (!ObjectUtil.isEmpty(taskDto)) {
if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
JSONArray array = new JSONArray();
JSONObject map = new JSONObject();
map.put("task_id", taskDto.getExt_task_id());
map.put("task_status", "2");
array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array);
}
if(to_command1 != 5){
this.writing("to_command1", "5");
}
;
this.writing("to_command1", "5");
this.setNow_steps_type3(10);
this.setNow_steps_type3(0);
}
@@ -673,16 +635,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} catch (Exception var17) {
feedMessage = var17.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage());
// return;
}
// if (!this.itemProtocol.getIsonline()) {
// this.setIsonline(false);
// this.setIserror(true);
// message = "信号量同步异常";
// //未联机
// } else
if (mode == 0) {
if (mode == 0) {
this.setIsonline(false);
message = "未联机";
//有报警
@@ -725,11 +680,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
feedMessage = "";
notCreateInstMessage = "";
notCreateTaskMessage = "";
logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",action1:" + action1 + ",requireSucess:" + requireSucess);
} else {
// if (!requireSucess) {
// remark = remark + "请求标记为true,请检查mode是否由其他值变为2";
// }
if (!requireSucess) {
String remark = "";
if (mode != 2) {
@@ -1140,12 +1092,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
list.add(map6);
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "下发前工位任务");
// this.writing("to_onset1", start_addr);
// this.writing("to_target1", next_addr);
// this.writing("to_task1", dto.getInstruction_code());
// this.writing("to_command1", "1");
// this.writing("to_type", "1");
this.setNow_steps_type1(2);
} else if (StrUtil.equals(type, "2")) {
Map map1 = new HashMap();
@@ -1175,12 +1121,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
list.add(map6);
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "下发后工位任务");
// this.writing("to_onset2", start_addr);
// this.writing("to_target2", next_addr);
// this.writing("to_task2", dto.getInstruction_code());
// this.writing("to_command2", "1");
// this.writing("to_type", "2");
this.setNow_steps_type2(2);
} else if (StrUtil.equals(type, "3")) {
String start_device_code2 = dto.getStart_device_code2();
@@ -1230,16 +1170,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
this.writing(list);
logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "下发双工位任务");
// this.writing("to_onset1", start_addr2);
// this.writing("to_target1", next_addr2);
// this.writing("to_task1", dto.getInstruction_code());
// this.writing("to_command1", "1");
// this.writing("to_onset2", start_addr);
// this.writing("to_target2", next_addr);
// this.writing("to_task2", dto.getInstruction_code());
// this.writing("to_command2", "1");
// this.writing("to_type", "3");
this.setNow_steps_type3(2);
}

View File

@@ -107,7 +107,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
String message;
// 1 上位系统允许进入 2 上位系统允许离开
int status = 0;
int option = 0;
int agvphase = 0;
int index = 0;

View File

@@ -70,7 +70,7 @@ public class WmsToAcsController {
}
@PostMapping("/querydevice")
@Log(value = "WMS查询设备状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
// @Log(value = "WMS查询设备状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
@ApiOperation("WMS查询设备状态")
@SaIgnore
public ResponseEntity<Object> queryDevice(@RequestBody String whereJson) throws Exception {
@@ -94,4 +94,11 @@ public class WmsToAcsController {
return new ResponseEntity<>(wmstoacsService.putPlusPullAction(whereJson), HttpStatus.OK);
}
@PostMapping("/updateTask")
@Log(value = "WMS更新任务点位状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
@ApiOperation("WMS更新任务点位状态")
@SaIgnore
public ResponseEntity<Object> updateTask(@RequestBody String whereJson){
return new ResponseEntity<>(wmstoacsService.updateTask(whereJson), HttpStatus.OK);
}
}

View File

@@ -84,4 +84,12 @@ public interface WmsToAcsService {
Map<String, Object> putPlusPullAction(String whereJson);
/**
* 更新任务点位状态
*
* @param whereJson 条件
* @return Map<String, Object>
*/
Map<String, Object> updateTask(String whereJson);
}

View File

@@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
import org.nl.acs.common.IDriverService;
import org.nl.acs.common.StandardOrdinarySiteDevice;
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;
@@ -16,6 +17,8 @@ import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDe
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDefination;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.ext.wms.data.*;
import org.nl.acs.ext.wms.liKuData.Resp;
import org.nl.acs.ext.wms.service.AcsToLiKuService;
@@ -728,9 +731,41 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
MDC.remove(log_file_type);
}
}
@Override
public Map<String, Object> updateTask(String whereJson) {
JSONArray datas = JSONArray.parseArray(whereJson);
log.info("updateTask--------------:输入参数" + datas.toString());
JSONObject map = new JSONObject();
if (datas.size() > 0) {
for (int i = 0; i < datas.size(); i++) {
JSONObject jsonObject = datas.getJSONObject(i);
String device_code = jsonObject.getString("device_code");
String task_code = jsonObject.getString("task_code");
//1-允许取放; 2-允许离开
String option = jsonObject.getString("option");
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
Device device_k = deviceAppService.findDeviceByCode(device_code+"_K");
Device device_m = deviceAppService.findDeviceByCode(device_code+"_M");
if(device_k.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_k.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
}
if(device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_m.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
}
}
}
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.OK);
resultJson.put("message", "操作成功");
resultJson.put("data", map);
return resultJson;
}
}

View File

@@ -81,4 +81,9 @@ public interface DeviceAppService {
*/
String findDeviceTypeByCode(String deviceCode);
void removeDevice(String deviceCode);
void addDevice(String deviceCode);
}

View File

@@ -302,6 +302,51 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
return null;
}
@Override
public void removeDevice(String deviceCode) {
Iterator<Device> iterator = devices.iterator();
while (iterator.hasNext()) {
Device device = iterator.next();
if (StrUtil.equals(device.getDevice_code(), deviceCode)) {
iterator.remove();
}
}
Iterator<String> iterator2 = code_indexs.iterator();
while (iterator2.hasNext()) {
String str = iterator2.next();
if (StrUtil.equals(str, deviceCode)) {
iterator2.remove();
}
}
}
@Override
public void addDevice(String deviceCode) {
List<DeviceManageDto> deviceManageDtos = this.deviceManageService.queryAllWithExtra(deviceCode);
int i = 0;
for (int size = deviceManageDtos.size(); i < size; ++i) {
DeviceManageDto deviceManage = (DeviceManageDto) deviceManageDtos.get(i);
Device device = new Device();
BeanUtil.copyProperties(deviceManage, device);
this.devices.add(device);
this.code_indexs.add(device.getDevice_code());
if (!StrUtil.isEmpty(device.getDriver_code())) {
DeviceDriverDefination defination = this.deviceDriverDefinationAppService.getDeviceDriverDefination(deviceManage.getDriver_code());
if (defination != null) {
device.setDeviceDriverDefination(defination);
DeviceDriver driver = defination.getDriverInstance(device);
device.setDeviceDriver(driver);
}
}
}
}
public List<LinewayDeviceDriver> findLaneway() {
return this.findDeviceDriver(LinewayDeviceDriver.class);
}

View File

@@ -4,4 +4,7 @@ import java.util.List;
public interface DeviceManageService {
List<DeviceManageDto> queryAllWithExtra();
List<DeviceManageDto> queryAllWithExtra(String device_code);
}

View File

@@ -78,4 +78,69 @@ public class DeviceManageServiceImpl implements DeviceManageService {
return devices;
}
@Override
public List<DeviceManageDto> queryAllWithExtra(String device_code) {
JSONArray arr = WQLObject.getWQLObject("acs_device").query("device_code = '" + device_code + " '").getResultJSONArray(0);
JSONArray extArr = WQLObject.getWQLObject("acs_device_extra").query("device_code = '" + device_code + " '").getResultJSONArray(0);
List<DeviceExtraManageDto> extras = extArr.toJavaList(DeviceExtraManageDto.class);
WQLObject runpointTab = WQLObject.getWQLObject("acs_device_runpoint");
WQLObject opcTab = WQLObject.getWQLObject("acs_opc");
//OPC_PLC表【acs_opc_plc】
WQLObject plcTab = WQLObject.getWQLObject("acs_opc_plc");
List<DeviceManageDto> devices = new ArrayList<>();
for (int i = 0; i < arr.size(); i++) {
JSONObject json = arr.getJSONObject(i);
DeviceManageDto device = json.toJavaObject(DeviceManageDto.class);
String opc_server_id = json.getString("opc_server_id");
String opc_plc_id = json.getString("opc_plc_id");
if (StrUtil.isNotEmpty(opc_plc_id) && StrUtil.isNotEmpty(opc_server_id)) {
//OPC表【acs_opc】
JSONObject rb = opcTab.query("is_delete= '0' AND is_active= '1' AND opc_id = '" + opc_server_id + "'").uniqueResult(0);
if(ObjectUtil.isEmpty(rb)){
System.out.println(device.getDevice_code());
continue;
}
String opc_code= rb.getString("opc_code");
device.setOpc_server_code(opc_code);
if(ObjectUtil.isEmpty(plcTab.query("is_delete= '0' AND is_active= '1' AND plc_id = '" + opc_plc_id + "'").uniqueResult(0)))
{
System.out.println(device.getDevice_code());
continue;
}
String plc_code = plcTab.query("is_delete= '0' AND is_active= '1' AND plc_id = '" + opc_plc_id + "'").uniqueResult(0).getString("plc_code");
device.setOpc_plc_code(plc_code);
}
devices.add(device);
}
Iterator it = devices.iterator();
while (it.hasNext()) {
DeviceManageDto device = (DeviceManageDto) it.next();
Iterator var5 = extras.iterator();
while (var5.hasNext()) {
DeviceExtraManageDto extra = (DeviceExtraManageDto) var5.next();
if (extra.getDevice_id().equals(device.getDevice_id())) {
device.getExtra().add(extra);
if (StrUtil.equals(extra.getExtra_code(), "station_manager") && StrUtil.equals(extra.getExtra_value().toString(), "true")) {
String has_goods = runpointTab.query("is_delete= '0' AND is_active= '1' AND device_id = '" + extra.getDevice_id() + "'").uniqueResult(0).getString("hasgoods");
String material_type = runpointTab.query("is_delete= '0' AND is_active= '1' AND device_id = '" + extra.getDevice_id() + "'").uniqueResult(0).getString("material_type");
String batch = runpointTab.query("is_delete= '0' AND is_active= '1' AND device_id = '" + extra.getDevice_id() + "'").uniqueResult(0).getString("batch");
String islock = runpointTab.query("is_delete= '0' AND is_active= '1' AND device_id = '" + extra.getDevice_id() + "'").uniqueResult(0).getString("islock");
device.setMaterial_type(material_type);
device.setHas_goods(Integer.parseInt(has_goods));
device.setBatch(batch);
device.setIslock(islock);
}
}
}
}
return devices;
}
}

View File

@@ -120,8 +120,8 @@ public class DeviceOpcProtocolRunable implements Runnable {
try {
itemStatus = group.read(true, (Item[]) itemsMap.values().toArray(new Item[0]));
} catch (Exception e){
// System.out.println("数据同步异常:"+itemsMap);
e.printStackTrace();
System.out.println("数据同步异常:"+ this.getOpcServer().getOpc_code());
//e.printStackTrace();
}
long end = System.currentTimeMillis();
log.trace("{} 开始记时{}", tag, DateUtil.now());
@@ -138,7 +138,7 @@ public class DeviceOpcProtocolRunable implements Runnable {
time_out = false;
}
if(ObjectUtil.isEmpty(itemStatus)) continue label97;
// if(ObjectUtil.isEmpty(itemStatus)) continue label97;
Set<Item> items = itemStatus.keySet();
Iterator var18 = items.iterator();

View File

@@ -53,7 +53,8 @@ public class StringUtils {
private static final UserAgentAnalyzer USER_AGENT_ANALYZER = UserAgentAnalyzer
.newBuilder()
.hideMatcherLoadStats()
.withCache(10000)
.withCache(1)
// .withCache(10000)
.withField(UserAgent.AGENT_NAME_VERSION)
.build();

View File

@@ -95,6 +95,7 @@ import hongxiang_conveyor from '@/views/acs/device/driver/hongxiang_conveyor'
import plug_pull_device_site from '@/views/acs/device/driver/plug_pull_device_site'
import siemens_conveyor_labeling from '@/views/acs/device/driver/siemens_conveyor_labeling'
import siemens_conveyor_ckk from '@/views/acs/device/driver/siemens_conveyor_ckk'
import siemens_onefloor_agv_conveyor from '@/views/acs/device/driver/siemens_onefloor_agv_conveyor'
export default {
name: 'DeviceConfig',
@@ -120,7 +121,8 @@ export default {
slit_two_manipulator,
plug_pull_device_site,
siemens_conveyor_labeling,
siemens_conveyor_ckk
siemens_conveyor_ckk,
siemens_onefloor_agv_conveyor
},
dicts: ['device_type'],
mixins: [crud],

View File

@@ -0,0 +1,530 @@
<template>
<!--标准版-1LAGV-输送机-->
<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="dbr_value2">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" />
</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: 'StandardConveyorControl',
mixins: [crud],
props: {
parentForm: {
type: Object,
require: true
}
},
data() {
return {
device_code: '',
device_id: '',
plc_id: '',
plc_code: '',
address: '',
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) {
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('mode') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 0)
}
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('carrier_direction') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
}
if (this.data1[val].code.indexOf('error') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
}
if (this.data1[val].code.indexOf('task') !== -1) {
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 8)
}
}
}
},
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
}
console.log(endNumber)
for (const val in this.data2) {
if (this.data2[val].code.indexOf('to_command') !== -1) {
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 0)
}
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_container_type') !== -1) {
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 4)
}
if (this.data2[val].code.indexOf('to_task') !== -1) {
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
}
if (this.data2[val].code.indexOf('to_strap_times') !== -1) {
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 10)
}
if (this.data2[val].code.indexOf('to_length') !== -1) {
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 12)
}
if (this.data2[val].code.indexOf('to_weight') !== -1) {
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 14)
}
if (this.data2[val].code.indexOf('to_height') !== -1) {
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 16)
}
}
}
},
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_read2() {
testRead(this.data2, this.opc_id).then(data => {
this.data2 = data
console.log(this.data2)
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

@@ -45,22 +45,6 @@
<version>6.1.4</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.elasticsearch.client</groupId>-->
<!-- <artifactId>elasticsearch-rest-high-level-client</artifactId>-->
<!-- <version>7.6.1</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.elasticsearch.client</groupId>-->
<!-- <artifactId>elasticsearch-rest-client</artifactId>-->
<!-- <version>7.6.1</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.elasticsearch</groupId>-->
<!-- <artifactId>elasticsearch</artifactId>-->
<!-- <version>7.6.1</version>-->
<!-- </dependency>-->
<!-- logback appender日志-->
<dependency>
<groupId>com.internetitem</groupId>

View File

@@ -69,7 +69,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
*/
@Override
public Map<String, Object> receiveTaskStatusAcs(String string) {
log.info("receiveTaskStatusAcs请求参数--------------------------------------"+string);
log.info("receiveTaskStatusAcs请求参数--------------------------------------" + string);
JSONArray array = JSONArray.parseArray(string);
//返回处理失败的任务
JSONArray errArr = new JSONArray();
@@ -265,47 +265,58 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
3、任务下发判断巷道的任务类型只能为空盘入库或者无任务类型
* */
vehicle_code = CodeUtil.getNewCode("VEHICCLE_CODE_KTP");
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "21").process().uniqueResult(0);
JSONArray emptyArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "21").process().getResultJSONArray(0);
JSONObject struct_jo = new JSONObject();
if (ObjectUtil.isNotEmpty(empty_row)) {
for (int i = 0; i < emptyArr.size(); i++) {
JSONObject empty_row = emptyArr.getJSONObject(i);
String block_num = empty_row.getString("block_num");
String row_num = empty_row.getString("row_num");
String placement_type = empty_row.getString("placement_type");
if (placement_type.equals("03")) {
// 右通
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq desc").uniqueResult(0);
} else if (placement_type.equals("02")) {
// 左通
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq").uniqueResult(0);
} else {
// 双通
JSONArray isLock = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('4','5') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
// 先倒序找到第一个托盘、判断上一个是否有货位
JSONObject jsonDescBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
String out_order_seq = jsonDescBox.getString("out_order_seq");
// 上一个货位顺序号
String out_order_seq_desc = String.valueOf(NumberUtil.add(out_order_seq, "1"));
JSONObject jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq = '" + out_order_seq_desc + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonDescStruct)) {
struct_jo = jsonDescStruct;
if (ObjectUtil.isEmpty(isLock)) {
if (placement_type.equals("03")) {
// 右通
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq desc").uniqueResult(0);
break;
} else if (placement_type.equals("02")) {
// 左通
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq").uniqueResult(0);
break;
} else {
// 没有就正序找到第一个托盘、判断上一个是否有货位
JSONObject jsonAscBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
String out_order_seq2 = jsonAscBox.getString("out_order_seq");
// 上一个货位顺序号
String out_order_seq_asc = String.valueOf(NumberUtil.sub(out_order_seq2, "1"));
JSONObject jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq = '" + out_order_seq_asc + "'").uniqueResult(0);
// 双通
if (ObjectUtil.isNotEmpty(jsonAscStruct)) {
struct_jo = jsonAscStruct;
// 先倒序找到第一个托盘、判断上一个是否有货位
JSONObject jsonDescBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
String out_order_seq = jsonDescBox.getString("out_order_seq");
// 上一个货位顺序号
JSONObject jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonDescStruct)) {
struct_jo = jsonDescStruct;
break;
} else {
// 没有就正序找到第一个托盘、判断上一个是否有货位
JSONObject jsonAscBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
String out_order_seq2 = jsonAscBox.getString("out_order_seq");
// 上一个货位顺序号
JSONObject jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonAscStruct)) {
struct_jo = jsonAscStruct;
break;
}
}
}
} else {
continue;
}
}
if (ObjectUtil.isEmpty(struct_jo)) {
throw new BadRequestException("未查询到可用的空载具存放点位!");
}
@@ -333,20 +344,31 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
b、没有则优先找空的巷道按空位置顺序分配
3、任务下发判断巷道的任务类型只能为空盘入库或者无任务类型
* */
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "22").process().uniqueResult(0);
JSONArray empArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "22").process().getResultJSONArray(0);
JSONObject struct_jo = new JSONObject();
if (ObjectUtil.isNotEmpty(empty_row)) {
for (int i = 0; i < empArr.size(); i++) {
JSONObject empty_row = empArr.getJSONObject(i);
String block_num = empty_row.getString("block_num");
String row_num = empty_row.getString("row_num");
String placement_type = empty_row.getString("placement_type");
if (placement_type.equals("01") || placement_type.equals("03")) {
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq").uniqueResult(0);
JSONArray isLock = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('4','5') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(isLock)) {
if (placement_type.equals("01") || placement_type.equals("03")) {
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq").uniqueResult(0);
break;
} else {
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq desc").uniqueResult(0);
break;
}
} else {
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq desc").uniqueResult(0);
continue;
}
}
if (ObjectUtil.isEmpty(struct_jo)) {
throw new BadRequestException("未查询到可用的空载具!");
}
@@ -364,6 +386,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
map.put("lock_type", "4");
point_table.update(map, "point_code = '" + struct_jo.getString("struct_code") + "'");
struct_table.update(map, "struct_code = '" + struct_jo.getString("struct_code") + "'");
}
if (type.equals("4")) {
//查询该木箱对应的包装关系
@@ -484,7 +509,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public JSONObject deviceApply(JSONObject whereJson) {
log.info("deviceApply请求参数---------------------------------------------"+whereJson.toString());
log.info("deviceApply请求参数---------------------------------------------" + whereJson.toString());
String vehicle_code = whereJson.getString("vehicle_code");
String weight = whereJson.getString("weight");
String type = whereJson.getString("type");
@@ -547,13 +572,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
data.put("box_width", box_width);
data.put("box_high", box_high);
data.put("bundle_times", 2);
result.put("data",data);
result.put("data", data);
} else if (type.equals("3")) {
//烘箱出箱任务
String device_code = whereJson.getString("device_code");
JSONObject bake_jo = new JSONObject();
bake_jo.put("point_code",device_code);
bake_jo.put("option","2");
bake_jo.put("point_code", device_code);
bake_jo.put("option", "2");
new BakingServiceImpl().ovenInAndOut(bake_jo);
} else {
throw new BadRequestException("请输入正确的任务类型!");
@@ -563,7 +588,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public JSONObject process(JSONObject whereJson) {
log.info("process请求参数---------------------------------------------"+whereJson.toString());
log.info("process请求参数---------------------------------------------" + whereJson.toString());
String vehicle_code = whereJson.getString("vehicle_code");
String ext_task_id = whereJson.getString("ext_task_id");
String srcLocation = whereJson.getString("srcLocation");
@@ -630,20 +655,20 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public JSONObject shipDeviceUpdate(JSONObject whereJson) {
log.info("shipDeviceUpdate请求参数---------------------------------------------"+whereJson.toString());
log.info("shipDeviceUpdate请求参数---------------------------------------------" + whereJson.toString());
String device_code = whereJson.getString("device_code");
if (StrUtil.isEmpty(device_code)){
if (StrUtil.isEmpty(device_code)) {
throw new BadRequestException("输入的设备号不能为空!");
}
//查询该设备对应的输送线点位
JSONObject deliver_jo = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("point_code = '"+device_code+"'").uniqueResult(0);
if (deliver_jo != null){
JSONObject deliver_jo = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("point_code = '" + device_code + "'").uniqueResult(0);
if (deliver_jo != null) {
String qzzno = deliver_jo.getString("qzzno");
if (ObjectUtil.isNotEmpty(deliver_jo)){
deliver_jo.put("point_status","01");
deliver_jo.put("qzzno","");
deliver_jo.put("vehicle_code","");
if (ObjectUtil.isNotEmpty(deliver_jo)) {
deliver_jo.put("point_status", "01");
deliver_jo.put("qzzno", "");
deliver_jo.put("vehicle_code", "");
WQLObject.getWQLObject("st_ivt_deliverypointivt").update(deliver_jo);
//如果为靠近分切机一端的输送点,判断远离端是否需要进行横移
@@ -657,18 +682,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
.addParam("point_code", device_code)
.addParam("product_area", product_area)
.addParam("sort_seq", sort_seq)
.addParam("find_type","1")
.addParam("find_type", "1")
.addParam("flag", "17").process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(right_point) && !right_point.getString("point_status").equals("01")) {
//创建载具横移任务
String translate_code1 = right_point.getString("point_code");
String translate_code2 = device_code;
JSONObject tran_jo = new JSONObject();
tran_jo.put("point_code1",translate_code1);
tran_jo.put("point_code2",translate_code2);
tran_jo.put("vehicle_code",right_point.getString("qzzno"));
tran_jo.put("vehicle_code2",right_point.getString("vehicle_code"));
tran_jo.put("task_type","010406");
tran_jo.put("point_code1", translate_code1);
tran_jo.put("point_code2", translate_code2);
tran_jo.put("vehicle_code", right_point.getString("qzzno"));
tran_jo.put("vehicle_code2", right_point.getString("vehicle_code"));
tran_jo.put("task_type", "010406");
cutConveyorTask.createTask(tran_jo);
}
}
@@ -683,100 +708,98 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public void initialize(JSONObject param) {
{
{
int j_size = param.getInteger("j"); //
int k_size = param.getInteger("k"); //
String block = param.getString("layer"); // 块
JSONObject max_jo = WQLObject.getWQLObject("ST_IVT_StructAttr").query("sect_code = 'ZC01' order by out_order_seq desc ").uniqueResult(0);
int max_no = 0;
if (ObjectUtil.isNotEmpty(max_jo)) {
max_no = max_jo.getIntValue("out_order_seq");
}
max_no++;
for (int i = 1; i < 4; i++) {
for (int j = 1; j < j_size; j++) {
for (int k = 1; k < k_size; k++) {
//排
String row = "";
if (j < 10) {
row = "0" + j;
} else {
row = j + "";
}
//列
String line = "";
if (k < 10) {
line = "0" + k;
} else {
line = k + "";
}
//块
String piece = i + block;
//层
String layer = "0" + i;
JSONObject jo = new JSONObject();
jo.put("struct_id", IdUtil.getSnowflake(1, 1).nextId());
jo.put("struct_code", piece + row + "-" + line + "-" + layer);
jo.put("struct_name", piece + "" + row + "" + line + "" + layer + "");
jo.put("simple_name", piece + "" + row + "" + line + "" + layer + "");
jo.put("sect_id", "1582991348217286656");
jo.put("sect_code", "ZC01");
jo.put("sect_name", "主存区");
jo.put("stor_id", "1582991156504039424");
jo.put("stor_code", "CP01");
jo.put("stor_name", "兰州仓库");
jo.put("stor_type", "03");
jo.put("is_tempstruct", "0");
jo.put("row_num", row);
jo.put("col_num", line);
jo.put("layer_num", layer);
jo.put("block_num", piece);
jo.put("in_order_seq", 0);
jo.put("out_order_seq", max_no);
jo.put("in_empty_seq", 0);
jo.put("out_empty_seq", 0);
jo.put("placement_type", "01");
jo.put("create_id", "1");
jo.put("create_name", "管理员");
jo.put("create_time", DateUtil.now());
jo.put("update_optid", "1");
jo.put("update_optname", "管理员");
jo.put("update_time", DateUtil.now());
jo.put("is_delete", "0");
jo.put("is_used", "1");
jo.put("lock_type", "1");
jo.put("material_height_type", "1");
WQLObject.getWQLObject("ST_IVT_StructAttr").insert(jo);
max_no++;
//插入点位
JSONObject structMap = new JSONObject();
structMap.put("point_id", IdUtil.getSnowflake(1,1).nextId());
structMap.put("point_code", jo.getString("struct_code"));
structMap.put("point_name", jo.getString("struct_name"));
structMap.put("region_id", "1582991348217286656");
structMap.put("region_code", jo.getString("sect_code"));
structMap.put("region_name", jo.getString("sect_name"));
structMap.put("point_type", "2");
structMap.put("point_status", "1");
structMap.put("lock_type", jo.getString("lock_type"));
structMap.put("block_num", jo.getIntValue("block_num"));
structMap.put("row_num", jo.getIntValue("row_num"));
structMap.put("col_num", jo.getIntValue("col_num"));
structMap.put("layer_num", jo.getIntValue("layer_num"));
structMap.put("source_id", jo.getString("struct_id"));
structMap.put("create_id", "1");
structMap.put("create_name", "管理员");
structMap.put("create_time", DateUtil.now());
structMap.put("update_optid", "1");
structMap.put("update_optname", "管理员");
structMap.put("update_time", DateUtil.now());
WQLObject.getWQLObject("sch_base_point").insert(structMap);
int j_size = param.getInteger("j"); // 排
int k_size = param.getInteger("k"); //
String block = param.getString("layer"); //
JSONObject max_jo = WQLObject.getWQLObject("ST_IVT_StructAttr").query("sect_code = 'ZC01' order by out_order_seq desc ").uniqueResult(0);
int max_no = 0;
if (ObjectUtil.isNotEmpty(max_jo)) {
max_no = max_jo.getIntValue("out_order_seq");
}
max_no++;
for (int i = 1; i < 4; i++) {
for (int j = 1; j < j_size; j++) {
for (int k = 1; k < k_size; k++) {
//排
String row = "";
if (j < 10) {
row = "0" + j;
} else {
row = j + "";
}
//列
String line = "";
if (k < 10) {
line = "0" + k;
} else {
line = k + "";
}
//块
String piece = i + block;
//层
String layer = "0" + i;
JSONObject jo = new JSONObject();
jo.put("struct_id", IdUtil.getSnowflake(1, 1).nextId());
jo.put("struct_code", piece + row + "-" + line + "-" + layer);
jo.put("struct_name", piece + "" + row + "" + line + "" + layer + "");
jo.put("simple_name", piece + "" + row + "" + line + "" + layer + "");
jo.put("sect_id", "1582991348217286656");
jo.put("sect_code", "ZC01");
jo.put("sect_name", "主存区");
jo.put("stor_id", "1582991156504039424");
jo.put("stor_code", "CP01");
jo.put("stor_name", "兰州仓库");
jo.put("stor_type", "03");
jo.put("is_tempstruct", "0");
jo.put("row_num", row);
jo.put("col_num", line);
jo.put("layer_num", layer);
jo.put("block_num", piece);
jo.put("in_order_seq", 0);
jo.put("out_order_seq", max_no);
jo.put("in_empty_seq", 0);
jo.put("out_empty_seq", 0);
jo.put("placement_type", "01");
jo.put("create_id", "1");
jo.put("create_name", "管理员");
jo.put("create_time", DateUtil.now());
jo.put("update_optid", "1");
jo.put("update_optname", "管理员");
jo.put("update_time", DateUtil.now());
jo.put("is_delete", "0");
jo.put("is_used", "1");
jo.put("lock_type", "1");
jo.put("material_height_type", "1");
WQLObject.getWQLObject("ST_IVT_StructAttr").insert(jo);
max_no++;
//插入点位
JSONObject structMap = new JSONObject();
structMap.put("point_id", IdUtil.getSnowflake(1, 1).nextId());
structMap.put("point_code", jo.getString("struct_code"));
structMap.put("point_name", jo.getString("struct_name"));
structMap.put("region_id", "1582991348217286656");
structMap.put("region_code", jo.getString("sect_code"));
structMap.put("region_name", jo.getString("sect_name"));
structMap.put("point_type", "2");
structMap.put("point_status", "1");
structMap.put("lock_type", jo.getString("lock_type"));
structMap.put("block_num", jo.getIntValue("block_num"));
structMap.put("row_num", jo.getIntValue("row_num"));
structMap.put("col_num", jo.getIntValue("col_num"));
structMap.put("layer_num", jo.getIntValue("layer_num"));
structMap.put("source_id", jo.getString("struct_id"));
structMap.put("create_id", "1");
structMap.put("create_name", "管理员");
structMap.put("create_time", DateUtil.now());
structMap.put("update_optid", "1");
structMap.put("update_optname", "管理员");
structMap.put("update_time", DateUtil.now());
WQLObject.getWQLObject("sch_base_point").insert(structMap);
}
}
}

View File

@@ -795,7 +795,7 @@
sa.row_num,
sa.placement_type
ORDER BY
sa.placement_type DESC
sa.block_num DESC
ENDSELECT
ENDQUERY
ENDIF
@@ -818,7 +818,7 @@
sa.row_num,
sa.placement_type
ORDER BY
sa.placement_type DESC
sa.block_num DESC
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -178,13 +178,7 @@ sa-token:
is-log: false
jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq
# token 前缀
token-prefix:
token-prefix: Bearer
cookie:
# 配置 Cookie 作用域:根据二级域名实现sso登入如lms.sso.com;acs.sso.com
domain:
loki:
url: http://localhost:3100/loki/api/v1
systemName: lms
es:
index: lms_log_prod