optimize
wet 1 year ago
parent 2f0cd5885f
commit 4da83732f7

@ -276,7 +276,7 @@ namespace Myshipping.Application
{ {
throw Oops.Bah("简称未录入"); throw Oops.Bah("简称未录入");
} }
var m = mlist.Where(x => x.ShortName == item.ShortName).First(); var m = mlist.Where(x => x.ShortName == item.ShortName).FirstOrDefault();
var entity = item.Adapt<DjyCustomer>(); var entity = item.Adapt<DjyCustomer>();
if (m == null) if (m == null)
{ {
@ -310,7 +310,7 @@ namespace Myshipping.Application
if (entity.PropString.Contains("shipagency")) if (entity.PropString.Contains("shipagency"))
{ {
var ship = shiplist.Where(x => x.Code == entity.CodeName).First(); var ship = shiplist.Where(x => x.Code == entity.CodeName).FirstOrDefault();
if (ship == null) if (ship == null)
{ {
@ -375,7 +375,7 @@ namespace Myshipping.Application
if (entity.PropString.Contains("shipagency")) if (entity.PropString.Contains("shipagency"))
{ {
var ship = shiplist.Where(x => x.Code == entity.CodeName).First(); var ship = shiplist.Where(x => x.Code == entity.CodeName).FirstOrDefault();
if (ship == null) if (ship == null)
{ {
@ -421,10 +421,10 @@ namespace Myshipping.Application
public async Task<dynamic> SyncVesselDateList(List<DjyVesselInfoDto> model) public async Task<dynamic> SyncVesselDateList(List<DjyVesselInfoDto> model)
{ {
var mapcarrier = await _mapcarrier.Where(x => x.Module == "HeChuan").ToListAsync(); var mapcarrier = _mapcarrier.Where(x => x.Module == "HeChuan").ToList();
var userlist = _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); var userlist = _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToList();
var mlist = await _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).ToListAsync(); var mlist = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).ToList();
var orderlist= await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); var orderlist= _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToList();
foreach (var item in model) foreach (var item in model)
{ {
@ -433,7 +433,7 @@ namespace Myshipping.Application
throw Oops.Bah("BSNO未录入"); throw Oops.Bah("BSNO未录入");
} }
var m = mlist.Where(x => x.BSNO == item.BSNO).First(); var m = mlist.Where(x => x.BSNO == item.BSNO).FirstOrDefault();
var entity = item.Adapt<DjyVesselInfo>(); var entity = item.Adapt<DjyVesselInfo>();
entity.Vessel = item.Vessel.ToUpper().Trim(); entity.Vessel = item.Vessel.ToUpper().Trim();
if (!string.IsNullOrEmpty(item.CARRIER)) if (!string.IsNullOrEmpty(item.CARRIER))
@ -456,7 +456,7 @@ namespace Myshipping.Application
if (!string.IsNullOrEmpty(item.CreatedUserName)) if (!string.IsNullOrEmpty(item.CreatedUserName))
{ {
entity.CreatedUserId = userlist.Result.Where(x => x.Name == item.CreatedUserName).Select(x => x.Id).FirstOrDefault(); entity.CreatedUserId = userlist.Where(x => x.Name == item.CreatedUserName).Select(x => x.Id).FirstOrDefault();
} }
if (string.IsNullOrEmpty(item.Voyno)) if (string.IsNullOrEmpty(item.Voyno))
{ {
@ -598,12 +598,12 @@ namespace Myshipping.Application
throw Oops.Bah("未录入创建人"); throw Oops.Bah("未录入创建人");
} }
var user = userlist.Where(x => x.Name == model.CreatedUserName.Trim() && x.IsDeleted == false).First(); var user = userlist.Where(x => x.Name == model.CreatedUserName.Trim() && x.IsDeleted == false).FirstOrDefault();
if (user == null) if (user == null)
{ {
throw Oops.Bah($"未匹配到创建人{model.CreatedUserName.Trim()}请联系管理员添加相关用户"); throw Oops.Bah($"未匹配到创建人{model.CreatedUserName.Trim()}请联系管理员添加相关用户");
} }
var order = orderlist.Where(x => x.BSNO == model.BSNO ).First(); var order = orderlist.Where(x => x.BSNO == model.BSNO ).FirstOrDefault();
if (order == null) if (order == null)
@ -687,7 +687,7 @@ namespace Myshipping.Application
} }
if (!string.IsNullOrEmpty(entity.LineName)) if (!string.IsNullOrEmpty(entity.LineName))
{ {
var line = linelist.Where(m => m.LineName.Contains(entity.LineName)).First(); var line = linelist.Where(m => m.LineName.Contains(entity.LineName)).FirstOrDefault();
if (line == null) if (line == null)
{ {
await _repline.InsertAsync(new DjyTenantLine await _repline.InsertAsync(new DjyTenantLine
@ -1678,7 +1678,7 @@ namespace Myshipping.Application
foreach (var item in dto) foreach (var item in dto)
{ {
var model = infolist.Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno).First(); var model = infolist.Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno).FirstOrDefault();
if (model != null) if (model != null)
{ {
model.ETA = item.ETA; model.ETA = item.ETA;
@ -1829,7 +1829,7 @@ namespace Myshipping.Application
foreach (var item in dto) foreach (var item in dto)
{ {
//var model = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno && x.TenantId == UserManager.TENANT_ID).First(); //var model = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno && x.TenantId == UserManager.TENANT_ID).FirstOrDefault();
//model.ETA = item.ETA; //model.ETA = item.ETA;
//model.ETD = item.ETD; //model.ETD = item.ETD;
//model.ATD = item.ATD; //model.ATD = item.ATD;

Loading…
Cancel
Save