--1.售饭子系统初始菜单表
INSERT INTO dbo.ST_MenuInfo(Menu_ID,System_No,Menu_No,Menu_Name,Menu_Hint,Para_ID,Call_Mode,Form_Name,ShortKey,
                        Menu_Index,Image_Index,Separator,InToolBar,Remark)
SELECT * FROM (SELECT 175[Menu_ID],'DC'[System_No],'DC_01'[Menu_No],'系统管理'[Menu_Name],NULL[Menu_Hint],-1[Para_ID],NULL[Call_Mode],
                      NULL[Form_Name],NULL[ShortKey],1[Menu_Index],NULL[Image_Index],NULL[Separator],0[InToolBar],NULL[Remark]
                                UNION ALL SELECT 176,'DC','DC_0101','订餐机设置','订餐机设置',175,2,'TfrmMocSetDC',NULL,1,65,0,0,NULL
                                UNION ALL SELECT 177,'DC','DC_0102','订餐规则设置','订餐规则设置',175,2,'TfrmRuleSet',NULL,2,66,1,0,NULL
								UNION ALL SELECT 178,'DC','MJ_0103','退出系统','退出系统',175,5,'Exit',NULL,3,0,0,0,NULL
								UNION ALL SELECT 179,'DC','DC_02','订餐管理',NULL,-1,NULL,NULL,NULL,2,-1,NULL,0,NULL
								UNION ALL SELECT 180,'DC','DC_0201','订餐数据下载','订餐数据下载',179,1,'TfrmDownloadDC',NULL,1,67,1,0,NULL
								UNION ALL SELECT 181,'DC','DC_0202','手工订餐','手工订餐',179,1,'TfrmSelfOrder',NULL,2,68,'0',0,NULL
								UNION ALL SELECT 182,'DC','DC_0203','撤消订餐','撤消订餐',179,1,'TfrmDeleteOrder',NULL,3,69,'0',0,NULL
								UNION ALL SELECT 183,'DC','DC_03','订餐报表',NULL,-1,NULL,NULL,NULL,3,-1,NULL,0,NULL
								UNION ALL SELECT 184,'DC','DC_0301','订餐数据明细','订餐数据明细报表',183,1,'TfrmOrderData',NULL,1,70,0,0,NULL
								UNION ALL SELECT 185,'DC','DC_0302','订餐数据汇总','订餐数据汇总报表',183,1,'TfrmOrderTotal',NULL,2,71,1,0,NULL
								UNION ALL SELECT 186,'DC','DC_0303','未用餐明细','未用餐明细报表',183,1,'TfrmUnuseData',NULL,3,-1,0,0,NULL
								UNION ALL SELECT 187,'DC','DC_0304','未用餐汇总','未用餐汇总报表',183,1,'TfrmUnuseTotal',NULL,4,-1,0,0,NULL
								UNION ALL SELECT 188,'DC','DC_04','系统维护',NULL,-1,NULL,NULL,NULL,4,-1,NULL,0,NULL
								UNION ALL SELECT 189,'DC','DC_0401','过期数据清理','过期数据清理',188,2,'TfrmClearData',NULL,1,-1,0,0,NULL
								UNION ALL SELECT 190,'SF','SF_0204','订餐系统','订餐系统',89,4,'OrderMeal.exe',NULL,4,72,0,0,NULL								
							) A
 WHERE A.Menu_ID NOT IN (SELECT Menu_ID FROM dbo.ST_MenuInfo)
GO

--初始化实时订餐的菜单
INSERT INTO dbo.ST_MenuInfo(Menu_ID,System_No,Menu_No,Menu_Name,Menu_Hint,Para_ID,Call_Mode,Form_Name,ShortKey,
                        Menu_Index,Image_Index,Separator,InToolBar,Remark)
SELECT * FROM (SELECT 600[Menu_ID],'DC'[System_No],'DC_10'[Menu_No],'系统管理'[Menu_Name],NULL[Menu_Hint],-1[Para_ID],NULL[Call_Mode],
                      NULL[Form_Name],NULL[ShortKey],1[Menu_Index],NULL[Image_Index],NULL[Separator],0[InToolBar],NULL[Remark]
                UNION ALL SELECT 601,'DC','DC_1001','系统参数设置','系统参数设置',600,2,'TfrmSysparamSet_R',NULL,1,65,1,0,NULL
                UNION ALL SELECT 602,'DC','DC_1002','订餐机设置','订餐机设置',600,2,'TfrmMocSetDC_R',NULL,2,65,0,0,NULL
                UNION ALL SELECT 603,'DC','DC_1003','订餐时间设置','订餐时间设置',600,2,'TfrmRepast_R',NULL,3,66,1,0,NULL
                UNION ALL SELECT 604,'DC','DC_1004','退出系统','退出系统',600,5,'Exit',NULL,4,0,0,0,NULL
                UNION ALL SELECT 605,'DC','DC_11','订餐管理',NULL,-1,NULL,NULL,NULL,2,-1,NULL,0,NULL
                UNION ALL SELECT 606,'DC','DC_1101','订餐机控制台','订餐机控制台',605,1,'TfrmMocStateDC',NULL,1,67,1,0,NULL
                UNION ALL SELECT 607,'DC','DC_1102','手工订餐','手工订餐',605,1,'TfrmSelfOrder_R',NULL,2,68,'0',0,NULL
                UNION ALL SELECT 608,'DC','DC_1103','撤消订餐','撤消订餐',605,1,'TfrmDeleteOrder_R',NULL,3,69,'0',0,NULL
                UNION ALL SELECT 609,'DC','DC_12','订餐报表',NULL,-1,NULL,NULL,NULL,3,-1,NULL,0,NULL
                UNION ALL SELECT 610,'DC','DC_1201','订餐数据明细','订餐数据明细报表',609,1,'TfrmOrderData_R',NULL,1,70,0,0,NULL
                UNION ALL SELECT 611,'DC','DC_1202','订餐数据汇总','订餐数据汇总报表',609,1,'TfrmOrderTotal_R',NULL,2,71,1,0,NULL
                UNION ALL SELECT 612,'DC','DC_1203','未用餐明细','未用餐明细报表',609,1,'TfrmUnuseData_R',NULL,3,-1,0,0,NULL
                UNION ALL SELECT 613,'DC','DC_1204','未用餐汇总','未用餐汇总报表',609,1,'TfrmUnuseTotal_R',NULL,4,-1,0,0,NULL
                UNION ALL SELECT 614,'DC','DC_13','系统维护',NULL,-1,NULL,NULL,NULL,4,-1,NULL,0,NULL
                UNION ALL SELECT 615,'DC','DC_1301','过期数据清理','过期数据清理',614,2,'TfrmClearData',NULL,1,-1,0,0,NULL
                UNION ALL SELECT 599,'DC','DC_0100','系统参数设置','系统参数设置',175,2,'TfrmSysparamSet_R',NULL,0,-1,1,0,NULL
              ) A
 WHERE A.Menu_ID NOT IN (SELECT Menu_ID FROM dbo.ST_MenuInfo)
GO

--2.增加系统权限值列表
--2.1增加每个模块的默认权限值

--3.增加角色权限默认管理员组

IF NOT EXISTS(SELECT Param_Code FROM ST_SysParam WHERE Param_Code='DC.Solution')   
   INSERT INTO ST_SysParam(Param_Code,Param_Name,Param_Value)
   SELECT 'DC.Solution','DC.Solution','0'
GO

IF NOT EXISTS(SELECT Param_Code FROM ST_SysParam WHERE Param_Code='DC.IsUseMOCAsMDC')   
   INSERT INTO ST_SysParam(Param_Code,Param_Name,Param_Value)
   SELECT 'DC.IsUseMOCAsMDC','DC.IsUseMOCAsMDC','0'
GO

--4.更新子系统创建日期
UPDATE dbo.ST_SubSystem SET DBCreateDate=CONVERT(VARCHAR(10),GETDATE(),121),DBVersion = '3.2.0'
WHERE  System_No = 'DC'
GO

