diff --git a/ds-wms-service/DS.Module.SqlSugar/SqlsugarHelper.cs b/ds-wms-service/DS.Module.SqlSugar/SqlsugarHelper.cs index 5960a216..ee5156b4 100644 --- a/ds-wms-service/DS.Module.SqlSugar/SqlsugarHelper.cs +++ b/ds-wms-service/DS.Module.SqlSugar/SqlsugarHelper.cs @@ -27,9 +27,11 @@ 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)) { - entityInfo.SetValue(SnowFlakeSingle.Instance.NextId()); + var id = entityInfo.EntityColumnInfo.PropertyInfo.GetValue(entityInfo.EntityValue); + if (id == null || (long)id == 0) + entityInfo.SetValue(SnowFlakeSingle.Instance.NextId()); } } diff --git a/ds-wms-service/DS.WMS.AdminApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.AdminApi/Logs/internal-nlog.txt index 49bc2f14..e23830fd 100644 --- a/ds-wms-service/DS.WMS.AdminApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.AdminApi/Logs/internal-nlog.txt @@ -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. diff --git a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeGoods.cs b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeGoods.cs new file mode 100644 index 00000000..34832be7 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeGoods.cs @@ -0,0 +1,103 @@ +using DS.Module.Core; +using DS.Module.Core.Data; +using SqlSugar; + +namespace DS.WMS.Core.Code.Entity; +/// +/// 商品信息表 +/// +[SqlSugar.SugarTable("op_code_goods","商品信息表")] +public class CodeGoods: BaseModel +{ + /// + /// 商品编码 + /// + [SugarColumn(ColumnDescription = "商品编码", Length = 30)] + public string GoodsCode { get; set; } + + /// + /// 商品名称 + /// + [SugarColumn(ColumnDescription = "商品名称", Length = 50)] + public string GoodName { get; set; } + + /// + /// 物料号 + /// + [SugarColumn(ColumnDescription = "物料号", Length = 50)] + public string GoodNo { get; set; } + + /// + /// 英文名称 + /// + [SugarColumn(ColumnDescription = "英文名称", Length = 10)] + public string EnName { get; set; } + /// + /// 商品描述 + /// + [SugarColumn(ColumnDescription = "商品描述", Length = 200)] + public string Description { get; set; } + + /// + /// 入库应收 + /// + [SugarColumn(ColumnDescription = "入库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")] + public decimal ARRate { get; set; } + + /// + /// 入库应付 + /// + [SugarColumn(ColumnDescription = "入库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")] + public decimal APRate { get; set; } + /// + /// 出库应收 + /// + [SugarColumn(ColumnDescription = "出库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")] + public decimal AROutRate { get; set; } + + /// + /// 出库应付 + /// + [SugarColumn(ColumnDescription = "出库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")] + public decimal APOutRate { get; set; } + + /// + /// 商品类型 + /// + [SugarColumn(ColumnDescription = "商品类型", IsNullable = true)] + public long GoodsTypeId { get; set; } + /// + /// 计费大类 + /// + [SugarColumn(ColumnDescription = "计费大类", IsNullable = true)] + public long GoodsFeeTypeId { get; set; } + + /// + /// 海关代码 + /// + [SugarColumn(ColumnDescription = "海关代码", Length = 50)] + public string HSCode { get; set; } + + /// + /// 申报计量单位 + /// + [SugarColumn(ColumnDescription = "物料号", Length = 50)] + public string RuleUnit { get; set; } + + /// + /// 法定第一计量单位 + /// + [SugarColumn(ColumnDescription = "法定第一计量单位", Length = 50)] + public string RuleUnit1 { get; set; } + + /// + /// 法定第二计量单位 + /// + [SugarColumn(ColumnDescription = "法定第二计量单位", Length = 50)] + public string RuleUnit2 { get; set; } + /// + /// 状态 0启用 1禁用 + /// + [SugarColumn(ColumnDescription = "状态",DefaultValue = "0")] + public StatusEnum? Status { get; set; } = StatusEnum.Enable; +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeGoodsType.cs b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeGoodsType.cs new file mode 100644 index 00000000..ddd4a566 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeGoodsType.cs @@ -0,0 +1,39 @@ +using DS.Module.Core; +using DS.Module.Core.Data; +using SqlSugar; + +namespace DS.WMS.Core.Code.Entity; +/// +/// 商品类型表 +/// +[SqlSugar.SugarTable("op_code_goods_type","商品类型表")] +public class CodeGoodsType: BaseModel +{ + /// + /// 类型代码 + /// + [SugarColumn(ColumnDescription = "类型代码", Length = 20)] + public string GoodsTypeCode { get; set; } + + /// + /// 货物类型 + /// + [SugarColumn(ColumnDescription = "货物类型", Length = 50)] + public string GoodsTypeName { get; set; } + + /// + /// 英文名称 + /// + [SugarColumn(ColumnDescription = "英文名称", Length = 10)] + public string EnName { get; set; } + /// + /// 描述 + /// + [SugarColumn(ColumnDescription = "描述", Length = 200)] + public string Description { get; set; } + /// + /// 状态 0启用 1禁用 + /// + [SugarColumn(ColumnDescription = "状态",DefaultValue = "0")] + public StatusEnum? Status { get; set; } = StatusEnum.Enable; +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/DS.WMS.Core.csproj b/ds-wms-service/DS.WMS.Core/DS.WMS.Core.csproj index ea7b5066..86f45634 100644 --- a/ds-wms-service/DS.WMS.Core/DS.WMS.Core.csproj +++ b/ds-wms-service/DS.WMS.Core/DS.WMS.Core.csproj @@ -20,6 +20,10 @@ + + + + diff --git a/ds-wms-service/DS.WMS.Core/Flow/Dtos/FlowTemplateReq.cs b/ds-wms-service/DS.WMS.Core/Flow/Dtos/FlowTemplateReq.cs index 6fa58162..a3c159de 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Dtos/FlowTemplateReq.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Dtos/FlowTemplateReq.cs @@ -37,7 +37,10 @@ public class FlowTemplateReq /// 排序 /// public int? OrderNo { get; set; } = 100; - + /// + /// 状态 0 启用 1 禁用 + /// + public StatusEnum? Status { get; set; } = StatusEnum.Enable; /// /// 备注 /// diff --git a/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowTemplateService.cs b/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowTemplateService.cs index 1f14a1f8..6c38d280 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowTemplateService.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowTemplateService.cs @@ -80,6 +80,7 @@ public class ClientFlowTemplateService : IClientFlowTemplateService } var data = info.Adapt(); + data.Id = 0; db.Insertable(data).ExecuteCommand(); return DataResult.Successed("引入成功!",MultiLanguageConst.DataImportSuccess); } diff --git a/ds-wms-service/DS.WMS.Core/System/Dtos/DataRuleReq.cs b/ds-wms-service/DS.WMS.Core/System/Dtos/DataRuleReq.cs index 98cf2be1..0309a92c 100644 --- a/ds-wms-service/DS.WMS.Core/System/Dtos/DataRuleReq.cs +++ b/ds-wms-service/DS.WMS.Core/System/Dtos/DataRuleReq.cs @@ -24,11 +24,18 @@ public class DataRuleReq /// 权限规则 /// public string DataRules { get; set; } - + /// + /// 权限实体 + /// + public string PermissionEntity { get; set; } /// /// 数据权限描述 /// public string Description { get; set; } + /// + /// 排序 + /// + public int? OrderNo { get; set; } = 100; /// /// 状态 0 启用 1 禁用 diff --git a/ds-wms-service/DS.WMS.Core/System/Dtos/DataRuleRes.cs b/ds-wms-service/DS.WMS.Core/System/Dtos/DataRuleRes.cs index 19b8e774..ccc8dd1e 100644 --- a/ds-wms-service/DS.WMS.Core/System/Dtos/DataRuleRes.cs +++ b/ds-wms-service/DS.WMS.Core/System/Dtos/DataRuleRes.cs @@ -23,6 +23,11 @@ public class DataRuleRes /// 权限模块名称 /// public string PermissionName { get; set; } + + /// + /// 权限实体 + /// + public string PermissionEntity { get; set; } /// /// 权限规则 /// @@ -41,7 +46,11 @@ public class DataRuleRes /// 备注 /// public string Note { get; set; } = ""; - + /// + /// 排序 + /// + public int? OrderNo { get; set; } = 100; + /// /// 创建时间 /// diff --git a/ds-wms-service/DS.WMS.Core/System/Method/CommonService.cs b/ds-wms-service/DS.WMS.Core/System/Method/CommonService.cs index 7cc2d909..bee3fcc6 100644 --- a/ds-wms-service/DS.WMS.Core/System/Method/CommonService.cs +++ b/ds-wms-service/DS.WMS.Core/System/Method/CommonService.cs @@ -603,8 +603,10 @@ public class CommonService : ICommonService foreach (var item in list) { var childs = db.Queryable().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 { @@ -760,7 +762,7 @@ public class CommonService : ICommonService } #endregion 获取用户下拉列表 - + #region 获取机构下拉列表 /// @@ -783,21 +785,24 @@ public class CommonService : ICommonService #region 获取客户数据权限列表 + /// /// 获取客户数据权限列表 /// /// public DataResult> GetClientPermissionList() { - var list = db.Queryable().Where(x=> x.MenuType == 2 && x.IsHidden == false && - (x.PermissionType == 1 || x.PermissionType == 0) && x.Id!=1744968217220222976 ) + var list = db.Queryable().Where(x => x.MenuType == 2 && x.IsHidden == false && + (x.PermissionType == 1 || x.PermissionType == 0) && + x.Id != 1744968217220222976 && + (x.PermissionEntity != "" || x.PermissionEntity != null)) .Select() .ToList(); return DataResult>.Success("获取数据成功!", list); } - #endregion + #region 修改密码 /// @@ -972,7 +977,8 @@ public class CommonService : ICommonService } var moduleName = typeof(T).Name.ToLower(); - var rule = db.Queryable().First(u => u.PermissionEntity.ToLower() == moduleName && u.Status == StatusEnum.Enable); + var rule = db.Queryable() + .First(u => u.PermissionEntity.ToLower() == moduleName && u.Status == StatusEnum.Enable); if (rule == null) return db.Queryable(); //没有设置数据规则,那么视为该资源允许被任何主体查看 if (rule.DataRules.Contains(DataRuleConst.LoginUser)) @@ -980,31 +986,32 @@ 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().Where(x => x.UserId == long.Parse(user.UserId) ).Select(n => n.RoleId) + var roles = db.Queryable().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)); + roles.Sort(); + rule.DataRules = rule.DataRules.Replace(DataRuleConst.LoginRole, string.Join(',', roles)); } + if (rule.DataRules.Contains(DataRuleConst.LoginOrg)) { - var orgs = db.Queryable().Where(x => x.UserId == long.Parse(user.UserId) ).Select(n => n.OrgId) + var orgs = db.Queryable().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)); + orgs.Sort(); + rule.DataRules = rule.DataRules.Replace(DataRuleConst.LoginOrg, string.Join(',', orgs)); } var conditions = rule.DataRules.ConvertSqlSugarExpression(); var conditionalModels = db.ConfigQuery.Context.Utilities.JsonToConditionalModels( JsonConvert.SerializeObject(conditions)); - return db.Queryable().Where(conditionalModels); + return db.Queryable().Where(conditionalModels); } - - #region 获取数据库表及字段属性 /// diff --git a/ds-wms-service/DS.WMS.Core/System/Method/TenantApplyService.cs b/ds-wms-service/DS.WMS.Core/System/Method/TenantApplyService.cs index 6bce7c63..c34742b9 100644 --- a/ds-wms-service/DS.WMS.Core/System/Method/TenantApplyService.cs +++ b/ds-wms-service/DS.WMS.Core/System/Method/TenantApplyService.cs @@ -156,6 +156,7 @@ public class TenantApplyService : ITenantApplyService foreach (var item in permissions) { var tenantPer = item.Adapt(); + tenantPer.Id = 0; tenantPer.TenantId = tenant.Id; tenantPer.PermissionId = item.Id; diff --git a/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt index c851d29d..a6ea881d 100644 --- a/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt @@ -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.