From 5ea350f6d056758039b04a342fcd786f9c61a151 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 10 Sep 2024 16:13:52 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9INTTRA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SeaExportBookingOrClosingEDIService.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs index d457ba1b..74341297 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs @@ -2660,12 +2660,25 @@ namespace DS.WMS.Core.Op.Method if (!string.IsNullOrWhiteSpace(mapPackageInfo.MapCode)) return DataResult.Success(mapPackageInfo.MapCode); - return DataResult.FailedData(mapPackageInfo.MapCode); + //return DataResult.FailedData(mapPackageInfo.MapCode); + throw new Exception($"包装的映射代码未找到"); } else { - throw new Exception($"包装的映射代码未找到"); + var codePackage = codePackageList.FirstOrDefault(b => b.Id == packageCodeId); + + if(codePackage != null && !string.IsNullOrWhiteSpace(codePackage.EdiCode)) + { + return DataResult.Success(codePackage.EdiCode); + } + + throw new Exception($"包装的基础信息EDI代码未找到"); } + + //else + //{ + // + //} } #endregion From 13144a9ae6225991cfe41db1c424149dd05b1060 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 10 Sep 2024 17:23:06 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9INTTRA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SeaExportBookingOrClosingEDIService.cs | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs index 74341297..91e7f764 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBookingOrClosingEDIService.cs @@ -1605,23 +1605,34 @@ namespace DS.WMS.Core.Op.Method return DataResult.Failed($"箱型{conta.CtnAll}的映射数据代码未找到"); } - if (string.IsNullOrWhiteSpace(conta.KindPkgs)) + //截单时箱的包装必填 + if (string.IsNullOrWhiteSpace(conta.KindPkgs) && req.SendType.Equals("E",StringComparison.OrdinalIgnoreCase)) return DataResult.Failed($"集装箱包装不能为空!"); - long packageId = long.Parse(conta.KindPkgs); + if (!string.IsNullOrWhiteSpace(conta.KindPkgs)) + { + long packageId = long.Parse(conta.KindPkgs); - var mapRlt = GetPackageEDICode(packageId, codePackageList, mapPackageList, order.CarrierId, CONST_MAPPING_MODULE); + var mapRlt = GetPackageEDICode(packageId, codePackageList, mapPackageList, order.CarrierId, CONST_MAPPING_MODULE); - if (codePackageList.Any(b => b.Id == packageId)) - contaModel.KINDPKGS = codePackageList.FirstOrDefault(b => b.Id == packageId).PackageName; + if (codePackageList.Any(b => b.Id == packageId)) + contaModel.KINDPKGS = codePackageList.FirstOrDefault(b => b.Id == packageId).PackageName; - if (mapRlt.Succeeded) - { - contaModel.KINDPKGS_EDI_CODE = mapRlt.Data; + if (mapRlt.Succeeded) + { + contaModel.KINDPKGS_EDI_CODE = mapRlt.Data; + } + else + { + return DataResult.Failed($"集装箱【{conta.CntrNo}】包装{conta.KindPkgs}的映射数据代码未找到"); + } } else { - return DataResult.Failed($"包装{order.KindPkgs}的映射数据代码未找到"); + if(req.SendType.Equals("E", StringComparison.OrdinalIgnoreCase)) + { + return DataResult.Failed($"集装箱【{conta.CntrNo}】包装{conta.KindPkgs} 不能为空"); + } } primaryModel.CTNLIST.Add(contaModel); @@ -2606,11 +2617,16 @@ namespace DS.WMS.Core.Op.Method if (!string.IsNullOrWhiteSpace(mapCtnInfo.MapCode)) return DataResult.Success(mapCtnInfo.MapCode); - return DataResult.FailedData(mapCtnInfo.MapCode); + throw new Exception($"集装箱型 {ctnName}的映射代码未找到"); } else { - throw new Exception($"集装箱型 {ctnName}的映射代码未找到"); + if (codeCtnInfo != null && !string.IsNullOrWhiteSpace(codeCtnInfo.EdiCode)) + { + return DataResult.Success(codeCtnInfo.EdiCode); + } + + throw new Exception($"集装箱型 {ctnName}基础代码EDI 错误"); } } #endregion From 00670e1a22a960a1159b787fb3e27d5039881438 Mon Sep 17 00:00:00 2001 From: cjy Date: Tue, 10 Sep 2024 18:06:59 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=8F=8A=E7=94=A8=E6=88=B7=E6=9D=83=E9=99=90?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Code/Dtos/CodeDataRuleTemplateReq.cs | 15 +++++- .../Code/Dtos/CodeDataRuleTemplateRes.cs | 15 +++++- .../DS.WMS.Core/Code/Entity/CodeDataRule.cs | 42 +++++++-------- .../Code/Entity/CodeDataRuleTemplate.cs | 16 ++++-- .../Code/Interface/ICodeDataRuleService.cs | 12 ++--- .../Code/Method/CodeDataRuleService.cs | 54 +++++++++---------- .../Code/Method/DataRuleTemplateService.cs | 2 +- .../Controllers/CodeDataRuleController.cs | 24 ++++----- 8 files changed, 107 insertions(+), 73 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleTemplateReq.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleTemplateReq.cs index 35c447a6..929665d0 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleTemplateReq.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleTemplateReq.cs @@ -18,9 +18,22 @@ namespace DS.WMS.Core.Code.Dtos /// public long Id { get; set; } /// - /// 模板名称 + /// 权限模板类型 /// public string TemplateName { get; set; } + + /// + /// 权限类型 visible 可视范围 operate 操作范围 + /// + public string RuleType { get; set; } = "visible"; + /// + /// 权限模板范围 + /// + public string RuleScope { get; set; } + /// + /// 权限模板范围名称 + /// + public string RuleScopeName { get; set; } /// /// 资源标识(权限ID) /// diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleTemplateRes.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleTemplateRes.cs index a915ad3b..5992a1aa 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleTemplateRes.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleTemplateRes.cs @@ -17,9 +17,22 @@ namespace DS.WMS.Core.Code.Dtos /// public long Id { get; set; } /// - /// 模板名称 + /// 权限模板类型 /// public string TemplateName { get; set; } + + /// + /// 权限类型 visible 可视范围 operate 操作范围 + /// + public string RuleType { get; set; } = "visible"; + /// + /// 权限模板范围 + /// + public string RuleScope { get; set; } + /// + /// 权限模板范围名称 + /// + public string RuleScopeName { get; set; } /// /// 资源标识(权限ID) /// diff --git a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRule.cs b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRule.cs index 249b5762..cdc52be4 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRule.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRule.cs @@ -32,41 +32,39 @@ namespace DS.WMS.Core.Code.Entity [SqlSugar.SugarColumn(ColumnDescription = "用户名称", IsNullable = true, Length = 100)] public string UserName { get; set; } /// - /// 模板ID + /// 可视模板Id /// - [SugarColumn(ColumnDescription = "模板ID")] - public long TemplateId { get; set; } - /// - /// 模板名称 - /// - [SqlSugar.SugarColumn(ColumnDescription = "模板名称", IsNullable = false, Length = 200)] - public string TemplateName { get; set; } - + [SugarColumn(ColumnDescription = "可视模板Id")] + public long VisibleTemplateId { get; set; } /// - /// 权限实体 + /// 可视权限模板范围 /// - [SqlSugar.SugarColumn(ColumnDescription = "权限实体", IsNullable = false, Length = 100)] - public string PermissionEntity { get; set; } + [SqlSugar.SugarColumn(ColumnDescription = "可视权限模板范围", IsNullable = false, Length = 200)] + public string VisibleRuleScope { get; set; } /// - /// 中文视图名 + /// 可视权限模板范围名称 /// - [SqlSugar.SugarColumn(ColumnDescription = "中文视图名", IsNullable = true, Length = 50)] - public string ColumnView { get; set; } + [SqlSugar.SugarColumn(ColumnDescription = "可视权限模板范围名称", IsNullable = false, Length = 200)] + public string VisibleRuleScopeName { get; set; } /// - /// 权限规则 + /// 操作模板Id /// - [SugarColumn(ColumnDescription = "权限规则", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)] - public string DataRules { get; set; } + [SugarColumn(ColumnDescription = "操作模板Id")] + public long OperatorTemplateId { get; set; } /// - /// 数据权限描述 + /// 操作权限模板范围 + /// + [SqlSugar.SugarColumn(ColumnDescription = "操作权限模板范围", IsNullable = false, Length = 200)] + public string OperatorRuleScope { get; set; } + /// + /// 操作权限模板范围名称 /// - [SqlSugar.SugarColumn(ColumnDescription = "数据权限描述", IsNullable = true, Length = 200)] - public string Description { get; set; } + [SqlSugar.SugarColumn(ColumnDescription = "操作权限模板范围名称", IsNullable = false, Length = 200)] + public string OperatorRuleScopeName { get; set; } - /// /// 状态 /// diff --git a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRuleTemplate.cs b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRuleTemplate.cs index efe6d0a4..3f6c9b5a 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRuleTemplate.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRuleTemplate.cs @@ -15,16 +15,26 @@ namespace DS.WMS.Core.Code.Entity [SqlSugar.SugarTable("code_data_rule_template","数据权限模板")] public class CodeDataRuleTemplate : BaseModel { + /// + /// 权限模板类型 + /// + [SqlSugar.SugarColumn(ColumnDescription = "权限模板类型", IsNullable = false, Length = 200)] + public string TemplateName { get; set; } /// /// 权限类型 visible 可视范围 operate 操作范围 /// [SqlSugar.SugarColumn(ColumnDescription = "权限类型", IsNullable = false, Length = 100)] public string RuleType { get; set; } = "visible"; /// - /// 模板名称 + /// 权限模板范围 /// - [SqlSugar.SugarColumn(ColumnDescription = "模板名称", IsNullable = false, Length = 200)] - public string TemplateName { get; set; } + [SqlSugar.SugarColumn(ColumnDescription = "权限模板范围", IsNullable = false, Length = 200)] + public string RuleScope { get; set; } + /// + /// 权限模板范围名称 + /// + [SqlSugar.SugarColumn(ColumnDescription = "权限模板范围名称", IsNullable = false, Length = 200)] + public string RuleScopeName { get; set; } /// /// 资源标识(权限ID) /// diff --git a/ds-wms-service/DS.WMS.Core/Code/Interface/ICodeDataRuleService.cs b/ds-wms-service/DS.WMS.Core/Code/Interface/ICodeDataRuleService.cs index 72a06006..0d206612 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Interface/ICodeDataRuleService.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Interface/ICodeDataRuleService.cs @@ -15,12 +15,12 @@ public interface ICodeDataRuleService Task>> GetListByPage(PageRequest request); - /// - /// 编辑 - /// - /// - /// - Task EditCodeDataRule(CodeDataRuleReq model); + ///// + ///// 编辑 + ///// + ///// + ///// + //Task EditCodeDataRule(CodeDataRuleReq model); /// /// 获取详情 diff --git a/ds-wms-service/DS.WMS.Core/Code/Method/CodeDataRuleService.cs b/ds-wms-service/DS.WMS.Core/Code/Method/CodeDataRuleService.cs index 59017d4f..84537ed9 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Method/CodeDataRuleService.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Method/CodeDataRuleService.cs @@ -47,37 +47,37 @@ namespace DS.WMS.Core.Code.Method return data; } - /// - /// 编辑 - /// - /// - /// - public async Task EditCodeDataRule(CodeDataRuleReq req) - { - var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - if (req.Id == 0) - { - if (tenantDb.Queryable() - .Where(x => x.PermissionId == req.PermissionId && x.TemplateName == req.TemplateName).Any()) - { - return await Task.FromResult(DataResult.Failed("数据权限模板已存在!", MultiLanguageConst.DataRuleTemplateExist)); - } + ///// + ///// 编辑 + ///// + ///// + ///// + //public async Task EditCodeDataRule(CodeDataRuleReq req) + //{ + // var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + // if (req.Id == 0) + // { + // if (tenantDb.Queryable() + // .Where(x => x.PermissionId == req.PermissionId && x.TemplateName == req.TemplateName).Any()) + // { + // return await Task.FromResult(DataResult.Failed("数据权限模板已存在!", MultiLanguageConst.DataRuleTemplateExist)); + // } - var data = req.Adapt(); - var entity = await tenantDb.Insertable(data).ExecuteReturnEntityAsync(); + // var data = req.Adapt(); + // var entity = await tenantDb.Insertable(data).ExecuteReturnEntityAsync(); - return await Task.FromResult(DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess)); - } - else - { - var info = await tenantDb.Queryable().Where(x => x.Id == req.Id).FirstAsync(); + // return await Task.FromResult(DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess)); + // } + // else + // { + // var info = await tenantDb.Queryable().Where(x => x.Id == req.Id).FirstAsync(); - info = req.Adapt(info); + // info = req.Adapt(info); - await tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); - return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess)); - } - } + // await tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + // return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess)); + // } + //} /// /// 详情 diff --git a/ds-wms-service/DS.WMS.Core/Code/Method/DataRuleTemplateService.cs b/ds-wms-service/DS.WMS.Core/Code/Method/DataRuleTemplateService.cs index 2c521faf..ba806553 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Method/DataRuleTemplateService.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Method/DataRuleTemplateService.cs @@ -63,7 +63,7 @@ namespace DS.WMS.Core.Code.Method if (req.Id == 0) { if (tenantDb.Queryable() - .Where(x => x.PermissionId == req.PermissionId && x.TemplateName == req.TemplateName).Any()) + .Where(x => x.PermissionId == req.PermissionId && x.TemplateName == req.TemplateName && x.RuleScope == req.RuleScope && x.RuleType == req.RuleType).Any()) { return await Task.FromResult(DataResult.Failed("数据权限模板已存在!", MultiLanguageConst.DataRuleTemplateExist)); } diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/CodeDataRuleController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/CodeDataRuleController.cs index e009fd6f..b171bc7c 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/CodeDataRuleController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/CodeDataRuleController.cs @@ -37,18 +37,18 @@ public class CodeDataRuleController : ApiController return res; } - /// - /// 编辑 - /// - /// - /// - [HttpPost] - [Route("EditCodeDataRule")] - public async Task EditCodeDataRule([FromBody] CodeDataRuleReq req) - { - var res = await _invokeService.EditCodeDataRule(req); - return res; - } + ///// + ///// 编辑 + ///// + ///// + ///// + //[HttpPost] + //[Route("EditCodeDataRule")] + //public async Task EditCodeDataRule([FromBody] CodeDataRuleReq req) + //{ + // var res = await _invokeService.EditCodeDataRule(req); + // return res; + //} /// /// 详情 From 8f3025b6d4bd412d90a4a37eb0300019f858daff Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Tue, 10 Sep 2024 20:03:18 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8F=B0=E5=8F=B0?= =?UTF-8?q?=E8=B4=A6=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TaskInteraction/SeaExportTaskService.cs | 31 +- .../Op/Method/TaskInteraction/TaskService.cs | 31 +- .../TaskPlat/Dtos/QueryTaskManageDto.cs | 16 +- .../TaskPlat/Dtos/TaskManageDtos.cs | 12 + .../Dtos/TaskManageOrderMessageMainInfo.cs | 50 +- .../TaskPlat/Entity/TaskBaseInfo.cs | 52 ++ .../TaskPlat/Method/TaskManageService.cs | 556 ++++++++++++++---- .../DS.WMS.Test/SaasDBUpdateTest.cs | 18 +- 8 files changed, 647 insertions(+), 119 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/SeaExportTaskService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/SeaExportTaskService.cs index 92a5f116..b52f2431 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/SeaExportTaskService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/SeaExportTaskService.cs @@ -63,6 +63,19 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction x.Vessel, x.Voyno, x.ETD, + + x.DischargePortId, + x.DischargePortCode, + x.DischargePort, + x.LoadPortId, + x.LoadPortCode, + x.LoadPort, + + x.CarrierId, + x.Carrier, + //x.BookingNo, + //x.HBLNO, + //x.CustomerNum, }).FirstAsync(x => x.Id == first.BusinessId); var taskList = new List(); @@ -100,8 +113,24 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction } }; info.Main.TaskDesp = info.Main.TaskTitle = $"【{item.TaskType.GetDescription()}】{biz?.CustomerNo} {biz?.Vessel} {biz?.Voyno} ETD:{biz?.ETD?.ToString("yyyy-MM-dd")}"; - info.Main.CUSTOMER_NO = biz?.CustomerNo; + info.Main.CustomerNo = biz?.CustomerNo; info.Main.MBlNo = biz?.MBLNO; + info.Main.ETD = biz?.ETD; + + info.Main.PortDischarge = biz?.DischargePort; + info.Main.PortDischargeCode = biz?.DischargePortCode; + info.Main.PortDischargeId = biz?.DischargePortId; + info.Main.PortLoad = biz?.LoadPort; + info.Main.PortLoadId = biz?.LoadPortId; + info.Main.PortLoadCode = biz?.LoadPortCode; + + info.Main.CarrierId = biz?.Carrier; + info.Main.CarrierPK = biz?.CarrierId; + + //info.Main.HBLNO = biz?.HBLNO; + //info.Main.BookingNo = biz?.BookingNo; + //info.Main.CustomsNum = biz?.CustomerNum; + var result = await ManagerService.InitTaskJob(info); if (!result.Succeeded) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs index 2c13396b..46c7f08a 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs @@ -243,11 +243,40 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction x.Vessel, x.Voyno, x.ETD, + + x.DischargePortId, + x.DischargePortCode, + x.DischargePort, + x.LoadPortId, + x.LoadPortCode, + x.LoadPort, + + x.CarrierId, + x.Carrier, + + //x.BookingNo, + //x.HBLNO, + //x.CustomerNum, }).FirstAsync(x => x.Id == request.BusinessId); info.Main.TaskTitle = $"【{request.TaskType.GetDescription()}】{biz?.CustomerNo} {biz?.Vessel} {biz?.Voyno} ETD:{biz?.ETD?.ToString("yyyy-MM-dd")}"; + info.Main.CustomerNo = biz?.CustomerNo; info.Main.MBlNo = biz?.MBLNO; - info.Main.CUSTOMER_NO = biz?.CustomerNo; + info.Main.ETD = biz?.ETD; + + info.Main.PortDischarge = biz?.DischargePort; + info.Main.PortDischargeCode = biz?.DischargePortCode; + info.Main.PortDischargeId = biz?.DischargePortId; + info.Main.PortLoad = biz?.LoadPort; + info.Main.PortLoadId = biz?.LoadPortId; + info.Main.PortLoadCode = biz?.LoadPortCode; + + info.Main.CarrierId = biz?.Carrier; + info.Main.CarrierPK = biz?.CarrierId; + + //info.Main.HBLNO = biz?.HBLNO; + //info.Main.BookingNo = biz?.BookingNo; + //info.Main.CustomsNum = biz?.CustomerNum; } info.Main.TaskDesp = info.Main.TaskDesp ?? info.Main.TaskTitle; diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/QueryTaskManageDto.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/QueryTaskManageDto.cs index 17d841f6..10a506eb 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/QueryTaskManageDto.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/QueryTaskManageDto.cs @@ -6,7 +6,7 @@ public sealed class QueryTaskManageDto { /// - /// 业务编号(提单号或委托编号) + /// 业务编号(委托编号/订舱编号/客户编号/提单号/分单号) /// public string BusinessNo { get; set; } @@ -79,5 +79,19 @@ /// 大简云用户Id /// public string DJYUserId { get; set; } + + + + /// + /// 装货港代码 + /// + public string? PortLoadCode { get; set; } + + + /// + /// 卸货港代码 + /// + public string? PortDischargeCode { get; set; } + } } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageDtos.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageDtos.cs index 153054b4..86534367 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageDtos.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageDtos.cs @@ -12,5 +12,17 @@ /// 业务编号(提单号或委托编号) /// public string BusinessNo { get; set; } + + + /// + /// 装货港代码 + /// + public string? PortLoadCode { get; set; } + + + /// + /// 卸货港代码 + /// + public string? PortDischargeCode { get; set; } } } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageMainInfo.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageMainInfo.cs index eaba1f93..a9d6a3d1 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageMainInfo.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageOrderMessageMainInfo.cs @@ -1,4 +1,5 @@ using DS.Module.Core; +using SqlSugar; using System.ComponentModel.DataAnnotations; namespace DS.WMS.Core.TaskPlat.Dtos @@ -63,7 +64,7 @@ namespace DS.WMS.Core.TaskPlat.Dtos /// /// 委托编号 /// - public string? CUSTOMER_NO { get; set; } + public string? CustomerNo { get; set; } /// /// 反馈结果 @@ -311,9 +312,56 @@ namespace DS.WMS.Core.TaskPlat.Dtos ///// 单票账单的解析 ///// //public perbill perbillInfo { get; set; } + /// /// 任务批次号 /// public string TaskBatchNo { get; set; } + + ///// + ///// 客户编号 + ///// + //public string? CustomsNum { get; set; } + + ///// + ///// 分提单号 + ///// + //public string? HBLNO { get; set; } + + ///// + ///// 订舱编号 + ///// + //public string? BookingNo { get; set; } + + + /// + /// 装货港主键 + /// + public long? PortLoadId { get; set; } + + /// + /// 装货港代码 + /// + public string? PortLoadCode { get; set; } + + /// + /// 装货港 + /// + public string? PortLoad { get; set; } + + /// + /// 卸货港主键 + /// + public long? PortDischargeId { get; set; } + + /// + /// 卸货港代码 + /// + public string? PortDischargeCode { get; set; } + + /// + /// 卸货港 + /// + public string? PortDischarge { get; set; } } } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs index f21869e4..986202e8 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs @@ -116,12 +116,30 @@ namespace DS.WMS.Core.TaskPlat.Entity [SugarColumn(ColumnDescription = "主单号", IsNullable = true, Length = 64)] public string? MBL_NO { get; set; } + ///// + ///// 分单号 + ///// + //[SugarColumn(ColumnDescription = "分单号", IsNullable = true, Length = 30)] + //public string? HBL_NO { get; set; } + + ///// + ///// 订舱编号 + ///// + //[SugarColumn(ColumnDescription = "订舱编号", IsNullable = true, Length = 20)] + //public string? BOOKING_NO { get; set; } + /// /// 委托编号 /// [SugarColumn(ColumnDescription = "委托编号", IsNullable = true, Length = 30)] public string? CUSTOMER_NO { get; set; } + ///// + ///// 客户编号 + ///// + //[SugarColumn(ColumnDescription = "客户编号", IsNullable = true, Length = 50)] + //public string? CUSTOMER_NUM { get; set; } + /// /// 备注 /// @@ -290,7 +308,41 @@ namespace DS.WMS.Core.TaskPlat.Entity //[SugarColumn(ColumnDescription = "大简云userid", IsNullable = true, Length = 50)] //public string? DJYUserId { get; set; } + ///// + ///// 装货港主键 + ///// + //[SugarColumn(ColumnDescription = "装货港主键", IsNullable = true)] + //public long? PORTLOAD_ID { get; set; } + ///// + ///// 装货港代码 + ///// + //[SugarColumn(ColumnDescription = "装货港代码", IsNullable = true, Length = 10)] + //public string? PORTLOAD_CODE { get; set; } + + ///// + ///// 装货港 + ///// + //[SugarColumn(ColumnDescription = "装货港", IsNullable = true, Length = 120)] + //public string? PORTLOAD { get; set; } + + ///// + ///// 卸货港主键 + ///// + //[SugarColumn(ColumnDescription = "卸货港主键", IsNullable = true)] + //public long? PORTDISCHARGE_ID { get; set; } + + ///// + ///// 卸货港代码 + ///// + //[SugarColumn(ColumnDescription = "卸货港代码", IsNullable = true, Length = 10)] + //public string? PORTDISCHARGE_CODE { get; set; } + + ///// + ///// 卸货港 + ///// + //[SugarColumn(ColumnDescription = "卸货港", IsNullable = true, Length = 120)] + //public string? PORTDISCHARGE { get; set; } } } \ No newline at end of file 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 42c97cb6..999035a5 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -9,6 +9,7 @@ using DS.Module.DjyServiceStatus; using DS.Module.SqlSugar; using DS.Module.UserModule; using DS.WMS.Core.Code.Dtos; +using DS.WMS.Core.Code.Entity; using DS.WMS.Core.Code.Interface; using DS.WMS.Core.Map.Dtos; using DS.WMS.Core.Map.Interface; @@ -37,6 +38,7 @@ namespace DS.WMS.Core.TaskPlat.Method private readonly ICodePortService codePortService; private readonly IMappingPortService mappingPortService; private readonly IMappingCarrierService mappingCarrierService; + private readonly ICodeCarrierService codeCarrierService; // 按需构建 //private readonly Lazy seaExportCommonService; @@ -46,6 +48,11 @@ namespace DS.WMS.Core.TaskPlat.Method /// public static DateTime LastMatchTaskTime = DateTime.Now; + /// + /// 需要查海运出口表的小写字段名 + /// + static string[] seaExportFields = ["customerid", "saleid", "customerservice", "operatorid"]; //, "portload_code", "portdischarge_code" + public TaskManageService(IUser user, ILogger logger, ISaasDbService saasDbService, @@ -54,12 +61,14 @@ namespace DS.WMS.Core.TaskPlat.Method ICodeCtnService codeCtnService, ICodePortService codePortService, IMappingPortService mappingPortService, - IMappingCarrierService mappingCarrierService) : base(user, logger, saasDbService, serviceProvider, environment) + IMappingCarrierService mappingCarrierService, + ICodeCarrierService codeCarrierService) : base(user, logger, saasDbService, serviceProvider, environment) { this.codeCtnService = codeCtnService; this.codePortService = codePortService; this.mappingPortService = mappingPortService; this.mappingCarrierService = mappingCarrierService; + this.codeCarrierService = codeCarrierService; //seaExportCommonService = new Lazy(serviceProvider.GetRequiredService); } @@ -325,7 +334,22 @@ namespace DS.WMS.Core.TaskPlat.Method BATCH_STATIC = info.Main.BatchStatic, //DJYUserId = info.Head.DJYUserId, OUT_BS_NO = info.Head.BSNO, - CUSTOMER_NO = info.Main.CUSTOMER_NO, + CUSTOMER_NO = info.Main.CustomerNo, + //CUSTOMER_NUM = info.Main.CustomsNum, + //HBL_NO = info.Main.HBLNO, + //BOOKING_NO = info.Main.BookingNo, + + //PORTDISCHARGE = info.Main.PortDischarge, + //PORTDISCHARGE_CODE = info.Main.PortDischargeCode, + //PORTDISCHARGE_ID = info.Main.PortDischargeId, + //PORTLOAD = info.Main.PortLoad, + //PORTLOAD_ID = info.Main.PortLoadId, + //PORTLOAD_CODE = info.Main.PortLoadCode, + + CARRIER_ID = info.Main.CarrierPK, + CARRIER_CODE = info.Main.CarrierId, + CARRIER_NAME = info.Main.CarrierName, + CreateTime = DateTime.Now, }; if (Enum.TryParse(typeof(TaskBaseTypeEnum), taskInfo.TASK_TYPE, out object? taskTypeTemp)) @@ -333,24 +357,29 @@ namespace DS.WMS.Core.TaskPlat.Method taskInfo.TASK_TYPE_NAME = ((TaskBaseTypeEnum)taskTypeTemp).EnumDescription(); } - // 如果船公司主键不为空,则直接保存船公司主键、Code、Name等信息 - if (info.Main.CarrierPK != null) + // 如果船公司主键不为空,则直接保存船公司主键、Code、Name等信息(如果Name为空,查询一下再赋值) + if (taskInfo.CARRIER_ID != null) { - taskInfo.CARRIER_ID = info.Main.CarrierPK; - taskInfo.CARRIER_CODE = info.Main.CarrierId; - taskInfo.CARRIER_NAME = info.Main.CarrierName; + if (string.IsNullOrEmpty(taskInfo.CARRIER_NAME)) + { + var carrierShortName = await tenantDb.Queryable().Where(x => x.Id == taskInfo.CARRIER_ID).Select(x => x.CnShortName).FirstAsync(); + taskInfo.CARRIER_NAME = carrierShortName; + } } - // 如果船公司主键为空,但是Code不为空,则通过映射查出船公司信息并保存 - else if (!string.IsNullOrEmpty(info.Main.CarrierId)) + else { - // 船公司转换 - var allMapCarrierList = (await mappingCarrierService.GetAllList())?.Data ?? new List(); - MappingCarrierRes? carrierInfo = allMapCarrierList.Where(t => t.MapCode.Equals(info.Main.CarrierId, StringComparison.OrdinalIgnoreCase) && t.Module == MappingModuleConst.CONST_MAPPING_CARRIER_MODULE).FirstOrDefault(); - if (carrierInfo != null) + // 如果船公司主键为空,但是Code不为空,则通过映射查出船公司信息并保存 + if (!string.IsNullOrEmpty(taskInfo.CARRIER_CODE)) { - taskInfo.CARRIER_ID = carrierInfo.LinkId; - taskInfo.CARRIER_CODE = carrierInfo.MapCode; - taskInfo.CARRIER_NAME = carrierInfo.MapName; + // 船公司转换 + var allMapCarrierList = (await mappingCarrierService.GetAllList())?.Data ?? new List(); + MappingCarrierRes? carrierInfo = allMapCarrierList.Where(t => t.MapCode.Equals(taskInfo.CARRIER_CODE, StringComparison.OrdinalIgnoreCase) && t.Module == MappingModuleConst.CONST_MAPPING_CARRIER_MODULE).FirstOrDefault(); + if (carrierInfo != null) + { + taskInfo.CARRIER_ID = carrierInfo.LinkId; + taskInfo.CARRIER_CODE = carrierInfo.MapCode; + taskInfo.CARRIER_NAME = carrierInfo.MapName; + } } } @@ -1703,7 +1732,12 @@ namespace DS.WMS.Core.TaskPlat.Method { if (item is ConditionalModel model) { - if (!model.FieldName.StartsWith("t.")) + string lowerFieldName = model.FieldName.ToLower(); + if (seaExportFields.Contains(lowerFieldName)) + { + model.FieldName = "s." + model.FieldName; + } + else { model.FieldName = "t." + model.FieldName; } @@ -1735,17 +1769,41 @@ namespace DS.WMS.Core.TaskPlat.Method { switch (taskType) { + 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, bc) => t.Id == bc.TASK_ID) + .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); + + await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); + // POL、POD关联查询 + queryable.WhereIF(!string.IsNullOrEmpty(querySearch.OtherQueryCondition.PortLoadCode), (t, a, bc, s) => querySearch.OtherQueryCondition.PortLoadCode == bc.PORTLOAD_CODE || querySearch.OtherQueryCondition.PortLoadCode == bc.PORTLOAD_CODE); + queryable.WhereIF(!string.IsNullOrEmpty(querySearch.OtherQueryCondition.PortDischargeCode), (t, a, bc, s) => querySearch.OtherQueryCondition.PortDischargeCode == bc.PORTDISCHARGE_CODE || querySearch.OtherQueryCondition.PortDischargeCode == bc.PORTDISCHARGE_CODE); - result = await queryable.Select((t, a, bc) => new + var queryableTemp = queryable.Select((t, a, bc, s) => new { Id = t.Id.SelectAll(), + + s.CustomerNo, + s.CustomerNum, + s.BookingNo, + s.HBLNO, + + s.CustomerName, + s.Sale, + s.CustomerServiceName, + s.OperatorName, + + s.LoadPortCode, + s.LoadPort, + s.DischargePortCode, + s.DischargePort, + + s.CntrTotal, + bc.BUSI_TYPE, bc.SHIPPER, bc.CONSIGNEE, @@ -1820,22 +1878,41 @@ namespace DS.WMS.Core.TaskPlat.Method bc.PROCESS_RESULT, bc.PROCESS_DATE, bc.PRICE_CALCULATION_DATE - }) - .Distinct().ToQueryPageAsync(querySearch.PageCondition); + }).Distinct(); + var sql = queryableTemp.ToSqlString(); + result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition); - //var sql = queryable.ToSqlString(); return result; } + case TaskBaseTypeEnum.SI_FEEDBACK: { var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) - .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID); - - SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); + await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - result = await queryable.Select((t, a, bc) => new + var queryableTemp = queryable.Select((t, a, bc, s) => new { PK_ID = t.Id.SelectAll(), + + s.CustomerNo, + s.CustomerNum, + s.BookingNo, + s.HBLNO, + + s.CustomerName, + s.Sale, + s.CustomerServiceName, + s.OperatorName, + + s.LoadPortCode, + s.LoadPort, + s.DischargePortCode, + s.DischargePort, + + s.CntrTotal, + bc.CARRIER, //bc.MBL_NO, bc.TAKE_ISSUETYPE_NAME, @@ -1876,20 +1953,41 @@ namespace DS.WMS.Core.TaskPlat.Method bc.DIFF_NUM, bc.IS_UPDATE_BOOKING, bc.UPDATE_BOOKING_DATE - }) - .Distinct().ToQueryPageAsync(querySearch.PageCondition); + }).Distinct(); + + result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition); + return result; } 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); + .LeftJoin((t, a, bc) => t.Id == bc.TASK_PKID) + .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); - SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); + await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - result = await queryable.Select((t, a, bc) => new + var queryableTemp = queryable.Select((t, a, bc, s) => new { PK_ID = t.Id.SelectAll(), + + s.CustomerNo, + s.CustomerNum, + s.BookingNo, + s.HBLNO, + + s.CustomerName, + s.Sale, + s.CustomerServiceName, + s.OperatorName, + + s.LoadPortCode, + s.LoadPort, + s.DischargePortCode, + s.DischargePort, + + s.CntrTotal, + bc.TASK_PKID, //bc.MBL_NO, bc.INVOICE_NO, @@ -1900,20 +1998,38 @@ namespace DS.WMS.Core.TaskPlat.Method bc.DONGSH_RECV_TIME, bc.DONGSH_RESULT_TIME, bc.DONGSH_RECV_REASON - }) - .Distinct().ToQueryPageAsync(querySearch.PageCondition); + }).Distinct(); + result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition); return result; } case TaskBaseTypeEnum.TRUCK_DISPATCH: { var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) - .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID); + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); - SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); + await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - result = await queryable.Select((t, a, bc) => new + var queryableTemp = queryable.Select((t, a, bc, s) => new { PK_ID = t.Id.SelectAll(), + + s.CustomerNo, + s.CustomerNum, + s.BookingNo, + s.HBLNO, + + s.CustomerName, + s.Sale, + s.CustomerServiceName, + s.OperatorName, + + s.LoadPortCode, + s.LoadPort, + s.DischargePortCode, + s.DischargePort, + + //s.CntrTotal, bc.TASK_ID, bc.BookingTruckId, bc.BookingId, @@ -1965,20 +2081,38 @@ namespace DS.WMS.Core.TaskPlat.Method bc.MBLNo, bc.CntrTotal, bc.FactoryAddr - }) - .Distinct().ToQueryPageAsync(querySearch.PageCondition); + }).Distinct(); + result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition); return result; } case TaskBaseTypeEnum.CUT_MODIFY: { var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) - .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID); + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); - SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); + await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - result = await queryable.Select((t, a, bc) => new + result = await queryable.Select((t, a, bc, s) => new { PK_ID = t.Id.SelectAll(), + + s.CustomerNo, + s.CustomerNum, + s.BookingNo, + s.HBLNO, + + s.CustomerName, + s.Sale, + s.CustomerServiceName, + s.OperatorName, + + s.LoadPortCode, + s.LoadPort, + s.DischargePortCode, + s.DischargePort, + + s.CntrTotal, bc.TASK_ID, bc.CARRIER, bc.VESSEL, @@ -1992,13 +2126,31 @@ namespace DS.WMS.Core.TaskPlat.Method case TaskBaseTypeEnum.TRANSFER_NOMINATION: { var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) - .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID); + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); - SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); + await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - result = await queryable.Select((t, a, bc) => new + result = await queryable.Select((t, a, bc, s) => new { PK_ID = t.Id.SelectAll(), + + s.CustomerNo, + s.CustomerNum, + s.BookingNo, + s.HBLNO, + + s.CustomerName, + s.Sale, + s.CustomerServiceName, + s.OperatorName, + + s.LoadPortCode, + s.LoadPort, + s.DischargePortCode, + s.DischargePort, + + s.CntrTotal, bc.TASK_ID, bc.PLAN_TYPE, bc.BATCH_NO, @@ -2017,13 +2169,31 @@ 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); + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); - SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); + await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - result = await queryable.Select((t, a, bc) => new + result = await queryable.Select((t, a, bc, s) => new { PK_ID = t.Id.SelectAll(), + + s.CustomerNo, + s.CustomerNum, + s.BookingNo, + s.HBLNO, + + s.CustomerName, + s.Sale, + s.CustomerServiceName, + s.OperatorName, + + s.LoadPortCode, + s.LoadPort, + s.DischargePortCode, + s.DischargePort, + + s.CntrTotal, bc.TASK_ID, bc.CARRIER, //bc.MBL_NO, @@ -2039,13 +2209,31 @@ namespace DS.WMS.Core.TaskPlat.Method 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); + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); - SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); + await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - result = await queryable.Select((t, a, bc) => new + result = await queryable.Select((t, a, bc,s) => new { PK_ID = t.Id.SelectAll(), + + s.CustomerNo, + s.CustomerNum, + s.BookingNo, + s.HBLNO, + + s.CustomerName, + s.Sale, + s.CustomerServiceName, + s.OperatorName, + + s.LoadPortCode, + s.LoadPort, + s.DischargePortCode, + s.DischargePort, + + s.CntrTotal, bc.TASK_ID, bc.CARRIER, bc.NOTICE_TYPE, @@ -2058,13 +2246,32 @@ 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); + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); - SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); + await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - result = await queryable.Select((t, a, bc) => new + result = await queryable.Select((t, a, bc,s) => new { PK_ID = t.Id.SelectAll(), + + + s.CustomerNo, + s.CustomerNum, + s.BookingNo, + s.HBLNO, + + s.CustomerName, + s.Sale, + s.CustomerServiceName, + s.OperatorName, + + s.LoadPortCode, + s.LoadPort, + s.DischargePortCode, + s.DischargePort, + + s.CntrTotal, bc.TASK_ID, bc.SOURCE_SYSTEM, bc.SOURCE_BUSI_TYPE, @@ -2089,13 +2296,31 @@ 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); + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .LeftJoin((t, a, bc, s) => t.OUT_BS_NO == s.Id); - SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); + await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - result = await queryable.Select((t, a, bc) => new + result = await queryable.Select((t, a, bc,s) => new { PK_ID = t.Id.SelectAll(), + + s.CustomerNo, + s.CustomerNum, + s.BookingNo, + s.HBLNO, + + s.CustomerName, + s.Sale, + s.CustomerServiceName, + s.OperatorName, + + s.LoadPortCode, + s.LoadPort, + s.DischargePortCode, + s.DischargePort, + + s.CntrTotal, bc.TASK_ID, bc.VESSEL, bc.VOYNO, @@ -2118,19 +2343,43 @@ namespace DS.WMS.Core.TaskPlat.Method }).Distinct().ToQueryPageAsync(querySearch.PageCondition); return result; } + default: { - var queryable = tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId); + var queryable = tenantDb.Queryable() + .LeftJoin((t, a) => t.Id == a.TaskId) + .LeftJoin((t, a, s) => t.OUT_BS_NO == s.Id); - SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); + await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - result = await queryable.Select((t, a) => new + var queryableTemp = queryable.Select((t, a, s) => new { PK_ID = t.Id.SelectAll(), + s.CustomerNo, + s.CustomerNum, + s.BookingNo, + s.HBLNO, + + s.CustomerName, + s.Sale, + s.CustomerServiceName, + s.OperatorName, + + s.LoadPortCode, + s.LoadPort, + s.DischargePortCode, + s.DischargePort, + + s.CntrTotal, + //TASK_USER_STATUS = a.Status, //TASK_USER_STATUS_NAME = a.StatusName, //TASK_USER_STATUS_TIME = a.StatusTime - }).Distinct().ToQueryPageAsync(querySearch.PageCondition); + }).Distinct(); + + var sql = queryableTemp.ToSqlString(); + + result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition); return result; } @@ -2140,6 +2389,7 @@ namespace DS.WMS.Core.TaskPlat.Method { if (result.Data?.Count > 0) { + // 查询任务接收人列表 var taskIdList = result.Data.Select(x => (long)x.Id).ToList(); var allRecvUserList = await tenantDb.Queryable() @@ -2181,11 +2431,87 @@ namespace DS.WMS.Core.TaskPlat.Method } } } + + /// + /// 设置条件的方法,用于 + /// + private static async Task SetCondition(ISugarQueryable queryable, + List? whereList, + TaskBaseTypeEnum? taskType, + TaskStatLevelEnum? taskStatLevel, + QueryTaskManageDto queryDto, + long userId) + { + queryable.ClearFilter(typeof(IOrgId)); + var taskTypeStr = taskType.ToString(); + + long? parentId = null; + if (!string.IsNullOrEmpty(queryDto.BusinessNo)) + { + parentId = await queryable.Context.Queryable().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.BusinessNo).Select(x => x.ParentId).FirstAsync(); + } + + queryable.Where(whereList) + .Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString()) + .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 + || queryDto.BusinessNo == s.CustomerNo + || queryDto.BusinessNo == s.BookingNo + || queryDto.BusinessNo == s.CustomerNum + || (parentId != null && s.Id == parentId)) + .WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.STATUS == queryDto.Status) + .WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0 + && (a.UserId == userId) // 2024-8-14 只显示自己需要审批的任务,自己创建的任务不显示,所以去掉t.CreateBy == userId || + && a.Status == queryDto.Status) + .OrderByDescending(t => t.Id); + + var sql = queryable.ToSqlString(); + } + + /// + /// 设置条件的方法,用于 + /// + private static async Task SetCondition(ISugarQueryable queryable, + List? whereList, + TaskBaseTypeEnum? taskType, + TaskStatLevelEnum? taskStatLevel, + QueryTaskManageDto queryDto, + long userId) + { + queryable.ClearFilter(typeof(IOrgId)); + long? parentId = null; + if (!string.IsNullOrEmpty(queryDto.BusinessNo)) + { + parentId = await queryable.Context.Queryable().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.BusinessNo).Select(x => x.ParentId).FirstAsync(); + } + + queryable.Where(whereList) + .Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString()) + .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 + || queryDto.BusinessNo == s.CustomerNo + || queryDto.BusinessNo == s.CustomerNum + || queryDto.BusinessNo == s.BookingNo + || (parentId != null && s.Id == parentId)) + .WhereIF(!string.IsNullOrEmpty(queryDto.PortLoadCode), (t, a, s) => queryDto.PortLoadCode == s.LoadPortCode) + .WhereIF(!string.IsNullOrEmpty(queryDto.PortDischargeCode), (t, a, s) => queryDto.PortDischargeCode == s.DischargePortCode) + + .WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.STATUS == queryDto.Status) + .WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0 + && (a.UserId == userId) // 2024-8-14 只显示自己需要审批的任务,自己创建的任务不显示,所以去掉t.CreateBy == userId || + && a.Status == queryDto.Status) + .OrderByDescending(t => t.Id); + + } + + /// /// 获取登陆人相关的任务统计信息 /// /// 返回回执 - public async Task> GetCurrentTotalStat(GetCurrentTotalStatQueryDto querySearch) + public async Task> GetCurrentTotalStat(GetCurrentTotalStatQueryDto queryDto) { TaskUserStatResultInfo resultInfo = new TaskUserStatResultInfo @@ -2214,9 +2540,9 @@ namespace DS.WMS.Core.TaskPlat.Method //序列化查询条件 List? whereList = null; - if (!string.IsNullOrEmpty(querySearch.QueryCondition)) + if (!string.IsNullOrEmpty(queryDto.QueryCondition)) { - whereList = tenantDb.Utilities.JsonToConditionalModels(querySearch.QueryCondition); + whereList = tenantDb.Utilities.JsonToConditionalModels(queryDto.QueryCondition); if (whereList != null) { @@ -2224,7 +2550,12 @@ namespace DS.WMS.Core.TaskPlat.Method { if (item is ConditionalModel model) { - if (!model.FieldName.StartsWith("t.")) + string lowerFieldName = model.FieldName.ToLower(); + if (seaExportFields.Contains(lowerFieldName)) + { + model.FieldName = "s." + model.FieldName; + } + else { model.FieldName = "t." + model.FieldName; } @@ -2234,14 +2565,53 @@ namespace DS.WMS.Core.TaskPlat.Method } var userId = long.Parse(user.UserId); + var cancelStr = TaskStatusEnum.Cancel.ToString(); + long? parentId = null; + if (!string.IsNullOrEmpty(queryDto.BusinessNo)) + { + var parentIdTemp = await tenantDb.Queryable().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.BusinessNo).Select(x => x.ParentId).FirstAsync(); + parentId = parentIdTemp == 0 ? null : parentIdTemp; + } + + long[]? portLoadTaskIdList = []; + if (!string.IsNullOrEmpty(queryDto.PortLoadCode)) + { + var q1 = tenantDb.Queryable().Where(x => x.PORTLOAD_CODE == queryDto.PortLoadCode).Select(x => new { x.TASK_ID }); + var temp = await q1.ToListAsync(); + if (temp.Count > 0) + { + portLoadTaskIdList = temp.Select(x => x.TASK_ID).ToArray(); + } + } + + long[]? portDischargeTaskIdList = []; + if (!string.IsNullOrEmpty(queryDto.PortDischargeCode)) + { + var q1 = tenantDb.Queryable().Where(x => x.PORTDISCHARGE_CODE == queryDto.PortDischargeCode).Select(x => new { x.TASK_ID }); + var temp = await q1.ToListAsync(); + if (temp.Count > 0) + { + portLoadTaskIdList = temp.Select(x => x.TASK_ID).ToArray(); + } + } + //任务列表分组统计 - var groupList = await tenantDb.Queryable() + var queryable = tenantDb.Queryable() .ClearFilter(typeof(IOrgId)) .LeftJoin((t, a) => t.Id == a.TaskId) + .LeftJoin((t, a, s) => t.OUT_BS_NO == s.Id) .Where(whereList) - .Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString()) - .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(querySearch.BusinessNo), (t, a) => t.MBL_NO == querySearch.BusinessNo || t.CUSTOMER_NO == querySearch.BusinessNo) + .Where((t, a) => t.STATUS != cancelStr) + .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.BusinessNo), (t, a, s) => queryDto.BusinessNo == t.MBL_NO + || queryDto.BusinessNo == s.MBLNO + || queryDto.BusinessNo == s.CustomerNo + || queryDto.BusinessNo == s.BookingNo + || queryDto.BusinessNo == s.CustomerNum + || (parentId != null && s.Id == parentId)) + .WhereIF(!string.IsNullOrEmpty(queryDto.PortLoadCode), (t, a, s) => queryDto.PortLoadCode == s.LoadPortCode || portLoadTaskIdList.Contains(t.Id)) + .WhereIF(!string.IsNullOrEmpty(queryDto.PortDischargeCode), (t, a, s) => queryDto.PortDischargeCode == s.DischargePortCode || portDischargeTaskIdList.Contains(t.Id)) + .GroupBy((t, a) => new { t.TASK_TYPE, t.STATUS, a.Status, t.IS_PUBLIC }) .Select((t, a) => new { @@ -2251,7 +2621,10 @@ namespace DS.WMS.Core.TaskPlat.Method AStatus = a.Status, //IsExcept = t.IS_EXCEPT, IsPublic = t.IS_PUBLIC - }).ToListAsync(); + }); + var sql = queryable.ToSqlString(); + var groupList = await queryable.ToListAsync(); + //var exceptList = groupList @@ -2696,49 +3069,6 @@ namespace DS.WMS.Core.TaskPlat.Method return DataResult.Success(result); } - /// - /// 设置条件的方法,用于 - /// - private void SetCondition(ISugarQueryable queryable, - List? whereList, - TaskBaseTypeEnum? taskType, - TaskStatLevelEnum? taskStatLevel, - QueryTaskManageDto queryTaskManageDto, - long userId) - { - queryable.ClearFilter(typeof(IOrgId)) - .Where(whereList) - .Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString()) - .WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString()) - .WhereIF(!string.IsNullOrEmpty(queryTaskManageDto.BusinessNo), (t, a) => t.MBL_NO == queryTaskManageDto.BusinessNo || t.CUSTOMER_NO == queryTaskManageDto.BusinessNo) - .WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.STATUS == queryTaskManageDto.Status) - .WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0 - && (a.UserId == userId) // 2024-8-14 只显示自己需要审批的任务,自己创建的任务不显示,所以去掉t.CreateBy == userId || - && a.Status == queryTaskManageDto.Status) - .OrderByDescending(t => t.Id); - } - - /// - /// 设置条件的方法,用于 - /// - private void SetCondition(ISugarQueryable queryable, - List? whereList, - TaskBaseTypeEnum? taskType, - TaskStatLevelEnum? taskStatLevel, - QueryTaskManageDto queryTaskManageDto, - long userId) - { - queryable.ClearFilter(typeof(IOrgId)) - .Where(whereList) - .Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString()) - .WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString()) - .WhereIF(!string.IsNullOrEmpty(queryTaskManageDto.BusinessNo), (t, a) => t.MBL_NO == queryTaskManageDto.BusinessNo || t.CUSTOMER_NO == queryTaskManageDto.BusinessNo) - .WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.STATUS == queryTaskManageDto.Status) - .WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0 - && (a.UserId == userId) // 2024-8-14 只显示自己需要审批的任务,自己创建的任务不显示,所以去掉t.CreateBy == userId || - && a.Status == queryTaskManageDto.Status) - .OrderByDescending(t => t.Id); - } diff --git a/ds-wms-service/DS.WMS.Test/SaasDBUpdateTest.cs b/ds-wms-service/DS.WMS.Test/SaasDBUpdateTest.cs index 4b103ee0..f7b0ff47 100644 --- a/ds-wms-service/DS.WMS.Test/SaasDBUpdateTest.cs +++ b/ds-wms-service/DS.WMS.Test/SaasDBUpdateTest.cs @@ -81,8 +81,22 @@ public class SaasDBUpdateTest { var tenantDb = saasService.GetBizDbScopeById(item.TenantId).CopyNew(); StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci"; //较高版本支持 - //tenantDb.CodeFirst.InitTables(types); //指定表空间下的实体 - tenantDb.CodeFirst.InitTables(typeof(BookingContractNoManageLane));//指定更新特定实体 + + // 多表更新 + //tenantDb.CodeFirst.InitTables(types); + + // 单表更新 + //tenantDb.CodeFirst.InitTables(typeof(TaskBaseInfo)); + + // 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); } Assert.True(true); From e4783bdfd46119de31d83c5e5628b6af3389a2ee Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Tue, 10 Sep 2024 20:35:38 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8F=B0=E5=8F=B0?= =?UTF-8?q?=E8=B4=A6=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TaskPlat/Dtos/TaskManageDtos.cs | 26 +++++++------ .../TaskPlat/Method/TaskManageService.cs | 38 ++++++++++--------- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageDtos.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageDtos.cs index 86534367..76fbdaa8 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageDtos.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskManageDtos.cs @@ -7,22 +7,24 @@ /// public string QueryCondition { get; set; } = string.Empty; + public QueryTaskManageDto OtherQueryCondition { get; set; } - /// - /// 业务编号(提单号或委托编号) - /// - public string BusinessNo { get; set; } + ///// + ///// 业务编号(提单号或委托编号) + ///// + //public string BusinessNo { get; set; } - /// - /// 装货港代码 - /// - public string? PortLoadCode { get; set; } + ///// + ///// 装货港代码 + ///// + //public string? PortLoadCode { get; set; } - /// - /// 卸货港代码 - /// - public string? PortDischargeCode { get; set; } + + ///// + ///// 卸货港代码 + ///// + //public string? PortDischargeCode { get; set; } } } 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 59733f7a..d8964cea 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -2214,7 +2214,7 @@ namespace DS.WMS.Core.TaskPlat.Method await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - result = await queryable.Select((t, a, bc,s) => new + result = await queryable.Select((t, a, bc, s) => new { PK_ID = t.Id.SelectAll(), @@ -2251,7 +2251,7 @@ namespace DS.WMS.Core.TaskPlat.Method await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - result = await queryable.Select((t, a, bc,s) => new + result = await queryable.Select((t, a, bc, s) => new { PK_ID = t.Id.SelectAll(), @@ -2301,7 +2301,7 @@ namespace DS.WMS.Core.TaskPlat.Method await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId); - result = await queryable.Select((t, a, bc,s) => new + result = await queryable.Select((t, a, bc, s) => new { PK_ID = t.Id.SelectAll(), @@ -2448,7 +2448,8 @@ namespace DS.WMS.Core.TaskPlat.Method long? parentId = null; if (!string.IsNullOrEmpty(queryDto.BusinessNo)) { - parentId = await queryable.Context.Queryable().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.BusinessNo).Select(x => x.ParentId).FirstAsync(); + var parentIdTemp = await queryable.Context.Queryable().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.BusinessNo).Select(x => x.ParentId).FirstAsync(); + parentId = parentIdTemp == 0 ? null : parentIdTemp; } queryable.Where(whereList) @@ -2483,7 +2484,8 @@ namespace DS.WMS.Core.TaskPlat.Method long? parentId = null; if (!string.IsNullOrEmpty(queryDto.BusinessNo)) { - parentId = await queryable.Context.Queryable().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.BusinessNo).Select(x => x.ParentId).FirstAsync(); + var parentIdTemp = await queryable.Context.Queryable().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.BusinessNo).Select(x => x.ParentId).FirstAsync(); + parentId = parentIdTemp == 0 ? null : parentIdTemp; } queryable.Where(whereList) @@ -2567,16 +2569,16 @@ namespace DS.WMS.Core.TaskPlat.Method var userId = long.Parse(user.UserId); var cancelStr = TaskStatusEnum.Cancel.ToString(); long? parentId = null; - if (!string.IsNullOrEmpty(queryDto.BusinessNo)) + if (!string.IsNullOrEmpty(queryDto.OtherQueryCondition.BusinessNo)) { - var parentIdTemp = await tenantDb.Queryable().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.BusinessNo).Select(x => x.ParentId).FirstAsync(); + var parentIdTemp = await tenantDb.Queryable().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.OtherQueryCondition.BusinessNo).Select(x => x.ParentId).FirstAsync(); parentId = parentIdTemp == 0 ? null : parentIdTemp; } long[]? portLoadTaskIdList = []; - if (!string.IsNullOrEmpty(queryDto.PortLoadCode)) + if (!string.IsNullOrEmpty(queryDto.OtherQueryCondition.PortLoadCode)) { - var q1 = tenantDb.Queryable().Where(x => x.PORTLOAD_CODE == queryDto.PortLoadCode).Select(x => new { x.TASK_ID }); + var q1 = tenantDb.Queryable().Where(x => x.PORTLOAD_CODE == queryDto.OtherQueryCondition.PortLoadCode).Select(x => new { x.TASK_ID }); var temp = await q1.ToListAsync(); if (temp.Count > 0) { @@ -2585,9 +2587,9 @@ namespace DS.WMS.Core.TaskPlat.Method } long[]? portDischargeTaskIdList = []; - if (!string.IsNullOrEmpty(queryDto.PortDischargeCode)) + if (!string.IsNullOrEmpty(queryDto.OtherQueryCondition.PortDischargeCode)) { - var q1 = tenantDb.Queryable().Where(x => x.PORTDISCHARGE_CODE == queryDto.PortDischargeCode).Select(x => new { x.TASK_ID }); + var q1 = tenantDb.Queryable().Where(x => x.PORTDISCHARGE_CODE == queryDto.OtherQueryCondition.PortDischargeCode).Select(x => new { x.TASK_ID }); var temp = await q1.ToListAsync(); if (temp.Count > 0) { @@ -2603,14 +2605,14 @@ namespace DS.WMS.Core.TaskPlat.Method .Where(whereList) .Where((t, a) => t.STATUS != cancelStr) .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.BusinessNo), (t, a, s) => queryDto.BusinessNo == t.MBL_NO - || queryDto.BusinessNo == s.MBLNO - || queryDto.BusinessNo == s.CustomerNo - || queryDto.BusinessNo == s.BookingNo - || queryDto.BusinessNo == s.CustomerNum + .WhereIF(!string.IsNullOrEmpty(queryDto.OtherQueryCondition.BusinessNo), (t, a, s) => queryDto.OtherQueryCondition.BusinessNo == t.MBL_NO + || queryDto.OtherQueryCondition.BusinessNo == s.MBLNO + || queryDto.OtherQueryCondition.BusinessNo == s.CustomerNo + || queryDto.OtherQueryCondition.BusinessNo == s.BookingNo + || queryDto.OtherQueryCondition.BusinessNo == s.CustomerNum || (parentId != null && s.Id == parentId)) - .WhereIF(!string.IsNullOrEmpty(queryDto.PortLoadCode), (t, a, s) => queryDto.PortLoadCode == s.LoadPortCode || portLoadTaskIdList.Contains(t.Id)) - .WhereIF(!string.IsNullOrEmpty(queryDto.PortDischargeCode), (t, a, s) => queryDto.PortDischargeCode == s.DischargePortCode || portDischargeTaskIdList.Contains(t.Id)) + .WhereIF(!string.IsNullOrEmpty(queryDto.OtherQueryCondition.PortLoadCode), (t, a, s) => queryDto.OtherQueryCondition.PortLoadCode == s.LoadPortCode || portLoadTaskIdList.Contains(t.Id)) + .WhereIF(!string.IsNullOrEmpty(queryDto.OtherQueryCondition.PortDischargeCode), (t, a, s) => queryDto.OtherQueryCondition.PortDischargeCode == s.DischargePortCode || portDischargeTaskIdList.Contains(t.Id)) .GroupBy((t, a) => new { t.TASK_TYPE, t.STATUS, a.Status, t.IS_PUBLIC }) .Select((t, a) => new From e4273640e6e8e2014889ded25c31691785c955da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Tue, 10 Sep 2024 16:48:01 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E5=BE=80=E6=9D=A5=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=88=97=E8=A1=A8bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs index fcdf55c7..a4ad183d 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs @@ -269,7 +269,8 @@ public class ClientInfoService : ServiceBase, IClientInfoService var query = TenantDb.Queryable() .LeftJoin((c, c1) => c.Id == c1.ClientId) .LeftJoin((c, c1, c2) => c.Id == c2.ClientId) - .InnerJoinIF(request.OtherQueryCondition?.ClientTag != null, (c, c1, c2, ct) => c.Id == ct.ClientId); + .InnerJoinIF(request.OtherQueryCondition?.ClientTag != null, (c, c1, c2, ct) => c.Id == ct.ClientId) + .GroupByIF(request.OtherQueryCondition != null, (c, c1, c2) => c.Id); if (!string.IsNullOrEmpty(request.OtherQueryCondition?.ContactInfo)) query = query.Where((c, c1, c2) => c1.Tel.Contains(request.OtherQueryCondition.ContactInfo) || From c813074860ef2e8eeaa3e5f51a26cfbe83d3a2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Tue, 10 Sep 2024 17:23:28 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E5=BE=80=E6=9D=A5=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=94=AF=E6=8C=81=E9=AB=98=E7=BA=A7=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Info/Method/ClientInfoService.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs index a4ad183d..9dafec59 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs @@ -260,12 +260,6 @@ public class ClientInfoService : ServiceBase, IClientInfoService { //序列化查询条件 var whereList = request.GetConditionalModels(Db); - foreach (var item in whereList) - { - var condition = (ConditionalModel)item; - condition.FieldName = "c." + condition.FieldName.ToUpperCamelCase(); - } - var query = TenantDb.Queryable() .LeftJoin((c, c1) => c.Id == c1.ClientId) .LeftJoin((c, c1, c2) => c.Id == c2.ClientId) @@ -297,7 +291,14 @@ public class ClientInfoService : ServiceBase, IClientInfoService } } - var result = await query.Where(whereList).Select().ToQueryPageAsync(request.PageCondition); + var result = await query.Select((c, c1, c2, ct) => new ClientInfoRes + { + CodeName = c.CodeName, + Name = c.Name, + ShortName = c.ShortName, + EnShortName = c.EnShortName, + EnFullName = c.EnFullName + }, true).MergeTable().Where(whereList).ToQueryPageAsync(request.PageCondition); if (result.Data?.Count > 0) { From 6386ae372ef0d5d17bf565fc6d44ca193f793e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Wed, 11 Sep 2024 10:46:14 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=9D=9E=E5=88=86=E7=BB=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs index 9dafec59..b082892a 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs @@ -264,7 +264,7 @@ public class ClientInfoService : ServiceBase, IClientInfoService .LeftJoin((c, c1) => c.Id == c1.ClientId) .LeftJoin((c, c1, c2) => c.Id == c2.ClientId) .InnerJoinIF(request.OtherQueryCondition?.ClientTag != null, (c, c1, c2, ct) => c.Id == ct.ClientId) - .GroupByIF(request.OtherQueryCondition != null, (c, c1, c2) => c.Id); + .GroupBy((c, c1, c2) => c.Id); if (!string.IsNullOrEmpty(request.OtherQueryCondition?.ContactInfo)) query = query.Where((c, c1, c2) => c1.Tel.Contains(request.OtherQueryCondition.ContactInfo) || From ea02724b8ceddfd165c0723440c012bb8ccf88ed Mon Sep 17 00:00:00 2001 From: cjy Date: Wed, 11 Sep 2024 11:55:48 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E4=BC=98=E5=8C=96=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E3=80=81=E5=88=97=E8=A1=A8=E5=88=9D=E5=A7=8B=E5=8C=96=E6=9D=83?= =?UTF-8?q?=E9=99=90=E3=80=81=E6=8C=87=E5=AE=9A=E6=9D=83=E9=99=90=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E7=AD=89=EF=BC=9B=E8=8E=B7=E5=8F=96=E6=9C=BA=E6=9E=84?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=A0=91=EF=BC=9B=E6=B5=B7=E8=BF=90=E5=87=BA?= =?UTF-8?q?=E5=8F=A3=E5=A4=8D=E5=88=B6=E5=8D=95=E5=8F=B7=E5=A4=84=E7=90=86?= =?UTF-8?q?=EF=BC=9B=E8=A7=92=E8=89=B2=E4=BB=A3=E7=A0=81=E5=94=AF=E4=B8=80?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E4=BF=AE=E6=94=B9=EF=BC=9B=E5=90=88=E7=BA=A6?= =?UTF-8?q?=E5=8F=B7=E4=B8=8B=E6=8B=89=E6=B7=BB=E5=8A=A0=E8=88=B9=E5=85=AC?= =?UTF-8?q?=E5=8F=B8=E4=BC=A0=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Code/Dtos/AssignDataRuleScopeReq.cs | 36 +++++ .../DS.WMS.Core/Code/Dtos/CodeDataRuleReq.cs | 47 ++++-- .../DS.WMS.Core/Code/Dtos/CodeDataRuleRes.cs | 47 ++++-- .../Code/Dtos/GetOrCreateCodeDataRuleReq.cs | 25 +++ .../DS.WMS.Core/Code/Entity/CodeDataRule.cs | 17 +- .../Code/Interface/ICodeDataRuleService.cs | 35 ++-- .../Code/Method/CodeDataRuleService.cs | 152 +++++++++++------- .../DS.WMS.Core/Op/Method/SeaExportService.cs | 4 +- .../DS.WMS.Core/Sys/Dtos/OrgTree.cs | 3 +- .../Sys/Interface/IClientCommonService.cs | 2 +- .../Sys/Interface/ISysOrgService.cs | 7 + .../Sys/Method/ClientCommonService.cs | 3 +- .../DS.WMS.Core/Sys/Method/SysOrgService.cs | 69 ++++++++ .../DS.WMS.Core/Sys/Method/SysRoleService.cs | 2 +- .../Controllers/ClientCommonController.cs | 6 +- .../Controllers/CodeDataRuleController.cs | 67 ++++---- .../Controllers/OrgController.cs | 13 ++ .../DS.WMS.Test/SaasDBUpdateTest.cs | 2 +- 18 files changed, 395 insertions(+), 142 deletions(-) create mode 100644 ds-wms-service/DS.WMS.Core/Code/Dtos/AssignDataRuleScopeReq.cs create mode 100644 ds-wms-service/DS.WMS.Core/Code/Dtos/GetOrCreateCodeDataRuleReq.cs diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/AssignDataRuleScopeReq.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/AssignDataRuleScopeReq.cs new file mode 100644 index 00000000..deb26626 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/AssignDataRuleScopeReq.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Code.Dtos +{ + /// + /// 分配数据权限范围 + /// + public class AssignDataRuleScopeReq + { + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 模板Id + /// + public long TemplateId { get; set; } + /// + /// 权限类型 visible 可视范围 operate 操作范围 + /// + public string RuleType { get; set; } = "visible"; + /// + /// 权限模板范围 + /// + public string RuleScope { get; set; } + /// + /// 权限模板范围名称 + /// + public string RuleScopeName { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleReq.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleReq.cs index c60989d2..96542930 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleReq.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleReq.cs @@ -18,32 +18,24 @@ namespace DS.WMS.Core.Code.Dtos /// public long Id { get; set; } - /// - /// 模板Id - /// - public long TemplateId { get; set; } - /// - /// 模板名称 - /// - public string TemplateName { get; set; } /// /// 资源标识(权限ID) /// public long PermissionId { get; set; } /// - /// 权限实体 + /// 权限模板类型 /// - public string PermissionEntity { get; set; } + public string TemplateName { get; set; } /// - /// 中文视图名 + /// 权限描述 /// - public string ColumnView { get; set; } + public string Description { get; set; } /// - /// 权限规则 + /// 备注 /// - public string DataRules { get; set; } + public string Note { get; set; } /// /// 用户Id /// @@ -54,9 +46,32 @@ namespace DS.WMS.Core.Code.Dtos /// public string UserName { get; set; } /// - /// 数据权限描述 + /// 可视模板Id /// - public string Description { get; set; } + public long VisibleTemplateId { get; set; } + + /// + /// 可视权限模板范围 + /// + public string VisibleRuleScope { get; set; } + /// + /// 可视权限模板范围名称 + /// + public string VisibleRuleScopeName { get; set; } + + /// + /// 操作模板Id + /// + public long OperatorTemplateId { get; set; } + + /// + /// 操作权限模板范围 + /// + public string OperatorRuleScope { get; set; } + /// + /// 操作权限模板范围名称 + /// + public string OperatorRuleScopeName { get; set; } /// /// 状态 /// diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleRes.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleRes.cs index 056bbc54..bc6e69df 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleRes.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeDataRuleRes.cs @@ -17,31 +17,23 @@ namespace DS.WMS.Core.Code.Dtos /// public long Id { get; set; } /// - /// 模板Id - /// - public long TemplateId { get; set; } - /// - /// 模板名称 - /// - public string TemplateName { get; set; } - /// /// 资源标识(权限ID) /// public long PermissionId { get; set; } /// - /// 权限实体 + /// 权限模板类型 /// - public string PermissionEntity { get; set; } + public string TemplateName { get; set; } /// - /// 中文视图名 + /// 权限描述 /// - public string ColumnView { get; set; } + public string Description { get; set; } /// - /// 权限规则 + /// 备注 /// - public string DataRules { get; set; } + public string Note { get; set; } /// /// 用户Id /// @@ -52,9 +44,32 @@ namespace DS.WMS.Core.Code.Dtos /// public string UserName { get; set; } /// - /// 数据权限描述 + /// 可视模板Id /// - public string Description { get; set; } + public long VisibleTemplateId { get; set; } + + /// + /// 可视权限模板范围 + /// + public string VisibleRuleScope { get; set; } + /// + /// 可视权限模板范围名称 + /// + public string VisibleRuleScopeName { get; set; } + + /// + /// 操作模板Id + /// + public long OperateTemplateId { get; set; } + + /// + /// 操作权限模板范围 + /// + public string OperateRuleScope { get; set; } + /// + /// 操作权限模板范围名称 + /// + public string OperateRuleScopeName { get; set; } /// /// 状态 /// diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/GetOrCreateCodeDataRuleReq.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/GetOrCreateCodeDataRuleReq.cs new file mode 100644 index 00000000..849ea864 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/GetOrCreateCodeDataRuleReq.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Code.Dtos +{ + /// + /// 数据权限请求 + /// + public class GetOrCreateCodeDataRuleReq + { + + /// + /// 用户Id + /// + public long UserId { get; set; } + + /// + /// 资源标识(权限ID) + /// + public long PermissionId { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRule.cs b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRule.cs index cdc52be4..9b1c1959 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRule.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRule.cs @@ -20,6 +20,17 @@ namespace DS.WMS.Core.Code.Entity /// [SugarColumn(ColumnDescription = "资源标识(权限ID)")] public long PermissionId { get; set; } + + /// + /// 权限模板类型 + /// + [SqlSugar.SugarColumn(ColumnDescription = "权限模板类型", IsNullable = false, Length = 200)] + public string TemplateName { get; set; } + /// + /// 权限描述 + /// + [SqlSugar.SugarColumn(ColumnDescription = "权限描述", IsNullable = true, Length = 200)] + public string Description { get; set; } /// /// 用户Id /// @@ -52,18 +63,18 @@ namespace DS.WMS.Core.Code.Entity /// 操作模板Id /// [SugarColumn(ColumnDescription = "操作模板Id")] - public long OperatorTemplateId { get; set; } + public long OperateTemplateId { get; set; } /// /// 操作权限模板范围 /// [SqlSugar.SugarColumn(ColumnDescription = "操作权限模板范围", IsNullable = false, Length = 200)] - public string OperatorRuleScope { get; set; } + public string OperateRuleScope { get; set; } /// /// 操作权限模板范围名称 /// [SqlSugar.SugarColumn(ColumnDescription = "操作权限模板范围名称", IsNullable = false, Length = 200)] - public string OperatorRuleScopeName { get; set; } + public string OperateRuleScopeName { get; set; } /// /// 状态 diff --git a/ds-wms-service/DS.WMS.Core/Code/Interface/ICodeDataRuleService.cs b/ds-wms-service/DS.WMS.Core/Code/Interface/ICodeDataRuleService.cs index 0d206612..142e4be4 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Interface/ICodeDataRuleService.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Interface/ICodeDataRuleService.cs @@ -10,11 +10,16 @@ public interface ICodeDataRuleService /// /// 列表 /// - /// + /// /// - Task>> GetListByPage(PageRequest request); - + Task>> GetCodeDataRuleList(GetOrCreateCodeDataRuleReq req); + /// + /// 数据权限指定范围 + /// + /// + /// + public Task AssignDataRuleScope(AssignDataRuleScopeReq req); ///// ///// 编辑 ///// @@ -22,18 +27,18 @@ public interface ICodeDataRuleService ///// //Task EditCodeDataRule(CodeDataRuleReq model); - /// - /// 获取详情 - /// - /// - /// - Task> GetCodeDataRuleInfo(string id); + ///// + ///// 获取详情 + ///// + ///// + ///// + //Task> GetCodeDataRuleInfo(string id); - /// - /// 批量删除 - /// - /// - /// - public Task BatchDelCodeDataRule(IdModel req); + ///// + ///// 批量删除 + ///// + ///// + ///// + //public Task BatchDelCodeDataRule(IdModel req); } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Code/Method/CodeDataRuleService.cs b/ds-wms-service/DS.WMS.Core/Code/Method/CodeDataRuleService.cs index 84537ed9..d2a458e2 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Method/CodeDataRuleService.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Method/CodeDataRuleService.cs @@ -6,7 +6,10 @@ using DS.Module.UserModule; using DS.WMS.Core.Code.Dtos; using DS.WMS.Core.Code.Entity; using DS.WMS.Core.Code.Interface; +using DS.WMS.Core.Sys.Dtos; +using DS.WMS.Core.Sys.Entity; using Mapster; +using Microsoft.AspNet.SignalR.Hubs; using Microsoft.Extensions.DependencyInjection; using SqlSugar; @@ -34,78 +37,117 @@ namespace DS.WMS.Core.Code.Method /// /// 列表 /// - /// + /// /// - public async Task>> GetListByPage(PageRequest request) + public async Task>> GetCodeDataRuleList(GetOrCreateCodeDataRuleReq req) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - //序列化查询条件 - var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); - var data = await tenantDb.Queryable() - .Where(whereList) - .Select().ToQueryPageAsync(request.PageCondition); - return data; - } - ///// - ///// 编辑 - ///// - ///// - ///// - //public async Task EditCodeDataRule(CodeDataRuleReq req) - //{ - // var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - // if (req.Id == 0) - // { - // if (tenantDb.Queryable() - // .Where(x => x.PermissionId == req.PermissionId && x.TemplateName == req.TemplateName).Any()) - // { - // return await Task.FromResult(DataResult.Failed("数据权限模板已存在!", MultiLanguageConst.DataRuleTemplateExist)); - // } + if (!tenantDb.Queryable().Where(x=>x.UserId == req.UserId && x.PermissionId == req.PermissionId).Any()) { - // var data = req.Adapt(); - // var entity = await tenantDb.Insertable(data).ExecuteReturnEntityAsync(); + var visibleTemp = await tenantDb.Queryable().FirstAsync(x => x.PermissionId == req.PermissionId && x.RuleType == "visible" && x.RuleScope == "self"); - // return await Task.FromResult(DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess)); - // } - // else - // { - // var info = await tenantDb.Queryable().Where(x => x.Id == req.Id).FirstAsync(); + if (visibleTemp.IsNull()) + { + return await Task.FromResult(DataResult>.Failed("请维护该权限下的本人可视权限模板!")); + } + var operateTemp = await tenantDb.Queryable().FirstAsync(x => x.PermissionId == req.PermissionId && x.RuleType == "operate" && x.RuleScope == "self"); - // info = req.Adapt(info); + if (operateTemp.IsNull()) + { + return await Task.FromResult(DataResult>.Failed("请维护该权限下的本人操作权限模板!")); + } - // await tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); - // return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess)); - // } - //} + var userInfo = await db.Queryable().FirstAsync(x => x.Id == req.UserId); + + var rule = new CodeDataRule() { + UserId = req.UserId, + UserName = userInfo.UserName, + VisibleTemplateId = visibleTemp.Id, + VisibleRuleScope =visibleTemp.RuleScope, + VisibleRuleScopeName = visibleTemp.RuleScopeName, + OperateTemplateId = operateTemp.Id, + OperateRuleScope = operateTemp.RuleScope, + OperateRuleScopeName = operateTemp.RuleScopeName, + PermissionId = req.PermissionId, + TemplateName = visibleTemp.TemplateName, + Description = visibleTemp.Description, + Note = visibleTemp.Note, + }; + await tenantDb.Insertable(rule).ExecuteCommandAsync(); + } + var data = await tenantDb.Queryable() + .Where(x => x.UserId == req.UserId && x.PermissionId == req.PermissionId) + .Select().ToListAsync(); + + return await Task.FromResult(DataResult>.Success(data,MultiLanguageConst.DataQuerySuccess)); + //序列化查询条件 + //var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); + //var data = await tenantDb.Queryable() + // .Where(whereList) + // .Select().ToQueryPageAsync(request.PageCondition); + //return data; + } /// - /// 详情 + /// 数据权限指定范围 /// - /// + /// /// - public async Task> GetCodeDataRuleInfo(string id) + public async Task AssignDataRuleScope(AssignDataRuleScopeReq req) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var data = await tenantDb.Queryable() - .Where(x => x.Id == long.Parse(id) && x.Status == StatusEnum.Enable) - .Select() - .FirstAsync(); - return await Task.FromResult(DataResult.Success(data, MultiLanguageConst.DataQuerySuccess)); - } - + var info = await tenantDb.Queryable().FirstAsync(x => x.Id == req.Id); - - - public async Task BatchDelCodeDataRule(IdModel req) - { - var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var list = await tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id)).ToListAsync(); - if (list.Count > 0) + if (info.IsNull()) { - tenantDb.Deleteable(list).ExecuteCommand(); + return await Task.FromResult(DataResult.Failed("数据权限不存在!")); } - return await Task.FromResult(DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess)); + + if (req.RuleType == "visible") + { + info.VisibleTemplateId = req.TemplateId; + info.VisibleRuleScope = req.RuleScope; + info.VisibleRuleScopeName = req.RuleScopeName; + } + else + { + info.OperateTemplateId = req.TemplateId; + info.OperateRuleScope = req.RuleScope; + info.OperateRuleScopeName = req.RuleScopeName; + + } + await tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess)); } + + /// + /// 详情 + /// + /// + /// + //public async Task> GetCodeDataRuleInfo(string id) + //{ + // var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + // var data = await tenantDb.Queryable() + // .Where(x => x.Id == long.Parse(id) && x.Status == StatusEnum.Enable) + // .Select() + // .FirstAsync(); + // return await Task.FromResult(DataResult.Success(data, MultiLanguageConst.DataQuerySuccess)); + //} + + + + + //public async Task BatchDelCodeDataRule(IdModel req) + //{ + // var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + // var list = await tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id)).ToListAsync(); + // if (list.Count > 0) + // { + // tenantDb.Deleteable(list).ExecuteCommand(); + // } + // return await Task.FromResult(DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess)); + //} } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs index a2f8b9d3..018b0160 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs @@ -786,6 +786,7 @@ public partial class SeaExportService : ISeaExportService //data.IsBusinessLocking = false; //data.IsFeeLocking = false; //data.CustomerNo = sequence.Data; + data.CustomerNo = ""; var entity = tenantDb.Insertable(data).ExecuteReturnEntity(); @@ -801,6 +802,7 @@ public partial class SeaExportService : ISeaExportService data = info.Adapt(data); data.Id = 0; data.ParentId = 0; + data.CustomerNo = ""; //data.IsBusinessLocking = false; //data.IsFeeLocking = false; //data.CustomerNo = sequence.Data; @@ -813,7 +815,7 @@ public partial class SeaExportService : ISeaExportService } list1.Add("IsBusinessLocking"); list1.Add("IsFeeLocking"); - list1.Add("CustomerNo"); + //list1.Add("CustomerNo"); var insertColumns = list1.ToArray(); //insertColumns.AddRange(["Id", "ParentId", "IsBusinessLocking", "IsFeeLocking", "CustomerNo"]); var entity = tenantDb.Insertable(data).InsertColumns(insertColumns).ExecuteReturnEntity(); diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/OrgTree.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/OrgTree.cs index dd4091dc..a501b504 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/OrgTree.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/OrgTree.cs @@ -12,7 +12,8 @@ public class OrgTree public long? ParentId { get; set; } public List Children { get; set; } - + + public List UserList { get; set; } /// /// 无参构造函数 /// diff --git a/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs index bcfecdc0..4386d46d 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs @@ -46,7 +46,7 @@ public interface IClientCommonService /// 获取约号下拉列表-客户端 /// /// - public Task>> GetBookingContractNoList(string queryKey = ""); + public Task>> GetBookingContractNoList(string queryKey = "", long carrierId = 0); /// /// 获取商品下拉列表-客户端 /// diff --git a/ds-wms-service/DS.WMS.Core/Sys/Interface/ISysOrgService.cs b/ds-wms-service/DS.WMS.Core/Sys/Interface/ISysOrgService.cs index 48222c02..0e96f28b 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Interface/ISysOrgService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Interface/ISysOrgService.cs @@ -42,4 +42,11 @@ public interface ISysOrgService /// /// public DataResult BatchDelOrg(IdModel req); + + + /// + /// 获取树型机构用户 + /// + /// + public DataResult> GetOrgUserTree(); } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs index 17ebe240..d57da245 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs @@ -162,11 +162,12 @@ public class ClientCommonService : IClientCommonService /// 获取约号下拉列表-客户端 /// /// - public async Task>> GetBookingContractNoList(string queryKey = "") + public async Task>> GetBookingContractNoList(string queryKey = "", long carrierId = 0) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var list = await tenantDb.Queryable() .WhereIF(!string.IsNullOrEmpty(queryKey), a => a.ContractNo.Contains(queryKey) || a.ContractName.Contains(queryKey)) + .WhereIF(carrierId != 0, a => a.CarrierId == carrierId) .Select() .Take(20) .WithCache($"{SqlSugarCacheConst.ContractNo}{user.TenantId}") diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/SysOrgService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/SysOrgService.cs index bcd5fd83..d5911c05 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/SysOrgService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/SysOrgService.cs @@ -164,4 +164,73 @@ public class SysOrgService:ISysOrgService throw ex; } } + + + /// + /// 获取树型机构用户 + /// + /// + public DataResult> GetOrgUserTree() + { + var list = db.Queryable().Select(a => new OrgTree + { + Title = a.OrgName, + Value = a.Id, + ParentId = a.ParentId + }).ToList(); + + var orgList = BuildOrgUserTree(list,db); + + return DataResult>.Success("获取数据成功!", orgList); + } + + /// + /// 双层循环 + /// + /// + /// + public static List BuildOrgUserTree(List treeNodes,ISqlSugarClient sugarClient) + { + try + { + List trees = new List(); + + foreach (var treeNode in treeNodes) + { + //var orgUsers = sugarClient.Queryable().Where(x=>x.OrgId == treeNode.Value).Select(x=>x.UserId).ToList(); + //if (orgUsers.Count>0) + //{ + // var users = sugarClient.Queryable().Where(x => orgUsers.Contains(x.Id)).Select().ToList(); + // if (users.Any()) + // { + + + // } + //} + var users = sugarClient.Queryable().Where(x => x.DefaultOrgId == treeNode.Value).Select().ToList(); + if (users.Count>0) + { + treeNode.UserList = users; + } + + if (0 == (treeNode.ParentId)) + { + trees.Add(treeNode); + } + + foreach (var it in treeNodes) + { + if (it.ParentId == treeNode.Value) + { + treeNode.Children.Add(it); + } + } + } + return trees; + } + catch (Exception ex) + { + throw ex; + } + } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/SysRoleService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/SysRoleService.cs index 6c90a650..b81a49f0 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/SysRoleService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/SysRoleService.cs @@ -56,7 +56,7 @@ public class SysRoleService : ISysRoleService { if (model.Id == 0) { - var isExist = db.Queryable().Filter(null, true).Where(x => x.RoleCode == model.RoleCode).First(); + var isExist = db.Queryable().Where(x => x.RoleCode == model.RoleCode).First(); if (isExist != null) { return DataResult.Failed("角色唯一编码已存在!", MultiLanguageConst.UserCodeExist); diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs index de46f5e0..673d23ff 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs @@ -103,13 +103,13 @@ public class ClientCommonController : ApiController /// /// 获取合约号下拉列表-客户端 /// - /// 商品代码 + /// 合约号 /// [HttpGet] [Route("GetBookingContractNoList")] - public async Task>> GetBookingContractNoList([FromQuery] string queryKey) + public async Task>> GetBookingContractNoList([FromQuery] string queryKey, long carrierId = 0) { - var res = await _invokeService.GetBookingContractNoList(queryKey); + var res = await _invokeService.GetBookingContractNoList(queryKey, carrierId); return res; } /// diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/CodeDataRuleController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/CodeDataRuleController.cs index b171bc7c..db194ee1 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/CodeDataRuleController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/CodeDataRuleController.cs @@ -27,16 +27,27 @@ public class CodeDataRuleController : ApiController /// /// 列表 /// - /// + /// /// [HttpPost] [Route("GetCodeDataRuleList")] - public async Task>> GetCodeDataRuleList([FromBody] PageRequest request) + public async Task>> GetCodeDataRuleList([FromBody] GetOrCreateCodeDataRuleReq req) { - var res =await _invokeService.GetListByPage(request); + var res =await _invokeService.GetCodeDataRuleList(req); + return res; + } + /// + /// 数据权限指定范围 + /// + /// + /// + [HttpPost] + [Route("AssignDataRuleScope")] + public async Task AssignDataRuleScope([FromBody] AssignDataRuleScopeReq req) + { + var res = await _invokeService.AssignDataRuleScope(req); return res; } - ///// ///// 编辑 ///// @@ -50,29 +61,29 @@ public class CodeDataRuleController : ApiController // return res; //} - /// - /// 详情 - /// - /// - /// - [HttpGet] - [Route("GetCodeDataRuleInfo")] - public async Task> GetCodeDataRuleInfo([FromQuery] string id) - { - var res = await _invokeService.GetCodeDataRuleInfo(id); - return res; - } + ///// + ///// 详情 + ///// + ///// + ///// + //[HttpGet] + //[Route("GetCodeDataRuleInfo")] + //public async Task> GetCodeDataRuleInfo([FromQuery] string id) + //{ + // var res = await _invokeService.GetCodeDataRuleInfo(id); + // return res; + //} - /// - /// 批量删除 - /// - /// req - /// - [HttpPost] - [Route("BatchDelCodeDataRule")] - public async Task BatchDelCodeDataRule([FromBody] IdModel req) - { - var res =await _invokeService.BatchDelCodeDataRule(req); - return res; - } + ///// + ///// 批量删除 + ///// + ///// req + ///// + //[HttpPost] + //[Route("BatchDelCodeDataRule")] + //public async Task BatchDelCodeDataRule([FromBody] IdModel req) + //{ + // var res =await _invokeService.BatchDelCodeDataRule(req); + // return res; + //} } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/OrgController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/OrgController.cs index c33f2d98..1be3d5a6 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/OrgController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/OrgController.cs @@ -84,4 +84,17 @@ public class OrgController : ApiController var res = _invokeService.BatchDelOrg(req); return res; } + + + /// + /// 获取树型机构用户 + /// + /// + [HttpGet] + [Route("GetOrgUserTree")] + public DataResult> GetOrgUserTree() + { + var res = _invokeService.GetOrgUserTree(); + return res; + } } \ 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 4b103ee0..a6bf8fac 100644 --- a/ds-wms-service/DS.WMS.Test/SaasDBUpdateTest.cs +++ b/ds-wms-service/DS.WMS.Test/SaasDBUpdateTest.cs @@ -61,7 +61,7 @@ public class SaasDBUpdateTest var tenantDb = saasService.GetBizDbScopeById(item.TenantId).CopyNew(); StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci"; //较高版本支持 //tenantDb.CodeFirst.InitTables(types); //指定表空间下的实体 - tenantDb.CodeFirst.InitTables(typeof(BusinessYard));//指定更新特定实体 + tenantDb.CodeFirst.InitTables(typeof(CodeDataRule));//指定更新特定实体 } Assert.True(true); From 96a97b7867ea97de1d09eceb41125f6463729695 Mon Sep 17 00:00:00 2001 From: cjy Date: Wed, 11 Sep 2024 14:36:27 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=A7=9F=E6=88=B7?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8E=88=E6=9D=83=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ds-wms-service/DS.WMS.Test/OpTest.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ds-wms-service/DS.WMS.Test/OpTest.cs b/ds-wms-service/DS.WMS.Test/OpTest.cs index 4e4a939b..3efdbb66 100644 --- a/ds-wms-service/DS.WMS.Test/OpTest.cs +++ b/ds-wms-service/DS.WMS.Test/OpTest.cs @@ -2,16 +2,19 @@ using System.IO; using System.Reflection; using DS.Module.Core; using DS.Module.Core.Extensions; +using DS.Module.Core.Helpers; using DS.Module.SqlSugar; using DS.WMS.Core.Code.Interface; using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Interface; using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.Sys.Interface; +using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; using NPOI.HPSF; +using Org.BouncyCastle.Ocsp; using SharpCompress.Common; using SqlSugar; using SqlSugar.IOC; @@ -47,13 +50,16 @@ public class OpTest Assert.True(true); } + /// + /// ⻧ûȨ + /// [Fact] public void OpTest2() { //var tenantDb = saasService.GetBizDbScopeById("1750335377144680448"); //var data = _commonSetService.GetSequenceNext(); - + var str = EncrypteHelper.EncryptData("300", "ba31a8758af1c6b7"); Assert.True(true); } From f2c67d6b809a6479cdb9b00f8b877dead0007829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Wed, 11 Sep 2024 13:54:59 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E6=92=A4=E9=94=80=E5=90=8E=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Info/Method/ClientInfoService.cs | 8 ++++---- .../DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs index b082892a..4d900bc6 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs @@ -68,10 +68,6 @@ public class ClientInfoService : ServiceBase, IClientInfoService if (await queryable.AnyAsync(x => (SqlFunc.IsNullOrEmpty(x.Tel) && SqlFunc.IsNullOrEmpty(x.Mobile)) || (SqlFunc.IsNullOrEmpty(x.Email) && SqlFunc.IsNullOrEmpty(x.QQ)))) return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ClientInfoIncomplete)); - var template = await FindTemplateAsync(INFO_CLIENT_TASK); - if (template == null) - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TemplateNotFound)); - if (await taskService.Value.HasAuthorizedAsync()) { var requests = list.Select(x => new TaskCreationRequest @@ -106,6 +102,10 @@ public class ClientInfoService : ServiceBase, IClientInfoService } } + var template = await FindTemplateAsync(INFO_CLIENT_TASK); + if (template == null) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TemplateNotFound)); + for (int i = 0; i < idModel.Ids.Length; i++) { var id = idModel.Ids[i]; diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs index b91c87b6..e126f044 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs @@ -344,13 +344,16 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction if (updateFlag) { - await SetTaskStatusAsync(new TaskUpdateRequest + result = await SetTaskStatusAsync(new TaskUpdateRequest { BusinessId = request.BusinessId, BusinessType = request.BusinessType, TaskTypeName = request.TaskTypeName, TaskStatus = TaskStatusEnum.Create }, false); + + if (!result.Succeeded) + return result; } } @@ -447,8 +450,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData)); if (task.TaskStatus == TaskStatusEnum.Complete) return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskCompleted)); - if (task.TaskStatus == TaskStatusEnum.Cancel) - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskCancelled)); + //if (task.TaskStatus == TaskStatusEnum.Cancel) + // return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskCancelled)); var result = await ManagerService.SetTaskStatusWithBsno(request.BusinessId, request.TaskType, request.TaskStatus, DateTime.Now); if (!result.Succeeded) From 0dbc57ca25f1f0364a322e5fb1158430477845ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Wed, 11 Sep 2024 14:36:20 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E4=BA=8C=E6=AC=A1=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Flow/Method/FlowInstanceService.cs | 2 ++ .../DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs b/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs index 1ac60d30..3f2bca85 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs @@ -1,4 +1,5 @@ using DS.Module.Core; +using DS.Module.Core.Data; using DS.Module.Core.Extensions; using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Flow.Entity; @@ -28,6 +29,7 @@ public class FlowInstanceService : ServiceBase, IFlowInstanceService /// public FlowInstanceService(IServiceProvider serviceProvider) : base(serviceProvider) { + Db.QueryFilter.Clear(); } /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs index e126f044..b28241b5 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs @@ -464,10 +464,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction task.RejectReason = request.RejectReason; //更新当前任务状态 task.TaskStatus = request.TaskStatus; - if (AuditTaskTypes.Contains(task.TaskType)) - task.FlowId = null; - - await TenantDb.Updateable(task).UpdateColumns(x => new { x.TaskStatus, x.FlowId, x.RejectReason }).ExecuteCommandAsync(); + await TenantDb.Updateable(task).UpdateColumns(x => new { x.TaskStatus, x.RejectReason }).ExecuteCommandAsync(); if (task.TaskStatus == TaskStatusEnum.Complete && task.NextType.HasValue && request.AutoCreateNext) {