public void AddErrorCodes(object[] errorCodes) { for (int i = 0; i < errorCodes.Length; i++) { ErrorCodeA err = (ErrorCodeA)errorCodes[i]; lstSelect.Items.Add(err); } }
protected override object GetEditObject() { // this.ValidateInput(); if (_facade == null) { _facade = new TSModelFacadeFactory(base.DataProvider).CreateTSModelFacade(); } ErrorCodeA ErrorCodeA = this._facade.CreateNewErrorCodeA(); ErrorCodeA.ErrorCode = FormatHelper.CleanString(FormatHelper.PKCapitalFormat(this.txtErrorCodeEdit.Text), 40); ErrorCodeA.ErrorDescription = FormatHelper.CleanString(this.txtErrorDescriptionEdit.Text, 100); ErrorCodeA.MaintainUser = this.GetUserCode(); return(ErrorCodeA); }
public void txtInputErrorCode_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { string strInput = txtInputErrorCode.Text.Trim().ToUpper(); if (e.KeyChar == '\r') { if (this.cbxErrorGroup.SelectedItemValue == null) { Application.DoEvents(); txtInputErrorCode.Clear(); this.cbxErrorGroup.Focus(); return; } if (strInput != String.Empty && (strInput == ClipOK || strInput == ClipFail)) { if (EndErrorCodeInput != null) { EndErrorCodeInput(sender, e); } } else { for (int i = 0; i < lstSelect.Items.Count; i++) { //string strItem = lstSelect.Items[i].ToString().ToUpper(); //if (strItem.Substring(0, strItem.IndexOf(" ")) == strInput) ErrorCodeA errorCode = (ErrorCodeA)lstSelect.Items[i]; if (string.Compare(errorCode.ErrorCode, strInput, true) == 0) { lstSelect.SelectedIndex = i; this.btnAdd_Click(null, null); break; } } } } if (ErrorCodeKeyPress != null) { ErrorCodeKeyPress(txtInputErrorCode, e); } if (e.KeyChar == '\r' && strInput != ClipOK && strInput != ClipFail) { txtInputErrorCode.Clear(); txtInputErrorCode.Focus(); } }
private void LoadInitData() { if (product == null) { TSModel.TSModelFacade tsmodelFacade = new TSModelFacade(this.DataProvider); object[] objsECodeAll = tsmodelFacade.GetAllErrorCode(); if (objsECodeAll == null || objsECodeAll.Length == 0) { return; } ErrorCodeA[] errorsAll = new ErrorCodeA[objsECodeAll.Length]; objsECodeAll.CopyTo(errorsAll, 0); this.ucErrorCodeSelect21.AddErrorCodes(errorsAll); this.ucErrorCodeSelect21.Focus(); this.ucErrorCodeSelect21.FocusInput(); return; } if (product == null || product.LastSimulation == null) { return; } ItemFacade itFacade = new ItemFacade(this.DataProvider); BaseSetting.BaseModelFacade baseFacade = new BaseSetting.BaseModelFacade(this.DataProvider); object op = null; if (product.LastSimulation.RouteCode != null && product.LastSimulation.RouteCode != string.Empty) { try { op = itFacade.GetItemRoute2Operation(product.LastSimulation.ItemCode, product.LastSimulation.RouteCode, product.LastSimulation.OPCode); } catch { } } string strOPCode = ""; if (op != null) { ItemRoute2OP CurrentOP = op as ItemRoute2OP; object objOP2RES = baseFacade.GetOperation2Resource(CurrentOP.OPCode, this.txtResource.Value.Trim().ToUpper()); if (objOP2RES != null) { strOPCode = CurrentOP.OPCode; } else { /* joe song 不知道这段代码为什么这样写,为了增加对线外工序的支持, 修改之 * //object objSOP = baseFacade.GetOperationByRouteAndResource(product.LastSimulation.RouteCode, this.txtResource.Value.Trim().ToUpper()); * //if (objSOP != null) * //{ * // object actOP = itFacade.GetItemRoute2Operation(product.LastSimulation.ItemCode, product.LastSimulation.RouteCode, (objSOP as Operation).OPCode); * // if (actOP != null) * // { * // CurrentOP = actOP as ItemRoute2OP; * // strOPCode = CurrentOP.OPCode; * // } * // } * */ Operation2Resource or = baseFacade.GetOperationByResource(this.txtResource.Value.Trim().ToUpper()) as Operation2Resource; if (or != null) { strOPCode = or.OPCode; } } } if (strOPCode == "") { Operation2Resource or = baseFacade.GetOperationByResource(this.txtResource.Value.Trim().ToUpper()) as Operation2Resource; if (or != null) { strOPCode = or.OPCode; } } if (strOPCode == "") { return; } object[] objsECode = baseFacade.GetAllErrorCodeByOperationCode(strOPCode); if (objsECode == null || objsECode.Length == 0) { return; } ErrorCodeA[] errors = new ErrorCodeA[objsECode.Length]; objsECode.CopyTo(errors, 0); this.ucErrorCodeSelect21.AddErrorCodes(errors); this.ucErrorCodeSelect21.Focus(); this.ucErrorCodeSelect21.FocusInput(); }