基础信息部分及程序优化

master
ZR20090193-陈敬勇 9 months ago
parent 4d45830b64
commit 3ffe6f3f9e

@ -27,8 +27,10 @@ namespace DS.Module.SqlSugar
entityInfo.SetValue(GuidHelper.GetSnowflakeId());
}
if (entityInfo.EntityColumnInfo.PropertyInfo.PropertyType == typeof(long))
if (entityInfo.EntityColumnInfo.IsPrimarykey && entityInfo.EntityColumnInfo.PropertyInfo.PropertyType == typeof(long))
{
var id = entityInfo.EntityColumnInfo.PropertyInfo.GetValue(entityInfo.EntityValue);
if (id == null || (long)id == 0)
entityInfo.SetValue(SnowFlakeSingle.Instance.NextId());
}
}

@ -418,3 +418,17 @@
2024-02-20 15:44:42.6293 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-02-20 15:44:42.6549 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-20 15:44:42.7207 Info Configuration initialized.
2024-02-22 17:59:02.7290 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-02-22 17:59:02.7572 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-02-22 17:59:02.7819 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-02-22 17:59:02.8134 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-02-22 17:59:02.8482 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-02-22 17:59:02.8692 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-22 17:59:02.9376 Info Configuration initialized.
2024-02-23 08:53:34.7978 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-02-23 08:53:34.8813 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-02-23 08:53:34.9347 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-02-23 08:53:35.0052 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-02-23 08:53:35.0867 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-02-23 08:53:35.1429 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-23 08:53:35.2826 Info Configuration initialized.

@ -0,0 +1,103 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using SqlSugar;
namespace DS.WMS.Core.Code.Entity;
/// <summary>
/// 商品信息表
/// </summary>
[SqlSugar.SugarTable("op_code_goods","商品信息表")]
public class CodeGoods: BaseModel<long>
{
/// <summary>
/// 商品编码
/// </summary>
[SugarColumn(ColumnDescription = "商品编码", Length = 30)]
public string GoodsCode { get; set; }
/// <summary>
/// 商品名称
/// </summary>
[SugarColumn(ColumnDescription = "商品名称", Length = 50)]
public string GoodName { get; set; }
/// <summary>
/// 物料号
/// </summary>
[SugarColumn(ColumnDescription = "物料号", Length = 50)]
public string GoodNo { get; set; }
/// <summary>
/// 英文名称
/// </summary>
[SugarColumn(ColumnDescription = "英文名称", Length = 10)]
public string EnName { get; set; }
/// <summary>
/// 商品描述
/// </summary>
[SugarColumn(ColumnDescription = "商品描述", Length = 200)]
public string Description { get; set; }
/// <summary>
/// 入库应收
/// </summary>
[SugarColumn(ColumnDescription = "入库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")]
public decimal ARRate { get; set; }
/// <summary>
/// 入库应付
/// </summary>
[SugarColumn(ColumnDescription = "入库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")]
public decimal APRate { get; set; }
/// <summary>
/// 出库应收
/// </summary>
[SugarColumn(ColumnDescription = "出库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")]
public decimal AROutRate { get; set; }
/// <summary>
/// 出库应付
/// </summary>
[SugarColumn(ColumnDescription = "出库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")]
public decimal APOutRate { get; set; }
/// <summary>
/// 商品类型
/// </summary>
[SugarColumn(ColumnDescription = "商品类型", IsNullable = true)]
public long GoodsTypeId { get; set; }
/// <summary>
/// 计费大类
/// </summary>
[SugarColumn(ColumnDescription = "计费大类", IsNullable = true)]
public long GoodsFeeTypeId { get; set; }
/// <summary>
/// 海关代码
/// </summary>
[SugarColumn(ColumnDescription = "海关代码", Length = 50)]
public string HSCode { get; set; }
/// <summary>
/// 申报计量单位
/// </summary>
[SugarColumn(ColumnDescription = "物料号", Length = 50)]
public string RuleUnit { get; set; }
/// <summary>
/// 法定第一计量单位
/// </summary>
[SugarColumn(ColumnDescription = "法定第一计量单位", Length = 50)]
public string RuleUnit1 { get; set; }
/// <summary>
/// 法定第二计量单位
/// </summary>
[SugarColumn(ColumnDescription = "法定第二计量单位", Length = 50)]
public string RuleUnit2 { get; set; }
/// <summary>
/// 状态 0启用 1禁用
/// </summary>
[SugarColumn(ColumnDescription = "状态",DefaultValue = "0")]
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
}

@ -0,0 +1,39 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using SqlSugar;
namespace DS.WMS.Core.Code.Entity;
/// <summary>
/// 商品类型表
/// </summary>
[SqlSugar.SugarTable("op_code_goods_type","商品类型表")]
public class CodeGoodsType: BaseModel<long>
{
/// <summary>
/// 类型代码
/// </summary>
[SugarColumn(ColumnDescription = "类型代码", Length = 20)]
public string GoodsTypeCode { get; set; }
/// <summary>
/// 货物类型
/// </summary>
[SugarColumn(ColumnDescription = "货物类型", Length = 50)]
public string GoodsTypeName { get; set; }
/// <summary>
/// 英文名称
/// </summary>
[SugarColumn(ColumnDescription = "英文名称", Length = 10)]
public string EnName { get; set; }
/// <summary>
/// 描述
/// </summary>
[SugarColumn(ColumnDescription = "描述", Length = 200)]
public string Description { get; set; }
/// <summary>
/// 状态 0启用 1禁用
/// </summary>
[SugarColumn(ColumnDescription = "状态",DefaultValue = "0")]
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
}

@ -20,6 +20,10 @@
<PackageReference Include="Mapster" Version="7.3.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="BaseInfo\Dtos\" />
<Folder Include="BaseInfo\Entity\" />
<Folder Include="BaseInfo\Interface\" />
<Folder Include="BaseInfo\Method\" />
<Folder Include="Code\Dtos\" />
<Folder Include="Code\Interface\" />
<Folder Include="Code\Method\" />

@ -37,7 +37,10 @@ public class FlowTemplateReq
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>

@ -80,6 +80,7 @@ public class ClientFlowTemplateService : IClientFlowTemplateService
}
var data = info.Adapt<FlowTemplateTenant>();
data.Id = 0;
db.Insertable(data).ExecuteCommand();
return DataResult.Successed("引入成功!",MultiLanguageConst.DataImportSuccess);
}

@ -24,11 +24,18 @@ public class DataRuleReq
/// 权限规则
/// </summary>
public string DataRules { get; set; }
/// <summary>
/// 权限实体
/// </summary>
public string PermissionEntity { get; set; }
/// <summary>
/// 数据权限描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态 0 启用 1 禁用

@ -23,6 +23,11 @@ public class DataRuleRes
/// 权限模块名称
/// </summary>
public string PermissionName { get; set; }
/// <summary>
/// 权限实体
/// </summary>
public string PermissionEntity { get; set; }
/// <summary>
/// 权限规则
/// </summary>
@ -41,6 +46,10 @@ public class DataRuleRes
/// 备注
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 创建时间

@ -603,8 +603,10 @@ public class CommonService : ICommonService
foreach (var item in list)
{
var childs = db.Queryable<SysPermissionTenant>().Where(x =>
x.MenuType == 2 && x.ParentId == item.ParentId && x.IsHidden == false && permissions.Contains(x.PermissionId) &&
(x.PermissionType == 1 || x.PermissionType == 0) && x.PermissionId!=1744968217220222976)//排除企业用户维护
x.MenuType == 2 && x.ParentId == item.ParentId && x.IsHidden == false &&
permissions.Contains(x.PermissionId) &&
(x.PermissionType == 1 || x.PermissionType == 0) &&
x.PermissionId != 1744968217220222976) //排除企业用户维护
.OrderBy(x => x.SortCode)
.Select(a => new RouteItem
{
@ -783,21 +785,24 @@ public class CommonService : ICommonService
#region 获取客户数据权限列表
/// <summary>
/// 获取客户数据权限列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientPermissionRes>> GetClientPermissionList()
{
var list = db.Queryable<SysPermission>().Where(x=> x.MenuType == 2 && x.IsHidden == false &&
(x.PermissionType == 1 || x.PermissionType == 0) && x.Id!=1744968217220222976 )
var list = db.Queryable<SysPermission>().Where(x => x.MenuType == 2 && x.IsHidden == false &&
(x.PermissionType == 1 || x.PermissionType == 0) &&
x.Id != 1744968217220222976 &&
(x.PermissionEntity != "" || x.PermissionEntity != null))
.Select<ClientPermissionRes>()
.ToList();
return DataResult<List<ClientPermissionRes>>.Success("获取数据成功!", list);
}
#endregion
#region 修改密码
/// <summary>
@ -972,7 +977,8 @@ public class CommonService : ICommonService
}
var moduleName = typeof(T).Name.ToLower();
var rule = db.Queryable<SysDataRule>().First(u => u.PermissionEntity.ToLower() == moduleName && u.Status == StatusEnum.Enable);
var rule = db.Queryable<SysDataRule>()
.First(u => u.PermissionEntity.ToLower() == moduleName && u.Status == StatusEnum.Enable);
if (rule == null) return db.Queryable<T>(); //没有设置数据规则,那么视为该资源允许被任何主体查看
if (rule.DataRules.Contains(DataRuleConst.LoginUser))
@ -980,19 +986,22 @@ public class CommonService : ICommonService
//即把{loginUser} =='xxxxxxx'换为 user.UserId =='xxxxxxx'从而把当前登录的用户名与当时设计规则时选定的用户id对比
rule.DataRules = rule.DataRules.Replace(DataRuleConst.LoginUser, user.UserId);
}
if (rule.DataRules.Contains(DataRuleConst.LoginRole))
{
var roles = db.Queryable<SysRoleUser>().Where(x => x.UserId == long.Parse(user.UserId) ).Select(n => n.RoleId)
var roles = db.Queryable<SysRoleUser>().Where(x => x.UserId == long.Parse(user.UserId))
.Select(n => n.RoleId)
.ToList();
roles.Sort();
rule.DataRules = rule.DataRules.Replace(DataRuleConst.LoginRole, string.Join(',',roles));
rule.DataRules = rule.DataRules.Replace(DataRuleConst.LoginRole, string.Join(',', roles));
}
if (rule.DataRules.Contains(DataRuleConst.LoginOrg))
{
var orgs = db.Queryable<SysOrgUser>().Where(x => x.UserId == long.Parse(user.UserId) ).Select(n => n.OrgId)
var orgs = db.Queryable<SysOrgUser>().Where(x => x.UserId == long.Parse(user.UserId)).Select(n => n.OrgId)
.ToList();
orgs.Sort();
rule.DataRules = rule.DataRules.Replace(DataRuleConst.LoginOrg, string.Join(',',orgs));
rule.DataRules = rule.DataRules.Replace(DataRuleConst.LoginOrg, string.Join(',', orgs));
}
var conditions = rule.DataRules.ConvertSqlSugarExpression();
@ -1003,8 +1012,6 @@ public class CommonService : ICommonService
}
#region 获取数据库表及字段属性
/// <summary>

@ -156,6 +156,7 @@ public class TenantApplyService : ITenantApplyService
foreach (var item in permissions)
{
var tenantPer = item.Adapt<SysPermissionTenant>();
tenantPer.Id = 0;
tenantPer.TenantId = tenant.Id;
tenantPer.PermissionId = item.Id;

@ -145,3 +145,17 @@
2024-02-20 09:40:59.9372 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-02-20 09:40:59.9923 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-20 09:41:00.1331 Info Configuration initialized.
2024-02-22 18:00:02.8205 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-02-22 18:00:02.8930 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-02-22 18:00:02.9099 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-02-22 18:00:02.9383 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-02-22 18:00:02.9564 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-02-22 18:00:02.9679 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-22 18:00:02.9866 Info Configuration initialized.
2024-02-23 08:54:46.3885 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-02-23 08:54:46.5134 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-02-23 08:54:46.5423 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-02-23 08:54:46.5925 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-02-23 08:54:46.6245 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-02-23 08:54:46.6406 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-23 08:54:46.6758 Info Configuration initialized.

Loading…
Cancel
Save