lazhen
2024-10-22 6fae3f0b2ce8365d8c75d7acfd79a0a1675ac8fc
Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev-zlg
已添加2个文件
已修改1个文件
107 ■■■■■ 文件已修改
_Main/BL/Type_WholeShift/Method_ContinuousProductionScheduling.qbl 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_WholeShift/Method_MobileCycleTask.qbl 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_WholeShift/Method_PostProcessing2.qbl 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_WholeShift/Method_ContinuousProductionScheduling.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,76 @@
Quintiq file version 2.0
#parent: #root
Method ContinuousProductionScheduling (
  MacroPlan macroPlan,
  UnitPeriodTimeBases uptbs
)
{
  Description: '一周内连续排产'
  TextBody:
  [*
    debuginfo( "开始设置连续排产" );
    // ä¸€å‘¨çš„开始时间【循环索引】
    indexStartDate  := macroPlan.StartOfPlanning().Date().StartOfWeek();
    needHandleUPTBs := selectsortedset( uptbs, Elements, tempUPTB, tempUPTB.StartDate().StartOfWeek() = indexStartDate, tempUPTB.StartDate() );
    while ( needHandleUPTBs.Size() > 0 ) {
      debuginfo( "-------------------------------------------", "正在处理的周开始时间:", indexStartDate.Format( "Y-M2-D2" ),
                 "    æ­£åœ¨å¤„理的周结束时间:", ( indexStartDate.StartOfNextWeek() - 1 ).Format( "Y-M2-D2" ), "    å¤„理的个数:", needHandleUPTBs.Size() );
      // éœ€è¦å¤„理标志
      needHandleFlag := false;
      // ç¬¬ä¸€æ¬¡å‡ºçŽ°äº§èƒ½æ—¥æœŸ
      firstAppearCapacityDate  := Date::MinDate();
      // ç¬¬ä¸€æ¬¡å‡ºçŽ°äº§èƒ½æ—¥æœŸã€å¤„ç†è¿žç»­æŽ’äº§ç”¨åˆ°ã€‘
      firstAppearCapacityDate1 := Date::MinDate();
      // è¯†åˆ«æ˜¯å¦éœ€è¦è¿žç»­æŽ’产
      traverse ( needHandleUPTBs, Elements, uptb ) {
        // ç»™ç¬¬ä¸€æ¬¡äº§èƒ½èµ‹å€¼
        if ( firstAppearCapacityDate.IsMinInfinity() and uptb.UsedCapacity().HoursAsReal() > 0.0 ) {
          firstAppearCapacityDate  := uptb.StartDate();
          firstAppearCapacityDate1 := uptb.StartDate();
        }
        // åˆ¤æ–­æ˜¯å¦éœ€è¦è¿žç»­æŽ’产
        if ( not firstAppearCapacityDate.IsMinInfinity() and firstAppearCapacityDate <> uptb.StartDate() and uptb.UsedCapacity().HoursAsReal() > 0.0 ) {
          if ( ( firstAppearCapacityDate + 1 ) = uptb.StartDate() ) {
            firstAppearCapacityDate := uptb.StartDate();
          } else {
            needHandleFlag := true;
          }
        }
      }
      // å¤„理连续排产
      if ( needHandleFlag ) {
        // ç´¢å¼•开始时间
        handleIndexStartDate := firstAppearCapacityDate1 + 1;
        // éœ€è¦å¤„理的UPTB的最大时间
        handleIndexEndDate   := maxobject( needHandleUPTBs, Elements, tempUPTB, true, tempUPTB.StartDate() ).StartDate();
    //    debuginfo( "需要处理的周开始时间:", indexStartDate.Format( "Y-M2-D2" ), "    éœ€è¦å¤„理的周结束时间:", handleIndexEndDate.Format( "Y-M2-D2" ),
    //               "    ç¬¬ä¸€æ¬¡å‡ºçŽ°äº§èƒ½çš„æ—¥æœŸï¼š", firstAppearCapacityDate1.Format( "Y-M2-D2" ) );
        needFillUPTB := select( needHandleUPTBs, Elements, tempUPTB, tempUPTB.StartDate() = handleIndexStartDate );
        while ( guard( needFillUPTB.UsedCapacity().HoursAsReal(), -1 ) <= 0.0 and handleIndexStartDate <= handleIndexEndDate ) {
          targetUPTB := minselect( needHandleUPTBs, Elements, tempUPTB, tempUPTB.StartDate() > handleIndexStartDate and tempUPTB.UsedCapacity().HoursAsReal() > 0.0, tempUPTB.StartDate() );
          // ç§»åŠ¨å‘¨æœŸä»»åŠ¡
          if ( not isnull( needFillUPTB ) and not isnull( targetUPTB ) ) {
            this.MobileCycleTask( needFillUPTB, targetUPTB );
          }
          handleIndexStartDate := handleIndexStartDate + 1;
          needFillUPTB         := select( needHandleUPTBs, Elements, tempUPTB, tempUPTB.StartDate() = handleIndexStartDate );
        }
      }
      indexStartDate  := indexStartDate.StartOfNextWeek();
      needHandleUPTBs := selectsortedset( uptbs, Elements, tempUPTB, tempUPTB.StartDate().StartOfWeek() = indexStartDate, tempUPTB.StartDate() );
    }
  *]
}
_Main/BL/Type_WholeShift/Method_MobileCycleTask.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
Quintiq file version 2.0
#parent: #root
Method MobileCycleTask (
  UnitPeriodTimeBase fillUPTB,
  UnitPeriodTimeBase targetUPTB
)
{
  Description: '连续生产,移动两个周期任务'
  TextBody:
  [*
    debuginfo( "需要填充的日期:", fillUPTB.StartDate().Format( "Y-M2-D2" ), "    ç›®æ ‡è¢«å–数日期:", targetUPTB.StartDate().Format( "Y-M2-D2" ) );
    // åˆ¤æ–­å¯ç”¨äº§èƒ½æ˜¯å¦ä¸€è‡´
    if ( fillUPTB.BaseAvailableCapacity().HoursAsReal() = targetUPTB.BaseAvailableCapacity().HoursAsReal() ) {
      traverse ( targetUPTB, PeriodTaskOperation, pto ) {
        PeriodTaskOperation::Create( pto.Operation(), fillUPTB, pto.Quantity(), false );
      }
      PeriodTaskOperation::Delete( selectset( targetUPTB, PeriodTaskOperation, tempPTO, true ) );
    }
    Transaction::Transaction().Propagate();
  *]
}
_Main/BL/Type_WholeShift/Method_PostProcessing2.qbl
@@ -15,8 +15,8 @@
      uptbs    := selectsortedset( unit, UnitPeriod.astype( UnitPeriodTimeBase ), tempUPTB, not tempUPTB.IsPeriodFrozen() and tempUPTB.IsPlanning(), tempUPTB.Start() );
          
      // åœ†æ•´æˆ–补零当前产线下所生产的产品
      this.IsRoundingOrZeroFilling3( macroPlan, uptbs ); // å€Ÿè¿˜é€»è¾‘
      Transaction::Transaction().Propagate();
    //  this.IsRoundingOrZeroFilling3( macroPlan, uptbs ); // å€Ÿè¿˜é€»è¾‘
    //  Transaction::Transaction().Propagate();
            
    //        // å¹³è¡¡å½“前产线下所生产的产品库存(库存 < æœ€å¤§åº“存)
    //        // this.A_balanceInventory( macroPlan, unitPeriodTimeBases );
@@ -44,6 +44,9 @@
    //        this.A_generateRequirements( macroPlan, unit.ID() );
    //        Transaction::Transaction().Propagate();
    //      }
      // è®¾ç½®è¿žç»­æŽ’产
      this.ContinuousProductionScheduling( macroPlan, uptbs );
    }
    
    // è½¦é“整班