コード例 #1
0
 /**
  * Release at the same time
  */
 public function depReleasePm($childPmId, $scopeId, $typeId, $woId, $dueDate, $finishTime, $pmRow, $pmAssetRow, $wogenBo)
 {
     $depPmRow = $this->getPmRow($childPmId);
     if ($scopeId == 'pm_dependency_scope_same') {
         $depPmAssetRows = $this->getPmAssetRow($childPmId, $pmAssetRow['asset_id']);
     } else {
         if ($scopeId == 'pm_dependency_scope_all') {
             $depPmAssetRows = $this->getPmAssetRow($childPmId);
         }
     }
     if (!$depPmRow || !$depPmAssetRows) {
         return;
     }
     if (!$wogenBo->isDependencySchedulePm($depPmRow)) {
         return;
     }
     //this dependent PmRow cannot be released.
     $assetDbo = CalemFactory::getDbo('asset');
     //Get schedule object
     $schedBo = new CalemPmScheduleBo($depPmRow['release_schedule']);
     //release each based on scope and type.
     foreach ($depPmAssetRows as $depPmAssetRow) {
         //Let's check for asset here
         if (!$wogenBo->isDependencyScheduleAsset($depPmAssetRow, $assetDbo)) {
             continue;
         }
         //Let's go ahead and release the asset
         $depDueDate = $dueDate;
         //@todo - do we need a configuration to check for floating case so it's not released?
         if ($typeId == 'pm_dependency_before') {
             //Figure out a dueDate by
             $startDate = $this->releaseBo->getStartDate($dueDate, $depPmRow['duration_hours']);
             $depDueDate = $schedBo->adjustReleaseDate($startDate);
         } else {
             if ($typeId == 'pm_dependency_after') {
                 $depDueDate = $schedBo->adjustReleaseDate($finishTime);
             }
         }
         $depFinishTime = $this->releaseBo->getPlannedFinishTime($depDueDate, $depPmRow['duration_hours']);
         $depWoId = $this->releaseBo->releasePm($depDueDate, $depFinishTime, $depPmRow, $depPmAssetRow);
         if ($depWoId) {
             $wogenBo->incWoCount();
             $this->setDepWoId($typeId, $woId, $depWoId);
             //Need to recursively release for dependency
             $wogenBo->releaseByDependency($depWoId, $depDueDate, $depFinishTime, $depPmRow, $depPmAssetRow);
         }
     }
 }