Tuesday, March 13, 2018

Movement journal picking list post with qty spliting for updating serial number


    Inventtrans                         inventTrans,inventTransCopy,inventTransLocal,inventTransUpdate;
    InventTransOrigin                   inventTransOrigin;
    inventjournaltrans                  inventjournaltrans;
    EcoResProductDimensionGroupProduct  erpdgp;
    EcoResProductDimensionGroup         erpdg;
    int                                 rowCount,i;
    TmpInventTransWMS                   tmpInventTransWMS;
    InventMovement                      InventMovement;
    InventTransOrigin                   InventTransOriginLoc;
    inventTransWMS_Pick                 inventTransWMS_Pick;
    Query                               inventTransQuery;
    QueryBuildDataSource                QueryBuildDataSource;
    InventTable                         inventtable;

    System.String                       netString = "Net string.";
    System.Exception                    netExcepn;

    while select inventjournaltrans where inventjournaltrans.JournalId == "00434"
    {
        erpdgp=EcoResProductDimensionGroupProduct::findByProduct(Inventtable::find(inventjournaltrans.ItemID).Product);
     
        if ( erpdg.Name == "SN" )
        {

            inventTransOrigin =     InventTransOrigin::findByInventTransId(inventjournaltrans.InventTransId, false);
            inventTrans = InventTrans::findByInventTransOrigin(inventTransOrigin.RecId, false);
            rowCount = real2int(abs(inventTrans.Qty));
            for (i = 1; i < rowCount; i++)
            {
                inventTrans = InventTrans::findByInventTransOrigin(inventTransOrigin.RecId, false);
                inventTrans.updateSplit(-1);
            }
        }
        else
            continue;

    }
    inventjournaltrans.clear();
    while select inventjournaltrans where inventjournaltrans.JournalId == "00434"
    {
        select inventTransOriginloc where inventTransOriginloc.InventTransId == inventjournaltrans.InventTransId;
        // start loop on <inventTrans> to get each item line
        while select inventTransUpdate where inventTransUpdate.InventTransOrigin == inventTransOriginloc.RecId
        {
            inventTransQuery                = new Query();
            QueryBuildDataSource            = inventTransQuery.addDataSource(tableNum(InventTrans));
            InventTransOrigin               = InventTransorigin::findByInventTransId(inventTransOriginloc.InventTransId);
            QueryBuildDataSource.addRange(fieldNum(InventTrans,RecId)).value(int642str(inventTransUpdate.recid));
            delete_from tmpInventTransWMS;
            tmpInventTransWMS.clear();
            inventTransWMS_Pick             = InventTransWMS_Pick::newStandard(tmpInventTransWMS,inventTransQuery);
            tmpInventTransWMS.initFromInventTrans(inventTransUpdate);
            tmpInventTransWMS.initFromInventTransOrigin(InventTransOriginloc);
            tmpInventTransWMS.InventQty     = 1;//inventTransUpdate.Qty;
            //tmpInventTransWMS.InventDimId   = _InventDimId;
            inventTransWMS_Pick.writeTmpInventTransWMS(tmpInventTransWMS);
            inventTransWMS_Pick.updateInvent();
        }
    }

No comments:

Post a Comment