|
|
|
@ -110,12 +110,12 @@ namespace Myshipping.Application
|
|
|
|
|
[HttpPost("/DataSync/SyncCustomer"), ApiUser(ApiCode = "SyncCustomer")]
|
|
|
|
|
public async Task<long> SyncCustomer(DjyCustomerSyncDto model)
|
|
|
|
|
{
|
|
|
|
|
var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false).ToListAsync();
|
|
|
|
|
var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(model.ShortName))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("简称未录入");
|
|
|
|
|
}
|
|
|
|
|
var m = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.ShortName == model.ShortName && x.IsDeleted == false).FirstAsync();
|
|
|
|
|
var m = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.ShortName == model.ShortName && x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).FirstAsync();
|
|
|
|
|
var entity = model.Adapt<DjyCustomer>();
|
|
|
|
|
if (m == null)
|
|
|
|
|
{
|
|
|
|
@ -259,7 +259,7 @@ namespace Myshipping.Application
|
|
|
|
|
[HttpPost("/DataSync/SyncCustomerList"), ApiUser(ApiCode = "SyncCustomerList")]
|
|
|
|
|
public async Task SyncCustomer(List<DjyCustomerSyncDto> model)
|
|
|
|
|
{
|
|
|
|
|
var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false).ToListAsync();
|
|
|
|
|
var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
|
|
|
|
|
foreach (var item in model)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@ -268,7 +268,7 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("简称未录入");
|
|
|
|
|
}
|
|
|
|
|
var m = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.ShortName == item.ShortName && x.IsDeleted == false).FirstAsync();
|
|
|
|
|
var m = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.ShortName == item.ShortName && x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).FirstAsync();
|
|
|
|
|
var entity = item.Adapt<DjyCustomer>();
|
|
|
|
|
if (m == null)
|
|
|
|
|
{
|
|
|
|
@ -421,8 +421,8 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("BSNO未录入");
|
|
|
|
|
}
|
|
|
|
|
var userlist = _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false).ToListAsync();
|
|
|
|
|
var m = await _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.BSNO == item.BSNO).FirstAsync();
|
|
|
|
|
var userlist = _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
|
|
|
|
|
var m = await _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.BSNO == item.BSNO && x.TenantId == UserManager.TENANT_ID).FirstAsync();
|
|
|
|
|
var entity = item.Adapt<DjyVesselInfo>();
|
|
|
|
|
entity.Vessel = item.Vessel.ToUpper().Trim();
|
|
|
|
|
if (!string.IsNullOrEmpty(item.CARRIER))
|
|
|
|
@ -565,9 +565,9 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
List<CodeCtn> ctncode = await _cache.GetAllCodeCtn();
|
|
|
|
|
var mapcarrier = await _mapcarrier.Where(x => x.Module == "HeChuan").ToListAsync();
|
|
|
|
|
var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false).ToListAsync();
|
|
|
|
|
var djycustomer = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false).ToListAsync();
|
|
|
|
|
var goodsconfig = await _goodsStatusConfig.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false).ToListAsync();
|
|
|
|
|
var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
|
|
|
|
|
var djycustomer = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
|
|
|
|
|
var goodsconfig = await _goodsStatusConfig.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
|
|
|
|
|
foreach (var model in list)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(model.BSNO))
|
|
|
|
@ -1925,6 +1925,135 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 自动化接口
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取订舱数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/DataSync/GetBookingOrder"), ApiUser(ApiCode = "GetBookingOrder")]
|
|
|
|
|
public async Task<dynamic> GetBookingOrder(QueryBookingOrder query)
|
|
|
|
|
{
|
|
|
|
|
if (query == null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("未录入正确查询条件");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(query.MBLNO) && string.IsNullOrEmpty(query.TMBLNO) && string.IsNullOrEmpty(query.BOOKINGNO))
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var list = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).
|
|
|
|
|
WhereIF(!string.IsNullOrEmpty(query.MBLNO), x => x.MBLNO == query.MBLNO).
|
|
|
|
|
WhereIF(!string.IsNullOrEmpty(query.TMBLNO), x => x.TMBLNO == query.TMBLNO).
|
|
|
|
|
WhereIF(!string.IsNullOrEmpty(query.BOOKINGNO), x => x.BOOKINGNO == query.BOOKINGNO).ToListAsync();
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新订舱
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
|
[HttpPost("/DataSync/SaveBookingOrder"), ApiUser(ApiCode = "SaveBookingOrder")]
|
|
|
|
|
public async Task SaveBookingOrder(UpdateBookingOrder input)
|
|
|
|
|
{
|
|
|
|
|
if (input == null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("未录入数据");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(input.MBLNO) && string.IsNullOrEmpty(input.TMBLNO) && string.IsNullOrEmpty(input.BOOKINGNO) && input.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("未录入正确数据");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == input.Id).FirstAsync();
|
|
|
|
|
if (order.MBLNO != input.MBLNO)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = order.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "MBLNO",
|
|
|
|
|
OldValue = order.MBLNO,
|
|
|
|
|
NewValue = input.MBLNO,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (order.TMBLNO != input.TMBLNO)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = order.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "TMBLNO",
|
|
|
|
|
OldValue = order.TMBLNO,
|
|
|
|
|
NewValue = input.TMBLNO,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (order.BOOKINGNO != input.BOOKINGNO)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = order.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "BOOKINGNO",
|
|
|
|
|
OldValue = order.BOOKINGNO,
|
|
|
|
|
NewValue = input.BOOKINGNO,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
order.MBLNO = input.MBLNO;
|
|
|
|
|
order.TMBLNO = input.TMBLNO;
|
|
|
|
|
order.BOOKINGNO = input.BOOKINGNO;
|
|
|
|
|
order.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
order.UpdatedUserName = UserManager.Name;
|
|
|
|
|
order.UpdatedTime = DateTime.Now;
|
|
|
|
|
await _rep.AsUpdateable(order).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.ParentId,
|
|
|
|
|
it.TenantId,
|
|
|
|
|
it.CreatedTime,
|
|
|
|
|
it.CreatedUserId,
|
|
|
|
|
it.CreatedUserName,
|
|
|
|
|
it.TenantName,
|
|
|
|
|
it.IsDeleted,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|