From 5b77ee33a23a3fd8a8ae9358af9ebb27eca19aed Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Fri, 17 May 2024 17:00:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingLabel/BookingLabelService.cs | 14 ++++++++++++++ .../BookingLabel/Dto/BookingLabelBaseDto.cs | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Myshipping.Application/Service/BookingLabel/BookingLabelService.cs b/Myshipping.Application/Service/BookingLabel/BookingLabelService.cs index 011c24de..3f35b6cd 100644 --- a/Myshipping.Application/Service/BookingLabel/BookingLabelService.cs +++ b/Myshipping.Application/Service/BookingLabel/BookingLabelService.cs @@ -94,6 +94,20 @@ namespace Myshipping.Application : cacheList.Where(x => x.Scope == scope).ToList(); return result; } + /// + /// 分页获取全部或指定范围类型的标签列表 + /// + [HttpPost("/BookingLabel/PageList")] + public async Task> PageList(BookingLabelPageListInput input) + { + var list = await _rep.AsQueryable() + .WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name)) + .WhereIF(input.Scope != null, x => x.Scope == input.Scope) + .ToPagedListAsync(input.PageNo, input.PageSize); + + var result = list.Adapt>(); + return result; + } /// /// 新增或修改标签信息 diff --git a/Myshipping.Application/Service/BookingLabel/Dto/BookingLabelBaseDto.cs b/Myshipping.Application/Service/BookingLabel/Dto/BookingLabelBaseDto.cs index 88af57a9..875c0291 100644 --- a/Myshipping.Application/Service/BookingLabel/Dto/BookingLabelBaseDto.cs +++ b/Myshipping.Application/Service/BookingLabel/Dto/BookingLabelBaseDto.cs @@ -1,4 +1,5 @@ -namespace Myshipping.Application.Service.BookingLabel.Dto +using Myshipping.Core; +namespace Myshipping.Application.Service.BookingLabel.Dto { public class BookingLabelBaseDto { @@ -28,4 +29,17 @@ /// public long[] BusinessIdArray { get; set; } } + public class BookingLabelPageListInput : PageInputBase + { + /// + /// 标签名称 + /// + public string Name { get; set; } + + /// + /// 标签使用范围 1-舱位 + /// + public int? Scope { get; set; } + + } } From dfbf84314a4234dc1e6be45aa1d2806fb146aac7 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Mon, 20 May 2024 10:37:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=88=B1=E4=BD=8D=E3=80=81=E8=88=B9?= =?UTF-8?q?=E6=9C=9F=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Application/Entity/BookingLabel.cs | 5 ++ .../BookingSlot/BookingSlotAllocation.cs | 2 +- .../Entity/BookingSlot/BookingSlotBase.cs | 2 +- .../Entity/BookingSlot/BookingSlotStock.cs | 34 ++++---- .../BookingLabel/Dto/BookingLabelBaseDto.cs | 5 +- .../Service/BookingSlot/BookingSlotService.cs | 10 +-- .../BookingSlot/Dto/BookingSlotBaseDto.cs | 4 +- .../Dto/BookingSlotStockPageInput.cs | 2 +- .../TaskManagePlat/TaskManageBCService.cs | 12 ++- Myshipping.Core/Myshipping.Core.xml | 2 +- .../DjyVesselInfo/DjyVesselInfoService.cs | 79 ++++++++++++++----- Myshipping.Core/SqlSugar/SqlSugarSetup.cs | 9 ++- 12 files changed, 109 insertions(+), 57 deletions(-) diff --git a/Myshipping.Application/Entity/BookingLabel.cs b/Myshipping.Application/Entity/BookingLabel.cs index b93ea890..a7b825b6 100644 --- a/Myshipping.Application/Entity/BookingLabel.cs +++ b/Myshipping.Application/Entity/BookingLabel.cs @@ -19,5 +19,10 @@ namespace Myshipping.Application.Entity /// 标签使用范围 1-舱位管理台账 /// public int Scope { get; set; } + + /// + /// 颜色 + /// + public string Color { get; set; } } } \ No newline at end of file diff --git a/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs b/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs index 39d9dbeb..550cbcaa 100644 --- a/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs +++ b/Myshipping.Application/Entity/BookingSlot/BookingSlotAllocation.cs @@ -206,7 +206,7 @@ namespace Myshipping.Application /// 所在周数 /// [SugarColumn(ColumnName = "WEEK_AT")] - public string WEEK_AT { get; set; } + public int? WEEK_AT { get; set; } /// /// 箱使天数 diff --git a/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs b/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs index 656ab9ff..e8c768f9 100644 --- a/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs +++ b/Myshipping.Application/Entity/BookingSlot/BookingSlotBase.cs @@ -223,7 +223,7 @@ namespace Myshipping.Application /// [SugarColumn(ColumnName = "WEEK_AT")] [Description("所在周数")] - public string WEEK_AT{ get; set; } + public int? WEEK_AT{ get; set; } /// /// 箱使天数 diff --git a/Myshipping.Application/Entity/BookingSlot/BookingSlotStock.cs b/Myshipping.Application/Entity/BookingSlot/BookingSlotStock.cs index cf401f6a..4f7f3715 100644 --- a/Myshipping.Application/Entity/BookingSlot/BookingSlotStock.cs +++ b/Myshipping.Application/Entity/BookingSlot/BookingSlotStock.cs @@ -131,23 +131,23 @@ namespace Myshipping.Application [Description("卸货港国家名称")] public string PORTDISCHARGE_COUNTRY { get; set; } - /// - /// 航线代码(船公司) - /// - [SugarColumn(ColumnName = "LANECODE")] - public string LANECODE { get; set; } - - /// - /// 航线名称(船公司) - /// - [SugarColumn(ColumnName = "LANENAME")] - public string LANENAME { get; set; } - - /// - /// 所在周数 - /// - [SugarColumn(ColumnName = "WEEK_AT")] - public string WEEK_AT { get; set; } + ///// + ///// 航线代码(船公司) + ///// + //[SugarColumn(ColumnName = "LANECODE")] + //public string LANECODE { get; set; } + + ///// + ///// 航线名称(船公司) + ///// + //[SugarColumn(ColumnName = "LANENAME")] + //public string LANENAME { get; set; } + + ///// + ///// 所在周数 + ///// + //[SugarColumn(ColumnName = "WEEK_AT")] + //public string WEEK_AT { get; set; } /// /// 箱型箱量 diff --git a/Myshipping.Application/Service/BookingLabel/Dto/BookingLabelBaseDto.cs b/Myshipping.Application/Service/BookingLabel/Dto/BookingLabelBaseDto.cs index 875c0291..679bd3c2 100644 --- a/Myshipping.Application/Service/BookingLabel/Dto/BookingLabelBaseDto.cs +++ b/Myshipping.Application/Service/BookingLabel/Dto/BookingLabelBaseDto.cs @@ -13,6 +13,10 @@ namespace Myshipping.Application.Service.BookingLabel.Dto /// 标签使用范围 1-舱位 /// public int Scope { get; set; } + /// + /// 颜色 + /// + public string Color { get; set; } } /// @@ -40,6 +44,5 @@ namespace Myshipping.Application.Service.BookingLabel.Dto /// 标签使用范围 1-舱位 /// public int? Scope { get; set; } - } } diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index 057271b4..398a5107 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -1367,12 +1367,8 @@ namespace Myshipping.Application [HttpPost("/BookingSlot/page")] public async Task Page(BookingSlotBasePageInput input) { - if (!string.IsNullOrEmpty(input.WEEK_AT)) - { - input.WEEK_AT = "W" + input.WEEK_AT; - } ISugarQueryable select = null; - + // 箱型筛选 string[] ctnCodeArr = null; if (!string.IsNullOrEmpty(input.CTN_STAT)) @@ -1409,10 +1405,10 @@ namespace Myshipping.Application .WhereIF(!string.IsNullOrEmpty(input.BOOKING_SLOT_TYPE), u => u.BOOKING_SLOT_TYPE == input.BOOKING_SLOT_TYPE) .WhereIF(!string.IsNullOrEmpty(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME)) - .WhereIF(!string.IsNullOrEmpty(input.WEEK_AT), u => u.WEEK_AT == input.WEEK_AT) + .WhereIF(input.WEEK_AT != null, u => u.WEEK_AT == input.WEEK_AT) // 标签筛选 - .WhereIF(input.LabelIdArray != null && input.LabelIdArray.Length > 0, + .WhereIF(input.LabelIdArray != null && input.LabelIdArray.Length > 0, u => SqlFunc.Subqueryable() .Where(x => x.BusinessId == u.Id && input.LabelIdArray.Contains(x.LabelId)) .Any()); diff --git a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs index 7722bd79..05c463fe 100644 --- a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs +++ b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotBaseDto.cs @@ -123,7 +123,7 @@ namespace Myshipping.Application.Service.BookingSlot.Dto /// /// 周数 /// - public string WEEK_AT { get; set; } + public int? WEEK_AT { get; set; } /// /// 标签Id列表 @@ -313,7 +313,7 @@ namespace Myshipping.Application.Service.BookingSlot.Dto /// 所在周数 /// [Description("所在周数")] - public string WEEK_AT { get; set; } + public int? WEEK_AT { get; set; } /// /// 箱使天数 diff --git a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotStockPageInput.cs b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotStockPageInput.cs index 28112f1c..395b6156 100644 --- a/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotStockPageInput.cs +++ b/Myshipping.Application/Service/BookingSlot/Dto/BookingSlotStockPageInput.cs @@ -129,7 +129,7 @@ namespace Myshipping.Application.Service.BookingSlot.Dto /// /// 所在周数 /// - public string WEEK_AT { get; set; } + public int? WEEK_AT { get; set; } /// /// 箱型箱量 diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs index fd4ae7a7..ffce2d1b 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs @@ -1249,7 +1249,7 @@ namespace Myshipping.Application VESSEL = taskBCInfo.VESSEL, VOYNO = taskBCInfo.VOYNO, VGM_SUBMISSION_CUT_DATE = taskBCInfo.VGM_CUTOFF_TIME, - WEEK_AT = taskBCInfo.WEEK_AT, + //WEEK_AT = taskBCInfo.WEEK_AT, CARRIAGE_TYPE = taskBCInfo.CARRIAGE_TYPE, CARRIAGE_TYPE_NAME = taskBCInfo.CARRIAGE_TYPE_NAME, CONTRACT_NO = taskBCInfo.CONTRACTNO, @@ -1273,6 +1273,10 @@ namespace Myshipping.Application }, OpType = opType }; + if (int.TryParse(taskBCInfo.WEEK_AT, out int _weekat)) + { + slotModel.DataObj.WEEK_AT = _weekat; + } var ctnCodeList = _cache.GetAllCodeCtn().GetAwaiter().GetResult().ToList(); @@ -2924,7 +2928,7 @@ namespace Myshipping.Application VESSEL = taskBCInfo.VESSEL, VOYNO = taskBCInfo.VOYNO, VGM_SUBMISSION_CUT_DATE = taskBCInfo.VGM_CUTOFF_TIME, - WEEK_AT = taskBCInfo.WEEK_AT, + //WEEK_AT = taskBCInfo.WEEK_AT, CARRIAGE_TYPE = taskBCInfo.CARRIAGE_TYPE, CARRIAGE_TYPE_NAME = taskBCInfo.CARRIAGE_TYPE_NAME, CONTRACT_NO = taskBCInfo.CONTRACTNO, @@ -2948,6 +2952,10 @@ namespace Myshipping.Application }, OpType = "update" }; + if (int.TryParse(taskBCInfo.WEEK_AT, out int _weekat)) + { + slotModel.DataObj.WEEK_AT = _weekat; + } var ctnList = _taskBCCTNInfoRepository.AsQueryable().Where(a => a.P_ID == taskBCInfo.PK_ID).ToList(); diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 80c08aed..66cf7389 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -13932,7 +13932,7 @@ - + 下拉列表 diff --git a/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs b/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs index feaf2375..4670909e 100644 --- a/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs +++ b/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs @@ -150,15 +150,22 @@ namespace Myshipping.Core.Service /// /// [HttpGet("/DjyVesselInfoService/GetList")] - public async Task GetList([FromQuery] string CarrierID, DateTime? ETD = null, string PortDischargeId = null, string KeyWord = "", DateTime? etdStart = null, DateTime? etdEnd = null, string sortField = null, bool descSort = false, int limit = 20) + public async Task GetList([FromQuery] string CarrierID, + DateTime? ETD = null, + string PortDischargeId = null, + string PortLoadingId = null, + string KeyWord = "", + DateTime? etdStart = null, + DateTime? etdEnd = null, + string sortField = null, + bool descSort = false, + int limit = 20) { - //获取船名 - List list = await _sysCacheService.GetAllCodeVessel(); - var query = _rep.AsQueryable().Filter(null, true). Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false && x.CARRIERID != null && x.CARRIERID != ""). WhereIF(!string.IsNullOrWhiteSpace(KeyWord), x => x.Vessel.StartsWith(KeyWord.ToUpper())). WhereIF(!string.IsNullOrEmpty(PortDischargeId), x => x.PortDischargeId == PortDischargeId). + WhereIF(!string.IsNullOrEmpty(PortLoadingId), x => x.PortLoadingId == PortLoadingId). WhereIF(ETD != null, x => Convert.ToDateTime(x.ETD).ToString("yyyy-MM-dd") == Convert.ToDateTime(ETD).ToString("yyyy-MM-dd")).//船期关联船名 WhereIF(ETD == null && etdStart == null && etdEnd == null, x => x.ETD > DateTime.Now.AddDays(-7)).//领导需求当前日期7天之前 WhereIF(etdStart.HasValue, x => x.ETD >= etdStart). @@ -183,6 +190,7 @@ namespace Myshipping.Core.Service query = query.OrderBy(PageInputOrder.OrderBuilder(sortField, descSort)); } + var tlist = await query .Take(limit) .ToListAsync(); @@ -193,26 +201,55 @@ namespace Myshipping.Core.Service return tlist; } - - - var ves = tlist.Select(x => x.Vessel).ToList(); - var all = list.WhereIF(!string.IsNullOrWhiteSpace(KeyWord), x => x.Name.StartsWith(KeyWord.ToUpper())). - Select(x => new + List commonList = await _sysCacheService.GetAllCodeVessel(); + if (string.IsNullOrEmpty(KeyWord)) { - - Voyno = "", - VoynoInside = "", - Vessel = x.Name, - ETD = "", - ATD = "", - PortDischargeId = "", - PortDischarge = "" - }).Take(limit).ToList(); - foreach (var item in ves) + foreach (var item in commonList) + { + if (tlist.Count >= 10) + { + return tlist; + } + if (tlist.Any(x => x.Vessel == item.Name)) + { + continue; + } + tlist.Add(new + { + Voyno = "", + VoynoInside = "", + Vessel = item.Name, + ETD = "", + ATD = "", + PortDischargeId = "", + PortDischarge = "", + ClosingDate = "", + CloseDocTime = "" + }); + } + return tlist; + } + else { - all.RemoveAll(x => x.Vessel.StartsWith(item)); + commonList = commonList.Where(x => x.Name.StartsWith(KeyWord.ToUpper())).ToList(); + foreach (var item in tlist) + { + commonList.RemoveAll(x => x.Name == item.Vessel); + } + var temp = commonList.Select(x => new + { + Voyno = "", + VoynoInside = "", + Vessel = x.Name, + ETD = "", + ATD = "", + PortDischargeId = "", + PortDischarge = "", + ClosingDate = "", + CloseDocTime = "" + }); + return tlist.Union(temp); } - return tlist.Union(all); } } } diff --git a/Myshipping.Core/SqlSugar/SqlSugarSetup.cs b/Myshipping.Core/SqlSugar/SqlSugarSetup.cs index b4e54955..08e12f52 100644 --- a/Myshipping.Core/SqlSugar/SqlSugarSetup.cs +++ b/Myshipping.Core/SqlSugar/SqlSugarSetup.cs @@ -119,9 +119,12 @@ public static class SqlSugarSetup { Console.ForegroundColor = ConsoleColor.Blue; } - //Console.WriteLine("Sql:" + "\r\n\r\n" + UtilMethods.GetSqlString(c.DbType, sql, pars)); - //App.PrintToMiniProfiler("SqlSugar", "Info", UtilMethods.GetSqlString(c.DbType, sql, pars)); - //$"DB:{c.ConfigId}, Sql:\r\n\r\n { UtilMethods.GetSqlString(c.DbType, sql, pars)}".LogInformation(); + if (App.WebHostEnvironment.EnvironmentName == "Development") + { + //Console.WriteLine("Sql:" + "\r\n\r\n" + UtilMethods.GetSqlString(c.DbType, sql, pars)); + //App.PrintToMiniProfiler("SqlSugar", "Info", UtilMethods.GetSqlString(c.DbType, sql, pars)); + $"DB:{c.ConfigId}, Sql:\r\n\r\n {UtilMethods.GetSqlString(c.DbType, sql, pars)}".LogInformation(); + } };