opt:西门子项目优化,新增大小车指定逻辑
This commit is contained in:
@@ -94,12 +94,16 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
//如果起始点在PS15起始点位区间、终点也在PS15终点区间,则使用PS15,type=2其他情况,type =1
|
||||
StorageCell startStorageCell = storageCellService.getByCode(inst.getStart_point_code());
|
||||
StorageCell endStorageCell = storageCellService.getByCode(inst.getNext_point_code());
|
||||
if(null != startStorageCell && null != endStorageCell
|
||||
&& "2".equals(startStorageCell.getCar_type())){
|
||||
if ((null != startStorageCell && null != endStorageCell)
|
||||
&& (("start".equals(inst.getCar_type()) && "2".equals(startStorageCell.getCar_type()))
|
||||
|| "end".equals(inst.getCar_type()) && "2".equals(endStorageCell.getCar_type())
|
||||
|| "new_car".equals(startStorageCell.getRemark())
|
||||
|| "new_car".equals(endStorageCell.getRemark()))) {
|
||||
inst.setCar_type("2");
|
||||
startAddress = deviceService.queryEndAddressBydeviceCode(inst.getStart_point_code());
|
||||
nextAddress = deviceService.queryEndAddressBydeviceCode(inst.getNext_point_code());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
inst.setCar_type("1");
|
||||
startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
|
||||
nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
|
||||
|
||||
@@ -25,12 +25,12 @@ public class AcsAgvStatus implements Serializable {
|
||||
/**
|
||||
* AGV设备编码
|
||||
*/
|
||||
private String deviceCode;
|
||||
private String device_code;
|
||||
|
||||
/**
|
||||
* AGV设备名称
|
||||
*/
|
||||
private String deviceName;
|
||||
private String device_name;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
@@ -55,16 +55,16 @@ public class AcsAgvStatus implements Serializable {
|
||||
/**
|
||||
* 电量
|
||||
*/
|
||||
private Integer electricQty;
|
||||
private Integer electric_qty;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
private Date update_time;
|
||||
|
||||
/**
|
||||
* 是否有效: 1-有效, 0-无效
|
||||
*/
|
||||
private String isActive;
|
||||
private String is_active;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
|
||||
<resultMap id="BaseResultMap" type="org.nl.acs.agv_alarm.domain.AcsAgvStatus">
|
||||
<id column="id" property="id" />
|
||||
<result column="device_code" property="deviceCode" />
|
||||
<result column="device_name" property="deviceName" />
|
||||
<result column="device_code" property="device_code" />
|
||||
<result column="device_name" property="device_name" />
|
||||
<result column="status" property="status" />
|
||||
<result column="x" property="x" />
|
||||
<result column="y" property="y" />
|
||||
<result column="angle" property="angle" />
|
||||
<result column="electric_qty" property="electricQty" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="is_active" property="isActive" />
|
||||
<result column="electric_qty" property="electric_qty" />
|
||||
<result column="update_time" property="update_time" />
|
||||
<result column="is_active" property="is_active" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectAllStatus" resultMap="BaseResultMap">
|
||||
|
||||
@@ -58,8 +58,8 @@ public class AcsAgvAlarmServiceImpl implements AcsAgvAlarmService {
|
||||
insertFlag = true;
|
||||
agvStatus = new AcsAgvStatus();
|
||||
agvStatus.setId(IdUtil.simpleUUID());
|
||||
agvStatus.setDeviceCode(deviceCode);
|
||||
agvStatus.setDeviceName(deviceName);
|
||||
agvStatus.setDevice_code(deviceCode);
|
||||
agvStatus.setDevice_name(deviceName);
|
||||
}
|
||||
|
||||
// 更新状态信息
|
||||
@@ -67,13 +67,13 @@ public class AcsAgvAlarmServiceImpl implements AcsAgvAlarmService {
|
||||
agvStatus.setX(x);
|
||||
agvStatus.setY(y);
|
||||
agvStatus.setAngle(angle);
|
||||
agvStatus.setElectricQty(electricQty);
|
||||
agvStatus.setUpdateTime(new Date());
|
||||
agvStatus.setElectric_qty(electricQty);
|
||||
agvStatus.setUpdate_time(new Date());
|
||||
|
||||
if (statusInt == 1 || statusInt == 3 || statusInt == 4 || statusInt == 6 || statusInt == 7) {
|
||||
agvStatus.setIsActive("1");
|
||||
agvStatus.setIs_active("1");
|
||||
} else {
|
||||
agvStatus.setIsActive("0");
|
||||
agvStatus.setIs_active("0");
|
||||
}
|
||||
|
||||
if (insertFlag) {
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.common.utils.ThrowableUtil;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.lucene.LuceneExecuteLogService;
|
||||
@@ -267,7 +268,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
} catch (Exception e) {
|
||||
log.info("下发告警灯告警信号失败");
|
||||
log.error("下发告警灯告警信号失败", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -292,7 +293,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
} catch (Exception e) {
|
||||
log.info("下发告警灯取消告警信号失败");
|
||||
log.error("下发告警灯取消告警信号失败", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.nl.acs.task.domain.Task;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.impl.TaskServiceImpl;
|
||||
import org.nl.common.utils.ThrowableUtil;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
@@ -159,6 +160,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
transportOrder = inst.getTask_code();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + "反馈:" + data);
|
||||
|
||||
//到达取货点
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x03) {
|
||||
|
||||
// AGV使用率统计 - 开始工作
|
||||
try {
|
||||
String agvDeviceCode = "agv" + carno;
|
||||
@@ -172,9 +177,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.error("AGV使用率统计-开始工作失败: {}", e.getMessage());
|
||||
}
|
||||
|
||||
//到达取货点
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x03) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
@@ -577,7 +579,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("下发告警灯告警信号失败");
|
||||
log.error("下发告警灯告警信号失败", e);
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
@@ -594,7 +596,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("下发告警灯取消告警信号失败");
|
||||
log.error("下发告警灯取消告警信号失败", e);
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
|
||||
@@ -64,35 +64,29 @@ public class GuardLampDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_param, Integer.parseInt(value));
|
||||
|
||||
// 改动1:恢复线程池状态打印(和你原代码一致,方便监控)
|
||||
java.util.concurrent.ThreadPoolExecutor executor = (java.util.concurrent.ThreadPoolExecutor) ThreadPoolUtil.getGlobalFixedExecutor();
|
||||
log.info("线程池状态 - 活跃线程数: {}, 队列大小: {}, 已完成任务数: {}",
|
||||
executor.getActiveCount(),
|
||||
executor.getQueue().size(),
|
||||
executor.getCompletedTaskCount());
|
||||
|
||||
// 改动2:加try-catch捕获线程池满的拒绝异常,实现「满了就拒绝」
|
||||
try {
|
||||
// 核心:全局线程池直接执行control,无任何嵌套新建线程
|
||||
ThreadPoolUtil.getGlobalFixedExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
control(itemMap);
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
|
||||
} catch (Exception e) {
|
||||
log.error("异步执行 control 方法失败,参数:" + to_param, e);
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号失败:" + e.getMessage() + ",设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (RejectedExecutionException e) {
|
||||
// 改动3:线程池满拒绝时,打错误日志+记录执行日志,不影响主流程
|
||||
log.error("线程池队列满,下发任务被拒绝,参数:{}", to_param, e);
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号失败:线程池队列满,参数:" + to_param + ",值:" + value);
|
||||
return; // 拒绝后直接返回,不记录成功日志
|
||||
}
|
||||
|
||||
// 仅任务提交成功时,记录正常下发日志
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -987,6 +987,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(acsTask.getPriority());
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setCar_type(acsTask.getCar_type());
|
||||
instdto.setExecute_device_code(dto.getNext_device_code());
|
||||
try {
|
||||
this.create(instdto);
|
||||
|
||||
@@ -225,7 +225,7 @@ public class FabController {
|
||||
public ResponseEntity<TableDataInfo<List<LB>>> vehicleType() {
|
||||
List<LB> result = new ArrayList<>();
|
||||
for (VehicleTypeEnum value : VehicleTypeEnum.values()) {
|
||||
result.add(LB.builder().label(value.getVehicleName()).value(value.getVehicleCode()).build());
|
||||
result.add(LB.builder().label(value.getVehicleCode()).value(value.getVehicleCode()).build());
|
||||
}
|
||||
return new ResponseEntity(TableDataInfo.build(result), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -294,6 +294,7 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
jo.put("vehicle_type", mdBaseVehicle.getVehicle_type());
|
||||
jo.put("region_code", RegionEnum.NBGD.getRegion_code());
|
||||
param.put("region_code", RegionEnum.NBGD.getRegion_code());
|
||||
jo.put("car_type","start");
|
||||
jo.put("ext_data", param);
|
||||
connectorTask.apply(jo);
|
||||
}
|
||||
@@ -324,6 +325,7 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
jo.put("config_code", "EMPTYCAGENEWTask");
|
||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("car_type","end");
|
||||
connectorTask.apply(jo);
|
||||
}
|
||||
|
||||
@@ -350,6 +352,8 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
jo.put("vehicle_qty", vehicle_list.length);
|
||||
jo.put("vehicle_code", vehicle);
|
||||
jo.put("car_type","start");
|
||||
|
||||
jo.put("ext_data", param);
|
||||
connectorTask.apply(jo);
|
||||
}
|
||||
@@ -707,6 +711,7 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
jo.put("config_code", "TOSTOREHOUSETask");
|
||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
jo.put("vehicle_type", vehicle_type);
|
||||
jo.put("car_type", "start");
|
||||
jo.put("ext_data", param);
|
||||
connectorTask.apply(jo);
|
||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
@@ -743,6 +748,7 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("vehicle_type", mdBaseVehicle.getVehicle_type());
|
||||
jo.put("car_type","start");
|
||||
jo.put("ext_data", param);
|
||||
connectorTask.apply(jo);
|
||||
}
|
||||
|
||||
@@ -285,6 +285,7 @@ public abstract class AbstractTask {
|
||||
task.setWorkshop_code(taskConfig.getWorkshop_code());
|
||||
task.setRemark(param.getString("remark"));
|
||||
task.setAcs_trace_id(param.getString("task_seq"));
|
||||
task.setCar_type(param.getString("car_type"));
|
||||
// 设置起/终点
|
||||
this.setTaskPoint(taskConfig, task, apply_point_code);
|
||||
task.setRequest_param(JSONObject.toJSONString(param.get("ext_data")));
|
||||
|
||||
Reference in New Issue
Block a user