コード例 #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 = "システムエラーです。サポートへご連絡ください。";
            }
        }
コード例 #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();
                }
            }
        }
コード例 #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();
        }
コード例 #4
0
        /// <summary>
        /// スプレッドシート内のエラーチェックをおこなう
        /// </summary>
        /// <returns></returns>
        private string isSpreadInputValidation()
        {
            string errMsg = string.Empty;

            for (int i = 0; i < SetKouseihin.Count(); i++)
            {
                var data = SetKouseihin[i];
                if (string.IsNullOrEmpty(data.材料品番))
                {
                    continue;
                }

                if (string.IsNullOrEmpty(data.材料品名))
                {
                    // 名称=空値 => 対象外(SET品)の品番 or 品番登録なし
                    errMsg = string.Format("{0}行目:品番は登録されていません。", i + 1);
                    return(errMsg);
                }

                if (string.IsNullOrEmpty(data.数量))
                {
                    // 数量は必須
                    errMsg = string.Format("{0}行目:数量が入力されていません。", i + 1);
                    return(errMsg);
                }

                for (int j = i + 1; j < SetKouseihin.Count(); j++)
                {
                    var nextdata = SetKouseihin[j];

                    if (data.品番コード == nextdata.品番コード)
                    {
                        // 名称=空値 => 対象外(SET品)の品番 or 品番登録なし
                        errMsg = string.Format("{0}行目:同じ品番が複数行存在しています。", i + 1);
                        return(errMsg);
                    }
                }
            }

            return(string.Empty);
        }