Пример #1
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            foreach (Control ctl in this.Controls)
            {
                try
                {
                    // Attempt to cast the control to type MdiClient.
                    MdiClient ctlMDI = (MdiClient)ctl;

                    // Set the BackColor of the MdiClient control.
                    ctlMDI.BackColor = this.BackColor;
                }
                catch (InvalidCastException exc)
                {
                    // Catch and ignore the error if casting failed.
                }
            }

            lblUserName.Text       = _userInfo.NAME;
            lblDepartmentName.Text = _userInfo.DEPARTMENT_NAME;
            lblCompanyName.Text    = _userInfo.COMPANY_NAME;

            try
            {
                CCacheData.SetRolesFunction(_userInfo.ROLES_CODE);
            }
            catch { }
            //我的桌面的重新整理
            try
            {
                bCommon.ReSetMyDesk(_userInfo.COMPANY_CODE, _userInfo.CODE, _userInfo.ROLES_CODE);
            }
            catch (Exception ex)
            {
                Logger.Error("我的桌面的重新整理异常!", ex);
            }

            menuManage_Click(this.menuDesk, null);

            #region 通知

            BProductionPlanSearch bProductionPlanSearch = new BProductionPlanSearch();
            BProductionDrawing    bProductionDrawing    = new BProductionDrawing();
            try
            {
                int a = bProductionPlanSearch.GetProductionPlan(" DEPARTMENT_CODE = '" + _userInfo.DEPARTMENT_CODE + "'" + "  AND PSPP_STATUS_FLAG <> 2" + "  AND STATUS_FLAG <> 5").Tables[0].Rows.Count;
                int b = bProductionPlanSearch.GetProductionTechnology(" DEPARTMENT_CODE = '" + _userInfo.DEPARTMENT_CODE + "'" + "  AND PST_STATUS_FLAG <> 1" + "  AND STATUS_FLAG <> 5").Tables[0].Rows.Count;
                if (CConvert.ToInt32(a + b) > 0)
                {
                    menuProduceManage.Image           = Resources.warning;
                    menuProduceManage.BackgroundImage = null;
                    menuProduceManage.Top             = menuProduceManage.Top - 1;
                    menuProduceManage.Left            = menuProduceManage.Left - 1;
                }
                else if (_userInfo.DEPARTMENT_CODE.Equals("D05"))
                {
                    int c = bProductionDrawing.GetProductionDrawing("PSDL_STATUS_FLAG <> 1" + " AND PS_STATUS_FLAG <> 5").Tables[0].Rows.Count;
                    if (c > 0)
                    {
                        menuProduceManage.Image           = Resources.warning;
                        menuProduceManage.BackgroundImage = null;
                        menuProduceManage.Top             = menuProduceManage.Top - 1;
                        menuProduceManage.Left            = menuProduceManage.Left - 1;
                    }
                }
                else
                {
                    menuProduceManage.Image           = null;
                    menuProduceManage.BackgroundImage = Resources.buttonup;
                }
            }
            catch (Exception ex) { }


            ////入库预定
            //int receivingCount = 0;
            //try
            //{
            //    receivingCount = (new BReceipt()).GetRecordCount(" STATUS_FLAG =" + CConstant.INIT + " and DUE_DATE<= '" + DateTime.Now.ToString("yyyy-MM-dd") + "' ");
            //}
            //catch { }
            //if (receivingCount > 0)
            //{
            //    notifyMessage += "您有未处理的入库预定!\r\n";
            //}

            ////安全库存
            //int stockCount = 0;
            //try
            //{
            //    stockCount = (new BStock()).GetStockNotifyRecordCount(" STATUS_FLAG <> " + CConstant.DELETE + "and QUANTITY < SAFETY_STOCK ");
            //}
            //catch { }

            //if (stockCount > 0)
            //{
            //    notifyMessage += "商品库存不足,请尽快采购!\r\n";
            //}

            ////通知提示
            //if (notifyMessage != "")
            //{
            //    Thread notifyThread = new Thread(new ThreadStart(ShowNotify));
            //    notifyThread.Start();
            //}
            #endregion

            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmMain_FormClosing);
            this.FormClosed  += new System.Windows.Forms.FormClosedEventHandler(this.FrmMain_FormClosed);
        }