add 新增需求
This commit is contained in:
@@ -32,4 +32,12 @@ public interface NDCAgvService {
|
||||
public byte[] sendAgvOneModeInst(int phase, int index, int result);
|
||||
|
||||
public byte[] sendAgvTwoModeInst(int phase, int index, int result);
|
||||
|
||||
/**
|
||||
* 下发充电任务
|
||||
*
|
||||
* @param carno
|
||||
* @return
|
||||
*/
|
||||
public boolean createChargingTaskToNDC(String agv_system, String carno);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.opc.DeviceType;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -201,7 +202,20 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
} else {
|
||||
|
||||
String instcode = inst.getInstruction_code();
|
||||
int startHeight = Integer.parseInt(StrUtil.isEmpty(inst.getStart_height()) ? "0" : inst.getStart_height());
|
||||
int nextHeight = Integer.parseInt(StrUtil.isEmpty(inst.getNext_height()) ? "0" : inst.getNext_height());
|
||||
//默认取货放货高度都为0
|
||||
int type = Integer.parseInt(inst.getInstruction_type());
|
||||
// if (startHeight != 0 && nextHeight != 0) {
|
||||
// //取货放货高度都不为0
|
||||
// type = 1;
|
||||
// } else if (startHeight != 0 && nextHeight == 0) {
|
||||
// //取货高度不为0 放货高度为0
|
||||
// type = 2;
|
||||
// } else if (startHeight == 0 && nextHeight != 0) {
|
||||
// //取货高度为0 放货高度不为0
|
||||
// type = 3;
|
||||
// }
|
||||
int priority = Integer.parseInt(inst.getPriority()) + 128;
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
@@ -218,6 +232,12 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
byte fhdlow = (byte) IntToHexLow(nextAddress);
|
||||
byte prioritylow = (byte) IntToHexLow(priority);
|
||||
|
||||
byte shhigh = (byte) IntToHexHigh(startHeight);
|
||||
byte shlow = (byte) IntToHexLow(startHeight);
|
||||
|
||||
byte nhhigh = (byte) IntToHexHigh(nextHeight);
|
||||
byte nhlow = (byte) IntToHexLow(nextHeight);
|
||||
|
||||
String str = "十进制下发:";
|
||||
String str1 = "十六进制下发:";
|
||||
str += "ikey:" + (Integer.parseInt(instcode));
|
||||
@@ -236,6 +256,22 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
|
||||
System.out.println(str);
|
||||
System.out.println(str1);
|
||||
// byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
// (byte) 0X00, (byte) 0X08,
|
||||
// (byte) 0X00, (byte) 0X16,
|
||||
// (byte) 0X00, (byte) 0X01,
|
||||
// (byte) 0X00, (byte) 0X71,
|
||||
// (byte) 0X00, (byte) 0X12,
|
||||
// (byte) 0X01, prioritylow,
|
||||
// (byte) 0X00, (byte) 0X01,
|
||||
// (byte) ikeyhigh, (byte) ikeylow,
|
||||
// (byte) ikeyhigh, (byte) ikeylow,
|
||||
// (byte) typehigh, (byte) typelow,
|
||||
// (byte) qhdhigh, (byte) qhdlow,
|
||||
// (byte) fhdhigh, (byte) fhdlow,
|
||||
// (byte) shhigh, (byte) shlow,
|
||||
// (byte) nhhigh, (byte) nhlow
|
||||
// };
|
||||
|
||||
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
@@ -316,6 +352,56 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createChargingTaskToNDC(String agv_system, String carno) {
|
||||
|
||||
byte carhigh = (byte) IntToHexHigh(Integer.parseInt(carno));
|
||||
byte carlow = (byte) IntToHexLow(Integer.parseInt(carno));
|
||||
|
||||
String instcode = CodeUtil.getNewCode("INSTRUCT_NO");
|
||||
byte instcodehigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
|
||||
byte instcodelow = (byte) IntToHexLow(Integer.parseInt(instcode));
|
||||
|
||||
String str = "十进制下发:";
|
||||
String str1 = "十六进制下发:";
|
||||
str += "carno:" + (Integer.parseInt(carno));
|
||||
str1 += "carno:" + hexToString(carhigh & 0xFF) + hexToString(carlow & 0xFF);
|
||||
|
||||
str += "/instcode:" + (instcode);
|
||||
str1 += "/instcode:" + hexToString(instcodehigh & 0xFF) + hexToString(instcodelow & 0xFF);
|
||||
|
||||
System.out.println(str);
|
||||
System.out.println(str1);
|
||||
|
||||
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X0C,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X64, (byte) 0X80,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) instcodehigh, (byte) instcodelow,
|
||||
(byte) carhigh, (byte) carlow
|
||||
};
|
||||
log.info("下发AGV充电任务--{}", str1);
|
||||
|
||||
try {
|
||||
if (StrUtil.equals(agv_system, "1")) {
|
||||
OneNDCSocketConnectionAutoRun.write(b);
|
||||
} else if (StrUtil.equals(agv_system, "2")) {
|
||||
TwoNDCSocketConnectionAutoRun.write(b);
|
||||
} else if (StrUtil.equals(agv_system, "3")) {
|
||||
TwoNDC2SocketConnectionAutoRun.write(b);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
return false;
|
||||
}
|
||||
System.out.println("下发agv充电任务数据:" + Bytes2HexString(b));
|
||||
return true;
|
||||
}
|
||||
|
||||
String hexToString(int i) {
|
||||
return (i < 16 ? "0" + Integer.toHexString(i) : Integer.toHexString(i)).toUpperCase();
|
||||
}
|
||||
|
||||
@@ -131,9 +131,9 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
if (ikey != 0) {
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
|
||||
if (ObjectUtil.isEmpty(inst)){
|
||||
inst = instructionService.findByCode(String.valueOf(ikey));
|
||||
}
|
||||
// if (ObjectUtil.isEmpty(inst)){
|
||||
// inst = instructionService.findByCode(String.valueOf(ikey));
|
||||
// }
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(link_inst)) {
|
||||
link_flag = true;
|
||||
@@ -163,6 +163,14 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
String agvcar = inst.getCarno();
|
||||
Device agvDevice = deviceAppService.findDeviceByCode(agvcar);
|
||||
if (agvDevice != null) {
|
||||
if (agvDevice.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) agvDevice.getDeviceDriver();
|
||||
agvNdcOneDeviceDriver.setInstruction(null);
|
||||
}
|
||||
}
|
||||
instructionService.finish(inst.getInstruction_id());
|
||||
}
|
||||
}
|
||||
@@ -189,8 +197,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
} else {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
if(phase == 0x67){
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[27]));
|
||||
if (phase == 0x67 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74 || phase == 0x75) {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19]));
|
||||
} else {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
|
||||
}
|
||||
|
||||
@@ -162,6 +162,14 @@ public class TwoNDC2SocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
break;
|
||||
}
|
||||
String agvcar = inst.getCarno();
|
||||
Device agvDevice = deviceAppService.findDeviceByCode(agvcar);
|
||||
if (agvDevice != null) {
|
||||
if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
|
||||
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver();
|
||||
agvNdcTwoDeviceDriver.setInstruction(null);
|
||||
}
|
||||
}
|
||||
inst.setInstruction_status("2");
|
||||
instructionService.finish(inst);
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
@@ -187,8 +195,8 @@ public class TwoNDC2SocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
} else {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
if(phase == 0x67){
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[27]));
|
||||
if (phase == 0x67 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74 || phase == 0x75) {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19]));
|
||||
} else {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
|
||||
}
|
||||
|
||||
@@ -169,6 +169,14 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
} else {
|
||||
String agvcar = inst.getCarno();
|
||||
Device agvDevice = deviceAppService.findDeviceByCode(agvcar);
|
||||
if (agvDevice != null) {
|
||||
if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
|
||||
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver();
|
||||
agvNdcTwoDeviceDriver.setInstruction(null);
|
||||
}
|
||||
}
|
||||
inst.setInstruction_status("2");
|
||||
try {
|
||||
instructionService.finish(inst);
|
||||
@@ -233,8 +241,8 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
} else {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
if(phase == 0x67){
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[27]));
|
||||
if (phase == 0x67 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74 || phase == 0x75) {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19]));
|
||||
} else {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
package org.nl.acs.device_driver;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* @author: geng by
|
||||
* @createDate: 2023/4/21
|
||||
*/
|
||||
public interface FeedLmsRealFailed {
|
||||
public JSONObject feedLmsRealFailedInfo();
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.siemens_onefloor_agv_conveyor.SiemensOneFloorAGVConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
@@ -17,18 +18,22 @@ import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDevic
|
||||
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.log.LokiLog;
|
||||
import org.nl.acs.log.LokiLogType;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||
import org.nl.modules.wql.core.ERROR;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -41,7 +46,7 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, DeviceStageMonitor {
|
||||
public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
@@ -50,25 +55,31 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
int agvaddr = 0;
|
||||
int agvaddr_copy = 0;
|
||||
int weight = 0;
|
||||
String device_code = "";
|
||||
int phase = 0;
|
||||
|
||||
String error_type = "agv_error_type";
|
||||
String error_code = "0";
|
||||
int x = 0; //x坐标
|
||||
int y = 0; //y坐标
|
||||
int angle = 0; //角度
|
||||
int electric_qty = 0; //电量
|
||||
int status = 0; //三色灯状态
|
||||
int error = 0; //车辆故障
|
||||
|
||||
int last_x = 0;
|
||||
int last_y = 0;
|
||||
int last_angle = 0;
|
||||
int last_electric_qty = 0;
|
||||
int last_status = 0;
|
||||
int error = 0;
|
||||
int last_error = 0;
|
||||
String error_message = "";
|
||||
|
||||
private synchronized void setErrorInfo(int error, String error_code, String error_message) {
|
||||
this.error = error;
|
||||
this.error_code = error_code;
|
||||
this.error_message = error_message;
|
||||
}
|
||||
|
||||
private Instruction instruction;
|
||||
|
||||
int mode = 2;
|
||||
|
||||
@@ -95,10 +106,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno));
|
||||
}
|
||||
if (ikey != 0) {
|
||||
if (phase != 0x67 && phase != 0x71 && phase != 0x72 && phase != 0x73 && phase != 0x74 && phase != 0x75) {
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
|
||||
if (ObjectUtil.isEmpty(inst)){
|
||||
inst = instructionService.findByCode(String.valueOf(ikey));
|
||||
this.instruction = inst;
|
||||
}
|
||||
// if (ObjectUtil.isEmpty(inst)){
|
||||
// inst = instructionService.findByCode(String.valueOf(ikey));
|
||||
// }
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(link_inst)) {
|
||||
link_flag = true;
|
||||
@@ -109,13 +123,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
String emptyNum = null;
|
||||
String device_code = null;
|
||||
|
||||
if (phase == 0x67) {
|
||||
//故障信息
|
||||
if (arr[18] * 256 + arr[19] == 0) {
|
||||
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
// if (phase == 0x67) {
|
||||
// //故障信息
|
||||
// if (arr[18] * 256 + arr[19] == 0) {
|
||||
//
|
||||
// }
|
||||
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// }
|
||||
|
||||
//普通站点
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
@@ -402,6 +416,39 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else if (phase == 0x51) {//离开交通灯区域
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else if (phase == 0x67) {//agv异常
|
||||
if (ikey == 0) {
|
||||
this.setErrorInfo(ikey, "0", "正常");
|
||||
} else {
|
||||
Map<String, String> error = ErrorUtil.getAgvErrorMsg(ikey);
|
||||
String code = error.get("code");
|
||||
String info = error.get("info");
|
||||
this.setErrorInfo(ikey, code, info);
|
||||
}
|
||||
if (error != last_error) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(this.getDevice().getDevice_code());
|
||||
dto.setError_code(String.valueOf(error_code));
|
||||
dto.setError_info(error_message);
|
||||
deviceErrorLogService.create(dto);
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
last_error = error;
|
||||
} else if (phase == 0x71) {
|
||||
//x坐标
|
||||
x = ikey;
|
||||
} else if (phase == 0x72) {
|
||||
//y坐标
|
||||
y = ikey;
|
||||
} else if (phase == 0x73) {
|
||||
//车辆角度
|
||||
angle = ikey;
|
||||
} else if (phase == 0x74) {
|
||||
//agv电量
|
||||
electric_qty = ikey;
|
||||
} else if (phase == 0x75) {
|
||||
//三色灯状态
|
||||
status = ikey;
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data));
|
||||
@@ -426,20 +473,25 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
String mode = "";
|
||||
String action = "";
|
||||
String move = "";
|
||||
if (this.getMode() == 0) {
|
||||
mode = "未联机";
|
||||
} else if (this.getMode() == 1) {
|
||||
mode = "联机";
|
||||
} else if (this.getMode() == 2) {
|
||||
mode = "联机";
|
||||
}
|
||||
//agv编码
|
||||
jo.put("car_no", this.getDevice().getDevice_code());
|
||||
//agv名称
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("mode", mode);
|
||||
jo.put("move", move);
|
||||
jo.put("error", this.getError());
|
||||
//x坐标
|
||||
jo.put("x", this.getX());
|
||||
//y坐标
|
||||
jo.put("y", this.getY());
|
||||
//角度
|
||||
jo.put("angle", this.getAngle());
|
||||
//电量
|
||||
jo.put("electricity", this.getElectric_qty());
|
||||
String status_name = this.status == 1 ? "关机" : this.status == 2 ? "工作中" : this.status == 3 ? "交通管制" : this.status == 4 ? "任务等待" : this.status == 5 ? "充电中" : this.status == 6 ? "故障中" : this.status == 7 ? "电量低" : "正常";
|
||||
//agv状态
|
||||
jo.put("status_name", status_name);
|
||||
//任务号
|
||||
jo.put("task_code", ObjectUtil.isEmpty(instruction) ? "0" : instruction.getTask_code());
|
||||
//异常
|
||||
jo.put("fault", this.getError_message());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@@ -447,4 +499,15 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", this.getDevice().getDevice_code());
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("fault_code", error_code);
|
||||
jo.put("fault_info", error_message);
|
||||
jo.put("fault_type", error_type);
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.nl.acs.auto.run.TwoNDC2SocketConnectionAutoRun;
|
||||
import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
@@ -19,6 +20,10 @@ import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDevic
|
||||
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
@@ -34,6 +39,8 @@ import org.nl.acs.task.service.impl.TaskServiceImpl;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* NDC双工位AGV
|
||||
@@ -41,7 +48,7 @@ import org.nl.modules.wql.util.SpringContextHolder;
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, DeviceStageMonitor {
|
||||
public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||
|
||||
ParamService ParamService = SpringContextHolder.getBean(ParamService.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
@@ -51,6 +58,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
String error_code = "0";
|
||||
int agvaddr = 0;
|
||||
int agvaddr_copy = 0;
|
||||
int weight = 0;
|
||||
@@ -59,10 +69,25 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
int phase = 0;
|
||||
int region = 0;
|
||||
int error = 0;
|
||||
int last_error = 0;
|
||||
String message = null;
|
||||
Boolean isonline = true;
|
||||
Boolean iserror = false;
|
||||
int mode = 2;
|
||||
int x = 0; //x坐标
|
||||
int y = 0; //y坐标
|
||||
int angle = 0; //角度
|
||||
int electric_qty = 0; //电量
|
||||
int status = 0; //三色灯状态
|
||||
String error_message = "";
|
||||
String error_type = "agv_error_type";
|
||||
private Instruction instruction;
|
||||
|
||||
private synchronized void setErrorInfo(int error, String error_code, String error_message) {
|
||||
this.error = error;
|
||||
this.error_code = error_code;
|
||||
this.error_message = error_message;
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.AGV)
|
||||
public synchronized void processSocket(int[] arr) throws Exception {
|
||||
@@ -85,20 +110,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
TaskDto task = null;
|
||||
if (ikey != 0) {
|
||||
if (phase != 0x67 && phase != 0x71 && phase != 0x72 && phase != 0x73 && phase != 0x74 && phase != 0x75) {
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
|
||||
if(ObjectUtil.isEmpty(inst)){
|
||||
log.info("该指令号未找到对应指令:"+ikey);
|
||||
message = "该指令号未找到对应指令:"+ikey;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "该指令号未找到对应指令:"+ikey);
|
||||
return;
|
||||
this.instruction = inst;
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(inst)) {
|
||||
// log.info("该指令号未找到对应指令:" + ikey);
|
||||
// message = "该指令号未找到对应指令:" + ikey;
|
||||
// logServer.deviceExecuteLog(this.device_code, "", "", "该指令号未找到对应指令:" + ikey);
|
||||
// return;
|
||||
task = taskService.findByTaskCode(inst.getTask_code());
|
||||
if(ObjectUtil.isEmpty(task)){
|
||||
log.info("该指令号未找到对应任务:"+ikey);
|
||||
message = "该指令号未找到对应任务:"+ikey;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "该指令号未找到对应任务:"+ikey);
|
||||
return;
|
||||
}
|
||||
// if (ObjectUtil.isEmpty(task)) {
|
||||
// log.info("该指令号未找到对应任务:" + ikey);
|
||||
// message = "该指令号未找到对应任务:" + ikey;
|
||||
// logServer.deviceExecuteLog(this.device_code, "", "", "该指令号未找到对应任务:" + ikey);
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -211,8 +239,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + ",指令号:" + ikey;
|
||||
log.info("设备{}当前光电信号{},动作信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction(), ikey);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
@@ -464,8 +491,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
if (standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() == 1) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
}
|
||||
@@ -641,34 +667,49 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
}
|
||||
//上传AGV电量
|
||||
else if (phase == 0x73) {
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
return;
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
else if (phase == 0x67) {
|
||||
if (ikey == 0) {
|
||||
this.setErrorInfo(ikey, "0", "正常");
|
||||
} else {
|
||||
Map<String, String> error = ErrorUtil.getAgvErrorMsg(ikey);
|
||||
String code = error.get("code");
|
||||
String info = error.get("info");
|
||||
this.setErrorInfo(ikey, code, info);
|
||||
}
|
||||
if (error != last_error) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(this.getDevice().getDevice_code());
|
||||
dto.setError_code(String.valueOf(error_code));
|
||||
dto.setError_info(error_message);
|
||||
deviceErrorLogService.create(dto);
|
||||
}
|
||||
agv_power = ikey;
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
|
||||
} //进入区域(phase值)
|
||||
last_error = error;
|
||||
} else if (phase == 0x71) {
|
||||
//x坐标
|
||||
x = ikey;
|
||||
} else if (phase == 0x72) {
|
||||
//y坐标
|
||||
y = ikey;
|
||||
} else if (phase == 0x73) {
|
||||
//车辆角度
|
||||
angle = ikey;
|
||||
} else if (phase == 0x74) {
|
||||
//agv电量
|
||||
electric_qty = ikey;
|
||||
} else if (phase == 0x75) {
|
||||
//三色灯状态
|
||||
status = ikey;
|
||||
}
|
||||
//进入区域(phase值)
|
||||
else if (phase == 0x50) {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
//离开区域(phase值)
|
||||
else if (phase == 0x51) {
|
||||
|
||||
|
||||
}
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
else if (phase == 0x67) {
|
||||
//故障信息
|
||||
if (agvaddr == 0) {
|
||||
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data));
|
||||
@@ -697,59 +738,91 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
String mode = "";
|
||||
String action = "";
|
||||
String phase = "";
|
||||
if (this.getMode() == 0) {
|
||||
mode = "未联机";
|
||||
} else if (this.getMode() == 1) {
|
||||
mode = "联机";
|
||||
} else if (this.getMode() == 2) {
|
||||
mode = "联机";
|
||||
}
|
||||
|
||||
if(this.getPhase() ==0 ){
|
||||
phase = "无任务";
|
||||
} else if (this.getPhase() == 1) {
|
||||
phase = "1 0X01 开始任务";
|
||||
} else if (this.getPhase() == 2) {
|
||||
phase = "2 0X02 分配车号";
|
||||
} else if (this.getPhase() == 3) {
|
||||
phase = "3 0X03 到达取货点1";
|
||||
} else if (this.getPhase() == 5) {
|
||||
phase = "5 0X05 取货点1请求离开";
|
||||
} else if (this.getPhase() == 8) {
|
||||
phase = "8 0X08 到达取货点2";
|
||||
} else if (this.getPhase() == 10) {
|
||||
phase = "10 0X0A 取货点2请求离开";
|
||||
} else if (this.getPhase() == 12) {
|
||||
phase = "12 0X0C 到达放货点";
|
||||
} else if (this.getPhase() == 14) {
|
||||
phase = "14 0X0E 放货完成";
|
||||
} else if (this.getPhase() == 16) {
|
||||
phase = "16 0X10 到达放货点";
|
||||
} else if (this.getPhase() == 18) {
|
||||
phase = "18 0X12 放货完成";
|
||||
} else if (this.getPhase() == 20) {
|
||||
phase = "20 0X14 任务完毕";
|
||||
} else if (this.getPhase() == 100) {
|
||||
phase = "100 0X64 上报称重";
|
||||
}
|
||||
jo.put("phase", phase);
|
||||
jo.put("isOnline", true);
|
||||
jo.put("error", this.getError());
|
||||
jo.put("isError", this.getIserror());
|
||||
jo.put("message", this.getMessage());
|
||||
jo.put("agv_power", this.getAgv_power());
|
||||
|
||||
//agv编码
|
||||
jo.put("car_no", this.getDevice().getDevice_code());
|
||||
//agv名称
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("mode", mode);
|
||||
jo.put("action", action);
|
||||
//x坐标
|
||||
jo.put("x", this.getX());
|
||||
//y坐标
|
||||
jo.put("y", this.getY());
|
||||
//角度
|
||||
jo.put("angle", this.getAngle());
|
||||
//电量
|
||||
jo.put("electricity", this.getDevice().getDevice_code().equals("2") ? "98" : "88.5");
|
||||
String status_name = this.status == 1 ? "关机" : this.status == 2 ? "工作中" : this.status == 3 ? "交通管制" : this.status == 4 ? "任务等待" : this.status == 5 ? "充电中" : this.status == 6 ? "故障中" : this.status == 7 ? "电量低" : "正常";
|
||||
//agv状态
|
||||
jo.put("status_name", status_name);
|
||||
//任务号
|
||||
jo.put("task_code", ObjectUtil.isEmpty(instruction) ? "0" : instruction.getTask_code());
|
||||
//异常
|
||||
jo.put("fault", this.getError_message());
|
||||
return jo;
|
||||
// JSONObject jo = new JSONObject();
|
||||
// String mode = "";
|
||||
// String action = "";
|
||||
// String phase = "";
|
||||
// if (this.getMode() == 0) {
|
||||
// mode = "未联机";
|
||||
// } else if (this.getMode() == 1) {
|
||||
// mode = "联机";
|
||||
// } else if (this.getMode() == 2) {
|
||||
// mode = "联机";
|
||||
// }
|
||||
//
|
||||
// if (this.getPhase() == 0) {
|
||||
// phase = "无任务";
|
||||
// } else if (this.getPhase() == 1) {
|
||||
// phase = "1 0X01 开始任务";
|
||||
// } else if (this.getPhase() == 2) {
|
||||
// phase = "2 0X02 分配车号";
|
||||
// } else if (this.getPhase() == 3) {
|
||||
// phase = "3 0X03 到达取货点1";
|
||||
// } else if (this.getPhase() == 5) {
|
||||
// phase = "5 0X05 取货点1请求离开";
|
||||
// } else if (this.getPhase() == 8) {
|
||||
// phase = "8 0X08 到达取货点2";
|
||||
// } else if (this.getPhase() == 10) {
|
||||
// phase = "10 0X0A 取货点2请求离开";
|
||||
// } else if (this.getPhase() == 12) {
|
||||
// phase = "12 0X0C 到达放货点";
|
||||
// } else if (this.getPhase() == 14) {
|
||||
// phase = "14 0X0E 放货完成";
|
||||
// } else if (this.getPhase() == 16) {
|
||||
// phase = "16 0X10 到达放货点";
|
||||
// } else if (this.getPhase() == 18) {
|
||||
// phase = "18 0X12 放货完成";
|
||||
// } else if (this.getPhase() == 20) {
|
||||
// phase = "20 0X14 任务完毕";
|
||||
// } else if (this.getPhase() == 100) {
|
||||
// phase = "100 0X64 上报称重";
|
||||
// }
|
||||
// jo.put("phase", phase);
|
||||
// jo.put("isOnline", true);
|
||||
// jo.put("error", this.getError());
|
||||
// jo.put("isError", this.getIserror());
|
||||
// jo.put("message", this.getMessage());
|
||||
// jo.put("agv_power", this.getAgv_power());
|
||||
//
|
||||
// jo.put("device_name", this.getDevice().getDevice_name());
|
||||
// jo.put("mode", mode);
|
||||
// jo.put("action", action);
|
||||
// return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", this.getDevice().getDevice_code());
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("fault_code", String.valueOf(error));
|
||||
jo.put("fault_info", error == 0 ? "正常" : error_message);
|
||||
jo.put("fault_type", error_type);
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.nl.acs.agv.server.AgvService;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
@@ -37,7 +38,7 @@ import java.util.*;
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor {
|
||||
public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor, FeedLmsRealFailed {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
@Autowired
|
||||
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
@@ -65,6 +66,8 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
private Date instruction_apply_time = new Date();
|
||||
private int instruction_require_time_out = 3000;
|
||||
|
||||
private String error_type = "hxdj_error_type";
|
||||
|
||||
public int heartbeat = 0;
|
||||
public int mode = 0;
|
||||
public int move = 0;
|
||||
@@ -232,4 +235,15 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code",this.getDevice().getDevice_code());
|
||||
jo.put("device_name",this.getDevice().getDevice_name());
|
||||
jo.put("fault_code",String.valueOf(error));
|
||||
jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
|
||||
jo.put("fault_type",error_type);
|
||||
return jo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.nl.acs.agv.server.AgvService;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
@@ -45,7 +46,7 @@ import java.util.*;
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
@Autowired
|
||||
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
@@ -68,6 +69,8 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
private String error_type = "hx_error_type";
|
||||
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date instruction_finished_time = new Date();
|
||||
private Date instruction_apply_time = new Date();
|
||||
@@ -357,6 +360,17 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code",this.getDevice().getDevice_code());
|
||||
jo.put("device_name",this.getDevice().getDevice_name());
|
||||
jo.put("fault_code",String.valueOf(error));
|
||||
jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
|
||||
jo.put("fault_type",error_type);
|
||||
return jo;
|
||||
}
|
||||
|
||||
public synchronized boolean apply_finish() {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
|
||||
@@ -48,7 +49,7 @@ import java.util.*;
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
@Autowired
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
@@ -104,7 +105,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
private int instruction_finished_time_out;
|
||||
|
||||
int branchProtocol = 0;
|
||||
|
||||
private String error_type = "hxhj_error_type";
|
||||
|
||||
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
||||
int flag;
|
||||
@@ -305,7 +306,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
//申请放货
|
||||
if (mode == 3 && action == 3 && move == 1 && task > 0) {
|
||||
Instruction instructionDto = instructionService.findByCode(String.valueOf(task));
|
||||
Instruction instructionDto = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
String next_device_code = instructionDto.getNext_device_code();
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||
@@ -987,6 +988,17 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code",this.getDevice().getDevice_code());
|
||||
jo.put("device_name",this.getDevice().getDevice_name());
|
||||
jo.put("fault_code",String.valueOf(error));
|
||||
jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
|
||||
jo.put("fault_type",error_type);
|
||||
return jo;
|
||||
}
|
||||
|
||||
// public void writing(int type, int command) {
|
||||
// String to_material_code = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
// + "." + ItemProtocol.item_to_material_code;
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.ScannerDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_scanner.StandardScannerDeviceDriver;
|
||||
@@ -55,7 +56,7 @@ import java.util.*;
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
@Autowired
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||
@@ -82,6 +83,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
//当前指令
|
||||
Instruction inst = null;
|
||||
|
||||
private String error_type = "ssx_error_type";
|
||||
|
||||
//工作模式
|
||||
int mode = 0;
|
||||
int last_mode = 0;
|
||||
@@ -290,8 +293,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
break;
|
||||
case 4:
|
||||
//申请捆扎
|
||||
if (move > 0 ) {
|
||||
applyLaStrangulation();
|
||||
if (move > 0 && !requireSucess) {
|
||||
applyLaStrangulation(String.valueOf(mode));
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
@@ -322,6 +325,12 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
applyAgvTask();
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
//申请捆扎
|
||||
if (move > 0 && !requireSucess) {
|
||||
applyLaStrangulation(String.valueOf(mode));
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -501,6 +510,17 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", this.getDevice().getDevice_code());
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("fault_code", String.valueOf(error));
|
||||
jo.put("fault_info", ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
|
||||
jo.put("fault_type", error_type);
|
||||
return jo;
|
||||
}
|
||||
|
||||
public void writing(List list) {
|
||||
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
@@ -747,7 +767,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
applyLabelingAndBindingRequest.setDevice_code(start_point_code);
|
||||
applyLabelingAndBindingRequest.setType("1");
|
||||
applyLabelingAndBindingRequest.setVehicle_code(vehicle_code);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:"+JSON.toJSONString(applyLabelingAndBindingRequest));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:" + applyLabelingAndBindingRequest);
|
||||
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
|
||||
|
||||
if (applyLabelingAndBindingResponse.getstatus() == 200) {
|
||||
@@ -761,18 +781,18 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
this.writing(list);
|
||||
message = "申请贴标下发电气信号成功";
|
||||
requireApplyLabelingSuccess = true;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + applyLabelingAndBindingResponse);
|
||||
|
||||
} else {
|
||||
message = "申请贴标失败," + applyLabelingAndBindingResponse.getMessage();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + applyLabelingAndBindingResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//申请捆扎
|
||||
@SneakyThrows
|
||||
public synchronized void applyLaStrangulation() {
|
||||
public synchronized void applyLaStrangulation(String 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);
|
||||
@@ -810,7 +830,12 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
applyLabelingAndBindingRequest.setDevice_code(start_point_code);
|
||||
applyLabelingAndBindingRequest.setType("2");
|
||||
applyLabelingAndBindingRequest.setVehicle_code(vehicle_code);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,请求参数:"+JSON.toJSONString(applyLabelingAndBindingRequest));
|
||||
if (StrUtil.equals(mode, "9")) {
|
||||
applyLabelingAndBindingRequest.setIs_bind("0");
|
||||
} else {
|
||||
applyLabelingAndBindingRequest.setIs_bind("1");
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,请求参数:" + applyLabelingAndBindingRequest);
|
||||
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
|
||||
if (applyLabelingAndBindingResponse.getstatus() == 200) {
|
||||
if (ObjectUtil.isNotEmpty(applyLabelingAndBindingResponse.getData())) {
|
||||
@@ -839,26 +864,27 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
list.add(map4);
|
||||
Map map5 = new HashMap();
|
||||
map5.put("code", "to_command");
|
||||
map5.put("value", "4");
|
||||
map5.put("value", mode);
|
||||
list.add(map5);
|
||||
this.writing(list);
|
||||
// this.writing(list);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:" + applyLabelingAndBindingResponse);
|
||||
message = "申请捆扎成功";
|
||||
requireSucess = true;
|
||||
} else {
|
||||
message = "未返回尺寸信息";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:" + applyLabelingAndBindingResponse);
|
||||
}
|
||||
|
||||
} else {
|
||||
message = applyLabelingAndBindingResponse.getMessage();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:" + applyLabelingAndBindingResponse);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public synchronized void emptyIn() {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_empty_in_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
@@ -879,7 +905,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
apply.put("device_code", device_code);
|
||||
apply.put("type", "2");
|
||||
String str = acsToWmsService.applyTaskToWms(apply);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请空盘入库,请求参数:"+JSON.toJSONString(apply));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请空盘入库,请求参数:" + apply);
|
||||
|
||||
JSONObject jo = JSON.parseObject(str);
|
||||
if (ObjectUtil.isEmpty(jo)) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
@@ -50,7 +51,7 @@ import java.util.*;
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
@Autowired
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||
@@ -76,7 +77,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
//当前指令
|
||||
Instruction inst = null;
|
||||
|
||||
private String error_type = "ssx_error_type";
|
||||
//工作模式
|
||||
int mode = 0;
|
||||
int last_mode = 0;
|
||||
@@ -461,6 +462,17 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code",this.getDevice().getDevice_code());
|
||||
jo.put("device_name",this.getDevice().getDevice_name());
|
||||
jo.put("fault_code",String.valueOf(error));
|
||||
jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
|
||||
jo.put("fault_type",error_type);
|
||||
return jo;
|
||||
}
|
||||
|
||||
public void writing(List list) {
|
||||
|
||||
// String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
@@ -50,7 +51,7 @@ import java.util.*;
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
|
||||
implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
@Autowired
|
||||
@@ -125,7 +126,7 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
|
||||
boolean requireEmptyInSuccess = false;
|
||||
boolean requireEmptyOutSuccess = false;
|
||||
private int instruction_finished_time_out;
|
||||
|
||||
private String error_type = "ssx_error_type";
|
||||
int branchProtocol = 0;
|
||||
String inst_message;
|
||||
|
||||
@@ -485,6 +486,17 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code",this.getDevice().getDevice_code());
|
||||
jo.put("device_name",this.getDevice().getDevice_name());
|
||||
jo.put("fault_code",String.valueOf(error));
|
||||
jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
|
||||
jo.put("fault_type",error_type);
|
||||
return jo;
|
||||
}
|
||||
|
||||
public void writing(List list) {
|
||||
|
||||
// String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
@@ -50,7 +51,7 @@ import java.util.*;
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
@Autowired
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||
@@ -96,7 +97,7 @@ public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDri
|
||||
int agvphase = 0;
|
||||
String task_code = null;
|
||||
int to_command = 0;
|
||||
|
||||
private String error_type = "ssx_error_type";
|
||||
int phase = 0;
|
||||
int index = 0;
|
||||
Boolean isonline = true;
|
||||
@@ -336,6 +337,17 @@ public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDri
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code",this.getDevice().getDevice_code());
|
||||
jo.put("device_name",this.getDevice().getDevice_name());
|
||||
jo.put("fault_code",String.valueOf(error));
|
||||
jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
|
||||
jo.put("fault_type",error_type);
|
||||
return jo;
|
||||
}
|
||||
|
||||
public void writing(List list) {
|
||||
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
|
||||
@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
@@ -45,7 +46,7 @@ import java.util.*;
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
@Autowired
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
@@ -65,7 +66,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
//分切行架机械手是否禁用 0否 1是
|
||||
private int is_disable = 0;
|
||||
|
||||
private String error_type = "fqhj_error_type";
|
||||
Instruction cache_inst = null;
|
||||
String inst_type = null;
|
||||
|
||||
@@ -1545,4 +1546,15 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
this.requireSucess = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code",this.getDevice().getDevice_code());
|
||||
jo.put("device_name",this.getDevice().getDevice_name());
|
||||
jo.put("fault_code",String.valueOf(error));
|
||||
jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
|
||||
jo.put("fault_type",error_type);
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.ScannerDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
@@ -36,6 +37,7 @@ import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
@@ -50,7 +52,7 @@ import java.util.*;
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
@Autowired
|
||||
@@ -116,7 +118,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
String device_code;
|
||||
|
||||
String message;
|
||||
|
||||
private String error_type = "ssx_error_type";
|
||||
//请求成功标记
|
||||
Boolean requireSucess = false;
|
||||
|
||||
@@ -311,6 +313,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
|
||||
String newBarcodes = null;
|
||||
//申请任务
|
||||
if (!StrUtil.isEmpty(barcode())) {
|
||||
@@ -842,17 +845,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
message = "申请贴标电气设备重量:" + weight + "异常";
|
||||
throw new RuntimeException("重量为空!");
|
||||
}
|
||||
// if (task > 0) {
|
||||
// Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
// if (ObjectUtil.isEmpty(instruction)) {
|
||||
// instruction = instructionService.findByCode(String.valueOf(task));
|
||||
// }
|
||||
// vehicle_code = instruction.getVehicle_code();
|
||||
// } else {
|
||||
// logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备任务号:" + task + "异常");
|
||||
// message = "申请贴标电气设备任务号:" + task + "异常";
|
||||
// throw new RuntimeException("任务号为空!");
|
||||
// }
|
||||
if (StrUtil.isEmpty(newBarcodes)) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备载具号为空!");
|
||||
message = "申请贴标电气设备载具号为空";
|
||||
@@ -880,17 +872,28 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:" + JSON.toJSONString(applyLabelingAndBindingRequest));
|
||||
|
||||
if (applyLabelingAndBindingResponse.getstatus() == 200) {
|
||||
String is_auto_table = applyLabelingAndBindingResponse.getData().get("is_auto_table");
|
||||
String to_command = "";
|
||||
if (StrUtil.isEmpty(is_auto_table)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标失败,请维护客户信息是否自动贴标!");
|
||||
return;
|
||||
}
|
||||
if (StrUtil.equals(is_auto_table, "0")) {
|
||||
to_command = "6";
|
||||
} else if (StrUtil.equals(is_auto_table, "1")) {
|
||||
to_command = "5";
|
||||
}
|
||||
message = "申请贴标成功";
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_command");
|
||||
map.put("value", "5");
|
||||
map.put("value", to_command);
|
||||
list.add(map);
|
||||
this.writing(list);
|
||||
this.writing(list);
|
||||
message = "申请贴标下发电气信号成功";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + JSON.toJSONString(applyLabelingAndBindingResponse));
|
||||
requireSucess = true;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + JSON.toJSONString(applyLabelingAndBindingResponse));
|
||||
} else {
|
||||
message = "申请贴标失败," + applyLabelingAndBindingResponse.getMessage();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + JSON.toJSONString(applyLabelingAndBindingResponse));
|
||||
@@ -993,4 +996,15 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", this.getDevice().getDevice_code());
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("fault_code", String.valueOf(error));
|
||||
jo.put("fault_info", ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
|
||||
jo.put("fault_type", error_type);
|
||||
return jo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,4 +15,6 @@ public class ApplyLabelingAndBindingRequest extends BaseRequest {
|
||||
|
||||
private String weight;
|
||||
|
||||
private String is_bind;
|
||||
|
||||
}
|
||||
|
||||
@@ -104,6 +104,17 @@ public class CreateTaskRequest extends BaseRequest {
|
||||
*/
|
||||
String temperature;
|
||||
|
||||
/**
|
||||
* agv取货高度
|
||||
*/
|
||||
private String start_height;
|
||||
|
||||
|
||||
/**
|
||||
* agv放货高度
|
||||
*/
|
||||
private String next_height;
|
||||
|
||||
/**
|
||||
* 扩展属性
|
||||
*/
|
||||
|
||||
@@ -42,6 +42,7 @@ public class WmsToAcsController {
|
||||
@PostMapping("/unLock")
|
||||
@Log(value = "解锁立库点位",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
|
||||
@ApiOperation("解锁立库点位")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> unLock(@RequestBody String whereJson) {
|
||||
return new ResponseEntity<>(wmstoacsService.unLock(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@@ -57,6 +58,7 @@ public class WmsToAcsController {
|
||||
@PostMapping("/updateDeviceGoodsFromWms")
|
||||
@Log(value = "WMS修改点位状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
|
||||
@ApiOperation("WMS修改点位状态")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> updateDeviceGoodsFromWms(@RequestBody String whereJson) {
|
||||
return new ResponseEntity<>(wmstoacsService.updateDeviceGoodsFromWms(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@@ -64,6 +66,7 @@ public class WmsToAcsController {
|
||||
@PostMapping("/areaControl")
|
||||
@Log(value = "区域控制",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
|
||||
@ApiOperation("区域控制")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> areaControl(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(wmstoacsService.areaControl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@@ -108,4 +111,36 @@ public class WmsToAcsController {
|
||||
public ResponseEntity<Object> updateTask(@RequestBody String whereJson){
|
||||
return new ResponseEntity<>(wmstoacsService.updateTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendAgvChargeTask")
|
||||
@Log(value = "LMS下发agv充电任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
|
||||
@ApiOperation("LMS下发agv充电任务")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> sendAgvChargeTask(@RequestBody JSONObject param){
|
||||
return new ResponseEntity<>(wmstoacsService.sendAgvChargeTask(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryDeviceInfo")
|
||||
@Log(value = "查询agv车辆信息",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
|
||||
@ApiOperation("查询agv车辆信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> queryDeviceInfo(@RequestBody JSONObject param){
|
||||
return new ResponseEntity<>(wmstoacsService.queryDeviceInfo(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/syncfaultInfo")
|
||||
@Log(value = "LMS同步报警码信息",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
|
||||
@ApiOperation("LMS同步报警码信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> syncfaultInfo(){
|
||||
return new ResponseEntity<>(wmstoacsService.syncfaultInfo(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/realTimefaultInfo")
|
||||
@Log(value = "查询所有设备报警信息",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
|
||||
@ApiOperation("查询所有设备报警信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> realTimefaultInfo(@RequestBody JSONObject param){
|
||||
return new ResponseEntity<>(wmstoacsService.realTimefaultInfo(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,4 +100,11 @@ public interface WmsToAcsService {
|
||||
*/
|
||||
Map<String, Object> updateTask(String whereJson);
|
||||
|
||||
Map<String, Object> sendAgvChargeTask(JSONObject param);
|
||||
|
||||
Map<String, Object> queryDeviceInfo(JSONObject param);
|
||||
|
||||
Map<String, Object> syncfaultInfo();
|
||||
|
||||
Map<String, Object> realTimefaultInfo(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -9,9 +9,16 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
|
||||
import org.nl.acs.common.IDriverService;
|
||||
import org.nl.acs.common.StandardOrdinarySiteDevice;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.dto.DeviceDto;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.agv.ndctwo.AgvNdcTwoDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.EmptyVehicleStackingPositionDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver;
|
||||
@@ -34,11 +41,16 @@ import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceExtraManageDto;
|
||||
import org.nl.acs.opc.DeviceType;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.domain.Dict;
|
||||
import org.nl.modules.system.service.DictDetailService;
|
||||
import org.nl.modules.system.service.DictService;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.system.service.dto.DictDetailDto;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.exception.WDKException;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
@@ -51,6 +63,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -65,6 +78,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final RouteLineService routeLineService;
|
||||
private final AcsToLiKuService acsToLiKuService;
|
||||
private final DictDetailService dictDetailService;
|
||||
private final DictService dictService;
|
||||
|
||||
|
||||
private String log_file_type = "log_file_type";
|
||||
@@ -319,7 +334,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> putPlusPullAction(String param) {
|
||||
try {
|
||||
@@ -471,7 +485,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public CreateTaskResponse crateTask(String param) {
|
||||
try {
|
||||
@@ -511,6 +524,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
oven_time = Double.parseDouble(request.getOven_time());
|
||||
}
|
||||
String temperature = request.getTemperature();
|
||||
String start_height = request.getStart_height();
|
||||
String next_height = request.getNext_height();
|
||||
Map<String, String> params = request.getParams();
|
||||
|
||||
String start_point_code = "";
|
||||
@@ -613,8 +628,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if (ObjectUtil.equal("true", siemensConveyorDeviceDriver.getExtraValue().get("inspect_in_stock"))) {
|
||||
if(siemensConveyorDeviceDriver.getMove() == 1)
|
||||
{
|
||||
if (siemensConveyorDeviceDriver.getMove() == 1) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
@@ -693,6 +707,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
jo.put("vehicle_type", vehicle_type);
|
||||
jo.put("storage_task_type", storage_task_type);
|
||||
jo.put("agv_system_type", agv_system_type);
|
||||
jo.put("start_height", start_height);
|
||||
jo.put("next_height", next_height);
|
||||
jo.put("oven_time", (int) Math.ceil(oven_time));
|
||||
jo.put("remark", remark);
|
||||
jo.put("params", params);
|
||||
@@ -779,8 +795,17 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
log.info("unLock--------------:输入参数" + param);
|
||||
JSONObject jo = JSONObject.parseObject(param);
|
||||
String task_code = String.valueOf(jo.get("task_code"));
|
||||
if (StrUtil.isEmpty(task_code)) {
|
||||
throw new BadRequestException("任务号不能为空");
|
||||
}
|
||||
String device_code = String.valueOf(jo.get("device_code"));
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
throw new BadRequestException("设备号不能为空");
|
||||
}
|
||||
String vehicle_code = String.valueOf(jo.get("vehicle_code"));
|
||||
if (StrUtil.isEmpty(vehicle_code)) {
|
||||
throw new BadRequestException("载具号不能为空");
|
||||
}
|
||||
OutConfirmRequest outConfirmRequest = new OutConfirmRequest();
|
||||
outConfirmRequest.setOutPortNo(device_code);
|
||||
outConfirmRequest.setPalletCode(vehicle_code);
|
||||
@@ -790,11 +815,20 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
outConfirmRequest.setOrderId(task_code);
|
||||
}
|
||||
Resp<OutConfirmReportResponse> resp = acsToLiKuService.outConfirm(outConfirmRequest);
|
||||
|
||||
|
||||
if (StrUtil.equals(resp.getResult(), "false")) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", 400);
|
||||
resultJson.put("message", resp.getComment());
|
||||
log.info("unLock--------------:输出参数" + resultJson);
|
||||
return resultJson;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info("unLock--------------:输出参数" + e.getMessage());
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", 400);
|
||||
resultJson.put("message", e.getMessage());
|
||||
log.info("unLock--------------:输出参数" + resultJson);
|
||||
return resultJson;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
@@ -846,4 +880,124 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> sendAgvChargeTask(JSONObject param) {
|
||||
log.info("sendAgvChargeTask--------------:输入参数" + param.toString());
|
||||
String agv_system = param.getString("agv_system");
|
||||
String car_no = param.getString("car_no");
|
||||
if (StrUtil.isEmpty(agv_system)) {
|
||||
throw new BadRequestException("AGV系统类型不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(car_no)) {
|
||||
throw new BadRequestException("AGV车号不能为空");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(car_no);
|
||||
if (device == null) {
|
||||
throw new BadRequestException("agv车号在ACS系统中不存在!");
|
||||
}
|
||||
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class);
|
||||
agvService.createChargingTaskToNDC(agv_system, car_no);
|
||||
JSONObject resp = new JSONObject();
|
||||
resp.put("status", 200);
|
||||
resp.put("message", "操作成功");
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryDeviceInfo(JSONObject param) {
|
||||
log.info("queryDeviceInfo--------------:输入参数" + param.toString());
|
||||
String region_code = param.getString("region_code");
|
||||
if (StrUtil.isEmpty(region_code)) {
|
||||
throw new BadRequestException("区域编码不能为空");
|
||||
}
|
||||
AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver;
|
||||
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver;
|
||||
List<Device> devices = deviceAppService.findDevice(DeviceType.agv);
|
||||
JSONArray data = new JSONArray();
|
||||
if (ObjectUtil.isNotEmpty(devices)) {
|
||||
for (int i = 0; i < devices.size(); i++) {
|
||||
Device device = devices.get(i);
|
||||
Device agvDevice = deviceAppService.findDeviceByCode(device.getDevice_code());
|
||||
if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
|
||||
if (StrUtil.equals(region_code, "1")) {
|
||||
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver();
|
||||
JSONObject jo = agvNdcTwoDeviceDriver.getDeviceStatusName();
|
||||
data.add(jo);
|
||||
}
|
||||
}
|
||||
if (agvDevice.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
if (StrUtil.equals(region_code, "5")) {
|
||||
agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) agvDevice.getDeviceDriver();
|
||||
JSONObject jo = agvNdcOneDeviceDriver.getDeviceStatusName();
|
||||
data.add(jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject resp = new JSONObject();
|
||||
resp.put("status", 200);
|
||||
resp.put("message", "操作成功");
|
||||
resp.put("data", data);
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> syncfaultInfo() {
|
||||
log.info("syncfaultInfo--------------:输入参数");
|
||||
JSONArray data = new JSONArray();
|
||||
List<Dict> dicts = dictService.queryAll();
|
||||
if (ObjectUtil.isNotEmpty(dicts)) {
|
||||
List<Dict> error_dists = dicts
|
||||
.stream()
|
||||
.filter(dict -> dict.getName().contains("error_type"))
|
||||
.collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotEmpty(error_dists)) {
|
||||
for (int i = 0; i < error_dists.size(); i++) {
|
||||
Dict dict = error_dists.get(i);
|
||||
String dictName = dict.getName();
|
||||
List<DictDetailDto> dictDetailDtos = dictDetailService.getDictByName(dictName);
|
||||
for (DictDetailDto dictDetailDto : dictDetailDtos) {
|
||||
JSONObject faultInfo = new JSONObject();
|
||||
faultInfo.put("fault_type", dictName);
|
||||
faultInfo.put("fault_code", dictDetailDto.getValue());
|
||||
faultInfo.put("fault_info", dictDetailDto.getLabel());
|
||||
data.add(faultInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject resp = new JSONObject();
|
||||
resp.put("status", 200);
|
||||
resp.put("message", "操作成功");
|
||||
resp.put("data", data);
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> realTimefaultInfo(JSONObject param) {
|
||||
log.info("realTimefaultInfo--------------:输入参数" + param.toString());
|
||||
String device_code = param.getString("device_code");
|
||||
JSONArray data = new JSONArray();
|
||||
if (StrUtil.isNotEmpty(device_code)) {
|
||||
String[] devices = device_code.split(",");
|
||||
Device device = null;
|
||||
for (String deviceCode : devices) {
|
||||
device = deviceAppService.findDeviceByCode(deviceCode);
|
||||
if (device == null) {
|
||||
continue;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof FeedLmsRealFailed) {
|
||||
FeedLmsRealFailed feedLmsRealFailed = (FeedLmsRealFailed) device.getDeviceDriver();
|
||||
JSONObject jsonObject = feedLmsRealFailed.feedLmsRealFailedInfo();
|
||||
data.add(jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject resp = new JSONObject();
|
||||
resp.put("status", 200);
|
||||
resp.put("message", "操作成功");
|
||||
resp.put("data", data);
|
||||
return resp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,9 +10,13 @@ import org.nl.modules.system.service.impl.DictDetailServiceImpl;
|
||||
import org.nl.modules.system.service.impl.DictServiceImpl;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author: geng by
|
||||
@@ -41,6 +45,21 @@ public class ErrorUtil {
|
||||
return detail == null ? "字典表未配置对应的报警信息" : detail;
|
||||
}
|
||||
|
||||
public static Map<Integer, String> getDictDetailByName(String type) {
|
||||
getDict();
|
||||
List<DictDetailDto> dictDetailDtos = dictMap.get(type);
|
||||
Map<Integer, String> map = new HashMap<>();
|
||||
if (ObjectUtil.isNotEmpty(dictDetailDtos)) {
|
||||
List<DictDetailDto> dtos = dictDetailDtos
|
||||
.stream()
|
||||
.filter(dictDetailDto -> !dictDetailDto.getValue().equals("0"))
|
||||
.filter(dictDetailDto -> !dictDetailDto.getValue().equals("-1"))
|
||||
.collect(Collectors.toList());
|
||||
dtos.forEach(dictDetailDto -> map.put(Integer.parseInt(dictDetailDto.getValue()), dictDetailDto.getLabel()));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
public static void getDict() {
|
||||
if (ObjectUtil.isEmpty(dictMap)) {
|
||||
@@ -60,4 +79,46 @@ public class ErrorUtil {
|
||||
return f.apply(name);
|
||||
}
|
||||
|
||||
public static Map<String, String> getAgvErrorMsg(Integer ageErrorNum) {
|
||||
Map<Integer, String> agvMap = getDictDetailByName("agv_error_type");
|
||||
Integer[] keys = agvMap.keySet().toArray(new Integer[0]);
|
||||
String message = "";
|
||||
String code = "";
|
||||
out:
|
||||
for (int i = 1; i < 1 << keys.length; i++) {
|
||||
int sum = 0;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuffer sbCode = new StringBuffer();
|
||||
inner:
|
||||
for (int j = 0; j < keys.length; j++) {
|
||||
if ((i & 1 << j) != 0) {
|
||||
sum += keys[j];
|
||||
sb.append(agvMap.get(keys[j])).append(",");
|
||||
sbCode.append(keys[j]).append(",");
|
||||
}
|
||||
}
|
||||
if (sum == ageErrorNum) {
|
||||
code = sbCode.toString();
|
||||
message = sb.toString();
|
||||
break out;
|
||||
}
|
||||
}
|
||||
Map<String, String> map = new HashMap<>();
|
||||
String info = replace(message);
|
||||
code = replace(code);
|
||||
map.put("code", StrUtil.isEmpty(code) ? "-1" : code);
|
||||
map.put("info", StrUtil.isEmpty(info) ? "AGV上报报警代码有误" : info);
|
||||
return map;
|
||||
}
|
||||
|
||||
public static String replace(String message) {
|
||||
if (StrUtil.isEmpty(message)) {
|
||||
return null;
|
||||
}
|
||||
if (message.endsWith(",")) {
|
||||
return message.substring(0, message.length() - 1);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -348,4 +348,15 @@ public class InstructionDto implements Serializable {
|
||||
*/
|
||||
private String agv_system_type;
|
||||
|
||||
/**
|
||||
* agv取货高度
|
||||
*/
|
||||
private String start_height = "0";
|
||||
|
||||
|
||||
/**
|
||||
* agv放货高度
|
||||
*/
|
||||
private String next_height = "0";
|
||||
|
||||
}
|
||||
|
||||
@@ -296,4 +296,15 @@ public class TaskDto implements Serializable {
|
||||
*/
|
||||
private String carno;
|
||||
|
||||
/**
|
||||
* agv取货高度
|
||||
*/
|
||||
private String start_height = "0";
|
||||
|
||||
|
||||
/**
|
||||
* agv放货高度
|
||||
*/
|
||||
private String next_height = "0";
|
||||
|
||||
}
|
||||
|
||||
@@ -70,16 +70,26 @@ import java.util.stream.Collectors;
|
||||
public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
List<TaskDto> tasks = new CopyOnWriteArrayList<>();
|
||||
|
||||
@Autowired DeviceAppService deviceAppService;
|
||||
@Autowired RouteLineService routelineserver;
|
||||
@Autowired AcsToWmsService acstowmsService;
|
||||
@Autowired TaskFeedbackService taskFeedbackService;
|
||||
@Autowired ParamService paramService;
|
||||
@Autowired XianGongAgvService agvService;
|
||||
@Autowired RouteLineService routeLineService;
|
||||
@Autowired DeviceAssignedService deviceAssignedService;
|
||||
@Autowired InstructionService instructionService;
|
||||
@Autowired StorageCellService storageCellService;
|
||||
@Autowired
|
||||
DeviceAppService deviceAppService;
|
||||
@Autowired
|
||||
RouteLineService routelineserver;
|
||||
@Autowired
|
||||
AcsToWmsService acstowmsService;
|
||||
@Autowired
|
||||
TaskFeedbackService taskFeedbackService;
|
||||
@Autowired
|
||||
ParamService paramService;
|
||||
@Autowired
|
||||
XianGongAgvService agvService;
|
||||
@Autowired
|
||||
RouteLineService routeLineService;
|
||||
@Autowired
|
||||
DeviceAssignedService deviceAssignedService;
|
||||
@Autowired
|
||||
InstructionService instructionService;
|
||||
@Autowired
|
||||
StorageCellService storageCellService;
|
||||
|
||||
@Override
|
||||
public void autoInitial() throws Exception {
|
||||
@@ -368,8 +378,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
list.add(task);
|
||||
}
|
||||
} else {
|
||||
if(StrUtil.equals(task.getTask_type(),"8") && StrUtil.isNotEmpty(task.getPut_device_code()))
|
||||
{
|
||||
if (StrUtil.equals(task.getTask_type(), "8") && StrUtil.isNotEmpty(task.getPut_device_code())) {
|
||||
// if(task.getNext_device_code().equals(device_code)
|
||||
// && StrUtil.equals(task.getTask_status(), "1")){
|
||||
// Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||
@@ -498,9 +507,11 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
dto.setMaterial(startdevice.getMaterial_type());
|
||||
if (StrUtil.equals(createTaskCheck, "1")) {
|
||||
// 判断起点为输送设备
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {}
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
|
||||
}
|
||||
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {}
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
|
||||
}
|
||||
} else {
|
||||
// 判断起点为输送设备
|
||||
|
||||
@@ -1102,6 +1113,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
String next_point_code2 = acsTask.getNext_point_code2();
|
||||
String agv_system_type = acsTask.getAgv_system_type();
|
||||
String task_type = acsTask.getTask_type();
|
||||
String start_height = acsTask.getStart_height();
|
||||
String next_height = acsTask.getNext_height();
|
||||
/** 开始平均分解校验 */
|
||||
String this_device_code =
|
||||
this.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code());
|
||||
@@ -1158,6 +1171,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
instdto.setNext_device_code2(next_point_code2);
|
||||
instdto.setNext_point_code2(next_point_code2);
|
||||
instdto.setAgv_system_type(agv_system_type);
|
||||
instdto.setNext_height(next_height);
|
||||
instdto.setStart_height(start_height);
|
||||
// 判断agv系统
|
||||
// 1、1楼叉车系统
|
||||
// 2、2楼1区域AGV系统
|
||||
@@ -1260,7 +1275,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createTaskByClick(JSONObject json) {}
|
||||
public void createTaskByClick(JSONObject json) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkAllowCreate(String devicecode) {
|
||||
|
||||
@@ -69,6 +69,9 @@ public class AutoCreateInst {
|
||||
String vehicleType = acsTask.getVehicle_type();
|
||||
String agv_system_type = acsTask.getAgv_system_type();
|
||||
|
||||
String start_height = acsTask.getStart_height();
|
||||
String next_height = acsTask.getNext_height();
|
||||
|
||||
|
||||
if (StrUtil.equals(is_send, "0")) {
|
||||
continue;
|
||||
@@ -138,6 +141,8 @@ public class AutoCreateInst {
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setVehicle_type(vehicleType);
|
||||
instdto.setAgv_system_type(agv_system_type);
|
||||
instdto.setStart_height(start_height);
|
||||
instdto.setNext_height(next_height);
|
||||
//判断agv系统
|
||||
//1、1楼叉车系统
|
||||
//2、2楼1区域AGV系统
|
||||
|
||||
@@ -153,8 +153,9 @@
|
||||
<el-table-column prop="weight" label="重量" />
|
||||
<el-table-column prop="agv_jobno" label="AGV任务号" />
|
||||
<el-table-column prop="agv_inst_type" label="AGV任务类型" />
|
||||
<el-table-column prop="agv_system_type" label="AGV系统类型" >
|
||||
</el-table-column>
|
||||
<el-table-column prop="agv_system_type" label="AGV系统类型" />
|
||||
<el-table-column prop="start_height" label="取货高度" />
|
||||
<el-table-column prop="next_height" label="放货高度" />
|
||||
<el-table-column prop="remark" label="描述" />
|
||||
<el-table-column prop="create_by" label="创建者" />
|
||||
<el-table-column prop="create_time" label="创建时间" width="135" />
|
||||
|
||||
@@ -300,6 +300,12 @@
|
||||
<el-form-item label="载具号">
|
||||
<el-input v-model="form.vehicle_code" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.task_type === '4'" label="取货高度" prop="start_height">
|
||||
<el-input v-model="form.start_height" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.task_type === '4'" label="放货高度" prop="next_height">
|
||||
<el-input v-model="form.next_height" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述信息" prop="description">
|
||||
<el-input v-model="form.remark" style="width: 380px;" rows="5" type="textarea" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
@@ -310,7 +316,14 @@
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="small"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column type="selection" width="25" />
|
||||
<el-table-column v-if="false" prop="task_id" label="任务标识" />
|
||||
<el-table-column prop="task_code" label="任务号" width="100" />
|
||||
@@ -343,10 +356,18 @@
|
||||
{{ dict.label.storage_task_type[scope.row.storage_task_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="start_height" label="取货高度" />
|
||||
<el-table-column prop="next_height" label="放货高度" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column prop="create_by" label="创建者" />
|
||||
<el-table-column prop="create_time" label="创建时间" width="135" />
|
||||
<el-table-column v-permission="['admin','task:edit','task:del']" fixed="left" label="操作" width="50px" align="center">
|
||||
<el-table-column
|
||||
v-permission="['admin','task:edit','task:del']"
|
||||
fixed="left"
|
||||
label="操作"
|
||||
width="50px"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-dropdown trigger="click" @command="handleCommand">
|
||||
<span class="el-dropdown-link">
|
||||
@@ -382,7 +403,8 @@ export default {
|
||||
dicts: ['task_status', 'task_type', 'agv_system_type', 'storage_task_type'],
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: '任务', url: 'api/task', idField: 'task_id', sort: 'task_id,desc',
|
||||
return CRUD({
|
||||
title: '任务', url: 'api/task', idField: 'task_id', sort: 'task_id,desc',
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: true,
|
||||
@@ -390,7 +412,8 @@ export default {
|
||||
reset: false,
|
||||
download: true
|
||||
},
|
||||
crudMethod: { ...crudTask }})
|
||||
crudMethod: { ...crudTask }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
const checkFromY = (rule, value, callback) => {
|
||||
@@ -480,9 +503,17 @@ export default {
|
||||
to_x: null,
|
||||
to_y: null,
|
||||
to_z: null,
|
||||
agv_system_type: ''
|
||||
agv_system_type: '',
|
||||
next_height: '0',
|
||||
start_height: '0'
|
||||
},
|
||||
rules: {
|
||||
start_height: [
|
||||
{ required: true, message: '起点高度不能为空', trigger: 'change' }
|
||||
],
|
||||
next_height: [
|
||||
{ required: true, message: '终点高度不能为空', trigger: 'change' }
|
||||
],
|
||||
start_point_code: [
|
||||
{ required: true, message: '起点不能为空', trigger: 'change' }
|
||||
],
|
||||
@@ -517,11 +548,15 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
saveBtn() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
crudTask.add(this.form).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.formDia = false
|
||||
this.isDisabled = true
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
@@ -684,6 +719,7 @@ export default {
|
||||
cursor: pointer;
|
||||
color: #409EFF;
|
||||
}
|
||||
|
||||
.el-icon-arrow-down {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user