Merge branch 'master' of http://121.40.234.130:8899/root/hl_one
0
wcs/hd/logPath_IS_UNDEFINED/2022-07-04.0.log
Normal file
0
wcs/hd/logPath_IS_UNDEFINED/2022-07-07.0.log
Normal file
@@ -18,6 +18,29 @@ public class AbstractDriverService<T> implements IDriverService{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getDbValue(Device device,String dbName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Integer getDbValue(T t,String dbName){
|
||||
Integer dbValue = 0;
|
||||
try {
|
||||
Class<?> tClass = t.getClass();
|
||||
Method methodDb = tClass.getMethod("get"+dbName);
|
||||
dbValue = (Integer) methodDb.invoke(t);
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return dbValue;
|
||||
}
|
||||
|
||||
|
||||
public JSONObject getCommonDeviceInfo(T t){
|
||||
JSONObject map = new JSONObject();
|
||||
try {
|
||||
|
||||
@@ -11,9 +11,10 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service("hailiang_packer_station")
|
||||
public class HailiangPackerStationDevice extends AbstractDriverService {
|
||||
HailiangPackerStationDeviceDriver hailiangPackerStationDeviceDriver;
|
||||
@Override
|
||||
public JSONObject getDeviceInfo(Device device) {
|
||||
HailiangPackerStationDeviceDriver hailiangPackerStationDeviceDriver = (HailiangPackerStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangPackerStationDeviceDriver = (HailiangPackerStationDeviceDriver) device.getDeviceDriver();
|
||||
JSONObject jo = super.getCommonDeviceInfo(hailiangPackerStationDeviceDriver);
|
||||
jo.put("material_type",device.getMaterial_type());
|
||||
jo.put("lack_req", StageActorUtil.getIsOrNo(hailiangPackerStationDeviceDriver.getLack_req()));
|
||||
@@ -26,4 +27,10 @@ public class HailiangPackerStationDevice extends AbstractDriverService {
|
||||
jo.put("driver_type",device.getDeviceDriverDefination().getDriverCode());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getDbValue(Device device,String dbName){
|
||||
hailiangPackerStationDeviceDriver = (HailiangPackerStationDeviceDriver) device.getDeviceDriver();
|
||||
return super.getDbValue(hailiangPackerStationDeviceDriver,dbName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,15 @@ import org.nl.acs.opc.Device;
|
||||
|
||||
|
||||
public interface IDriverService {
|
||||
/**
|
||||
* 获取设备监控信息
|
||||
* @param device
|
||||
* @return
|
||||
*/
|
||||
JSONObject getDeviceInfo(Device device);
|
||||
|
||||
/**
|
||||
* 获取db值
|
||||
*/
|
||||
Integer getDbValue(Device device,String dbName);
|
||||
}
|
||||
|
||||
@@ -311,8 +311,6 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":,move:" + move + ",mode:" + mode + ",requireSucess:" + requireSucess + "开始申请请求取走空料斗任务");
|
||||
apply_take_empty_task();
|
||||
}
|
||||
logServer.deviceLogToacs(this.device_code, "", "", "lack_req:" + lack_req + "move:" + move + "req_task_empty:" + req_task_empty);
|
||||
|
||||
} else {
|
||||
logServer.deviceLogToacs(this.device_code, "", "", "是否请求成功:requireSucess:" + requireSucess);
|
||||
}
|
||||
@@ -541,7 +539,8 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":关联设备" + link_device + "未找到对应设备工单");
|
||||
throw new BadRequestException(this.device_code + ":关联设备" + link_device + "未找到对应设备工单");
|
||||
}
|
||||
if (order.getIs_needmove().equals("0")) {
|
||||
|
||||
if (StrUtil.isNotEmpty(order.getIs_needmove()) && order.getIs_needmove().equals("0")) {
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":关联设备" + link_device + "工单,不需要agv搬运");
|
||||
return false;
|
||||
}
|
||||
@@ -562,8 +561,9 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (num != 0) {
|
||||
continue;
|
||||
}
|
||||
String material = hailiangEngravingCacheDeviceDriver.getMaterial();
|
||||
String material = route_link_device.getMaterial_type();
|
||||
if (StrUtil.isEmpty(material)) {
|
||||
logServer.deviceLogToacs(this.device_code, "", "", hailiangEngravingCacheDeviceDriver.getDevice_code() + ":缓存位物料为空");
|
||||
continue;
|
||||
}
|
||||
if (material.equals(cpbh)) {
|
||||
|
||||
@@ -84,4 +84,11 @@ public class WmsToAcsController {
|
||||
return new ResponseEntity<>(wmstoacsService.orderStatusUpdate(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryDeviceDBValue")
|
||||
@Log("查询设备DB值")
|
||||
@ApiOperation("查询设备DB值")
|
||||
public ResponseEntity<Object> queryDeviceDBValue(@RequestBody String whereJson){
|
||||
return new ResponseEntity<>(wmstoacsService.queryDeviceDBValue(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -68,4 +68,12 @@ public interface WmsToAcsService {
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> orderStatusUpdate(String whereJson);
|
||||
|
||||
/**
|
||||
* 查询设备DB值
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> queryDeviceDBValue(String whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.common.IDriverService;
|
||||
import org.nl.acs.config.AcsConfig;
|
||||
import org.nl.acs.config.server.AcsConfigService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.DeviceDriverDefination;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_machine.HailiangEngravingMachineDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_packer_station.HailiangPackerStationDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_device.HailiangSpecialDeviceDriver;
|
||||
@@ -28,10 +26,10 @@ import org.nl.acs.instruction.service.InstructionService;
|
||||
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.order.service.ProduceshiftorderService;
|
||||
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
|
||||
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.exception.BadRequestException;
|
||||
@@ -39,13 +37,12 @@ import org.nl.exception.WDKException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.unit.DataUnit;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -54,13 +51,13 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
private final InstructionService InstructionService;
|
||||
private final TaskService TaskService;
|
||||
private final DeviceService DeviceService;
|
||||
private final DeviceAppService DeviceAppService;
|
||||
private final RouteLineService RouteLineService;
|
||||
private final TaskService taskService;
|
||||
private final DeviceService deviceService;
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final RouteLineService routeLineService;
|
||||
private final ProduceshiftorderService produceshiftorderService;
|
||||
|
||||
@Override
|
||||
@@ -128,12 +125,12 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
// if (ObjectUtil.isEmpty(list)) {
|
||||
// throw new WDKException("路由不通!");
|
||||
// }
|
||||
TaskDto taskDto = TaskService.findByCodeFromCache(task_code);
|
||||
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
|
||||
if (taskDto != null) {
|
||||
throw new WDKException("不能存在相同的任务号!");
|
||||
}
|
||||
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||
TaskDto vehicle_dto = TaskService.findByContainer(vehicle_code);
|
||||
TaskDto vehicle_dto = taskService.findByContainer(vehicle_code);
|
||||
if (vehicle_dto != null) {
|
||||
throw new WDKException("已存在该载具号的任务!");
|
||||
}
|
||||
@@ -161,7 +158,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
||||
try {
|
||||
TaskService.create(task_dto);
|
||||
taskService.create(task_dto);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
JSONObject json = new JSONObject();
|
||||
@@ -216,11 +213,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
String cancelTaskCheck = acsConfigService.findConfigFromCache().get(AcsConfig.CANCELTASKCHECK);
|
||||
if (StrUtil.equals(cancelTaskCheck, "1")) {
|
||||
TaskService.cancel(task_uuid);
|
||||
taskService.cancel(task_uuid);
|
||||
} else if (StrUtil.equals(cancelTaskCheck, "0")) {
|
||||
Instruction inst = instructionService.findByTaskcode(task_code);
|
||||
if (inst == null) {
|
||||
TaskService.cancel(task_uuid);
|
||||
taskService.cancel(task_uuid);
|
||||
} else {
|
||||
throw new RuntimeException("指令正在执行中,操作失败!");
|
||||
}
|
||||
@@ -247,7 +244,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("hasGoodStatus", has_goods);
|
||||
DeviceService.changeDeviceStatus(jo);
|
||||
deviceService.changeDeviceStatus(jo);
|
||||
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
@@ -263,7 +260,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
String device_code = form.getString("device_code");
|
||||
String type = form.getString("type");
|
||||
|
||||
Device device = DeviceAppService.findDeviceByCode(device_code);
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK);
|
||||
@@ -282,7 +279,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
String device_code = data.getString("device_code");
|
||||
String code = data.getString("code");
|
||||
String value = data.getString("value");
|
||||
Device device = DeviceAppService.findDeviceByCode(device_code);
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new Exception("未找到对应设备:" + device_code);
|
||||
}
|
||||
@@ -317,7 +314,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver;
|
||||
|
||||
if (datas.size() == 0) {
|
||||
List<Device> list = DeviceService.findCacheDevice();
|
||||
List<Device> list = deviceService.findCacheDevice();
|
||||
for (int i = 0, j = list.size(); i < j; i++) {
|
||||
Device device = list.get(i);
|
||||
JSONObject obj = new JSONObject();
|
||||
@@ -446,7 +443,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONObject data = datas.getJSONObject(i);
|
||||
String device_code = data.getString("device_code");
|
||||
Device device = DeviceAppService.findDeviceByCode(device_code);
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new Exception("未找到对应设备:" + device_code);
|
||||
}
|
||||
@@ -650,7 +647,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
String type = jsonObject.getString("type");
|
||||
JSONObject json = wo.query("ext_order_id = '" + ext_order_id + "'").uniqueResult(0);
|
||||
ProduceshiftorderDto obj = JSONObject.toJavaObject(json, ProduceshiftorderDto.class);
|
||||
Device device = DeviceAppService.findDeviceByCode(obj.getDevice_code());
|
||||
Device device = deviceAppService.findDeviceByCode(obj.getDevice_code());
|
||||
HailiangSpecialDeviceDriver hailiangSpecialDeviceDriver;
|
||||
HailiangPackerStationDeviceDriver hailiangPackerStationDeviceDriver;
|
||||
HailiangEngravingMachineDeviceDriver hailiangEngravingMachineDeviceDriver;
|
||||
@@ -711,4 +708,40 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryDeviceDBValue(String whereJson) {
|
||||
JSONArray datas = JSONArray.parseArray(whereJson);
|
||||
log.info("orderStatusUpdate--------------:输入参数" + datas.toString());
|
||||
JSONObject map = new JSONObject();
|
||||
if (datas.size() > 0){
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
JSONObject jsonObject = datas.getJSONObject(i);
|
||||
String device_code = jsonObject.getString("device_code");
|
||||
String dbName = jsonObject.getString("DB");
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
List<DeviceExtraManageDto> extra = device.getExtra();
|
||||
for (int j = 0; j < extra.size(); j++) {
|
||||
DeviceExtraManageDto deviceExtraManageDto = extra.get(j);
|
||||
String deviceCode = deviceExtraManageDto.getDevice_code();
|
||||
String extra_name = deviceExtraManageDto.getExtra_name();
|
||||
if (deviceCode.equals(device_code) && extra_name.equals(dbName)){
|
||||
String extra_code = deviceExtraManageDto.getExtra_code();
|
||||
String[] split = extra_code.split("\\.");
|
||||
extra_code = split[split.length - 1];
|
||||
extra_code = extra_code.substring(0,1).toUpperCase()+extra_code.substring(1);
|
||||
IDriverService driverService = applicationContext.getBean(device.getDeviceDriverDefination().getDriverCode(), IDriverService.class);
|
||||
Integer dbValue = driverService.getDbValue(device, extra_code);
|
||||
map.put(dbName,dbValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK);
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", map);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ public class DeviceExtraManageDto {
|
||||
private String device_driver;
|
||||
|
||||
private String extra_code;
|
||||
private String extra_name;
|
||||
private Object extra_value;
|
||||
private String description;
|
||||
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
package org.nl.modules.log;
|
||||
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.bson.Document;
|
||||
import org.slf4j.Marker;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* https://www.cnblogs.com/lzghyh/p/14913230.html
|
||||
* https://juejin.cn/post/6844903488896385037
|
||||
* https://cloud.tencent.com/developer/article/1384035
|
||||
* https://www.freesion.com/article/229560377/
|
||||
*/
|
||||
public class MongoDBAppender extends MongoDBAppenderBase<ILoggingEvent> {
|
||||
public MongoDBAppender() {
|
||||
super("loggingEvents");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Document toMongoDocument(ILoggingEvent eventObject) {
|
||||
|
||||
final Document doc = new Document();
|
||||
doc.append("date", DateUtil.now());
|
||||
doc.append("source", source);
|
||||
try {
|
||||
doc.append("ip", InetAddress.getLocalHost().getHostAddress());
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Marker marker = eventObject.getMarker();
|
||||
if (!ObjectUtil.isEmpty(marker)) {
|
||||
doc.append("marker", marker.getName());
|
||||
}else {
|
||||
doc.append("marker", "default");
|
||||
}
|
||||
|
||||
doc.append("level", eventObject.getLevel().toString());
|
||||
doc.append("logger", eventObject.getLoggerName());
|
||||
doc.append("thread", eventObject.getThreadName());
|
||||
doc.append("message", eventObject.getFormattedMessage());
|
||||
if (eventObject.getMDCPropertyMap() != null && !eventObject.getMDCPropertyMap().isEmpty())
|
||||
doc.append("mdc", eventObject.getMDCPropertyMap());
|
||||
// ...
|
||||
return doc;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,108 +2,58 @@ package org.nl.modules.log;
|
||||
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.UnsynchronizedAppenderBase;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mongodb.MongoClient;
|
||||
import com.mongodb.MongoClientOptions;
|
||||
import com.mongodb.MongoCredential;
|
||||
import com.mongodb.ServerAddress;
|
||||
import com.mongodb.*;
|
||||
import com.mongodb.client.MongoCollection;
|
||||
import com.mongodb.client.MongoDatabase;
|
||||
import lombok.Data;
|
||||
import org.bson.Document;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.slf4j.Marker;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* MongoDBAppender适配类
|
||||
* https://www.cnblogs.com/lzghyh/p/14913230.html
|
||||
* https://juejin.cn/post/6844903488896385037
|
||||
* https://cloud.tencent.com/developer/article/1384035
|
||||
* https://www.freesion.com/article/229560377/
|
||||
* <p>
|
||||
* https://cloud.tencent.com/developer/article/1384035
|
||||
*/
|
||||
@Data
|
||||
public abstract class MongoDBAppenderBase<E> extends UnsynchronizedAppenderBase<E> {
|
||||
private MongoClient mongo;
|
||||
MongoDatabase db;
|
||||
private MongoCollection<Document> eventsCollection;
|
||||
|
||||
private String host = "192.168.46.225"; // 地址
|
||||
private int port = 27017; // 端口号
|
||||
private String dbName = "db"; // 库名
|
||||
private String collectionName; // 集合名
|
||||
private String username; // 用户名
|
||||
private String password; // 密码
|
||||
protected String source;
|
||||
|
||||
private int connectionsPerHost = 10; // 空闲线程池中最大链接数
|
||||
private int threadsAllowedToBlockForConnectionMultiplier = 5; //一个线程等待链接可用的最大等待毫秒数
|
||||
private int maxWaitTime = 1000 * 60 * 2; // 最长等待时间
|
||||
private int connectTimeout;
|
||||
private int socketTimeout;
|
||||
private int wtimeout;
|
||||
|
||||
MongoDBAppenderBase(String collectionName) {
|
||||
this.collectionName = collectionName;
|
||||
}
|
||||
public class MongoDBAppenderBase<E> extends UnsynchronizedAppenderBase<ILoggingEvent> {
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
try {
|
||||
connectToMongoDB();
|
||||
super.start();
|
||||
} catch (UnknownHostException e) {
|
||||
addError("Error connecting to MongoDB server: " + host + ":" + port,
|
||||
e);
|
||||
protected void append(ILoggingEvent eventObject) {
|
||||
|
||||
MongoTemplate mongoTemplate = SpringContextHolder.getBean(MongoTemplate.class);
|
||||
|
||||
if (mongoTemplate != null) {
|
||||
final BasicDBObject doc = new BasicDBObject();
|
||||
Marker marker = eventObject.getMarker();
|
||||
if (!ObjectUtil.isEmpty(marker)) {
|
||||
doc.append("marker", marker.getName());
|
||||
} else {
|
||||
doc.append("marker", "default");
|
||||
}
|
||||
try {
|
||||
doc.append("ip", InetAddress.getLocalHost().getHostAddress());
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
doc.append("level", eventObject.getLevel().toString());
|
||||
doc.append("logger", eventObject.getLoggerName());
|
||||
doc.append("thread", eventObject.getThreadName());
|
||||
doc.append("message", eventObject.getFormattedMessage());
|
||||
mongoTemplate.insert(doc, "log");
|
||||
}
|
||||
}
|
||||
|
||||
private void connectToMongoDB() throws UnknownHostException {
|
||||
// 用户名 数据库 密码
|
||||
if (username != null && password != null) {
|
||||
|
||||
MongoCredential credential = MongoCredential.createCredential(
|
||||
username, dbName, password.toCharArray());
|
||||
ServerAddress serverAddress = new ServerAddress(host, port);
|
||||
mongo = new MongoClient(serverAddress, Collections.singletonList(credential), buildOptions());
|
||||
} else {
|
||||
mongo = new MongoClient(new ServerAddress(host, port), buildOptions());
|
||||
}
|
||||
|
||||
db = mongo.getDatabase(dbName);
|
||||
eventsCollection = db.getCollection(collectionName);
|
||||
|
||||
}
|
||||
|
||||
private MongoClientOptions buildOptions() {
|
||||
final MongoClientOptions.Builder options = new MongoClientOptions.Builder();
|
||||
options.connectionsPerHost(connectionsPerHost);
|
||||
options.threadsAllowedToBlockForConnectionMultiplier(threadsAllowedToBlockForConnectionMultiplier);
|
||||
options.maxWaitTime(maxWaitTime);
|
||||
options.connectTimeout(connectTimeout);
|
||||
options.socketTimeout(socketTimeout);
|
||||
options.maxWaitTime(wtimeout);
|
||||
return options.build();
|
||||
}
|
||||
|
||||
protected abstract Document toMongoDocument(E event);
|
||||
|
||||
@Override
|
||||
protected void append(E eventObject) {
|
||||
if (eventObject instanceof ILoggingEvent) {
|
||||
ILoggingEvent evt = (ILoggingEvent) eventObject;
|
||||
Marker marker = evt.getMarker();
|
||||
if (ObjectUtil.isEmpty(marker))
|
||||
marker = LogMarkerTypeEnum.getMarker(LogMarkerTypeEnum.DEFAULT);
|
||||
eventsCollection = db.getCollection(marker.getName());
|
||||
|
||||
}
|
||||
|
||||
eventsCollection.insertOne(toMongoDocument(eventObject));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if (mongo != null)
|
||||
mongo.close();
|
||||
super.stop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
package org.nl.modules.quartz.task;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -24,22 +20,17 @@ import java.util.Date;
|
||||
@RequiredArgsConstructor
|
||||
public class AutoCleanUpLogs {
|
||||
|
||||
private final MongoTemplate mongoTemplate;
|
||||
private ExecutorService threadPool = Executors.newCachedThreadPool();
|
||||
|
||||
public void run() throws Exception {
|
||||
try {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device");
|
||||
JSONArray array = wo.query("1=1","device_code").getResultJSONArray(0);
|
||||
Date now = DateUtil.parse(DateUtil.now());
|
||||
DateTime dateTime = DateUtil.offsetDay(now, -15);
|
||||
String formatDateTime = DateUtil.formatDateTime(dateTime);
|
||||
Query query = new Query().addCriteria(Criteria.where("create_time").lte(formatDateTime));
|
||||
if (array.size() > 0){
|
||||
JSONArray array = wo.query("1=1", "device_code").getResultJSONArray(0);
|
||||
if (array.size() > 0) {
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject jsonObject = array.getJSONObject(i);
|
||||
String device_code = jsonObject.getString("device_code");
|
||||
mongoTemplate.remove(query,device_code);
|
||||
System.out.println(device_code+"设备日志清除成功---------------------");
|
||||
threadPool.execute(new CleanUpThread(device_code));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.nl.modules.quartz.task;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: geng by
|
||||
* @createDate: 2022/7/12
|
||||
*/
|
||||
public class CleanUpThread extends Thread{
|
||||
|
||||
private String deviceCode;
|
||||
|
||||
public CleanUpThread(String deviceCode){
|
||||
this.deviceCode = deviceCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
MongoTemplate mongoTemplate = SpringContextHolder.getBean(MongoTemplate.class);
|
||||
Date now = DateUtil.parse(DateUtil.now());
|
||||
DateTime bzdate;
|
||||
if (deviceCode.equals("BZ01") || deviceCode.equals("BZ02")){
|
||||
bzdate = DateUtil.offsetDay(now, -3);
|
||||
} else {
|
||||
bzdate = DateUtil.offsetDay(now, -15);
|
||||
}
|
||||
String formatbz = DateUtil.formatDateTime(bzdate);
|
||||
Query bzquery = new Query().addCriteria(Criteria.where("create_time").lte(formatbz));
|
||||
System.out.println(deviceCode+"设备日志开始清除---------------------");
|
||||
mongoTemplate.remove(bzquery, deviceCode);
|
||||
System.out.println(deviceCode+"设备日志清除成功---------------------");
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<appender name="acs_to_erp" class="org.nl.modules.log.MongoDBAppender">
|
||||
<dbName>acs_log</dbName>
|
||||
<collectionName>acs_to_erp</collectionName>
|
||||
<source>${CONTEXT_NAME}</source>
|
||||
<appender name="acs_to_erp" class="org.nl.modules.log.MongoDBAppenderBase">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>info</level>
|
||||
</filter>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<appender name="acs_to_wms" class="org.nl.modules.log.MongoDBAppender">
|
||||
<dbName>acs_log</dbName>
|
||||
<collectionName>acs_to_wms</collectionName>
|
||||
<source>${CONTEXT_NAME}</source>
|
||||
<appender name="acs_to_wms" class="org.nl.modules.log.MongoDBAppenderBase">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>info</level>
|
||||
</filter>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<appender name="agv_feedback_servlet" class="org.nl.modules.log.MongoDBAppender">
|
||||
<dbName>acs_log</dbName>
|
||||
<collectionName>agv_feedback_servlet</collectionName>
|
||||
<source>${CONTEXT_NAME}</source>
|
||||
<appender name="agv_feedback_servlet" class="org.nl.modules.log.MongoDBAppenderBase">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>info</level>
|
||||
</filter>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<appender name="agv_leave_servlet" class="org.nl.modules.log.MongoDBAppender">
|
||||
<dbName>acs_log</dbName>
|
||||
<collectionName>agv_leave_servlet</collectionName>
|
||||
<source>${CONTEXT_NAME}</source>
|
||||
<appender name="agv_leave_servlet" class="org.nl.modules.log.MongoDBAppenderBase">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>info</level>
|
||||
</filter>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<appender name="auto_create_inst" class="org.nl.modules.log.MongoDBAppender">
|
||||
<dbName>acs_log</dbName>
|
||||
<collectionName>auto_create_inst</collectionName>
|
||||
<source>${CONTEXT_NAME}</source>
|
||||
<appender name="auto_create_inst" class="org.nl.modules.log.MongoDBAppenderBase">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>info</level>
|
||||
</filter>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<appender name="ndc_socket_connection_autorun" class="org.nl.modules.log.MongoDBAppender">
|
||||
<dbName>acs_log</dbName>
|
||||
<collectionName>ndc_socket_connection_autorun</collectionName>
|
||||
<source>${CONTEXT_NAME}</source>
|
||||
<appender name="ndc_socket_connection_autorun" class="org.nl.modules.log.MongoDBAppenderBase">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>info</level>
|
||||
</filter>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<appender name="agv_task_status" class="org.nl.modules.log.MongoDBAppender">
|
||||
<dbName>acs_log</dbName>
|
||||
<collectionName>agv_task_status</collectionName>
|
||||
<source>${CONTEXT_NAME}</source>
|
||||
<appender name="agv_task_status" class="org.nl.modules.log.MongoDBAppenderBase">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>info</level>
|
||||
</filter>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<appender name="xz_agv_task_status" class="org.nl.modules.log.MongoDBAppender">
|
||||
<dbName>acs_log</dbName>
|
||||
<collectionName>xz_agv_task_status</collectionName>
|
||||
<source>${CONTEXT_NAME}</source>
|
||||
<appender name="xz_agv_task_status" class="org.nl.modules.log.MongoDBAppenderBase">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>info</level>
|
||||
</filter>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<appender name="wms_to_acs" class="org.nl.modules.log.MongoDBAppender">
|
||||
<dbName>acs_log</dbName>
|
||||
<collectionName>wms_to_acs</collectionName>
|
||||
<source>${CONTEXT_NAME}</source>
|
||||
<appender name="wms_to_acs" class="org.nl.modules.log.MongoDBAppenderBase">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>info</level>
|
||||
</filter>
|
||||
|
||||
@@ -57,14 +57,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
</encoder>-->
|
||||
</appender>
|
||||
|
||||
<appender name="MONGO" class="org.nl.modules.log.MongoDBAppender">
|
||||
<host>192.168.46.225</host>
|
||||
<port>27017</port>
|
||||
<!-- <username>admin</username>
|
||||
<password>123456</password>-->
|
||||
<dbName>acs_log</dbName>
|
||||
<collectionName>default</collectionName>
|
||||
<source>${CONTEXT_NAME}</source>
|
||||
<appender name="MONGO" class="org.nl.modules.log.MongoDBAppenderBase">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>info</level>
|
||||
</filter>
|
||||
|
||||
BIN
wcs/qd/src/assets/acs/三通一体机.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
wcs/qd/src/assets/acs/储料仓.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
wcs/qd/src/assets/acs/刻字机.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
wcs/qd/src/assets/acs/包装机1.png
Normal file
|
After Width: | Height: | Size: 692 B |
BIN
wcs/qd/src/assets/acs/包装机2.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
wcs/qd/src/assets/acs/包装机3.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
wcs/qd/src/assets/acs/包装机4.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
wcs/qd/src/assets/acs/推弯成型1.png
Normal file
|
After Width: | Height: | Size: 1022 B |
BIN
wcs/qd/src/assets/acs/推弯成型2.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
wcs/qd/src/assets/acs/推弯成型3.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
wcs/qd/src/assets/acs/清洗机1.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
wcs/qd/src/assets/acs/清洗机2.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
wcs/qd/src/assets/acs/清洗机3.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
wcs/qd/src/assets/acs/清洗机4.png
Normal file
|
After Width: | Height: | Size: 680 B |
BIN
wcs/qd/src/assets/acs/清洗机5.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
wcs/qd/src/assets/acs/盘管下料1.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
wcs/qd/src/assets/acs/盘管下料2.png
Normal file
|
After Width: | Height: | Size: 683 B |
BIN
wcs/qd/src/assets/acs/盘管下料3.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
wcs/qd/src/assets/acs/直管下料1.png
Normal file
|
After Width: | Height: | Size: 529 B |
BIN
wcs/qd/src/assets/acs/直管下料2.png
Normal file
|
After Width: | Height: | Size: 673 B |
BIN
wcs/qd/src/assets/acs/直管下料3.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
@@ -232,41 +232,62 @@ export default {
|
||||
{ id: 11, name: '区域横', img1: '区域横' },
|
||||
{ id: 12, name: '区域竖', img1: '区域竖' },
|
||||
{ id: 13, name: '专机', img1: '专机' },
|
||||
{ id: 14, name: '激', img1: '激' },
|
||||
{ id: 15, name: '光', img1: '光' },
|
||||
{ id: 16, name: '区', img1: '区' },
|
||||
{ id: 17, name: '一', img1: '一' },
|
||||
{ id: 18, name: '三', img1: '三' },
|
||||
{ id: 19, name: '下', img1: '下' },
|
||||
{ id: 20, name: '仓', img1: '仓' },
|
||||
{ id: 21, name: '伸', img1: '伸' },
|
||||
{ id: 22, name: '体', img1: '体' },
|
||||
{ id: 23, name: '储', img1: '储' },
|
||||
{ id: 24, name: '刻', img1: '刻' },
|
||||
{ id: 25, name: '加', img1: '加' },
|
||||
{ id: 26, name: '包', img1: '包' },
|
||||
{ id: 27, name: '压', img1: '压' },
|
||||
{ id: 28, name: '品', img1: '品' },
|
||||
{ id: 29, name: '孔', img1: '孔' },
|
||||
{ id: 30, name: '字', img1: '字' },
|
||||
{ id: 31, name: '屑', img1: '屑' },
|
||||
{ id: 32, name: '工', img1: '工' },
|
||||
{ id: 33, name: '弯', img1: '弯' },
|
||||
{ id: 34, name: '拉', img1: '拉' },
|
||||
{ id: 35, name: '推', img1: '推' },
|
||||
{ id: 36, name: '料', img1: '料' },
|
||||
{ id: 37, name: '旋', img1: '旋' },
|
||||
{ id: 38, name: '无', img1: '无' },
|
||||
{ id: 39, name: '机', img1: '机' },
|
||||
{ id: 40, name: '桶', img1: '桶' },
|
||||
{ id: 41, name: '洗', img1: '洗' },
|
||||
{ id: 42, name: '清', img1: '清' },
|
||||
{ id: 43, name: '盘', img1: '盘' },
|
||||
{ id: 44, name: '直', img1: '直' },
|
||||
{ id: 45, name: '码', img1: '码' },
|
||||
{ id: 46, name: '管', img1: '管' },
|
||||
{ id: 47, name: '装', img1: '装' },
|
||||
{ id: 48, name: '镗', img1: '镗' }
|
||||
{ id: 14, name: '三通一体机', img1: '三通一体机' },
|
||||
{ id: 15, name: '储料仓', img1: '储料仓' },
|
||||
{ id: 16, name: '刻字机', img1: '刻字机' },
|
||||
{ id: 17, name: '包装机1', img1: '包装机1' },
|
||||
{ id: 18, name: '包装机2', img1: '包装机2' },
|
||||
{ id: 19, name: '包装机3', img1: '包装机3' },
|
||||
{ id: 20, name: '包装机4', img1: '包装机4' },
|
||||
{ id: 21, name: '推弯成型1', img1: '推弯成型1' },
|
||||
{ id: 22, name: '推弯成型2', img1: '推弯成型2' },
|
||||
{ id: 23, name: '推弯成型3', img1: '推弯成型3' },
|
||||
{ id: 24, name: '清洗机1', img1: '清洗机1' },
|
||||
{ id: 25, name: '清洗机2', img1: '清洗机2' },
|
||||
{ id: 26, name: '清洗机3', img1: '清洗机3' },
|
||||
{ id: 27, name: '清洗机4', img1: '清洗机4' },
|
||||
{ id: 28, name: '清洗机5', img1: '清洗机5' },
|
||||
{ id: 29, name: '盘管下料1', img1: '盘管下料1' },
|
||||
{ id: 30, name: '盘管下料2', img1: '盘管下料2' },
|
||||
{ id: 31, name: '盘管下料3', img1: '盘管下料3' },
|
||||
{ id: 32, name: '直管下料1', img1: '直管下料1' },
|
||||
{ id: 33, name: '直管下料2', img1: '直管下料2' },
|
||||
{ id: 34, name: '直管下料3', img1: '直管下料3' },
|
||||
{ id: 35, name: '激', img1: '激' },
|
||||
{ id: 36, name: '光', img1: '光' },
|
||||
{ id: 37, name: '下', img1: '下' },
|
||||
{ id: 38, name: '料', img1: '料' },
|
||||
{ id: 39, name: '区', img1: '区' },
|
||||
{ id: 40, name: '三', img1: '三' },
|
||||
{ id: 41, name: '一', img1: '一' },
|
||||
{ id: 42, name: '仓', img1: '仓' },
|
||||
{ id: 43, name: '伸', img1: '伸' },
|
||||
{ id: 44, name: '体', img1: '体' },
|
||||
{ id: 45, name: '储', img1: '储' },
|
||||
{ id: 46, name: '刻', img1: '刻' },
|
||||
{ id: 47, name: '加', img1: '加' },
|
||||
{ id: 48, name: '压', img1: '压' },
|
||||
{ id: 49, name: '品', img1: '品' },
|
||||
{ id: 50, name: '孔', img1: '孔' },
|
||||
{ id: 51, name: '字', img1: '字' },
|
||||
{ id: 52, name: '屑', img1: '屑' },
|
||||
{ id: 53, name: '工', img1: '工' },
|
||||
{ id: 54, name: '弯', img1: '弯' },
|
||||
{ id: 55, name: '拉', img1: '拉' },
|
||||
{ id: 56, name: '推', img1: '推' },
|
||||
{ id: 57, name: '旋', img1: '旋' },
|
||||
{ id: 58, name: '无', img1: '无' },
|
||||
{ id: 59, name: '机', img1: '机' },
|
||||
{ id: 60, name: '桶', img1: '桶' },
|
||||
{ id: 61, name: '洗', img1: '洗' },
|
||||
{ id: 62, name: '清', img1: '清' },
|
||||
{ id: 63, name: '盘', img1: '盘' },
|
||||
{ id: 64, name: '码', img1: '码' },
|
||||
{ id: 65, name: '直', img1: '直' },
|
||||
{ id: 66, name: '管', img1: '管' },
|
||||
{ id: 67, name: '包', img1: '包' },
|
||||
{ id: 68, name: '装', img1: '装' },
|
||||
{ id: 69, name: '镗', img1: '镗' }
|
||||
],
|
||||
arr2: [],
|
||||
stageSelectList: [],
|
||||
|
||||