Merge branch 'master' of http://121.40.234.130:8899/root/lanzhouhailiang_one
This commit is contained in:
@@ -12,6 +12,7 @@ import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactor
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
@@ -36,6 +37,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@EnableMethodCache(basePackages = "org.nl")
|
||||
@EnableCreateCacheAnnotation
|
||||
@MapperScan("org.nl.**.mapper")
|
||||
//@EnableElasticsearchRepositories(basePackages = {"org.nl.modules.logging.repository.*"})
|
||||
public class AppRun {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
104
lms/nladmin-system/src/main/java/org/nl/ElasticSearchTest.java
Normal file
104
lms/nladmin-system/src/main/java/org/nl/ElasticSearchTest.java
Normal file
@@ -0,0 +1,104 @@
|
||||
package org.nl;
|
||||
|
||||
|
||||
import org.apache.http.HttpHost;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.MatchQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.index.query.RangeQueryBuilder;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ElasticSearchTest {
|
||||
|
||||
public final String ES_URL = "127.0.0.1";
|
||||
|
||||
public final int ES_PORT = 9200;
|
||||
|
||||
|
||||
public static RestHighLevelClient getClientConnection() {
|
||||
|
||||
RestHighLevelClient client = new RestHighLevelClient(
|
||||
RestClient.builder(
|
||||
new HttpHost("localhost", 9200, "http")
|
||||
)
|
||||
);
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
public static void searchById() throws IOException {
|
||||
RestHighLevelClient client = getClientConnection();
|
||||
GetRequest getRequest = null;//new GetRequest("gateway_log", "DceJqGwBqlIig5BB05Z-");
|
||||
GetResponse getResponse = client.get(getRequest, RequestOptions.DEFAULT);
|
||||
System.out.println(getResponse.getSourceAsString());
|
||||
client.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-search.html
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void paginationSearch() throws IOException {
|
||||
|
||||
SearchRequest searchRequest = new SearchRequest();
|
||||
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
|
||||
sourceBuilder.query(QueryBuilders.matchPhraseQuery("eventType", "WAN_ONOFF"));
|
||||
sourceBuilder.from(0);
|
||||
sourceBuilder.size(1);
|
||||
sourceBuilder.timeout(new TimeValue(1000));
|
||||
sourceBuilder.trackTotalHits(true);
|
||||
searchRequest.source(sourceBuilder);
|
||||
|
||||
|
||||
RestHighLevelClient client = getClientConnection();
|
||||
SearchResponse response = client.search(new SearchRequest("gateway_log")
|
||||
.source(sourceBuilder), RequestOptions.DEFAULT);
|
||||
|
||||
System.out.println(response.toString());
|
||||
client.close();
|
||||
}
|
||||
|
||||
public static void paginationSearch2() throws IOException {
|
||||
RestHighLevelClient client = getClientConnection();
|
||||
|
||||
|
||||
BoolQueryBuilder boolQuery = new BoolQueryBuilder();
|
||||
|
||||
RangeQueryBuilder rangeQuery= QueryBuilders.rangeQuery("count").gte(8);
|
||||
boolQuery.filter(rangeQuery);
|
||||
|
||||
MatchQueryBuilder matchQuery = new MatchQueryBuilder("eventType", "WAN_ONOFF");
|
||||
boolQuery.must(matchQuery);
|
||||
|
||||
SearchResponse response = client.search(new SearchRequest("gateway_log")
|
||||
.source(new SearchSourceBuilder()
|
||||
.query(boolQuery)
|
||||
.from(0)
|
||||
.size(2)
|
||||
.trackTotalHits(true)
|
||||
), RequestOptions.DEFAULT);
|
||||
|
||||
System.out.println(response.getHits().getTotalHits());
|
||||
System.out.println(response.toString());
|
||||
client.close();
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
//searchById();
|
||||
//paginationSearch();
|
||||
paginationSearch2();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.nl.common.enums;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public enum LevelEnum{
|
||||
DEBUG,
|
||||
INFO,
|
||||
WARN,
|
||||
ERROR;
|
||||
public static LevelEnum checkLevel(String level){
|
||||
if (!StringUtils.isEmpty(level)){
|
||||
for (LevelEnum value : LevelEnum.values()) {
|
||||
if (value.name().equals(level)){
|
||||
return value;
|
||||
};
|
||||
}
|
||||
}
|
||||
return LevelEnum.DEBUG;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.nl.common.utils;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/2/9 2:54 下午
|
||||
*/
|
||||
public class BaseCode {
|
||||
|
||||
static final char[] MySerials = new char[]{
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
|
||||
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p','q','r','s','t','u','v','w','x','y','z',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
||||
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P','Q','R','S','T','U','V','W','X','Y','Z'};
|
||||
|
||||
|
||||
public static final String intToChars(long n){
|
||||
String s = "";
|
||||
if (n == 0) {
|
||||
s = "0";
|
||||
}
|
||||
while (n != 0) {
|
||||
int i = (int) (n % MySerials.length);
|
||||
char c = MySerials[i];
|
||||
s = c + s;
|
||||
n = n / MySerials.length;
|
||||
}
|
||||
for (int x = s.length();x<5;x++){
|
||||
s="0"+s;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.nl.common.utils.BaseCode;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.utils.RequestHolder;
|
||||
@@ -35,6 +36,8 @@ import org.nl.modules.common.utils.ThrowableUtil;
|
||||
import org.nl.modules.logging.domain.Log;
|
||||
import org.nl.modules.logging.service.LogService;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -53,52 +56,40 @@ import java.util.*;
|
||||
@Slf4j
|
||||
public class LogAspect {
|
||||
|
||||
private final LogService logService;
|
||||
@Autowired
|
||||
private LogService logService;
|
||||
|
||||
ThreadLocal<Long> currentTime = new ThreadLocal<>();
|
||||
|
||||
public LogAspect(LogService logService) {
|
||||
this.logService = logService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置切入点
|
||||
*/
|
||||
@Pointcut("@annotation(org.nl.modules.logging.annotation.Log)")
|
||||
public void logPointcut() {
|
||||
// 该方法无方法体,主要为了让同类中其他方法使用此切入点
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置环绕通知,使用在方法logPointcut()上注册的切入点
|
||||
*
|
||||
* @param joinPoint join point for advice
|
||||
*/
|
||||
@Around("logPointcut()")
|
||||
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
String trackId = UUID.randomUUID().toString();
|
||||
@Around("@annotation(logInfo)")
|
||||
public Object logAround(ProceedingJoinPoint joinPoint,org.nl.modules.logging.annotation.Log logInfo) throws Throwable {
|
||||
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
// 方法路径
|
||||
String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()";
|
||||
String params = getParameter(method, joinPoint.getArgs());
|
||||
|
||||
org.nl.modules.logging.annotation.Log logInfo = method.getAnnotation(org.nl.modules.logging.annotation.Log.class);
|
||||
|
||||
//是否输出到日志文件
|
||||
if (logInfo.isPrintToLogFile()) {
|
||||
log.info("track_id:{},请求方法:{},请求方法参数:{}",trackId,methodName,params);
|
||||
}
|
||||
HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||
String url = request.getRequestURI();
|
||||
String requestIp = StringUtils.getIp(request);
|
||||
Object result;
|
||||
currentTime.set(System.currentTimeMillis());
|
||||
|
||||
MDC.put("requestMethod",url);
|
||||
MDC.put("requestIp", StringUtils.getIp(request));
|
||||
MDC.put("traceId", BaseCode.intToChars(IdUtil.getLongId()));
|
||||
MDC.put("requestTime", DateUtil.now());
|
||||
|
||||
Object result = null;
|
||||
long comming = System.currentTimeMillis();
|
||||
try {
|
||||
log.info("[--request--][请求接口:{}][请求参数:{}]",url,params);
|
||||
result = joinPoint.proceed();
|
||||
//是否把日志存到日志表
|
||||
if (logInfo.isAddLogTable()) {
|
||||
Log log = new Log("INFO", System.currentTimeMillis() - currentTime.get());
|
||||
currentTime.remove();
|
||||
Log log = new Log("INFO", System.currentTimeMillis() - comming);
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), requestIp, joinPoint, log);
|
||||
}
|
||||
if (logInfo.isInterfaceLog()) {
|
||||
@@ -112,25 +103,41 @@ public class LogAspect {
|
||||
json.put("method", methodName);
|
||||
json.put("params", getParameter(method, joinPoint.getArgs()));
|
||||
json.put("request_ip", StringUtils.getIp(request));
|
||||
json.put("time", System.currentTimeMillis() - currentTime.get());
|
||||
json.put("time", System.currentTimeMillis() - comming);
|
||||
json.put("username", getUsername());
|
||||
json.put("address", StringUtils.getCityInfo(requestIp));
|
||||
json.put("browser", StringUtils.getBrowser(request));
|
||||
json.put("exception_detail", IdUtil.getStringId());
|
||||
json.put("create_time", DateUtil.now());
|
||||
json.put("return_result", JSONObject.parse(result.toString()));
|
||||
Object parse = JSONObject.parse(result.toString());
|
||||
json.put("return_result", parse);
|
||||
interfaceLog.insert(json);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
}catch (Exception ex){
|
||||
log.error("track_id:{},error:{}",trackId,ex.getMessage());
|
||||
Log log = new Log("ERROR", System.currentTimeMillis() - currentTime.get());
|
||||
currentTime.remove();
|
||||
StringBuffer errorInfo = new StringBuffer();
|
||||
errorInfo.append(ex.getMessage()).append("\n");
|
||||
int x = 0;
|
||||
StackTraceElement[] stackTrace = ex.getStackTrace();
|
||||
if (stackTrace!=null && stackTrace.length>0){
|
||||
errorInfo.append("---堆栈信息:");
|
||||
for (StackTraceElement stack : stackTrace) {
|
||||
x++;
|
||||
errorInfo.append(stack.toString()).append("\n");
|
||||
if (x>10){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("[--requestError--][请求接口:{}][请求参数:{}]【异常信息 :{}】", url,params, errorInfo.toString());
|
||||
Log log = new Log("ERROR", System.currentTimeMillis() - comming);
|
||||
log.setExceptionDetail(ThrowableUtil.getStackTrace(ex).getBytes());
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint) joinPoint, log);
|
||||
throw ex;
|
||||
}finally {
|
||||
log.info("[--response--][接口:{} 执行结束][耗时:{}s]",url,(System.currentTimeMillis() - comming)/1000);
|
||||
MDC.clear();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -165,21 +172,6 @@ public class LogAspect {
|
||||
return argList.size() == 1 ? JSONUtil.toJsonStr(argList.get(0)) : JSONUtil.toJsonStr(argList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置异常通知
|
||||
*
|
||||
* @param joinPoint join point for advice
|
||||
* @param e exception
|
||||
*/
|
||||
// @AfterThrowing(pointcut = "logPointcut()", throwing = "e")
|
||||
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
|
||||
Log log = new Log("ERROR", System.currentTimeMillis() - currentTime.get());
|
||||
currentTime.remove();
|
||||
log.setExceptionDetail(ThrowableUtil.getStackTrace(e).getBytes());
|
||||
HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint) joinPoint, log);
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
try {
|
||||
return SecurityUtils.getCurrentUsername();
|
||||
@@ -187,4 +179,7 @@ public class LogAspect {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.nl.modules.logging.repository;
|
||||
|
||||
import org.nl.modules.logging.service.dto.LogRepositoryDTO;
|
||||
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/2/8 4:11 下午
|
||||
*/
|
||||
@Repository
|
||||
public interface EsLogRepository extends ElasticsearchRepository<LogRepositoryDTO, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.nl.modules.logging.rest;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.service.EsLogService;
|
||||
import org.nl.modules.logging.service.dto.LogQuery;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @version 1.0
|
||||
* @date 2023年01月29日 18:55
|
||||
* @desc desc
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/esLog")
|
||||
public class EsLogController {
|
||||
private final EsLogService esLogService;
|
||||
|
||||
|
||||
@GetMapping("/labels")
|
||||
@ApiOperation("获取标签")
|
||||
public ResponseEntity<Object> labelsValues() {
|
||||
return new ResponseEntity<>(esLogService.getLabelsValues(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/query")
|
||||
@ApiOperation("日志查询")
|
||||
public ResponseEntity<Object> queryAll(@RequestBody LogQuery query) {
|
||||
return new ResponseEntity<>(esLogService.query(query), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.nl.modules.logging.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.service.dto.LogQuery;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @version 1.0
|
||||
* @date 2023年02月07日 14:34
|
||||
* @desc desc
|
||||
*/
|
||||
public interface EsLogService {
|
||||
/**
|
||||
* 获取labels和values树
|
||||
* @return
|
||||
*/
|
||||
JSONArray getLabelsValues();
|
||||
|
||||
/**
|
||||
* 日志查询
|
||||
* @param logQuery
|
||||
* @return
|
||||
*/
|
||||
Page query(LogQuery logQuery);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.nl.modules.logging.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/2/8 5:18 下午
|
||||
*/
|
||||
@Data
|
||||
public class LogQuery {
|
||||
/**
|
||||
* 创建时间范围查询
|
||||
*/
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
/**
|
||||
* 追踪id
|
||||
*/
|
||||
private String traceId;
|
||||
/**
|
||||
* 日志内容模糊匹配
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 日志级别
|
||||
*/
|
||||
private String logLevel;
|
||||
/**
|
||||
* 是否只查询Http相关请求
|
||||
*/
|
||||
private Boolean isRequest = Boolean.TRUE;
|
||||
/**
|
||||
* 是否过滤wql日志
|
||||
*/
|
||||
private Boolean filterSql = Boolean.TRUE;
|
||||
|
||||
private Integer size = 20;
|
||||
|
||||
private Integer page = 1;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.nl.modules.logging.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.elasticsearch.annotations.Document;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/2/8 4:06 下午
|
||||
*/
|
||||
@Document(indexName = "lms_log", type = "lms_log")
|
||||
@Data
|
||||
public class LogRepositoryDTO {
|
||||
|
||||
private String message;
|
||||
private String host;
|
||||
private String logLevel;
|
||||
private String logger;
|
||||
private String requestTime;
|
||||
private String requestIp;
|
||||
@Id
|
||||
private String id;
|
||||
private String traceId;
|
||||
private String requestMethod;
|
||||
private String thread;
|
||||
private String system;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package org.nl.modules.logging.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.enums.LevelEnum;
|
||||
import org.nl.modules.logging.repository.EsLogRepository;
|
||||
import org.nl.modules.logging.service.EsLogService;
|
||||
import org.nl.modules.logging.service.dto.LogQuery;
|
||||
import org.nl.modules.logging.service.dto.LogRepositoryDTO;
|
||||
import org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.elasticsearch.core.aggregation.impl.AggregatedPageImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @version 1.0
|
||||
* @date 2023年02月07日 14:35
|
||||
* @desc desc
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EsLogServiceImpl implements EsLogService {
|
||||
|
||||
private final EsLogRepository esLogRepository;
|
||||
|
||||
@Override
|
||||
public Page query(LogQuery logQuery){
|
||||
Page<T> page = new Page<>();
|
||||
if (logQuery != null){
|
||||
BoolQueryBuilder query = QueryBuilders.boolQuery(); //requestMethod
|
||||
extractedParam(logQuery, query);
|
||||
Iterable<LogRepositoryDTO> all = esLogRepository.search(query, PageRequest.of(logQuery.getPage()-1,logQuery.getSize(), Sort.by("@timestamp").descending()));
|
||||
page.setRecords(((AggregatedPageImpl) all).getContent());
|
||||
page.setTotal(((AggregatedPageImpl) all).getTotalElements());
|
||||
page.setPages(logQuery.getPage());
|
||||
page.setSize(logQuery.getSize());
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
private void extractedParam(LogQuery logQuery, BoolQueryBuilder query) {
|
||||
if (StringUtils.isNotEmpty(logQuery.getLogLevel())){
|
||||
query.must().add(QueryBuilders.matchQuery("logLevel", LevelEnum.checkLevel(logQuery.getLogLevel())));
|
||||
}
|
||||
if (logQuery.getIsRequest()){
|
||||
query.must().add(QueryBuilders.existsQuery("requestMethod"));
|
||||
}
|
||||
if (logQuery.getFilterSql()){
|
||||
query.mustNot().add(QueryBuilders.wildcardQuery("logger","org.nl.modules.wql.core.engine.*"));
|
||||
}
|
||||
query.mustNot().add(QueryBuilders.matchPhraseQuery("logger","org.elasticsearch.client.RestClient"));
|
||||
if (StringUtils.isNotEmpty(logQuery.getTraceId())){
|
||||
query.must().add(QueryBuilders.matchQuery("traceId", logQuery.getTraceId()));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(logQuery.getMessage())){
|
||||
query.must().add(QueryBuilders.matchQuery("message", logQuery.getMessage()).minimumShouldMatch("80%"));
|
||||
}
|
||||
if (logQuery.getEndTime()!=null ){
|
||||
String script = "doc['@timestamp'].value.millis < " + logQuery.getEndTime().getTime() + "L";
|
||||
query.must().add(QueryBuilders.scriptQuery(new Script(script)));
|
||||
}
|
||||
if (logQuery.getStartTime()!=null){
|
||||
String script = "doc['@timestamp'].value.millis > " + logQuery.getStartTime().getTime() + "L";
|
||||
query.must().add(QueryBuilders.scriptQuery(new Script(script)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public JSONArray getLabelsValues() {
|
||||
JSONArray result = new JSONArray();
|
||||
for (LevelEnum value : LevelEnum.values()) {
|
||||
JSONObject level = new JSONObject();
|
||||
level.put("label", value.name());
|
||||
level.put("value", value.name());
|
||||
result.add(level);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -56,8 +56,6 @@ public class ExecutionJob extends QuartzJobBean {
|
||||
logDto.setCronExpression(quartzJob.getCronExpression());
|
||||
try {
|
||||
// 执行任务
|
||||
System.out.println("--------------------------------------------------------------");
|
||||
System.out.println("任务开始执行,任务名称:" + quartzJob.getJobName());
|
||||
QuartzRunnable task = new QuartzRunnable(quartzJob.getBeanName(), quartzJob.getMethodName(),
|
||||
quartzJob.getParams());
|
||||
Future<?> future = EXECUTOR.submit(task);
|
||||
@@ -69,8 +67,6 @@ public class ExecutionJob extends QuartzJobBean {
|
||||
}
|
||||
// 任务状态
|
||||
logDto.setIsSuccess(true);
|
||||
System.out.println("任务执行完毕,任务名称:" + quartzJob.getJobName() + ", 执行时间:" + times + "毫秒");
|
||||
System.out.println("--------------------------------------------------------------");
|
||||
// 判断是否存在子任务
|
||||
if (StrUtil.isNotEmpty(quartzJob.getSubTask())) {
|
||||
String[] tasks = quartzJob.getSubTask().split("[,,]");
|
||||
@@ -81,8 +77,6 @@ public class ExecutionJob extends QuartzJobBean {
|
||||
if (StrUtil.isNotEmpty(uuid)) {
|
||||
redisUtils.set(uuid, false);
|
||||
}
|
||||
System.out.println("任务执行失败,任务名称:" + quartzJob.getJobName());
|
||||
System.out.println("--------------------------------------------------------------");
|
||||
long times = System.currentTimeMillis() - startTime;
|
||||
logDto.setTime(times);
|
||||
// 任务状态 0:成功 1:失败
|
||||
@@ -95,7 +89,7 @@ public class ExecutionJob extends QuartzJobBean {
|
||||
quartzJobService.updateIsPause(quartzJob);
|
||||
}
|
||||
//异常时候打印日志
|
||||
log.info(logDto.toString());
|
||||
log.error(logDto.toString());
|
||||
quartzLogMapper.insert(logDto);
|
||||
} finally {
|
||||
|
||||
|
||||
@@ -395,12 +395,21 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
if (ObjectUtil.isEmpty(joArr)) {
|
||||
//查询新的一排
|
||||
JSONObject point_jo = WQL.getWO("QST_ACSTOLMSTYPE4").addParam("flag", "3").process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point_jo)) {
|
||||
JSONArray rowArr = WQL.getWO("QST_ACSTOLMSTYPE4").addParam("flag", "3").process().getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(rowArr)) {
|
||||
throw new BadRequestException("未查询到相同销售订单的放货区点位或空的一排!");
|
||||
} else {
|
||||
JSONObject jsonNewRow = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' order by out_order_seq ASC").uniqueResult(0);
|
||||
point_code = jsonNewRow.getString("point_code");
|
||||
for (int i = 0; i < rowArr.size(); i++) {
|
||||
JSONObject point_jo = rowArr.getJSONObject(i);
|
||||
|
||||
JSONArray pointArr = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' and lock_type = '1' and IFNULL(vehicle_code,'') = '' order by out_order_seq ASC").getResultJSONArray(0);
|
||||
if (pointArr.size() == 3) {
|
||||
JSONObject jsonNewRow = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' and lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
|
||||
point_code = jsonNewRow.getString("point_code");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 校验此货位是否被堵住:1.如果被堵住则判断下一个是否被堵住 2.如果全部被堵住则新开一排
|
||||
@@ -426,12 +435,21 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
if (ObjectUtil.isEmpty(point_code)) {
|
||||
// 为空则新开一排
|
||||
JSONObject point_jo = WQL.getWO("QST_ACSTOLMSTYPE4").addParam("flag", "3").process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point_jo)) {
|
||||
JSONArray rowArr = WQL.getWO("QST_ACSTOLMSTYPE4").addParam("flag", "3").process().getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(rowArr)) {
|
||||
throw new BadRequestException("未查询到相同销售订单的放货区点位或空的一排!");
|
||||
} else {
|
||||
JSONObject jsonNewRow = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' order by out_order_seq ASC").uniqueResult(0);
|
||||
point_code = jsonNewRow.getString("point_code");
|
||||
for (int i = 0; i < rowArr.size(); i++) {
|
||||
JSONObject point_jo = rowArr.getJSONObject(i);
|
||||
|
||||
JSONArray pointArr = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' and lock_type = '1' and IFNULL(vehicle_code,'') = '' order by out_order_seq ASC").getResultJSONArray(0);
|
||||
if (pointArr.size() == 3) {
|
||||
JSONObject jsonNewRow = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' and lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
|
||||
point_code = jsonNewRow.getString("point_code");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,6 +461,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
task_jo.put("task_type", "010506");
|
||||
SendOutTask sendOutTask = new SendOutTask();
|
||||
sendOutTask.createTask(task_jo);
|
||||
|
||||
// 锁住点位
|
||||
JSONObject jsonPoint = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0);
|
||||
jsonPoint.put("lock_type", "99");
|
||||
jsonPoint.put("vehicle_code", vehicle_code);
|
||||
WQLObject.getWQLObject("sch_base_point").update(jsonPoint);
|
||||
}
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "下发成功!");
|
||||
@@ -614,37 +638,39 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
//查询该设备对应的输送线点位
|
||||
JSONObject deliver_jo = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("point_code = '"+device_code+"'").uniqueResult(0);
|
||||
String qzzno = deliver_jo.getString("qzzno");
|
||||
if (ObjectUtil.isNotEmpty(deliver_jo)){
|
||||
deliver_jo.put("point_status","01");
|
||||
deliver_jo.put("qzzno","");
|
||||
deliver_jo.put("vehicle_code","");
|
||||
WQLObject.getWQLObject("st_ivt_deliverypointivt").update(deliver_jo);
|
||||
if (deliver_jo != null){
|
||||
String qzzno = deliver_jo.getString("qzzno");
|
||||
if (ObjectUtil.isNotEmpty(deliver_jo)){
|
||||
deliver_jo.put("point_status","01");
|
||||
deliver_jo.put("qzzno","");
|
||||
deliver_jo.put("vehicle_code","");
|
||||
WQLObject.getWQLObject("st_ivt_deliverypointivt").update(deliver_jo);
|
||||
|
||||
//如果为靠近分切机一端的输送点,判断远离端是否需要进行横移
|
||||
char dtl_type = device_code.charAt(device_code.length() - 1);
|
||||
if (Integer.valueOf(String.valueOf(dtl_type)) % 2 != 0) {
|
||||
String point_location = deliver_jo.getString("point_location");
|
||||
String product_area = deliver_jo.getString("product_area");
|
||||
String sort_seq = deliver_jo.getString("sort_seq");
|
||||
JSONObject right_point = WQL.getWO("PDA_02")
|
||||
.addParam("point_location", point_location)
|
||||
.addParam("point_code", device_code)
|
||||
.addParam("product_area", product_area)
|
||||
.addParam("sort_seq", sort_seq)
|
||||
.addParam("find_type","1")
|
||||
.addParam("flag", "17").process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(right_point) && !right_point.getString("point_status").equals("01")) {
|
||||
//创建载具横移任务
|
||||
String translate_code1 = right_point.getString("point_code");
|
||||
String translate_code2 = device_code;
|
||||
JSONObject tran_jo = new JSONObject();
|
||||
tran_jo.put("point_code1",translate_code1);
|
||||
tran_jo.put("point_code2",translate_code2);
|
||||
tran_jo.put("vehicle_code",right_point.getString("qzzno"));
|
||||
tran_jo.put("vehicle_code2",right_point.getString("vehicle_code"));
|
||||
tran_jo.put("task_type","010406");
|
||||
cutConveyorTask.createTask(tran_jo);
|
||||
//如果为靠近分切机一端的输送点,判断远离端是否需要进行横移
|
||||
char dtl_type = device_code.charAt(device_code.length() - 1);
|
||||
if (Integer.valueOf(String.valueOf(dtl_type)) % 2 != 0) {
|
||||
String point_location = deliver_jo.getString("point_location");
|
||||
String product_area = deliver_jo.getString("product_area");
|
||||
String sort_seq = deliver_jo.getString("sort_seq");
|
||||
JSONObject right_point = WQL.getWO("PDA_02")
|
||||
.addParam("point_location", point_location)
|
||||
.addParam("point_code", device_code)
|
||||
.addParam("product_area", product_area)
|
||||
.addParam("sort_seq", sort_seq)
|
||||
.addParam("find_type","1")
|
||||
.addParam("flag", "17").process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(right_point) && !right_point.getString("point_status").equals("01")) {
|
||||
//创建载具横移任务
|
||||
String translate_code1 = right_point.getString("point_code");
|
||||
String translate_code2 = device_code;
|
||||
JSONObject tran_jo = new JSONObject();
|
||||
tran_jo.put("point_code1",translate_code1);
|
||||
tran_jo.put("point_code2",translate_code2);
|
||||
tran_jo.put("vehicle_code",right_point.getString("qzzno"));
|
||||
tran_jo.put("vehicle_code2",right_point.getString("vehicle_code"));
|
||||
tran_jo.put("task_type","010406");
|
||||
cutConveyorTask.createTask(tran_jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.wms.ext.crm.service.CrmToLmsService;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.log.LokiLog;
|
||||
import org.nl.wms.log.LokiLogType;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -23,7 +21,7 @@ import java.util.HashMap;
|
||||
@Slf4j
|
||||
public class CrmToLmsServiceImpl implements CrmToLmsService {
|
||||
|
||||
@LokiLog(type = LokiLogType.CRM_TO_LMS)
|
||||
|
||||
@Override
|
||||
public JSONObject getCustomerInfo(JSONObject row) {
|
||||
|
||||
@@ -94,7 +92,7 @@ public class CrmToLmsServiceImpl implements CrmToLmsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.CRM_TO_LMS)
|
||||
|
||||
@Override
|
||||
public JSONObject getCPIvtInfo(JSONObject jo) {
|
||||
log.info("getCPIvtInfo输入参数为:----------------------" + jo.toString());
|
||||
|
||||
@@ -8,12 +8,9 @@ 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.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.ext.mes.service.LmsToMesService;
|
||||
import org.nl.wms.log.LokiLog;
|
||||
import org.nl.wms.log.LokiLogType;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -32,7 +29,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LokiLog(type = LokiLogType.LMS_TO_MES)
|
||||
|
||||
@Override
|
||||
public JSONObject momRollFoilWeighing(JSONObject param) {
|
||||
log.info("momRollFoilWeighing接口输入参数为:-------------------" + param);
|
||||
@@ -50,8 +47,8 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
|
||||
String Password = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
|
||||
|
||||
param.put("UserName",UserName);
|
||||
param.put("Password",Password);
|
||||
param.put("UserName", UserName);
|
||||
param.put("Password", Password);
|
||||
|
||||
// String url = acsUrl + api;
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
|
||||
@@ -65,13 +62,13 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
log.info("momRollFoilWeighing接口输出参数为:-------------------" + result.toString());
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
if (RTYPE.equals("E")){
|
||||
if (RTYPE.equals("E")) {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("MES提示错误:"+e.getMessage());
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -81,7 +78,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LokiLog(type = LokiLogType.LMS_TO_MES)
|
||||
|
||||
@Override
|
||||
public JSONObject momRollBakeInBound(JSONObject param) {
|
||||
log.info("momRollBakeInBound接口输入参数为:-------------------" + param.toString());
|
||||
@@ -108,13 +105,13 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
log.info("momRollBakeInBound接口输出参数为:-------------------" + result.toString());
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
if (RTYPE.equals("E")){
|
||||
if (RTYPE.equals("E")) {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("MES提示错误:"+e.getMessage());
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -124,7 +121,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LokiLog(type = LokiLogType.LMS_TO_MES)
|
||||
|
||||
@Override
|
||||
public JSONObject momRollBakeOutBound(JSONObject param) {
|
||||
log.info("momRollBakeOutBound接口输入参数为:-------------------" + param.toString());
|
||||
@@ -140,8 +137,8 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
|
||||
String Password = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
|
||||
param.put("UserName",UserName);
|
||||
param.put("Password",Password);
|
||||
param.put("UserName", UserName);
|
||||
param.put("Password", Password);
|
||||
|
||||
// String url = acsUrl + api;
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
|
||||
@@ -155,13 +152,13 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
log.info("momRollBakeOutBound接口输出参数为:-------------------" + result.toString());
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
if (RTYPE.equals("E")){
|
||||
if (RTYPE.equals("E")) {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("MES提示错误:"+e.getMessage());
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -171,7 +168,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LokiLog(type = LokiLogType.LMS_TO_MES)
|
||||
|
||||
@Override
|
||||
public JSONObject momRollSemiFGInboundComplete(JSONObject param) {
|
||||
log.info("momRollSemiFGInboundComplete接口输入参数为:-------------------" + param.toString());
|
||||
@@ -199,13 +196,13 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
if (RTYPE.equals("E")){
|
||||
if (RTYPE.equals("E")) {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("MES提示错误:"+e.getMessage());
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -215,7 +212,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LokiLog(type = LokiLogType.LMS_TO_MES)
|
||||
|
||||
@Override
|
||||
public JSONObject airSwellWithPaperTubeAssComplete(JSONObject param) {
|
||||
log.info("airSwellWithPaperTubeAssComplete接口输入参数为:-------------------" + param.toString());
|
||||
@@ -249,13 +246,13 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
log.info("airSwellWithPaperTubeAssComplete接口输出参数为:-------------------" + result.toString());
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
if (RTYPE.equals("E")){
|
||||
if (RTYPE.equals("E")) {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("MES提示错误:"+e.getMessage());
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -265,7 +262,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LokiLog(type = LokiLogType.LMS_TO_MES)
|
||||
|
||||
@Override
|
||||
public JSONObject cutPlanMomRollDeliveryComplete(JSONObject param) {
|
||||
log.info("cutPlanMomRollDeliveryComplete接口输入参数为:-------------------" + param.toString());
|
||||
@@ -283,19 +280,18 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
String warehouse = param.getString("warehouse");
|
||||
|
||||
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("iContainerName",container_name);
|
||||
jo.put("iisSourceRollDeliveryComplete",1);
|
||||
jo.put("PackageBoxSN",package_box_sn);
|
||||
jo.put("iWarehouse",warehouse);
|
||||
jo.put("iisAirSwellAssComplete","");
|
||||
jo.put("iisAirSwellDeliveryComplete","");
|
||||
jo.put("iContainerName", container_name);
|
||||
jo.put("iisSourceRollDeliveryComplete", 1);
|
||||
jo.put("PackageBoxSN", package_box_sn);
|
||||
jo.put("iWarehouse", warehouse);
|
||||
jo.put("iisAirSwellAssComplete", "");
|
||||
jo.put("iisAirSwellDeliveryComplete", "");
|
||||
|
||||
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
|
||||
String Password = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
|
||||
jo.put("UserName",UserName);
|
||||
jo.put("Password",Password);
|
||||
jo.put("UserName", UserName);
|
||||
jo.put("Password", Password);
|
||||
|
||||
// String url = acsUrl + api;
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
|
||||
@@ -310,13 +306,13 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
if (RTYPE.equals("E")){
|
||||
if (RTYPE.equals("E")) {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("MES提示错误:"+e.getMessage());
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -326,7 +322,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LokiLog(type = LokiLogType.LMS_TO_MES)
|
||||
|
||||
@Override
|
||||
public JSONObject airSwellWithPaperTubeAssArrival(JSONObject param) {
|
||||
log.info("airSwellWithPaperTubeAssArrival接口输入参数为:-------------------" + param.toString());
|
||||
@@ -361,13 +357,13 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
if (RTYPE.equals("E")){
|
||||
if (RTYPE.equals("E")) {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("MES提示错误:"+e.getMessage());
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -377,7 +373,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LokiLog(type = LokiLogType.LMS_TO_MES)
|
||||
|
||||
@Override
|
||||
public JSONObject childRollFGInboundComplete(JSONObject param) {
|
||||
log.info("childRollFGInboundComplete接口输入参数为:-------------------" + param.toString());
|
||||
@@ -401,8 +397,8 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
|
||||
String Password = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
|
||||
jo.put("UserName",UserName);
|
||||
jo.put("Password",Password);
|
||||
jo.put("UserName", UserName);
|
||||
jo.put("Password", Password);
|
||||
|
||||
// String url = acsUrl + api;
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
|
||||
@@ -417,13 +413,13 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
if (RTYPE.equals("E")){
|
||||
if (RTYPE.equals("E")) {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("MES提示错误:"+e.getMessage());
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -433,7 +429,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LokiLog(type = LokiLogType.LMS_TO_MES)
|
||||
|
||||
@Override
|
||||
public JSONObject childRollFGOutboundComplete(JSONObject param) {
|
||||
log.info("childRollFGOutboundComplete接口输入参数为:-------------------" + param.toString());
|
||||
@@ -460,13 +456,13 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
if (RTYPE.equals("E")){
|
||||
if (RTYPE.equals("E")) {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("MES提示错误:"+e.getMessage());
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -476,7 +472,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LokiLog(type = LokiLogType.LMS_TO_MES)
|
||||
|
||||
@Override
|
||||
public JSONObject lmsUnPackage(JSONObject param) {
|
||||
log.info("LMSUnPackakge接口输入参数为:-------------------" + param.toString());
|
||||
@@ -496,8 +492,8 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
|
||||
String Password = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
|
||||
param.put("UserName",UserName);
|
||||
param.put("Password",Password);
|
||||
param.put("UserName", UserName);
|
||||
param.put("Password", Password);
|
||||
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
@@ -508,13 +504,13 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
if (RTYPE.equals("E")){
|
||||
if (RTYPE.equals("E")) {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("MES提示错误:"+e.getMessage());
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -524,7 +520,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LokiLog(type = LokiLogType.LMS_TO_MES)
|
||||
|
||||
@Override
|
||||
public JSONObject lmsPackage(JSONObject param) {
|
||||
log.info("LMSPackakge接口输入参数为:-------------------" + param.toString());
|
||||
@@ -544,8 +540,8 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
|
||||
String Password = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
|
||||
param.put("UserName",UserName);
|
||||
param.put("Password",Password);
|
||||
param.put("UserName", UserName);
|
||||
param.put("Password", Password);
|
||||
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
@@ -556,13 +552,13 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
if (RTYPE.equals("E")){
|
||||
if (RTYPE.equals("E")) {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("MES提示错误:"+e.getMessage());
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
|
||||
import org.nl.wms.ext.mes.service.MesToLmsService;
|
||||
import org.nl.wms.log.LokiLog;
|
||||
import org.nl.wms.log.LokiLogType;
|
||||
import org.nl.wms.pda.mps.service.InService;
|
||||
import org.nl.wms.pda.mps.service.OutService;
|
||||
import org.nl.wms.pda.mps.service.impl.BakingServiceImpl;
|
||||
@@ -30,7 +28,6 @@ import org.nl.wms.st.inbill.service.CheckOutBillService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
|
||||
@Service
|
||||
|
||||
@@ -7,12 +7,9 @@ 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.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.ext.sap.service.LmsToSapService;
|
||||
import org.nl.wms.log.LokiLog;
|
||||
import org.nl.wms.log.LokiLogType;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -21,7 +18,7 @@ import org.springframework.stereotype.Service;
|
||||
@Slf4j
|
||||
public class LmsToSapServiceImpl implements LmsToSapService {
|
||||
|
||||
@LokiLog(type = LokiLogType.LMS_TO_SAP)
|
||||
|
||||
@Override
|
||||
public JSONObject returnDelivery(JSONObject jo) {
|
||||
/*
|
||||
@@ -58,8 +55,8 @@ public class LmsToSapServiceImpl implements LmsToSapService {
|
||||
String api = "";
|
||||
url = url + "/sap/center/wms/004";
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url).header("TOKEN",token)
|
||||
.header("sap-client",sap_client)
|
||||
String resultMsg = HttpRequest.post(url).header("TOKEN", token)
|
||||
.header("sap-client", sap_client)
|
||||
.body(String.valueOf(jo))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
@@ -72,13 +69,13 @@ public class LmsToSapServiceImpl implements LmsToSapService {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("SAP提示错误:"+e.getMessage());
|
||||
throw new BadRequestException("SAP提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.LMS_TO_SAP)
|
||||
|
||||
@Override
|
||||
public JSONObject returnMoveDtl(JSONObject jo) {
|
||||
/*
|
||||
@@ -123,8 +120,8 @@ public class LmsToSapServiceImpl implements LmsToSapService {
|
||||
String api = "/sap/center/wms/005";
|
||||
url = url + api;
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url).header("TOKEN",token)
|
||||
.header("sap-client",sap_client)
|
||||
String resultMsg = HttpRequest.post(url).header("TOKEN", token)
|
||||
.header("sap-client", sap_client)
|
||||
.body(String.valueOf(jo))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
@@ -136,7 +133,7 @@ public class LmsToSapServiceImpl implements LmsToSapService {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("SAP提示错误:"+e.getMessage());
|
||||
throw new BadRequestException("SAP提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.ext.sap.service.SapToLmsService;
|
||||
import org.nl.wms.log.LokiLog;
|
||||
import org.nl.wms.log.LokiLogType;
|
||||
import org.nl.wms.st.inbill.service.CheckOutBillService;
|
||||
import org.nl.wms.st.inbill.service.RawAssistIStorService;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -29,7 +27,7 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
|
||||
private final RawAssistIStorService rawAssistIStorService;
|
||||
|
||||
@LokiLog(type = LokiLogType.SAP_TO_LMS)
|
||||
|
||||
@Override
|
||||
public JSONObject getMaterialInfo(JSONObject jo) {
|
||||
JSONArray rows = jo.getJSONArray("DATAS");
|
||||
@@ -51,33 +49,33 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
WQLObject.getWQLObject("md_me_materialbaseext").update(row);
|
||||
}
|
||||
|
||||
JSONObject base_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '"+MATNR+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(base_jo)){
|
||||
JSONObject base_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + MATNR + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(base_jo)) {
|
||||
JSONObject mater_base_jo = new JSONObject();
|
||||
mater_base_jo.put("material_id",IdUtil.getSnowflake(1,1).nextId());
|
||||
mater_base_jo.put("material_code",MATNR);
|
||||
mater_base_jo.put("material_name",MATNR01);
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("unit_code = '"+MEINS+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(unit)){
|
||||
mater_base_jo.put("material_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
mater_base_jo.put("material_code", MATNR);
|
||||
mater_base_jo.put("material_name", MATNR01);
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("unit_code = '" + MEINS + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(unit)) {
|
||||
throw new BadRequestException("未查询到相关计量单位,请进行维护!");
|
||||
}
|
||||
mater_base_jo.put("base_unit_id",unit.getString("measure_unit_id"));
|
||||
mater_base_jo.put("base_unit_id", unit.getString("measure_unit_id"));
|
||||
mater_base_jo.put("create_id", "1");
|
||||
mater_base_jo.put("create_name", "管理员");
|
||||
mater_base_jo.put("create_time", DateUtil.now());
|
||||
mater_base_jo.put("update_optid", "1");
|
||||
mater_base_jo.put("update_optname", "管理员");
|
||||
mater_base_jo.put("update_time", DateUtil.now());
|
||||
mater_base_jo.put("is_used","1");
|
||||
mater_base_jo.put("is_delete","0");
|
||||
mater_base_jo.put("is_used", "1");
|
||||
mater_base_jo.put("is_delete", "0");
|
||||
WQLObject.getWQLObject("md_me_materialbase").insert(mater_base_jo);
|
||||
}else {
|
||||
base_jo.put("material_name",MATNR01);
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("unit_code = '"+MEINS+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(unit)){
|
||||
} else {
|
||||
base_jo.put("material_name", MATNR01);
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("unit_code = '" + MEINS + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(unit)) {
|
||||
throw new BadRequestException("未查询到相关计量单位,请进行维护!");
|
||||
}
|
||||
base_jo.put("base_unit_id",unit.getString("measure_unit_id"));
|
||||
base_jo.put("base_unit_id", unit.getString("measure_unit_id"));
|
||||
base_jo.put("update_optid", "1");
|
||||
base_jo.put("update_optname", "管理员");
|
||||
base_jo.put("update_time", DateUtil.now());
|
||||
@@ -96,7 +94,7 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.SAP_TO_LMS)
|
||||
|
||||
@Override
|
||||
public JSONObject getDeliveryInfo(JSONObject jo) {
|
||||
log.info("getDeliveryInfo的输入参数为:------------------------" + jo.toString());
|
||||
@@ -168,7 +166,7 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
jsonMst.put("consignee", json.getString("NAMEM")); // 收货单位
|
||||
jsonMst.put("receiptaddress", json.getString("ADRNRS")); // 收货地址
|
||||
/*jsonMst.put("remark",json.getString("LGORT"));//库位*/
|
||||
|
||||
|
||||
|
||||
// 明细
|
||||
JSONObject jsonMater = materTab.query("material_code = '" + json.getString("MATNR") + "'").uniqueResult(0);
|
||||
@@ -298,7 +296,7 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.SAP_TO_LMS)
|
||||
|
||||
@Override
|
||||
public JSONObject getReturnDeliveryInfo(JSONObject jo) {
|
||||
/**
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package org.nl.wms.log;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author: lyd
|
||||
* @description: 自定义日志注解,用作LOKI日志分类
|
||||
* @Date: 2022/10/10
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD})
|
||||
@Documented
|
||||
public @interface LokiLog {
|
||||
LokiLogType type() default LokiLogType.DEFAULT;
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package org.nl.wms.log;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.Signature;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
|
||||
/**
|
||||
* @author: lyd
|
||||
* @description: 自定义日志切面:https://cloud.tencent.com/developer/article/1655923
|
||||
* @Date: 2022/10/10
|
||||
*/
|
||||
@Aspect
|
||||
@Slf4j
|
||||
@Component
|
||||
public class LokiLogAspect {
|
||||
/**
|
||||
* 切到所有OperatorLog注解修饰的方法
|
||||
*/
|
||||
@Pointcut("@annotation(org.nl.wms.log.LokiLog)")
|
||||
public void operatorLog() {
|
||||
// 空方法
|
||||
}
|
||||
|
||||
/**
|
||||
* 利用@Around环绕增强
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Around("operatorLog()")
|
||||
public synchronized Object around(ProceedingJoinPoint pjp) throws Throwable {
|
||||
// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
// HttpServletRequest request = attributes.getRequest();
|
||||
// HttpServletResponse response = attributes.getResponse();
|
||||
|
||||
Signature signature = pjp.getSignature();
|
||||
MethodSignature methodSignature = (MethodSignature) signature;
|
||||
Method method = methodSignature.getMethod();
|
||||
LokiLog lokiLog = method.getAnnotation(LokiLog.class);
|
||||
|
||||
// 获取描述信息
|
||||
LokiLogType logType = lokiLog.type();
|
||||
|
||||
MDC.put("log_file_type", logType.getDesc());
|
||||
log.info("输入参数:" + JSONObject.toJSONString(pjp.getArgs()));
|
||||
|
||||
Object proceed = pjp.proceed();
|
||||
|
||||
log.info("返回参数:" + JSONObject.toJSONString(proceed));
|
||||
MDC.remove("log_file_type");
|
||||
return proceed;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package org.nl.wms.log;
|
||||
|
||||
/**
|
||||
* @author: lyd
|
||||
* @description:
|
||||
* @Date: 2022/10/11
|
||||
*/
|
||||
public enum LokiLogType {
|
||||
DEFAULT("默认"),
|
||||
LMS_TO_MES("LMS请求MES"),
|
||||
MES_TO_LMS("MES请求LMS"),
|
||||
LMS_TO_CRM("LMS请求CRM"),
|
||||
CRM_TO_LMS("CRM请求LMS"),
|
||||
LMS_TO_SAP("LMS请求SAP"),
|
||||
SAP_TO_LMS("SAP请求LMS"),
|
||||
LMS_TO_ACS("LMS请求ACS"),
|
||||
ACS_TO_LMS("ACS请求LMS");
|
||||
|
||||
private String desc;
|
||||
|
||||
LokiLogType(String desc) {
|
||||
this.desc=desc;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
|
||||
@@ -55,6 +56,7 @@ public class PdaCheckServiceImpl implements PdaCheckService {
|
||||
|
||||
@Override
|
||||
public JSONObject checkQueryDtl(JSONObject whereJson) {
|
||||
|
||||
String box_no = whereJson.getString("box_no");
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
@@ -64,8 +66,16 @@ public class PdaCheckServiceImpl implements PdaCheckService {
|
||||
|
||||
JSONArray resultJSONArray = WQL.getWO("PDA_CHECK").addParamMap(map).process().getResultJSONArray(0);
|
||||
|
||||
// 已盘点数: 不等于生成状态
|
||||
JSONArray unCheckNumArr = WQLObject.getWQLObject("ST_IVT_CheckDtl").query("check_code = '" + whereJson.getString("check_code") + "' and status <> '1'").getResultJSONArray(0);
|
||||
|
||||
// 未盘点数:等于生成状态
|
||||
JSONArray checkNumArr = WQLObject.getWQLObject("ST_IVT_CheckDtl").query("check_code = '" + whereJson.getString("check_code") + "' and status = '1'").getResultJSONArray(0);
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("data", resultJSONArray);
|
||||
jo.put("check_num", unCheckNumArr.size());
|
||||
jo.put("uncheck_num", checkNumArr.size());
|
||||
jo.put("message", "查询成功!");
|
||||
return jo;
|
||||
}
|
||||
|
||||
@@ -129,12 +129,14 @@
|
||||
dtl.check_optname,
|
||||
dtl.check_time,
|
||||
dtl.remark,
|
||||
sub.quanlity_in_box,
|
||||
|
||||
dtl.check_id,
|
||||
dtl.checkdtl_id
|
||||
FROM
|
||||
ST_IVT_CheckDtl dtl
|
||||
LEFT JOIN md_me_materialbase mater ON dtl.material_id = mater.material_id
|
||||
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.package_box_sn = dtl.storagevehicle_code
|
||||
WHERE
|
||||
dtl.status = '1'
|
||||
|
||||
|
||||
@@ -54,10 +54,10 @@ public class AutoCreateTask {
|
||||
}
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
log.info("定时器执行失败:{}", e.getTargetException().getMessage());
|
||||
log.error("定时器执行失败:{}", e.getTargetException().getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info("定时器执行失败:{}", e.getMessage());
|
||||
log.error("定时器执行失败:{}", e.getMessage());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -6,11 +6,9 @@ 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.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
@@ -18,6 +16,7 @@ import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.service.PointService;
|
||||
import org.nl.wms.sch.service.dto.PointDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -26,11 +25,12 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class BookTwoConfirmTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = BookTwoConfirmTask.class.getName();
|
||||
private final CutConveyorTask conveyorTask;
|
||||
@Autowired
|
||||
private CutConveyorTask conveyorTask;
|
||||
|
||||
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
|
||||
@@ -100,9 +100,9 @@ public class OutTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
// 更新任务为下发
|
||||
JSONObject paramMap = new JSONObject();
|
||||
/* JSONObject paramMap = new JSONObject();
|
||||
paramMap.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||
wo_Task.update(paramMap,"task_group_id ='"+json.getString("task_group_id")+"'");
|
||||
wo_Task.update(paramMap,"task_group_id ='"+json.getString("task_group_id")+"'");*/
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
@@ -115,61 +115,64 @@ public class OutTask extends AbstractAcsTask {
|
||||
WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis"); // 出入库分配表
|
||||
|
||||
String task_id = taskObj.getString("task_id");
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "' and task_status < '07'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonTask)) {
|
||||
if (StrUtil.equals(status, "0")) {
|
||||
// 任务为下发之后就不允许取消
|
||||
if (jsonTask.getIntValue("task_status") > Integer.valueOf(TaskStatusEnum.START_AND_POINT.getCode())) {
|
||||
throw new BadRequestException("任务:"+jsonTask.getString("task_code")+"已下发,不可取消");
|
||||
}
|
||||
|
||||
// 更新删除字段
|
||||
jsonTask.put("is_delete","1");
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
// 更新分配明细为:未生成
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("work_status", "00");
|
||||
map.put("point_id", "");
|
||||
|
||||
disTab.update(map,"task_id = '"+task_id+"'");
|
||||
|
||||
if (StrUtil.equals(status, "0")) {
|
||||
// 任务为执行中之后就不允许取消
|
||||
if (StrUtil.equals(TaskStatusEnum.EXECUTING.getCode(), jsonTask.getString("task_status"))) {
|
||||
throw new BadRequestException("任务:"+jsonTask.getString("task_code")+"正在执行中,不可取消");
|
||||
}
|
||||
|
||||
// 更新删除字段
|
||||
jsonTask.put("is_delete","1");
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
// 更新分配明细为:未生成
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("work_status", "00");
|
||||
map.put("point_id", "");
|
||||
}
|
||||
|
||||
disTab.update(map,"task_id = '"+task_id+"'");
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
}
|
||||
// 判断此任务是否有任务组
|
||||
String task_group_id = jsonTask.getString("task_group_id");
|
||||
if (ObjectUtil.isNotEmpty(task_group_id)) {
|
||||
// 上一个任务组顺序号
|
||||
String sort_seq_last = NumberUtil.sub(jsonTask.getString("sort_seq"), "1").toString();
|
||||
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
}
|
||||
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
// 判断此任务是否有任务组
|
||||
String task_group_id = jsonTask.getString("task_group_id");
|
||||
if (ObjectUtil.isNotEmpty(task_group_id)) {
|
||||
// 上一个任务组顺序号
|
||||
String sort_seq_last = NumberUtil.sub(jsonTask.getString("sort_seq"), "1").toString();
|
||||
|
||||
JSONObject jsonTaskLast = taskTab.query("task_group_id = '" + task_group_id + "' and sort_seq = '" + sort_seq_last + "' and task_status <> '07'").uniqueResult(0);
|
||||
JSONObject jsonTaskLast = taskTab.query("task_group_id = '" + task_group_id + "' and sort_seq = '" + sort_seq_last + "' and task_status <> '07'").uniqueResult(0);
|
||||
// if (ObjectUtil.isNotEmpty(jsonTaskLast)) throw new BadRequestException("请先完成"+jsonTaskLast.getString("task_code")+"的任务!");
|
||||
}
|
||||
|
||||
// 调用标识完成
|
||||
CheckOutBillService checkOutBillService = SpringContextHolder.getBean(CheckOutBillService.class);
|
||||
checkOutBillService.finishTask(jsonTask);
|
||||
|
||||
// 更改任务状态为完成
|
||||
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("update_optid", currentUserId);
|
||||
jsonTask.put("update_optname", currentUsername);
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
|
||||
// 调用标识完成
|
||||
CheckOutBillService checkOutBillService = SpringContextHolder.getBean(CheckOutBillService.class);
|
||||
checkOutBillService.finishTask(jsonTask);
|
||||
|
||||
// 更改任务状态为完成
|
||||
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("update_optid", currentUserId);
|
||||
jsonTask.put("update_optname", currentUsername);
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -70,6 +70,10 @@ public class SendOutTask extends AbstractAcsTask {
|
||||
jsonTask.put("is_delete","1");
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
JSONObject jsonPoint2 = pointTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
|
||||
jsonPoint2.put("lock_type", "1");
|
||||
pointTab.update(jsonPoint2);
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
@@ -94,6 +98,7 @@ public class SendOutTask extends AbstractAcsTask {
|
||||
// 更新暂存区点位状态
|
||||
JSONObject jsonPoint2 = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
|
||||
jsonPoint2.put("point_status", "2");
|
||||
jsonPoint2.put("lock_type", "1");
|
||||
jsonPoint2.put("vehicle_code", jsonTask.getString("vehicle_code"));
|
||||
pointTab.update(jsonPoint2);
|
||||
}
|
||||
|
||||
@@ -1197,7 +1197,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
task_map.put("update_optname", nickName);
|
||||
task_map.put("update_time", now);
|
||||
//修改分配表起点,任务表起点
|
||||
/* task_wql.update(task_map, "task_id = '" + task_id + "'");*/
|
||||
task_wql.update(task_map, "task_id = '" + whereJson.get("task_id") + "'");
|
||||
|
||||
//解锁原货位点位
|
||||
HashMap unlock_map = new HashMap();
|
||||
|
||||
@@ -70,6 +70,8 @@
|
||||
IFNULL( po.vehicle_code, '' ) = ''
|
||||
AND
|
||||
po.point_type = '9'
|
||||
AND
|
||||
po.lock_type = '1'
|
||||
OPTION 输入.row_num <> ""
|
||||
po.row_num = 输入.row_num
|
||||
ENDOPTION
|
||||
|
||||
@@ -87,6 +87,13 @@ public class CheckController {
|
||||
checkService.insertDtl(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
@PostMapping("/allInsert")
|
||||
@Log("新增全部在库木箱")
|
||||
@ApiOperation("新增全部在库木箱")
|
||||
public ResponseEntity<Object> allInsert(@RequestBody JSONObject whereJson){
|
||||
checkService.allInsert(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
@GetMapping("/getStructIvt")
|
||||
@Log("查询可盘点库存")
|
||||
@ApiOperation("查询可盘点库存")
|
||||
|
||||
@@ -114,4 +114,9 @@ public interface CheckService {
|
||||
* 处理确认
|
||||
*/
|
||||
void disposeConfirm(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 新增全部在库木箱
|
||||
*/
|
||||
void allInsert(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
@@ -215,11 +216,26 @@ public class CheckServiceImpl implements CheckService {
|
||||
|
||||
@Override
|
||||
public JSONArray getOutBillDtl(Map whereJson) {
|
||||
whereJson.put("flag", "2");
|
||||
JSONArray jo = WQL.getWO("QST_IVT_CHECK")
|
||||
.addParamMap((HashMap) whereJson)
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
String type = MapUtil.getStr(whereJson, "type");
|
||||
|
||||
JSONArray jo = new JSONArray();
|
||||
if (ObjectUtil.isNotEmpty(type)) {
|
||||
if (StrUtil.equals(type, "1")){
|
||||
// 1-已盘点
|
||||
whereJson.put("flag", "22");
|
||||
jo = WQL.getWO("QST_IVT_CHECK").addParamMap((HashMap) whereJson).process().getResultJSONArray(0);
|
||||
} else {
|
||||
// 1-未盘点
|
||||
whereJson.put("flag", "222");
|
||||
jo = WQL.getWO("QST_IVT_CHECK").addParamMap((HashMap) whereJson).process().getResultJSONArray(0);
|
||||
}
|
||||
} else {
|
||||
whereJson.put("flag", "2");
|
||||
jo = WQL.getWO("QST_IVT_CHECK")
|
||||
.addParamMap((HashMap) whereJson)
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
}
|
||||
return jo;
|
||||
}
|
||||
|
||||
@@ -666,51 +682,30 @@ public class CheckServiceImpl implements CheckService {
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject jo = rows.getJSONObject(i);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("盘点单号", jo.getString("check_code"));
|
||||
map.put("明细序号", jo.getString("seq_no"));
|
||||
map.put("库区编码", jo.getString("sect_code"));
|
||||
map.put("库区名称", jo.getString("sect_name"));
|
||||
map.put("货位编码", jo.getString("struct_code"));
|
||||
map.put("货位名称", jo.getString("struct_name"));
|
||||
map.put("载具号", jo.getString("storagevehicle_code"));
|
||||
map.put("物料编码", jo.getString("material_code"));
|
||||
map.put("物料名称", jo.getString("material_name"));
|
||||
map.put("桶数", jo.getString("base_qty"));
|
||||
map.put("盘点桶数", jo.getString("fac_qty"));
|
||||
map.put("单位", jo.getString("qty_unit_name"));
|
||||
String check_result = jo.getString("check_result");
|
||||
if (check_result.equals("0")) {
|
||||
map.put("盘点结果", "正常");
|
||||
} else if (check_result.equals("1")) {
|
||||
map.put("盘点结果", "盘亏");
|
||||
} else if (check_result.equals("2")) {
|
||||
map.put("盘点结果", "盘盈");
|
||||
}
|
||||
String status = jo.getString("status");
|
||||
if (status.equals("01")) {
|
||||
if (StrUtil.equals(status, "1")) {
|
||||
map.put("状态", "生成");
|
||||
} else if (status.equals("04")) {
|
||||
} else if (StrUtil.equals(status, "2")) {
|
||||
map.put("状态", "盘点中");
|
||||
} else if (status.equals("05")) {
|
||||
} else if (StrUtil.equals(status, "3")) {
|
||||
map.put("状态", "已盘点");
|
||||
} else if (status.equals("06")) {
|
||||
} else if (StrUtil.equals(status, "4")) {
|
||||
map.put("状态", "异常处理中");
|
||||
} else if (status.equals("07")) {
|
||||
} else if (StrUtil.equals(status, "5")) {
|
||||
map.put("状态", "异常处理完成");
|
||||
} else if (status.equals("99")) {
|
||||
} else if (StrUtil.equals(status, "99")) {
|
||||
map.put("状态", "确认完成");
|
||||
}
|
||||
map.put("异常处理人", jo.getString("process_optname"));
|
||||
map.put("异常处理时间", jo.getString("process_time"));
|
||||
String process_type = jo.getString("process_type");
|
||||
if (process_type.equals("0")) {
|
||||
map.put("异常处理方式", "账务为准");
|
||||
} else if (process_type.equals("1")) {
|
||||
map.put("异常处理方式", "实物为准");
|
||||
}
|
||||
map.put("盘点库区", jo.getString("sect_name"));
|
||||
map.put("盘点货位", jo.getString("struct_name"));
|
||||
map.put("箱号", jo.getString("storagevehicle_code"));
|
||||
map.put("净重", jo.getString("base_qty"));
|
||||
map.put("物料编码", jo.getString("material_code"));
|
||||
map.put("物料名称", jo.getString("material_name"));
|
||||
map.put("备注", jo.getString("remark"));
|
||||
list.add(map);
|
||||
}
|
||||
//FileUtil.downloadExcel(list, response);
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -757,5 +752,60 @@ public class CheckServiceImpl implements CheckService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void allInsert(JSONObject jsonObject) {
|
||||
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_CheckMst"); // 盘点单主表
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_CheckDtl"); // 盘点单明细表
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
Long deptId = SecurityUtils.getDeptId();
|
||||
|
||||
// 查找库内所有在库木箱
|
||||
JSONArray dtlArr = WQL.getWO("QST_IVT_CHECK").addParam("flag", "11").addParam("stor_id", jsonObject.getString("stor_id")).process().getResultJSONArray(0);
|
||||
|
||||
// 插入主表
|
||||
JSONObject jsonMst = new JSONObject();
|
||||
jsonMst.put("check_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonMst.put("check_code", CodeUtil.getNewCode("PD_CODE"));
|
||||
jsonMst.put("buss_type", jsonObject.getString("check_type"));
|
||||
jsonMst.put("check_type", jsonObject.getString("check_type"));
|
||||
jsonMst.put("stor_id", jsonObject.getLongValue("stor_id"));
|
||||
jsonMst.put("stor_name", jsonObject.getString("stor_name"));
|
||||
jsonMst.put("dtl_num", dtlArr.size());
|
||||
jsonMst.put("create_mode", "01");
|
||||
jsonMst.put("is_nok", "0");
|
||||
jsonMst.put("input_optid", currentUserId);
|
||||
jsonMst.put("input_optname", nickName);
|
||||
jsonMst.put("input_time", DateUtil.now());
|
||||
jsonMst.put("remark", jsonObject.getString("remark"));
|
||||
jsonMst.put("status", "1");
|
||||
jsonMst.put("sysdeptid", deptId);
|
||||
jsonMst.put("syscompanyid", deptId);
|
||||
mstTab.insert(jsonMst);
|
||||
|
||||
// 插入明细
|
||||
for (int i = 0; i < dtlArr.size(); i++) {
|
||||
JSONObject json = dtlArr.getJSONObject(i);
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("checkdtl_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonDtl.put("check_id", jsonMst.getLongValue("check_id"));
|
||||
jsonDtl.put("check_code", jsonMst.getString("check_code"));
|
||||
jsonDtl.put("seq_no", i + 1);
|
||||
jsonDtl.put("sect_id", json.getLongValue("sect_id"));
|
||||
jsonDtl.put("sect_name", json.getString("sect_name"));
|
||||
jsonDtl.put("struct_id", json.getLongValue("struct_id"));
|
||||
jsonDtl.put("struct_name", json.getString("struct_name"));
|
||||
jsonDtl.put("storagevehicle_code", json.getString("storagevehicle_code"));
|
||||
jsonDtl.put("material_id", json.getLongValue("material_id"));
|
||||
jsonDtl.put("qty_unit_id", json.getLongValue("measure_unit_id"));
|
||||
jsonDtl.put("qty_unit_name", json.getString("qty_unit_name"));
|
||||
jsonDtl.put("status", "1");
|
||||
|
||||
JSONObject jsonSub = WQL.getWO("PDA_CHECK").addParam("flag", "4").addParam("storagevehicle_code", json.getString("storagevehicle_code")).process().uniqueResult(0);
|
||||
jsonDtl.put("base_qty", jsonSub.getDoubleValue("net_weight"));
|
||||
dtlTab.insert(jsonDtl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,6 +141,56 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "22"
|
||||
QUERY
|
||||
SELECT
|
||||
CheckDtl.*,
|
||||
struct.struct_code,
|
||||
struct.sect_code,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
user1.person_name AS process_optname
|
||||
FROM
|
||||
ST_IVT_CheckDtl CheckDtl
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = CheckDtl.material_id
|
||||
LEFT JOIN st_ivt_structattr struct ON struct.struct_id = CheckDtl.struct_id
|
||||
LEFT JOIN sys_user user1 ON user1.user_id = CheckDtl.process_optid
|
||||
WHERE
|
||||
CheckDtl.status <> '1'
|
||||
OPTION 输入.check_id <> ""
|
||||
CheckDtl.check_id = 输入.check_id
|
||||
ENDOPTION
|
||||
|
||||
order by CheckDtl.seq_no
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "222"
|
||||
QUERY
|
||||
SELECT
|
||||
CheckDtl.*,
|
||||
struct.struct_code,
|
||||
struct.sect_code,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
user1.person_name AS process_optname
|
||||
FROM
|
||||
ST_IVT_CheckDtl CheckDtl
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = CheckDtl.material_id
|
||||
LEFT JOIN st_ivt_structattr struct ON struct.struct_id = CheckDtl.struct_id
|
||||
LEFT JOIN sys_user user1 ON user1.user_id = CheckDtl.process_optid
|
||||
WHERE
|
||||
CheckDtl.status = '1'
|
||||
OPTION 输入.check_id <> ""
|
||||
CheckDtl.check_id = 输入.check_id
|
||||
ENDOPTION
|
||||
|
||||
order by CheckDtl.seq_no
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
@@ -433,3 +483,33 @@
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "11"
|
||||
QUERY
|
||||
SELECT
|
||||
MAX(attr.sect_id) AS sect_id,
|
||||
MAX(attr.sect_name) AS sect_name,
|
||||
MAX(attr.struct_id) AS struct_id,
|
||||
MAX(attr.struct_name) AS struct_name,
|
||||
MAX(attr.storagevehicle_code) AS storagevehicle_code,
|
||||
MAX(mater.material_id) AS material_id,
|
||||
MAX(mater.base_unit_id) AS qty_unit_id,
|
||||
'KG' AS qty_unit_name
|
||||
FROM
|
||||
st_ivt_structivt ivt
|
||||
LEFT JOIN st_ivt_structattr attr ON ivt.struct_id = attr.struct_id
|
||||
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||
WHERE
|
||||
attr.sect_code in ('XN01','XN11')
|
||||
AND IFNULL(attr.storagevehicle_code,'') <> ''
|
||||
AND attr.lock_type = '1'
|
||||
|
||||
OPTION 输入.stor_id <> ""
|
||||
attr.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
|
||||
group by attr.struct_code
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -619,6 +619,13 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task"); // 任务表
|
||||
|
||||
String task_id = whereJson.getString("task_id");
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
// 任务为下发之后就不允许取消
|
||||
if (jsonTask.getIntValue("task_status") > Integer.valueOf(TaskStatusEnum.START_AND_POINT.getCode())) {
|
||||
throw new BadRequestException("任务:"+jsonTask.getString("task_code")+"已下发,不可取消");
|
||||
}
|
||||
|
||||
// 更新分配明细 任务状态、清空任务id
|
||||
JSONObject paramMap = new JSONObject();
|
||||
paramMap.put("task_id", "");
|
||||
@@ -2545,6 +2552,17 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
if (ObjectUtil.isEmpty(allRowArr)) throw new BadRequestException("当前没有可设置的分配明细");
|
||||
|
||||
// 判断当前排是否有其他任务正在执行
|
||||
for (int i = 0; i < allRowArr.size(); i++) {
|
||||
JSONObject jsonRow = allRowArr.getJSONObject(i);
|
||||
JSONArray structArr = attrTab.query("block_num = '" + jsonRow.getString("block_num")
|
||||
+ "' and row_num = '" + jsonRow.getString("row_num") + "' and is_used = '1' and is_delete = '0' and lock_type not in ('1','6','3')").getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(structArr)) {
|
||||
throw new BadRequestException(jsonRow.getString("block_num")+"区-"+jsonRow.getString("row_num")+"排有未完成的入库任务!");
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < allRowArr.size(); i++) {
|
||||
// 调用当前排处理方法
|
||||
JSONObject jsonRow = allRowArr.getJSONObject(i);
|
||||
@@ -3833,6 +3851,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
|
||||
// 物料表
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
// 任务表
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
// 库区表
|
||||
WQLObject sectTab = WQLObject.getWQLObject("st_ivt_sectattr");
|
||||
// 子卷包装关系表
|
||||
@@ -3944,6 +3964,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
JSONObject jsonDis = wo_dis.query("iostorinvdis_id = '" + dis.getString("iostorinvdis_id") + "'").uniqueResult(0);
|
||||
jsonDis.put("work_status", "99");
|
||||
wo_dis.update(jsonDis);
|
||||
|
||||
// 更新对应任务为完成
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + jsonDis.getString("task_id") + "' and task_status < '07'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonTask)) {
|
||||
jsonTask.put("task_status",TaskStatusEnum.FINISHED.getCode());
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JSONObject out_jo = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
|
||||
|
||||
Reference in New Issue
Block a user