From ad242bf0203ebb1236bd2cb5c1da1dd8619aedce Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期三, 25 九月 2024 11:44:55 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev

---
 _Main/BL/Type_ChangeLossSettingExcel/StaticMethod_Import.qbl |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_Import.qbl b/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_Import.qbl
index 466849e..2e8db80 100644
--- a/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_Import.qbl
+++ b/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_Import.qbl
@@ -20,19 +20,32 @@
       macroplan.ChangeLossSettingExcel( relflush );
       error( e.GeneralInformation() );
     }
+    clsset              := construct( ChangeLossSettings );
     //閬嶅巻澶勭悊瀵煎叆鐨勬暟鎹�
     traverse( macroplan, ChangeLossSettingExcel, excel ){
       cls               := selectobject(  macroplan, ChangeLossSetting, cls, cls.ProductFirst().ID() = excel.Product1()
                                           and cls.ProductSecond().ID() = excel.Product2()
-                                          and cls.Unit().ID() = excel.Unit() );
+                                          and cls.Unit().ID() = excel.Unit()
+                                          and cls.StartDate() = excel.StartDate()
+                                          and cls.EndDate() = excel.EndDate() );
       if( isnull( cls ) ){
-        cls             := macroplan.ChangeLossSetting( relnew, ChangeLossNr := [Number]excel.ChangeLossNumber() );
         product1        := selectobject( macroplan, Product_MP, product, product.ID() = excel.Product1() );
         product2        := selectobject( macroplan, Product_MP, product, product.ID() = excel.Product2() );
         unit            := selectobject( macroplan, Unit, unit, unit.ID() = excel.Unit() );
-        cls.ProductFirst( relset, product1 );
-        cls.ProductSecond( relset, product2 );
-        cls.Unit( relset, unit );
+        feedback        := '';
+        if( ChangeLossSetting::ValidateInput( feedback, macroplan, null( ChangeLossSetting ), unit, product1, product2, excel.StartDate(), excel.EndDate(), [Number]excel.ChangeLossNumber() ) ){
+          cls             := macroplan.ChangeLossSetting( relnew, ChangeLossNr := [Number]excel.ChangeLossNumber() );
+          
+          cls.ProductFirst( relset, product1 );
+          cls.ProductSecond( relset, product2 );
+          cls.Unit( relset, unit );
+          clsset.Add( cls );
+        }else{
+          traverse( clsset, Elements, e ){
+            e.Delete();
+          }
+          error( feedback );
+        }
       }else {
         cls.ChangeLossNr( [Number]excel.ChangeLossNumber() );
       }

--
Gitblit v1.9.3