//添加 private void ButAdd_Click(object sender, EventArgs e) { try { qCDrumsFindLeakReportBindingSource.EndEdit();//获取文本框数据 if (model.FLResult.IsNullOrEmpty()) { FLResultTextEdit.Focus(); ClsMsg.ShowWarningEmptyMsg(ItemForFLResult.Text); } else if (model.Frequency.IsNullOrEmpty()) { FrequencyTextEdit.Focus(); ClsMsg.ShowWarningEmptyMsg(ItemForFrequency.Text); } else if (model.DevName.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForDrumsName.Text); } else if (model.FLSituation.IsNullOrEmpty()) { FLSituationTextEdit.Focus(); ClsMsg.ShowWarningEmptyMsg(ItemForFLSituation.Text); } else if (model.FLResult.Equals("合格") || ClsMsg.ShowQuestionMsg("当前检漏结果为:不合格!\r\n是否继续提交呢?") == DialogResult.Yes) { BgWait.RunWorkerAsync("SaveData"); } } catch (Exception ex) { Utils.Logger.Error(ex.ToString()); ClsMsg.ShowErrMsg(ex.Message); } }
private void bt_Del_Click(object sender, EventArgs e) { try { uAEnumBindingSource.EndEdit(); Model = uAEnumBindingSource.DataSource as UA_Enum; if (Model.EnumType == null) { ClsMsg.ShowInfoMsg("请选择要删除的数据"); } else { if (bgWait.IsBusy == false) { if (ClsMsg.ShowQuestionMsg("是否要删除该字典名称?") == System.Windows.Forms.DialogResult.Yes) { bgWait.RunWorkerAsync("DelDateDictionary"); } } } } catch (Exception ex) { Utils.Logger.Error(ex.ToString()); ClsMsg.ShowInfoMsg(ex.Message); } }
public void DeleteDepartmentClass(DoWorkEventArgs e) { departmentBindingSource.EndEdit(); if (string.IsNullOrEmpty(DepCodeTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForDepCode.Text); } else { if (ClsMsg.ShowQuestionMsg("是否删除" + DepNameTextEdit.Text + "部门数据?") == DialogResult.Yes) { using (var DelClient = new SRDepartment.DepartmentServiceClient()) { Model = new SRDepartment.Department(); Model = departmentBindingSource.DataSource as SRDepartment.Department; var ret = DelClient.DelDepartmentData(context.SessionID, Model.DepCode); if (ret.IsSuccess) { this.AddSysOperLogs(this.Text, OperateStatus.除, strCode: Model.DepCode); e.Result = true; ClsMsg.ShowWarningMsg("数据删除成功!"); } else { e.Result = true; bgWait.ReportProgress(101, ret.Message); } } } } }
public void UpdataDepartmentClass(DoWorkEventArgs e) { departmentBindingSource.EndEdit(); this.strDepartmentNameNow = DepNameTextEdit.Text; Model = new SRDepartment.Department(); Model = departmentBindingSource.DataSource as SRDepartment.Department; if (string.IsNullOrEmpty(DepNameTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForDepName.Text); } else { if (ClsMsg.ShowQuestionMsg("是否修改该模板数据?") == DialogResult.Yes) { using (var upClient = new SRDepartment.DepartmentServiceClient()) { var ret = upClient.UpdataDepartmentData(context.SessionID, Model, strDepartmentNameOriginal, strDepartmentNameNow); if (ret.IsSuccess) { this.AddSysOperLogs(this.Text, OperateStatus.修改, strCode: Model.DepCode); e.Result = true; ClsMsg.ShowWarningMsg("数据更新完毕!"); } else { e.Result = false; bgWait.ReportProgress(101, ret.Message); } } } } }
private void bgWait_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { if (e.Result != null) { if (e.Result is SRPersonInfo.Person) { if (ClsMsg.ShowQuestionMsg("数据新增成功!\n 是否继续新增职员档案?") == DialogResult.Yes) { AddPersonData(); } else { this.DialogResult = DialogResult.OK; } } else if (e.Result is bool) { this.DialogResult = DialogResult.OK; } } } catch (Exception ex) { ClsMsg.ShowErrMsg(ex.Message); Utils.Logger.Error(ex.ToString()); } }
/// <summary> /// 连接设备 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button4_Click(object sender, EventArgs e) { if (ClsMsg.ShowQuestionMsg("是否连接设备?") == DialogResult.Yes) { button4.Enabled = false; try { // 获取到本机IP GetServerIP(); //自动获取到本机电脑端口 // IP = IPAddress.Parse("192.168.1.238"); IP = IPAddress.Parse("192.168.1.238"); int point = Convert.ToInt32("8899"); endpoint = new IPEndPoint(IP, point); //建立Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); CollectTime.Start(); System.Threading.Thread th = new System.Threading.Thread(this.ToConnect); th.Start(); } catch (Exception ex) { MessageBox.Show("连接尚未建立!无法发送数据!" + ex.Message); } } }
private void btn_Submit_Click(object sender, EventArgs e) { // mainPipelineInfoBindingSource.DataSource = Model; OperatingTimeTextEdit.Text = DateTime.Now.ToString(); CreateDateDateEdit.Text = DateTime.Now.ToString(); if (string.IsNullOrEmpty(DeveCodeTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForDeveCode.Text); DeveCodeTextEdit.Focus(); } else if (string.IsNullOrEmpty(DeveNameTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForDeveName.Text); DeveNameTextEdit.Focus(); } else if (string.IsNullOrEmpty(PipelineStatusTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForPipelineStatus.Text); PipelineStatusTextEdit.Focus(); } else if (string.IsNullOrEmpty(PromptDesTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForPromptDes.Text); PromptDesTextEdit.Focus(); } //else if (string.IsNullOrEmpty(OperatorReamrkTextEdit.Text)) //{ // ClsMsg.ShowWarningEmptyMsg(ItemForOperatorReamrk.Text); // OperatorReamrkTextEdit.Focus(); //} else if (string.IsNullOrEmpty(FrequencyTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForFrequency.Text); FrequencyTextEdit.Focus(); } else if (string.IsNullOrEmpty(OperatorTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForOperator.Text); OperatorTextEdit.Focus(); } else if (string.IsNullOrEmpty(CreatorTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForCreator.Text); CreatorTextEdit.Focus(); } else if (string.IsNullOrEmpty(CreateDateDateEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForCreateDate.Text); CreateDateDateEdit.Focus(); } else if (backgroundWorker.IsBusy == false) { if (ClsMsg.ShowQuestionMsg("是否保存当前操作?") == DialogResult.Yes) { backgroundWorker.RunWorkerAsync("AddOperatingData"); } } }
private void button6_Click(object sender, EventArgs e) { Byte[] bs; if (ClsMsg.ShowQuestionMsg("是否要打开排水阀门?") == DialogResult.Yes) { bs = System.Text.Encoding.UTF8.GetBytes("XXL-0-53"); //发现UTF8可支持中文,就用之 socket.BeginSend(bs, 0, bs.Length, 0, new AsyncCallback(SendCallback), socket); } }
private void bmTool_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { switch (e.Item.Name) { case "bbtniSave": //EndEditOnAllBindingSources(); deviceBindingSource.EndEdit(); if (model.DevCode.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForDevCode.Text); DevCodeTextEdit.Focus(); } else if (model.DevName.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForDevName.Text); DevNameTextEdit.Focus(); } else if (model.DevCCode.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForDevCCode.Text); DevCCodeTextEdit.Focus(); } else if (ClsMsg.ShowQuestionMsg("是否要保存设备档案信息呢?") == DialogResult.Yes) { bgwWait.RunWorkerAsync("SaveData"); } break; case "bbtniDel": if (strDevCode.IsNullOrEmpty()) { ClsMsg.ShowWarningMsg("无任何数据可删除!"); return; } if (ClsMsg.ShowQuestionMsg("是否要删除设备档案呢?") == DialogResult.Yes) { bgwWait.RunWorkerAsync("DeleteData"); } break; case "bbtniExit": this.Close(); break; default: break; } } catch (Exception ex) { ClsMsg.ShowErrMsg(ex.Message); Utils.Logger.Error(ex.ToString()); } }
private void bt_Save_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(EnumTypeTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForEnumType.Text); } else if (string.IsNullOrEmpty(TypeNameTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForTypeName.Text); } else if (string.IsNullOrEmpty(EnumCodeTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForEnumCode.Text); } else if (string.IsNullOrEmpty(ItemForEnumCode.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForEnumName.Text); } else if (string.IsNullOrEmpty(IOrderTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForIOrder.Text); } else if (string.IsNullOrEmpty(SysCodeTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForSysCode.Text); } else { if (bgWait.IsBusy == false) { if (AutoIDSpinEdit.Text != "0") { if (ClsMsg.ShowQuestionMsg("是否保存修改后的数据?") == System.Windows.Forms.DialogResult.Yes) { bgWait.RunWorkerAsync("UpdateDateDictionary"); } } else { if (ClsMsg.ShowQuestionMsg("是否保存新增数据?") == System.Windows.Forms.DialogResult.Yes) { bgWait.RunWorkerAsync("AddDateDictionary"); } } } } } catch (Exception ex) { Utils.Logger.Error(ex.ToString()); ClsMsg.ShowInfoMsg(ex.Message); } }
private void BgWait1_DoWork(object sender, DoWorkEventArgs e) { BgWait1.ReportProgress(0); try { switch (e.Argument.ToString()) { case "Refresh": // MessageBox.Show(MyAddress); // dataGridView1.DataSource = client.GetDevViewList("text"); // dataGridView1.Refresh(); // String str = this.dataGridView1.SelectedCells[0].Value.ToString(); // MessageBox.Show(str); break; case "bttniStartTask": if (ClsMsg.ShowQuestionMsg("启动任务?") == DialogResult.Yes) { workTask.StartTask(); } break; case "bttniEndTask": if (ClsMsg.ShowQuestionMsg("停止任务?") == DialogResult.Yes) { workTask.StopTask(); } break; default: break; } } catch (Exception ex) { BgWait1.ReportProgress(102, ex.Message); } BgWait1.ReportProgress(100); }
/// <summary> /// 数采仪接口控制后真空阀门 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { try { Byte[] bs; //string Tap1 = cache.ListGetByIndex("52", 0); //string[] Tap1Array = Tap1.Split('-'); string Tap1 = string.Format("{0}_{1}", DateTime.Now.ToString("yyyyMMdd"), 52); string Tap1Array = cache.ListGetByIndex(Tap1, 0); if (socket.Connected == true) { if (Tap1Array[0].ToString() == "1") { if (ClsMsg.ShowQuestionMsg("是否要打开后真空阀门?") == DialogResult.Yes) { bs = System.Text.Encoding.UTF8.GetBytes("XXL-1-52"); //发现UTF8可支持中文,就用之 socket.BeginSend(bs, 0, bs.Length, 0, new AsyncCallback(SendCallback), socket); } } else if (Tap1Array[0].ToString() == "0") { if (ClsMsg.ShowQuestionMsg("是否要关闭后真空阀门?") == DialogResult.Yes) { bs = System.Text.Encoding.UTF8.GetBytes("XXL-0-52"); //发现UTF8可支持中文,就用之 socket.BeginSend(bs, 0, bs.Length, 0, new AsyncCallback(SendCallback), socket); } } } else { MessageBox.Show("网络设备无法连接,请根据右上角提示进行处理!"); } } catch (Exception ex) { MessageBox.Show("连接尚未建立!无法发送数据!" + ex.Message); } }
private void BgWait2_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Result != null) { if (e.Result is SRExcute.DeviceExecute) { if (ClsMsg.ShowQuestionMsg("新增成功!\n是否继续增加设备档案呢?") == DialogResult.Yes) { AddData(); } else { this.DialogResult = DialogResult.OK; } } else if (e.Result is bool) { this.DialogResult = DialogResult.OK; } } }
private void ResetBtn_Click(object sender, EventArgs e) { //if (ClsMsg.ShowQuestionMsg("是否要测试工艺规划明细数据?") == DialogResult.Yes) //{ // BgWait.RunWorkerAsync("InsterCraProDataById"); //} if (ClsMsg.ShowQuestionMsg("是否要清除该界面所有信息呢?") == DialogResult.Yes) { vw_DurmsUpFeedingModel = new SRCfPExecute.vw_DurmsUpFeeding(); vwDurmsUpFeedingBindingSource.DataSource = vw_DurmsUpFeedingModel; DeveUseStatusSpinEdit.Text = ""; DeveUseStatusSpinEdit.EditValue = null; OperatDescEdit.Text = ""; NewCraftsName.Text = ""; FrequencyEdit.Text = ""; vw_DurmsUpFeedingModel.CreateTime = DateTime.Now; vw_DurmsUpFeedingModel.Creator = context.UserName; gridControl1.RefreshDataSource(); arrangedVouchLogBindingSource.DataSource = null; } }
private void bmTool_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (BgwWait.IsBusy == false) { switch (e.Item.Name) { case "bbtnseach": BgwWait.RunWorkerAsync("SearchData"); break; case "bbtniAdd": DevpCodeTextEdit.Properties.ReadOnly = false; model = new SRDevice.DeviceParameter() { DevCode = strDevCode }; deviceParameterBindingSource.DataSource = model; // DevpCodeTextEdit.Properties.ReadOnly = true; bbtniSave.Enabled = true; bbtniUpdate.Enabled = false; bbtniDel.Enabled = false; // ClsMsg.ShowWarningMsg("开启设备编辑模式!"); break; case "bbtniSave": // deviceParameterBindingSource.DataSource = model; // model = new SRDevice.DeviceClass(); deviceParameterBindingSource.EndEdit(); // if (this.DeviCodeTextEdit.Text != "" && this.DeviNameTextEdit.Text != "" && this.DevpCodeTextEdit.Text != "" && this.DataTypeTextEdit.Text != "" && this.DevpAddressTextEdit.Text != "" && this.SendFormatTextEdit.Text != "") if (model == null || this.DevCodeTextEdit.Text == "" || this.DevpCodeTextEdit.Text == "" || this.DevpNameTextEdit.Text == "" || this.StandardValueTextEdit.Text == "" || this.MaxValueTextEdit.Text == "" || this.MinValueTextEdit.Text == "") { ClsMsg.ShowWarningMsg("请输入完整数据!"); } else if (ClsMsg.ShowQuestionMsg("是否要保存当前数据呢?") == DialogResult.Yes) { BgwWait.RunWorkerAsync("SaveData"); } break; case "bbtniDel": deviceParameterBindingSource.EndEdit(); if (model != null && ClsMsg.ShowQuestionMsg("是否要删除当前数据呢?") == DialogResult.Yes) { BgwWait.RunWorkerAsync("DelData"); } break; case "bbtniUpdate": deviceParameterBindingSource.EndEdit(); if (model != null && ClsMsg.ShowQuestionMsg("是否要更新当前数据呢?") == DialogResult.Yes) { BgwWait.RunWorkerAsync("UpdData"); } break; case "bbtnExit": this.Close(); break; case "barButtonItem2": if (BgwWait.IsBusy == false) { gridControl1.RefreshDataSource(); BgwWait.RunWorkerAsync("SearchData"); } break; default: break; } } } catch (Exception ex) { ClsMsg.ShowErrMsg(ex.ToString()); } }
private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { switch (e.Item.Name) { case "bbtniAddRow": if (lstCPContrast != null) { lstCPContrast.Add(new CPContrast() { Editprop = "A" }); cPContrastBindingSource.DataSource = lstCPContrast; gridControl1.RefreshDataSource(); } break; case "bbtniDelRow": if (gridView1.FocusedRowHandle >= 0 && bgwWait.IsBusy == false) { gridView1.CloseEditor(); gridView1.UpdateCurrentRow(); var model = gridView1.GetRow(gridView1.FocusedRowHandle) as CPContrast; if (model.Editprop.IsNullOrEmpty()) { if (ClsMsg.ShowQuestionMsg("是否删除选中行呢?") == DialogResult.Yes) { bgwWait.RunWorkerAsync("DelData"); } } else { lstCPContrast.Remove(model); cPContrastBindingSource.DataSource = lstCPContrast; gridControl1.RefreshDataSource(); } } break; case "bbtniSave": if (bgwWait.IsBusy == false && lstCPContrast != null) { if (ClsMsg.ShowQuestionMsg("是否要保存当前列表数据呢?") == DialogResult.Yes) { gridView1.CloseEditor(); gridView1.UpdateCurrentRow(); cPContrastBindingSource.EndEdit(); bool bEdit = false; for (int i = 0; i < lstCPContrast.Count; i++) { var m = lstCPContrast[i]; if (m.Editprop.IsNullOrEmpty() == false) { bEdit = true; if (m.ParamName.IsNullOrEmpty()) { ClsMsg.ShowWarningMsg(string.Format("第{0}行参数名称不能为空!", (i + 1).ToString())); return; } //else if (m.DevepName.IsNullOrEmpty()) //{ // ClsMsg.ShowWarningMsg(string.Format("第{0}行设备参数名称不能为空!", (i + 1).ToString())); // return; //} } } if (bEdit) { bgwWait.RunWorkerAsync("SaveData"); } } } break; case "bbtniRefer": if (bgwWait.IsBusy == false) { bgwWait.RunWorkerAsync("LoadData"); } break; case "bbtniExit": this.Close(); break; default: break; } } catch (Exception ex) { Utils.Logger.Error(ex.ToString()); ClsMsg.ShowErrMsg(ex.Message); } }
private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { qCPullDetectionRegBindingSource.EndEdit(); switch (e.Item.Name) { case "bbtniSave": if (model.RegDate.ToString().IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForRegDate.Text); RegDateDateEdit.Focus(); } else if (model.QualityInspector.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForQualityInspector.Text); QualityInspectorTextEdit.Focus(); } else if (model.Frequency.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForFrequency.Text); FrequencyTextEdit.Focus(); } else if (model.ProductionLine.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForProductionLine.Text); ProductionLineTextEdit.Focus(); } else if (model.OrderCode.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForOrderCode.Text); OrderCodeTextEdit.Focus(); } else if (model.ProductLevel.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForProductLevel.Text); ProductLevelComboBoxEdit.Focus(); } else if (model.TestResults.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForTestResults.Text); //TestResultsTextEdit.Focus(); } else { if (ClsMsg.ShowQuestionMsg("是否要保存当前数据呢?") == DialogResult.Yes) { bgwWait.RunWorkerAsync("SaveData"); } } break; case "bbtniStart": if (bbtniStart.Caption.Equals("开始检测")) { if (model.ProductLevel.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForProductLevel.Text); ProductLevelComboBoxEdit.Focus(); } else if (model.OrderType.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForOrderType.Text); } else if (model.Width.HasValue == false) { ClsMsg.ShowWarningEmptyMsg(ItemForWidth.Text); } else if (model.Thick.HasValue == false) { ClsMsg.ShowWarningEmptyMsg(ItemForThick.Text); } else if (dtPullRule == null || dtPullRule.Rows.Count == 0) { ClsMsg.ShowWarningMsg("请先维护拉力检测计算规则!"); } else { iNum = 0; bool bSuccess = mp.Open("COM7"); if (bSuccess) { timer1.Start(); bbtniStart.Caption = "停止检测"; } else { ClsMsg.ShowWarningMsg(mp.modbusMsg); } } } else { timer1.Stop(); mp.Close(); // model.ActualPull = 0; // model.TestResults = "aaa"; // ItemCurrPull.Text = "0"; qCPullDetectionRegBindingSource.DataSource = model; //#if DEBUG // model.ActualPull = Convert.ToDecimal(textEdit1.Text); //#endif bbtniStart.Caption = "开始检测"; } break; default: break; } } catch (Exception ex) { ClsMsg.ShowErrMsg(ex.Message); Utils.Logger.Error(ex.ToString()); } }
private void bmTool_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (bgwWait.IsBusy == false) { switch (e.Item.Name) { case "bbtniAdd": DevCCodeTextEdit.Properties.ReadOnly = false; model = new SRDevice.DeviceClass() { Grade = 0 }; deviceClassBindingSource.DataSource = model; break; case "bbtniSave": deviceClassBindingSource.EndEdit(); if (model == null) { ClsMsg.ShowWarningMsg("无任何可保存的数据!"); } else if (model.DevCCode.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForDevCCode.Text); DevCCodeTextEdit.Focus(); } else if (model.DevCName.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForDevCName.Text); DevCNameTextEdit.Focus(); } else if (ClsMsg.ShowQuestionMsg("是否要保存当前数据呢?") == DialogResult.Yes) { bgwWait.RunWorkerAsync("SaveData"); } break; case "bbtniDel": deviceClassBindingSource.EndEdit(); if (model != null && ClsMsg.ShowQuestionMsg("是否要删除当前数据呢?") == DialogResult.Yes) { bgwWait.RunWorkerAsync("DelData"); } break; case "bbtniExit": this.Close(); break; default: break; } } } catch (Exception ex) { ClsMsg.ShowErrMsg(ex.Message); Utils.Logger.Error(ex.ToString()); } }
private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (BgWait2.IsBusy == false) { switch (e.Item.Name) { case "bbtniAdd": EndEditOnAllBindingSources(); if (strDeviCode.IsNullOrEmpty() && ClsMsg.ShowQuestionMsg("是否要保存设备档案信息呢?") == DialogResult.Yes) { BgWait2.RunWorkerAsync("SaveData"); } else if (CollFrequencyTextEdit.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForCollFrequency.Text); CollFrequencyTextEdit.Focus(); } else if (UserStatusSpinEdit.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForUserStatus.Text); UserStatusSpinEdit.Focus(); } else { if (ClsMsg.ShowQuestionMsg("是否要修改设备档案信息呢?") == DialogResult.Yes) { EndEditOnAllBindingSources(); BgWait2.RunWorkerAsync("UpdData"); } } break; case "bbtniUpdate": BgWait2.RunWorkerAsync("UpdData"); break; case "bbtniDelete": if (strDeviCode.IsNullOrEmpty()) { ClsMsg.ShowWarningMsg("无任何数据可删除!"); return; } if (ClsMsg.ShowQuestionMsg("是否要删除设备档案呢?") == DialogResult.Yes) { BgWait2.RunWorkerAsync("Delete"); } break; case "bbtnExit": this.Close(); break; default: break; } } } catch (Exception ex) { ClsMsg.ShowErrMsg(ex.ToString()); } }
private void barManager_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { switch (e.Item.Name) { case "bbtniSave": if (string.IsNullOrEmpty(PersonCodeTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForPersonCode.Text); } else if (string.IsNullOrEmpty(PersonNameTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForPersonName.Text); } else if (string.IsNullOrEmpty(PersonTypeTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForPersonType.Text); } else if (IsOperatorCheckEdit.CheckState.Equals(CheckState.Checked) && string.IsNullOrEmpty(OparatorNameTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForOparatorName.Text); } else if (IsOperatorCheckEdit.CheckState.Equals(CheckState.Checked) && string.IsNullOrEmpty(ItemForOparatorCode.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForOparatorCode.Text); } else if (bgWait.IsBusy == false) { if (ClsMsg.ShowQuestionMsg("是否保存该职员数据?") == DialogResult.Yes) { bgWait.RunWorkerAsync("SavePersonData"); } } break; case "bbtniDelete": if (string.IsNullOrEmpty(PersonCodeTextEdit.Text)) { ClsMsg.ShowWarningEmptyMsg(ItemForPersonCode.Text); } else if (bgWait.IsBusy == false) { if (ClsMsg.ShowQuestionMsg("是否删除该职员数据?") == DialogResult.Yes) { bgWait.RunWorkerAsync("DeletePersonData"); } } break; case "bbtniExit": this.Close(); break; default: break; } } catch (Exception ex) { ClsMsg.ShowErrMsg(ex.Message); Utils.Logger.Error(ex.ToString()); } }
private void SuBmitBtn_Click(object sender, EventArgs e) { using (var MESclient = new SRCfPExecute.CfPExecuteServiceClient()) { var ret = MESclient.GetDurmsUpFeedingByDevCode(context.SessionID, WorkbrachNameTextEdit.Text); vw_DurmsUpFeedingModel.CreateTime = DateTime.Now; if (ret.Data[0].DevName != vw_DurmsUpFeedingModel.DevName) { ClsMsg.ShowErrMsg("该转鼓跟二维码编码不一致,请重新扫描转鼓号码!"); return; } if (ret.Data != null) { DeveUseStatusSpinEdit.EditValue = ret.Data[0].DeveUseStatus.ToString(); } else { ClsMsg.ShowErrMsg("无该设备状态数据,请跟管理员沟通"); } var Proret = MESclient.GeCraftsProcessdByWorkbrachName(context.SessionID, WorkbrachNameTextEdit.Text); if (Proret.Data.ExecuteOrder != vw_DurmsUpFeedingModel.ExecuteOrder || Proret.Data.ExecuteStatus != vw_DurmsUpFeedingModel.ExecuteStatus) { vw_DurmsUpFeedingModel.WorkbrachCode = ""; vw_DurmsUpFeedingModel.DevName = ""; ClsMsg.ShowErrMsg("该转鼓在同一时间被进行了操作,请重新扫描转鼓号码!"); return; } } if (WorkbrachNameTextEdit.Text == "") { ClsMsg.ShowErrMsg("当前二维码为空,请扫描正确的鼓号!"); return; } if (FrequencyEdit.Text == "") { ClsMsg.ShowErrMsg("当前没有选择班次,请先选择班次!"); return; } if (CraftsNameTextEdit.Text != "空鼓" && CraftsNameTextEdit.Text != "上料") { ClsMsg.ShowErrMsg("当前鼓号工艺状态异常,请扫描正确的鼓号,或者完成刷卡操作!"); return; } if (OperatDescEdit.Text != "" && WorkbrachNameTextEdit.Text != "" && CraftsNameTextEdit.Text == "空鼓" && DeveUseStatusSpinEdit.Text == "正常" && ClsMsg.ShowQuestionMsg("是否要保存空鼓上料信息呢?") == DialogResult.Yes) { BgWait.RunWorkerAsync("InsterArrangedVouchCode"); } else if (OperatDescEdit.Text != "" && RFIDCodeTextEdit.Text != "" && CraftsNameTextEdit.Text == "上料" && DeveUseStatusSpinEdit.Text == "正常" && ClsMsg.ShowQuestionMsg("是否要保存原料绑卡信息呢?") == DialogResult.Yes) { BgWait.RunWorkerAsync("UpdateArrangedVouchCode"); } else if (RFIDCodeTextEdit.Text == "" && CraftsNameTextEdit.Text != "空鼓" && CraftsNameTextEdit.Text != "上料") { ClsMsg.ShowErrMsg("当前鼓号工艺状态异常,请扫描正确的鼓号,或者完成刷卡操作!"); return; } else if (RFIDCodeTextEdit.Text == "" && CraftsNameTextEdit.Text == "上料") { ClsMsg.ShowErrMsg("当前工艺为刷卡绑定操作,请正确刷卡!"); return; } else if (DeveUseStatusSpinEdit.Text != "正常") { ClsMsg.ShowErrMsg("当前鼓号设备状态异常,请扫描正确的鼓号!"); return; } else if (OperatDescEdit.Text == "") { ClsMsg.ShowErrMsg("当前鼓号信息异常,操作项目为空,请扫描正确卡号!"); return; } }
private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (bgwWait.IsBusy == false) { switch (e.Item.Name) { case "bbtniAdd": headModel = new SRCLParamSet.CraftsLineParamSet(); headModel.CreateDateTime = DateTime.Now; headModel.Creator = context.UserName; craftsLineParamSetBindingSource.DataSource = headModel; lstbodyModel = new List <SRCLParamSet.VCraftsLineParamSetDetail>(); //lstbodyModel.Add(new SRCLParamSet.CraftsLineParamSets()); craftsLineParamSetsBindingSource.DataSource = lstbodyModel; gridControl1.RefreshDataSource(); break; case "bbtniSave": gvDetail.CloseEditor(); craftsLineParamSetBindingSource.EndEdit(); craftsLineParamSetsBindingSource.EndEdit(); if (headModel.CraftsName.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForCraftsName.Text); CraftsNameButtonEdit.Focus(); return; } else if (headModel.WorkShop.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForWorkShop.Text); WorkShopTextEdit.Focus(); return; } else if (headModel.Treatment.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(ItemForTreatment.Text); TreatmentLookUpEdit.Focus(); return; } else if (headModel.Treatment.Equals("1") && (headModel.CraftsTaskTime.HasValue == false || headModel.CraftsTaskTime.Value <= 0)) { ClsMsg.ShowWarningMsg("处理方式为:自动,工艺总耗时不能小于零或为空!"); CraftsTaskTimeCalcEdit.Focus(); return; } else if (headModel.Order <= 0) { ClsMsg.ShowWarningMsg(ItemForOrder.Text + "不能小于等于零!"); OrderSpinEdit.Focus(); return; } else if (headModel.Treatment.Equals("1") && lstbodyModel.Count == 0) { ClsMsg.ShowWarningMsg("处理方式为:自动,工艺参数明细不能为空!"); return; } else if (lstbodyModel.Count > 0) { //if (lstbodyModel.Where(t => (t.Editprop.IsNullOrEmpty() || t.Editprop != "D")).OrderBy(t => t.Priority).First().Priority != 0) //{ // ClsMsg.ShowWarningMsg("工艺参数明细优先级没有开始参数"); // return; //} //else if (headModel.Treatment == "1") //处理方式:自动,判断必须有结束 { if (lstbodyModel.Where(t => (t.Editprop.IsNullOrEmpty() || t.Editprop != "D")).OrderByDescending(t => t.Priority).First().Priority != 100) { ClsMsg.ShowWarningMsg("工艺参数明细优先级没有结束参数"); return; } } for (int i = 0; i < lstbodyModel.Count; i++) { var item = lstbodyModel[i]; if (item.Editprop.IsNullOrEmpty() || item.Editprop.Equals("E")) { if (item.ParameterID == 0) { ClsMsg.ShowWarningEmptyMsg(string.Format("第{0}行参数名称", i.ToString())); return; } else if (item.UserStatus.IsNullOrEmpty()) { ClsMsg.ShowWarningEmptyMsg(string.Format("第{0}行使用状态", i.ToString())); return; } } } } if (ClsMsg.ShowQuestionMsg("是否要保存当前数据呢?") == DialogResult.Yes) { bgwWait.RunWorkerAsync("SaveData"); } break; case "bbtniDel": if (ClsMsg.ShowQuestionMsg("是否要删除当前数据呢?") == DialogResult.Yes) { bgwWait.RunWorkerAsync("DelData"); } break; case "bbtniDelRow": var curr = lstbodyModel.Where(t => t.Editprop != "D").ToList()[gvDetail.FocusedRowHandle]; curr.Editprop = "D"; craftsLineParamSetsBindingSource.DataSource = lstbodyModel; gridControl1.RefreshDataSource(); break; case "bbtniAddRow": lstbodyModel.Add(new SRCLParamSet.VCraftsLineParamSetDetail() { ID = headModel.ID, Editprop = "A", UserStatus = "0" }); craftsLineParamSetsBindingSource.DataSource = lstbodyModel; gridControl1.RefreshDataSource(); break; case "bbtniExit": this.Close(); break; default: break; } } } catch (Exception ex) { Utils.Logger.Error(ex.ToString()); ClsMsg.ShowErrMsg(ex.Message); } }
/// <summary> /// 工具栏事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bmButton_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (bgwWait1.IsBusy == false) { switch (e.Item.Name) { case "bbtnAdd1": table = new SRDevice.DeviceInterface() { DevCode = strDevCode }; deviceInterfaceBindingSource.DataSource = table; this.DeviCodeTextEdit.Properties.ReadOnly = false; this.bbtnModify.Enabled = false; this.bbtnDel.Enabled = false; this.bbtnSave.Enabled = true; break; case "bbtnSave": deviceInterfaceBindingSource.EndEdit(); if (this.DeviCodeTextEdit.IsNullOrEmpty()) { ClsMsg.ShowWarningMsg("无任何可保存的数据!"); return; } if (this.DeviCodeTextEdit.Text != "" && this.DeviNameTextEdit.Text != "" && this.DevpCodeTextEdit.Text != "" && this.DataTypeTextEdit.Text != "" && this.DevpAddressTextEdit.Text != "" && this.SendFormatTextEdit.Text != "") { if (ClsMsg.ShowQuestionMsg("是否要保存当前数据呢?") == DialogResult.Yes) { bgwWait1.RunWorkerAsync("SaveData"); this.DeviCodeTextEdit.Properties.ReadOnly = true; this.bbtnModify.Enabled = true; this.bbtnDel.Enabled = true; this.bbtnSave.Enabled = false; } } else { ClsMsg.ShowWarningMsg("请填写完整,不能留空!"); return; } break; case "bbtnDel": deviceInterfaceBindingSource.EndEdit(); this.DeviCodeTextEdit.Properties.ReadOnly = true; if (this.DeviCodeTextEdit.IsNullOrEmpty()) { ClsMsg.ShowWarningMsg("请选中数据再进行删除!"); return; } if (ClsMsg.ShowQuestionMsg("是否要删除当前数据呢?") == DialogResult.Yes) { this.DeviNameTextEdit.Text = null; this.RemarkTextEdit.Text = null; this.SendFormatTextEdit.Text = null; this.DevpAddressTextEdit.Text = null; this.DevpCodeTextEdit.Text = null; this.DataTypeTextEdit.Text = null; bgwWait1.RunWorkerAsync("DelData"); } break; case "bbtnModify": deviceInterfaceBindingSource.EndEdit(); this.DeviCodeTextEdit.Properties.ReadOnly = true; if (this.DeviCodeTextEdit.IsNullOrEmpty()) { ClsMsg.ShowWarningMsg("请选中数据再进行修改!"); return; } if (ClsMsg.ShowQuestionMsg("是否要更新当前数据呢?") == DialogResult.Yes) { bgwWait1.RunWorkerAsync("UpdData"); } break; case "bbtnExit": this.Close(); break; default: break; } } } catch (Exception ex) { ClsMsg.ShowErrMsg(ex.Message); Utils.Logger.Error(ex.ToString()); } }
private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (BgwWait.IsBusy == false) { switch (e.Item.Name) { case "bbtnseach": BgwWait.RunWorkerAsync("SearchData"); bbtniAdd.Enabled = true; bbtniSave.Enabled = false; bbtniUpdate.Enabled = true; bbtniDel.Enabled = true; break; case "bbtniAdd": InsterData(); bbtniAdd.Enabled = false; bbtniSave.Enabled = true; bbtniUpdate.Enabled = false; bbtniDel.Enabled = false; break; case "bbtniSave": iPRegistFormBindingSource.EndEdit(); if (IPTextEdit.Text == "") { ClsMsg.ShowWarningMsg("IP为必填项,请输入完整数据!"); } else if (ClsMsg.ShowQuestionMsg("是否要保存当前数据呢?") == DialogResult.Yes) { BgwWait.RunWorkerAsync("SaveData"); } bbtniAdd.Enabled = true; bbtniSave.Enabled = false; bbtniUpdate.Enabled = true; bbtniDel.Enabled = true; break; case "bbtniDel": iPRegistFormBindingSource.EndEdit(); if (model != null && ClsMsg.ShowQuestionMsg("是否要删除当前数据呢?") == DialogResult.Yes) { BgwWait.RunWorkerAsync("DelData"); } break; case "bbtniUpdate": iPRegistFormBindingSource.EndEdit(); if (model != null && ClsMsg.ShowQuestionMsg("是否要更新当前数据呢?") == DialogResult.Yes) { BgwWait.RunWorkerAsync("UpdData"); } break; case "bbtnExit": this.Close(); break; default: break; } } } catch (Exception ex) { ClsMsg.ShowErrMsg(ex.ToString()); } }