private void WorkbrachNameTextEdit_EditValueChanged(object sender, EventArgs e) { if (WorkbrachNameTextEdit.Text.Length == 6 && !BgWait.IsBusy) { BgWait.RunWorkerAsync("SearchDevStatus"); } }
//添加 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 frmQCDrumsFindLeak_Load(object sender, EventArgs e) { try { var FLSituationData = DataEnum.GetEnumData(context, "CF.FLSituation"); FLSituationTextEdit.Properties.DataSource = FLSituationData; BgWait.RunWorkerAsync("SearchData2");//打开窗口显示列表数据 } catch (Exception ex) { Utils.Logger.Error(ex.ToString()); } }
private void GridInit() { try { if (!BgWait.IsBusy) { BgWait.RunWorkerAsync("GetCrafData"); } } catch (Exception ex) { Utils.Logger.Error(ex.ToString()); } }
/// <summary> /// 根据RFID卡号获取明细信息,包括残留的排配单号获取上一步数据 /// </summary>&& CraftsNameTextEdit.Text == "上料" 第一个判断条件因为界面遗留数据简便操作,暂时注释20170109XCQ /// <param name="sender"></param> /// <param name="e"></param> private void RFIDCodeTextEdit_EditValueChanged(object sender, EventArgs e) { // if (RFIDCodeTextEdit.Text.Length == 10) if (RFIDCodeTextEdit.Text.Length == 10) { if (DeveUseStatusSpinEdit.Text != "正常") { ClsMsg.ShowErrMsg("当前鼓号设备状态异常,请先扫描正确的鼓号"); return; } if (NewCraftsName.Text != "上料") { ClsMsg.ShowErrMsg("当前鼓号设备工艺状态异常,不处于可上料状态,无法上料,请先扫描正确的鼓号"); return; } string Flag_ID = RFIDCodeTextEdit.Text.Substring(0, 2); // string a= RFIDCodeTextEdit.EditValue.ToString(); if (Flag_ID != "ID") { if (!BgWait.IsBusy) { BgWait.RunWorkerAsync("SearchRFID"); } } } if (RFIDCodeTextEdit.Text.Length == 13) { string Flag_ID = RFIDCodeTextEdit.Text.Substring(0, 2); RFIDCodeTextEdit.EditValue = RFIDCodeTextEdit.Text.Substring(3, 10); RFIDCodeTextEdit.Refresh(); if (Flag_ID == "ID") { if (!BgWait.IsBusy) { BgWait.RunWorkerAsync("SearchRFID"); } } } }
private SetGridKanbanCallbak setGridKanbanCallbak = null; //订阅委托事件,用于处理左下角异步修改控件值的情况 #endregion #region Event /// <summary> /// 定时器更新三个控件的值 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timer1_Tick(object sender, EventArgs e) { try { if (!BgWait.IsBusy) { BgWait.RunWorkerAsync("GetCrafData"); } if (!BgWaitDrumDry.IsBusy) { ZGNullColor.Items.Clear(); ZGFundaVW.Items.Clear(); listView1.Items.Clear(); BgWaitDrumDry.RunWorkerAsync("GetInitDrumDryData"); } if (!BgWaitStockArea.IsBusy) { listView2.Items.Clear(); StockFundaVW.Items.Clear(); BgWaitStockArea.RunWorkerAsync("GetInitRFIDData"); } if (!CylinderBgWait.IsBusy) { CylinderBgWait.RunWorkerAsync("GetZKLData"); } } catch (Exception ex) { 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 BgWait_DoWork(object sender, DoWorkEventArgs e) { BgWait.ReportProgress(PubConstant.WaitMessageStatus.START); try { switch (e.Argument.ToString()) { case "SearchRFID": using (var QZclient = new SRQZData.QZDataServiceClient()) { var ret = QZclient.GetQZRFIDCodeData(context.SessionID, RFIDCodeTextEdit.Text); var Newret = QZclient.GetNewQZRFIDCodeData(context.SessionID, RFIDCodeTextEdit.Text); if (Newret != null && Newret.Rows.Count > 0) { //该位置应存储过磅单号,RFID卡号,配方编号,配方名称,合计重量 //vw_DurmsUpFeedingModel.RFIDCode = ret.Rows[0][0].ToString(); //vw_DurmsUpFeedingModel.FormulaName = ret.Rows[0][9].ToString(); //vw_DurmsUpFeedingModel.MaterialVouchCode = ret.Rows[0][10].ToString(); //vw_DurmsUpFeedingModel.InputWeight = Decimal.Parse(ret.Rows[0][2].ToString()); NewCraftsName.Text = "上料"; vw_DurmsUpFeedingModel.RFIDCode = Newret.Rows[0]["RFID卡号"].ToString(); vw_DurmsUpFeedingModel.FormulaName = Newret.Rows[0]["配方名称"].ToString(); vw_DurmsUpFeedingModel.ProPlanNum = Newret.Rows[0]["参数表编码"].ToString(); vw_DurmsUpFeedingModel.MaterialVouchCode = Newret.Rows[0]["过磅单号"].ToString(); vw_DurmsUpFeedingModel.FormulaCode = Newret.Rows[0]["配方单号"].ToString(); vw_DurmsUpFeedingModel.InputWeight = Decimal.Parse(Newret.Rows[0]["每鼓合计重量"].ToString()); } else { ClsMsg.ShowErrMsg("没有该卡号信息,请重新刷卡"); BgWait.ReportProgress(PubConstant.WaitMessageStatus.END); return; } } using (var MESclient = new SRCfPExecute.CfPExecuteServiceClient()) { // GetCfPExecuteByArrangedVouchCode WorkbrachName var ArrRet = MESclient.GetCfPExecuteByArrangedVouchCode(context.SessionID, vw_DurmsUpFeedingModel.ArrangedVouchCode); vw_DurmsUpFeedingModel.WorkbrachCode = ArrRet.Data.WorkbrachCode; vw_DurmsUpFeedingModel.ExecuteOrder = ArrRet.Data.ExecuteOrder; vw_DurmsUpFeedingModel.ExecuteStatus = ArrRet.Data.ExecuteStatus;//暂定用于判断保存时数据是否被后台或同一时间进行了修正 vw_DurmsUpFeedingModel.CraftsName = ArrRet.Data.CraftsName; vw_DurmsUpFeedingModel.CraftsCode = ArrRet.Data.CraftsCode; vw_DurmsUpFeedingModel.ArrangedVouchCode = ArrRet.Data.ArrangedVouchCode; if (vw_DurmsUpFeedingModel.CraftsName != "上料" && vw_DurmsUpFeedingModel.CraftsName != "空鼓") { ClsMsg.ShowErrMsg("本转鼓不处于空鼓或上料开始阶段,无法使用保存功能"); vw_DurmsUpFeedingModel.WorkbrachCode = ""; RFIDCodeTextEdit.Properties.ReadOnly = true; } else if (vw_DurmsUpFeedingModel.CraftsName == "空鼓") { vw_DurmsUpFeedingModel.ArrangedVouchCode = ""; OperatDescEdit.Text = "上料开始"; NewCraftsName.Text = "上料"; RFIDCodeTextEdit.Properties.ReadOnly = true; } else if (vw_DurmsUpFeedingModel.CraftsName == "上料" && ArrRet.Data.ExecuteStatus != 2) { vw_DurmsUpFeedingModel.ArrangedVouchCode = ArrRet.Data.ArrangedVouchCode; OperatDescEdit.Text = "原料扫卡绑定"; NewCraftsName.Text = "上料"; RFIDCodeTextEdit.Properties.ReadOnly = false; } else { ClsMsg.ShowErrMsg("本转鼓不处于空鼓或上料开始阶段,无法使用保存功能"); vw_DurmsUpFeedingModel.WorkbrachCode = ""; RFIDCodeTextEdit.Properties.ReadOnly = true; } } using (var MESclient = new SRCfPExecute.CfPExecuteServiceClient()) { var ret = MESclient.GetArrangedVouchLogByCode(context.SessionID, ArrangedVouchCodeTextEdit.Text); if (ret.Data != null) { e.Result = ret.Data; } else { BgWait.ReportProgress(PubConstant.WaitMessageStatus.WARNING, ret.Message); } } break; case "SearchDevStatus": using (var MESclient = new SRCfPExecute.CfPExecuteServiceClient()) { var ret = MESclient.GetDurmsUpFeedingByDevCode(context.SessionID, WorkbrachNameTextEdit.Text); if (ret.Data != null) { DeveUseStatusSpinEdit.EditValue = ret.Data[0].DeveUseStatus.ToString(); vw_DurmsUpFeedingModel.DevName = ret.Data[0].DevName; vw_DurmsUpFeedingModel.WorkbrachName = ret.Data[0].DevName; vw_DurmsUpFeedingModel.WorkbrachCode = ret.Data[0].DevCode; } else { ClsMsg.ShowErrMsg("无该设备状态数据,请跟管理员沟通"); } //vw_DurmsUpFeedingModel.WorkbrachName = ret.Data[0].DevCode; var Proret = MESclient.GeCraftsProcessdByWorkbrachName(context.SessionID, WorkbrachNameTextEdit.Text); // vw_DurmsUpFeedingModel.WorkbrachName = Proret.Data.WorkbrachName; vw_DurmsUpFeedingModel.ExecuteOrder = Proret.Data.ExecuteOrder; vw_DurmsUpFeedingModel.ExecuteStatus = Proret.Data.ExecuteStatus; //暂定用于判断保存时数据是否被后台或同一时间进行了修正 vw_DurmsUpFeedingModel.CraftsName = Proret.Data.CraftsName; vw_DurmsUpFeedingModel.RFIDCode = ""; vw_DurmsUpFeedingModel.FormulaName = ""; vw_DurmsUpFeedingModel.InputWeight = null; if (vw_DurmsUpFeedingModel.CraftsName != "上料" && vw_DurmsUpFeedingModel.CraftsName != "空鼓") { ClsMsg.ShowErrMsg("本转鼓不处于空鼓或上料开始阶段,无法使用保存功能"); vw_DurmsUpFeedingModel.WorkbrachCode = ""; RFIDCodeTextEdit.Properties.ReadOnly = true; } else if (vw_DurmsUpFeedingModel.CraftsName == "空鼓") { vw_DurmsUpFeedingModel.ArrangedVouchCode = ""; OperatDescEdit.Text = "上料开始"; NewCraftsName.Text = "上料"; RFIDCodeTextEdit.Properties.ReadOnly = true; } else if (vw_DurmsUpFeedingModel.CraftsName == "上料" && Proret.Data.ExecuteStatus != 2) { vw_DurmsUpFeedingModel.ArrangedVouchCode = Proret.Data.ArrangedVouchCode; // OperatDescEdit.Text = "原料扫卡绑定"; NewCraftsName.Text = "上料"; RFIDCodeTextEdit.Properties.ReadOnly = false; } else { ClsMsg.ShowErrMsg("本转鼓不处于空鼓或上料开始阶段,无法使用保存功能"); vw_DurmsUpFeedingModel.WorkbrachCode = ""; RFIDCodeTextEdit.Properties.ReadOnly = true; } using (var MESclientLog = new SRCfPExecute.CfPExecuteServiceClient()) { var retLog = MESclientLog.GetArrangedVouchLogByCode(context.SessionID, ArrangedVouchCodeTextEdit.Text); if (retLog.Data != null) { e.Result = retLog.Data; } else { BgWait.ReportProgress(PubConstant.WaitMessageStatus.WARNING, retLog.Message); } } } vw_DurmsUpFeedingModel.CreateTime = DateTime.Now; break; case "SearchArrangedVouchLogCode": using (var MESclient = new SRCfPExecute.CfPExecuteServiceClient()) { var ret = MESclient.GetArrangedVouchLogByCode(context.SessionID, ArrangedVouchCodeTextEdit.Text); if (ret.Data != null) { e.Result = ret.Data; } else { BgWait.ReportProgress(PubConstant.WaitMessageStatus.WARNING, ret.Message); } } break; case "InsterArrangedVouchCode": using (var MESclient = new SRCfPExecute.CfPExecuteServiceClient()) { var ret = MESclient.InsterArrVouchByVw(context.SessionID, vw_DurmsUpFeedingModel); //保存排配单数据 if (ret.IsSuccess) { var logModel = new SRCfPExecute.ArrangedVouchLog() { ArrangedVouchCode = ret.Data.ArrangedVouchCode, OperatingTime = vw_DurmsUpFeedingModel.CreateTime, OperatDesc = OperatDescEdit.Text, Operator = OperatorEdit.Text, Frequency = FrequencyEdit.Text, CraftsName = CraftsNameTextEdit.Text, }; vw_DurmsUpFeedingModel.ArrangedVouchCode = ret.Data.ArrangedVouchCode; MESclient.InsterArrVouchLog(context.SessionID, logModel); //保存操作日志数据 BgWait.ReportProgress(99, "保存成功!"); vw_DurmsUpFeedingModel.WorkbrachCode = ""; OperatDescEdit.Text = ""; RFIDCodeTextEdit.Properties.ReadOnly = false; vw_DurmsUpFeedingModel.CreateTime = DateTime.Now; vw_DurmsUpFeedingModel.Creator = context.UserName; using (var MESclientLog = new SRCfPExecute.CfPExecuteServiceClient()) { var retLog = MESclientLog.GetArrangedVouchLogByCode(context.SessionID, ArrangedVouchCodeTextEdit.Text); if (retLog.Data != null) { e.Result = retLog.Data; } else { BgWait.ReportProgress(PubConstant.WaitMessageStatus.WARNING, retLog.Message); } } } } break; case "InsterCraProDataById": using (var MESclient = new SRCfPExecute.CfPExecuteServiceClient()) { var ret = MESclient.UpdateCraftsProcessData(context.SessionID, "CSGH17011", vw_DurmsUpFeedingModel); //保存排配单数据 if (ret.IsSuccess) { BgWait.ReportProgress(99, "保存成功!"); } else { BgWait.ReportProgress(PubConstant.WaitMessageStatus.WARNING, ret.Message); } } break; case "UpdateArrangedVouchCode": using (var MESclient = new SRCfPExecute.CfPExecuteServiceClient()) { var ret = MESclient.UpdateArrangedVouchCode(context.SessionID, vw_DurmsUpFeedingModel); //保存排配单数据 var retTail = MESclient.UpdateCraftsProcessData(context.SessionID, vw_DurmsUpFeedingModel.ProPlanNum, vw_DurmsUpFeedingModel); //修改执行子表跟主表数据 var TestRet = MESclient.UpdateCraftsProcessExecute(context.SessionID, vw_DurmsUpFeedingModel.ArrangedVouchCode, 1, 2); if (ret.IsSuccess) { var logModel = new SRCfPExecute.ArrangedVouchLog() { ArrangedVouchCode = ret.Data.ArrangedVouchCode, OperatingTime = vw_DurmsUpFeedingModel.CreateTime, OperatDesc = OperatDescEdit.Text, Operator = OperatorEdit.Text, Frequency = FrequencyEdit.Text, CraftsName = CraftsNameTextEdit.Text, }; MESclient.InsterArrVouchLog(context.SessionID, logModel); //保存操作日志数据 BgWait.ReportProgress(99, "保存成功!"); vw_DurmsUpFeedingModel.WorkbrachCode = ""; OperatDescEdit.Text = ""; RFIDCodeTextEdit.Properties.ReadOnly = true; vw_DurmsUpFeedingModel.CreateTime = DateTime.Now; vw_DurmsUpFeedingModel.Creator = context.UserName; using (var MESclientLog = new SRCfPExecute.CfPExecuteServiceClient()) { var retLog = MESclientLog.GetArrangedVouchLogByCode(context.SessionID, ArrangedVouchCodeTextEdit.Text); if (retLog.Data != null) { e.Result = retLog.Data; } else { BgWait.ReportProgress(PubConstant.WaitMessageStatus.WARNING, retLog.Message); } } } } break; default: break; } } catch (Exception ex) { BgWait.ReportProgress(PubConstant.WaitMessageStatus.ERROR, ex.Message); } BgWait.ReportProgress(PubConstant.WaitMessageStatus.END); }
private void BgWait_DoWork(object sender, DoWorkEventArgs e) { BgWait.ReportProgress(0); try { switch (e.Argument.ToString()) { case "SearchData": //清空列表 //model2 = new SRQZDDrumesSet.QC_FindLeakDrumsSet(); //qCFindLeakDrumsSetBindingSource.DataSource = model2; using (var client = new SRQZDDrumesSet.QCDrumsSetServiceClient()) { strLeakDrums = DeveCodeTextEdit.Text; var ret = client.GetQCDrumsSetQRCode(context.SessionID, strLeakDrums); if (ret.IsSuccess) { e.Result = ret.Data; } else { BgWait.ReportProgress(101, ret.Message); } } break; case "SearchData2": SearchData2(e); break; case "SaveData": using (var client = new SRFindLeak.QCDFindLeakServiceClient()) //引用服务 { var ret = client.AddQCDrumsFindLeakReport(context.SessionID, model); //应用,增加的方法 if (ret.IsSuccess) { BgWait.ReportProgress(PubConstant.WaitMessageStatus.PROMPT, "提交成功!"); this.Invoke((MethodInvoker) delegate() { AddFun(); }); SearchData2(e); } else { BgWait.ReportProgress(PubConstant.WaitMessageStatus.WARNING, ret.Message); } } break; default: break; } } catch (Exception ex) { Utils.Logger.Error(ex.ToString()); BgWait.ReportProgress(PubConstant.WaitMessageStatus.ERROR, ex.Message); } BgWait.ReportProgress(PubConstant.WaitMessageStatus.END); }