Merge remote-tracking branch 'origin/master_merge' into master_merge

This commit is contained in:
zhouz
2024-07-03 23:02:45 +08:00
35 changed files with 533 additions and 423 deletions

View File

@@ -25,6 +25,12 @@ public class ItemProtocol {
public static String item_error = "error";
//任务号
public static String item_task = "task";
//货叉上叠盘数量
public static String item_s_quantity = "s_quantity";
//货叉下叠盘数量
public static String item_x_quantity = "x_quantity";
//叠盘总数量
public static String item_quantity = "quantity";
//下发命令
public static String item_to_command = "to_command";
@@ -74,6 +80,18 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_task);
}
public int getS_quantity() {
return this.getOpcIntegerValue(item_s_quantity);
}
public int getX_quantity() {
return this.getOpcIntegerValue(item_x_quantity);
}
public int getQuantity() {
return this.getOpcIntegerValue(item_quantity);
}
public int getTo_command() {
return this.getOpcIntegerValue(item_to_command);
}
@@ -142,6 +160,9 @@ public class ItemProtocol {
list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB600.B4"));
list.add(new ItemDto(item_error, "报警信号", "DB600.B6"));
list.add(new ItemDto(item_task, "任务号", "DB600.D10"));
list.add(new ItemDto(item_s_quantity, "货叉上叠盘数量", "DB600.D12"));
list.add(new ItemDto(item_x_quantity, "货叉下叠盘数量", "DB600.D14"));
list.add(new ItemDto(item_quantity, "叠盘总数量", "DB600.D16"));
return list;
}

View File

@@ -62,7 +62,7 @@ public interface NDCAgvService {
* @param result
* @return
*/
/*public byte[] sendAgvTwoModeInst(int phase, int index, int result,int offset,int quantity);*/
public byte[] sendAgvTwoModeInst(int phase, int index, int result,int offset,int quantity);
/**
* 下发一号agv指令

View File

@@ -336,7 +336,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
return b;
}
/*@Override
@Override
public byte[] sendAgvTwoModeInst(int phase, int index, int result,int offset,int quantity) {
if (phase < 0 || index < 0)
return null;
@@ -368,7 +368,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
System.out.println("反馈agv动作数据:" + Bytes2HexString(b));
return b;
}*/
}
@Override

View File

@@ -191,7 +191,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
inst.setAgv_jobno(String.valueOf(index));
inst.setSend_status("1");
instructionService.update(inst);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
}
flag = true;
}
@@ -219,12 +219,13 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
e.printStackTrace();
}
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
}
//请求删除任务
//(需要WCS反馈)
else if (phase == 0x30) {
data = ndcAgvService.sendAgvTwoModeInst(0x8F, index, 0);
// data = ndcAgvService.sendAgvTwoModeInst(0x8F, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(0x8F, index, 0,0,0);
}
//任务删除确认
//(需要WCS反馈)
@@ -243,34 +244,6 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (ObjectUtil.isNotEmpty(device)) {
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
// String region = (String) standardAutodoorDeviceDriver.getDevice().getExtraValue().get("region");
// if (StrUtil.isNotEmpty(region) && !(" ".equals(region))) {
// String linkDeviceCode = (String) standardAutodoorDeviceDriver.getDevice().getExtraValue().get("link_device_code");
// Device deviceByCode = deviceAppService.findDeviceByCode(linkDeviceCode);
// if (ObjectUtil.isNotEmpty(deviceByCode) && deviceByCode.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver) {
// OvenGantryManipulatorDeviceDriver hxhj = (OvenGantryManipulatorDeviceDriver) deviceByCode.getDeviceDriver();
// String s = Integer.parseInt(region) == 1 ? "one" : Integer.parseInt(region) == 2 ?
// "two" : Integer.parseInt(region) == 3 ? "three" : null;
// Class<? extends OvenGantryManipulatorDeviceDriver> aClass = hxhj.getClass();
// String regionCode = "region_" + s;
// String s1 = Integer.parseInt(region) == 1 ? "2" : Integer.parseInt(region) == 2 ?
// "6" : Integer.parseInt(region) == 3 ? "8" : null;
// if (StrUtil.isNotEmpty(s) && ((Integer) aClass.getField(regionCode).get(hxhj) == 0)) {
// hxhj.writing("to_"+regionCode, s1);
// log.info("下发AGV进入区域{}信号值为:{}", region, s1);
// } else {
// log.info("区域{}信号{}未清除,导致不满足下发AGV进入区域信号", region, regionCode);
// }
// if (hxhj.getMode() == 2 && StrUtil.isNotEmpty(s1) && ((Integer) aClass.getField(regionCode).get(hxhj) == 2)) {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// requireSucessRegion = true;
// } else {
// log.error("AGV进入区域{}信号{}行架未接收{},请检查;或行架正在执行中:{}", region, regionCode,s1, hxhj.getMode());
// }
// } else {
// log.error("未设置关联设备或关联的不是烘箱行架设备{}导致信号未反馈", linkDeviceCode);
// }
// } else {
try {
standardAutodoorDeviceDriver.writing("to_open", "1");
standardAutodoorDeviceDriver.writing("to_close", "0");
@@ -298,37 +271,6 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (ObjectUtil.isNotEmpty(device)) {
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
// String region = (String) standardAutodoorDeviceDriver.getDevice().getExtraValue().get("region");
// if (StrUtil.isNotEmpty(region) && !(" ".equals(region))) {
// String linkDeviceCode = (String) standardAutodoorDeviceDriver.getDevice().getExtraValue().get("link_device_code");
// if(requireSucessTake || requireSucessPut){
// Device deviceByCode = deviceAppService.findDeviceByCode(linkDeviceCode);
// if (ObjectUtil.isNotEmpty(deviceByCode) && deviceByCode.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver) {
// OvenGantryManipulatorDeviceDriver hxhj = (OvenGantryManipulatorDeviceDriver) deviceByCode.getDeviceDriver();
// String s = Integer.parseInt(region) == 1 ? "one" : Integer.parseInt(region) == 2 ?
// "two" : Integer.parseInt(region) == 3 ? "three" : null;
// Class<? extends OvenGantryManipulatorDeviceDriver> aClass = hxhj.getClass();
// String regionCode = "region_" + s;
// if (StrUtil.isNotEmpty(s) && ((Integer) aClass.getField(regionCode).get(hxhj) != 0)) {
// hxhj.writing("to_"+regionCode, "0");
// log.info("下发AGV离开区域{}信号值为:{}", region, 0);
// } else {
// log.info("区域{}信号{}为0,不需要下发AGV离开区域信号", region, regionCode);
// }
// if (hxhj.getMode() == 2 && ((Integer) aClass.getField(regionCode).get(hxhj) == 0)) {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// requireSucessPut = false;
// requireSucessTake = false;
// } else {
// log.error("AGV离开区域{}信号{}行架未接收0,请检查;或行架正在执行中:{}", region, regionCode, hxhj.getMode());
// }
// } else {
// log.error("未设置关联设备或关联的不是烘箱行架设备{}导致信号未反馈", linkDeviceCode);
// }
// }else{
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// }
// } else {
try {
standardAutodoorDeviceDriver.writing("to_close", "1");
standardAutodoorDeviceDriver.writing("to_open", "0");
@@ -355,13 +297,6 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver();
agvNdcTwoDeviceDriver.processSocket(arr);
if(phase == 0x05 && "3".equals(inst.getInstruction_type()) && requireSucessRegion){
requireSucessPut = true;
requireSucessRegion = false;
}else if(phase == 0x0E && "8".equals(inst.getInstruction_type()) && requireSucessRegion){
requireSucessTake = true;
requireSucessRegion = false;
}
} else if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
agvNdcOneDeviceDriver.processSocket(arr);

View File

@@ -867,9 +867,9 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
celldto.setY("0");
celldto.setZ("0");
celldto.setAddress(Integer.parseInt(CodeUtil.getNewCode("NDCADDRESS_NO")));
celldto.setCreate_by("init");
celldto.setCreate_time(SecurityUtils.getCurrentNickName());
// wo.insert((JSONObject) JSONObject.toJSON(celldto));
celldto.setCreate_by(SecurityUtils.getCurrentNickName());
String now = DateUtil.now();
celldto.setCreate_time(now);
StorageCell entity = ConvertUtil.convert(celldto, StorageCell.class);
storageCellMapper.insert(entity);
}
@@ -888,9 +888,9 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
celldto.setY("0");
celldto.setZ("0");
celldto.setAddress(Integer.parseInt(CodeUtil.getNewCode("NDCADDRESS_NO")));
celldto.setCreate_by("init");
celldto.setCreate_time(SecurityUtils.getCurrentNickName());
// wo.insert((JSONObject) JSONObject.toJSON(celldto));
celldto.setCreate_by(SecurityUtils.getCurrentNickName());
String now = DateUtil.now();
celldto.setCreate_time(now);
StorageCell entity = ConvertUtil.convert(celldto, StorageCell.class);
storageCellMapper.insert(entity);
}

View File

@@ -1,13 +1,12 @@
package org.nl.acs.device_driver.agv.ndctwo;
import cn.hutool.core.util.NumberUtil;
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.AcsConfig;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun;
import org.nl.acs.common.base.CommonFinalParam;
@@ -23,7 +22,6 @@ import org.nl.acs.device_driver.storage.standard_storage.StandardStorageDeviceDr
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.HongXiangStationDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.oven_manipulator.OvenGantryManipulatorDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.ranging_stations.RangingStationsDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.waste_foil_weighing_station.WasteFoilWeighingStationDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
@@ -41,8 +39,6 @@ import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.enums.LogTypeEnum;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.config.thread.ThreadPoolExecutorUtil;
@@ -267,7 +263,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -287,7 +283,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -305,47 +301,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1
&& standardInspectSiteDeviceDriver.getError() == 0)) {
String region = (String) standardInspectSiteDeviceDriver.getDevice().getExtraValue().get("region");
if (StrUtil.isNotEmpty(region) && !(" ".equals(region))) {
String linkDeviceCode = (String) standardInspectSiteDeviceDriver.getDevice().getExtraValue().get("link_device_code");
Device deviceByCode = deviceAppService.findDeviceByCode(linkDeviceCode);
if (ObjectUtil.isNotEmpty(deviceByCode) && deviceByCode.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver) {
OvenGantryManipulatorDeviceDriver hxhj = (OvenGantryManipulatorDeviceDriver) deviceByCode.getDeviceDriver();
String s = Integer.parseInt(region) == 2 ? "one" : Integer.parseInt(region) == 6 ?
"two" : Integer.parseInt(region) == 8 ? "three" : null;
Class<? extends OvenGantryManipulatorDeviceDriver> aClass = hxhj.getClass();
String regionCode = "region_" + s;
if (StrUtil.isNotEmpty(s) && ((Integer) aClass.getField(regionCode).get(hxhj) == 0)) {
hxhj.writing("to_" + regionCode, region);
log.info("下发AGV进入区域{}信号值为:{}", s, region);
} else {
log.info("区域{}信号{}未清除,导致不满足下发AGV进入区域信号", s, regionCode);
}
if (hxhj.getMode() == 2 && StrUtil.isNotEmpty(region) && ((Integer) aClass.getField(regionCode).get(hxhj) == Integer.parseInt(region))) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
log.error("AGV进入区域{}信号{}行架未接收{},请检查;或行架正在执行中:{}", region, regionCode, Integer.parseInt(region), hxhj.getMode());
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction()
, standardInspectSiteDeviceDriver.getError(), ikey);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(message)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction()
, standardInspectSiteDeviceDriver.getError(), ikey);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(message)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
@@ -356,7 +328,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -381,7 +353,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if (hongXiangStationDeviceDriver.getMove() > 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -408,7 +380,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -491,7 +463,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "2");
wasteFoilWeighingStationDriver.writing(map);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -513,7 +485,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -579,7 +551,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
&& StrUtil.equals("true", this.device.getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) {
standardOrdinarySiteDeviceDriver.setOption(0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -587,7 +559,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -618,7 +590,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
e.printStackTrace();
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -648,7 +620,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if (hongXiangStationDeviceDriver.getMove() > 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -675,7 +647,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -702,37 +674,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if ((standardInspectSiteDeviceDriver.getMove() != 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
String region = (String) standardInspectSiteDeviceDriver.getDevice().getExtraValue().get("region");
if (StrUtil.isNotEmpty(region) && !(" ".equals(region))) {
String linkDeviceCode = (String) standardInspectSiteDeviceDriver.getDevice().getExtraValue().get("link_device_code");
Device deviceByCode = deviceAppService.findDeviceByCode(linkDeviceCode);
if (ObjectUtil.isNotEmpty(deviceByCode) && deviceByCode.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver) {
OvenGantryManipulatorDeviceDriver hxhj = (OvenGantryManipulatorDeviceDriver) deviceByCode.getDeviceDriver();
String s = Integer.parseInt(region) == 2 ? "one" : Integer.parseInt(region) == 6 ?
"two" : Integer.parseInt(region) == 8 ? "three" : null;
Class<? extends OvenGantryManipulatorDeviceDriver> aClass = hxhj.getClass();
String regionCode = "region_" + s;
if (StrUtil.isNotEmpty(s) && ((Integer) aClass.getField(regionCode).get(hxhj) != 0)) {
hxhj.writing("to_"+regionCode, "0");
log.info("下发AGV离开区域{}信号值为:{}", region, 0);
} else {
log.info("区域{}信号{}为0,不需要下发AGV离开区域信号", s, regionCode);
}
if (hxhj.getMode() == 2 && ((Integer) aClass.getField(regionCode).get(hxhj) == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
log.error("AGV离开区域{}信号{}行架未接收0,请检查;或行架正在执行中:{}", s, regionCode, hxhj.getMode());
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction()
@@ -752,7 +700,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "3");
wasteFoilWeighingStationDriver.writing(map);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -774,7 +722,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -844,7 +792,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -864,7 +812,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -881,7 +829,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -907,7 +855,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -933,7 +881,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if (hongXiangStationDeviceDriver.getMove() > 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -960,7 +908,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1030,7 +978,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("设备{},偏移数据出错导致未反馈{},指令号{}", device_code, rangingStationsDeviceDriver.getLength1() + "," + rangingStationsDeviceDriver.getLength2(), ikey);
}
}*/ else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1087,7 +1035,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())) {
standardOrdinarySiteDeviceDriver.setOption(0);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1095,7 +1043,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
@@ -1114,7 +1062,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if (hongXiangStationDeviceDriver.getMove() == 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1140,7 +1088,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
e.printStackTrace();
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1156,7 +1104,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1183,7 +1131,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1202,7 +1150,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1238,7 +1186,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
task.setCarno(this.device_code);
taskService.update(task);
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1289,7 +1237,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1309,7 +1257,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1336,7 +1284,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1361,7 +1309,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if (hongXiangStationDeviceDriver.getMove() == 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1383,7 +1331,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing(1);
if ((standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1460,7 +1408,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "4");
wasteFoilWeighingStationDriver.writing(map);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1482,7 +1430,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1546,7 +1494,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
// } else {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1562,7 +1510,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
e.printStackTrace();
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1577,7 +1525,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if (hongXiangStationDeviceDriver.getMove() > 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1620,7 +1568,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1643,37 +1591,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing(0);
if ((standardInspectSiteDeviceDriver.getMove() == 1)) {
String region = (String) standardInspectSiteDeviceDriver.getDevice().getExtraValue().get("region");
if (StrUtil.isNotEmpty(region) && !(" ".equals(region))) {
String linkDeviceCode = (String) standardInspectSiteDeviceDriver.getDevice().getExtraValue().get("link_device_code");
Device deviceByCode = deviceAppService.findDeviceByCode(linkDeviceCode);
if (ObjectUtil.isNotEmpty(deviceByCode) && deviceByCode.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver) {
OvenGantryManipulatorDeviceDriver hxhj = (OvenGantryManipulatorDeviceDriver) deviceByCode.getDeviceDriver();
String s = Integer.parseInt(region) == 2 ? "one" : Integer.parseInt(region) == 6 ?
"two" : Integer.parseInt(region) == 8 ? "three" : null;
Class<? extends OvenGantryManipulatorDeviceDriver> aClass = hxhj.getClass();
String regionCode = "region_" + s;
if (StrUtil.isNotEmpty(s) && ((Integer) aClass.getField(regionCode).get(hxhj) != 0)) {
hxhj.writing("to_"+ regionCode, "0");
log.info("下发AGV离开区域{}信号值为:{}", region, 0);
} else {
log.info("区域{}信号{}为0,不需要下发AGV离开区域信号", s, regionCode);
}
if (hxhj.getMode() == 2 && ((Integer) aClass.getField(regionCode).get(hxhj) == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
log.error("AGV离开区域{}信号{}行架未接收0,请检查;或行架正在执行中:{}", s, regionCode, hxhj.getMode());
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) {
wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver();
@@ -1683,7 +1607,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "5");
wasteFoilWeighingStationDriver.writing(map);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1705,7 +1629,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1771,7 +1695,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
// } else {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1789,7 +1713,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1814,7 +1738,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if (hongXiangStationDeviceDriver.getMove() == 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1841,7 +1765,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1917,7 +1841,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("设备{},偏移数据出错导致未反馈{},指令号{}", device_code, rangingStationsDeviceDriver.getLength1() + "," + rangingStationsDeviceDriver.getLength2(), ikey);
}
}*/ else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -1984,7 +1908,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
// } else {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -2000,7 +1924,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
e.printStackTrace();
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -2016,7 +1940,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -2042,7 +1966,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
e.printStackTrace();
}
if (hongXiangStationDeviceDriver.getMove() > 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
@@ -2061,7 +1985,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)

View File

@@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.acs.agv.server.impl.XianGongAgvServiceImpl;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
@@ -28,6 +29,8 @@ import org.nl.config.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
/**
@@ -56,7 +59,7 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
@Autowired
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
@Autowired
private XianGongAgvService xianGongAgvService;
XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class);
Integer hasGoods = 0;
int error = 0;
@@ -127,27 +130,56 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
/**
* 是否推送场景的状态 0=可推送 1=正在更新场景 2=正在执行运单
*/
private String upload_scene_status;
private String upload_scene_status = "";
/**
* 机器人当前运单
*/
private String current_order;
private String current_order = "";
/**
* 机器人连接状态 0表示断连 1表示连接上
*/
private String connection_status;
private String connection_status = "";
/**
* 机器人可接单状态 true=可接单 false=不可接单
*/
private String dispatchable;
private boolean dispatchable = false;
/**
* core出错标识
*/
private boolean is_error;
private boolean is_error = false;
/**
* 是否正在执行用户下发的运单
*/
private boolean procBusiness;
private boolean procBusiness = false;
/**
* 机器人当前地图不在场景中
*/
private boolean current_map_invalid = false;
/**
* 机器人是否断连
*/
private boolean disconnect = false;
/**
* 1 = api 设置可接单2 = api 设置不可接单(小车占用资源) 3 = api 设置不可接单(小车不占用资源)
*/
private int dispatchable_status = 0;
/**
* 低电量
*/
private boolean low_battery = false;
/**
* 暂停运单
*/
private boolean suspended = false;
/**
* 未确认定位
*/
private boolean unconfirmed_reloc = false;
/**
* 0: 控制权在core手上 1; 控制权被其他人抢走; 2: 控制权没有被抢占
*/
private int unlock = 0;
String device_code = null;
String container;
@@ -178,11 +210,15 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
@Override
public JSONObject getDeviceStatusName() {
getAgvStatus();
JSONObject jo = new JSONObject();
Map<String, Object> map = new LinkedHashMap<>();
try{
getAgvStatus();
}catch (Exception e){
message = "获取机器人状态报错";
}
String isError;
if (is_error) {
isError = "报错";
isError = "出错,不执行任何运单";
} else {
isError = "正常";
}
@@ -193,12 +229,21 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
} else if (CommonFinalParam.DELETE.equals(upload_scene_status)) {
upload_scene_status = "可推送";
}
jo.put("is_error", isError);
jo.put("upload_scene_status", upload_scene_status);
jo.put("procBusiness", procBusiness);
jo.put("current_order", current_order);
jo.put("connection_status", connection_status);
jo.put("dispatchable", dispatchable);
map.put("errors", isError);
map.put("upload_scene_status", upload_scene_status);
map.put("procBusiness", procBusiness ? "": "");
// map.put("current_order", current_order);
map.put("connection_status", "1".equals(connection_status) ? "连接上" : "断连");
map.put("dispatchable", dispatchable ? "可接单" : "不可接单");
map.put("dispatchable_status", dispatchable_status == 1?"设置可接单" : dispatchable_status == 2?"设置不可接单(小车占用资源)" : dispatchable_status == 3?"设置不可接单(小车不占用资源)" : "未知");
map.put("current_map_invalid", current_map_invalid ? "机器人不在地图场景中": "机器人在地图场景中");
map.put("disconnect", disconnect ? "机器人断连" : "机器人连接上");
map.put("low_battery", low_battery ? "低电量": "正常");
map.put("suspended", suspended ? "订单被暂停,需要人工手动恢复": "正常");
map.put("message", message);
map.put("unconfirmed_reloc", unconfirmed_reloc ? "未确认定位" : "正常");
map.put("unlock", unlock == 0 ? "控制权在core手上" : unlock == 1 ? "控制权被其他人抢走" : unlock == 2 ?"控制权没有被抢占" : "未知");
JSONObject jo = new JSONObject(map);
return jo;
}
@@ -214,7 +259,7 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
*/
private void getAgvStatus() {
HttpResponse robotInfo = xianGongAgvService.getRobotInfo(this.getDevice().getDevice_name());
if (robotInfo.getStatus() == 200) {
if (ObjectUtil.isNotEmpty(robotInfo) && robotInfo.getStatus() == 200) {
JSONObject jsonObject = JSONObject.parseObject(robotInfo.body());
String report = jsonObject.getString("report");
//core出错标识
@@ -231,9 +276,26 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
//机器人连接状态 0表示断连 1表示连接上
connection_status = json.getString("connection_status");
//机器人可接单状态 true=可接单 false=不可接单
dispatchable = json.getString("dispatchable");
dispatchable = json.getBooleanValue("dispatchable");
//机器人不可接单原因
JSONObject undispatchableReason = json.getJSONObject("undispatchable_reason");
//机器人当前地图不在场景中
current_map_invalid = undispatchableReason.getBooleanValue("current_map_invalid");
//网络断连
disconnect = undispatchableReason.getBooleanValue("disconnect");
//可接单状态: 0 = api 设置可接单, 1 = api 设置不可接单
dispatchable_status = undispatchableReason.getIntValue("dispatchable_status");
//低电量
low_battery = undispatchableReason.getBooleanValue("low_battery");
//当前车子的订单被暂停了,需要人为手动恢复
suspended = undispatchableReason.getBooleanValue("suspended");
//未确认定位
unconfirmed_reloc = undispatchableReason.getBooleanValue("unconfirmed_reloc");
//0: 控制权在core手上 , 1:控制权被其他人抢走
unlock = undispatchableReason.getIntValue("unlock");
}
} else {
message = "请求机器人状态失败";
log.info("请求{}机器人状态失败", this.getDevice().getDevice_name());
}
}

View File

@@ -30,6 +30,7 @@ import java.util.Map;
@RequiredArgsConstructor
public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
protected ToDoorCommandControl toDoorCommandControl = new ToDoorCommandControl(this);
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
@Autowired
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
@@ -85,22 +86,16 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
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));
// 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));
try {
this.checkcontrol(itemMap);
this.toDoorCommandControl.control(param,value);
} catch (Exception e) {
e.printStackTrace();
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发门信号:" + itemMap)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
public void writing(String param, int command) {

View File

@@ -0,0 +1,27 @@
package org.nl.acs.device_driver.autodoor.standard_autodoor;
import java.util.HashMap;
import java.util.Map;
public class ToDoorCommandControl {
private StandardAutodoorDeviceDriver driver;
public ToDoorCommandControl(StandardAutodoorDeviceDriver driver){
this.driver = driver;
}
public void control(String param, String value) throws Exception {
// ItemValue[] itemValues = new ItemValue[]{new ItemValue(this.driver.getItem(ItemProtocol.item_to_command), command)};
Map<String, Object> itemMap = new HashMap<String, Object>();
String to_param = this.driver.getDevice().getOpc_server_code() + "." + this.driver.getDevice().getOpc_plc_code() + "." + this.driver.getDevice().getDevice_code()
+ "."+ param;
itemMap.put(to_param, Integer.parseInt(value));
try {
this.driver.checkcontrol(itemMap);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -422,7 +422,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请空托盘出入库,返回参数:" + jo.getString("body"))
.content("申请空托盘出入库,返回参数:" + response)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);

View File

@@ -189,14 +189,8 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
heartbeat = this.itemProtocol.getHeartbeat();
material_barcode = this.itemProtocol.getMaterialBarcode();
if (mode != last_mode) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", Math.min(mode, 3));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", CommonFinalParam.ONE);
requireSucess = false;
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记:" + requireSucess);
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (move != 0 && task > 0) {

View File

@@ -187,14 +187,8 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
// 更新指令状态
if (mode != last_mode) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", Math.min(mode, 3));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", CommonFinalParam.ONE);
requireSucess = false;
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记:" + requireSucess);
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (move != 0 && task > 0) {
if (null!=inst) {
@@ -333,6 +327,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
.device_code(device_code)
.content("申请AGV任务,请求参数:" + apply)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
String str = acsToWmsService.applySendOutTwo(apply);
JSONObject jo = JSON.parseObject(str);
@@ -340,6 +335,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
.device_code(device_code)
.content("申请AGV任务,参数,接口返回:" + jo)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
message = "申请AGV任务,参数,接口返回:" + jo;
@@ -352,7 +348,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
this.writing(list1);
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请AGV任务,返回参数:" + jo.getString("body"))
.content("申请AGV任务,返回参数:" + str)
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
@@ -369,6 +365,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
.device_code(device_code)
.content("申请AGV任务,请求参数:" + apply)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
String str = acsToWmsService.applySendOutTwo(apply);
logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,请求参数:" + apply + ",响应参数");
@@ -378,6 +375,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
.device_code(device_code)
.content("申请AGV任务,参数,接口返回:" + jo)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
message = "申请AGV任务,参数,接口返回:" + jo;
if (jo.getInteger("status") == 200) {

View File

@@ -371,7 +371,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请捆扎失败,接口返回:" + jo.getString("body"))
.content("申请捆扎失败,接口返回:" + response)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);

View File

@@ -189,14 +189,9 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
container_type = this.itemProtocol.getContainer_type();
carrier_direction = this.itemProtocol.getCarrier_direction();
if (mode != last_mode) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", Math.min(mode, 3));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", CommonFinalParam.ONE);
requireSucess = false;
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记:" + requireSucess);
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
// 更新指令状态
if (move != 0 && task > 0) {
@@ -617,7 +612,7 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请空托盘出入库,返回参数:" + jo.getString("body"))
.content("申请空托盘出入库,返回参数:" + response)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);

View File

@@ -16,6 +16,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.nl.acs.AcsConfig;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device.service.DeviceExtraService;
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
import org.nl.acs.device_driver.DeviceDriver;
@@ -446,7 +447,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请高度等级,返回参数:" + jo.getString("body"))
.content("申请高度等级,返回参数:" + response)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
@@ -506,7 +507,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请退货入库,返回参数:" + jo.getString("body"))
.content("申请退货入库,返回参数:" + response)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
@@ -615,7 +616,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请空托盘出入库,返回参数:" + jo.getString("body"))
.content("申请空托盘出入库,返回参数:" + response)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
@@ -677,7 +678,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("木箱、子卷入库申请入库任务,返回参数:" + jo.getString("body"))
.content("木箱、子卷入库申请入库任务,返回参数:" + response)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
@@ -787,6 +788,16 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
//判断有无出入库任务是相同路线
//判断有没有DDJ对接位出入库的指令
List<Instruction> byCodeAndExcute = instructionService.findByCodeAndExcute(next_device_code);
if (CollUtil.isNotEmpty(byCodeAndExcute)){
Iterator<Instruction> iterator = byCodeAndExcute.iterator();
while (iterator.hasNext()) {
Instruction instruction = iterator.next();
Device nextDevice = deviceAppService.findDeviceByCode(instruction.getNext_device_code());
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.storage.name())){
iterator.remove();
}
}
}
if (CollUtil.isNotEmpty(byCodeAndExcute)){
this.message="有DDJ对接位出入库的指令";
requireSucess = false;

View File

@@ -247,7 +247,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
//任务完成
if (action == 4 && move == 0) {
if (action == 5 && move == 0) {
if (inst != null) {
try {
logServer.deviceExecuteLog(this.device_code, "", "", "放货完成");

View File

@@ -365,7 +365,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
count = 0;
}
if (mode == 0) {
if (mode == 0 || command == 9) {
this.setIsonline(false);
message = "universal_off";
}else {
@@ -711,7 +711,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
luceneExecuteLogService.deviceExecuteLog(logDto1);
String response = acsToWmsService.applyUpdatePointCode(param);
JSONObject jo = JSON.parseObject(response);
if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) {
if ( jo.getInteger("status") == 200) {
try {
//清警
cleanErro();
@@ -761,7 +761,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请更新点位,返回参数:" + jo.getString("body"))
.content("申请更新点位,返回参数:" + jo)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
@@ -1254,12 +1254,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
//监控大屏下发作业命令清警-5、召回-7、急停-8
Integer toCommand = data.getInteger("toCommand");
if (toCommand != null) {
HashMap map1 = new HashMap();
List<Object> list = new ArrayList<>();
map1.put("code", "to_command");
map1.put("value", toCommand);
list.add(map1);
this.writing(map1);
List list = new ArrayList<>();
Map map4 = new HashMap<>();
map4.put("code", "to_command");
map4.put("value", toCommand);
list.add(map4);
writing(list);
}
//ACS监控大屏设置禁止入库、禁止出库、停止接收任务
Boolean prohibitInWarehouse = data.getBoolean("prohibitInWarehouse");

View File

@@ -223,6 +223,8 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver
jo.put("isOnline", this.getIsonline());
jo.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError())));
jo.put("isError", this.getIserror());
jo.put("qty", this.getQty());
jo.put("type", this.getType() == 3 ? "三寸": this.getType() == 6 ? "六寸" : "未知");
jo.put("driver_type", "siemens_conveyor");
jo.put("is_click", true);
return jo;

View File

@@ -21,6 +21,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.hongxiang_device.HongXiangConveyorDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.lamp_three_color.LampThreecolorDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
@@ -350,6 +351,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Device startdevice = deviceAppService.findDeviceByCode(start_device_code);
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
/*if (startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof RangingStationsDeviceDriver) {
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver();
@@ -1034,6 +1036,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
@@ -1051,8 +1054,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
}
if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextDevice.getDeviceDriver();
if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver||nextDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
if (!StrUtil.startWith(taskDto.getTask_code(), "-")) {
if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("link_three_lamp"))) {
String lamp = nextDevice.getExtraValue().get("link_three_lamp").toString();

View File

@@ -695,6 +695,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
//拆叠盘位
FoldDiscSiteDeviceDriver foldDiscSiteDeviceDriver;
//气胀轴缓存库
InflatableShaftLibraryDeviceDriver inflatableShaftLibraryDeviceDriver;
PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver;
if (datas.size() == 0) {
throw new BadRequestException("缺少输入参数!");
@@ -844,6 +847,15 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("qty", foldDiscSiteDeviceDriver.getQty());
jo.put("container_type", foldDiscSiteDeviceDriver.getContainer_type());
jo.put("error", foldDiscSiteDeviceDriver.getError());
}
else if (device.getDeviceDriver() instanceof InflatableShaftLibraryDeviceDriver) {
inflatableShaftLibraryDeviceDriver = (InflatableShaftLibraryDeviceDriver) device.getDeviceDriver();
jo.put("device_code", parent_device_code);
jo.put("move", inflatableShaftLibraryDeviceDriver.getMove());
jo.put("mode", inflatableShaftLibraryDeviceDriver.getMode());
jo.put("qty", inflatableShaftLibraryDeviceDriver.getQty());
jo.put("error", inflatableShaftLibraryDeviceDriver.getError());
jo.put("type", inflatableShaftLibraryDeviceDriver.getError());
} else {
jo.put("device_code", parent_device_code);
}

View File

@@ -124,8 +124,22 @@ export default {
'barcode_length': 'Vehicle length',
'last_container': 'Last vehicle number',
'applySucess': 'Request task flag',
'requireSucess': 'Request instruction mark'
'requireSucess': 'Request instruction mark',
'number_of_air_shafts': 'Number of air shafts',
'control': 'Control',
'positioning_confirmation': 'Positioning confirmation',
'The_status_of_the_waybill': 'The status of the waybill',
'The_state_of_the_robots_battery_level': 'The state of the robots battery level',
'Whether_or_not_the_connection_is_disconnected': 'Whether or not the connection is disconnected',
'Whether_or_not_in_the_scene': 'Whether or not in the scene',
'Whether_the_order_can_be_accepted': 'Whether the order can be accepted',
'Connection_status': 'Connection status',
'Whether_it_is_being_executed': 'Whether or not the waybill placed by the user is being executed',
'Whether_to_push_the_scenario_waybill': 'Whether to push the scenario waybill',
'Core_error_identifier': 'Core error identifier',
'Current_command_information': 'Current command information',
'The_signal_is_successfully_marked': 'The signal is successfully marked',
'Complement_information': 'Complement information'
}
}
}

View File

@@ -124,8 +124,22 @@ export default {
'barcode_length': 'Perjalanan panjang',
'last_container': 'Nomor muatan terakhir',
'applySucess': 'Meminta tanda tugas',
'requireSucess': 'Kode aplikasicomment'
'requireSucess': 'Kode aplikasicomment',
'number_of_air_shafts': 'Jumlah poros udara',
'control': 'Menguasai',
'positioning_confirmation': 'Konfirmasi posisi',
'The_status_of_the_waybill': 'Status waybill',
'The_state_of_the_robots_battery_level': 'Keadaan tingkat baterai robot',
'Whether_or_not_the_connection_is_disconnected': 'Apakah koneksi terputus atau tidak',
'Whether_or_not_in_the_scene': 'Apakah di tempat kejadian atau tidak',
'Whether_the_order_can_be_accepted': 'Apakah pesanan dapat diterima',
'Connection_status': 'Status koneksi',
'Whether_it_is_being_executed': 'Apakah waybill yang ditempatkan oleh pengguna sedang dieksekusi atau tidak',
'Whether_to_push_the_scenario_waybill': 'Apakah akan mendorong waybill skenario',
'Core_error_identifier': 'Pengenal kesalahan inti',
'Current_command_information': 'Informasi perintah saat ini',
'The_signal_is_successfully_marked': 'Sinyal berhasil ditandai',
'Complement_information': 'Informasi pelengkap'
}
}
}

View File

@@ -124,7 +124,22 @@ export default {
'barcode_length': '载具长度',
'last_container': '上次载具号',
'applySucess': '请求任务标记',
'requireSucess': '申请指令标记'
'requireSucess': '申请指令标记',
'number_of_air_shafts': '气涨轴数量',
'control': '控制权',
'positioning_confirmation': '定位确认',
'The_status_of_the_waybill': '运单状态',
'The_state_of_the_robots_battery_level': '机器人电量状态',
'Whether_or_not_the_connection_is_disconnected': '是否断连',
'Whether_or_not_in_the_scene': '是否在场景',
'Whether_the_order_can_be_accepted': '是否可接单',
'Connection_status': '连接状态',
'Whether_it_is_being_executed': '是否在执行用户下的运单',
'Whether_to_push_the_scenario_waybill': '是否推送场景运单',
'Core_error_identifier': 'Core出错标识位',
'Current_command_information': '当前指令信息',
'The_signal_is_successfully_marked': '信号成功标记',
'Complement_information': '补码信息'
}
}
}

View File

@@ -168,7 +168,7 @@
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_name"
:label="item.device_code"
:value="item.device_code"
/>
</el-select>
@@ -177,42 +177,43 @@
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="关联设备异常时取货点" prop="device_code" label-width="200">
<el-select
v-model="form.error_get_device_code"
multiple
filterable
reserve-keyword
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
: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="200">
<el-select
v-model="form.error_put_device_code"
filterable
reserve-keyword
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-row>
<el-col :span="8">
<el-form-item label="关联设备异常时取货点" prop="device_code" label-width="200">
<el-select
v-model="form.error_get_device_code"
multiple
filterable
reserve-keyword
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="200">
<el-select
v-model="form.error_put_device_code"
filterable
reserve-keyword
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-row>
</el-form>
</el-card>

View File

@@ -698,7 +698,7 @@ export default {
const obj = { name: i18n.t('monitor.click.request_success_flag'), value: data[val] }
this.arr.push(obj)
} else if (val === 'requireActionSucess') {
const obj = { name: '信号成功标记', value: data[val] }
const obj = { name: i18n.t('monitor.click.delivery_completed'), value: data[val] }
this.arr.push(obj)
} else if (val === 'applySucess') {
const obj = { name: 'applySucess', value: data[val] }
@@ -710,7 +710,7 @@ export default {
const obj = { name: i18n.t('monitor.click.inventory_quantity'), value: data[val] }
this.arr.push(obj)
} else if (val === 'hand_barcode') {
const obj = { name: '补码信息', value: data[val] }
const obj = { name: i18n.t('monitor.click.Complement_information'), value: data[val] }
this.arr.push(obj)
} else if (val === 'hand_barcode1') {
const obj = { name: i18n.t('monitor.click.the_subvolume_number'), value: data[val] }
@@ -755,10 +755,49 @@ export default {
const obj = { name: i18n.t('monitor.click.command'), value: data[val] }
this.arr.push(obj)
} else if (val === 'material_barcode') {
const obj = { name: '子卷编号', value: data[val] }
const obj = { name: i18n.t('monitor.click.the_subvolume_number'), value: data[val] }
this.arr.push(obj)
} else if (val === 'inst_message') {
const obj = { name: '当前指令信息', value: data[val] }
const obj = { name: i18n.t('monitor.click.Current_command_information'), value: data[val] }
this.arr.push(obj)
} else if (val === 'errors') {
const obj = { name: i18n.t('monitor.click.Core_error_identifier'), value: data[val] }
this.arr.push(obj)
} else if (val === 'upload_scene_status') {
const obj = { name: i18n.t('monitor.click.Whether_to_push_the_scenario_waybill'), value: data[val] }
this.arr.push(obj)
} else if (val === 'procBusiness') {
const obj = { name: i18n.t('monitor.click.Whether_it_is_being_executed'), value: data[val] }
this.arr.push(obj)
} else if (val === 'connection_status') {
const obj = { name: i18n.t('monitor.click.Connection_status'), value: data[val] }
this.arr.push(obj)
} else if (val === 'dispatchable_status') {
const obj = { name: i18n.t('monitor.click.Whether_the_order_can_be_accepted'), value: data[val] }
this.arr.push(obj)
} else if (val === 'current_map_invalid') {
const obj = { name: i18n.t('monitor.click.Whether_or_not_in_the_scene'), value: data[val] }
this.arr.push(obj)
} else if (val === 'disconnect') {
const obj = { name: i18n.t('monitor.click.Whether_or_not_the_connection_is_disconnected'), value: data[val] }
this.arr.push(obj)
} else if (val === 'low_battery') {
const obj = { name: i18n.t('monitor.click.The_state_of_the_robots_battery_level'), value: data[val] }
this.arr.push(obj)
} else if (val === 'suspended') {
const obj = { name: i18n.t('monitor.click.The_status_of_the_waybill'), value: data[val] }
this.arr.push(obj)
} else if (val === 'unconfirmed_reloc') {
const obj = { name: i18n.t('monitor.click.positioning_confirmation'), value: data[val] }
this.arr.push(obj)
} else if (val === 'unlock') {
const obj = { name: i18n.t('monitor.click.control'), value: data[val] }
this.arr.push(obj)
} else if (val === 'qty') {
const obj = { name: i18n.t('monitor.click.number_of_air_shafts'), value: data[val] }
this.arr.push(obj)
} else if (val === 'type') {
const obj = { name: i18n.t('opc.table_title.type'), value: data[val] }
this.arr.push(obj)
}
}

View File

@@ -65,8 +65,8 @@
AND p.is_child_tz_ok = '0'
AND p.is_paper_ok = '1'
AND p.is_delete = '0'
AND p.up_or_down IS NOT NULL
AND p.left_or_right IS NOT NULL
AND IFNULL(p.up_or_down,'') <![CDATA[ <> ]]> ''
AND IFNULL(p.left_or_right,'') <![CDATA[ <> ]]> ''
GROUP BY
p.resource_name,
p.parent_container_name,

View File

@@ -854,11 +854,11 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
boxInfo.put("device_code", deviceCode);
boxInfo.put("material_code", boxType);
boxInfo.put("num", workIdList.size());
String boxSn = outBoxManageService.outBox(boxInfo);
//String boxSn = outBoxManageService.outBox(boxInfo);
stopWatch.stop();
System.out.println("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
log.info("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
//String boxSn = "MX240702000169";
String boxSn = "MX240703000118";
StopWatch stopWatch1 = new StopWatch();
stopWatch1.start();
//更新及子卷包装状态已分配规格及木箱规格组
@@ -902,7 +902,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
djqPoints.forEach(r -> {
//校验重复任务
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getVehicle_code, r.getContainer_name()).eq(SchBaseTask::getTask_type, PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"))
.eq(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("")));
.eq(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("")).lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED));
if (CollectionUtils.isEmpty(taskList)) {
JSONObject jo = new JSONObject();
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"));

View File

@@ -27,6 +27,7 @@ import org.nl.common.enums.PackageInfoIvtEnum;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.system.service.param.ISysParamService;
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@@ -114,7 +115,7 @@ public class AutoSendZxToDjw {
throw new BadRequestException("装箱区的子卷号为" + containerName + "无对应的分切计划信息,请检查!");
}
//校验是否存在相同子卷号任务
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getVehicle_code, containerName).eq(SchBaseTask::getTask_type, PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位")).eq(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("")));
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getVehicle_code, containerName).eq(SchBaseTask::getTask_type, PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位")).eq(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code("")).lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode()));
if (CollectionUtils.isEmpty(taskList)) {
//创建搬运任务到装箱位
JSONObject jo = new JSONObject();
@@ -159,7 +160,7 @@ public class AutoSendZxToDjw {
* 传输子卷包装关系至MES
*/
public void transferBoxPackageToMes(List<PdmBiSubpackagerelation> packagerelationList, BstIvtBoxinfo bstIvtBoxinfo) {
if (StringUtils.isBlank(packagerelationList.get(0).getPackage_box_sn()) || packagerelationList.get(0).getBox_weight() == null) {
if (StringUtils.isBlank(packagerelationList.get(0).getPackage_box_sn())) {
log.info("transferBoxPackageToMes接口的子卷号" + packagerelationList.get(0).getContainer_name() + ",子卷未确定木箱规格信息");
throw new BadRequestException("子卷未确定木箱规格信息!");
}

View File

@@ -15,6 +15,8 @@ import org.nl.b_lms.bst.ivt.stockingivt.service.IBstIvtStockingivtService;
import org.nl.b_lms.bst.ivt.stockingivt.service.dao.BstIvtStockingivt;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
import org.nl.b_lms.sch.tasks.slitter.StockAreaCallTubeTask;
import org.nl.b_lms.sch.tasks.slitter.StockAreaSendVehicleTask;
import org.nl.b_lms.sch.tasks.slitter.TrussCallAirShaftTask;
@@ -32,8 +34,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil.*;
@@ -70,6 +74,8 @@ public class AutoCallAirShaftTask {
private StockAreaCallTubeTask stockAreaCallTubeTask;
@Autowired
private IMdPbPapervehicleService mdPbPapervehicleService;
@Autowired
private IschBaseTaskService taskService;
/**
* hint: 目前只是考虑了上区域
@@ -82,6 +88,7 @@ public class AutoCallAirShaftTask {
*/
@Transactional(rollbackFor = Exception.class)
public void run() {
log.info(this.getClass().getName() + "开始执行...");
// 1、获取空的插拔轴位(无任务)
List<BstIvtShafttubeivt> emptyPoints = bstIvtShafttubeivtService.getAllShaftPointsByConditions("2",
"0", "0");
@@ -92,7 +99,7 @@ public class AutoCallAirShaftTask {
// 2、获取分切计划数据 校验代数
List<SlitterPlanDistinctDto> planAll = slittingproductionplanService.getAllCutPlan();
List<SlitterPlanDistinctDto> plans = planAll.stream()
.filter(p -> p.getResource_name().startsWith("B")).collect(Collectors.toList());
.filter(p -> p.getResource_name().startsWith("B6")).collect(Collectors.toList());
if (plans.size() == 0) {
// 如果不需要套轴,就只做拔轴
makePullShaft(empty, specification);
@@ -445,7 +452,27 @@ public class AutoCallAirShaftTask {
trussCallAirShaftTask.createTask(param);
}
/**
* 检查是否有同设备的任务
* @param dto
* @return
*/
public boolean checkHasTask(SlitterPlanDistinctDto dto) {
// 同设备,同母卷,同组别的任务
// 桁架也需要校验
return false;
}
/**
* 检查是否有同母卷,不同组的点位数据
* @param dto
* @return
*/
public boolean checkComputationPoint(SlitterPlanDistinctDto dto) {
// 同设备,同母卷,同组别的点位
// 有就返回true
return false;
}

View File

@@ -123,7 +123,7 @@ public class AutoSendAirShaftAgvTask {
param.put("point_code2", endPoint.getPoint_code());
param.put("vehicle_code1", cutPoint.getQzz_no1());
param.put("vehicle_code2", cutPoint.getQzz_no2());
param.put("task_type", SlitterEnum.TASK_TYPE.code("穿拔轴缓存<>穿拔轴位"));
param.put("task_type", SlitterEnum.TASK_TYPE.code("送气胀轴到分切机任务"));
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
sendAirShaftAgvTask.createTask(param);
} else {

View File

@@ -22,7 +22,7 @@ public enum SlitterEnum {
TASK_TYPE(MapOf.of("穿拔轴缓存<>穿拔轴位", "010801", "穿拔轴缓存<>分切对接位", "010802", "穿拔轴位<>气胀轴缓存位", "010803"
, "分切机下料AGV任务", "010804", "分切机上气胀轴", "010805", "分切机下气胀轴", "010806", "备货区送载具", "010807"
, "备货区送纸管", "010808", "分切机下料桁架任务", "010809", "分切机下料AGV到内包间", "010810", "套轴异常处理AGV任务", "010811"
, "套轴异常处理桁架任务", "010812"));
, "套轴异常处理桁架任务", "010812", "送气胀轴到分切机任务", "010813"));
private Map<String, String> code;
public String code(String desc) {

View File

@@ -769,6 +769,9 @@ public class SlitterServiceImpl implements SlitterService {
StIvtCutpointivt deviceCode = cutpointivtService.getPintByExtCode(device_code, false);
List<String> qzzNo = Stream.of(deviceCode.getUp_qzzno(), deviceCode.getDown_qzzno())
.filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
if (qzzNo.size() == 0) {
throw new BadRequestException("分切机 " + device_code + " 的分切计划不存在!");
}
List<PdmBiSlittingproductionplan> list = slittingproductionplanService.getByQzzNos(qzzNo, "05");
if (list.size() == 0) {
throw new BadRequestException("分切机" + device_code + " 的分切计划 " + qzzNo + " 不存在");

View File

@@ -1939,7 +1939,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return taskService.list(new LambdaQueryWrapper<SchBaseTask>()
.eq(SchBaseTask::getTask_type, taskType)
.eq(SchBaseTask::getVehicle_code, containerName)
.gt(SchBaseTask::getCreate_time, startTime)
//.gt(SchBaseTask::getCreate_time, startTime)
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
.eq(SchBaseTask::getIs_delete, IOSEnum.IS_NOTANDYES.code(""))
);

View File

@@ -18,6 +18,9 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@@ -128,73 +131,87 @@ public class SapToLmsServiceImpl implements SapToLmsService {
public JSONObject getReCutInfo(JSONObject json) {
log.info("getReCutInfo的输入参数为------------------------" + json.toString());
JSONObject jsonMst = new JSONObject();
JSONObject result = new JSONObject();
String msg = "改切出库单据推送成功!";
try {
JSONArray dtl_ja = json.getJSONArray("ITEM");
String LGORT = dtl_ja.getJSONObject(0).getString("LGORT");
JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("ext_id = '" + LGORT + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(stor_jo)) {
result.put("RTYPE", "E");
result.put("RTMSG", "操作失败!" + "未查询到外部标识为:" + LGORT + "对应的仓库!");
result.put("RTOAL", 1);
result.put("RTDAT", null);
return result;
}
// 需要插入分切计划的集合
List<JSONObject> needInsetIos = new ArrayList<>();
// 子卷集合
List<JSONObject> dtl_ja = json.getJSONArray("ITEM").toJavaList(JSONObject.class);
// 根据仓库进行分类:一个仓库生成一个单据
Map<String, List<JSONObject>> storList = dtl_ja.stream()
.collect(Collectors.groupingBy(row -> row.getString("LGORT")));
jsonMst.put("stor_id", stor_jo.getString("stor_id"));
jsonMst.put("stor_code", stor_jo.getString("stor_code"));
jsonMst.put("stor_name", stor_jo.getString("stor_name"));
for(String LGORT: storList.keySet()) {
// 查询仓库是否存在
JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("ext_id = '" + LGORT + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(stor_jo)) {
result.put("RTYPE", "E");
result.put("RTMSG", "操作失败!" + "未查询到外部标识为:" + LGORT + "对应的仓库!");
result.put("RTOAL", 1);
result.put("RTDAT", null);
return result;
}
JSONArray dtls = new JSONArray();
for (int i = 0; i < dtl_ja.size(); i++) {
JSONObject jo = dtl_ja.getJSONObject(i);
String sap_pcsn = jo.getString("CHARG");
if (StrUtil.isEmpty("sap_pcsn")) {
throw new BadRequestException("请求参数SAP批次不能为空!");
}
JSONObject sub_jo = WQLObject.getWQLObject("PDM_BI_SubPackageRelation").query("sap_pcsn = '" + sap_pcsn + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sub_jo)) {
throw new BadRequestException("LMS中不存在SAP批次为【" + sap_pcsn + "】的包装关系");
}
String container_name = sub_jo.getString("container_name");
JSONObject struct_ivt = WQLObject.getWQLObject("st_ivt_structivt").query("pcsn = '" + container_name + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(struct_ivt)) {
throw new BadRequestException("SAP批次为【" + sap_pcsn + "】的成品卷不存在或已经出库!");
} else {
if (struct_ivt.getDoubleValue("frozen_qty") > 0) {
msg = "SAP批次为【" + sap_pcsn + "】的成品卷已经被分配或出库中";
// 组织主表信息
JSONObject jsonMst = new JSONObject();
jsonMst.put("stor_id", stor_jo.getString("stor_id"));
jsonMst.put("stor_code", stor_jo.getString("stor_code"));
jsonMst.put("stor_name", stor_jo.getString("stor_name"));
// 组织明细信息
JSONArray dtls = new JSONArray();
for (JSONObject jo : storList.get(LGORT)) {
String sap_pcsn = jo.getString("CHARG");
if (StrUtil.isEmpty("sap_pcsn")) {
throw new BadRequestException("请求参数SAP批次不能为空!");
}
JSONObject sub_jo = WQLObject.getWQLObject("PDM_BI_SubPackageRelation").query("sap_pcsn = '" + sap_pcsn + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sub_jo)) {
throw new BadRequestException("LMS中不存在SAP批次为【" + sap_pcsn + "】的包装关系");
}
String container_name = sub_jo.getString("container_name");
JSONObject struct_ivt = WQLObject.getWQLObject("st_ivt_structivt").query("pcsn = '" + container_name + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(struct_ivt)) {
throw new BadRequestException("SAP批次为【" + sap_pcsn + "】的成品卷不存在或已经出库!");
} else {
JSONObject dtl = new JSONObject();
//查询该物料
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + sub_jo.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(mater_jo)) {
throw new BadRequestException("查询物料" + sub_jo.getString("product_name") + ",信息!");
if (struct_ivt.getDoubleValue("frozen_qty") > 0) {
msg = "SAP批次为【" + sap_pcsn + "】的成品卷已经被分配或出库中";
} else {
JSONObject dtl = new JSONObject();
//查询物料
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + sub_jo.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(mater_jo)) {
throw new BadRequestException("未查询到物料:" + sub_jo.getString("product_name") + ",信息!");
}
dtl.put("material_id", mater_jo.getString("material_id"));
dtl.put("sap_pcsn", sap_pcsn);
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + mater_jo.getString("base_unit_id") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(unit)) {
throw new BadRequestException("未查询到物料计量单位:" + mater_jo.getString("base_unit_id") + ",信息!");
}
dtl.put("qty_unit_id", unit.getString("measure_unit_id"));
dtl.put("qty_unit_name", unit.getString("unit_name"));
dtl.put("package_box_sn", sub_jo.getString("package_box_sn"));
dtl.put("qty", sub_jo.getString("net_weight"));
dtls.add(dtl);
}
dtl.put("material_id", mater_jo.getString("material_id"));
dtl.put("sap_pcsn", sap_pcsn);
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + mater_jo.getString("base_unit_id") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(unit)) {
throw new BadRequestException("未查询到物料计量单位:" + mater_jo.getString("base_unit_id") + ",信息!");
}
dtl.put("qty_unit_id", unit.getString("measure_unit_id"));
dtl.put("qty_unit_name", unit.getString("unit_name"));
dtl.put("package_box_sn", sub_jo.getString("package_box_sn"));
dtl.put("qty", sub_jo.getString("net_weight"));
dtls.add(dtl);
}
}
if (!dtls.isEmpty()) {
jsonMst.put("tableData", dtls);
needInsetIos.add(jsonMst);
} else {
throw new BadRequestException("推送失败SAP推送的子卷明细不符合出库状态");
}
}
if (!dtls.isEmpty()) {
jsonMst.put("tableData", dtls);
recutPlanService.insertDtl(jsonMst);
} else {
throw new BadRequestException("推送失败SAP推送的子卷明细不符合出库状态");
// 生成单据
for(JSONObject jsonIos : needInsetIos) {
recutPlanService.insertDtl(jsonIos);
}
} catch (Exception exception) {
result.put("TYPE", "E");
result.put("MESSAGE", "推送失败!" + exception.getMessage());

View File

@@ -29,9 +29,9 @@ public class TaskUtil {
if (schBaseTask.getTask_status().equals(TaskStatusEnum.FINISHED.getCode())) {
return true;
}
if (StringUtils.isBlank(schBaseTask.getVehicle_code())) {
throw new BadRequestException("任务类型为:" + taskType + "子卷号不能为空!");
}
// if (StringUtils.isBlank(schBaseTask.getVehicle_code())) {
// throw new BadRequestException("任务类型为:" + taskType + "子卷号不能为空!");
// }
return false;
}