From 485f50250d12f31bed90e48bfdc737c8b34386f6 Mon Sep 17 00:00:00 2001
From: hongji.li <hongji.a.li@capgemini.com>
Date: 星期三, 27 九月 2023 18:13:28 +0800
Subject: [PATCH] Merge branch 'dev_Kevin' into dev
---
LibSOPImportExport/BL/Type_LibSOPImpExp_ImportExcel/Method_CanImport#382.qbl | 4
_Main/BL/Type_ImportExcel/_ROOT_Type_ImportExcel.qbl | 6 +
_Main/BL/Type_ImportExcel/Method_Execute.qbl | 43 ++++++++
_Main/BL/Type_LibSOPImpExp_ExportExcel/StaticMethod_IsDataSourceIncluded_Tianma.qbl | 10 ++
_Main/BL/Type_MacroPlan/Method_ImportExcels_Tianma.qbl | 47 +++++++++
_Main/BL/Type_ScenarioManager/Method_ImportExcels_Tianma.qbl | 29 +++++
LibSOPImportExport/metadata.properties | 2
LibSOPImportExport/BL/Type_LibSOPImpExp_DataSource/Method_HasAllRequiredFilesForImport#522.qbl | 5
_Main/BL/Type_LibSOPImpExp_ExportExcel/_ROOT_Type_LibSOPImpExp_ExportExcel.qbl | 6 +
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl | 75 ++++++++++++++
LibMacroPlanner/BL/Relations/Relation_MPSync_ImportExcel_ImportExcel_MPSync.qbl | 2
LibSOPImportExport/BL/Type_LibSOPImpExp_DataSource/Method_HasAllRequiredFilesForImport.qbl | 4
_Main/BL/Type_MPSync/Method_ImportExcels_Tianma.qbl | 22 ++++
13 files changed, 248 insertions(+), 7 deletions(-)
diff --git a/LibMacroPlanner/BL/Relations/Relation_MPSync_ImportExcel_ImportExcel_MPSync.qbl b/LibMacroPlanner/BL/Relations/Relation_MPSync_ImportExcel_ImportExcel_MPSync.qbl
index 9f508eb..c429f65 100644
--- a/LibMacroPlanner/BL/Relations/Relation_MPSync_ImportExcel_ImportExcel_MPSync.qbl
+++ b/LibMacroPlanner/BL/Relations/Relation_MPSync_ImportExcel_ImportExcel_MPSync.qbl
@@ -12,7 +12,6 @@
Cardinality: '1toN'
ObjectDefinition: MPSync
OwningSide: 'Owned'
- InterfaceProperties { Accessibility: 'Module' }
}
RelationSide.RightSide MPSync
{
@@ -20,6 +19,5 @@
Cardinality: '0to1'
ObjectDefinition: ImportExcel
OwningSide: 'Reference'
- InterfaceProperties { Accessibility: 'Module' }
}
}
diff --git "a/LibSOPImportExport/BL/Type_LibSOPImpExp_DataSource/Method_HasAllRequiredFilesForImport\043522.qbl" "b/LibSOPImportExport/BL/Type_LibSOPImpExp_DataSource/Method_HasAllRequiredFilesForImport\043522.qbl"
index 4ea6109..af8fd45 100644
--- "a/LibSOPImportExport/BL/Type_LibSOPImpExp_DataSource/Method_HasAllRequiredFilesForImport\043522.qbl"
+++ "b/LibSOPImportExport/BL/Type_LibSOPImpExp_DataSource/Method_HasAllRequiredFilesForImport\043522.qbl"
@@ -1,6 +1,9 @@
Quintiq file version 2.0
#parent: #root
-Method HasAllRequiredFilesForImport (output Strings missingFiles_o, Boolean needUserUploadAllFiles) as Boolean
+Method HasAllRequiredFilesForImport (
+ output Strings missingFiles_o,
+ Boolean needUserUploadAllFiles
+) remote as Boolean
{
TextBody:
[*
diff --git a/LibSOPImportExport/BL/Type_LibSOPImpExp_DataSource/Method_HasAllRequiredFilesForImport.qbl b/LibSOPImportExport/BL/Type_LibSOPImpExp_DataSource/Method_HasAllRequiredFilesForImport.qbl
index b8c6585..a6720f7 100644
--- a/LibSOPImportExport/BL/Type_LibSOPImpExp_DataSource/Method_HasAllRequiredFilesForImport.qbl
+++ b/LibSOPImportExport/BL/Type_LibSOPImpExp_DataSource/Method_HasAllRequiredFilesForImport.qbl
@@ -1,6 +1,8 @@
Quintiq file version 2.0
#parent: #root
-Method HasAllRequiredFilesForImport (output Strings missingFiles_o) as Boolean
+Method HasAllRequiredFilesForImport (
+ output Strings missingFiles_o
+) remote as Boolean
{
TextBody:
[*
diff --git "a/LibSOPImportExport/BL/Type_LibSOPImpExp_ImportExcel/Method_CanImport\043382.qbl" "b/LibSOPImportExport/BL/Type_LibSOPImpExp_ImportExcel/Method_CanImport\043382.qbl"
index 590b315..d9785ad 100644
--- "a/LibSOPImportExport/BL/Type_LibSOPImpExp_ImportExcel/Method_CanImport\043382.qbl"
+++ "b/LibSOPImportExport/BL/Type_LibSOPImpExp_ImportExcel/Method_CanImport\043382.qbl"
@@ -1,6 +1,8 @@
Quintiq file version 2.0
#parent: #root
-Method CanImport (output Strings missingFiles_o) as Boolean
+Method CanImport (
+ output Strings missingFiles_o
+) remote as Boolean
{
Description: 'Checks if necessary files are sufficent before starting import.'
TextBody:
diff --git a/LibSOPImportExport/metadata.properties b/LibSOPImportExport/metadata.properties
index c38fbdb..6d65136 100644
--- a/LibSOPImportExport/metadata.properties
+++ b/LibSOPImportExport/metadata.properties
@@ -5,4 +5,4 @@
system=false
version.component=2022.3.0.0
version.fileformat=2
-version.quintiq=6.3.3.0 NightlyBuild 247983, build 247983
+version.quintiq=6.3.3.0 , build 248673
diff --git a/_Main/BL/Type_ImportExcel/Method_Execute.qbl b/_Main/BL/Type_ImportExcel/Method_Execute.qbl
new file mode 100644
index 0000000..8bad7ba
--- /dev/null
+++ b/_Main/BL/Type_ImportExcel/Method_Execute.qbl
@@ -0,0 +1,43 @@
+Quintiq file version 2.0
+#parent: #root
+MethodOverride Execute #extension
+{
+ TextBody:
+ [*
+ opt := DatasetFindOptions::Construct( this.MacroPlanDatasetName() );
+ mp := MDSMacroPlan::Find( opt );
+
+ opt := DatasetFindOptions::Construct();
+ scenarioManager := MDSScenarioManager::Find( opt );
+
+ // Only get data source which has all required files uploaded
+ dummyMissingFiles := construct( Strings );
+ needUserUploadAllFiles := true;
+ validUploadedFiles := selectset( this, LibSOPImpExp_DataSourceChildren, ds,
+ ds.HasAllRequiredFilesForImport( dummyMissingFiles, needUserUploadAllFiles ) );
+
+ traverse( validUploadedFiles, Elements, file )
+ {
+ this.LibSOPImpExp_UserInput( relnew, Value := file.Name() );
+ }
+
+ binaryValues := selectvalues( validUploadedFiles, Elements.LibSOPImpExp_DataSourceFile.LibSOPImpExp_ImportUploadedFile, file, true, file.DataAsBinary() );
+ brokerNames := selectvalues( validUploadedFiles, Elements.LibSOPImpExp_DataSourceFile, file, true, file.BrokerName() );
+ userinputvalues := selectuniquevalues( this, LibSOPImpExp_UserInput, userinput,
+ true,
+ userinput.Value() );
+ mpsync := this.MPSync();
+
+ // Reactive way to import
+ o := this
+ ->SetStatusInProgress()
+ ->|mp->ImportExcels_Tianma( userinputvalues, binaryValues.Copy(), brokerNames )
+ ->|scenarioManager->ImportExcels_Tianma( userinputvalues, binaryValues.Copy(), brokerNames )
+ ->|mpsync->ImportExcels_Tianma( userinputvalues, binaryValues.Copy(), brokerNames )
+ ->|this->SetStatusDone()
+ ->|mp->SetLastImportTime()
+ ->Exception();
+
+ this->OnException(o);
+ *]
+}
diff --git a/_Main/BL/Type_ImportExcel/_ROOT_Type_ImportExcel.qbl b/_Main/BL/Type_ImportExcel/_ROOT_Type_ImportExcel.qbl
new file mode 100644
index 0000000..cd6e3ac
--- /dev/null
+++ b/_Main/BL/Type_ImportExcel/_ROOT_Type_ImportExcel.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+TypeSpecialization ImportExcel #extension
+{
+}
diff --git a/_Main/BL/Type_LibSOPImpExp_ExportExcel/StaticMethod_IsDataSourceIncluded_Tianma.qbl b/_Main/BL/Type_LibSOPImpExp_ExportExcel/StaticMethod_IsDataSourceIncluded_Tianma.qbl
new file mode 100644
index 0000000..710f4a0
--- /dev/null
+++ b/_Main/BL/Type_LibSOPImpExp_ExportExcel/StaticMethod_IsDataSourceIncluded_Tianma.qbl
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod IsDataSourceIncluded_Tianma (
+ Strings userinputvalues,
+ String datasource_i
+) remote as Boolean
+{
+ Description: 'If data source selected by user to export'
+ TextBody: 'return exists( userinputvalues, Elements, input, input = datasource_i );'
+}
diff --git a/_Main/BL/Type_LibSOPImpExp_ExportExcel/_ROOT_Type_LibSOPImpExp_ExportExcel.qbl b/_Main/BL/Type_LibSOPImpExp_ExportExcel/_ROOT_Type_LibSOPImpExp_ExportExcel.qbl
new file mode 100644
index 0000000..9510e76
--- /dev/null
+++ b/_Main/BL/Type_LibSOPImpExp_ExportExcel/_ROOT_Type_LibSOPImpExp_ExportExcel.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+TypeSpecialization LibSOPImpExp_ExportExcel #extension
+{
+}
diff --git a/_Main/BL/Type_MPSync/Method_ImportExcels_Tianma.qbl b/_Main/BL/Type_MPSync/Method_ImportExcels_Tianma.qbl
new file mode 100644
index 0000000..01d9ef9
--- /dev/null
+++ b/_Main/BL/Type_MPSync/Method_ImportExcels_Tianma.qbl
@@ -0,0 +1,22 @@
+Quintiq file version 2.0
+#parent: #root
+Method ImportExcels_Tianma (
+ Strings userinputvalues,
+ BinaryValues mpBinaryValues_i,
+ Strings mpBrokers_i
+)
+{
+ Description: 'Import from Excel, used by web app.'
+ TextBody:
+ [*
+ // @userInput_i - Array of data group that user imports
+ // @mpBinaryValues_i - Array of uploaded Excels in binary value. Binary at position x matches @mpBrokers_i at same position
+ // @mpBrokers_i - Array of uploaded Excels' broker name
+
+ is3DDrive := false;
+
+ // Check if each data group has files uploaded by user for import
+ this.Import( LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_ImportProfiles() ),
+ mpBinaryValues_i, mpBrokers_i, is3DDrive, construct( FileItems), construct( Strings ) );
+ *]
+}
diff --git a/_Main/BL/Type_MacroPlan/Method_ImportExcels_Tianma.qbl b/_Main/BL/Type_MacroPlan/Method_ImportExcels_Tianma.qbl
new file mode 100644
index 0000000..7d409ec
--- /dev/null
+++ b/_Main/BL/Type_MacroPlan/Method_ImportExcels_Tianma.qbl
@@ -0,0 +1,47 @@
+Quintiq file version 2.0
+#parent: #root
+Method ImportExcels_Tianma (
+ Strings userinputvalues,
+ BinaryValues mpBinaryValues_i,
+ Strings mpBrokers_i
+)
+{
+ Description: 'Import from Excel, used by web app.'
+ TextBody:
+ [*
+ // @userinputvalues - Array of data group that user imports
+ // @mpBinaryValues_i - Array of uploaded Excels in binary value. Binary at position x matches @mpBrokers_i at same position
+ // @mpBrokers_i - Array of uploaded Excels' broker name
+
+ is3DDrive := false;
+
+ // Check if each data group has files uploaded by user for import
+ this.Synchronize( LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_SupplyChainParameters() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_GlobalParameters() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_Periods() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MP_Functionality_InventorySpecifications() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MP_Functionality_InventorySupplies() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_Products() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_Forecasts() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_ServiceLevels() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_Campaigns() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_Entities() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_Costs() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_Lanes() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_Routings() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_Capacities() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MP_Functionality_SupplySpecifications() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_Recipes() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MP_Designer_Actuals() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MP_GlobalParameters_KPIFeedbackName() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_OptimizerPuzzles() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_PostponementSpecAndFulfillmentRestriction() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_CustomerOrder() ),
+ false, /* isImportBinary */
+ mpBinaryValues_i,
+ mpBrokers_i,
+ is3DDrive,
+ construct( FileItems ), /* 3ddrive, ignore */
+ construct( Strings ) /* 3ddrive, ignore */ );
+ *]
+}
diff --git a/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl
index ca35281..b716d4d 100644
--- a/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl
@@ -10,7 +10,6 @@
TextBody:
[*
// yypsybs Aug-21-2023 (created)
-
keyProductList := construct( Strings );
if( isKeyProduct ) {
keyProductList := selectuniquevalues( globalOTDTable, Global_MappingProduct_MP, item, item.ProductMajorType()="鎴愬搧" or item.ProductMajorType()="鍗婃垚鍝�", item.ID() );
@@ -59,6 +58,7 @@
// ========鍒嗙粍澶勭悊杈撳叆========
}
+
if( not isnull( stockingPoint)){
if( isKeyProduct){
keyRows := selectset( routingRows,Elements,routingrow,keyProductList.Find( routingrow.ComponentCode())>=0);
@@ -81,5 +81,78 @@
this.MappingOperationBOMDataSupplyPurchase( bom.OrganCode(), bom.ComponentCode(), bom.ComponentType());
}
}
+
+
+ //
+ //keyProductList := construct( Strings );
+ //if( isKeyProduct ) {
+ // keyProductList := selectuniquevalues( globalOTDTable, Global_MappingProduct_MP, item, item.ProductMajorType()="鎴愬搧" or item.ProductMajorType()="鍗婃垚鍝�", item.ID() );
+ //}
+ //bomList := selectsortedset( globalOTDTable, Global_MappingOperationBOM, item,
+ // ifexpr( isnull( businessTypes ) or businessTypes.Size() = 0,
+ // true,
+ //// businessTypes.Difference( businessTypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0 )
+ // businessTypes.Find( item.BusinessType() ) >= 0 )
+ //// and ifexpr( isKeyProduct,
+ //// keyProductList.Size() > 0 and keyProductList.Find( item.ComponentCode() ) >= 0,
+ //// true )
+ // ,
+ // item.OrganCode() + "_" + item.ProductCode() + "_" + item.ProcessSection() );
+ //// 鎸塺outing鍙妑outingStep鍒嗙粍
+ //routingIds := selectuniquevalues( bomList, Elements, item, true, item.OrganCode() + "_" + item.ProductCode() );
+ //traverse( routingIds, Elements, routingId ) {
+ // routingRows := selectset( bomList, Elements, item, true, routingId = item.OrganCode() + "_" + item.ProductCode() );
+ // if( routingRows.Size() > 0 ) {
+ // firstRow := routingRows.Element( 0 );
+ //// stockingPointId := firstRow.OrganCode() + "_" + firstRow.ProductType() + "_Stock";
+ //// inputStockingPointId := firstRow.OrganCode() + "_" + firstRow.ComponentType() + "_Stock";
+ // stockingPointId := firstRow.OrganCode() + "_Stock";
+ //
+ // // ========妫�鏌�========
+ // product := Product_MP::FindProductTypeIndex( firstRow.ProductCode() );
+ // if( not isnull( product ) ) {
+ //// error( "product : " + firstRow.ProductCode() + " not found" );
+ // stockingPoint := StockingPoint_MP::FindStockingPointTypeIndex( stockingPointId );
+ //
+ //// info( stockingPointId.AsQUILL() );
+ // // if( isnull( stockingPoint ) ) {
+ // // error( "stockingPoint : " + stockingPointId + " not found" );
+ // // }
+ // routing := Routing::FindRoutingTypeIndex( routingId );
+ // if( not isnull( routing ) ) {
+ //// error( "routing : " + routingId + " not found" );
+ // // ========澶勭悊杈撳嚭========
+ // if( not isnull( stockingPoint ) ) {
+ //// info( 1 );
+ // operationsInLastSteps := Operation::FindFinalOperationsByRoutingId( this, routingId );
+ // traverse( operationsInLastSteps, Elements, operationsInLastStep ) {
+ // operationsInLastStep.CreateOperationBOM( product, stockingPoint, false, true );
+ // operationsInLastStep.GetOperationBOM( product.ID(), stockingPoint.ID(), false ).Quantity( 1 );
+ // }
+ // // ========鍒嗙粍澶勭悊杈撳叆========
+ //
+ // }
+ // if( not isnull( stockingPoint)){
+ // if( isKeyProduct){
+ // keyRows := selectset( routingRows,Elements,routingrow,keyProductList.Find( routingrow.ComponentCode())>=0);
+ // this.MappingOperationBOMDataRouting( routing,globalOTDTable,keyRows);
+ // }else{
+ // this.MappingOperationBOMDataRouting( routing,globalOTDTable,routingRows);
+ // }
+ //
+ // }
+ // }
+ // }
+ // }
+ //}
+ //if( createPurchaseSupplyMaterial ) {
+ // toCreateBomList := selectuniquevalues( bomList, Elements, item,
+ // item.ComponentType() = "P", item.OrganCode() + item.ComponentCode());
+ // traverse( toCreateBomList, Elements, key ) {
+ // boms := selectset( bomList, Elements, item, item.ComponentType() = "P" and item.OrganCode() + item.ComponentCode() = key );
+ // bom := boms.First();
+ // this.MappingOperationBOMDataSupplyPurchase( bom.OrganCode(), bom.ComponentCode(), bom.ComponentType());
+ // }
+ //}
*]
}
diff --git a/_Main/BL/Type_ScenarioManager/Method_ImportExcels_Tianma.qbl b/_Main/BL/Type_ScenarioManager/Method_ImportExcels_Tianma.qbl
new file mode 100644
index 0000000..2c38e3e
--- /dev/null
+++ b/_Main/BL/Type_ScenarioManager/Method_ImportExcels_Tianma.qbl
@@ -0,0 +1,29 @@
+Quintiq file version 2.0
+#parent: #root
+Method ImportExcels_Tianma (
+ Strings userinputvalues,
+ BinaryValues mpBinaryValues_i,
+ Strings mpBrokers_i
+)
+{
+ Description: 'Import from Excel, used by web app.'
+ TextBody:
+ [*
+ // @userinputvalues - Array of data group that user imports
+ // @mpBinaryValues_i - Array of uploaded Excels in binary value. Binary at position x matches @mpBrokers_i at same position
+ // @mpBrokers_i - Array of uploaded Excels' broker name
+
+ is3DDrive := false;
+
+ // Check if each data group has files uploaded by user for import
+ this.Import( LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_Strategies() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_Accounts() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_Bookmarks() ),
+ LibSOPImpExp_ExportExcel::IsDataSourceIncluded_Tianma( userinputvalues, Translations::MPSync_ObjectGroup_KPISetting() ),
+ mpBinaryValues_i.Copy(),
+ mpBrokers_i,
+ is3DDrive,
+ construct( FileItems ), /* 3ddrive, ignore */
+ construct( Strings ) /* 3ddrive, ignore */ );
+ *]
+}
--
Gitblit v1.9.3