xiaoding721
2024-12-11 922e32f3483318a2f733b8a3d9074264d6bd3613
_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl
@@ -51,7 +51,7 @@
        }
      }
      
      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() and cell.Quantity() > 0){
        product := null( DispatchShiftSchedulingProduct );
        tips := "";
        if( not isnull( unit )){
@@ -77,6 +77,7 @@
          productIndex := guard( productIndexTree.Root().Child( productHandle ),null( NamedValue ));
          if( isnull( productIndex )){
            product := line.DispatchShiftSchedulingProduct( relnew,ProductID := row.ProductID() );
            product.OrderNumber( cell.OrderNr() );
            product.ProductionQuantity( cell.Quantity() );
            products.Add( product );
            productIndexTree.Root().AddChild( productHandle,products.Size() - 1 );
@@ -106,7 +107,7 @@
        }
      }
      
      traverse( row,NewAssemblyOnlinePlanCell,cell, startDate <= cell.NewAssemblyOnlinePlanColumn().StartDate() and endDate >= cell.NewAssemblyOnlinePlanColumn().EndDate()){
      traverse( row,NewAssemblyOnlinePlanCell,cell, startDate <= cell.NewAssemblyOnlinePlanColumn().StartDate() and endDate >= cell.NewAssemblyOnlinePlanColumn().EndDate() and cell.Quantity() > 0){
        product := null( DispatchShiftSchedulingProduct );
        tips := "";
        if( not isnull( unit )){
@@ -132,6 +133,7 @@
          productIndex := guard( productIndexTree.Root().Child( productHandle ),null( NamedValue ));
          if( isnull( productIndex )){
            product := line.DispatchShiftSchedulingProduct( relnew,ProductID := row.ProductID() );
            product.OrderNumber( cell.OrderNr() );
            product.ProductionQuantity( cell.Quantity() );
            products.Add( product );
            productIndexTree.Root().AddChild( productHandle,products.Size() - 1 );
@@ -157,7 +159,7 @@
      // 481
      lineQuantity := line.LineQuantity();
      
      tempProducts := selectsortedset( line,DispatchShiftSchedulingProduct,object,object.ProductionQuantity() );
      tempProducts := selectsortedset( line,DispatchShiftSchedulingProduct,object,object.OrderNumber() );
      
      if( line.ShiftName() = "3" ){
        
@@ -188,7 +190,7 @@
          }
        }
        
        for( i := tempProducts.Size() - 1;i >= 0; i-- ){
        for( i := 0;i < tempProducts.Size(); i++ ){
          product := tempProducts.Element( i );
          productionQuantity := product.ProductionQuantity();
          
@@ -214,7 +216,9 @@
            singleShiftVolume3 := singleShiftVolume3 - productionQuantity;
            productionQuantity := productionQuantity - detail.ShiftVolume();
          }else{
            product.DispatchShiftSchedulingDetail( relnew,ShiftVolume := 0 ,SingleShiftName := "三班");
            if( i = tempProducts.Size() - 1 ){
              product.DispatchShiftSchedulingDetail( relnew,ShiftVolume := 0 ,SingleShiftName := "三班");
            }
          }
        }
        
@@ -242,7 +246,7 @@
          }
        }
    
        for( i := tempProducts.Size() - 1;i >= 0; i-- ){
        for( i := 0 ;i < tempProducts.Size(); i++ ){
          product := tempProducts.Element( i );
          productionQuantity := product.ProductionQuantity();
          
@@ -262,13 +266,17 @@
            detail := product.DispatchShiftSchedulingDetail( relnew,ShiftVolume := ifexpr( tempProductQuantity > 0 ,productionQuantity,singleShiftVolume2 ) ,SingleShiftName := "二班");
            singleShiftVolume2 := singleShiftVolume2 - productionQuantity;
            productionQuantity := productionQuantity - detail.ShiftVolume();
          }else{
            if( i = tempProducts.Size() - 1 ){
              product.DispatchShiftSchedulingDetail( relnew,ShiftVolume := 0 ,SingleShiftName := "二班");
            }
          }
        }
        
      }else if( line.ShiftName() = "1" ){
        singleShiftVolume1 := lineQuantity;
        
        for( i := tempProducts.Size() - 1;i >= 0; i-- ){
        for( i := 0 ;i < tempProducts.Size(); i++ ){
          product := tempProducts.Element( i );
          productionQuantity := product.ProductionQuantity();
          if( singleShiftVolume1 > 0 and productionQuantity > 0){