From aecdc87e707bac64676e898e451ce677bc200293 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng Date: Fri, 29 Dec 2023 17:15:57 +0800 Subject: [PATCH] =?UTF-8?q?AFR=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/djy.IService/Afr/IAfrService.cs | 7 ++- web/djy.Model/AFR/AFRCntrno.cs | 29 +++++++-- web/djy.Model/AFR/AFRMaster.cs | 14 ++++- web/djy.Model/AFRDto/AFRMasterInputDto.cs | 2 +- web/djy.Model/AmsDto/CommonMappiCode.cs | 1 + web/djy.Service/Afr/AfrService.cs | 59 +++++++++++++++---- web/djy_AfrApi/Controllers/AfrController.cs | 28 ++++++--- .../Controllers/CommonController.cs | 26 ++++---- ...leware.cs => CommonDataCacheMiddleware.cs} | 9 +-- .../Milldlewares/MiddlewareHelpers.cs | 2 +- 10 files changed, 128 insertions(+), 49 deletions(-) rename web/djy_AfrApi/Milldlewares/{CommonCacheMiddleware.cs => CommonDataCacheMiddleware.cs} (94%) diff --git a/web/djy.IService/Afr/IAfrService.cs b/web/djy.IService/Afr/IAfrService.cs index 5496409..29756b8 100644 --- a/web/djy.IService/Afr/IAfrService.cs +++ b/web/djy.IService/Afr/IAfrService.cs @@ -12,8 +12,8 @@ namespace djy.IService.Afr #region 字典接口 List GetCountry(string strlink, int page, int limit); List GetCARRIER(); - List GetCTNALL(); - List GetPackage(); + List GetCTNALL(); + List GetPackage(); List GetDangerousGoods(string strlink); List GetPort(string strlink, int page, int limit); List GetVessel(string strlink, int page, int limit); @@ -23,7 +23,8 @@ namespace djy.IService.Afr Task Get(string gid); Task SaveInfo(AFRMaster input); Task Delete(string ids); - Task Send(string ids, string msgType); + Task Send(string ids, int sendType); Task SaveReceipt(AFRReceiptDto input); + Task> GetHistory(string id); } } diff --git a/web/djy.Model/AFR/AFRCntrno.cs b/web/djy.Model/AFR/AFRCntrno.cs index 6088558..f6a8edd 100644 --- a/web/djy.Model/AFR/AFRCntrno.cs +++ b/web/djy.Model/AFR/AFRCntrno.cs @@ -32,9 +32,18 @@ namespace djy.Model.Afr public string ContainerNo { get; set; } /// - /// 箱型 + /// 箱型Code + /// + public string ContainerTypeCode { get; set; } + + /// + /// 箱型Name + /// + public string ContainerTypeName { get; set; } + /// + /// 箱型MapCode /// - public string ContainerType { get; set; } + public string ContainerTypeMapCode { get; set; } /// /// 危品联系人(选填) @@ -92,14 +101,22 @@ namespace djy.Model.Afr public string OriginCountryCode { get; set; } /// - /// 包装 + /// 包装Code + /// + public string PackingCode { get; set; } + /// + /// 包装Name + /// + public string PackingName { get; set; } + /// + /// 包装MapCode /// - public string Packing { get; set; } + public string PackingMapCode { get; set; } /// - /// 包装代码 + /// 包装MapName /// - public string PackingCode { get; set; } + public string PackingMapName { get; set; } /// diff --git a/web/djy.Model/AFR/AFRMaster.cs b/web/djy.Model/AFR/AFRMaster.cs index 5c5f9b1..9d105eb 100644 --- a/web/djy.Model/AFR/AFRMaster.cs +++ b/web/djy.Model/AFR/AFRMaster.cs @@ -100,9 +100,19 @@ namespace djy.Model.Afr public string MBLNO { get; set; } /// - /// 船公司 + /// 船司Code + /// + public string ShipCompanyCode { get; set; } + /// + /// 船司Name /// - public string ShipCompany { get; set; } + public string ShipCompanyName { get; set; } + + /// + /// 船司MapCode + /// + public string ShipCompanyMapCode { get; set; } + /// /// 船东单运编号(选填) diff --git a/web/djy.Model/AFRDto/AFRMasterInputDto.cs b/web/djy.Model/AFRDto/AFRMasterInputDto.cs index 5141f38..cb556ef 100644 --- a/web/djy.Model/AFRDto/AFRMasterInputDto.cs +++ b/web/djy.Model/AFRDto/AFRMasterInputDto.cs @@ -34,7 +34,7 @@ namespace djy.Model.AFRDto /// /// 船公司 /// - public string ShipCompany { get; set; } + public string ShipCompanyName { get; set; } /// /// 操作用户名称 /// diff --git a/web/djy.Model/AmsDto/CommonMappiCode.cs b/web/djy.Model/AmsDto/CommonMappiCode.cs index 276ee68..ee621fc 100644 --- a/web/djy.Model/AmsDto/CommonMappiCode.cs +++ b/web/djy.Model/AmsDto/CommonMappiCode.cs @@ -14,5 +14,6 @@ namespace djy.Model.AmsDto public string Value { get; set; } public string MapCode { get; set; } + public string MapName { get; set; } } } diff --git a/web/djy.Service/Afr/AfrService.cs b/web/djy.Service/Afr/AfrService.cs index cfdae72..69171f6 100644 --- a/web/djy.Service/Afr/AfrService.cs +++ b/web/djy.Service/Afr/AfrService.cs @@ -61,7 +61,7 @@ namespace djy.Service.AFR { try { - var List = DbBus.Get(DbList.Common).Select().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "Afr").ToList((cc, map) => new CommonMappiCode + var List = DbBus.Get(DbList.Common).Select().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "AMS").ToList((cc, map) => new CommonMappiCode { Code = cc.Code, Value = cc.EnName, @@ -75,14 +75,15 @@ namespace djy.Service.AFR } } - public List GetCTNALL() + public List GetCTNALL() { try { - var List = DbBus.Get(DbList.Common).Select().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "Afr").ToList((cc, map) => new CommonCodeValue + var List = DbBus.Get(DbList.Common).Select().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "AMS").ToList((cc, map) => new CommonMappiCode { Code = cc.Code, Value = cc.Name, + MapCode = map.MapCode }).Distinct().ToList(); return List; } @@ -92,14 +93,16 @@ namespace djy.Service.AFR } } - public List GetPackage() + public List GetPackage() { try { - var List = DbBus.Get(DbList.Common).Select().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "Afr").ToList((cc, map) => new CommonCodeValue + var List = DbBus.Get(DbList.Common).Select().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "AMS").ToList((cc, map) => new CommonMappiCode { Code = cc.Code, Value = cc.Name, + MapCode = map.MapCode, + MapName = map.MapName }).Distinct().ToList(); return List; } @@ -210,7 +213,7 @@ namespace djy.Service.AFR .WhereIf(!string.IsNullOrEmpty(input.MBLNO), m => m.MBLNO.Contains(input.MBLNO)) .WhereIf(!string.IsNullOrEmpty(input.UserName), m => m.UserName.Contains(input.UserName)) .WhereIf(!string.IsNullOrEmpty(input.DischargeHarbour), m => m.DischargeHarbour.Contains(input.DischargeHarbour)) - .WhereIf(!string.IsNullOrEmpty(input.ShipCompany), m => m.ShipCompany.Contains(input.ShipCompany)) + .WhereIf(!string.IsNullOrEmpty(input.ShipCompanyName), m => m.ShipCompanyName.Contains(input.ShipCompanyName)) .WhereIf(input.CreateTimeStart != null, m => m.CreateTime >= input.CreateTimeStart) .WhereIf(input.CreateTimeEnd != null, m => m.CreateTime <= input.CreateTimeEnd); @@ -484,14 +487,43 @@ namespace djy.Service.AFR return history; } - public Task Delete(string ids) + public async Task Delete(string ids) { - throw new NotImplementedException(); + if (string.IsNullOrEmpty(ids)) + { + return; + } + DateTime nowTime = DateTime.Now; + + string[] idArr = ids.Split(','); + foreach (string id in idArr) + { + await using DbTransaction tran = await GetDbAmsTransaction(); + + await DbAMS.Update() + .Set(h => h.IsDel == true) + .Set(h => h.LastUpdate == nowTime) + .WithTransaction(tran) + .Where(h => id == h.GID) + .ExecuteAffrowsAsync(); + + await DbAMS.Update() + .Set(h => h.IsDel == true) + .Set(h => h.LastUpdate == nowTime) + .WithTransaction(tran) + .Where(h => h.PID == id) + .ExecuteAffrowsAsync(); + + tran.Commit(); + } } - public Task Send(string ids, string msgType) + public async Task Send(string ids, int sendType) { - throw new NotImplementedException(); + return sendType switch + { + _ => "发送成功", + }; } public Task SaveReceipt(AFRReceiptDto input) @@ -499,5 +531,12 @@ namespace djy.Service.AFR throw new NotImplementedException(); } + public async Task> GetHistory(string id) + { + var data = await DbAMS.Select() + .Where(h => h.PID == id) + .ToListAsync(); + return data; + } } } diff --git a/web/djy_AfrApi/Controllers/AfrController.cs b/web/djy_AfrApi/Controllers/AfrController.cs index 07a102d..43faad1 100644 --- a/web/djy_AfrApi/Controllers/AfrController.cs +++ b/web/djy_AfrApi/Controllers/AfrController.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using System; +using System.Collections.Generic; using System.Threading.Tasks; namespace djy_AfrApi.Controllers @@ -57,8 +58,8 @@ namespace djy_AfrApi.Controllers /// /// /// - [HttpGet("Get")] - public async Task> Get(string gid) + [HttpGet("Detail")] + public async Task> Detail(string gid) { var model = await _afrService.Get(gid); return SuccessResp(model); @@ -97,14 +98,14 @@ namespace djy_AfrApi.Controllers /// /// 发送接口 /// - /// - /// + /// 主键集合 + /// 1:发送 2:原始重发 3:修改发送 4:删除发送 /// [HttpGet("Send")] - public async Task Send(string ids, string msgType) + public async Task Send(string ids, int sendType) { - await _afrService.Send(ids, msgType); - return SuccessResp(); + string message = await _afrService.Send(ids, sendType); + return SuccessResp(message); } /// @@ -120,6 +121,19 @@ namespace djy_AfrApi.Controllers return SuccessResp("接收成功"); } #endregion + + /// + /// 获取历史记录 + /// + /// 主键 + /// 历史记录列表 + [HttpGet("GetHistory")] + public async Task>> GetHistory(string id) + { + var data = await _afrService.GetHistory(id); + return SuccessResp(data); + } + /// /// 获取服务器当前时间 /// diff --git a/web/djy_AfrApi/Controllers/CommonController.cs b/web/djy_AfrApi/Controllers/CommonController.cs index c9a0a77..1d637c0 100644 --- a/web/djy_AfrApi/Controllers/CommonController.cs +++ b/web/djy_AfrApi/Controllers/CommonController.cs @@ -12,7 +12,7 @@ namespace djy_AfrApi.Controllers.Common [Route("api/[controller]")] [ApiController] [Authorize] - public class CommonController + public class CommonController { private readonly IAfrService ser; @@ -28,12 +28,12 @@ namespace djy_AfrApi.Controllers.Common /// [HttpGet("GetCountry")] [RedisCaching] - public Response> GetCountry(string strlink = "", int page = 0, int limit = 0) + public Response> GetCountry() { var result = new Response>(); try { - result.Result = ser.GetCountry(strlink, page, limit); + result.Result = ser.GetCountry("", 0, 0); } catch (Exception ex) { @@ -71,9 +71,9 @@ namespace djy_AfrApi.Controllers.Common /// [HttpGet("GetCTNALL")] [RedisCaching] - public Response> GetCTNALL() + public Response> GetCTNALL() { - var result = new Response>(); + var result = new Response>(); try { result.Result = ser.GetCTNALL(); @@ -94,9 +94,9 @@ namespace djy_AfrApi.Controllers.Common /// [HttpGet("GetPackage")] [RedisCaching] - public Response> GetPackage() + public Response> GetPackage() { - var result = new Response>(); + var result = new Response>(); try { result.Result = ser.GetPackage(); @@ -115,12 +115,12 @@ namespace djy_AfrApi.Controllers.Common /// [HttpGet("GetDangerousGoods")] [RedisCaching] - public Response> GetDangerousGoods(string strlink = "",int page = 0, int limit = 0) + public Response> GetDangerousGoods() { var result = new Response>(); try { - result.Result = ser.GetDangerousGoods(strlink); + result.Result = ser.GetDangerousGoods(""); } catch (Exception ex) { @@ -158,12 +158,12 @@ namespace djy_AfrApi.Controllers.Common /// [HttpGet("GetPort")] [RedisCaching] - public Response> GetPort(string strlink = "", int page = 0, int limit = 0) + public Response> GetPort() { var result = new Response>(); try { - result.Result = ser.GetPort(strlink, page, limit); + result.Result = ser.GetPort("", 0, 0); } catch (Exception ex) { @@ -180,12 +180,12 @@ namespace djy_AfrApi.Controllers.Common /// [HttpGet("GetVessel")] [RedisCaching] - public Response> GetVessel(string strlink = "", int page = 0,int limit =0) + public Response> GetVessel() { var result = new Response>(); try { - result.Result = ser.GetVessel(strlink, page,limit); + result.Result = ser.GetVessel("", 0, 0); } catch (Exception ex) { diff --git a/web/djy_AfrApi/Milldlewares/CommonCacheMiddleware.cs b/web/djy_AfrApi/Milldlewares/CommonDataCacheMiddleware.cs similarity index 94% rename from web/djy_AfrApi/Milldlewares/CommonCacheMiddleware.cs rename to web/djy_AfrApi/Milldlewares/CommonDataCacheMiddleware.cs index b65bf11..4053b5c 100644 --- a/web/djy_AfrApi/Milldlewares/CommonCacheMiddleware.cs +++ b/web/djy_AfrApi/Milldlewares/CommonDataCacheMiddleware.cs @@ -1,22 +1,19 @@ using Common.Tools; using Common.Utilities; +using djy_AfrApi.Attributes; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Controllers; using Newtonsoft.Json; -using System.Diagnostics; -using System; using System.IO; using System.Threading.Tasks; -using NPOI.XWPF.UserModel; -using djy_AfrApi.Attributes; namespace djy_AfrApi.Milldlewares { - public class CommonCacheMiddleware + public class CommonDataCacheMiddleware { private readonly RequestDelegate next; - public CommonCacheMiddleware(RequestDelegate next) + public CommonDataCacheMiddleware(RequestDelegate next) { this.next = next; } diff --git a/web/djy_AfrApi/Milldlewares/MiddlewareHelpers.cs b/web/djy_AfrApi/Milldlewares/MiddlewareHelpers.cs index ee9e033..75be504 100644 --- a/web/djy_AfrApi/Milldlewares/MiddlewareHelpers.cs +++ b/web/djy_AfrApi/Milldlewares/MiddlewareHelpers.cs @@ -42,7 +42,7 @@ namespace djy_AfrApi.Middlewares /// public static IApplicationBuilder UseCommonCacheMiddleware(this IApplicationBuilder app) { - return app.UseMiddleware(); + return app.UseMiddleware(); } } }