From 3a29d25c3752978005c2c1d7138f601ba8700bff Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Wed, 18 Sep 2024 15:10:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8F=B0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=AE=A2=E5=8D=95=E8=BD=AF=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TaskPlat/Method/TaskManageService.cs | 68 +++++++++++-------- .../DS.WMS.MainApi/DS.WMS.MainApi.csproj.user | 2 +- .../DS.WMS.Test/SaasDBUpdateTest.cs | 22 +++--- 3 files changed, 50 insertions(+), 42 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs index fb708220..f626c179 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -15,6 +15,7 @@ using DS.WMS.Core.Map.Dtos; using DS.WMS.Core.Map.Interface; using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Entity; +using DS.WMS.Core.Sys.Interface; using DS.WMS.Core.TaskPlat.Dtos; using DS.WMS.Core.TaskPlat.Entity; using DS.WMS.Core.TaskPlat.Interface; @@ -39,6 +40,7 @@ namespace DS.WMS.Core.TaskPlat.Method private readonly IMappingPortService mappingPortService; private readonly IMappingCarrierService mappingCarrierService; private readonly ICodeCarrierService codeCarrierService; + private readonly ICommonService commonService; // 按需构建 //private readonly Lazy seaExportCommonService; @@ -62,13 +64,15 @@ namespace DS.WMS.Core.TaskPlat.Method ICodePortService codePortService, IMappingPortService mappingPortService, IMappingCarrierService mappingCarrierService, - ICodeCarrierService codeCarrierService) : base(user, logger, saasDbService, serviceProvider, environment) + ICodeCarrierService codeCarrierService, + ICommonService commonService) : base(user, logger, saasDbService, serviceProvider, environment) { this.codeCtnService = codeCtnService; this.codePortService = codePortService; this.mappingPortService = mappingPortService; this.mappingCarrierService = mappingCarrierService; this.codeCarrierService = codeCarrierService; + this.commonService = commonService; //seaExportCommonService = new Lazy(serviceProvider.GetRequiredService); } @@ -312,10 +316,16 @@ namespace DS.WMS.Core.TaskPlat.Method { throw new Exception(string.Format("{0}文件不存在", info.Main.ModifyFile)); } + var sequence = await commonService.GetSequenceNextAsync(tenantDb, user); + //if (!sequence.Succeeded || sequence.Data is null) + //{ + // return await Task.FromResult(DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist)); + //} taskInfo = new TaskBaseInfo { Id = SnowFlakeSingle.Instance.NextId(), + TASK_NO = sequence?.Data ?? "", STATUS = TaskStatusEnum.Create.ToString(), STATUS_NAME = TaskStatusEnum.Create.EnumDescription(), IS_EXCEPT = 0, @@ -1731,6 +1741,7 @@ namespace DS.WMS.Core.TaskPlat.Method public async Task>> GetPageAsync(PageRequest querySearch) { var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); + tenantDb.QueryFilter.Clear(); if (querySearch.OtherQueryCondition == null) { @@ -1790,8 +1801,8 @@ namespace DS.WMS.Core.TaskPlat.Method case TaskBaseTypeEnum.BC: { var queryable = tenantDb.Queryable() - .LeftJoin((t, a) => t.Id == a.TaskId) - .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .LeftJoin((t, a) => t.Id == a.TaskId && a.Deleted == false) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID && bc.Deleted == false) .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); @@ -1904,8 +1915,8 @@ namespace DS.WMS.Core.TaskPlat.Method case TaskBaseTypeEnum.SI_FEEDBACK: { - var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) - .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId && a.Deleted == false) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID && bc.Deleted == false) .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); @@ -1978,8 +1989,8 @@ namespace DS.WMS.Core.TaskPlat.Method } case TaskBaseTypeEnum.INVOICE_BILL_MAIL: { - var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) - .LeftJoin((t, a, bc) => t.Id == bc.TASK_PKID) + var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId && a.Deleted == false) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_PKID && bc.Deleted == false) .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); @@ -2021,8 +2032,8 @@ namespace DS.WMS.Core.TaskPlat.Method } case TaskBaseTypeEnum.TRUCK_DISPATCH: { - var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) - .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId && a.Deleted == false) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID && bc.Deleted == false) .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); @@ -2104,8 +2115,8 @@ namespace DS.WMS.Core.TaskPlat.Method } case TaskBaseTypeEnum.CUT_MODIFY: { - var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) - .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId && a.Deleted == false) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID && bc.Deleted == false) .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); @@ -2142,8 +2153,8 @@ namespace DS.WMS.Core.TaskPlat.Method case TaskBaseTypeEnum.ROLLING_NOMINATION: case TaskBaseTypeEnum.TRANSFER_NOMINATION: { - var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) - .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId && a.Deleted == false) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID && bc.Deleted == false) .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); @@ -2185,8 +2196,8 @@ namespace DS.WMS.Core.TaskPlat.Method } case TaskBaseTypeEnum.DRAFT: { - var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) - .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId && a.Deleted == false) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID && bc.Deleted == false) .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); @@ -2225,8 +2236,8 @@ namespace DS.WMS.Core.TaskPlat.Method case TaskBaseTypeEnum.POD_DISCHARGE_FULL: case TaskBaseTypeEnum.POD_GATEOUT_FULL: { - var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) - .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId && a.Deleted == false) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID && bc.Deleted == false) .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); @@ -2262,8 +2273,8 @@ namespace DS.WMS.Core.TaskPlat.Method } case TaskBaseTypeEnum.CAUTION_NOTICE: { - var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) - .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId && a.Deleted == false) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID && bc.Deleted == false) .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); @@ -2312,8 +2323,8 @@ namespace DS.WMS.Core.TaskPlat.Method } case TaskBaseTypeEnum.ROUTE_CUT_CHANGE: { - var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) - .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId && a.Deleted == false) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID && bc.Deleted == false) .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); @@ -2364,7 +2375,7 @@ namespace DS.WMS.Core.TaskPlat.Method default: { var queryable = tenantDb.Queryable() - .LeftJoin((t, a) => t.Id == a.TaskId) + .LeftJoin((t, a) => t.Id == a.TaskId && a.Deleted == false) .LeftJoin((t, a, s) => t.OUT_BS_NO == s.Id); await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); @@ -2470,7 +2481,7 @@ namespace DS.WMS.Core.TaskPlat.Method } queryable.Where(whereList) - .Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString()) + .Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString() && t.Deleted == false) .WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString()) .WhereIF(!string.IsNullOrEmpty(queryDto.BusinessNo), (t, a, bc, s) => queryDto.BusinessNo == t.MBL_NO || queryDto.BusinessNo == s.MBLNO @@ -2506,7 +2517,7 @@ namespace DS.WMS.Core.TaskPlat.Method } queryable.Where(whereList) - .Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString()) + .Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString() && t.Deleted == false) .WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString()) .WhereIF(!string.IsNullOrEmpty(queryDto.BusinessNo), (t, a, s) => queryDto.BusinessNo == t.MBL_NO || queryDto.BusinessNo == s.MBLNO @@ -2540,7 +2551,7 @@ namespace DS.WMS.Core.TaskPlat.Method LevelTree = new List() }; var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); - + tenantDb.QueryFilter.Clear(); // 人员信息测试用 //var sql = tenantDb.Queryable().Where(x => x.Id > 232).ToSqlString(); //var a = user.UserId; @@ -2617,16 +2628,15 @@ namespace DS.WMS.Core.TaskPlat.Method //var underTaskQueryable = tenantDb.Queryable() // .LeftJoin((t, a) => t.Id == a.TaskId) // .LeftJoin((t, a, s) => t.OUT_BS_NO == s.Id); - + //任务列表分组统计 var queryable = tenantDb.Queryable() - .ClearFilter(typeof(IOrgId)) - .LeftJoin((t, a) => t.Id == a.TaskId) + .LeftJoin((t, a) => t.Id == a.TaskId && a.Deleted == false) .LeftJoin((t, a, s) => t.OUT_BS_NO == s.Id) .Where(whereList) - .Where((t, a) => t.STATUS != cancelStr) + .Where((t, a) => t.STATUS != cancelStr && t.Deleted == false) .Where((t, a) => t.IS_PUBLIC == 1 || (t.IS_PUBLIC == 0 && a.Status != null && (a.UserId == userId))) // 2024-8-14 只显示自己需要审批的任务,自己创建的任务不显示,所以去掉t.CreateBy == userId || .WhereIF(!string.IsNullOrEmpty(queryDto.OtherQueryCondition.BusinessNo), (t, a, s) => queryDto.OtherQueryCondition.BusinessNo == t.MBL_NO || queryDto.OtherQueryCondition.BusinessNo == s.MBLNO diff --git a/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj.user b/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj.user index 73975b0c..f2a959bf 100644 --- a/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj.user +++ b/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj.user @@ -1,6 +1,6 @@  - D:\Source\Repos\DS8\ds-wms-service\DS.WMS.MainApi\Properties\PublishProfiles\FolderProfile.pubxml + D:\Code\ds8-solution-pro\ds-wms-service\DS.WMS.MainApi\Properties\PublishProfiles\FolderProfile.pubxml \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Test/SaasDBUpdateTest.cs b/ds-wms-service/DS.WMS.Test/SaasDBUpdateTest.cs index d44c8538..70c5a7e8 100644 --- a/ds-wms-service/DS.WMS.Test/SaasDBUpdateTest.cs +++ b/ds-wms-service/DS.WMS.Test/SaasDBUpdateTest.cs @@ -1,4 +1,5 @@ using System.Reflection; +using DotNetCore.CAP.Internal; using DS.Module.Core; using DS.Module.Core.Extensions; using DS.Module.SqlSugar; @@ -10,12 +11,14 @@ using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Entity.BookingSlot; using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.TaskPlat.Entity; +using LanguageExt.ClassInstances; using Mapster; using Masuit.Tools.Strings; using Microsoft.Extensions.DependencyInjection; using Microsoft.Owin.BuilderProperties; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; +using NPOI.Util; using Org.BouncyCastle.Ocsp; using SqlSugar; using SqlSugar.IOC; @@ -35,15 +38,15 @@ public class SaasDBUpdateTest saasService = _serviceProvider.GetRequiredService(); } - + /// /// 主库初始化单表 /// [Fact] public void MasterInitTableTest() - { + { StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持 - db.CodeFirst.InitTables(typeof(CodeCarrier)); + db.CodeFirst.InitTables(typeof(CodeCarrier)); Assert.True(true); } /// @@ -86,17 +89,12 @@ public class SaasDBUpdateTest //tenantDb.CodeFirst.InitTables(types); // 单表更新 - tenantDb.CodeFirst.InitTables(typeof(TaskBaseAllocation)); + //tenantDb.CodeFirst.InitTables(typeof(TaskBaseAllocation)); // SQL更新 - // string sql = @"ALTER TABLE `task_base` - //DROP COLUMN `PORTLOAD_ID`, - //DROP COLUMN `PORTLOAD_CODE`, - //DROP COLUMN `PORTLOAD`, - //DROP COLUMN `PORTDISCHARGE_ID`, - //DROP COLUMN `PORTDISCHARGE_CODE`, - //DROP COLUMN `PORTDISCHARGE`;"; - // tenantDb.Ado.ExecuteCommand(sql); + string sql = @"UPDATE `task_flow_module` SET `CompletedBusinessStatusCode` = 'YSDAN' WHERE `Id` = 30001"; + // DROP TRIGGER `tr_task_no`; + tenantDb.Ado.ExecuteCommand(sql); } Assert.True(true);