Compare commits
5 Commits
master
...
feature/ms
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b70386156 | ||
|
|
c9ea2f112b | ||
|
|
48a45ba56d | ||
|
|
2f933a6709 | ||
|
|
ef3baa529c |
@@ -109,6 +109,17 @@
|
||||
<!-- <artifactId>logback-elasticsearch-appender</artifactId>-->
|
||||
<!-- <version>1.6</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.shardingsphere/sharding-jdbc-spring-boot-starter -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.shardingsphere</groupId>-->
|
||||
<!-- <artifactId>sharding-jdbc-spring-boot-starter</artifactId>-->
|
||||
<!-- <version>4.1.1</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.shardingsphere</groupId>
|
||||
<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
|
||||
<version>5.0.0-alpha</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 图片缩略图 -->
|
||||
<dependency>
|
||||
@@ -300,20 +311,6 @@
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 解析客户端操作系统、浏览器信息 -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>nl.basjes.parse.useragent</groupId>-->
|
||||
<!-- <artifactId>yauaa</artifactId>-->
|
||||
<!-- <version>5.23</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>eu.bitwalker</groupId>-->
|
||||
<!-- <artifactId>UserAgentUtils</artifactId>-->
|
||||
<!-- <version>1.21</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!--WQL-->
|
||||
<dependency>
|
||||
<groupId>com.hynnet</groupId>
|
||||
<artifactId>jxl</artifactId>
|
||||
|
||||
@@ -4,16 +4,19 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alicp.jetcache.Cache;
|
||||
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
|
||||
import com.alicp.jetcache.anno.config.EnableMethodCache;
|
||||
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
@@ -29,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@EnableAsync
|
||||
@RestController
|
||||
|
||||
|
||||
@SpringBootApplication(exclude = {
|
||||
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
|
||||
})
|
||||
|
||||
@@ -6,6 +6,7 @@ package org.nl.common.lucene;
|
||||
* @desc desc
|
||||
*/
|
||||
|
||||
import ch.qos.logback.classic.AsyncAppender;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import com.yomahub.tlog.core.enhance.logback.async.AspectLogbackAsyncAppender;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -14,7 +15,8 @@ import org.slf4j.MDC;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class AsyncLuceneAppender extends AspectLogbackAsyncAppender {
|
||||
//public class AsyncLuceneAppender extends AspectLogbackAsyncAppender {
|
||||
public class AsyncLuceneAppender extends AsyncAppender {
|
||||
|
||||
|
||||
public AsyncLuceneAppender() {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.common.lucene;
|
||||
|
||||
import ch.qos.logback.classic.spi.LoggingEvent;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2024/1/24 11:26
|
||||
*/
|
||||
@Data
|
||||
public class LogEntity extends LoggingEvent {
|
||||
private Map<String,String> propertiys = new HashMap<>();
|
||||
private long timeStamp;
|
||||
private String msg;
|
||||
private String traceId;
|
||||
}
|
||||
@@ -8,6 +8,7 @@ package org.nl.common.lucene;
|
||||
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.AppenderBase;
|
||||
import ch.qos.logback.core.Context;
|
||||
import com.alibaba.ttl.TransmittableThreadLocal;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
@@ -23,6 +24,7 @@ import org.wltea.analyzer.lucene.IKAnalyzer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@@ -32,7 +34,7 @@ public class LuceneAppender extends AppenderBase<ILoggingEvent> {
|
||||
public static final TransmittableThreadLocal<String> traceIdTL = new TransmittableThreadLocal();
|
||||
public LuceneProperties properties;
|
||||
public static Directory index;
|
||||
private List<LucenePropertyAndEncoder> encoders;
|
||||
public static List<LucenePropertyAndEncoder> encoders =new ArrayList<>();
|
||||
public static IndexWriter indexWriter;
|
||||
|
||||
|
||||
@@ -43,7 +45,10 @@ public class LuceneAppender extends AppenderBase<ILoggingEvent> {
|
||||
try {
|
||||
// 读取配置文件
|
||||
Properties properties = YmlConfigFileUtil.readConfig("config/application.yml");
|
||||
|
||||
for (Property property : this.properties.getProperties()) {
|
||||
LucenePropertyAndEncoder encoder = new LucenePropertyAndEncoder(property, this.context);
|
||||
encoders.add(encoder);
|
||||
}
|
||||
// 获取配置值
|
||||
String luceneDir = properties.getProperty("lucene.index.path");
|
||||
System.out.println("---index地址----"+luceneDir);
|
||||
@@ -61,26 +66,22 @@ public class LuceneAppender extends AppenderBase<ILoggingEvent> {
|
||||
@Override
|
||||
protected void append(ILoggingEvent event) {
|
||||
Document doc = new Document();
|
||||
for (Property property : this.properties.getProperties()) {
|
||||
LucenePropertyAndEncoder encoder = new LucenePropertyAndEncoder(property, this.context);
|
||||
String encode = encoder.encode(event);
|
||||
doc.add(new StringField(property.getName(), encode, Field.Store.YES));
|
||||
}
|
||||
Map<String, String> map = event.getMDCPropertyMap();
|
||||
if (!map.isEmpty() && StringUtils.isNotEmpty(map.get("traceId"))){
|
||||
doc.add(new StringField("traceId",map.get("traceId"), Field.Store.YES));
|
||||
}else {
|
||||
doc.add(new StringField("traceId"," ", Field.Store.YES));
|
||||
}
|
||||
|
||||
doc.add(new TextField(LogMessageConstant.FIELD_MESSAGE, event.getFormattedMessage(), Field.Store.YES));
|
||||
doc.add(new StringField(LogMessageConstant.FIELD_TIMESTAMP, String.valueOf(event.getTimeStamp()),Field.Store.YES));
|
||||
doc.add(new NumericDocValuesField(LogMessageConstant.SORT_NAME, event.getTimeStamp()));
|
||||
try {
|
||||
indexWriter.addDocument(doc);
|
||||
indexWriter.commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (event instanceof LogEntity){
|
||||
LogEntity logEntity = (LogEntity) event;
|
||||
Map<String, String> propertiys = logEntity.getPropertiys();
|
||||
propertiys.forEach((a,b)->{
|
||||
doc.add(new StringField(a, b, Field.Store.YES));
|
||||
});
|
||||
doc.add(new StringField("traceId",logEntity.getTraceId(), Field.Store.YES));
|
||||
doc.add(new TextField(LogMessageConstant.FIELD_MESSAGE, logEntity.getMsg(), Field.Store.YES));
|
||||
doc.add(new StringField(LogMessageConstant.FIELD_TIMESTAMP, String.valueOf(logEntity.getTimeStamp()),Field.Store.YES));
|
||||
doc.add(new NumericDocValuesField(LogMessageConstant.SORT_NAME,logEntity.getTimeStamp()));
|
||||
try {
|
||||
indexWriter.addDocument(doc);
|
||||
indexWriter.commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package org.nl.common.lucene.netty;
|
||||
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.StringField;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.nl.common.lucene.LogEntity;
|
||||
import org.nl.common.lucene.LuceneAppender;
|
||||
import org.nl.common.lucene.LucenePropertyAndEncoder;
|
||||
import org.nl.common.utils.MapOf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Map;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2024/1/24 11:07
|
||||
*/
|
||||
public class LuceneJsonWriter extends Writer {
|
||||
|
||||
private StringBuilder sendBuffer;
|
||||
private JsonGenerator jsonGenerator;
|
||||
|
||||
public LuceneJsonWriter() throws IOException {
|
||||
JsonFactory jsonFactory = new JsonFactory();
|
||||
jsonFactory.setRootValueSeparator(null);
|
||||
this.jsonGenerator = jsonFactory.createGenerator(this);
|
||||
}
|
||||
|
||||
public static LogEntity convertLog(ILoggingEvent event){
|
||||
LogEntity logEntity = new LogEntity();
|
||||
Map<String, String> map = logEntity.getPropertiys();
|
||||
for (LucenePropertyAndEncoder encoder : LuceneAppender.encoders) {
|
||||
map.put(encoder.getName(),encoder.encode(event));
|
||||
}
|
||||
String msg = String.format(event.getFormattedMessage(), event.getArgumentArray());
|
||||
logEntity.setMsg(msg);
|
||||
logEntity.setTimeStamp(event.getTimeStamp());
|
||||
Map<String, String> mdc = event.getMDCPropertyMap();
|
||||
if (!mdc.isEmpty() && StringUtils.isNotEmpty(mdc.get("traceId"))){
|
||||
logEntity.setTraceId(mdc.get("traceId"));
|
||||
}else {
|
||||
logEntity.setTraceId(" ");
|
||||
}
|
||||
return logEntity;
|
||||
}
|
||||
@Override
|
||||
public void write(@NotNull char[] cbuf, int off, int len) throws IOException {
|
||||
sendBuffer.append(cbuf, off, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,14 @@ package org.nl.common.lucene.netty;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.util.CharsetUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.lucene.AsyncLuceneAppender;
|
||||
import org.nl.common.lucene.LogEntity;
|
||||
import org.nl.common.lucene.netty.AbstraceServer;
|
||||
import org.nl.common.lucene.netty.impl.ClientServer;
|
||||
import org.nl.common.lucene.netty.impl.RemoteServer;
|
||||
@@ -31,7 +33,7 @@ import java.util.Map;
|
||||
* @author ZZQ
|
||||
* @Date 2024/1/22 09:06
|
||||
*/
|
||||
@Component
|
||||
//@Component
|
||||
public class RemoteLogServer implements SmartLifecycle {
|
||||
|
||||
@Autowired
|
||||
@@ -46,10 +48,12 @@ public class RemoteLogServer implements SmartLifecycle {
|
||||
public static AsyncLuceneAppender asyncLuceneAppender;
|
||||
|
||||
public static void writeLog(ILoggingEvent event){
|
||||
LogEntity logEntity = LuceneJsonWriter.convertLog(event);
|
||||
if (LOCAL_LOG){
|
||||
asyncLuceneAppender.appendSync(event);
|
||||
asyncLuceneAppender.appendSync(logEntity);
|
||||
}else {
|
||||
ByteBuf log = Unpooled.copiedBuffer(JSON.toJSONString(event), CharsetUtil.UTF_8);
|
||||
String json = JSON.toJSONString(logEntity, SerializerFeature.IgnoreErrorGetter);
|
||||
ByteBuf log = Unpooled.copiedBuffer(json, CharsetUtil.UTF_8);
|
||||
server.channel.writeAndFlush(log);
|
||||
}
|
||||
};
|
||||
@@ -58,15 +62,15 @@ public class RemoteLogServer implements SmartLifecycle {
|
||||
@Override
|
||||
public void start() {
|
||||
try {
|
||||
String provider = redisTemplate.opsForValue().get("providers");
|
||||
String provider = redisTemplate.opsForValue().get("provider");
|
||||
if (StringUtils.isEmpty(provider)){
|
||||
String ip = Inet4Address.getLocalHost().getHostAddress();
|
||||
Map<String,Object> config = MapOf.of("ip", ip, "port", port);
|
||||
Map<String,Object> config = MapOf.of("ip", ip, "port", String.valueOf(port));
|
||||
redisTemplate.opsForValue().set("provider", JSON.toJSONString(config));
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() ->{
|
||||
System.out.println("------服务关闭-升级从变主-------");
|
||||
server.doClose();
|
||||
redisTemplate.delete("providers");
|
||||
redisTemplate.delete("provider");
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
}catch (Exception ex){}
|
||||
|
||||
@@ -2,10 +2,8 @@ package org.nl.config;
|
||||
|
||||
import com.alibaba.druid.filter.FilterChain;
|
||||
import com.alibaba.druid.filter.FilterEventAdapter;
|
||||
import com.alibaba.druid.proxy.jdbc.JdbcParameter;
|
||||
import com.alibaba.druid.proxy.jdbc.PreparedStatementProxy;
|
||||
import com.alibaba.druid.proxy.jdbc.ResultSetProxy;
|
||||
import com.alibaba.druid.proxy.jdbc.StatementProxy;
|
||||
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||
import com.alibaba.druid.proxy.jdbc.*;
|
||||
import com.alibaba.druid.sql.SQLUtils;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
import com.mysql.cj.jdbc.result.ResultSetImpl;
|
||||
@@ -13,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -39,14 +38,13 @@ public class DruidFilter extends FilterEventAdapter {
|
||||
|
||||
@Override
|
||||
protected void statementExecuteAfter(StatementProxy statement, String sql, boolean result) {
|
||||
String traceId = MDC.get("traceId");
|
||||
int size = statement.getParametersSize();
|
||||
String executeSql = sql;
|
||||
int count = 0;
|
||||
try {
|
||||
count=statement.getUpdateCount();
|
||||
}catch (Exception ex){ }
|
||||
if (StringUtils.isNotBlank(traceId) && count>0) {
|
||||
if ( count>0) {
|
||||
if (size > 0) {
|
||||
Collection<JdbcParameter> values = statement.getParameters().values();
|
||||
List<Object> params = new ArrayList<>();
|
||||
@@ -61,10 +59,11 @@ public class DruidFilter extends FilterEventAdapter {
|
||||
}
|
||||
@Override
|
||||
public ResultSetProxy statement_getResultSet(FilterChain chain, StatementProxy statement) throws SQLException {
|
||||
String jdbc = chain.getDataSource().getRawJdbcUrl();
|
||||
System.out.println(jdbc);
|
||||
ResultSetProxy rs = super.statement_getResultSet(chain, statement);
|
||||
String executeSql = statement.getLastExecuteSql();
|
||||
String traceId = MDC.get("traceId");
|
||||
if (StringUtils.isNotBlank(traceId)){
|
||||
if (true){
|
||||
int result = 0;
|
||||
if (rs != null) {
|
||||
ResultSetImpl rss = rs.getResultSetRaw().unwrap(ResultSetImpl.class);
|
||||
|
||||
@@ -18,9 +18,6 @@ import javax.sql.DataSource;
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
/**
|
||||
* 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除)
|
||||
添加自增插件
|
||||
@@ -36,11 +33,4 @@ public class MybatisPlusConfig {
|
||||
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void datainnit(){
|
||||
String url = ((DruidDataSource) dataSource).getUrl();
|
||||
System.out.println("项目数据库地址:"+url);
|
||||
log.debug("项目数据库地址:{}",url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class WQLCore {
|
||||
//解析wql文件的根目录
|
||||
public static String ROOT = "wql";
|
||||
//数据库默认名
|
||||
public static String defalutDBName = "dataSource";
|
||||
public static String defalutDBName = "dataSource";//集群时使用SpringContextHolder.getBean("shardingSphereDataSource")
|
||||
//wql源文件
|
||||
public static HashMap<String, ArrayList<String>> wqlMap = new HashMap<String, ArrayList<String>>();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.modules.wql.core.db;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.wql.WQLCore;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.jdbc.datasource.DataSourceUtils;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
@@ -38,13 +39,13 @@ public class DBConnection {
|
||||
return conn;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static Connection getConnection(String name) {
|
||||
Connection conn = null;
|
||||
|
||||
|
||||
DBPoolSpring dbPoolSpring = DBPoolSpring.getInstance(name);
|
||||
if(dbPoolSpring.isUseful()){
|
||||
currpooltype = DBPOOLTYPE_SPRING;
|
||||
@@ -80,7 +81,7 @@ public class DBConnection {
|
||||
try {
|
||||
// if(null!=conn){
|
||||
//conn.setAutoCommit(true);
|
||||
|
||||
|
||||
//不启用事务
|
||||
// conn.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
|
||||
// }
|
||||
@@ -89,7 +90,7 @@ public class DBConnection {
|
||||
}
|
||||
return conn;
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 开启事务
|
||||
// * @param conn
|
||||
@@ -110,14 +111,14 @@ public class DBConnection {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public static UserTransaction getTransaction() {
|
||||
// return getTransaction(WQLCore.defalutDBName);
|
||||
// }
|
||||
|
||||
// public static UserTransaction getTransaction(String name) {
|
||||
// UserTransaction utx = null;
|
||||
//
|
||||
//
|
||||
// DBPoolSpring dbPoolSpring = DBPoolSpring.getInstance();
|
||||
// if(dbPoolSpring.isUseful()){
|
||||
// utx = dbPoolSpring.getTransaction(name);
|
||||
@@ -143,12 +144,12 @@ public class DBConnection {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// log.error("DBConnection无法获得事务管理资源.");
|
||||
// }
|
||||
// return utx;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 释放数据库连接
|
||||
* @param conn
|
||||
@@ -156,7 +157,7 @@ public class DBConnection {
|
||||
public static void freeConnection(Connection conn) {
|
||||
freeConnection(conn,null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 释放数据库连接
|
||||
* @param conn
|
||||
@@ -168,8 +169,13 @@ public class DBConnection {
|
||||
if(null==name||"".equals(name)){
|
||||
name = WQLCore.defalutDBName;
|
||||
}
|
||||
DataSource dataSource = (DataSource) SpringContextHolder.getApplicationContext().getBean(name);
|
||||
DataSourceUtils.releaseConnection(conn, dataSource);
|
||||
Object dataSource;
|
||||
try {
|
||||
dataSource = SpringContextHolder.getApplicationContext().getBean(name);
|
||||
}catch (NoSuchBeanDefinitionException ex){
|
||||
dataSource = SpringContextHolder.getApplicationContext().getBean(DataSource.class);
|
||||
}
|
||||
DataSourceUtils.releaseConnection(conn, (DataSource) dataSource);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -182,7 +188,7 @@ public class DBConnection {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
/*
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.modules.wql.core.db;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.wql.WQLCore;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.jdbc.datasource.DataSourceUtils;
|
||||
|
||||
import javax.naming.Context;
|
||||
@@ -50,7 +51,7 @@ public class DBPoolSpring {
|
||||
static synchronized public DBPoolSpring getInstance(String name) {
|
||||
if (instance == null) {
|
||||
instance = new DBPoolSpring();
|
||||
// Connection conn = getConnection();
|
||||
Connection conn = getConnection();
|
||||
// if (conn !=null ){//&& ut !=null
|
||||
// setUseful (true);
|
||||
// }else{
|
||||
@@ -78,8 +79,13 @@ public class DBPoolSpring {
|
||||
public static Connection getConnection(String name) {
|
||||
Connection conn = null;
|
||||
try {
|
||||
DataSource dataSource = (DataSource) SpringContextHolder.getBean(name);
|
||||
conn = DataSourceUtils.getConnection(dataSource);
|
||||
Object bean;
|
||||
try {
|
||||
bean = SpringContextHolder.getBean(name);
|
||||
}catch (NoSuchBeanDefinitionException ex){
|
||||
bean = SpringContextHolder.getBean(DataSource.class);
|
||||
}
|
||||
conn = DataSourceUtils.getConnection((DataSource) bean);
|
||||
} catch (Exception e) {
|
||||
log.error("不能获得Spring连接池中的数据库连接:" + e.toString());
|
||||
}
|
||||
@@ -115,15 +121,15 @@ public class DBPoolSpring {
|
||||
* @param conn 连接对象
|
||||
*/
|
||||
public static void freeConnection(Connection conn, String name) {
|
||||
// try {
|
||||
// if (conn != null) {
|
||||
// conn.close();
|
||||
// }
|
||||
DataSource dataSource = (DataSource) SpringContextHolder.getBean(name);
|
||||
DataSourceUtils.releaseConnection(conn, dataSource);
|
||||
// } catch (SQLException e) {
|
||||
// log.error("数据库连接关闭:"+e.toString() );
|
||||
// }
|
||||
Object bean;
|
||||
try {
|
||||
bean = SpringContextHolder.getBean(name);
|
||||
}catch (NoSuchBeanDefinitionException ex){
|
||||
bean = SpringContextHolder.getBean(DataSource.class);
|
||||
}
|
||||
if (bean !=null){
|
||||
DataSourceUtils.releaseConnection(conn, (DataSource) bean);
|
||||
}
|
||||
}
|
||||
|
||||
private static InitialContext getInitialContext() throws NamingException {
|
||||
@@ -148,6 +154,6 @@ public class DBPoolSpring {
|
||||
// public static void main(String[] args) {
|
||||
//
|
||||
// DBPoolSpring cnn = DBPoolSpring.getInstance();
|
||||
//
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* 创 建 者 :yumeng
|
||||
* 创建时间:2014-07-01 14:25:35
|
||||
* 文件版本:v1.0
|
||||
* 文件版本:v1.0
|
||||
*
|
||||
*******************************************************/
|
||||
package org.nl.modules.wql.core.engine.object;
|
||||
@@ -29,8 +29,10 @@ import org.nl.modules.wql.core.engine.Syntax;
|
||||
import org.nl.modules.wql.exception.WDKException;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.sql.DataSource;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
@@ -45,11 +47,16 @@ public class WO implements Serializable, Cloneable{
|
||||
private static final long serialVersionUID = -4831486954013002791L;
|
||||
public WP wp;
|
||||
private String code = ""; //当前交易编号
|
||||
private String dbname = "dataSource"; //指定使用的数据库
|
||||
private String dbname = "dataSource"; //指定使用的数据库;使用集群数据库时名字需要改成SpringContextHolder.getBean("shardingSphereDataSource")
|
||||
|
||||
public WO setDbname(String dbname) {
|
||||
this.dbname = dbname;
|
||||
Object bean = SpringContextHolder.getBean(dbname);
|
||||
Object bean;
|
||||
try {
|
||||
bean = SpringContextHolder.getBean(dbname);
|
||||
}catch (NoSuchBeanDefinitionException ex){
|
||||
bean = SpringContextHolder.getBean(DataSource.class);
|
||||
}
|
||||
if(bean instanceof DruidDataSource) {
|
||||
DruidDataSource druidDataSource = (DruidDataSource) bean;
|
||||
String rawJdbcUrl = druidDataSource.getRawJdbcUrl();
|
||||
|
||||
@@ -406,7 +406,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
|
||||
// 调用入库分配规则
|
||||
StIvtSectattr sect = sectattrService.getOne(
|
||||
new QueryWrapper<StIvtSectattr>().lambda()
|
||||
.eq(StIvtSectattr::getSect_name, "海柔半成品库区")
|
||||
.eq(StIvtSectattr::getSect_name, "三线半成品库区")
|
||||
);
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("sect_id", sect.getSect_id());
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package org.nl.wms.storage_manage.pda.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shardingsphere.spring.boot.SpringBootConfiguration;
|
||||
import org.apache.shardingsphere.spring.boot.datasource.DataSourceMapSetter;
|
||||
import org.apache.shardingsphere.spring.boot.datasource.prop.impl.DataSourcePropertiesSetterHolder;
|
||||
import org.apache.shardingsphere.transaction.ShardingTransactionManagerEngine;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.storage_manage.pda.service.PdaStHrBcpInService;
|
||||
import org.nl.wms.storage_manage.semimanagehr.service.iostorInv.IStIvtIostorinvOrderService;
|
||||
import org.nl.wms.storage_manage.semimanagehr.service.iostorInv.dao.StIvtIostorinvOrder;
|
||||
import org.nl.wms.storage_manage.semimanagehr.service.iostorInv.dto.HrBcpIostorOrderQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 手持半成品出入库顺序 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2023-08-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/pda/hrBcp/order")
|
||||
public class PdaStHrBcpOrderController {
|
||||
|
||||
@Autowired
|
||||
protected IStIvtIostorinvOrderService iStIvtIostorinvOrderService; // 出入顺序服务
|
||||
|
||||
@GetMapping
|
||||
@Log("获取出入库顺序表")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getMaterial(HrBcpIostorOrderQuery query, PageQuery page) {
|
||||
Page<StIvtIostorinvOrder> result = iStIvtIostorinvOrderService.page(page.build(), query.build());
|
||||
JSONObject jo = WQLObject.getWQLObject("sys_code_rule").query("code = '" + "IO_CODE" + "'").uniqueResult(0);
|
||||
System.out.println(JSONObject.toJSONString(jo));
|
||||
return new ResponseEntity<>(TableDataInfo.build(result), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
@Log("获取出入库顺序表")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getorders(@RequestBody JSONObject param) {
|
||||
String bar_code = param.getString("bar_code");
|
||||
HrBcpIostorOrderQuery query = new HrBcpIostorOrderQuery();
|
||||
if (StringUtils.isNotEmpty(bar_code)){
|
||||
query.setBar_code(bar_code);
|
||||
}
|
||||
Page<StIvtIostorinvOrder> result = iStIvtIostorinvOrderService.page(new Page<>(param.getInteger("page"),param.getInteger("size")), query.build());
|
||||
return new ResponseEntity<>(MapOf.of("message","操作成功","totalCount",result.getTotal(),"data",result.getRecords()), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Log("update顺序表")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getMaterial(@RequestBody StIvtIostorinvOrder order) {
|
||||
if (order!=null){
|
||||
iStIvtIostorinvOrderService.updateById(order);
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@Log("删除入库顺序表")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids){
|
||||
if (ids!=null && ids.length>0){
|
||||
iStIvtIostorinvOrderService.removeByIds(Arrays.asList(ids));
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.nl.wms.storage_manage.semimanagehr.service.iostorInv.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.common.domain.query.QParam;
|
||||
import org.nl.common.enums.QueryTEnum;
|
||||
import org.nl.wms.storage_manage.semimanage.service.iostorInv.dao.StIvtIostorinvBcp;
|
||||
import org.nl.wms.storage_manage.semimanagehr.service.iostorInv.dao.StIvtIostorinvOrder;
|
||||
|
||||
/*
|
||||
* @author LXY
|
||||
* @Date 2023/08/01 19:49
|
||||
*/
|
||||
@Data
|
||||
public class HrBcpIostorOrderQuery extends BaseQuery<StIvtIostorinvOrder> {
|
||||
/**
|
||||
* 载具码
|
||||
*/
|
||||
private String bar_code;
|
||||
/**
|
||||
* 出入库类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ public class PdaQuery extends BaseQuery<StIvtShutframeinvBcp> {
|
||||
|
||||
|
||||
private String material_code;
|
||||
private String product_area;
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
|
||||
@@ -80,7 +80,7 @@ public class PdaStHrBcpEmpOutServiceImpl implements PdaStHrBcpEmpOutService {
|
||||
|
||||
StIvtSectattr sect = sectattrService.getOne(
|
||||
new QueryWrapper<StIvtSectattr>().lambda()
|
||||
.eq(StIvtSectattr::getSect_name, "海柔半成品库区")
|
||||
.eq(StIvtSectattr::getSect_name, "三线半成品库区")
|
||||
);
|
||||
|
||||
List<StIvtStructattr> list = new ArrayList<>();
|
||||
|
||||
@@ -65,10 +65,12 @@ public class PdaStHrBcpInServiceImpl implements PdaStHrBcpInService {
|
||||
List<MdMeMaterialbase> list1 = iMdMeMaterialbaseService.list(
|
||||
new QueryWrapper<MdMeMaterialbase>().lambda()
|
||||
.eq(MdMeMaterialbase::getMaterial_type_id, "1528555445302726656")
|
||||
.eq(MdMeMaterialbase::getProduct_area, "A3")
|
||||
);
|
||||
list = list1.subList(0, Math.min(list1.size(), size));
|
||||
totalCount = list1.size();
|
||||
} else {
|
||||
whereJson.setProduct_area("A3");
|
||||
List list1 = iMdMeMaterialbaseService.getPdaBcpGetMaterial(whereJson, pageQuery);
|
||||
list = list1.subList(0, Math.min(list1.size(), size));
|
||||
totalCount = list1.size();
|
||||
|
||||
@@ -60,7 +60,7 @@ public class IosHrTask extends AbstractAcsTask {
|
||||
// 2.判断device_code2、barcode2 是否为空
|
||||
if (ObjectUtil.isNotEmpty(json.getString("device_code2")) && ObjectUtil.isNotEmpty(json.getString("barcode2"))) {
|
||||
|
||||
param.put("device_code", json.getString("device_code2"));
|
||||
param.put("device_code", json.getString("device_code1"));
|
||||
param.put("barcode", json.getString("barcode2"));
|
||||
iStIvtIostorinvHrBcpInService.fullIn(param);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class IosHrTask extends AbstractAcsTask {
|
||||
|
||||
// 2.判断device_code2、barcode2 是否为空
|
||||
if (ObjectUtil.isNotEmpty(json.getString("device_code2")) && ObjectUtil.isNotEmpty(json.getString("barcode2"))) {
|
||||
param.put("device_code", json.getString("device_code2"));
|
||||
param.put("device_code", json.getString("device_code1"));
|
||||
param.put("barcode", json.getString("barcode2"));
|
||||
iStIvtIostorinvEmpBcpService.InEmp(param);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class IosHrTask extends AbstractAcsTask {
|
||||
|
||||
// 2.判断device_code2、barcode2 是否为空
|
||||
if (ObjectUtil.isNotEmpty(json.getString("device_code2"))) {
|
||||
param.put("device_code", json.getString("device_code2"));
|
||||
param.put("device_code", json.getString("device_code1"));
|
||||
iStIvtIostorinvEmpBcpService.OutEmp(param);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,5 +228,7 @@ public class StIvtIostorinvHrBcp implements Serializable {
|
||||
*/
|
||||
private String point_code;
|
||||
|
||||
private String workprocedure_id;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class StIvtIostorinvEmpBcpServiceImpl implements IStIvtIostorinvEmpBcpSe
|
||||
// 1.找一个空货位
|
||||
StIvtSectattr sect = sectattrService.getOne(
|
||||
new QueryWrapper<StIvtSectattr>().lambda()
|
||||
.eq(StIvtSectattr::getSect_name, "海柔半成品库区")
|
||||
.eq(StIvtSectattr::getSect_name, "三线半成品库区")
|
||||
);
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
@@ -173,7 +173,7 @@ public class StIvtIostorinvEmpBcpServiceImpl implements IStIvtIostorinvEmpBcpSe
|
||||
// 1.找一个空载具的货位
|
||||
StIvtSectattr sect = sectattrService.getOne(
|
||||
new QueryWrapper<StIvtSectattr>().lambda()
|
||||
.eq(StIvtSectattr::getSect_name, "海柔半成品库区")
|
||||
.eq(StIvtSectattr::getSect_name, "三线半成品库区")
|
||||
);
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
|
||||
@@ -174,6 +174,7 @@ public class StIvtIostorinvHrBcpInServiceImpl extends ServiceImpl<StIvtIostorinv
|
||||
mst.setBase_bill_code(row.getString("base_bill_code"));
|
||||
mst.setQty_unit_name(row.getString("base_unit_name"));
|
||||
mst.setUnit_weight(row.getBigDecimal("unit_weight"));
|
||||
mst.setWorkprocedure_id(row.getString("workprocedure_id"));
|
||||
// 载具信息
|
||||
{
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getOne(
|
||||
@@ -303,7 +304,9 @@ public class StIvtIostorinvHrBcpInServiceImpl extends ServiceImpl<StIvtIostorinv
|
||||
.set(MdPbStoragevehicleext::getMaterial_id, mst.getMaterial_id())
|
||||
.set(MdPbStoragevehicleext::getStorage_qty, mst.getPlan_qty())
|
||||
);
|
||||
|
||||
if (StringUtils.isNotEmpty(mst.getStoragevehicle_code())){
|
||||
iStIvtIostorinvOrderService.remove(new QueryWrapper<StIvtIostorinvOrder>().eq("bar_code",mst.getStoragevehicle_code()));
|
||||
}
|
||||
// 更新任务为完成
|
||||
iSchBaseTaskService.update(
|
||||
new UpdateWrapper<SchBaseTask>().lambda()
|
||||
|
||||
@@ -239,6 +239,9 @@ public class StIvtIostorinvHrBcpOutServiceImpl extends ServiceImpl<StIvtIostorin
|
||||
new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
||||
.eq(MdPbStoragevehicleext::getStoragevehicle_code,mst.getStoragevehicle_code())
|
||||
);
|
||||
if (StringUtils.isNotEmpty(mst.getStoragevehicle_code())){
|
||||
iStIvtIostorinvOrderService.remove(new QueryWrapper<StIvtIostorinvOrder>().eq("bar_code",mst.getStoragevehicle_code()));
|
||||
}
|
||||
|
||||
// 插入出入库顺序表
|
||||
StIvtIostorinvOrder dao = new StIvtIostorinvOrder();
|
||||
@@ -468,6 +471,8 @@ public class StIvtIostorinvHrBcpOutServiceImpl extends ServiceImpl<StIvtIostorin
|
||||
.task_group_id(IdUtil.getStringId())
|
||||
.point_code3(mst.getPoint_code())
|
||||
.point_code1(mst.getStruct_code())
|
||||
.extParam(MapOf.of("material_id",mst.getMaterial_id(),
|
||||
"material_qty",mst.getPlan_qty(),"table_fk_id",mst.getIostorinv_id()))
|
||||
.vehicle_code(mst.getStoragevehicle_code())
|
||||
.product_area(mst.getWorkshop_id())
|
||||
.callback((Consumer<String>) mst::setTask_id)
|
||||
|
||||
@@ -81,7 +81,7 @@ public class StIvtMoveinvHrBcpServiceImpl extends ServiceImpl<StIvtMoveinvHrBcpM
|
||||
|
||||
// 新增
|
||||
mst.setMoveinv_id(IdUtil.getStringId());
|
||||
mst.setBill_code(CodeUtil.getNewCode("BCP_MOVE_CODE"));
|
||||
mst.setBill_code(CodeUtil.getNewCode("MOVE_CODE"));
|
||||
mst.setBuss_type(form.getString("buss_type"));
|
||||
mst.setBill_type(form.getString("buss_type"));
|
||||
mst.setStor_id(form.getString("stor_id"));
|
||||
|
||||
@@ -76,7 +76,7 @@ public class StIvtMoveinvdtlHrBcpServiceImpl extends ServiceImpl<StIvtMoveinvdtl
|
||||
StIvtMoveinvdtlHrBcp moveinvdtlCp = list.get(0);
|
||||
PointEvent event = PointEvent.builder()
|
||||
.type(AcsTaskEnum.TASK_STRUCT_BCP_HR_MOVE)
|
||||
.acs_task_type(AcsTaskEnum.ACS_TASK_TYPE_NON_WEIGHING_TASK_OF_PS20.getCode())
|
||||
.acs_task_type("19")
|
||||
.task_group_id(IdUtil.getStringId())
|
||||
.point_code1(form.getString("turnout_struct_code"))
|
||||
.point_code3(form.getString("turnin_struct_code"))
|
||||
|
||||
@@ -101,5 +101,9 @@ public class StIvtStructivtHrBcp implements Serializable {
|
||||
*/
|
||||
private BigDecimal unit_weight;
|
||||
|
||||
/**
|
||||
* 工序标识
|
||||
*/
|
||||
private String workprocedure_id;
|
||||
|
||||
}
|
||||
|
||||
@@ -50,6 +50,9 @@
|
||||
<if test="query.sect_id != null and query.sect_id != ''">
|
||||
and sa.sect_id = #{query.sect_id}
|
||||
</if>
|
||||
<if test="query.sect_code != null and query.sect_code != ''">
|
||||
and sa.sect_code = #{query.sect_code}
|
||||
</if>
|
||||
<if test="query.struct_search != null and query.struct_search != ''">
|
||||
and (sa.struct_code = #{query.struct_search} OR sa.struct_name = #{query.struct_search})
|
||||
</if>
|
||||
@@ -123,7 +126,8 @@
|
||||
attr.sect_code,
|
||||
attr.sect_name,
|
||||
attr.stor_name,
|
||||
attr.storagevehicle_code
|
||||
attr.storagevehicle_code,
|
||||
attr.lock_type
|
||||
FROM
|
||||
st_ivt_structivt_hr_bcp ivt
|
||||
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||
|
||||
@@ -16,6 +16,8 @@ public class StructIvtHrBcpQuery extends BaseQuery<StIvtStructivtBcp> {
|
||||
|
||||
private String sect_id;
|
||||
|
||||
private String sect_code;
|
||||
|
||||
private String struct_search;
|
||||
|
||||
private String material_search;
|
||||
|
||||
@@ -51,6 +51,7 @@ public class StIvtStructivtHrBcpServiceImpl extends ServiceImpl<StIvtStructivtHr
|
||||
@Override
|
||||
public Object getBcpIvt(StructIvtHrBcpQuery query, PageQuery pageQuery) {
|
||||
com.github.pagehelper.Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
query.setSect_code("HKQ001");
|
||||
List<Map> mst_detail = this.baseMapper.getBcpIvt(query, pageQuery);
|
||||
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
|
||||
build.setTotalElements(page.getTotal());
|
||||
|
||||
@@ -2,54 +2,81 @@ server:
|
||||
port: 8011
|
||||
#配置数据源
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.5}:${DB_PORT:3306}/${DB_NAME:hl_one_mes_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.5}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.5}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:123456}
|
||||
password: ${DB_PWD:942464Yy}
|
||||
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
min-idle: 15
|
||||
# 最大连接数
|
||||
max-active: 30
|
||||
# 是否自动回收超时连接
|
||||
remove-abandoned: true
|
||||
# 超时时间(以秒数为单位)
|
||||
remove-abandoned-timeout: 180
|
||||
# 获取连接超时时间
|
||||
max-wait: 3000
|
||||
# 连接有效性检测时间
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 连接在池中最小生存的时间
|
||||
min-evictable-idle-time-millis: 300000
|
||||
# 连接在池中最大生存的时间
|
||||
max-evictable-idle-time-millis: 900000
|
||||
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
||||
test-while-idle: true
|
||||
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
||||
test-on-borrow: true
|
||||
# 是否在归还到池中前进行检验
|
||||
test-on-return: false
|
||||
# 检测连接是否有效
|
||||
validation-query: select 1
|
||||
# 配置监控统计
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
reset-enable: false
|
||||
filters:
|
||||
DruidFilter,stat
|
||||
|
||||
autoconfigure:
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
shardingsphere:
|
||||
enabled: true
|
||||
datasource:
|
||||
common:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 初始连接数
|
||||
initial-size: 10
|
||||
# 最小连接数
|
||||
min-idle: 10
|
||||
# 最大连接数
|
||||
max-active: 100
|
||||
# 是否自动回收超时连接
|
||||
remove-abandoned: true
|
||||
# 超时时间(以秒数为单位)
|
||||
remove-abandoned-timeout: 180
|
||||
# 获取连接超时时间
|
||||
max-wait: 5000
|
||||
# 连接有效性检测时间
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 连接在池中最小生存的时间
|
||||
min-evictable-idle-time-millis: 300000
|
||||
# 连接在池中最大生存的时间
|
||||
max-evictable-idle-time-millis: 900000
|
||||
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
||||
test-while-idle: true
|
||||
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
||||
test-on-borrow: true
|
||||
# 是否在归还到池中前进行检验
|
||||
test-on-return: false
|
||||
# 检测连接是否有效
|
||||
validation-query: select 1
|
||||
# 配置监控统计
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
reset-enable: false
|
||||
filters:
|
||||
DruidFilter,stat
|
||||
names: master,slave
|
||||
master:
|
||||
url: jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:942464Yy}
|
||||
slave:
|
||||
url: jdbc:mysql://${DB_HOST:192.168.81.165}:${DB_PORT:3306}/${DB_NAME:hl_one_mes2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:password}
|
||||
rules:
|
||||
replica-query:
|
||||
data-sources:
|
||||
db:
|
||||
# 读写分离类型,比如:Static,Dynamic
|
||||
type: Static
|
||||
#主数据源名称
|
||||
primary-data-source-name: master
|
||||
#从数据源名称,多个用逗号分隔
|
||||
replica-data-source-names: slave
|
||||
#负载均衡算法名称
|
||||
load-balancer-name: round-robin
|
||||
props:
|
||||
#接口有事务,读写分离不生效,默认全部使用主库
|
||||
write-data-source-name: master
|
||||
read-data-source-names: slave
|
||||
load-balancers:
|
||||
round-robin:
|
||||
#负载均衡算法配置,一共三种一种是 RANDOM(随机),一种是 ROUND_ROBIN(轮询),一种是 WEIGHT(权重)
|
||||
type: ROUND_ROBIN
|
||||
props:
|
||||
#负载均衡算法属性配置
|
||||
workId: 1
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:1}
|
||||
|
||||
@@ -34,11 +34,12 @@
|
||||
</encoder>
|
||||
</appender>
|
||||
<!--异步到文件-->
|
||||
<appender name="asyncFileAppender" class="com.yomahub.tlog.core.enhance.logback.async.AspectLogbackAsyncAppender">
|
||||
<appender name="asyncFileAppender" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<discardingThreshold>2</discardingThreshold>
|
||||
<queueSize>500</queueSize>
|
||||
<appender-ref ref="FILE"/>
|
||||
</appender>
|
||||
|
||||
<appender name="luceneAppender" class="org.nl.common.lucene.LuceneAppender" >
|
||||
<properties>
|
||||
<property>
|
||||
@@ -76,9 +77,10 @@
|
||||
<queueSize>512</queueSize>
|
||||
</appender>
|
||||
|
||||
<!--开发环境:打印控制台-->
|
||||
<springProfile name="dev">
|
||||
<root level="debug">
|
||||
|
||||
<springProfile name="dev3">
|
||||
<root level="info">
|
||||
<appender-ref ref="asyncLuceneAppender"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
<logger name="jdbc" level="ERROR" additivity="true">
|
||||
@@ -106,17 +108,10 @@
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</logger>
|
||||
</springProfile>
|
||||
|
||||
<springProfile name="dev3">
|
||||
<root level="info">
|
||||
<appender-ref ref="asyncLuceneAppender"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
<springProfile name="prod">
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="asyncLuceneAppender"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
<logger name="jdbc" level="ERROR" additivity="true">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
|
||||
@@ -151,6 +151,19 @@
|
||||
|
||||
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码"/>
|
||||
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称"/>
|
||||
<el-table-column show-overflow-tooltip prop="workprocedure_id" label="所属工序">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="form.tableData[scope.$index].workprocedure_id"
|
||||
class="filter-item" placeholder="所属工序" size="small" style="width: 280px">
|
||||
<el-option
|
||||
v-for="item in workprocedureList"
|
||||
:key="item.workprocedure_id"
|
||||
:label="item.workprocedure_name"
|
||||
:value="item.workprocedure_id"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column show-overflow-tooltip prop="material_spec" label="物料规格"/>
|
||||
<el-table-column show-overflow-tooltip prop="plan_qty" label="数量(个)">
|
||||
<template slot-scope="scope">
|
||||
@@ -217,6 +230,7 @@ import crudsemiproductIn from '@/views/wms/storage_manage/semiproducthr/semiprod
|
||||
import MaterDtl from '@/views/wms/pub/MaterDialog'
|
||||
import crudStorattr from '@/views/wms/storage_manage/basedata/basedata'
|
||||
import crudPoint from '@/views/wms/scheduler_manage/point/point'
|
||||
import crudWorkProcedure from '@/api/wms/basedata/pdm/workProcedure'
|
||||
|
||||
const defaultForm = {
|
||||
bill_code: '',
|
||||
@@ -257,6 +271,7 @@ export default {
|
||||
materType: '01',
|
||||
storlist: [],
|
||||
pointList: [],
|
||||
workprocedureList: [],
|
||||
billtypelist: [],
|
||||
rules: {
|
||||
product_code: [
|
||||
@@ -283,6 +298,9 @@ export default {
|
||||
crudStorattr.getStor({'stor_type': '5'}).then(res => {
|
||||
this.storlist = res.content
|
||||
})
|
||||
crudWorkProcedure.downSelect({ product_area: 'A3' }).then(res => {
|
||||
this.workprocedureList = res
|
||||
})
|
||||
const area_type = 'A3_BCPRK01'
|
||||
crudPoint.getPoint({ 'area_type': area_type }).then(res => {
|
||||
this.pointList = res
|
||||
|
||||
@@ -105,6 +105,11 @@
|
||||
<el-table-column min-width="120" show-overflow-tooltip prop="material_code" label="物料编码" align="center" />
|
||||
<el-table-column min-width="120" show-overflow-tooltip prop="material_name" label="物料名称" align="center" />
|
||||
<el-table-column min-width="120" show-overflow-tooltip prop="material_spec" label="物料规格" align="center" />
|
||||
<el-table-column min-width="120" show-overflow-tooltip prop="workprocedure_id" label="所属工序">
|
||||
<template slot-scope="scope">
|
||||
{{ getprocedurename(scope.row) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="pcsn" label="批次" width="150" align="center" />
|
||||
<el-table-column prop="plan_qty" :formatter="crud.formatNum3" label="数量(个)" align="center" />
|
||||
<el-table-column prop="qty_unit_name" label="单位" align="center" />
|
||||
@@ -124,6 +129,8 @@
|
||||
|
||||
import { crud } from '@crud/crud'
|
||||
import crudsemiproductIn from '@/views/wms/storage_manage/semiproducthr/semiproducthrIn/semiproducthrIn'
|
||||
import crudWorkProcedure from '@/api/wms/basedata/pdm/workProcedure'
|
||||
|
||||
|
||||
export default {
|
||||
name: 'ViewDialog',
|
||||
@@ -145,6 +152,7 @@ export default {
|
||||
tableDtl: [],
|
||||
tabledis: [],
|
||||
billtypelist: [],
|
||||
workprocedureList: {},
|
||||
storlist: [],
|
||||
currentdtl: null,
|
||||
currentDis: {},
|
||||
@@ -164,7 +172,17 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getprocedurename(row) {
|
||||
return this.workprocedureList.get(row.workprocedure_id)
|
||||
},
|
||||
open() {
|
||||
crudWorkProcedure.downSelect({ product_area: 'A3' }).then(res => {
|
||||
var procedures = new Map();
|
||||
res.forEach(item => {
|
||||
procedures.set(item.workprocedure_id,item.workprocedure_name)
|
||||
})
|
||||
this.workprocedureList = procedures
|
||||
})
|
||||
this.queryTableDtl()
|
||||
},
|
||||
close() {
|
||||
|
||||
@@ -91,9 +91,15 @@
|
||||
<el-table-column show-overflow-tooltip min-width="120" prop="material_code" label="物料编码" />
|
||||
<el-table-column show-overflow-tooltip min-width="120" prop="material_name" label="物料名称" />
|
||||
<el-table-column show-overflow-tooltip min-width="120" prop="material_spec" label="物料规格" />
|
||||
<el-table-column show-overflow-tooltip min-width="120" prop="lock_type" label="锁定类型" />
|
||||
<el-table-column show-overflow-tooltip min-width="120" prop="workprocedure_id" label="所属工序" >
|
||||
<template slot-scope="scope">
|
||||
{{ getprocedurename(scope.row) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="载具号" />
|
||||
<el-table-column show-overflow-tooltip prop="canuse_qty" label="可用数量(个)" :formatter="crud.formatNum3" />
|
||||
<!-- <el-table-column show-overflow-tooltip prop="unit_name" label="单位" />-->
|
||||
<!-- <el-table-column show-overflow-tooltip prop="unit_name" label="单位" />-->
|
||||
<el-table-column show-overflow-tooltip prop="instorage_time" label="入库时间" min-width="150" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
@@ -111,6 +117,8 @@ import pagination from '@crud/Pagination'
|
||||
import DateRangePicker from '@/components/DateRangePicker/index'
|
||||
import crudStorattr, { getStor } from '@/views/wms/storage_manage/basedata/basedata'
|
||||
import semiproductivt from '@/views/wms/storage_manage/semiproducthr/semiproducthrIvt/semiproducthrivt'
|
||||
import crudWorkProcedure from '@/api/wms/basedata/pdm/workProcedure'
|
||||
|
||||
|
||||
export default {
|
||||
name: 'ProductIn',
|
||||
@@ -130,6 +138,7 @@ export default {
|
||||
return {
|
||||
height: document.documentElement.clientHeight - 180 + 'px;',
|
||||
permission: {},
|
||||
workprocedureList: {},
|
||||
storlist: [],
|
||||
storId: null
|
||||
}
|
||||
@@ -141,11 +150,21 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudWorkProcedure.downSelect({ product_area: 'A3' }).then(res => {
|
||||
var procedures = new Map();
|
||||
res.forEach(item => {
|
||||
procedures.set(item.workprocedure_id,item.workprocedure_name)
|
||||
})
|
||||
this.workprocedureList = procedures
|
||||
})
|
||||
crudStorattr.getStor({ 'stor_type': '5' }).then(res => {
|
||||
this.storlist = res.content
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getprocedurename(row){
|
||||
return this.workprocedureList.get(row.workprocedure_id)
|
||||
},
|
||||
downloadMethod() {
|
||||
semiproductivt.exportFile(this.query).then(res => {
|
||||
this.crud.notify('导出成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
|
||||
@@ -2,8 +2,8 @@ import request from '@/utils/request'
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: '/api/pda/hrBcp/order',
|
||||
method: 'delete',
|
||||
url: '/api/pda/hrBcp/order/delete',
|
||||
method: 'post',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<el-form-item label="箱码">
|
||||
<label slot="label">箱码:</label>
|
||||
<el-input
|
||||
v-model="query.type"
|
||||
v-model="query.bar_code"
|
||||
clearable
|
||||
style="width: 180px"
|
||||
placeholder="载具号"
|
||||
@@ -42,7 +42,18 @@
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
|
||||
<crudOperation :permission="permission" />
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
type="danger"
|
||||
@click="force(crud.selections)"
|
||||
>
|
||||
强制雀润
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
@@ -52,6 +63,7 @@
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column prop="workshop_id" label="车间" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="type" label="出入库类型" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="order_id" label="顺序id" min-width="100" show-overflow-tooltip />
|
||||
@@ -142,8 +154,19 @@ export default {
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
force(rows){
|
||||
if (rows.length > 0){
|
||||
let ids = []
|
||||
rows.forEach((item) => {
|
||||
ids.push(item.order_id)
|
||||
})
|
||||
crudHrorder.del(ids).then(res => {
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user