|
|
|
@ -63,13 +63,16 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<CodePort> _codePortRep;
|
|
|
|
|
private readonly SqlSugarRepository<RelaPortCarrierLane> _relaPortLane;
|
|
|
|
|
private readonly ICommonDBService _commonDBService;
|
|
|
|
|
private readonly SqlSugarRepository<CodeForwarder> _codeForwarder;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DataSyncService(ILogger<DataSyncService> logger, ISysCacheService cache, SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn,
|
|
|
|
|
SqlSugarRepository<SysUser> repUser, SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<DjyCustomer> djycustomer,
|
|
|
|
|
SqlSugarRepository<DjyCustomerContact> djycustomercontact, SqlSugarRepository<DjyVesselInfo> vesselinfo, SqlSugarRepository<BookingCtnDetail> ctndetailrep
|
|
|
|
|
, SqlSugarRepository<BookingEDIExt> bookingEDIExt, SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail,
|
|
|
|
|
SqlSugarRepository<BookingGoodsStatus> goodsStatus, SqlSugarRepository<BookingGoodsStatusConfig> goodsStatusConfig, SqlSugarRepository<DjyTenantLine> repline,
|
|
|
|
|
SqlSugarRepository<BookingRemark> bookingremark, SqlSugarRepository<MappingCarrier> mapcarrier,
|
|
|
|
|
SqlSugarRepository<BookingRemark> bookingremark, SqlSugarRepository<MappingCarrier> mapcarrier, SqlSugarRepository<CodeForwarder> codeForwarder,
|
|
|
|
|
SqlSugarRepository<CodePort> codePortRep, SqlSugarRepository<CodeLane> codeLaneRep, ICommonDBService commonDBService, SqlSugarRepository<RelaPortCarrierLane> relaPortLane)
|
|
|
|
|
{
|
|
|
|
|
this._logger = logger;
|
|
|
|
@ -94,6 +97,7 @@ namespace Myshipping.Application
|
|
|
|
|
this._codeLaneRep = codeLaneRep;
|
|
|
|
|
this._commonDBService = commonDBService;
|
|
|
|
|
this._relaPortLane = relaPortLane;
|
|
|
|
|
this._codeForwarder = codeForwarder;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -132,7 +136,7 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
entity.CUSTSERVICEID = userlist.Where(x => x.Name == entity.CUSTSERVICE).Count() == 0 ? "" : userlist.Where(x => x.Name == entity.CUSTSERVICE).Select(x => x.Id).FirstOrDefault().ToString();
|
|
|
|
|
}
|
|
|
|
|
entity.PropString = entity.PropString.Replace("forwarder", "booking_agent");
|
|
|
|
|
entity.PropString = entity.PropString.Replace("forwarder", "booking_agent");
|
|
|
|
|
entity.TenantId = UserManager.TENANT_ID;
|
|
|
|
|
await _djycustomer.InsertAsync(entity);
|
|
|
|
|
foreach (var item in model.ContactList)
|
|
|
|
@ -142,6 +146,38 @@ namespace Myshipping.Application
|
|
|
|
|
contact.TenantId = UserManager.TENANT_ID;
|
|
|
|
|
await _djycustomercontact.InsertAsync(contact);
|
|
|
|
|
}
|
|
|
|
|
if (entity.PropString.Contains("shipagency"))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var ship = await _codeForwarder.AsQueryable().Where(x => x.Code == entity.CodeName).FirstAsync();
|
|
|
|
|
if (ship == null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
await _codeForwarder.InsertAsync(new CodeForwarder
|
|
|
|
|
{
|
|
|
|
|
GID = Guid.NewGuid().ToString(),
|
|
|
|
|
CreateTime = DateTime.Now,
|
|
|
|
|
CreateUser = UserManager.DjyUserId,
|
|
|
|
|
Code = entity.CodeName,
|
|
|
|
|
Name = entity.ShortName
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ship.Code = entity.CodeName;
|
|
|
|
|
ship.Name = entity.ShortName;
|
|
|
|
|
ship.ModifyTime = DateTime.Now;
|
|
|
|
|
ship.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeForwarder.UpdateAsync(ship);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -171,6 +207,37 @@ namespace Myshipping.Application
|
|
|
|
|
it.TIDANINFO
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
await _djycustomercontact.DeleteAsync(x => x.CustomerId == entity.Id);
|
|
|
|
|
if (entity.PropString.Contains("shipagency"))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var ship = await _codeForwarder.AsQueryable().Where(x => x.Code == entity.CodeName).FirstAsync();
|
|
|
|
|
if (ship == null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
await _codeForwarder.InsertAsync(new CodeForwarder
|
|
|
|
|
{
|
|
|
|
|
GID = Guid.NewGuid().ToString(),
|
|
|
|
|
CreateTime = DateTime.Now,
|
|
|
|
|
CreateUser = UserManager.DjyUserId,
|
|
|
|
|
Code = entity.CodeName,
|
|
|
|
|
Name = entity.ShortName
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ship.Code = entity.CodeName;
|
|
|
|
|
ship.Name = entity.ShortName;
|
|
|
|
|
ship.ModifyTime = DateTime.Now;
|
|
|
|
|
ship.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeForwarder.UpdateAsync(ship);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
foreach (var item in model.ContactList)
|
|
|
|
|
{
|
|
|
|
|
var contact = item.Adapt<DjyCustomerContact>();
|
|
|
|
@ -231,6 +298,37 @@ namespace Myshipping.Application
|
|
|
|
|
contact.CustomerId = entity.Id;
|
|
|
|
|
contact.TenantId = UserManager.TENANT_ID;
|
|
|
|
|
await _djycustomercontact.InsertAsync(contact);
|
|
|
|
|
}
|
|
|
|
|
if (entity.PropString.Contains("shipagency"))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var ship = await _codeForwarder.AsQueryable().Where(x => x.Code == entity.CodeName).FirstAsync();
|
|
|
|
|
if (ship == null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
await _codeForwarder.InsertAsync(new CodeForwarder
|
|
|
|
|
{
|
|
|
|
|
GID = Guid.NewGuid().ToString(),
|
|
|
|
|
CreateTime = DateTime.Now,
|
|
|
|
|
CreateUser = UserManager.DjyUserId,
|
|
|
|
|
Code = entity.CodeName,
|
|
|
|
|
Name = entity.ShortName
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ship.Code = entity.CodeName;
|
|
|
|
|
ship.Name = entity.ShortName;
|
|
|
|
|
ship.ModifyTime = DateTime.Now;
|
|
|
|
|
ship.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeForwarder.UpdateAsync(ship);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -265,6 +363,37 @@ namespace Myshipping.Application
|
|
|
|
|
contact.CustomerId = entity.Id;
|
|
|
|
|
contact.TenantId = UserManager.TENANT_ID;
|
|
|
|
|
await _djycustomercontact.InsertAsync(contact);
|
|
|
|
|
}
|
|
|
|
|
if (entity.PropString.Contains("shipagency"))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var ship = await _codeForwarder.AsQueryable().Where(x => x.Code == entity.CodeName).FirstAsync();
|
|
|
|
|
if (ship == null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
await _codeForwarder.InsertAsync(new CodeForwarder
|
|
|
|
|
{
|
|
|
|
|
GID = Guid.NewGuid().ToString(),
|
|
|
|
|
CreateTime = DateTime.Now,
|
|
|
|
|
CreateUser = UserManager.DjyUserId,
|
|
|
|
|
Code = entity.CodeName,
|
|
|
|
|
Name = entity.ShortName
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ship.Code = entity.CodeName;
|
|
|
|
|
ship.Name = entity.ShortName;
|
|
|
|
|
ship.ModifyTime = DateTime.Now;
|
|
|
|
|
ship.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeForwarder.UpdateAsync(ship);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -347,7 +476,8 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
it.ATD = item.ATD;
|
|
|
|
|
}
|
|
|
|
|
if (it.YgtETD!=item.YgtETD) {
|
|
|
|
|
if (it.YgtETD != item.YgtETD)
|
|
|
|
|
{
|
|
|
|
|
it.YgtETD = item.YgtETD;
|
|
|
|
|
}
|
|
|
|
|
await _rep.AsUpdateable(it).IgnoreColumns(it => new
|
|
|
|
|