xiaoding721
2024-11-25 d729cf0951344771245befd9ae8b0b97d133c7f7
_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl
@@ -41,6 +41,7 @@
    traverse( offlinePlan,NewOfflinePlanRow,row ,not row.ProductionLine().ToUpper().LikeUserLocale( "MOMO" )){
      line := null( DispatchShiftSchedulingLine );
      factory := constnull( Unit );
      unit := constnull( Unit );
      {
        unitHandle := unitIndexTree.GetHandle( row.ProductionLine() );
        unitIndex := guard( unitIndexTree.Root().Child( unitHandle ), null( NamedValue ));
@@ -52,12 +53,16 @@
      
      traverse( row,NewOfflinePlanCell,cell, startDate <= cell.NewOfflinePlanColumn().StartDate() and endDate >= cell.NewOfflinePlanColumn().EndDate()){
        product := null( DispatchShiftSchedulingProduct );
        remark := "";
        if( not isnull( unit )){
          remark := ShiftPlan::CalculateRemark( unit,cell.NewOfflinePlanColumn().StartDate(),cell.NewOfflinePlanColumn().EndDate() );
        }
        {
          lineKey := row.ProductionLine() + cell.NewOfflinePlanColumn().StartDate().AsQUILL();
          lineHandle := lineIndexTree.GetHandle( lineKey );
          lineIndex := guard( lineIndexTree.Root().Child( lineHandle ),null( NamedValue ));
          if( isnull( lineIndex )){
            line := owner.DispatchShiftSchedulingLine( relnew,ID := IDHolder::GetGUID(),LineName := row.ProductionLine(),ShiftDate := cell.NewOfflinePlanColumn().StartDate() );
            line := owner.DispatchShiftSchedulingLine( relnew,ID := IDHolder::GetGUID(),LineName := row.ProductionLine(),ShiftDate := cell.NewOfflinePlanColumn().StartDate(),Remark := remark );
            line.FactoryName( factory.Name() );
            line.InterfaceTime( now );
            line.VersionName( macroPlan.MDSMacroPlan().Description() );
@@ -85,6 +90,7 @@
    traverse( macroPlan,NewAssemblyOnlinePlanRow,row , row.ProductionLine().ToUpper().LikeUserLocale( "MOMO" )){
      line := null( DispatchShiftSchedulingLine );
      factory := constnull( Unit );
      unit := constnull( Unit );
      {
        unitHandle := unitIndexTree.GetHandle( row.ProductionLine() );
        unitIndex := guard( unitIndexTree.Root().Child( unitHandle ), null( NamedValue ));
@@ -102,12 +108,16 @@
      
      traverse( row,NewAssemblyOnlinePlanCell,cell, startDate <= cell.NewAssemblyOnlinePlanColumn().StartDate() and endDate >= cell.NewAssemblyOnlinePlanColumn().EndDate()){
        product := null( DispatchShiftSchedulingProduct );
        remark := "";
        if( not isnull( unit )){
          remark := ShiftPlan::CalculateRemark( unit,cell.NewAssemblyOnlinePlanColumn().StartDate(),cell.NewAssemblyOnlinePlanColumn().EndDate() );
        }
        {
          lineKey := row.ProductionLine() + cell.NewAssemblyOnlinePlanColumn().StartDate().AsQUILL();
          lineHandle := lineIndexTree.GetHandle( lineKey );
          lineIndex := guard( lineIndexTree.Root().Child( lineHandle ),null( NamedValue ));
          if( isnull( lineIndex )){
            line := owner.DispatchShiftSchedulingLine( relnew,ID := IDHolder::GetGUID(),LineName := row.ProductionLine(),ShiftDate := cell.NewAssemblyOnlinePlanColumn().StartDate() );
            line := owner.DispatchShiftSchedulingLine( relnew,ID := IDHolder::GetGUID(),LineName := row.ProductionLine(),ShiftDate := cell.NewAssemblyOnlinePlanColumn().StartDate(),Remark := remark );
            line.FactoryName( factory.Name() );
            line.InterfaceTime( now );
            line.VersionName( macroPlan.MDSMacroPlan().Description() );
@@ -141,9 +151,21 @@
      tempProducts := selectsortedset( line,DispatchShiftSchedulingProduct,object,object.ProductionQuantity() );
      
      if( line.ShiftName() = "3" ){
        singleShiftVolume1 := lineQuantity / 3;
        singleShiftVolume2 := lineQuantity / 3;
        singleShiftVolume3 := lineQuantity / 3;
        singleShiftVolume1 := 0.0;
        singleShiftVolume2 := 0.0;
        singleShiftVolume3 := 0.0;
        if( line.Remark().LikeUserLocale( "保养" )){
          singleShiftVolume1 := 0.0;
          singleShiftVolume2 := lineQuantity / 2;
          singleShiftVolume3 := lineQuantity / 2;
        }else{
          singleShiftVolume1 := lineQuantity / 3;
          singleShiftVolume2 := lineQuantity / 3;
          singleShiftVolume3 := lineQuantity / 3;
        }
        for( i := tempProducts.Size() - 1;i >= 0; i-- ){
          product := tempProducts.Element( i );
          productionQuantity := product.ProductionQuantity();
@@ -168,8 +190,16 @@
        
      }else if( line.ShiftName() = "2" ){    
        // 240.5
        singleShiftVolume1 := lineQuantity / 2;
        singleShiftVolume2 := lineQuantity / 2;
        singleShiftVolume1 := 0.0;
        singleShiftVolume2 := 0.0;
        if( line.Remark().LikeUserLocale( "保养" )){
          singleShiftVolume1 := 0.0;
          singleShiftVolume2 := lineQuantity;
        }else{
          singleShiftVolume1 := lineQuantity / 2;
          singleShiftVolume2 := lineQuantity / 2;
        }
        for( i := tempProducts.Size() - 1;i >= 0; i-- ){
          product := tempProducts.Element( i );
          // 288
@@ -192,6 +222,13 @@
        
      }else if( line.ShiftName() = "1" ){
        singleShiftVolume1 := lineQuantity / 1;
        if( line.Remark().LikeUserLocale( "保养" )){
          singleShiftVolume1 := lineQuantity / 1;
        }else{
          singleShiftVolume1 := lineQuantity / 1;
        }
        for( i := tempProducts.Size() - 1;i >= 0; i-- ){
          product := tempProducts.Element( i );
          productionQuantity := product.ProductionQuantity();