船期@改为船期维护人

optimize
wanghaomei 1 year ago
parent e6b40d306c
commit 375e8a4b63

@ -266,7 +266,7 @@ namespace Myshipping.Application
public async Task SyncCustomer(List<DjyCustomerSyncDto> model) public async Task SyncCustomer(List<DjyCustomerSyncDto> model)
{ {
var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var mlist = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync(); var mlist = await _djycustomer.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var shiplist = await _codeForwarder.AsQueryable().ToListAsync(); var shiplist = await _codeForwarder.AsQueryable().ToListAsync();
foreach (var item in model) foreach (var item in model)
{ {
@ -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 = _mapcarrier.Where(x => x.Module == "HeChuan").ToList(); 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).ToList(); var userlist = _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToList();
var mlist = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).ToList(); var mlist = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).ToList();
var orderlist= _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToList(); 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)
{ {
@ -476,7 +476,7 @@ namespace Myshipping.Application
if (!string.IsNullOrEmpty(item.CARRIER) && !string.IsNullOrEmpty(item.Vessel) && (!string.IsNullOrEmpty(item.Voyno) || !string.IsNullOrWhiteSpace(item.VoynoInside))) if (!string.IsNullOrEmpty(item.CARRIER) && !string.IsNullOrEmpty(item.Vessel) && (!string.IsNullOrEmpty(item.Voyno) || !string.IsNullOrWhiteSpace(item.VoynoInside)))
{ {
var order = orderlist.Where(x => x.CARRIERID == item.CARRIERID && x.VESSEL == item.Vessel) var order = orderlist.Where(x => x.CARRIERID == item.CARRIERID && x.VESSEL == item.Vessel)
.WhereIF(!string.IsNullOrEmpty(item.Voyno), x => x.VOYNO == item.Voyno) .WhereIF(!string.IsNullOrEmpty(item.Voyno), x => x.VOYNO == item.Voyno)
.WhereIF(!string.IsNullOrEmpty(item.VoynoInside), x => x.VOYNOINNER == item.VoynoInside).ToList(); .WhereIF(!string.IsNullOrEmpty(item.VoynoInside), x => x.VOYNOINNER == item.VoynoInside).ToList();
@ -584,7 +584,7 @@ namespace Myshipping.Application
var userlist = await _repUser.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).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 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(); var goodsconfig = await _goodsStatusConfig.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false&& x.TenantId == UserManager.TENANT_ID).ToListAsync(); var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
var linelist = await _repline.AsQueryable().Filter(null, true).Where(m => m.TenantId == UserManager.TENANT_ID).ToListAsync(); var linelist = await _repline.AsQueryable().Filter(null, true).Where(m => m.TenantId == UserManager.TENANT_ID).ToListAsync();
foreach (var model in list) foreach (var model in list)
@ -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).FirstOrDefault(); 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 ).FirstOrDefault(); 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)).FirstOrDefault(); 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
@ -1674,12 +1674,12 @@ namespace Myshipping.Application
public async Task SaveSyncVesselDate(List<DjyVesselDto> dto) public async Task SaveSyncVesselDate(List<DjyVesselDto> dto)
{ {
var infolist = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).ToList(); var infolist = _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 = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
foreach (var item in dto) foreach (var item in dto)
{ {
var model = infolist.Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno).FirstOrDefault(); 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;
model.YgtETD = item.ETD; model.YgtETD = item.ETD;
@ -1825,7 +1825,7 @@ namespace Myshipping.Application
[SqlSugarUnitOfWork] [SqlSugarUnitOfWork]
public async Task SaveSyncGHVesselDate(List<DjyVesselGHDto> dto) public async Task SaveSyncGHVesselDate(List<DjyVesselGHDto> dto)
{ {
var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync(); var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
foreach (var item in dto) foreach (var item in dto)
{ {
@ -2187,14 +2187,17 @@ namespace Myshipping.Application
var usrList = _repUser.AsQueryable().Filter(null, true).Where(u => u.TenantId == tenantId && !u.IsDeleted).ToList(); var usrList = _repUser.AsQueryable().Filter(null, true).Where(u => u.TenantId == tenantId && !u.IsDeleted).ToList();
Dictionary<string, List<string>> dic = new Dictionary<string, List<string>>(); Dictionary<string, List<string>> dic = new Dictionary<string, List<string>>();
//遍历船名航次,查询订舱数据 //遍历船名航次,查询船期维护人
foreach (var item in dto) foreach (var item in dto)
{ {
var boUserList = _rep.AsQueryable().Filter(null, true).Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno && (x.ParentId == 0 || x.ParentId == null) && !x.IsDeleted && x.TenantId == tenantId) var veUserList = _vesselinfo.AsQueryable().Filter(null, true)
.Select(x => x.CreatedUserId).ToList(); .Where(v => v.TenantId == tenantId && v.Vessel == item.Vessel && v.Voyno == item.Voyno && !v.IsDeleted)
if (boUserList.Count > 0) .Select(x => x.CreatedUserId)
.ToList();
if (veUserList.Count > 0)
{ {
var phoneList = usrList.Where(u => boUserList.Contains(u.Id) && u.Phone != "" && u.Phone != null).Select(x => x.Phone).ToList(); var phoneList = usrList.Where(u => veUserList.Contains(u.Id) && u.Phone != "" && u.Phone != null).Select(x => x.Phone).ToList();
foreach (var phone in phoneList) foreach (var phone in phoneList)
{ {

Loading…
Cancel
Save