|
|
@ -31,6 +31,7 @@ using System.Net.Http;
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
using System.Reflection.Emit;
|
|
|
|
using System.Reflection.Emit;
|
|
|
|
using Myshipping.Application.Service.DataSync.Dto;
|
|
|
|
using Myshipping.Application.Service.DataSync.Dto;
|
|
|
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Application
|
|
|
|
namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -58,13 +59,16 @@ namespace Myshipping.Application
|
|
|
|
private readonly SqlSugarRepository<BookingGoodsStatusConfig> _goodsStatusConfig;
|
|
|
|
private readonly SqlSugarRepository<BookingGoodsStatusConfig> _goodsStatusConfig;
|
|
|
|
private readonly SqlSugarRepository<DjyTenantLine> _repline;
|
|
|
|
private readonly SqlSugarRepository<DjyTenantLine> _repline;
|
|
|
|
private readonly SqlSugarRepository<MappingCarrier> _mapcarrier;
|
|
|
|
private readonly SqlSugarRepository<MappingCarrier> _mapcarrier;
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<CodeLane> _codeLaneRep;
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<CodePort> _codePortRep;
|
|
|
|
|
|
|
|
|
|
|
|
public DataSyncService(ILogger<DataSyncService> logger, ISysCacheService cache, SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn,
|
|
|
|
public DataSyncService(ILogger<DataSyncService> logger, ISysCacheService cache, SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn,
|
|
|
|
SqlSugarRepository<SysUser> repUser, SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<DjyCustomer> djycustomer,
|
|
|
|
SqlSugarRepository<SysUser> repUser, SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<DjyCustomer> djycustomer,
|
|
|
|
SqlSugarRepository<DjyCustomerContact> djycustomercontact, SqlSugarRepository<DjyVesselInfo> vesselinfo, SqlSugarRepository<BookingCtnDetail> ctndetailrep
|
|
|
|
SqlSugarRepository<DjyCustomerContact> djycustomercontact, SqlSugarRepository<DjyVesselInfo> vesselinfo, SqlSugarRepository<BookingCtnDetail> ctndetailrep
|
|
|
|
, SqlSugarRepository<BookingEDIExt> bookingEDIExt, SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail,
|
|
|
|
, SqlSugarRepository<BookingEDIExt> bookingEDIExt, SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail,
|
|
|
|
SqlSugarRepository<BookingGoodsStatus> goodsStatus, SqlSugarRepository<BookingGoodsStatusConfig> goodsStatusConfig, SqlSugarRepository<DjyTenantLine> repline,
|
|
|
|
SqlSugarRepository<BookingGoodsStatus> goodsStatus, SqlSugarRepository<BookingGoodsStatusConfig> goodsStatusConfig, SqlSugarRepository<DjyTenantLine> repline,
|
|
|
|
SqlSugarRepository<BookingRemark> bookingremark, SqlSugarRepository<MappingCarrier> mapcarrier)
|
|
|
|
SqlSugarRepository<BookingRemark> bookingremark, SqlSugarRepository<MappingCarrier> mapcarrier,
|
|
|
|
|
|
|
|
SqlSugarRepository<CodePort> codePortRep, SqlSugarRepository<CodeLane> codeLaneRep)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this._logger = logger;
|
|
|
|
this._logger = logger;
|
|
|
|
this._rep = rep;
|
|
|
|
this._rep = rep;
|
|
|
@ -84,6 +88,8 @@ namespace Myshipping.Application
|
|
|
|
this._goodsStatusConfig = goodsStatusConfig;
|
|
|
|
this._goodsStatusConfig = goodsStatusConfig;
|
|
|
|
this._repline = repline;
|
|
|
|
this._repline = repline;
|
|
|
|
this._mapcarrier = mapcarrier;
|
|
|
|
this._mapcarrier = mapcarrier;
|
|
|
|
|
|
|
|
this._codePortRep = codePortRep;
|
|
|
|
|
|
|
|
this._codeLaneRep = codeLaneRep;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1314,7 +1320,7 @@ namespace Myshipping.Application
|
|
|
|
if (item.BookingEDIExt != null)
|
|
|
|
if (item.BookingEDIExt != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//检索EDI扩展
|
|
|
|
//检索EDI扩展
|
|
|
|
var ediExtEntity = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == fdmain.Id).FirstAsync();
|
|
|
|
var ediExtEntity = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == fdmain.Id).FirstAsync();
|
|
|
|
|
|
|
|
|
|
|
|
if (ediExtEntity == null)
|
|
|
|
if (ediExtEntity == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1572,6 +1578,59 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 航线上传同步
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpPost("/DataSync/SyncLine"), ApiUser(ApiCode = "SyncLine")]
|
|
|
|
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
|
|
|
|
public async Task SyncLine(LineSyncDto dto)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var idList = dto.DataList.Select(x => x.Code).ToList();
|
|
|
|
|
|
|
|
var laneList = _codeLaneRep.Where(x => idList.Contains(x.Code)).ToList();
|
|
|
|
|
|
|
|
if (dto.Type == "save")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var dtoLine in dto.DataList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var lane = laneList.FirstOrDefault(x => x.Code == dtoLine.Code);
|
|
|
|
|
|
|
|
if (lane != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
lane.EnName = dtoLine.Name;
|
|
|
|
|
|
|
|
lane.CnName = dtoLine.Name;
|
|
|
|
|
|
|
|
lane.ModifyTime = DateTime.Now;
|
|
|
|
|
|
|
|
lane.ModifyUser = UserManager.Name;
|
|
|
|
|
|
|
|
await _codeLaneRep.UpdateAsync(lane);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
lane = new CodeLane();
|
|
|
|
|
|
|
|
lane.GID = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
lane.Code = dtoLine.Code;
|
|
|
|
|
|
|
|
lane.EnName = dtoLine.Name;
|
|
|
|
|
|
|
|
lane.CnName = dtoLine.Name;
|
|
|
|
|
|
|
|
lane.LaneType = "SEA";
|
|
|
|
|
|
|
|
lane.CreateTime = DateTime.Now;
|
|
|
|
|
|
|
|
lane.CreateUser = UserManager.Name;
|
|
|
|
|
|
|
|
await _codeLaneRep.InsertAsync(lane);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (dto.Type == "del")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var lane in laneList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await _codeLaneRep.DeleteAsync(lane);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah($"同步类型无效:{dto.Type}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 下载数据
|
|
|
|
#region 下载数据
|
|
|
|