租户参数设置及相关接口

usertest
cjy 4 months ago
parent bfcc2b81b1
commit 7fc5f92c85

@ -445,7 +445,10 @@ public static class MultiLanguageConst
[Description("客户信息已存在")]
public const string ClientInfoExist = "Client_Info_Exist";
[Description("客户参数已存在")]
public const string ClientParamExist = "Client_Param_Exist";
#endregion
#region 海运出口
@ -460,7 +463,7 @@ public static class MultiLanguageConst
[Description("请先选择场站!")]
public const string SeaExportYardCheck = "Sea_Export_Yard_Check";
[Description("海运出口规则引擎校验完成!")]
public const string SeaExportRuleEngineFinished = "Sea_Export_RuleEngine_Finished";

@ -0,0 +1,99 @@
using DS.Module.Core;
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;
namespace DS.WMS.AdminApi.Controllers;
/// <summary>
/// 租户参数模块
/// </summary>
public class TenantParamController : ApiController
{
private readonly ITenantParamService _invokeService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public TenantParamController(ITenantParamService invokeService)
{
_invokeService = invokeService;
}
/// <summary>
/// 租户参数列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetTenantParamList")]
public DataResult<List<TenantParamRes>> GetTenantParamList([FromBody] PageRequest request)
{
var res = _invokeService.GetListByPage(request);
return res;
}
/// <summary>
/// 编辑租户参数
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("EditTenantParam")]
public DataResult EditTenantParam([FromBody] TenantParamReq model)
{
var res = _invokeService.EditTenantParam(model);
return res;
}
/// <summary>
/// 租户参数明细列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetTenantParamDataList")]
public DataResult<List<TenantParamDataRes>> GetTenantParamDataList([FromBody] PageRequest request)
{
var res = _invokeService.GetTenantParamDataList(request);
return res;
}
/// <summary>
/// 编辑字典明细
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("EditTenantParmData")]
public DataResult EditTenantParmData([FromBody] TenantParamDataReq model)
{
var res = _invokeService.EditTenantParamData(model);
return res;
}
/// <summary>
/// 租户参数详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("GetTenantParamInfo")]
public DataResult<TenantParamRes> GetTenantParamInfo([FromQuery] string id)
{
var res = _invokeService.GetTenantParamInfo(id);
return res;
}
/// <summary>
/// 租户参数明细详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("GetTenantParamDataInfo")]
public DataResult<TenantParamDataRes> GetTenantParamDataInfo([FromQuery] string id)
{
var res = _invokeService.GetTenantParamDataInfo(id);
return res;
}
}

@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Code.Dtos
{
/// <summary>
/// 租户参数下拉
/// </summary>
public class TenantParamSelectRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 名称
/// </summary>
public string ParamName { get; set; }
/// <summary>
/// 编码
/// </summary>
public string ParamCode { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
}
/// <summary>
/// 租户参数值下拉
/// </summary>
public class TenantParamDataSelectRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 参数类型Id
/// </summary>
public long ParamId { get; set; }
/// <summary>
/// 参数类型Code
/// </summary>
public string ParamCode { get; set; }
/// <summary>
/// 参数代码
/// </summary>
public string ItemCode { get; set; }
/// <summary>
/// 参数名称
/// </summary>
public string ItemName { get; set; }
}
}

@ -0,0 +1,90 @@
using DS.Module.Core;
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Info.Dtos
{
/// <summary>
/// 往来单位参数请求实体
/// </summary>
public class ClientParamReq
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 参数类型Id
/// </summary>
public long ParamId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string ParamName { get; set; }
/// <summary>
/// 参数类型Code
/// </summary>
public string ParamCode { get; set; }
/// <summary>
/// 参数类型
/// </summary>
public string ParamType { get; set; }
/// <summary>
/// 参数代码
/// </summary>
public string ItemCode { get; set; }
/// <summary>
/// 参数名称
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// 往来单位
/// </summary>
public string CustomerName { get; set; }
/// <summary>
/// 往来单位Id
/// </summary>
public long CustomerId { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; }
}
/// <summary>
/// 验证
/// </summary>
public class InfoClientParamReqValidator : AbstractValidator<ClientParamReq>
{
/// <summary>
/// 构造函数
/// </summary>
public InfoClientParamReqValidator()
{
this.RuleFor(o => o.CustomerId)
.NotEmpty().WithName("往来单位");
this.RuleFor(o => o.ParamId)
.NotEmpty().WithName("参数类型");
this.RuleFor(o => o.ItemCode)
.NotEmpty().WithName("参数代码");
}
}
}

@ -0,0 +1,77 @@
using DS.Module.Core;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Info.Dtos
{
/// <summary>
/// 往来单位参数返回
/// </summary>
public class ClientParamRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 参数类型Id
/// </summary>
public long ParamId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string ParamName { get; set; }
/// <summary>
/// 参数类型Code
/// </summary>
public string ParamCode { get; set; }
/// <summary>
/// 参数类型
/// </summary>
public string ParamType { get; set; }
/// <summary>
/// 参数代码
/// </summary>
public string ItemCode { get; set; }
/// <summary>
/// 参数名称
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// 往来单位
/// </summary>
public string CustomerName { get; set; }
/// <summary>
/// 往来单位Id
/// </summary>
public long CustomerId { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}
}

@ -0,0 +1,68 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using SqlSugar;
namespace DS.WMS.Core.Code.Entity;
/// <summary>
/// 往来单位参数值表
/// </summary>
[SqlSugar.SugarTable("info_client_param")]
public class InfoClientParam : BaseModel<long>
{
/// <summary>
/// 参数类型Id
/// </summary>
public long ParamId { get; set; }
/// <summary>
/// 名称
/// </summary>
[SqlSugar.SugarColumn(Length = 100, ColumnDescription = "名称")]
public string ParamName { get; set; }
/// <summary>
/// 参数类型Code
/// </summary>
[SqlSugar.SugarColumn(Length = 100, ColumnDescription = "参数类型Code")]
public string ParamCode { get; set; }
/// <summary>
/// 参数类型
/// </summary>
[SqlSugar.SugarColumn(Length = 100, ColumnDescription = "参数类型")]
public string ParamType { get; set; }
/// <summary>
/// 参数代码
/// </summary>
[SqlSugar.SugarColumn(Length = 100,ColumnDescription= "参数代码")]
public string ItemCode { get; set; }
/// <summary>
/// 参数名称
/// </summary>
[SqlSugar.SugarColumn(Length = 50,ColumnDescription= "参数名称")]
public string ItemName { get; set; }
/// <summary>
/// 往来单位
/// </summary>
[SugarColumn(ColumnDescription = "往来单位", Length = 100, IsNullable = true)]
public string CustomerName { get; set; }
/// <summary>
/// 往来单位Id
/// </summary>
[SugarColumn(ColumnDescription = "往来单位Id")]
public long CustomerId { get; set; }
/// <summary>
/// 排序
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "排序")]
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "状态")]
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
}

@ -1,4 +1,5 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Sys.Dtos;
@ -27,4 +28,12 @@ public interface IClientInfoService
/// <param name="id"></param>
/// <returns></returns>
DataResult<ClientInfoRes> GetClientInfo(string id);
/// <summary>
/// 批量删除
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult BatchDelClientInfo(IdModel req);
}

@ -0,0 +1,42 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Info.Dtos;
namespace DS.WMS.Core.Info.Interface;
public interface IClientParamService
{
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
DataResult<List<ClientParamRes>> GetListByPage(PageRequest request);
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
DataResult EditClientParam(ClientParamReq req);
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult<ClientParamRes> GetClientParamInfo(string id);
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
DataResult BatchDelClientParam(IdModel req);
/// <summary>
///
/// </summary>
/// <returns></returns>
public DataResult<List<TenantParamSelectRes>> GetTenantParamSelectList();
public DataResult<List<TenantParamDataSelectRes>> GetTenantParamDataSelectList(string code = "");
}

@ -1,10 +1,15 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Check.Entity;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Info.Interface;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Sys.Entity;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
@ -105,4 +110,70 @@ public class ClientInfoService : IClientInfoService
data.ClientTag = tag;
return DataResult<ClientInfoRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
public DataResult BatchDelClientInfo(IdModel req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = tenantDb.Queryable<InfoClient>().Where(x => req.Ids.Contains(x.Id)).ToList();
if (list.Count > 0)
{
if (tenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.ShipperId)).Any())
return DataResult.Failed("存在海运出口使用的发货人信息!");
if (tenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.ConsigneeId)).Any())
return DataResult.Failed("存在海运出口使用的收货人信息!");
if (tenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.NotifyPartyId)).Any())
return DataResult.Failed("存在海运出口使用的通知人信息!");
if (tenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.AgentId)).Any())
return DataResult.Failed("存在海运出口使用的国外代理人信息!");
if (tenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.ShipAgencyId)).Any())
return DataResult.Failed("存在海运出口使用的船代I信息!");
if (tenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.CustomerId)).Any())
return DataResult.Failed("存在海运出口使用的委托单位信息!");
if (tenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.YardId)).Any())
return DataResult.Failed("存在海运出口使用的场站信息!");
if (tenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.CarrierId)).Any())
return DataResult.Failed("存在海运出口使用的船公司信息!");
if (tenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.ForwarderId)).Any())
return DataResult.Failed("存在海运出口使用的货代公司信息!");
if (tenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.CustomserId)).Any())
return DataResult.Failed("存在海运出口使用的报关行信息!");
if (tenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.TruckerId)).Any())
return DataResult.Failed("存在海运出口使用的承运车队信息!");
if (tenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.WareHouseId)).Any())
return DataResult.Failed("存在海运出口使用的仓库信息!");
if (tenantDb.Queryable<FeeRecord>().Where(x => req.Ids.Contains((long)x.CustomerId)).Any())
return DataResult.Failed("存在费用记录使用的费用对象信息!");
if (tenantDb.Queryable<CheckBill>().Where(x => req.Ids.Contains((long)x.CustomerId)).Any())
return DataResult.Failed("存在客户对账使用的对账客户信息!");
if (tenantDb.Queryable<CheckBillAuto>().Where(x => req.Ids.Contains((long)x.CustomerId)).Any())
return DataResult.Failed("存在自动对账使用的对账客户信息!");
//银行信息
var banks = tenantDb.Queryable<InfoClientBank>().Where(x => req.Ids.Contains(x.ClientId)).ToList();
if(banks.Count>0)
tenantDb.Deleteable(banks).ExecuteCommand();
//联系人
var contacts = tenantDb.Queryable<InfoClientContact>().Where(x => req.Ids.Contains(x.ClientId)).ToList();
if (contacts.Count > 0)
tenantDb.Deleteable(contacts).ExecuteCommand();
//合同信息
var contracts = tenantDb.Queryable<InfoClientContract>().Where(x => req.Ids.Contains(x.ClientId)).ToList();
if (contracts.Count > 0)
tenantDb.Deleteable(contracts).ExecuteCommand();
//账期
var accountDates = tenantDb.Queryable<InfoClientAccountDate>().Where(x => req.Ids.Contains(x.ClientId)).ToList();
if (accountDates.Count > 0)
tenantDb.Deleteable(accountDates).ExecuteCommand();
//收发货人
var clientShippers = tenantDb.Queryable<InfoClientShipper>().Where(x => req.Ids.Contains(x.ClientId)).ToList();
if (clientShippers.Count > 0)
tenantDb.Deleteable(clientShippers).ExecuteCommand();
//删除客户信息
tenantDb.Deleteable(list).ExecuteCommand();
}
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
}

@ -0,0 +1,130 @@
using DS.Module.Core;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Info.Interface;
using DS.WMS.Core.Sys.Entity;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using Mapster;
using DS.Module.Core.Data;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Code.Dtos;
using Org.BouncyCastle.Ocsp;
using DS.WMS.Core.TaskPlat.Dtos;
namespace DS.WMS.Core.Info.Method
{
public class ClientParamService : IClientParamService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ISaasDbService saasService;
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public ClientParamService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DataResult<List<ClientParamRes>> GetListByPage(PageRequest request)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = tenantDb.Queryable<InfoClientParam>()
.Where(whereList)
.Select<ClientParamRes>().ToQueryPage(request.PageCondition);
return data;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult EditClientParam(ClientParamReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (req.Id == 0)
{
if (tenantDb.Queryable<InfoClientParam>().Where(x => x.ParamId == req.ParamId && x.CustomerId == x.CustomerId).Any())
{
return DataResult.Failed("往来单位参数已存在!", MultiLanguageConst.ClientParamExist);
}
var data = req.Adapt<InfoClientParam>();
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
}
else
{
var info = tenantDb.Queryable<InfoClientParam>().Where(x => x.Id == req.Id).First();
info = req.Adapt(info);
tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult<ClientParamRes> GetClientParamInfo(string id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<InfoClientParam>()
.Where(a => a.Id == long.Parse(id))
.Select<ClientParamRes>()
.First();
return DataResult<ClientParamRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
public DataResult BatchDelClientParam(IdModel req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = tenantDb.Queryable<InfoClientParam>().Where(x => req.Ids.Contains(x.Id)).ToList();
if (list.Count > 0)
{
tenantDb.Deleteable(list).ExecuteCommand();
}
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
public DataResult<List<TenantParamSelectRes>> GetTenantParamSelectList()
{
var data = db.Queryable<SysTenantParam>().Where(x => x.Status == StatusEnum.Enable)
.Select<TenantParamSelectRes>()
.ToList();
return DataResult<List<TenantParamSelectRes>>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
public DataResult<List<TenantParamDataSelectRes>> GetTenantParamDataSelectList(string code = "")
{
var data = db.Queryable<SysTenantParamData>().Where(x => x.Status == StatusEnum.Enable)
.WhereIF(code.IsNotEmptyOrNull(), x => x.ParamCode.ToLower() == code.ToLower())
.Select<TenantParamDataSelectRes>()
.ToList();
return DataResult<List<TenantParamDataSelectRes>>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
}
}

@ -0,0 +1,64 @@
using DS.Module.Core;
using FluentValidation;
namespace DS.WMS.Core.Sys.Dtos;
/// <summary>
/// 租户参数请求实体
/// </summary>
public class TenantParamDataReq
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 参数类型Id
/// </summary>
public long ParamId { get; set; }
/// <summary>
/// 参数类型Code
/// </summary>
public string ParamCode { get; set; }
/// <summary>
/// 参数代码
/// </summary>
public string ItemCode { get; set; }
/// <summary>
/// 参数名称
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
}
/// <summary>
/// 验证
/// </summary>
public class TenantParamDataReqValidator : AbstractValidator<TenantParamDataReq>
{
/// <summary>
/// 构造函数
/// </summary>
public TenantParamDataReqValidator()
{
this.RuleFor(o => o.ItemCode)
.NotEmpty().WithName("参数代码");
this.RuleFor(o => o.ItemName)
.NotEmpty().WithName("参数名称");
}
}

@ -0,0 +1,50 @@
using DS.Module.Core;
namespace DS.WMS.Core.Sys.Dtos;
/// <summary>
/// 租户参数返回实体
/// </summary>
public class TenantParamDataRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 参数类型Id
/// </summary>
public long ParamId { get; set; }
/// <summary>
/// 参数类型Code
/// </summary>
public string ParamCode { get; set; }
/// <summary>
/// 参数代码
/// </summary>
public string ItemCode { get; set; }
/// <summary>
/// 参数名称
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}

@ -0,0 +1,59 @@
using DS.Module.Core;
using FluentValidation;
namespace DS.WMS.Core.Sys.Dtos;
/// <summary>
/// 租户参数类型请求实体
/// </summary>
public class TenantParamReq
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 名称
/// </summary>
public string ParamName { get; set; }
/// <summary>
/// 编码
/// </summary>
public string ParamCode { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
}
/// <summary>
/// 验证
/// </summary>
public class TenantParamReqValidator : AbstractValidator<TenantParamReq>
{
/// <summary>
/// 构造函数
/// </summary>
public TenantParamReqValidator()
{
this.RuleFor(o => o.ParamName)
.NotEmpty().WithName("租户参数类型名称");
this.RuleFor(o => o.ParamCode)
.NotEmpty().WithName("租户参数类型唯一编码");
}
}

@ -0,0 +1,45 @@
using DS.Module.Core;
namespace DS.WMS.Core.Sys.Dtos;
/// <summary>
/// 租户参数类型返回
/// </summary>
public class TenantParamRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 名称
/// </summary>
public string ParamName { get; set; }
/// <summary>
/// 编码
/// </summary>
public string ParamCode { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}

@ -0,0 +1,42 @@
using DS.Module.Core;
using DS.Module.Core.Data;
namespace DS.WMS.Core.Sys.Entity;
/// <summary>
/// 系统租户参数类型表
/// </summary>
[SqlSugar.SugarTable("sys_tenant_param")]
public class SysTenantParam : BaseModel<long>
{
/// <summary>
/// 名称
/// </summary>
[SqlSugar.SugarColumn(Length = 100,ColumnDescription="名称")]
public string ParamName { get; set; }
/// <summary>
/// 编码
/// </summary>
[SqlSugar.SugarColumn(Length = 50,ColumnDescription="编码")]
public string ParamCode { get; set; }
/// <summary>
/// 类型
/// </summary>
[SqlSugar.SugarColumn(Length = 50, ColumnDescription = "类型")]
public string Type { get; set; }
/// <summary>
/// 排序
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "排序")]
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "状态")]
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
}

@ -0,0 +1,46 @@
using DS.Module.Core;
using DS.Module.Core.Data;
namespace DS.WMS.Core.Sys.Entity;
/// <summary>
/// 系统租户参数值表
/// </summary>
[SqlSugar.SugarTable("sys_tenant_param_data")]
public class SysTenantParamData : BaseModel<long>
{
/// <summary>
/// 参数类型Id
/// </summary>
public long ParamId { get; set; }
/// <summary>
/// 参数类型Code
/// </summary>
[SqlSugar.SugarColumn(Length = 100, ColumnDescription = "参数类型Code")]
public string ParamCode { get; set; }
/// <summary>
/// 参数代码
/// </summary>
[SqlSugar.SugarColumn(Length = 100,ColumnDescription= "参数代码")]
public string ItemCode { get; set; }
/// <summary>
/// 参数名称
/// </summary>
[SqlSugar.SugarColumn(Length = 50,ColumnDescription= "参数名称")]
public string ItemName { get; set; }
/// <summary>
/// 排序
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "排序")]
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "状态")]
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
}

@ -0,0 +1,48 @@
using DS.Module.Core;
using DS.WMS.Core.Sys.Dtos;
namespace DS.WMS.Core.Sys.Interface;
public interface ITenantParamService
{
/// <summary>
/// 列表查询
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
DataResult<List<TenantParamRes>> GetListByPage(PageRequest request);
/// <summary>
/// 添加租户参数类型
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
DataResult EditTenantParam(TenantParamReq model);
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult<TenantParamRes> GetTenantParamInfo(string id);
/// <summary>
/// 列表查询
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
DataResult<List<TenantParamDataRes>> GetTenantParamDataList(PageRequest request);
/// <summary>
/// 添加字典值
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
DataResult EditTenantParamData(TenantParamDataReq model);
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult<TenantParamDataRes> GetTenantParamDataInfo(string id);
}

@ -0,0 +1,123 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.UserModule;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using Org.BouncyCastle.Ocsp;
using SqlSugar;
namespace DS.WMS.Core.Sys.Method
{
public class TenantParamService : ITenantParamService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ICommonService _commonService;
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public TenantParamService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
_commonService = _serviceProvider.GetRequiredService<ICommonService>();
}
public DataResult EditTenantParam(TenantParamReq req)
{
if (req.Id == 0)
{
var isExist = db.Queryable<SysTenantParam>().Where(x => x.ParamCode == req.ParamCode).First();
if (isExist != null)
{
return DataResult.Failed("租户参数唯一编码已存在!");
}
var data = req.Adapt<SysTenantParam>();
var entity = db.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
}
else
{
var info = db.Queryable<SysTenantParam>().Where(x => x.Id == req.Id).First();
info = req.Adapt(info);
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
}
public DataResult EditTenantParamData(TenantParamDataReq req)
{
if (req.Id == 0)
{
var isExist = db.Queryable<SysTenantParamData>().Where(x => x.ParamId == req.ParamId && x.ItemCode == req.ItemCode).First();
if (isExist != null)
{
return DataResult.Failed("租户参数值唯一编码已存在!");
}
var data = req.Adapt<SysTenantParamData>();
var entity = db.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
}
else
{
var info = db.Queryable<SysTenantParamData>().Where(x => x.Id == req.Id).First();
info = req.Adapt(info);
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
}
public DataResult<List<TenantParamRes>> GetListByPage(PageRequest request)
{
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = db.Queryable<SysTenantParam>()
.Select<TenantParamRes>()
.Where(whereList).ToQueryPage(request.PageCondition);
return data;
}
public DataResult<TenantParamDataRes> GetTenantParamDataInfo(string id)
{
var data = db.Queryable<SysTenantParamData>()
.Where(a => a.Id == long.Parse(id))
.Select<TenantParamDataRes>()
.First();
return DataResult<TenantParamDataRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
public DataResult<List<TenantParamDataRes>> GetTenantParamDataList(PageRequest request)
{
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = db.Queryable<SysTenantParamData>()
.Select<TenantParamDataRes>()
.Where(whereList).ToQueryPage(request.PageCondition);
return data;
}
public DataResult<TenantParamRes> GetTenantParamInfo(string id)
{
var data = db.Queryable<SysTenantParam>()
.Where(a => a.Id == long.Parse(id))
.Select<TenantParamRes>()
.First();
return DataResult<TenantParamRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
}
}

@ -0,0 +1,101 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Interface;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Interface;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.MainApi.Controllers;
/// <summary>
/// 客户参数信息-模块
/// </summary>
public class ClientParamController : ApiController
{
private readonly IClientParamService _invokeService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public ClientParamController(IClientParamService invokeService)
{
_invokeService = invokeService;
}
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetClientParamList")]
public DataResult<List<ClientParamRes>> GetClientParamList([FromBody] PageRequest request)
{
var res = _invokeService.GetListByPage(request);
return res;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("EditClientParam")]
public DataResult EditClientParam([FromBody] ClientParamReq req)
{
var res = _invokeService.EditClientParam(req);
return res;
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("GetClientParamInfo")]
public DataResult<ClientParamRes> GetClientParamInfo([FromQuery] string id)
{
var res = _invokeService.GetClientParamInfo(id);
return res;
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("BatchDelClientParam")]
public DataResult BatchDelClientParam([FromBody] IdModel req)
{
var res = _invokeService.BatchDelClientParam(req);
return res;
}
/// <summary>
/// 获取租户参数下拉
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetTenantParamSelectList")]
public DataResult<List<TenantParamSelectRes>> GetTenantParamSelectList()
{
var res = _invokeService.GetTenantParamSelectList();
return res;
}
/// <summary>
/// 获取租户参数值下拉
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
[HttpGet]
[Route("GetTenantParamDataSelectList")]
public DataResult<List<TenantParamDataSelectRes>> GetTenantParamDataSelectList([FromQuery] string code)
{
var res = _invokeService.GetTenantParamDataSelectList(code);
return res;
}
}

@ -97,4 +97,17 @@ public class CodeCtnController : ApiController
var res = _invokeService.GetExistCodeCtnList();
return res;
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="req">主表Ids</param>
/// <returns></returns>
[HttpPost]
[Route("BatchDelCodeCtn")]
public DataResult BatchDelCodeCtn([FromBody] IdModel req)
{
var res = _invokeService.BatchDelCodeCtn(req);
return res;
}
}

@ -97,4 +97,17 @@ public class CodeFrtController : ApiController
var res = _invokeService.GetExistCodeFrtList();
return res;
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="req">主表Ids</param>
/// <returns></returns>
[HttpPost]
[Route("BatchDelCodeFrt")]
public DataResult BatchDelCodeFrt([FromBody] IdModel req)
{
var res = _invokeService.BatchDelCodeFrt(req);
return res;
}
}

@ -97,4 +97,17 @@ public class CodeIssueTypeController : ApiController
var res = _invokeService.GetExistCodeIssueTypeList();
return res;
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="req">主表Ids</param>
/// <returns></returns>
[HttpPost]
[Route("BatchDelCodeIssueType")]
public DataResult BatchDelCodeIssueType([FromBody] IdModel req)
{
var res = _invokeService.BatchDelCodeIssueType(req);
return res;
}
}

@ -97,4 +97,17 @@ public class CodePackageController : ApiController
var res = _invokeService.GetExistCodePackageList();
return res;
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="req">主表Ids</param>
/// <returns></returns>
[HttpPost]
[Route("BatchDelCodePackage")]
public DataResult BatchDelCodePackage([FromBody] IdModel req)
{
var res = _invokeService.BatchDelCodePackage(req);
return res;
}
}

@ -6,7 +6,7 @@
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\Code\PublishCopy\ds8-mainapi</_PublishTargetUrl>
<History>True|2024-06-18T09:36:34.9035076Z||;True|2024-06-18T16:25:54.2461596+08:00||;True|2024-06-18T10:09:37.3872162+08:00||;True|2024-06-18T10:00:43.4402179+08:00||;True|2024-06-18T08:55:07.3014083+08:00||;True|2024-06-18T08:40:51.6182342+08:00||;True|2024-06-13T19:48:34.0429148+08:00||;True|2024-06-13T19:09:39.6804400+08:00||;True|2024-06-13T15:41:56.9502735+08:00||;True|2024-06-13T15:23:59.4555910+08:00||;True|2024-06-13T15:12:55.6093356+08:00||;True|2024-06-11T17:08:01.8930314+08:00||;True|2024-06-07T15:23:11.1389680+08:00||;True|2024-06-07T10:23:59.6079620+08:00||;True|2024-06-06T17:42:56.1843783+08:00||;True|2024-06-04T14:20:46.7742295+08:00||;True|2024-05-31T17:57:35.6858600+08:00||;True|2024-05-31T15:25:20.8503086+08:00||;True|2024-05-30T17:22:52.2563382+08:00||;True|2024-05-30T17:05:35.7504154+08:00||;True|2024-05-29T17:17:39.6966826+08:00||;</History>
<History>True|2024-07-16T10:17:43.9220347Z||;True|2024-06-18T17:36:34.9035076+08:00||;True|2024-06-18T16:25:54.2461596+08:00||;True|2024-06-18T10:09:37.3872162+08:00||;True|2024-06-18T10:00:43.4402179+08:00||;True|2024-06-18T08:55:07.3014083+08:00||;True|2024-06-18T08:40:51.6182342+08:00||;True|2024-06-13T19:48:34.0429148+08:00||;True|2024-06-13T19:09:39.6804400+08:00||;True|2024-06-13T15:41:56.9502735+08:00||;True|2024-06-13T15:23:59.4555910+08:00||;True|2024-06-13T15:12:55.6093356+08:00||;True|2024-06-11T17:08:01.8930314+08:00||;True|2024-06-07T15:23:11.1389680+08:00||;True|2024-06-07T10:23:59.6079620+08:00||;True|2024-06-06T17:42:56.1843783+08:00||;True|2024-06-04T14:20:46.7742295+08:00||;True|2024-05-31T17:57:35.6858600+08:00||;True|2024-05-31T15:25:20.8503086+08:00||;True|2024-05-30T17:22:52.2563382+08:00||;True|2024-05-30T17:05:35.7504154+08:00||;True|2024-05-29T17:17:39.6966826+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

@ -67,7 +67,7 @@ public class SaasTest
{
var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持
tenantDb.CodeFirst.InitTables(typeof(BusinessFeeStatus));
tenantDb.CodeFirst.InitTables(typeof(InfoClientParam));
//tenantDb.CodeFirst.InitTables(typeof(CheckBillAutoDetail));
//db.CodeFirst.InitTables(typeof(OpBusinessTruckCtn));
Assert.True(true);

@ -208,6 +208,7 @@ Global
{CF36AACB-6405-4F5E-9494-72D8BD1FF414} = {518DB9B5-80A8-4B2C-8570-52BD406458DE}
{32B97A3A-C361-44F3-B417-5D08E9FD9624} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4}
{8DAE16A3-E249-4C86-BEEC-DA8429FD837C} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4}
{4B51DCC1-62A5-49C5-978B-798E6B48F3C0} = {518DB9B5-80A8-4B2C-8570-52BD406458DE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {66115F23-94B4-43C0-838E-33B5CF77F788}

Loading…
Cancel
Save