From 9b3d8a44e8a76928b1abf2f18a74ef5051a4b089 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期三, 21 八月 2024 14:32:24 +0800
Subject: [PATCH] 客户需求(PPA+IDS)日志添加

---
 _Main/BL/Type_InterfaceLoginfo/DefaultValue_IsShow.qbl                                              |    7 +++
 _Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl                                    |   42 ++++++++++++++++-----
 _Main/BL/Type_InterfaceLoginfo/Attribute_IsShow.qbl                                                 |    8 ++++
 _Main/BL/Relations/Relation_CustomerDemandPPAIDS_InterfaceLoginfo_InterfaceLoginfo_CustomerDema.qbl |   23 +++++++++++
 _Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def                    |    2 
 5 files changed, 71 insertions(+), 11 deletions(-)

diff --git a/_Main/BL/Relations/Relation_CustomerDemandPPAIDS_InterfaceLoginfo_InterfaceLoginfo_CustomerDema.qbl b/_Main/BL/Relations/Relation_CustomerDemandPPAIDS_InterfaceLoginfo_InterfaceLoginfo_CustomerDema.qbl
new file mode 100644
index 0000000..f1944f5
--- /dev/null
+++ b/_Main/BL/Relations/Relation_CustomerDemandPPAIDS_InterfaceLoginfo_InterfaceLoginfo_CustomerDema.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation CustomerDemandPPAIDS_InterfaceLoginfo_InterfaceLoginfo_CustomerDemandPPAIDS
+{
+  #keys: '1[415136.0.1027064726]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide InterfaceLoginfo
+  {
+    #keys: '3[415136.0.1027064728][415136.0.1027064727][415136.0.1027064729]'
+    Cardinality: '0to1'
+    ObjectDefinition: CustomerDemandPPAIDS
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide CustomerDemandPPAIDS
+  {
+    #keys: '3[415136.0.1027064731][415136.0.1027064730][415136.0.1027064732]'
+    Cardinality: '1toN'
+    ObjectDefinition: InterfaceLoginfo
+    OwningSide: 'Reference'
+  }
+}
diff --git a/_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl b/_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl
index afb4b46..e61e4bd 100644
--- a/_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl
+++ b/_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl
@@ -3,6 +3,7 @@
 StaticMethod GenerateData (
   const MacroPlan macroplan,
   InterfaceDataset interfaceDataset,
+  String executor,
   Boolean versionflag
 )
 {
@@ -10,16 +11,37 @@
   TextBody:
   [*
     // 鐢勫叞楦� Aug-20-2024 (created)
-    interfaceDataset.CustomerDemandPPAIDS( relflush );
-    nowdate                     := DateTime::ActualTime();
-    traverse( macroplan, SalesDemand.astype( Forecast ), forecast ){
-      interfaceDataset.CustomerDemandPPAIDS( relnew, Product           := forecast.ProductID()
-                                             , DemandDate              := forecast.StartDate()
-                                             , DemandQty               := [Number]forecast.Quantity()
-                                             , VersionName             := macroplan.ScenarioName()
-                                             , InterfaceTime           := nowdate
-                                             , VersionFlag             := versionflag
-                                             );
+    cdlast                 := maxobject( interfaceDataset, CustomerDemandPPAIDS, cd, cd.InterfaceTime(), cd.DemandDate(), cd.Product() );
+    if( not isnull( cdlast ) ){
+      loginfo              := cdlast.InterfaceLoginfo();
+      if( not loginfo.IsShow() ){
+        loginfo.Delete();
+      }else{
+        loginfo.Last( false );
+      }
+      interfaceDataset.CustomerDemandPPAIDS( relflush );
     }
+    nowdate                := DateTime::ActualTime();
+    loginfo                := interfaceDataset.InterfaceLoginfo( relnew, ExecuteUser := executor
+                                                                 , Name := Translations::InterfaceDataset_CustomerDemandPPAIDS_Name()
+                                                                 , InterfaceDateTime := DateTime::ActualTime()
+                                                                 , Message := '瀹㈡埛闇�姹傦紙PPA+IDS锛夋暟鎹帹閫�'
+                                                                 , IsShow := false
+                                                                 , Last := true
+                                                                 , ReturnSuccess := true
+                                                                 , ReturnMsg := 'Success'
+                                                                 , Success := true
+                                                                  );
+    traverse( macroplan, SalesDemand.astype( Forecast ), forecast ){
+      cd                  :=interfaceDataset.CustomerDemandPPAIDS( relnew, Product           := forecast.ProductID()
+                                                                   , DemandDate              := forecast.StartDate()
+                                                                   , DemandQty               := [Number]forecast.Quantity()
+                                                                   , VersionName             := macroplan.ScenarioName()
+                                                                   , InterfaceTime           := nowdate
+                                                                   , VersionFlag             := versionflag
+                                                                   );
+      loginfo.CustomerDemandPPAIDS( relinsert, cd );
+    }
+    loginfo.TotalRow( loginfo.CustomerDemandPPAIDS( relsize ) );
   *]
 }
diff --git a/_Main/BL/Type_InterfaceLoginfo/Attribute_IsShow.qbl b/_Main/BL/Type_InterfaceLoginfo/Attribute_IsShow.qbl
new file mode 100644
index 0000000..60952d7
--- /dev/null
+++ b/_Main/BL/Type_InterfaceLoginfo/Attribute_IsShow.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsShow
+{
+  #keys: '3[415136.0.1027064712][415136.0.1027064711][415136.0.1027064713]'
+  Description: '鏄惁鏄剧ず'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_InterfaceLoginfo/DefaultValue_IsShow.qbl b/_Main/BL/Type_InterfaceLoginfo/DefaultValue_IsShow.qbl
new file mode 100644
index 0000000..8bd79cf
--- /dev/null
+++ b/_Main/BL/Type_InterfaceLoginfo/DefaultValue_IsShow.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+DefaultValue
+{
+  ISOValue: 'true'
+  TargetAttribute: IsShow
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def
index 234e7ba..4cbb8f8 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def
@@ -9,7 +9,7 @@
     Form.ApplyChanges();
     
     if( efInterfacename.Text() = Translations::InterfaceDataset_CustomerDemandPPAIDS_Name() ){
-      CustomerDemandPPAIDS::GenerateData( MacroPlan, InterfaceDataset, ifexpr( rbgVersionFlag.BoundValue() = "true", true, false ) );
+      CustomerDemandPPAIDS::GenerateData( MacroPlan, InterfaceDataset, QuintiqUser::CurrentUser().DisplayName(), ifexpr( rbgVersionFlag.BoundValue() = "true", true, false ) );
     }
     
     Form.Close();

--
Gitblit v1.9.3