qty getUnitConvert(Qty qty,
ItemId ItemId,
UnitId _InventUnit,
UnitId _CsmUnitId)
{
Real factor_ok;
Qty CSMQty;
;
factor_ok = unitconvert::find(ItemId,_InventUnit,_CsmUnitId).Factor; //库存单位到海关单位
if(factor_ok == 0.00)
{
factor_ok = unitconvert::find(ItemId,_CsmUnitId,_InventUnit).Factor;//海关单位到库存单位
if(factor_ok != 0.00 )
factor_ok = 1/factor_ok;
else
factor_ok = 0.00;
}//End else
if(factor_ok == 0.00)
CSMQty = (1/1) * qty;//海关单位的在仓数量
else
CSMQty = (1/factor_ok) * qty;
return CSMQty;
}