From 76c7b6120bb5a3076a31f3c3eb7e068f290f68d3 Mon Sep 17 00:00:00 2001
From: limj <limj@taizhitech.com>
Date: 星期一, 25 九月 2023 20:47:39 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/TIANMA_JITUAN into dev_lmj

---
 _Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl |   45 +++++++++++++++++++++++++++++++++++----------
 1 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl b/_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl
index e885859..e428bb7 100644
--- a/_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl
+++ b/_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl
@@ -38,23 +38,23 @@
     }
     // 妫�鏌ヤ緷璧栭」
     if( isnull( product) ) {
-        info( "product not found" );  
+        info( "product not found" + productId);  
     }
     if( isnull( salesSegment) ) {
-        info( "sales segment not found" );  
+        info( "sales segment not found" + salesSegmentName);  
     }
     if( isnull( stockingPoint) ) {
-        info( "stock point not found" );  
+        info( "stock point not found" + stockingPointId);  
     }
     //if( isnull( currency) ) {
     //    error( "currency not found" );  
     //}
     if( unitOfMeasureName <> "" and isnull( unitOfMeasure) ) {
-        info( "unit of measure not found" );  
+        info( "unit of measure not found" + unitOfMeasureName);  
     }
-    if( priorityName <> "" and isnull( stockingPoint) ) {
-        info( "priority not found" );  
-    }
+    //if( priorityName <> "" and isnull( stockingPoint) ) {
+    //    info( "priority not found" );  
+    //}
     // 鏂板/鏇存柊
     result := CustomerOrder::FindById( macroPlan, id );
     if( isnull( result ) ) {
@@ -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