* [task#142088,done,2h] finish task.

This commit is contained in:
sunguangming
2025-04-29 13:05:10 +08:00
committed by 刘刚
parent 08ca612c9b
commit 9c59dbfb89
3 changed files with 24 additions and 4 deletions
+5 -1
View File
@@ -1656,7 +1656,11 @@ class execution extends control
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$project = $this->loadModel('project')->getById($execution->project);
if(in_array($project->model, array('waterfall', 'waterfallplus', 'ipd'))) $this->loadModel('programplan')->computeProgress($executionID, 'close');
if(in_array($project->model, array('waterfall', 'waterfallplus', 'ipd')))
{
$result = $this->loadModel('programplan')->computeProgress($executionID, 'close');
if(is_array($result)) return $this->send($result);
}
$this->executeHooks($executionID);
+9 -1
View File
@@ -1488,6 +1488,7 @@ class executionModel extends model
$today = helper::today();
$burns = $this->getBurnData($executions);
$parentExecutions = $this->dao->select('parent,parent')->from(TABLE_EXECUTION)->where('parent')->ne(0)->andWhere('deleted')->eq(0)->fetchPairs();
$statusGroup = $this->dao->select('parent,status')->from(TABLE_EXECUTION)->where('parent')->in(array_keys($executions))->fetchGroup('parent', 'status');
/* Get workingDays. */
$earliestEnd = $today;
@@ -1509,6 +1510,13 @@ class executionModel extends model
if(isset($parentExecutions[$execution->id])) $executions[$execution->id]->isParent = 1;
if(empty($productID) && !empty($productList[$execution->id])) $execution->product = trim($productList[$execution->id]->product, ',');
/** 如果子执行都关闭了,则父执行可以手动关闭。 */
if(isset($statusGroup[$execution->id]))
{
$childStatus = array_keys($statusGroup[$execution->id]);
if(count($childStatus) == 1 && $childStatus[0] == 'closed') $execution->parentCanClose = true;
}
/* Judge whether the execution is delayed. */
if($execution->status != 'done' && $execution->status != 'closed' && $execution->status != 'suspended' && !empty($workingDays))
{
@@ -3829,7 +3837,7 @@ class executionModel extends model
$action = strtolower($action);
if($action == 'start') return $execution->status == 'wait';
if($action == 'close') return $execution->status != 'closed' && (!isset($execution->isParent) || (isset($execution->isParent) && !$execution->isParent));
if($action == 'close') return $execution->status != 'closed' && (empty($execution->isParent) || !empty($execution->parentCanClose));
if($action == 'suspend') return $execution->status == 'wait' || $execution->status == 'doing';
if($action == 'putoff') return $execution->status == 'wait' || $execution->status == 'doing';
if($action == 'activate') return $execution->status == 'suspended' || $execution->status == 'closed';
+10 -2
View File
@@ -602,9 +602,9 @@ class programplanModel extends model
* @param string $action
* @param bool $isParent
* @access public
* @return bool
* @return bool|array
*/
public function computeProgress(int $stageID, string $action = '', bool $isParent = false): bool
public function computeProgress(int $stageID, string $action = '', bool $isParent = false): bool|array
{
$stage = $this->loadModel('execution')->getByID($stageID);
if(empty($stage) || empty($stage->path)) return false;
@@ -618,6 +618,14 @@ class programplanModel extends model
foreach($parentIdList as $id)
{
$parent = $this->execution->getByID((int)$id);
/* 如果当前是顶级阶段,并且由于交付物不能关闭,则跳转到顶级阶段的关闭页面。 */
if(in_array($this->config->edition, array('max', 'ipd')) && $parent->grade == 1 && $parent->type != 'project' && $stageID != $id && !$this->execution->canCloseByDeliverable($parent))
{
$url = helper::createLink('execution', 'close', "executionID={$parent->id}");
return array('result' => 'fail', 'callback' => "zui.Modal.confirm('{$this->lang->execution->cannotAutoCloseParent}').then((res) => {if(res) {loadModal('$url', '.modal-dialog');} else {loadPage();}});");
}
if(empty($this->lang->execution->typeList[$parent->type]) || (!$isParent && $id == $stageID)) continue;
/** 获取子阶段关联开始任务数以及状态下子阶段数量。 */