private void Search() { string strWhere = GetConduction(); ds = bProductionPlanSearch.GetProductionTechnology(strWhere); ds.Tables[0].Columns.Add("BTN_DOWN_LOAD", Type.GetType("System.String")); if (ds.Tables[0].Rows.Count < 1) { txtSlipNumber.Clear(); txtSlipType.Clear(); txtSlipTypeName.Clear(); cboStatus.SelectedIndex = 0; dateTimePicker1.Checked = false; dateTimePicker2.Checked = false; //dgvData.DataSource = ds.Tables[0]; dgvData.Rows.Clear(); MessageBox.Show("查询的信息不存在!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { Hashtable TechnologyDwHt = new Hashtable(); DataTable technologyDw = bProductionPlanSearch.GetTechnologyDw(GetConductionTechnologyDw()).Tables[0]; foreach (DataRow dr in technologyDw.Rows) { string key = CConvert.ToString(dr["SLIP_NUMBER"]) + CConvert.ToString(dr["SCHEDULE_LINE_NUMBER"]) + CConvert.ToString(dr["SCHEDULE_PRODUCTION_PROCESS_LINE_NUNBER"]) + CConvert.ToString(dr["TECHNOLOGY_LINE_NUMBER"]); int count = CConvert.ToInt32(dr["COUNT"]); int number = CConvert.ToInt32(dr["NUMBER"]); if (count >= number && number != 0) { TechnologyDwHt.Add(key, "有"); } else if (number == 0) { TechnologyDwHt.Add(key, "无"); } } foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["PST_STATUS_FLAG"].ToString() == CConvert.ToString(CConstant.STATUS)) { dr["PST_ACTUAL_END_TIME"] = DateTime.Now; } else if (dr["PST_STATUS_FLAG"].ToString() == CConvert.ToString(CConstant.STATUS_START)) { dr["PST_ACTUAL_END_TIME"] = CConvert.ToDateTime(dr["PST_ACTUAL_END_TIME"].ToString()); } string key = CConvert.ToString(dr["SLIP_NUMBER"]) + CConvert.ToString(dr["PST_SCHEDULE_LINE_NUMBER"]) + CConvert.ToString(dr["PST_SCHEDULE_PRODUCTION_PROCESS_LINE_NUNBER"]) + CConvert.ToString(dr["PST_TECHNOLOGY_LINE_NUMBER"]); if (TechnologyDwHt.Contains(key)) { dr["BTN_DOWN_LOAD"] = TechnologyDwHt[key]; } else { dr["BTN_DOWN_LOAD"] = "N/A"; } } //dgvData.DataSource = ds.Tables[0]; try { if (dgvData.Rows.Count > 0) { dgvData.Rows.Clear(); } foreach (DataRow dr in ds.Tables[0].Rows) { int currentRowIndex = dgvData.Rows.Add(1); DataGridViewRow row = dgvData.Rows[currentRowIndex]; row.Cells["SLIP_NUMBER"].Value = dr["SLIP_NUMBER"]; row.Cells["TYPE_NAME"].Value = dr["SLIP_TYPE_NAME"]; row.Cells["PARTS_NAME"].Value = dr["PARTS_NAME"]; row.Cells["PRODUCTION_PROCESS_NAME"].Value = dr["PRODUCTION_PROCESS_NAME"]; row.Cells["BT_TECHNOLOGY_NAME"].Value = dr["BT_TECHNOLOGY_NAME"]; // row.Cells["START_PLAN_DATE"].Value = dr["TECHNOLOGY_STATUS"]; row.Cells["END_PLAN_DATE"].Value = dr["PST_PLAN_END_DATE"]; // row.Cells["START_DATE"].Value = dr["PSPP_PLAN_END_DATE"]; row.Cells["BTN_DOWN_LOAD"].Value = dr["BTN_DOWN_LOAD"]; row.Cells["END_DATE"].Value = dr["PST_ACTUAL_END_TIME"]; // row.Cells["WEIGHT"].Value = dr["WEIGHT"]; row.Cells["PRODUCTION_PROCESS_CODE"].Value = dr["PRODUCTION_PROCESS_CODE"]; row.Cells["PSPP_LINE_NUMBER"].Value = dr["PSPP_LINE_NUMBER"]; row.Cells["SCHEDULE_LINE_NUNBER"].Value = dr["SCHEDULE_LINE_NUNBER"]; row.Cells["PSPP_STATUS_FLAG"].Value = dr["PSPP_STATUS_FLAG"]; row.Cells["PST_STATUS_FLAG"].Value = dr["PST_STATUS_FLAG"]; row.Cells["PST_SCHEDULE_LINE_NUMBER"].Value = dr["PST_SCHEDULE_LINE_NUMBER"]; row.Cells["PST_SCHEDULE_PRODUCTION_PROCESS_LINE_NUNBER"].Value = dr["PST_SCHEDULE_PRODUCTION_PROCESS_LINE_NUNBER"]; row.Cells["PST_TECHNOLOGY_LINE_NUMBER"].Value = dr["PST_TECHNOLOGY_LINE_NUMBER"]; row.Cells["PARTS_CODE"].Value = dr["PARTS_CODE"]; } } catch (Exception ex) { } foreach (DataGridViewRow dgvr in dgvData.Rows) { if (dgvr.Cells["PST_STATUS_FLAG"].Value.ToString().Equals("1")) { dgvr.Cells["CHK"].ReadOnly = true; dgvr.Cells["END_DATE"].ReadOnly = true; } } } }
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); }