From 472c228ef6d7c8d877558ff90051b1fdb35ffb5c Mon Sep 17 00:00:00 2001
From: renhao <renhui.hao@capgemini.com>
Date: 星期二, 10 十月 2023 14:05:34 +0800
Subject: [PATCH] Merge branch 'dev'
---
_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl | 58 +++++++++++++++++++++++++++++++++++-----------------------
1 files changed, 35 insertions(+), 23 deletions(-)
diff --git a/_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl
index 3713cc9..cdcd7f1 100644
--- a/_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl
@@ -1,7 +1,9 @@
Quintiq file version 2.0
#parent: #root
Method MappingOperationCostData (
- Strings businesstypes
+ GlobalOTDTable globalOTDTable,
+ Strings businesstypes,
+ Strings organcodelist
)
{
Description: 'Get operation cost data from operation mapping'
@@ -9,19 +11,21 @@
[*
// Administrator Aug-21-2023 (created)
// list to deal
- listtodeal := construct( structured[MappingOperation] );
+ listtodeal := construct( structured[Global_MappingOperation] );
if( isnull( businesstypes ) or businesstypes.Size() = 0 ) {
- listtodeal := selectset( this, MappingOperation, item, true );
+ listtodeal := selectset( globalOTDTable, Global_MappingOperation, item, true );
} else {
- listtodeal := selectset( this, MappingOperation, item, businesstypes.Find( item.BusinessType() ) <> -1 );
+ listtodeal := selectset( globalOTDTable, Global_MappingOperation,
+ item,
+ ( businesstypes.Find( item.BusinessType() ) <> -1 ) and
+ ( organcodelist.Find( item.OrganCode() ) >= 0 ) );
}
// Get the list to deal with max sequence number
- listtodealwithmaxsn := construct( structured[MappingOperation] );
+ listtodealwithmaxsn := construct( structured[Global_MappingOperation] );
traverse( listtodeal, Elements, item ){
- maxsn := maxselect( this,
- MappingOperation,
+ maxsn := maxselect( globalOTDTable, Global_MappingOperation,
moperation,
moperation.OrganCode() = item.OrganCode(),
moperation.ProductID() = item.ProductID(),
@@ -41,23 +45,31 @@
if( count - [Number](count/1000) * 1000 = 0 or count = totalcount ){
info( "Now is dealing with the " + count.AsQUILL() + "OperationCost " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
}
- id := item.OrganCode() + "_" + item.ProductID() + "_" + item.ProcessSection() + "_" + item.Line();
- operation := Operation::FindOperationTypeIndex( id );
- account := Account_MP::FindByName( this, "Operation cost" );
- isfromdb := false;
- existoperationcost := OperationCost::FindOperationCostTypeIndex( id );
- if( isnull( existoperationcost ) ){
- connecteditem := select( this,
- MappingOperationCost,
- moperationcost,
- moperationcost.OrgCode() = item.OrganCode(),
- moperationcost.ProductID() = item.ProductID() );
- cost := connecteditem.Cost();
- lengthoftime := connecteditem.LengthOfTime();
- start := connecteditem.Start();
- timeunit := connecteditem.TimeUnit();
- OperationCost::Create( id, operation, account, "Volume", start, timeunit, lengthoftime, cost, isfromdb );
+ id := item.OrganCode() + "_" + item.ProductID() + "_" + item.ProcessSection()+"_" + [String]item.SequenceNumber();
+ if( guard( item.Line(), "" ).Length() > 0 ) {
+ id := id + "_" + item.Line();
}
+ operation := Operation::FindOperationTypeIndex( id );
+ if(not isnull(operation)){
+ account := Account_MP::FindByName( this, "Operating cost" );
+ isfromdb := false;
+ existoperationcost := OperationCost::FindOperationCostTypeIndex( id );
+ if( isnull( existoperationcost ) ){
+ connecteditem := select( globalOTDTable,
+ Global_MappingOperationCost,
+ moperationcost,
+ moperationcost.OrgCode() = item.OrganCode(),
+ moperationcost.ProductID() = item.ProductID() );
+ if( not isnull( connecteditem)){
+ cost := connecteditem.Cost();
+ lengthoftime := connecteditem.LengthOfTime();
+ start := connecteditem.Start();
+ timeunit := connecteditem.TimeUnit();
+ OperationCost::Create( id, operation, account, "Volume", start, timeunit, lengthoftime, cost, isfromdb );
+ }
+
+ }
}
+ }
*]
}
--
Gitblit v1.9.3