Vous consultez une page technique concernant le logiciel de gestion Mercator. Celle-ci contient des informations spécifiques destinées aux professionnels de Mercator. Souhaitez-vous être redirigés vers des informations plus générales ?


   Ne plus poser cette question

Exemple 3 d'implémentation de consommations de ressources

0000002558     -      08/10/2015

A partir d'un document de gestion de production, la gestion des ressources est activée au niveau du 4ème signalétique. La quantité consommée correspond à la valeur dans un champ optionnel Q_RESS. La couleur correspond à un atelier choisi manuellement dans un champ optionnel ATELIER. Le libellé correspond à la désignation de l'article présent sur la même ligne.

Pour installer cette configuration :

  • Installer le trigger TR_LIGNESA_RESS_DEST_DEL en copiant le contenu du fichier TR_LIGNESA_RESS_DEST_DEL.sql dans un onglet SQL de l'éditeur de code. (Ce trigger peut être retiré en exécutant la commande suivante : drop trigger TR_LIGNESA_RESS_DEST_DEL)
     
  • Installer le trigger TR_LIGNESA_RESS_DEST_INS en copiant le contenu du fichier TR_LIGNESA_RESS_DEST_INS.sql dans un onglet SQL de l'éditeur de code. (Ce trigger peut être retiré en exécutant la commande suivante : drop trigger TR_LIGNESA_RESS_DEST_INS)
     
  • Ajouter une colonne dans la grille de la séquence avec
    • la propriété Source : Atelier
    • la propriété SqlQuery : <items>Atelier 1,Atelier 2,Atelier 3,Atelier 4,Atelier 5,Atelier 6,Atelier 7,Atelier 8,Atelier 9</items>
       
  • Placer ce customizer dans la (ou les) séquence(s) concernée(s) :
Zoom
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Windows.Forms;
using MercatorApi;
using MercatorUi;
using System.Drawing;

namespace Billing
{
    public class Customizer : MercatorUi.ICustomizers.IFormLoadCustomizer,
        MercatorUi.ICustomizers.IFormClosedCustomizer
    {
        public void FormLoadCustomize(System.Windows.Forms.Form WindowsForm)
        {
            MercatorUi.Forms.Billing.BillingForm billingForm = (MercatorUi.Forms.Billing.BillingForm)WindowsForm;
            LinesEditorGrid_DefineColumns(billingForm.LinesEditor.Grid);
            billingForm.LinesEditor.Grid.CellSuperClick += new MercatorUi.GridPro.CellSuperClickHandler(LinesEditorGrid_CellSuperClick);
        }
        public void FormClosedCustomize(System.Windows.Forms.Form WindowsForm)
        {
            MercatorUi.Forms.Billing.BillingForm billingForm = (MercatorUi.Forms.Billing.BillingForm)WindowsForm;
            billingForm.LinesEditor.Grid.CellSuperClick -= new MercatorUi.GridPro.CellSuperClickHandler(LinesEditorGrid_CellSuperClick);
        }

        private void LinesEditorGrid_DefineColumns(MercatorUi.GridPro.DataGridViewXPro grid)
        {
            MercatorUi.GridPro.DataGridViewHidableButtonXColumn btnRess = new MercatorUi.GridPro.DataGridViewHidableButtonXColumn();
            btnRess.Name = "btnRess";
            btnRess.Width = 30;
            btnRess.HeaderText = "";
            btnRess.Text = "Grantt";
            btnRess.ToolTipText = "Grantt";
            grid.Columns.Add(btnRess);
            grid.Columns["btnRess"].Width = 30;
        }
        private void LinesEditorGrid_CellSuperClick(object sender, DataGridViewCellEventArgs e)
        {
            MercatorUi.GridPro.DataGridViewXPro Grid = (MercatorUi.GridPro.DataGridViewXPro)sender;
            MercatorUi.Forms.Billing.BillingForm billingForm = (MercatorUi.Forms.Billing.BillingForm)Grid.FindForm();

            if ((e.RowIndex > -1) && (e.ColumnIndex > -1))
            {
                if (Grid.Columns[e.ColumnIndex].Name == "btnRess")
                {
                    MercatorUi.GridPro.DataGridViewHidableButtonXCell cellBtnRess = (MercatorUi.GridPro.DataGridViewHidableButtonXCell)Grid.Rows[e.RowIndex].Cells[e.ColumnIndex];

                    using (MercatorUi.Forms.Sig.SigDialogs.Ress.RessSelect ressSelect = new MercatorUi.Forms.Sig.SigDialogs.Ress.RessSelect(MercatorUi.Sig._SigEnum.PROJ, Grid.Rows[e.RowIndex].Cells["ID_PROJ"].Value.ToString(), (DateTime)billingForm.BillingEngine.LIGNES.Rows[e.RowIndex]["MOMENT1"], (DateTime)billingForm.BillingEngine.LIGNES.Rows[e.RowIndex]["MOMENT2"]))
                    {
                        ressSelect.ShowDialog(Globals.iw);
                        if (ressSelect.DialogResult == DialogResult.OK)
                        {
                            billingForm.BillingEngine.LIGNES.Rows[e.RowIndex]["MOMENT1"] = ressSelect.ret_moment1;
                            billingForm.BillingEngine.LIGNES.Rows[e.RowIndex]["MOMENT2"] = ressSelect.ret_moment2;
                            Dialogs.Stop(ressSelect.ret_id_sig);
                            if (ressSelect.ret_id_sig != "" && ressSelect.ret_id_sig != Grid.Rows[e.RowIndex].Cells["ID_DEST"].Value.ToString())
                            {
                                billingForm.BillingEngine.LIGNES.Rows[e.RowIndex]["ID_DESTIN"] = ressSelect.ret_id_sig;
                                string lib_proj = MercatorController.xFunctions.xLookUpString("DEST", "D_ID", ressSelect.ret_id_sig, "D_NOM");
                                Grid.Rows[e.RowIndex].Cells["lib_dest"].Value = lib_proj;
                            }
                        }
                    }
                }
            }
        }
    }
}


A télécharger : 0000002558.zip (1 Kb - 09/10/2015)