From 9e6cd153724264ff955d7e398c395db7a33f7e0d Mon Sep 17 00:00:00 2001
From: renhao <renhui.hao@capgemini.com>
Date: 星期三, 13 九月 2023 19:08:26 +0800
Subject: [PATCH] external supply修改 product字段调整

---
 _Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl |   20 +++++----
 _Main/BL/Type_Product_MP/StaticMethod_CreateOrUpdate.qbl     |   11 ++++-
 _Main/BL/Type_MacroPlan/Method_MappingProductData.qbl        |   15 ++++---
 _Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl  |    2 
 _Main/BL/Type_Product_MP/Attribute_KeyProduct.qbl            |    7 +++
 _Main/BL/Type_Product_MP/Attribute_BusinessTypeCommon.qbl    |    7 +++
 6 files changed, 43 insertions(+), 19 deletions(-)

diff --git a/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
index ea2ad61..1f242ac 100644
--- a/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
@@ -9,8 +9,9 @@
   [*
     // renhao Aug-14-2023 (created)
     
-    listtodeal := selectset( this,MappingExternalSupply,externalSupply, true );
+    listtodeal := selectset( this,MappingExternalSupply,externalSupply, externalSupply.UserQuantity()>0 );
     totalcount := listtodeal.Size();
+    description := "鍦ㄩ�斿湪鍒�";
     info( "ExternalSupply has " + totalcount.AsQUILL() + " rows in total" );
     
     count := 0;
@@ -19,10 +20,11 @@
       if( count - [Number](count/1000) * 1000 = 0 or count = totalcount ){
         info( "Now is dealing with the " + count.AsQUILL() + "ExternalSupply " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
         }
-      product := select( this,MappingProduct,product,product.ID() = externalSupply.ProductID() and product.KeyProduct() = nuclear,true);
+      product := select( this,MappingProduct,product,product.ID() = externalSupply.ProductID(),true);
+      
       
       if( not isnull( product)){
-        productMP :=  select( this,Product_MP,productMP,productMP.ID() = externalSupply.ProductID() ,true);
+        productMP :=  Product_MP :: FindProductTypeIndex( externalSupply.ProductID());
         stockingpoint := select( this,StockingPoint_MP,st,st.ID() = externalSupply.StockingPointID(),true);
         if( not isnull(businessTypes)){
         
@@ -34,25 +36,25 @@
                                                stockingpoint,
                                                externalSupply.Date(),
                                                externalSupply.ManufacturedDate(),
-                                               externalSupply.UserQuantity(),"鍦ㄩ�斿湪鍒�");
+                                               externalSupply.UserQuantity(),description);
             }
           }
           
         }else{
-        if( not isnull( stockingpoint) and not isnull( productMP)){
-          InventorySupply::CreateOrUpdate( externalSupply.ID(),
+          if( not isnull( stockingpoint) and not isnull( productMP)){
+            InventorySupply::CreateOrUpdate( externalSupply.ID(),
                                            productMP,
                                            stockingpoint,
                                            externalSupply.Date(),
                                            externalSupply.ManufacturedDate(),
-                                           externalSupply.UserQuantity(),"鍦ㄩ�斿湪鍒�");
-        }
+                                           externalSupply.UserQuantity(),description);
+          }
       
         }
         
       }else{
         info( "Invaild product" );
-        }
+      }
     }
   *]
 }
diff --git a/_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl
index 98be129..3713cc9 100644
--- a/_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl
@@ -27,7 +27,7 @@
                           moperation.ProductID() = item.ProductID(), 
                           moperation.SequenceNumber() ).SequenceNumber()
       if( item.SequenceNumber() = maxsn ){
-        listtodealwithmaxsn.Add( item );
+          listtodealwithmaxsn.Add( item );
         }
       }
     
diff --git a/_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl
index fa5aa3b..492ebce 100644
--- a/_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl
@@ -23,9 +23,9 @@
     } else {
         if( iskeyproduct = true ){
           listToDeal := selectset( this, MappingProduct, item, item.KeyProduct() = true,  businesstypes.Find(  item.BusinessType()) > 0 );
-          }
+         }
         else{
-        listToDeal := selectset( this, MappingProduct, item, businesstypes.Find(  item.BusinessType()) > 0 );
+          listToDeal := selectset( this, MappingProduct, item, businesstypes.Find(  item.BusinessType()) > 0 );
         }
     }
     totalcount := listToDeal.Size();
@@ -38,7 +38,7 @@
                                 "鍏ㄩ儴鐗╂枡浜у搧", 
                                 "PCS", 
                                 "鍏ㄩ儴鐗╂枡浜у搧",
-                                0.0
+                                0.0,false,false
                                 );
     count := 0;
     // Get the ProductMajorType list & ProductSubclassType list
@@ -54,7 +54,7 @@
                                     item.ProductMajorType(), 
                                     "PCS", 
                                     item.ProductMajorType(),
-                                    0.0
+                                    0.0,false,false
                                     );
       }
       productmajortype := item.ProductMajorType();
@@ -69,12 +69,12 @@
                                     item.ProductSubclassType(), 
                                     "PCS", 
                                     item.ProductSubclassType(),
-                                    0.0
+                                    0.0,false,false
                                     );
         }
       productsubclasstype := item.ProductSubclassType();
       if( productsubclasstype="" ){
-        productsubclasstype := productmajortype;
+          productsubclasstype := productmajortype;
         }
       
       if( not item.ID() = "" ){
@@ -84,7 +84,8 @@
                                       item.ID(), 
                                       item.UnitOfMeasureName(), 
                                       item.Name(),
-                                      item.ShelfLife()
+                                      item.ShelfLife(),
+                                      item.KeyProduct(),item.IsCommon()
                                       );
         }
       }
diff --git a/_Main/BL/Type_Product_MP/Attribute_BusinessTypeCommon.qbl b/_Main/BL/Type_Product_MP/Attribute_BusinessTypeCommon.qbl
new file mode 100644
index 0000000..b384b1d
--- /dev/null
+++ b/_Main/BL/Type_Product_MP/Attribute_BusinessTypeCommon.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute BusinessTypeCommon
+{
+  #keys: '3[414480.0.138606036][414480.0.138606035][414480.0.138606037]'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_Product_MP/Attribute_KeyProduct.qbl b/_Main/BL/Type_Product_MP/Attribute_KeyProduct.qbl
new file mode 100644
index 0000000..6261b43
--- /dev/null
+++ b/_Main/BL/Type_Product_MP/Attribute_KeyProduct.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute KeyProduct
+{
+  #keys: '3[414480.0.138606008][414480.0.138606007][414480.0.138606009]'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_Product_MP/StaticMethod_CreateOrUpdate.qbl b/_Main/BL/Type_Product_MP/StaticMethod_CreateOrUpdate.qbl
index 7d60ea3..2cc1d59 100644
--- a/_Main/BL/Type_Product_MP/StaticMethod_CreateOrUpdate.qbl
+++ b/_Main/BL/Type_Product_MP/StaticMethod_CreateOrUpdate.qbl
@@ -7,7 +7,9 @@
   String name,
   String unitofmeasurename,
   String description,
-  Real shelflife
+  Real shelflife,
+  Boolean keyproduct,
+  Boolean businesstypecommon
 )
 {
   TextBody:
@@ -28,7 +30,7 @@
     //info( productid );
     
     if( isnull( product ) ){
-      Product_MP::Create( owner, 
+      product := Product_MP::Create( owner, 
                           productid, 
                           parentid, 
                           name, 
@@ -44,6 +46,9 @@
                           isexcludedfromfulfilmentkpis, 
                           isfromdb
                           );
+                         
+        product.KeyProduct(keyproduct);
+        product.BusinessTypeCommon(businesstypecommon);
       }else{
         product.Update( productid, 
                         name, 
@@ -60,6 +65,8 @@
                         isexcludedfromfulfilmentkpis, 
                         isfromdb
                         );
+          product.KeyProduct(keyproduct);
+          product.BusinessTypeCommon(businesstypecommon);
         }
   *]
 }

--
Gitblit v1.9.3