This commit is contained in:
USER-20220102CG\noblelift
2023-03-01 19:48:32 +08:00
20 changed files with 577 additions and 43 deletions

View File

@@ -34,5 +34,11 @@ public class EsLogController {
public ResponseEntity<Object> queryAll(@RequestBody LogQuery query) {
return new ResponseEntity<>(esLogService.query(query), HttpStatus.OK);
}
@DeleteMapping("/clearLogs")
@ApiOperation("清空日志")
public ResponseEntity<Object> clearLogs(@RequestBody LogQuery query) {
esLogService.clearLogs(query);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -12,6 +12,11 @@ import org.nl.modules.logging.service.dto.LogQuery;
* @desc desc
*/
public interface EsLogService {
/**
* 清空日志
*/
void clearLogs(LogQuery query);
/**
* 获取labels和values树
* @return

View File

@@ -1,5 +1,7 @@
package org.nl.modules.logging.service.impl;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
@@ -27,6 +29,7 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.aggregation.impl.AggregatedPageImpl;
import org.springframework.data.elasticsearch.core.query.DeleteQuery;
import org.springframework.data.elasticsearch.core.query.FetchSourceFilter;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.stereotype.Service;
@@ -99,6 +102,20 @@ public class EsLogServiceImpl implements EsLogService {
}
}
@Override
public void clearLogs(LogQuery logQuery) {
String system = logQuery.getSystem();
BoolQueryBuilder query = QueryBuilders.boolQuery();
if (!StringUtils.isEmpty(system)){
query.must().add(QueryBuilders.matchQuery("system", system));
}
long time = DateUtil.offset(new Date(), DateField.DAY_OF_MONTH, -10).getTime();
String script = "doc['@timestamp'].value.millis < " + time + "L";
query.must().add(QueryBuilders.scriptQuery(new Script(script)));
DeleteQuery deleteQuery = new DeleteQuery();
deleteQuery.setQuery(query);
elasticsearchRestTemplate.delete(deleteQuery,new LogRepositoryDTO().getClass());
}
@Override

View File

@@ -1,6 +1,7 @@
package org.nl.wms.ext.mes.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONArray;
@@ -8,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.ext.mes.service.LmsToMesService;
@@ -91,6 +93,25 @@ public class LmsToMesServiceImpl implements LmsToMesService {
return result;
}
//判断母卷对应的设备是否启用,如果启用则回传,未启用则不回传
String iContainerName = param.getString("iContainerName");
//查询该母卷号、设备号对应的生箔工单
JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + iContainerName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("未查询到母卷号:" + iContainerName + "对应的生箔工单!");
}
String resource_name = raw_jo.getString("resource_name");
JSONObject sb_jo = WQLObject.getWQLObject("st_ivt_sbpointivt").query("ext_code ='" + resource_name + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sb_jo)) {
throw new BadRequestException("未查询到母卷号:" + iContainerName + "对应的生箔机台编号!");
}
if (StrUtil.equals("0", sb_jo.getString("is_used"))) {
result.put("status", HttpStatus.OK.value());
result.put("message", "设备:" + sb_jo.getString("point_code") + "未启动!");
result.put("data", new JSONObject());
return result;
}
JSONArray list = new JSONArray();
// String url = acsUrl + api;
@@ -134,6 +155,25 @@ public class LmsToMesServiceImpl implements LmsToMesService {
return result;
}
//判断母卷对应的设备是否启用,如果启用则回传,未启用则不回传
String iContainerName = param.getString("iContainerName");
//查询该母卷号、设备号对应的生箔工单
JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + iContainerName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("未查询到母卷号:" + iContainerName + "对应的生箔工单!");
}
String resource_name = raw_jo.getString("resource_name");
JSONObject sb_jo = WQLObject.getWQLObject("st_ivt_sbpointivt").query("ext_code ='" + resource_name + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sb_jo)) {
throw new BadRequestException("未查询到母卷号:" + iContainerName + "对应的生箔机台编号!");
}
if (StrUtil.equals("0", sb_jo.getString("is_used"))) {
result.put("status", HttpStatus.OK.value());
result.put("message", "设备:" + sb_jo.getString("point_code") + "未启动!");
result.put("data", new JSONObject());
return result;
}
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
String Password = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();

View File

@@ -147,31 +147,34 @@ public class MesToLmsServiceImpl implements MesToLmsService {
JSONObject result = new JSONObject();
try {
String is_mesTolms = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_mesTolms").getValue();
if (StrUtil.equals(is_mesTolms, "1")) {
String ContainerName = param.getString("ContainerName");
String ResourceName = param.getString("ResourceName");
//查询该母卷号、设备号对应的生箔工单
JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + ContainerName + "' AND resource_name = '" + ResourceName + "'").uniqueResult(0);
JSONArray arr = new JSONArray();
String ContainerName = param.getString("ContainerName");
String ResourceName = param.getString("ResourceName");
//查询该母卷号、设备号对应的生箔工单
JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + ContainerName + "' AND resource_name = '" + ResourceName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("未查询到对应的生箔工单!");
}
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("未查询到对应的生箔工单!");
}
JSONArray data = new JSONArray();
//查询对应的设备是否启用
JSONObject jsonPoint = WQLObject.getWQLObject("ST_IVT_SbPointIvt").query("ext_code ='" + ResourceName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonPoint)) {
jsonPoint = new JSONObject();
}
if (StrUtil.equals("1", jsonPoint.getString("is_used"))) {
JSONObject json = new JSONObject();
json.put("ContainerName", raw_jo.getString("container_name"));
json.put("ResourceName", raw_jo.getString("resource_name"));
json.put("Weight", String.format("%.2f", raw_jo.getDoubleValue("productin_qty")));
json.put("WeighDate", DateUtil.now());
data.add(json);
arr.add(json);
}
result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!");
result.put("RTOAL", 1);
result.put("RTDAT", null);
result.put("RTDAT", arr);
System.out.println(result);
} catch (Exception e) {
result.put("RTYPE", "E");
result.put("RTMSG", "操作失败!" + e.getMessage());
@@ -199,16 +202,22 @@ public class MesToLmsServiceImpl implements MesToLmsService {
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表
try {
String is_mesTolms = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_mesTolms").getValue();
if (StrUtil.equals(is_mesTolms, "1")) {
String containerName = param.getString("ContainerName");
String resourceName = param.getString("ResourceName");
if (ObjectUtil.isEmpty(resourceName)) throw new BadRequestException("机台编码不能为空");
if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空");
String containerName = param.getString("ContainerName");
String resourceName = param.getString("ResourceName");
if (ObjectUtil.isEmpty(resourceName)) throw new BadRequestException("机台编码不能为空");
if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空");
JSONObject jsonSb = sbTab.query("ext_code = '" + resourceName + "' and is_used = '1'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("点位设备不存在");
JSONObject jsonSb = sbTab.query("ext_code = '" + resourceName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("点位设备不存在");
if (StrUtil.equals("1", jsonSb.getString("is_used"))) {
//查询该母卷对应的工单状态是否为准备就绪,如果不是则提示报错
// 更新工单状态
JSONObject jsonRaw = rawTab.query("container_name = '" + containerName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonRaw)) throw new BadRequestException("工单不存在");
if (!jsonRaw.getString("status").equals("03")) {
throw new BadRequestException("该生箔工单对应的状态不为准备就绪,不允许确认下卷!");
}
// 下发ACS更改任务状态
JSONArray paramArr = new JSONArray();
JSONObject json = new JSONObject();
@@ -220,10 +229,6 @@ public class MesToLmsServiceImpl implements MesToLmsService {
if (!StrUtil.equals(resultAcs.getString("status"), "200")) {
throw new BadRequestException(resultAcs.getString("message "));
}
// 更新工单状态
JSONObject jsonRaw = rawTab.query("container_name = '" + containerName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonRaw)) throw new BadRequestException("工单不存在");
jsonRaw.put("status", "04");
rawTab.update(jsonRaw);
}
@@ -259,16 +264,28 @@ public class MesToLmsServiceImpl implements MesToLmsService {
JSONObject jsonParam = new JSONObject();
try {
String is_mesTolms = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_mesTolms").getValue();
if (StrUtil.equals(is_mesTolms, "1")) {
String containerName = param.getString("ContainerName"); // 母卷号
String nextSpec = param.getString("NextSpec"); // 下工序1-入烘箱2-入冷却
String bakingTemperature = param.getString("BakingTemperature"); // 温度
String bakingTimer = param.getString("BakingTimer"); // 烘烤时间
String containerName = param.getString("ContainerName"); // 母卷号
String nextSpec = param.getString("NextSpec"); // 下工序1-入烘箱2-入冷却
String bakingTemperature = param.getString("BakingTemperature"); // 温度
String bakingTimer = param.getString("BakingTimer"); // 烘烤时间
if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空");
if (ObjectUtil.isEmpty(nextSpec)) throw new BadRequestException("下工序不能为空");
if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空");
if (ObjectUtil.isEmpty(nextSpec)) throw new BadRequestException("下工序不能为空");
//判断母卷号对应的设备是否启用启用则调度生成任务未启用返回MES成功
String ContainerName = param.getString("ContainerName");
//查询该母卷号、设备号对应的生箔工单
JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + ContainerName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("未查询到对应的生箔工单!");
}
String resource_name = raw_jo.getString("resource_name");
JSONObject sb_jo = WQLObject.getWQLObject("st_ivt_sbpointivt").query("ext_code ='" + resource_name + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sb_jo)) {
throw new BadRequestException("未查询到母卷号:" + ContainerName + "对应的生箔机台编号!");
}
if (StrUtil.equals("1", sb_jo.getString("is_used"))) {
if (StrUtil.equals(nextSpec, "1")) {
/*
* 入烘箱
@@ -675,7 +692,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
if (Status.equals("1")) {
for (int i = 0; i < param.size(); i++) {
JSONObject row = param.getJSONObject(i);
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "'").uniqueResult(0);
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "' AND is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
}
@@ -697,7 +714,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
} else {
for (int i = 0; i < param.size(); i++) {
JSONObject row = param.getJSONObject(i);
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "'").uniqueResult(0);
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "' AND is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
}
@@ -715,7 +732,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
//更新分切计划表状态
for (int i = 0; i < param.size(); i++) {
JSONObject row = param.getJSONObject(i);
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "'").uniqueResult(0);
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "' AND is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
}
@@ -747,7 +764,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
for (int i = 0; i < param.size(); i++) {
JSONObject row = param.getJSONObject(i);
//查询对应的分切计划
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "'").uniqueResult(0);
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "' AND is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
}
@@ -833,6 +850,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
} else {
jo.put("is_last", "1");
}
} else {
jo.put("is_last", "0");
}
} else {
jo.put("is_last", "1");

View File

@@ -55,6 +55,10 @@ public class OutServiceImpl implements OutService {
String point_code = whereJson.getString("point_code");
String is_last = whereJson.getString("is_last");
if (StrUtil.isEmpty(is_last)){
throw new BadRequestException("是否末次下卷不能为空!");
}
JSONArray rows = whereJson.getJSONArray("cut_rows");
if (rows.size() > 2) {

View File

@@ -21,6 +21,7 @@ import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
import org.nl.wms.pda.mps.service.RawFoilService;
import org.nl.wms.sch.service.PointService;
import org.nl.wms.sch.tasks.CallEmpReelTask;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -142,7 +143,11 @@ public class RawFoilServiceImpl implements RawFoilService {
if (!StrUtil.equals(jsonRaw.getString("status"), "01")) throw new BadRequestException("工单状态不为开始");
JSONObject jsonSb = sbTab.query("ext_code = '" + jsonRaw.getString("resource_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("生箔点位不存在");
if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("点位"+jsonRaw.getString("resource_name")+"生箔设备不存在");
if (StrUtil.equals("0", jsonSb.getString("is_used"))) {
throw new BadRequestException("当前生箔机:"+jsonSb.getString("ext_code")+"未启用!");
}
String start_pint_code = "";
String point_code4 = "";
@@ -198,6 +203,10 @@ public class RawFoilServiceImpl implements RawFoilService {
throw new BadRequestException("未查到相关的生箔机点位!");
}
if (StrUtil.equals("0", raw_jo.getString("is_used"))) {
throw new BadRequestException("当前生箔机:"+raw_jo.getString("ext_code")+"未启用!");
}
// 2.根据就近原则查对应空卷抽
JSONObject map = new JSONObject();
map.put("flag", "1");

View File

@@ -274,6 +274,7 @@ public class ProductInstorServiceImpl implements ProductInstorService {
JSONObject param = new JSONObject();
param.put("vehicle_code", vehicle_code);
param.put("weight", whereJson.getString("weight"));
param.put("type", "1");
AcsToWmsServiceImpl bean = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);

View File

@@ -49,7 +49,7 @@
der.STATUS
WHEN '01' THEN '开始'
WHEN '02' THEN '空轴搬出'
WHEN '03' THEN '确认下卷'
WHEN '03' THEN '准备就绪'
WHEN '04' THEN '下卷完成'
WHEN '09' THEN '结束'
END

View File

@@ -382,7 +382,7 @@ public class CutTrussTask extends AbstractAcsTask {
//更新入站气涨轴的分切计划状态
JSONArray plan_jo = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("qzzno = '" + json.getString("vehicle_code") + "' AND is_child_tz_ok = '1' AND is_child_ps_ok = '1' AND is_delete = '0' AND status = '03'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到气涨轴:" + json.getString("vehicle_code") + "对应的分切计划!");
throw new BadRequestException("未查询到状态为入站完成气涨轴:" + json.getString("vehicle_code") + "对应的分切计划!");
}
for (int i = 0; i < plan_jo.size(); i++) {
JSONObject plan_row = plan_jo.getJSONObject(i);
@@ -394,7 +394,7 @@ public class CutTrussTask extends AbstractAcsTask {
//更新出站气涨轴的分切计划状态
JSONArray plan_jo2 = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("qzzno = '" + json.getString("vehicle_code2") + "' AND is_child_tz_ok = '1' AND is_child_ps_ok = '1' AND is_delete = '0' AND status = '05'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(plan_jo2)) {
throw new BadRequestException("未查询到气涨轴:" + json.getString("vehicle_code2") + "对应的分切计划!");
throw new BadRequestException("未查询到状态为入站完成气涨轴:" + json.getString("vehicle_code2") + "对应的分切计划!");
}
for (int i = 0; i < plan_jo2.size(); i++) {
JSONObject plan_row = plan_jo2.getJSONObject(i);

View File

@@ -208,6 +208,8 @@ public class InCoolIvtTask extends AbstractAcsTask {
json.put("acs_task_type","3" );
tab.insert(json);
this.immediateNotifyAcs(null);
return json.getString("task_id");
}

View File

@@ -2,6 +2,66 @@
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.1.3.90:9200/_bulk</url>
<index>${esIndex}</index>
<type>lms_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>lms</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE5" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -23,6 +83,7 @@
<logger name="org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE5"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->

View File

@@ -2,6 +2,66 @@
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.1.3.90:9200/_bulk</url>
<index>${esIndex}</index>
<type>lms_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>lms</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE6" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -23,6 +83,7 @@
<logger name="org.nl.wms.sch.AcsUtil" level="info" additivity="false">
<appender-ref ref="FILE6"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->

View File

@@ -20,9 +20,70 @@
<charset>${log.charset}</charset>
</encoder>
</appender>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.1.3.90:9200/_bulk</url>
<index>${esIndex}</index>
<type>lms_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>lms</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<logger name="org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl" level="info" additivity="false">
<logger name="org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE4"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->

View File

@@ -2,6 +2,66 @@
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.1.3.90:9200/_bulk</url>
<index>${esIndex}</index>
<type>lms_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>lms</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE2" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -23,6 +83,7 @@
<logger name="org.nl.wms.ext.sap.service.impl.LmsToSapServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE2"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->

View File

@@ -2,6 +2,66 @@
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.1.3.90:9200/_bulk</url>
<index>${esIndex}</index>
<type>lms_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>lms</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE3" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -23,6 +83,7 @@
<logger name="org.nl.wms.ext.mes.service.impl.MesToLmsServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE3"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->

View File

@@ -2,6 +2,66 @@
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.1.3.90:9200/_bulk</url>
<index>${esIndex}</index>
<type>lms_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>lms</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE1" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -23,6 +83,7 @@
<logger name="org.nl.wms.ext.sap.service.impl.SapToLmsServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE1"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->

View File

@@ -15,4 +15,12 @@ export function labelsValues(type) {
})
}
export default { getLogData, labelsValues }
export function clearLogs(param) {
return request({
url: '/api/esLog/clearLogs',
method: 'delete',
data: param
})
}
export default { getLogData, labelsValues, clearLogs }

View File

@@ -118,6 +118,14 @@
:step="1"
/>
</el-form-item>
<el-form-item label="总条数">
<el-input
v-model="total"
size="small"
disabled
style="width: 110px"
/>
</el-form-item>
<el-form-item>
<el-dropdown split-button type="primary" size="mini" @click="queryData">
查询
@@ -126,6 +134,9 @@
</el-dropdown-menu>
</el-dropdown>
</el-form-item>
<el-form-item>
<el-button @click="clearLogs">清空日志</el-button>
</el-form-item>
</el-form>
</div>
<!-- <div style="margin: 3px; min-height: 80vh;">
@@ -180,6 +191,7 @@ let queryParam = {
filterSql: true,
isRequest: true,
page: null,
total: 0,
size: 20
}
export default {
@@ -308,6 +320,7 @@ export default {
logOperation.getLogData(queryParam).then(res => {
this.showEmpty = false
this.total = res.total
// 清空
this.logs = []
for (const j in res.records) { // 用push的方式将所有日志数组添加进去
@@ -315,6 +328,50 @@ export default {
}
})
},
clearLogs() {
var message = '您确定要清空'
if (this.system !== '' && this.system !== null) {
message += '标签为:' + this.system + ' '
}
message += '10天前的日志吗 ?'
this.$confirm(message, '确认信息', {
distinguishCancelAndClose: true,
confirmButtonText: '确定',
cancelButtonText: '取消'
})
.then(() => {
// 清空查询数据
this.clearParam()
queryParam.logLevel = this.logLevelValue
const time = new Date()
if (this.timeZoneValue !== '') {
queryParam.startTime = new Date(((time.getTime() - this.timeZoneValue)))
}
if (this.timeRange !== '' && this.timeRange.length > 0) {
queryParam.startTime = this.timeRange[0]
queryParam.endTime = this.timeRange[1]
}
queryParam.message = this.message.replace(/^\s*|\s*$/g, '')
queryParam.traceId = this.traceId
queryParam.system = this.system
logOperation.clearLogs(queryParam).then(res => {
this.queryData()
this.$message({
type: 'info',
message: '清除成功'
})
})
})
.catch(action => {
this.$message({
type: 'info',
message: action === 'cancel'
? '已取消'
: '已取消'
})
})
},
changetype() {
},