Example #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 = "システムエラーです。サポートへご連絡ください。";
            }
        }
Example #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();
                }
            }
        }
Example #3
0
        private void ClearSpreadRow(string myCode)
        {
            spComponent.BeginEdit();

            var data = SetKouseihin.Where(x => x.材料品番 == myCode).FirstOrDefault();

            if (data != null)
            {
                data.品番コード = 0;
                data.材料品番  = string.Empty;
                data.材料品名  = string.Empty;
                data.材料色   = string.Empty;
                data.数量    = string.Empty;
            }

            spComponent.CommitCellEdit();
        }