From 98666fb3add2c1b2529318d1aec463c7360f2be3 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 07 十一月 2024 17:00:11 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev-zlg

---
 _Main/BL/Type_LocalCell_OfflinePlanComparison/StaticMethod_GetColumnXML.qbl                  |   35 ++++++++++-
 _Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl                                  |   28 ++++++---
 _Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl                              |    2 
 _Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter_PlanInventory.qbl     |   48 ++++++++++++++++
 _Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl                                  |   16 ++--
 _Main/BL/Type_InterfaceDataset/StaticMethod_PushPlanInventoryData.qbl                        |   28 +++++---
 _Main/BL/Type_LocalCell_OfflinePlanComparison/_ROOT_Type_LocalCell_OfflinePlanComparison.qbl |    2 
 7 files changed, 124 insertions(+), 35 deletions(-)

diff --git a/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
index 27b05ec..64f8ba1 100644
--- a/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
@@ -60,17 +60,21 @@
         
         // 绌烘枡鏋舵暟閲忥細銆�350bar MQB鏂欐灦鎬绘暟閲� - 鎵�鏈�350bar MQB鎬诲簱瀛� / 鍖呰瀹归噺-瀹㈡埛搴撴枡鏋舵暟閲忋��* 闀挎槬澶栫搴撶┖鏂欐灦姣斾緥
         plannedInventory := sum( macroPlan, Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriod, tempPISPIP,
-                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().IsLeaf()                                                                 and
-                                 exists( tempPISPIP.ProductInStockingPoint_MP().Product_MP(), AllParent.AsParent, tempPMP, tempPMP.ID() =  "鍙戝姩鏈�" )         and
-                                 tempPISPIP.ProductInStockingPoint_MP().StockingPointID()                                               =  "闀挎槬澶栫搴�"       and
-                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().Generation()                                       =  ccerr.Generation() and
-                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().MQBMLB()                                           =  ccerr.MLB_MQB()    and
-                                 tempPISPIP.Start().Date()                                                                              >= ccerc.StartDate()  and
-                                 tempPISPIP.End().Date()                                                                                <= lastDayOfThisMonth,
-                                 tempPISPIP.PlannedInventoryLevelEnd() );
+                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().IsLeaf()                                                                       and
+                                 exists( tempPISPIP.ProductInStockingPoint_MP().Product_MP(), AllParent.AsParent, tempPMP, tempPMP.ID() = "鍙戝姩鏈�" )                and
+                                 //tempPISPIP.ProductInStockingPoint_MP().StockingPointID()                                             = "澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�"  and
+                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().Generation()                                       = ccerr.Generation()        and
+                                 tempPISPIP.ProductInStockingPoint_MP().Product_MP().MQBMLB()                                           = ccerr.MLB_MQB()           and
+                                 tempPISPIP.Start().Date().Year()                                                                       = ccerc.StartDate().Year()  and 
+                                 tempPISPIP.Start().Date().Month()                                                                      = ccerc.StartDate().Month(),
+                                 tempPISPIP.PlannedInventoryLevelEnd() ) / ( ccerc.StartDate().StartOfNextMonth() - ccerc.StartDate() );
         cell.PackagingCapacity( guard( lce.PackagingCapacity(), 1 ) );
         cell.PlannedInventory( plannedInventory );
-        cell.NumberOfEmptyShelves( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - ( plannedInventory / lce.PackagingCapacity() ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ), 0 ) );
+        if ( ccerr.Generation() = "350bar" and ccerr.MLB_MQB() = "MQB" ) {
+          cell.NumberOfEmptyShelves( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - ( plannedInventory / lce.PackagingCapacity() ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ), 0 ) );
+        } else {
+          cell.NumberOfEmptyShelves( [Number] guard( cell.TotalQuantityOfMaterialRacks() - ( plannedInventory / lce.PackagingCapacity() ), 0 ) );
+        }
         
         // 澶栫搴撳叆搴撹垂鐢紙鍙戝姩鏈洪攢閲� / 鍖呰瀹归噺[鍚戜笂鍙栨暣] * 鏂欐灦鍏ュ簱鍗曚环锛�
         engineSales := sum( macroPlan, FSImportData, tempFSID, 
@@ -107,7 +111,11 @@
              
         // 澶栫搴撲粨鍌ㄨ垂鐢細銆�350bar MQB鏂欐灦鎬绘暟閲� - 鎵�鏈�350bar MQB鎬诲簱瀛� / 鍖呰瀹归噺 - 瀹㈡埛搴撴枡鏋舵暟閲忋��* 闀挎槬澶栫搴撶┖鏂欐灦姣斾緥*鏂欐灦浠撳偍鍗曚环銆傚彂鍔ㄦ満搴撳瓨鍙朅ctual inventories閲屽彇鍒伴暱鏄ュ绉熷簱璇ュ彂鍔ㄦ満鐨勪粨鍌ㄩ噺锛屾枡鏋舵�绘暟閲忛渶瑕佹墜鍔ㄧ淮鎶ゃ��
         cell.UnitPriceOfEmptyShelfStorage( lcmr.StoragePrice() );
-        cell.RentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - [Number]( plannedInventory / lce.PackagingCapacity() ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ) * lcmr.StoragePrice(), 0 ) );
+        if ( ccerr.Generation() = "350bar" and ccerr.MLB_MQB() = "MQB" ) {
+          cell.RentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - ceil( plannedInventory / lce.PackagingCapacity() ) - guard( mrcc.Quantity(), 0 ) ) * guard( mrpc.Quantity(), 1 ) * lcmr.StoragePrice() * ( ccerc.StartDate().StartOfNextMonth() - ccerc.StartDate() ), 0 ) );
+        } else {
+          cell.RentalWarehouseStorageFees( [Number] guard( ( cell.TotalQuantityOfMaterialRacks() - ceil( plannedInventory / lce.PackagingCapacity() ) ) * lcmr.StoragePrice()* ( ccerc.StartDate().StartOfNextMonth() - ccerc.StartDate() ), 0 ) );
+        }
         
         // 娓呮礂璐圭敤锛氬彂鍔ㄦ満鍏ュ簱閲� / 鍖呰瀹归噺 * 鏂欐灦娓呮礂鍗曚环銆傚彂鍔ㄦ満鍏ュ簱閲忓彇鍙戝姩鏈洪攢閲忥紝鍖呰瀹归噺鍙栬嚜鍙戝姩鏈烘垚鏈〃銆傛枡鏋舵竻娲楀崟浠峰彇鏂欐灦鎴愭湰琛ㄣ��
         cell.CleaningCost( [Number] ( engineProductions / guard( lce.PackagingCapacity(), 1 ) * lcmr.CleanPrice() ) );
diff --git a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
index 7a0a699..25bb40e 100644
--- a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
@@ -159,19 +159,19 @@
         
         // DL澶栫搴撴竻娲楄垂鐢細鍙戝姩鏈哄叆搴撻噺 / 鍖呰瀹归噺 * 鏂欐灦娓呮礂鍗曚环銆傚彂鍔ㄦ満鍏ュ簱閲忓彇鍙戝姩鏈洪攢閲忥紝鍖呰瀹归噺鍙栬嚜鍙戝姩鏈烘垚鏈〃銆傛枡鏋舵竻娲楀崟浠峰彇鏂欐灦鎴愭湰琛ㄣ��
         cell.CleaningCost( [Number] ( guard( outboundQuantity / lce.PackagingCapacity(), 0 ) * guard( lcmrDL.CleanPrice(), 1 ) ) );
-        
-        // 棰勮鎬昏垂鐢�
-        cell.EstimatedTotalCost( cell.CCStorageFeesForRentedWarehouses() + cell.CCOutboundExpensesForRentedWarehouses() + cell.CCRentalWarehouseStorageFees() + cell.CCLineHaulCost() + 
-                                 cell.CCShortDistanceTransportationCosts() + cell.DLStorageFeesForRentedWarehouses() + cell.DLOutboundExpensesForRentedWarehouses() +
-                                 cell.DLExternalRentalWarehouseTransportationCosts() + cell.DLRentalWarehouseStorageFees() + cell.CleaningCost() );
-        
+          
         // 澶ц繛澶栫搴撴枡鏋惰垂鐢�
         cell.DLRentalWarehouseMaterialRackCost( cell.DLStorageFeesForRentedWarehouses() + cell.DLOutboundExpensesForRentedWarehouses() +
-                                                cell.DLExternalRentalWarehouseTransportationCosts() );
+                                                cell.DLExternalRentalWarehouseTransportationCosts() + cell.DLRentalWarehouseStorageFees() + cell.CleaningCost() );
         
         // CC澶栫搴揇L鏂欐灦璐圭敤
         cell.CCExternalRentalWarehouseDLMaterialRackCost( cell.CCStorageFeesForRentedWarehouses() + cell.CCOutboundExpensesForRentedWarehouses() +
-                                                          cell.CCRentalWarehouseStorageFees() + cell.CCShortDistanceTransportationCosts() );
+                                                          cell.CCShortDistanceTransportationCosts() + cell.CCCleaningCost() );
+        
+        // 棰勮鎬昏垂鐢�
+        cell.EstimatedTotalCost( cell.CCStorageFeesForRentedWarehouses() + cell.CCOutboundExpensesForRentedWarehouses() + cell.CCLineHaulCost() + cell.CCCleaningCost() +
+                                 cell.CCShortDistanceTransportationCosts() + cell.DLStorageFeesForRentedWarehouses() + cell.DLOutboundExpensesForRentedWarehouses() +
+                                 cell.DLExternalRentalWarehouseTransportationCosts() + cell.DLRentalWarehouseStorageFees() + cell.CleaningCost() );
         
         // 绯绘暟
         cell.Coefficient( 1.05 );
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..4503d47 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,8 @@
   [*
     table         := selectobject( interfaceDataset, InventoryPlanArchiveVersion, version, not version.IsShow() );
     
-    interfaceTime := DateTime::ActualTime().Format( "Y-M2-D2 h2:m:s" );
+    totalRow      := 0;
+    interfaceTime := DateTime::ActualTime().Format( "Y-M2-D2 H2:m:s" );
     
     jsonarray     := JSON::Array();
     
@@ -27,19 +29,23 @@
                                    .Add( "fac", ifexpr( r.Unit().Regex( "CC" ), "CC", "DL" ) )
                                    .Add( "interfaceTime", interfaceTime ).Build();
           jsonarray.Add( idsjson );
+          totalRow++;
         }
       }
     }
     
     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() );
+    
+    //info(  requestbody );
+    
+    loginfo := interfaceDataset.InterfaceLoginfo( relnew, 
+                                                  ExecuteUser       := executor, 
+                                                  Name              := "Plan inventory data", 
+                                                  InterfaceDateTime := DateTime::ActualTime(), 
+                                                  Message           := "璁″垝搴撳瓨鏁版嵁", 
+                                                  RequestBody       := requestbody,
+                                                  TotalRow          := totalRow );
+    
+    InterfaceLoginfo::CallInterfaceForDataCenter_PlanInventory( interfaceDataset, loginfo );
   *]
 }
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..47b93de
--- /dev/null
+++ b/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter_PlanInventory.qbl
@@ -0,0 +1,48 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CallInterfaceForDataCenter_PlanInventory (
+  InterfaceDataset owner,
+  InterfaceLoginfo loginfo
+)
+{
+  Description: '璋冪敤鏁版嵁涓彴鎺ュ彛銆愯鍒掑簱瀛樸��'
+  TextBody:
+  [*
+    address       := Translations::InterfaceDataset_DataCenter_Address(); 
+    
+    httpinterface := HTTPInterface::Create( address,80 );
+    
+    httpinterface.PostMethod( true ); 
+    httpinterface.URL( "/api/plan-stock/saveList" );
+    httpinterface.MediaType( Translations::InterfaceDataset_ContentType() );
+    httpinterface.AddHeader( "clientId", Translations::InterfaceDataset_DataCenter_ClientId() );
+    httpinterface.AddHeader( "clientSecret", Translations::InterfaceDataset_DataCenter_ClientSecret() );
+    
+    try {
+      httpinterface.Call( loginfo.RequestBody() );
+      
+      result := httpinterface.Result();
+      
+      loginfo.Response( result );
+      loginfo.Success( true );
+    } onerror { 
+      loginfo.ReturnMsg( e.GeneralInformation() );
+    }
+    
+    // 鍚庣画鍏叡澶勭悊
+    loginfo.FinishTime( DateTime::ActualTime() );
+    
+    if ( loginfo.Success() ) {
+      resultJson := JSON::Parse( loginfo.Response() );
+      code       := resultJson.Get( "code" ).GetNumber();
+      msg        := resultJson.Get( "message" ).GetString();
+      
+      loginfo.ReturnMsg( msg );
+      
+      if ( code = 200 ) {
+        loginfo.ReturnSuccess( true );
+        loginfo.UpdateLast();
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_LocalCell_OfflinePlanComparison/StaticMethod_GetColumnXML.qbl b/_Main/BL/Type_LocalCell_OfflinePlanComparison/StaticMethod_GetColumnXML.qbl
index 1de038a..04b7d69 100644
--- a/_Main/BL/Type_LocalCell_OfflinePlanComparison/StaticMethod_GetColumnXML.qbl
+++ b/_Main/BL/Type_LocalCell_OfflinePlanComparison/StaticMethod_GetColumnXML.qbl
@@ -32,9 +32,9 @@
     }
     if( type = "attribute" ){
     //  columnXML0_1 := "<column><name>Sales Segment</name><type>String</type>";
-    //  columnXML0_2 := "<column><name>Generation</name><type>String</type>";
-    //  columnXML0_3 := "<column><name>MQB/MLB</name><type>String</type>";
-    //  columnXML0_4 := "<column><name>鍔熺巼</name><type>String</type>";
+      columnXML0_2 := "<column><name>Generation</name><type>String</type>";
+      columnXML0_3 := "<column><name>MQB/MLB</name><type>String</type>";
+      columnXML0_4 := "<column><name>鍔熺巼</name><type>String</type>";
       
       columnXML1 := "<column><name>Line</name><type>String</type>";
       columnXML2 := "<column><name>Attribute</name><type>String</type>";
@@ -46,16 +46,43 @@
             cellXML := '<cell value="' + cell.LocalRow().Name() + '"/>'
             columnXML1 := columnXML1 + cellXML;
             
+            product := select( macroPlan,Product_MP,product,product.ID() = cell.LocalRow().ProductID() );
+            if( not isnull( product )){
+              cellXML0_2 := '<cell value="' + product.Generation() + '"/>';
+              cellXML0_3 := '<cell value="' + product.MQBMLB() + '"/>';
+              cellXML0_4 := '<cell value="' + product.Power() + '"/>';
+              columnXML0_2 := columnXML0_2 + cellXML0_2;
+              columnXML0_3 := columnXML0_3 + cellXML0_3;
+              columnXML0_4 := columnXML0_4 + cellXML0_4;
+            }else{
+              cellXML0_2 := '<cell value="  "/>';
+              cellXML0_3 := '<cell value="  "/>';
+              cellXML0_4 := '<cell value="  "/>';
+              columnXML0_2 := columnXML0_2 + cellXML0_2;
+              columnXML0_3 := columnXML0_3 + cellXML0_3;
+              columnXML0_4 := columnXML0_4 + cellXML0_4;
+            }
+            
             flag := false;
           }else{
             cellXML := '<cell value="  "/>'
             columnXML1 := columnXML1 + cellXML;
+            
+    //        cellXML0_1 := '<cell value="  "/>'
+    //        columnXML0_1 := columnXML0_1 + cellXML0_1;
+            
+            cellXML0_2 := '<cell value="  "/>';
+            cellXML0_3 := '<cell value="  "/>';
+            cellXML0_4 := '<cell value="  "/>';
+            columnXML0_2 := columnXML0_2 + cellXML0_2;
+            columnXML0_3 := columnXML0_3 + cellXML0_3;
+            columnXML0_4 := columnXML0_4 + cellXML0_4;
           }
           cellXML := '<cell value="' + e + '"/>'
           columnXML2 := columnXML2 + cellXML;
         }
       }
-      columnXML := columnXML1 + "</column>" + columnXML2 + "</column>";
+      columnXML := columnXML1 + "</column>" + columnXML0_2 + "</column>" + columnXML0_3 + "</column>" + columnXML0_4 + "</column>" + columnXML2 + "</column>";
     }
      
     return columnXML;
diff --git a/_Main/BL/Type_LocalCell_OfflinePlanComparison/_ROOT_Type_LocalCell_OfflinePlanComparison.qbl b/_Main/BL/Type_LocalCell_OfflinePlanComparison/_ROOT_Type_LocalCell_OfflinePlanComparison.qbl
index fa2e66e..699139a 100644
--- a/_Main/BL/Type_LocalCell_OfflinePlanComparison/_ROOT_Type_LocalCell_OfflinePlanComparison.qbl
+++ b/_Main/BL/Type_LocalCell_OfflinePlanComparison/_ROOT_Type_LocalCell_OfflinePlanComparison.qbl
@@ -4,7 +4,7 @@
 TypeSpecialization LocalCell_OfflinePlanComparison
 {
   #keys: '2[412672.1.76654683][412672.1.76654682]'
-  Description: '涓嬬嚎璁″垝瀵规瘮鎶ヨ〃'
+  Description: '涓嬬嚎璁″垝瀵规瘮鎶ヨ〃_鐢熶骇璁″垝鍙樻洿'
   Parent: LocalCell
   StructuredName: 'LocalCell_OfflinePlanComparisons'
 }

--
Gitblit v1.9.3