Friday, 7 August 2015

Arrival Create Journal From Arrival Overview and Posting

Functional Process:

To Get Lines in to Arrival Overview - we need to Create Purchase order.

Create Arrival journal(s) from Arrival overview form

1.       User navigates to Stock management / Periodic / Arrival overview
2.       On Arrival overview form,
a.       On Setup tab user sets new ‘Arrival journal per purchase order’ checkbox to ‘yes’
b.       On Overview tab user adjusts range as needed, and selects ‘Update’
3.       On same Arrival overview form, in Receipts section lines are displayed based on previously defined filter criteria ( set – Days Back : 2000 if you want data – click update)
4.       User selects lines (mark them in column ‘Select for arrival’), and calls function ‘Start arrival’
5.       AX prompts user about Arrival journal(s) being created

Register Delivered items on Arrival journal, and post journal

1.       User navigates to Stock management / Journals / Item arrival
2.       Item arrival form opened, user selects journal, and click on ‘Lines’ button.
3.       Journal lines form opened, providing information about:
4.       Click ‘Post’
5.       Posting dialog box displayed. If the user posts an arrival journal with discrepanc

Technical Overview :

Create Arrival journal(s) from Arrival overview form

>>\Forms\WMSArrivalOverview\Designs\Design\[Tab:Tab]\[TabPage:OverviewTabPage]\[Group:ExpectedReceipts]\[Group:OverviewGroup]\[ActionPane:ActionPane]\[ActionPaneTab:ActionPaneTab]\[ButtonGroup:ButtonGroup]\Button:StartArrivalButton\Methods\clicked

>> Classes\ WMSArrivalStart::startArrival

>> Classes\ WMSArrivalStart\run

wmsArrivalCreateJournal.createWMSJournalTrans(wmsArrivalDetailTmpLocal);  - Journal is created by looping all the selected lines in Lines grid.

>>Classes\WMSArrivalCreateJournal\ createWMSJournalTrans
Line no : 34  - Creates journal header
if (!wmsJournalTable.RecId)
    {
        this.createWMSJournalFromTmp(_wmsArrivalDetailTmp);
    }

Line no  : 52 – Create Journal Lines.

numberOfLines += this.createWMSJournalTransFromTmp(_wmsArrivalDetailTmp);

Post Item Arrival Journal : 

Classes \ WmsJournalCheckPostReception\run
Classes \ WMSJournalCheckPost\main
Classes\ JournalCheckPost\postjournal
 Some Learnings about Classes \JournalCheckPost :
Classes\JournalCheckPost\runEnd – then itself Journal status is updated as posted.
Classes \ WmsJournalCheckPostReception\run  - After Super() – We can make any process that should be done after posting …( Method can be overrided, as it do not exist).
X++ code to create a Item Arrival Journal :

Classes \ WmsJournalCheckPostReception\run   - Get Journal Id through
this.parmJournalId()

Requirements / Modifications :

Create Arrival journal(s) from Arrival overview form

Need to Create separate journals for different Orders
Customization required :
while select wmsArrivalDetailTmpLocal
        where wmsArrivalDetailTmpLocal.Selected   == NoYes::Yes
        &&    wmsArrivalDetailTmpLocal.InventQty  >  0
    {
        find    =   conFind(con,wmsArrivalDetailTmpLocal.InventTransRefId);
        if (!find)
        {
            con = conIns(con,i,wmsArrivalDetailTmpLocal.InventTransRefId);
            i++;
        }
    }
Get all different order ids and loop it by setting Invent TransRefId as range
while select wmsArrivalDetailTmpLocal
            where wmsArrivalDetailTmpLocal.Selected   == NoYes::Yes  // Existing
            &&    wmsArrivalDetailTmpLocal.InventQty  >  0
            && wmsArrivalDetailTmpLocal.InventTransRefId    ==  refrenceId // Add this line as range

Post Item Arrival Journal : 

Need to add new parameter on the post , Based on that we need to create new journal on some validated conditions

In post Dialog Add one more parameter along with Transfer all posting errors to a new journal :

Customization :

1)       Need to add Parm method
2)       Show this field only for Arrival posting : Classes\JournalCheckPost\dialog
wmsjournaltable =   WMSJournalTable::find(journalId);
        if(wmsjournaltable.journalType  ==  WMSJournalType::Reception)
            dialogTransferRemainingQty  = dialog.addField(extendedTypeStr(StockJournalTransferRemainingQuantity));


3)       Need to add the field in Macro – to maintain the value in cache -modify in Unpack and Classdeclaration ( If any error, just remove cache and usage data).
4)       Set parm method in Classes\JournalCheckPost\getFromDialog

Create a new Item Arrival Journal Through code : 

private void CreateArrivalJournal(JournalId _journalId)//JournalTransList _journalTransList)
{
        WMSJournalTable         fromJournalTable,toJournalTable;
        WMSJournalTrans         fromJournalTrans,toJournalTrans;
        str                     journalNum,journalName;
        int                     lineNum = 1;
        NumberSeq               numberSeq;
        WMSJournalName          wmsJournalName;
    ;
        if(this.chkRemaingQtyPerJournal(_journalId))
    {
        select * from fromJournalTable
            where fromJournalTable.journalId    ==  _journalId;

        numberSeq = NumberSeq::newGetNum(WMSParameters::numRefWMSJournalId());
        journalName = WMSParameters::find().receptionJournalNameId;
        journalNum = numberSeq.num();
        wmsJournalName = WMSJournalName::find(journalName);
        ttsbegin;
        toJournalTable.initFromWMSJournalName(wmsJournalName);

        toJournalTable.JournalNameId        =   journalName;
        toJournalTable.JournalId            =   journalNum;
        toJournalTable.journalType          =   WMSJournalType::Reception;

        toJournalTable.inventDimId = InventDim::inventDimIdBlank();
        toJournalTable.insert();
        while select fromJournalTrans
            where fromJournalTrans.journalId    ==  _journalId
        {
            //Condition whether to insert or not the lines
            {
                    toJournalTrans.clear();
                    toJournalTrans.initFromWMSJournalTable(toJournalTable);
                    toJournalTrans.JournalId                =   journalNum;
                    toJournalTrans.LineNum                  =   lineNum;
                    toJournalTrans.TransDate                =   today();
                    toJournalTrans.ItemId                   =   fromJournalTrans.ItemId;
                    toJournalTrans.Qty                      =   fromJournalTrans.StockExpectedQuantity - fromJournalTrans.qty;
                    toJournalTrans.InventDimId              =   fromJournalTrans.InventDimId;
                    toJournalTrans.vendAccount              =  fromJournalTrans.vendAccount;
                    toJournalTrans.inventTransType          =   fromJournalTrans.inventTransType;
                    toJournalTrans.inventTransRefId         =   fromJournalTrans.inventTransRefId;
                    toJournalTrans.inventTransId            =   fromJournalTrans.inventTransId;
                    toJournalTrans.checkPickingLocation     =   NoYes::No;
                    toJournalTrans.createQuarantineOrder    =   NoYes::No;
                    toJournalTrans.inventDimId              =   fromJournalTrans.InventDimId;
                    toJournalTrans.StockExpectedQuantity    =   fromJournalTrans.qty;
                    toJournalTrans.insert();
                    lineNum++;
            }
        }
    ttscommit;       
         info(strFmt("@SYS58788", journalNum));
    }

}


No comments:

Post a Comment