主单位与次单位

static Qty ConvertUnit(InventTable _inventTable,Qty _qtyFrom,UnitID _unitTo)
{
    qty         qtyTo;
    ;

    setprefix("Unit Conversion");

    if (_inventTable.inventTableModuleInvent().UnitId == "CT" ||
                                        _inventTable.inventTableModuleInvent().UnitId == "GM")
            {
                qtyTo  += UnitConvert::qty(_qtyFrom,
                                            _inventTable.inventTableModuleInvent().UnitId,
                                            _unitTo,
                                            _inventTable.ItemId);
            }
            else
            {
                if (_inventTable.ACT_SecUnitID == "CT" || _inventTable.ACT_SecUnitID == "GM")
                {
                    qtyTo += UnitConvert::qty(_qtyFrom,
                                               _inventTable.ACT_SecUnitID,
                                               _unitTo,
                                               _inventTable.ItemId);
                }
                else
                    Warning(strfmt("Units can not be converted to CT! ItemID:%1,Unit:%2,SecUnit:%3",
                                    _inventTable.ItemId,
                                    _inventTable.inventTableModuleInvent().UnitId,
                                    _inventTable.ACT_SecUnitID
                                    ));
            }

    return qtyTo;

}

原文地址:https://www.cnblogs.com/perock/p/2375310.html