xiaoding721
2024-11-14 bc48aaf7a93d102a8db55b265740b6807024d459
Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev
已添加6个文件
已修改8个文件
543 ■■■■■ 文件已修改
_Main/BL/Type_CCEngineLogisticsCostColumn/Attribute_EndDate.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostColumn/Method_CalcEngineCost.qbl 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostColumn0/Attribute_EndDate.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostColumn0/Method_CalcEngineCost.qbl 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostColumn0/Method_CalcTransCost.qbl 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostReport/Method_Generate.qbl 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostReport/Method_GenerateColumn.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostReport0/Method_Generate.qbl 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostReport0/Method_GenerateColumn.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl 221 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackage_Lotsize.qbl 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostColumn/Attribute_EndDate.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
Quintiq file version 2.0
#parent: #root
Attribute EndDate
{
  #keys: '3[415136.0.1304620060][415136.0.1304620059][415136.0.1304620061]'
  ValueType: Date
}
_Main/BL/Type_CCEngineLogisticsCostColumn/Method_CalcEngineCost.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
Quintiq file version 2.0
#parent: #root
Method CalcEngineCost (
  ProductInStockingPointInPeriods pispips,
  LogisticsCostEngines enginecosts
) as Real
{
  TextBody:
  [*
    // ç”„兰鸽 Nov-14-2024 (created)
    cost             := 0.0;
    enginecost       := selectobject( enginecosts, Elements, engine, engine.StartDate() <= this.StartDate() and engine.EndDate() >= this.EndDate() );
    if( isnull( enginecost ) ){
      fenginecost    := selectobject( enginecosts, Elements, engine, engine.EndDate() > this.StartDate() and engine.EndDate() <= this.EndDate() and engine.StartDate() < this.StartDate() );
      if( not isnull( fenginecost ) ){
        pinvqty      := sum( pispips, Elements, pispip, pispip.Start().Date() >= fenginecost.StartDate() and pispip.Start().Date() <= fenginecost.EndDate(), pispip.PlannedInventoryLevelEnd() );
        cost         := cost + ceil( pinvqty / fenginecost.PackagingCapacity() ) * fenginecost.StoragePrice();//四舍五入
      }
      menginecost    := selectobject( enginecosts, Elements, engine, engine.StartDate() > this.StartDate() and engine.EndDate() < this.EndDate() );
      if( not isnull( menginecost ) ){
        pinvqty      := sum( pispips, Elements, pispip, pispip.Start().Date() >= menginecost.StartDate() and pispip.Start().Date() <= menginecost.EndDate(), pispip.PlannedInventoryLevelEnd() );
        cost         := cost + ceil( pinvqty / menginecost.PackagingCapacity() ) * menginecost.StoragePrice();//四舍五入
      }
      benginecost    := selectobject( enginecosts, Elements, engine, engine.StartDate() > this.StartDate() and engine.StartDate() <= this.EndDate() and engine.EndDate() > this.EndDate() );
      if( not isnull( benginecost ) ){
        pinvqty      := sum( pispips, Elements, pispip, pispip.Start().Date() >= benginecost.StartDate() and pispip.Start().Date() <= benginecost.EndDate(), pispip.PlannedInventoryLevelEnd() );
        cost         := cost + ceil( pinvqty / benginecost.PackagingCapacity() ) * benginecost.StoragePrice();//四舍五入
      }
    }else{
      pinvqty        := sum( pispips, Elements, pispip, pispip.PlannedInventoryLevelEnd() );
      cost           := cost + ceil( pinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入
    }
    return cost;
  *]
}
_Main/BL/Type_CCEngineLogisticsCostColumn0/Attribute_EndDate.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
Quintiq file version 2.0
#parent: #root
Attribute EndDate
{
  #keys: '3[415136.0.1304630050][415136.0.1304630049][415136.0.1304630051]'
  ValueType: Date
}
_Main/BL/Type_CCEngineLogisticsCostColumn0/Method_CalcEngineCost.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,111 @@
Quintiq file version 2.0
#parent: #root
Method CalcEngineCost (
  ProductInStockingPointInPeriods pispips,
  LogisticsCostEngines enginecosts,
  LogisticsCostTransports transcosts,
  String factory,
  output Real entercost,
  output Real othercost,
  output Real outcost,
  output Real storecost,
  output Real transcost
)
{
  TextBody:
  [*
    // ç”„兰鸽 Nov-14-2024 (created)
    enginecost       := selectobject( enginecosts, Elements, engine, engine.StartDate() <= this.StartDate() and engine.EndDate() >= this.EndDate() and engine.Factory() = factory );
    if( isnull( enginecost ) ){
      fenginecost    := selectobject( enginecosts, Elements, engine, engine.EndDate() > this.StartDate() and engine.EndDate() <= this.EndDate() and engine.StartDate() < this.StartDate() and engine.Factory() = factory );
      if( not isnull( fenginecost ) ){
        fpispips     := selectset( pispips, Elements, pispip, pispip.Start().Date() >= fenginecost.StartDate() and pispip.Start().Date() <= fenginecost.EndDate() );
        if( entercost.IsMaxInfinity() ){
          newsqty    := sum( fpispips, Elements, e, e.NewSupplyQuantity() );
          entercost  := entercost + ceil( newsqty / fenginecost.PackagingCapacity() ) * fenginecost.WarehousingPrice();
        }
        if( othercost.IsMaxInfinity() ){
          newsqty    := sum( fpispips, Elements, e, e.NewSupplyQuantity() );
          othercost  := othercost + ceil( newsqty / fenginecost.PackagingCapacity() ) * fenginecost.OtherPrice();
        }
        if( outcost.IsMaxInfinity() ){
          newsqty    := sum( fpispips, Elements, e, e.NewSupplyQuantity() );
          outcost    := outcost + ceil( newsqty / fenginecost.PackagingCapacity() ) * fenginecost.OutboundPrice();
        }
        if( storecost.IsMaxInfinity() ){
          pinvqty    := sum( fpispips, Elements, e, e.PlannedInventoryLevelEnd() );
          storecost  := storecost + ceil( pinvqty / fenginecost.PackagingCapacity() ) * fenginecost.StoragePrice();//四舍五入
        }
        if( transcost.IsMaxInfinity() ){
          this.CalcTransCost( fpispips, transcosts, fenginecost, transcost );
        }
      }
      menginecost    := selectobject( enginecosts, Elements, engine, engine.StartDate() > this.StartDate() and engine.EndDate() < this.EndDate() and engine.Factory() = factory );
      if( not isnull( menginecost ) ){
        mpispips     := selectset( pispips, Elements, pispip, pispip.Start().Date() >= menginecost.StartDate() and pispip.Start().Date() <= menginecost.EndDate() );
        if( entercost.IsMaxInfinity() ){
          newsqty    := sum( mpispips, Elements, e, e.NewSupplyQuantity() );
          entercost  := entercost + ceil( newsqty / menginecost.PackagingCapacity() ) * menginecost.WarehousingPrice();
        }
        if( othercost.IsMaxInfinity() ){
          newsqty    := sum( mpispips, Elements, e, e.NewSupplyQuantity() );
          othercost  := othercost + ceil( newsqty / menginecost.PackagingCapacity() ) * menginecost.OtherPrice();
        }
        if( outcost.IsMaxInfinity() ){
          newsqty    := sum( mpispips, Elements, e, e.NewSupplyQuantity() );
          outcost    := outcost + ceil( newsqty / menginecost.PackagingCapacity() ) * menginecost.OutboundPrice();
        }
        if( storecost.IsMaxInfinity() ){
          pinvqty    := sum( mpispips, Elements, e, e.PlannedInventoryLevelEnd() );
          storecost  := storecost + ceil( pinvqty / menginecost.PackagingCapacity() ) * menginecost.StoragePrice();//四舍五入
        }
        if( transcost.IsMaxInfinity() ){
          this.CalcTransCost( mpispips, transcosts, menginecost, transcost );
        }
      }
      benginecost    := selectobject( enginecosts, Elements, engine, engine.StartDate() > this.StartDate() and engine.StartDate() <= this.EndDate() and engine.EndDate() > this.EndDate() and engine.Factory() = factory );
      if( not isnull( benginecost ) ){
        bpispips     := selectset( pispips, Elements, pispip, pispip.Start().Date() >= benginecost.StartDate() and pispip.Start().Date() <= benginecost.EndDate() )
        if( entercost.IsMaxInfinity() ){
          newsqty    := sum( bpispips, Elements, e, e.NewSupplyQuantity() );
          entercost  := entercost + ceil( newsqty / benginecost.PackagingCapacity() ) * benginecost.WarehousingPrice();
        }
        if( othercost.IsMaxInfinity() ){
          newsqty    := sum( bpispips, Elements, e, e.NewSupplyQuantity() );
          othercost  := othercost + ceil( newsqty / benginecost.PackagingCapacity() ) * benginecost.OtherPrice();
        }
        if( outcost.IsMaxInfinity() ){
          newsqty    := sum( bpispips, Elements, e, e.NewSupplyQuantity() );
          outcost    := outcost + ceil( newsqty / benginecost.PackagingCapacity() ) * benginecost.OutboundPrice();
        }
        if( storecost.IsMaxInfinity() ){
          pinvqty    := sum( bpispips, Elements, e, e.PlannedInventoryLevelEnd() );
          storecost  := storecost + ceil( pinvqty / benginecost.PackagingCapacity() ) * benginecost.StoragePrice();//四舍五入
        }
        if( transcost.IsMaxInfinity() ){
          this.CalcTransCost( bpispips, transcosts, benginecost, transcost );
        }
      }
    }else{
      if( entercost.IsMaxInfinity() ){
        newsqty      := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() );
        entercost    := entercost + ceil( newsqty / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
      }
      if( othercost.IsMaxInfinity() ){
        newsqty      := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() );
        othercost    := othercost + ceil( newsqty / enginecost.PackagingCapacity() ) * enginecost.OtherPrice();
      }
      if( outcost.IsMaxInfinity() ){
        newsqty      := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() );
        outcost      := outcost + ceil( newsqty / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
      }
      if( storecost.IsMaxInfinity() ){
        pinvqty      := sum( pispips, Elements, pispip, pispip.PlannedInventoryLevelEnd() );
        storecost    := storecost + ceil( pinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入
      }
      if( transcost.IsMaxInfinity() ){
        this.CalcTransCost( pispips, transcosts, enginecost, transcost );
      }
    }
  *]
}
_Main/BL/Type_CCEngineLogisticsCostColumn0/Method_CalcTransCost.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
Quintiq file version 2.0
#parent: #root
Method CalcTransCost (
  ProductInStockingPointInPeriods pispips,
  LogisticsCostTransports transcosts,
  LogisticsCostEngine enginecost,
  output Real transcost
)
{
  TextBody:
  [*
    // ç”„兰鸽 Nov-14-2024 (created)
    tran             := selectobject( transcosts, Elements, trans, trans.StartDate() <= this.StartDate() and trans.EndDate() >= this.StartDate() );
    if( isnull( tran ) ){
      ftranscost     := selectobject( transcosts, Elements, trans, trans.EndDate() > this.StartDate() and this.EndDate() <= this.EndDate() and trans.StartDate() < this.StartDate() );
      if( not isnull( ftranscost ) ){
        newsqty      := sum( pispips, Elements, pispip, pispip.Start().Date() >= ftranscost.StartDate() and pispip.Start().Date() <= ftranscost.EndDate(), pispip.NewSupplyQuantity() );
        transcost    := transcost + ceil( ceil( newsqty / enginecost.PackagingCapacity() ) / ftranscost.LoadingCapacity() ) * ftranscost.TransportPrice();
      }
      mtranscost     := selectobject( transcosts, Elements, trans, trans.StartDate() > this.StartDate() and trans.EndDate() < this.EndDate() );
      if( not isnull( mtranscost ) ){
        newsqty      := sum( pispips, Elements, pispip, pispip.Start().Date() >= mtranscost.StartDate() and pispip.Start().Date() <= mtranscost.EndDate(), pispip.NewSupplyQuantity() );
        transcost    := transcost + ceil( ceil( newsqty / enginecost.PackagingCapacity() ) / mtranscost.LoadingCapacity() ) * mtranscost.TransportPrice();
      }
      btranscost    := selectobject( transcosts, Elements, trans, trans.StartDate() > this.StartDate() and trans.StartDate() <= this.EndDate() and trans.EndDate() > this.EndDate() );
      if( not isnull( btranscost ) ){
        newsqty      := sum( pispips, Elements, pispip, pispip.Start().Date() >= btranscost.StartDate() and pispip.Start().Date() <= btranscost.EndDate(), pispip.NewSupplyQuantity() );
        transcost    := transcost + ceil( ceil( newsqty / enginecost.PackagingCapacity() ) / btranscost.LoadingCapacity() ) * btranscost.TransportPrice();
      }
    }else{
      newsqty        := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() );
      transcost      := transcost + ceil( ceil( newsqty / enginecost.PackagingCapacity() ) / tran.LoadingCapacity() ) * tran.TransportPrice();
    }
  *]
}
_Main/BL/Type_CCEngineLogisticsCostReport/Method_Generate.qbl
@@ -38,6 +38,8 @@
          //显示月单元格
          showcell   := showrow.Cell( relnew, RentInCost := cell.RentInCost(), RentOutOfCost := cell.RentOutOfCost(), WerkToRentTransCost := cell.WerkToRentTransCost(), RentStorCost := cell.RentStorCost(), CoefficientValue := cell.CoefficientValue(), AllCost := cell.EstimateTotalCost() * [Real]cell.CoefficientValue() );
          column.Cell( relinsert, showcell );
          showcell.EstimateTotalCost( showcell.CalcEstimateTotalCost() );
          showcell.AllCost( showcell.EstimateTotalCost() * [Real]showcell.CoefficientValue() );
          //显示年单元格
          yearcell.RentInCost( cell.RentInCost() + yearcell.RentInCost() );
          yearcell.RentOutOfCost( cell.RentOutOfCost() + yearcell.RentOutOfCost() );
@@ -74,5 +76,11 @@
      cell.IsRentStorCostUpdate( exists( cell.Column(), Cell, acell, acell.IsRentStorCostUpdate() ) );
      cell.IsWerkToRentTransCostUpdate( exists( cell.Column(), Cell, acell, acell.IsWerkToRentTransCostUpdate() ) );
    }
    rows := selectsortedset( this, Row, row, row.Name() );
    i    := 0;
    traverse( rows, Elements, e ){
      e.RowNr( i );
      i := i + 1;
    }
  *]
}
_Main/BL/Type_CCEngineLogisticsCostReport/Method_GenerateColumn.qbl
@@ -14,7 +14,7 @@
    for( start := startofyear; start < startofnextyear; start := start.StartOfNextMonth() ){
      periodtime := start.Date();
      periodname := periodtime.Format( "M2/D2/Y" );
      this.Column( relnew, Name := periodname, StartDate := periodtime );
      this.Column( relnew, Name := periodname, StartDate := periodtime, EndDate := ( start.StartOfNextMonth() - Duration::Days( 1 ) ).Date() );
    }
  *]
}
_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
@@ -7,7 +7,7 @@
  TextBody:
  [*
    // ç”„兰鸽 Aug-12-2024 (created)
    owner.CCEngineLogisticsCostReport( relflush );
    //owner.CCEngineLogisticsCostReport( relflush );
    produtparent              := CCEngineLogisticsCostReport::GetDefaultProductParent();
    name                      := CCEngineLogisticsCostReport::GetDefaultName();
    allunit                   := CCEngineLogisticsCostReport::GetDefaultAllUnit();
@@ -20,9 +20,17 @@
    //startofyear               := startofplanning.StartOfYear();
    startofnextyear           := startofplanning.StartOfNextYear();
    
    table                     := owner.CCEngineLogisticsCostReport( relnew, ID := name, Name := name );
    owner.CCEngineLogisticsCostReport( relnew, ID := name + 'Show', Name := name, IsShow := true );
    table                     := selectobject(owner, CCEngineLogisticsCostReport, report, report.ID() = name );
    if( isnull( table ) ){
      owner.CCEngineLogisticsCostReport( relnew, ID := name, Name := name );
    }
    showname                  := name + 'Show';
    if( exists( owner, CCEngineLogisticsCostReport, report, report.ID() = showname and report.IsShow() ) ){
      owner.CCEngineLogisticsCostReport( relnew, ID := showname, Name := name, IsShow := true );
    }
    if( isnull( owner.CCEngineLogisticsCostSearch() ) ){
    owner.CCEngineLogisticsCostSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit );
    }
    
    products                  := construct( Product_MPs );
    
@@ -130,33 +138,16 @@
        if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
          row                := table.GetRow( pisp.ProductID() );
          products.Add( product );
          //当product planning的日期区间在需要的日期区间内
    //      traverse( table, Column, column ){
    //        pispips          := selectset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.PlannedInventoryLevelEnd() <> 0
    //                                       and pispip.Start().Date() < column.StartDate().StartOfNextMonth() and pispip.Start().Date() >= column.StartDate() );
          traverse( table, Column, column ){
            
          traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.PlannedInventoryLevelEnd() <> 0 ){
            enginecost     := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date() );
            if( not isnull( enginecost ) ){
              periodtime   := pispip.Start().StartOfMonth().Date();
              periodname   := periodtime.Format( "M2/D2/Y" );
              quantity     := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入
              column       := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
              row.SetRentStorageCost( column, quantity );
            pispips          := selectset( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start().Date() >= column.StartDate()
                                            and pispip.Start().Date() < column.StartDate().StartOfNextMonth()
                                            and pispip.PlannedInventoryLevelEnd() <> 0 );
            cost             := column.CalcEngineCost( pispips, enginecosts );
            row.SetRentStorageCost( column, cost );
            }
          }
        }
      }
    }
    //rows := selectsortedset( table, Row, row, row.Name() );
    //i    := 0;
    //traverse( rows, Elements, e ){
    //  e.RowNr( i );
    //  i := i + 1;
    //}
    //
    //showtable.Generate( search, products );
  *]
}
_Main/BL/Type_CCEngineLogisticsCostReport0/Method_Generate.qbl
@@ -48,6 +48,8 @@
                                      , CoefficientValue             := cell.CoefficientValue()
                                      , AllCost                      := cell.EstimateTotalCost() * [Real]cell.CoefficientValue() );
          column.Cell( relinsert, showcell );
          showcell.EstimateTotalCost( showcell.CalcEstimateTotalCost() );
          showcell.AllCost( showcell.EstimateTotalCost() * [Real]showcell.CoefficientValue() );
          //显示年单元格
          yearcell.CCRentInCost( cell.CCRentInCost() + yearcell.CCRentInCost() );
          yearcell.CCRentOutOfCost( cell.CCRentOutOfCost() + yearcell.CCRentOutOfCost() );
@@ -105,6 +107,12 @@
      cell.IsEstimateTotalCostUpdate( exists( cell.Column(), Cell, acell, acell.IsEstimateTotalCostUpdate() ) );
      cell.IsWerkToDLRentTransCostUpdate( exists( cell.Column(), Cell, acell, acell.IsWerkToDLRentTransCostUpdate() ) );
    }
    rows := selectsortedset( this, Row, row, row.Name() );
    i    := 0;
    traverse( rows, Elements, e ){
      e.RowNr( i );
      i := i + 1;
    }
    info( '-------------------------g------------end---------------------------------' );
  *]
}
_Main/BL/Type_CCEngineLogisticsCostReport0/Method_GenerateColumn.qbl
@@ -14,7 +14,7 @@
    for( start := startofyear; start < startofnextyear; start := start.StartOfNextMonth() ){
      periodtime := start.Date();
      periodname := periodtime.Format( "M2/D2/Y" );
      this.Column( relnew, Name := periodname, StartDate := periodtime );
      this.Column( relnew, Name := periodname, StartDate := periodtime, EndDate := ( start.StartOfNextMonth() - Duration::Days( 1 ) ).Date() );
    }
  *]
}
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,221 @@
Quintiq file version 2.0
#parent: #root
StaticMethod Initialize (
  MacroPlan owner
)
{
  TextBody:
  [*
    // ç”„兰鸽 Aug-12-2024 (created)
    owner.DLEngineLogisticsCostReport( relflush );
    produtparent              := DLEngineLogisticsCostReport::GetDefaultProductParent();
    name                      := DLEngineLogisticsCostReport::GetDefaultName();
    allunit                   := DLEngineLogisticsCostReport::GetDefaultAllUnit();
    ccfactory                 := DLEngineLogisticsCostReport::GetCCFactory();
    dlfactory                 := DLEngineLogisticsCostReport::GetDLFactory();
    startofplanning           := owner.StartOfPlanning().Date();
    startofnextyear           := startofplanning.StartOfNextYear();
    table                     := owner.DLEngineLogisticsCostReport( relnew, ID := name, Name := name );
    owner.DLEngineLogisticsCostReport( relnew, ID := name + 'Show', Name := name, IsShow := true );
    owner.DLEngineLogisticsCostSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit );
    products                  := construct( Product_MPs );
    table.GenerateColumn( owner );
    //外租库仓储费用:仓储数量/包装容量*仓储单价,在Actual inventories里取到长春外租库/大连外租库该发动机的仓储量,根据发动机号找到对应的Generation å’Œæ¨ªçºµåˆ¶ï¼Œåœ¨å‘动机成本参数表里找到对应的仓储单价和包装容量,用公式计算,月度进行汇总
    //长春外租库入库/出库费用,大连发动机的长春外租库的New supply
    traverse( owner, StockingPoint_MP, stockingpoint, stockingpoint.ID().EndsWith( '外租库' ) ){
      isdltoccrent            := stockingpoint.ID().StartsWith( '大连发动机的长春' );
      isdlrent                := not isdltoccrent and stockingpoint.ID().StartsWith( '大连' ) or stockingpoint.ID().StartsWith( 'DL' );
      if( isdlrent or isdltoccrent){
        traverse( stockingpoint, ProductInStockingPoint_MP, pisp,  pisp.Product_MP().IsLeaf()
                  and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) ) ){
          //获取行
          product             := pisp.Product_MP();
          productparents      := product.GetAllParent();
          if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机
            row               := table.GetRow( pisp.ProductID() );
            enginecosts       := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower() and engine.MLB_MQB() = product.MQBMLB() );
            transcosts        := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
            if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
              traverse( table, Column, column ){
                pispips       := selectset( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start().Date() >= column.StartDate()
                                            and pispip.Start().Date() < column.StartDate().StartOfNextMonth()
                                            and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) );
                cell          := selectobject( row, Cell, cell, cell.Column() = column );
                entercost     := 0.0;
                othercost     := 0.0;
                outcost       := 0.0;
                storecost     := 0.0;
                transcost     := 0.0;
                if( isdltoccrent){
                  othercost   := Real::MaxReal();
                  transset    := selectset( transcosts, Elements, trans, trans.Origin() = '长春外租库' and trans.Destination() = '客户库' );
                  column.CalcEngineCost( pispips, enginecosts, transset, ccfactory, entercost, othercost, outcost, storecost, transcost );
                  cell.CCRentQty( cell.CCRentQty() + sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() ) );
                  cell.CCRentInCost( cell.CCRentInCost() + entercost );
                  cell.CCRentOutOfCost( cell.CCRentOutOfCost() + outcost );
                  cell.CCRentStorCost( cell.CCRentStorCost() + storecost );//长春外租库仓储费用
                  cell.CCShorTransCost( cell.CCShorTransCost() + transcost );//长春短途运输费用
                } else {
                  outcost     := Real::MaxReal();
                  transset    := selectset( transcosts, Elements, trans, trans.Origin() = '大连厂内库' and trans.Destination() = '大连外租库' );
                  column.CalcEngineCost( pispips, enginecosts, transset, dlfactory, entercost, othercost, outcost, storecost, transcost );
                  cell.DLRentStorCost( cell.DLRentStorCost() + storecost );//大连外租库仓储费用
                  cell.DLRentOtherCost( cell.DLRentOtherCost() + othercost );//大连外租库其他费用
                  cell.DLRentInCost( cell.DLRentInCost() + entercost );//大连外租库入库费用
                  cell.WerkToDLRentTransCost( cell.WerkToDLRentTransCost() + transcost );//厂内到大连外租库运输费用
                }
              }
              products.Add( pisp.Product_MP() );
            }
          }
        }
      }
    }
    //长春长途运输费用:调拨数量/包装容量/装载容量*运输单价,调拨计划里找到该产品从DL到CC的调拨数量,即起始地大连装配线边库,目的地为长春外租库对应的运输数量,在发动机成本参数表找到对应的包装容量,在运输成本参数表里找到发动机对应运输单价和装载容量,用公式计算得出结果,月度进行汇总
    traverse( owner, Unit.Lane.LaneLeg, laneleg ){
      //起始库存点是否是大连(大连厂内库)
      isdl                    := laneleg.OriginStockingPointID().EndsWith( '厂内库' ) and ( laneleg.OriginStockingPointID().StartsWith( '大连' ) or laneleg.OriginStockingPointID().StartsWith( 'DL' ) );
      //目的地库存点是否是长春(长春外租库)
      iscc                    := laneleg.DestinationStockingPointID() = '大连发动机的长春外租库';
        if( isdl and iscc ){
        traverse( table, Column, column){//, column.StartDate().Month() = 1
          alltrips            := selectset( laneleg, Trip, trip, trip.Arrival().Date() < column.StartDate().StartOfNextMonth() and trip.Arrival().Date() >= column.StartDate() );
          enginecosts         := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.StartDate() <= column.StartDate() and engine.EndDate() >= column.StartDate() );
          transcosts          := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() );
          if( not isnull( enginecosts ) and enginecosts.Size() > 0 and not isnull( transcosts ) and transcosts.Size() > 0 ){
            producttrips      := selectuniquevalues( alltrips, Elements.ProductInTrip, pit, pit.Quantity() <> 0 and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ), pit.ProductID() );
            traverse( producttrips, Elements, producttrip ){//, producttrip = '6912'
              row             := table.GetRow( producttrip );
              product         := selectobject( owner, Product_MP, product, product.ID() = producttrip );
              products.Add( product );
              quantity        := sum( alltrips, Elements.ProductInTrip, pit, pit.Product_MP() = product, pit.Quantity() );
              enginecost      := selectobject( enginecosts, Elements, engine, engine.Generation().ToLower() = product.Generation().ToLower()
                                                   and engine.MLB_MQB() = product.MQBMLB()
                                                   and engine.Factory() = ccfactory );
                //在运输成本参数表里找到发动机对应运输单价和装载容量
                transcost     := selectobject( transcosts, Elements, trans, trans.Origin() = laneleg.OriginStockingPointID()
                                                  and trans.Destination() = laneleg.DestinationStockingPointID()
                                                  and exists( product.GetAllParent(), Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
                if( not isnull( enginecost ) and not isnull( transcost ) ){
                  cost        := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//四舍五入
                  cell        := selectobject( row, Cell, cell, cell.Column() = column );
                  cell.CCLongTransCost( cell.CCLongTransCost() + cost )
                }
            }
          }
        }
    //traverse( owner, TransferPlanRow, tprow ){
    //  product                 := selectobject( owner, Product_MP, product, product.ID() = tprow.ProductID() );
    //  productparents          := product.GetAllParent();
    //  if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机
    //    //起始库存点是否是大连(大连厂内库)
    //    isdl                   := tprow.SourceStockpoingPointID().EndsWith( '厂内库' ) and ( tprow.TargetStockpoingPointID().StartsWith( '大连' ) or tprow.TargetStockpoingPointID().StartsWith( 'DL' ) );
    //    //目的地库存点是否是长春(长春外租库)
    //    iscc                   := tprow.TargetStockpoingPointID().EndsWith( '外租库' ) and ( tprow.TargetStockpoingPointID().StartsWith( '长春' ) or tprow.TargetStockpoingPointID().StartsWith( 'CC' ) );
    //    if( isdl and iscc ){
    //      //查询对应的发动机成本
    //      enginecosts          := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower()
    //                                             and engine.MLB_MQB() = product.MQBMLB()
    //                                             and engine.Factory() = ccfactory );
    //      //在运输成本参数表里找到发动机对应运输单价和装载容量
    //      transcosts           := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.Origin() = tprow.SourceStockpoingPointID()
    //                                              and trans.Destination() = tprow.TargetStockpoingPointID()
    //                                              and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
    //      if( not isnull( enginecosts ) and enginecosts.Size() > 0 and not isnull( transcosts ) and transcosts.Size() > 0 ){
    //        row                := table.GetRow( product.ID() );
    //        products.Add( product );
    //        traverse( tprow,TransferPlanCell, tpcell, tpcell.TransferPlanColumn().ColumnDate() <> Date::MinDate() and [Number]tpcell.Value() > 0){
    //          tpcolumndate     := tpcell.TransferPlanColumn().ColumnDate();
    //          enginecost       := selectobject( enginecosts, Elements, engine, engine.StartDate() <= tpcolumndate and engine.EndDate() >= tpcolumndate );
    //          transcost        := selectobject( transcosts, Elements, trans, trans.StartDate() <= tpcolumndate and trans.EndDate() >= tpcolumndate );
    //          if( not isnull( enginecost ) and not isnull( transcost ) ){
    //            periodtime     := tpcolumndate.StartOfMonth();
    //            periodname     := periodtime.Format( "M2/D2/Y" );
    //            column         := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
    //
    //            cost           := ceil( ceil( [Number]tpcell.Value() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
    //            cell           := selectobject( row, Cell, cell, cell.Column() = column );
    //            cell.CCLongTransCost( cell.CCLongTransCost() + cost );
    //          }
    //        }
    //      }
    //    }
      }
    }
    //长春短途运输费用:客户需求数量/包装容量/装载容量*运输单价,客户需求数量取自forecast里sales segment为长春的数量汇总,再用公式计算,月度进行汇总(取客户需求数量换算成车次)
    allforecast               := selectset( owner, SalesDemand.astype( Forecast ), forecast, forecast.Quantity() > 0 and not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < startofnextyear and //forecast.ProductID() = '6912' and forecast.StartDate().Month() = 1 and
    //                                         ( forecast.SalesSegment_MP().Name().StartsWith( 'Changchun' ) or exists( forecast.SalesSegment_MP().GetAllParent(), Elements, psalessegment, psalessegment.Name().StartsWith( 'Changchun' ) ) or
                                               ( forecast.SalesSegment_MP().Name().StartsWith( 'Foshan' ) or forecast.SalesSegment_MP().Name().StartsWith( 'Tianjin' )
                                                or exists( forecast.SalesSegment_MP().GetAllParent(), Elements, psalessegment, psalessegment.Name().StartsWith( 'Foshan' ) or psalessegment.Name().StartsWith( 'Tianjin' ) ) )
                                             and exists( forecast.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ) );
    //ccforecasts               := selectset( allforecast, Elements, forecast, forecast.SalesSegment_MP().Name().StartsWith( 'Changchun' ) or exists( forecast.SalesSegment_MP().GetAllParent(), Elements, psalessegment, psalessegment.Name().StartsWith( 'Changchun' ) )  );
    //ccproducts                := selectuniquevalues( ccforecasts, Elements, forecast, forecast.ProductID() );
    dlforecasts               := selectset( allforecast, Elements, forecast, forecast.SalesSegment_MP().Name().StartsWith( 'Foshan' ) or forecast.SalesSegment_MP().Name().StartsWith( 'Tianjin' )
                                                or exists( forecast.SalesSegment_MP().GetAllParent(), Elements, psalessegment, psalessegment.Name().StartsWith( 'Foshan' ) or psalessegment.Name().StartsWith( 'Tianjin' ) ) );
    dlproducts                := selectuniquevalues( dlforecasts, Elements, forecast, forecast.ProductID() );;
    //traverse( ccproducts, Elements, ccproduct){
    //  product                 := selectobject( owner, Product_MP, product, product.ID() = ccproduct );
    ////  info( '************', product.ID(), exists( ccforecasts, Elements, forecast, forecast.Quantity() > 0 ));
    //  //查询对应的发动机成本
    //      enginecosts         := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower()
    //                                             and engine.MLB_MQB() = product.MQBMLB()and engine.Factory() = ccfactory );
    //      //在运输成本参数表里找到发动机对应运输单价和装载容量
    //      transcosts           := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.Origin() = '长春外租库'
    //                                              and trans.Destination() = '客户库'
    //                                              and exists( product.GetAllParent(), Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
    //  if( not isnull( enginecosts ) and enginecosts.Size() > 0 and not isnull( transcosts ) and transcosts.Size() > 0 ){
    //    row               := table.GetRow( ccproduct )
    //    products.Add( product );
    //    traverse( table, Column, column ){
    //      allpsdips             := selectset( ccforecasts, Elements.PlanningSalesDemandInPeriod, psdip, psdip.ProductID() = ccproduct and psdip.Quantity() > 0 and psdip.StartDate() < column.StartDate().StartOfNextMonth() and psdip.StartDate() >= column.StartDate() );
    //      enginecost      := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate() and engine.EndDate() >= column.StartDate() );
    //      transcost       := selectobject( transcosts, Elements, trans, trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() );
    //      if( not isnull( enginecost ) and not isnull( transcost ) ){
    //        quantity        := sum( allpsdips, Elements, psdip, psdip.Quantity() );
    //        cost           := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
    //         cell           := selectobject( row, Cell, cell, cell.Column() = column );
    //         cell.CCShorTransCost( cell.CCShorTransCost() + cost );
    //       }
    //    }
    //  }
    //}
    traverse( dlproducts, Elements, ccproduct){
      row                     := table.GetRow( ccproduct )
      product                 := selectobject( owner, Product_MP, product, product.ID() = ccproduct );
      //查询对应的发动机成本
          enginecosts         := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower()
                                                 and engine.MLB_MQB() = product.MQBMLB()and engine.Factory() = dlfactory );
      if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
        traverse( table, Column, column ){
          allpsdips           := selectset( dlforecasts, Elements.PlanningSalesDemandInPeriod, psdip, psdip.ProductID() = ccproduct and psdip.Quantity() > 0 and psdip.StartDate() < column.StartDate().StartOfNextMonth() and psdip.StartDate() >= column.StartDate() );
          enginecost          := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate() and engine.EndDate() >= column.StartDate() );
          if( not isnull( enginecost ) ){
            products.Add( product );
            quantity          := sum( allpsdips, Elements, psdip, psdip.Quantity() );// + psdip.FulfilledQuantity()
            cost              := ceil( quantity / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
            row.SetDLRentOutCost( column, cost );
          }
        }
      }
    }
    //rows := selectsortedset( table, Row, row, row.Name() );
    //i    := 0;
    //traverse( rows, Elements, e ){
    //  e.RowNr( i );
    //  i := i + 1;
    //}
    info( '-------------------------------------end----------------------------------' );
    //
    //showtable.Generate( search, products );
  *]
}
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
@@ -211,7 +211,7 @@
          enginecost          := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate() and engine.EndDate() >= column.StartDate() );
          if( not isnull( enginecost ) ){
            products.Add( product );
            quantity          := sum( allpsdips, Elements, psdip, psdip.Quantity() );
            quantity          := sum( allpsdips, Elements, psdip, psdip.Quantity() );// + psdip.FulfilledQuantity()
            
            cost              := ceil( quantity / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
            row.SetDLRentOutCost( column, cost );
_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackage_Lotsize.qbl
@@ -44,9 +44,16 @@
                          tempSP.Outcome() <> "" )                                            and
                  needPackagingQuantity > 0 ) {
            // èƒ½åŒ…装的数量
            canPackagingQuantity  := ifexpr( ceil( needPackagingQuantity / ppls.LotSize() ) < floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ),
            canPackagingQuantity    := [Number]ifexpr( ceil( needPackagingQuantity / ppls.LotSize() ) < floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ),
                                             ceil( needPackagingQuantity / ppls.LotSize() ),
                                             floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ) ) * ppls.LotSize();
            // æ”¹ç±»ä¸‹å…¶ä»–产品包装总和
            categoryPackageQuantity := sum( indexPPCell, PackagingPlanColumn.PackagingPlanCell, tempPPCell,
                                            tempPPCell <> indexPPCell                                                            and
                                            tempPPCell.PackagingPlanRow().Factory() = indexPPCell.PackagingPlanRow().Factory()   and
                                            tempPPCell.PackagingPlanRow().Category() = indexPPCell.PackagingPlanRow().Category(),
                                            tempPPCell.Package() );
            canPackagingQuantity    := minvalue( [Number] ( ppnc.MaximumDailyPackagingQuantity() - categoryPackageQuantity ), canPackagingQuantity );
    //        info( "开始包装的日期:", indexPPCell.StartDate().Format( "Y-M2-D2" ), "    èƒ½åŒ…装的数量:", canPackagingQuantity );
            
            indexPPCell.Package( canPackagingQuantity );
_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl
@@ -6,26 +6,43 @@
{
  TextBody:
  [*
    traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "长春工厂" /*and ppr.ProductID() = "06K103011CM"*/ ) {
      traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) {
        unpackagedQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
                                   tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
                                   tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
                                   tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" )      and
                                   tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" ),
                                   tempPIT.Quantity()
                                  );
        ppcell.Unpacking( unpackagedQuantity );
    traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "长春工厂" /*and ppr.Category() = "ZKG" and ppr.ProductID() = "06K103011CP"*/ ) {
        
        packagedQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
                                 tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
                                 tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
                                 tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" )      and
                                 tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" ),
                                 tempPIT.Quantity()
                                );
        ppcell.Package( packagedQuantity );
      u  := select( macroPlan, Unit, tempU, tempU.ID() = "CC " + ppr.Category() + " çº¿è¾¹å’Œå¤–租库间");
      ts := selectset( u, Lane.LaneLeg.Trip, tempT,
                       guard( select( tempT, ProductInTrip, tempPIT, tempPIT.ProductID() = ppr.ProductID() ).Quantity() > 0, false ) );
      traverse ( ts, Elements.ProductInTrip, pit, pit.Quantity() > 0 and pit.ProductID() = ppr.ProductID() ) {
        ppcell := select( ppr, PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn().StartDate() = pit.Trip().Departure().Date() );
        if ( pit.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" ) and pit.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" ) ) {
          ppcell.Unpacking( pit.Quantity() );
      }
        if ( pit.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" ) and pit.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" ) ) {
          ppcell.Package( pit.Quantity() );
        }
      }
    //  traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) {
    //    unpackagedQuantity := sum( u, Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
    //                               tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
    //                               tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
    //                               tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" )      and
    //                               tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" ),
    //                               tempPIT.Quantity()
    //                              );
    //    ppcell.Unpacking( unpackagedQuantity );
    //
    //    packagedQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
    //                             tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
    //                             tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
    //                             tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" )      and
    //                             tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" ),
    //                             tempPIT.Quantity()
    //                            );
    //    ppcell.Package( packagedQuantity );
    //  }
    }
  *]
}