| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129 |
- using Admin.NET.Core;
- using Microsoft.Extensions.DependencyInjection;
- using SqlSugar;
- namespace Admin.NET.Plugin.AiDOP.Infrastructure;
- /// <summary>
- /// 将 Ai-DOP 种子菜单 Id 补写到 <c>sys_tenant_menu</c> / <c>sys_role_menu</c>。
- /// 解决:<c>SysTenantMenuSeedData</c> 带 IgnoreUpdateSeed,库已存在时新增菜单不会自动进租户/角色;多租户下仅补默认租户会导致其它租户侧栏与菜单管理不可见。
- /// </summary>
- public static class AidopMenuLinkSync
- {
- /// <summary>与框架种子中首条「系统管理员」角色 Id 一致。</summary>
- private const long SysAdminRoleId = 1300000000101L;
- private const long LegacyMaterialSubstitutionMenuId = 1329003000005L;
- private const long DeprecatedMaterialSubstitutionMenuId = 1329002000004L;
- private const long DeprecatedS8DashboardChildMenuId = 1329008000001L;
- private const long S8DirMenuId = 1321000009000L;
- public static void EnsureLinked(IServiceProvider services)
- {
- using var scope = services.CreateScope();
- var db = scope.ServiceProvider.GetRequiredService<ISqlSugarClient>();
- // Database.json 常关闭 EnableInitSeed/EnableIncreSeed,新增种子菜单不会入库;先补插 S2 三级结构再挂租户/角色。
- EnsureS2ManufacturingCollaborationSeedMenus(db);
- EnsureS4ProcurementExecutionSeedMenus(db);
- EnsureDataPlatformSeedMenus(db);
- NormalizeMaterialSubstitutionMenu(db);
- NormalizeS1OrderWorkOrderParents(db);
- NormalizeS2ManufacturingParents(db);
- NormalizeS2ScheduleExceptionMenu(db);
- NormalizeS2OperationPlanLeafMenus(db);
- NormalizeS2WorkOrderProgressKanbanMenu(db);
- NormalizeS3SupplyMenus(db);
- NormalizeS4DeliveryMenus(db);
- NormalizeS4ReturnMenus(db);
- NormalizeS4TopLevelMenus(db);
- EnsureLinkagePlanMenu(db);
- RemoveDeprecatedS8DashboardChildMenu(db);
- NormalizeS8MenuParents(db);
- var seedMenus = new global::Admin.NET.Plugin.AiDOP.SysMenuSeedData().HasData().ToList();
- var seedMenuIds = seedMenus.Select(m => m.Id).ToHashSet();
- var existingMenuIds = db.Queryable<SysMenu>()
- .Where(m => seedMenuIds.Contains(m.Id))
- .Select(m => m.Id)
- .ToList()
- .ToHashSet();
- if (existingMenuIds.Count == 0)
- return;
- var tenantIds = db.Queryable<SysTenant>().Select(t => t.Id).ToList();
- if (tenantIds.Count == 0)
- return;
- var tenantMenuPairs = db.Queryable<SysTenantMenu>()
- .Where(tm => tenantIds.Contains(tm.TenantId) && seedMenuIds.Contains(tm.MenuId))
- .Select(tm => new { tm.TenantId, tm.MenuId })
- .ToList()
- .Select(x => (x.TenantId, x.MenuId))
- .ToHashSet();
- var tenantRows = new List<SysTenantMenu>();
- foreach (var tid in tenantIds)
- {
- foreach (var menu in seedMenus)
- {
- if (!existingMenuIds.Contains(menu.Id))
- continue;
- if (tenantMenuPairs.Contains((tid, menu.Id)))
- continue;
- tenantRows.Add(new SysTenantMenu
- {
- Id = CommonUtil.GetFixedHashCode("" + tid + menu.Id, 1300000000000),
- TenantId = tid,
- MenuId = menu.Id
- });
- }
- }
- if (tenantRows.Count > 0)
- db.Insertable(tenantRows).ExecuteCommand();
- // 已为任一 Ai-DOP 种子菜单授权的角色,补全新增子菜单;并始终包含默认租户系统管理员角色。
- var roleIdsWithAnyAidop = db.Queryable<SysRoleMenu>()
- .Where(rm => seedMenuIds.Contains(rm.MenuId))
- .Select(rm => rm.RoleId)
- .ToList()
- .Distinct()
- .ToHashSet();
- roleIdsWithAnyAidop.Add(SysAdminRoleId);
- var roleMenuPairs = db.Queryable<SysRoleMenu>()
- .Where(rm => roleIdsWithAnyAidop.Contains(rm.RoleId) && seedMenuIds.Contains(rm.MenuId))
- .Select(rm => new { rm.RoleId, rm.MenuId })
- .ToList()
- .Select(x => (x.RoleId, x.MenuId))
- .ToHashSet();
- // SysRoleMenu 主键须全局唯一。使用 menu.Id + (roleId % 1300000000000) 时,不同 (MenuId, RoleId) 会算出相同 Id(如 1322000000208),
- // 批量插入失败,新菜单无法进入 sys_role_menu,侧栏不刷新。与 SysTenantMenu 一致,用固定哈希避免碰撞。
- var roleRows = new List<SysRoleMenu>();
- var pendingRoleMenuIds = new HashSet<long>();
- foreach (var roleId in roleIdsWithAnyAidop)
- {
- foreach (var menu in seedMenus)
- {
- if (!existingMenuIds.Contains(menu.Id))
- continue;
- if (roleMenuPairs.Contains((roleId, menu.Id)))
- continue;
- var rmId = CommonUtil.GetFixedHashCode($"{roleId}:{menu.Id}", 1300000000000);
- while (!pendingRoleMenuIds.Add(rmId))
- rmId++;
- roleRows.Add(new SysRoleMenu
- {
- Id = rmId,
- RoleId = roleId,
- MenuId = menu.Id
- });
- }
- }
- if (roleRows.Count > 0)
- db.Insertable(roleRows).ExecuteCommand();
- }
- /// <summary>
- /// S4「采购执行」:数据库关闭种子时菜单不入库,侧栏只能看到历史遗留项(常见仅“供应商交货管理”)。
- /// 从 <see cref="SysMenuSeedData.HasData"/> 取完整行按父链补插,确保交货/退货/看板目录与子菜单齐全。
- /// </summary>
- private static void EnsureS4ProcurementExecutionSeedMenus(ISqlSugarClient db)
- {
- const long aidopRootId = 1320990000101L;
- var fullSeed = new global::Admin.NET.Plugin.AiDOP.SysMenuSeedData().HasData().ToList();
- var byId = fullSeed.GroupBy(m => m.Id).ToDictionary(g => g.Key, g => g.First());
- var orderedIds = new long[]
- {
- aidopRootId,
- 1321000005000L, // S4 一级目录
- 1322000000012L, // 交货管理(Dir)
- 1322000000013L, // 退货管理(Dir)
- 1322000000014L, // 采购执行看板(Dir)
- 1329004100001L, // 供应商交货管理
- 1329004100002L, // 供应商发货单
- 1329004100003L, // 发货单表单(隐藏)
- 1329004200001L, // 采购退货单
- 1329004200002L, // 采购退货单表单(隐藏)
- 1329004200003L, // IQC 退货查询
- 1329004300001L, // 采购执行看板主页
- 1329004300002L, // 供应商欠料看板
- };
- var existingMenus = db.Queryable<SysMenu>().Where(m => orderedIds.Contains(m.Id)).ToList();
- var existing = existingMenus.Select(m => m.Id).ToHashSet();
- var cumulativeIds = new HashSet<long>(existing);
- var toInsert = new List<SysMenu>();
- foreach (var id in orderedIds)
- {
- if (cumulativeIds.Contains(id))
- continue;
- if (!byId.TryGetValue(id, out var row))
- continue;
- if (row.Pid != 0 && !cumulativeIds.Contains(row.Pid))
- continue;
- toInsert.Add(row);
- cumulativeIds.Add(id);
- }
- if (toInsert.Count > 0)
- db.Insertable(toInsert).ExecuteCommand();
- // 已插入过的演示菜单也需要随种子纠偏;例如「数据源管理」改为「数据地图」时,旧动态路由不更新会导致 404。
- foreach (var menu in existingMenus)
- {
- if (!byId.TryGetValue(menu.Id, out var seed))
- continue;
- var needFix = menu.Pid != seed.Pid
- || menu.Title != seed.Title
- || menu.Path != seed.Path
- || menu.Name != seed.Name
- || menu.Component != seed.Component
- || menu.Icon != seed.Icon
- || menu.Type != seed.Type
- || menu.OrderNo != seed.OrderNo
- || menu.Redirect != seed.Redirect
- || menu.IsHide != seed.IsHide
- || menu.Remark != seed.Remark;
- if (!needFix)
- continue;
- menu.Pid = seed.Pid;
- menu.Title = seed.Title;
- menu.Path = seed.Path;
- menu.Name = seed.Name;
- menu.Component = seed.Component;
- menu.Icon = seed.Icon;
- menu.Type = seed.Type;
- menu.OrderNo = seed.OrderNo;
- menu.Redirect = seed.Redirect;
- menu.IsHide = seed.IsHide;
- menu.Remark = seed.Remark;
- db.Updateable(menu)
- .UpdateColumns(m => new { m.Pid, m.Title, m.Path, m.Name, m.Component, m.Icon, m.Type, m.OrderNo, m.Redirect, m.IsHide, m.Remark })
- .ExecuteCommand();
- }
- }
- /// <summary>
- /// 数据中台管理:数据库关闭种子时,补插 Ai-DOP 下的数据中台统一入口和演示子页。
- /// </summary>
- private static void EnsureDataPlatformSeedMenus(ISqlSugarClient db)
- {
- const long aidopRootId = 1320990000101L;
- var fullSeed = new global::Admin.NET.Plugin.AiDOP.SysMenuSeedData().HasData().ToList();
- var byId = fullSeed.GroupBy(m => m.Id).ToDictionary(g => g.Key, g => g.First());
- var orderedIds = new long[]
- {
- aidopRootId,
- 1320990000400L,
- 1320990000401L,
- 1320990000402L,
- 1320990000403L,
- 1320990000404L,
- 1320990000405L,
- };
- var existing = db.Queryable<SysMenu>().Where(m => orderedIds.Contains(m.Id)).Select(m => m.Id).ToList().ToHashSet();
- var cumulativeIds = new HashSet<long>(existing);
- var toInsert = new List<SysMenu>();
- foreach (var id in orderedIds)
- {
- if (cumulativeIds.Contains(id))
- continue;
- if (!byId.TryGetValue(id, out var row))
- continue;
- if (row.Pid != 0 && !cumulativeIds.Contains(row.Pid))
- continue;
- toInsert.Add(row);
- cumulativeIds.Add(id);
- }
- if (toInsert.Count > 0)
- db.Insertable(toInsert).ExecuteCommand();
- }
- /// <summary>
- /// S2「制造协同」二级目录与三级子菜单:<c>Database.json</c> 关闭种子时不会入库,导致侧栏无「工单工序排程」等项。
- /// 从 <see cref="SysMenuSeedData.HasData"/> 取完整行一次性补插(含目录 Redirect)。
- /// </summary>
- private static void EnsureS2ManufacturingCollaborationSeedMenus(ISqlSugarClient db)
- {
- const long aidopRootId = 1320990000101L;
- var fullSeed = new global::Admin.NET.Plugin.AiDOP.SysMenuSeedData().HasData().ToList();
- var byId = fullSeed.GroupBy(m => m.Id).ToDictionary(g => g.Key, g => g.First());
- // 父链:Ai-DOP 根 → S2 一级目录 → 三个二级目录 → 三级菜单(同批插入时父行尚未落库,用 cumulativeIds 判定)
- var orderedIds = new long[]
- {
- aidopRootId,
- 1321000003000L,
- 1322000000006L,
- 1322000000007L,
- 1322000000008L,
- 1322000000108L,
- 1329002100001L,
- 1329002100011L,
- 1329002100012L,
- 1329002100013L,
- 1329002100014L,
- 1329002100015L,
- 1329002100021L,
- };
- var existing = db.Queryable<SysMenu>().Where(m => orderedIds.Contains(m.Id)).Select(m => m.Id).ToList().ToHashSet();
- var cumulativeIds = new HashSet<long>(existing);
- var toInsert = new List<SysMenu>();
- foreach (var id in orderedIds)
- {
- if (cumulativeIds.Contains(id))
- continue;
- if (!byId.TryGetValue(id, out var row))
- continue;
- if (row.Pid != 0 && !cumulativeIds.Contains(row.Pid))
- continue;
- toInsert.Add(row);
- cumulativeIds.Add(id);
- }
- if (toInsert.Count > 0)
- db.Insertable(toInsert).ExecuteCommand();
- }
- /// <summary>
- /// 计划联动看板(Id=1322000000107):<c>Database.json</c> 常关闭 <c>EnableIncreSeed</c>,种子不会入库,故在启动时补插/纠偏。
- /// 父级为产销协同看板目录 1322000000005。
- /// </summary>
- private static void EnsureLinkagePlanMenu(ISqlSugarClient db)
- {
- const long menuId = 1322000000107L;
- const long salesKanBanDirId = 1322000000005L;
- if (!db.Queryable<SysMenu>().Any(m => m.Id == salesKanBanDirId))
- return;
- var ct = DateTime.Parse("2022-02-10 00:00:00");
- if (!db.Queryable<SysMenu>().Any(m => m.Id == menuId))
- {
- db.Insertable(new SysMenu
- {
- Id = menuId,
- Pid = salesKanBanDirId,
- Title = "计划联动看板",
- Path = "/aidop/s1/SalesKanBan/linkage-plan",
- Name = "aidopS1LinkagePlan",
- Component = "/aidop/business/linkagePlanList",
- Icon = "ele-DataBoard",
- Type = MenuTypeEnum.Menu,
- CreateTime = ct,
- OrderNo = 30,
- Status = StatusEnum.Enable,
- Remark = "S1 计划联动看板(LinkagePlan)"
- }).ExecuteCommand();
- return;
- }
- var row = db.Queryable<SysMenu>().First(m => m.Id == menuId);
- if (row.Pid != salesKanBanDirId
- || row.Path != "/aidop/s1/SalesKanBan/linkage-plan"
- || row.Component != "/aidop/business/linkagePlanList")
- {
- row.Pid = salesKanBanDirId;
- row.Path = "/aidop/s1/SalesKanBan/linkage-plan";
- row.Name = "aidopS1LinkagePlan";
- row.Component = "/aidop/business/linkagePlanList";
- row.Title = "计划联动看板";
- row.Icon = "ele-DataBoard";
- row.OrderNo = 30;
- row.Type = MenuTypeEnum.Menu;
- db.Updateable(row)
- .UpdateColumns(m => new { m.Pid, m.Path, m.Name, m.Component, m.Title, m.Icon, m.OrderNo, m.Type })
- .ExecuteCommand();
- }
- }
- private static void NormalizeMaterialSubstitutionMenu(ISqlSugarClient db)
- {
- var deprecatedMenuId = DeprecatedMaterialSubstitutionMenuId;
- var legacyMenuId = LegacyMaterialSubstitutionMenuId;
- var legacyMenu = db.Queryable<SysMenu>()
- .First(m => m.Id == legacyMenuId);
- if (legacyMenu != null)
- {
- legacyMenu.Title = "物料替代";
- legacyMenu.Path = "/aidop/s0/manufacturing/material-substitution";
- legacyMenu.Name = "aidopS0MfgMaterialSubstitution";
- legacyMenu.Component = "/aidop/s0/manufacturing/MaterialSubstitutionList";
- legacyMenu.Remark = "S0 物料替代";
- db.Updateable(legacyMenu)
- .UpdateColumns(m => new { m.Title, m.Path, m.Name, m.Component, m.Remark })
- .ExecuteCommand();
- }
- var deprecatedExists = db.Queryable<SysMenu>().Any(m => m.Id == deprecatedMenuId);
- if (!deprecatedExists)
- return;
- db.Deleteable<SysUserMenu>().Where(x => x.MenuId == deprecatedMenuId).ExecuteCommand();
- db.Deleteable<SysRoleMenu>().Where(x => x.MenuId == deprecatedMenuId).ExecuteCommand();
- db.Deleteable<SysTenantMenu>().Where(x => x.MenuId == deprecatedMenuId).ExecuteCommand();
- db.Deleteable<SysMenu>().Where(x => x.Id == deprecatedMenuId).ExecuteCommand();
- }
- private static void RemoveDeprecatedS8DashboardChildMenu(ISqlSugarClient db)
- {
- const long deprecatedMenuId = DeprecatedS8DashboardChildMenuId;
- var deprecatedExists = db.Queryable<SysMenu>().Any(m => m.Id == deprecatedMenuId);
- if (!deprecatedExists)
- return;
- db.Deleteable<SysUserMenu>().Where(x => x.MenuId == deprecatedMenuId).ExecuteCommand();
- db.Deleteable<SysRoleMenu>().Where(x => x.MenuId == deprecatedMenuId).ExecuteCommand();
- db.Deleteable<SysTenantMenu>().Where(x => x.MenuId == deprecatedMenuId).ExecuteCommand();
- db.Deleteable<SysMenu>().Where(x => x.Id == deprecatedMenuId).ExecuteCommand();
- }
- private static void NormalizeS8MenuParents(ISqlSugarClient db)
- {
- var s8MenuIds = new long[]
- {
- 1329008000002L,
- 1329008000003L,
- 1329008000004L,
- 1329008000010L,
- 1329008000011L,
- 1329008000012L,
- 1329008000013L,
- 1329008000014L,
- 1329008000015L,
- 1329008000016L,
- 1329008000020L
- };
- db.Updateable<SysMenu>()
- .SetColumns(x => x.Pid == S8DirMenuId)
- .Where(x => s8MenuIds.Contains(x.Id) && x.Pid != S8DirMenuId)
- .ExecuteCommand();
- }
- /// <summary>
- /// 将 S1「订单管理」「工单管理」升级为目录并修正 path/name;
- /// 「产销协同看板」单独菜单路径为 /aidop/s1/SalesKanBan;
- /// 「工单下达」父级须为工单管理目录 1322000000004(历史错误曾挂到 0005)。
- /// 「工单工序排产」1322000000108 已迁至 S2「生产排程」下,见 <see cref="NormalizeS2ManufacturingParents"/>。
- /// </summary>
- private static void NormalizeS1OrderWorkOrderParents(ISqlSugarClient db)
- {
- const long orderMgmtId = 1322000000003L;
- const long workOrderMgmtId = 1322000000004L;
- const long salesKanBanMenuId = 1322000000005L;
- const long workOrderDispatchMenuId = 1322000000106L;
- var orderMgmt = db.Queryable<SysMenu>().First(m => m.Id == orderMgmtId);
- if (orderMgmt != null)
- {
- orderMgmt.Type = MenuTypeEnum.Dir;
- orderMgmt.Component = "Layout";
- orderMgmt.Path = "/aidop/s1/order-mgmt";
- orderMgmt.Name = "aidopS1OrderMgmt";
- orderMgmt.Icon = "ele-Folder";
- db.Updateable(orderMgmt)
- .UpdateColumns(m => new { m.Type, m.Component, m.Path, m.Name, m.Icon })
- .ExecuteCommand();
- }
- var workOrderMgmt = db.Queryable<SysMenu>().First(m => m.Id == workOrderMgmtId);
- if (workOrderMgmt != null)
- {
- workOrderMgmt.Type = MenuTypeEnum.Dir;
- workOrderMgmt.Component = "Layout";
- workOrderMgmt.Path = "/aidop/s1/workorder-mgmt";
- workOrderMgmt.Name = "aidopS1WorkOrderMgmt";
- workOrderMgmt.Icon = "ele-Folder";
- db.Updateable(workOrderMgmt)
- .UpdateColumns(m => new { m.Type, m.Component, m.Path, m.Name, m.Icon })
- .ExecuteCommand();
- }
- var salesKanBan = db.Queryable<SysMenu>().First(m => m.Id == salesKanBanMenuId);
- if (salesKanBan != null)
- {
- salesKanBan.Type = MenuTypeEnum.Menu;
- salesKanBan.Component = "/aidop/kanban/s1";
- salesKanBan.Path = "/aidop/s1/SalesKanBan";
- salesKanBan.Name = "aidopS1003";
- salesKanBan.Icon = "ele-DataAnalysis";
- db.Updateable(salesKanBan)
- .UpdateColumns(m => new { m.Type, m.Component, m.Path, m.Name, m.Icon })
- .ExecuteCommand();
- }
- var dispatch = db.Queryable<SysMenu>().First(m => m.Id == workOrderDispatchMenuId);
- if (dispatch != null)
- {
- var needFix = dispatch.Pid != workOrderMgmtId
- || dispatch.Path != "/aidop/s1/workorder-mgmt/dispatch";
- if (needFix)
- {
- dispatch.Pid = workOrderMgmtId;
- dispatch.Path = "/aidop/s1/workorder-mgmt/dispatch";
- db.Updateable(dispatch)
- .UpdateColumns(m => new { m.Pid, m.Path })
- .ExecuteCommand();
- }
- }
- }
- /// <summary>
- /// S2「生产排程 / 作业计划 / 制造协同看板」升级为目录;「工单工序排产」父级为生产排程 1322000000006,path 为 S2 路由。
- /// </summary>
- private static void NormalizeS2ManufacturingParents(ISqlSugarClient db)
- {
- const long productionSchedulingId = 1322000000006L;
- const long operationPlanId = 1322000000007L;
- const long collaborationKanbanId = 1322000000008L;
- const long workOrderSchedulingMenuId = 1322000000108L;
- void EnsureDir(long id, string path, string name)
- {
- var m = db.Queryable<SysMenu>().First(x => x.Id == id);
- if (m == null)
- return;
- m.Type = MenuTypeEnum.Dir;
- m.Component = "Layout";
- m.Path = path;
- m.Name = name;
- m.Icon = "ele-Folder";
- db.Updateable(m)
- .UpdateColumns(x => new { x.Type, x.Component, x.Path, x.Name, x.Icon })
- .ExecuteCommand();
- }
- EnsureDir(productionSchedulingId, "/aidop/s2/production-scheduling", "aidopS2ProductionScheduling");
- EnsureDir(operationPlanId, "/aidop/s2/operation-plan", "aidopS2OperationPlan");
- EnsureDir(collaborationKanbanId, "/aidop/s2/collaboration-kanban", "aidopS2CollaborationKanban");
- var scheduling = db.Queryable<SysMenu>().First(m => m.Id == workOrderSchedulingMenuId);
- if (scheduling == null)
- return;
- const string s2SchedulingPath = "/aidop/s2/production-scheduling/work-order-scheduling";
- var needFix = scheduling.Pid != productionSchedulingId
- || scheduling.Path != s2SchedulingPath
- || scheduling.Name != "aidopS2WorkOrderScheduling";
- if (!needFix)
- return;
- scheduling.Pid = productionSchedulingId;
- scheduling.Path = s2SchedulingPath;
- scheduling.Name = "aidopS2WorkOrderScheduling";
- db.Updateable(scheduling)
- .UpdateColumns(m => new { m.Pid, m.Path, m.Name })
- .ExecuteCommand();
- }
- /// <summary>
- /// S2「排产异常记录」由占位页 <c>/aidop/planning/index</c> 改为真实列表页 <c>/aidop/production/scheduleExceptionList</c>。
- /// </summary>
- private static void NormalizeS2ScheduleExceptionMenu(ISqlSugarClient db)
- {
- const long menuId = 1329002100001L;
- const string component = "/aidop/production/scheduleExceptionList";
- var m = db.Queryable<SysMenu>().First(x => x.Id == menuId);
- if (m == null)
- return;
- if (m.Component == component)
- return;
- m.Component = component;
- m.Remark = "S2 排产异常记录";
- db.Updateable(m)
- .UpdateColumns(x => new { x.Component, x.Remark })
- .ExecuteCommand();
- }
- /// <summary>
- /// S2「作业计划」下三页由占位改为真实组件(库中已落旧 <c>/aidop/planning/index</c> 时纠偏)。
- /// </summary>
- private static void NormalizeS2OperationPlanLeafMenus(ISqlSugarClient db)
- {
- (long Id, string Component, string Title)[] map =
- {
- (1329002100011L, "/aidop/production/executableDailyPlanList", "可执行日计划"),
- (1329002100012L, "/aidop/production/shopCalendarWorkCtrList", "产线工作日历管理"),
- (1329002100013L, "/aidop/production/qualityLineRestDetailList", "产线休息时间管理"),
- (1329002100014L, "/aidop/production/holidayMasterList", "产线节假日管理"),
- (1329002100015L, "/aidop/production/lineOvertimeList", "产线加班管理"),
- };
- foreach (var (id, component, title) in map)
- {
- var m = db.Queryable<SysMenu>().First(x => x.Id == id);
- if (m == null)
- continue;
- if (m.Component == component && m.Title == title)
- continue;
- m.Component = component;
- m.Title = title;
- db.Updateable(m)
- .UpdateColumns(x => new { x.Component, x.Title })
- .ExecuteCommand();
- }
- }
- /// <summary>
- /// S2「工单执行进度看板」由占位 <c>/aidop/kanban/s2</c> 改为列表页 <c>/aidop/production/workOrderProgressDashboardList</c>。
- /// </summary>
- private static void NormalizeS2WorkOrderProgressKanbanMenu(ISqlSugarClient db)
- {
- const long menuId = 1329002100021L;
- const string component = "/aidop/production/workOrderProgressDashboardList";
- var m = db.Queryable<SysMenu>().First(x => x.Id == menuId);
- if (m == null)
- return;
- if (m.Component == component)
- return;
- m.Component = component;
- m.Remark = "S2 工单执行进度看板(列表)";
- db.Updateable(m)
- .UpdateColumns(x => new { x.Component, x.Remark })
- .ExecuteCommand();
- }
- /// <summary>
- /// S3「物料计划」下三项菜单:种子关闭时补插,已存在时纠偏到真实组件页。
- /// </summary>
- private static void NormalizeS3SupplyMenus(ISqlSugarClient db)
- {
- const long s3RootId = 1321000004000L;
- const long parentId = 1322000000009L;
- const long procurementDirId = 1322000000010L;
- if (!db.Queryable<SysMenu>().Any(m => m.Id == parentId) || !db.Queryable<SysMenu>().Any(m => m.Id == procurementDirId))
- return;
- var procurementDir = db.Queryable<SysMenu>().First(m => m.Id == procurementDirId);
- if (procurementDir != null)
- {
- var procurementNeedFix = procurementDir.Pid != s3RootId
- || procurementDir.Title != "采购管理"
- || procurementDir.Path != "/aidop/s3/procurement"
- || procurementDir.Name != "aidopS3Procurement"
- || procurementDir.Component != "Layout"
- || procurementDir.Type != MenuTypeEnum.Dir
- || procurementDir.Icon != "ele-Folder"
- || procurementDir.Redirect != "/aidop/s3/procurement/purchase-request"
- || procurementDir.Remark != "S3 采购管理";
- if (procurementNeedFix)
- {
- procurementDir.Pid = s3RootId;
- procurementDir.Title = "采购管理";
- procurementDir.Path = "/aidop/s3/procurement";
- procurementDir.Name = "aidopS3Procurement";
- procurementDir.Component = "Layout";
- procurementDir.Type = MenuTypeEnum.Dir;
- procurementDir.Icon = "ele-Folder";
- procurementDir.Redirect = "/aidop/s3/procurement/purchase-request";
- procurementDir.Remark = "S3 采购管理";
- db.Updateable(procurementDir)
- .UpdateColumns(m => new { m.Pid, m.Title, m.Path, m.Name, m.Component, m.Type, m.Icon, m.Redirect, m.Remark })
- .ExecuteCommand();
- }
- }
- var ct = DateTime.Parse("2022-02-10 00:00:00");
- var defs = new (long Id, string Title, string Path, string Name, string Component, string Icon, int OrderNo, string Remark)[]
- {
- (
- 1329003100001L,
- "物料需求计划",
- "/aidop/s3/material-plan/demand-schedule",
- "aidopS3DemandSchedule",
- "/aidop/s3/supply/demandScheduleList",
- "ele-Calendar",
- 10,
- "S3 物料需求计划(ic_demandschedule)"
- ),
- (
- 1329003100002L,
- "物料交货计划",
- "/aidop/s3/material-plan/delivery-schedule",
- "aidopS3DeliverySchedule",
- "/aidop/s3/supply/deliveryScheduleList",
- "ele-Document",
- 20,
- "S3 物料交货计划(srm_polist_ds)"
- ),
- (
- 1329003100003L,
- "交货单异常记录",
- "/aidop/s3/material-plan/delivery-exception",
- "aidopS3DeliveryException",
- "/aidop/s3/supply/deliveryExceptionList",
- "ele-Warning",
- 30,
- "S3 交货单异常记录(DeliveryExceptionMaster)"
- ),
- };
- foreach (var def in defs)
- {
- var row = db.Queryable<SysMenu>().First(m => m.Id == def.Id);
- if (row == null)
- {
- db.Insertable(new SysMenu
- {
- Id = def.Id,
- Pid = parentId,
- Title = def.Title,
- Path = def.Path,
- Name = def.Name,
- Component = def.Component,
- Icon = def.Icon,
- Type = MenuTypeEnum.Menu,
- CreateTime = ct,
- OrderNo = def.OrderNo,
- Status = StatusEnum.Enable,
- Remark = def.Remark
- }).ExecuteCommand();
- continue;
- }
- var needFix = row.Pid != parentId
- || row.Path != def.Path
- || row.Name != def.Name
- || row.Component != def.Component
- || row.Title != def.Title
- || row.Icon != def.Icon
- || row.OrderNo != def.OrderNo
- || row.Type != MenuTypeEnum.Menu
- || row.Remark != def.Remark;
- if (!needFix)
- continue;
- row.Pid = parentId;
- row.Path = def.Path;
- row.Name = def.Name;
- row.Component = def.Component;
- row.Title = def.Title;
- row.Icon = def.Icon;
- row.OrderNo = def.OrderNo;
- row.Type = MenuTypeEnum.Menu;
- row.Remark = def.Remark;
- db.Updateable(row)
- .UpdateColumns(m => new { m.Pid, m.Path, m.Name, m.Component, m.Title, m.Icon, m.OrderNo, m.Type, m.Remark })
- .ExecuteCommand();
- }
- EnsureS3LeafMenu(
- db, ct, 1329003100011L, procurementDirId, "物料采购申请",
- "/aidop/s3/procurement/purchase-request", "aidopS3PurchaseRequest",
- "/aidop/s3/supply/purchaseRequestList", "ele-Document", 10, "S3 物料采购申请(srm_pr_main)");
- EnsureS3LeafMenu(
- db, ct, 1329003100012L, procurementDirId, "物料采购订单",
- "/aidop/s3/procurement/purchase-order", "aidopS3PurchaseOrder",
- "/aidop/s3/supply/purchaseOrderList", "ele-Tickets", 20, "S3 物料采购订单(vscm_jhjh)");
- EnsureS3LeafMenu(
- db, ct, 1329003100013L, procurementDirId, "委外加工订单",
- "/aidop/s3/procurement/outsource-order", "aidopS3OutsourceOrder",
- "/aidop/s3/supply/outsourceOrderList", "ele-List", 30, "S3 委外加工订单(PurOrdMaster/PW)");
- EnsureS3LeafMenu(
- db, ct, 1329003100014L, procurementDirId, "工序外协订单",
- "/aidop/s3/procurement/process-outsource-order", "aidopS3ProcessOutsourceOrder",
- "/aidop/s3/supply/processOutsourceOrderList", "ele-List", 40, "S3 工序外协订单(PurOrdMaster/PW)");
- EnsureS3DirMenu(
- db, ct, 1329003100010L, s3RootId, "供应协同看板",
- "/aidop/s3/supply-kanban", "aidopS3SupplyKanbanDir",
- "/aidop/s3/supply-kanban/dashboard", "S3 供应协同看板目录");
- EnsureS3LeafMenu(
- db, ct, 1329003100015L, 1329003100010L, "供应协同看板",
- "/aidop/s3/supply-kanban/dashboard", "aidopS3SupplyKanban",
- "/aidop/kanban/s3", "ele-DataBoard", 10, "S3 供应协同看板");
- EnsureS3LeafMenu(
- db, ct, 1329003100016L, 1329003100010L, "工单物料齐套上线看板",
- "/aidop/s3/supply-kanban/work-order-material-readiness", "aidopS3WorkOrderMaterialReadiness",
- "/aidop/s3/supply/workOrderMaterialReadinessKanban", "ele-List", 20, "S3 工单物料齐套上线看板");
- EnsureS3LeafMenu(
- db, ct, 1329003100017L, 1329003100010L, "MDP运行监控",
- "/aidop/s3/supply-kanban/mdp-monitor", "aidopS3MdpMonitor",
- "/aidop/s3/supply/mdpMonitorList", "ele-Monitor", 30, "S3 MDP 同步与转换运行监控");
- }
- /// <summary>
- /// S4「交货管理」目录与子菜单纠偏/补齐。
- /// </summary>
- private static void NormalizeS4DeliveryMenus(ISqlSugarClient db)
- {
- const long s4RootId = 1321000005000L;
- const long deliveryDirId = 1322000000012L;
- if (!db.Queryable<SysMenu>().Any(m => m.Id == deliveryDirId))
- return;
- var dir = db.Queryable<SysMenu>().First(m => m.Id == deliveryDirId);
- if (dir != null)
- {
- var needFix = dir.Pid != s4RootId
- || dir.Title != "交货管理"
- || dir.Path != "/aidop/s4/delivery"
- || dir.Name != "aidopS4Delivery"
- || dir.Component != "Layout"
- || dir.Type != MenuTypeEnum.Dir
- || dir.Icon != "ele-Folder"
- || dir.Redirect != "/aidop/s4/delivery/supplier-delivery-management";
- if (needFix)
- {
- dir.Pid = s4RootId;
- dir.Title = "交货管理";
- dir.Path = "/aidop/s4/delivery";
- dir.Name = "aidopS4Delivery";
- dir.Component = "Layout";
- dir.Type = MenuTypeEnum.Dir;
- dir.Icon = "ele-Folder";
- dir.Redirect = "/aidop/s4/delivery/supplier-delivery-management";
- db.Updateable(dir)
- .UpdateColumns(m => new { m.Pid, m.Title, m.Path, m.Name, m.Component, m.Type, m.Icon, m.Redirect })
- .ExecuteCommand();
- }
- }
- var ct = DateTime.Parse("2022-02-10 00:00:00");
- EnsureS3LeafMenu(
- db, ct, 1329004100001L, deliveryDirId, "供应商交货管理",
- "/aidop/s4/delivery/supplier-delivery-management", "aidopS4SupplierDeliveryManagement",
- "/aidop/s4/delivery/supplierDeliveryManagementList", "ele-Document", 10, "S4 供应商交货管理");
- EnsureS3LeafMenu(
- db, ct, 1329004100002L, deliveryDirId, "供应商发货单",
- "/aidop/s4/delivery/supplier-shipment", "aidopS4SupplierShipment",
- "/aidop/s4/delivery/supplierShipmentList", "ele-Tickets", 20, "S4 供应商发货单");
- var formMenu = db.Queryable<SysMenu>().First(m => m.Id == 1329004100003L);
- if (formMenu == null)
- {
- db.Insertable(new SysMenu
- {
- Id = 1329004100003L,
- Pid = deliveryDirId,
- Title = "发货单表单",
- Path = "/aidop/s4/delivery/supplier-shipment-form",
- Name = "aidopS4SupplierShipmentForm",
- Component = "/aidop/s4/delivery/supplierShipmentForm",
- Icon = "ele-Document",
- Type = MenuTypeEnum.Menu,
- IsHide = true,
- CreateTime = ct,
- OrderNo = 90,
- Status = StatusEnum.Enable,
- Remark = "S4 发货单新增/编辑/查看表单"
- }).ExecuteCommand();
- return;
- }
- var formNeedFix = formMenu.Pid != deliveryDirId
- || formMenu.Path != "/aidop/s4/delivery/supplier-shipment-form"
- || formMenu.Name != "aidopS4SupplierShipmentForm"
- || formMenu.Component != "/aidop/s4/delivery/supplierShipmentForm"
- || formMenu.Title != "发货单表单"
- || formMenu.Icon != "ele-Document"
- || formMenu.Type != MenuTypeEnum.Menu
- || formMenu.OrderNo != 90
- || formMenu.IsHide != true
- || formMenu.Remark != "S4 发货单新增/编辑/查看表单";
- if (!formNeedFix)
- return;
- formMenu.Pid = deliveryDirId;
- formMenu.Path = "/aidop/s4/delivery/supplier-shipment-form";
- formMenu.Name = "aidopS4SupplierShipmentForm";
- formMenu.Component = "/aidop/s4/delivery/supplierShipmentForm";
- formMenu.Title = "发货单表单";
- formMenu.Icon = "ele-Document";
- formMenu.Type = MenuTypeEnum.Menu;
- formMenu.OrderNo = 90;
- formMenu.IsHide = true;
- formMenu.Remark = "S4 发货单新增/编辑/查看表单";
- db.Updateable(formMenu)
- .UpdateColumns(m => new { m.Pid, m.Path, m.Name, m.Component, m.Title, m.Icon, m.Type, m.OrderNo, m.IsHide, m.Remark })
- .ExecuteCommand();
- }
- private static void NormalizeS4ReturnMenus(ISqlSugarClient db)
- {
- const long s4RootId = 1321000005000L;
- const long returnDirId = 1322000000013L;
- if (!db.Queryable<SysMenu>().Any(m => m.Id == returnDirId))
- return;
- var dir = db.Queryable<SysMenu>().First(m => m.Id == returnDirId);
- if (dir != null)
- {
- var needFix = dir.Pid != s4RootId
- || dir.Title != "退货管理"
- || dir.Path != "/aidop/s4/return-mgmt"
- || dir.Name != "aidopS4ReturnMgmt"
- || dir.Component != "Layout"
- || dir.Type != MenuTypeEnum.Dir
- || dir.Icon != "ele-Folder"
- || dir.Redirect != "/aidop/s4/return-mgmt/purchase-return-order";
- if (needFix)
- {
- dir.Pid = s4RootId;
- dir.Title = "退货管理";
- dir.Path = "/aidop/s4/return-mgmt";
- dir.Name = "aidopS4ReturnMgmt";
- dir.Component = "Layout";
- dir.Type = MenuTypeEnum.Dir;
- dir.Icon = "ele-Folder";
- dir.Redirect = "/aidop/s4/return-mgmt/purchase-return-order";
- dir.Remark = "S4 退货管理";
- db.Updateable(dir)
- .UpdateColumns(m => new { m.Pid, m.Title, m.Path, m.Name, m.Component, m.Type, m.Icon, m.Redirect, m.Remark })
- .ExecuteCommand();
- }
- }
- var ct = DateTime.Parse("2022-02-10 00:00:00");
- EnsureS3LeafMenu(
- db, ct, 1329004200001L, returnDirId, "采购退货单",
- "/aidop/s4/return-mgmt/purchase-return-order", "aidopS4PurchaseReturnOrder",
- "/aidop/s4/return/purchaseReturnOrderList", "ele-Document", 10, "S4 采购退货单");
- EnsureS3LeafMenu(
- db, ct, 1329004200003L, returnDirId, "IQC 退货查询",
- "/aidop/s4/return-mgmt/iqc-return-query", "aidopS4IqcReturnQuery",
- "/aidop/s4/return/iqcReturnQueryList", "ele-Search", 20, "S4 IQC 退货查询(只读列表)");
- var formMenu = db.Queryable<SysMenu>().First(m => m.Id == 1329004200002L);
- if (formMenu == null)
- {
- db.Insertable(new SysMenu
- {
- Id = 1329004200002L,
- Pid = returnDirId,
- Title = "采购退货单表单",
- Path = "/aidop/s4/return-mgmt/purchase-return-order-form",
- Name = "aidopS4PurchaseReturnOrderForm",
- Component = "/aidop/s4/return/purchaseReturnOrderForm",
- Icon = "ele-Document",
- Type = MenuTypeEnum.Menu,
- IsHide = true,
- CreateTime = ct,
- OrderNo = 90,
- Status = StatusEnum.Enable,
- Remark = "S4 采购退货单新增/编辑/查看表单"
- }).ExecuteCommand();
- }
- else
- {
- var formNeedFix = formMenu.Pid != returnDirId
- || formMenu.Path != "/aidop/s4/return-mgmt/purchase-return-order-form"
- || formMenu.Name != "aidopS4PurchaseReturnOrderForm"
- || formMenu.Component != "/aidop/s4/return/purchaseReturnOrderForm"
- || formMenu.Title != "采购退货单表单"
- || formMenu.Icon != "ele-Document"
- || formMenu.Type != MenuTypeEnum.Menu
- || formMenu.OrderNo != 90
- || formMenu.IsHide != true;
- if (formNeedFix)
- {
- formMenu.Pid = returnDirId;
- formMenu.Path = "/aidop/s4/return-mgmt/purchase-return-order-form";
- formMenu.Name = "aidopS4PurchaseReturnOrderForm";
- formMenu.Component = "/aidop/s4/return/purchaseReturnOrderForm";
- formMenu.Title = "采购退货单表单";
- formMenu.Icon = "ele-Document";
- formMenu.Type = MenuTypeEnum.Menu;
- formMenu.OrderNo = 90;
- formMenu.IsHide = true;
- formMenu.Remark = "S4 采购退货单新增/编辑/查看表单";
- db.Updateable(formMenu)
- .UpdateColumns(m => new { m.Pid, m.Path, m.Name, m.Component, m.Title, m.Icon, m.Type, m.OrderNo, m.IsHide, m.Remark })
- .ExecuteCommand();
- }
- }
- }
- /// <summary>S4:隐藏规划占位「采购管理」;纠正「采购执行看板」路径与组件。</summary>
- private static void NormalizeS4TopLevelMenus(ISqlSugarClient db)
- {
- const long purchaseMgmtPlaceholderId = 1322000000011L;
- const long executionKanbanId = 1322000000014L;
- if (db.Queryable<SysMenu>().Any(m => m.Id == purchaseMgmtPlaceholderId))
- {
- var proc = db.Queryable<SysMenu>().First(m => m.Id == purchaseMgmtPlaceholderId);
- if (proc != null && proc.IsHide != true)
- {
- proc.IsHide = true;
- db.Updateable(proc).UpdateColumns(m => new { m.IsHide }).ExecuteCommand();
- }
- }
- if (!db.Queryable<SysMenu>().Any(m => m.Id == executionKanbanId))
- return;
- var kb = db.Queryable<SysMenu>().First(m => m.Id == executionKanbanId);
- var needFix = kb.Path != "/aidop/s4/execution-kanban"
- || kb.Name != "aidopS4ExecutionKanban"
- || kb.Component != "Layout"
- || kb.Type != MenuTypeEnum.Dir
- || kb.Icon != "ele-Folder"
- || kb.Redirect != "/aidop/s4/execution-kanban/dashboard";
- if (needFix)
- {
- kb.Path = "/aidop/s4/execution-kanban";
- kb.Name = "aidopS4ExecutionKanban";
- kb.Component = "Layout";
- kb.Type = MenuTypeEnum.Dir;
- kb.Icon = "ele-Folder";
- kb.Redirect = "/aidop/s4/execution-kanban/dashboard";
- kb.Remark = "S4 采购执行看板目录(含主页 + 供应商欠料看板)";
- db.Updateable(kb)
- .UpdateColumns(m => new { m.Path, m.Name, m.Component, m.Type, m.Icon, m.Redirect, m.Remark })
- .ExecuteCommand();
- }
- var ct = DateTime.Parse("2022-02-10 00:00:00");
- EnsureS3LeafMenu(
- db, ct, 1329004300001L, executionKanbanId, "采购执行看板主页",
- "/aidop/s4/execution-kanban/dashboard", "aidopS4ExecutionKanbanDashboard",
- "/aidop/kanban/s4", "ele-DataBoard", 10, "S4 采购执行看板主页(/aidop/kanban/s4)");
- EnsureS3LeafMenu(
- db, ct, 1329004300002L, executionKanbanId, "供应商欠料看板",
- "/aidop/s4/execution-kanban/supplier-shortage-kanban", "aidopS4SupplierShortageKanban",
- "/aidop/s4/execution-kanban/supplierShortageKanbanList", "ele-List", 20, "S4 供应商欠料看板(WorkOrdDetailTotalKB)");
- }
- private static void EnsureS3LeafMenu(
- ISqlSugarClient db,
- DateTime ct,
- long id,
- long pid,
- string title,
- string path,
- string name,
- string component,
- string icon,
- int orderNo,
- string remark)
- {
- var row = db.Queryable<SysMenu>().First(m => m.Id == id);
- if (row == null)
- {
- db.Insertable(new SysMenu
- {
- Id = id,
- Pid = pid,
- Title = title,
- Path = path,
- Name = name,
- Component = component,
- Icon = icon,
- Type = MenuTypeEnum.Menu,
- CreateTime = ct,
- OrderNo = orderNo,
- Status = StatusEnum.Enable,
- Remark = remark
- }).ExecuteCommand();
- return;
- }
- var needFix = row.Pid != pid
- || row.Title != title
- || row.Path != path
- || row.Name != name
- || row.Component != component
- || row.Icon != icon
- || row.Type != MenuTypeEnum.Menu
- || row.OrderNo != orderNo
- || row.Remark != remark;
- if (!needFix)
- return;
- row.Pid = pid;
- row.Title = title;
- row.Path = path;
- row.Name = name;
- row.Component = component;
- row.Icon = icon;
- row.Type = MenuTypeEnum.Menu;
- row.OrderNo = orderNo;
- row.Remark = remark;
- db.Updateable(row)
- .UpdateColumns(m => new { m.Pid, m.Title, m.Path, m.Name, m.Component, m.Icon, m.Type, m.OrderNo, m.Remark })
- .ExecuteCommand();
- }
- private static void EnsureS3DirMenu(
- ISqlSugarClient db,
- DateTime ct,
- long id,
- long pid,
- string title,
- string path,
- string name,
- string redirect,
- string remark)
- {
- var row = db.Queryable<SysMenu>().First(m => m.Id == id);
- if (row == null)
- {
- db.Insertable(new SysMenu
- {
- Id = id,
- Pid = pid,
- Title = title,
- Path = path,
- Name = name,
- Component = "Layout",
- Icon = "ele-Folder",
- Type = MenuTypeEnum.Dir,
- Redirect = redirect,
- CreateTime = ct,
- OrderNo = 102,
- Status = StatusEnum.Enable,
- Remark = remark
- }).ExecuteCommand();
- return;
- }
- var needFix = row.Pid != pid
- || row.Title != title
- || row.Path != path
- || row.Name != name
- || row.Component != "Layout"
- || row.Icon != "ele-Folder"
- || row.Type != MenuTypeEnum.Dir
- || row.Redirect != redirect
- || row.OrderNo != 102
- || row.Remark != remark;
- if (!needFix)
- return;
- row.Pid = pid;
- row.Title = title;
- row.Path = path;
- row.Name = name;
- row.Component = "Layout";
- row.Icon = "ele-Folder";
- row.Type = MenuTypeEnum.Dir;
- row.Redirect = redirect;
- row.OrderNo = 102;
- row.Remark = remark;
- db.Updateable(row)
- .UpdateColumns(m => new { m.Pid, m.Title, m.Path, m.Name, m.Component, m.Icon, m.Type, m.Redirect, m.OrderNo, m.Remark })
- .ExecuteCommand();
- }
- }
|