获取所有往来单位下拉列表,增加查询参数

usertest
嵇文龙 3 months ago
parent aad5b2322d
commit ab7fbaabad

@ -117,8 +117,10 @@ public interface IClientCommonService
/// <summary>
/// 获取所有往来单位下拉列表
/// </summary>
/// <param name="id"></param>
/// <param name="type"></param>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetAllClientList();
public DataResult<List<ClientSelectRes>> GetAllClientList(long? id = null, string? type = null);
/// <summary>
/// 获取船公司下拉列表
/// </summary>

@ -57,7 +57,7 @@ public class ClientCommonService : IClientCommonService
/// 获取航线操作员列表
/// </summary>
/// <returns></returns>
public async Task<DataResult<List<UserSelectRes>>> GetLaneUserList(string queryKey = "")
public async Task<DataResult<List<UserSelectRes>>> GetLaneUserList(string queryKey = "")
{
var data = await db.Queryable<SysUser>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsLaner == true)
@ -83,7 +83,7 @@ public class ClientCommonService : IClientCommonService
{
Id = a.Id,
PinYinCode = a.ShortName + "(" + a.CodeName + ")"
},true
}, true
).Take(20).WithCache($"{SqlSugarCacheConst.InfoClient}{user.TenantId}").ToListAsync();
return await Task.FromResult(DataResult<List<ControllerClientRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess));
}
@ -91,15 +91,16 @@ public class ClientCommonService : IClientCommonService
/// 获取船公司下拉列表
/// </summary>
/// <returns></returns>
public async Task<DataResult<List<CodeCarrierRes>>> GetCarrierSelectList(string queryKey = "") {
public async Task<DataResult<List<CodeCarrierRes>>> GetCarrierSelectList(string queryKey = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = await tenantDb.Queryable<CodeCarrier>()
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.Code.Contains(queryKey) || a.CnName.Contains(queryKey))
.Select(a => new CodeCarrierRes()
{
PinYinCode = a.CnName + "(" + a.Code + ")",
},
{
PinYinCode = a.CnName + "(" + a.Code + ")",
},
true)
.Take(20)
.WithCache($"{SqlSugarCacheConst.Carrier}{user.TenantId}")
@ -128,10 +129,10 @@ public class ClientCommonService : IClientCommonService
/// 获取商品下拉列表-客户端
/// </summary>
/// <returns></returns>
public async Task<DataResult<List<CodeGoodsSelectRes>>> GetClientGoodsList(string queryKey ="")
public async Task<DataResult<List<CodeGoodsSelectRes>>> GetClientGoodsList(string queryKey = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = await tenantDb.Queryable<CodeGoods>().Where(a=> a.Status == StatusEnum.Enable)
var list = await tenantDb.Queryable<CodeGoods>().Where(a => a.Status == StatusEnum.Enable)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.GoodsCode.Contains(queryKey) || a.GoodName.Contains(queryKey))
.Select(a => new CodeGoodsSelectRes()
{
@ -163,7 +164,7 @@ public class ClientCommonService : IClientCommonService
/// <param name="ids"></param>
/// <returns></returns>
public async Task<DataResult<List<UserSelectRes>>> GetUseEmailListByIds(long[] ids)
{
{
var data = await db.Queryable<SysUser>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && ids.Contains(a.Id))
.Select<UserSelectRes>()
@ -178,7 +179,7 @@ public class ClientCommonService : IClientCommonService
/// </summary>
/// <returns></returns>
public async Task<DataResult<List<ApiSelectViewModel>>> GetUserListByCode(string code, string queryKey = "")
{
{
code = code.ToLower();
var data = await db.Queryable<SysUser>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt())
@ -234,13 +235,13 @@ public class ClientCommonService : IClientCommonService
var dictvalue = db.Queryable<SysDictData>().InnerJoin<SysDictType>((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())
if (dictvalue.Where(x => x == req.Code).Any())
{
var data = GetSeaExportUnit(info, req.Code);
return DataResult<UnitSelectInfoRes>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
else
{
{
var codeCtns = tenantDb.Queryable<CodeCtn>().Where(x => x.Status == StatusEnum.Enable).ToList();
if (codeCtns.Where(x => x.CtnName == req.Code).Any())
@ -263,7 +264,7 @@ public class ClientCommonService : IClientCommonService
return DataResult<UnitSelectInfoRes>.Failed("没有维护该箱型的集装箱信息!");
}
}
}
else
{
@ -290,7 +291,7 @@ public class ClientCommonService : IClientCommonService
data.Quantity = seaExport.PKGS;
break;
case "JF"://计费吨
data.Quantity = seaExport.KGS/1000> seaExport.CBM? seaExport.KGS/1000: seaExport.CBM;
data.Quantity = seaExport.KGS / 1000 > seaExport.CBM ? seaExport.KGS / 1000 : seaExport.CBM;
break;
//默认
default:
@ -336,7 +337,7 @@ public class ClientCommonService : IClientCommonService
.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)
.WhereIF(code == "contract", (a, b) => b.IsContract == true)
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
@ -355,14 +356,14 @@ public class ClientCommonService : IClientCommonService
return DataResult<ClientSelectInfoRes>.Failed("业务信息不存在!");
}
var data = GetSeaExportClientInfo(info,code);
var data = GetSeaExportClientInfo(info, code);
data.ClientList = list;
return DataResult<ClientSelectInfoRes>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
else
{
return DataResult<ClientSelectInfoRes>.Failed("非法业务类型");
}
}
}
private ClientSelectInfoRes GetSeaExportClientInfo(SeaExport seaExport, string code)
@ -370,7 +371,7 @@ public class ClientCommonService : IClientCommonService
var data = new ClientSelectInfoRes();
switch (code)
{
{
case "carrier":
data.ClientId = seaExport.CarrierId;
data.ClientName = seaExport.Carrier;
@ -1134,7 +1135,7 @@ public class ClientCommonService : IClientCommonService
/// 根据类型获取往来单位下拉列表
/// </summary>
/// <returns></returns>
public async Task<DataResult<List<ClientSelectRes>>> GetClientListByCode(string code,string queryKey ="")
public async Task<DataResult<List<ClientSelectRes>>> GetClientListByCode(string code, string queryKey = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
@ -1176,24 +1177,41 @@ public class ClientCommonService : IClientCommonService
).Take(20).WithCache($"{SqlSugarCacheConst.InfoClient}{user.TenantId}").ToListAsync();
return await Task.FromResult(DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess));
}
/// <summary>
/// 获取所有往来单位下拉列表
/// </summary>
/// <param name="id"></param>
/// <param name="type"></param>
/// <returns></returns>
public DataResult<List<ClientSelectRes>> GetAllClientList()
public DataResult<List<ClientSelectRes>> GetAllClientList(long? id = null, string? type = null)
{
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
List<IConditionalModel> 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<InfoClient>().InnerJoin<InfoClientTag>((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();
}).ToList();
return DataResult<List<ClientSelectRes>>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
@ -1645,7 +1663,7 @@ public class ClientCommonService : IClientCommonService
/// 获取包装类型下拉列表
/// </summary>
/// <returns></returns>
public DataResult<List<CodePackageSelectRes>> GetPackageSelectList(string queryKey ="")
public DataResult<List<CodePackageSelectRes>> GetPackageSelectList(string queryKey = "")
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<CodePackage>()
@ -1735,7 +1753,7 @@ public class ClientCommonService : IClientCommonService
/// 获取单证员列表
/// </summary>
/// <returns></returns>
public DataResult<List<UserSelectRes>> GetVouchingClerkList(string queryKey ="")
public DataResult<List<UserSelectRes>> GetVouchingClerkList(string queryKey = "")
{
var data = db.Queryable<SysUser>()
.Where(a => a.Status == StatusEnum.Enable.ToEnumInt() && a.IsVouchingClerk == true)
@ -1852,7 +1870,7 @@ public class ClientCommonService : IClientCommonService
public DataResult<SysQuerySet> GetUserQuerySet(string permissionId, int tagNo = 0)
{
var info = db.Queryable<SysQuerySet>()
.Where(x => x.UserId == long.Parse(user.UserId) && x.PermissionId == long.Parse(permissionId)&& x.TagNo == tagNo).First();
.Where(x => x.UserId == long.Parse(user.UserId) && x.PermissionId == long.Parse(permissionId) && x.TagNo == tagNo).First();
return DataResult<SysQuerySet>.Success(info);
}

@ -1,5 +1,4 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Info.Dtos;
@ -7,9 +6,7 @@ using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace DS.WMS.MainApi.Controllers;
@ -180,6 +177,7 @@ public class ClientCommonController : ApiController
var res = _invokeService.GetClientSelectInfoByCode(req);
return res;
}
/// <summary>
/// 获取往来单位下拉集合列表
/// </summary>
@ -191,6 +189,7 @@ public class ClientCommonController : ApiController
var res = await _invokeService.GetMultiClientList();
return res;
}
/// <summary>
/// 提取汇率信息 先提取CodeConfig 参数ExchangeRateType(ETD\AccountDate\CreateTime) 再提取SysConfig配置最后默认取业务订单ETD
/// </summary>
@ -255,7 +254,7 @@ public class ClientCommonController : ApiController
/// <returns></returns>
[HttpGet]
[Route("GetClientListByCode")]
public async Task<DataResult<List<ClientSelectRes>>> GetClientListByCode([FromQuery]string code, string queryKey = "")
public async Task<DataResult<List<ClientSelectRes>>> GetClientListByCode([FromQuery] string code, string queryKey = "")
{
var res = await _invokeService.GetClientListByCode(code, queryKey);
return res;
@ -263,12 +262,13 @@ public class ClientCommonController : ApiController
/// <summary>
/// 获取所有往来单位下拉列表
/// </summary>
/// <param name="id">当前往来单位的ID可空</param>
/// <param name="type">类型字符串(与系统配置保持一致,可空)</param>
/// <returns></returns>
[HttpGet]
[Route("GetAllClientList")]
public DataResult<List<ClientSelectRes>> GetAllClientList()
[HttpGet, Route("GetAllClientList")]
public DataResult<List<ClientSelectRes>> GetAllClientList([FromQuery] long? id = null, [FromQuery] string? type = null)
{
var res = _invokeService.GetAllClientList();
var res = _invokeService.GetAllClientList(id, type);
return res;
}
/// <summary>
@ -620,7 +620,7 @@ public class ClientCommonController : ApiController
/// <returns></returns>
[HttpGet]
[Route("GetPackageSelectList")]
public DataResult<List<CodePackageSelectRes>> GetPackageSelectList([FromQuery]string queryKey = "")
public DataResult<List<CodePackageSelectRes>> GetPackageSelectList([FromQuery] string queryKey = "")
{
var res = _invokeService.GetPackageSelectList(queryKey);
return res;

Loading…
Cancel
Save