yanyuan
2023-11-01 d82c813f4c07b13801a92fc20b3054d23a32ec58
Fix InventoryCost error

修正了在InventoryCost 创建中进行FindById时,并不会by ID find 的问题,并放开了对其Update的代码注释
已修改2个文件
11 ■■■■■ 文件已修改
_Main/BL/Type_InventoryValueAndCost/StaticMethod_CreateOrUpdate.qbl 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventoryValueAndCost/StaticMethod_FindById.qbl 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventoryValueAndCost/StaticMethod_CreateOrUpdate.qbl
@@ -32,16 +32,16 @@
    //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;
_Main/BL/Type_InventoryValueAndCost/StaticMethod_FindById.qbl
@@ -12,6 +12,9 @@
  [*
    // 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;
  *]
}