diff --git a/wcs/hd/logPath_IS_UNDEFINED/2022-07-04.0.log b/wcs/hd/logPath_IS_UNDEFINED/2022-07-04.0.log new file mode 100644 index 00000000..e69de29b diff --git a/wcs/hd/logPath_IS_UNDEFINED/2022-07-07.0.log b/wcs/hd/logPath_IS_UNDEFINED/2022-07-07.0.log new file mode 100644 index 00000000..e69de29b diff --git a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/common/AbstractDriverService.java b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/common/AbstractDriverService.java index 95a1c4f2..25ececae 100644 --- a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/common/AbstractDriverService.java +++ b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/common/AbstractDriverService.java @@ -18,6 +18,29 @@ public class AbstractDriverService 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 { diff --git a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/common/HailiangPackerStationDevice.java b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/common/HailiangPackerStationDevice.java index 5c8b32bb..0e162423 100644 --- a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/common/HailiangPackerStationDevice.java +++ b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/common/HailiangPackerStationDevice.java @@ -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); + } } diff --git a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/common/IDriverService.java b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/common/IDriverService.java index ee1a1ca7..ba7a36bc 100644 --- a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/common/IDriverService.java +++ b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/common/IDriverService.java @@ -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); } diff --git a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_packer_station/HailiangPackerStationDeviceDriver.java b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_packer_station/HailiangPackerStationDeviceDriver.java index 9949577e..92f9f289 100644 --- a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_packer_station/HailiangPackerStationDeviceDriver.java +++ b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_packer_station/HailiangPackerStationDeviceDriver.java @@ -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)) { diff --git a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java index 72ee3f85..d45d192b 100644 --- a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java +++ b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java @@ -84,4 +84,11 @@ public class WmsToAcsController { return new ResponseEntity<>(wmstoacsService.orderStatusUpdate(whereJson), HttpStatus.OK); } + @PostMapping("/queryDeviceDBValue") + @Log("查询设备DB值") + @ApiOperation("查询设备DB值") + public ResponseEntity queryDeviceDBValue(@RequestBody String whereJson){ + return new ResponseEntity<>(wmstoacsService.queryDeviceDBValue(whereJson), HttpStatus.OK); + } + } diff --git a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java index 2b60b2c9..4c001b2d 100644 --- a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java +++ b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java @@ -68,4 +68,12 @@ public interface WmsToAcsService { * @return */ Map orderStatusUpdate(String whereJson); + + /** + * 查询设备DB值 + * @param whereJson + * @return + */ + Map queryDeviceDBValue(String whereJson); + } diff --git a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 5495b0a3..1b4236ed 100644 --- a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -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 list = DeviceService.findCacheDevice(); + List 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 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 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; + } + } diff --git a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceExtraManageDto.java b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceExtraManageDto.java index d9f0b6cb..8589dd72 100644 --- a/wcs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceExtraManageDto.java +++ b/wcs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceExtraManageDto.java @@ -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; diff --git a/wcs/hd/nladmin-system/src/main/java/org/nl/modules/log/MongoDBAppender.java b/wcs/hd/nladmin-system/src/main/java/org/nl/modules/log/MongoDBAppender.java deleted file mode 100644 index 6af3945f..00000000 --- a/wcs/hd/nladmin-system/src/main/java/org/nl/modules/log/MongoDBAppender.java +++ /dev/null @@ -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 { - 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; - } - -} diff --git a/wcs/hd/nladmin-system/src/main/java/org/nl/modules/log/MongoDBAppenderBase.java b/wcs/hd/nladmin-system/src/main/java/org/nl/modules/log/MongoDBAppenderBase.java index 4abc90fe..886a6b31 100644 --- a/wcs/hd/nladmin-system/src/main/java/org/nl/modules/log/MongoDBAppenderBase.java +++ b/wcs/hd/nladmin-system/src/main/java/org/nl/modules/log/MongoDBAppenderBase.java @@ -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/ + *

+ * https://cloud.tencent.com/developer/article/1384035 */ @Data -public abstract class MongoDBAppenderBase extends UnsynchronizedAppenderBase { - private MongoClient mongo; - MongoDatabase db; - private MongoCollection 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 extends UnsynchronizedAppenderBase { @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(); - } } diff --git a/wcs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCleanUpLogs.java b/wcs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCleanUpLogs.java index aabf37ea..c86b0492 100644 --- a/wcs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCleanUpLogs.java +++ b/wcs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCleanUpLogs.java @@ -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) { diff --git a/wcs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/CleanUpThread.java b/wcs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/CleanUpThread.java new file mode 100644 index 00000000..4994a5f4 --- /dev/null +++ b/wcs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/CleanUpThread.java @@ -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+"设备日志清除成功---------------------"); + } +} diff --git a/wcs/hd/nladmin-system/src/main/resources/log/AcsToErp.xml b/wcs/hd/nladmin-system/src/main/resources/log/AcsToErp.xml index 46f3bc91..da17ef54 100644 --- a/wcs/hd/nladmin-system/src/main/resources/log/AcsToErp.xml +++ b/wcs/hd/nladmin-system/src/main/resources/log/AcsToErp.xml @@ -1,10 +1,7 @@ - - acs_log - acs_to_erp - ${CONTEXT_NAME} + info diff --git a/wcs/hd/nladmin-system/src/main/resources/log/AcsToWms.xml b/wcs/hd/nladmin-system/src/main/resources/log/AcsToWms.xml index 6ba12f1d..c1d195c9 100644 --- a/wcs/hd/nladmin-system/src/main/resources/log/AcsToWms.xml +++ b/wcs/hd/nladmin-system/src/main/resources/log/AcsToWms.xml @@ -1,10 +1,7 @@ - - acs_log - acs_to_wms - ${CONTEXT_NAME} + info diff --git a/wcs/hd/nladmin-system/src/main/resources/log/AgvFeedbackServiceImpl.xml b/wcs/hd/nladmin-system/src/main/resources/log/AgvFeedbackServiceImpl.xml index c236d0c3..1edd79ea 100644 --- a/wcs/hd/nladmin-system/src/main/resources/log/AgvFeedbackServiceImpl.xml +++ b/wcs/hd/nladmin-system/src/main/resources/log/AgvFeedbackServiceImpl.xml @@ -1,10 +1,7 @@ - - acs_log - agv_feedback_servlet - ${CONTEXT_NAME} + info diff --git a/wcs/hd/nladmin-system/src/main/resources/log/AgvLeaveServlet.xml b/wcs/hd/nladmin-system/src/main/resources/log/AgvLeaveServlet.xml index 3c9d096f..ee95ac94 100644 --- a/wcs/hd/nladmin-system/src/main/resources/log/AgvLeaveServlet.xml +++ b/wcs/hd/nladmin-system/src/main/resources/log/AgvLeaveServlet.xml @@ -1,10 +1,7 @@ - - acs_log - agv_leave_servlet - ${CONTEXT_NAME} + info diff --git a/wcs/hd/nladmin-system/src/main/resources/log/AutoCreateInst.xml b/wcs/hd/nladmin-system/src/main/resources/log/AutoCreateInst.xml index 31174211..27068485 100644 --- a/wcs/hd/nladmin-system/src/main/resources/log/AutoCreateInst.xml +++ b/wcs/hd/nladmin-system/src/main/resources/log/AutoCreateInst.xml @@ -1,10 +1,7 @@ - - acs_log - auto_create_inst - ${CONTEXT_NAME} + info diff --git a/wcs/hd/nladmin-system/src/main/resources/log/NDCSocketConnectionAutoRun.xml b/wcs/hd/nladmin-system/src/main/resources/log/NDCSocketConnectionAutoRun.xml index e908af73..f674ced5 100644 --- a/wcs/hd/nladmin-system/src/main/resources/log/NDCSocketConnectionAutoRun.xml +++ b/wcs/hd/nladmin-system/src/main/resources/log/NDCSocketConnectionAutoRun.xml @@ -1,10 +1,7 @@ - - acs_log - ndc_socket_connection_autorun - ${CONTEXT_NAME} + info diff --git a/wcs/hd/nladmin-system/src/main/resources/log/QueryAgvTaskStatus.xml b/wcs/hd/nladmin-system/src/main/resources/log/QueryAgvTaskStatus.xml index 565a189d..90846b44 100644 --- a/wcs/hd/nladmin-system/src/main/resources/log/QueryAgvTaskStatus.xml +++ b/wcs/hd/nladmin-system/src/main/resources/log/QueryAgvTaskStatus.xml @@ -1,10 +1,7 @@ - - acs_log - agv_task_status - ${CONTEXT_NAME} + info diff --git a/wcs/hd/nladmin-system/src/main/resources/log/QueryXZAgvTaskStatus.xml b/wcs/hd/nladmin-system/src/main/resources/log/QueryXZAgvTaskStatus.xml index 4dd0141d..3ec70a11 100644 --- a/wcs/hd/nladmin-system/src/main/resources/log/QueryXZAgvTaskStatus.xml +++ b/wcs/hd/nladmin-system/src/main/resources/log/QueryXZAgvTaskStatus.xml @@ -1,10 +1,7 @@ - - acs_log - xz_agv_task_status - ${CONTEXT_NAME} + info diff --git a/wcs/hd/nladmin-system/src/main/resources/log/WmsToAcs.xml b/wcs/hd/nladmin-system/src/main/resources/log/WmsToAcs.xml index 51e95e93..386c33cc 100644 --- a/wcs/hd/nladmin-system/src/main/resources/log/WmsToAcs.xml +++ b/wcs/hd/nladmin-system/src/main/resources/log/WmsToAcs.xml @@ -1,10 +1,7 @@ - - acs_log - wms_to_acs - ${CONTEXT_NAME} + info diff --git a/wcs/hd/nladmin-system/src/main/resources/logback-spring.xml b/wcs/hd/nladmin-system/src/main/resources/logback-spring.xml index 307dbb46..4a5a305e 100644 --- a/wcs/hd/nladmin-system/src/main/resources/logback-spring.xml +++ b/wcs/hd/nladmin-system/src/main/resources/logback-spring.xml @@ -57,14 +57,7 @@ https://juejin.cn/post/6844903775631572999 --> - - 192.168.46.225 - 27017 - - acs_log - default - ${CONTEXT_NAME} + info diff --git a/wcs/qd/src/assets/acs/三通一体机.png b/wcs/qd/src/assets/acs/三通一体机.png new file mode 100644 index 00000000..d21399b5 Binary files /dev/null and b/wcs/qd/src/assets/acs/三通一体机.png differ diff --git a/wcs/qd/src/assets/acs/储料仓.png b/wcs/qd/src/assets/acs/储料仓.png new file mode 100644 index 00000000..9ebef5bb Binary files /dev/null and b/wcs/qd/src/assets/acs/储料仓.png differ diff --git a/wcs/qd/src/assets/acs/刻字机.png b/wcs/qd/src/assets/acs/刻字机.png new file mode 100644 index 00000000..2efb8a9b Binary files /dev/null and b/wcs/qd/src/assets/acs/刻字机.png differ diff --git a/wcs/qd/src/assets/acs/包装机1.png b/wcs/qd/src/assets/acs/包装机1.png new file mode 100644 index 00000000..7cb6a898 Binary files /dev/null and b/wcs/qd/src/assets/acs/包装机1.png differ diff --git a/wcs/qd/src/assets/acs/包装机2.png b/wcs/qd/src/assets/acs/包装机2.png new file mode 100644 index 00000000..5eef3e0c Binary files /dev/null and b/wcs/qd/src/assets/acs/包装机2.png differ diff --git a/wcs/qd/src/assets/acs/包装机3.png b/wcs/qd/src/assets/acs/包装机3.png new file mode 100644 index 00000000..0fe952c0 Binary files /dev/null and b/wcs/qd/src/assets/acs/包装机3.png differ diff --git a/wcs/qd/src/assets/acs/包装机4.png b/wcs/qd/src/assets/acs/包装机4.png new file mode 100644 index 00000000..968073df Binary files /dev/null and b/wcs/qd/src/assets/acs/包装机4.png differ diff --git a/wcs/qd/src/assets/acs/推弯成型1.png b/wcs/qd/src/assets/acs/推弯成型1.png new file mode 100644 index 00000000..f08d70d0 Binary files /dev/null and b/wcs/qd/src/assets/acs/推弯成型1.png differ diff --git a/wcs/qd/src/assets/acs/推弯成型2.png b/wcs/qd/src/assets/acs/推弯成型2.png new file mode 100644 index 00000000..c57183de Binary files /dev/null and b/wcs/qd/src/assets/acs/推弯成型2.png differ diff --git a/wcs/qd/src/assets/acs/推弯成型3.png b/wcs/qd/src/assets/acs/推弯成型3.png new file mode 100644 index 00000000..116ba7a4 Binary files /dev/null and b/wcs/qd/src/assets/acs/推弯成型3.png differ diff --git a/wcs/qd/src/assets/acs/清洗机1.png b/wcs/qd/src/assets/acs/清洗机1.png new file mode 100644 index 00000000..6f85780a Binary files /dev/null and b/wcs/qd/src/assets/acs/清洗机1.png differ diff --git a/wcs/qd/src/assets/acs/清洗机2.png b/wcs/qd/src/assets/acs/清洗机2.png new file mode 100644 index 00000000..1bca582c Binary files /dev/null and b/wcs/qd/src/assets/acs/清洗机2.png differ diff --git a/wcs/qd/src/assets/acs/清洗机3.png b/wcs/qd/src/assets/acs/清洗机3.png new file mode 100644 index 00000000..99ed875a Binary files /dev/null and b/wcs/qd/src/assets/acs/清洗机3.png differ diff --git a/wcs/qd/src/assets/acs/清洗机4.png b/wcs/qd/src/assets/acs/清洗机4.png new file mode 100644 index 00000000..f44b4bf9 Binary files /dev/null and b/wcs/qd/src/assets/acs/清洗机4.png differ diff --git a/wcs/qd/src/assets/acs/清洗机5.png b/wcs/qd/src/assets/acs/清洗机5.png new file mode 100644 index 00000000..e45c2874 Binary files /dev/null and b/wcs/qd/src/assets/acs/清洗机5.png differ diff --git a/wcs/qd/src/assets/acs/盘管下料1.png b/wcs/qd/src/assets/acs/盘管下料1.png new file mode 100644 index 00000000..10320952 Binary files /dev/null and b/wcs/qd/src/assets/acs/盘管下料1.png differ diff --git a/wcs/qd/src/assets/acs/盘管下料2.png b/wcs/qd/src/assets/acs/盘管下料2.png new file mode 100644 index 00000000..08b33f3c Binary files /dev/null and b/wcs/qd/src/assets/acs/盘管下料2.png differ diff --git a/wcs/qd/src/assets/acs/盘管下料3.png b/wcs/qd/src/assets/acs/盘管下料3.png new file mode 100644 index 00000000..44555b1e Binary files /dev/null and b/wcs/qd/src/assets/acs/盘管下料3.png differ diff --git a/wcs/qd/src/assets/acs/直管下料1.png b/wcs/qd/src/assets/acs/直管下料1.png new file mode 100644 index 00000000..38bd2804 Binary files /dev/null and b/wcs/qd/src/assets/acs/直管下料1.png differ diff --git a/wcs/qd/src/assets/acs/直管下料2.png b/wcs/qd/src/assets/acs/直管下料2.png new file mode 100644 index 00000000..e99f90c3 Binary files /dev/null and b/wcs/qd/src/assets/acs/直管下料2.png differ diff --git a/wcs/qd/src/assets/acs/直管下料3.png b/wcs/qd/src/assets/acs/直管下料3.png new file mode 100644 index 00000000..44555b1e Binary files /dev/null and b/wcs/qd/src/assets/acs/直管下料3.png differ diff --git a/wcs/qd/src/views/acs/stage/editor/index.vue b/wcs/qd/src/views/acs/stage/editor/index.vue index 52c7a8b5..b915a4ea 100644 --- a/wcs/qd/src/views/acs/stage/editor/index.vue +++ b/wcs/qd/src/views/acs/stage/editor/index.vue @@ -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: [],