From 608fb6f9529ce51291ef682638a5efc7dd51ac63 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期二, 18 十一月 2025 08:21:08 +0800
Subject: [PATCH] 1.完善找库位 2.新增erp订单删除后,wms订单跟着删除功能 3.新增订单完成后,上报erp,erp报错后显现在出货单中 4.新增一键查询到异常完成订单 5.对销售单据和其他单据进行区分出库 6.对中间表订单状态进行完善 7.新增锁单功能 8.新增任务查询维护加上订单号

---
 src/main/java/com/zy/common/config/ds/AbstractRoutingDataSource.java |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/common/config/ds/AbstractRoutingDataSource.java b/src/main/java/com/zy/common/config/ds/AbstractRoutingDataSource.java
new file mode 100644
index 0000000..d8b8519
--- /dev/null
+++ b/src/main/java/com/zy/common/config/ds/AbstractRoutingDataSource.java
@@ -0,0 +1,38 @@
+package com.zy.common.config.ds;
+
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.jdbc.datasource.AbstractDataSource;
+import org.springframework.util.Assert;
+
+import javax.sql.DataSource;
+import java.util.Map;
+
+public abstract class AbstractRoutingDataSource extends AbstractDataSource implements InitializingBean {
+    //澶氭暟鎹簮map闆嗗悎
+    private Map<Object, Object> targetDataSources;
+    //榛樿鏁版嵁婧�
+    private Object defaultTargetDataSource;
+    //鍏跺疄灏辨槸targetDataSources锛屽悗闈㈢殑afterPropertiesSet锛堬級鏂规硶浼氬皢targetDataSources璧嬪�肩粰resolvedDataSources
+    private Map<Object, DataSource> resolvedDataSources;
+    private DataSource resolvedDefaultDataSource;
+
+    public void setTargetDataSources(Map<Object, Object> targetDataSources) {
+        this.targetDataSources = targetDataSources;
+    }
+
+    protected DataSource determineTargetDataSource() {
+        Assert.notNull(this.resolvedDataSources, "DataSource router not initialized");
+        Object lookupKey = this.determineCurrentLookupKey();
+        DataSource dataSource = (DataSource) this.resolvedDataSources.get(lookupKey);
+        if (dataSource == null && ( lookupKey == null)) {
+            dataSource = this.resolvedDefaultDataSource;
+        }
+        if (dataSource == null) {
+            throw new IllegalStateException("Cannot determine target DataSource for lookup key [" + lookupKey + "]");
+        } else {
+            return dataSource;
+        }
+    }
+
+    protected abstract Object determineCurrentLookupKey();
+}
\ No newline at end of file

--
Gitblit v1.9.1