diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index 5590dd18..a1159b9a 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -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"; diff --git a/ds-wms-service/DS.WMS.AdminApi/Controllers/TenantParamController.cs b/ds-wms-service/DS.WMS.AdminApi/Controllers/TenantParamController.cs new file mode 100644 index 00000000..1c21b586 --- /dev/null +++ b/ds-wms-service/DS.WMS.AdminApi/Controllers/TenantParamController.cs @@ -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; +/// +/// 租户参数模块 +/// +public class TenantParamController : ApiController +{ + private readonly ITenantParamService _invokeService; + /// + /// 构造函数 + /// + /// + public TenantParamController(ITenantParamService invokeService) + { + _invokeService = invokeService; + } + + /// + /// 租户参数列表 + /// + /// + /// + [HttpPost] + [Route("GetTenantParamList")] + public DataResult> GetTenantParamList([FromBody] PageRequest request) + { + var res = _invokeService.GetListByPage(request); + return res; + } + + /// + /// 编辑租户参数 + /// + /// + /// + [HttpPost] + [Route("EditTenantParam")] + public DataResult EditTenantParam([FromBody] TenantParamReq model) + { + var res = _invokeService.EditTenantParam(model); + return res; + } + + /// + /// 租户参数明细列表 + /// + /// + /// + [HttpPost] + [Route("GetTenantParamDataList")] + public DataResult> GetTenantParamDataList([FromBody] PageRequest request) + { + var res = _invokeService.GetTenantParamDataList(request); + return res; + } + + /// + /// 编辑字典明细 + /// + /// + /// + [HttpPost] + [Route("EditTenantParmData")] + public DataResult EditTenantParmData([FromBody] TenantParamDataReq model) + { + var res = _invokeService.EditTenantParamData(model); + return res; + } + /// + /// 租户参数详情 + /// + /// + /// + [HttpGet] + [Route("GetTenantParamInfo")] + public DataResult GetTenantParamInfo([FromQuery] string id) + { + var res = _invokeService.GetTenantParamInfo(id); + return res; + } + /// + /// 租户参数明细详情 + /// + /// + /// + [HttpGet] + [Route("GetTenantParamDataInfo")] + public DataResult GetTenantParamDataInfo([FromQuery] string id) + { + var res = _invokeService.GetTenantParamDataInfo(id); + return res; + } +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/TenantParamSelectRes.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/TenantParamSelectRes.cs new file mode 100644 index 00000000..2a957fca --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/TenantParamSelectRes.cs @@ -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 +{ + /// + /// 租户参数下拉 + /// + public class TenantParamSelectRes + { + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 名称 + /// + public string ParamName { get; set; } + + /// + /// 编码 + /// + public string ParamCode { get; set; } + + /// + /// 类型 + /// + public string Type { get; set; } + } + + /// + /// 租户参数值下拉 + /// + public class TenantParamDataSelectRes + { + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 参数类型Id + /// + public long ParamId { get; set; } + + /// + /// 参数类型Code + /// + public string ParamCode { get; set; } + /// + /// 参数代码 + /// + public string ItemCode { get; set; } + + /// + /// 参数名称 + /// + public string ItemName { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Info/Dtos/ClientParamReq.cs b/ds-wms-service/DS.WMS.Core/Info/Dtos/ClientParamReq.cs new file mode 100644 index 00000000..92302e57 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Info/Dtos/ClientParamReq.cs @@ -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 +{ + /// + /// 往来单位参数请求实体 + /// + public class ClientParamReq + { + /// + /// 主键Id + /// + public long Id { get; set; } + /// + /// 参数类型Id + /// + public long ParamId { get; set; } + /// + /// 名称 + /// + public string ParamName { get; set; } + + /// + /// 参数类型Code + /// + public string ParamCode { get; set; } + + /// + /// 参数类型 + /// + public string ParamType { get; set; } + /// + /// 参数代码 + /// + public string ItemCode { get; set; } + + /// + /// 参数名称 + /// + public string ItemName { get; set; } + + /// + /// 往来单位 + /// + public string CustomerName { get; set; } + /// + /// 往来单位Id + /// + public long CustomerId { get; set; } + /// + /// 排序 + /// + public int? OrderNo { get; set; } = 100; + + + /// + /// 状态 + /// + public StatusEnum? Status { get; set; } = StatusEnum.Enable; + + /// + /// 备注 + /// + public string Note { get; set; } + } + /// + /// 验证 + /// + public class InfoClientParamReqValidator : AbstractValidator + { + /// + /// 构造函数 + /// + public InfoClientParamReqValidator() + { + this.RuleFor(o => o.CustomerId) + .NotEmpty().WithName("往来单位"); + this.RuleFor(o => o.ParamId) + .NotEmpty().WithName("参数类型"); + this.RuleFor(o => o.ItemCode) + .NotEmpty().WithName("参数代码"); + } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Info/Dtos/ClientParamRes.cs b/ds-wms-service/DS.WMS.Core/Info/Dtos/ClientParamRes.cs new file mode 100644 index 00000000..114371c9 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Info/Dtos/ClientParamRes.cs @@ -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 +{ + /// + /// 往来单位参数返回 + /// + public class ClientParamRes + { + /// + /// 主键Id + /// + public long Id { get; set; } + /// + /// 参数类型Id + /// + public long ParamId { get; set; } + /// + /// 名称 + /// + public string ParamName { get; set; } + + /// + /// 参数类型Code + /// + public string ParamCode { get; set; } + + /// + /// 参数类型 + /// + public string ParamType { get; set; } + /// + /// 参数代码 + /// + public string ItemCode { get; set; } + + /// + /// 参数名称 + /// + public string ItemName { get; set; } + + /// + /// 往来单位 + /// + public string CustomerName { get; set; } + /// + /// 往来单位Id + /// + public long CustomerId { get; set; } + /// + /// 排序 + /// + public int? OrderNo { get; set; } = 100; + + + /// + /// 状态 + /// + public StatusEnum? Status { get; set; } = StatusEnum.Enable; + + /// + /// 备注 + /// + public string Note { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Info/Entity/InfoClientParam.cs b/ds-wms-service/DS.WMS.Core/Info/Entity/InfoClientParam.cs new file mode 100644 index 00000000..db8a33f7 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Info/Entity/InfoClientParam.cs @@ -0,0 +1,68 @@ +using DS.Module.Core; +using DS.Module.Core.Data; +using SqlSugar; + +namespace DS.WMS.Core.Code.Entity; +/// +/// 往来单位参数值表 +/// +[SqlSugar.SugarTable("info_client_param")] +public class InfoClientParam : BaseModel +{ + /// + /// 参数类型Id + /// + public long ParamId { get; set; } + /// + /// 名称 + /// + [SqlSugar.SugarColumn(Length = 100, ColumnDescription = "名称")] + public string ParamName { get; set; } + + /// + /// 参数类型Code + /// + [SqlSugar.SugarColumn(Length = 100, ColumnDescription = "参数类型Code")] + public string ParamCode { get; set; } + + /// + /// 参数类型 + /// + [SqlSugar.SugarColumn(Length = 100, ColumnDescription = "参数类型")] + public string ParamType { get; set; } + /// + /// 参数代码 + /// + [SqlSugar.SugarColumn(Length = 100,ColumnDescription= "参数代码")] + public string ItemCode { get; set; } + + /// + /// 参数名称 + /// + [SqlSugar.SugarColumn(Length = 50,ColumnDescription= "参数名称")] + public string ItemName { get; set; } + + /// + /// 往来单位 + /// + [SugarColumn(ColumnDescription = "往来单位", Length = 100, IsNullable = true)] + public string CustomerName { get; set; } + /// + /// 往来单位Id + /// + [SugarColumn(ColumnDescription = "往来单位Id")] + public long CustomerId { get; set; } + /// + /// 排序 + /// + [SqlSugar.SugarColumn(ColumnDescription = "排序")] + public int? OrderNo { get; set; } = 100; + + + /// + /// 状态 + /// + [SqlSugar.SugarColumn(ColumnDescription = "状态")] + public StatusEnum? Status { get; set; } = StatusEnum.Enable; + +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Info/Interface/IClientInfoService.cs b/ds-wms-service/DS.WMS.Core/Info/Interface/IClientInfoService.cs index ac52f779..f253a54e 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Interface/IClientInfoService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Interface/IClientInfoService.cs @@ -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 /// /// DataResult GetClientInfo(string id); + + + /// + /// 批量删除 + /// + /// + /// + public DataResult BatchDelClientInfo(IdModel req); } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Info/Interface/IClientParamService.cs b/ds-wms-service/DS.WMS.Core/Info/Interface/IClientParamService.cs new file mode 100644 index 00000000..a2b1c47c --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Info/Interface/IClientParamService.cs @@ -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 +{ + /// + /// 列表 + /// + /// + /// + DataResult> GetListByPage(PageRequest request); + /// + /// 编辑 + /// + /// + /// + DataResult EditClientParam(ClientParamReq req); + + /// + /// 获取详情 + /// + /// + /// + DataResult GetClientParamInfo(string id); + + /// + /// 编辑 + /// + /// + /// + DataResult BatchDelClientParam(IdModel req); + /// + /// + /// + /// + public DataResult> GetTenantParamSelectList(); + + public DataResult> GetTenantParamDataSelectList(string code = ""); +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs index a17d828d..596a4ba9 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs @@ -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.Success(data, MultiLanguageConst.DataQuerySuccess); } + + public DataResult BatchDelClientInfo(IdModel req) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var list = tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id)).ToList(); + if (list.Count > 0) + { + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.ShipperId)).Any()) + return DataResult.Failed("存在海运出口使用的发货人信息!"); + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.ConsigneeId)).Any()) + return DataResult.Failed("存在海运出口使用的收货人信息!"); + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.NotifyPartyId)).Any()) + return DataResult.Failed("存在海运出口使用的通知人信息!"); + + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.AgentId)).Any()) + return DataResult.Failed("存在海运出口使用的国外代理人信息!"); + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.ShipAgencyId)).Any()) + return DataResult.Failed("存在海运出口使用的船代I信息!"); + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.CustomerId)).Any()) + return DataResult.Failed("存在海运出口使用的委托单位信息!"); + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.YardId)).Any()) + return DataResult.Failed("存在海运出口使用的场站信息!"); + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.CarrierId)).Any()) + return DataResult.Failed("存在海运出口使用的船公司信息!"); + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.ForwarderId)).Any()) + return DataResult.Failed("存在海运出口使用的货代公司信息!"); + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.CustomserId)).Any()) + return DataResult.Failed("存在海运出口使用的报关行信息!"); + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.TruckerId)).Any()) + return DataResult.Failed("存在海运出口使用的承运车队信息!"); + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.WareHouseId)).Any()) + return DataResult.Failed("存在海运出口使用的仓库信息!"); + + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.CustomerId)).Any()) + return DataResult.Failed("存在费用记录使用的费用对象信息!"); + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.CustomerId)).Any()) + return DataResult.Failed("存在客户对账使用的对账客户信息!"); + + if (tenantDb.Queryable().Where(x => req.Ids.Contains((long)x.CustomerId)).Any()) + return DataResult.Failed("存在自动对账使用的对账客户信息!"); + //银行信息 + var banks = tenantDb.Queryable().Where(x => req.Ids.Contains(x.ClientId)).ToList(); + if(banks.Count>0) + tenantDb.Deleteable(banks).ExecuteCommand(); + //联系人 + var contacts = tenantDb.Queryable().Where(x => req.Ids.Contains(x.ClientId)).ToList(); + if (contacts.Count > 0) + tenantDb.Deleteable(contacts).ExecuteCommand(); + //合同信息 + var contracts = tenantDb.Queryable().Where(x => req.Ids.Contains(x.ClientId)).ToList(); + if (contracts.Count > 0) + tenantDb.Deleteable(contracts).ExecuteCommand(); + //账期 + var accountDates = tenantDb.Queryable().Where(x => req.Ids.Contains(x.ClientId)).ToList(); + if (accountDates.Count > 0) + tenantDb.Deleteable(accountDates).ExecuteCommand(); + //收发货人 + var clientShippers = tenantDb.Queryable().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); + } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientParamService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientParamService.cs new file mode 100644 index 00000000..23c8d182 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientParamService.cs @@ -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; + /// + /// + /// + /// + public ClientParamService(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + db = _serviceProvider.GetRequiredService(); + user = _serviceProvider.GetRequiredService(); + saasService = _serviceProvider.GetRequiredService(); + } + + /// + /// 列表 + /// + /// + /// + public DataResult> GetListByPage(PageRequest request) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + //序列化查询条件 + var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); + var data = tenantDb.Queryable() + .Where(whereList) + .Select().ToQueryPage(request.PageCondition); + return data; + } + /// + /// 编辑 + /// + /// + /// + public DataResult EditClientParam(ClientParamReq req) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + if (req.Id == 0) + { + + if (tenantDb.Queryable().Where(x => x.ParamId == req.ParamId && x.CustomerId == x.CustomerId).Any()) + { + return DataResult.Failed("往来单位参数已存在!", MultiLanguageConst.ClientParamExist); + } + + var data = req.Adapt(); + + var entity = tenantDb.Insertable(data).ExecuteReturnEntity(); + + return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); + } + else + { + var info = tenantDb.Queryable().Where(x => x.Id == req.Id).First(); + + info = req.Adapt(info); + + tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); + return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess); + } + } + /// + /// 详情 + /// + /// + /// + public DataResult GetClientParamInfo(string id) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var data = tenantDb.Queryable() + .Where(a => a.Id == long.Parse(id)) + .Select() + .First(); + return DataResult.Success(data, MultiLanguageConst.DataQuerySuccess); + } + + public DataResult BatchDelClientParam(IdModel req) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var list = tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id)).ToList(); + if (list.Count > 0) + { + tenantDb.Deleteable(list).ExecuteCommand(); + } + return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess); + } + + public DataResult> GetTenantParamSelectList() + { + + var data = db.Queryable().Where(x => x.Status == StatusEnum.Enable) + .Select() + .ToList(); + return DataResult>.Success(data, MultiLanguageConst.DataQuerySuccess); + } + + public DataResult> GetTenantParamDataSelectList(string code = "") + { + var data = db.Queryable().Where(x => x.Status == StatusEnum.Enable) + .WhereIF(code.IsNotEmptyOrNull(), x => x.ParamCode.ToLower() == code.ToLower()) + .Select() + .ToList(); + return DataResult>.Success(data, MultiLanguageConst.DataQuerySuccess); + } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/TenantParamDataReq.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/TenantParamDataReq.cs new file mode 100644 index 00000000..b838aa8a --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/TenantParamDataReq.cs @@ -0,0 +1,64 @@ +using DS.Module.Core; +using FluentValidation; + +namespace DS.WMS.Core.Sys.Dtos; + +/// +/// 租户参数请求实体 +/// +public class TenantParamDataReq +{ + /// + /// 主键Id + /// + public long Id { get; set; } + /// + /// 参数类型Id + /// + public long ParamId { get; set; } + + /// + /// 参数类型Code + /// + public string ParamCode { get; set; } + /// + /// 参数代码 + /// + public string ItemCode { get; set; } + + /// + /// 参数名称 + /// + public string ItemName { get; set; } + + /// + /// 排序 + /// + public int? OrderNo { get; set; } = 100; + + /// + /// 状态 0 启用 1 禁用 + /// + public StatusEnum? Status { get; set; } = StatusEnum.Enable; + /// + /// 备注 + /// + public string Note { get; set; } = ""; +} + +/// +/// 验证 +/// +public class TenantParamDataReqValidator : AbstractValidator +{ + /// + /// 构造函数 + /// + public TenantParamDataReqValidator() + { + this.RuleFor(o => o.ItemCode) + .NotEmpty().WithName("参数代码"); + this.RuleFor(o => o.ItemName) + .NotEmpty().WithName("参数名称"); + } +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/TenantParamDataRes.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/TenantParamDataRes.cs new file mode 100644 index 00000000..056345c3 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/TenantParamDataRes.cs @@ -0,0 +1,50 @@ +using DS.Module.Core; + +namespace DS.WMS.Core.Sys.Dtos; +/// +/// 租户参数返回实体 +/// +public class TenantParamDataRes +{ + /// + /// 主键Id + /// + public long Id { get; set; } + /// + /// 参数类型Id + /// + public long ParamId { get; set; } + + /// + /// 参数类型Code + /// + public string ParamCode { get; set; } + /// + /// 参数代码 + /// + public string ItemCode { get; set; } + + /// + /// 参数名称 + /// + public string ItemName { get; set; } + + /// + /// 排序 + /// + public int? OrderNo { get; set; } = 100; + + /// + /// 状态 0 启用 1 禁用 + /// + public StatusEnum? Status { get; set; } = StatusEnum.Enable; + /// + /// 备注 + /// + public string Note { get; set; } = ""; + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/TenantParamReq.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/TenantParamReq.cs new file mode 100644 index 00000000..a1b450eb --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/TenantParamReq.cs @@ -0,0 +1,59 @@ +using DS.Module.Core; +using FluentValidation; + +namespace DS.WMS.Core.Sys.Dtos; + +/// +/// 租户参数类型请求实体 +/// +public class TenantParamReq +{ + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 名称 + /// + public string ParamName { get; set; } + + /// + /// 编码 + /// + public string ParamCode { get; set; } + + /// + /// 类型 + /// + public string Type { get; set; } + /// + /// 排序 + /// + public int? OrderNo { get; set; } = 100; + /// + /// 状态 0 启用 1 禁用 + /// + public StatusEnum? Status { get; set; } = StatusEnum.Enable; + /// + /// 备注 + /// + public string Note { get; set; } = ""; +} + +/// +/// 验证 +/// +public class TenantParamReqValidator : AbstractValidator +{ + /// + /// 构造函数 + /// + public TenantParamReqValidator() + { + this.RuleFor(o => o.ParamName) + .NotEmpty().WithName("租户参数类型名称"); + this.RuleFor(o => o.ParamCode) + .NotEmpty().WithName("租户参数类型唯一编码"); + } +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/TenantParamRes.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/TenantParamRes.cs new file mode 100644 index 00000000..afe8caa2 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/TenantParamRes.cs @@ -0,0 +1,45 @@ +using DS.Module.Core; + +namespace DS.WMS.Core.Sys.Dtos; + +/// +/// 租户参数类型返回 +/// +public class TenantParamRes +{ + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 名称 + /// + public string ParamName { get; set; } + + /// + /// 编码 + /// + public string ParamCode { get; set; } + + /// + /// 类型 + /// + public string Type { get; set; } + /// + /// 排序 + /// + public int? OrderNo { get; set; } = 100; + /// + /// 备注 + /// + public string Note { get; set; } = ""; + /// + /// 状态 0 启用 1 禁用 + /// + public StatusEnum? Status { get; set; } = StatusEnum.Enable; + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysTenantParam.cs b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysTenantParam.cs new file mode 100644 index 00000000..bf1fafb7 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysTenantParam.cs @@ -0,0 +1,42 @@ +using DS.Module.Core; +using DS.Module.Core.Data; + +namespace DS.WMS.Core.Sys.Entity; +/// +/// 系统租户参数类型表 +/// +[SqlSugar.SugarTable("sys_tenant_param")] +public class SysTenantParam : BaseModel +{ + /// + /// 名称 + /// + [SqlSugar.SugarColumn(Length = 100,ColumnDescription="名称")] + public string ParamName { get; set; } + + /// + /// 编码 + /// + [SqlSugar.SugarColumn(Length = 50,ColumnDescription="编码")] + public string ParamCode { get; set; } + + /// + /// 类型 + /// + [SqlSugar.SugarColumn(Length = 50, ColumnDescription = "类型")] + public string Type { get; set; } + /// + /// 排序 + /// + [SqlSugar.SugarColumn(ColumnDescription = "排序")] + public int? OrderNo { get; set; } = 100; + + + /// + /// 状态 + /// + [SqlSugar.SugarColumn(ColumnDescription = "状态")] + public StatusEnum? Status { get; set; } = StatusEnum.Enable; + + +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysTenantParamData.cs b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysTenantParamData.cs new file mode 100644 index 00000000..f7a36217 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysTenantParamData.cs @@ -0,0 +1,46 @@ +using DS.Module.Core; +using DS.Module.Core.Data; + +namespace DS.WMS.Core.Sys.Entity; +/// +/// 系统租户参数值表 +/// +[SqlSugar.SugarTable("sys_tenant_param_data")] +public class SysTenantParamData : BaseModel +{ + /// + /// 参数类型Id + /// + public long ParamId { get; set; } + + /// + /// 参数类型Code + /// + [SqlSugar.SugarColumn(Length = 100, ColumnDescription = "参数类型Code")] + public string ParamCode { get; set; } + /// + /// 参数代码 + /// + [SqlSugar.SugarColumn(Length = 100,ColumnDescription= "参数代码")] + public string ItemCode { get; set; } + + /// + /// 参数名称 + /// + [SqlSugar.SugarColumn(Length = 50,ColumnDescription= "参数名称")] + public string ItemName { get; set; } + + /// + /// 排序 + /// + [SqlSugar.SugarColumn(ColumnDescription = "排序")] + public int? OrderNo { get; set; } = 100; + + + /// + /// 状态 + /// + [SqlSugar.SugarColumn(ColumnDescription = "状态")] + public StatusEnum? Status { get; set; } = StatusEnum.Enable; + +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Interface/ITenantParamService.cs b/ds-wms-service/DS.WMS.Core/Sys/Interface/ITenantParamService.cs new file mode 100644 index 00000000..5bdd7f3a --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Sys/Interface/ITenantParamService.cs @@ -0,0 +1,48 @@ +using DS.Module.Core; +using DS.WMS.Core.Sys.Dtos; + +namespace DS.WMS.Core.Sys.Interface; + +public interface ITenantParamService +{ + /// + /// 列表查询 + /// + /// + /// + DataResult> GetListByPage(PageRequest request); + /// + /// 添加租户参数类型 + /// + /// + /// + DataResult EditTenantParam(TenantParamReq model); + + /// + /// 获取详情 + /// + /// + /// + DataResult GetTenantParamInfo(string id); + + + /// + /// 列表查询 + /// + /// + /// + DataResult> GetTenantParamDataList(PageRequest request); + /// + /// 添加字典值 + /// + /// + /// + DataResult EditTenantParamData(TenantParamDataReq model); + + /// + /// 获取详情 + /// + /// + /// + DataResult GetTenantParamDataInfo(string id); +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/TenantParamService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/TenantParamService.cs new file mode 100644 index 00000000..3feefb12 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/TenantParamService.cs @@ -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; + /// + /// + /// + /// + public TenantParamService(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + db = _serviceProvider.GetRequiredService(); + user = _serviceProvider.GetRequiredService(); + _commonService = _serviceProvider.GetRequiredService(); + } + public DataResult EditTenantParam(TenantParamReq req) + { + if (req.Id == 0) + { + var isExist = db.Queryable().Where(x => x.ParamCode == req.ParamCode).First(); + if (isExist != null) + { + return DataResult.Failed("租户参数唯一编码已存在!"); + } + + var data = req.Adapt(); + + var entity = db.Insertable(data).ExecuteReturnEntity(); + + return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); + } + else + { + var info = db.Queryable().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().Where(x => x.ParamId == req.ParamId && x.ItemCode == req.ItemCode).First(); + if (isExist != null) + { + return DataResult.Failed("租户参数值唯一编码已存在!"); + } + + var data = req.Adapt(); + + var entity = db.Insertable(data).ExecuteReturnEntity(); + + return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); + } + else + { + var info = db.Queryable().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> GetListByPage(PageRequest request) + { + //序列化查询条件 + var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); + var data = db.Queryable() + .Select() + .Where(whereList).ToQueryPage(request.PageCondition); + return data; + } + + public DataResult GetTenantParamDataInfo(string id) + { + var data = db.Queryable() + .Where(a => a.Id == long.Parse(id)) + .Select() + .First(); + return DataResult.Success(data, MultiLanguageConst.DataQuerySuccess); + } + + public DataResult> GetTenantParamDataList(PageRequest request) + { + //序列化查询条件 + var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); + var data = db.Queryable() + .Select() + .Where(whereList).ToQueryPage(request.PageCondition); + return data; + } + + public DataResult GetTenantParamInfo(string id) + { + var data = db.Queryable() + .Where(a => a.Id == long.Parse(id)) + .Select() + .First(); + return DataResult.Success(data, MultiLanguageConst.DataQuerySuccess); + } + } +} diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientParamController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientParamController.cs new file mode 100644 index 00000000..e6961fa5 --- /dev/null +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientParamController.cs @@ -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; + +/// +/// 客户参数信息-模块 +/// +public class ClientParamController : ApiController +{ + private readonly IClientParamService _invokeService; + + /// + /// 构造函数 + /// + /// + public ClientParamController(IClientParamService invokeService) + { + _invokeService = invokeService; + } + + /// + /// 列表 + /// + /// + /// + [HttpPost] + [Route("GetClientParamList")] + public DataResult> GetClientParamList([FromBody] PageRequest request) + { + var res = _invokeService.GetListByPage(request); + return res; + } + + /// + /// 编辑 + /// + /// + /// + [HttpPost] + [Route("EditClientParam")] + public DataResult EditClientParam([FromBody] ClientParamReq req) + { + var res = _invokeService.EditClientParam(req); + return res; + } + + /// + /// 详情 + /// + /// + /// + [HttpGet] + [Route("GetClientParamInfo")] + public DataResult GetClientParamInfo([FromQuery] string id) + { + var res = _invokeService.GetClientParamInfo(id); + return res; + } + /// + /// 批量删除 + /// + /// + /// + [HttpPost] + [Route("BatchDelClientParam")] + public DataResult BatchDelClientParam([FromBody] IdModel req) + { + var res = _invokeService.BatchDelClientParam(req); + return res; + } + /// + /// 获取租户参数下拉 + /// + /// + [HttpGet] + [Route("GetTenantParamSelectList")] + public DataResult> GetTenantParamSelectList() + { + var res = _invokeService.GetTenantParamSelectList(); + return res; + } + /// + /// 获取租户参数值下拉 + /// + /// + /// + [HttpGet] + [Route("GetTenantParamDataSelectList")] + public DataResult> GetTenantParamDataSelectList([FromQuery] string code) + { + var res = _invokeService.GetTenantParamDataSelectList(code); + return res; + } +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/CodeCtnController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/CodeCtnController.cs index 09452682..6bc55eec 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/CodeCtnController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/CodeCtnController.cs @@ -97,4 +97,17 @@ public class CodeCtnController : ApiController var res = _invokeService.GetExistCodeCtnList(); return res; } + + /// + /// 批量删除 + /// + /// 主表Ids + /// + [HttpPost] + [Route("BatchDelCodeCtn")] + public DataResult BatchDelCodeCtn([FromBody] IdModel req) + { + var res = _invokeService.BatchDelCodeCtn(req); + return res; + } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/CodeFrtController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/CodeFrtController.cs index 1bfc1b86..4a10ddb7 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/CodeFrtController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/CodeFrtController.cs @@ -97,4 +97,17 @@ public class CodeFrtController : ApiController var res = _invokeService.GetExistCodeFrtList(); return res; } + + /// + /// 批量删除 + /// + /// 主表Ids + /// + [HttpPost] + [Route("BatchDelCodeFrt")] + public DataResult BatchDelCodeFrt([FromBody] IdModel req) + { + var res = _invokeService.BatchDelCodeFrt(req); + return res; + } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/CodeIssueTypeController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/CodeIssueTypeController.cs index 5cdda05b..17cc4e37 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/CodeIssueTypeController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/CodeIssueTypeController.cs @@ -97,4 +97,17 @@ public class CodeIssueTypeController : ApiController var res = _invokeService.GetExistCodeIssueTypeList(); return res; } + + /// + /// 批量删除 + /// + /// 主表Ids + /// + [HttpPost] + [Route("BatchDelCodeIssueType")] + public DataResult BatchDelCodeIssueType([FromBody] IdModel req) + { + var res = _invokeService.BatchDelCodeIssueType(req); + return res; + } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/CodePackageController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/CodePackageController.cs index 42df89bc..ae4953a6 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/CodePackageController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/CodePackageController.cs @@ -97,4 +97,17 @@ public class CodePackageController : ApiController var res = _invokeService.GetExistCodePackageList(); return res; } + + /// + /// 批量删除 + /// + /// 主表Ids + /// + [HttpPost] + [Route("BatchDelCodePackage")] + public DataResult BatchDelCodePackage([FromBody] IdModel req) + { + var res = _invokeService.BatchDelCodePackage(req); + return res; + } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.MainApi/Properties/PublishProfiles/FolderProfile.pubxml.user b/ds-wms-service/DS.WMS.MainApi/Properties/PublishProfiles/FolderProfile.pubxml.user index 3b729485..b8efeb44 100644 --- a/ds-wms-service/DS.WMS.MainApi/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/ds-wms-service/DS.WMS.MainApi/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -6,7 +6,7 @@ <_PublishTargetUrl>D:\Code\PublishCopy\ds8-mainapi - 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||; + 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||; \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Test/SaasTest.cs b/ds-wms-service/DS.WMS.Test/SaasTest.cs index 256d7803..8e15206b 100644 --- a/ds-wms-service/DS.WMS.Test/SaasTest.cs +++ b/ds-wms-service/DS.WMS.Test/SaasTest.cs @@ -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); diff --git a/ds-wms-service/ds-wms-service.sln b/ds-wms-service/ds-wms-service.sln index 8e8f90a9..df50f1f3 100644 --- a/ds-wms-service/ds-wms-service.sln +++ b/ds-wms-service/ds-wms-service.sln @@ -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}