From 936cbe9cabf9ae35420a16d4b00f10965ae63a3c Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期一, 30 九月 2024 16:29:59 +0800
Subject: [PATCH] 换型损失设置数量改为正数

---
 _Main/BL/InfoMessages.qbl                                                                                     |    2 
 _Main/UI/MacroPlannerWebApp/Views/Change_loss_setting_view.vw                                                 |   10 ++--
 /dev/null                                                                                                     |    8 ----
 _Main/BL/Type_ChangeLossSettingExcel/StaticMethod_Import.qbl                                                  |    8 ++-
 _Main/BL/Type_ChangeLossSetting/Attribute_ChangeLossNumber.qbl                                                |    7 +++
 _Main/UI/MacroPlannerWebApp/Component_FormChangeLossSetting/Component_ListChangeLossSetting#568.def           |    2 
 _Main/BL/Type_ChangeLossSetting/StaticMethod_ValidateInput.qbl                                                |    8 ++-
 _Main/BL/Type_ChangeLossSettingExcel/StaticMethod_ExportTemplate.qbl                                          |    2 
 _Main/metadata.properties                                                                                     |    2 
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateEditChangeLossSetting/Response_pnlActions_btnOk_OnClick.def |    2 
 _Main/BL/Type_ChangeLossSettingExcel/StaticMethod_CheckImport.qbl                                             |    2 
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateEditChangeLossSetting/Component_pnlContent.def              |   23 +++++------
 _Main/BL/Type_OfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl                                     |    2 
 13 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/_Main/BL/InfoMessages.qbl b/_Main/BL/InfoMessages.qbl
index 84c6052..fa931f1 100644
--- a/_Main/BL/InfoMessages.qbl
+++ b/_Main/BL/InfoMessages.qbl
@@ -172,7 +172,7 @@
   }
   InfoMessage MP_ChangeLossSettingExcel_Import_PositiveInteger
   {
-    DefaultText: 'The import ChangeLossNr is not positive integer.'
+    DefaultText: 'The import ChangeLossNr is not positive number.'
   }
   InfoMessage MP_ChangeLossSettingExcel_Import_ProductNoExist
   {
diff --git a/_Main/BL/Type_ChangeLossSetting/Attribute_ChangeLossNr.qbl b/_Main/BL/Type_ChangeLossSetting/Attribute_ChangeLossNr.qbl
deleted file mode 100644
index 3632e29..0000000
--- a/_Main/BL/Type_ChangeLossSetting/Attribute_ChangeLossNr.qbl
+++ /dev/null
@@ -1,8 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute ChangeLossNr
-{
-  #keys: '3[415136.0.738030098][415136.0.738030097][415136.0.738030099]'
-  Description: '鎹㈠瀷鎹熷け锛堝彴锛�'
-  ValueType: Number
-}
diff --git a/_Main/BL/Type_ChangeLossSetting/Attribute_ChangeLossNumber.qbl b/_Main/BL/Type_ChangeLossSetting/Attribute_ChangeLossNumber.qbl
new file mode 100644
index 0000000..f110070
--- /dev/null
+++ b/_Main/BL/Type_ChangeLossSetting/Attribute_ChangeLossNumber.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ChangeLossNumber
+{
+  #keys: '3[415136.0.1176550071][415136.0.1176550070][415136.0.1176550072]'
+  ValueType: Real
+}
diff --git a/_Main/BL/Type_ChangeLossSetting/StaticMethod_ValidateInput.qbl b/_Main/BL/Type_ChangeLossSetting/StaticMethod_ValidateInput.qbl
index 6980d92..ebd5300 100644
--- a/_Main/BL/Type_ChangeLossSetting/StaticMethod_ValidateInput.qbl
+++ b/_Main/BL/Type_ChangeLossSetting/StaticMethod_ValidateInput.qbl
@@ -9,15 +9,17 @@
   Product_MP product2,
   Date startdate,
   Date enddate,
-  Number number
+  String number
 ) as Boolean
 {
   TextBody:
   [*
     // 鐢勫叞楦� Jun-5-2024 (created)
     feedback := '';
-    
-    if( isnull( unit ) or isnull( product1 ) or isnull( product2 ) or number < 1 ){
+    if( [Number]number < 0 ){
+      feedback := Translations::MP_ChangeLossSettingExcel_Import_PositiveInteger();
+    }
+    if( isnull( unit ) or isnull( product1 ) or isnull( product2 ) or [Number]number = 0 ){
       feedback := Translations::MP_ChangeLossSetting_CheckNull();
     }
     if( product1 = product2 ){
diff --git a/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_CheckImport.qbl b/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_CheckImport.qbl
index de86c3f..7acf689 100644
--- a/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_CheckImport.qbl
+++ b/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_CheckImport.qbl
@@ -16,7 +16,7 @@
       error( Translations::MP_ChangeLossSettingExcel_Import_NullInputRequiredField() );
     }
     //瀵煎叆鐨勬暟閲忓皬浜�0
-    if( exists( macroplan, ChangeLossSettingExcel, excel, [Real]excel.ChangeLossNumber() > 0 and ceil( [Real]excel.ChangeLossNumber() ) <> floor( [Real]excel.ChangeLossNumber() ) ) ){
+    if( exists( macroplan, ChangeLossSettingExcel, excel, [Real]excel.ChangeLossNumber() <= 0 ) ){
       error( Translations::MP_ChangeLossSettingExcel_Import_PositiveInteger() );
     }
     //瀵煎叆浜у搧鏄惁瀛樺湪
diff --git a/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_ExportTemplate.qbl b/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_ExportTemplate.qbl
index eb73c40..22f4c62 100644
--- a/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_ExportTemplate.qbl
+++ b/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_ExportTemplate.qbl
@@ -9,7 +9,7 @@
   [*
     // 鐢勫叞楦� Aug-22-2024 (created)
     traverse( macroplan, ChangeLossSetting, cls ){
-      macroplan.ChangeLossSettingExcel( relnew, Product1 := cls.ProductFirst().ID(), Product2 := cls.ProductSecond().ID(), Unit := cls.Unit().ID(), ChangeLossNumber := [String]cls.ChangeLossNr(), StartDate := cls.StartDate(), EndDate := cls.EndDate() );
+      macroplan.ChangeLossSettingExcel( relnew, Product1 := cls.ProductFirst().ID(), Product2 := cls.ProductSecond().ID(), Unit := cls.Unit().ID(), ChangeLossNumber := [String]cls.ChangeLossNumber(), StartDate := cls.StartDate(), EndDate := cls.EndDate() );
     }
     value := macroplan.MP_ExportChangeLossSettingsBroker().ExecuteToXLS( isxlsxformat ).AsBinaryValue();
     macroplan.ChangeLossSettingExcel( relflush );
diff --git a/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_Import.qbl b/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_Import.qbl
index 2e8db80..7332ee9 100644
--- a/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_Import.qbl
+++ b/_Main/BL/Type_ChangeLossSettingExcel/StaticMethod_Import.qbl
@@ -28,13 +28,14 @@
                                           and cls.Unit().ID() = excel.Unit()
                                           and cls.StartDate() = excel.StartDate()
                                           and cls.EndDate() = excel.EndDate() );
+      info( excel.ChangeLossNumber() );
       if( isnull( cls ) ){
         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() );
         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() );
+        if( ChangeLossSetting::ValidateInput( feedback, macroplan, null( ChangeLossSetting ), unit, product1, product2, excel.StartDate(), excel.EndDate(), excel.ChangeLossNumber() ) ){
+          cls             := macroplan.ChangeLossSetting( relnew, ChangeLossNumber := [Real]excel.ChangeLossNumber() );
           
           cls.ProductFirst( relset, product1 );
           cls.ProductSecond( relset, product2 );
@@ -47,8 +48,9 @@
           error( feedback );
         }
       }else {
-        cls.ChangeLossNr( [Number]excel.ChangeLossNumber() );
+        cls.ChangeLossNumber( [Real]excel.ChangeLossNumber() );
       }
+      info( '-------------------', cls.ChangeLossNumber() );
       excel.Delete();
     }
   *]
diff --git a/_Main/BL/Type_OfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl b/_Main/BL/Type_OfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl
index bf4f206..bc4f716 100644
--- a/_Main/BL/Type_OfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl
+++ b/_Main/BL/Type_OfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl
@@ -36,7 +36,7 @@
                                          tempOPC.OfflinePlanRow().Type() = "1" and 
                                          tempOPC.OfflinePlanRow().ProductID() = firstOrderCell.OfflinePlanRow().ProductID()
                                         );
-            firstQuantityCell.Value( [String] ( [Number]firstQuantityCell.Value() - cls.ChangeLossNr() ) );                 
+            firstQuantityCell.Value( [String] ( [Number]firstQuantityCell.Value() - cls.ChangeLossNumber() ) );                 
     //        info( "褰撳墠鍒楁椂闂达細", opc.ColumnDate().Format( "Y-M2-D2" ), "    褰撳墠搴忓彿锛�", i, "    鍗曞厓鏍肩殑鍊硷細", firstOrderCell.Value(), "    浜у搧鍚嶏細", firstOrderCell.OfflinePlanRow().ProductID(),
     //              "涓嬩竴涓簭鍙凤細", i + 1, "    鍗曞厓鏍肩殑鍊硷細", secondOrderCell.Value(), "    浜у搧鍚嶏細", secondOrderCell.OfflinePlanRow().ProductID() );
           }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditChangeLossSetting/Component_pnlContent.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditChangeLossSetting/Component_pnlContent.def
index 94aa80b..5aec729 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditChangeLossSetting/Component_pnlContent.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditChangeLossSetting/Component_pnlContent.def
@@ -89,18 +89,6 @@
         Taborder: 2
       ]
     }
-    Component npChangeLossNr
-    {
-      #keys: '[415136.0.738250237]'
-      BaseType: 'WebNumberPicker'
-      Properties:
-      [
-        DataBinding: 'dhDialogData.Data.ChangeLossNr'
-        Label: 'Change loss number'
-        Min: '0'
-        Taborder: 5
-      ]
-    }
     Component dsStartDate
     {
       #keys: '[415136.0.1132411785]'
@@ -123,6 +111,17 @@
         Taborder: 4
       ]
     }
+    Component efChangeLossNr
+    {
+      #keys: '[415136.0.1176801957]'
+      BaseType: 'WebEditField'
+      Properties:
+      [
+        DataBinding: 'dhDialogData.Data.ChangeLossNumber'
+        Label: 'Change loss number'
+        Taborder: 5
+      ]
+    }
   ]
   Properties:
   [
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditChangeLossSetting/Response_pnlActions_btnOk_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditChangeLossSetting/Response_pnlActions_btnOk_OnClick.def
index 5def9ee..3d1e36b 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditChangeLossSetting/Response_pnlActions_btnOk_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditChangeLossSetting/Response_pnlActions_btnOk_OnClick.def
@@ -6,7 +6,7 @@
   DefinitionID: 'Responsedef_WebButton_OnClick'
   Precondition:
   [*
-    return ChangeLossSetting::ValidateInput( feedback, MacroPlan, dhDialogData.Data().WrappedInstance(), ddlUnit.Data(), ddlProduct1.Data(), ddlProduct2.Data(), dsStartDate.Date(), dsEndDate.Date(), [Number]npChangeLossNr.Number() );
+    return ChangeLossSetting::ValidateInput( feedback, MacroPlan, dhDialogData.Data().WrappedInstance(), ddlUnit.Data(), ddlProduct1.Data(), ddlProduct2.Data(), dsStartDate.Date(), dsEndDate.Date(), efChangeLossNr.Text() );
   *]
   QuillAction
   {
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormChangeLossSetting/Component_ListChangeLossSetting\043568.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormChangeLossSetting/Component_ListChangeLossSetting\043568.def"
index 13d921e..19e17fb 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormChangeLossSetting/Component_ListChangeLossSetting\043568.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormChangeLossSetting/Component_ListChangeLossSetting\043568.def"
@@ -28,7 +28,7 @@
       ]
       Properties:
       [
-        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Unit.ID","title":"Unit","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"Unit.ID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ProductFirst.ID","title":"Product1","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"ProductFirst.ID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ProductSecond.ID","title":"Product2","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"ProductSecond.ID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StartDate","title":"StartDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"StartDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"EndDate","title":"EndDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"EndDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ChangeLossNr","title":"ChangeLossNr","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ChangeLossNr"}}]'
+        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Unit.ID","title":"Unit","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"Unit.ID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ProductFirst.ID","title":"Product1","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"ProductFirst.ID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ProductSecond.ID","title":"Product2","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"ProductSecond.ID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StartDate","title":"StartDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"StartDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"EndDate","title":"EndDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"EndDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ChangeLossNumber","title":"ChangeLossNumber","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ChangeLossNumber"}}]'
         ContextMenu: 'listContextMenuChangeLossSetting'
         Taborder: 2
       ]
diff --git a/_Main/UI/MacroPlannerWebApp/Views/Change_loss_setting_view.vw b/_Main/UI/MacroPlannerWebApp/Views/Change_loss_setting_view.vw
index d72a303..3bafc0d 100644
--- a/_Main/UI/MacroPlannerWebApp/Views/Change_loss_setting_view.vw
+++ b/_Main/UI/MacroPlannerWebApp/Views/Change_loss_setting_view.vw
@@ -78,14 +78,14 @@
               subtotals: ''
               width: 150
             }
-            column_ChangeLossNr
+            column_ChangeLossNumber
             {
-              columnId: 'ChangeLossNr'
-              dataPath: 'ChangeLossNr'
-              dataType: 'number'
+              columnId: 'ChangeLossNumber'
+              dataPath: 'ChangeLossNumber'
+              dataType: 'real'
               index: 5
               subtotals: ''
-              width: 150
+              width: 183
             }
           }
         }
diff --git a/_Main/metadata.properties b/_Main/metadata.properties
index 6123311..14be557 100644
--- a/_Main/metadata.properties
+++ b/_Main/metadata.properties
@@ -1,6 +1,6 @@
 component=submodel
 kind=Quintiq Metadata File
 name=MacroPlanner
-version.component=2022.3.0.0
+version.component=2022.3.0.56
 version.fileformat=2
 version.quintiq=6.3.3.0 , build 248673

--
Gitblit v1.9.3