/// <summary> /// マスターメンテナンス画面の呼び出しを行う /// </summary> /// <param name="mntwndTypes">マスター種別の一覧</param> public static void CallMasterMainte(Dictionary <string, List <Type> > mntwndTypes) { UcLabelTwinTextBox twintextbox = ViewBaseCommon.GetCurrentTwinText(); if (twintextbox == null) { return; } if (mntwndTypes == null) { return; } try { var wndtp = mntwndTypes.Where(x => x.Key == twintextbox.DataAccessName).FirstOrDefault(); if ((wndtp.Value is List <Type>) != true) { return; } Type tp = (wndtp.Value as List <Type>)[0]; if (tp == null) { return; } WindowMasterMainteBase mstmnt = Activator.CreateInstance(tp) as WindowMasterMainteBase; var wnd = Window.GetWindow(twintextbox); mstmnt.ShowDialog(wnd); } catch (Exception ex) { throw ex; } }
/// <summary> /// F1 リボン 検索 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override void OnF1Key(object sender, KeyEventArgs e) { try { object elmnt = FocusManager.GetFocusedElement(this); var spgrid = ViewBaseCommon.FindVisualParent <GcSpreadGrid>(elmnt as Control); if (spgrid != null) { int actrow = spgrid.ActiveRowIndex; spgrid.CommitCellEdit(); UcLabelTwinTextBox dmy = new UcLabelTwinTextBox(); switch (spgrid.ActiveColumn.Name) { case "材料品番": var val = spComponent.Cells[spComponent.ActiveRowIndex, spgrid.ActiveColumn.Name].Value; SCHM09_MYHIN myHin = new SCHM09_MYHIN(); myHin.chkItemClass_1.IsChecked = false; myHin.chkItemClass_1.IsEnabled = false; myHin.TwinTextBox = dmy; if (myHin.ShowDialog(this) ?? false) { SpreadGridRow row = spComponent.Rows[spComponent.ActiveRowIndex]; int myCode = (int)myHin.SelectedRowData["品番コード"]; int cnt = SetKouseihin.Where(x => x.品番コード == myCode).Count(); if (cnt > 0) { MessageBox.Show("同じ材料品番が既に登録されています。"); return; } row.Cells[0].Value = myHin.SelectedRowData["品番コード"].ToString(); row.Cells[2].Value = myHin.SelectedRowData["自社品番"].ToString(); row.Cells[3].Value = myHin.SelectedRowData["自社色"].ToString(); row.Cells[4].Value = myHin.SelectedRowData["自社色名"].ToString(); row.Cells[5].Value = myHin.SelectedRowData["自社品名"].ToString(); NotifyPropertyChanged(); } break; default: break; } } else { ViewBaseCommon.CallMasterSearch(this, this.MasterMaintenanceWindowList); } } catch (Exception ex) { appLog.Error("検索画面起動エラー", ex); this.ErrorMessage = "システムエラーです。サポートへご連絡ください。"; } }
private void setInputRowData(DataTable tbl) { SpreadGridRow row = spComponent.ActiveRow; if (tbl == null || tbl.Rows.Count == 0) { // 現在行を初期化して終了 row.Cells[0].Value = 0; row.Cells[3].Value = string.Empty; row.Cells[4].Value = string.Empty; row.Cells[6].Value = string.Empty; return; } if (tbl.Rows.Count == 1) { DataRow dr = tbl.Rows[0]; row.Cells[0].Value = dr["品番コード"].ToString(); row.Cells[2].Value = dr["自社品番"].ToString(); row.Cells[3].Value = dr["自社色"].ToString(); row.Cells[4].Value = dr["自社色名"].ToString(); row.Cells[5].Value = dr["自社品名"].ToString(); } else { //商品検索画面出力 string hinCode = row.Cells[2].Value.ToString(); UcLabelTwinTextBox dmy = new UcLabelTwinTextBox(); SCHM09_MYHIN myHin = new SCHM09_MYHIN(); myHin.chkItemClass_1.IsChecked = false; myHin.chkItemClass_1.IsEnabled = false; myHin.txtCode.Text = hinCode; myHin.TwinTextBox = dmy; if (myHin.ShowDialog(this) ?? false) { int myCode = (int)myHin.SelectedRowData["品番コード"]; int cnt = SetKouseihin.Where(x => x.品番コード == myCode).Count(); if (cnt > 0) { MessageBox.Show("同じ材料品番が既に登録されています。"); return; } row.Cells[0].Value = myHin.SelectedRowData["品番コード"].ToString(); row.Cells[2].Value = myHin.SelectedRowData["自社品番"].ToString(); row.Cells[3].Value = myHin.SelectedRowData["自社色"].ToString(); row.Cells[4].Value = myHin.SelectedRowData["自社色名"].ToString(); row.Cells[5].Value = myHin.SelectedRowData["自社品名"].ToString(); NotifyPropertyChanged(); } } }
/// <summary> /// マスター検索画面の呼び出しを行う /// </summary> /// <param name="wnd">呼び出し元Window</param> /// <param name="srchwndTypeList">マスター種別の一覧</param> public static void CallMasterSearch(Window wnd, Dictionary <string, List <Type> > srchwndTypeList) { UcLabelTwinTextBox twintextbox = ViewBaseCommon.GetCurrentTwinText(); if (twintextbox == null) { return; } if (srchwndTypeList == null) { return; } try { var wndtp = srchwndTypeList.Where(x => x.Key == twintextbox.DataAccessName).FirstOrDefault(); if ((wndtp.Value is List <Type>) != true) { return; } Type tp = (wndtp.Value as List <Type>)[1]; if (tp == null) { return; } if (tp.BaseType != typeof(WindowMasterSearchBase)) { ViewBaseException ex = new ViewBaseException(string.Format("{0}がWindowMasterSearchBaseの派生クラスではないため処理できません。", tp)); throw ex; } twintextbox.BeforeCode = twintextbox.Text1; WindowMasterSearchBase mstsrch = Activator.CreateInstance(tp) as WindowMasterSearchBase; mstsrch.TwinTextBox = twintextbox; if (mstsrch.ShowDialog(wnd) == true) { twintextbox.AfterCode = twintextbox.Text1; // 検索結果を選択して閉じられた場合、該当するTwinTextboxにPreviewKeyDownイベントを送信する。 IInputElement element = Keyboard.FocusedElement; var s = PresentationSource.FromDependencyObject(element as DependencyObject); var eventArgs = new KeyEventArgs(Keyboard.PrimaryDevice, s, (int)System.DateTime.Now.Ticks, Key.Enter); eventArgs.RoutedEvent = Keyboard.PreviewKeyDownEvent; InputManager.Current.ProcessInput(eventArgs); eventArgs.RoutedEvent = Keyboard.PreviewKeyUpEvent; InputManager.Current.ProcessInput(eventArgs); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 場所会社コードが変更された時のイベント処理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ttxt場所会社_cText1Changed(object sender, RoutedEventArgs e) { UcLabelTwinTextBox tb = sender as UcLabelTwinTextBox; if (string.IsNullOrEmpty(tb.Text1)) { return; } base.SendRequest( new CommunicationObject( MessageType.RequestData, M70_JIS_GetData, new object[] { tb.Text1, 0 })); }