You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

900 lines
35 KiB
C#

8 months ago
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.Core.Log;
8 months ago
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;
8 months ago
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
8 months ago
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using System.Collections.Generic;
8 months ago
namespace DS.WMS.Core.Sys.Method;
8 months ago
public class ClientCommonService : IClientCommonService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ISaasDbService saasService;
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public ClientCommonService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
/// <summary>
/// 获取揽货人信息
/// </summary>
/// <returns></returns>
public DataResult<List<SaleSelectListRes>> GetSaleList()
{
var list = db.Queryable<SysUser>().Where(x => x.Status == StatusEnum.Enable.ToEnumInt() && x.IsSale == true)
.Select<SaleSelectListRes>()
.ToList();
if (list.Count > 0)
{
foreach (var item in list)
{
var orgs = db.Queryable<SysOrgUser>().Filter(null, true)
.LeftJoin<SysOrg>((a, b) => a.OrgId == b.Id)
.Where(a => a.UserId == item.Id)
.Select((a, b) => new OrgList
{
OrgId = (long)a.OrgId,
OrgName = b.OrgName
})
.ToList();
item.SaleOrgList = orgs;
}
}
return DataResult<List<SaleSelectListRes>>.Success(list, MultiLanguageConst.DataQuerySuccess); ;
}
/// <summary>
/// 获取审核日志列表
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult<List<AuditLogListRes>> GetAuditLogList(string id)
{
var data = saasService.GetLogDb().Queryable<SysLogAudit>().Filter(null, true)
.Where(a => a.KeyId == long.Parse(id))
.Select<AuditLogListRes>()
.ToList();
return DataResult<List<AuditLogListRes>>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取币别信息下拉选择
/// </summary>
/// <returns></returns>
public DataResult<List<FeeCurrencySelectRes>> GetFeeCurrencySelectList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<FeeCurrency>()
.Where(x=>x.Status == StatusEnum.Enable)
.Select<FeeCurrencySelectRes>()
.ToList();
return DataResult<List<FeeCurrencySelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取费用代码下拉选择
/// </summary>
/// <returns></returns>
public DataResult<List<FeeCodeSelectRes>> GetFeeCodeSelectList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<FeeCode>()
.Where(x => x.Status == StatusEnum.Enable)
.Select<FeeCodeSelectRes>()
.ToList();
return DataResult<List<FeeCodeSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 根据类型获取往来单位下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetClientListByCode(string code = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
8 months ago
code = code.ToLower();
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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 == "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)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取所有往来单位下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetAllClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt())
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
8 months ago
/// <summary>
/// 获取船公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetCarrierClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取场站下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetYardClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取订舱公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetBookingClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取车队下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetTruckClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取委托单位下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetControllerClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取报关行下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetCustomClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取代理(国外)下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetAgentClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取代理(国内)下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetAgentCnClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取快递公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetExpressClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取航空公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetAirLinesClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取发货人下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetShipperClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取收货人下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetConsigneeClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((a, b) => a.Id == b.ClientId)
.Where((a, b) => a.Status == StatusEnum.Enable.ToEnumInt() && b.IsConsignee == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
CodeName = a.CodeName,
ShortName = a.ShortName,
EnShortName = a.EnShortName
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取通知人下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetNotifyPartyClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取仓库下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetWareHouseClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取码头下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetWharfClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取保险公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetInsurerClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取租箱公司下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetLeasingClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取贸易代理下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetTradingAgencyClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取船代下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetShipAgencyClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取经营单位下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetEnterpriseClientList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClient>()
.InnerJoin<InfoClientTag>((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
}
8 months ago
).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
8 months ago
/// <summary>
/// 获取签单方式下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<IssueTypeSelectRes>> GetIssueTypeSelectList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
7 months ago
var data = tenantDb.Queryable<CodeIssueType>()
.Where(a => a.Status == StatusEnum.Enable)
8 months ago
.Select<IssueTypeSelectRes>().ToList();
return DataResult<List<IssueTypeSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取集装箱下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<CodeCtnSelectRes>> GetCtnSelectList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<CodeCtn>()
.Where(a => a.Status == StatusEnum.Enable)
.Select<CodeCtnSelectRes>().ToList();
return DataResult<List<CodeCtnSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
8 months ago
/// <summary>
/// 获取包装类型下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<CodePackageSelectRes>> GetPackageSelectList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<CodePackage>()
.Where(a => a.Status == StatusEnum.Enable)
.Select<CodePackageSelectRes>().ToList();
return DataResult<List<CodePackageSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取船名下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<CodeVesselSelectRes>> GetVesselSelectList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<CodeVessel>()
.Where(a => a.Status == StatusEnum.Enable)
.Select<CodeVesselSelectRes>().ToList();
return DataResult<List<CodeVesselSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取航次下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<CodeVoynoSelectRes>> GetVoynoSelectList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<CodeVoyno>()
.Where(a => a.Status == StatusEnum.Enable)
.Select<CodeVoynoSelectRes>().ToList();
return DataResult<List<CodeVoynoSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取运输条款下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<CodeServiceSelectRes>> GetServiceSelectList()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<CodeService>()
.Where(a => a.Status == StatusEnum.Enable)
.Select<CodeServiceSelectRes>().ToList();
return DataResult<List<CodeServiceSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取部门列表
/// </summary>
/// <param name="orgId">机构id</param>
/// <returns></returns>
public DataResult<List<DeptSelectRes>> GetDeptList(string orgId = "")
{
var list = db.Queryable<SysOrg>()
.WhereIF(orgId.IsNotEmptyOrNull(), a => a.ParentId == long.Parse(orgId))
.Where(a => a.Status == StatusEnum.Enable && a.IsDepartment == true)
.Select<DeptSelectRes>()
.ToList();
return DataResult<List<DeptSelectRes>>.Success("获取数据成功!", list);
}
/// <summary>
/// 获取操作员列表
/// </summary>
/// <returns></returns>
public DataResult<List<UserSelectRes>> GetOperatorUserList()
{
8 months ago
var data = db.Queryable<SysUser>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsOperator == true)
.Select(a => new UserSelectRes
{
Id = a.Id,
UserCode = a.UserCode,
UserName = a.UserName,
}
8 months ago
).ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
8 months ago
/// <summary>
/// 获取单证员列表
/// </summary>
/// <returns></returns>
public DataResult<List<UserSelectRes>> GetVouchingClerkList()
{
8 months ago
var data = db.Queryable<SysUser>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsVouchingClerk == true)
.Select(a => new UserSelectRes
{
Id = a.Id,
UserCode = a.UserCode,
UserName = a.UserName,
}
8 months ago
).ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取销售员列表
/// </summary>
/// <returns></returns>
public DataResult<List<UserSelectRes>> GetSaleUserList()
{
8 months ago
var data = db.Queryable<SysUser>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsSale == true)
.Select(a => new UserSelectRes
{
Id = a.Id,
UserCode = a.UserCode,
UserName = a.UserName,
}
8 months ago
).ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
8 months ago
/// <summary>
/// 获取报关员列表
/// </summary>
/// <returns></returns>
public DataResult<List<UserSelectRes>> GetCustomUserList()
{
8 months ago
var data = db.Queryable<SysUser>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsCustom == true)
.Select(a => new UserSelectRes
{
Id = a.Id,
UserCode = a.UserCode,
UserName = a.UserName,
}
8 months ago
).ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
8 months ago
/// <summary>
/// 获取财务员列表
/// </summary>
/// <returns></returns>
public DataResult<List<UserSelectRes>> GetFinancialStaffList()
{
8 months ago
var data = db.Queryable<SysUser>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsFinancialStaff == true)
.Select(a => new UserSelectRes
{
Id = a.Id,
UserCode = a.UserCode,
UserName = a.UserName,
}
8 months ago
).ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
8 months ago
/// <summary>
/// 获取客服列表
/// </summary>
/// <returns></returns>
public DataResult<List<UserSelectRes>> GetCustomerServiceList()
{
8 months ago
var data = db.Queryable<SysUser>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsCustomerService == true)
.Select(a => new UserSelectRes
{
Id = a.Id,
UserCode = a.UserCode,
UserName = a.UserName,
}
8 months ago
).ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
8 months ago
/// <summary>
/// 获取司机列表
/// </summary>
/// <returns></returns>
public DataResult<List<UserSelectRes>> GetDiverList()
{
8 months ago
var data = db.Queryable<SysUser>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsDriver == true)
.Select(a => new UserSelectRes
{
Id = a.Id,
UserCode = a.UserCode,
UserName = a.UserName,
}
8 months ago
).ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取派车调度人员列表
/// </summary>
/// <returns></returns>
public DataResult<List<UserSelectRes>> GetDispatcherList()
{
8 months ago
var data = db.Queryable<SysUser>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsDispatcher == true)
.Select(a => new UserSelectRes
{
Id = a.Id,
UserCode = a.UserCode,
UserName = a.UserName,
}
8 months ago
).ToList();
return DataResult<List<UserSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
#region 用户高级查询条件设置
/// <summary>
/// 获取用户高级查询条件设置
/// </summary>
/// <param name="permissionId"></param>
/// <returns></returns>
public DataResult<SysQuerySet> GetUserQuerySet(string permissionId)
{
var info = db.Queryable<SysQuerySet>()
.Where(x => x.UserId == long.Parse(user.UserId) && x.PermissionId == long.Parse(permissionId)).First();
return DataResult<SysQuerySet>.Success(info);
}
/// <summary>
/// 更新用户高级查询条件设置
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult UpdateUserQuerySet(UserQuerySetUpdateReq req)
{
var info = db.Queryable<SysQuerySet>()
.Where(x => x.UserId == long.Parse(user.UserId) && x.PermissionId == req.PermissionId).First();
if (info.IsNull())
{
var entity = new SysQuerySet
{
UserId = long.Parse(user.UserId),
PermissionId = req.PermissionId,
Content = req.Content
};
db.Insertable(entity).ExecuteCommand();
}
else
{
info.Content = req.Content;
db.Updateable(info).ExecuteCommand();
}
return DataResult.Successed("更新成功");
}
#endregion
/// <summary>
/// 获取模块新增信息
/// </summary>
/// <param name="id">权限模块id</param>
/// <returns></returns>
public async Task<DataResult<FormSetCreateRes>> GetFormSetCreateInfoAsync(string id)
{
var res = new FormSetCreateRes();
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//判断有没有自己设置的模板
var ownSet = await tenantDb.Queryable<CodeFormSet>()
.Where(x => x.PermissionId == long.Parse(id) && x.CreateBy == long.Parse(user.UserId))
.Select<FormSetCreateRes>()
.FirstAsync();
if (ownSet != null)
{
return await Task.FromResult(DataResult<FormSetCreateRes>.Success(ownSet));
}
else
{
var publicSet = await tenantDb.Queryable<CodeFormSet>()
.Where(x => x.PermissionId == long.Parse(id))
.Select<FormSetCreateRes>()
.FirstAsync();
if (publicSet != null)
{
return await Task.FromResult(DataResult<FormSetCreateRes>.Success(publicSet));
}
else
{
return await Task.FromResult(DataResult<FormSetCreateRes>.Failed(MultiLanguageConst.FormSetNotExist));
}
}
}
8 months ago
}