From 7c926c1e3ade5158e6b1b0b805cd1b9c142e4b6c Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期六, 21 十二月 2024 09:45:33 +0800
Subject: [PATCH] 更新代码以使用SqlSugarScope替代SqlSugarClient,并添加生产产线属性

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/GetStationService.cs   |    4 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs                |  118 ++++-
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/RepositoryBase.cs                  |  132 +++---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs                   |   12 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/IDispatchInfoService.cs              |    3 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs                         |   47 ++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/RequestTaskDto.cs                               |    2 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs                       |    9 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs         |   65 ++-
 Code Management/WCS/WIDESEAWCS_Client/src/views/Devicestatus/Craftlibrary/AgingLibrary.vue              |  108 +++--
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/LogHelper/Logger.cs                               |    2 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs         |  325 ++++++++++-------
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/BasicInfo/Dt_needBarcodeService.cs   |    2 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/QuartzJob/DispatchInfoController.cs |   14 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/SqlsugarSetup.cs                       |    6 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs    |    4 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/IUnitOfWorkManage.cs   |    2 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs        |    2 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs   |   13 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/DB/BaseDBConfig.cs                                |    2 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfo.cs                   |    7 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/SchedulerCenterServer.cs           |    6 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs           |    6 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Seed/DBContext.cs                                 |   28 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/DispatchInfoService.cs               |   60 +++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs    |   28 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs                       |   18 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs               |    2 
 28 files changed, 647 insertions(+), 380 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Client/src/views/Devicestatus/Craftlibrary/AgingLibrary.vue b/Code Management/WCS/WIDESEAWCS_Client/src/views/Devicestatus/Craftlibrary/AgingLibrary.vue
index 98eb092..47c9bd9 100644
--- a/Code Management/WCS/WIDESEAWCS_Client/src/views/Devicestatus/Craftlibrary/AgingLibrary.vue
+++ b/Code Management/WCS/WIDESEAWCS_Client/src/views/Devicestatus/Craftlibrary/AgingLibrary.vue
@@ -1,74 +1,78 @@
 <template>
- <el-row>
-    <el-col :span="3">
-     
-      <device-stacker v-for="stacker in Stackers" :key="stacker.deviceName" :Stacker="stacker"></device-stacker>
-    </el-col>
-    <el-col :span="21">
-      <device-line v-for="device in devices" :key="device.deviceName" :device="device" />
-    </el-col>
-  </el-row>
+  <div>
+    <div>
+      <div class="Stackerbox">
+        <div class="card">
+          <div class="card-header">
+            <div>
+              <div class="card-body Stacker">
+                {{ StackerOne.deviceName }}
+              </div>
+            </div>
+          </div>
+          <div class="card-body">
+            <ul class="list-group">
+              <li class="list-group-item list-group-item-secondary">
+                浠诲姟鍙凤細{{ StackerOne.data.currentTaskNum || '鏆傛棤浠诲姟鍙�' }}
+              </li>
+              <li :class="getStatusClass(StackerOne.data.stackerCraneAutoStatusDes)">
+                宸ヤ綔妯″紡锛歿{ StackerOne.data.stackerCraneAutoStatusDes }}
+              </li>
+              <li :class="getStatusClass(StackerOne.data.stackerCraneStatusDes)">
+                璁惧鐘舵�侊細{{ StackerOne.data.stackerCraneStatusDes }}
+              </li>
+              <li :class="getStatusClass(StackerOne.data.stackerCraneWorkStatusDes)">
+                宸ヤ綔鐘舵�侊細{{ StackerOne.data.stackerCraneWorkStatusDes }}
+              </li>
+            </ul>
+          </div>
+        </div>
+      </div>
+    </div>
+    <device-line v-for="device in devices" :key="device.deviceName" :device="device" />
+  </div>
 </template>
 
 <script setup>
 import { onMounted, reactive, toRefs } from "vue";
 import eventBus from "@/uitils/eventBus";
 import DeviceLine from "@/components/DeviceLine.vue";
-import DeviceStacker from "@/components/DeviceStacker.vue";
 
 // 鍫嗗灈鏈�
-const Stackers = reactive([]);
+const StackerOne = reactive({
+  deviceName: "",
+  data: {
+  }
+});
 
 // 璁惧鍒楄〃锛堜慨鏀归噸澶嶈澶囧悕绉帮級
-const devices = reactive([]);
+const devices = reactive([
+  { deviceName: "闄堝寲鍑哄簱杈撻�佺嚎", data: { command: {}, commandWrite: {}, writeInteractiveSignal: [] } },
+  { deviceName: "闄堝寲鍏ュ簱杈撻�佺嚎", data: { command: {}, commandWrite: {}, writeInteractiveSignal: [] } },
+  // { deviceName: "鍫嗗灈鏈�1", data: { command: {}, commandWrite: {}, writeInteractiveSignal: [] } },
+  // Add all devices similarly...
+]);
 
-const intToBitArrayFromBinaryString = (num, numBits) => {
-  let binaryString = num.toString(2).padStart(numBits, '0');
-  return Array.from({ length: numBits }, (_, index) => binaryString[index] === '1');
+// 鑾峰彇鐘舵�佺被鍚嶏紙浼樺寲鐘舵�佸垽鏂級
+const getStatusClass = (status) => {
+  if (status === '姝e父' || status === '鑷姩' || status === '寰呮満') {
+    return 'list-group-item list-group-item-success';
+  }
+  if (status === '鏁呴殰' || status === '鍋滄満') {
+    return 'list-group-item list-group-item-danger';
+  }
+  return 'list-group-item list-group-item-warning'; // 榛樿璀﹀憡鐘舵��
 };
 
 // 鐩戝惉璁惧鏁版嵁鍙樺寲
 onMounted(() => {
   eventBus.on('locationData', eventData => {
-    console.log(eventData)
-    if (eventData.deviceName === "闄堝寲鍏ュ簱杈撻�佺嚎"||eventData.deviceName === "闄堝寲鍏ュ簱杈撻�佺嚎") {
-
-      if (devices.length <= 0) {
-        devices.push({ deviceName: eventData.deviceName, data: eventData.data, childDeviceCode: eventData.childDeviceCode });
-      }
-      else {
-        const device = devices.find(c => c.childDeviceCode == eventData.childDeviceCode)
-        if (device) {
-          const number = eventData.data.commandWrite.writeInteractiveSignal;
-          const writeInteractiveSignal = intToBitArrayFromBinaryString(number, 8)
-          eventData.data.writeInteractiveSignal = writeInteractiveSignal;
-          device.data = eventData.data
-        }
-        else {
-          const number = eventData.data.commandWrite.writeInteractiveSignal;
-          const writeInteractiveSignal = intToBitArrayFromBinaryString(number, 8)
-          eventData.data.writeInteractiveSignal = writeInteractiveSignal;
-          devices.push({ deviceName: eventData.deviceName, data: eventData.data, childDeviceCode: eventData.childDeviceCode });
-        }
-      }
+    const device = devices.find(d => d.deviceName === eventData.deviceName);
+    if (device) {
+      // 浣跨敤鎵╁睍杩愮畻绗︽洿鏂板璞″睘鎬э紝淇濇寔鍝嶅簲鎬�
+      device.data = { ...device.data, ...eventData.data };
     }
   });
-  eventBus.on('stackerData', eventData => {
-    if (eventData.deviceName == "闄堝寲1鍙峰爢鍨涙満"||eventData.deviceName == "闄堝寲2鍙峰爢鍨涙満") {
-      if (Stackers.length == 0) {
-        Stackers.push({ deviceName: eventData.deviceName, data: eventData.data });
-      }
-      else {
-        const Stacker = Stackers.find(c => c.deviceName == eventData.deviceName);
-        if (Stacker) {
-          Stacker.data = eventData.data
-        }
-        else {
-          Stackers.push({ deviceName: eventData.deviceName, data: eventData.data });
-        }
-      }
-    }
-  })
 });
 </script>
 <style scoped>
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/RepositoryBase.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/RepositoryBase.cs
index 20dd214..da6b068 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/RepositoryBase.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/RepositoryBase.cs
@@ -22,7 +22,7 @@
     public class RepositoryBase<TEntity> : IRepository<TEntity> where TEntity : class, new()
     {
         private readonly IUnitOfWorkManage _unitOfWorkManage;
-        private readonly SqlSugarClient _dbBase;
+        private readonly SqlSugarScope _dbBase;
 
         private ISqlSugarClient _db
         {
@@ -84,7 +84,7 @@
         /// <returns>鏌ヨ缁撴灉</returns>
         public virtual TEntity QureyDataById(object id)
         {
-            return _db.Queryable<TEntity>().In(id).Single();
+            return _db.CopyNew().Queryable<TEntity>().In(id).Single();
         }
 
         /// <summary>
@@ -94,7 +94,7 @@
         /// <returns>鏌ヨ缁撴灉闆嗗悎</returns>
         public virtual List<TEntity> QureyDataByIds(object[] lstIds)
         {
-            return _db.Queryable<TEntity>().In(lstIds).ToList();
+            return _db.CopyNew().Queryable<TEntity>().In(lstIds).ToList();
         }
 
         /// <summary>
@@ -104,7 +104,7 @@
         /// <returns>鏌ヨ缁撴灉闆嗗悎</returns>
         public virtual List<TEntity> QureyDataByIds(List<object> lstIds)
         {
-            return _db.Queryable<TEntity>().In(lstIds).ToList();
+            return _db.CopyNew().Queryable<TEntity>().In(lstIds).ToList();
         }
 
         /// <summary>
@@ -114,7 +114,7 @@
         /// <returns>褰卞搷琛屾暟</returns>
         public virtual int AddData(TEntity entity)
         {
-            IInsertable<TEntity> insert = _db.Insertable(entity);
+            IInsertable<TEntity> insert = _db.CopyNew().Insertable(entity);
             return insert.ExecuteReturnIdentity();
         }
 
@@ -125,7 +125,7 @@
         /// <returns>褰卞搷琛屾暟</returns>
         public virtual int AddData(List<TEntity> listEntity)
         {
-            IInsertable<TEntity> insert = _db.Insertable(listEntity);
+            IInsertable<TEntity> insert = _db.CopyNew().Insertable(listEntity);
             return insert.ExecuteCommand();
         }
 
@@ -136,7 +136,7 @@
         /// <returns>鍒犻櫎缁撴灉</returns>
         public virtual bool DeleteDataById(object id)
         {
-            return _db.Deleteable<TEntity>().In(id).ExecuteCommandHasChange();
+            return _db.CopyNew().Deleteable<TEntity>().In(id).ExecuteCommandHasChange();
         }
 
         /// <summary>
@@ -146,7 +146,7 @@
         /// <returns>鍒犻櫎缁撴灉</returns>
         public virtual bool DeleteDataByIds(object[] ids)
         {
-            return _db.Deleteable<TEntity>().In(ids).ExecuteCommandHasChange();
+            return _db.CopyNew().Deleteable<TEntity>().In(ids).ExecuteCommandHasChange();
         }
 
         /// <summary>
@@ -156,7 +156,7 @@
         /// <returns>鍒犻櫎缁撴灉</returns>
         public virtual bool DeleteData(TEntity entity)
         {
-            return _db.Deleteable(entity).ExecuteCommandHasChange();
+            return _db.CopyNew().Deleteable(entity).ExecuteCommandHasChange();
         }
 
         /// <summary>
@@ -166,7 +166,7 @@
         /// <returns>鍒犻櫎缁撴灉</returns>
         public virtual bool DeleteData(List<TEntity> listEntity)
         {
-            return _db.Deleteable(listEntity).ExecuteCommandHasChange();
+            return _db.CopyNew().Deleteable(listEntity).ExecuteCommandHasChange();
         }
 
         /// <summary>
@@ -176,7 +176,7 @@
         /// <returns></returns>
         public virtual bool UpdateData(TEntity entity)
         {
-            return _db.Updateable(entity).ExecuteCommandHasChange();
+            return _db.CopyNew().Updateable(entity).ExecuteCommandHasChange();
         }
 
         /// <summary>
@@ -186,7 +186,7 @@
         /// <returns></returns>
         public virtual bool UpdateData(List<TEntity> listEntity)
         {
-            return _db.Updateable(listEntity).ExecuteCommandHasChange();
+            return _db.CopyNew().Updateable(listEntity).ExecuteCommandHasChange();
         }
 
         /// <summary>
@@ -198,7 +198,7 @@
         /// <returns></returns>
         public virtual bool UpdateData(TEntity entity, List<string> lstColumns, List<string>? lstIgnoreColumns = null)
         {
-            IUpdateable<TEntity> update = _db.Updateable(entity);
+            IUpdateable<TEntity> update = _db.CopyNew().Updateable(entity);
 
             if (lstIgnoreColumns != null && lstIgnoreColumns.Count > 0)
             {
@@ -219,7 +219,7 @@
         /// <returns></returns>
         public virtual List<TEntity> QueryData()
         {
-            return _db.Queryable<TEntity>().ToList();
+            return _db.CopyNew().Queryable<TEntity>().ToList();
         }
 
         /// <summary>
@@ -229,7 +229,7 @@
         /// <returns></returns>
         public virtual List<TEntity> QueryData(string where)
         {
-            return _db.Queryable<TEntity>().WhereIF(!string.IsNullOrEmpty(where), where).ToList();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(!string.IsNullOrEmpty(where), where).ToList();
         }
 
         /// <summary>
@@ -239,17 +239,17 @@
         /// <returns></returns>
         public virtual List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression)
         {
-            return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).ToList();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).ToList();
         }
 
         public virtual TEntity QueryFirst(Expression<Func<TEntity, bool>> whereExpression)
         {
-            return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).First();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).First();
         }
 
         public virtual TResult QueryFirst<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> expression)
         {
-            return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).Select(expression).First();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).Select(expression).First();
         }
 
         /// <summary>
@@ -270,7 +270,7 @@
                 };
                 orderByModels.Add(orderByModel);
             }
-            return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).OrderBy(orderByModels).ToList();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).OrderBy(orderByModels).ToList();
         }
 
         /// <summary>
@@ -291,7 +291,7 @@
                 };
                 orderByModels.Add(orderByModel);
             }
-            return _db.Queryable<TEntity>().WhereIF(!string.IsNullOrEmpty(where), where).OrderBy(orderByModels).ToList();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(!string.IsNullOrEmpty(where), where).OrderBy(orderByModels).ToList();
         }
 
         /// <summary>
@@ -302,7 +302,7 @@
         /// <returns></returns>
         public virtual List<TResult> QueryData<TResult>(Expression<Func<TEntity, TResult>> expression)
         {
-            return _db.Queryable<TEntity>().Select(expression).ToList();
+            return _db.CopyNew().Queryable<TEntity>().Select(expression).ToList();
         }
 
         /// <summary>
@@ -315,7 +315,7 @@
         /// <returns></returns>
         public virtual List<TResult> QueryData<TResult>(Expression<Func<TEntity, TResult>> expression, Expression<Func<TEntity, bool>> whereExpression, string orderByFields = "")
         {
-            return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(whereExpression != null, whereExpression).Select(expression).ToList();
+            return _db.CopyNew().Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(whereExpression != null, whereExpression).Select(expression).ToList();
         }
 
         /// <summary>
@@ -327,7 +327,7 @@
         /// <returns></returns>
         public virtual List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, object>> orderByExpression, bool isAsc = true)
         {
-            return _db.Queryable<TEntity>().OrderByIF(orderByExpression != null, orderByExpression, isAsc ? OrderByType.Asc : OrderByType.Desc).WhereIF(whereExpression != null, whereExpression).ToList();
+            return _db.CopyNew().Queryable<TEntity>().OrderByIF(orderByExpression != null, orderByExpression, isAsc ? OrderByType.Asc : OrderByType.Desc).WhereIF(whereExpression != null, whereExpression).ToList();
         }
 
         /// <summary>
@@ -338,7 +338,7 @@
         /// <returns></returns>
         public virtual List<TEntity> QueryData(string where, string orderByFields)
         {
-            return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(!string.IsNullOrEmpty(where), where).ToList();
+            return _db.CopyNew().Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(!string.IsNullOrEmpty(where), where).ToList();
         }
 
         /// <summary>
@@ -405,7 +405,7 @@
         /// <returns></returns>
         public virtual List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, int top, string orderByFields)
         {
-            return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(whereExpression != null, whereExpression).Take(top).ToList();
+            return _db.CopyNew().Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(whereExpression != null, whereExpression).Take(top).ToList();
         }
 
         /// <summary>
@@ -417,7 +417,7 @@
         /// <returns></returns>
         public virtual List<TEntity> QueryData(string where, int top, string orderByFields)
         {
-            return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(!string.IsNullOrEmpty(where), where).Take(top).ToList();
+            return _db.CopyNew().Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(!string.IsNullOrEmpty(where), where).Take(top).ToList();
         }
 
         /// <summary>
@@ -430,7 +430,7 @@
         /// <returns></returns>
         public virtual List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, int pageIndex, int pageSize, string orderByFields)
         {
-            return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields)
+            return _db.CopyNew().Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields)
                .WhereIF(whereExpression != null, whereExpression).ToPageList(pageIndex, pageSize);
         }
 
@@ -444,7 +444,7 @@
         /// <returns></returns>
         public virtual List<TEntity> QueryData(string where, int pageIndex, int pageSize, string orderByFields)
         {
-            return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields)
+            return _db.CopyNew().Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields)
                 .WhereIF(!string.IsNullOrEmpty(where), where).ToPageList(pageIndex, pageSize);
         }
 
@@ -459,7 +459,7 @@
         public virtual PageGridData<TEntity> QueryPage(Expression<Func<TEntity, bool>> whereExpression, int pageIndex, int pageSize, string? orderByFields = null)
         {
             int totalCount = 0;
-            var list = _db.Queryable<TEntity>()
+            var list = _db.CopyNew().Queryable<TEntity>()
                 .OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields)
                 .WhereIF(whereExpression != null, whereExpression)
                 .ToPageList(pageIndex, pageSize, ref totalCount);
@@ -488,7 +488,7 @@
                 orderByModels.Add(orderByModel);
             }
             int totalCount = 0;
-            List<TEntity> list = _db.Queryable<TEntity>()
+            List<TEntity> list = _db.CopyNew().Queryable<TEntity>()
                 .OrderBy(orderByModels)
                 .WhereIF(whereExpression != null, whereExpression)
                 .ToPageList(pageIndex, pageSize, ref totalCount);
@@ -517,7 +517,7 @@
                 orderByModels.Add(orderByModel);
             }
             int totalCount = 0;
-            List<TEntity> list = _db.Queryable<TEntity>()
+            List<TEntity> list = _db.CopyNew().Queryable<TEntity>()
                 .WhereIF(!string.IsNullOrEmpty(where), where).OrderBy(orderByModels).ToPageList(pageIndex, pageSize, ref totalCount);
 
             return new PageGridData<TEntity>(totalCount, list);
@@ -539,7 +539,7 @@
            Expression<Func<T,T2, bool>> whereExpressionT1,
            Expression<Func<TResult, bool>> whereExpression)
         {
-            List<TResult> list = _db.Queryable(joinExpression).WhereIF(whereExpressionT1 != null, whereExpressionT1)
+            List<TResult> list = _db.CopyNew().Queryable(joinExpression).WhereIF(whereExpressionT1 != null, whereExpressionT1)
                .Select(selectExpression)
                .WhereIF(whereExpression != null, whereExpression).ToList();
             return list;
@@ -560,7 +560,7 @@
         public virtual PageGridData<TResult> QueryTabsPage<T1, T2, TResult>(Expression<Func<T1, T2, object[]>> joinExpression, Expression<Func<T1, T2, TResult>> selectExpression, Expression<Func<TResult, bool>> whereExpression, int pageIndex, int pageSize, string? orderByFields = null)
         {
             int totalCount = 0;
-            List<TResult> list = _db.Queryable(joinExpression)
+            List<TResult> list = _db.CopyNew().Queryable(joinExpression)
                 .Select(selectExpression)
                 .OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields)
                 .WhereIF(whereExpression != null, whereExpression)
@@ -585,7 +585,7 @@
         public virtual PageGridData<TResult> QueryTabsPage<T1, T2, TResult>(Expression<Func<T1, T2, object[]>> joinExpression, Expression<Func<T1, T2, TResult>> selectExpression, Expression<Func<TResult, bool>> whereExpression, Expression<Func<T1, object>> groupExpression, int pageIndex, int pageSize, string? orderByFields = null)
         {
             int totalCount = 0;
-            List<TResult> list = _db.Queryable(joinExpression).GroupBy(groupExpression)
+            List<TResult> list = _db.CopyNew().Queryable(joinExpression).GroupBy(groupExpression)
                 .Select(selectExpression)
                 .OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields)
                 .WhereIF(whereExpression != null, whereExpression)
@@ -595,64 +595,64 @@
 
         public Task<TEntity> QureyDataByIdAsync(object id)
         {
-            return _db.Queryable<TEntity>().In(id).SingleAsync();
+            return _db.CopyNew().Queryable<TEntity>().In(id).SingleAsync();
         }
 
         public Task<List<TEntity>> QureyDataByIdsAsync(object[] lstIds)
         {
-            return _db.Queryable<TEntity>().In(lstIds).ToListAsync();
+            return _db.CopyNew().Queryable<TEntity>().In(lstIds).ToListAsync();
         }
 
         public Task<List<TEntity>> QureyDataByIdsAsync(List<object> lstIds)
         {
-            return _db.Queryable<TEntity>().In(lstIds).ToListAsync();
+            return _db.CopyNew().Queryable<TEntity>().In(lstIds).ToListAsync();
         }
 
         public Task<int> AddDataAsync(TEntity entity)
         {
-            IInsertable<TEntity> insert = _db.Insertable(entity);
+            IInsertable<TEntity> insert = _db.CopyNew().Insertable(entity);
             return insert.ExecuteReturnIdentityAsync();
         }
 
         public Task<int> AddDataAsync(List<TEntity> listEntity)
         {
-            IInsertable<TEntity> insert = _db.Insertable(listEntity);
+            IInsertable<TEntity> insert = _db.CopyNew().Insertable(listEntity);
             return insert.ExecuteReturnIdentityAsync();
         }
 
         public Task<bool> DeleteDataByIdAsync(object id)
         {
-            return _db.Deleteable<TEntity>().In(id).ExecuteCommandHasChangeAsync();
+            return _db.CopyNew().Deleteable<TEntity>().In(id).ExecuteCommandHasChangeAsync();
         }
 
         public Task<bool> DeleteDataByIdsAsync(object[] ids)
         {
-            return _db.Deleteable<TEntity>().In(ids).ExecuteCommandHasChangeAsync();
+            return _db.CopyNew().Deleteable<TEntity>().In(ids).ExecuteCommandHasChangeAsync();
         }
 
         public Task<bool> DeleteDataAsync(TEntity entity)
         {
-            return _db.Deleteable(entity).ExecuteCommandHasChangeAsync();
+            return _db.CopyNew().Deleteable(entity).ExecuteCommandHasChangeAsync();
         }
 
         public Task<bool> DeleteDataAsync(List<TEntity> listEntity)
         {
-            return _db.Deleteable(listEntity).ExecuteCommandHasChangeAsync();
+            return _db.CopyNew().Deleteable(listEntity).ExecuteCommandHasChangeAsync();
         }
 
         public Task<bool> UpdateDataAsync(TEntity entity)
         {
-            return _db.Updateable(entity).ExecuteCommandHasChangeAsync();
+            return _db.CopyNew().Updateable(entity).ExecuteCommandHasChangeAsync();
         }
 
         public Task<bool> UpdateDataAsync(List<TEntity> listEntity)
         {
-            return _db.Updateable(listEntity).ExecuteCommandHasChangeAsync();
+            return _db.CopyNew().Updateable(listEntity).ExecuteCommandHasChangeAsync();
         }
 
         public Task<bool> UpdateDataAsync(TEntity entity, List<string> lstColumns, List<string>? lstIgnoreColumns = null)
         {
-            IUpdateable<TEntity> update = _db.Updateable(entity);
+            IUpdateable<TEntity> update = _db.CopyNew().Updateable(entity);
 
             if (lstIgnoreColumns != null && lstIgnoreColumns.Count > 0)
             {
@@ -669,27 +669,27 @@
 
         public Task<List<TEntity>> QueryDataAsync()
         {
-            return _db.Queryable<TEntity>().ToListAsync();
+            return _db.CopyNew().Queryable<TEntity>().ToListAsync();
         }
 
         public Task<List<TEntity>> QueryDataAsync(string where)
         {
-            return _db.Queryable<TEntity>().WhereIF(!string.IsNullOrEmpty(where), where).ToListAsync();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(!string.IsNullOrEmpty(where), where).ToListAsync();
         }
 
         public Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression)
         {
-            return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).ToListAsync();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).ToListAsync();
         }
 
         public Task<TEntity> QueryFirstAsync(Expression<Func<TEntity, bool>> whereExpression)
         {
-            return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).FirstAsync();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).FirstAsync();
         }
 
         public Task<TResult> QueryFirstAsync<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> expression)
         {
-            return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).Select(expression).FirstAsync();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).Select(expression).FirstAsync();
         }
 
         public TResult QueryFirst<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> expression, Dictionary<string, OrderByType> orderBy)
@@ -704,7 +704,7 @@
                 };
                 orderByModels.Add(orderByModel);
             }
-            return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).OrderBy(orderByModels).Select(expression).First();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).OrderBy(orderByModels).Select(expression).First();
         }
 
         public Task<TResult> QueryFirstAsync<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> expression, Dictionary<string, OrderByType> orderBy)
@@ -719,7 +719,7 @@
                 };
                 orderByModels.Add(orderByModel);
             }
-            return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).OrderBy(orderByModels).Select(expression).FirstAsync();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).OrderBy(orderByModels).Select(expression).FirstAsync();
         }
 
         public TEntity QueryFirst(Expression<Func<TEntity, bool>> whereExpression, Dictionary<string, OrderByType> orderBy)
@@ -734,7 +734,7 @@
                 };
                 orderByModels.Add(orderByModel);
             }
-            return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).OrderBy(orderByModels).First();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).OrderBy(orderByModels).First();
         }
 
         public Task<TEntity> QueryFirstAsync(Expression<Func<TEntity, bool>> whereExpression, Dictionary<string, OrderByType> orderBy)
@@ -749,12 +749,12 @@
                 };
                 orderByModels.Add(orderByModel);
             }
-            return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).OrderBy(orderByModels).FirstAsync();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).OrderBy(orderByModels).FirstAsync();
         }
 
         public Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression, string orderByFields)
         {
-            return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).ToListAsync();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).ToListAsync();
         }
 
         public Task<List<TEntity>> QueryDataAsync(string where, Dictionary<string, OrderByType> orderBy)
@@ -769,27 +769,27 @@
                 };
                 orderByModels.Add(orderByModel);
             }
-            return _db.Queryable<TEntity>().WhereIF(!string.IsNullOrEmpty(where), where).OrderBy(orderByModels).ToListAsync();
+            return _db.CopyNew().Queryable<TEntity>().WhereIF(!string.IsNullOrEmpty(where), where).OrderBy(orderByModels).ToListAsync();
         }
 
         public Task<List<TResult>> QueryDataAsync<TResult>(Expression<Func<TEntity, TResult>> expression)
         {
-            return _db.Queryable<TEntity>().Select(expression).ToListAsync();
+            return _db.CopyNew().Queryable<TEntity>().Select(expression).ToListAsync();
         }
 
         public Task<List<TResult>> QueryDataAsync<TResult>(Expression<Func<TEntity, TResult>> expression, Expression<Func<TEntity, bool>> whereExpression, string orderByFields)
         {
-            return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(whereExpression != null, whereExpression).Select(expression).ToListAsync();
+            return _db.CopyNew().Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(whereExpression != null, whereExpression).Select(expression).ToListAsync();
         }
 
         public Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, object>> orderByExpression, bool isAsc = true)
         {
-            return _db.Queryable<TEntity>().OrderByIF(orderByExpression != null, orderByExpression, isAsc ? OrderByType.Asc : OrderByType.Desc).WhereIF(whereExpression != null, whereExpression).ToListAsync();
+            return _db.CopyNew().Queryable<TEntity>().OrderByIF(orderByExpression != null, orderByExpression, isAsc ? OrderByType.Asc : OrderByType.Desc).WhereIF(whereExpression != null, whereExpression).ToListAsync();
         }
 
         public Task<List<TEntity>> QueryDataAsync(string where, string orderByFields)
         {
-            return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(!string.IsNullOrEmpty(where), where).ToListAsync();
+            return _db.CopyNew().Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(!string.IsNullOrEmpty(where), where).ToListAsync();
         }
 
         public Task<List<TEntity>> QueryDataBySqlAsync(string sql, SugarParameter[]? parameters = null)
@@ -819,29 +819,29 @@
 
         public Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression, int top, string orderByFields)
         {
-            return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(whereExpression != null, whereExpression).Take(top).ToListAsync();
+            return _db.CopyNew().Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(whereExpression != null, whereExpression).Take(top).ToListAsync();
         }
 
         public Task<List<TEntity>> QueryDataAsync(string where, int top, string orderByFields)
         {
-            return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(!string.IsNullOrEmpty(where), where).Take(top).ToListAsync();
+            return _db.CopyNew().Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(!string.IsNullOrEmpty(where), where).Take(top).ToListAsync();
         }
 
         public Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression, int pageIndex, int pageSize, string orderByFields)
         {
-            return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields)
+            return _db.CopyNew().Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields)
               .WhereIF(whereExpression != null, whereExpression).ToPageListAsync(pageIndex, pageSize);
         }
 
         public Task<List<TEntity>> QueryDataAsync(string where, int pageIndex, int pageSize, string orderByFields)
         {
-            return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields)
+            return _db.CopyNew().Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields)
                 .WhereIF(!string.IsNullOrEmpty(where), where).ToPageListAsync(pageIndex, pageSize);
         }
 
         public Task<List<TResult>> QueryTabsAsync<T, T2, TResult>(Expression<Func<T, T2, object[]>> joinExpression, Expression<Func<T, T2, TResult>> selectExpression, Expression<Func<TResult, bool>> whereExpression)
         {
-            return _db.Queryable(joinExpression)
+            return _db.CopyNew().Queryable(joinExpression)
              .Select(selectExpression)
              .WhereIF(whereExpression != null, whereExpression).ToListAsync();
         }
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/IUnitOfWorkManage.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/IUnitOfWorkManage.cs
index f63d9d2..3792727 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/IUnitOfWorkManage.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/IUnitOfWorkManage.cs
@@ -10,7 +10,7 @@
 {
     public interface IUnitOfWorkManage
     {
-        SqlSugarClient GetDbClient();
+        SqlSugarScope GetDbClient();
         int TranCount { get; }
 
         UnitOfWork CreateUnitOfWork();
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs
index fa6dd14..fbc2bb2 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs
@@ -31,10 +31,10 @@
         /// 鑾峰彇DB锛屼繚璇佸敮涓�鎬�
         /// </summary>
         /// <returns></returns>
-        public SqlSugarClient GetDbClient()
+        public SqlSugarScope GetDbClient()
         {
             // 蹇呴』瑕乤s锛屽悗杈逛細鐢ㄥ埌鍒囨崲鏁版嵁搴撴搷浣�
-            return _sqlSugarClient as SqlSugarClient;
+            return _sqlSugarClient as SqlSugarScope;
         }
 
 
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs
index ded801d..ee18736 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs
@@ -286,7 +286,7 @@
 
                 List<TDetail> list = detailDics.DicToIEnumerable<TDetail>();
 
-                ((SqlSugarClient)BaseDal.Db).BeginTran();
+                ((SqlSugarScope)BaseDal.Db).BeginTran();
 
                 int id = BaseDal.Db.Insertable(entity).ExecuteReturnIdentity();
 
@@ -298,13 +298,13 @@
 
                 BaseDal.Db.Insertable(list).ExecuteCommand();
 
-                ((SqlSugarClient)BaseDal.Db).CommitTran();
+                ((SqlSugarScope)BaseDal.Db).CommitTran();
 
                 content = WebResponseContent.Instance.OK();
             }
             catch (Exception ex)
             {
-                ((SqlSugarClient)BaseDal.Db).RollbackTran();
+                ((SqlSugarScope)BaseDal.Db).RollbackTran();
                 content = WebResponseContent.Instance.Error(ex.Message);
             }
             return content;
@@ -457,7 +457,7 @@
                 object mainId = typeof(TEntity).GetPropertyValue(entity, typeof(TEntity).GetKeyName());
                 if (mainId != null)
                 {
-                    ((SqlSugarClient)BaseDal.Db).BeginTran();
+                    ((SqlSugarScope)BaseDal.Db).BeginTran();
 
                     if (dynamicDelKeys.Count > 0)
                         BaseDal.Db.Deleteable<object>().AS(detailType.Name).Where($"{detailType.GetKeyName()} in (@id)", new { id = dynamicDelKeys.ToArray() }).ExecuteCommandHasChange();
@@ -474,7 +474,7 @@
 
                     BaseDal.Db.Insertable(addRows).ExecuteCommand();
 
-                    ((SqlSugarClient)BaseDal.Db).CommitTran();
+                    ((SqlSugarScope)BaseDal.Db).CommitTran();
 
                     content = WebResponseContent.Instance.OK();
                 }
@@ -486,7 +486,7 @@
             }
             catch (Exception ex)
             {
-                ((SqlSugarClient)BaseDal.Db).RollbackTran();
+                ((SqlSugarScope)BaseDal.Db).RollbackTran();
                 content = WebResponseContent.Instance.Error(ex.Message);
             }
             return content;
@@ -532,14 +532,14 @@
                         {
                             dynamicDelKeys.Add(keys[i]);
                         }
-                        ((SqlSugarClient)BaseDal.Db).BeginTran();
+                        ((SqlSugarScope)BaseDal.Db).BeginTran();
 
                         if (dynamicDelKeys.Count > 0)
                             BaseDal.Db.Deleteable<object>().AS(detailType.Name).Where($"{name} in (@id)", new { id = dynamicDelKeys.ToArray() }).ExecuteCommandHasChange();
 
                         BaseDal.DeleteDataByIds(keys);
 
-                        ((SqlSugarClient)BaseDal.Db).CommitTran();
+                        ((SqlSugarScope)BaseDal.Db).CommitTran();
 
                         return WebResponseContent.Instance.OK();
                     }
@@ -551,7 +551,7 @@
             }
             catch (Exception ex)
             {
-                ((SqlSugarClient)BaseDal.Db).RollbackTran();
+                ((SqlSugarScope)BaseDal.Db).RollbackTran();
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/DB/BaseDBConfig.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/DB/BaseDBConfig.cs
index 65764aa..09440d9 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/DB/BaseDBConfig.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/DB/BaseDBConfig.cs
@@ -39,7 +39,7 @@
 
         public static List<MutiDBOperate> MutiInitConn()
         {
-            SqlSugarClient sqlSugarClient = new SqlSugarClient(new ConnectionConfig
+            SqlSugarScope sqlSugarClient = new SqlSugarScope(new ConnectionConfig
             {
                 ConfigId = MainDb.CurrentDbConnId,
                 ConnectionString = AppSettings.app(MainDb.ConnectionString).DecryptDES(AppSecret.DB),
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/SqlsugarSetup.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/SqlsugarSetup.cs
index 2357478..2cfeef4 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/SqlsugarSetup.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/SqlsugarSetup.cs
@@ -28,10 +28,10 @@
 
             // 榛樿娣诲姞涓绘暟鎹簱杩炴帴
             //MainDb.CurrentDbConnId = AppSettings.app(new string[] { "MainDB" });
-
+            services.AddHttpContextAccessor();
             // SqlSugarScope鏄嚎绋嬪畨鍏紝鍙娇鐢ㄥ崟渚嬫敞鍏�
             // 鍙傝�冿細https://www.donet5.com/Home/Doc?typeId=1181
-            services.AddScoped<ISqlSugarClient>(o =>
+            services.AddSingleton<ISqlSugarClient>(o =>
             {
                 var memoryCache = o.GetRequiredService<IMemoryCache>();
 
@@ -114,7 +114,7 @@
                 //});
                 #endregion
 
-                SqlSugarClient sqlSugarClient = new SqlSugarClient(listConfig, db =>
+                SqlSugarScope sqlSugarClient = new SqlSugarScope(listConfig, db =>
                 {
                     db.Aop.DataExecuting = SqlSugarAop.DataExecuting;
                 });
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/LogHelper/Logger.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/LogHelper/Logger.cs
index 7f1d74a..1932cdb 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/LogHelper/Logger.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/LogHelper/Logger.cs
@@ -42,7 +42,7 @@
 
                     if (queueTable.Rows.Count == 0) { continue; }
 
-                    SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig()
+                    SqlSugarScope sugarClient = new SqlSugarScope(new ConnectionConfig()
                     {
                         ConnectionString = DBContext.GetMainConnectionDb().Connection,
                         IsAutoCloseConnection = true,
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Seed/DBContext.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Seed/DBContext.cs
index 85d3b5e..3f478e4 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Seed/DBContext.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Seed/DBContext.cs
@@ -16,7 +16,7 @@
         private static string _connectionString = connectObject.Connection;
         private static DbType _dbType = (DbType)connectObject.DbType;
         public static string ConnId = connectObject.ConnId;
-        private SqlSugarClient _db;
+        private SqlSugarScope _db;
 
         /// <summary>
         /// 杩炴帴瀛楃涓� 
@@ -51,7 +51,7 @@
         /// <summary>
         /// 鏁版嵁杩炴帴瀵硅薄 
         /// </summary>
-        public SqlSugarClient Db
+        public SqlSugarScope Db
         {
             get { return _db; }
             private set { _db = value; }
@@ -71,7 +71,7 @@
             if (string.IsNullOrEmpty(_connectionString))
                 throw new ArgumentNullException("鏁版嵁搴撹繛鎺ュ瓧绗︿覆涓虹┖");
 
-            _db = sqlSugarClient as SqlSugarClient;
+            _db = sqlSugarClient as SqlSugarScope;
             //_db.Aop.DataExecuting = SqlSugarAop.DataExecuting;
         }
 
@@ -188,29 +188,29 @@
         /// </summary>
         /// <param name="config">config</param>
         /// <returns>杩斿洖鍊�</returns>
-        public static SqlSugarClient GetCustomDB(ConnectionConfig config)
+        public static SqlSugarScope GetCustomDB(ConnectionConfig config)
         {
-            return new SqlSugarClient(config);
+            return new SqlSugarScope(config);
         }
         /// <summary>
         /// 鍔熻兘鎻忚堪:鑾峰彇涓�涓嚜瀹氫箟鐨勬暟鎹簱澶勭悊瀵硅薄
         /// </summary>
         /// <param name="sugarClient">sugarClient</param>
         /// <returns>杩斿洖鍊�</returns>
-        public static SimpleClient<T> GetCustomEntityDB<T>(SqlSugarClient sugarClient) where T : class, new()
-        {
-            return new SimpleClient<T>(sugarClient);
-        }
+        //public static SqlSugarScope<T> GetCustomEntityDB<T>(SqlSugarScope sugarClient) where T : class, new()
+        //{
+        //    return new SqlSugarScope<T>(sugarClient);
+        //}
         /// <summary>
         /// 鍔熻兘鎻忚堪:鑾峰彇涓�涓嚜瀹氫箟鐨勬暟鎹簱澶勭悊瀵硅薄
         /// </summary>
         /// <param name="config">config</param>
         /// <returns>杩斿洖鍊�</returns>
-        public static SimpleClient<T> GetCustomEntityDB<T>(ConnectionConfig config) where T : class, new()
-        {
-            SqlSugarClient sugarClient = GetCustomDB(config);
-            return GetCustomEntityDB<T>(sugarClient);
-        }
+        //public static SimpleClient<T> GetCustomEntityDB<T>(ConnectionConfig config) where T : class, new()
+        //{
+        //    SqlSugarScope sugarClient = GetCustomDB(config);
+        //    return GetCustomEntityDB<T>(sugarClient);
+        //}
         #endregion
     }
 }
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
index 909d960..96bd474 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
@@ -201,6 +201,15 @@
         Dt_Task QueryStackerCraneOutTask(string deviceNo, string currentAddress = "");
 
         /// <summary>
+        /// 鏍规嵁璁惧缂栧彿銆佹帓闄ょ殑浠诲姟銆佸綋鍓嶅湴鍧�鎸夌収浼樺厛绾т互鍙婂垱寤烘椂闂存帓搴忔煡璇换鍔℃睜鍑哄簱绫诲瀷鐨勬柊澧炵殑浠诲姟
+        /// </summary>
+        /// <param name="deviceNo">璁惧缂栧彿</param>
+        /// <param name="excludedTaskId">鎺掗櫎鐨勪换鍔�</param>
+        /// <param name="currentAddress">褰撳墠鍦板潃</param>
+        /// <returns>杩斿洖浠诲姟瀹炰綋瀵硅薄锛屽彲鑳戒负null</returns>
+        List<Dt_Task> QueryAllOutboundTasks(string deviceNo, string currentAddress = "");
+
+        /// <summary>
         /// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�鎸夌収浼樺厛绾т互鍙婂垱寤烘椂闂存帓搴忔煡璇换鍔℃睜鍑哄簱绫诲瀷鐨勬柊澧炵殑浠诲姟
         /// </summary>
         /// <param name="deviceNo">璁惧缂栧彿</param>
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/SchedulerCenterServer.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/SchedulerCenterServer.cs
index febec47..08ee278 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/SchedulerCenterServer.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/SchedulerCenterServer.cs
@@ -178,6 +178,11 @@
                     #endregion
 
                     //浼犲叆鍙嶅皠鍑烘潵鐨勬墽琛岀▼搴忛泦
+                    //IJobDetail jobDetail = JobBuilder.Create(jobType)
+                    //   .WithIdentity(tasksQz.Id.ToString(), tasksQz.JobGroup)
+                    //   .Build();
+                    //jobDetail.JobDataMap.Add("JobParams", tasksQz.JobParams);
+
                     IJobDetail job = new JobDetailImpl(tasksQz.Id.ToString(), tasksQz.JobGroup, jobType);
                     job.JobDataMap.Add("JobParams", tasksQz.JobParams);
 
@@ -185,6 +190,7 @@
 
                     // 鍛婅瘔Quartz浣跨敤鎴戜滑鐨勮Е鍙戝櫒鏉ュ畨鎺掍綔涓�
                     await _scheduler.Result.ScheduleJob(job, trigger);
+                    //await _scheduler.Result.ScheduleJob(jobDetail, trigger);
 
                     result = WebResponseContent.Instance.OK(string.Format(QuartzJobInfoMessage.JobAddSuccess, tasksQz.Name));
                     return result;
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/DispatchInfoService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/DispatchInfoService.cs
index 27a92be..858681c 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/DispatchInfoService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/DispatchInfoService.cs
@@ -15,11 +15,15 @@
  *----------------------------------------------------------------*/
 #endregion << 鐗� 鏈� 娉� 閲� >>
 
+using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
+using Quartz.Impl.Matchers;
+using Quartz;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.BaseRepository;
 using WIDESEAWCS_Core.BaseServices;
 using WIDESEAWCS_Core.Helper;
@@ -28,6 +32,8 @@
 using WIDESEAWCS_QuartzJob.DTO;
 using WIDESEAWCS_QuartzJob.Models;
 using WIDESEAWCS_QuartzJob.Repository;
+using Quartz.Impl;
+using System.Collections.Specialized;
 
 namespace WIDESEAWCS_QuartzJob.Service
 {
@@ -35,10 +41,12 @@
     {
         private readonly IUnitOfWorkManage _unitOfWorkManage;
         private readonly IDeviceInfoRepository _deviceInfoRepository;
-        public DispatchInfoService(IDispatchInfoRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IDeviceInfoRepository deviceInfoRepository) : base(BaseDal)
+        private readonly ISchedulerCenter _schedulerCenter;
+        public DispatchInfoService(IDispatchInfoRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IDeviceInfoRepository deviceInfoRepository, ISchedulerCenter schedulerCenter) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
             _deviceInfoRepository = deviceInfoRepository;
+            _schedulerCenter = schedulerCenter;
         }
 
         /// <summary>
@@ -66,5 +74,55 @@
                 DeviceType = b.DeviceType
             }).ToList();
         }
+
+        public async Task<WebResponseContent> GetDispatchInfosAsync()
+        {
+            WebResponseContent content = new WebResponseContent();
+            NameValueCollection collection = new NameValueCollection
+            {
+                { "quartz.serializer.type", "binary" },
+            };
+            StdSchedulerFactory factory = new StdSchedulerFactory(collection);
+            IScheduler scheduler = await factory.GetScheduler();
+            var jobKeys = await scheduler.GetJobKeys(GroupMatcher<JobKey>.AnyGroup());
+            foreach (var jobKey in jobKeys)
+            {
+                // 鍦ㄨ繖閲屽鐞嗘瘡涓狫obKey
+                IJobDetail jobDetail = await scheduler.GetJobDetail(jobKey);
+                if (jobDetail != null)
+                {
+                    // 鍙互鑾峰彇Job鐨勬弿杩颁俊鎭�
+                    string jobDescription = jobDetail.Description;
+                    // 浠ュ強Job鐨勬暟鎹槧灏勶紙JobDataMap锛�
+                    JobDataMap jobDataMap = jobDetail.JobDataMap;
+                }
+            }
+
+            var triggerKeys = await scheduler.GetTriggerKeys(GroupMatcher<TriggerKey>.AnyGroup());
+            foreach (var triggerKey in triggerKeys)
+            {
+                // 鍦ㄨ繖閲屽鐞嗘瘡涓猅riggerKey
+                ITrigger trigger = await scheduler.GetTrigger(triggerKey);
+                if (trigger != null)
+                {
+                    // 鑾峰彇涓嬩竴娆¤Е鍙戞椂闂达紙濡傛灉鏈夛級
+                    DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
+                    // 鑾峰彇涓婃瑙﹀彂鏃堕棿锛堝鏋滄湁锛�
+                    DateTimeOffset? previousFireTime = trigger.GetPreviousFireTimeUtc();
+                    // 鑾峰彇瑙﹀彂绫诲瀷锛堝SimpleTrigger銆丆ronTrigger锛�
+                    string triggerType = trigger.GetType().Name;
+                    // 瀵逛簬CronTrigger锛岃繕鍙互鑾峰彇Cron琛ㄨ揪寮忥紙濡傛灉鏄級
+                    //if (trigger is CronTrigger cronTrigger)
+                    //{
+                    //    string cronExpression = cronTrigger.CronExpressionString;
+                    //}
+                    if (!previousFireTime.HasValue && nextFireTime.HasValue)
+                    {
+                        Console.WriteLine($"Job澶勪簬绛夊緟瑙﹀彂鐘舵�侊紝Trigger鍚嶇О: {triggerKey.Name}");
+                    }
+                }
+            }
+            return content;
+        }
     }
 }
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/IDispatchInfoService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/IDispatchInfoService.cs
index 63be19e..5a4131d 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/IDispatchInfoService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/IDispatchInfoService.cs
@@ -20,6 +20,7 @@
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.BaseServices;
 using WIDESEAWCS_QuartzJob.DTO;
 using WIDESEAWCS_QuartzJob.Models;
@@ -33,5 +34,7 @@
         /// </summary>
         /// <returns>杩斿洖瀹氭椂鍣↗ob涓庡搴旂殑璁惧淇℃伅DTO闆嗗悎銆�</returns>
         List<DispatchInfoDTO> QueryDispatchInfos();
+
+        Task<WebResponseContent> GetDispatchInfosAsync();
     }
 }
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/QuartzJob/DispatchInfoController.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/QuartzJob/DispatchInfoController.cs
index 59046ac..4bc52e8 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/QuartzJob/DispatchInfoController.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/QuartzJob/DispatchInfoController.cs
@@ -1,5 +1,7 @@
-锘縰sing Microsoft.AspNetCore.Http;
+锘縰sing Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
+using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.BaseController;
 using WIDESEAWCS_QuartzJob.Models;
 using WIDESEAWCS_QuartzJob.Service;
@@ -10,8 +12,16 @@
     [ApiController]
     public class DispatchInfoController : ApiBaseController<IDispatchInfoService, Dt_DispatchInfo>
     {
-        public DispatchInfoController(IDispatchInfoService service) : base(service)
+        private readonly IDispatchInfoService _dispatchInfoService;
+        public DispatchInfoController(IDispatchInfoService service, IDispatchInfoService dispatchInfoService) : base(service)
         {
+            _dispatchInfoService = dispatchInfoService;
+        }
+
+        [HttpGet("GetDispatchInfosAsync"),AllowAnonymous]
+        public Task<WebResponseContent> GetDispatchInfosAsync()
+        {
+            return _dispatchInfoService.GetDispatchInfosAsync();
         }
     }
 }
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index c962f62..bfa2c3b 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -90,32 +90,48 @@
                     task.Creater = "WMS";
                     if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                     {
-                        List<Dt_Router> routers = _routerService.QueryNextRoutes(item.RoadWay, item.TargetAddress);
-                        if (routers.Count > 0)
+                        if (task.TargetAddress == "002-021-001")
                         {
                             task.TaskState = (int)TaskOutStatusEnum.OutNew;
                             task.CurrentAddress = item.SourceAddress;
-                            task.NextAddress = routers.FirstOrDefault().ChildPosi;
                         }
                         else
                         {
-                            routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress);
+                            List<Dt_Router> routers = _routerService.QueryNextRoutes(item.RoadWay, item.TargetAddress);
                             if (routers.Count > 0)
                             {
-                                task.TaskState = (int)TaskOutStatusEnum.SC_OutFinish;
+                                task.TaskState = (int)TaskOutStatusEnum.OutNew;
                                 task.CurrentAddress = item.SourceAddress;
                                 task.NextAddress = routers.FirstOrDefault().ChildPosi;
+                            }
+                            else
+                            {
+                                routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress);
+                                if (routers.Count > 0)
+                                {
+                                    task.TaskState = (int)TaskOutStatusEnum.SC_OutFinish;
+                                    task.CurrentAddress = item.SourceAddress;
+                                    task.NextAddress = routers.FirstOrDefault().ChildPosi;
+                                }
                             }
                         }
                     }
                     else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
                     {
-                        List<Dt_Router> routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress);
-                        if (routers.Count > 0)
+                        if (task.SourceAddress == "1359-4")
                         {
                             task.TaskState = (int)TaskInStatusEnum.InNew;
                             task.CurrentAddress = item.SourceAddress;
-                            task.NextAddress = routers.FirstOrDefault().ChildPosi;
+                        }
+                        else
+                        {
+                            List<Dt_Router> routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress);
+                            if (routers.Count > 0)
+                            {
+                                task.TaskState = (int)TaskInStatusEnum.InNew;
+                                task.CurrentAddress = item.SourceAddress;
+                                task.NextAddress = routers.FirstOrDefault().ChildPosi;
+                            }
                         }
                     }
                     tasks.Add(task);
@@ -326,6 +342,21 @@
         }
 
         /// <summary>
+        /// 鏍规嵁璁惧缂栧彿銆佹帓闄ょ殑浠诲姟銆佸綋鍓嶅湴鍧�鎸夌収浼樺厛绾т互鍙婂垱寤烘椂闂存帓搴忔煡璇换鍔℃睜鍑哄簱绫诲瀷鐨勬柊澧炵殑鎵�鏈変换鍔�
+        /// </summary>
+        /// <param name="deviceNo">璁惧缂栧彿</param>
+        /// <param name="excludedTaskId">鎺掗櫎鐨勪换鍔�</param>
+        /// <param name="currentAddress">褰撳墠鍦板潃</param>
+        /// <returns>杩斿洖浠诲姟瀹炰綋瀵硅薄锛屽彲鑳戒负null</returns>
+        public List<Dt_Task> QueryAllOutboundTasks(string deviceNo, string currentAddress = "")
+        {
+            if (string.IsNullOrEmpty(currentAddress))
+                return BaseDal.QueryData(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew, TaskOrderBy);
+            else
+                return BaseDal.QueryData(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew && x.CurrentAddress == currentAddress, TaskOrderBy);
+        }
+
+        /// <summary>
         /// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�鎸夌収浼樺厛绾т互鍙婂垱寤烘椂闂存帓搴忔煡璇换鍔℃睜鍑哄簱绫诲瀷鐨勬柊澧炵殑浠诲姟
         /// </summary>
         /// <param name="deviceNo">璁惧缂栧彿</param>
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
index a64d5e3..8352fc6 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -58,160 +58,207 @@
             _noticeService = noticeService;
         }
 
-        public Task Execute(IJobExecutionContext context)
+        public async Task Execute(IJobExecutionContext context)
         {
-            try
+            string jobName = context.JobDetail.Key.Name;
+            if (MemoryLockManager.TryAcquireLock(jobName))
             {
-                CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
-                if (conveyorLine != null)
+                try
                 {
-                    List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
-                    foreach (string childDeviceCode in childDeviceCodes)
+                    CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
+                    if (conveyorLine != null)
                     {
-                        ProcessDeviceAsync(conveyorLine, childDeviceCode);
-                    }
+                        List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
+                        var tasks = childDeviceCodes.Select(childDeviceCode => ProcessDeviceAsync(conveyorLine, childDeviceCode)).ToList();
+                        await Task.WhenAll(tasks);
 
-                    List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode);
-                    foreach (var station in stationManagers)
-                    {
-                        if (station.stationType == 11)
+                        List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode);
+                        foreach (var station in stationManagers)
                         {
-                            ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(station.stationChildCode);
-                            ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(station.stationChildCode, "DeviceCommand");
-                            if (command != null && commandWrite != null)
+                            if (station.stationType == 11)
                             {
-                                var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray();
-                                if (structs[0] == true)
+                                ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(station.stationChildCode);
+                                ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(station.stationChildCode, "DeviceCommand");
+                                if (command != null && commandWrite != null)
                                 {
-                                    ConsoleHelper.WriteWarningLine($"銆恵conveyorLine.DeviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵station.stationChildCode}銆戠┖鎵樼洏璇锋眰鎵爜鍏ュ簱");
-                                    NGRequestTaskInbound(conveyorLine, command, station.stationChildCode, 0, station.stationLocation);
-                                }
-                                else
-                                {
-                                    ConveyorLineSendFinish(conveyorLine, station.stationChildCode, 0, false);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            catch (Exception ex)
-            {
-                Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
-            }
-            return Task.CompletedTask;
-        }
-
-        private void ProcessDeviceAsync(CommonConveyorLine conveyorLine, string childDeviceCode)
-        {
-            ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(childDeviceCode);
-            ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(childDeviceCode, "DeviceCommand");
-            if (command != null && commandWrite != null)
-            {
-
-                #region 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
-
-                var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken");
-                if (tokenInfos == null || !tokenInfos.Any())
-                {
-                    //throw new Exception(conveyorLine.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨");
-                    return;
-                }
-                var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList();
-                var userIds = tokenInfos?.Select(x => x.UserId).ToList();
-
-                object obj = new
-                {
-                    command,
-                    commandWrite
-                };
-                _noticeService.LineData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, childDeviceCode, data = obj });
-
-                #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
-
-                var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray();
-
-                List<DeviceProtocolDetailDTO>? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.Where(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand.InteractiveSignal)).ToList();
-
-                if (deviceProtocolDetails != null)
-                {
-                    foreach (var item in deviceProtocolDetails)
-                    {
-                        var outDeviceCodes = _routerService.QueryOutDeviceCodes(conveyorLine.DeviceCode);
-                        if (structs[item.ProtocalDetailValue.ObjToInt()] == true)
-                        {
-                            MethodInfo? method = GetType().GetMethod(item.ProtocolDetailType);
-                            if (method != null)
-                            {
-                                var numRead = item.ProtocalDetailValue.ObjToInt();
-                                var numWrite = item.ProtocalDetailValue.ObjToInt() + 1;
-                                ConsoleHelper.WriteWarningLine($"銆恵conveyorLine.DeviceName}銆戙�恵childDeviceCode}銆戙�恵numRead.ToString()}銆戜綅杈撻�佺嚎璇诲彇淇″彿锛氥�恵structs[item.ProtocalDetailValue.ObjToInt()]}銆� 銆恵numWrite}銆戜綅WCS鍐欏叆淇″彿锛氥�恵structs[item.ProtocalDetailValue.ObjToInt() + 1]}銆�");
-                                if (structs[item.ProtocalDetailValue.ObjToInt() + 1] != structs[item.ProtocalDetailValue.ObjToInt()])
-                                {
-                                    command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
-                                    method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, item.ProtocalDetailValue.ObjToInt() });
-                                }
-                            }
-                        }
-                        else
-                        {
-
-
-                            ConveyorLineSendFinish(conveyorLine, childDeviceCode, item.ProtocalDetailValue.ObjToInt(), false);
-
-                            //DeviceProDTO? devicePro = conveyorLine.DeviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand) && x.DeviceChildCode == childDeviceCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
-                            //string[] x = devicePro.DeviceProAddress.Split('.');
-                            //x[x.Length - 1] = (item.ProtocalDetailValue.ObjToInt() + 1).ToString();
-                            //string DeviceProAddress = string.Join(".", x);
-                            //var writeRead = conveyorLine.Communicator.Read<bool>(DeviceProAddress);
-                            //if (writeRead)
-                            //{
-                            //    conveyorLine.Communicator.Write(DeviceProAddress, false);
-                            //    //ConveyorLineSendFinish(conveyorLine, childDeviceCode, item.ProtocalDetailValue.ObjToInt(), false);
-                            //}
-                        }
-                    }
-                }
-
-                Platform platform = _platFormRepository.QueryFirst(x => x.PLCCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active");
-                if (platform != null)
-                {
-                    if (command.InteractiveSignal != 2)
-                    {
-                        MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
-                        if (method != null)
-                        {
-                            command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
-                            int count = string.IsNullOrEmpty(platform.Location) ? 0 + 1 : platform.Location.Split(',').Count() + 1;
-                            method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
-                        }
-                    }
-                    else
-                    {
-                        if (platform.Location != null && platform.Location != "")
-                        {
-                            var strings = platform.Location.Split(',').ToList();
-                            foreach (var ite in strings)
-                            {
-                                //int index = strings.FindIndex(p => p == ite);
-                                ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(ite);
-                                if (command1.InteractiveSignal != 2)
-                                {
-                                    MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
-                                    if (method != null)
+                                    var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray();
+                                    if (structs[0] == true)
                                     {
-                                        command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
-                                        //int count = strings.Count - index;
-                                        int count = strings.Count;
-                                        method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
+                                        ConsoleHelper.WriteWarningLine($"銆恵conveyorLine.DeviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵station.stationChildCode}銆戠┖鎵樼洏璇锋眰鎵爜鍏ュ簱");
+                                        NGRequestTaskInbound(conveyorLine, command, station.stationChildCode, 0, station.stationLocation);
+                                    }
+                                    else
+                                    {
+                                        ConveyorLineSendFinish(conveyorLine, station.stationChildCode, 0, false);
                                     }
                                 }
                             }
                         }
                     }
                 }
-
+                catch (Exception ex)
+                {
+                    Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
+                }
+                finally
+                {
+                    MemoryLockManager.ReleaseLock(jobName);
+                }
             }
+            else
+            {
+                ConsoleHelper.WriteErrorLine($"[CommonConveyorLineJob]銆恵jobName}銆戜换鍔″凡琚攣瀹氾紝鏃犳硶澶勭悊");
+            }
+            return;
+        }
+
+        private Task ProcessDeviceAsync(CommonConveyorLine conveyorLine, string childDeviceCode)
+        {
+            ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(childDeviceCode);
+            ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(childDeviceCode, "DeviceCommand");
+            if (command != null && commandWrite != null)
+            {
+                #region 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
+
+                var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken");
+                if (tokenInfos != null && tokenInfos.Any())
+                {
+                    var userTokenIds = tokenInfos.Select(x => x.Token_ID).ToList();
+                    var userIds = tokenInfos.Select(x => x.UserId).ToList();
+
+                    object obj = new
+                    {
+                        command,
+                        commandWrite
+                    };
+                    _noticeService.LineData(userIds.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, childDeviceCode, data = obj });
+                }
+
+                #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
+
+                var writeInteractiveSignal = commandWrite.WriteInteractiveSignal;
+                var structs = BitConverter.GetBytes(writeInteractiveSignal).Reverse().ToArray().ToBoolArray();
+                List<DeviceProtocolDetailDTO>? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.Where(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand.InteractiveSignal)).ToList();
+
+                if (deviceProtocolDetails != null)
+                {
+                    foreach (var item in deviceProtocolDetails)
+                    {
+                        int itemValue = item.ProtocalDetailValue.ObjToInt();
+                        if (structs[itemValue] == true)
+                        {
+                            var numRead = itemValue;
+                            var numWrite = itemValue + 1;
+                            ConsoleHelper.WriteWarningLine($"銆恵conveyorLine.DeviceName}銆戙�恵childDeviceCode}銆戙�恵numRead.ToString()}銆戜綅杈撻�佺嚎璇诲彇淇″彿锛氥�恵structs[itemValue]}銆� 銆恵numWrite}銆戜綅WCS鍐欏叆淇″彿锛氥�恵structs[itemValue + 1]}銆�");
+                            if (structs[itemValue + 1] != structs[itemValue])
+                            {
+                                MethodInfo? method = GetType().GetMethod(item.ProtocolDetailType);
+                                if (method != null)
+                                {
+                                    command.InteractiveSignal = writeInteractiveSignal;
+                                    method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, itemValue });
+                                }
+                            }
+                        }
+                        else
+                        {
+                            ConveyorLineSendFinish(conveyorLine, childDeviceCode, itemValue, false);
+                        }
+                    }
+                }
+
+                Platform platform = _platFormRepository.QueryFirst(x => x.PLCCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active");
+                if (platform != null && !string.IsNullOrEmpty(platform.Location))
+                {
+                    var strings = platform.Location.Split(',').ToList();
+                    foreach (var ite in strings)
+                    {
+                        ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(ite);
+                        if (command1.InteractiveSignal != 2)
+                        {
+                            command.InteractiveSignal = writeInteractiveSignal;
+                            int count = strings.Count;
+                            MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
+                            if (method != null)
+                            {
+                                command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
+                                method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
+                            };
+                        }
+                    }
+                }
+
+                #region
+                //var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray();
+
+                //List<DeviceProtocolDetailDTO>? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.Where(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand.InteractiveSignal)).ToList();
+
+                //if (deviceProtocolDetails != null)
+                //{
+                //    foreach (var item in deviceProtocolDetails)
+                //    {
+                //        if (structs[item.ProtocalDetailValue.ObjToInt()] == true)
+                //        {
+                //            MethodInfo? method = GetType().GetMethod(item.ProtocolDetailType);
+                //            if (method != null)
+                //            {
+                //                var numRead = item.ProtocalDetailValue.ObjToInt();
+                //                var numWrite = item.ProtocalDetailValue.ObjToInt() + 1;
+                //                ConsoleHelper.WriteWarningLine($"銆恵conveyorLine.DeviceName}銆戙�恵childDeviceCode}銆戙�恵numRead.ToString()}銆戜綅杈撻�佺嚎璇诲彇淇″彿锛氥�恵structs[item.ProtocalDetailValue.ObjToInt()]}銆� 銆恵numWrite}銆戜綅WCS鍐欏叆淇″彿锛氥�恵structs[item.ProtocalDetailValue.ObjToInt() + 1]}銆�");
+                //                if (structs[item.ProtocalDetailValue.ObjToInt() + 1] != structs[item.ProtocalDetailValue.ObjToInt()])
+                //                {
+                //                    command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
+                //                    method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, item.ProtocalDetailValue.ObjToInt() });
+                //                }
+                //            }
+                //        }
+                //        else
+                //        {
+                //            ConveyorLineSendFinish(conveyorLine, childDeviceCode, item.ProtocalDetailValue.ObjToInt(), false);
+                //        }
+                //    }
+                //}
+
+                //Platform platform = _platFormRepository.QueryFirst(x => x.PLCCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active");
+                //if (platform != null)
+                //{
+                //    if (command.InteractiveSignal != 2)
+                //    {
+                //        MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
+                //        if (method != null)
+                //        {
+                //            command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
+                //            int count = string.IsNullOrEmpty(platform.Location) ? 0 + 1 : platform.Location.Split(',').Count() + 1;
+                //            method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
+                //        }
+                //    }
+                //    else
+                //    {
+                //        if (platform.Location != null && platform.Location != "")
+                //        {
+                //            var strings = platform.Location.Split(',').ToList();
+                //            foreach (var ite in strings)
+                //            {
+                //                //int index = strings.FindIndex(p => p == ite);
+                //                ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(ite);
+                //                if (command1.InteractiveSignal != 2)
+                //                {
+                //                    MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
+                //                    if (method != null)
+                //                    {
+                //                        command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
+                //                        //int count = strings.Count - index;
+                //                        int count = strings.Count;
+                //                        method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
+                //                    }
+                //                }
+                //            }
+                //        }
+                //    }
+                //}
+                #endregion
+            }
+            return Task.CompletedTask;
         }
 
         #region 鍏ュ簱
@@ -312,7 +359,7 @@
             var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
             if (task != null && task.TaskState != (int)TaskInStatusEnum.Line_InFinish)
             {
-                if (command.Barcode == task.PalletCode)
+                if (command.Barcode == task.PalletCode && childDeviceCode == task.NextAddress)
                 {
                     ConsoleHelper.WriteWarningLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍏ュ簱瀹屾垚,涓嬩竴鐩爣鍦板潃銆愮瓑寰呭垎閰嶈揣浣嶃��");
                     ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
index 634c58f..7fd4c81 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
@@ -223,12 +223,10 @@
                 {
                     if (task.NextAddress.Contains("JZ"))
                     {
-                        command.Barcode = task.PalletCode;
-                        command.TaskNum = task.TaskNum;
                         int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
                         task.TaskState = nextStatus;
 
-                        ConsoleHelper.WriteWarningLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(瀹炵洏),涓嬩竴鐩爣鍦板潃銆恵task.TargetAddress}銆�");
+                        ConsoleHelper.WriteWarningLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵task.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵task.PalletCode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(瀹炵洏),涓嬩竴鐩爣鍦板潃銆恵task.TargetAddress}銆�");
                         _taskService.UpdateTaskStatusToNext(task);
                         ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                     }
@@ -239,7 +237,7 @@
                         var taskCommand = MapTaskCommand(task, command);
                         task.NextAddress = next;
 
-                        ConsoleHelper.WriteWarningLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(鏄儢),涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�");
+                        ConsoleHelper.WriteWarningLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(瀹炵洏),涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�");
 
                         conveyorLine.SendCommand(taskCommand, childDeviceCode);
                         ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
index f38e6a1..f637dd2 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
@@ -21,6 +21,7 @@
 
 using AutoMapper;
 using HslCommunication;
+using Microsoft.CodeAnalysis;
 using Newtonsoft.Json;
 using Quartz;
 using SqlSugar;
@@ -44,6 +45,7 @@
 using WIDESEAWCS_SignalR;
 using WIDESEAWCS_Tasks.ConveyorLineJob;
 using ICacheService = WIDESEAWCS_Core.Caches.ICacheService;
+using Platform = WIDESEAWCS_Model.Models.Platform;
 
 namespace WIDESEAWCS_Tasks
 {
@@ -405,7 +407,7 @@
         /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
         /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
         /// <param name="index">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
-        public async void EmptyTrayReturn(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode, int index, Platform platform)
+        public async void EmptyTrayReturn(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode, int index, WIDESEAWCS_Model.Models.Platform platform)
         {
             try
             {
@@ -414,7 +416,7 @@
                     taskOutboundTypeEnum = TaskOutboundTypeEnum.OutTray;
                 else
                     taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound;
-                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker);
+                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker, platform);
             }
             catch (Exception)
             {
@@ -424,7 +426,7 @@
         /// <summary>
         /// 妫�鏌ヤ换鍔″苟鍒涘缓鏂颁换鍔�
         /// </summary>
-        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, List<string> roadways = null)
+        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, Platform platform)
         {
             var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode);
             if (tasks.Count < index)
@@ -443,7 +445,10 @@
                 }
                 var wmsIpAddress = wmsBase + requestTrayOutTask;
 
-                var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, roadways = roadways }.ToJsonString());
+
+                List<string> strings = platform.Location.Split(',').ToList();
+
+                var result = await HttpHelper.PostAsync(wmsIpAddress, new { Position = childDeviceCode, Tag = (int)taskType, AreaCdoe = roadWay, AreaCdoes = strings, platform.ProductionLine }.ToJsonString());
                 //var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString());
 
                 WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/GetStationService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/GetStationService.cs
index 743d33f..f5dd88d 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/GetStationService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/GetStationService.cs
@@ -30,7 +30,7 @@
                     if (IsStationValid(station))
                     {
                         var hasPallet = ReadPalletStatus(station); // 鑾峰彇鎵樼洏鐘舵��
-                        if (hasPallet == 0) // 濡傛灉娌℃湁鎵樼洏
+                        if (hasPallet == 16) // 濡傛灉娌℃湁鎵樼洏
                         {
                             palletCount++;
                         }
@@ -57,7 +57,7 @@
         private int ReadPalletStatus(Dt_StationManager station)
         {
             var commonConveyorLine_GW = Storage.Devices.FirstOrDefault(device => device.DeviceCode == station.stationPLC) as CommonConveyorLine_GW;
-            return Convert.ToInt32(commonConveyorLine_GW.ReadValue(ConveyorLineDBName_After.HasPallet, station.stationChildCode));
+            return Convert.ToInt32(commonConveyorLine_GW.ReadValue(ConveyorLineDBName_After.InteractiveSignal, station.stationChildCode));
         }
     }
 }
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index 83311b0..7889386 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -4,6 +4,7 @@
 using Newtonsoft.Json;
 using Quartz;
 using System.Diagnostics.CodeAnalysis;
+using System.Threading.Tasks;
 using WIDESEAWCS_BasicInfoRepository;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core.Caches;
@@ -171,14 +172,14 @@
                         else
                             return;
                     }
-                    
+
                     _taskService.StackCraneTaskCompleted(e.TaskNum);
                     if (commonStackerCrane.DeviceCode.Contains("CH") && task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
                     {
                         task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum);
                         Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
                     }
-                    if(task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && task.TargetAddress == "1359-4") 
+                    if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && task.TargetAddress == "002-021-001")
                     {
                         var TASKHTY = task.Adapt<Dt_Task_Hty>();
                         _taskRepository.DeleteData(task);
@@ -197,15 +198,14 @@
         private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane)
         {
             Dt_Task task;
-            //var taskRun = _taskRepository.QueryFirst(x => x.Roadway == commonStackerCrane.DeviceCode && (x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting || x.TaskState == (int)TaskInStatusEnum.SC_InExecuting));
-            //if (taskRun != null) { return null; }
             if (commonStackerCrane.LastTaskType == null)
             {
                 task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode);
             }
             else
             {
-                if (commonStackerCrane.LastTaskType.GetValueOrDefault().GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
+                var lastTaskTypeGroup = commonStackerCrane.LastTaskType.GetValueOrDefault().GetTaskTypeGroup();
+                if (lastTaskTypeGroup == TaskTypeGroup.OutbondGroup)
                 {
                     task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode);
                     if (task == null)
@@ -221,23 +221,18 @@
 
             if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
             {
-                if (OutTaskStationIsOccupied(task) != null)
+                // 妫�鏌ュ綋鍓嶅嚭搴撲换鍔$珯鍙版槸鍚﹀厑璁告斁璐�
+                var occupiedStation = OutTaskStationIsOccupied(task);
+                if (occupiedStation == null)
+                {
+                    // 濡傛灉褰撳墠鍑哄簱浠诲姟绔欏彴涓嶅厑璁告斁璐э紝鎺掗櫎褰撳墠浠诲姟锛屾煡鎵惧叾浠栧嚭搴撲换鍔�
+                    ConsoleHelper.WriteErrorLine($"浠诲姟鍙凤細銆恵task.TaskNum}銆戝嚭搴撳湴鍧�锛氥�恵task.NextAddress}銆戜笉鍏佽鏀捐揣");
+                    task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, task.TaskId);
+                }
+                else
                 {
                     return task;
                 }
-                //else
-                //{
-                //    List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress).Select(x => x.ChildPosi).ToList();
-                //    List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode, otherOutStaionCodes);
-                //    foreach (var item in tasks)
-                //    {
-                //        if (OutTaskStationIsOccupied(task) != null)
-                //        {
-                //            return task;
-                //        }
-                //    }
-                //    task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode);
-                //}
             }
             else if (task == null)
             {
@@ -326,6 +321,38 @@
             return null;
         }
 
+
+        /// <summary>
+        /// 鏌ユ壘鍏朵粬鍑哄簱浠诲姟鐨勮緟鍔╂柟娉曪紙鎺掗櫎鎸囧畾浠诲姟ID鐨勪换鍔★級
+        /// </summary>
+        /// <param name="deviceCode">璁惧浠g爜</param>
+        /// <param name="excludedTaskId">瑕佹帓闄ょ殑浠诲姟ID</param>
+        /// <returns></returns>
+        private Dt_Task? FindAnotherOutboundTask(string deviceCode, int excludedTaskId)
+        {
+            // 鍏堣幏鍙栨墍鏈夌鍚堟潯浠讹紙鎺掗櫎鎸囧畾浠诲姟ID锛夌殑鍑哄簱浠诲姟鍒楄〃
+            var allOutboundTasks = _taskService.QueryAllOutboundTasks(deviceCode);
+            var availableTasks = allOutboundTasks?.Where(t => excludedTaskId != t.TaskId && t.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup).ToList();
+
+            if (availableTasks == null || availableTasks.Count == 0)
+            {
+                return null;
+            }
+
+            // 閬嶅巻鍙敤浠诲姟鍒楄〃锛屾鏌ヤ换鍔$珯鍙版槸鍚﹀厑璁告斁璐э紝鎵惧埌绗竴涓厑璁告斁璐х殑浠诲姟灏辫繑鍥�
+            foreach (var candidateTask in availableTasks)
+            {
+                var occupiedStation = OutTaskStationIsOccupied(candidateTask);
+                if (occupiedStation != null)
+                {
+                    return candidateTask;
+                }
+                ConsoleHelper.WriteErrorLine($"浠诲姟鍙凤細銆恵occupiedStation.TaskNum}銆戝嚭搴撳湴鍧�锛氥�恵occupiedStation.NextAddress}銆戜笉鍏佽鏀捐揣");
+            }
+
+            return null;
+        }
+
         /// <summary>
         /// 浠诲姟瀹炰綋杞崲鎴愬懡浠odel
         /// </summary>
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/RequestTaskDto.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/RequestTaskDto.cs
index 9b90299..0aeaa65 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/RequestTaskDto.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/RequestTaskDto.cs
@@ -27,6 +27,7 @@
     public string Roadways { get; set; }
 
     public int area { get; set; }
+    public string ProductionLine { get; set; }
 }
 
 public class RequestOutTaskDto
@@ -34,5 +35,6 @@
     public string Position { get; set; }
     public int Tag { get; set; }
     public string AreaCdoe { get; set; }
+    public List<string> AreaCdoes { get; set; }
     public string ProductionLine { get; set; }
 }
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs
index 8e104b3..82858a6 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs
@@ -165,7 +165,7 @@
     /// <param name="areaCode">鍖哄煙缂栫爜</param>
     /// <param name="roadways">宸烽亾鍒楄〃</param>
     /// <returns>杩斿洖缁撴灉闆�</returns>
-    Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, string productionLine);
+    Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, List<string> areaCodes, string productionLine);
 
 
     /// <summary>
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfo.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfo.cs
index 7cc810a..de981c4 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfo.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfo.cs
@@ -34,6 +34,13 @@
         [SugarColumn(IsNullable = true, ColumnDescription = "澶囨敞")]
         public string Remark { get; set; }
 
+
+        /// <summary>
+        /// 鐢熶骇浜х嚎
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDescription = "鐢熶骇浜х嚎")]
+        public string ProductionLine { get; set; }
+
         /// <summary>
         /// 褰撳墠宸ュ簭
         /// </summary>
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/BasicInfo/Dt_needBarcodeService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/BasicInfo/Dt_needBarcodeService.cs
index 36a7f72..4559635 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/BasicInfo/Dt_needBarcodeService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/BasicInfo/Dt_needBarcodeService.cs
@@ -8,7 +8,7 @@
     {
         public dt_needBarcodeService(IDt_needBarcodeRepository BaseDal) : base(BaseDal)
         {
-            
+
         }
     }
 }
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index ffd4a8a..bf8748c 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -1,4 +1,5 @@
-锘縰sing Mapster;
+锘縰sing AngleSharp.Io;
+using Mapster;
 using Masuit.Tools;
 using System.Text.RegularExpressions;
 using WIDESEA_Core.Const;
@@ -78,7 +79,7 @@
                 //var process = await SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>()
                 //    .FirstAsync(x => x.EquipmentName == task.Roadway);
                 //var info = JsonConvert.DeserializeObject<ResponseEqptRunDto>(process.ProcessValue);
-                if (!task.Roadway.Contains("FR"))  //闈炲垎瀹瑰簱鍖哄潎涓婃姤MOM鍑哄叆绔�
+                if (!task.Roadway.Contains("FR") && stock.ProcessCode != "OCVB")  //闈炲垎瀹瑰簱鍖轰笌褰撳墠宸ュ簭鏄疧CVB鍧囦笂鎶OM鍑哄叆绔�
                 {
                     var agingOutputDto = MapToAgingOutputDto(stock);
                     content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
@@ -418,11 +419,20 @@
         }
         else
         {
-            var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.SourceAddress);
-            if (station.stationPLC == "1017")
-                area = _areaInfoRepository.QueryFirst(x => x.AreaID == Convert.ToInt32(station.stationNGLocation));
-            else
-                area = _areaInfoRepository.QueryFirst(x => x.AreaID == loation.AreaId);
+            //var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.SourceAddress);
+            //if (station.stationPLC == "1017")
+            //    area = _areaInfoRepository.QueryFirst(x => x.AreaID == Convert.ToInt32(station.stationNGLocation));
+            //else
+            //    area = _areaInfoRepository.QueryFirst(x => x.AreaID == loation.AreaId);
+            //if (area == null)
+            //    throw new Exception("鏈壘鍒板搴斿尯鍩熶俊鎭�");
+
+            if (boxing.ProcessCode == "OCV1")
+                area = _areaInfoRepository.QueryFirst(x => x.AreaID == 6);
+
+            else if (boxing.ProcessCode == "OCVB")
+                area = _areaInfoRepository.QueryFirst(x => x.AreaID == 7);
+
             if (area == null)
                 throw new Exception("鏈壘鍒板搴斿尯鍩熶俊鎭�");
         }
@@ -444,31 +454,46 @@
             Remark = boxing.BoxingInfoDetails.Count().ToString(),
         };
 
-        // 澶勭悊璇锋眰鍙傛暟
-        AgingInputDto agingInputDto = new AgingInputDto()
+        if (boxing.ProcessCode != "OCVB")
         {
-            SerialNos = boxing.BoxingInfoDetails
-                .Select(item => new SerialNoInDto { SerialNo = item.SerialNumber, PositionNo = item.OrderNo })
-                .ToList(),
-            TrayBarcode = task.PalletCode,
-            OpFlag = 1,
-            EquipmentCode = area.Spare2,
-            Software = area.Spare3
-        };
+            // 澶勭悊璇锋眰鍙傛暟
+            AgingInputDto agingInputDto = new AgingInputDto()
+            {
+                SerialNos = boxing.BoxingInfoDetails
+                    .Select(item => new SerialNoInDto { SerialNo = item.SerialNumber, PositionNo = item.OrderNo })
+                    .ToList(),
+                TrayBarcode = task.PalletCode,
+                OpFlag = 1,
+                EquipmentCode = area.Spare2,
+                Software = area.Spare3
+            };
 
-        var result = _agingInOrOutInputService.GetOCVInputAsync(agingInputDto).Result;
-        var respone = JsonConvert.DeserializeObject<ResponeAgingInputDto>(result.Data.ToString());
-        if (respone.ProductionLine == null || respone.ParameterInfos == null || respone.SpecialParameterDuration.IsNullOrEmpty())
-        {
-            throw new Exception("MOM鏁版嵁杩斿洖閿欒");
+            var result = _agingInOrOutInputService.GetOCVInputAsync(agingInputDto).Result;
+            var respone = JsonConvert.DeserializeObject<ResponeAgingInputDto>(result.Data.ToString());
+
+            bool isFull = false;
+            if (!task.Roadway.Contains("FR"))
+            {
+                isFull = respone.SpecialParameterDuration.IsNullOrEmpty();
+            }
+            if (respone.ProductionLine == null || respone.ParameterInfos == null)
+            {
+                throw new Exception("MOM鏁版嵁杩斿洖閿欒");
+            }
+            stock.LinedProcessFeedbackTime = respone.LinedProcessFeedbackTime;
+            stock.SpecialParameterDuration = respone.SpecialParameterDuration;
+            //2024骞�11鏈�16鏃ワ細鏂板瀛楁璁$畻搴斿嚭搴撴椂闂�
+            stock.OutboundTime = Convert.ToDateTime(respone.LinedProcessFeedbackTime == null ? DateTime.Now : respone.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(respone.SpecialParameterDuration));
+            stock.ProductionLine = respone.ProductionLine;
+            stock.ParameterInfos = respone.ParameterInfos.ToJsonString();
+            stock.StockStatus = 1;
         }
-        stock.LinedProcessFeedbackTime = respone.LinedProcessFeedbackTime;
-        stock.SpecialParameterDuration = respone.SpecialParameterDuration;
-        //2024骞�11鏈�16鏃ワ細鏂板瀛楁璁$畻搴斿嚭搴撴椂闂�
-        stock.OutboundTime = Convert.ToDateTime(respone.LinedProcessFeedbackTime == null ? DateTime.Now : respone.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(respone.SpecialParameterDuration));
-        stock.ProductionLine = respone.ProductionLine;
-        stock.ParameterInfos = respone.ParameterInfos.ToJsonString();
-        stock.StockStatus = 1;
+        else
+        {
+            stock.OutboundTime = DateTime.Now;
+            stock.StockStatus = 1;
+            stock.ProductionLine = boxing.ProductionLine;
+        }
 
         // 璁板綍鏃ュ織
         LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍏ュ簱浠诲姟瀹屾垚", $"璐т綅鍦板潃锛歿task.TargetAddress},淇敼鍚庤揣浣嶆暟鎹細{locationInf}");
@@ -956,6 +981,7 @@
             PalletCode = palletCode,
             IsFull = true,
             ProcessCode = result.ProcessCode,
+            ProductionLine = result.ProductionLine,
             BoxingInfoDetails = result.SerialNos.Select(serialNoObj => new DtBoxingInfoDetail
             {
                 SerialNumber = serialNoObj.SerialNo,
@@ -993,15 +1019,15 @@
     /// <param name="areaCode">鍖哄煙缂栫爜</param>
     /// <param name="roadways">宸烽亾缂栫爜闆嗗悎</param>
     /// <returns>杩斿洖缁撴灉闆�</returns>
-    public async Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, string productionLine)
+    public async Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, List<string> areaCodes, string productionLine)
     {
         WebResponseContent content = new WebResponseContent();
         try
         {
             // 鏍规嵁鎵樼洏绫诲瀷鏌ヨ搴撳瓨淇℃伅
             DtStockInfo stockInfo = tag == (int)TaskOutboundTypeEnum.Outbound
-                ? QueryStockInfoForRealTrayAsync(areaCode, productionLine).Result
-                : QueryStockInfoForEmptyTrayAsync(areaCode).Result;
+                ? areaCodes == null ? await QueryStockInfoForRealTrayAsync(areaCode, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine)
+                : await QueryStockInfoForEmptyTrayAsync(areaCode);
 
             if (stockInfo == null)
             {
@@ -1056,6 +1082,28 @@
             .Includes(x => x.LocationInfo) // 棰勫姞杞絃ocationInfo
             .Includes(x => x.StockInfoDetails) // 棰勫姞杞絊tockInfoDetails
             .Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull == true) // 杩囨护鏉′欢
+            .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
+            .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // 杩囨护鏉′欢
+            .OrderBy(x => x.OutboundTime) // 鎺掑簭
+            .FirstAsync(); // 鑾峰彇绗竴涓厓绱�
+
+        //var firstOrDefault = result.FirstOrDefault(x => roadways.Contains(x.LocationInfo.RoadwayNo)); // 鏌ユ壘绗竴涓尮閰嶇殑鍏冪礌
+        //var firstOrDefault = result[0]; // 鏌ユ壘绗竴涓尮閰嶇殑鍏冪礌
+        //return firstOrDefault;
+        return result;
+    }
+
+    /// <summary>
+    /// 鏌ヨ瀹炵洏搴撳瓨淇℃伅
+    /// </summary>
+    private async Task<DtStockInfo> QueryStockInfoForRealTrayCWAsync(List<string> areaCodes, string productionLine)
+    {
+        var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == "CWSC1");
+
+        var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>()
+            .Includes(x => x.LocationInfo) // 棰勫姞杞絃ocationInfo
+            .Includes(x => x.StockInfoDetails) // 棰勫姞杞絊tockInfoDetails
+            .Where(x => areaCodes.Contains(x.AreaCode) && x.OutboundTime < DateTime.Now && x.IsFull == true) // 杩囨护鏉′欢
             .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
             .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // 杩囨护鏉′欢
             .OrderBy(x => x.OutboundTime) // 鎺掑簭
@@ -1220,7 +1268,7 @@
             {
                 if (stockInfo.LocationInfo.RoadwayNo == "JZSC1")
                 {
-                    task = CreateTask(stockInfo, "1359-4", taskType);
+                    task = CreateTask(stockInfo, "002-021-001", taskType);
                 }
             }
             //var taskId = await BaseDal.AddDataAsync(task);
@@ -1275,6 +1323,10 @@
 
     #endregion 鎸囧畾浠诲姟鍑哄簱
 
+    #region  闈欑疆寮傚父鍙e叆搴�
+
+    #endregion
+
     #endregion 澶栭儴鎺ュ彛鏂规硶
 
     #region 鍐呴儴璋冪敤鏂规硶
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
index 8113250..eee68a9 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -5,6 +5,8 @@
 using System.Threading.Tasks;
 using WIDESEA_Common;
 using WIDESEA_Common.CustomModels;
+
+//using WIDESEA_Common.CustomModels;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.Const;
 using WIDESEA_DTO.MOM;
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs
index 363e05c..611c289 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs
@@ -39,19 +39,25 @@
     {
         WebResponseContent content = new WebResponseContent();
         // 鍒ゆ柇闇�涓嶉渶瑕佸幓鍖呰锛屼笉闇�瑕佸氨鍘诲父娓╀笁
-        var stationManagers = _stationManagerRepository.QueryData(x => x.stationPLC == "1018" && x.stationArea == "Cache");
-        var station = stationManagers.Select(x => x.stationChildCode).ToList();
+        var stationManagers = _stationManagerRepository.QueryData(x => x.stationPLC == "1018" && x.stationArea == "Cache" && x.productLine == input.ProductionLine);
 
-        // 鑾峰彇WCSip鍦板潃鐩稿叧閰嶇疆
-        var wcsIpAddrss = GetWCSIpAddress();
-        if (wcsIpAddrss == null)
-        {
-            throw new InvalidOperationException("WCS IP 鏈厤缃�");
-        }
+        //var station = stationManagers.Select(x => x.stationChildCode).ToList();
 
-        var abc = HttpHelper.PostAsync(wcsIpAddrss, station.ToJsonString()).Result;
-        content = JsonConvert.DeserializeObject<WebResponseContent>(abc);
-        if (content.Data.ObjToInt() > 0)
+        //// 鑾峰彇WCSip鍦板潃鐩稿叧閰嶇疆
+        //var wcsIpAddrss = GetWCSIpAddress();
+        //if (wcsIpAddrss == null)
+        //{
+        //    throw new InvalidOperationException("WCS IP 鏈厤缃�");
+        //}
+
+        //var abc = HttpHelper.PostAsync(wcsIpAddrss, station.ToJsonString()).Result;
+        //content = JsonConvert.DeserializeObject<WebResponseContent>(abc);
+        //var num = content.Data.ObjToInt();
+
+
+        // TODO 鍒ゆ柇鍦ㄩ�旀暟閲�
+        var count = BaseDal.QueryData(x => x.TargetAddress == stationManagers[0].Roadway).Count;
+        if (count <= 10)
         {
             // 閫佽嚦鍖呰
             List<string> strings = stationManagers.Where(x => x.stationType == 0).Select(x => x.Roadway).ToList();
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs
index bc14b7d..662da3a 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs
@@ -108,7 +108,7 @@
     [HttpPost, AllowAnonymous, Route("RequestTrayOutTaskAsync")]
     public async Task<WebResponseContent> RequestTrayOutTaskAsync([FromBody] RequestOutTaskDto request)
     {
-        return await Service.RequestTrayOutTaskAsync(request.Position, request.Tag, request.AreaCdoe, request.ProductionLine);
+        return await Service.RequestTrayOutTaskAsync(request.Position, request.Tag, request.AreaCdoe, request.AreaCdoes, request.ProductionLine);
     }
 
     /// <summary>
@@ -161,9 +161,9 @@
     /// </summary>
     /// <param name="input">璇锋眰鏁版嵁</param>
     /// <returns></returns>
-    [HttpPost, AllowAnonymous, Route("EmergencyTask")]
-    public WebResponseContent EmergencyTask([FromBody] object input)
-    {
-        return Service.EmergencyTask(input);
-    }
+    //[HttpPost, AllowAnonymous, Route("EmergencyTask")]
+    //public WebResponseContent EmergencyTask([FromBody] object input)
+    //{
+    //    //return Service.EmergencyTask(input);
+    //}
 }
\ No newline at end of file

--
Gitblit v1.9.3