diff --git a/DataBase/版本日志/SGGLDB_V2026-09-12-lpf( 新增防腐等级定义菜单).sql b/DataBase/版本日志/SGGLDB_V2026-09-12-lpf( 新增防腐等级定义菜单).sql new file mode 100644 index 00000000..a5b704e4 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-09-12-lpf( 新增防腐等级定义菜单).sql @@ -0,0 +1,102 @@ +SET XACT_ABORT ON; +BEGIN TRANSACTION; + +DECLARE @MenuId NVARCHAR(50) = N'44F69908-89DF-4B96-86F8-6ACC0019FBE7'; +DECLARE @MaterialMenuId NVARCHAR(50) = N'8IDKGJE2-09B1-4607-BC6D-865CE48F0013'; +DECLARE @SuperMenu NVARCHAR(50); +DECLARE @MenuType NVARCHAR(50); +DECLARE @SortIndex INT; +DECLARE @IsOffice BIT; + +SELECT + @SuperMenu = SuperMenu, + @MenuType = MenuType, + @SortIndex = SortIndex, + @IsOffice = IsOffice +FROM dbo.Sys_Menu +WHERE MenuId = @MaterialMenuId; + +IF @SuperMenu IS NULL +BEGIN + RAISERROR(N'未找到“管道材质定义”菜单,无法确定防腐等级定义菜单位置。', 16, 1); + ROLLBACK TRANSACTION; + RETURN; +END; + +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_Menu WHERE MenuId = @MenuId) +BEGIN + UPDATE dbo.Sys_Menu + SET SortIndex = ISNULL(SortIndex, 0) + 1 + WHERE SuperMenu = @SuperMenu + AND ISNULL(SortIndex, 0) >= ISNULL(@SortIndex, 0); + + INSERT INTO dbo.Sys_Menu + (MenuId, MenuName, Icon, Url, SortIndex, SuperMenu, MenuType, IsOffice, IsEnd, IsUsed) + VALUES + (@MenuId, N'防腐等级定义', NULL, N'HJGL/BaseInfo/PaintCodeDict.aspx', + @SortIndex, @SuperMenu, @MenuType, @IsOffice, 1, 1); +END +ELSE +BEGIN + UPDATE dbo.Sys_Menu + SET MenuName = N'防腐等级定义', + Url = N'HJGL/BaseInfo/PaintCodeDict.aspx', + SuperMenu = @SuperMenu, + MenuType = @MenuType, + IsEnd = 1, + IsUsed = 1 + WHERE MenuId = @MenuId; +END; + +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_ButtonToMenu WHERE MenuId = @MenuId AND ButtonName = N'增加') + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) + VALUES (N'D9437722-E216-408D-84DB-BBCBBF2763DF', @MenuId, N'增加', 1); + +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_ButtonToMenu WHERE MenuId = @MenuId AND ButtonName = N'修改') + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) + VALUES (N'0752CB84-0E82-4B3D-B7C4-8A563C65F340', @MenuId, N'修改', 2); + +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_ButtonToMenu WHERE MenuId = @MenuId AND ButtonName = N'删除') + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) + VALUES (N'3D4C0A40-C1F5-4431-A464-EA92CCA7C4D7', @MenuId, N'删除', 3); + +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_ButtonToMenu WHERE MenuId = @MenuId AND ButtonName = N'保存') + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) + VALUES (N'CFA71E37-08DE-4F49-8740-0F13B341331D', @MenuId, N'保存', 4); + +IF NOT EXISTS (SELECT 1 FROM dbo.Sys_ButtonToMenu WHERE MenuId = @MenuId AND ButtonName = N'查看') + INSERT INTO dbo.Sys_ButtonToMenu (ButtonToMenuId, MenuId, ButtonName, SortIndex) + VALUES (N'8EA926AF-CDF1-4F63-AF94-B91B3569D266', @MenuId, N'查看', 5); + +INSERT INTO dbo.Sys_RolePower (RolePowerId, RoleId, MenuId, MenuType, IsOffice) +SELECT CONVERT(NVARCHAR(50), NEWID()), source.RoleId, @MenuId, @MenuType, source.IsOffice +FROM dbo.Sys_RolePower source +WHERE source.MenuId = @MaterialMenuId + AND NOT EXISTS + ( + SELECT 1 + FROM dbo.Sys_RolePower target + WHERE target.RoleId = source.RoleId + AND target.MenuId = @MenuId + ); + +INSERT INTO dbo.Sys_ButtonPower (ButtonPowerID, RoleId, MenuId, ButtonToMenuId) +SELECT CONVERT(NVARCHAR(50), NEWID()), sourcePower.RoleId, @MenuId, targetButton.ButtonToMenuId +FROM dbo.Sys_ButtonPower sourcePower +INNER JOIN dbo.Sys_ButtonToMenu sourceButton + ON sourceButton.ButtonToMenuId = sourcePower.ButtonToMenuId + AND sourceButton.MenuId = @MaterialMenuId +INNER JOIN dbo.Sys_ButtonToMenu targetButton + ON targetButton.MenuId = @MenuId + AND targetButton.ButtonName = sourceButton.ButtonName +WHERE sourcePower.MenuId = @MaterialMenuId + AND NOT EXISTS + ( + SELECT 1 + FROM dbo.Sys_ButtonPower targetPower + WHERE targetPower.RoleId = sourcePower.RoleId + AND targetPower.MenuId = @MenuId + AND targetPower.ButtonToMenuId = targetButton.ButtonToMenuId + ); + +COMMIT TRANSACTION; diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index d1747f31..2f2a424d 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -407,6 +407,7 @@ + diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index 00e9501a..a4768d31 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -2844,6 +2844,11 @@ namespace BLL /// public const string HJGL_MaterialMenuId = "8IDKGJE2-09B1-4607-BC6D-865CE48F0013"; + /// + /// 防腐等级定义 + /// + public const string HJGL_PaintCodeDictMenuId = "44F69908-89DF-4B96-86F8-6ACC0019FBE7"; + /// /// 介质定义 /// diff --git a/SGGL/BLL/HJGL/BaseInfo/PaintCodeDictService.cs b/SGGL/BLL/HJGL/BaseInfo/PaintCodeDictService.cs new file mode 100644 index 00000000..3dac0dc8 --- /dev/null +++ b/SGGL/BLL/HJGL/BaseInfo/PaintCodeDictService.cs @@ -0,0 +1,76 @@ +using Model; +using System.Collections.Generic; +using System.Linq; + +namespace BLL +{ + public static class PaintCodeDictService + { + public static List GetList(string paintCode) + { + var query = Funs.DB.Tw_PaintCodeDict.AsQueryable(); + if (!string.IsNullOrEmpty(paintCode)) + { + query = query.Where(x => x.PaintCode.Contains(paintCode)); + } + + return query.OrderBy(x => x.SortIndex).ThenBy(x => x.PaintCode).ToList(); + } + + public static Tw_PaintCodeDict GetById(string id) + { + return Funs.DB.Tw_PaintCodeDict.FirstOrDefault(x => x.Id == id); + } + + public static bool PaintCodeExists(string paintCode, string excludeId) + { + if (string.IsNullOrEmpty(excludeId)) + { + return Funs.DB.Tw_PaintCodeDict.Any(x => x.PaintCode == paintCode); + } + + return Funs.DB.Tw_PaintCodeDict.Any(x => x.PaintCode == paintCode && x.Id != excludeId); + } + + public static void Add(Tw_PaintCodeDict paintCodeDict) + { + Funs.DB.Tw_PaintCodeDict.InsertOnSubmit(paintCodeDict); + Funs.DB.SubmitChanges(); + } + + public static void Update(Tw_PaintCodeDict paintCodeDict) + { + var model = Funs.DB.Tw_PaintCodeDict.First(x => x.Id == paintCodeDict.Id); + model.PaintCode = paintCodeDict.PaintCode; + model.Primer = paintCodeDict.Primer; + model.IntermediatePaint = paintCodeDict.IntermediatePaint; + model.Topcoat = paintCodeDict.Topcoat; + model.ColorCode = paintCodeDict.ColorCode; + model.SortIndex = paintCodeDict.SortIndex; + model.IsUsed = paintCodeDict.IsUsed; + Funs.DB.SubmitChanges(); + } + + public static string GetDeleteRestriction(string id) + { + if (Funs.DB.HJGL_Pipeline.Any(x => x.PaintId == id)) + { + return "已在【管线信息】中使用,不能删除!"; + } + + if (Funs.DB.HJGL_AntiCorrosionCheckRecord.Any(x => x.PaintId == id)) + { + return "已在【防腐检查记录】中使用,不能删除!"; + } + + return string.Empty; + } + + public static void Delete(string id) + { + var model = Funs.DB.Tw_PaintCodeDict.First(x => x.Id == id); + Funs.DB.Tw_PaintCodeDict.DeleteOnSubmit(model); + Funs.DB.SubmitChanges(); + } + } +} diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index e10ba9b4..00bb4242 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -1541,6 +1541,9 @@ + + + @@ -10338,6 +10341,27 @@ MaterialView.aspx + + PaintCodeDict.aspx + ASPXCodeBehind + + + PaintCodeDict.aspx + + + PaintCodeDictEdit.aspx + ASPXCodeBehind + + + PaintCodeDictEdit.aspx + + + PaintCodeDictView.aspx + ASPXCodeBehind + + + PaintCodeDictView.aspx + Medium.aspx ASPXCodeBehind diff --git a/SGGL/FineUIPro.Web/HJGL/BaseInfo/PaintCodeDict.aspx b/SGGL/FineUIPro.Web/HJGL/BaseInfo/PaintCodeDict.aspx new file mode 100644 index 00000000..1b243e7f --- /dev/null +++ b/SGGL/FineUIPro.Web/HJGL/BaseInfo/PaintCodeDict.aspx @@ -0,0 +1,78 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PaintCodeDict.aspx.cs" Inherits="FineUIPro.Web.HJGL.BaseInfo.PaintCodeDict" %> + + + + + 防腐等级定义 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +