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

---
 _Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter_OfflinePlan.qbl                          |   48 ++
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateExternalRentalWarehouseTransportationCosts.qbl   |    8 
 _Main/Sys/Repr/Global/MachineLogisticsCostReportCell.qrp                                                        |  140 +++++++
 _Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl                                                     |    5 
 _Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl                                                       |   10 
 _Main/BL/Type_MachineLogisticsCostReportColumn/Function_CalcDisplayName.qbl                                     |   11 
 _Main/BL/Type_InterfaceDataset/StaticMethod_PushOfflinePlanData.qbl                                             |   51 ++
 _Main/BL/Type_MachineLogisticsCostReportRow/Attribute_Index.qbl                                                 |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_pHeader_bExport_OnClick.def       |    6 
 _Main/UI/MacroPlannerWebApp/Views/MachineLogisticsCostReport.vw                                                 |  141 +++++++
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateTransferCost.qbl                                 |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_MatrixEditor912_OnUpdateValue.def |   19 +
 _Main/BL/Type_LocalTool/StaticMethod_GetFactoryByUnit.qbl                                                       |   26 +
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateOutboundExpensesForRentedWarehouses.qbl          |    8 
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateUnpackingCost#0.qbl                              |    8 
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateBufferPaperCost.qbl                              |    8 
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateQuantityOfWoodenCrates.qbl                       |    8 
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateCoefficient.qbl                                  |    8 
 _Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_Import.qbl                                            |  107 +++++
 _Main/BL/Type_Test/StaticMethod_Test.qbl                                                                        |    6 
 _Main/BL/Type_MachineLogisticsCostReportColumn/DefaultValue_DisplayName.qbl                                     |    6 
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_EstimatedTotalCost#455.qbl                               |    0 
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdatePackingCharges.qbl                               |    8 
 _Main/BL/Type_MachineLogisticsCostReportCell/Method_SetCellValue.qbl                                            |   34 +
 _Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_MatrixEditor912.def              |    4 
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateTotalCost.qbl                                    |    8 
 _Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl                                                 |    4 
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateRentalWarehouseStorageFees.qbl                   |    8 
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateStorageFeesForRentedWarehouses.qbl               |    8 
 _Main/BL/Type_MachineLogisticsCostReportColumn/Attribute_DisplayName.qbl                                        |    8 
 _Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl                                                     |    2 
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpateEstimatedTotalCost.qbl                            |    8 
 _Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_Export.qbl                                            |  134 +++++++
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_PackingCharges#420.qbl                                   |    0 
 _Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl                                        |   83 ++++
 _Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_pHeader_bImport_OnClick#298.def   |   45 ++
 _Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl                          |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_pHeader.def                      |   12 
 _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateWoodenCrateCost.qbl                              |    8 
 39 files changed, 981 insertions(+), 41 deletions(-)

diff --git a/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
index 64f8ba1..14344a6 100644
--- a/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_CC_EngineRackCell/StaticMethod_CreateData.qbl
@@ -46,9 +46,6 @@
         // 瀹㈡埛搴撴枡鏋舵�绘暟閲�
         mrcc := select( macroPlan, MaterialRackCustomRow.MaterialRackCustomCell, tempMRCCell, tempMRCCell.MaterialRackCustomRow().Generation() = ccerr.Generation() and tempMRCCell.MaterialRackCustomRow().MLB_MQB() = ccerr.MLB_MQB() and tempMRCCell.MaterialRackColumn().Month() = ccerc.StartDate().Month() );
         
-        // 褰撳墠鏈堟湯鏈�鍚庝竴澶╂棩鏈�                
-        lastDayOfThisMonth := ccerc.StartDate().StartOfNextMonth() - 1; 
-        
         cell := ccerr.CC_EngineRackCell( relnew );
         
         // 鏂欐灦鎬绘暟閲�
@@ -56,7 +53,7 @@
                            tempMRTCell.MaterialRackTotalRow().Generation() = ccerr.Generation()        and
                            tempMRTCell.MaterialRackTotalRow().MLB_MQB()    = ccerr.MLB_MQB()           and
                            tempMRTCell.MaterialRackColumn().Month()        = ccerc.StartDate().Month() );
-        cell.TotalQuantityOfMaterialRacks( mrtcell.Quantity() );
+        cell.TotalQuantityOfMaterialRacks( guard( mrtcell.Quantity(), 0 ) );
         
         // 绌烘枡鏋舵暟閲忥細銆�350bar MQB鏂欐灦鎬绘暟閲� - 鎵�鏈�350bar MQB鎬诲簱瀛� / 鍖呰瀹归噺-瀹㈡埛搴撴枡鏋舵暟閲忋��* 闀挎槬澶栫搴撶┖鏂欐灦姣斾緥
         plannedInventory := sum( macroPlan, Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriod, tempPISPIP,
diff --git a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
index 1cf5d6b..32a186c 100644
--- a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
@@ -61,7 +61,7 @@
                            tempMRTCell.MaterialRackTotalRow().MLB_MQB()    = dlerr.MLB_MQB()           and
                            tempMRTCell.MaterialRackColumn().Month()        = dlerc.StartDate().Month() );
         if ( dlerr.Generation() = "350bar" and dlerr.MLB_MQB() = "MQB" ) {
-          cell.TotalQuantityOfMaterialRacks( mrtcell.Quantity() );
+          cell.TotalQuantityOfMaterialRacks( guard( mrtcell.Quantity(), 0 ) );
         }
        
         // 澶ц繛澶栫搴撶┖鏂欐灦鏁伴噺锛氥��350bar MQB鏂欐灦鎬绘暟閲� - 鎵�鏈�350bar MQB鎬诲簱瀛� / 鍖呰瀹归噺 - 瀹㈡埛搴撴枡鏋舵暟閲忋��* 澶ц繛澶栫搴撶┖鏂欐灦姣斾緥
diff --git a/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl b/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl
index fd802d5..ec03621 100644
--- a/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl
+++ b/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl
@@ -38,14 +38,8 @@
     now := DateTime::Now();
     macroPlanName := macroPlan.MDSMacroPlan().Description();
     traverse( macroPlan,Unit.UnitPeriod.astype( UnitPeriodTime ).ShiftPlan,shiftPlan ,shiftPlan.UnitPeriodTime().Period_MP().StartDate() >= macroPlan.StartOfPlanning().Date()){
-       factory := shiftPlan.UnitPeriodTime().Unit();
-       while( factory.HasParent() ){
-         temp1 := factory;
-         factory := factory.Parent();
-         if( not factory.HasParent() ){
-           factory := temp1;
-         }
-       }
+       factory := LocalTool::GetFactoryByUnit( shiftPlan.UnitPeriodTime().Unit() );
+       
        productLine :=  shiftPlan.UnitPeriodTime().Unit().ID();
        shiftDate := shiftPlan.UnitPeriodTime().Period_MP().StartDate();
        factoryName := factory.ID();
diff --git a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl
index cc5744c..9da63db 100644
--- a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl
+++ b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl
@@ -46,13 +46,7 @@
         unitIndex := guard( unitIndexTree.Root().Child( unitHandle ), null( NamedValue ));
         if( not isnull( unitIndex )){
           unit := units.Element( unitIndex.GetValueAsNumber() );
-          temp1 := unit;
-          temp2 := unit.Parent();
-          while( not isnull( temp1.Parent())){
-            temp2 := temp1;
-            temp1 := temp1.Parent();
-          }
-          factory := temp2;
+          factory := LocalTool::GetFactoryByUnit( unit );
         }
       }
       
diff --git a/_Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl b/_Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl
index 27c99d0..a1bbc96 100644
--- a/_Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl
+++ b/_Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl
@@ -17,8 +17,8 @@
     if( iscustomdemand ){//鍏ㄥ勾鏃ュ害闇�姹�/瀹㈡埛闇�姹� 
       CustomerDemandPPAIDS::GenerateData( this, macroplan, executor );
     }
-    if( isofflineplan ){//鍚勪骇绾夸笅绾胯鍒�
-    //  OfflinePlanArchiveVersion::RefreshData( this, macroplan, archive );
+    if ( isofflineplan ) { // 鍚勪骇绾夸笅绾胯鍒�
+      InterfaceDataset::PushOfflinePlanData( macroplan, this, executor );
     }
     if( isshiftplan ){//鐝璁″垝
       DispatchShiftPlan::Dispatch(this, macroplan,executor );
diff --git a/_Main/BL/Type_InterfaceDataset/StaticMethod_PushOfflinePlanData.qbl b/_Main/BL/Type_InterfaceDataset/StaticMethod_PushOfflinePlanData.qbl
new file mode 100644
index 0000000..bbb615e
--- /dev/null
+++ b/_Main/BL/Type_InterfaceDataset/StaticMethod_PushOfflinePlanData.qbl
@@ -0,0 +1,51 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod PushOfflinePlanData (
+  const MacroPlan macroPlan,
+  InterfaceDataset interfaceDataset,
+  String executor
+)
+{
+  Description: '鍙戦�佷笅绾胯鍒掓暟鎹帴鍙�'
+  TextBody:
+  [*
+    table         := selectobject( interfaceDataset, OfflinePlanArchiveVersion, version, not version.IsShow() );
+    
+    totalRow      := 0;
+    interfaceTime := DateTime::ActualTime().Format( "Y-M2-D2 H2:m:s" );
+    
+    jsonarray     := JSON::Array();
+    
+    traverse ( table, Row, r ){
+      traverse ( table, Column, c, c.TimeUnit() = Translations::MP_GlobalParameters_Day() ) {
+        cell := select( r, Cell, tempC, tempC.Column() = c );
+        
+        if ( not isnull( cell ) ) {
+          idsjson := JSON::Object().Add( "product", r.ProductID() )       
+                                   .Add( "planningDate", c.StartDate().Format( 'Y-M2-D2' ) )
+                                   .Add( "planningQty", cell.Quantity() )
+                                   .Add( "versionName", macroPlan.ScenarioName() )
+                                   .Add( "factoryName", ifexpr( r.Unit().Regex( "CC" ), "闀挎槬宸ュ巶", "澶ц繛宸ュ巶" ) )
+                                   .Add( "fac", ifexpr( r.Unit().Regex( "CC" ), "CC", "DL" ) )
+                                   .Add( "interfaceTime", interfaceTime ).Build();
+          jsonarray.Add( idsjson );
+          totalRow++;
+        }
+      }
+    }
+    
+    requestbody := jsonarray.Build().AsString();
+    
+    //info(  requestbody );
+    
+    loginfo := interfaceDataset.InterfaceLoginfo( relnew, 
+                                                  ExecuteUser       := executor, 
+                                                  Name              := "Offline plan data", 
+                                                  InterfaceDateTime := DateTime::ActualTime(), 
+                                                  Message           := "涓嬬嚎璁″垝鏁版嵁", 
+                                                  RequestBody       := requestbody,
+                                                  TotalRow          := totalRow );
+    
+    InterfaceLoginfo::CallInterfaceForDataCenter_OfflinePlan( interfaceDataset, loginfo );
+  *]
+}
diff --git a/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter_OfflinePlan.qbl b/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter_OfflinePlan.qbl
new file mode 100644
index 0000000..b8a22f6
--- /dev/null
+++ b/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter_OfflinePlan.qbl
@@ -0,0 +1,48 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CallInterfaceForDataCenter_OfflinePlan (
+  InterfaceDataset owner,
+  InterfaceLoginfo loginfo
+)
+{
+  Description: '璋冪敤鏁版嵁涓彴鎺ュ彛銆愪笅绾胯鍒掋��'
+  TextBody:
+  [*
+    address       := Translations::InterfaceDataset_DataCenter_Address(); 
+    
+    httpinterface := HTTPInterface::Create( address,80 );
+    
+    httpinterface.PostMethod( true ); 
+    httpinterface.URL( "/api/production-planning/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_LocalTool/StaticMethod_GetFactoryByUnit.qbl b/_Main/BL/Type_LocalTool/StaticMethod_GetFactoryByUnit.qbl
new file mode 100644
index 0000000..66b05c8
--- /dev/null
+++ b/_Main/BL/Type_LocalTool/StaticMethod_GetFactoryByUnit.qbl
@@ -0,0 +1,26 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetFactoryByUnit (
+  const Unit unit
+) const as const Unit
+{
+  TextBody:
+  [*
+    // Akari Nov-11-2024 (created)
+    factory := constnull( Unit );
+    
+    if( isnull( unit ) or isnull( unit.Parent())){
+      factory := unit;
+    }else{
+      temp1 := unit;
+      temp2 := unit.Parent();
+      while( not isnull( temp1.Parent())){
+        temp2 := temp1;
+        temp1 := temp1.Parent();
+      }
+      factory := temp2;
+    }
+    
+    return factory;
+  *]
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_EstimatedTotalCost.qbl "b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_EstimatedTotalCost\043455.qbl"
similarity index 100%
rename from _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_EstimatedTotalCost.qbl
rename to "_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_EstimatedTotalCost\043455.qbl"
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpateEstimatedTotalCost.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpateEstimatedTotalCost.qbl
new file mode 100644
index 0000000..e9889d8
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpateEstimatedTotalCost.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsUpateEstimatedTotalCost
+{
+  #keys: '3[413988.1.99460691][413988.1.99460690][413988.1.99460692]'
+  Description: '棰勮鎬昏垂鐢ㄦ洿鏂板��'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateBufferPaperCost.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateBufferPaperCost.qbl
new file mode 100644
index 0000000..c3ee5de
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateBufferPaperCost.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsUpdateBufferPaperCost
+{
+  #keys: '3[413988.1.99460214][413988.1.99460213][413988.1.99460215]'
+  Description: '缂撳啿绾歌垂鐢ㄦ洿鏂板��'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateCoefficient.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateCoefficient.qbl
new file mode 100644
index 0000000..9c64935
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateCoefficient.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsUpdateCoefficient
+{
+  #keys: '3[413988.1.99460638][413988.1.99460637][413988.1.99460639]'
+  Description: '绯绘暟鏇存柊鍊�'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateExternalRentalWarehouseTransportationCosts.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateExternalRentalWarehouseTransportationCosts.qbl
new file mode 100644
index 0000000..2e31094
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateExternalRentalWarehouseTransportationCosts.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsUpdateExternalRentalWarehouseTransportationCosts
+{
+  #keys: '3[413988.1.99460585][413988.1.99460584][413988.1.99460586]'
+  Description: '澶栫搴撹繍杈撹垂鐢ㄦ洿鏂板��'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateOutboundExpensesForRentedWarehouses.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateOutboundExpensesForRentedWarehouses.qbl
new file mode 100644
index 0000000..c6d37a5
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateOutboundExpensesForRentedWarehouses.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsUpdateOutboundExpensesForRentedWarehouses
+{
+  #keys: '3[413988.1.99460479][413988.1.99460478][413988.1.99460480]'
+  Description: '澶栫搴撳嚭搴撹垂鐢ㄦ洿鏂板��'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdatePackingCharges.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdatePackingCharges.qbl
new file mode 100644
index 0000000..024b8c9
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdatePackingCharges.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsUpdatePackingCharges
+{
+  #keys: '3[413988.1.99360501][413988.1.99360500][413988.1.99360502]'
+  Description: '鍖呰璐圭敤鏇存柊鍊�'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateQuantityOfWoodenCrates.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateQuantityOfWoodenCrates.qbl
new file mode 100644
index 0000000..a1c14c8
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateQuantityOfWoodenCrates.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsUpdateQuantityOfWoodenCrates
+{
+  #keys: '3[413988.1.99460320][413988.1.99460319][413988.1.99460321]'
+  Description: '鏈ㄧ鏁伴噺鏇存柊鍊�'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateRentalWarehouseStorageFees.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateRentalWarehouseStorageFees.qbl
new file mode 100644
index 0000000..3fc165a
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateRentalWarehouseStorageFees.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsUpdateRentalWarehouseStorageFees
+{
+  #keys: '3[413988.1.99460532][413988.1.99460531][413988.1.99460533]'
+  Description: '澶栫搴撲粨鍌ㄨ垂鐢ㄦ洿鏂板��'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateStorageFeesForRentedWarehouses.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateStorageFeesForRentedWarehouses.qbl
new file mode 100644
index 0000000..14938c1
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateStorageFeesForRentedWarehouses.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsUpdateStorageFeesForRentedWarehouses
+{
+  #keys: '3[413988.1.99460426][413988.1.99460425][413988.1.99460427]'
+  Description: '澶栫搴撳叆搴撹垂鐢ㄦ洿鏂板��'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateTotalCost.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateTotalCost.qbl
new file mode 100644
index 0000000..cd47406
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateTotalCost.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsUpdateTotalCost
+{
+  #keys: '3[413988.1.99460744][413988.1.99460743][413988.1.99460745]'
+  Description: '鎬昏垂鐢ㄦ洿鏂板��'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateTransferCost.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateTransferCost.qbl
new file mode 100644
index 0000000..4ea6c9f
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateTransferCost.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsUpdateTransferCost
+{
+  #keys: '3[413988.1.99460373][413988.1.99460372][413988.1.99460374]'
+  Description: '璋冩嫧璐圭敤鏇存柊鍊�'
+  ValueType: Boolean
+}
diff --git "a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateUnpackingCost\0430.qbl" "b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateUnpackingCost\0430.qbl"
new file mode 100644
index 0000000..cd60e26
--- /dev/null
+++ "b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateUnpackingCost\0430.qbl"
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsUpdateUnpackingCost
+{
+  #keys: '3[413988.1.99360582][413988.1.99360581][413988.1.99360583]'
+  Description: '鎷嗗寘璐圭敤鏇存柊鍊�'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateWoodenCrateCost.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateWoodenCrateCost.qbl
new file mode 100644
index 0000000..79bb81f
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_IsUpdateWoodenCrateCost.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsUpdateWoodenCrateCost
+{
+  #keys: '3[413988.1.99460267][413988.1.99460266][413988.1.99460268]'
+  Description: '鏈ㄧ璐圭敤鏇存柊鍊�'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_PackingCharges.qbl "b/_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_PackingCharges\043420.qbl"
similarity index 100%
rename from _Main/BL/Type_MachineLogisticsCostReportCell/Attribute_PackingCharges.qbl
rename to "_Main/BL/Type_MachineLogisticsCostReportCell/Attribute_PackingCharges\043420.qbl"
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/Method_SetCellValue.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/Method_SetCellValue.qbl
new file mode 100644
index 0000000..40d928d
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/Method_SetCellValue.qbl
@@ -0,0 +1,34 @@
+Quintiq file version 2.0
+#parent: #root
+Method SetCellValue (
+  Real quantityOfWoodenCrates
+)
+{
+  Description: '鏇存柊鍗曞厓鏍煎��'
+  TextBody:
+  [*
+    // 璁剧疆鏈ㄧ鏁伴噺
+    this.QuantityOfWoodenCrates( quantityOfWoodenCrates );
+    
+    // 绌烘枡鏋舵暟閲忚仈鍔�
+    this.WoodenCrateCost( [Number] ( quantityOfWoodenCrates * this.WoodenCratePriceReal() ) );
+    
+    // SUM琛岃仈鍔�
+    cell := select( this, MachineLogisticsCostReportColumn.MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() = "SUM" );
+    cell.QuantityOfWoodenCrates( sum( this, MachineLogisticsCostReportColumn.MachineLogisticsCostReportCell, 
+                                      tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = this.MachineLogisticsCostReportRow().Factory(), 
+                                      tempMLCRCell.QuantityOfWoodenCrates() ) );
+    cell.WoodenCrateCost(        sum( this, MachineLogisticsCostReportColumn.MachineLogisticsCostReportCell, tempMLCRCell, 
+                                      tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = this.MachineLogisticsCostReportRow().Factory(), 
+                                      tempMLCRCell.WoodenCrateCost() ) );
+    
+    // SUM鍒楄仈鍔�
+    cell := select( this, MachineLogisticsCostReportRow.MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportColumn().DisplayName() = "SUM" );
+    cell.QuantityOfWoodenCrates( sum( this, MachineLogisticsCostReportRow.MachineLogisticsCostReportCell, tempMLCRCell, 
+                                      not tempMLCRCell.MachineLogisticsCostReportColumn().StartDate().IsMaxInfinity(), 
+                                      tempMLCRCell.QuantityOfWoodenCrates() ) );
+    cell.WoodenCrateCost(        sum( this, MachineLogisticsCostReportRow.MachineLogisticsCostReportCell, tempMLCRCell, 
+                                      not tempMLCRCell.MachineLogisticsCostReportColumn().StartDate().IsMaxInfinity(), 
+                                      tempMLCRCell.WoodenCrateCost() ) );
+  *]
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl
index c5b9fec..2f99195 100644
--- a/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl
@@ -14,8 +14,8 @@
                                       exists( tempPMP, AllParent.AsParent, tempPMP1, tempPMP1.ID() = "鏈哄姞浠�" ),  
                                       tempPMP.ParentID() );
     traverse ( categories, Elements, c ) {
-      macroPlan.MachineLogisticsCostReportRow( relnew, Factory := "澶ц繛宸ュ巶", Category := c  );
-      macroPlan.MachineLogisticsCostReportRow( relnew, Factory := "闀挎槬宸ュ巶", Category := c );
+      macroPlan.MachineLogisticsCostReportRow( relnew, Factory := "澶ц繛宸ュ巶", Category := c, Index := 0 );
+      macroPlan.MachineLogisticsCostReportRow( relnew, Factory := "闀挎槬宸ュ巶", Category := c, Index := 0 );
     }
     
     // 鍒涘缓鍒�
@@ -60,7 +60,7 @@
                                 tempPPC.PackagingPlanColumn().StartDate().Year()  = mlcrc.StartDate().Year()  and
                                 tempPPC.PackagingPlanColumn().StartDate().Month() = mlcrc.StartDate().Month(),
                                 tempPPC.Package() );
-        cell.PackingCharges( packageQuantity * guard( lcm.PackagePrice(), 1 ) );
+        cell.PackingCharges( [Number] ( packageQuantity * guard( lcm.PackagePrice(), 1 ) ) );
     
         // 璁剧疆鎷嗗寘璐圭敤锛堟媶鍖呴噺 * 鎷嗗寘鍗曚环锛�
         unpackingQuantity := sum( macroPlan, PackagingPlanRow.PackagingPlanCell, tempPPC,
@@ -69,10 +69,10 @@
                                   tempPPC.PackagingPlanColumn().StartDate().Year()  = mlcrc.StartDate().Year()  and
                                   tempPPC.PackagingPlanColumn().StartDate().Month() = mlcrc.StartDate().Month(),
                                   tempPPC.Unpacking() );
-        cell.UnpackingCost( unpackingQuantity * guard( lcm.UnpackingPrice(), 1 ) );
+        cell.UnpackingCost( [Number] ( unpackingQuantity * guard( lcm.UnpackingPrice(), 1 ) ) );
     
         // 璁剧疆缂撳啿绾歌垂鐢紙鍖呰绫� * 缂撳啿绾稿崟浠凤級
-        cell.BufferPaperCost( packageQuantity * guard( lcm.BufferPaperPrice(), 1 ) );
+        cell.BufferPaperCost( [Number] ( packageQuantity * guard( lcm.BufferPaperPrice(), 1 ) ) );
     
           // 璁剧疆鏈ㄧ鍗曚环
         cell.WoodenCratePriceReal( guard( lcm.WoodenCratePrice(), 1 ) );
@@ -88,10 +88,10 @@
         cell.TransferCost( [Number] ( ceil( ceil( transferQuantity / guard( lcm.PackagingCapacity(), 1 ) ) / guard( lct1.LoadingCapacity(), 1 ) ) * guard( lct1.TransportPrice(), 1 ) ) );
     
         // 澶栫搴撳叆搴撹垂鐢紙鍏ュ簱閲廩鍖呰閲廬 / 鍖呰瀹归噺 * 鍏ュ簱鍗曚环锛�
-        cell.StorageFeesForRentedWarehouses( packageQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.WarehousingPrice(), 1 ) );
+        cell.StorageFeesForRentedWarehouses( [Number] ( packageQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.WarehousingPrice(), 1 ) ) );
     
         // 澶栫搴撳嚭搴撹垂鐢紙鍑哄簱閲廩鎷嗗寘閲廬 / 鍖呰瀹归噺 * 鍑哄簱鍗曚环锛�
-        cell.OutboundExpensesForRentedWarehouses( unpackingQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.OutboundPrice(), 1 ) );
+        cell.OutboundExpensesForRentedWarehouses( [Number] ( unpackingQuantity / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.OutboundPrice(), 1 ) ) );
     
         // 澶栫搴撹繍杈撹垂鐢紙杩愯緭鏁伴噺 / 鍖呰瀹归噺 / 瑁呰浇瀹归噺 * 杩愯緭鍗曚环锛�
         transportationQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
@@ -111,7 +111,7 @@
                                        tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID() =  ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "DL", "CC" ) + " " + mlcrr.Category() + "绾胯竟搴�",
                                        tempPIT.Quantity()
                                       );
-        cell.ExternalRentalWarehouseTransportationCosts( transportationQuantity / guard( lcm.PackagingCapacity(), 1 ) / guard( lct.LoadingCapacity(), 1 ) * guard( lct.TransportPrice(), 1 ) );
+        cell.ExternalRentalWarehouseTransportationCosts( [Number] ( transportationQuantity / guard( lcm.PackagingCapacity(), 1 ) / guard( lct.LoadingCapacity(), 1 ) * guard( lct.TransportPrice(), 1 ) ) );
     
         // 澶栫搴撲粨鍌ㄨ垂鐢細浠撳偍鏁伴噺/鍖呰瀹归噺*浠撳偍鍗曚环
         plannedInventory := sum( macroPlan, Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriod, tempPISPIP,
@@ -122,7 +122,7 @@
                                  tempPISPIP.End().Date()                                                                                <= lastDayOfThisMonth and
                                  tempPISPIP.ProductInStockingPoint_MP().StockingPointID()                                               =  ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "DL", "CC" ) + " " + mlcrr.Category() + "澶栫搴�",
                                  tempPISPIP.PlannedInventoryLevelEnd() );
-        cell.RentalWarehouseStorageFees( plannedInventory / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.StoragePrice(), 1 ) );
+        cell.RentalWarehouseStorageFees( [Number] ( plannedInventory / guard( lcm.PackagingCapacity(), 1 ) * guard( lcm.StoragePrice(), 1 ) ) );
     
         
         
@@ -143,10 +143,73 @@
         cell.Coefficient( 1.05 );
     
         // 鎬昏垂鐢�
-        cell.TotalCost( cell.EstimatedTotalCost() * cell.Coefficient() );
+        cell.TotalCost( [Number] ( cell.EstimatedTotalCost() * cell.Coefficient() ) );
         
         cell.MachineLogisticsCostReportColumn( relset, mlcrc );
       }
     }
+    
+    // 鍒涘缓SUM琛�
+    sumR   := macroPlan.MachineLogisticsCostReportRow( relnew,  Category := "SUM", Factory := "澶ц繛宸ュ巶", Index := 2 );
+    traverse ( macroPlan, MachineLogisticsCostReportColumn, mlcrc ) {
+      cell := sumR.MachineLogisticsCostReportCell( relnew );
+      cell.MachineLogisticsCostReportColumn( relset, mlcrc );
+      
+      cell.PackingCharges( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.PackingCharges() ) );
+      cell.UnpackingCost( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.UnpackingCost() ) );
+      cell.BufferPaperCost( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.BufferPaperCost() ) );
+      cell.QuantityOfWoodenCrates( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.QuantityOfWoodenCrates() ) );
+      cell.WoodenCrateCost( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.WoodenCrateCost() ) );
+      cell.TransferCost( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.TransferCost() ) );
+      cell.StorageFeesForRentedWarehouses( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.StorageFeesForRentedWarehouses() ) );
+      cell.OutboundExpensesForRentedWarehouses( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.OutboundExpensesForRentedWarehouses() ) );
+      cell.ExternalRentalWarehouseTransportationCosts( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.ExternalRentalWarehouseTransportationCosts() ) );
+      cell.RentalWarehouseStorageFees( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.RentalWarehouseStorageFees() ) );
+      cell.EstimatedTotalCost( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.EstimatedTotalCost() ) );
+      cell.Coefficient( 1.05 );
+      cell.TotalCost( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.TotalCost() ) );
+    }
+    
+    // 鍒涘缓SUM琛�
+    sumR   := macroPlan.MachineLogisticsCostReportRow( relnew,  Category := "SUM", Factory := "闀挎槬宸ュ巶", Index := 2 );
+    traverse ( macroPlan, MachineLogisticsCostReportColumn, mlcrc ) {
+      cell := sumR.MachineLogisticsCostReportCell( relnew );
+      cell.MachineLogisticsCostReportColumn( relset, mlcrc );
+      
+      cell.PackingCharges( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.PackingCharges() ) );
+      cell.UnpackingCost( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.UnpackingCost() ) );
+      cell.BufferPaperCost( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.BufferPaperCost() ) );
+      cell.QuantityOfWoodenCrates( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.QuantityOfWoodenCrates() ) );
+      cell.WoodenCrateCost( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.WoodenCrateCost() ) );
+      cell.TransferCost( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.TransferCost() ) );
+      cell.StorageFeesForRentedWarehouses( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.StorageFeesForRentedWarehouses() ) );
+      cell.OutboundExpensesForRentedWarehouses( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.OutboundExpensesForRentedWarehouses() ) );
+      cell.ExternalRentalWarehouseTransportationCosts( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.ExternalRentalWarehouseTransportationCosts() ) );
+      cell.RentalWarehouseStorageFees( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.RentalWarehouseStorageFees() ) );
+      cell.EstimatedTotalCost( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.EstimatedTotalCost() ) );
+      cell.Coefficient( 1.05 );
+      cell.TotalCost( sum( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, tempMLCRCell.MachineLogisticsCostReportRow().Category() <> "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = sumR.Factory(), tempMLCRCell.TotalCost() ) );
+    }
+    
+    // 鍒涘缓SUM鍒�
+    sumC   := macroPlan.MachineLogisticsCostReportColumn( relnew, StartDate := Date::MaxDate() );
+    traverse ( macroPlan, MachineLogisticsCostReportRow, mlcrr ) {
+      cell := mlcrr.MachineLogisticsCostReportCell( relnew );
+      cell.MachineLogisticsCostReportColumn( relset, sumC );
+      
+      cell.PackingCharges( sum( mlcrr, MachineLogisticsCostReportCell, tempMLCRCell, not tempMLCRCell.MachineLogisticsCostReportColumn().StartDate().IsMaxInfinity(), tempMLCRCell.PackingCharges() ) );
+      cell.UnpackingCost( sum( mlcrr, MachineLogisticsCostReportCell, tempMLCRCell, not tempMLCRCell.MachineLogisticsCostReportColumn().StartDate().IsMaxInfinity(), tempMLCRCell.UnpackingCost() ) );
+      cell.BufferPaperCost( sum( mlcrr, MachineLogisticsCostReportCell, tempMLCRCell, not tempMLCRCell.MachineLogisticsCostReportColumn().StartDate().IsMaxInfinity(), tempMLCRCell.BufferPaperCost() ) );
+      cell.QuantityOfWoodenCrates( sum( mlcrr, MachineLogisticsCostReportCell, tempMLCRCell, not tempMLCRCell.MachineLogisticsCostReportColumn().StartDate().IsMaxInfinity(), tempMLCRCell.QuantityOfWoodenCrates() ) );
+      cell.WoodenCrateCost( sum( mlcrr, MachineLogisticsCostReportCell, tempMLCRCell, not tempMLCRCell.MachineLogisticsCostReportColumn().StartDate().IsMaxInfinity(), tempMLCRCell.WoodenCrateCost() ) );
+      cell.TransferCost( sum( mlcrr, MachineLogisticsCostReportCell, tempMLCRCell, not tempMLCRCell.MachineLogisticsCostReportColumn().StartDate().IsMaxInfinity(), tempMLCRCell.TransferCost() ) );
+      cell.StorageFeesForRentedWarehouses( sum( mlcrr, MachineLogisticsCostReportCell, tempMLCRCell, not tempMLCRCell.MachineLogisticsCostReportColumn().StartDate().IsMaxInfinity(), tempMLCRCell.StorageFeesForRentedWarehouses() ) );
+      cell.OutboundExpensesForRentedWarehouses( sum( mlcrr, MachineLogisticsCostReportCell, tempMLCRCell, not tempMLCRCell.MachineLogisticsCostReportColumn().StartDate().IsMaxInfinity(), tempMLCRCell.OutboundExpensesForRentedWarehouses() ) );
+      cell.ExternalRentalWarehouseTransportationCosts( sum( mlcrr, MachineLogisticsCostReportCell, tempMLCRCell, not tempMLCRCell.MachineLogisticsCostReportColumn().StartDate().IsMaxInfinity(), tempMLCRCell.ExternalRentalWarehouseTransportationCosts() ) );
+      cell.RentalWarehouseStorageFees( sum( mlcrr, MachineLogisticsCostReportCell, tempMLCRCell, not tempMLCRCell.MachineLogisticsCostReportColumn().StartDate().IsMaxInfinity(), tempMLCRCell.RentalWarehouseStorageFees() ) );
+      cell.EstimatedTotalCost( sum( mlcrr, MachineLogisticsCostReportCell, tempMLCRCell, not tempMLCRCell.MachineLogisticsCostReportColumn().StartDate().IsMaxInfinity(), tempMLCRCell.EstimatedTotalCost() ) );
+      cell.Coefficient( 1.05 ); 
+      cell.TotalCost( sum( mlcrr, MachineLogisticsCostReportCell, tempMLCRCell, not tempMLCRCell.MachineLogisticsCostReportColumn().StartDate().IsMaxInfinity(), tempMLCRCell.TotalCost() ) );    
+    }
   *]
 }
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_Export.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_Export.qbl
index a37bcec..3d60299 100644
--- a/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_Export.qbl
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_Export.qbl
@@ -1,7 +1,139 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod Export (
+  MacroPlan macroPlan,
   MachineLogisticsCostReportRows mlcrrs
-)
+) as BinaryValue
 {
+  TextBody:
+  [*
+    xmlDOMI      := XMLDOMImplementation::Create();
+    xmlDOM       := xmlDOMI.CreateDocumentFromString( '<?xml version="1.0" encoding="UTF-16"?><table><name>Sheet1</name></table>' );
+    
+    tableElement := xmlDOM.GetElementByTagName( "table", 0 );
+    
+    // 绗竴鍒楋紙鍚嶇О锛�
+    mlcrrs      := selectsortedset( mlcrrs, Elements, tempMLCRR, true, tempMLCRR.Index(), tempMLCRR.Category() );
+    firstColumn := xmlDOM.CreateElement( "column" );
+    firstName   := xmlDOM.CreateElement( "name" );
+    firstType   := xmlDOM.CreateElement( "type" );
+    firstName.TextContent( "*" );
+    firstType.TextContent( "String" );
+    firstColumn.AppendChild( firstName );
+    firstColumn.AppendChild( firstType );
+    traverse ( mlcrrs, Elements, mlcrr ) {
+      firstCell := xmlDOM.CreateElement( "cell" );
+      firstCell.SetAttribute( "value", mlcrr.Category() );
+      firstColumn.AppendChild( firstCell );
+      
+      for ( i := 0; i < 12; i++ ) {
+        firstCell := xmlDOM.CreateElement( "cell" );
+        firstCell.SetAttribute( "value", "" );
+        firstColumn.AppendChild( firstCell );
+      }
+    }
+    tableElement.AppendChild( firstColumn );
+    
+    
+    // 绗簩鍒�
+    attrs        := construct( Strings ); attrs.Add( "鍖呰璐圭敤" ); attrs.Add( "鎷嗗寘璐圭敤" ); attrs.Add( "缂撳啿绾歌垂鐢�" ); attrs.Add( "鏈ㄧ鏁伴噺" ); attrs.Add( "鏈ㄧ璐圭敤" );
+                                          attrs.Add( "璋冩嫧璐圭敤" ); attrs.Add( "澶栫搴撳叆搴撹垂鐢�" ); attrs.Add( "澶栫搴撳嚭搴撹垂鐢�" ); attrs.Add( "澶栫搴撹繍杈撹垂鐢�" ); attrs.Add( "澶栫搴撲粨鍌ㄨ垂鐢�" );
+                                          attrs.Add( "棰勮鎬昏垂鐢�" ); attrs.Add( "绯绘暟" ); attrs.Add( "鎬昏垂鐢�" );
+    secondColumn := xmlDOM.CreateElement( "column" );
+    secondName   := xmlDOM.CreateElement( "name" );
+    secondType   := xmlDOM.CreateElement( "type" );
+    secondName.TextContent( "*" );
+    secondType.TextContent( "String" );
+    secondColumn.AppendChild( secondName );
+    secondColumn.AppendChild( secondType );
+    for ( i := 0; i < mlcrrs.Size(); i++ ) {
+      traverse ( attrs, Elements, attr ) {
+        secondCell := xmlDOM.CreateElement( "cell" );
+        secondCell.SetAttribute( "value", attr );
+        secondColumn.AppendChild( secondCell );
+      }
+    }
+    tableElement.AppendChild( secondColumn );
+    
+    // 鏃堕棿鍒�
+    mlcrcs := selectsortedset( macroPlan, MachineLogisticsCostReportColumn, tempMLCRC, true, tempMLCRC.StartDate() );
+    traverse ( mlcrcs, Elements, mlcrc ) {
+      cellColumn := xmlDOM.CreateElement( "column" );
+      cellName   := xmlDOM.CreateElement( "name" );
+      cellType   := xmlDOM.CreateElement( "type" );
+      cellName.TextContent( mlcrc.DisplayName() );
+      cellType.TextContent( "Real" );
+      cellColumn.AppendChild( cellName );
+      cellColumn.AppendChild( cellType );
+      cells := selectsortedset( mlcrc, MachineLogisticsCostReportCell, tempMLCRCell, 
+                                exists( mlcrrs, Elements, tempMLCRR, tempMLCRR = tempMLCRCell.MachineLogisticsCostReportRow() ), 
+                                tempMLCRCell.MachineLogisticsCostReportRow().Index(), tempMLCRCell.MachineLogisticsCostReportRow().Category() );
+      traverse ( cells, Elements, c ) {
+        cell := xmlDOM.CreateElement( "cell" );
+        cell.SetAttribute( "value", [String]c.PackingCharges().Round( 0 ) ); // 鍖呰璐圭敤
+        cellColumn.AppendChild( cell );
+        
+        cell := xmlDOM.CreateElement( "cell" );
+        cell.SetAttribute( "value", [String]c.UnpackingCost().Round( 0 ) ); // 鎷嗗寘璐圭敤
+        cellColumn.AppendChild( cell );
+        
+        cell := xmlDOM.CreateElement( "cell" );
+        cell.SetAttribute( "value", [String]c.BufferPaperCost().Round( 0 ) ); // 缂撳啿绾歌垂鐢�
+        cellColumn.AppendChild( cell );
+        
+        cell := xmlDOM.CreateElement( "cell" );
+        cell.SetAttribute( "value", [String]c.QuantityOfWoodenCrates().Round( 0 ) ); // 鏈ㄧ鏁伴噺
+        cellColumn.AppendChild( cell );
+        
+        cell := xmlDOM.CreateElement( "cell" );
+        cell.SetAttribute( "value", [String]c.WoodenCrateCost().Round( 0 ) ); // 鏈ㄧ璐圭敤
+        cellColumn.AppendChild( cell );
+        
+        cell := xmlDOM.CreateElement( "cell" );
+        cell.SetAttribute( "value", [String]c.TransferCost().Round( 0 ) ); // 璋冩嫧璐圭敤
+        cellColumn.AppendChild( cell );
+        
+        cell := xmlDOM.CreateElement( "cell" );
+        cell.SetAttribute( "value", [String]c.StorageFeesForRentedWarehouses().Round( 0 ) ); // 澶栫搴撳叆搴撹垂鐢�
+        cellColumn.AppendChild( cell );
+        
+        cell := xmlDOM.CreateElement( "cell" );
+        cell.SetAttribute( "value", [String]c.OutboundExpensesForRentedWarehouses().Round( 0 ) ); // 澶栫搴撳嚭搴撹垂鐢�
+        cellColumn.AppendChild( cell );
+        
+        cell := xmlDOM.CreateElement( "cell" );
+        cell.SetAttribute( "value", [String]c.ExternalRentalWarehouseTransportationCosts().Round( 0 ) ); // 澶栫搴撹繍杈撹垂鐢�
+        cellColumn.AppendChild( cell );
+        
+        cell := xmlDOM.CreateElement( "cell" );
+        cell.SetAttribute( "value", [String]c.RentalWarehouseStorageFees().Round( 0 ) ); // 澶栫搴撲粨鍌ㄨ垂鐢�
+        cellColumn.AppendChild( cell );
+        
+        cell := xmlDOM.CreateElement( "cell" );
+        cell.SetAttribute( "value", [String]c.EstimatedTotalCost().Round( 0 ) ); // 棰勮鎬昏垂鐢�
+        cellColumn.AppendChild( cell );
+        
+        cell := xmlDOM.CreateElement( "cell" );
+        cell.SetAttribute( "value", [String]c.Coefficient().Round( 2 ) ); // 绯绘暟
+        cellColumn.AppendChild( cell );
+        
+        cell := xmlDOM.CreateElement( "cell" );
+        cell.SetAttribute( "value", [String]c.TotalCost().Round( 0 ) ); // 鎬昏垂鐢�
+        cellColumn.AppendChild( cell );
+      }
+      tableElement.AppendChild( cellColumn );
+    }
+    
+    xmlString := xmlDOMI.CreateSerializer().WriteToString( xmlDOM )
+    
+    //info( xmlString );
+    
+    tableGroupHandle := TableGroupHandle::Create( "Sheet1" );
+    tableHandle      := TableHandle::ImportXML( BinaryValue::Construct( xmlString ) );
+    tableGroupHandle.Add( tableHandle );
+    
+    binaryData := XLS::SaveTableGroupToBinaryData( tableGroupHandle, true );
+    
+    return binaryData.AsBinaryValue();
+  *]
 }
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_Import.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_Import.qbl
new file mode 100644
index 0000000..03133cc
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_Import.qbl
@@ -0,0 +1,107 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Import (
+  MacroPlan macroPlan,
+  GeneralExcelImportAndExportDataTable table
+)
+{
+  TextBody:
+  [*
+    isUpdateFlag        := "";
+    attributeUpdateFlag := "";
+    
+    factory := table.GeneralExcelImportAndExportDataSource().Name().Tokenize( "_" ).Element( 0 );
+    if ( not ( factory = "澶ц繛宸ュ巶" or factory = "闀挎槬宸ュ巶" ) ) {
+      error( "鏂囦欢鍚嶉敊璇�" );
+    }
+    
+    traverse ( table, GeneralExcelImportAndExportDataRow, row ) {
+      traverse ( table, GeneralExcelImportAndExportDataColumn, column ) {
+        // 鍗曞厓鏍煎��
+        cellValue := select( row, GeneralExcelImportAndExportDataCell, tempGEIAEDCell, tempGEIAEDCell.GeneralExcelImportAndExportDataColumn() = column ).Value();
+        // 鏈哄姞鐗╂祦鎴愭湰鎶ヨ〃鍒�
+        mlcrc     := select( macroPlan, MachineLogisticsCostReportColumn, tempMLCRC, tempMLCRC.DisplayName() = column.Name() );
+        cell      := select( macroPlan, MachineLogisticsCostReportRow.MachineLogisticsCostReportCell, tempMLCRCell, 
+                             tempMLCRCell.MachineLogisticsCostReportRow().Category() = "SUM" and tempMLCRCell.MachineLogisticsCostReportRow().Factory() = factory
+                             and tempMLCRCell.MachineLogisticsCostReportColumn() = mlcrc );
+        
+        if ( column.ColumnIndex() = 0 and cellValue <> "" ) {
+          isUpdateFlag := cellValue;
+        }
+        
+        if ( column.ColumnIndex() = 1 and cellValue <> "" ) {
+          attributeUpdateFlag := cellValue;
+        }
+        
+        if ( isUpdateFlag = "SUM" ) {
+          if ( attributeUpdateFlag = "鍖呰璐圭敤"            and not isnull( cell ) ) {
+            if ( not cell.IsUpdatePackingCharges() and cell.PackingCharges() <> [Real]cellValue ) {
+              cell.IsUpdatePackingCharges( true );
+            }
+            cell.PackingCharges( [Real]cellValue );    
+          } else if ( attributeUpdateFlag = "鎷嗗寘璐圭敤"     and not isnull( cell ) ) {
+            if ( not cell.IsUpdateUnpackingCost() and cell.UnpackingCost() <> [Real]cellValue ) {
+              cell.IsUpdateUnpackingCost( true );
+            }
+            cell.UnpackingCost( [Real]cellValue );
+          } else if ( attributeUpdateFlag = "缂撳啿绾歌垂鐢�"       and not isnull( cell ) ) {
+            if ( not cell.IsUpdateBufferPaperCost() and cell.BufferPaperCost() <> [Real]cellValue ) {
+              cell.IsUpdateBufferPaperCost( true );
+            }
+            cell.BufferPaperCost( [Real]cellValue );
+          } else if ( attributeUpdateFlag = "鏈ㄧ鏁伴噺"       and not isnull( cell ) ) {
+            if ( not cell.IsUpdateQuantityOfWoodenCrates() and cell.QuantityOfWoodenCrates() <> [Real]cellValue ) {
+              cell.IsUpdateQuantityOfWoodenCrates( true );
+            }
+            cell.QuantityOfWoodenCrates( [Real]cellValue );
+          } else if ( attributeUpdateFlag = "鏈ㄧ璐圭敤"       and not isnull( cell ) ) {
+            if ( not cell.IsUpdateWoodenCrateCost() and cell.WoodenCrateCost() <> [Real]cellValue ) {
+              cell.IsUpdateWoodenCrateCost( true );
+            }
+            cell.WoodenCrateCost( [Real]cellValue );
+          } else if ( attributeUpdateFlag = "璋冩嫧璐圭敤"       and not isnull( cell ) ) {
+            if ( not cell.IsUpdateTransferCost() and cell.TransferCost() <> [Real]cellValue ) {
+              cell.IsUpdateTransferCost( true );
+            }
+            cell.TransferCost( [Real]cellValue );
+          } else if ( attributeUpdateFlag = "澶栫搴撳叆搴撹垂鐢�" and not isnull( cell ) ) {
+            if ( not cell.IsUpdateStorageFeesForRentedWarehouses() and cell.StorageFeesForRentedWarehouses() <> [Real]cellValue ) {
+              cell.IsUpdateStorageFeesForRentedWarehouses( true );
+            }
+            cell.StorageFeesForRentedWarehouses( [Real]cellValue );
+          } else if ( attributeUpdateFlag = "澶栫搴撳嚭搴撹垂鐢�" and not isnull( cell ) ) {
+            if ( not cell.IsUpdateOutboundExpensesForRentedWarehouses() and cell.OutboundExpensesForRentedWarehouses() <> [Real]cellValue ) {
+              cell.IsUpdateOutboundExpensesForRentedWarehouses( true );
+            }
+            cell.OutboundExpensesForRentedWarehouses( [Real]cellValue );
+          } else if ( attributeUpdateFlag = "澶栫搴撹繍杈撹垂鐢�" and not isnull( cell ) ) {
+            if ( not cell.IsUpdateExternalRentalWarehouseTransportationCosts() and cell.ExternalRentalWarehouseTransportationCosts() <> [Real]cellValue ) {
+              cell.IsUpdateExternalRentalWarehouseTransportationCosts( true );
+            }
+            cell.ExternalRentalWarehouseTransportationCosts( [Real]cellValue );
+          } else if ( attributeUpdateFlag = "澶栫搴撲粨鍌ㄨ垂鐢�" and not isnull( cell ) ) {
+            if ( not cell.IsUpdateRentalWarehouseStorageFees() and cell.RentalWarehouseStorageFees() <> [Real]cellValue ) {
+              cell.IsUpdateRentalWarehouseStorageFees( true );
+            }
+            cell.RentalWarehouseStorageFees( [Real]cellValue );
+          }else if ( attributeUpdateFlag = "棰勮鎬昏垂鐢�"     and not isnull( cell ) ) {
+            if ( not cell.IsUpateEstimatedTotalCost() and cell.EstimatedTotalCost() <> [Real]cellValue ) {
+              cell.IsUpateEstimatedTotalCost( true );
+            }
+            cell.EstimatedTotalCost( [Real]cellValue );
+          } else if ( attributeUpdateFlag = "绯绘暟"           and not isnull( cell ) ) {
+            if ( not cell.IsUpdateCoefficient() and cell.Coefficient() <> [Real]cellValue ) {
+              cell.IsUpdateCoefficient( true );
+            }
+            cell.Coefficient( [Real]cellValue );
+          } else if ( attributeUpdateFlag = "鎬昏垂鐢�"         and not isnull( cell ) ) {
+            if ( not cell.IsUpdateTotalCost() and cell.TotalCost() <> [Real]cellValue ) {
+              cell.IsUpdateTotalCost( true );
+            }
+            cell.TotalCost( [Real]cellValue );
+          }
+        }
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportColumn/Attribute_DisplayName.qbl b/_Main/BL/Type_MachineLogisticsCostReportColumn/Attribute_DisplayName.qbl
new file mode 100644
index 0000000..3f12afa
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportColumn/Attribute_DisplayName.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute DisplayName
+{
+  #keys: '3[413988.1.100804848][413988.1.100804847][413988.1.100804849]'
+  Description: '鍒楁樉绀�'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportColumn/DefaultValue_DisplayName.qbl b/_Main/BL/Type_MachineLogisticsCostReportColumn/DefaultValue_DisplayName.qbl
new file mode 100644
index 0000000..96a7dae
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportColumn/DefaultValue_DisplayName.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#parent: #root
+DefaultValue
+{
+  TargetAttribute: DisplayName
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportColumn/Function_CalcDisplayName.qbl b/_Main/BL/Type_MachineLogisticsCostReportColumn/Function_CalcDisplayName.qbl
new file mode 100644
index 0000000..fea962d
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportColumn/Function_CalcDisplayName.qbl
@@ -0,0 +1,11 @@
+Quintiq file version 2.0
+#parent: #root
+Function CalcDisplayName
+{
+  TextBody:
+  [*
+    value := ifexpr( this.StartDate().IsMaxInfinity(), "SUM", this.StartDate().Format( "Y-M2-D2" ) );
+    
+    this.DisplayName( value );
+  *]
+}
diff --git a/_Main/BL/Type_MachineLogisticsCostReportRow/Attribute_Index.qbl b/_Main/BL/Type_MachineLogisticsCostReportRow/Attribute_Index.qbl
new file mode 100644
index 0000000..ee59131
--- /dev/null
+++ b/_Main/BL/Type_MachineLogisticsCostReportRow/Attribute_Index.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Index
+{
+  #keys: '3[413988.1.100900359][413988.1.100900358][413988.1.100900360]'
+  Description: '鎺掑簭绱㈠紩'
+  ValueType: Number
+}
diff --git a/_Main/BL/Type_Test/StaticMethod_Test.qbl b/_Main/BL/Type_Test/StaticMethod_Test.qbl
index 389d1dc..ea55e75 100644
--- a/_Main/BL/Type_Test/StaticMethod_Test.qbl
+++ b/_Main/BL/Type_Test/StaticMethod_Test.qbl
@@ -11,10 +11,8 @@
 {
   TextBody:
   [*
-    traverse( archive,ArchiveFile,object ){
-    //  object.Name();
-    //  object.FilePath();
-    //  object.SourceFileBinaryValue();
+    traverse( macroPlan,Unit,unit ){
+      info( LocalTool::GetFactoryByUnit( unit ).ID() ); 
     }
   *]
 }
diff --git a/_Main/Sys/Repr/Global/MachineLogisticsCostReportCell.qrp b/_Main/Sys/Repr/Global/MachineLogisticsCostReportCell.qrp
index b891513..b737013 100644
--- a/_Main/Sys/Repr/Global/MachineLogisticsCostReportCell.qrp
+++ b/_Main/Sys/Repr/Global/MachineLogisticsCostReportCell.qrp
@@ -6,6 +6,17 @@
   {
     AttributeKey: '[413988.0.1462991459]'
     Synonym: '缂撳啿绾歌垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF3399'
+        ConditionBody: 'object.IsUpdateBufferPaperCost()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation Coefficient
   {
@@ -13,6 +24,14 @@
     Synonym: '绯绘暟'
     Conditional:
     [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF3399'
+        ConditionBody: 'object.IsUpdateCoefficient()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
     ]
     DataRepresentation.Default
     {
@@ -24,56 +43,177 @@
   {
     AttributeKey: '[413988.0.1462991539]'
     Synonym: '棰勮鎬昏垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF3399'
+        ConditionBody: 'object.IsUpateEstimatedTotalCost()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation ExternalRentalWarehouseTransportationCosts
   {
     AttributeKey: '[413988.0.1462991519]'
     Synonym: '澶栫搴撹繍杈撹垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF3399'
+        ConditionBody: 'object.IsUpdateExternalRentalWarehouseTransportationCosts()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation OutboundExpensesForRentedWarehouses
   {
     AttributeKey: '[413988.0.1462991509]'
     Synonym: '澶栫搴撳嚭搴撹垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF3399'
+        ConditionBody: 'object.IsUpdateOutboundExpensesForRentedWarehouses()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation PackingCharges
   {
     AttributeKey: '[413988.0.1462991439]'
     Synonym: '鍖呰璐圭敤'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF3399'
+        ConditionBody: 'object.IsUpdatePackingCharges()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation QuantityOfWoodenCrates
   {
     AttributeKey: '[413988.0.1462991469]'
     Synonym: '鏈ㄧ鏁伴噺'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF3399'
+        ConditionBody: 'object.IsUpdateQuantityOfWoodenCrates()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation RentalWarehouseStorageFees
   {
     AttributeKey: '[413988.0.1462991529]'
     Synonym: '澶栫搴撲粨鍌ㄨ垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF3399'
+        ConditionBody: 'object.IsUpdateRentalWarehouseStorageFees()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation StorageFeesForRentedWarehouses
   {
     AttributeKey: '[413988.0.1462991499]'
     Synonym: '澶栫搴撳叆搴撹垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF3399'
+        ConditionBody: 'object.IsUpdateStorageFeesForRentedWarehouses()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation TotalCost
   {
     AttributeKey: '[413988.0.1462991549]'
     Synonym: '鎬昏垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF3399'
+        ConditionBody: 'object.IsUpdateTotalCost()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation TransferCost
   {
     AttributeKey: '[413988.0.1462991489]'
     Synonym: '璋冩嫧璐圭敤'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF3399'
+        ConditionBody: 'object.IsUpdateTransferCost()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation UnpackingCost
   {
     AttributeKey: '[413988.0.1462991449]'
     Synonym: '鎷嗗寘璐圭敤'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF3399'
+        ConditionBody: 'object.IsUpdateUnpackingCost()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation WoodenCrateCost
   {
     AttributeKey: '[413988.0.1462991479]'
     Synonym: '鏈ㄧ璐圭敤'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF3399'
+        ConditionBody: 'object.IsUpdateWoodenCrateCost()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   RelationRepresentation MachineLogisticsCostReportColumn { RelationKey: '[413988.0.1462991383]' Visibility: 'Normal' }
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_MatrixEditor912.def b/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_MatrixEditor912.def
index bae3842..9d698a5 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_MatrixEditor912.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_MatrixEditor912.def
@@ -56,7 +56,7 @@
       Properties:
       [
         Legend: 'Category'
-        SortCriteria: 'Category'
+        SortCriteria: 'Index;Category'
         Taborder: 1
       ]
     }
@@ -81,7 +81,7 @@
       ]
       Properties:
       [
-        Legend: 'StartDate'
+        Legend: 'DisplayName'
         SortCriteria: 'StartDate'
         Taborder: 2
       ]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_pHeader.def b/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_pHeader.def
index 883b60a..ebcd3cb 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_pHeader.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Component_pHeader.def
@@ -33,6 +33,18 @@
       Properties:
       [
         Image: 'EXPORT1'
+        Label: '瀵煎嚭'
+        Taborder: 3
+      ]
+    }
+    Component bImport id:bImport_438
+    {
+      #keys: '[413988.1.109640450]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Image: 'IMPORT1'
+        Label: '瀵煎叆'
         Taborder: 2
       ]
     }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_MatrixEditor912_OnUpdateValue.def b/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_MatrixEditor912_OnUpdateValue.def
new file mode 100644
index 0000000..3d7776c
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_MatrixEditor912_OnUpdateValue.def
@@ -0,0 +1,19 @@
+Quintiq file version 2.0
+#parent: MatrixEditor912
+Response OnUpdateValue (
+  MachineLogisticsCostReportCell cell,
+  Real value
+) id:Response_MatrixEditor912_OnUpdateValue
+{
+  #keys: '[413988.1.115290697]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebMatrixEditor_OnUpdateValue'
+  QuillAction
+  {
+    Body:
+    [*
+      cell.SetCellValue( value );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_pHeader_bExport_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_pHeader_bExport_OnClick.def
index d6dce97..87d85f4 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_pHeader_bExport_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_pHeader_bExport_OnClick.def
@@ -13,9 +13,11 @@
   {
     Body:
     [*
-      mlcrrs := selectset( MacroPlan, MachineLogisticsCostReportRow, tempMLCRR, true );
+      mlcrrs := selectset( MacroPlan, MachineLogisticsCostReportRow, tempMLCRR, tempMLCRR.Factory() = ddslFactory.Text() );
       
-      MachineLogisticsCostReportCell::Export( mlcrrs );
+      binaryValue := MachineLogisticsCostReportCell::Export( MacroPlan, mlcrrs );
+      
+      Application.Download( ddslFactory.Text() + "_鏈哄姞鐗╂祦鎴愭湰鎶ヨ〃.xlsx", binaryValue.AsBinaryData() );
     *]
     GroupServerCalls: false
   }
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_pHeader_bImport_OnClick\043298.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_pHeader_bImport_OnClick\043298.def"
new file mode 100644
index 0000000..74e4825
--- /dev/null
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormMachineLogisticsCostReport/Response_pHeader_bImport_OnClick\043298.def"
@@ -0,0 +1,45 @@
+Quintiq file version 2.0
+#parent: pHeader/bImport_438
+Response OnClick () id:Response_pHeader_bImport_OnClick_298
+{
+  #keys: '[413988.1.109640449]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  Precondition:
+  [*
+    return not isnull( MacroPlan );
+  *]
+  QuillAction
+  {
+    Body:
+    [*
+      try {
+        uploadJsonString := Application.GetFile();
+        if ( uploadJsonString <> "" ) {
+          uploadJson := JSON::Parse( uploadJsonString );
+          Archive::VerifyTheFileName( uploadJson );
+                
+          fileName := uploadJson.Get( "name" ).GetString();
+          base64String := uploadJson.Get( "data" ).GetString();
+              
+          webFileBinaryData := BinaryData::FromBase64EncodedString( base64String ).AsBinaryValue();
+          
+          generalExcelImportAndExportDataSource := GeneralExcelImportAndExportDataSource::Upload( RecycleBin, webFileBinaryData, fileName );
+          generalExcelImportAndExportDataSource.ReadStructure();
+          
+          selection := select( generalExcelImportAndExportDataSource, GeneralExcelImportAndExportDataTable, tempGEIAEDT, tempGEIAEDT.Name() = "Sheet1" );
+          
+          MachineLogisticsCostReportCell::Import( MacroPlan, selection );
+          
+          // 鍚庣画鍒犻櫎
+          generalExcelImportAndExportDataSource.Delete();
+          
+          WebMessageBox::Success( Translations::A_VWED_Success() );
+        }
+      } onerror {
+        WebMessageBox::Error( e.GeneralInformation() );
+      }
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Views/MachineLogisticsCostReport.vw b/_Main/UI/MacroPlannerWebApp/Views/MachineLogisticsCostReport.vw
index 4f9b6ae..322ae26 100644
--- a/_Main/UI/MacroPlannerWebApp/Views/MachineLogisticsCostReport.vw
+++ b/_Main/UI/MacroPlannerWebApp/Views/MachineLogisticsCostReport.vw
@@ -27,6 +27,147 @@
           {
             sizeRatio: 1
           }
+          FormMachineLogisticsCostReport_MatrixEditor912
+          {
+            gridColor: '#c4c4c4'
+            totalHeaderWidth: 200
+            attributeHeaderWidthRatio: 0.6
+            nameHeaderWidthRatio: 0.4
+            columnWidth: 90
+            horizontalGrid: true
+            verticalGrid: true
+            backendState
+            {
+              componentId: 'QMacroPlanner::FormMachineLogisticsCostReport.MatrixEditor912'
+              state
+              {
+                cells
+                {
+                  attributes
+                  {
+                    attribute_PackingCharges
+                    {
+                      type: 'MatrixEditorWebApiCellDataModelInterest'
+                      index: 0
+                      rowsubtotal: ''
+                      columnsubtotal: ''
+                      attribute: 'PackingCharges'
+                    }
+                    attribute_UnpackingCost
+                    {
+                      type: 'MatrixEditorWebApiCellDataModelInterest'
+                      index: 1
+                      rowsubtotal: ''
+                      columnsubtotal: ''
+                      attribute: 'UnpackingCost'
+                    }
+                    attribute_BufferPaperCost
+                    {
+                      type: 'MatrixEditorWebApiCellDataModelInterest'
+                      index: 2
+                      rowsubtotal: ''
+                      columnsubtotal: ''
+                      attribute: 'BufferPaperCost'
+                    }
+                    attribute_QuantityOfWoodenCrates
+                    {
+                      type: 'MatrixEditorWebApiCellDataModelInterest'
+                      index: 3
+                      rowsubtotal: ''
+                      columnsubtotal: ''
+                      attribute: 'QuantityOfWoodenCrates'
+                    }
+                    attribute_WoodenCrateCost
+                    {
+                      type: 'MatrixEditorWebApiCellDataModelInterest'
+                      index: 4
+                      rowsubtotal: ''
+                      columnsubtotal: ''
+                      attribute: 'WoodenCrateCost'
+                    }
+                    attribute_TransferCost
+                    {
+                      type: 'MatrixEditorWebApiCellDataModelInterest'
+                      index: 5
+                      rowsubtotal: ''
+                      columnsubtotal: ''
+                      attribute: 'TransferCost'
+                    }
+                    attribute_StorageFeesForRentedWarehouses
+                    {
+                      type: 'MatrixEditorWebApiCellDataModelInterest'
+                      index: 6
+                      rowsubtotal: ''
+                      columnsubtotal: ''
+                      attribute: 'StorageFeesForRentedWarehouses'
+                    }
+                    attribute_OutboundExpensesForRentedWarehouses
+                    {
+                      type: 'MatrixEditorWebApiCellDataModelInterest'
+                      index: 7
+                      rowsubtotal: ''
+                      columnsubtotal: ''
+                      attribute: 'OutboundExpensesForRentedWarehouses'
+                    }
+                    attribute_ExternalRentalWarehouseTransportationCosts
+                    {
+                      type: 'MatrixEditorWebApiCellDataModelInterest'
+                      index: 8
+                      rowsubtotal: ''
+                      columnsubtotal: ''
+                      attribute: 'ExternalRentalWarehouseTransportationCosts'
+                    }
+                    attribute_RentalWarehouseStorageFees
+                    {
+                      type: 'MatrixEditorWebApiCellDataModelInterest'
+                      index: 9
+                      rowsubtotal: ''
+                      columnsubtotal: ''
+                      attribute: 'RentalWarehouseStorageFees'
+                    }
+                    attribute_EstimatedTotalCost
+                    {
+                      type: 'MatrixEditorWebApiCellDataModelInterest'
+                      index: 10
+                      rowsubtotal: ''
+                      columnsubtotal: ''
+                      attribute: 'EstimatedTotalCost'
+                    }
+                    attribute_Coefficient
+                    {
+                      type: 'MatrixEditorWebApiCellDataModelInterest'
+                      index: 11
+                      rowsubtotal: ''
+                      columnsubtotal: ''
+                      attribute: 'Coefficient'
+                    }
+                    attribute_TotalCost
+                    {
+                      type: 'MatrixEditorWebApiCellDataModelInterest'
+                      index: 12
+                      rowsubtotal: ''
+                      columnsubtotal: ''
+                      attribute: 'TotalCost'
+                    }
+                  }
+                }
+                columns
+                {
+                  sorting
+                  {
+                    criteria: "datamember:'StartDate'"
+                  }
+                }
+                rows
+                {
+                  sorting
+                  {
+                    criteria: "datamember:'Index';datamember:'Category'"
+                  }
+                }
+              }
+            }
+          }
         }
       }
       form_FormGeneralSettings

--
Gitblit v1.9.3