From e5664d694fca1afef7bb4f0f95cfd47f855cadd0 Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期四, 07 十一月 2024 13:18:25 +0800
Subject: [PATCH] 计划库存接口优化

---
 _Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl                          |    2 
 _Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter_PlanInventory.qbl |   51 +++++++++++++++++++++++++
 _Main/BL/Type_InterfaceDataset/StaticMethod_PushPlanInventoryData.qbl                    |   24 +++++++-----
 3 files changed, 66 insertions(+), 11 deletions(-)

diff --git a/_Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl b/_Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl
index ea073a7..668d9a5 100644
--- a/_Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl
+++ b/_Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl
@@ -27,7 +27,7 @@
       AssemblyOnlinePlanPPPSPush::GenerateData( this, macroplan, executor );
     }
     if ( isinventoryplan ) { // 璁″垝搴撳瓨鏁版嵁
-      InterfaceDataset::PushPlanInventoryData( macroplan, this );
+      InterfaceDataset::PushPlanInventoryData( macroplan, this, executor );
     }
   *]
 }
diff --git a/_Main/BL/Type_InterfaceDataset/StaticMethod_PushPlanInventoryData.qbl b/_Main/BL/Type_InterfaceDataset/StaticMethod_PushPlanInventoryData.qbl
index 3853f45..1b91d1c 100644
--- a/_Main/BL/Type_InterfaceDataset/StaticMethod_PushPlanInventoryData.qbl
+++ b/_Main/BL/Type_InterfaceDataset/StaticMethod_PushPlanInventoryData.qbl
@@ -2,7 +2,8 @@
 #parent: #root
 StaticMethod PushPlanInventoryData (
   const MacroPlan macroPlan,
-  InterfaceDataset interfaceDataset
+  InterfaceDataset interfaceDataset,
+  String executor
 )
 {
   Description: '鍙戦�佽鍒掑簱瀛樻暟鎹帴鍙�'
@@ -10,7 +11,7 @@
   [*
     table         := selectobject( interfaceDataset, InventoryPlanArchiveVersion, version, not version.IsShow() );
     
-    interfaceTime := DateTime::ActualTime().Format( "Y-M2-D2 h2:m:s" );
+    interfaceTime := DateTime::ActualTime().Format( "Y-M2-D2 H2:m:s" );
     
     jsonarray     := JSON::Array();
     
@@ -32,14 +33,17 @@
     }
     
     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(  requestbody );
+    
+    loginfo := interfaceDataset.InterfaceLoginfo( relnew, 
+                                                  ExecuteUser       := executor, 
+                                                  Name              := Translations::InterfaceDataset_CustomerDemandPPAIDS_Name(), 
+                                                  InterfaceDateTime := DateTime::ActualTime(), 
+                                                  Message           := "璁″垝搴撳瓨鏁版嵁", 
+                                                  RequestBody       := requestbody );
+    
+    InterfaceLoginfo::CallInterfaceForDataCenter_PlanInventory( interfaceDataset, loginfo );
     //info( '----------------', data.AsString() );
   *]
 }
diff --git a/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter_PlanInventory.qbl b/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter_PlanInventory.qbl
new file mode 100644
index 0000000..d7fc50a
--- /dev/null
+++ b/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter_PlanInventory.qbl
@@ -0,0 +1,51 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CallInterfaceForDataCenter_PlanInventory (
+  InterfaceDataset owner,
+  InterfaceLoginfo loginfo
+) as owning JSON
+{
+  Description: '璋冪敤鏁版嵁涓彴鎺ュ彛銆愯鍒掑簱瀛樸��'
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jul-22-2024 (created)
+    address       := Translations::InterfaceDataset_DataCenter_Address(); 
+    httpinterface := HTTPInterface::Create( address,80);
+    httpinterface.PostMethod( true ); 
+    httpinterface.MediaType( Translations::InterfaceDataset_ContentType() );
+    httpinterface.AddHeader( "clientId", Translations::InterfaceDataset_DataCenter_ClientId() );
+    httpinterface.AddHeader( "clientSecret", Translations::InterfaceDataset_DataCenter_ClientSecret() );
+    try{
+      if( loginfo.Name() = Translations::InterfaceDataset_CustomerDemandPPAIDS_Name() ){//瀹㈡埛闇�姹�
+        httpinterface.URL( Translations::InterfaceDataset_CustomerDemandPPAIDS_URL() );
+      } 
+      httpinterface.Call( loginfo.RequestBody() );
+      result := httpinterface.Result();
+      loginfo.Response( result );
+      loginfo.Success( true );
+    }onerror{
+      loginfo.ReturnMsg( e.GeneralInformation() );
+    }
+    
+    //鍚庣画鍏叡澶勭悊
+    loginfo.FinishTime( DateTime::ActualTime() );
+    data             := JSON::Null().Build();
+    
+    if( loginfo.Success() ){
+      resultJson     := JSON::Parse( loginfo.Response() );
+      code           := resultJson.Get( "code" ).GetNumber();
+      msg            := resultJson.Get( "message" ).GetString();
+      data           := resultJson.Get( "data" );
+      
+      loginfo.ReturnMsg( msg );
+      if( code = 200 ){
+    //    total        := resultJson.Get( "dataSize" ).GetNumber();
+        loginfo.ReturnSuccess( true );
+    //    loginfo.TotalRow( total );
+        loginfo.UpdateLast();
+      }
+    }
+    
+    return &data;
+  *]
+}

--
Gitblit v1.9.3