Add a column in Gantt chart form in all Production order.

 Today we have requirement to add the one more column ( description on the based of resource) in the Gantt chart form.


Path ---> Production control>> All production order >> select started production order >> Click on the schedule >> Click on the Gantt Chart form.


Step to complete this 

Step 1 :- Create a filed in the temp table "GanttTmpWrkCtrJob."

=====================================================================

Step 2 :- Create a COC of Class "GanttTable_WrkCtrJob".


[ExtensionOf(classStr(GanttTable_WrkCtrJob))]

final class AVAGanttTable_WrkCtrJob_Extension

{

    /// <summary>

    ///    Initializes the <c>GanttTmpWrkCtrJob</c> data fields that have the data from a production order job

    /// </summary>

    /// <param name="_prodRouteJob">

    ///    A table buffer that contains the source production order job data.

    /// </param>

    /// <param name="_prodRoute">

    ///    A table buffer that contains the production route data.

    /// </param>

   

    public void initFromProdRouteJob(ProdRouteJob   _prodRouteJob,

                                     ProdRoute      _prodRoute)

    {

        next initFromProdRouteJob(_prodRouteJob,_prodRoute);


        ganttTmpWrkCtrJob.AVAResourceDescription  = WrkCtrTable::find(_prodRouteJob.WrkCtrId).Name;

    }


    /// <summary>

    ///    Initializes the <c>GanttTmpWrkCtrJob</c> data fields that have data from a planned production order

    ///    job

    /// </summary>

    /// <param name="_reqRouteJob">

    ///    A table buffer that contains the source planned production order job data.

    /// </param>

    /// <param name="_reqRoute">

    ///    A table buffer that contains the planned production order route data.

    /// </param>

   

    public void initFromReqRouteJob(ReqRouteJob _reqRouteJob,

                                    ReqRoute    _reqRoute) 

    {

        next initFromReqRouteJob(_reqRouteJob,_reqRoute);


        ganttTmpWrkCtrJob.AVAResourceDescription  = WrkCtrTable::find(_reqRouteJob.WrkCtrId).Name;

    }


}

=========================================================================


Step 3 :- Create a coc of "GanttControlVisualization_WrkCtr" it helps to create column size and coloum fill the values in the coloum :- 


Please note :- we need to delete the list which is created and after that we need to create our own list to perform the action 


[ExtensionOf(classStr(GanttControlVisualization_WrkCtr))]

final class AVAGanttControlVisualization_WrkCt_Extension

{


    /// <summary>

    /// Gets the columns to display in the gantt control.

    /// </summary>

    /// <returns>A List of gantt column settings.</returns>

    

    public List getColumns()

    {

        List                  columns = new List(Types::Class);

        ListIterator          iter;

        GanttControlColumn    value;


        columns = next getColumns();


        iter = new ListIterator(columns);


        while (iter.more())

        {

            value = iter.value();

 

            if (value)

            {

                iter.delete();

            }

            else

            {

                iter.next();

            }

        }


        columns.addEnd(GanttControlColumn::newParameters(fieldPName(GanttTmpWrkCtrJob, RefId), 135, true));

        columns.addEnd(GanttControlColumn::newParameters(fieldPName(GanttTmpWrkCtrJob, OprNum), 80, true));

        columns.addEnd(GanttControlColumn::newParameters(fieldPName(GanttTmpWrkCtrJob, JobType), 100, true));

        columns.addEnd(GanttControlColumn::newParameters(fieldPName(GanttTmpWrkCtrJob, WrkCtrId), 80, true));

        columns.addEnd(GanttControlColumn::newParameters(fieldPName(GanttTmpWrkCtrJob, AVAResourceDescription), 200, true));

        columns.addEnd(GanttControlColumn::newParameters(fieldPName(GanttTmpWrkCtrJob, SchedFromDateTime), 140, true));

        columns.addEnd(GanttControlColumn::newParameters(fieldPName(GanttTmpWrkCtrJob, SchedToDateTime), 140, true));

       

        return columns;

    }


    /// <summary>

    /// Creates a list with the column details of the Gantt temp job.

    /// </summary>

    /// <param name = "_ganttTmpWrkCtrJob">The job record to get details from.</param>

    /// <returns>A list with the column texts of th job.</returns>

    protected List getColumnTexts(GanttTmpWrkCtrJob _ganttTmpWrkCtrJob)

    {

        List            columnTexts = new List(Types::String);

        ListIterator    iter;

        Name            value;

       


        columnTexts = next getColumnTexts(_ganttTmpWrkCtrJob);


        iter = new ListIterator(columnTexts);


        while (iter.more())

        {

            value = iter.value();

 

            if (value)

            {

                iter.delete();

            }

            else

            {

                iter.next();

            }

        }


        columnTexts.addEnd(_ganttTmpWrkCtrJob.RefId);

        columnTexts.addEnd(int2Str(_ganttTmpWrkCtrJob.OprNum));

        columnTexts.addEnd(enum2Str(_ganttTmpWrkCtrJob.JobType));

        columnTexts.addEnd(_ganttTmpWrkCtrJob.WrkCtrId);

        columnTexts.addEnd(_ganttTmpWrkCtrJob.AVAResourceDescription);

        columnTexts.addEnd(strFmt('%1', DateTimeUtil::applyTimeZoneOffset(_ganttTmpWrkCtrJob.SchedFromDateTime, DateTimeUtil::getUserPreferredTimeZone())));

        columnTexts.addEnd(strFmt('%1', DateTimeUtil::applyTimeZoneOffset(_ganttTmpWrkCtrJob.SchedToDateTime, DateTimeUtil::getUserPreferredTimeZone())));

    

        return columnTexts;


    }


}

=====================================================================

Before :- 



After :- 


=========================================================================















Comments

Popular posts from this blog

Customization on Sales invoice Report in D365 F&O

75) COC - Create a coc of the table modified method

46) D365 FO: SHAREPOINT FILE UPLOAD USING X++