刘磊
2024-12-21 a6ea79849f0142b5280f0c5d4b15ecc83f0d015a
Merge branch 'master' of http://115.159.85.185:8098/r/HuaYiZhongHeng/BaiBuLiKu
已删除11个文件
已修改29个文件
1183 ■■■■■ 文件已修改
.gitignore 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Client/src/views/Devicestatus/Craftlibrary/AgingLibrary.vue 202 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/CodeChunks.db 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/CodeChunks.db-shm 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/CodeChunks.db-wal 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/SemanticSymbols.db 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/SemanticSymbols.db-shm 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/SemanticSymbols.db-wal 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/RepositoryBase.cs 132 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/IUnitOfWorkManage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/DB/BaseDBConfig.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/SqlsugarSetup.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/LogHelper/Logger.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Seed/DBContext.cs 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/SchedulerCenterServer.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/DispatchInfoService.cs 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/IDispatchInfoService.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/QuartzJob/DispatchInfoController.cs 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Properties/PublishProfiles/FolderProfile.pubxml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs 325 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/GetStationService.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs 65 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.31.40377/CodeChunks.db 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.31.40377/SemanticSymbols.db-shm 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.31.40377/SemanticSymbols.db-wal 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/RequestTaskDto.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfo.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/BasicInfo/Dt_needBarcodeService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs 118 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -1563,3 +1563,18 @@
/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/CodeChunks.db
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/CodeChunks.db-shm
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/CodeChunks.db-wal
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/SemanticSymbols.db
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/SemanticSymbols.db-shm
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/SemanticSymbols.db-wal
/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/publish/win-x64/WIDESEAWCS_Server.csproj.nuget.g.targets
/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/WIDESEAWCS_Server.csproj.EntityFrameworkCore.targets
/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Properties/PublishProfiles/FolderProfile.pubxml
/Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.31.40377/CodeChunks.db
/Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.31.40377/CodeChunks.db-shm
/Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.31.40377/CodeChunks.db-wal
/Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.31.40377/SemanticSymbols.db-shm
/Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.31.40377/SemanticSymbols.db-wal
Code Management/WCS/WIDESEAWCS_Client/src/views/Devicestatus/Craftlibrary/AgingLibrary.vue
@@ -1,102 +1,102 @@
<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>
</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 devices = reactive([]);
const intToBitArrayFromBinaryString = (num, numBits) => {
  let binaryString = num.toString(2).padStart(numBits, '0');
  return Array.from({ length: numBits }, (_, index) => binaryString[index] === '1');
};
// ç›‘听设备数据变化
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 });
        }
      }
    }
  });
  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>
.Stackerbox {
  width: 220px;
  float: left;
}
.Linebox {
  width: 500px;
  float: left;
}
.box1 {
  float: left;
}
.card-body {
  text-align: center;
  border-radius: 6%;
}
.Stacker {
  background-color: burlywood;
}
.lis {
  float: left;
  width: 233px;
}
</style>
  <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>
 </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 devices = reactive([]);
 const intToBitArrayFromBinaryString = (num, numBits) => {
   let binaryString = num.toString(2).padStart(numBits, '0');
   return Array.from({ length: numBits }, (_, index) => binaryString[index] === '1');
 };
 // ç›‘听设备数据变化
 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 });
         }
       }
     }
   });
   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>
 .Stackerbox {
   width: 220px;
   float: left;
 }
 .Linebox {
   width: 500px;
   float: left;
 }
 .box1 {
   float: left;
 }
 .card-body {
   text-align: center;
   border-radius: 6%;
 }
 .Stacker {
   background-color: burlywood;
 }
 .lis {
   float: left;
   width: 233px;
 }
 </style>
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/CodeChunks.db
Binary files differ
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/CodeChunks.db-shm
Binary files differ
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/CodeChunks.db-wal
Binary files differ
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/SemanticSymbols.db
Binary files differ
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/SemanticSymbols.db-shm
Binary files differ
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.31.40377/SemanticSymbols.db-wal
Binary files differ
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();
        }
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();
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()
        {
            // å¿…须要as,后边会用到切换数据库操作
            return _sqlSugarClient as SqlSugarClient;
            return _sqlSugarClient as SqlSugarScope;
        }
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);
            }
        }
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),
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;
                });
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,
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
    }
}
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>
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;
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)
            {
                // åœ¨è¿™é‡Œå¤„理每个JobKey
                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)
            {
                // åœ¨è¿™é‡Œå¤„理每个TriggerKey
                ITrigger trigger = await scheduler.GetTrigger(triggerKey);
                if (trigger != null)
                {
                    // èŽ·å–ä¸‹ä¸€æ¬¡è§¦å‘æ—¶é—´ï¼ˆå¦‚æžœæœ‰ï¼‰
                    DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
                    // èŽ·å–ä¸Šæ¬¡è§¦å‘æ—¶é—´ï¼ˆå¦‚æžœæœ‰ï¼‰
                    DateTimeOffset? previousFireTime = trigger.GetPreviousFireTimeUtc();
                    // èŽ·å–è§¦å‘ç±»åž‹ï¼ˆå¦‚SimpleTrigger、CronTrigger)
                    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;
        }
    }
}
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>返回定时器Job与对应的设备信息DTO集合。</returns>
        List<DispatchInfoDTO> QueryDispatchInfos();
        Task<WebResponseContent> GetDispatchInfosAsync();
    }
}
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/QuartzJob/DispatchInfoController.cs
@@ -1,5 +1,7 @@
using Microsoft.AspNetCore.Http;
using 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();
        }
    }
}
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Properties/PublishProfiles/FolderProfile.pubxml
ÎļþÒÑɾ³ý
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
ÎļþÒÑɾ³ý
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>
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);
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);
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);
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));
        }
    }
}
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">设备代码</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>
        /// ä»»åŠ¡å®žä½“è½¬æ¢æˆå‘½ä»¤Model
        /// </summary>
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.31.40377/CodeChunks.db
Binary files differ
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.31.40377/SemanticSymbols.db-shm
Binary files differ
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.12.31.40377/SemanticSymbols.db-wal
Binary files differ
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; }
}
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>
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>
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/BasicInfo/Dt_needBarcodeService.cs
@@ -8,7 +8,7 @@
    {
        public dt_needBarcodeService(IDt_needBarcodeRepository BaseDal) : base(BaseDal)
        {
        }
    }
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -1,4 +1,5 @@
using Mapster;
using 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")  //非分容库区与当前工序是OCVB均上报MOM出入站
                {
                    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) // é¢„加载LocationInfo
            .Includes(x => x.StockInfoDetails) // é¢„加载StockInfoDetails
            .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) // é¢„加载LocationInfo
            .Includes(x => x.StockInfoDetails) // é¢„加载StockInfoDetails
            .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  é™ç½®å¼‚常口入库
    #endregion
    #endregion å¤–部接口方法
    #region å†…部调用方法
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;
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();
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);
    //}
}