From 769152ad8cd980ac8ef70e3ba2868cb9f6446738 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期四, 14 十一月 2024 11:07:41 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev

---
 _Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl     |    2 +-
 _Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl       |    6 +++---
 _Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl |   38 +++++++++++++++++++-------------------
 _Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl         |   12 ++++++------
 4 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
index 92fdf14..6c8de34 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
@@ -106,7 +106,7 @@
               row            := table.GetRow( producttrip );
               product        := selectobject( owner, Product_MP, product, product.ID() = producttrip );
               products.Add( product );
-              quantity       := sum( alltrips, Elements.ProductInTrip, pit, pit.Product_MP() = product, pit.Quantity() );
+              quantity       := sum( alltrips, Elements.ProductInTrip, pit, pit.Product_MP() = product, floor( pit.Quantity() ) );
               enginecost     := selectobject( enginecosts, Elements, engine, engine.Generation().ToLower() = product.Generation().ToLower() and engine.MLB_MQB() = product.MQBMLB() and engine.Factory() = ccfactory );
               //鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
               transcost      := selectobject( transcosts, Elements, trans, trans.Origin() = 'CC 鍘傚唴搴�' and trans.Destination() = ccrent and exists( product.GetAllParent(), Elements, e, ifexpr( trans.Product().FindString( '鍙戝姩鏈�', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
index 85c9da7..7d6e205 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
@@ -40,48 +40,48 @@
             enginecosts       := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower() and engine.MLB_MQB() = product.MQBMLB() );
             transcosts        := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '鍙戝姩鏈�', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
             if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
-              products.Add( pisp.Product_MP() );
-              traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear 
-                        and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) ){
-                periodtime    := pispip.Start().StartOfMonth().Date();
-                periodname    := periodtime.Format( "M2/D2/Y" );
-                column        := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
+              traverse( table, Column, column ){
+                pispips       := selectset( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start().Date() >= column.StartDate() 
+                                            and pispip.Start().Date() < column.StartDate().StartOfNextMonth() 
+                                            and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) );
                 cell          := selectobject( row, Cell, cell, cell.Column() = column );
-                
+                newsupplyqty  := sum( pispips, Elements, pispip, pispip.NewSupplyQuantity() );
+                plannedinvqty := sum( pispips, Elements, pispip, pispip.PlannedInventoryLevelEnd() );
                 if( isdltoccrent){
                   //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
-                  enginecost  := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date()
+                  enginecost  := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate()  and engine.EndDate() >= column.StartDate() 
                                                      and engine.Factory() = ccfactory );
-                  cell.CCRentQty( cell.CCRentQty() + pispip.NewSupplyQuantity() );
+                  cell.CCRentQty( cell.CCRentQty() + newsupplyqty );
                   //闀挎槬澶栫搴撳叆搴撹垂鐢細鍏ュ簱閲�/鍖呰瀹归噺*鍏ュ簱鍗曚环 
-                  entercost   := ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
+                  entercost   := ceil( newsupplyqty / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
                   //闀挎槬澶栫搴撳嚭搴撹垂鐢�: 鍑哄簱閲�/鍖呰瀹归噺*鍑哄簱鍗曚环
-                  outcost     := ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
+                  outcost     := ceil( newsupplyqty / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
                   cell.CCRentInCost( cell.CCRentInCost() + entercost );
                   cell.CCRentOutOfCost( cell.CCRentOutOfCost() + outcost );
-                  cost        := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
+                  cost        := ceil( plannedinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
                   cell.CCRentStorCost( cell.CCRentStorCost() + cost );//闀挎槬澶栫搴撲粨鍌ㄨ垂鐢�
                   transcost   := selectobject( transcosts, Elements, trans, trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() and trans.Origin() = '闀挎槬澶栫搴�' and trans.Destination() = '瀹㈡埛搴�' );
                   if( not isnull( transcost ) ){
-                    cost      := ceil( ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
+                    cost      := ceil( ceil( newsupplyqty / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
                     cell.CCShorTransCost( cell.CCShorTransCost() + cost );//闀挎槬鐭�旇繍杈撹垂鐢�
                   }
                 } else {
                   //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
-                  enginecost  := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date()
+                  enginecost  := selectobject( enginecosts, Elements, engine, engine.StartDate() <= column.StartDate()  and engine.EndDate() >= column.StartDate() 
                                                      and engine.Factory() = dlfactory  );
                   if( not isnull( enginecost ) ){
-                    cost      := ceil( pispip.PlannedInventoryLevelEnd() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
+                    cost      := ceil( plannedinvqty / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
                     cell.DLRentStorCost( cell.DLRentStorCost() + cost );//澶ц繛澶栫搴撲粨鍌ㄨ垂鐢�
-                    row.SetDLRentEnterCost( column, enginecost, pispip.NewSupplyQuantity() );//澶ц繛澶栫搴撳叆搴撹垂鐢�
-                    transcost := selectobject( transcosts, Elements, trans, trans.StartDate() <= pispip.Start().Date() and trans.EndDate() >= pispip.Start().Date() and trans.Origin() = '澶ц繛鍘傚唴搴�' and trans.Destination() = '澶ц繛澶栫搴�' );
+                    row.SetDLRentEnterCost( column, enginecost, newsupplyqty );//澶ц繛澶栫搴撳叆搴撹垂鐢�
+                    transcost := selectobject( transcosts, Elements, trans, trans.StartDate() <= column.StartDate() and trans.EndDate() >= column.StartDate() and trans.Origin() = '澶ц繛鍘傚唴搴�' and trans.Destination() = '澶ц繛澶栫搴�' );
                     if( not isnull( transcost ) ){
-                      cost    := ceil( ceil( pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
+                      cost    := ceil( ceil( newsupplyqty / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
                       row.SetFactoryToRentTransCost( column, cost );
                     }
                   }
                 }
-              }   
+              }
+              products.Add( pisp.Product_MP() );
             }
           }
         }
diff --git a/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl b/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl
index 31b5a4b..eb8bc0a 100644
--- a/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl
@@ -35,13 +35,13 @@
           //褰損roduct planning鐨勬棩鏈熷尯闂村湪闇�瑕佺殑鏃ユ湡鍖洪棿鍐� 
           traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and ( pispip.Start() + Duration::Days( 1 ) ).Date() < startofnextyear and pispip.NewSupplyQuantity() <> 0 ){
             dayperiodtime     := ( pispip.Start() + Duration::Days( 1 ) ).Date();
-            dayperiodname     := dayperiodtime.Format( "M2/D2/Y" );
+    //        dayperiodname     := dayperiodtime.Format( "M2/D2/Y" );
             periodtime        := dayperiodtime.StartOfMonth();
             periodname        := periodtime.Format( "M2/D2/Y" );
     //        quantity          := [Number]pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
-            daycolumn         := selectobject( table, FinancialProductionColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime );
+    //        daycolumn         := selectobject( table, FinancialProductionColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime );
             column            := selectobject( table, FinancialProductionColumn, column, column.Name() = periodname and column.Period() = periodtime );
-            factoryrow.Initialize( daycolumn, pispip.NewSupplyQuantity() );
+    //        factoryrow.Initialize( daycolumn, pispip.NewSupplyQuantity() );
             factoryrow.Initialize( column, pispip.NewSupplyQuantity() );
     //        allrow.Initialize( column, pispip.NewSupplyQuantity() );
           }    
diff --git a/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl b/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl
index 5b6933e..2e312c9 100644
--- a/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl
+++ b/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl
@@ -52,17 +52,17 @@
         productids.Add( forecast.ProductID() );
         traverse( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() <> 0 and ( psdip.StartDate() + Duration::Days( 1 ) ).Date() < startofnextyear ){
           dayperiodtime      := ( psdip.StartDate() + Duration::Days( 1 ) ).Date();//psdip.StartDate();
-          dayperiodname      := dayperiodtime.Format( "M2/D2/Y" );
+    //      dayperiodname      := dayperiodtime.Format( "M2/D2/Y" );
           periodtime         := dayperiodtime.StartOfMonth();
           periodname         := periodtime.Format( "M2/D2/Y" );
     //      info( '-------------------------', periodname, periodtime );
-          daycolumn          := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime );
+    //      daycolumn          := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime );
           column             := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime );
     //      info( '-------------------------', column.Name() );
           quantity   := [Number]psdip.Quantity();//鍥涜垗浜斿叆
           
           factoryrow.Initialize( column, quantity );
-          factoryrow.Initialize( daycolumn, quantity );
+    //      factoryrow.Initialize( daycolumn, quantity );
         }
       }
     }
@@ -78,15 +78,15 @@
                     and ( pispip.Start() + Duration::Days( 1 ) ).Date() < startofnextyear 
                     and ( pispip.DependentDemandAndSalesDemandQuantity() <> 0 or pispip.NewSupplyQuantity() <> 0 ) ){
             dayperiodtime   := ( pispip.Start() + Duration::Days( 1 ) ).Date();//pispip.Start().Date();
-            dayperiodname   := dayperiodtime.Format( "M2/D2/Y" );
+    //        dayperiodname   := dayperiodtime.Format( "M2/D2/Y" );
             periodtime      := dayperiodtime.StartOfMonth();
             periodname      := periodtime.Format( "M2/D2/Y" );
-            daycolumn       := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime );
+    //        daycolumn       := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime );
             column          := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime );
             quantity        := [Number]pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
             
             factoryrow.Initialize( column, quantity );//鍙朤otal Demand瀛楁鎸夋湀姹囨�婚渶姹傛暟閲�
-            factoryrow.Initialize( daycolumn, quantity );
+    //        factoryrow.Initialize( daycolumn, quantity );
           }
         }
     //  }

--
Gitblit v1.9.3