opt:西门子优化,增加SD01重复入库功能
This commit is contained in:
@@ -3,6 +3,7 @@ package org.nl.acs.agv.server.impl;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.agv.server.dto.AgvDto;
|
||||
@@ -16,6 +17,8 @@ import org.nl.acs.log.LokiLogType;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.storage_cell.domain.StorageCell;
|
||||
import org.nl.acs.storage_cell.service.StorageCellService;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
@@ -38,6 +41,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
private final ISysParamService paramService;
|
||||
private final AcsToWmsService acsToWmsService;
|
||||
private final ISysDictService dictService;
|
||||
private final StorageCellService storageCellService;
|
||||
|
||||
private final DeviceExecuteLogService logServer;
|
||||
|
||||
@@ -85,8 +89,22 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
int priority = Integer.parseInt(inst.getPriority()) + 128;
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
|
||||
int nextAddress=deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
|
||||
int startAddress = 0;
|
||||
int nextAddress = 0;
|
||||
//如果起始点在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())){
|
||||
inst.setCar_type("2");
|
||||
startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
|
||||
nextAddress = deviceService.queryEndAddressBydeviceCode(inst.getNext_point_code());
|
||||
} else {
|
||||
inst.setCar_type("1");
|
||||
startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
|
||||
nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
|
||||
}
|
||||
|
||||
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
|
||||
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
|
||||
byte typehigh = (byte) IntToHexHigh(Integer.parseInt(inst.getInstruction_type()));
|
||||
@@ -96,6 +114,8 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
byte fhdhigh = (byte) IntToHexHigh(nextAddress);
|
||||
byte fhdlow = (byte) IntToHexLow(nextAddress);
|
||||
byte prioritylow = (byte) IntToHexLow(priority);
|
||||
byte carTypeHigh = (byte) IntToHexHigh(Integer.parseInt(inst.getCar_type()));
|
||||
byte carTypeLow = (byte) IntToHexLow(Integer.parseInt(inst.getCar_type()));
|
||||
String str = "十进制下发:";
|
||||
String str1 = "十六进制下发:";
|
||||
str += "ikey:" + (Integer.parseInt(instcode));
|
||||
@@ -108,16 +128,18 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF);
|
||||
str += "/priority:" + (priority);
|
||||
str1 += "/priority:" + hexToString(prioritylow & 0xFF);
|
||||
str += "/carType:" + (Integer.parseInt(inst.getCar_type()));
|
||||
str1 += "/carType:" + hexToString(carTypeHigh & 0xFF) + hexToString(carTypeLow & 0xFF);
|
||||
System.out.println(str);
|
||||
System.out.println(str1);
|
||||
byte[] b = null;
|
||||
if(type == 1){
|
||||
b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X14,
|
||||
(byte) 0X00, (byte) 0X16,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X10,
|
||||
(byte) 0X00, (byte) 0X12,
|
||||
(byte) 0X01, (byte) prioritylow,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
@@ -126,9 +148,10 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
(byte) qhdhigh, (byte) qhdlow,
|
||||
(byte) 0X00, (byte) 0X00,
|
||||
(byte) fhdhigh, (byte) fhdlow,
|
||||
(byte) carTypeHigh, (byte) carTypeLow,
|
||||
|
||||
};
|
||||
}else if(type == 2){
|
||||
}else if(type == 2){//没有使用
|
||||
b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X14,
|
||||
@@ -143,10 +166,12 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
(byte) qhdhigh, (byte) qhdlow,
|
||||
(byte) fhdhigh, (byte) fhdlow,
|
||||
(byte) 0X00, (byte) 0X00,
|
||||
(byte) carTypeHigh, (byte) carTypeLow,
|
||||
};
|
||||
}
|
||||
log.info("下发AGV作业指令--{}", str1);
|
||||
log.info("下发AGV作业指令--{}", str);
|
||||
System.out.println("下发agv指令数据:" + Bytes2HexString(b));
|
||||
OneNDCSocketConnectionAutoRun.write(b);
|
||||
System.out.println("下发agv指令数据:" + Bytes2HexString(b));
|
||||
log.info("下发agv指令数据:" + Bytes2HexString(b));
|
||||
|
||||
@@ -301,6 +301,8 @@ public interface DeviceService extends CommonService<Device> {
|
||||
|
||||
int queryAddressBydeviceCode(String code);
|
||||
|
||||
int queryEndAddressBydeviceCode(String code);
|
||||
|
||||
String queryDeviceCodeByAddress(int address);
|
||||
|
||||
List<Device> findCacheDevice();
|
||||
|
||||
@@ -1740,12 +1740,29 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryEndAddressBydeviceCode(String code) {
|
||||
Iterator iterator = storageCells.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
StorageCellDto storageCellDto = (StorageCellDto) iterator.next();
|
||||
if (storageCellDto.getStorage_code().equals(code)) {
|
||||
if (null != storageCellDto.getEnd_address()) {
|
||||
return storageCellDto.getEnd_address();
|
||||
} else {
|
||||
return storageCellDto.getAddress();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryDeviceCodeByAddress(int code) {
|
||||
Iterator iterator = storageCells.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
StorageCellDto storageCellDto = (StorageCellDto) iterator.next();
|
||||
if (storageCellDto.getAddress()!=null && storageCellDto.getAddress() == code) {
|
||||
if ((storageCellDto.getAddress()!=null && storageCellDto.getAddress() == code)
|
||||
|| (storageCellDto.getEnd_address()!=null && storageCellDto.getEnd_address() == code)) {
|
||||
return storageCellDto.getStorage_code();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,6 +357,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
device_code = old_device_code;
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -202,6 +202,7 @@ public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
String start_point_code = task.getStart_point_code();
|
||||
String start_device_code = task.getStart_device_code();
|
||||
String route_plan_code = task.getRoute_plan_code();
|
||||
String car_type = task.getCar_type();
|
||||
String next_device_code = "";
|
||||
|
||||
/**
|
||||
@@ -263,6 +264,7 @@ public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setCar_type(car_type);
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -13,10 +13,9 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
/**
|
||||
* 告警灯驱动
|
||||
@@ -41,7 +40,6 @@ public class GuardLampDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
String message = null;
|
||||
@@ -60,18 +58,43 @@ public class GuardLampDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
last_toOpen = toOpen;
|
||||
}
|
||||
|
||||
|
||||
public void writing(String param, String value) {
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + param;
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_param, Integer.parseInt(value));
|
||||
|
||||
this.control(itemMap);
|
||||
// 改动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);
|
||||
} catch (Exception e) {
|
||||
log.error("异步执行 control 方法失败,参数:" + to_param, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
} 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
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
@@ -93,5 +116,4 @@ public class GuardLampDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.nl.acs.device_driver.basedriver.guard_lamp;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
|
||||
/**
|
||||
* Spring 容器关闭回调处理器,用于释放全局资源(如线程池)
|
||||
*/
|
||||
@Component // 关键:交给 Spring 容器管理,成为单例 Bean
|
||||
public class SpringContextShutdownHandler {
|
||||
private static final Logger log = LoggerFactory.getLogger(SpringContextShutdownHandler.class);
|
||||
|
||||
/**
|
||||
* Spring 容器关闭时自动执行(仅单例 Bean 生效)
|
||||
*/
|
||||
@PreDestroy
|
||||
public void onContextClosed() {
|
||||
log.info("Spring 容器即将关闭,开始释放全局资源...");
|
||||
|
||||
// 调用 ThreadPoolUtil 的 shutdown 方法,关闭全局线程池
|
||||
ThreadPoolUtil.shutdown();
|
||||
|
||||
log.info("全局线程池已优雅关闭,Spring 容器关闭完成");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.nl.acs.device_driver.basedriver.guard_lamp;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ThreadPoolUtil {
|
||||
// 全局单例固定线程池,核心线程数10,最大线程数10,使用有界队列,队列容量5000
|
||||
// 修正注释:使用AbortPolicy,队列满时抛RejectedExecutionException,实现任务拒绝
|
||||
private static final ExecutorService GLOBAL_FIXED_EXECUTOR =
|
||||
new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS,
|
||||
new LinkedBlockingQueue<>(5000),
|
||||
new ThreadPoolExecutor.AbortPolicy());
|
||||
|
||||
public static ExecutorService getGlobalFixedExecutor() {
|
||||
return GLOBAL_FIXED_EXECUTOR;
|
||||
}
|
||||
|
||||
// 禁止外部实例化
|
||||
private ThreadPoolUtil() {}
|
||||
|
||||
// 应用关闭时关闭线程池(可在Spring的销毁方法、容器关闭钩子中调用)
|
||||
public static void shutdown() {
|
||||
if (!GLOBAL_FIXED_EXECUTOR.isShutdown()) {
|
||||
GLOBAL_FIXED_EXECUTOR.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -549,6 +549,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
String route_plan_code = task.getRoute_plan_code();
|
||||
String next_point_code = task.getNext_point_code();
|
||||
String next_device_code = task.getNext_device_code();
|
||||
String car_type = task.getCar_type();
|
||||
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
@@ -569,6 +570,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setCar_type(car_type);
|
||||
|
||||
//判断关联的同一列烘箱设备是否都关门 都关门返回false,有一个不关门就返回true
|
||||
boolean isCloseDoor = this.judgeCloseDoor(instdto.getStart_device_code(), instdto.getNext_device_code());
|
||||
|
||||
@@ -653,6 +653,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setCar_type(taskdto.getCar_type());
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -221,7 +221,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
message = "未联机";
|
||||
|
||||
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
@@ -615,6 +615,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setCar_type(taskdto.getCar_type());
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -633,6 +633,7 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setCar_type(taskdto.getCar_type());
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1074,7 +1074,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
instdto.setStart_point_code2(start_point_code2);
|
||||
instdto.setNext_device_code2(next_device_code2);
|
||||
instdto.setNext_point_code2(next_point_code2);
|
||||
|
||||
instdto.setCar_type(taskDto.getCar_type());
|
||||
try {
|
||||
logServer.deviceExecuteLog(this.getDeviceCode(), "", "", "" +
|
||||
"执行就绪状态下的任务生成指令时:起点1为:" + start_device_code + "起点2为:" + start_device_code2
|
||||
|
||||
@@ -701,6 +701,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setCar_type(task.getCar_type());
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
@@ -811,6 +812,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setCar_type(task.getCar_type());
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -652,6 +652,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setCar_type(taskdto.getCar_type());
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -61,6 +61,12 @@ public class CreateTaskRequest extends BaseRequest {
|
||||
*/
|
||||
String remark;
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
String car_type;
|
||||
|
||||
/**
|
||||
* 扩展属性
|
||||
*/
|
||||
|
||||
@@ -484,6 +484,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
String task_type = req.getTask_type();
|
||||
String agv_task_type = req.getAgv_task_type();
|
||||
String remark = req.getRemark();
|
||||
String car_type = req.getCar_type();
|
||||
Map<String, String> params = req.getParams();
|
||||
|
||||
String start_point_code = "";
|
||||
@@ -600,6 +601,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
jo.put("vehicle_type", vehicle_type);
|
||||
jo.put("agv_system_type", agv_task_type);
|
||||
jo.put("remark", remark);
|
||||
jo.put("car_type", car_type);
|
||||
jo.put("params", params);
|
||||
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
|
||||
|
||||
|
||||
@@ -348,4 +348,10 @@ public class InstructionDto implements Serializable {
|
||||
*/
|
||||
private String agv_system_type;
|
||||
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
|
||||
private String car_type;
|
||||
|
||||
}
|
||||
|
||||
@@ -344,9 +344,8 @@ public class RouteLineServiceImpl extends CommonServiceImpl<RouteLineMapper, Rou
|
||||
routeLineMapper.insert(entity);
|
||||
List list1 = routeLines.get("normal");
|
||||
list1.add(ConvertUtil.convert(dto, RouteLineDto.class));
|
||||
} else {
|
||||
throw new BadRequestException("已存在该路由路线!");
|
||||
}
|
||||
//如果重复了,则跳过,不要影响新增。
|
||||
}
|
||||
}
|
||||
reload();
|
||||
|
||||
@@ -55,6 +55,9 @@ public class StorageCell extends CommonModel<StorageCell> implements Serializabl
|
||||
@ApiModelProperty(value = "地址")
|
||||
private Integer address;
|
||||
|
||||
@ApiModelProperty(value = "放货地址")
|
||||
private Integer end_address;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@@ -87,6 +90,9 @@ public class StorageCell extends CommonModel<StorageCell> implements Serializabl
|
||||
@ApiModelProperty(value = "父级货位编码")
|
||||
private String parent_storage_code;
|
||||
|
||||
@ApiModelProperty(value = "车辆类型")
|
||||
private String car_type;
|
||||
|
||||
public void copyFrom(StorageCell source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public interface StorageCellService extends CommonService<StorageCell> {
|
||||
|
||||
StorageCell getById(String id);
|
||||
StorageCellDto findById(String id);
|
||||
|
||||
StorageCell getByCode(String code);
|
||||
/**
|
||||
* 插入一条新数据。
|
||||
*/
|
||||
|
||||
@@ -41,6 +41,9 @@ public class StorageCellDto implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "地址")
|
||||
private Integer address;
|
||||
|
||||
@ApiModelProperty(value = "放货地址")
|
||||
private Integer end_address;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
@@ -65,4 +68,7 @@ public class StorageCellDto implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "父级货位编码")
|
||||
private String parent_storage_code;
|
||||
|
||||
@ApiModelProperty(value = "车辆类型")
|
||||
private String car_type;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.storage_cell.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@@ -14,6 +15,7 @@ import lombok.AllArgsConstructor;
|
||||
import org.nl.acs.common.base.PageInfo;
|
||||
import org.nl.acs.common.base.QueryHelpMybatisPlus;
|
||||
import org.nl.acs.common.base.impl.CommonServiceImpl;
|
||||
import org.nl.acs.opc.domain.OpcPlc;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.acs.utils.ConvertUtil;
|
||||
import org.nl.common.utils.FileUtil;
|
||||
@@ -67,6 +69,17 @@ public class StorageCellServiceImpl extends CommonServiceImpl<StorageCellMapper,
|
||||
return storageCellMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageCell getByCode(String code) {
|
||||
List<StorageCell> storageCellList = storageCellMapper.selectList(new LambdaQueryWrapper<StorageCell>()
|
||||
.eq(StorageCell::getStorage_code, code)
|
||||
.last("LIMIT 1"));
|
||||
if(CollectionUtil.isNotEmpty(storageCellList)){
|
||||
return storageCellList.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// // @Cacheable(key = "'id:' + #p0")
|
||||
// public StorageCellDto findById(String id) {
|
||||
@@ -149,8 +162,12 @@ public class StorageCellServiceImpl extends CommonServiceImpl<StorageCellMapper,
|
||||
LambdaQueryWrapper<StorageCell> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.like(StringUtils.isNotBlank(storage_code), StorageCell::getStorage_code,storage_code);
|
||||
wrapper.like(StringUtils.isNotBlank(parent_storage_code), StorageCell::getParent_storage_code,parent_storage_code);
|
||||
wrapper.like(StringUtils.isNotBlank(address), StorageCell::getAddress,address);
|
||||
IPage<StorageCell> storageCellIPage = storageCellMapper.selectPage(queryPage,wrapper);
|
||||
if (StringUtils.isNotBlank(address)) {
|
||||
// 使用 nested 方法分组,确保内部的 or 只作用于 address 和 end_address,不影响外部条件
|
||||
wrapper.nested(w -> w.like(StorageCell::getAddress, address)
|
||||
.or()
|
||||
.like(StorageCell::getEnd_address, address));
|
||||
} IPage<StorageCell> storageCellIPage = storageCellMapper.selectPage(queryPage,wrapper);
|
||||
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(storageCellIPage, StorageCell.class));
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -232,6 +232,9 @@ public class Task extends CommonModel<Task> implements Serializable {
|
||||
@ApiModelProperty(value = "时间")
|
||||
private String oven_time;
|
||||
|
||||
@ApiModelProperty(value = "车辆类型")
|
||||
private String car_type;
|
||||
|
||||
public void copyFrom(Task source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
@@ -301,5 +301,10 @@ public class TaskDto implements Serializable {
|
||||
*/
|
||||
private String next_height;
|
||||
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
private String car_type;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1101,6 +1101,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
String to_x = acsTask.getTo_x();
|
||||
String to_y = acsTask.getTo_y();
|
||||
String to_z = acsTask.getTo_z();
|
||||
String car_type = acsTask.getCar_type();
|
||||
|
||||
/** 开始平均分解校验 */
|
||||
String this_device_code =
|
||||
@@ -1167,6 +1168,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
instdto.setTo_x(to_x);
|
||||
instdto.setTo_y(to_y);
|
||||
instdto.setTo_z(to_z);
|
||||
instdto.setCar_type(car_type);
|
||||
|
||||
// 判断agv系统
|
||||
// 1、1楼叉车系统
|
||||
@@ -1280,6 +1282,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
instdto.setNext_point_code2(next_point_code2);
|
||||
instdto.setAgv_system_type(agv_system_type);
|
||||
instdto.setAgv_inst_type("1");
|
||||
instdto.setCar_type(acsTask.getCar_type());
|
||||
instructionservice.create2(instdto);
|
||||
|
||||
// acsTask.setTask_status("1");
|
||||
|
||||
@@ -388,6 +388,7 @@ public class HandServiceImpl implements HandService {
|
||||
String start_device_code = taskDto.getStart_device_code();
|
||||
String next_device_code = taskDto.getNext_device_code();
|
||||
String task_id = taskDto.getTask_id();
|
||||
String car_type = taskDto.getCar_type();
|
||||
|
||||
if(StrUtil.equals(taskDto.getTask_status(),"2")||StrUtil.equals(taskDto.getTask_status(),"3")){
|
||||
resultJson.put("message", "任务已完成或已取消,无法操作");
|
||||
@@ -412,6 +413,7 @@ public class HandServiceImpl implements HandService {
|
||||
instdto.setStart_device_code(start_device_code);
|
||||
instdto.setNext_device_code(next_device_code);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setCar_type(car_type);
|
||||
InstructionMybatis instructionMybatis = instructionService.lambdaQuery()
|
||||
.eq(InstructionMybatis::getStart_device_code, start_device_code)
|
||||
.eq(InstructionMybatis::getNext_device_code, next_device_code)
|
||||
|
||||
@@ -54,6 +54,7 @@ public class AutoCreateInst {
|
||||
String start_device_code = acsTask.getStart_device_code();
|
||||
String route_plan_code = acsTask.getRoute_plan_code();
|
||||
String vehicleType = acsTask.getVehicle_type();
|
||||
String car_type = acsTask.getCar_type();
|
||||
//是否复合任务 =0非复合任务
|
||||
String compound_task = acsTask.getCompound_task();
|
||||
String compound_task_data = null;
|
||||
@@ -199,6 +200,7 @@ public class AutoCreateInst {
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setVehicle_type(vehicleType);
|
||||
instdto.setCar_type(car_type);
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -20,11 +20,15 @@ public class NdcAutoReconnection {
|
||||
AutoRunService autoRunService;
|
||||
|
||||
public void run(String threadCode) throws Exception {
|
||||
String[] threadCodes = threadCode.split(",");
|
||||
for (String code : threadCodes) {
|
||||
if (!autoRunService.getThreadByCode(code).isAlive()) {
|
||||
autoRunService.startThread(code);
|
||||
try {
|
||||
String[] threadCodes = threadCode.split(",");
|
||||
for (String code : threadCodes) {
|
||||
if (!autoRunService.getThreadByCode(code).isAlive()) {
|
||||
autoRunService.startThread(code);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("定时任务执行异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ spring:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:ximenzi_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:Root.123456}
|
||||
password: ${DB_PWD:123456}
|
||||
|
||||
@@ -2,7 +2,7 @@ spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: prod
|
||||
active: dev
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
@@ -92,4 +92,4 @@ lucene:
|
||||
index:
|
||||
path: D:\lucene\index
|
||||
tlog:
|
||||
enable-invoke-time-print: true
|
||||
enable-invoke-time-print: true
|
||||
|
||||
@@ -50,9 +50,12 @@
|
||||
<el-form-item label="层" prop="z">
|
||||
<el-input v-model="form.z" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="AGV编码">
|
||||
<el-form-item label="老车AGV编码">
|
||||
<el-input v-model="form.address" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="新车AGV编码">
|
||||
<el-input v-model="form.end_address" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="父级系统编码" prop="parent_storage_code">
|
||||
<el-input v-model="form.parent_storage_code" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
@@ -72,7 +75,8 @@
|
||||
<el-table-column prop="x" label="排" />
|
||||
<el-table-column prop="y" label="列" />
|
||||
<el-table-column prop="z" label="层" />
|
||||
<el-table-column prop="address" label="地址" />
|
||||
<el-table-column prop="address" label="老车地址" />
|
||||
<el-table-column prop="end_address" label="新车地址" />
|
||||
<el-table-column prop="create_by" label="创建者" />
|
||||
<el-table-column prop="create_time" label="创建时间" />
|
||||
<el-table-column prop="parent_storage_code" label="父级系统编码" />
|
||||
@@ -99,7 +103,7 @@ import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
|
||||
const defaultForm = { storage_id: null, storage_code: null, x: null, y: null, z: null, address: null, remark: null, is_active: null, is_delete: null, create_by: null, create_time: null, update_by: null, update_time: null, parent_storage_code: null }
|
||||
const defaultForm = { storage_id: null, storage_code: null, x: null, y: null, z: null, address: null, end_address: null, remark: null, is_active: null, is_delete: null, create_by: null, create_time: null, update_by: null, update_time: null, parent_storage_code: null }
|
||||
export default {
|
||||
name: 'StorageCell',
|
||||
components: { pagination, crudOperation, udOperation, rrOperation },
|
||||
|
||||
Reference in New Issue
Block a user