rev:现场测试优化
This commit is contained in:
@@ -1434,7 +1434,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
jo10.put("binTask", "OutForkHeight");
|
||||
ja.add(jo10);
|
||||
|
||||
} else if (AgvActionTypeEnum.IN_STOCK.getCode().equals(inst.getAgv_action_type())) {
|
||||
} else if (AgvActionTypeEnum.IN_STOCK.getCode().equals(inst.getAgv_action_type())) {
|
||||
|
||||
} else if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(inst.getAgv_action_type())) {
|
||||
// to do
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.agv.ndcone.AgvNdcOneDeviceDriver;
|
||||
import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver;
|
||||
import org.nl.acs.device_driver.autodoor.standard_autodoor.StandardAutodoorDeviceDriver;
|
||||
import org.nl.acs.device_driver.two_conveyor.raster.RasterDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
@@ -31,6 +32,8 @@ import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
|
||||
|
||||
@@ -107,13 +110,14 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
socket = new Socket();
|
||||
socket.connect(socketAddress, 2 * 1000);
|
||||
socket.setKeepAlive(true);//长链接
|
||||
// s.setSoTimeout(1000* 60 * 10);//读取超时时间
|
||||
socket.setSoTimeout(30000);//读取超时时间
|
||||
dos = new DataOutputStream(socket.getOutputStream());
|
||||
dis = new DataInputStream(socket.getInputStream());
|
||||
|
||||
while (bConnected) {
|
||||
while (socket.isConnected()) {
|
||||
System.out.println("当前socket状态:"+socket.isConnected());
|
||||
int count = dis.read(b);
|
||||
|
||||
System.out.println("当前count值:"+count);
|
||||
if (count == -1) {
|
||||
log.error("agv连接出现异常:服务端被关闭");
|
||||
if (ObjectUtil.isNotEmpty(socket)) {
|
||||
@@ -171,6 +175,8 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
String emptyNum = null;
|
||||
//自动门
|
||||
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver;
|
||||
//光栅
|
||||
RasterDeviceDriver rasterDeviceDriver;
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
@@ -262,6 +268,23 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
log.info("未下发NDC信号原因: 下发开门信号值为:{},读取开门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose());
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof RasterDeviceDriver){
|
||||
rasterDeviceDriver = (RasterDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 1);
|
||||
rasterDeviceDriver.writing(map);
|
||||
} catch (Exception e) {
|
||||
log.info("下发电气信号失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (rasterDeviceDriver.getRaster() == 0) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
log.info("未下发NDC信号原因:读取开门信号值为:{}", rasterDeviceDriver.getRaster());
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
}
|
||||
@@ -285,7 +308,23 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
log.info("读取关门信号值为:{}", standardAutodoorDeviceDriver.getClose());
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
log.info("未下发NDC信号原因: 读取关门信号值为:{}", standardAutodoorDeviceDriver.getClose());
|
||||
log.info("未下发NDC信号原因: 读取光栅信号值为:{}", standardAutodoorDeviceDriver.getClose());
|
||||
}
|
||||
}
|
||||
else if (device.getDeviceDriver() instanceof RasterDeviceDriver) {
|
||||
rasterDeviceDriver = (RasterDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 2);
|
||||
rasterDeviceDriver.writing(map);
|
||||
} catch (Exception e) {
|
||||
log.info("下发电气信号失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (rasterDeviceDriver.getRaster() == 1) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
log.info("未下发NDC信号原因:读取光栅信号值为:{}", rasterDeviceDriver.getRaster());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -183,7 +183,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
if (mode == 2) {
|
||||
this.writing(0);
|
||||
// this.writing(0);
|
||||
}
|
||||
}
|
||||
if (move != last_move) {
|
||||
|
||||
@@ -790,6 +790,24 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("下发多个电气信号" + itemMap)
|
||||
.build();
|
||||
logDto.setLog_level(3);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
|
||||
public Instruction checkInst() {
|
||||
if (ObjectUtil.isNotEmpty(this.inst)) {
|
||||
if (this.task > 0) {
|
||||
|
||||
@@ -295,20 +295,40 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
List toInstructions;
|
||||
//木箱入库申请入库任务
|
||||
if (mode == 6 && !requireSucess) {
|
||||
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
|
||||
message = "托盘条码为空、或者子卷码为空";
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_apply_strangulation_time.getTime()
|
||||
< (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
applyIn(StorageTypeEnum.BOX_IN.getType(), mode);
|
||||
this.require_apply_strangulation_time = date;
|
||||
if (StrUtil.isNotEmpty(hand_barcode) && StrUtil.isNotEmpty(hand_material_barcode)) {
|
||||
applyIn(StorageTypeEnum.BOX_IN.getType(), mode);
|
||||
} else if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
|
||||
message = "托盘条码为空、或者子卷码为空";
|
||||
} else {
|
||||
applyIn(StorageTypeEnum.BOX_IN.getType(), mode);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//子卷入库申请入库任务
|
||||
if (mode == 7 && move == 1 && !requireSucess) {
|
||||
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
|
||||
message = "托盘条码为空、或者子卷码为空";
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_apply_strangulation_time.getTime()
|
||||
< (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
applyIn(StorageTypeEnum.STORAGE.getType(), mode);
|
||||
this.require_apply_strangulation_time = date;
|
||||
if (StrUtil.isNotEmpty(hand_barcode) && StrUtil.isNotEmpty(hand_material_barcode)) {
|
||||
applyIn(StorageTypeEnum.STORAGE.getType(), mode);
|
||||
} else if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
|
||||
message = "托盘条码为空、或者子卷码为空";
|
||||
} else {
|
||||
applyIn(StorageTypeEnum.STORAGE.getType(), mode);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -316,25 +336,43 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
|
||||
//申请空托盘入库
|
||||
if (mode == 9 && move == 1 && !requireSucess) {
|
||||
if (container_type == 0 || StrUtil.isEmpty(barcode)) {
|
||||
message = "托盘类型为空";
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_apply_strangulation_time.getTime()
|
||||
< (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode);
|
||||
this.require_apply_strangulation_time = date;
|
||||
if (container_type == 0 || StrUtil.isEmpty(barcode)) {
|
||||
message = "托盘类型为空";
|
||||
} else {
|
||||
applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//申请退货入库
|
||||
if (mode == 18 && move == 1 && !requireSucess) {
|
||||
if (StrUtil.isEmpty(barcode)|| StrUtil.isEmpty(material_barcode)) {
|
||||
message = "托盘条码为空或者木箱号为空";
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_apply_strangulation_time.getTime()
|
||||
< (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode);
|
||||
this.require_apply_strangulation_time = date;
|
||||
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
|
||||
message = "托盘条码为空或者木箱号为空";
|
||||
} else {
|
||||
applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//申请高度
|
||||
if (mode == 23 && !requireSucess) {
|
||||
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
|
||||
if (StrUtil.isNotEmpty(hand_barcode) && StrUtil.isNotEmpty(hand_material_barcode)) {
|
||||
applyErrorHeight();
|
||||
} else if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
|
||||
message = "托盘条码为空或者木箱号为空";
|
||||
} else {
|
||||
applyErrorHeight();
|
||||
@@ -410,6 +448,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
this.require_apply_strangulation_time = date;
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", device_code);
|
||||
@@ -472,36 +511,52 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
}
|
||||
|
||||
private void applyBoxReturnTask(String type, int mode) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_apply_strangulation_time.getTime()
|
||||
< (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", device_code);
|
||||
if (StrUtil.isNotEmpty(hand_barcode)) {
|
||||
param.put("vehicle_code", hand_barcode);
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", device_code);
|
||||
if (StrUtil.isNotEmpty(hand_barcode)) {
|
||||
param.put("vehicle_code", hand_barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(barcode) && (barcode.startsWith("A") || barcode.startsWith("B"))) {
|
||||
param.put("vehicle_code", barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(material_barcode)) {
|
||||
param.put("material_barcode", material_barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(hand_material_barcode)) {
|
||||
param.put("material_barcode", hand_material_barcode);
|
||||
}
|
||||
param.put("type", type);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("申请退货入库,参数:" + param)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
TaskDto dto = taskserver.findByBarcodeFromCache(barcode);
|
||||
if (ObjectUtil.isNotEmpty(dto)) {
|
||||
List list1 = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_command");
|
||||
map.put("value", mode);
|
||||
list1.add(map);
|
||||
this.writing(list1);
|
||||
this.requireSucess = true;
|
||||
} else {
|
||||
HttpResponse httpResponse = acsToWmsService.applyTwo(param);
|
||||
JSONObject jsonObject = null;
|
||||
if (ObjectUtil.isNotEmpty(httpResponse)) {
|
||||
String body = httpResponse.body();
|
||||
jsonObject = JSONObject.parseObject(body);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(barcode) && (barcode.startsWith("A") || barcode.startsWith("B"))) {
|
||||
param.put("vehicle_code", barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(material_barcode)) {
|
||||
param.put("material_barcode", material_barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(hand_material_barcode)) {
|
||||
param.put("material_barcode", hand_material_barcode);
|
||||
}
|
||||
param.put("type", type);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("申请退货入库,参数:" + param)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
TaskDto dto = taskserver.findByBarcodeFromCache(barcode);
|
||||
if (ObjectUtil.isNotEmpty(dto)) {
|
||||
message = "申请退货入库,返回参数:" + jsonObject;
|
||||
if (ObjectUtil.isNotNull(jsonObject) && jsonObject.getInteger("status") == 200) {
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("申请退货入库,参数,接口返回:" + jsonObject)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
List list1 = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_command");
|
||||
@@ -510,41 +565,18 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
this.writing(list1);
|
||||
this.requireSucess = true;
|
||||
} else {
|
||||
HttpResponse httpResponse = acsToWmsService.applyTwo(param);
|
||||
JSONObject jsonObject = null;
|
||||
if (ObjectUtil.isNotEmpty(httpResponse)) {
|
||||
String body = httpResponse.body();
|
||||
jsonObject = JSONObject.parseObject(body);
|
||||
}
|
||||
message = "申请退货入库,返回参数:" + jsonObject;
|
||||
if (ObjectUtil.isNotNull(jsonObject) && jsonObject.getInteger("status") == 200) {
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("申请退货入库,参数,接口返回:" + jsonObject)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
List list1 = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_command");
|
||||
map.put("value", mode);
|
||||
list1.add(map);
|
||||
this.writing(list1);
|
||||
this.requireSucess = true;
|
||||
} else {
|
||||
this.iserror = true;
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("申请退货入库,返回参数:" + jsonObject)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
message = "申请退货入库报错,返回参数:" + jsonObject;
|
||||
}
|
||||
this.iserror = true;
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("申请退货入库,返回参数:" + jsonObject)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
message = "申请退货入库报错,返回参数:" + jsonObject;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -604,12 +636,6 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
}
|
||||
|
||||
private void applyEmptyTask(String type, int mode) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_apply_strangulation_time.getTime()
|
||||
< (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", device_code);
|
||||
@@ -662,75 +688,81 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void applyIn(String type, int mode) {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_apply_strangulation_time.getTime()
|
||||
< (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", device_code);
|
||||
if (StrUtil.isNotEmpty(hand_barcode)) {
|
||||
param.put("vehicle_code", hand_barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(barcode) && (barcode.startsWith("A") || barcode.startsWith("B"))) {
|
||||
param.put("vehicle_code", barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(material_barcode)) {
|
||||
param.put("material_barcode", material_barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(hand_material_barcode)) {
|
||||
param.put("material_barcode", hand_material_barcode);
|
||||
}
|
||||
if (mode == 7 && weight != 0) {
|
||||
param.put("weight", weight);
|
||||
}
|
||||
param.put("type", type);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("木箱、子卷入库申请入库任务,参数:" + param)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
HttpResponse httpResponse = acsToWmsService.applyTwo(param);
|
||||
JSONObject jsonObject = null;
|
||||
if (ObjectUtil.isNotEmpty(httpResponse)) {
|
||||
String body = httpResponse.body();
|
||||
jsonObject = JSONObject.parseObject(body);
|
||||
}
|
||||
message = "木箱、子卷入库申请入库任务,返回参数:" + jsonObject;
|
||||
if (ObjectUtil.isNotNull(jsonObject) && jsonObject.getInteger("status") == 200) {
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("木箱、子卷入库申请入库任务,参数,接口返回:" + jsonObject)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
List list1 = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_command");
|
||||
map.put("value", mode);
|
||||
list1.add(map);
|
||||
this.writing(list1);
|
||||
requireSucess = true;
|
||||
} else {
|
||||
this.iserror = true;
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("木箱、子卷入库申请入库任务,返回参数:" + jsonObject)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
message = "木箱、子卷入库申请入库任务报错,返回参数:" + jsonObject;
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", device_code);
|
||||
if (StrUtil.isNotEmpty(hand_barcode)) {
|
||||
param.put("vehicle_code", hand_barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(barcode) && (barcode.startsWith("A") || barcode.startsWith("B"))) {
|
||||
param.put("vehicle_code", barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(material_barcode)) {
|
||||
param.put("material_barcode", material_barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(hand_material_barcode)) {
|
||||
param.put("material_barcode", hand_material_barcode);
|
||||
}
|
||||
if (mode == 7 && weight != 0) {
|
||||
param.put("weight", weight);
|
||||
}
|
||||
param.put("type", type);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("木箱、子卷入库申请入库任务,参数:" + param)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
HttpResponse httpResponse = acsToWmsService.applyTwo(param);
|
||||
JSONObject jsonObject = null;
|
||||
if (ObjectUtil.isNotEmpty(httpResponse)) {
|
||||
String body = httpResponse.body();
|
||||
jsonObject = JSONObject.parseObject(body);
|
||||
}
|
||||
log.error("wms反馈结果:{}",jsonObject);
|
||||
message = "木箱、子卷入库申请入库任务,返回参数:" + jsonObject;
|
||||
LuceneLogDto logDto3 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("木箱、子卷入库申请入库任务,参数,接口返回:" + jsonObject)
|
||||
.build();
|
||||
logDto3.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto3);
|
||||
if (ObjectUtil.isNotNull(jsonObject) && Integer.valueOf(200).equals(jsonObject.getInteger("status"))) {
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("木箱、子卷入库申请入库任务,参数,接口返回:" + jsonObject)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
List list1 = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_command");
|
||||
map.put("value", mode);
|
||||
list1.add(map);
|
||||
log.error("下发电气--------:{}",map);
|
||||
this.writing(list1);
|
||||
requireSucess = true;
|
||||
} else {
|
||||
this.iserror = true;
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("木箱、子卷入库申请入库任务,返回参数:" + jsonObject)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
message = "木箱、子卷入库申请入库任务报错,返回参数:" + jsonObject;
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("木箱、子卷入库申请入库任务,返回参数:" + e.getMessage())
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -198,79 +198,18 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
if (mode != lastMode) {
|
||||
requireSucess = false;
|
||||
}
|
||||
|
||||
|
||||
// 更新指令状态
|
||||
if (mode == 3 && task > 0) {
|
||||
if (mode == 3 && !requireSucess) {
|
||||
inst = checkInst();
|
||||
if (null != inst) {
|
||||
TaskDto dto = taskserver.findByCode(inst.getTask_code());
|
||||
String interaction_json = dto.getInteraction_json();
|
||||
JSONObject jsonObject = JSONObject.parseObject(interaction_json);
|
||||
//子卷号
|
||||
volume_code = jsonObject.getString("containers");
|
||||
}
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||
|
||||
} else {
|
||||
this.instruction_update_time = date;
|
||||
//更改指令状态
|
||||
if (task > 0) {
|
||||
Instruction inst = checkInst();
|
||||
if (inst != null) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||
inst.setInstruction_status(CommonFinalParam.ONE);
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//任务完成
|
||||
if (mode == 3 && action == 4 && move == 0 && task > 0) {
|
||||
Instruction inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (inst != null) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) {
|
||||
try {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
/*if (ObjectUtil.isNotEmpty(dto)){
|
||||
String interaction_json = dto.getInteraction_json();
|
||||
if (ObjectUtil.isNotEmpty(interaction_json)){
|
||||
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(interaction_json);
|
||||
map.put("to_pull", jsonObject.getString("is_pulling"));
|
||||
map.put("is_bushing", jsonObject.getString("is_bushing"));
|
||||
map.put("to_size", jsonObject.getString("qzz_size"));
|
||||
map.put("to_barcode", jsonObject.getString("qzz_no"));
|
||||
}
|
||||
}*/
|
||||
map.put("to_command", "5");
|
||||
this.writing(map);
|
||||
message = "universal_message1";
|
||||
finish_instruction(inst);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
feedMessage = "";
|
||||
}
|
||||
} else {
|
||||
if (mode != 3) {
|
||||
feedMessage = "universal_feedMessage1";
|
||||
}
|
||||
if (action != 4) {
|
||||
feedMessage = "universal_feedMessage2";
|
||||
}
|
||||
if (move != 0) {
|
||||
feedMessage = "universal_feedMessage3";
|
||||
}
|
||||
if (task == 0) {
|
||||
feedMessage = "universal_feedMessage4";
|
||||
if (StrUtil.isNotEmpty(interaction_json)) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(interaction_json);
|
||||
//子卷号
|
||||
volume_code = jsonObject.getString("containers");
|
||||
}
|
||||
}
|
||||
update_instruction_status();
|
||||
}
|
||||
|
||||
|
||||
@@ -348,6 +287,61 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
lastToBarcode = toBarcode;
|
||||
}
|
||||
|
||||
public synchronized void update_instruction_status() throws Exception {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||
|
||||
} else {
|
||||
this.instruction_update_time = date;
|
||||
// 更新指令状态
|
||||
if (task > 0) {
|
||||
Instruction inst = checkInst();
|
||||
if (inst != null) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||
inst.setInstruction_status(CommonFinalParam.ONE);
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
inst.setUpdate_time(DateUtil.now());
|
||||
instructionService.update(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//任务完成
|
||||
if (mode == 3 && action == 4 && move == 0 && task > 0) {
|
||||
Instruction inst2 = checkInst();
|
||||
if (inst2 != null) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "5");
|
||||
this.writing(map);
|
||||
message = "universal_message1";
|
||||
try {
|
||||
finish_instruction(inst2);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
feedMessage = "";
|
||||
}
|
||||
} else {
|
||||
if (mode != 3) {
|
||||
feedMessage = "universal_feedMessage1";
|
||||
}
|
||||
if (action != 4) {
|
||||
feedMessage = "universal_feedMessage2";
|
||||
}
|
||||
if (move != 0) {
|
||||
feedMessage = "universal_feedMessage3";
|
||||
}
|
||||
if (task == 0) {
|
||||
feedMessage = "universal_feedMessage4";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请任务
|
||||
*/
|
||||
@@ -364,25 +358,42 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
List<String> putDeviceCodeList = this.getExtraDeviceCodes("put_device_code");
|
||||
TaskDto task = null;
|
||||
PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver;
|
||||
//先查指令
|
||||
List<Instruction> instructionList = instructionService.findReadyIns();
|
||||
if (CollUtil.isNotEmpty(instructionList)) {
|
||||
List<Instruction> instructionsReady = new ArrayList<>();
|
||||
Instruction instructionReady = null;
|
||||
for (Instruction instruction : instructionList) {
|
||||
if (getDeviceCodeList.contains(instruction.getStart_device_code())) {
|
||||
instructionsReady.add(instruction);
|
||||
start:
|
||||
for (int i = 0; i < getDeviceCodeList.size(); i++) {
|
||||
String startDeviceCode = getDeviceCodeList.get(i);
|
||||
//先查指令
|
||||
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus3(startDeviceCode);
|
||||
List<TaskDto> taskDtoStream = taskDtos.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotEmpty(taskDtoStream)) {
|
||||
TaskDto taskDto = taskDtos.get(0);
|
||||
if (!StrUtil.equals(taskDto.getTask_type(), "6")) {
|
||||
taskDto = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(instructionsReady)) {
|
||||
List<Instruction> instructions = instructionsReady.stream().sorted(Comparator.comparing(Instruction::getCreate_time)).collect(Collectors.toList());
|
||||
instructionReady = instructions.get(0);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(instructionReady)) {
|
||||
String startCode = instructionReady.getStart_device_code();
|
||||
String nextCode = instructionReady.getNext_device_code();
|
||||
Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDto.getTask_code());
|
||||
if (ObjectUtil.isEmpty(instruction)) {
|
||||
break;
|
||||
}
|
||||
String startCode = instruction.getStart_device_code();
|
||||
String nextCode = instruction.getNext_device_code();
|
||||
Device startDevice = deviceAppService.findDeviceByCode(startCode);
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(nextCode);
|
||||
if (startDevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) startDevice.getDeviceDriver();
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() != 1) {
|
||||
notCreateInstMessage = "手动创建指令未下发电气信号原因->" + startCode + "工位状态为不允许取,无法生成指令";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (nextDevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) nextDevice.getDeviceDriver();
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() != 2) {
|
||||
notCreateInstMessage = "手动创建指令未下发电气信号原因->" + nextCode + "工位状态为不允许放,无法生成指令";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
|
||||
notCreateInstMessage = "未设置电气调度号!";
|
||||
@@ -394,17 +405,17 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
}
|
||||
String startAddr = startDevice.getExtraValue().get("address").toString();
|
||||
String nextAddr = nextDevice.getExtraValue().get("address").toString();
|
||||
TaskDto byTaskCode = taskserver.findByTaskCode(instructionReady.getTask_code());
|
||||
TaskDto byTaskCode = taskserver.findByTaskCode(instruction.getTask_code());
|
||||
String interactionJson = byTaskCode.getInteraction_json();
|
||||
// Map<String, Object> map = toStringObjectMap(instruction, startAddr, nextAddr, interaction_json);
|
||||
try {
|
||||
pushPLC(instructionReady, startAddr, nextAddr, interactionJson);
|
||||
pushPLC(instruction, startAddr, nextAddr, interactionJson);
|
||||
} catch (Exception e) {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("当前设备:" + device_code + ",下发指令:"
|
||||
+ instructionReady.getInstruction_code() + ",指令起点:" + instructionReady.getStart_device_code()
|
||||
+ ",指令终点:" + instructionReady.getNext_device_code() + ",指令执行失败:" + e.getMessage())
|
||||
+ instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code()
|
||||
+ ",指令终点:" + instruction.getNext_device_code() + ",指令执行失败:" + e.getMessage())
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
@@ -412,129 +423,131 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
}
|
||||
this.setRequireSucess(true);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
List<TaskDto> taskDtos = taskserver.findByTrappedManipulatorReady();
|
||||
List<TaskDto> taskDtosReady = new ArrayList<>();
|
||||
TaskDto taskDto = null;
|
||||
if (CollUtil.isNotEmpty(taskDtos)) {
|
||||
for (TaskDto taskDto1 : taskDtos) {
|
||||
if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) {
|
||||
taskDtosReady.add(taskDto1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(taskDtosReady)) {
|
||||
for (TaskDto dto : taskDtosReady) {
|
||||
String firstDeviceCode = dto.getStart_device_code();
|
||||
Device start_device = deviceAppService.findDeviceByCode(firstDeviceCode);
|
||||
if (start_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) start_device.getDeviceDriver();
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() != 1) {
|
||||
notCreateInstMessage = firstDeviceCode + "工位状态为不允许取,无法生成指令";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
String nextDeviceCode = dto.getNext_device_code();
|
||||
Device next_device = deviceAppService.findDeviceByCode(nextDeviceCode);
|
||||
if (next_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) next_device.getDeviceDriver();
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() != 2) {
|
||||
notCreateInstMessage = nextDeviceCode + "工位状态为不允许放,无法生成指令";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
taskDto = dto;
|
||||
if (ObjectUtil.isNotEmpty(taskDto)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(taskDto)) {
|
||||
String taskId = taskDto.getTask_id();
|
||||
String taskCode = taskDto.getTask_code();
|
||||
String vehicleCode = taskDto.getVehicle_code();
|
||||
String priority = taskDto.getPriority();
|
||||
String start_device_code = taskDto.getStart_device_code();
|
||||
String next_device_code = taskDto.getNext_device_code();
|
||||
String routePlanCode = taskDto.getRoute_plan_code();
|
||||
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setRoute_plan_code(routePlanCode);
|
||||
instdto.setRemark(taskDto.getRemark());
|
||||
instdto.setMaterial(taskDto.getMaterial());
|
||||
instdto.setQuantity(taskDto.getQuantity());
|
||||
instdto.setTask_id(taskId);
|
||||
instdto.setTask_code(taskCode);
|
||||
instdto.setVehicle_code(vehicleCode);
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by(SecurityUtils.getCurrentNickName());
|
||||
instdto.setStart_device_code(start_device_code);
|
||||
instdto.setNext_device_code(next_device_code);
|
||||
instdto.setStart_point_code(start_device_code);
|
||||
instdto.setNext_point_code(next_device_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(device_code);
|
||||
|
||||
Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code());
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code());
|
||||
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
|
||||
notCreateInstMessage = "未设置电气调度号";
|
||||
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code()));
|
||||
}
|
||||
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
|
||||
notCreateInstMessage = "未设置电气调度号!";
|
||||
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code()));
|
||||
|
||||
}
|
||||
String startAddr = startDevice.getExtraValue().get("address").toString();
|
||||
String nextAddr = nextDevice.getExtraValue().get("address").toString();
|
||||
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
notCreateInstMessage = e.getMessage();
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code + "创建指令时出现异常:" + e.getMessage())
|
||||
.build();
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
return false;
|
||||
}
|
||||
|
||||
String interaction_json = taskDto.getInteraction_json();
|
||||
try {
|
||||
pushPLC(instdto, startAddr, nextAddr, interaction_json);
|
||||
} catch (Exception e) {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("当前设备:" + device_code + ",下发指令:"
|
||||
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
|
||||
+ ",指令终点:" + instdto.getNext_device_code() + ",指令执行失败:" + e.getMessage())
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
return false;
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskserver.update(taskDto);
|
||||
this.setRequireSucess(true);
|
||||
return true;
|
||||
} else {
|
||||
notCreateInstMessage = "找到关联设备的任务,指令无法创建";
|
||||
List<TaskDto> taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDtoList)) {
|
||||
for (int j = 0; j < taskDtoList.size(); j++) {
|
||||
//按照优先级排序 优先级相等按照创建时间排序
|
||||
taskDtoList = this.sortTask(taskDtoList);
|
||||
task = taskDtoList.get(j);
|
||||
// 6 行架任务 8烘箱任务
|
||||
if (!StrUtil.equals(task.getTask_type(), "6")) {
|
||||
task = null;
|
||||
continue;
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(task)) {
|
||||
break start;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
if (!ObjectUtil.isEmpty(task)) {
|
||||
Device nextdevice = deviceAppService.findDeviceByCode(task.getNext_device_code());
|
||||
Device startdevice = deviceAppService.findDeviceByCode(task.getStart_device_code());
|
||||
if (startdevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() != 1) {
|
||||
notCreateInstMessage = "就绪任务未创建指令原因->" + task.getStart_device_code() + "工位状态为不允许取,无法生成指令";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (nextdevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() != 2) {
|
||||
notCreateInstMessage = "就绪任务未创建指令原因->" + task.getNext_device_code() + "工位状态为不允许放,无法生成指令";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String taskId = task.getTask_id();
|
||||
String taskCode = task.getTask_code();
|
||||
String vehicleCode = task.getVehicle_code();
|
||||
String priority = task.getPriority();
|
||||
String start_device_code = task.getStart_device_code();
|
||||
String next_device_code = task.getNext_device_code();
|
||||
String routePlanCode = task.getRoute_plan_code();
|
||||
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setRoute_plan_code(routePlanCode);
|
||||
instdto.setRemark(task.getRemark());
|
||||
instdto.setMaterial(task.getMaterial());
|
||||
instdto.setQuantity(task.getQuantity());
|
||||
instdto.setTask_id(taskId);
|
||||
instdto.setTask_code(taskCode);
|
||||
instdto.setVehicle_code(vehicleCode);
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by(SecurityUtils.getCurrentNickName());
|
||||
instdto.setStart_device_code(start_device_code);
|
||||
instdto.setNext_device_code(next_device_code);
|
||||
instdto.setStart_point_code(start_device_code);
|
||||
instdto.setNext_point_code(next_device_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(device_code);
|
||||
|
||||
Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code());
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code());
|
||||
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
|
||||
notCreateInstMessage = "未设置电气调度号";
|
||||
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code()));
|
||||
}
|
||||
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
|
||||
notCreateInstMessage = "未设置电气调度号!";
|
||||
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code()));
|
||||
|
||||
}
|
||||
String startAddr = startDevice.getExtraValue().get("address").toString();
|
||||
String nextAddr = nextDevice.getExtraValue().get("address").toString();
|
||||
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
notCreateInstMessage = e.getMessage();
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code + "创建指令时出现异常:" + e.getMessage())
|
||||
.build();
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
return false;
|
||||
}
|
||||
|
||||
String interaction_json = task.getInteraction_json();
|
||||
try {
|
||||
pushPLC(instdto, startAddr, nextAddr, interaction_json);
|
||||
} catch (Exception e) {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("当前设备:" + device_code + ",下发指令:"
|
||||
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
|
||||
+ ",指令终点:" + instdto.getNext_device_code() + ",指令执行失败:" + e.getMessage())
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
return false;
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
task.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
task.setUpdate_time(DateUtil.now());
|
||||
taskserver.update(task);
|
||||
this.setRequireSucess(true);
|
||||
return true;
|
||||
} else {
|
||||
notCreateInstMessage = "未找到关联设备的任务,指令无法创建";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void pushPLC(Instruction instdto, String startAddr, String nextAddr, String interaction_json) {
|
||||
// Map<String, Object> map = new LinkedHashMap<>();
|
||||
List list = new ArrayList();
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.raster;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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_raster = "raster";
|
||||
|
||||
public static String item_to_command = "to_command";
|
||||
|
||||
private RasterDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(RasterDeviceDriver driver){
|
||||
this.driver=driver;
|
||||
}
|
||||
|
||||
public int getItem_heartbeat(){
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
} ;
|
||||
public int getItem_mode(){
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
public int getItem_raster(){
|
||||
return this.getOpcIntegerValue(item_raster);
|
||||
}
|
||||
|
||||
Boolean isonline;
|
||||
Boolean isError;
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if(ObjectUtil.isEmpty(value)){
|
||||
isError = true;
|
||||
}else if(item_heartbeat.equals(protocol)){
|
||||
isError = false;
|
||||
}
|
||||
if (value == null) {
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB19.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB19.B1"));
|
||||
list.add(new ItemDto(item_raster, "光栅信号", "DB19.B3"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "DB20.W0"));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.raster;
|
||||
|
||||
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 RasterDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "raster";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "光栅站点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "光栅站点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new RasterDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return RasterDeviceDriver.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,267 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.raster;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.DeviceExtraService;
|
||||
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
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.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class RasterDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
@Autowired
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
@Autowired
|
||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||
@Autowired
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
@Autowired
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
@Autowired
|
||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
|
||||
@Autowired
|
||||
DeviceExtraService deviceExtraService = SpringContextHolder.getBean(DeviceExtraServiceImpl.class);
|
||||
@Autowired
|
||||
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
||||
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date instruction_finished_time = new Date();
|
||||
private Date instruction_apply_time = new Date();
|
||||
private int instruction_require_time_out = 3000;
|
||||
|
||||
/**
|
||||
* 工作模式
|
||||
*/
|
||||
int mode = 0;
|
||||
int last_mode = 0;
|
||||
/**
|
||||
* 动作信号
|
||||
*/
|
||||
int raster = 0;
|
||||
int last_raster = 0;
|
||||
int heartbeat = 0;
|
||||
int last_heartbeat = 0;
|
||||
|
||||
|
||||
int to_command = 0;
|
||||
int last_to_command = 0;
|
||||
|
||||
String message = "";
|
||||
|
||||
Boolean isonline = true;
|
||||
|
||||
Boolean iserror = false;
|
||||
|
||||
/**
|
||||
* 1-执行任务;2-取货完成;3-放货完成;
|
||||
*/
|
||||
int flag;
|
||||
|
||||
String device_code;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 请求成功标记
|
||||
*/
|
||||
Boolean requireSucess = false;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getItem_mode();
|
||||
heartbeat = this.itemProtocol.getItem_heartbeat();
|
||||
raster = this.itemProtocol.getItem_raster();
|
||||
iserror = this.itemProtocol.isError;
|
||||
|
||||
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
}
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.itemProtocol.getIsonline()) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "信号量同步异常";
|
||||
//未联机
|
||||
} else if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "未联机";
|
||||
//有报警
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
log.debug("设备运转模式:等待工作");
|
||||
return;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
last_mode = mode;
|
||||
last_raster = raster;
|
||||
last_heartbeat = heartbeat;
|
||||
last_to_command = to_command;
|
||||
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("下发电气信号:" + itemMap)
|
||||
.build();
|
||||
logDto.setLog_level(3);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
|
||||
try {
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void thingToNothing() {
|
||||
this.setRequireSucess(false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 抽取统一下发电气信号前缀
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getToParam() {
|
||||
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
|
||||
}
|
||||
|
||||
/**
|
||||
* 多个信号一起下发电气
|
||||
*
|
||||
* @param map
|
||||
*/
|
||||
public void writing(Map<String, Object> map) throws Exception {
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
Map<String, Object> itemMap = new LinkedHashMap<>();
|
||||
map.forEach((key, value) -> {
|
||||
if (ObjectUtil.isNotEmpty(value)) {
|
||||
itemMap.put(getToParam() + key, value);
|
||||
}
|
||||
});
|
||||
if (ObjectUtil.isNotEmpty(itemMap)) {
|
||||
this.checkcontrol(itemMap);
|
||||
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("下发多个电气信号" + itemMap)
|
||||
.build();
|
||||
logDto.setLog_level(3);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
String mode = "";
|
||||
String action = "";
|
||||
if(iserror){
|
||||
message = "universal_message11";
|
||||
}
|
||||
if (this.getMode() == 0) {
|
||||
mode = LangProcess.msg("universal_off-line");
|
||||
} else if (this.getMode() == 1) {
|
||||
mode = LangProcess.msg("universal_stand-alone");
|
||||
} else if (this.getMode() == 2) {
|
||||
mode = LangProcess.msg("universal_standby");
|
||||
} else if (this.getMode() == 3) {
|
||||
mode = LangProcess.msg("universal_operation");
|
||||
}
|
||||
if (this.getRaster() == 0) {
|
||||
action = "光栅关闭";
|
||||
} else if (this.getRaster() == 1) {
|
||||
action = "光栅开启";
|
||||
}
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("mode", mode);
|
||||
jo.put("action", action);
|
||||
jo.put("isOnline", true);
|
||||
jo.put("isError", this.getIserror());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -179,9 +179,11 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
if (null != inst) {
|
||||
TaskDto dto = taskserver.findByCode(inst.getTask_code());
|
||||
String interaction_json = dto.getInteraction_json();
|
||||
JSONObject jsonObject = JSONObject.parseObject(interaction_json);
|
||||
//子卷号
|
||||
volume_code = jsonObject.getString("containers");
|
||||
if (StrUtil.isNotEmpty(interaction_json)) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(interaction_json);
|
||||
//子卷号
|
||||
volume_code = jsonObject.getString("containers");
|
||||
}
|
||||
}
|
||||
update_instruction_status();
|
||||
}
|
||||
|
||||
@@ -351,7 +351,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
.header(Header.USER_AGENT, "Hutool http")
|
||||
.header("Authorization", token).body(String.valueOf(data))
|
||||
.execute();
|
||||
|
||||
// //System.out.println(result2);
|
||||
log.info("feedbackTaskStatusToWms-----执行反馈{}", result2);
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"feedTaskStatus", String.valueOf(result2.getStatus()),
|
||||
String.valueOf(data), String.valueOf(result2.body()), "ACS向WMS反馈任务状态");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.one_conveyor.fold_disc_site.FoldDiscSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.BoxPackageManipulatorDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.box_palletizing_manipulator.BoxPalletizingManipulatorDeviceDriver;
|
||||
@@ -559,6 +560,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
|
||||
WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver;
|
||||
FoldDiscSiteDeviceDriver foldDiscSiteDeviceDriver;
|
||||
BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver;
|
||||
TrappedManipulatorManipulatorDeviceDriver trappedManipulatorManipulatorDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
@@ -568,6 +570,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) device.getDeviceDriver();
|
||||
lampThreecolorDeviceDriver.writing(code, value);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver) {
|
||||
boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) device.getDeviceDriver();
|
||||
boxSubvolumesConveyorDeviceDriver.writing(code, value);
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) device.getDeviceDriver();
|
||||
beltConveyorDeviceDriver.writing(code, value);
|
||||
@@ -725,7 +731,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
map.put("to_spec", to_spec);
|
||||
map.put("to_qty", to_qty);
|
||||
}
|
||||
log.info("下发电气信号--------------:参数" + map);
|
||||
paperTubePickSiteDeviceDriver.writing(map);
|
||||
log.info("给电气下发信号成功!");
|
||||
}
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
|
||||
@@ -501,6 +501,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
List<Instruction> findByNextCode(String nextDeviceCode);
|
||||
|
||||
List<Instruction> findReadyIns();
|
||||
List<Instruction> findReadyIns2();
|
||||
|
||||
Instruction findByStarCodeAndExcute(String deviceCode);
|
||||
}
|
||||
|
||||
@@ -2043,6 +2043,16 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
return instructionList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Instruction> findReadyIns2() {
|
||||
|
||||
//根据时间升序取第一个
|
||||
List<Instruction> instructionsList = instructions.stream()
|
||||
.filter(item -> StrUtil.equals(item.getInstruction_type(), TaskTypeEnum.Truss_Task.getIndex())
|
||||
&& StrUtil.equals(item.getInstruction_status(), TaskStatusEnum.READY.getIndex())).collect(Collectors.toList());
|
||||
return instructionsList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Instruction> findReadyIns() {
|
||||
|
||||
|
||||
@@ -233,6 +233,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
*/
|
||||
List<TaskDto> queryTaskByDeviceCodeAndStatus(String device_code);
|
||||
|
||||
|
||||
/**
|
||||
* 根据设备号和任务状态查询
|
||||
*
|
||||
|
||||
@@ -39,19 +39,18 @@ public class SysMenuController {
|
||||
private ISysMenuService iSysMenuService;
|
||||
|
||||
@GetMapping(value = "/build")
|
||||
|
||||
public ResponseEntity<Object> buildMenus(@Validated String systemType) {
|
||||
//校验系统表是否存在该系统类型
|
||||
return new ResponseEntity(iSysMenuService.buildMenus(systemType),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping(value = "/lazy")
|
||||
@SaCheckPermission(value = {"menu:list", "roles:list"}, mode = SaMode.AND)
|
||||
public ResponseEntity<Object> query(@RequestParam String pid) {
|
||||
return new ResponseEntity<>(iSysMenuService.getMenus(pid), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/getMenusByRole")
|
||||
@SaCheckPermission(value = {"menu:list", "roles:list"}, mode = SaMode.AND)
|
||||
public ResponseEntity<Object> getMenusByRole(@RequestBody JSONObject json) {
|
||||
@@ -61,7 +60,7 @@ public class SysMenuController {
|
||||
return new ResponseEntity<>(iSysMenuService.getMenusByRole(role_id, system_type, category), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping(value = "/child")
|
||||
@SaCheckPermission(value = {"menu:list", "roles:list"}, mode = SaMode.AND)
|
||||
public ResponseEntity<Object> child(@RequestParam String id) {
|
||||
@@ -74,7 +73,7 @@ public class SysMenuController {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
|
||||
|
||||
@SaCheckPermission("menu:list")
|
||||
public ResponseEntity<Object> pageQuery(MenuQuery query, PageQuery page) throws Exception {
|
||||
if (ObjectUtil.isEmpty(page.getSort())) {
|
||||
@@ -84,7 +83,8 @@ public class SysMenuController {
|
||||
return new ResponseEntity<>(TableDataInfo.build(list), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("/superior")
|
||||
@SaCheckPermission("menu:list")
|
||||
public ResponseEntity<Object> getSuperior(@RequestBody JSONObject param) {
|
||||
@@ -98,7 +98,7 @@ public class SysMenuController {
|
||||
}
|
||||
|
||||
@Log("新增菜单")
|
||||
|
||||
|
||||
@PostMapping
|
||||
@SaCheckPermission("menu:add")
|
||||
public ResponseEntity<Object> create(@RequestBody SysMenu form) {
|
||||
@@ -107,7 +107,7 @@ public class SysMenuController {
|
||||
}
|
||||
|
||||
@Log("修改菜单")
|
||||
|
||||
|
||||
@PutMapping
|
||||
@SaCheckPermission("menu:edit")
|
||||
public ResponseEntity<Object> update( @RequestBody SysMenu form) {
|
||||
|
||||
@@ -72,7 +72,7 @@ spring:
|
||||
waitForTasksToCompleteOnShutdown: true # 参考spring线程池设计,优雅关闭线程池,默认true
|
||||
awaitTerminationSeconds: 5 # 优雅关闭线程池时,阻塞等待线程池中任务执行时间,默认3,单位(s)
|
||||
preStartAllCoreThreads: false # 是否预热所有核心线程,默认false
|
||||
runTimeout: 5000 # 任务执行超时阈值,单位(ms),默认0(不统计)
|
||||
runTimeout: 10000 # 任务执行超时阈值,单位(ms),默认0(不统计)
|
||||
queueTimeout: 1000 # 任务在队列等待超时阈值,单位(ms),默认0(不统计)
|
||||
- threadPoolName: scheduled_pool # 线程池名称,必填
|
||||
threadPoolAliasName: scheduled_thread # 线程池别名,可选
|
||||
|
||||
@@ -115,6 +115,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<root level="info">
|
||||
<appender-ref ref="asyncLuceneAppender"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<!-- <appender-ref ref="CONSOLE"/>-->
|
||||
</root>
|
||||
<logger name="jdbc" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncLuceneAppender"/>
|
||||
|
||||
Reference in New Issue
Block a user