From 5e5a0d4eb60f70b969ece9c6c4cc90d28c2edf55 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期四, 31 十月 2024 16:31:33 +0800
Subject: [PATCH] 修复下发时候无法显示error的问题

---
 _Main/UI/MacroPlannerWebApp/Component_FormDispatchShiftSchedulingInformation/Response_PanelDispatchShiftSchedulingInformation_bDispatch_OnClick.def |   20 ++++++++++++++++----
 _Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_DispatchCC.qbl                                                                        |   24 +++++++++++++++---------
 _Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_DispatchDL.qbl                                                                        |   10 ++--------
 3 files changed, 33 insertions(+), 21 deletions(-)

diff --git a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_DispatchCC.qbl b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_DispatchCC.qbl
index 108d268..965aa8d 100644
--- a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_DispatchCC.qbl
+++ b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_DispatchCC.qbl
@@ -2,13 +2,14 @@
 #parent: #root
 StaticMethod DispatchCC (
   const RecycleBin recycleBin
-) as String
+) as owning JSON
 {
   TextBody:
   [*
     // Akari Oct-28-2024 (created)
     // 鎺ュ彛鍦板潃锛�172.18.1.12/PPPS/AddPlan ---闀挎槬鍦板潃
-    url := "http://172.18.1.12/PPPS/AddPlan";
+    address := "172.18.1.12";
+    url := "/PPPS/AddPlan";
     
     datas := selectset( recycleBin,DispatchShiftSchedulingLine.DispatchShiftSchedulingProduct,object,object.DispatchShiftSchedulingLine().Fac() = "CC" );
     
@@ -35,20 +36,25 @@
       datas_Json.Add( data_Json );
     }
     
-    info( datas_Json.Build().AsString() );
-    
-    i := HTTPInterface::Create( url, 80 );
+    i := HTTPInterface::Create( address, 80 );
     i.URL( url );
     i.PostMethod( true );
     i.MediaType( "application/json" );
     i.TimeOut( Duration::Minutes( 5 ) );
     
-    i.Call( datas_Json.AsString() );
-      
+    resultJson := JSON::Object();
+    resultJson.Add( "jsonStr", datas_Json.Build().AsString() );
+    
+    json := resultJson.Build().AsString();
+    
+    LocalTool::WriteStringToFile( json );
+    
+    i.Call( json );
+    
     htmlresult := i.Result();
-      
+    
     respJSON   := JSON::Parse( htmlresult );
     
-    return respJSON.Get( "Message" ).AsString();
+    return &respJSON;
   *]
 }
diff --git a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_DispatchDL.qbl b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_DispatchDL.qbl
index 67b1d11..21505a4 100644
--- a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_DispatchDL.qbl
+++ b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_DispatchDL.qbl
@@ -2,7 +2,7 @@
 #parent: #root
 StaticMethod DispatchDL (
   const RecycleBin recycleBin
-) as String
+) as owning JSON
 {
   TextBody:
   [*
@@ -55,12 +55,6 @@
     
     respJSON   := JSON::Parse( htmlresult );
     
-    result := respJSON.Get( "State" ).AsString();
-    message := respJSON.Get( "Message" ).AsString();
-    if( result = "Error" ){
-      error( "杩滅▼鏈嶅姟鍣ㄨ繑鍥炰簡涓�涓敊璇細" + message );
-    }
-    
-    return message;
+    return &respJSON;
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDispatchShiftSchedulingInformation/Response_PanelDispatchShiftSchedulingInformation_bDispatch_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormDispatchShiftSchedulingInformation/Response_PanelDispatchShiftSchedulingInformation_bDispatch_OnClick.def
index edcb05d..87cac3a 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormDispatchShiftSchedulingInformation/Response_PanelDispatchShiftSchedulingInformation_bDispatch_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDispatchShiftSchedulingInformation/Response_PanelDispatchShiftSchedulingInformation_bDispatch_OnClick.def
@@ -27,12 +27,24 @@
       factoryNameEnglish := factoryNameEnglish.SubString( 0,factoryNameEnglish.Length() - 1 );
       if( WebMessageBox::Question( Translations::RecycleBin_DispatchShiftSchedulingDispatchCheck( factoryNameChinese,factoryNameEnglish ),Translations::MessageBox_YesNo() ) = 0 ){
         if( cbCC.Checked() ){
-          message := DispatchShiftSchedulingLine::DispatchCC( RecycleBin );
-          WebMessageBox::Information( message );
+          respJSON := DispatchShiftSchedulingLine::DispatchCC( RecycleBin );
+          result := respJSON.Get( "State" ).AsString(); 
+          message := respJSON.Get( "Message" ).AsString();
+          if( result = "Error" ){
+            WebMessageBox::Error( "杩滅▼鏈嶅姟鍣ㄨ繑鍥炰簡涓�涓敊璇細" + message );
+          }else{
+            WebMessageBox::Information( message );
+          }
         }
         if( cbDL.Checked() ){
-          message := DispatchShiftSchedulingLine::DispatchDL( RecycleBin ); 
-          WebMessageBox::Information( message );
+          respJSON := DispatchShiftSchedulingLine::DispatchDL( RecycleBin ); 
+          result := respJSON.Get( "State" ).AsString();
+          message := respJSON.Get( "Message" ).AsString();
+          if( result = "Error" ){
+            WebMessageBox::Error( "杩滅▼鏈嶅姟鍣ㄨ繑鍥炰簡涓�涓敊璇細" + message );
+          }else{
+            WebMessageBox::Information( message );
+          }
         }
         WebMessageBox::Success( "涓嬪彂鎴愬姛" );
       }else{

--
Gitblit v1.9.3