From 42f46304bc28d9fb2bee770668b70204d877db93 Mon Sep 17 00:00:00 2001
From: yanweiyuan3 <yanweiyuan3@gmail.com>
Date: 星期五, 22 九月 2023 17:24:31 +0800
Subject: [PATCH] Merge branch 'dev_yy' into dev

---
 _Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl b/_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl
index e885859..3ec5f41 100644
--- a/_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl
+++ b/_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl
@@ -62,9 +62,34 @@
                                priorityName, salesSegmentName, currencyId, unitOfMeasureName, 
                                false, customerName, customerId, orderId, orderLineId, true, true, true );
     } else {
-        result.Update( product, stockingPoint, orderDate, quantity, price, 
-                       priorityName, salesSegmentName, currencyId, unitOfMeasureName, 
-                       false, customerName, customerId, orderId, orderLineId, true, true, true );
+        if( result.ProductID() = productId 
+            and result.StockingPointID() = stockingPointId 
+            and result.StartDate() = orderDate 
+            and result.Quantity() = quantity 
+            and result.Price() = price 
+            and result.PriorityName() = priorityName 
+            and result.SalesSegmentName() = salesSegmentName 
+            and result.CurrencyID() = currencyId 
+            and result.UnitOfMeasureName() = unitOfMeasureName 
+            and result.CustomerName() = customerName 
+            and result.CustomerID() = customerId 
+            and result.OrderID() = orderId 
+            and result.OrderLineID() = orderLineId ){
+              info( "No need to update this order: " + id );
+              }else{
+                if( result.IsLocked() = true ){
+                  pispips := selectset( result, ProductInStockingPoint_MP.ProductInStockingPointInPeriod, pispip, true );
+                  pispipLeafs := selectset( pispips, 
+                                            Elements.astype( ProductInStockingPointInPeriodPlanningLeaf ), 
+                                            pispip, 
+                                            true );
+                  ProductInStockingPointInPeriod::LockUnlockPlanning( pispipLeafs, false, true );
+                }
+                result.Update( product, stockingPoint, orderDate, quantity, price, 
+                               priorityName, salesSegmentName, currencyId, unitOfMeasureName, 
+                               false, customerName, customerId, orderId, orderLineId, true, true, true );
+                result.IsLocked( false );
+                }
     }
     return result;
   *]

--
Gitblit v1.9.3