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

---
 /dev/null                                                                                           |    8 --
 _Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl                            |   25 +++++--
 _Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl                                           |   44 +++++++++-----
 _Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl                                     |    1 
 _Main/BL/Type_DispatchShiftPlan/Attribute_ShiftQty.qbl                                              |    7 ++
 _Main/BL/Relations/Relation_DispatchShiftPlan_InterfaceLoginfo_InterfaceLoginfo_DispatchShiftPl.qbl |   23 +++++++
 _Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl                                         |    6 ++
 _Main/BL/Type_DispatchShiftPlan/StaticMethod_Publish.qbl                                            |   29 +++++++++
 8 files changed, 112 insertions(+), 31 deletions(-)

diff --git a/_Main/BL/EDI/Broker_RB_DispatchShiftPlanBroker.qbl b/_Main/BL/EDI/Broker_RB_DispatchShiftPlanBroker.qbl
deleted file mode 100644
index 3e006d1..0000000
--- a/_Main/BL/EDI/Broker_RB_DispatchShiftPlanBroker.qbl
+++ /dev/null
@@ -1,119 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-EDIBroker RB_DispatchShiftPlanBroker
-{
-  MDSDefinition: RecycleBin
-  TimeZone: 'ACT'
-  UseOSTimeZone: false
-  EDIModelLink.Source DispatchShiftPlanSource
-  {
-    EDIMLTable DispatchShiftPlan
-    {
-      TargetType: DispatchShiftPlan
-      EDIMLColumn Fac { Attribute: Fac ValueType: String }
-      EDIMLColumn FactoryName { Attribute: FactoryName ValueType: String }
-      EDIMLColumn ID { Attribute: ID ValueType: String }
-      EDIMLColumn InterfaceTime { Attribute: InterfaceTime ValueType: DateTime }
-      EDIMLColumn ProductLine { Attribute: ProductLine ValueType: String }
-      EDIMLColumn ShiftDate { Attribute: ShiftDate ValueType: Date }
-      EDIMLColumn Tips { Attribute: Tips ValueType: String }
-      EDIMLColumn VersionFlag { Attribute: VersionFlag ValueType: String }
-      EDIMLColumn VersionName { Attribute: VersionName ValueType: String }
-    }
-  }
-  EDIODBCLink.Destination DispatchShiftPlanDestination
-  {
-    DataIntegrityStrategy: 'Disabled'
-    SettingsEngineLink: 'domainmodel.ediremotedatasourcedefinition.remotestorage.vwed'
-    EDIODBCLinkTable A_DispatchShiftPlan
-    {
-      MayCreateTable: true
-      MayDeleteRow: true
-      MayDropTable: true
-      MayFlushTable: true
-      MayInsertRow: true
-      Parameters: '/owner="dbo"'
-      PrimaryKeyColumns: ID
-      RecordModificationHintStrategy: 'None'
-      EDIODBCLinkColumn Fac
-      {
-        MayUpdateColumn: true
-        ValueType: String
-      }
-      EDIODBCLinkColumn FactoryName
-      {
-        MayUpdateColumn: true
-        ValueType: String
-      }
-      EDIODBCLinkColumn ID
-      {
-        MayUpdateColumn: true
-        ValueType: String
-      }
-      EDIODBCLinkColumn InterfaceTime
-      {
-        MayUpdateColumn: true
-        ValueType: DateTime
-      }
-      EDIODBCLinkColumn ProductLine
-      {
-        MayUpdateColumn: true
-        ValueType: String
-      }
-      EDIODBCLinkColumn ShiftDate
-      {
-        MayUpdateColumn: true
-        ValueType: DateTime
-      }
-      EDIODBCLinkColumn Tips
-      {
-        MayUpdateColumn: true
-        ValueType: String
-      }
-      EDIODBCLinkColumn VersionFlag
-      {
-        MayUpdateColumn: true
-        ValueType: String
-      }
-      EDIODBCLinkColumn VersionName
-      {
-        MayUpdateColumn: true
-        ValueType: String
-      }
-    }
-  }
-  EDITransformation.Transformation DispatchShiftPlanTransformation
-  {
-    EDITableTransformation
-    {
-      InputTable: DispatchShiftPlan
-      OutputTable: A_DispatchShiftPlan
-      EDIColumnMatch { InputColumn: Fac OutputColumn: Fac }
-      EDIColumnMatch { InputColumn: FactoryName OutputColumn: FactoryName }
-      EDIColumnMatch { InputColumn: ID OutputColumn: ID }
-      EDIColumnMatch { InputColumn: InterfaceTime OutputColumn: InterfaceTime }
-      EDIColumnMatch { InputColumn: ProductLine OutputColumn: ProductLine }
-      EDIColumnMatch
-      {
-        InputColumn: ShiftDate
-        OutputColumn: ShiftDate
-        Converter
-        {
-          XMLDefinition:
-          [*
-            <?xml version="1.0" encoding="UTF-16"?>
-            <DateToDateTime xmlns="http://www.quintiq.com/GEB/DateToDateTime" Key="@1">
-              <IsStandard>true</IsStandard>
-              <IsISO>false</IsISO>
-              <IsCustom>false</IsCustom>
-              <ConversionType>0</ConversionType>
-            </DateToDateTime>
-          *]
-        }
-      }
-      EDIColumnMatch { InputColumn: Tips OutputColumn: Tips }
-      EDIColumnMatch { InputColumn: VersionFlag OutputColumn: VersionFlag }
-      EDIColumnMatch { InputColumn: VersionName OutputColumn: VersionName }
-    }
-  }
-}
diff --git a/_Main/BL/Relations/Relation_DispatchShiftPlan_Archive_Archive_DispatchShiftPlan.qbl b/_Main/BL/Relations/Relation_DispatchShiftPlan_Archive_Archive_DispatchShiftPlan.qbl
deleted file mode 100644
index f45c374..0000000
--- a/_Main/BL/Relations/Relation_DispatchShiftPlan_Archive_Archive_DispatchShiftPlan.qbl
+++ /dev/null
@@ -1,23 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Relation DispatchShiftPlan_Archive_Archive_DispatchShiftPlan
-{
-  #keys: '1[414996.1.121982603]'
-  DefaultRelationStrategy
-  {
-  }
-  RelationSide.LeftSide Archive
-  {
-    #keys: '3[414996.1.121982605][414996.1.121982604][414996.1.121982606]'
-    Cardinality: '0to1'
-    ObjectDefinition: DispatchShiftPlan
-    OwningSide: 'Reference'
-  }
-  RelationSide.RightSide DispatchShiftPlan
-  {
-    #keys: '3[414996.1.121982608][414996.1.121982607][414996.1.121982609]'
-    Cardinality: '1toN'
-    ObjectDefinition: Archive
-    OwningSide: 'Owned'
-  }
-}
diff --git a/_Main/BL/Relations/Relation_DispatchShiftPlan_InterfaceLoginfo_InterfaceLoginfo_DispatchShiftPl.qbl b/_Main/BL/Relations/Relation_DispatchShiftPlan_InterfaceLoginfo_InterfaceLoginfo_DispatchShiftPl.qbl
new file mode 100644
index 0000000..7938196
--- /dev/null
+++ b/_Main/BL/Relations/Relation_DispatchShiftPlan_InterfaceLoginfo_InterfaceLoginfo_DispatchShiftPl.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation DispatchShiftPlan_InterfaceLoginfo_InterfaceLoginfo_DispatchShiftPlan
+{
+  #keys: '1[414996.1.203950081]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide InterfaceLoginfo
+  {
+    #keys: '3[414996.1.203950083][414996.1.203950082][414996.1.203950084]'
+    Cardinality: '0to1'
+    ObjectDefinition: DispatchShiftPlan
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide DispatchShiftPlan
+  {
+    #keys: '3[414996.1.203950086][414996.1.203950085][414996.1.203950087]'
+    Cardinality: '1toN'
+    ObjectDefinition: InterfaceLoginfo
+    OwningSide: 'Owned'
+  }
+}
diff --git a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
index 25bb40e..1cf5d6b 100644
--- a/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_DL_EngineRackCell/StaticMethod_CreateData.qbl
@@ -201,6 +201,9 @@
       cell.DLExternalRentalWarehouseTransportationCosts( sum( dlerc, DL_EngineRackCell, tempDLERCell, tempDLERCell.DL_EngineRackRow().Generation() <> "SUM", tempDLERCell.DLExternalRentalWarehouseTransportationCosts() ) );
       cell.DLRentalWarehouseStorageFees( sum( dlerc, DL_EngineRackCell, tempDLERCell, tempDLERCell.DL_EngineRackRow().Generation() <> "SUM", tempDLERCell.DLRentalWarehouseStorageFees() ) );
       cell.CleaningCost( sum( dlerc, DL_EngineRackCell, tempDLERCell, tempDLERCell.DL_EngineRackRow().Generation() <> "SUM", tempDLERCell.CleaningCost() ) );
+      cell.CCCleaningCost( sum( dlerc, DL_EngineRackCell, tempDLERCell, tempDLERCell.DL_EngineRackRow().Generation() <> "SUM", tempDLERCell.CCCleaningCost() ) ); // CC澶栫搴撴竻娲楄垂鐢�
+      cell.DLRentalWarehouseMaterialRackCost( sum( dlerc, DL_EngineRackCell, tempDLERCell, tempDLERCell.DL_EngineRackRow().Generation() <> "SUM", tempDLERCell.DLRentalWarehouseMaterialRackCost() ) ); // 澶ц繛澶栫搴撴枡鏋惰垂鐢�
+      cell.CCExternalRentalWarehouseDLMaterialRackCost( sum( dlerc, DL_EngineRackCell, tempDLERCell, tempDLERCell.DL_EngineRackRow().Generation() <> "SUM", tempDLERCell.CCExternalRentalWarehouseDLMaterialRackCost() ) ); // CC澶栫搴揇L鏂欐灦璐圭敤
       cell.EstimatedTotalCost( sum( dlerc, DL_EngineRackCell, tempDLERCell, tempDLERCell.DL_EngineRackRow().Generation() <> "SUM", tempDLERCell.EstimatedTotalCost() ) );
       cell.Coefficient( 1.05 );
       cell.TotalCost( sum( dlerc, DL_EngineRackCell, tempDLERCell, tempDLERCell.DL_EngineRackRow().Generation() <> "SUM", tempDLERCell.TotalCost() ) );
@@ -224,6 +227,9 @@
       cell.DLExternalRentalWarehouseTransportationCosts( sum( dlerr, DL_EngineRackCell, tempDLERCell, not tempDLERCell.DL_EngineRackColumn().StartDate().IsMaxInfinity(), tempDLERCell.DLExternalRentalWarehouseTransportationCosts() ) );    
       cell.DLRentalWarehouseStorageFees( sum( dlerr, DL_EngineRackCell, tempDLERCell, not tempDLERCell.DL_EngineRackColumn().StartDate().IsMaxInfinity(), tempDLERCell.DLRentalWarehouseStorageFees() ) );    
       cell.CleaningCost( sum( dlerr, DL_EngineRackCell, tempDLERCell, not tempDLERCell.DL_EngineRackColumn().StartDate().IsMaxInfinity(), tempDLERCell.CleaningCost() ) );    
+      cell.CCCleaningCost( sum( dlerr, DL_EngineRackCell, tempDLERCell, not tempDLERCell.DL_EngineRackColumn().StartDate().IsMaxInfinity(), tempDLERCell.CCCleaningCost() ) ); // CC澶栫搴撴竻娲楄垂鐢�
+      cell.DLRentalWarehouseMaterialRackCost( sum( dlerr, DL_EngineRackCell, tempDLERCell, not tempDLERCell.DL_EngineRackColumn().StartDate().IsMaxInfinity(), tempDLERCell.DLRentalWarehouseMaterialRackCost() ) ); // 澶ц繛澶栫搴撴枡鏋惰垂鐢�
+      cell.CCExternalRentalWarehouseDLMaterialRackCost( sum( dlerr, DL_EngineRackCell, tempDLERCell, not tempDLERCell.DL_EngineRackColumn().StartDate().IsMaxInfinity(), tempDLERCell.CCExternalRentalWarehouseDLMaterialRackCost() ) ); // CC澶栫搴揇L鏂欐灦璐圭敤
       cell.EstimatedTotalCost( sum( dlerr, DL_EngineRackCell, tempDLERCell, not tempDLERCell.DL_EngineRackColumn().StartDate().IsMaxInfinity(), tempDLERCell.EstimatedTotalCost() ) );    
       cell.Coefficient( 1.05 );
       cell.TotalCost( sum( dlerr, DL_EngineRackCell, tempDLERCell, not tempDLERCell.DL_EngineRackColumn().StartDate().IsMaxInfinity(), tempDLERCell.TotalCost() ) );                        
diff --git a/_Main/BL/Type_DispatchShiftPlan/Attribute_ShiftQty.qbl b/_Main/BL/Type_DispatchShiftPlan/Attribute_ShiftQty.qbl
new file mode 100644
index 0000000..3f1cccd
--- /dev/null
+++ b/_Main/BL/Type_DispatchShiftPlan/Attribute_ShiftQty.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ShiftQty
+{
+  #keys: '3[414996.1.206760016][414996.1.206760015][414996.1.206760017]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_DispatchShiftPlan/Attribute_VersionFlag.qbl b/_Main/BL/Type_DispatchShiftPlan/Attribute_VersionFlag.qbl
deleted file mode 100644
index 047acd8..0000000
--- a/_Main/BL/Type_DispatchShiftPlan/Attribute_VersionFlag.qbl
+++ /dev/null
@@ -1,8 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute VersionFlag
-{
-  #keys: '3[414996.1.17706927][414996.1.17706926][414996.1.17706928]'
-  Description: '鐗堟湰鏍囪瘑'
-  ValueType: String
-}
diff --git a/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl b/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl
index 5d69146..fd802d5 100644
--- a/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl
+++ b/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl
@@ -1,18 +1,33 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod Dispatch (
+  InterfaceDataset interfaceDataset,
   const MacroPlan macroPlan,
-  Archive owner,
-  String versionFlag
+  String executor
 )
 {
   TextBody:
   [*
     // Akari Aug-21-2024 (created)
-    // owner.DispatchShiftPlan( relflush );
-    // owner.RB_DispatchShiftPlanBroker().Source().FlatQuery( "truncate table A_DispatchShiftPlan" );
+    now := DateTime::Now();
     
-    dispatchShiftPlans := selectset( owner,DispatchShiftPlan,dispatchShiftPlan,true );
+    interfaceLoginfo := maxselect( interfaceDataset,InterfaceLoginfo,loginfo,loginfo.Name() = Translations::InterfaceDataset_ShiftPlanPPPSPush_Name() ,loginfo.InterfaceDateTime() );
+    if( not isnull( interfaceLoginfo )){
+      if( not interfaceLoginfo.IsShow() ){
+        interfaceLoginfo.Delete();
+      }else{
+        interfaceLoginfo.Last( false );
+      }
+    }
+    
+    interfaceLoginfo := interfaceDataset.InterfaceLoginfo( relnew,
+                                                           ExecuteUser := executor,
+                                                           Name := Translations::InterfaceDataset_ShiftPlanPPPSPush_Name(),
+                                                           InterfaceDateTime := now,
+                                                           Last := true,
+                                                           Message := '鐝璁″垝锛圥PA+IDS锛夋暟鎹帹閫�' );
+    
+    dispatchShiftPlans := selectset( interfaceLoginfo,DispatchShiftPlan,dispatchShiftPlan,true );
     dispatchShiftPlanIndexTree := NamedValueTree::Create();
     for( i := 0 ; i < dispatchShiftPlans.Size() ; i++){
       dispatchShiftPlan := dispatchShiftPlans.Element( i );
@@ -41,21 +56,20 @@
          dispatchShiftPlan := dispatchShiftPlans.Element( dispatchShiftPlanIndex.GetValueAsNumber() );
          dispatchShiftPlan.Tips( shiftPlan.Remark() );
          dispatchShiftPlan.VersionName( macroPlanName );
-         dispatchShiftPlan.VersionFlag( versionFlag );
          dispatchShiftPlan.InterfaceTime( now );
        }else{
-         owner.DispatchShiftPlan( relnew,ID := OS:: GenerateGUIDAsString(),
-                                  ProductLine := productLine,
-                                  FactoryName := factory.ID(),
+         interfaceLoginfo.DispatchShiftPlan( relnew,ID := OS:: GenerateGUIDAsString(),
+                                             ProductLine := productLine,
+                                             FactoryName := factory.ID(),
+                                             ShiftQty := shiftPlan.Outcome(),
                                   
-                                  ShiftDate := shiftDate,
-                                  Tips := shiftPlan.Remark(),
-                                  VersionName := macroPlanName,
-                                  VersionFlag := versionFlag,
-                                  InterfaceTime := now );
+                                             ShiftDate := shiftDate,
+                                             Tips := shiftPlan.Remark(),
+                                             VersionName := macroPlanName,
+                                             InterfaceTime := now );
        }
     }
-    
+    DispatchShiftPlan::Publish( interfaceLoginfo );
     // owner.RB_DispatchShiftPlanBroker().AsyncExecute();
   *]
 }
diff --git a/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Publish.qbl b/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Publish.qbl
new file mode 100644
index 0000000..2dbe5b1
--- /dev/null
+++ b/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Publish.qbl
@@ -0,0 +1,29 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Publish (
+  InterfaceLoginfo loginfo
+)
+{
+  TextBody:
+  [*
+    //// 鐢勫叞楦� Jul-17-2024 (created)
+    jsonarray          := JSON::Array();
+    traverse( loginfo, DispatchShiftPlan, shiftPlan ){
+      shiftPlanjson          := JSON::Object()
+                                    .Add( "productLine", shiftPlan.ProductLine() )
+                                    .Add( "shiftDate", shiftPlan.ShiftDate().Format( 'Y-M2-D2' ) )//"2024-10-01" 
+                                    .Add( "shiftQty", shiftPlan.ShiftQty() )
+                                    .Add( "tips", shiftPlan.Tips() )
+                                    .Add( "versionName", shiftPlan.VersionName() )
+                                    .Add( "factoryName", shiftPlan.FactoryName() )
+                                    .Add( "fac", shiftPlan.Fac() )
+                                    .Add( "interfaceTime", shiftPlan.InterfaceTime().Format( 'Y-M2-D2 H:m:s' ) )/*"2024-10-01 12:00:00" )*/
+                                    .Build();
+      jsonarray.Add( shiftPlanjson );
+    }
+    loginfo.RequestBody( jsonarray.Build().AsString() );
+    info( loginfo.RequestBody() );
+    data     := InterfaceLoginfo::CallInterfaceForDataCenter( loginfo.InterfaceDataset(), loginfo );
+    info( '----------------', data.AsString() );
+  *]
+}
diff --git a/_Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl b/_Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl
index 668d9a5..27c99d0 100644
--- a/_Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl
+++ b/_Main/BL/Type_InterfaceDataset/Method_PublishPlanReportData.qbl
@@ -21,6 +21,7 @@
     //  OfflinePlanArchiveVersion::RefreshData( this, macroplan, archive );
     }
     if( isshiftplan ){//鐝璁″垝
+      DispatchShiftPlan::Dispatch(this, macroplan,executor );
     //  CustomerDemandIDS::GenerateData( this, recyclebin, archive );
     }
     if( isassembleonlineplan ){//瑁呴厤涓婄嚎璁″垝
diff --git a/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl
index 8e153df..c5b9fec 100644
--- a/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl
+++ b/_Main/BL/Type_MachineLogisticsCostReportCell/StaticMethod_CreateData.qbl
@@ -26,19 +26,27 @@
     }
     
     // 鍒涘缓鍗曞厓鏍�
-    traverse ( macroPlan, MachineLogisticsCostReportRow, mlcrr ) { // 寰幆琛�
+    traverse ( macroPlan, MachineLogisticsCostReportRow, mlcrr
+    //           , mlcrr.Factory() = "闀挎槬宸ュ巶"
+              ) { // 寰幆琛�
       info( "褰撳墠閬嶅巻鐨勮锛�", mlcrr.Factory(), " ", mlcrr.Category() );
       traverse ( macroPlan, MachineLogisticsCostReportColumn, mlcrc ) { // 寰幆鍒�
       
         // 鏈哄姞鎴愭湰鍙傛暟
-        lcm  := select( macroPlan, LogisticsCostMachining, tempLCM, tempLCM.Factory() = mlcrr.Factory() and tempLCM.Product() = mlcrr.Category()
-                        and tempLCM.StartDate() <= mlcrc.StartDate() and tempLCM.EndDate() >= mlcrc.StartDate().StartOfNextMonth() );
+        lcm   := select( macroPlan, LogisticsCostMachining, tempLCM, tempLCM.Factory() = mlcrr.Factory() and tempLCM.Product() = mlcrr.Category()
+                         and tempLCM.StartDate() <= mlcrc.StartDate() and tempLCM.EndDate() >= mlcrc.StartDate().StartOfNextMonth() );
         
         // 杩愯緭鎴愭湰鍙傛暟
-        lct  := select( macroPlan, LogisticsCostTransport, tempLCT, 
-                        tempLCT.Product()     = mlcrr.Category()                                                                                                                         and
-                        tempLCT.Origin()      = ifexpr( mlcrr.Category() = "AGW", "DL AGW", ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "DL", "CC" ) + " " + mlcrr.Category() + "澶栫搴�" )     and
-                        tempLCT.Destination() = ifexpr( mlcrr.Category() = "AGW", "CC AGW搴撴埧", ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "DL", "CC" ) + " " + mlcrr.Category() + "绾胯竟搴�" ) );
+        lct   := select( macroPlan, LogisticsCostTransport, tempLCT, 
+                         tempLCT.Product()     = mlcrr.Category()                                                                                                                         and
+                         tempLCT.Origin()      = ifexpr( mlcrr.Category() = "AGW", "DL AGW", ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "DL", "CC" ) + " " + mlcrr.Category() + "澶栫搴�" )     and
+                         tempLCT.Destination() = ifexpr( mlcrr.Category() = "AGW", "CC AGW搴撴埧", ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "DL", "CC" ) + " " + mlcrr.Category() + "绾胯竟搴�" ) );
+    
+        // 杩愯緭鎴愭湰鍙傛暟锛堣皟鎷ㄨ垂鐢級
+        lct1  := select( macroPlan, LogisticsCostTransport, tempLCT, 
+                         tempLCT.Product()     = mlcrr.Category()                                                                                                                         and
+                         tempLCT.Origin()      = ifexpr( mlcrr.Category() = "AGW", "DL AGW", ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "CC", "DL" ) + " " + mlcrr.Category() )                and
+                         tempLCT.Destination() = ifexpr( mlcrr.Category() = "AGW", "CC AGW搴撴埧", ifexpr( mlcrr.Factory() = "澶ц繛宸ュ巶", "DL", "CC" ) + " " + mlcrr.Category() + "澶栫搴�" ) );
     
          // 褰撳墠鏈堟湯鏈�鍚庝竴澶╂棩鏈�
         lastDayOfThisMonth := mlcrc.StartDate().StartOfNextMonth() - 1;
@@ -76,7 +84,8 @@
                                  guard( tempTPC.TransferPlanColumn().ColumnDate().Year()   = mlcrc.StartDate().Year(), false )                              and
                                  guard(  tempTPC.TransferPlanColumn().ColumnDate().Month() = mlcrc.StartDate().Month(), false ),
                                  [Number]tempTPC.Value() );
-        cell.TransferCost( [Number] ( [Number] ( transferQuantity / guard( lcm.PackagingCapacity(), 1 ) ) / guard( lct.LoadingCapacity(), 1 ) ) * guard( lct.TransportPrice(), 1 ) );
+    //    info( "璋冩嫧鏁伴噺锛�", transferQuantity, "    鍖呰瀹归噺锛�", guard( lcm.PackagingCapacity(), 1 ), "    瑁呰浇瀹归噺锛�", guard( lct1.LoadingCapacity(), 1 ), "    杩愯緭鍗曚环锛�",guard( lct1.TransportPrice(), 1 )  );
+        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 ) );

--
Gitblit v1.9.3