wet 1 year ago
commit 91816c999d

@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 批量BC引入订舱检索
/// </summary>
public class BookingOrderBCQuery
{
/// <summary>
/// 开船开始日期
/// </summary>
public Nullable<DateTime> beginETD { get; set; }
/// <summary>
/// 开船结束日期
/// </summary>
public Nullable<DateTime> endETD { get; set; }
/// <summary>
/// 创建开始日期
/// </summary>
public Nullable<DateTime> beginCreated { get; set; }
/// <summary>
/// 创建结束日期
/// </summary>
public Nullable<DateTime> endCreated { get; set; }
/// <summary>
/// 主提单号
/// </summary>
public string mblNo { get; set; }
/// <summary>
/// 订舱编号
/// </summary>
public string custNo { get; set; }
/// <summary>
/// 船名
/// </summary>
public string vessel { get; set; }
/// <summary>
/// 航次号
/// </summary>
public string voyno { get; set; }
/// <summary>
/// 最大返回行数默认100
/// </summary>
public int topNum { get; set; } = 100;
}
}

@ -38,5 +38,12 @@ namespace Myshipping.Application
/// <param name="taskPKId">BC任务主键</param>
/// <returns>返回数据流</returns>
Task<IActionResult> DownloadFile(string taskPKId);
/// <summary>
/// 检索订舱信息
/// </summary>
/// <param name="query">检索条件</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> QueryBookingOrderList(BookingOrderBCQuery query);
}
}

@ -334,5 +334,119 @@ namespace Myshipping.Application
var result = new FileStreamResult(new FileStream(fileFullPath, FileMode.Open), "application/octet-stream") { FileDownloadName = fileName };
return result;
}
/// <summary>
/// 检索订舱信息
/// </summary>
/// <param name="query">检索条件</param>
/// <returns>返回回执</returns>
[HttpPost("/TaskManageBC/QueryBookingOrderList")]
public async Task<TaskManageOrderResultDto> QueryBookingOrderList([FromBody] BookingOrderBCQuery query)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
bool isAvailable = false;
var queryWhere = _bookingOrderRepository.AsQueryable();
#region 查询条件
if (query.beginETD.HasValue || query.endETD.HasValue)
{
/*
7
*/
DateTime beginDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
DateTime endDate = beginDate;
if (query.beginETD.HasValue)
beginDate = query.beginETD.Value;
if (query.endETD.HasValue)
endDate = query.endETD.Value;
if (endDate > beginDate.AddDays(7))
throw Oops.Oh($"船期的日期范围不能超过7天");
endDate = endDate.AddDays(1);
queryWhere = queryWhere.Where(a => a.ETD >= beginDate && a.ETD < endDate);
isAvailable = true;
}
if (query.beginCreated.HasValue || query.endCreated.HasValue)
{
/*
7
*/
DateTime beginDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
DateTime endDate = beginDate;
if (query.beginCreated.HasValue)
beginDate = query.beginCreated.Value;
if (query.endCreated.HasValue)
endDate = query.endCreated.Value;
if (endDate > beginDate.AddDays(7))
throw Oops.Oh($"制单的日期范围不能超过7天");
endDate = endDate.AddDays(1);
queryWhere = queryWhere.Where(a => a.CreatedTime >= beginDate && a.CreatedTime < endDate);
isAvailable = true;
}
if (!string.IsNullOrWhiteSpace(query.mblNo))
{
queryWhere = queryWhere.Where(a => a.MBLNO.Contains(query.mblNo));
isAvailable = true;
}
if (!string.IsNullOrWhiteSpace(query.custNo))
{
queryWhere = queryWhere.Where(a => a.CUSTNO.Contains(query.custNo));
isAvailable = true;
}
if (!string.IsNullOrWhiteSpace(query.vessel))
{
queryWhere = queryWhere.Where(a => a.VESSEL.Contains(query.vessel));
isAvailable = true;
}
if (!string.IsNullOrWhiteSpace(query.voyno))
{
queryWhere = queryWhere.Where(a => a.VOYNO.Contains(query.voyno));
isAvailable = true;
}
#endregion
if (!isAvailable)
throw Oops.Oh($"查询条件不能为空");
var list = await queryWhere.OrderBy(a => a.CreatedTime)
.Take(query.topNum).ToListAsync();
var bkList = list.Adapt<List<BookingOrderBCTaskDto>>();
result.succ = true;
result.ext = bkList;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"查询失败,原因:{ex.Message}";
}
return result;
}
}
}

@ -109,9 +109,10 @@ namespace Myshipping.Core.Service
[HttpGet("/DjyWebsiteAccountConfig/PageTenant")]
public async Task<dynamic> PageTenant([FromQuery] QueryDjyWebsiteAccountConfigInput input)
{
var entities = await _rep.AsQueryable()
var entities = await _rep.AsQueryable().Filter(null, true)
.Where(m => m.TenantId == UserManager.TENANT_ID)
.Where(m => m.IsTenant)
.Where(m => m.CreatedUserId == UserManager.UserId)
.Where(m => !m.IsDeleted)
.WhereIF(!string.IsNullOrWhiteSpace(input.TypeCode), u => u.TypeCode == input.TypeCode)
.WhereIF(!string.IsNullOrWhiteSpace(input.Account), u => u.Account.Contains(input.Account.Trim()))
.ToPagedListAsync(input.PageNo, input.PageSize);
@ -179,13 +180,15 @@ namespace Myshipping.Core.Service
/// <returns></returns>
public async Task<DjyWebsiteAccountConfig> GetAccountConfig(string TypeCode, long UserId)
{
if (string.IsNullOrWhiteSpace(TypeCode)||UserId==0) {
if (string.IsNullOrWhiteSpace(TypeCode) || UserId == 0)
{
throw Oops.Bah("请传入正确参数!");
}
DjyWebsiteAccountConfig accountConfig = new DjyWebsiteAccountConfig();
accountConfig = await _rep.FirstOrDefaultAsync(x => x.TypeCode == TypeCode && x.CreatedUserId == UserId);
if (accountConfig==null) {
accountConfig = await _rep.AsQueryable().InnerJoin<SysUser>((d,t)=>d.TenantId==t.TenantId).Where((d,t)=>d.TypeCode==TypeCode&&t.Id==UserId&&d.IsTenant==true).FirstAsync();
if (accountConfig == null)
{
accountConfig = await _rep.AsQueryable().InnerJoin<SysUser>((d, t) => d.TenantId == t.TenantId).Where((d, t) => d.TypeCode == TypeCode && t.Id == UserId && d.IsTenant == true).FirstAsync();
}
return accountConfig;
}

Loading…
Cancel
Save