Fix InventoryCost error
修正了在InventoryCost 创建中进行FindById时,并不会by ID find 的问题,并放开了对其Update的代码注释
| | |
| | | //if( isnull( account ) ) { |
| | | // error( "account not found" ); |
| | | //} |
| | | result := InventoryValueAndCost::FindById( macroPlan, stockingPointId,productId,start,id ); |
| | | result := InventoryValueAndCost::FindById( macroPlan, stockingPointId, productId, start, id ); |
| | | if( not isnull( product) and not isnull( stockingPoint) and not isnull( account)){ |
| | | if( isnull( result ) ) { |
| | | result := InventoryValueAndCost::Create( id, product, stockingPoint, account, costDriver, start, cost, true ).astype( InventoryValueAndCost ); |
| | | } else if( result.ProductID() <> productId ) { |
| | | info( "cannot change product of inventory value and cost" ) |
| | | } |
| | | // else { |
| | | // result.Update( account, costDriver, start, account.DefaultTimeUnit(), account.DefaultLengthOfTime(), cost, true ); |
| | | // } |
| | | else { |
| | | result.Update( account, costDriver, start, account.DefaultTimeUnit(), account.DefaultLengthOfTime(), cost, true ); |
| | | } |
| | | } |
| | | |
| | | return result; |
| | |
| | | [* |
| | | // yypsybs Aug-16-2023 (created) |
| | | value := select( macroPlan, Product_MP.InventoryValueAndCost, item, true, item.ProductID()=productId and item.StockingPointID() = stockPointId and item.Start() = start ); |
| | | if( isnull( value ) ){ |
| | | value := select( macroPlan, Product_MP.InventoryValueAndCost, item, true, item.ID() = id ); |
| | | } |
| | | return value; |
| | | *] |
| | | } |