From 7a32d4bb2dd7a033e95e916ae09bcaf60c3961b6 Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Mon, 10 Apr 2023 16:33:43 +0800 Subject: [PATCH] 111 --- .../Service/DataSync/DataSyncService.cs | 49 ++++++++++++++++--- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index 3f58422f..8f363cea 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -395,6 +395,7 @@ namespace Myshipping.Application public async Task SyncBookingList(List list) { List 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(); @@ -480,9 +481,17 @@ namespace Myshipping.Application { entity.FORWARDERID = djycustomer.Where(x => x.ShortName == entity.FORWARDER && x.PropString == "booking_agent").Select(x => x.CodeName).FirstOrDefault(); } - if (!string.IsNullOrEmpty(entity.CARRIERID)) + if (!string.IsNullOrEmpty(entity.CARRIER)) { - entity.CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == entity.CARRIERID).Select(x => x.CnName).FirstOrDefault(); + entity.CARRIERID = _cache.GetAllCodeCarrier().Result.Where(x => x.CnName == entity.CARRIER).Select(x => x.Code).FirstOrDefault(); + + if (string.IsNullOrEmpty(entity.CARRIERID)) + { + + entity.CARRIERID = mapcarrier.Where(x => x.MapName == entity.CARRIER).Select(x => x.Code).FirstOrDefault(); + } + + } if (!string.IsNullOrEmpty(entity.LineName)) { @@ -632,6 +641,18 @@ namespace Myshipping.Application { fdentity.CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == fdentity.CARRIERID).Select(x => x.CnName).FirstOrDefault(); + } + if (!string.IsNullOrEmpty(fdentity.CARRIER)) + { + fdentity.CARRIERID = _cache.GetAllCodeCarrier().Result.Where(x => x.CnName == fdentity.CARRIER).Select(x => x.Code).FirstOrDefault(); + + if (string.IsNullOrEmpty(fdentity.CARRIERID)) + { + + fdentity.CARRIERID = mapcarrier.Where(x => x.MapName == fdentity.CARRIER).Select(x => x.Code).FirstOrDefault(); + } + + } if (!string.IsNullOrEmpty(item.LineName)) { @@ -881,9 +902,17 @@ namespace Myshipping.Application { entity.FORWARDERID = djycustomer.Where(x => x.ShortName == entity.FORWARDER && x.PropString == "booking_agent").Select(x => x.CodeName).FirstOrDefault(); } - if (!string.IsNullOrEmpty(entity.CARRIERID)) + if (!string.IsNullOrEmpty(entity.CARRIER)) { - entity.CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == entity.CARRIERID).Select(x => x.CnName).FirstOrDefault(); + entity.CARRIERID = _cache.GetAllCodeCarrier().Result.Where(x => x.CnName == entity.CARRIER).Select(x => x.Code).FirstOrDefault(); + + if (string.IsNullOrEmpty(entity.CARRIERID)) + { + + entity.CARRIERID = mapcarrier.Where(x => x.MapName == entity.CARRIER).Select(x => x.Code).FirstOrDefault(); + } + + } if (!string.IsNullOrEmpty(entity.LineName)) @@ -1186,9 +1215,17 @@ namespace Myshipping.Application { fdentity.FORWARDERID = djycustomer.Where(x => x.ShortName == fdentity.FORWARDER && x.PropString == "booking_agent").Select(x => x.CodeName).FirstOrDefault(); } - if (!string.IsNullOrEmpty(fdentity.CARRIERID)) + if (!string.IsNullOrEmpty(fdentity.CARRIER)) { - fdentity.CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == fdentity.CARRIERID).Select(x => x.CnName).FirstOrDefault(); + fdentity.CARRIERID = _cache.GetAllCodeCarrier().Result.Where(x => x.CnName == fdentity.CARRIER).Select(x => x.Code).FirstOrDefault(); + + if (string.IsNullOrEmpty(fdentity.CARRIERID)) + { + + fdentity.CARRIERID = mapcarrier.Where(x => x.MapName == fdentity.CARRIER).Select(x => x.Code).FirstOrDefault(); + } + + } if (!string.IsNullOrEmpty(fdentity.LineName)) {