yunchai
2023-10-08 1a5a8be205641f5f79dd809f6c7e59fc84d76243
_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl
@@ -1,6 +1,7 @@
Quintiq file version 2.0
#parent: #root
Method MappingOperationCostData (
  GlobalOTDTable globalOTDTable,
  Strings businesstypes
)
{
@@ -14,7 +15,12 @@
    if( isnull( businesstypes ) or businesstypes.Size() = 0 ) {
        listtodeal := selectset( this, MappingOperation, item, true );
    } else {
        listtodeal := selectset( this, MappingOperation, item, businesstypes.Find( item.BusinessType() ) <> -1 );
        organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businesstypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() );
        listtodeal := selectset( this,
                                 MappingOperation,
                                 item,
                                 ( businesstypes.Find( item.BusinessType() ) <> -1 ) and
                                 ( organcodelist.Find( item.OrganCode() ) >= 0 ) );
    }
    
    // Get the list to deal with max sequence number
@@ -41,7 +47,10 @@
      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();
      id := item.OrganCode() + "_" + item.ProductID() + "_" + item.ProcessSection();
      if( guard( item.Line(), "" ).Length() > 0 ) {
          id := id + "_" + item.Line();
        }
      operation := Operation::FindOperationTypeIndex( id );
      account := Account_MP::FindByName( this, "Operation cost" );
      isfromdb := false;