表单新增接口 及相关修改

master
ZR20090193-陈敬勇 8 months ago
parent 7c7cf76c1b
commit c6a6549414

@ -303,5 +303,10 @@ public static class MultiLanguageConst
[Description("函电信息不存在")] [Description("函电信息不存在")]
public const string LetterNotExist = "Letter_Not_Exist"; public const string LetterNotExist = "Letter_Not_Exist";
[Description("表单设置不存在")]
public const string FormSetNotExist = "FormSet_Not_Exist";
[Description("表单复制模板不存在")]
public const string FormCopyNotExist = "FormCopy_Not_Exist";
#endregion #endregion
} }

@ -0,0 +1,36 @@
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 FormSetCreateRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 权限Id
/// </summary>
public long? PermissionId { get; set; }
/// <summary>
/// 权限模块名称
/// </summary>
public string PermissionName { get; set; }
/// <summary>
/// 模板名称
/// </summary>
public string TemplateName { get; set; }
/// <summary>
/// 字段设置
/// </summary>
public string Content { get; set; }
}
}

@ -7,7 +7,7 @@ namespace DS.WMS.Core.Code.Entity;
/// <summary> /// <summary>
/// 租户表单字段复制模板 /// 租户表单字段复制模板
/// </summary> /// </summary>
[SqlSugar.SugarTable("op_code_form_copy")] [SqlSugar.SugarTable("op_code_form_copy", "租户表单字段复制模板")]
public class CodeFormCopy : BaseOrgModel<long> public class CodeFormCopy : BaseOrgModel<long>
{ {
/// <summary> /// <summary>

@ -7,7 +7,7 @@ namespace DS.WMS.Core.Code.Entity;
/// <summary> /// <summary>
/// 租户表单设置 /// 租户表单设置
/// </summary> /// </summary>
[SqlSugar.SugarTable("op_code_form_set")] [SqlSugar.SugarTable("op_code_form_set", "租户表单设置")]
public class CodeFormSet : BaseOrgModel<long> public class CodeFormSet : BaseOrgModel<long>
{ {
/// <summary> /// <summary>

@ -4,6 +4,9 @@ using DS.WMS.Core.System.Dtos;
namespace DS.WMS.Core.Code.Interface; namespace DS.WMS.Core.Code.Interface;
/// <summary>
///
/// </summary>
public interface IFormSetService public interface IFormSetService
{ {
/// <summary> /// <summary>
@ -27,4 +30,12 @@ public interface IFormSetService
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
DataResult<CodeFormSetRes> GetFormSetInfo(string id); DataResult<CodeFormSetRes> GetFormSetInfo(string id);
/// <summary>
/// 获取模块新增信息
/// </summary>
/// <param name="id">权限模块id</param>
/// <returns></returns>
Task<DataResult<FormSetCreateRes>> GetFormSetCreateInfoAsync(string id);
} }

@ -95,4 +95,40 @@ public class CodeFormSetService : IFormSetService
.First(); .First();
return DataResult<CodeFormSetRes>.Success(data, MultiLanguageConst.DataQuerySuccess); return DataResult<CodeFormSetRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
} }
/// <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));
}
}
}
} }

@ -7,7 +7,7 @@ namespace DS.WMS.Core.Info.Entity;
/// <summary> /// <summary>
/// 往来单位基本信息 /// 往来单位基本信息
/// </summary> /// </summary>
[SqlSugar.SugarTable("info_client")] [SqlSugar.SugarTable("info_client", "往来单位基本信息")]
public class InfoClient : BaseOrgModel<long> public class InfoClient : BaseOrgModel<long>
{ {
/// <summary> /// <summary>

@ -7,7 +7,7 @@ namespace DS.WMS.Core.Info.Entity;
/// <summary> /// <summary>
/// 往来单位-账期信息 /// 往来单位-账期信息
/// </summary> /// </summary>
[SqlSugar.SugarTable("info_client_account_date")] [SqlSugar.SugarTable("info_client_account_date", "往来单位-账期信息")]
public class InfoClientAccountDate : BaseOrgModel<long> public class InfoClientAccountDate : BaseOrgModel<long>
{ {
/// <summary> /// <summary>

@ -7,7 +7,7 @@ namespace DS.WMS.Core.Info.Entity;
/// <summary> /// <summary>
/// 往来单位-银行信息 /// 往来单位-银行信息
/// </summary> /// </summary>
[SqlSugar.SugarTable("info_client_bank")] [SqlSugar.SugarTable("info_client_bank", "往来单位-银行信息")]
public class InfoClientBank : BaseOrgModel<long> public class InfoClientBank : BaseOrgModel<long>
{ {
/// <summary> /// <summary>

@ -7,7 +7,7 @@ namespace DS.WMS.Core.Info.Entity;
/// <summary> /// <summary>
/// 往来单位-联系人信息 /// 往来单位-联系人信息
/// </summary> /// </summary>
[SqlSugar.SugarTable("info_client_contact")] [SqlSugar.SugarTable("info_client_contact", "往来单位-联系人信息")]
public class InfoClientContact : BaseOrgModel<long> public class InfoClientContact : BaseOrgModel<long>
{ {
/// <summary> /// <summary>

@ -7,7 +7,7 @@ namespace DS.WMS.Core.Info.Entity;
/// <summary> /// <summary>
/// 往来单位-合同信息 /// 往来单位-合同信息
/// </summary> /// </summary>
[SqlSugar.SugarTable("info_client_contract")] [SqlSugar.SugarTable("info_client_contract", "往来单位-合同信息")]
public class InfoClientContract : BaseOrgModel<long> public class InfoClientContract : BaseOrgModel<long>
{ {
/// <summary> /// <summary>

@ -7,7 +7,7 @@ namespace DS.WMS.Core.Info.Entity;
/// <summary> /// <summary>
/// 往来单位-收发货人信息 /// 往来单位-收发货人信息
/// </summary> /// </summary>
[SqlSugar.SugarTable("info_client_shipper")] [SqlSugar.SugarTable("info_client_shipper", "往来单位-收发货人信息")]
public class InfoClientShipper : BaseOrgModel<long> public class InfoClientShipper : BaseOrgModel<long>
{ {
/// <summary> /// <summary>

@ -6,7 +6,7 @@ namespace DS.WMS.Core.Info.Entity;
/// <summary> /// <summary>
/// 往来单位标识 /// 往来单位标识
/// </summary> /// </summary>
[SqlSugar.SugarTable("info_client_tag")] [SqlSugar.SugarTable("info_client_tag", "往来单位标识")]
public class InfoClientTag : BaseOrgModel<long> public class InfoClientTag : BaseOrgModel<long>
{ {
/// <summary> /// <summary>

@ -149,6 +149,18 @@ public interface ICommonService
/// <returns></returns> /// <returns></returns>
public DataResult<List<DbColumnInfo>> GetColumns(string tableViewName); public DataResult<List<DbColumnInfo>> GetColumns(string tableViewName);
/// <summary>
/// 获取表及视图-按客户
/// </summary>
/// <returns></returns>
public DataResult<List<DbTableInfo>> GetTablesByClient();
/// <summary>
/// 获取列字段-按客户
/// </summary>
/// <param name="tableViewName">表名</param>
/// <returns></returns>
public DataResult<List<DbColumnInfo>> GetColumnsByClient(string tableViewName);
/// <summary> /// <summary>
/// 获取用户字段设置 /// 获取用户字段设置
/// </summary> /// </summary>

@ -1131,7 +1131,7 @@ public class CommonService : ICommonService
#region 获取数据库表及字段属性 #region 获取数据库表及字段属性
/// <summary> /// <summary>
/// /// 获取数据库表
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public DataResult<List<DbTableInfo>> GetTables() public DataResult<List<DbTableInfo>> GetTables()
@ -1141,7 +1141,7 @@ public class CommonService : ICommonService
} }
/// <summary> /// <summary>
/// /// 获取数据库表字段
/// </summary> /// </summary>
/// <param name="tableViewName"></param> /// <param name="tableViewName"></param>
/// <returns></returns> /// <returns></returns>
@ -1151,6 +1151,30 @@ public class CommonService : ICommonService
return DataResult<List<DbColumnInfo>>.Success("获取数据成功", data); return DataResult<List<DbColumnInfo>>.Success("获取数据成功", data);
} }
/// <summary>
/// 获取数据库表-按客户
/// </summary>
/// <returns></returns>
public DataResult<List<DbTableInfo>> GetTablesByClient()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.DbMaintenance.GetTableInfoList();
return DataResult<List<DbTableInfo>>.Success("获取数据成功", data);
}
/// <summary>
/// 获取数据库表字段-按客户
/// </summary>
/// <param name="tableViewName"></param>
/// <returns></returns>
public DataResult<List<DbColumnInfo>> GetColumnsByClient(string tableViewName)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.DbMaintenance.GetColumnInfosByTableName(tableViewName);
return DataResult<List<DbColumnInfo>>.Success("获取数据成功", data);
}
#endregion #endregion
#region 用户字段设置 #region 用户字段设置

@ -354,7 +354,30 @@ public class CommonController : ApiController
var res = _invokeService.GetColumns(tableViewName); var res = _invokeService.GetColumns(tableViewName);
return res; return res;
} }
/// <summary>
/// 获取数据库表及视图名-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetTablesByClient")]
public DataResult<List<DbTableInfo>> GetTablesByClient()
{
var res = _invokeService.GetTablesByClient();
return res;
}
/// <summary>
/// 获取数据库表及视图名-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetColumnsByClient")]
public DataResult<List<DbColumnInfo>> GetColumnsByClient([FromQuery] string tableViewName)
{
var res = _invokeService.GetColumnsByClient(tableViewName);
return res;
}
/// <summary> /// <summary>
/// 获取用户字段设置 /// 获取用户字段设置
/// </summary> /// </summary>

@ -61,4 +61,17 @@ public class FormSetController : ApiController
var res = _invokeService.GetFormSetInfo(id); var res = _invokeService.GetFormSetInfo(id);
return res; return res;
} }
/// <summary>
/// 获取模块新增信息
/// </summary>
/// <param name="id">权限模块Id</param>
/// <returns></returns>
[HttpGet]
[Route("GetFormSetCreateInfoAsync")]
public async Task<DataResult<FormSetCreateRes>> GetFormSetCreateInfoAsync([FromQuery] string id)
{
var res = await _invokeService.GetFormSetCreateInfoAsync(id);
return res;
}
} }

@ -1006,3 +1006,10 @@
2024-03-22 15:20:15.8155 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config 2024-03-22 15:20:15.8155 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-03-22 15:20:15.8391 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-03-22 15:20:15.8391 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-03-22 15:20:15.9040 Info Configuration initialized. 2024-03-22 15:20:15.9040 Info Configuration initialized.
2024-04-08 10:09:10.2207 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-04-08 10:09:10.2510 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-04-08 10:09:10.2510 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-04-08 10:09:10.2778 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-04-08 10:09:10.2901 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-04-08 10:09:10.2901 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-04-08 10:09:10.3066 Info Configuration initialized.

@ -0,0 +1,42 @@
using System.Reflection;
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.SqlSugar;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.System.Entity;
using DS.WMS.Core.System.Interface;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using SqlSugar.IOC;
using Xunit;
namespace Ds.WMS.Test;
public class OpTest
{
private readonly IServiceProvider _serviceProvider;
private readonly SqlSugarScope db;
private readonly ISaasDbService saasService;
private readonly IFormSetService _formSetService;
public OpTest(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = (SqlSugarScope)_serviceProvider.GetRequiredService<ISqlSugarClient>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
_formSetService = _serviceProvider.GetRequiredService<IFormSetService>();
}
[Fact]
public async void SaasTest1()
{
//var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
var data = await _formSetService.GetFormSetCreateInfoAsync("1750335377144680448");
Assert.True(true);
}
}
Loading…
Cancel
Save