xxyy
2025-03-18 d4cae5c48af02e109b1febce8c7c21e560cd6525
更新配置和代码逻辑,优化查询及日志

- 更新 `.gitignore`,添加 CopilotIndices 和 SemanticSymbols 数据库文件路径。
- 在 `RouterService.cs` 中,增加对 `startPosi` 的检查,优化查询逻辑。
- 修改 `http.js` 中生产环境的 `axios` 基础 URL。
- 在 `Login.vue` 中,调整用户信息的默认值为空字符串。
- 更新 `Sys_Role.vue` 中表格的 `key` 属性为 `roleId`。
- 在 `UnitOfWorkManage.cs` 中,改用 `GetDbClient()` 处理事务。
- 在 `Dt_TaskService.cs` 中,移除缓存锁定机制的注释,更新库存查询失败的日志信息。
- 在 `appsettings.json` 中,将 Redis 使用设置为 `true`,并更新连接信息。
- 移除出库编码的注释,并添加新的出库物料编码信息。
已修改9个文件
67 ■■■■■ 文件已修改
.gitignore 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/RouterService.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSClient/src/api/http.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSClient/src/views/Login.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSClient/src/views/system/Sys_Role.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -1698,3 +1698,11 @@
/3F/Code Management/WCS/WIDESEAWCS_Server/.vs/ProjectEvaluation/wideseawcs_server.projects.v7.bin
/3F/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/DesignTimeBuild/.dtbcache.v2
/3F/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/v17/.suo
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.13.439.2385/CodeChunks.db
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.13.439.2385/CodeChunks.db-shm
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.13.439.2385/CodeChunks.db-wal
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.13.439.2385/SemanticSymbols.db
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.13.439.2385/SemanticSymbols.db-shm
/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.13.439.2385/SemanticSymbols.db-wal
/Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.13.439.2385/CodeChunks.db
/Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.13.439.2385/SemanticSymbols.db
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/RouterService.cs
@@ -1,4 +1,5 @@
using SqlSugar;
using Masuit.Tools;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -98,7 +99,11 @@
                }
                visitedRoutes.Add(routeKey);
                List<Dt_Router> dt_Routers = BaseDal.QueryData(x => x.NextPosi == endPosi || x.ChildPosi == endPosi, new Dictionary<string, OrderByType> { { nameof(Dt_Router.IsEnd), OrderByType.Desc } });
                List<Dt_Router> dt_Routers = BaseDal.QueryData(x => (x.NextPosi == endPosi || x.ChildPosi == endPosi) && x.StartPosi == startPosi, new Dictionary<string, OrderByType> { { nameof(Dt_Router.IsEnd), OrderByType.Desc } });
                if (dt_Routers.IsNullOrEmpty())
                {
                    dt_Routers = BaseDal.QueryData(x => x.NextPosi == endPosi || x.ChildPosi == endPosi, new Dictionary<string, OrderByType> { { nameof(Dt_Router.IsEnd), OrderByType.Desc } });
                }
                if (dt_Routers.Count > 0)
                {
                    foreach (var item in dt_Routers)
@@ -264,7 +269,7 @@
                    {
                        if (routerType == (int)RouterInOutType.Out)
                            router.ChildPosi = routersAddDTOs[i + 1].ChildPositionCode;
                         router.IsEnd = true;
                        router.IsEnd = true;
                    }
                    routers.Add(router);
                }
Code Management/WMS/WIDESEA_WMSClient/src/api/http.js
@@ -19,7 +19,7 @@
}
else if (process.env.NODE_ENV == 'production') {
  // axios.defaults.baseURL = 'http://127.0.0.1:5000/';
  axios.defaults.baseURL = 'http://192.168.20.251:5000/';
  axios.defaults.baseURL = 'http://192.168.5.251:5000/';
}
//axios.defaults.baseURL = 'http://api.volcore.xyz/';
Code Management/WMS/WIDESEA_WMSClient/src/views/Login.vue
@@ -101,8 +101,8 @@
    const loading = ref(false);
    const codeImgSrc = ref('');
    const userInfo = reactive({
      userName: 'admin',
      password: '123456',
      userName: '',
      password: '',
      verificationCode: '1234',
      UUID: undefined
    });
Code Management/WMS/WIDESEA_WMSClient/src/views/system/Sys_Role.vue
@@ -22,7 +22,7 @@
    export default defineComponent({
        setup() {
            const table = ref({
                key: 'Role_Id',
                key: 'roleId',
                footer: "Foots",
                cnName: '角色管理',
                name: 'Sys_Role',
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs
@@ -194,7 +194,7 @@
        public async Task UseTranAsync(Func<Task> action)
        {
            // 开始事务
            _sqlSugarClient.Ado.BeginTran();
            await GetDbClient().BeginTranAsync();
            try
            {
@@ -202,12 +202,12 @@
                await action();
                // 提交事务
                await _sqlSugarClient.Ado.CommitTranAsync();
                await GetDbClient().CommitTranAsync();
            }
            catch (Exception ex)
            {
                // 回滚事务
                await _sqlSugarClient.Ado.RollbackTranAsync();
                await GetDbClient().RollbackTranAsync();
                throw new Exception (ex.Message); // 重新抛出异常,以便调用方可以处理
            }
        }
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -137,17 +137,11 @@
            });
            try
            {
                //using (_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000))
                //{
                _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { stock.PalletCode });
                //}
            }
            catch (Exception ex)
            {
                LogFactory.GetLog("删除缓存失败").Error(true, $"{stock.PalletCode}_删除缓存失败,异常信息:{ex.Message}");
                //using (_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000))
                //{
                //}
            }
            return content.OK("任务完成成功", task.Remark);
@@ -968,11 +962,10 @@
            List<DtStockInfo> stockInfoList = stockInfos.Values.ToList();
            var result = new DtStockInfo();
            //if (stockInfoList.IsNullOrEmpty())
            //{
            //    stockInfoList = await _stockInfoRepository.Db.Queryable<DtStockInfo>()
            //        .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock).IncludesAllFirstLayer().ToListAsync();
            //}
            if (areaCode == "CH001")
            {
                LogFactory.GetLog("CH001").Info(true, JsonConvert.SerializeObject(stockInfoList[0], Formatting.Indented));
            }
            result = stockInfoList.Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull)
                              .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
@@ -982,16 +975,17 @@
                              .OrderBy(x => x.OutboundTime)
            .FirstOrDefault();
            if (result != null)
                _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { result.PalletCode });
            else
                ConsoleHelper.WriteErrorLine("QueryStockInfoForRealTrayAsync查询实盘库存信息失败:未找到符合条件的数据");
                ConsoleHelper.WriteErrorLine($"{areaCode}-{productionLine}查询实盘库存信息失败:未找到符合条件的数据");
            return result;
        }
        catch (Exception ex)
        {
            ConsoleHelper.WriteErrorLine("QueryStockInfoForRealTrayAsync查询实盘库存信息失败:" + ex.Message + "\r\n" + ex.StackTrace);
            ConsoleHelper.WriteErrorLine("查询实盘库存信息失败:" + ex.Message + "\r\n" + ex.StackTrace);
            return null;
        }
    }
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -458,7 +458,7 @@
            else
            {
                locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Distribute && x.RoadwayNo == requestTask.Roadways && x.EnalbeStatus == 1 && x.LocationType == 1);
                if (locations == null)
                if (locations.IsNullOrEmpty())
                {
                    locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == requestTask.Roadways && x.EnalbeStatus == 1 && x.LocationType == 1);
                }
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
@@ -27,7 +27,7 @@
  //缓存设置
  "CacheSettings": {
    "UseRedis": false, //启用redis
    "UseRedis": true, //启用redis
    "RedisSettings": {
      "Address": "127.0.0.1:6379", //地址
      "Password": "123456", //Redis服务密码
@@ -44,10 +44,10 @@
  // 允许出库的编码
  "OutBoundMateriel": [
    //{
    //  "MaterielCode": "CC01050001348",
    //  "ProductionLine": "ZJ-8",
    //  "ProcessCode": "CH001"
    //}
    {
      "MaterielCode": "CC01050001523",
      "ProductionLine": "ZJ-7",
      "ProcessCode": "CH001"
    }
  ]
}