rev:更新

This commit is contained in:
2024-01-09 17:24:43 +08:00
parent 49016a2bd6
commit 9c44559e67
9 changed files with 167 additions and 16 deletions

View File

@@ -27,6 +27,7 @@ import org.nl.acs.opc.DeviceType;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
@@ -38,9 +39,12 @@ import java.util.Map;
@Service
@RequiredArgsConstructor
public class MagicAgvServiceImpl implements MagicAgvService {
private final DeviceAppService deviceAppService;
private final ParamService paramService;
private final AcsToWmsService acsToWmsService;
@Autowired
DeviceAppService deviceAppService;
@Autowired
ParamService paramService;
@Autowired
AcsToWmsService acsToWmsService;
Map<String, AgvDto> AGVDeviceStatus = new HashMap();

View File

@@ -19,6 +19,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
@@ -29,8 +30,10 @@ import java.util.Map;
@RequiredArgsConstructor
public class NDCAgvServiceImpl implements NDCAgvService {
private final DeviceAppService deviceAppService;
private final ParamService paramService;
@Autowired
DeviceAppService deviceAppService;
@Autowired
ParamService paramService;
private final AcsToWmsService acsToWmsService;
private final DeviceExecuteLogService logServer;

View File

@@ -21,6 +21,8 @@ import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceType;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.util.Arrays;
@@ -32,9 +34,16 @@ import java.util.Map;
@Service
@RequiredArgsConstructor
public class XianGongAgvServiceImpl implements XianGongAgvService {
private final DeviceAppService deviceAppService;
private final ParamService paramService;
private final AcsToWmsService acsToWmsService;
@Autowired
DeviceAppService deviceAppService;
@Autowired
ParamService paramService;
@Lazy
@Autowired
AcsToWmsService acsToWmsService;
Map<String, AgvDto> AGVDeviceStatus = new HashMap();
@LokiLog(type = LokiLogType.AGV)

View File

@@ -27,13 +27,15 @@ import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Slf4j
@Service
@RequiredArgsConstructor
public class ZheDaAgvServiceImpl implements ZheDaAgvService {
private final ParamService paramService;
@Autowired
ParamService paramService;
@LokiLog(type = LokiLogType.AGV)
@Override
public HttpResponse sendAgvInstToAgv(Instruction inst) throws Exception {

View File

@@ -193,6 +193,32 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
if (ObjectUtil.isNotEmpty(inst)){
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("device_code", inst.getStart_point_code());
map.put("device_status",inst.getExecute_status());
map.put("energyLevel",electric_qty);
map.put("transportOrder",inst.getTask_code());
map.put("positionX",x);
map.put("positionY",y);
map.put("positionAngle",angle);
HttpResponse httpResponse = acsToWmsService.feedbackAgv(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs向wms反馈AGV设备信息,已反馈AGV设备信息", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs向wms反馈AGV设备信息,未反馈AGV设备信息", inst.getInstruction_code());
}
} else {
log.warn("指令号:{},acs向wms反馈AGV设备信息失败连接被拒绝,未反馈agv设备信息", inst.getInstruction_code());
}
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
//取货完毕
//(需要WCS反馈)
} else if (phase == 0x05) {
@@ -254,6 +280,32 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
if (ObjectUtil.isNotEmpty(inst)){
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("device_code", inst.getStart_point_code());
map.put("device_status",inst.getExecute_status());
map.put("energyLevel",electric_qty);
map.put("transportOrder",inst.getTask_code());
map.put("positionX",x);
map.put("positionY",y);
map.put("positionAngle",angle);
HttpResponse httpResponse = acsToWmsService.feedbackAgv(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs向wms反馈AGV设备信息,已反馈AGV设备信息", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs向wms反馈AGV设备信息,未反馈AGV设备信息", inst.getInstruction_code());
}
} else {
log.warn("指令号:{},acs向wms反馈AGV设备信息失败连接被拒绝,未反馈agv设备信息", inst.getInstruction_code());
}
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
//到达放货点
//(需要WCS反馈)
} else if (phase == 0x07) {
@@ -311,6 +363,32 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
if (ObjectUtil.isNotEmpty(inst)){
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("device_code", inst.getStart_point_code());
map.put("device_status",inst.getExecute_status());
map.put("energyLevel",electric_qty);
map.put("transportOrder",inst.getTask_code());
map.put("positionX",x);
map.put("positionY",y);
map.put("positionAngle",angle);
HttpResponse httpResponse = acsToWmsService.feedbackAgv(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs向wms反馈AGV设备信息,已反馈AGV设备信息", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs向wms反馈AGV设备信息,未反馈AGV设备信息", inst.getInstruction_code());
}
} else {
log.warn("指令号:{},acs向wms反馈AGV设备信息失败连接被拒绝,未反馈agv设备信息", inst.getInstruction_code());
}
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
//放货完毕
//(需要WCS反馈)
} else if (phase == 0x09) {
@@ -364,6 +442,31 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
if (ObjectUtil.isNotEmpty(inst)){
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("device_code", inst.getStart_point_code());
map.put("device_status",inst.getExecute_status());
map.put("energyLevel",electric_qty);
map.put("transportOrder",inst.getTask_code());
map.put("positionX",x);
map.put("positionY",y);
map.put("positionAngle",angle);
HttpResponse httpResponse = acsToWmsService.feedbackAgv(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs向wms反馈AGV设备信息,已反馈AGV设备信息", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs向wms反馈AGV设备信息,未反馈AGV设备信息", inst.getInstruction_code());
}
} else {
log.warn("指令号:{},acs向wms反馈AGV设备信息失败连接被拒绝,未反馈agv设备信息", inst.getInstruction_code());
}
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
}
//到达位置点
//(需要WCS反馈)
@@ -379,7 +482,22 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} else if (phase == 0x51) {//离开交通灯区域
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
}
} else if (phase == 0x70) {
//x坐标
x = ikey;
} else if (phase == 0x71) {
//y坐标
y = ikey;
} else if (phase == 0x72) {
//车辆角度
angle = ikey;
} else if (phase == 0x73) {
//agv电量
electric_qty = ikey;
} else if (phase == 0x74) {
//三色灯状态
status = ikey;
}
if (!ObjectUtil.isEmpty(data)) {
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
OneNDCSocketConnectionAutoRun.write(data);

View File

@@ -46,7 +46,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
/*@Value("${acsTowms.token}")*/
public String token;
private String log_file_type="log_file_type";
private String log_type="ACS请求LMS";

View File

@@ -71,14 +71,15 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Autowired
DeviceAppService deviceAppService;
@Autowired
NDCAgvService ndcAgvService;
@Autowired
ParamService paramService;
@Autowired
RouteLineService routeLineService;
@Autowired
TaskService taskService;
private final TaskService taskService;
@Autowired
AcsToLiKuService acsToLiKuService;

View File

@@ -105,7 +105,9 @@ public class TaskFeedbackServiceImpl implements TaskFeedbackService {
@Transactional(rollbackFor = Exception.class)
public void update(TaskFeedbackDto dto) {
TaskFeedbackDto entity = this.findById(dto.getTaskback_id());
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
if (entity == null) {
throw new BadRequestException("被删除或无权限,操作失败!");
}
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();

View File

@@ -74,8 +74,10 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
DeviceAppService deviceAppService;
@Autowired
RouteLineService routelineserver;
@Autowired
AcsToWmsService acstowmsService;
@Autowired
TaskFeedbackService taskFeedbackService;
@Autowired
@@ -86,8 +88,10 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
RouteLineService routeLineService;
@Autowired
DeviceAssignedService deviceAssignedService;
@Autowired
InstructionService instructionService;
@Autowired
StorageCellService storageCellService;
@@ -99,6 +103,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
}
}
@Override
public synchronized void reload() {
List list = this.queryAll("task_status <2 and is_delete =0 order by create_time");
@@ -372,6 +377,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
return list;
}
@Override
public List<TaskDto> queryTaskByStartAndIntStatus(String head_start_device_code) {
List<TaskDto> list = new ArrayList<>();
Iterator<TaskDto> iterator = tasks.iterator();
@@ -392,6 +398,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
return list;
}
@Override
public List<TaskDto> queryTaskByNextAndIntStatus(String back_start_device_code) {
List<TaskDto> list = new ArrayList<>();
Iterator<TaskDto> iterator = tasks.iterator();
@@ -800,10 +807,14 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Transactional(rollbackFor = Exception.class)
public void finish(String id) {
TaskDto entity = this.findById(id);
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
if (entity == null) {
throw new BadRequestException("被删除或无权限,操作失败!");
}
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
InstructionDto instdto = instructionservice.findByTaskid(id, "instruction_status <2 ");
if (instdto != null) throw new BadRequestException("有指令未完成!");
if (instdto != null) {
throw new BadRequestException("有指令未完成!");
}
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
entity.setUpdate_time(now);
@@ -1327,6 +1338,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
return tasks;
}
@Override
public TaskDto findByContainer(String container_code) {
Iterator var3 = tasks.iterator();
@@ -1340,6 +1352,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
return null;
}
@Override
public TaskDto findByCodeFromCache(String task_code) {
Iterator var3 = tasks.iterator();