• Useing x++ Calculate period the on hand stock


    Useing x++ code Calculate period the on hand stock

    Remark by Jimmy July 13th 2010

    static void Jimmy_OnHandCalc(Args _args)
    {
        InventSumFinancial          InventSumFinancial;
        InventSumDatePhysical       InventSumDatePhysical = new InventSumDatePhysical();
        InventSumDateValueReport    InventSumDateValueReport;
        InventSumDateValue          InventSumDateValue    = new InventSumDateValue();
        InventSum                   InventSum;
        qty                         OnHandQty;
        Date                        PhysicalDate = MkDate(30,4,2010);
        ItemId                      ItemId  = 'BAG-1077-2';//10-1000
        InventTable                 IT      = InventTable::find(ItemId);
     ;
        InventSumDateValueReport = InventSumDateValueReport::newParameters(PhysicalDate,ItemId);
        OnHandQty =  InventSumDateValueReport.inventoryValue();
        print 'InventSumDateValueReport as below';//数量与库存价值均以物料实际交易日期为准则
        print 'Qty:',InventSumDateValueReport.physicalQuantity(),
          '   Value:',InventSumDateValueReport.inventoryValue();
    
        OnHandQty = 0;
    
        InventSumFinancial = InventSumFinancial::newInventTable(PhysicalDate,IT);
        OnHandQty = InventSumFinancial.value();
        print 'InventSumFinancial as below';//数量与库存价值均以 财务实际交易日期为准则
        print 'Qty:',InventSumFinancial.qty(),
           '   Value:',InventSumFinancial.value();
    
        InventSumDatePhysical.parmItemId(ItemId);
        InventSumDatePhysical.parmPerDate(PhysicalDate);
        InventSumDatePhysical.init();
        print 'InventSumDatePhysical as below';//没有库存价值
        print 'Qty:',InventSumDatePhysical.physicalQuantity();
    
        InventSumDateValue.parmItemId(ItemId);
        InventSumDateValue.parmPerDate(PhysicalDate);
        InventSumDateValue.init();
        print 'InventSumDateValue as below'; // 库存价值不正确
        print 'Qty:',InventSumDateValue.physicalQuantity(),'   Value:',InventSumDateValue.inventoryValue();
        print InventSumDateValue.estimatedInventValue();
        pause;
    }
    

     

    static void Jimmy_OnHandFindDim(Args _args)
    {
    /*** wrote by Jimmy on Dec. 1th 2010
    按维度显示库存
    InventSum 的newQuery 方法
    */
        query                       q;
        queryRun                    qr;
        InventSum                   inventSum;
        InventDim                   inventDim;
        InventDim                   inventDimValue;
        InventDimParm               inventDimParmCriteria;
        inventDimParm               inventDimParmGroupBy;
        inventSumDateValueReportDim inventSumDateValueReportDim;
        int             i;
        ;
        //维度(Dimension)条件
        inventDimValue.InventLocationId = "FPW";
        inventDimValue.configId         = "NZ-R";
        inventDimValue.inventBatchId    = "00000000-000000";
        //维度显示(有效)参数
        inventDimParmCriteria.ItemIdFlag            = NoYes::Yes;
        inventDimParmCriteria.InventLocationIdFlag  = NoYes::Yes;
        inventDimParmCriteria.ConfigIdFlag          = NoYes::Yes;
        inventDimParmCriteria.InventBatchIdFlag     = NoYes::Yes;
        //维度汇总参数
        inventDimParmGroupBy.ItemIdFlag             = NoYes::Yes;
        inventDimParmGroupBy.ConfigIdFlag           = NoYes::Yes;
        inventDimParmGroupBy.InventLocationIdFlag   = NoYes::Yes;
        inventDimParmGroupBy.InventBatchIdFlag      = NoYes::Yes;
        
        q = new Query();
        InventSum::newQuery(q,"10-1000",inventDimValue,inventDimParmCriteria,inventDimParmGroupBy);
    
        info(q.dataSourceNo(1).toString());
    
        qr = new QueryRun(q);
        while (qr.next())
        {
            inventDim = qr.get(tableNum(InventDim));
            inventSum = qr.get(tableNum(InventSum));
            i++;
            print inventDim.InventLocationId,'  ',inventDim.inventBatchId,inventSum.AvailPhysical,"  ",inventSum.PhysicalInvent;
        }
        print i;
        pause;
    }
    /***
    qty OnHand(ItemId       _ItemId)
    {
        qty         onHand;
        InventSum   InventSum;
        InventDim   InventDim;
    ;
        while select InventSum
                where InventSum.ItemId == _ItemId
            join InventDim
                where InventDim.InventDimId == InventSum.InventDimId
                &&    InventDim.InventLocationId != "RTV"
                &&    InventDim.InventLocationId != "REJECT"
                &&    InventDim.InventLocationId != "OBS"
                &&    InventDim.InventLocationId != "SALES"
        {
            onHand += InventSum.PhysicalInvent;
        }
        return onHand;
    }
    */
    
  • 相关阅读:
    POJ 1436 Horizontally Visible Segments (线段树+区间覆盖)
    HDU 4671 Backup Plan (构造)
    POJ 3325 Help with Intervals (线段树(难))
    HDU 4649 Professor Tian (位运算 + 按位DP)
    HDU 4662 MU Puzzle (YY+枚举)
    HDU 4638 Group (线段树 + 离线)
    深入浅出Node.js (附录A)
    JS的变量声明和函数声明提升
    JS基础:翻转数组
    JS基础:求一组数中的最大最小值,以及所在位置
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1776494.html
Copyright © 2020-2023  润新知