rev:布局

This commit is contained in:
2024-07-05 09:58:47 +08:00
parent d10119bef4
commit 6415d937f1
18 changed files with 1062 additions and 1035 deletions

View File

@@ -20,6 +20,9 @@ public class CleanLog {
WQLObject logTab = WQLObject.getWQLObject("sys_log");
int days = Integer.parseInt(paramService.findByCode("log_day").getValue());
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
WQLObject logQuartzTab = WQLObject.getWQLObject("sys_quartz_log");
logQuartzTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
log.info("自动清理日志执行成功...!");
}

View File

@@ -38,32 +38,32 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
// 心跳
private int heartbeat = 0;
private int lastHeartbeat = this.heartbeat;
private int lastHeartbeat = 0;
// 工作模式
private int mode = 0;
private int lastMode = this.mode;
private int lastMode = 0;
// 光电信号
private int move = 0;
private int lastMove = this.move;
private int lastMove = 0;
// 动作信号
private int action = 0;
private int lastAction = this.action;
private int lastAction = 0;
// error
private int error = 0;
private int lastError = this.error;
private int lastError = 0;
// 任务号
private int task = 0;
private int lastTask = this.task;
private int lastTask = 0;
// 下发命令
private int toCommand = 0;
private int lastToCommand = this.toCommand;
private int lastToCommand = 0;
// 下发物料
private int toMaterial = 0;
private int lastToMaterial = this.toMaterial;
private int lastToMaterial = 0;
// 下发数量
private int toQty = 0;
private int lastToQty = this.toQty;
private int lastToQty = 0;
private String currentDeviceCode = null;
private boolean isOnline = false;
@@ -103,37 +103,28 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
if (mode == 2) {
this.writing("to_command", "0");
}
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", "mode信号发生变化,进行复位标记,此时标记值:" + requireSuccess);
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_MODE, String.valueOf(mode));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_MODE + " " + this.lastMode + " -> " + this.mode);
}
if (this.move != this.lastMove) {
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_MOVE, String.valueOf(this.move));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_MOVE + " " + this.lastMove + " -> " + this.move);
}
if (this.action != this.lastAction) {
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_ACTION, String.valueOf(this.action));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_ACTION + " " + this.lastAction + " -> " + this.action);
}
if (this.error != this.lastError) {
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_ERROR, String.valueOf(this.error));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_ERROR + " " + this.lastError + " -> " + this.error);
}
if (this.task != this.lastTask) {
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_TASK, String.valueOf(this.task));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_TASK + " " + this.lastTask + " -> " + this.task);
}
if (this.toCommand != this.lastToCommand) {
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_TO_COMMAND, String.valueOf(this.toCommand));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_TO_COMMAND + " " + this.lastToCommand + " -> " + this.toCommand);
}
if (this.toMaterial != this.lastToMaterial) {
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_TO_MATERIAL, String.valueOf(this.toMaterial));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_TO_MATERIAL + " " + this.lastToMaterial + " -> " + this.toMaterial);
}
if (this.toQty != this.lastToQty) {
this.deviceExecuteLogService.deviceItemValue(this.currentDeviceCode, ItemProtocol.ITEM_TO_QTY, String.valueOf(this.toQty));
this.deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", ItemProtocol.ITEM_TO_QTY + " " + this.lastToQty + " -> " + this.toQty);
}
} catch (Exception e) {
@@ -271,8 +262,12 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
private Device findHasGoodsDevice(JSONArray deviceCodes) {
for (int i = 0; i < deviceCodes.size(); i++) {
Device device = this.deviceAppService.findDeviceByCode(deviceCodes.getString(i));
if (device != null && "0".equals(device.getIslock()) && 1 == device.getHas_goods()) {
if (device != null && ("0".equals(device.getIslock()) || "false".equals(device.getIslock())) && 1 == device.getHas_goods()) {
return device;
} else {
if (device != null) {
deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", "查找设备时,对应的设备:" + device.getDevice_code() + ",锁定状态:" + device.getIslock() + ",有货状态:" + device.getHas_goods());
}
}
}
return null;
@@ -281,8 +276,12 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
private Device findNotHasGoodsDevice(JSONArray deviceCodes) {
for (int i = 0; i < deviceCodes.size(); i++) {
Device device = this.deviceAppService.findDeviceByCode(deviceCodes.getString(i));
if (device != null && "0".equals(device.getIslock()) && 0 == device.getHas_goods()) {
if (device != null && ("0".equals(device.getIslock()) || "false".equals(device.getIslock())) && 0 == device.getHas_goods()) {
return device;
} else {
if (device != null) {
deviceExecuteLogService.deviceExecuteLog(this.currentDeviceCode, "", "", "查找设备时,对应的设备:" + device.getDevice_code() + ",锁定状态:" + device.getIslock() + ",有货状态:" + device.getHas_goods());
}
}
}
return null;

View File

@@ -582,8 +582,8 @@ public class HFHandServiceImpl implements HFHandService {
taskService.finish(acsTask.getTask_id());
Device startDevice = deviceAppService.findDeviceByCode(acsTask.getStart_device_code());
Device nextDevice = deviceAppService.findDeviceByCode(acsTask.getNext_device_code());
startDevice.setIslock("false");
nextDevice.setIslock("false");
startDevice.setIslock("0");
nextDevice.setIslock("0");
}

View File

@@ -53,9 +53,6 @@
sys_dict_detail
WHERE
`name` = 'region'
OPTION 输入.region_code <> ""
value in ('2','3','5','7','8','11')
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -25,6 +25,7 @@ import org.nl.modules.quartz.domain.QuartzLog;
import org.nl.modules.quartz.repository.QuartzLogRepository;
import org.nl.modules.quartz.service.QuartzJobService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.quartz.QuartzJobBean;
@@ -41,6 +42,7 @@ import java.util.concurrent.ThreadPoolExecutor;
@Async
@SuppressWarnings({"unchecked", "all"})
@Slf4j
@DisallowConcurrentExecution
public class ExecutionJob extends QuartzJobBean {
/**