Esempio n. 1
0
        /// <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 = "システムエラーです。サポートへご連絡ください。";
            }
        }
Esempio n. 2
0
        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();
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 構成品Grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void spComponent_CellEditEnded(object sender, GrapeCity.Windows.SpreadGrid.SpreadCellEditEndedEventArgs e)
        {
            if (e.EditAction == SpreadEditAction.Cancel)
            {
                return;
            }

            var spGrid = (sender as GcSpreadGrid);

            if (spGrid == null)
            {
                return;
            }

            try
            {
                // 編集列が『材料品番』の場合
                if (spGrid.ActiveColumn.Index == 2 || spGrid.ActiveColumn.Index == 3)
                {
                    SpreadGridRow row     = spGrid.Rows[e.CellPosition.Row];
                    string        myCode  = (string)row.Cells[spGrid.Columns["材料品番"].Index].Value;
                    string        myColor = (string)row.Cells[spGrid.Columns["自社色"].Index].Value;

                    // 入力値より品番情報を取得
                    this.SendRequest(
                        new CommunicationObject(
                            MessageType.RequestData,
                            TargetTableNm_GetProduct,
                            new object[] {
                        myCode,
                        myColor,
                        new int[] { 2, 3, 4 }                 // 対象商品形態:2:単品・材料、3:雑コード、4:副資材
                    }));
                }
            }
            catch (Exception)
            {
                this.ErrorMessage = "入力内容が不正です。";
            }
        }