From 087bacbc4f8b21ddaaf2e7f5facdcffadc5e76f2 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng Date: Fri, 19 Jan 2024 11:38:53 +0800 Subject: [PATCH] =?UTF-8?q?AFR=E6=B7=BB=E5=8A=A0=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E3=80=81=E8=B0=83=E6=95=B4=E6=B8=AF=E5=8F=A3?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E5=88=97=E8=A1=A8=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/Djy.Common/DJYModel/MappingPort.cs | 42 ++++++++ web/djy.IService/Afr/IAfrService.cs | 5 +- web/djy.Model/AFR/AFRAddrTemplate.cs | 51 ++++++++++ web/djy.Service/Afr/AfrService.cs | 99 +++++++++++++------ web/djy_AfrApi/Controllers/AfrController.cs | 33 +++++++ .../Controllers/CommonController.cs | 4 +- .../FolderProfile-Windows.pubxml.user | 2 +- 7 files changed, 204 insertions(+), 32 deletions(-) create mode 100644 web/Djy.Common/DJYModel/MappingPort.cs create mode 100644 web/djy.Model/AFR/AFRAddrTemplate.cs diff --git a/web/Djy.Common/DJYModel/MappingPort.cs b/web/Djy.Common/DJYModel/MappingPort.cs new file mode 100644 index 0000000..fed556f --- /dev/null +++ b/web/Djy.Common/DJYModel/MappingPort.cs @@ -0,0 +1,42 @@ +using FreeSql.DataAnnotations; +using Newtonsoft.Json; +using System; +using System.ComponentModel.DataAnnotations; + +namespace Common.DJYModel +{ + [JsonObject(MemberSerialization.OptIn), Table(Name = "MappingPort", DisableSyncStructure = true)] + public class MappingPort + { + [JsonProperty, Column(IsPrimary = true, IsNullable = false)] + [MaxLength(36)] + public string GID { get; set; } + + [MaxLength(20)] + public string Code { get; set; } + + [MaxLength(20)] + public string Module { get; set; } + + [MaxLength(50)] + public string MapCode { get; set; } + + [MaxLength(200)] + public string MapName { get; set; } + + [MaxLength(500)] + public string Remark { get; set; } + + + public DateTime CreateTime { get; set; } + + + public DateTime? ModifyTime { get; set; } + + [MaxLength(36)] + public string CreateUser { get; set; } + + [MaxLength(36)] + public string ModifyUser { get; set; } + } +} diff --git a/web/djy.IService/Afr/IAfrService.cs b/web/djy.IService/Afr/IAfrService.cs index a07fb43..aef6a77 100644 --- a/web/djy.IService/Afr/IAfrService.cs +++ b/web/djy.IService/Afr/IAfrService.cs @@ -15,7 +15,7 @@ namespace djy.IService.Afr List GetCTNALL(); List GetPackage(); List GetDangerousGoods(string strlink); - List GetPort(string strlink, int page, int limit); + List GetPort(string strlink, int page, int limit); List GetVessel(string strlink, int page, int limit); #endregion @@ -26,5 +26,8 @@ namespace djy.IService.Afr Task<(bool isSuccess, string message)> Send(string ids, string hids, int sendType); Task SaveReceipt(AFRReceiptDto input); Task> GetHistory(string pid, string hid); + Task> GetTemplate(string type, string name); + Task SaveTemplate(AFRAddrTemplate input); + Task DeleteTemplate(string ids); } } diff --git a/web/djy.Model/AFR/AFRAddrTemplate.cs b/web/djy.Model/AFR/AFRAddrTemplate.cs new file mode 100644 index 0000000..8c2c748 --- /dev/null +++ b/web/djy.Model/AFR/AFRAddrTemplate.cs @@ -0,0 +1,51 @@ +using djy.Model.AFR; +using FreeSql.DataAnnotations; +using System; + +namespace djy.Model.Afr +{ + [Table(Name = "AFR_AddrTemplate", DisableSyncStructure = true)] + public class AFRAddrTemplate : AFRBaseModel + { + + /// + /// 地址 + /// + public string Address { get; set; } + + /// + /// 城市 + /// + public string City { get; set; } + + /// + /// 联系人 + /// + public string Contact { get; set; } + + /// + /// 国家 + /// + public string Country { get; set; } + + /// + /// 国家代码 + /// + public string CountryCode { get; set; } + + /// + /// 名称 + /// + public string Name { get; set; } + + /// + /// 联系人电话 + /// + public string Tel { get; set; } + + /// + /// 收发通类型 1:发货人 2:收货人 3:通知人 + /// + public byte? Type { get; set; } + } +} \ No newline at end of file diff --git a/web/djy.Service/Afr/AfrService.cs b/web/djy.Service/Afr/AfrService.cs index 0f76fa5..4cec75b 100644 --- a/web/djy.Service/Afr/AfrService.cs +++ b/web/djy.Service/Afr/AfrService.cs @@ -139,34 +139,41 @@ namespace djy.Service.AFR } } - public List GetPort(string strlink, int page, int limit) + public List GetPort(string strlink, int page, int limit) { - try - { - if (page == 0 && limit == 0) - { - var List = DbBus.Get(DbList.Common).Select().WhereIf(strlink != "", x => x.Code.Contains(strlink.Trim()) || x.EnName.Contains(strlink.Trim())).ToList().Select(x => new CommonCodeValue - { - Code = x.Code, - Value = x.EnName, - }).Distinct().ToList(); - return List; - } - else - { - - var List = DbBus.Get(DbList.Common).Select().WhereIf(strlink != "", x => x.Code.Contains(strlink.Trim()) || x.EnName.Contains(strlink.Trim())).Page(page, limit).ToList().Select(x => new CommonCodeValue - { - Code = x.Code, - Value = x.EnName, - }).Distinct().ToList(); - return List; - } - } - catch (Exception e) - { - throw; - } + //try + //{ + //if (page == 0 && limit == 0) + //{ + var List = DbBus.Get(DbList.Common) + .Select() + .InnerJoin((cp, mp) => cp.Code == mp.Code) + .Where((cp, mp) => mp.Module == "AFR") + .ToList((cp, mp) => new CommonMappiCode + { + //Code = cp.Code, + //Value = cp.EnName, + Code = null, + Value = null, + MapCode = mp.MapCode, + MapName = mp.MapName + }); + return List; + //} + //else + //{ + // var List = DbBus.Get(DbList.Common).Select().WhereIf(strlink != "", x => x.Code.Contains(strlink.Trim()) || x.EnName.Contains(strlink.Trim())).Page(page, limit).ToList().Select(x => new CommonCodeValue + // { + // Code = x.Code, + // Value = x.EnName, + // }).Distinct().ToList(); + // return List; + //} + //} + //catch (Exception e) + //{ + // throw; + //} } public List GetVessel(string strlink, int page, int limit) @@ -1260,5 +1267,41 @@ namespace djy.Service.AFR await DbAMS.Insert(list).WithTransaction(tran).ExecuteAffrowsAsync(); } } + + public async Task> GetTemplate(string type, string name) + { + var data = await DbAMS.Select() + .WhereIf(!string.IsNullOrEmpty(type), t => t.Type == Convert.ToByte(type)) + .WhereIf(!string.IsNullOrEmpty(name), t => t.Name.Contains(name)) + .OrderByDescending(t=>t.CreateTime) + .ToListAsync(); + return data; + } + + public async Task SaveTemplate(AFRAddrTemplate input) + { + DateTime nowTime = DateTime.Now; + if (string.IsNullOrEmpty(input.GID)) + { + input.GID = Guid.NewGuid().ToString(); + input.LastUpdate = nowTime; + input.CreateTime = nowTime; + + await DbAMS.Insert(input).ExecuteAffrowsAsync(); + } + else + { + input.LastUpdate = nowTime; + + await DbAMS.Update().SetSource(input).Where(t => t.GID == input.GID).ExecuteAffrowsAsync(); + } + } + + public async Task DeleteTemplate(string ids) + { + await DbAMS.Delete() + .Where(t => ids.Contains(t.GID)) + .ExecuteAffrowsAsync(); + } } -} +} \ No newline at end of file diff --git a/web/djy_AfrApi/Controllers/AfrController.cs b/web/djy_AfrApi/Controllers/AfrController.cs index d9cdd28..934a06d 100644 --- a/web/djy_AfrApi/Controllers/AfrController.cs +++ b/web/djy_AfrApi/Controllers/AfrController.cs @@ -153,5 +153,38 @@ namespace djy_AfrApi.Controllers { return SuccessResp(DateTime.Now.ToString()); } + + #region 模板 + /// + /// 查询模板 + /// + /// 查询类型 1:发货人 2:收货人 3:通知人 空:查询所有 + /// 模板名称 + [HttpGet("GetTemplate")] + public async Task>> GetTemplate(string type, string name = null) + { + var data = await _afrService.GetTemplate(type, name); + return SuccessResp(data); + } + /// + /// 保存模板 + /// + [HttpPost("SaveTemplate")] + public async Task SaveTemplate([FromBody] AFRAddrTemplate input) + { + await _afrService.SaveTemplate(input); + return SuccessResp(); + } + /// + /// 删除模板 + /// + /// 模板主键列表,使用,连接 + [HttpGet("DeleteTemplate")] + public async Task DeleteTemplate([Required] string ids) + { + await _afrService.DeleteTemplate(ids); + return SuccessResp(); + } + #endregion } } diff --git a/web/djy_AfrApi/Controllers/CommonController.cs b/web/djy_AfrApi/Controllers/CommonController.cs index 1d637c0..bb9c8ef 100644 --- a/web/djy_AfrApi/Controllers/CommonController.cs +++ b/web/djy_AfrApi/Controllers/CommonController.cs @@ -158,9 +158,9 @@ namespace djy_AfrApi.Controllers.Common /// [HttpGet("GetPort")] [RedisCaching] - public Response> GetPort() + public Response> GetPort() { - var result = new Response>(); + var result = new Response>(); try { result.Result = ser.GetPort("", 0, 0); diff --git a/web/djy_AfrApi/Properties/PublishProfiles/FolderProfile-Windows.pubxml.user b/web/djy_AfrApi/Properties/PublishProfiles/FolderProfile-Windows.pubxml.user index 9af6486..511c61a 100644 --- a/web/djy_AfrApi/Properties/PublishProfiles/FolderProfile-Windows.pubxml.user +++ b/web/djy_AfrApi/Properties/PublishProfiles/FolderProfile-Windows.pubxml.user @@ -6,7 +6,7 @@ <_PublishTargetUrl>D:\DJY\Code\djyweb_ams\web\djy_AfrApi\bin\Release\net5.0\publish-windows\ - True|2024-01-08T07:50:46.8011898Z;True|2024-01-05T17:51:52.2695558+08:00;True|2024-01-05T17:04:21.5306695+08:00;True|2024-01-05T16:48:05.1050469+08:00;True|2024-01-05T15:13:30.4657789+08:00;True|2024-01-05T15:00:49.5985418+08:00;True|2024-01-05T13:48:06.1634940+08:00;True|2024-01-05T11:59:09.7697688+08:00;True|2024-01-05T11:33:19.2093394+08:00;True|2024-01-05T11:27:31.2454199+08:00;True|2024-01-05T11:20:20.5464568+08:00;True|2024-01-04T18:36:38.8259124+08:00;True|2024-01-04T15:54:57.9348895+08:00;True|2024-01-04T15:44:34.6535493+08:00;False|2024-01-04T15:44:20.9673752+08:00;True|2024-01-04T11:14:33.4379160+08:00;True|2024-01-03T21:54:40.3579096+08:00;True|2024-01-03T21:52:09.6604718+08:00;True|2024-01-03T16:04:13.6208067+08:00;True|2024-01-03T15:07:08.9376581+08:00;True|2024-01-02T10:57:59.7067270+08:00;True|2024-01-02T10:28:44.8223638+08:00;True|2023-12-29T17:26:12.9612280+08:00; + True|2024-01-19T03:20:41.9920968Z;True|2024-01-08T15:50:46.8011898+08:00;True|2024-01-05T17:51:52.2695558+08:00;True|2024-01-05T17:04:21.5306695+08:00;True|2024-01-05T16:48:05.1050469+08:00;True|2024-01-05T15:13:30.4657789+08:00;True|2024-01-05T15:00:49.5985418+08:00;True|2024-01-05T13:48:06.1634940+08:00;True|2024-01-05T11:59:09.7697688+08:00;True|2024-01-05T11:33:19.2093394+08:00;True|2024-01-05T11:27:31.2454199+08:00;True|2024-01-05T11:20:20.5464568+08:00;True|2024-01-04T18:36:38.8259124+08:00;True|2024-01-04T15:54:57.9348895+08:00;True|2024-01-04T15:44:34.6535493+08:00;False|2024-01-04T15:44:20.9673752+08:00;True|2024-01-04T11:14:33.4379160+08:00;True|2024-01-03T21:54:40.3579096+08:00;True|2024-01-03T21:52:09.6604718+08:00;True|2024-01-03T16:04:13.6208067+08:00;True|2024-01-03T15:07:08.9376581+08:00;True|2024-01-02T10:57:59.7067270+08:00;True|2024-01-02T10:28:44.8223638+08:00;True|2023-12-29T17:26:12.9612280+08:00; \ No newline at end of file