diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/BLIssueManage/IBLIssueManageService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/BLIssueManage/IBLIssueManageService.cs index 9f054b26..5eab2066 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/BLIssueManage/IBLIssueManageService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/BLIssueManage/IBLIssueManageService.cs @@ -21,11 +21,11 @@ namespace DS.WMS.Core.Op.Interface Task>> GetPageAsync(PageRequest querySearch); /// - /// 导出 + /// 获取导出数据列表 /// /// 查询条件 /// 返回回执 - Task> Export(PageRequest querySearch); + Task>> GetExportList(PageRequest querySearch); /// /// 打印 diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BLIssueManage/BLIssueManageService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BLIssueManage/BLIssueManageService.cs index 7651b11b..effa8e5e 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/BLIssueManage/BLIssueManageService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/BLIssueManage/BLIssueManageService.cs @@ -69,6 +69,7 @@ using DS.WMS.Core.Application.Dtos; using iText.Layout.Element; using AngleSharp.Html; using DS.WMS.Core.Op.Dtos.Enum; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory; namespace DS.WMS.Core.Op.Method { @@ -185,15 +186,93 @@ namespace DS.WMS.Core.Op.Method } #endregion - #region 导出 + #region 获取导出数据列表 /// - /// 导出 + /// 获取导出数据列表 /// /// 查询条件 /// 返回回执 - public async Task> Export(PageRequest querySearch) + public async Task>> GetExportList(PageRequest querySearch) { - return null; + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + + var query = tenantDb.Queryable().ClearFilter(typeof(IOrgId)) + .LeftJoin((l, r) => l.Id == r.BookingId) + .Select((l, r) => new { order = l, bl = r }); + + if (!querySearch.QueryCondition.IsNullOrEmpty()) + { + var whereList = querySearch.GetConditionalModels(db); + query = query.Where(whereList); + } + + querySearch.PageCondition.PageSize = Int16.MaxValue; + + var result = await query.ToQueryPageAsync(querySearch.PageCondition); + + List resultList = new List(); + + if (result.Data.Count > 0) + { + int start = 1; + + foreach (var data in result.Data) + { + if (data.bl != null && data.bl.Id > 0) + { + var currBl = data.bl.Adapt(); + + currBl.IssueType = data.order.IssueType; + currBl.IssueTypeCode = data.order.IssueTypeCode; + currBl.IssuePlaceId = data.order.IssuePlaceId; + currBl.IssuePlaceCode = data.order.IssuePlaceCode; + currBl.IssuePlace = data.order.IssuePlace; + currBl.LoadPortId = data.order.LoadPortId; + currBl.LoadPortCode = data.order.LoadPortCode; + currBl.LoadPort = data.order.LoadPort; + currBl.DischargePortId = data.order.DischargePortId; + currBl.DischargePortCode = data.order.DischargePortCode; + currBl.DischargePort = data.order.DischargePort; + currBl.CustomerService = data.order.CustomerService; + currBl.CustomerServiceName = data.order.CustomerServiceName; + + resultList.Add(currBl); + + continue; + } + + resultList.Add(new BLIssueManageBaseDto + { + Id = start, + BookingId = data.order.Id, + BLNo = data.order.MBLNO, + CustomerId = data.order.CustomerId, + CustomerName = data.order.CustomerName, + SaleId = data.order.SaleId, + Sale = data.order.Sale, + IssueType = data.order.IssueType, + IssueTypeCode = data.order.IssueTypeCode, + IssuePlaceCode = data.order.IssuePlaceCode, + IssuePlace = data.order.IssuePlace, + LoadPortId = data.order.LoadPortId, + LoadPortCode = data.order.LoadPortCode, + LoadPort = data.order.LoadPort, + DischargePortId = data.order.DischargePortId, + DischargePortCode = data.order.DischargePortCode, + DischargePort = data.order.DischargePort, + CustomerService = data.order.CustomerService, + CustomerServiceName = data.order.CustomerServiceName, + BusiType = BLIssueBusiTypeEnum.SeaExport.ToString(), + BusiTypeName = BLIssueBusiTypeEnum.SeaExport.GetDescription(), + BLType = BLTypeEnum.BL.ToString(), + BLTypeName = BLTypeEnum.BL.GetDescription(), + }); + + start++; + } + } + + return DataResult>.Success(resultList); } #endregion diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/BLIssueManageController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/BLIssueManageController.cs index 57a3d427..2db1b731 100644 --- a/ds-wms-service/DS.WMS.OpApi/Controllers/BLIssueManageController.cs +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/BLIssueManageController.cs @@ -40,17 +40,17 @@ namespace DS.WMS.OpApi.Controllers } #endregion - #region 导出 + #region 获取导出数据列表 /// - /// 导出 + /// 获取导出数据列表 /// /// 查询条件 /// 返回回执 [HttpPost] - [Route("Export")] - public async Task> Export([FromBody] PageRequest querySearch) + [Route("GetExportList")] + public async Task>> GetExportList(PageRequest querySearch) { - return await _BLIssueManageService.Export(querySearch); + return await _BLIssueManageService.GetExportList(querySearch); } #endregion