lazhen
2024-11-06 0afdd1bc9376b24ba8722b77d92e28a38862c7a5
装配上线计划数据中台推送接口
已添加3个文件
已修改6个文件
123 ■■■■ 文件已修改
_Main/BL/Type_AssemblyOnlinePlanCell0/Attribute_Order.qbl 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanCell0/DefaultValue_Order.qbl 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanPush/StaticMethod_GenerateData.qbl 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanPush/StaticMethod_Publish.qbl 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/Method_Generate.qbl 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_RefreshData.qbl 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_Publish.qbl 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_AssemblyOnlinePlanCell0/Attribute_Order.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
Quintiq file version 2.0
#parent: #root
Attribute Order
{
  #keys: '3[415136.0.1280830135][415136.0.1280830134][415136.0.1280830136]'
  Description: '生产顺序(String)'
  ValueType: String
}
_Main/BL/Type_AssemblyOnlinePlanCell0/DefaultValue_Order.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,6 @@
Quintiq file version 2.0
#parent: #root
DefaultValue
{
  TargetAttribute: Order
}
_Main/BL/Type_AssemblyOnlinePlanPush/StaticMethod_GenerateData.qbl
@@ -1,10 +1,9 @@
Quintiq file version 2.0
#parent: #root
StaticMethod GenerateData (
  const MacroPlan macroplan,
  InterfaceDataset interfaceDataset,
  String executor,
  Boolean versionflag
  const MacroPlan macroplan,
  String executor
)
{
  Description: '生成可以下发的客户需求(PPA+IDS)数据'
@@ -25,32 +24,28 @@
                                                                 , Name := Translations::InterfaceDataset_AssemblyOnlinePlanPPPSPush_Name()
                                                                 , InterfaceDateTime := nowdate
                                                                 , Message := '装配上线计划-PPPS传输至数据中台(包含排序)/SAP(不包含排序)'
                                                                 , IsShow := false
                                                                 , Last := true
                                                                 , ReturnSuccess := true
                                                                 , ReturnMsg := 'Success'
                                                                 , Success := true
                                                                  );
    traverse( macroplan, AssemblyOnlinePlanColumn, column ){
      traverse( column, AssemblyOnlinePlanCell, cell, cell.Value() <> '' and cell.AssemblyOnlinePlanRow().Type() = '1' ){
        quantityrow        := cell.AssemblyOnlinePlanRow();
        ordercell          := selectobject( column, AssemblyOnlinePlanCell, ocell, ocell.AssemblyOnlinePlanRow().ProductID() = quantityrow.ProductID()
                                            and ocell.AssemblyOnlinePlanRow().ProductionLine() = quantityrow.ProductionLine()
                                            and ocell.AssemblyOnlinePlanRow().Type() = '2' );
        product            := selectobject( macroplan, Product_MP, product, product.ID() = quantityrow.ProductID() );
        cd                  :=interfaceDataset.AssemblyOnlinePlanPPPSPush( relnew, Product           := product.ID()
                                                                           , PlanningDate            := column.ColumnDate()
                                                                           , PlanningQty             := [Number]cell.Value()
                                                                           , Sequence                := ordercell.Value()
    traverse( interfaceDataset, AssemblyOnlinePlanVersion, verison, not verison.IsShow() ){
      traverse( verison, Column, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() ){
        traverse( column, Cell, cell ){
          row              := cell.Row();
          cd               :=interfaceDataset.AssemblyOnlinePlanPPPSPush( relnew, Product            := row.ProductID()
                                                                           , PlanningDate            := column.StartDate()
                                                                           , PlanningQty             := [Number]cell.Quantity()
                                                                           , Sequence                := cell.Order()
                                                                           , VersionName             := macroplan.ScenarioName()
                                                                           , InterfaceTime           := nowdate
                                                                           , VersionFlag             := versionflag
                                                                           , ProductFourCode         := product.Notes()
                                                                           , FactoryName             := row.Unit()
                                                                          , Fac                     := ifexpr( row.Unit() = FinancialProductionReport::GetDefaultCCUnit(), 'CC', 'DL' )
    //                                                                       , VersionFlag             := versionflag
                                                                           , ProductFourCode         := ifexpr( row.ProductID() = row.Name(), '', row.Name() )
                                                                           );
        loginfo.AssemblyOnlinePlanPPPSPush( relinsert, cd );
      }
    }
    }
    loginfo.TotalRow( loginfo.AssemblyOnlinePlanPPPSPush( relsize ) );
    AssemblyOnlinePlanPPPSPush::Publish( interfaceDataset, loginfo );
  *]
}
_Main/BL/Type_AssemblyOnlinePlanPush/StaticMethod_Publish.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
Quintiq file version 2.0
#parent: #root
StaticMethod Publish (
  InterfaceDataset owner,
  InterfaceLoginfo loginfo
)
{
  TextBody:
  [*
    //// ç”„兰鸽 Jul-17-2024 (created)
    jsonarray          := JSON::Array();
    traverse( owner, AssemblyOnlinePlanPPPSPush, aopdata ){
      aopdatajson      := JSON::Object().Add( "product", aopdata.Product() ).Add( "planningDate", aopdata.PlanningDate().Format( 'Y-M2-D2' ) )//"2024-10-01" )
                                    .Add( "planningQty", aopdata.PlanningQty() )
                                    .Add( "sequence", aopdata.Sequence() )
                                    .Add( "factoryName", aopdata.FactoryName() )
                                    .Add( "fac", aopdata.Fac() )
                                    .Add( "versionName", aopdata.VersionName() )
                                    .Add( "interfaceTime", aopdata.InterfaceTime().Format( 'Y-M2-D2 H:m:s' ) ).Build();/*"2024-10-01 12:00:00" )*/
      jsonarray.Add( aopdatajson );
    }
    requestbody := jsonarray.Build().AsString();
    info(  requestbody );
    data     := InterfaceLoginfo::CallInterfaceForDataCenter( owner, loginfo );
    info( '----------------', data.AsString() );
  *]
}
_Main/BL/Type_AssemblyOnlinePlanVersion/Method_Generate.qbl
@@ -7,6 +7,7 @@
  TextBody:
  [*
    // ç”„兰鸽 Jun-25-2024 (created)
    info( '-----------Search start-------' );
    table                   := selectobject( this,InterfaceDataset.AssemblyOnlinePlanVersion, report, not report.IsShow() );
    //清空之前存储的显示数据
    aopcolumns              := selectuniquevalues(  table, Column, aopcolumn, aopcolumn.TimeUnit() = search.TimeUnit() and aopcolumn.StartDate() >= search.StartDate() and aopcolumn.StartDate() <= search.EndDate(), aopcolumn.StartDate() );
@@ -31,5 +32,6 @@
        }
      }
    }
    info( '-----------Search end-------' );
  *]
}
_Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_RefreshData.qbl
@@ -24,15 +24,11 @@
    table.GenerateColumn( aopcolumns, false );
    traverse( macroPlan, NewAssemblyOnlinePlanRow, aoprow, aoprow.Type() = '1' ){
      row                  := table.GetRow( aoprow );
      info( '------------------------', row.Type() );
      traverse( aoprow, NewAssemblyOnlinePlanCell, aopcell ){
        column             := selectobject( table, Column, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.StartDate() = aopcell.NewAssemblyOnlinePlanColumn().StartDate() );
        cell               := selectobject( row, Cell, cell, cell.Column() = column );
        cell.InventoryWeight( aopcell.InventoryWeight() );
    //    cell.ProductionSerialNumber( aopcell.ProductionSerialNumber() );
    //    cell.InventoryWeight( aopcell.InventoryWeight() );
        cell.Quantity( aopcell.Quantity() );
    //    cell.Shift( aopcell.Shift() );
    //    cell.Value( aopcell.Value() );
      }
    }
    showtable.Generate( search );
_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl
@@ -25,10 +25,6 @@
                                                                 , InterfaceDateTime         := nowdate
                                                                 , Message                   := '客户需求(PPA+IDS)数据推送'
                                                                 , Last                      := true
                                                                 , IsShow                    := false
                                                                 , ReturnSuccess             := true
                                                                 , ReturnMsg                 := 'Success'
                                                                 , Success                   := true
                                                                  );
    traverse( interfaceDataset, CustomerDemandIDS.Row, row ){
      traverse( row, Cell, cell ){
@@ -37,11 +33,14 @@
                                                                     , DemandQty               := [Number]cell.Value()
                                                                     , VersionName             := macroplan.ScenarioName()
                                                                     , InterfaceTime           := nowdate
                                                                     , FactoryName             := row.Factory()
                                                                     , Fac                     := ifexpr( row.Factory() = FinancialProductionReport::GetDefaultCCUnit(), 'CC', 'DL' )
    //                                                                 , VersionFlag             := versionflag
                                                                     );
        loginfo.CustomerDemandPPAIDS( relinsert, cd );
      }
    }
    loginfo.TotalRow( loginfo.CustomerDemandPPAIDS( relsize ) );
    CustomerDemandPPAIDS::Publish( interfaceDataset, loginfo );
  *]
}
_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_Publish.qbl
@@ -2,7 +2,7 @@
#parent: #root
StaticMethod Publish (
  InterfaceDataset owner,
  String executor
  InterfaceLoginfo loginfo
)
{
  TextBody:
@@ -16,35 +16,9 @@
                                    .Add( "interfaceTime", ids.InterfaceTime().Format( 'Y-M2-D2 H:m:s' ) ).Build();/*"2024-10-01 12:00:00" )*/
      jsonarray.Add( idsjson );
    }
    //jsonarray := JSON::Array().Add( JSON::Object().Add( "product", "DZ948293" )
    //                                 ).Build();
    requestbody := jsonarray.Build().AsString();
    info(  requestbody );
    loginfo := owner.InterfaceLoginfo( relnew, ExecuteUser := executor
                                       , Name := Translations::InterfaceDataset_CustomerDemandPPAIDS_Name()
                                       , InterfaceDateTime := DateTime::ActualTime()
                                       , Message := '客户需求(PPA+IDS)'
                                       , RequestBody := requestbody);
    //error( '--------------------', requestbody );
    data     := InterfaceLoginfo::CallInterfaceForDataCenter( owner, loginfo );
    info( '----------------', data.AsString() );
    //if( not isnull( data ) ){
    //
    //  cnv2 := StringToDate::StandardConverter();
    //  cnv2.SetCustomConversion();
    //  cnv2.CustomFormatString( 'yyyy-MM-dd' );
    //
    //  sadatalist := construct( FinishedEngineInventorys );
    //  for( seq := 0;seq < data.Size();seq++){
    //    item := data.Get(seq);
    //    sadata := FinishedEngineInventory::GenerateData( loginfo, cnv2, item );
    //    sadatalist.Add( sadata );
    //  }
    //
    //  options := DatasetFindOptions::Construct( 'MacroPlan' ).IncludeOffline( true ); //to load we must search offline datasets.
    //  mdskey := DatasetController::FindUnique( options );
    //
    //  MDSMacroPlan::Root( mdskey ) -> InventoryInterfaceData::SynchronizeInventory( owner, sadatalist );
    //}
  *]
}
_Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl
@@ -24,7 +24,7 @@
    //  CustomerDemandIDS::GenerateData( this, recyclebin, archive );
    }
    if( isassembleonlineplan ){//装配上线计划
    //  AssemblyOnlinePlanVersion::RefreshData( this, macroplan );
      AssemblyOnlinePlanPPPSPush::GenerateData( this, macroplan, executor );
    }
    if( isinventoryplan ){//库存计划
    //  CustomerDemandIDS::GenerateData( this, recyclebin, archive );