lazhen
2024-10-11 162469bbaa9b14ba269e8fa495b237b7b79e5e73
大连发动机物流报表数据bug
已添加32个文件
已修改9个文件
已删除5个文件
1472 ■■■■ 文件已修改
_Main/BL/Relations/Relation_AssemblyOnlinePlanVersionColumn_InterfaceDataset_InterfaceDataset_A.qbl 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Relations/Relation_AssemblyOnlinePlanVersionRow_InterfaceDataset_InterfaceDataset_Asse.qbl 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Relations/Relation_AssemblyOnlinePlanVersionSearch_InterfaceDataset_InterfaceDataset_A.qbl 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Relations/Relation_AssemblyOnlinePlanVersion_Column_AssemblyOnlinePlanVersionColumn_Ve.qbl 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Relations/Relation_AssemblyOnlinePlanVersion_InterfaceDataset_InterfaceDataset_Assembl.qbl 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Relations/Relation_AssemblyOnlinePlanVersion_Row_AssemblyOnlinePlanVersionRow_Version.qbl 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AOnlineAndMOfflinePlanPIR/StaticMethod_GenerateData.qbl 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanCell0/StaticMethod_RefreshData.qbl 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanColumn0/Attribute_ColumnDate.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanColumn0/Attribute_EndDate.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanColumn0/Attribute_StartDate.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanColumn0/Attribute_TimeUnit.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/Attribute_ID.qbl 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/Attribute_IsShow.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/Attribute_Name.qbl 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/DefaultValue_ID.qbl 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/DefaultValue_Name.qbl 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/Method_GenerateColumn.qbl 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/Method_GetColumnByTimeUnit.qbl 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/Method_GetRow.qbl 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_GenerateData.qbl 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_GetDefaultAllUnit.qbl 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_GetDefaultName.qbl 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_RefreshData.qbl 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/_ROOT_Type_AssemblyOnlinePlanVersion.qbl 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersionRow/Method_Initialize.qbl 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersionRow/Method_InitializeCell.qbl 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/Attribute_EndDate.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/Attribute_Product.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/Attribute_ProductionLine.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/Attribute_StartDate.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/Attribute_TimeUnit.qbl 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/Attribute_Unit.qbl 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/DefaultValue_Product.qbl 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/DefaultValue_TimeUnit.qbl 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/DefaultValue_Unit.qbl 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/_ROOT_Type_AssemblyOnlinePlanVersionSearch.qbl 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl 285 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl 366 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostRow0/Method_SetDLRentEnterCost.qbl 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostRow0/Method_SetDLRentOutCost.qbl 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventorySummaryReport/Method_GenerateColumn.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSMS64/Component_pnlLeft#88.def 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSPIR/Component_pnlLeft.def 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSPIR/Method_OnOk.def 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Relations/Relation_AssemblyOnlinePlanVersionColumn_InterfaceDataset_InterfaceDataset_A.qbl
ÎļþÒÑɾ³ý
_Main/BL/Relations/Relation_AssemblyOnlinePlanVersionRow_InterfaceDataset_InterfaceDataset_Asse.qbl
ÎļþÒÑɾ³ý
_Main/BL/Relations/Relation_AssemblyOnlinePlanVersionSearch_InterfaceDataset_InterfaceDataset_A.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
Quintiq file version 2.0
#parent: #root
Relation AssemblyOnlinePlanVersionSearch_InterfaceDataset_InterfaceDataset_AssemblyOnlinePlanVersionSearch
{
  #keys: '1[415136.0.1184120209]'
  DefaultRelationStrategy
  {
  }
  RelationSide.LeftSide InterfaceDataset
  {
    #keys: '3[415136.0.1184120211][415136.0.1184120210][415136.0.1184120212]'
    Cardinality: '0to1'
    ObjectDefinition: AssemblyOnlinePlanVersionSearch
    OwningSide: 'Reference'
  }
  RelationSide.RightSide AssemblyOnlinePlanVersionSearch
  {
    #keys: '3[415136.0.1184120214][415136.0.1184120213][415136.0.1184120215]'
    Cardinality: '0to1'
    ObjectDefinition: InterfaceDataset
    OwningSide: 'Owned'
  }
}
_Main/BL/Relations/Relation_AssemblyOnlinePlanVersion_Column_AssemblyOnlinePlanVersionColumn_Ve.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
Quintiq file version 2.0
#parent: #root
Relation AssemblyOnlinePlanVersion_Column_AssemblyOnlinePlanVersionColumn_Version
{
  #keys: '1[415136.0.1184171015]'
  DeclarativeSequenceRelationStrategy
  {
    #keys: '13[0.0.0][415136.0.1184171034][415136.0.1184171028][415136.0.1184171035][415136.0.1184171029][415136.0.1184171036][415136.0.1184171030][415136.0.1184171037][415136.0.1184171031][415136.0.1184171038][415136.0.1184171032][415136.0.1184171039][415136.0.1184171033]'
    SequenceElementSuffix: 'VersionColumn'
    SequenceSuffix: 'VersionColumn'
  }
  RelationSide.LeftSide Column
  {
    #keys: '3[415136.0.1184171017][415136.0.1184171016][415136.0.1184171018]'
    Cardinality: '1toN'
    ObjectDefinition: AssemblyOnlinePlanVersion
    OwningSide: 'Owned'
  }
  RelationSide.RightSide Version
  {
    #keys: '3[415136.0.1184171020][415136.0.1184171019][415136.0.1184171021]'
    Cardinality: '0to1'
    ObjectDefinition: AssemblyOnlinePlanVersionColumn
    OwningSide: 'Reference'
  }
}
_Main/BL/Relations/Relation_AssemblyOnlinePlanVersion_InterfaceDataset_InterfaceDataset_Assembl.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
Quintiq file version 2.0
#parent: #root
Relation AssemblyOnlinePlanVersion_InterfaceDataset_InterfaceDataset_AssemblyOnlinePlanVersion
{
  #keys: '1[415136.0.1184171001]'
  DefaultRelationStrategy
  {
  }
  RelationSide.LeftSide InterfaceDataset
  {
    #keys: '3[415136.0.1184171003][415136.0.1184171002][415136.0.1184171004]'
    Cardinality: '0to1'
    ObjectDefinition: AssemblyOnlinePlanVersion
    OwningSide: 'Reference'
  }
  RelationSide.RightSide AssemblyOnlinePlanVersion
  {
    #keys: '3[415136.0.1184171006][415136.0.1184171005][415136.0.1184171007]'
    Cardinality: '1toN'
    ObjectDefinition: InterfaceDataset
    OwningSide: 'Owned'
  }
}
_Main/BL/Relations/Relation_AssemblyOnlinePlanVersion_Row_AssemblyOnlinePlanVersionRow_Version.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
Quintiq file version 2.0
#parent: #root
Relation AssemblyOnlinePlanVersion_Row_AssemblyOnlinePlanVersionRow_Version
{
  #keys: '1[415136.0.1184170985]'
  DefaultRelationStrategy
  {
  }
  RelationSide.LeftSide Row
  {
    #keys: '3[415136.0.1184170987][415136.0.1184170986][415136.0.1184170988]'
    Cardinality: '1toN'
    ObjectDefinition: AssemblyOnlinePlanVersion
    OwningSide: 'Owned'
  }
  RelationSide.RightSide Version
  {
    #keys: '3[415136.0.1184170990][415136.0.1184170989][415136.0.1184170991]'
    Cardinality: '0to1'
    ObjectDefinition: AssemblyOnlinePlanVersionRow
    OwningSide: 'Reference'
  }
}
_Main/BL/Type_AOnlineAndMOfflinePlanPIR/StaticMethod_GenerateData.qbl
@@ -3,7 +3,7 @@
StaticMethod GenerateData (
  InterfaceDataset owner,
  String werk,
  const MacroPlan macroplan,
  String version,
  Date startdate,
  Date enddate,
  String executor
@@ -33,41 +33,43 @@
                                                      , ReturnMsg := 'Success'
                                                      , Success := true
                                                      );
    pir                    := owner.AOnlineAndMOfflinePlanPIR( relnew, ZPPPSCode := OS::GenerateGUIDAsString(), Werk := werk, Version := macroplan.ScenarioName(), StartDate := startdate, EndDate := enddate );
    pir                    := owner.AOnlineAndMOfflinePlanPIR( relnew, ZPPPSCode := OS::GenerateGUIDAsString(), Werk := werk, Version := version, StartDate := startdate, EndDate := enddate );
    loginfo.AOnlineAndMOfflinePlanPIR( relinsert, pir );
    traverse( macroplan, AssemblyOnlinePlanColumn, column, column.ColumnDate() >= startdate and column.ColumnDate() <= enddate ){
      traverse( column, AssemblyOnlinePlanCell, cell, ( werk = 'All' or cell.AssemblyOnlinePlanRow().ProductionLine().FindString( werk, 0 ) > -1 )
                and cell.AssemblyOnlinePlanRow().Type() = '1' ){
        quantityrow        := cell.AssemblyOnlinePlanRow();
    traverse( owner, AssemblyOnlinePlanVersion, verison, not verison.IsShow() ){
      traverse( verison, Column, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.StartDate() >= startdate and column.StartDate() <= enddate ){
        traverse( column, Cell, cell, ( werk = 'All' or cell.Row().ProductionLine().FindString( werk, 0 ) > -1 )
                  and cell.Row().Type() = '1' ){
          quantityrow        := cell.Row();
        if( not exists( productids, Elements, e, e = quantityrow.ProductID() ) ){
          productids.Add( quantityrow.ProductID() );
        }
    
        pir.PIRData( relnew, Product           := quantityrow.ProductID()
                     , PlanningDate            := column.ColumnDate()
                       , PlanningDate            := column.StartDate()
                     , PlanningQty             := [Number]cell.Value());
      }
    }
    }
    
    traverse( macroplan, OfflinePlanTable, table ){
      traverse( table, OfflinePlanColumn, column, column.ColumnDate() >= startdate and column.ColumnDate() <= enddate ){
        traverse( column, OfflinePlanCell, cell, ( werk = 'All' or cell.OfflinePlanRow().ProductionLine().FindString( werk, 0 ) > -1 )
                  and ( cell.OfflinePlanRow().ProductionLine() <> 'DL_MOMO' or cell.OfflinePlanRow().ProductionLine() <> 'CC_MOMO' )
                  and cell.OfflinePlanRow().Type() = '1' ){
          row              := cell.OfflinePlanRow();
          if( not exists( productids, Elements, e, e = row.ProductID() ) ){
            productids.Add( row.ProductID() );
          }
          pirdata          := selectobject(  pir, PIRData, pirdata, pirdata.Product() = row.ProductID() and pirdata.PlanningDate() = column.ColumnDate() );
          if( isnull( pirdata ) ){
            pirdata          := pir.PIRData( relnew, Product         := row.ProductID()
                                             , PlanningDate            := column.ColumnDate()
                                             , PlanningQty             := 0 );
          }
          pirdata.PlanningQty( pirdata.PlanningQty() + [Number]cell.Value() );
        }
      }
    }
    //traverse( version, OfflinePlanTable, table ){
    //  traverse( table, OfflinePlanColumn, column, column.ColumnDate() >= startdate and column.ColumnDate() <= enddate ){
    //    traverse( column, OfflinePlanCell, cell, ( werk = 'All' or cell.OfflinePlanRow().ProductionLine().FindString( werk, 0 ) > -1 )
    //              and ( cell.OfflinePlanRow().ProductionLine() <> 'DL_MOMO' or cell.OfflinePlanRow().ProductionLine() <> 'CC_MOMO' )
    //              and cell.OfflinePlanRow().Type() = '1' ){
    //      row              := cell.OfflinePlanRow();
    //      if( not exists( productids, Elements, e, e = row.ProductID() ) ){
    //        productids.Add( row.ProductID() );
    //      }
    //      pirdata          := selectobject(  pir, PIRData, pirdata, pirdata.Product() = row.ProductID() and pirdata.PlanningDate() = column.ColumnDate() );
    //      if( isnull( pirdata ) ){
    //        pirdata          := pir.PIRData( relnew, Product         := row.ProductID()
    //                                         , PlanningDate            := column.ColumnDate()
    //                                         , PlanningQty             := 0 );
    //      }
    //      pirdata.PlanningQty( pirdata.PlanningQty() + [Number]cell.Value() );
    //    }
    //  }
    //}
    traverse( productids, Elements, e ){
      for( date := startdate.StartOfWeek(); date <= enddate; date := ( date + Duration::Days( 1 ) ).Date() ){
        if( not exists( pir, PIRData, pirdata, pirdata.Product() = e and pirdata.PlanningDate() = date ) ){
_Main/BL/Type_AssemblyOnlinePlanCell0/StaticMethod_RefreshData.qbl
ÎļþÒÑɾ³ý
_Main/BL/Type_AssemblyOnlinePlanColumn0/Attribute_ColumnDate.qbl
ÎļþÒÑɾ³ý
_Main/BL/Type_AssemblyOnlinePlanColumn0/Attribute_EndDate.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
Quintiq file version 2.0
#parent: #root
Attribute EndDate
{
  #keys: '3[415136.0.1184120166][415136.0.1184120165][415136.0.1184120167]'
  ValueType: Date
}
_Main/BL/Type_AssemblyOnlinePlanColumn0/Attribute_StartDate.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
Quintiq file version 2.0
#parent: #root
Attribute StartDate
{
  #keys: '3[415136.0.1184120156][415136.0.1184120155][415136.0.1184120157]'
  ValueType: Date
}
_Main/BL/Type_AssemblyOnlinePlanColumn0/Attribute_TimeUnit.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
Quintiq file version 2.0
#parent: #root
Attribute TimeUnit
{
  #keys: '3[415136.0.1184120146][415136.0.1184120145][415136.0.1184120147]'
  ValueType: String
}
_Main/BL/Type_AssemblyOnlinePlanVersion/Attribute_ID.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
Quintiq file version 2.0
#parent: #root
Attribute ID
{
  #keys: '3[415136.0.1184170976][415136.0.1184170975][415136.0.1184170977]'
  IsReadOnly: true
  ValueType: String
}
_Main/BL/Type_AssemblyOnlinePlanVersion/Attribute_IsShow.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
Quintiq file version 2.0
#parent: #root
Attribute IsShow
{
  #keys: '3[415136.0.1184120223][415136.0.1184120222][415136.0.1184120224]'
  ValueType: Boolean
}
_Main/BL/Type_AssemblyOnlinePlanVersion/Attribute_Name.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
Quintiq file version 2.0
#parent: #root
Attribute Name
{
  #keys: '3[415136.0.1184170979][415136.0.1184170978][415136.0.1184170980]'
  Description: '名称'
  ValueType: String
}
_Main/BL/Type_AssemblyOnlinePlanVersion/DefaultValue_ID.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,6 @@
Quintiq file version 2.0
#parent: #root
DefaultValue
{
  TargetAttribute: ID
}
_Main/BL/Type_AssemblyOnlinePlanVersion/DefaultValue_Name.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,6 @@
Quintiq file version 2.0
#parent: #root
DefaultValue
{
  TargetAttribute: Name
}
_Main/BL/Type_AssemblyOnlinePlanVersion/Method_GenerateColumn.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,65 @@
Quintiq file version 2.0
#parent: #root
Method GenerateColumn (
  Dates periods,
  String timeunit,
  Date starttime,
  Date endtime
)
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-25-2024 (created)
    mindate               := min( periods, Elements, period, period );
    maxdate               := max( periods, Elements, period, period );
    //查询日期返回需要在计划日期之内
    if( starttime < mindate and endtime > maxdate ){
      if( starttime < mindate ){
        starttime             := mindate;
      }
      if( endtime > maxdate ){
        endtime               := maxdate;
      }
      if( timeunit = Translations::MP_GlobalParameters_Day() ){
        for( start := starttime; start <= endtime; start := start.DateTime().StartOfNextDay().Date() ){
          periodname          := start.Format( "M2/D2/Y" );
          if( not exists( this, Column, column, column.StartDate() = start ) ){
            this.Column( relnew, ColumnName := periodname, StartDate := start, EndDate := start, TimeUnit := Translations::MP_GlobalParameters_Day() );
          }
        }
      }else if( timeunit = Translations::MP_GlobalParameters_Week() ){
    //    weekstartstr          := ' KW';
        for( start := starttime; start <= endtime; start := start.StartOfNextWeek() ){
          weekend             := ( start.StartOfNextWeek() - Duration::Days( 1 ) ).Date();//.Concat( weekstartstr.Concat( weekend.Week().Format( 'N(LPad0(2))' ) ) )
          this.Column( relnew, ColumnName := weekend.Format( "M2/D2/Y" ), StartDate := start, EndDate := weekend, TimeUnit := Translations::MP_GlobalParameters_Week() );
        }
      }else if( timeunit = Translations::MP_GlobalParameters_Month() ){
        for( start := starttime; start <= endtime; start := start.StartOfNextMonth() ){
          monthend            := ( start.StartOfNextMonth() - Duration::Days( 1 ) ).Date();//.Concat( ' ' ).Concat( monthend.Format( "MM", us_locale ).Concat( '/').Concat( [String]monthend.Month() ).Concat( '月' ) )
    //      us_locale := Locale::Construct( 'en_us' );
          this.Column( relnew, ColumnName := monthend.Format( "M2/D2/Y" ), StartDate := start, EndDate := monthend, TimeUnit := Translations::MP_GlobalParameters_Month() );
        }
      }
    }
    //weekstart             := periods.Element( 0 );
    //monthstart            := periods.Element( 0 );
    //traverse( periods, Elements, periodtime ){
    //  periodname          := periodtime.Format( "M2/D2/Y" );
    //
    //  this.Column( relnew, Name := periodname, StartDate := periodtime, EndDate := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
    //
    //  if( periodtime = weekstart ){
    //    weekperiodname    := weekstart.Format( "M2/D2/Y" );
    //    this.Column( relnew, Name := weekperiodname, StartDate := weekstart, EndDate := ( weekstart + Duration::Days( 6 ) ).Date(), TimeUnit := Translations::MP_GlobalParameters_Week() );
    //    weekstart         := ( weekstart + Duration::Days( 7 ) ).Date();
    //  }
    //  if( periodtime = monthstart ){
    //    monthperiodname   := monthstart.Format( "M2/D2/Y" );
    //    enddate           := ( monthstart.StartOfNextMonth() - Duration::Days( 1 ) ).Date();
    //    this.Column( relnew, Name := monthperiodname, StartDate := monthstart, EndDate := enddate, TimeUnit := Translations::MP_GlobalParameters_Month() );
    //    monthstart        := monthstart.StartOfNextMonth();
    //  }
    //}
  *]
}
_Main/BL/Type_AssemblyOnlinePlanVersion/Method_GetColumnByTimeUnit.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
Quintiq file version 2.0
#parent: #root
Method GetColumnByTimeUnit (
  String unit,
  Date period
) as AssemblyOnlinePlanVersionColumn
{
  TextBody:
  [*
    // ç”„兰鸽 Aug-7-2024 (created)
    column := selectobject( this, Column, column, column.StartDate() <= period and column.EndDate() >= period and column.TimeUnit() = unit );
    return column;
  *]
}
_Main/BL/Type_AssemblyOnlinePlanVersion/Method_GetRow.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
Quintiq file version 2.0
#parent: #root
Method GetRow (
  const AssemblyOnlinePlanRow aoprow
) as AssemblyOnlinePlanVersionRow
{
  TextBody:
  [*
    // ç”„兰鸽 Oct-11-2024 (created)
    row := selectobject( this, Row, row, row.ProductID() = aoprow.ProductID() and row.ProductionLine() = aoprow.ProductionLine() and row.Type() = aoprow.Type() );
    if( isnull( row ) ){
      row := this.Row( relnew, ProductID := aoprow.ProductID(), ProductionLine := aoprow.ProductionLine(), Type := aoprow.Type() );
      //初始化单元格
      row.InitializeCell();
    }
    return row;
  *]
}
_Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_GenerateData.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,62 @@
Quintiq file version 2.0
#parent: #root
StaticMethod GenerateData (
  InterfaceDataset interface,
  RecycleBin recycle,
  const Archive archive
)
{
  Description: '生成可以下发的客户需求(PPA+IDS)数据'
  TextBody:
  [*
    // ç”„兰鸽 Aug-20-2024 (created)
    interface.CustomerDemandIDS( relflush );
    interface.CustomerDemandIDSSearch( relflush );
    allunit               := CustomerDemandIDS::GetDefaultAllUnit();
    interface.CustomerDemandIDSSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit, TimeUnit := Translations::MP_GlobalParameters_Day(), Unit := allunit );
    idstable              := interface.CustomerDemandIDS( relnew, ID := '客户需求', Name := '客户需求' );
    binaryValue           := TemplateManager::GetIDSFullTable( archive, Date::ActualDate().Year() );
    source                := GeneralExcelImportAndExportDataSource::Upload( recycle, binaryValue, OS::TempPath() + "template.xlsx" );
    source.ReadStructure();
    Transaction::Transaction().Propagate( attribute( GeneralExcelImportAndExportDataColumn, ColumnIndex ) );
    cnv2 := StringToDate::StandardConverter();
    cnv2.SetCustomConversion();
    cnv2.CustomFormatString( "yyyy/MM/dd" );
    idsdates              := selectuniquevalues( source, GeneralExcelImportAndExportDataTable.GeneralExcelImportAndExportDataColumn, column, column.ColumnIndex() > 2, cnv2.Convert( column.Name() ) );
    ppadates              := selectuniquevalues( interface, InterfaceForecast, forecast, forecast.Origin() = 'PPA', forecast.Date() );
    //ppadates              := construct( Dates );
    //traverse( macroplan, SalesDemand.astype( Forecast ), forecast, forecast.Origin() = 'PPA' ){
    //  ppadates            := ppadates.Union( selectuniquevalues( forecast, PlanningSalesDemandInPeriod, salesdemand, salesdemand.StartDate() ) );
    //}
    periods               := idsdates.Union( ppadates );
    periods               := selectuniquevalues( periods, Elements, e, e );
    idstable.GenerateColumn( periods.Sort() );
    traverse( recycle, GeneralExcelImportAndExportDataSource.GeneralExcelImportAndExportDataTable, table ){
      traverse( table, GeneralExcelImportAndExportDataRow, row ){
        productcell       := selectobject( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 2 );
        factorycell       := selectobject( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 0 );
        idsrow            := idstable.GetRowByUnit( productcell.Value(), factorycell.Value() );
        traverse( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() > 2 ){
          period          := cnv2.Convert( cell.GeneralExcelImportAndExportDataColumn().Name() );
          daycolumn       := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Day(), period );
          weekcolumn      := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Week(), period );
          monthcolumn     := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Month(), period );
          idsrow.SetCellValue( daycolumn, [Number]cell.Value() );
          idsrow.SetCellValue( weekcolumn, [Number]cell.Value() );
          idsrow.SetCellValue( monthcolumn, [Number]cell.Value() );
        }
      }
    }
    traverse( interface, InterfaceForecast, forecast, forecast.Origin() = 'PPA' ){
      idsrow              := idstable.GetRowByUnit( forecast.PartNumber(), forecast.Factory() );
      daycolumn           := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Day(), forecast.Date() );
      weekcolumn          := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Week(), forecast.Date() );
      monthcolumn         := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Month(), forecast.Date() );
      idsrow.SetCellValue( daycolumn, [Number]forecast.Quantity() );
      idsrow.SetCellValue( weekcolumn, [Number]forecast.Quantity() );
      idsrow.SetCellValue( monthcolumn, [Number]forecast.Quantity() );
    }
    source.Delete();
  *]
}
_Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_GetDefaultAllUnit.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
Quintiq file version 2.0
#parent: #root
StaticMethod GetDefaultAllUnit () const declarative as String
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-25-2024 (created)
    return '<All>';
  *]
}
_Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_GetDefaultName.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
Quintiq file version 2.0
#parent: #root
StaticMethod GetDefaultName () const declarative as String
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-25-2024 (created)
    return '装配上线计划全量表';
  *]
}
_Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_RefreshData.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,38 @@
Quintiq file version 2.0
#parent: #root
StaticMethod RefreshData (
  InterfaceDataset interface,
  const MacroPlan macroPlan
)
{
  TextBody:
  [*
    //根据当前版本的装配上线计划
    allunit                := AssemblyOnlinePlanVersion::GetDefaultAllUnit();
    name                   := AssemblyOnlinePlanVersion::GetDefaultName();
    search                 := interface.AssemblyOnlinePlanVersionSearch( relnew, Product := allunit, ProductionLine := allunit, TimeUnit := Translations::MP_GlobalParameters_Day(), Unit := allunit, StartDate := Date::MinDate(), EndDate := Date::MaxDate() );
    table                  := selectobject( interface, AssemblyOnlinePlanVersion, version, not version.IsShow() );
    if( isnull( table ) ){
      table                := interface.AssemblyOnlinePlanVersion( relnew, ID := name, Name := name );
    }
    showtable              := selectobject( interface, AssemblyOnlinePlanVersion, version, version.IsShow() );
    if( isnull( table ) ){
      showtable               := interface.AssemblyOnlinePlanVersion( relnew, ID := name, Name := name, IsShow := true );
    }
    aopcolumns             := selectuniquevalues(  macroPlan, AssemblyOnlinePlanColumn, aopcolumn, not exists( table, Column, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.StartDate() = aopcolumn.ColumnDate() ), aopcolumn.ColumnDate() );
    table.GenerateColumn( aopcolumns, search.TimeUnit(), search.StartDate(), search.EndDate() );
    traverse( macroPlan, AssemblyOnlinePlanRow, aoprow ){
      row                  := table.GetRow( aoprow );
      traverse( aoprow, AssemblyOnlinePlanCell, aopcell ){
        column             := selectobject( table, Column, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.StartDate() = aopcell.AssemblyOnlinePlanColumn().ColumnDate() );
        cell               := selectobject( row, Cell, cell, cell.Column() = column );
        cell.InventoryWeight( aopcell.InventoryWeight() );
        cell.ProductionSerialNumber( aopcell.ProductionSerialNumber() );
        cell.Quantity( aopcell.Quantity() );
        cell.Shift( aopcell.Shift() );
        cell.Value( aopcell.Value() );
      }
    }
    //showtable.Generate( search, products );
  *]
}
_Main/BL/Type_AssemblyOnlinePlanVersion/_ROOT_Type_AssemblyOnlinePlanVersion.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
Quintiq file version 2.0
#root
#parent: #DomainModel
Type AssemblyOnlinePlanVersion
{
  #keys: '5[415136.0.1184170973][415136.0.1184170971][0.0.0][415136.0.1184170972][415136.0.1184170974]'
  BaseType: Object
  Description: '装配上线计划全表数据'
  StructuredName: 'AssemblyOnlinePlanVersions'
}
_Main/BL/Type_AssemblyOnlinePlanVersionRow/Method_Initialize.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
Quintiq file version 2.0
#parent: #root
Method Initialize (
  AssemblyOnlinePlanVersionColumn column
)
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-24-2024 (created)
    cell := column.Cell( relnew, InventoryWeight := 0, ProductionSerialNumber := 0, Quantity := 0, Shift := '', Value := '' );
    this.Cell( relinsert, cell );
  *]
}
_Main/BL/Type_AssemblyOnlinePlanVersionRow/Method_InitializeCell.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
Quintiq file version 2.0
#parent: #root
Method InitializeCell
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-28-2024 (created)
    traverse( this.Version(), Column, column ){
      this.Initialize( column );
    }
  *]
}
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/Attribute_EndDate.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
Quintiq file version 2.0
#parent: #root
Attribute EndDate
{
  #keys: '3[415136.0.1184120182][415136.0.1184120181][415136.0.1184120183]'
  ValueType: Date
}
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/Attribute_Product.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
Quintiq file version 2.0
#parent: #root
Attribute Product
{
  #keys: '3[415136.0.1184120194][415136.0.1184120193][415136.0.1184120195]'
  ValueType: String
}
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/Attribute_ProductionLine.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
Quintiq file version 2.0
#parent: #root
Attribute ProductionLine
{
  #keys: '3[415136.0.1184120240][415136.0.1184120239][415136.0.1184120241]'
  ValueType: String
}
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/Attribute_StartDate.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
Quintiq file version 2.0
#parent: #root
Attribute StartDate
{
  #keys: '3[415136.0.1184120197][415136.0.1184120196][415136.0.1184120198]'
  ValueType: Date
}
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/Attribute_TimeUnit.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
Quintiq file version 2.0
#parent: #root
Attribute TimeUnit
{
  #keys: '3[415136.0.1184120200][415136.0.1184120199][415136.0.1184120201]'
  Description: '日期类型'
  ValueType: String
}
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/Attribute_Unit.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
Quintiq file version 2.0
#parent: #root
Attribute Unit
{
  #keys: '3[415136.0.1184120203][415136.0.1184120202][415136.0.1184120204]'
  Description: '产线'
  ValueType: String
}
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/DefaultValue_Product.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,6 @@
Quintiq file version 2.0
#parent: #root
DefaultValue
{
  TargetAttribute: Product
}
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/DefaultValue_TimeUnit.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,6 @@
Quintiq file version 2.0
#parent: #root
DefaultValue
{
  TargetAttribute: TimeUnit
}
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/DefaultValue_Unit.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,6 @@
Quintiq file version 2.0
#parent: #root
DefaultValue
{
  TargetAttribute: Unit
}
_Main/BL/Type_AssemblyOnlinePlanVersionSearch/_ROOT_Type_AssemblyOnlinePlanVersionSearch.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
Quintiq file version 2.0
#root
#parent: #DomainModel
Type AssemblyOnlinePlanVersionSearch
{
  #keys: '5[415136.0.1184120179][415136.0.1184120177][0.0.0][415136.0.1184120178][415136.0.1184120180]'
  BaseType: Object
  Description: '查询类'
  StructuredName: 'AssemblyOnlinePlanVersionSearchs'
}
_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
@@ -96,34 +96,23 @@
      destisp                := selectobject( owner, StockingPoint_MP, sp, sp.ID() = laneleg.DestinationStockingPointID() );
      isccrent               := table.IsInUnit( destisp, ccrent );
      if( isccspline and isccrent ){
        traverse( laneleg, Trip, trip, trip.Arrival().Date() < startofnextyear ){
          periodtime         := trip.Arrival().StartOfMonth().Date();
          periodname         := periodtime.Format( "M2/D2/Y" );
          column             := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
          enginecosts        := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.StartDate() <= trip.Arrival().Date() and engine.EndDate() >= trip.Arrival().Date() );
          transcosts         := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.StartDate() <= trip.Arrival().Date() and trans.EndDate() >= trip.Arrival().Date() );
        traverse( table, Column, column ){
          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 ){
            traverse( trip, ProductInTrip, pit, pit.Quantity() <> 0 ){
              product          := pit.Product_MP();
              productparents   := product.GetAllParent();
              if( exists( productparents, Elements, e, e.ID() = produtparent ) ){////查询产品类型是发动机
                //在发动机成本参数表找到对应的包装容量
                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() = 'CC åŽ‚å†…åº“'
                                                  and trans.Destination() = ccrent
                                                  and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
                if( not isnull( enginecost ) and not isnull( transcost ) ){
                  row          := table.GetRow( pit.ProductID() );
            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 ){
              row            := table.GetRow( producttrip );
              product        := selectobject( owner, Product_MP, product, product.ID() = producttrip );
                  products.Add( product );
                  //运输数量/包装容量/装载容量*运输单价
                  quantity     := ceil( ceil( [Number]pit.Quantity() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//四舍五入
                  row.SetFactoryToRentTransCost( column, quantity );
                }
              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() = 'CC åŽ‚å†…åº“' and trans.Destination() = ccrent 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();//四舍五入
                row.SetFactoryToRentTransCost( column, cost );
              }
            }
          }
@@ -131,36 +120,31 @@
      }
    }
    //外租库仓储费用:仓储数量/包装容量*仓储单价,在Actual inventories里取到长春外租库该发动机的仓储量,根据发动机号找到对应的Generation å’Œæ¨ªçºµåˆ¶ï¼Œåœ¨å‘动机成本参数表里找到对应的仓储单价和包装容量,用公式计算,月度进行汇总
    traverse( owner, StockingPoint_MP, stockingpoint ){
      //是否属于长春外租库
      isccrent                 := table.IsInUnit( stockingpoint, ccrent );
      if( isccrent ){
        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 ) ){
    traverse( owner, StockingPoint_MP, stockingpoint, table.IsInUnit( stockingpoint, ccrent ) ){//是否属于长春外租库
      traverse( stockingpoint, ProductInStockingPoint_MP, pisp,  pisp.Product_MP().IsLeaf() and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent )//查询产品类型是发动机
                and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.PlannedInventoryLevelEnd() <> 0 ) ){
          //获取行
          product              := pisp.Product_MP();
          productparents       := product.GetAllParent();
          if( exists( productparents, Elements, e, e.ID() = produtparent ) ){////查询产品类型是发动机
            //查询对应的发动机成本
            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 );
        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 );
            if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
              row              := table.GetRow( pisp.ProductID() );
              products.Add( product );
              //当product planning的日期区间在需要的日期区间内 
              traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.NewSupplyQuantity() <> 0 ){
    //      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( 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( [Number]pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入
              quantity     := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入
                  
                  column       := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
                  
                  row.SetRentStorageCost( column, quantity );
                }
              }
            }
          }
        }
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
ÎļþÒÑɾ³ý
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
@@ -36,37 +36,37 @@
    //  unit                    := stockingpoint.Unit();
    //  parentunits             := unit.GetAllParent();
      //是否属于长春外租库用于长春外租库仓储费用
      isccrent                := stockingpoint.ID().StartsWith( '长春' ) or stockingpoint.ID().StartsWith( 'CC' );
    //  isccrent                := stockingpoint.ID().StartsWith( '长春' ) or stockingpoint.ID().StartsWith( 'CC' );
      //是否属于大连发动机的长春外租库用于长春入库/出库费用
      isdltoccrent            := stockingpoint.ID().StartsWith( '大连发动机的长春' );
      //是否属于大连外租库用于大连外租库仓储费用
      isdlrent                := stockingpoint.ID().StartsWith( '大连' ) or stockingpoint.ID().StartsWith( 'DL' );
      if( isccrent or isdlrent ){
      isdlrent                := not isdltoccrent and stockingpoint.ID().StartsWith( '大连' ) or stockingpoint.ID().StartsWith( 'DL' );
    //  info( '--------------', isccrent, isdltoccrent, isdlrent );
      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 ) ){
                  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 trans.Origin() = '大连厂内库'
                                                  and trans.Destination() = '大连外租库'
                                                  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 ){
              products.Add( pisp.Product_MP() );
              traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.NewSupplyQuantity() <> 0  ){
              traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear
                        and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) ){
                periodtime    := pispip.Start().StartOfMonth().Date();
                periodname    := periodtime.Format( "M2/D2/Y" );
                column        := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
                cell          := selectobject( row, Cell, cell, cell.Column() = column );
                
                if( isccrent or isdltoccrent){
                if( isdltoccrent){
                  //在发动机成本参数表找到对应的包装容量
                  enginecost  := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date()
                                                     and engine.Factory() = ccfactory );
                   if( not isnull( enginecost ) ){
                     if( isccrent ){
                       cost        := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入
                       cell.CCRentStorCost( cell.CCRentStorCost() + cost );//长春外租库仓储费用
                     }else{
                       cell.CCRentQty( cell.CCRentQty() + pispip.NewSupplyQuantity() );
                       //长春外租库入库费用:入库量/包装容量*入库单价 
                       entercost  := ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
@@ -74,15 +74,22 @@
                       outcost    := ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
                       cell.CCRentInCost( cell.CCRentInCost() + entercost );
                       cell.CCRentOutOfCost( cell.CCRentOutOfCost() + outcost );
                     }
                   }
                       cost        := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入
                       cell.CCRentStorCost( cell.CCRentStorCost() + cost );//长春外租库仓储费用
                } else {
                  //在发动机成本参数表找到对应的包装容量
                  enginecost     := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date()
                                                     and engine.Factory() = dlfactory  );
                   if( not isnull( enginecost ) ){
                     cost        := ceil( [Number]pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入
                     cost        := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//四舍五入
                     cell.DLRentStorCost( cell.DLRentStorCost() + cost );//大连外租库仓储费用
    //                 info( '**********************', pispip.NewSupplyQuantity() );
                     row.SetDLRentEnterCost( column, enginecost, pispip.NewSupplyQuantity() );//大连外租库入库费用
                     transcost        := selectobject( transcosts, Elements, trans, trans.StartDate() <= pispip.Start().Date() and trans.EndDate() >= pispip.Start().Date() );
                     if( not isnull( transcost ) ){
                       cost := ceil( ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//四舍五入
                       row.SetFactoryToRentTransCost( column, cost );
                     }
                   }
                }
              }   
@@ -92,178 +99,223 @@
      }
    }
    //在 trip plan里找到大连装配线边库到大连外租库的运输数量//大连厂内库到外租库
    //traverse( owner, Unit.Lane.LaneLeg, laneleg ){
    //  isdlspline             := laneleg.OriginStockingPointID().EndsWith( '厂内库' ) and ( laneleg.OriginStockingPointID().StartsWith( '大连' ) or laneleg.OriginStockingPointID().StartsWith( 'DL' ) );
    //  //目的地是否是大连外租库
    //  isdlrent               := laneleg.DestinationStockingPointID().EndsWith( '大连外租库' );
    //  if( isdlspline and isdlrent ){
    //    traverse( table, Column, column ){
    //      alltrips          := selectset( laneleg, Trip, trip, trip.Arrival().Date() < column.StartDate().StartOfNextMonth() and trip.Arrival().Date() >= column.StartDate() );
    ////      info( '--------------------', alltrips.Size(), 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() );
    ////        info( '--------------2---------------', producttrips.Size() );
    //        traverse( producttrips, Elements, producttrip ){
    //
    //          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() ) ) );
    ////            info( '-------------------', not isnull( enginecost ) and not isnull( transcost ), isnull( transcost ), product.ID() );
    //            if( not isnull( enginecost ) and not isnull( transcost ) ){
    ////              info( '-------------------', product.ID(), transcost.LoadingCapacity() );
    //              cost := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//四舍五入
    //              info( quantity, ceil( quantity / enginecost.PackagingCapacity() ), ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) );
    //              row.SetFactoryToRentTransCost( column, cost );
    //            }
    //        }
    //      }
    //    }
    //traverse( owner, Unit.Lane.LaneLeg, laneleg ){
    //  //起始库存点是否是大连装配线边库
    //  isdlspline             := laneleg.OriginStockingPointID().EndsWith( '厂内库' ) and ( laneleg.OriginStockingPointID().StartsWith( '大连' ) or laneleg.OriginStockingPointID().StartsWith( 'DL' ) );
    //  //目的地是否是大连外租库
    //  isdlrent               := laneleg.DestinationStockingPointID().EndsWith( '外租库' ) and ( laneleg.DestinationStockingPointID().StartsWith( '大连' ) or laneleg.DestinationStockingPointID().StartsWith( 'DL' ) );
    //  if( isdlspline and isdlrent ){
    //    traverse( laneleg, Trip, trip, trip.Departure().Date() < startofnextyear ){//由于需要考虑产品运输lead time,每个月的汇总数据需要推迟两天进行计算
    //      periodtime         := trip.Departure().StartOfMonth().Date();
    //      periodname         := periodtime.Format( "M2/D2/Y" );
    //
    //      column             := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
    //      enginecosts        := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.StartDate() <= trip.Departure().Date() and engine.EndDate() >= trip.Departure().Date() );
    //      transcosts         := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.StartDate() <= trip.Departure().Date() and trans.EndDate() >= trip.Departure().Date() );
    //      if( not isnull( enginecosts ) and enginecosts.Size() > 0 and not isnull( transcosts ) and transcosts.Size() > 0 ){
    //        traverse( trip, ProductInTrip, pit, pit.Quantity() <> 0 and not isnull( column ) and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机
    //          quantity       := [Number]pit.Quantity();
    //          row            := table.GetRow( pit.ProductID() );
    //          product        := pit.Product_MP();
    //          productparents := product.GetAllParent();
    //
    //          //在发动机成本参数表找到对应的包装容量
    //          enginecost     := selectobject( enginecosts, Elements, engine, engine.Generation().ToLower() = product.Generation().ToLower()
    //                                               and engine.MLB_MQB() = product.MQBMLB()
    //                                               and engine.Factory() = dlfactory  );
    //          //在运输成本参数表里找到发动机对应运输单价和装载容量
    //          transcost      := selectobject( transcosts, Elements, trans, trans.Origin() = laneleg.OriginStockingPointID()
    //                                              and trans.Destination() = laneleg.DestinationStockingPointID()
    //                                              and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
    //          if( not isnull( enginecost ) and not isnull( transcost ) ){
    //            products.Add( product );
    //            cell         := selectobject( row, Cell, cell, cell.Column() = column );
    //            //运输数量/包装容量/装载容量*运输单价
    //            cost         := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//四舍五入
    //            cell.WerkToDLRentTransCost( cell.WerkToDLRentTransCost() + cost );
    //          }
    //        }
    //      }
    //    }
    //  }
    //}
    //长春长途运输费用:调拨数量/包装容量/装载容量*运输单价,调拨计划里找到该产品从DL到CC的调拨数量,即起始地大连装配线边库,目的地为长春外租库对应的运输数量,在发动机成本参数表找到对应的包装容量,在运输成本参数表里找到发动机对应运输单价和装载容量,用公式计算得出结果,月度进行汇总
    traverse( owner, Unit.Lane.LaneLeg, laneleg ){
      //起始库存点是否是大连装配线边库
      isdlspline             := laneleg.OriginStockingPointID().EndsWith( '厂内库' ) and ( laneleg.OriginStockingPointID().StartsWith( '大连' ) or laneleg.OriginStockingPointID().StartsWith( 'DL' ) );
      //目的地是否是大连外租库
      isdlrent               := laneleg.DestinationStockingPointID().EndsWith( '外租库' ) and ( laneleg.DestinationStockingPointID().StartsWith( '大连' ) or laneleg.DestinationStockingPointID().StartsWith( 'DL' ) );
      if( isdlspline and isdlrent ){
        traverse( laneleg, Trip, trip, trip.Departure().Date() < startofnextyear ){//由于需要考虑产品运输lead time,每个月的汇总数据需要推迟两天进行计算
          periodtime         := trip.Departure().StartOfMonth().Date();
          periodname         := periodtime.Format( "M2/D2/Y" );
          column             := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
          enginecosts        := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.StartDate() <= trip.Departure().Date() and engine.EndDate() >= trip.Departure().Date() );
          transcosts         := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.StartDate() <= trip.Departure().Date() and trans.EndDate() >= trip.Departure().Date() );
    //  isdlspline             := laneleg.OriginStockingPointID().EndsWith( '厂内库' ) and ( laneleg.OriginStockingPointID().StartsWith( '大连' ) or laneleg.OriginStockingPointID().StartsWith( 'DL' ) );
    //  //目的地是否是大连外租库
    //  isdlrent               := laneleg.DestinationStockingPointID().EndsWith( '大连外租库' );
      //起始库存点是否是大连(大连厂内库)
      isdl                   := laneleg.OriginStockingPointID().EndsWith( '厂内库' ) and ( laneleg.OriginStockingPointID().StartsWith( '大连' ) or laneleg.OriginStockingPointID().StartsWith( 'DL' ) );
      //目的地库存点是否是长春(长春外租库)
      iscc                   := laneleg.DestinationStockingPointID() = '大连发动机的长春外租库';
        if( isdl and iscc ){
    //  if( isdlspline and isdlrent ){
        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() );
    //      info( '--------------------', alltrips.Size(), 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 ){
            traverse( trip, ProductInTrip, pit, pit.Quantity() <> 0 and not isnull( column ) and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机
              quantity       := [Number]pit.Quantity();
              row            := table.GetRow( pit.ProductID() );
              product        := pit.Product_MP();
              productparents := product.GetAllParent();
            producttrips      := selectuniquevalues( alltrips, Elements.ProductInTrip, pit, pit.Quantity() <> 0 and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ), pit.ProductID() );
    //        info( '--------------2---------------', producttrips.Size() );
            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() = dlfactory  );
                                                   and engine.Factory() = ccfactory );
              //在运输成本参数表里找到发动机对应运输单价和装载容量
              transcost      := selectobject( transcosts, Elements, trans, trans.Origin() = laneleg.OriginStockingPointID() 
                                                  and trans.Destination() = laneleg.DestinationStockingPointID() 
                                                  and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
                                                  and exists( product.GetAllParent(), Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
    //            info( '-------------------', not isnull( enginecost ) and not isnull( transcost ), isnull( transcost ), product.ID() );
              if( not isnull( enginecost ) and not isnull( transcost ) ){
                products.Add( product );
                cell         := selectobject( row, Cell, cell, cell.Column() = column );
                //运输数量/包装容量/装载容量*运输单价
    //              info( '-------------------', product.ID(), transcost.LoadingCapacity() );
                cost         := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//四舍五入
                cell.WerkToDLRentTransCost( cell.WerkToDLRentTransCost() + cost );
              }
            }
          }
        }
      }
    }
    //大连外租库入库费用:入库量/包装容量*入库单价,入库量等于大连工厂该产品产量减去发往长春(大连的长春外租库)的数量-newSupply
    traverse( owner, FinancialProductionSource, source, not source.IsImport() ){//财务产量报表非导入
      traverse( source, FinancialProductionReport, report, not report.IsShow() ){//财务产量报表不显示
        traverse( report, FinancialProductionRow, row, row.Unit() = dlunit and exists( row, FinancialProductionCell, cell, cell.Value() <> '0' and not cell.FinancialProductionColumn().IsDay() ) ){//财务产量报表里的大连产量, ä¸ä¸º0
          product            := row.Product_MP();
          productparents     := product.GetAllParent();
          if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机
            //查询对应的发动机成本
            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 ){
              products.Add( product );
              ccrow          := table.GetRow( row.Name() );
              traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' and not cell.FinancialProductionColumn().IsDay() ){
                cellcolumn   := cell.FinancialProductionColumn();
                enginecost   := selectobject( enginecosts, Elements, engine, engine.StartDate() <= cellcolumn.Period() and engine.EndDate() >= cellcolumn.Period() );
                if( not isnull( enginecost ) ){
                  column     := selectobject( table, Column, column, column.Name() = cell.FinancialProductionColumn().Name() );
                  //大连外租库入库费用
                  ccrow.SetDLRentEnterCost( column, enginecost, cell );
                }
              }
            }
          }
        }
      }
    }
    //大连外租库出库费用:出库量/包装容量*出库单价,出库量等于大连工厂该产品销量减去发往长春的数量-newSupply, å¤§è¿žåŽ‚å†…åº“ï¼Œå¤§è¿žå¤–ç§Ÿåº“
    traverse( owner, FinancialSalesSource, source, not source.IsImport() ){//财务销量报表非导入
      traverse( source, FinancialSalesReport, report, not report.IsShow() ){//财务销量报表不显示
        traverse( report, FinancialSalesRow, row, row.Unit() = ccunit and exists( row, FinancialSalesCell, cell, cell.Value() <> '0' and not cell.FinancialSalesColumn().IsDay() ) ){//财务销量报表里的大连产量, ä¸ä¸º0
          product            := row.Product_MP();
          productparents     := product.GetAllParent();
          if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机
            //查询对应的发动机成本
            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 ){
              products.Add( product );
              ccrow          := table.GetRow( row.Name() );
              traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' and not cell.FinancialSalesColumn().IsDay() ){
                cellcolumn   := cell.FinancialSalesColumn();
                enginecost   := selectobject( enginecosts, Elements, engine, engine.StartDate() <= cellcolumn.Period() and engine.EndDate() >= cellcolumn.Period() );
                if(  not isnull( enginecost ) ){
                  column     := selectobject( table, Column, column, column.Name() = cell.FinancialSalesColumn().Name() );
                  //大连外租库出库费用
                  ccrow.SetDLRentOutCost( column, enginecost, cell );
                }
              }
            }
          }
        }
      }
    }
    //长春长途运输费用:调拨数量/包装容量/装载容量*运输单价,调拨计划里找到该产品从DL到CC的调拨数量,即起始地大连装配线边库,目的地为长春外租库对应的运输数量,在发动机成本参数表找到对应的包装容量,在运输成本参数表里找到发动机对应运输单价和装载容量,用公式计算得出结果,月度进行汇总
    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();
    //              info( quantity, ceil( quantity / enginecost.PackagingCapacity() ), ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) );
    //              row.SetFactoryToRentTransCost( column, cost );
                cell           := selectobject( row, Cell, cell, cell.Column() = column );
                cell.CCLongTransCost( cell.CCLongTransCost() + cost );
                  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为长春的数量汇总,再用公式计算,月度进行汇总(取客户需求数量换算成车次)
    traverse( owner, SalesDemand.astype( Forecast ), forecast, forecast.Quantity() > 0 and not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < startofnextyear ){
      salessegment            := forecast.SalesSegment_MP();
      parentsalessegments     := salessegment.GetAllParent();
      //是否属于长春
      iscc                    := salessegment.Name().StartsWith( 'Changchun' ) or exists( parentsalessegments, Elements, psalessegment, psalessegment.Name().StartsWith( 'Changchun' ) );
      if( iscc ){
        product               := forecast.Product_MP();
        productparents        := product.GetAllParent();
        if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机
    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 );
                                                 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( productparents, Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
          if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
            products.Add( forecast.Product_MP() );
            row               := table.GetRow( forecast.ProductID() );
            traverse( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() > 0 ){
              enginecost      := selectobject( enginecosts, Elements, engine, engine.StartDate() <= psdip.StartDate() and engine.EndDate() >= psdip.StartDate() );
              transcost       := selectobject( transcosts, Elements, trans, trans.StartDate() <= psdip.StartDate() and trans.EndDate() >= psdip.StartDate() );
              if( not isnull( enginecost ) ){
                periodtime    := psdip.StartDate().StartOfMonth();
                periodname    := periodtime.Format( "M2/D2/Y" );
          //      info( '-------------------------', periodname, periodtime );
                column         := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
          //      info( '-------------------------', column.Name() );
                cost           := ceil( ceil( [Number]psdip.Quantity() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
                                                  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 );
              }
            }
          }
        }
    //info( '***********1********', dlforecasts.Size() );
    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() );
            cost           := ceil( quantity / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
    //        info( '******************', quantity, cost );
    //         cell           := selectobject( row, Cell, cell, cell.Column() = column );
             row.SetDLRentOutCost( column, cost );
           }
        }
      }
    }
    
_Main/BL/Type_CCEngineLogisticsCostRow0/Method_SetDLRentEnterCost.qbl
@@ -3,14 +3,13 @@
Method SetDLRentEnterCost (
  DLEngineLogisticsCostColumn column,
  LogisticsCostEngine enginecost,
  FinancialProductionCell fpcell
  Real quantity
)
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-24-2024 (created) 
    cell := selectobject( this, Cell, cell, cell.Column() = column );
    quantity      := fpcell.Quantity() - cell.CCRentQty();
    //入库量/包装容量*入库单价,入库量等于长春产量
    cost          := ceil( quantity / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
    othercost     := ceil( quantity / enginecost.PackagingCapacity() ) * enginecost.OtherPrice();
_Main/BL/Type_CCEngineLogisticsCostRow0/Method_SetDLRentOutCost.qbl
@@ -2,19 +2,14 @@
#parent: #root
Method SetDLRentOutCost (
  DLEngineLogisticsCostColumn column,
  LogisticsCostEngine enginecost,
  FinancialSalesCell fscell
  Real quantity
)
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-24-2024 (created)
    cell := selectobject( this, Cell, cell, cell.Column() = column );
    quantity      := [Number]fscell.Value() - cell.CCRentQty();
    //入库量/包装容量*入库单价,入库量等于长春产量
    cost          := ceil( quantity / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
    value := cell.DLRentOutOfCost() + cost;
    value := cell.DLRentOutOfCost() + quantity;
    cell.DLRentOutOfCost( value );
  *]
}
_Main/BL/Type_InventorySummaryReport/Method_GenerateColumn.qbl
@@ -37,8 +37,8 @@
      }else if( timeunit = Translations::MP_GlobalParameters_Month() ){
        for( start := starttime; start <= endtime; start := start.StartOfNextMonth() ){
          monthend            := ( start.StartOfNextMonth() - Duration::Days( 1 ) ).Date();
          this.InventorySummaryColumn( relnew, Name := monthend.Format( "M2/D2/Y" ).Concat( ' ' ).Concat( monthend.Format( "MM" ).Concat( '/').Concat( [String]monthend.Month() ).Concat( '月' ) ), StartDate := start.Date(), EndaDate := monthend, TimeUnit := Translations::MP_GlobalParameters_Month() );
          us_locale := Locale::Construct( 'en_us' );
          this.InventorySummaryColumn( relnew, Name := monthend.Format( "M2/D2/Y" ).Concat( ' ' ).Concat( monthend.Format( "MM", us_locale ).Concat( '/').Concat( [String]monthend.Month() ).Concat( '月' ) ), StartDate := start.Date(), EndaDate := monthend, TimeUnit := Translations::MP_GlobalParameters_Month() );
        }
      }
    }
_Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSMS64/Component_pnlLeft#88.def
@@ -44,63 +44,7 @@
      [
        Checked: true
        Label: '是否激活版本'
        Taborder: 8
      ]
    }
    Component ddlOriginMacroPlan
    {
      #keys: '[415136.0.1043064647]'
      BaseType: 'WebDropDownList'
      Databinding: 'ScenarioMP'
      Children:
      [
        Component deMacroPlan id:deMacroPlan_640
        {
          #keys: '[415136.0.1043064648]'
          BaseType: 'WebDataExtractor'
          Properties:
          [
            DataType: 'ScenarioManager'
            Source: 'ScenarioManager'
            Taborder: 0
            Transformation: 'ScenarioMP'
          ]
        }
      ]
      Properties:
      [
        DisplayField: 'Name'
        Label: '从版本'
        Taborder: 4
        Visible: false
      ]
    }
    Component ddlDestinationMacroPlan
    {
      #keys: '[415136.0.1043064790]'
      BaseType: 'WebDropDownList'
      Databinding: 'ScenarioMP'
      Children:
      [
        Component deMacroPlan950
        {
          #keys: '[415136.0.1043064791]'
          BaseType: 'WebDataExtractor'
          Properties:
          [
            DataType: 'ScenarioManager'
            Source: 'ScenarioManager'
            Taborder: 0
            Transformation: 'ScenarioMP'
          ]
        }
      ]
      Properties:
      [
        DisplayField: 'Name'
        Label: '到版本'
        Taborder: 6
        Visible: false
      ]
    }
    Component efVersionFrom
@@ -110,7 +54,7 @@
      Properties:
      [
        Label: '从版本'
        Taborder: 5
        Taborder: 4
      ]
    }
    Component efVersionTo
@@ -120,7 +64,7 @@
      Properties:
      [
        Label: '到版本'
        Taborder: 7
        Taborder: 5
      ]
    }
    Component ddslFactory
@@ -129,6 +73,7 @@
      BaseType: 'WebDropDownStringList'
      Properties:
      [
        InitialValue: 'all;8200;8201'
        Label: '工厂代码'
        Strings: 'All;DL;CC'
        Taborder: 1
_Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSPIR/Component_pnlLeft.def
@@ -36,44 +36,28 @@
        Taborder: 4
      ]
    }
    Component ddlMacroPlan
    {
      #keys: '[415136.0.1043063334]'
      BaseType: 'WebDropDownList'
      Databinding: 'ScenarioMP'
      Children:
      [
        Component deMacroPlan
        {
          #keys: '[415136.0.1043063336]'
          BaseType: 'WebDataExtractor'
          Properties:
          [
            DataType: 'ScenarioManager'
            Source: 'ScenarioManager'
            Taborder: 0
            Transformation: 'ScenarioMP'
          ]
        }
      ]
      Properties:
      [
        DisplayField: 'Name'
        Label: '版本'
        Taborder: 2
      ]
    }
    Component ddslFactory id:ddslFactory_424
    {
      #keys: '[415136.0.1047641312]'
      BaseType: 'WebDropDownStringList'
      Properties:
      [
        InitialValue: 'all;8200;8201'
        Label: '工厂代码'
        Strings: 'All;DL;CC'
        Taborder: 1
      ]
    }
    Component efVersion
    {
      #keys: '[415136.0.1184400599]'
      BaseType: 'WebEditField'
      Properties:
      [
        Label: '版本'
        Taborder: 2
      ]
    }
  ]
  Properties:
  [
_Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSPIR/Method_OnOk.def
@@ -6,11 +6,7 @@
  Body:
  [*
    Form.ApplyChanges();
    componentmds    := ApplicationScope.ComponentMDS();
    mdsinstance     := select( componentmds, ComponentMDSKinds.ComponentMDSInstances, m, m.MDSID().MDSKey() = ddlMacroPlan.Data().DatasetMDSID() );
    handle          := mdsinstance.GetMDSHandle()
    macroplan       := handle.AsMacroPlan();
    AOnlineAndMOfflinePlanPIR::GenerateData( InterfaceDataset, ddslFactory.Text(), macroplan, dsStartDate.Date(), dsEndDate.Date(), QuintiqUser::CurrentUser().DisplayName() );
    AOnlineAndMOfflinePlanPIR::GenerateData( InterfaceDataset, ddslFactory.Text(), efVersion.Text(), dsStartDate.Date(), dsEndDate.Date(), QuintiqUser::CurrentUser().DisplayName() );
    WebMessageBox::Success( "推送成功!" );
    Form.Close();
  *]