From 3d66f91917d7b1dbd1c6de29ccd0696ad1526713 Mon Sep 17 00:00:00 2001
From: lihongji <3117313295@qq.com>
Date: 星期二, 19 十一月 2024 16:31:59 +0800
Subject: [PATCH] BUG修复

---
 _Main/BL/Type_NewOfflinePlanCell/StaticMethod_SynchronizeToNewSupply.qbl |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_SynchronizeToNewSupply.qbl b/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_SynchronizeToNewSupply.qbl
index 4c521e8..d00ed54 100644
--- a/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_SynchronizeToNewSupply.qbl
+++ b/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_SynchronizeToNewSupply.qbl
@@ -9,28 +9,25 @@
   TextBody:
   [*
     traverse ( selectedRows, Elements.NewOfflinePlanCell, cell, 
-               cell.NewOfflinePlanRow().Type() = "1" and cell.Quantity() > 0.0 
+               cell.NewOfflinePlanRow().Type() = "1" and cell.Quantity() >= 0.0 
     //           and cell.NewOfflinePlanRow().ProductionLine() = "eMotor Assy (France)" and cell.NewOfflinePlanColumn().StartDate() = Date::Construct( 2020, 4, 4 )
              ) 
     {
-     pto := select( macroPlan, Unit.Operation.PeriodTaskOperation, tempPTO,
-                    exists( tempPTO, NewSupply, tempNS, tempNS.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().ProductID() = cell.NewOfflinePlanRow().ProductID() ) and
-                    tempPTO.Operation().UnitID() = cell.NewOfflinePlanRow().ProductionLine()                                                                                                 and
-                    tempPTO.Start().Date()       = cell.NewOfflinePlanColumn().StartDate() );
-      if ( isnull( pto ) ) {
+      pto := select( macroPlan, Unit.Operation.PeriodTaskOperation, tempPTO,
+                     exists( tempPTO, NewSupply, tempNS, tempNS.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().ProductID() = cell.NewOfflinePlanRow().ProductID() ) and
+                     tempPTO.Operation().UnitID() = cell.NewOfflinePlanRow().ProductionLine()                                                                                                 and
+                     tempPTO.Start().Date()       = cell.NewOfflinePlanColumn().StartDate() );
+      if ( isnull( pto ) and cell.Quantity() > 0 ) {
         o  := select( macroPlan, Unit.Operation, tempO, tempO.ID() = cell.NewOfflinePlanRow().OperationID() );
         up := select( macroPlan, Unit.UnitPeriod, tempUP, tempUP.UnitID() = cell.NewOfflinePlanRow().ProductionLine() and tempUP.StartDate() = cell.NewOfflinePlanColumn().StartDate() );
         if ( not isnull( o ) and not isnull( up ) ) {
           PeriodTaskOperation::Create( o, up, cell.Quantity(), false );
         }
-      } else {
+      } else if ( not isnull( pto ) ) {
         if ( [Number]cell.Quantity() <> [Number]pto.Quantity() ) {
           pto.Update( cell.Quantity(), false );
         }
       }
-      
-      
-      
       
     }
   *]

--
Gitblit v1.9.3