using DS.Module.Core;
using DS.Module.Core.Constants;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.Module.Core.Log;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
using Mapster;
using Masuit.Tools;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
namespace DS.WMS.Core.Sys.Method;
public class ClientCommonService : IClientCommonService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ISaasDbService saasService;
///
///
///
///
public ClientCommonService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService();
user = _serviceProvider.GetRequiredService();
saasService = _serviceProvider.GetRequiredService();
}
internal ISugarQueryable DicQueryable(string typeCode, string queryKey)
{
return db.Queryable().InnerJoin((d, t) => d.TypeId == t.Id)
.Where((d, t) => t.Code == typeCode)
.WhereIF(!string.IsNullOrEmpty(queryKey), (d, t) => d.Name.Contains(queryKey));
}
///
/// 获取服务项目下拉数据
///
/// 业务类型
/// 搜索关键词
///
public async Task>> GetServiceItemAsync(BusinessType businessType, string? queryKey = null)
{
string typeCode;
switch (businessType)
{
case BusinessType.OceanShippingExport:
typeCode = "se-service-item";
break;
default:
typeCode = "N/A";
break;
}
var list = await DicQueryable(typeCode, queryKey).Select(d => new SelectListItem
{
Text = d.Name,
Value = d.Value
}).ToListAsync();
var result = DataResult>.Success(list);
result.Count = list.Count;
return result;
}
///
/// 根据五字码获取港口信息-客户端
///
///
public async Task> GetClientPortInfoByCode(string queryKey = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = await tenantDb.Queryable()
.Where(x => x.Status == StatusEnum.Enable && x.EdiCode == queryKey.Trim())
.Select()
.FirstAsync();
return await Task.FromResult(DataResult.Success("获取数据成功!", data));
}
///
/// 获取航线操作员列表
///
///
public async Task>> GetLaneUserList(string queryKey = "")
{
var data = await db.Queryable()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsLaner == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.PinYinCode.Contains(queryKey) || a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey))
.Select()
.Take(20)
.WithCache($"{SqlSugarCacheConst.User}{user.TenantId}")
.ToListAsync();
return await Task.FromResult(DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess));
}
///
/// 获取委托单位下拉列表
///
///
public async Task>> GetControllerClientListByKey(string queryKey = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var orglist = db.Queryable().ToList();
var data = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsController == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), (a, b) => a.CodeName.Contains(queryKey) || a.ShortName.Contains(queryKey) || a.Description.Contains(queryKey))
.Select((a, b) => new ControllerClientRes
{
Id = a.Id,
PinYinCode = a.ShortName + "(" + a.CodeName + ")",
//SaleOrgName = string.IsNullOrEmpty(a.SaleOrgId) ? "": orglist.Where(x=>x.Id == long.Parse(a.SaleOrgId)).FirstOrDefault().OrgName
}, true
)
.Mapper(it =>
{
it.ClientContact = tenantDb.Queryable().Where(x => x.ClientId == it.Id && x.Status == StatusEnum.Enable && x.IsDefault == true)
.Select().First();
})
.Take(20).WithCache($"{SqlSugarCacheConst.InfoClient}{user.TenantId}").ToListAsync();
return await Task.FromResult(DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess));
}
///
/// 获取船公司下拉列表
///
///
public async Task>> GetCarrierSelectList(string queryKey = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = await tenantDb.Queryable()
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.Code.Contains(queryKey) || a.CnName.Contains(queryKey))
.Select(a => new CodeCarrierRes()
{
PinYinCode = a.Code + "(" + a.CnName + ")",
},
true)
.OrderBy(a => a.Code)
.Take(20)
.WithCache($"{SqlSugarCacheConst.Carrier}{user.TenantId}")
.ToListAsync();
return await Task.FromResult(DataResult>.Success("获取数据成功!", list));
}
///
/// 获取约号下拉列表-客户端
///
///
public async Task>> GetBookingContractNoList(string queryKey = "", long carrierId = 0)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = await tenantDb.Queryable()
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.ContractNo.Contains(queryKey) || a.ContractName.Contains(queryKey))
.WhereIF(carrierId != 0, a => a.CarrierId == carrierId)
.Select()
.Take(20)
.WithCache($"{SqlSugarCacheConst.ContractNo}{user.TenantId}")
.ToListAsync();
return await Task.FromResult(DataResult>.Success("获取数据成功!", list));
}
///
/// 获取商品下拉列表-客户端
///
///
public async Task>> GetClientGoodsList(string queryKey = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = await tenantDb.Queryable().Where(a => a.Status == StatusEnum.Enable)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.GoodsCode.Contains(queryKey) || a.GoodName.Contains(queryKey))
.Select(a => new CodeGoodsSelectRes()
{
PinYinCode = a.GoodName + "(" + a.GoodsCode + ")",
},
true)
.Take(20)
.WithCache($"{SqlSugarCacheConst.Goods}{user.TenantId}")
.ToListAsync();
return await Task.FromResult(DataResult>.Success("获取数据成功!", list));
}
///
/// 根据id获取往来单位参数信息
///
///
///
public async Task>> GetClientParamListById(string id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = await tenantDb.Queryable()
.Where(x => x.CustomerId == long.Parse(id) && x.Status == StatusEnum.Enable)
.Select()
.ToListAsync();
return await Task.FromResult(DataResult>.Success(data));
}
///
/// 根据用户ids获取用户邮箱信息
///
///
///
public async Task>> GetUseEmailListByIds(long[] ids)
{
var data = await db.Queryable()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && ids.Contains(a.Id))
.Select()
.Take(20)
.WithCache($"{SqlSugarCacheConst.User}{user.TenantId}")
.ToListAsync();
return await Task.FromResult(DataResult>.Success(data));
}
///
/// 根据类型获取用户下拉列表
///
///
public async Task>> GetUserListByCode(string code, string queryKey = "")
{
code = code.ToLower();
var data = await db.Queryable()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt())
.WhereIF(code == "operator", a => a.IsOperator == true)
.WhereIF(code == "doc", a => a.IsVouchingClerk == true)
.WhereIF(code == "sale", a => a.IsSale == true)
.WhereIF(code == "custom", a => a.IsCustom == true)
.WhereIF(code == "finance", a => a.IsFinancialStaff == true)
.WhereIF(code == "service", a => a.IsCustomerService == true)
.WhereIF(code == "driver", a => a.IsDriver == true)
.WhereIF(code == "dispatcher", a => a.IsDispatcher == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.PinYinCode.Contains(queryKey) || a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey))
.Select(a => new ApiSelectViewModel
{
Label = a.PinYinCode,
Value = a.Id,
})
.Take(20)
.WithCache($"{SqlSugarCacheConst.User}{user.TenantId}")
.ToListAsync();
return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
///
/// 获取工厂信息下拉列表-客户端
///
///
public DataResult> GetFactorySelectList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = tenantDb.Queryable()
.Where(x => x.Status == StatusEnum.Enable)
.Select()
.ToList();
return DataResult>.Success("获取数据成功!", list);
}
#region 根据单位获取数量箱型信息
///
/// 根据单位获取数量箱型信息
///
///
public DataResult GetUnitSelectInfo(UnitSelectInfoReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//var data = new ClientSelectInfoRes();
if (req.BusinessType == BusinessType.OceanShippingExport)
{
var info = tenantDb.Queryable().First(x => x.Id == req.BusinessId);
if (info.IsNull())
{
return DataResult.Failed("业务信息不存在!");
}
var ctns = tenantDb.Queryable().Where(x => x.BSNO == req.BusinessId.ToString()).ToList();
var dictvalue = db.Queryable().InnerJoin((a, b) => a.TypeId == b.Id)
.Where((a, b) => b.Code == "fee_unit").Select((a, b) => a.Value).ToList();
if (dictvalue.Where(x => x == req.Code).Any())
{
var data = GetSeaExportUnit(info, req.Code);
return DataResult.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
else
{
var codeCtns = tenantDb.Queryable().Where(x => x.Status == StatusEnum.Enable).ToList();
if (codeCtns.Where(x => x.CtnName == req.Code).Any())
{
//var data = GetSeaExportCtnsUnit(ctns, codeCtns, req.Code);
var codeCtn = codeCtns.First(x => x.CtnName == req.Code);
var ctns1 = ctns.Where(x => x.Ctn == req.Code).ToList();
var data = new UnitSelectInfoRes();
data.Code = req.Code;
data.Quantity = ctns1.Sum(x => x.CtnNum);
data.TEU = (int)data.Quantity * (int)codeCtn.TEU;
data.CtnTotalNum = ctns.Sum(x => x.CtnNum);
return DataResult.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
else
{
return DataResult.Failed("没有维护该箱型的集装箱信息!");
}
}
}
else
{
return DataResult.Failed("非法业务类型");
}
}
private UnitSelectInfoRes GetSeaExportUnit(SeaExport seaExport, string code)
{
var data = new UnitSelectInfoRes();
data.Code = code;
switch (code)
{
case "P"://单票
data.Quantity = 1;
break;
case "Z"://重量
data.Quantity = seaExport.KGS;
break;
case "C"://尺码
data.Quantity = seaExport.CBM;
break;
case "J"://件数
data.Quantity = seaExport.PKGS;
break;
case "JF"://计费吨
data.Quantity = seaExport.KGS / 1000 > seaExport.CBM ? seaExport.KGS / 1000 : seaExport.CBM;
break;
//默认
default:
data.Quantity = 0;
break;
}
return data;
}
#endregion
#region 根据类型获取往来单位下拉及业务信息列表
///
/// 根据类型获取往来单位下拉及业务信息列表
///
///
public DataResult GetClientSelectInfoByCode(ClientSelectInfoReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//var data = new ClientSelectInfoRes();
var code = req.Code.ToLower();
var list = tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt())
//.WhereIF(code == "carrier", (a, b) => b.IsCarrier == true)
.WhereIF(code == "yard", (a, b) => b.IsYard == true)
.WhereIF(code == "booking", (a, b) => b.IsBooking == true)
.WhereIF(code == "truck", (a, b) => b.IsTruck == true)
.WhereIF(code == "controller", (a, b) => b.IsController == true)
.WhereIF(code == "custom", (a, b) => b.IsCustom == true)
.WhereIF(code == "agent", (a, b) => b.IsAgent == true)
.WhereIF(code == "agentcn", (a, b) => b.IsAgentCn == true)
.WhereIF(code == "express", (a, b) => b.IsExpress == true)
.WhereIF(code == "airlines", (a, b) => b.IsAirLines == true)
.WhereIF(code == "shipper", (a, b) => b.IsShipper == true)
.WhereIF(code == "shippercn", (a, b) => b.IsShipperCn == true)
.WhereIF(code == "notifyparty", (a, b) => b.IsNotifyParty == true)
.WhereIF(code == "warehouse", (a, b) => b.IsWareHouse == true)
.WhereIF(code == "wharf", (a, b) => b.IsWharf == true)
.WhereIF(code == "insurer", (a, b) => b.IsInsurer == true)
.WhereIF(code == "leasing", (a, b) => b.IsLeasing == true)
.WhereIF(code == "tradingagency", (a, b) => b.IsTradingAgency == true)
.WhereIF(code == "shipagency", (a, b) => b.IsShipAgency == true)
.WhereIF(code == "enterprise", (a, b) => b.IsEnterprise == true)
.WhereIF(code == "contract", (a, b) => b.IsContract == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent,
}
)
.Mapper(it =>
{
it.ClientContact = tenantDb.Queryable().Where(x => x.ClientId == it.Id && x.Status == StatusEnum.Enable && x.IsDefault == true)
.Select().First();
}).ToList();
if (req.BusinessType == BusinessType.OceanShippingExport)
{
var info = tenantDb.Queryable().First(x => x.Id == req.BusinessId);
if (info.IsNull())
{
return DataResult.Failed("业务信息不存在!");
}
var data = GetSeaExportClientInfo(info, code);
data.ClientList = list;
return DataResult.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
else
{
return DataResult.Failed("非法业务类型");
}
}
private ClientSelectInfoRes GetSeaExportClientInfo(SeaExport seaExport, string code)
{
var data = new ClientSelectInfoRes();
switch (code)
{
case "carrier":
data.ClientId = seaExport.CarrierId;
data.ClientName = seaExport.Carrier;
break;
case "yard":
data.ClientId = seaExport.YardId;
data.ClientName = seaExport.Yard;
break;
case "booking":
data.ClientId = seaExport.ForwarderId;
data.ClientName = seaExport.Forwarder;
break;
case "truck":
data.ClientId = seaExport.TruckerId;
data.ClientName = seaExport.Trucker;
break;
case "controller":
data.ClientId = seaExport.CustomerId;
data.ClientName = seaExport.CustomerName;
break;
case "custom":
data.ClientId = seaExport.CustomserId;
data.ClientName = seaExport.Customser;
break;
case "agent":
data.ClientId = seaExport.AgentId;
data.ClientName = seaExport.Agent;
break;
case "warehouse":
data.ClientId = seaExport.WareHouseId;
data.ClientName = seaExport.WareHouse;
break;
case "agentcn":
break;
case "express":
break;
case "airlines":
break;
case "wharf":
break;
case "insurer":
break;
case "leasing":
break;
case "enterprise":
data.ClientId = (long)seaExport.EnterpriseId;
data.ClientName = seaExport.Enterprise;
break;
case "shipper":
data.ClientId = (long)seaExport.ShipperId;
data.ClientName = seaExport.Shipper;
break;
case "shippercn":
data.ClientId = (long)seaExport.ShipperCnId;
data.ClientName = seaExport.ShipperCn;
break;
case "notifyparty":
data.ClientId = (long)seaExport.NotifyPartyId;
data.ClientName = seaExport.NotifyParty;
break;
case "tradingagency":
break;
case "shipagency":
data.ClientId = seaExport.ShipAgencyId;
data.ClientName = seaExport.ShipAgency;
break;
//默认
default:
break;
}
return data;
}
#endregion
#region 获取往来单位下拉集合列表
///
/// 获取往来单位下拉集合列表
///
///
public async Task>> GetMultiClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = new List();
var carrier = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsCarrier == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
})
.Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
})
.ToListAsync();
data.Add(new ClientSelectMultiRes("carrier", carrier));
var yard = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsYard == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
)
.Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("yard", yard));
var booking = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsBooking == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("booking", booking));
var truck = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsTruck == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("truck", truck));
var controller = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsController == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("controller", controller));
var custom = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsCustom == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("custom", custom));
var agent = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsAgent == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("agent", agent));
var agentcn = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsAgentCn == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("agentcn", agentcn));
var express = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsExpress == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("express", express));
var airlines = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsAirLines == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("airlines", airlines));
var shipper = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsShipper == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("shipper", shipper));
var shippercn = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsShipperCn == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("shippercn", shippercn));
var notifyparty = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsNotifyParty == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("notifyparty", notifyparty));
var warehouse = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsWareHouse == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("warehouse", warehouse));
var wharf = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsWharf == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("wharf", wharf));
var insurer = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsInsurer == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("insurer", insurer));
var leasing = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsLeasing == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("leasing", leasing));
var tradingagency = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsTradingAgency == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("tradingagency", tradingagency));
var shipagency = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsShipAgency == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("shipagency", shipagency));
var enterprise = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsEnterprise == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent
}
).Mapper(it =>
{
it.ClientParams = tenantDb.Queryable()
.Where(x => x.CustomerId == it.Id && x.Status == StatusEnum.Enable)
.Select()
.ToList();
}).ToListAsync();
data.Add(new ClientSelectMultiRes("enterprise", enterprise));
return await Task.FromResult(DataResult>.Success(data));
}
#endregion
///
/// 提取汇率信息
///
///
///
public DataResult GetBusinessCurrencyExchangeInfo(BusinessCurrencyExchangeReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
DateTime rateDate;
var data = new BusinessCurrencyExchangeRes();
var opConfig = tenantDb.Queryable().Where(x => x.Status == StatusEnum.Enable && x.Code == "ExchangeRateType").First();
if (opConfig.IsNotNull())
{
#region 根据分公司配置参数
if (req.BusinessType == BusinessType.OceanShippingExport)
{
var order = tenantDb.Queryable().First(x => x.Id == req.BusinessId);
if (opConfig.Value == "ETD")
{
if (order.ETD.IsNull())
{
return DataResult.Failed("订单开船日期不能为空!");
}
var feeRate = tenantDb.Queryable().First(x => x.CurrencyCode == req.CurrencyCode && order.ETD >= x.StartDate && order.ETD <= x.EndDate);
if (feeRate.IsNull())
{
return DataResult.Failed("订单开船日期在币别设置的汇率不存在!");
}
feeRate.Adapt(data);
return DataResult.Success(data);
}
else if (opConfig.Value == "AccountDate")
{
if (order.AccountDate.IsNull())
{
return DataResult.Failed("订单会计期间不能为空!");
}
//var accountDateTime = DateTime.Parse(order.AccountDate +"-01");
if (DateTime.TryParse(order.AccountDate + "-01", out rateDate))
{
// 转换成功,可以使用date变量
var feeRate = tenantDb.Queryable().First(x => x.CurrencyCode == req.CurrencyCode && rateDate >= x.StartDate && rateDate <= x.EndDate);
if (feeRate.IsNull())
{
return DataResult.Failed("订单会计期间在币别设置的汇率不存在!");
}
feeRate.Adapt(data);
return DataResult.Success(data);
}
else
{
// 转换失败,处理错误情况
return DataResult.Failed("订单会计期间不正确!");
}
}
else if (opConfig.Value == "CreateTime")
{
if (order.CreateTime.IsNull())
{
return DataResult.Failed("订单录入时间不能为空!");
}
var feeRate = tenantDb.Queryable().First(x => x.CurrencyCode == req.CurrencyCode && order.CreateTime >= x.StartDate && order.CreateTime <= x.EndDate);
if (feeRate.IsNull())
{
return DataResult.Failed("订单录入时间在币别设置的汇率不存在!");
}
feeRate.Adapt(data);
return DataResult.Success(data);
}
else
{
return DataResult.Failed("非法参数类型,请联系管理员!");
}
}
else
{
return DataResult.Failed("非法业务类型,请联系管理员!");
}
#endregion
}
else
{
#region 根据系统配置参数
var sysConfig = tenantDb.Queryable().Where(x => x.Status == StatusEnum.Enable && x.Code == "ExchangeRateType").First();
if (sysConfig.IsNotNull())
{
if (req.BusinessType == BusinessType.OceanShippingExport)
{
var order = tenantDb.Queryable().First(x => x.Id == req.BusinessId);
if (sysConfig.Value == "ETD")
{
if (order.ETD.IsNull())
{
return DataResult.Failed("订单开船日期不能为空!");
}
var feeRate = tenantDb.Queryable().First(x => x.CurrencyCode == req.CurrencyCode && order.ETD >= x.StartDate && order.ETD <= x.EndDate);
if (feeRate.IsNull())
{
return DataResult.Failed("订单开船日期在币别设置的汇率不存在!");
}
feeRate.Adapt(data);
return DataResult.Success(data);
}
else if (sysConfig.Value == "AccountDate")
{
if (order.AccountDate.IsNull())
{
return DataResult.Failed("订单会计期间不能为空!");
}
//var accountDateTime = DateTime.Parse(order.AccountDate +"-01");
if (DateTime.TryParse(order.AccountDate + "-01", out rateDate))
{
// 转换成功,可以使用date变量
var feeRate = tenantDb.Queryable().First(x => x.CurrencyCode == req.CurrencyCode && rateDate >= x.StartDate && rateDate <= x.EndDate);
if (feeRate.IsNull())
{
return DataResult.Failed("订单会计期间在币别设置的汇率不存在!");
}
feeRate.Adapt(data);
return DataResult.Success(data);
}
else
{
// 转换失败,处理错误情况
return DataResult.Failed("订单会计期间不正确!");
}
}
else if (sysConfig.Value == "CreateTime")
{
if (order.CreateTime.IsNull())
{
return DataResult.Failed("订单录入时间不能为空!");
}
var feeRate = tenantDb.Queryable().First(x => x.CurrencyCode == req.CurrencyCode && order.CreateTime >= x.StartDate && order.CreateTime <= x.EndDate);
if (feeRate.IsNull())
{
return DataResult.Failed("订单录入时间在币别设置的汇率不存在!");
}
feeRate.Adapt(data);
return DataResult.Success(data);
}
else
{
return DataResult.Failed("非法参数类型,请联系管理员!");
}
}
else
{
return DataResult.Failed("非法业务类型,请联系管理员!");
}
}
else
{
//无系统参数按开船日期取汇率
if (req.BusinessType == BusinessType.OceanShippingExport)
{
var order = tenantDb.Queryable().First(x => x.Id == req.BusinessId);
if (order.ETD.IsNull())
{
return DataResult.Failed("订单开船日期不能为空!");
}
var feeRate = tenantDb.Queryable().First(x => x.CurrencyCode == req.CurrencyCode && order.ETD >= x.StartDate && order.ETD <= x.EndDate);
if (feeRate.IsNull())
{
return DataResult.Failed("订单开船日期在币别设置的汇率不存在!");
}
feeRate.Adapt(data);
return DataResult.Success(data);
}
else
{
return DataResult.Failed("非法业务类型,请联系管理员!");
}
}
#endregion
}
}
///
/// 获取揽货人信息
///
///
public DataResult> GetSaleList(string queryKey = "")
{
var list = db.Queryable().Where(x => x.Status == StatusEnum.Enable.ToEnumInt() && x.IsSale == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.PinYinCode.Contains(queryKey) || a.UserCode.Contains(queryKey) || a.UserName.Contains(queryKey))
.Select()
.Take(20)
.WithCache($"{SqlSugarCacheConst.User}{user.TenantId}")
.ToList();
if (list.Count > 0)
{
foreach (var item in list)
{
var orgs = db.Queryable().Filter(null, true)
.InnerJoin((a, b) => a.OrgId == b.Id && b.IsDepartment == false)
.Where(a => a.UserId == item.Id)
.Select((a, b) => new OrgList
{
OrgId = (long)a.OrgId,
OrgName = b.OrgName
})
.ToList();
item.SaleOrgList = orgs;
}
}
return DataResult>.Success(list, MultiLanguageConst.DataQuerySuccess); ;
}
///
/// 获取审核日志列表
///
///
///
public async Task>> GetAuditLogList(string id)
{
var data = await saasService.GetLogDb().Queryable().Filter(null, true)
.Where(a => a.KeyId == long.Parse(id))
.Select()
.ToListAsync();
return await Task.FromResult(DataResult>.Success(data, MultiLanguageConst.DataQuerySuccess));
}
///
/// 获取币别信息下拉选择
///
///
public DataResult> GetFeeCurrencySelectList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable()
.Where(x => x.Status == StatusEnum.Enable)
.Select()
.ToList();
return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
///
/// 获取费用代码下拉选择
///
///
public DataResult> GetFeeCodeSelectList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable()
.Where(x => x.Status == StatusEnum.Enable)
.Select()
.ToList();
return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
///
/// 根据类型获取往来单位下拉列表
///
///
public async Task>> GetClientListByCode(string code = "", string queryKey = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//code = code.ToLower();
var data = await tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt())
.WhereIF(!string.IsNullOrEmpty(code) && code == "carrier", (a, b) => b.IsCarrier == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "yard", (a, b) => b.IsYard == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "booking", (a, b) => b.IsBooking == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "truck", (a, b) => b.IsTruck == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "controller", (a, b) => b.IsController == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "custom", (a, b) => b.IsCustom == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "agent", (a, b) => b.IsAgent == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "agentcn", (a, b) => b.IsAgentCn == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "express", (a, b) => b.IsExpress == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "airlines", (a, b) => b.IsAirLines == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "shipper", (a, b) => b.IsShipper == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "shippercn", (a, b) => b.IsShipperCn == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "notifyparty", (a, b) => b.IsNotifyParty == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "warehouse", (a, b) => b.IsWareHouse == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "wharf", (a, b) => b.IsWharf == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "insurer", (a, b) => b.IsInsurer == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "leasing", (a, b) => b.IsLeasing == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "tradingagency", (a, b) => b.IsTradingAgency == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "shipagency", (a, b) => b.IsShipAgency == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "enterprise", (a, b) => b.IsEnterprise == true)
.WhereIF(!string.IsNullOrEmpty(code) && code == "contract", (a, b) => b.IsContract == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), (a, b) => a.CodeName.Contains(queryKey) || a.ShortName.Contains(queryKey) || a.Description.Contains(queryKey))
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName,
BLContent = a.BLContent,
PinYinCode = a.ShortName + "(" + a.CodeName + ")"
}
).Take(20).WithCache($"{SqlSugarCacheConst.InfoClient}{user.TenantId}").ToListAsync();
return await Task.FromResult(DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess));
}
///
/// 获取所有往来单位下拉列表
///
///
///
///
public DataResult> GetAllClientList(long? id = null, string? type = null)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
List conditions = [];
if (!string.IsNullOrEmpty(type))
{
conditions.Add(new ConditionalModel
{
FieldName = "b.Is" + type.ToUpperCamelCase(),
FieldValue = "1",
CSharpTypeName = "int",
ConditionalType = ConditionalType.Equal
});
}
var data = tenantDb.Queryable().InnerJoin((a, b) => a.Id == b.ClientId)
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt())
.Where(conditions)
.WhereIF(id.GetValueOrDefault() > 0, a => a.Id != id)
.Select(a => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}).ToList();
return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
///
/// 获取船公司下拉列表
///
///
public DataResult> GetCarrierClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsCarrier == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
///
/// 获取场站下拉列表
///
///
public DataResult> GetYardClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsYard == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
///
/// 获取订舱公司下拉列表
///
///
public DataResult> GetBookingClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsBooking == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
///
/// 获取车队下拉列表
///
///
public DataResult> GetTruckClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsTruck == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
///
/// 获取委托单位下拉列表
///
///
public DataResult> GetControllerClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsController == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
///
/// 获取报关行下拉列表
///
///
public DataResult> GetCustomClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsCustom == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
///
/// 获取代理(国外)下拉列表
///
///
public DataResult> GetAgentClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsAgent == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
///
/// 获取代理(国内)下拉列表
///
///
public DataResult> GetAgentCnClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsAgentCn == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
///
/// 获取快递公司下拉列表
///
///
public DataResult> GetExpressClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable()
.InnerJoin((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsExpress == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult