Exemple #1
0
        /// <summary>
        /// SPREAD セル編集がコミットされた時の処理(手入力) CellEditEnadedイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gcSpredGrid_CellEditEnded(object sender, SpreadCellEditEndedEventArgs e)
        {
            GcSpreadGrid grid = sender as GcSpreadGrid;

            if (e.EditAction == SpreadEditAction.Cancel)
            {
                return;
            }

            switch (e.CellPosition.ColumnName)
            {
            case "金種コード":
                var target = getSpreadGridValue(e.CellPosition.Row, GridColumnsMapping.金種コード);
                if (target == null)
                {
                    return;
                }

                int val = int.Parse(target.ToString());
                setSpreadGridValue(e.CellPosition.Row, GridColumnsMapping.金種名, 金種Dic.ContainsKey(val) ? 金種Dic[val] : string.Empty);
                break;

            default:
                break;
            }
        }
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="gr">対象のスプレッドグリッドコントロール</param>
        public GcSpreadGridController(GcSpreadGrid gr)
        {
            _grid = gr;

            _grid.InputBindings.Add(new KeyBinding(_grid.NavigationCommands.MoveNext, Key.Enter, ModifierKeys.None));

            _grid.PreviewKeyDown += GcSpreadGrid_PreviewKeyDown;
        }
        /// <summary>
        /// SPREAD セル編集がコミットされた時の処理(手入力) CellEditEnadedイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gcSpredGrid_CellEditEnded(object sender, SpreadCellEditEndedEventArgs e)
        {
            GcSpreadGrid grid = sender as GcSpreadGrid;

            if (e.EditAction == SpreadEditAction.Cancel)
            {
                return;
            }

            //明細行が存在しない場合は処理しない
            if (SearchDetail == null)
            {
                return;
            }
            if (SearchDetail.Select("", "", DataViewRowState.CurrentRows).Count() == 0)
            {
                return;
            }

            _編集行 = e.CellPosition.Row;

            try
            {
                switch (e.CellPosition.ColumnName)
                {
                case "自社品番":
                    var target = grid.Cells[e.CellPosition.Row, e.CellPosition.Column].Value;
                    if (target == null)
                    {
                        return;
                    }

                    // 自社品番(または得意先品番)からデータを参照し、取得内容をグリッドに設定
                    base.SendRequest(
                        new CommunicationObject(
                            MessageType.RequestData,
                            MasterCode_MyProduct,
                            new object[] {
                        target.ToString()
                        , null
                        , null
                    }));
                    break;

                default:
                    break;
                }

                SearchDetail.Rows[grid.ActiveRowIndex].EndEdit();               // No-160 Add
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        /// <summary>
        /// SPREAD セル編集がコミットされた時の処理(手入力) CellEditEnadedイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gcInnerSpreadGrid_CellEditEnded(object sender, SpreadCellEditEndedEventArgs e)
        {
            GcSpreadGrid grid         = sender as GcSpreadGrid;
            string       targetColumn = grid.ActiveCellPosition.ColumnName;

            if (e.EditAction == SpreadEditAction.Cancel)
            {
                return;
            }

            //明細行が存在しない場合は処理しない
            if (InnerDetail == null)
            {
                return;
            }
            if (InnerDetail.Select("", "", DataViewRowState.CurrentRows).Count() == 0)
            {
                return;
            }

            _編集行 = e.CellPosition.Row;

            switch (targetColumn)
            {
            case "自社品番":
                var target = gridDtb.GetCellValueToString();
                if (string.IsNullOrEmpty(target))
                {
                    return;
                }

                // 自社品番からデータを参照し、取得内容をグリッドに設定
                base.SendRequest(
                    new CommunicationObject(
                        MessageType.RequestData,
                        MasterCode_MyProduct,
                        new object[] {
                    target.ToString()
                    , string.Empty,
                    string.Empty
                }));
                break;

            case "数量":
            case "賞味期限":

                InnerDetail.Rows[gridDtl.ActiveRowIndex].EndEdit();

                break;

            default:
                break;
            }
        }
Exemple #5
0
        /// <summary>
        /// スプレッドグリッド上でキーが押された時のイベント処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gcSpredGrid_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            GcSpreadGrid grid = sender as GcSpreadGrid;

            // Delete押下時の処理
            // REMARKS:編集状態でない場合のDeleteキーは無視する
            if (e.Key == Key.Delete && !grid.Cells[gcSpreadGrid.ActiveRowIndex, grid.ActiveColumnIndex].IsEditing)
            {
                e.Handled = true;
            }
        }
        /// <summary>
        /// SPREAD セル編集がコミットされた時の処理(手入力) CellEditEnadedイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gcSpreadGrid_CellEditEnded(object sender, SpreadCellEditEndedEventArgs e)
        {
            GcSpreadGrid grid         = sender as GcSpreadGrid;
            string       targetColumn = grid.ActiveCellPosition.ColumnName;

            if (e.EditAction == SpreadEditAction.Cancel)
            {
                return;
            }

            int rIdx = gcSpreadGrid.ActiveRowIndex;

            switch (targetColumn)
            {
            case "自社品番":
                var 自社品番 = getSpreadGridValue(rIdx, GridColumnsMapping.自社品番);
                var 自社色  = getSpreadGridValue(rIdx, GridColumnsMapping.自社色);

                if (自社品番 == null || 自社色 == null)
                {
                    return;
                }

                // 品番未入力時には処理しない
                if (string.IsNullOrEmpty(自社品番.ToString()))
                {
                    // 行データをクリア
                    ClearRowItems(rIdx);
                    return;
                }

                // 自社品番からデータを参照し、取得内容をグリッドに設定
                base.SendRequest(
                    new CommunicationObject(
                        MessageType.RequestData,
                        MasterCode_MyProduct,
                        new object[] {
                    自社品番.ToString(),
                    自社色.ToString()
                }));
                break;

            case "数量":
                // 在庫数不足チェック

                break;

            default:
                break;
            }
        }
        /// <summary>
        /// SPREAD セル編集がコミットされた時の処理(手入力) CellEditEnadedイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gcSpredGrid_CellEditEnded(object sender, SpreadCellEditEndedEventArgs e)
        {
            GcSpreadGrid grid = sender as GcSpreadGrid;

            if (e.EditAction == SpreadEditAction.Cancel)
            {
                return;
            }

            //明細行が存在しない場合は処理しない
            if (SearchDetail == null)
            {
                return;
            }
            if (SearchDetail.Select("", "", DataViewRowState.CurrentRows).Count() == 0)
            {
                return;
            }

            switch (e.CellPosition.ColumnName)
            {
            case "単価":
            case "数量":
                // 金額の再計算
                Row     targetRow = grid.Rows[grid.ActiveRowIndex];
                decimal cost      = decimal.Parse(targetRow.Cells[GridColumnsMapping.単価.GetHashCode()].Value.ToString());
                decimal qty       = decimal.Parse(targetRow.Cells[GridColumnsMapping.数量.GetHashCode()].Value.ToString());

                targetRow.Cells[GridColumnsMapping.金額.GetHashCode()].Value = Convert.ToInt32(decimal.Multiply(cost, qty));

                // グリッド内容の再計算を実施
                summaryCalculation();

                SearchDetail.Rows[targetRow.Index].EndEdit();

                break;

            default:

                //▼課題管理表No173-4 Add Start Arinobu 2019/10/10
                if (gridCtl.ActiveRowIndex >= 0)
                {
                    // EndEditが行われずに登録すると変更内容が反映されないため処理追加
                    SearchDetail.Rows[gridCtl.ActiveRowIndex].EndEdit();
                }
                //▲課題管理表No173-4 Add Start Arinobu 2019/10/10
                break;
            }
        }
        /// <summary>
        /// SPREAD セルが編集状態になった時の処理 EditElementShowingイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gcSpredGrid_EditElementShowing(object sender, EditElementShowingEventArgs e)
        {
            GcSpreadGrid grid = sender as GcSpreadGrid;

            if (grid.ActiveCell.InheritedCellType is GrapeCity.Windows.SpreadGrid.CheckBoxCellType)
            {
                // チェックボックス型セルのイベントを関連付けます。
                GrapeCity.Windows.SpreadGrid.Editors.CheckBoxEditElement gcchk = grid.EditElement as GrapeCity.Windows.SpreadGrid.Editors.CheckBoxEditElement;
                if (gcchk != null)
                {
                    gcchk.Checked   += checkEdit_Checked;
                    gcchk.Unchecked += checkEdit_Unchecked;
                }
            }
        }
        private void SetupSpreadFixedColumn(GcSpreadGrid gcsp, string colNum)
        {
            if (string.IsNullOrWhiteSpace(colNum))
            {
                return;
            }
            int cno;

            if (int.TryParse(colNum, out cno) != true)
            {
                return;
            }
            if (cno < 1)
            {
                return;
            }
            gcsp.FrozenColumnCount = cno;
        }
Exemple #10
0
        /// <summary>
        /// spreadセル編集完了時処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SearchGrid_CellEditEnded(object sender, GrapeCity.Windows.SpreadGrid.SpreadCellEditEndedEventArgs e)
        {
            GcSpreadGrid grid         = sender as GcSpreadGrid;
            string       targetColumn = grid.ActiveCellPosition.ColumnName;
            int?         i担当者コード      = null;

            //明細行が存在しない場合は処理しない
            if (SearchResult == null)
            {
                return;
            }

            Row targetRow = grid.Rows[grid.ActiveRowIndex];

            targetRowIdx = targetRow.Index;
            targetColIdx = grid.ActiveColumnIndex;

            //編集したセルの値を取得
            var CellValue = grid[grid.ActiveRowIndex, targetColumn].Value;



            //担当者コードが入力された際担当者名をDBから取得
            if (CellValue != null && CellValue.ToString().Length > 0)
            {
                i担当者コード = int.Parse(CellValue.ToString());
            }
            else
            {
                CellValue = DBNull.Value;
            }

            SearchResult.Rows[targetRow.Index][targetColumn] = CellValue;

            if (targetColumn == "請求担当者コード" || targetColumn == "支払担当者コード")
            {
                base.SendRequest(
                    new CommunicationObject(MessageType.RequestData, MST01011_GetM72, new object[]
                {
                    i担当者コード
                }));
            }
        }
        /// <summary>
        /// SPREAD セル編集がコミットされた時の処理(手入力) CellEditEnadedイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SearchGrid_CellEditEnded(object sender, SpreadCellEditEndedEventArgs e)
        {
            GcSpreadGrid grid         = sender as GcSpreadGrid;
            string       targetColumn = grid.ActiveCellPosition.ColumnName;

            if (e.EditAction == SpreadEditAction.Cancel)
            {
                return;
            }

            switch (targetColumn)
            {
            case "単価":
            case "数量":
                // 金額の再計算
                decimal cost = gridCtl.GetCellValueToDecimal((int)GridColumnsMapping.単価) ?? 0;
                decimal qty  = gridCtl.GetCellValueToDecimal((int)GridColumnsMapping.数量) ?? 0;

                gridCtl.SetCellValue((int)GridColumnsMapping.金額, Convert.ToInt32(decimal.Multiply(cost, qty)));

                // グリッド内容の再計算を実施
                summaryCalculation();

                SearchDetail.Rows[gridCtl.ActiveRowIndex].EndEdit();

                break;

            //▼課題管理表No173-3 Add Start Arinobu 2019/10/10
            default:
                if (gridCtl.ActiveRowIndex >= 0)
                {
                    // EndEditが行われずに登録すると変更内容が反映されないため処理追加
                    SearchDetail.Rows[gridCtl.ActiveRowIndex].EndEdit();
                }
                break;
                //▲課題管理表No173-3 Add End Arinobu 2019/10/10
            }
        }
        /// <summary>
        /// セル編集コミット時処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SearchGrid_CellEditEnded(object sender, GrapeCity.Windows.SpreadGrid.SpreadCellEditEndedEventArgs e)
        {
            GcSpreadGrid grid = sender as GcSpreadGrid;

            int    intColumnIdx = grid.ActiveCellPosition.Column;
            string targetColumn = grid.ActiveCellPosition.ColumnName;

            //明細行が存在しない場合は処理しない
            if (SearchResult == null)
            {
                return;
            }

            Row targetRow = grid.Rows[grid.ActiveRowIndex];

            //編集したセルの値を取得
            var CellValue = grid[grid.ActiveRowIndex, targetColumn].Value;

            if (CellValue != null)
            {
                SearchResult.Rows[targetRow.Index][targetColumn] = CellValue;
            }
        }
 public cmd売上詳細表示(GcSpreadGrid gcSpreadGrid)
 {
     this._gcSpreadGrid = gcSpreadGrid;
 }
 public cmd構成部品(GcSpreadGrid gcSpreadGrid)
 {
     this._gcSpreadGrid = gcSpreadGrid;
 }
 public cmd売上削除(GcSpreadGrid gcSpreadGrid)
 {
     this._gcSpreadGrid = gcSpreadGrid;
 }
 public cmd期間クリア(GcSpreadGrid gcSpreadGrid)
 {
     this._gcSpreadGrid = gcSpreadGrid;
 }
 public cmd在庫(GcSpreadGrid gcSpreadGrid)
 {
     this._gcSpreadGrid = gcSpreadGrid;
 }
Exemple #18
0
        /// <summary>
        /// SPREAD セル編集がコミットされた時の処理(手入力) CellEditEnadedイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gcSpredGrid_CellEditEnded(object sender, SpreadCellEditEndedEventArgs e)
        {
            GcSpreadGrid grid            = sender as GcSpreadGrid;
            int          targetColumnIdx = grid.ActiveColumnIndex;
            int          targetRowIndex  = grid.ActiveRowIndex;

            if (e.EditAction == SpreadEditAction.Cancel)
            {
                return;
            }

            switch (targetColumnIdx)
            {
            case (int)GridColumnsMapping.取引先コード:
            case (int)GridColumnsMapping.枝番:
                string code = getSpreadGridValue(targetRowIndex, GridColumnsMapping.取引先コード).ToString();
                string eda  = getSpreadGridValue(targetRowIndex, GridColumnsMapping.枝番).ToString();

                if (string.IsNullOrEmpty(code) || string.IsNullOrEmpty(eda))
                {
                    setSpreadGridValue(targetRowIndex, GridColumnsMapping.得意先名, string.Empty);
                    return;
                }

                // 入力内容から取引先マスタを参照
                base.SendRequest(
                    new CommunicationObject(
                        MessageType.RequestData,
                        MasterCode_Supplier,
                        new object[] {
                    this.Subcontractor.DataAccessName,
                    code,
                    eda,
                    this.Subcontractor.LinkItem
                }));
                break;

            case (int)GridColumnsMapping.自社品番:
            case (int)GridColumnsMapping.色コード:
                string productCode = getSpreadGridValue(targetRowIndex, GridColumnsMapping.自社品番).ToString();

                if (string.IsNullOrEmpty(productCode))
                {
                    return;
                }

                // 自社品番から品番マスタを参照
                base.SendRequest(
                    new CommunicationObject(
                        MessageType.RequestData,
                        MasterCode_MyProductSet,
                        new object[] {
                    productCode
                }));
                break;

            case (int)GridColumnsMapping.依頼日:
            case (int)GridColumnsMapping.依頼数:
            case (int)GridColumnsMapping.仕上数:
                DataRow row = SearchResult.Rows[targetRowIndex];
                if (row.RowState == DataRowState.Unchanged)
                {
                    if (row.HasVersion(DataRowVersion.Original))
                    {
                        // Remarks:テーブル列とグリッド列の並びが違うので加算して合わせる
                        var org = row[targetColumnIdx + 1, DataRowVersion.Original];
                        var val = row[targetColumnIdx + 1];

                        if (org.ToString() != val.ToString())
                        {
                            row.SetModified();
                            row[targetColumnIdx + 1] = val;
                        }
                    }
                }

                break;

            default:
                break;
            }
        }
Exemple #19
0
 public cmd確定日登録(GcSpreadGrid gcSpreadGrid)
 {
     this._gcSpreadGrid = gcSpreadGrid;
 }