xiaoding721
2024-10-25 d5c074b9e2daa5030a8e730a30d2ed31c8169e7d
_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_Dispatch.qbl
@@ -30,6 +30,20 @@
      unitIndexTree.Root().AddChild( unitHandle,i );
    }
    
    // productLines := selectuniquevalues( offlinePlan,NewOfflinePlanRow,row,row.ProductionLine() );
    productLinesQuantityNameValueTree := NamedValueTree::Create();
    traverse( offlinePlan,NewOfflinePlanRow,row ){
      traverse( row,NewOfflinePlanCell,cell, startDate <= cell.NewOfflinePlanColumn().StartDate() and endDate >= cell.NewOfflinePlanColumn().EndDate()){
        productLinesQuantityHandle := productLinesQuantityNameValueTree.GetHandle( row.ProductionLine() + cell.NewOfflinePlanColumn().StartDate().AsQUILL() );
        productLinesQuantity := guard( productLinesQuantityNameValueTree.Root().Child( productLinesQuantityHandle ),null( NamedValue ));
        if( not isnull( productLinesQuantity )){
          productLinesQuantity.SetValue( productLinesQuantity.GetValueAsReal() + cell.Quantity() );
        }else{
          productLinesQuantityNameValueTree.Root().AddChild( productLinesQuantityHandle, cell.Quantity() );
        }
      }
    }
    traverse( offlinePlan,NewOfflinePlanRow,row ){
      productID := row.ProductID();
      productLine := row.ProductionLine();
@@ -48,7 +62,10 @@
          factory := temp2;
        }
      }
      traverse( row,NewOfflinePlanCell,cell ,startDate <= cell.NewOfflinePlanColumn().StartDate() and endDate >= cell.NewOfflinePlanColumn().EndDate()){
      traverse( row,NewOfflinePlanCell,cell, startDate <= cell.NewOfflinePlanColumn().StartDate() and endDate >= cell.NewOfflinePlanColumn().EndDate()){
        productLinesQuantityHandle := productLinesQuantityNameValueTree.GetHandle( row.ProductionLine() + cell.NewOfflinePlanColumn().StartDate().AsQUILL() );
        productLinesQuantity := guard( productLinesQuantityNameValueTree.Root().Child( productLinesQuantityHandle ).GetValueAsReal(),0.0 );
        shiftDate := cell.NewOfflinePlanColumn().StartDate();
        shiftName := cell.ShiftPatternName();
        shiftVolume := cell.Quantity();
@@ -62,7 +79,7 @@
          }
        }
        if( shiftVolume <> 0 ){
          shiftSchedulingInformations := DispatchShiftSchedulingInformation::SplitShifts( owner,shiftName,shiftVolume );
          shiftSchedulingInformations := DispatchShiftSchedulingInformation::SplitShifts( owner,shiftName,shiftVolume,productLinesQuantity );
        
        traverse( shiftSchedulingInformations,Elements,shiftSchedulingInformation ){
          shiftSchedulingInformation.InterfaceTime( now );