From 5a7aa688d6f9169dea5c8fb47978be93c974ea5c Mon Sep 17 00:00:00 2001 From: cjy Date: Fri, 19 Jul 2024 14:41:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Code/Dtos/CodeOrderContactReq.cs | 80 ---------- .../Code/Dtos/CodeOrderContactRes.cs | 62 -------- .../Code/Entity/CodeOrderContact.cs | 71 --------- .../Code/Interface/IOrderContactService.cs | 57 -------- .../Code/Method/OrderContactService.cs | 138 ------------------ .../Interface/IBusinessOrderContactService.cs | 7 + .../Op/Method/BusinessOrderContactService.cs | 13 ++ .../Op/Method/SeaExportCommonService.cs | 14 +- .../DS.WMS.Core/Op/Method/SeaExportService.cs | 6 +- .../Controllers/OrderContactController.cs | 89 ----------- .../BusinessOrderContactController.cs | 14 +- .../DS.WMS.OpApi/DS.WMS.OpApi.csproj.user | 2 +- 12 files changed, 45 insertions(+), 508 deletions(-) delete mode 100644 ds-wms-service/DS.WMS.Core/Code/Dtos/CodeOrderContactReq.cs delete mode 100644 ds-wms-service/DS.WMS.Core/Code/Dtos/CodeOrderContactRes.cs delete mode 100644 ds-wms-service/DS.WMS.Core/Code/Entity/CodeOrderContact.cs delete mode 100644 ds-wms-service/DS.WMS.Core/Code/Interface/IOrderContactService.cs delete mode 100644 ds-wms-service/DS.WMS.Core/Code/Method/OrderContactService.cs delete mode 100644 ds-wms-service/DS.WMS.MainApi/Controllers/OrderContactController.cs diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeOrderContactReq.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeOrderContactReq.cs deleted file mode 100644 index 7b5d538b..00000000 --- a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeOrderContactReq.cs +++ /dev/null @@ -1,80 +0,0 @@ -using DS.Module.Core; -using FluentValidation; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DS.WMS.Core.Code.Dtos -{ - /// - /// 订单关系人请求 - /// - public class CodeOrderContactReq - { - /// - /// 主键Id - /// - public long Id { get; set; } - /// - /// 客户类别 - /// - public string CustomerType { get; set; } - /// - /// 客户Id - /// - public long CustomerId { get; set; } - - /// - /// 客户名称 - /// - public string CustomerName { get; set; } - /// - /// 角色代码 - /// - public string RoleCode { get; set; } - /// - /// 联系人 - /// - public string Name { get; set; } - /// - /// 电话 - /// - public string Tel { get; set; } - /// - /// 邮箱 - /// - public string Email { get; set; } - /// - /// 排序 - /// - public int? OrderNo { get; set; } = 100; - /// - /// 备注 - /// - public string Note { get; set; } - - /// - /// 状态 0启用 1禁用 - /// - public StatusEnum? Status { get; set; } = StatusEnum.Enable; - } - /// - /// 验证 - /// - public class CodeOrderContactReqValidator : AbstractValidator - { - /// - /// 构造函数 - /// - public CodeOrderContactReqValidator() - { - this.RuleFor(o => o.CustomerType) - .NotEmpty().WithName("客户类别"); - //this.RuleFor(o => o.SendType) - // .NotEmpty().WithName("发送类型"); - } - } -} diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeOrderContactRes.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeOrderContactRes.cs deleted file mode 100644 index 51436498..00000000 --- a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeOrderContactRes.cs +++ /dev/null @@ -1,62 +0,0 @@ -using DS.Module.Core; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DS.WMS.Core.Code.Dtos -{ - /// - /// 订单关系人返回 - /// - public class CodeOrderContactRes - { - /// - /// 主键Id - /// - public long Id { get; set; } - /// - /// 客户类别 - /// - public string CustomerType { get; set; } - /// - /// 客户Id - /// - public long CustomerId { get; set; } - - /// - /// 客户名称 - /// - public string CustomerName { get; set; } - /// - /// 角色代码 - /// - public string RoleCode { get; set; } - /// - /// 联系人 - /// - public string Name { get; set; } - /// - /// 电话 - /// - public string Tel { get; set; } - /// - /// 邮箱 - /// - public string Email { get; set; } - /// - /// 排序 - /// - public int? OrderNo { get; set; } = 100; - /// - /// 备注 - /// - public string Note { get; set; } - - /// - /// 状态 0启用 1禁用 - /// - public StatusEnum? Status { get; set; } = StatusEnum.Enable; - } -} diff --git a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeOrderContact.cs b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeOrderContact.cs deleted file mode 100644 index 9a1679d0..00000000 --- a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeOrderContact.cs +++ /dev/null @@ -1,71 +0,0 @@ -using DS.Module.Core; -using DS.Module.Core.Data; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DS.WMS.Core.Code.Entity -{ - /// - /// 订单关系人 - /// - [SqlSugar.SugarTable("code_order_contact", "订单关系人")] - public class CodeOrderContact : BaseModel - { - /// - /// 客户类别 - /// - [SugarColumn(ColumnDescription = "客户类别", Length = 50, IsNullable = false)] - public string CustomerType { get; set; } - /// - /// 客户Id - /// - [SugarColumn(ColumnDescription = "客户Id")] - public long CustomerId { get; set; } - - /// - /// 客户名称 - /// - [SugarColumn(ColumnDescription = "客户名称", Length = 100, IsNullable = true)] - public string CustomerName { get; set; } - /// - /// 角色代码 - /// - [SugarColumn(ColumnDescription = "角色代码", Length = 50, IsNullable = true)] - public string RoleCode { get; set; } - /// - /// 联系人 - /// - [SugarColumn(ColumnDescription = "联系人", Length = 50, IsNullable = true)] - public string Name { get; set; } - /// - /// 电话 - /// - [SugarColumn(ColumnDescription = "电话", Length = 50, IsNullable = true)] - public string Tel { get; set; } - /// - /// 邮箱 - /// - [SugarColumn(ColumnDescription = "邮箱", Length = 50, IsNullable = true)] - public string Email { get; set; } - /// - /// 排序 - /// - [SugarColumn(ColumnDescription = "排序")] - public int? OrderNo { get; set; } = 100; - /// - /// 备注 - /// - [SugarColumn(ColumnDescription = "备注", Length = 200, IsNullable = true)] - public string Note { get; set; } - - /// - /// 状态 0启用 1禁用 - /// - [SugarColumn(ColumnDescription = "状态", DefaultValue = "0")] - public StatusEnum? Status { get; set; } = StatusEnum.Enable; - } -} diff --git a/ds-wms-service/DS.WMS.Core/Code/Interface/IOrderContactService.cs b/ds-wms-service/DS.WMS.Core/Code/Interface/IOrderContactService.cs deleted file mode 100644 index a26822bd..00000000 --- a/ds-wms-service/DS.WMS.Core/Code/Interface/IOrderContactService.cs +++ /dev/null @@ -1,57 +0,0 @@ -using DS.Module.Core; -using DS.Module.Core.Data; -using DS.WMS.Core.Code.Dtos; -using DS.WMS.Core.Sys.Dtos; - -namespace DS.WMS.Core.Code.Interface; - -/// -/// -/// -public interface IOrderContactService -{ - /// - /// 列表 - /// - /// - /// - DataResult> GetListByPage(PageRequest request); - - - /// - /// 编辑 - /// - /// - /// - DataResult EditOrderContact(CodeOrderContactReq model); - - /// - /// 获取详情 - /// - /// - /// - DataResult GetOrderContactInfo(string id); - - - - /// - /// 根据客户Id获取订单关系人列表 - /// - /// - /// - DataResult> GetOrderContactListByClientId(string id); - - /// - /// 删除 - /// - /// - /// - DataResult DelOrderContact(string id); - - /// - /// 批量删除 - /// - /// - /// - public DataResult BatchDelOrderContact(IdModel req); -} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Code/Method/OrderContactService.cs b/ds-wms-service/DS.WMS.Core/Code/Method/OrderContactService.cs deleted file mode 100644 index a96960f9..00000000 --- a/ds-wms-service/DS.WMS.Core/Code/Method/OrderContactService.cs +++ /dev/null @@ -1,138 +0,0 @@ -using DS.Module.Core; -using DS.Module.Core.Data; -using DS.Module.Core.Extensions; -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.Op.Entity; -using DS.WMS.Core.Sys.Dtos; -using DS.WMS.Core.Sys.Entity; -using DS.WMS.Core.Sys.Interface; -using Mapster; -using Microsoft.Extensions.DependencyInjection; -using SqlSugar; - -namespace DS.WMS.Core.Code.Method; - -/// -/// -/// -public class OrderContactService : IOrderContactService -{ - private readonly IServiceProvider _serviceProvider; - private readonly ISqlSugarClient db; - private readonly IUser user; - private readonly ISaasDbService saasService; - /// - /// - /// - /// - public OrderContactService(IServiceProvider serviceProvider) - { - _serviceProvider = serviceProvider; - db = _serviceProvider.GetRequiredService(); - user = _serviceProvider.GetRequiredService(); - saasService = _serviceProvider.GetRequiredService(); - } - - /// - /// 列表 - /// - /// - /// - public DataResult> GetListByPage(PageRequest request) - { - var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - //序列化查询条件 - var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); - var data = tenantDb.Queryable() - .Where(whereList) - .Select().ToQueryPage(request.PageCondition); - return data; - } - - /// - /// 编辑 - /// - /// - /// - public DataResult EditOrderContact(CodeOrderContactReq req) - { - var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - //var orgId = user.GetOrgId(); - if (req.Id == 0) - { - if (tenantDb.Queryable() - .Where(x => x.CustomerType == req.CustomerType && x.CustomerId == req.CustomerId && x.Name == req.Name).Any()) - { - return DataResult.Failed("订单关系人设置已存在!", MultiLanguageConst.OrderContactExist); - } - - var data = req.Adapt(); - var entity = tenantDb.Insertable(data).ExecuteReturnEntity(); - - return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); - } - else - { - var info = tenantDb.Queryable().Where(x => x.Id == req.Id).First(); - - info = req.Adapt(info); - - tenantDb.Updateable(info).IgnoreColumns("DefaultContent").IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); - return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess); - } - } - - /// - /// 详情 - /// - /// - /// - public DataResult GetOrderContactInfo(string id) - { - var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var data = tenantDb.Queryable() - .Where(x => x.Id == long.Parse(id) && x.Status == StatusEnum.Enable) - .Select() - .First(); - return DataResult.Success(data, MultiLanguageConst.DataQuerySuccess); - } - - - - public DataResult DelOrderContact(string id) - { - var info = db.Queryable().Where(x => x.Id == long.Parse(id)).First(); - if (info == null) - { - return DataResult.Failed("订单关系人设置不存在!", MultiLanguageConst.OrderContactNotExist); - } - - db.Deleteable(info).ExecuteCommand(); - return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess); - } - - public DataResult BatchDelOrderContact(IdModel req) - { - var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var list = tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id)).ToList(); - if (list.Count > 0) - { - tenantDb.Deleteable(list).ExecuteCommand(); - } - return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess); - } - - public DataResult> GetOrderContactListByClientId(string id) - { - var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var data = tenantDb.Queryable() - .Where(x => x.CustomerId == long.Parse(id) && x.Status == StatusEnum.Enable) - .Select() - .ToList(); - return DataResult>.Success(data, MultiLanguageConst.DataQuerySuccess); - } -} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/IBusinessOrderContactService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/IBusinessOrderContactService.cs index 84366f11..ca46596f 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/IBusinessOrderContactService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/IBusinessOrderContactService.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using DS.WMS.Core.Info.Dtos; namespace DS.WMS.Core.Op.Interface { @@ -39,5 +40,11 @@ namespace DS.WMS.Core.Op.Interface /// /// public DataResult BatchDelBusinessOrderContact(IdModel req); + /// + /// 根据客户Id获取联系人 + /// + /// + /// + public DataResult> GetOrderContactListByClientId(string id); } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BusinessOrderContactService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BusinessOrderContactService.cs index cae76668..1880af7a 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/BusinessOrderContactService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/BusinessOrderContactService.cs @@ -3,6 +3,9 @@ using DS.Module.Core.Data; using DS.Module.Core.Extensions; using DS.Module.SqlSugar; using DS.Module.UserModule; +using DS.WMS.Core.Code.Dtos; +using DS.WMS.Core.Info.Dtos; +using DS.WMS.Core.Info.Entity; using DS.WMS.Core.Map.Entity; using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Entity; @@ -93,5 +96,15 @@ namespace DS.WMS.Core.Op.Method } return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess); } + + public DataResult> GetOrderContactListByClientId(string id) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var data = tenantDb.Queryable() + .Where(x => x.ClientId == long.Parse(id) && x.Status == StatusEnum.Enable) + .Select() + .ToList(); + return DataResult>.Success(data, MultiLanguageConst.DataQuerySuccess); + } } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs index 65f5b815..eb666aef 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs @@ -1211,11 +1211,11 @@ namespace DS.WMS.Core.Op.Method { return DataResult.Failed($"模板EXCEL文件未找到,请联系管理员"); } - if (order.YardContactId == 0) + if (order.YardId == 0) { - return DataResult.Failed("请选择场站关系人"); + return DataResult.Failed("请选择场站"); } - var yardContact = tenantDb.Queryable().First(x => x.Id == order.YardContactId); + var yardContact = tenantDb.Queryable().First(x => x.BusinessId == order.Id && x.CustomerId == order.YardId); if (yardContact.IsNull()) { return DataResult.Failed("场站关系人不存在"); @@ -1461,7 +1461,7 @@ namespace DS.WMS.Core.Op.Method { ftpset = tenantDb.Queryable().First(f => f.EdiTypeCode == "XHZ_JIEFENG"); } - var yardContact = tenantDb.Queryable().First(x => x.Id == order.YardContactId); + var yardContact = tenantDb.Queryable().First(x => x.BusinessId == order.Id && x.CustomerId == order.YardId); if (yardContact.IsNull()) { return DataResult.Failed("场站关系人不存在"); @@ -1825,11 +1825,11 @@ namespace DS.WMS.Core.Op.Method } else //邮件方式 { - if (order.YardContactId == 0) + if (order.YardId == 0) { - return DataResult.Failed("请选择场站关系人"); + return DataResult.Failed("请选择场站"); } - var yardContact = tenantDb.Queryable().First(x => x.Id == order.YardContactId); + var yardContact = tenantDb.Queryable().First(x => x.BusinessId == order.Id && x.CustomerId == order.YardId); if (yardContact.IsNull()) { return DataResult.Failed("场站关系人不存在"); 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 ab3814a4..329059ae 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs @@ -629,6 +629,7 @@ public partial class SeaExportService : ISeaExportService Name = defaultContact.ShortName, Tel = defaultContact.Tel, Email = defaultContact.Email, + CustomerContactId = defaultContact.Id }); } } @@ -650,6 +651,7 @@ public partial class SeaExportService : ISeaExportService Name = defaultContact.ShortName, Tel = defaultContact.Tel, Email = defaultContact.Email, + CustomerContactId = defaultContact.Id }); } } @@ -671,9 +673,8 @@ public partial class SeaExportService : ISeaExportService Name = defaultContact.ShortName, Tel = defaultContact.Tel, Email = defaultContact.Email, + CustomerContactId = defaultContact.Id }); - //todo - seaExport.YardContactId = defaultContact.Id; } } } @@ -694,6 +695,7 @@ public partial class SeaExportService : ISeaExportService Name = defaultContact.ShortName, Tel = defaultContact.Tel, Email = defaultContact.Email, + CustomerContactId = defaultContact.Id }); } } diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/OrderContactController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/OrderContactController.cs deleted file mode 100644 index 17f83939..00000000 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/OrderContactController.cs +++ /dev/null @@ -1,89 +0,0 @@ -using DS.Module.Core; -using DS.Module.Core.Data; -using DS.WMS.Core.Code.Dtos; -using DS.WMS.Core.Code.Interface; -using DS.WMS.Core.Sys.Dtos; -using DS.WMS.Core.Sys.Interface; -using Microsoft.AspNetCore.Mvc; - -namespace DS.WMS.MainApi.Controllers; - -/// -/// 订单关系人设置 模块 -/// -public class OrderContactController : ApiController -{ - private readonly IOrderContactService _invokeService; - - /// - /// 构造函数 - /// - /// - public OrderContactController(IOrderContactService invokeService) - { - _invokeService = invokeService; - } - - /// - /// 列表 - /// - /// - /// - [HttpPost] - [Route("GetOrderContactList")] - public DataResult> GetOrderContactList([FromBody] PageRequest request) - { - var res = _invokeService.GetListByPage(request); - return res; - } - - /// - /// 编辑 - /// - /// - /// - [HttpPost] - [Route("EditOrderContact")] - public DataResult EditOrderContact([FromBody] CodeOrderContactReq req) - { - var res = _invokeService.EditOrderContact(req); - return res; - } - - /// - /// 详情 - /// - /// Id - /// - [HttpGet] - [Route("GetOrderContactInfo")] - public DataResult GetOrderContactInfo([FromQuery] string id) - { - var res = _invokeService.GetOrderContactInfo(id); - return res; - } - /// - /// 根据客户Id获取订单关系人列表 - /// - /// Id - /// - [HttpGet] - [Route("GetOrderContactListByClientId")] - public DataResult> GetOrderContactListByClientId([FromQuery] string id) - { - var res = _invokeService.GetOrderContactListByClientId(id); - return res; - } - /// - /// 批量删除 - /// - /// req - /// - [HttpPost] - [Route("BatchDelOrderContact")] - public DataResult BatchDelOrderContact([FromBody] IdModel req) - { - var res = _invokeService.BatchDelOrderContact(req); - return res; - } -} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/BusinessOrderContactController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/BusinessOrderContactController.cs index 7209f15f..12ba72aa 100644 --- a/ds-wms-service/DS.WMS.OpApi/Controllers/BusinessOrderContactController.cs +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/BusinessOrderContactController.cs @@ -2,6 +2,7 @@ using DS.Module.Core; using DS.Module.Core.Data; using DS.WMS.Core.Code.Dtos; using DS.WMS.Core.Code.Interface; +using DS.WMS.Core.Info.Dtos; using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Interface; using Microsoft.AspNetCore.Mvc; @@ -76,8 +77,19 @@ public class BusinessOrderContactController : ApiController var res = _invokeService.BatchDelBusinessOrderContact(req); return res; } + /// + /// 根据客户Id获取联系人 + /// + /// + /// + [HttpGet] + [Route("GetOrderContactListByClientId")] + public DataResult> GetOrderContactListByClientId([FromQuery] string id) + { + var res = _invokeService.GetOrderContactListByClientId(id); + return res; + } - } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.OpApi/DS.WMS.OpApi.csproj.user b/ds-wms-service/DS.WMS.OpApi/DS.WMS.OpApi.csproj.user index da141c5a..99e0fcb6 100644 --- a/ds-wms-service/DS.WMS.OpApi/DS.WMS.OpApi.csproj.user +++ b/ds-wms-service/DS.WMS.OpApi/DS.WMS.OpApi.csproj.user @@ -1,7 +1,7 @@  - E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\Properties\PublishProfiles\FolderProfile.pubxml + D:\Code\DS\ds8-solution-pro\ds-wms-service\DS.WMS.OpApi\Properties\PublishProfiles\FolderProfile.pubxml MvcControllerEmptyScaffolder root/Common/MVC/Controller