|
@ -2,21 +2,53 @@ |
|
|
|
|
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|
|
require_once('../conn.php'); |
|
|
require_once('../conn.php'); |
|
|
header("Content-Type: application/json; charset=UTF-8"); |
|
|
|
|
|
$signDetails = new signDetails(); |
|
|
$signDetails = new signDetails(); |
|
|
|
|
|
$method = !empty($_POST['method']) ? $_POST['method'] : ''; |
|
|
|
|
|
|
|
|
|
|
|
if ($method == 'getSingDetails') { |
|
|
|
|
|
header("Content-Type: application/json; charset=UTF-8"); |
|
|
echo $signDetails->getSingDetails(); |
|
|
echo $signDetails->getSingDetails(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($method == 'getSingDetailsAllCount') { |
|
|
|
|
|
header("Content-Type: application/html; charset=UTF-8"); |
|
|
|
|
|
echo $signDetails->getSingDetailsAllCount(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
class signDetails |
|
|
class signDetails |
|
|
{ |
|
|
{ |
|
|
|
|
|
public $count = 0; |
|
|
|
|
|
public $now_page = 1; |
|
|
|
|
|
public $end_page = 1; |
|
|
|
|
|
public $per = 10; |
|
|
|
|
|
public $system_name = ''; |
|
|
|
|
|
public $department_id = ''; |
|
|
|
|
|
public $user_id = ''; |
|
|
|
|
|
public $search = ''; |
|
|
|
|
|
|
|
|
public function getSingDetails() |
|
|
public function __construct() |
|
|
{ |
|
|
{ |
|
|
global $conn; |
|
|
$this->now_page = !empty($_POST['now_page']) ? $_POST['now_page'] : 1; |
|
|
|
|
|
$this->per = !empty($_POST['per']) ? $_POST['per'] : 10; |
|
|
|
|
|
$this->system_name = !empty($_POST['system_name']) ? $_POST['system_name'] : ''; |
|
|
|
|
|
$this->department_id = !empty($_POST['department_id']) ? $_POST['department_id'] : ''; |
|
|
|
|
|
$this->user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : ''; |
|
|
|
|
|
$this->search = !empty($_POST['search']) ? $_POST['search'] : ''; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$system_name = !empty($_POST['system_name']) ? $_POST['system_name'] : ''; |
|
|
public function getSingDetailsAllCount() |
|
|
$department_id = !empty($_POST['department_id']) ? $_POST['department_id'] : ''; |
|
|
{ |
|
|
$user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : ''; |
|
|
global $conn; |
|
|
|
|
|
global $connEkp; |
|
|
|
|
|
$system_name = $this->system_name; |
|
|
|
|
|
$department_id = $this->department_id; |
|
|
|
|
|
$user_id = $this->user_id; |
|
|
|
|
|
$search = $this->search; |
|
|
|
|
|
$all_count = 0; |
|
|
|
|
|
$wms_count = 0; |
|
|
|
|
|
$bpm_count = 0; |
|
|
|
|
|
|
|
|
$sql_str = " |
|
|
$sql_str = " |
|
|
SELECT |
|
|
SELECT |
|
@ -60,27 +92,107 @@ class signDetails |
|
|
AND sf.current_assigner != '' |
|
|
AND sf.current_assigner != '' |
|
|
AND sf.current_assigner IS NOT NULL |
|
|
AND sf.current_assigner IS NOT NULL |
|
|
"; |
|
|
"; |
|
|
if(!empty($department_id)){ |
|
|
$sql_str .= !empty($department_id) ? " AND a.department_id = :department_id " : ""; |
|
|
$sql_str .= " AND d.department_id = :department_id "; |
|
|
$sql_str .= !empty($user_id) ? " AND sf.current_assigner = :user_id " : ""; |
|
|
} |
|
|
if (!empty($search)) { |
|
|
if(!empty($user_id)){ |
|
|
$sql_str .= " AND ( |
|
|
$sql_str .= " AND sf.current_assigner = :user_id "; |
|
|
sm.system_name LIKE :search |
|
|
|
|
|
OR fm.flow_name LIKE :search |
|
|
|
|
|
OR f.form_key LIKE :search |
|
|
|
|
|
OR sf.current_assigner LIKE :search |
|
|
|
|
|
OR a.name LIKE :search |
|
|
|
|
|
OR d.department_id LIKE :search |
|
|
|
|
|
OR d.depart_name LIKE :search |
|
|
|
|
|
OR sf.update_date LIKE :search |
|
|
|
|
|
) "; |
|
|
} |
|
|
} |
|
|
$stmt = $conn->prepare($sql_str); |
|
|
$stmt = $conn->prepare($sql_str); |
|
|
if(!empty($department_id)){ |
|
|
!empty($department_id) ? $stmt->bindParam(':department_id', $department_id) : ''; |
|
|
$stmt->bindParam(':department_id', $department_id); |
|
|
!empty($user_id) ? $stmt->bindParam(':user_id', $user_id) : ''; |
|
|
} |
|
|
!empty($search) ? $stmt->bindValue(':search', '%' . $search . '%') : ''; |
|
|
if(!empty($user_id)){ |
|
|
$stmt->execute(); |
|
|
$stmt->bindParam(':user_id', $user_id); |
|
|
$wms_count = $stmt->rowCount(); |
|
|
|
|
|
|
|
|
|
|
|
$sql_str = " |
|
|
|
|
|
SELECT |
|
|
|
|
|
'藍凌BPM' AS system_name, |
|
|
|
|
|
krt.fd_name AS flow_name, -- 流程名稱 |
|
|
|
|
|
lp.fd_id AS form_key, |
|
|
|
|
|
soe.fd_no AS current_assigner, -- 預計處理人員工編號 |
|
|
|
|
|
soe.fd_name AS user_name, -- 預計處理人名稱 |
|
|
|
|
|
'' AS department_id, |
|
|
|
|
|
soe2.fd_name AS depart_name, -- 部門 |
|
|
|
|
|
lp.fd_create_time AS update_date -- 創建時間 |
|
|
|
|
|
FROM lbpm_process AS lp |
|
|
|
|
|
LEFT JOIN km_review_template AS krt |
|
|
|
|
|
ON lp.fd_template_model_id = krt.fd_id |
|
|
|
|
|
LEFT JOIN lbpm_workitem AS lw |
|
|
|
|
|
ON lp.fd_id = lw.fd_process_id |
|
|
|
|
|
LEFT JOIN sys_org_element AS soe |
|
|
|
|
|
ON lw.fd_expected_id = soe.fd_id |
|
|
|
|
|
LEFT JOIN sys_org_element AS soe2 |
|
|
|
|
|
ON soe2.fd_id = soe.fd_parentid |
|
|
|
|
|
LEFT JOIN lbpm_history_workitem AS lhw |
|
|
|
|
|
ON lp.fd_id = lhw.fd_process_id |
|
|
|
|
|
WHERE 1=1 |
|
|
|
|
|
-- AND lw.fd_status = '20' |
|
|
|
|
|
AND lhw.fd_activity_type = 'reviewWorkitem' |
|
|
|
|
|
AND krt.fd_name != '' |
|
|
|
|
|
AND soe.fd_no != '' |
|
|
|
|
|
"; |
|
|
|
|
|
$sql_str .= !empty($department_id) ? " AND a.department_id = :department_id " : ""; |
|
|
|
|
|
$sql_str .= !empty($user_id) ? " AND sf.current_assigner = :user_id " : ""; |
|
|
|
|
|
if (!empty($search)) { |
|
|
|
|
|
$sql_str .= " AND ( |
|
|
|
|
|
krt.fd_name LIKE :search |
|
|
|
|
|
OR lp.fd_id LIKE :search |
|
|
|
|
|
OR soe.fd_no LIKE :search |
|
|
|
|
|
OR soe.fd_name LIKE :search |
|
|
|
|
|
OR soe2.fd_name LIKE :search |
|
|
|
|
|
OR lp.fd_create_time LIKE :search |
|
|
|
|
|
) "; |
|
|
} |
|
|
} |
|
|
|
|
|
$stmt = $connEkp->prepare($sql_str); |
|
|
|
|
|
!empty($department_id) ? $stmt->bindParam(':department_id', $department_id) : ''; |
|
|
|
|
|
!empty($user_id) ? $stmt->bindParam(':user_id', $user_id) : ''; |
|
|
|
|
|
!empty($search) ? $stmt->bindValue(':search', '%' . $search . '%') : ''; |
|
|
$stmt->execute(); |
|
|
$stmt->execute(); |
|
|
$data = $stmt->fetchAll(PDO::FETCH_ASSOC); |
|
|
$bpm_count = $stmt->rowCount(); |
|
|
return json_encode($data, JSON_UNESCAPED_UNICODE); |
|
|
|
|
|
|
|
|
$all_count = $wms_count + $bpm_count; |
|
|
|
|
|
if ($system_name == 'wms') |
|
|
|
|
|
return $wms_count; |
|
|
|
|
|
if ($system_name == 'bpm') |
|
|
|
|
|
return $bpm_count; |
|
|
|
|
|
return $all_count; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getSingDetailsAllCount() |
|
|
public function getNowPage() |
|
|
|
|
|
{ |
|
|
|
|
|
return $this->now_page = !empty($_POST['now_page']) ? $_POST['now_page'] : 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getEndPage() |
|
|
|
|
|
{ |
|
|
|
|
|
$count = $this->getSingDetailsAllCount(); |
|
|
|
|
|
return $this->end_page = ceil($count / $this->per); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getSingDetails() |
|
|
{ |
|
|
{ |
|
|
global $conn; |
|
|
global $conn; |
|
|
|
|
|
global $connEkp; |
|
|
|
|
|
$system_name = $this->system_name; |
|
|
|
|
|
$department_id = $this->department_id; |
|
|
|
|
|
$user_id = $this->user_id; |
|
|
|
|
|
$search = $this->search; |
|
|
|
|
|
$per = $this->per; |
|
|
|
|
|
$now_page = $this->now_page; |
|
|
|
|
|
$limit_start = ($now_page - 1) * $per; |
|
|
|
|
|
$data = []; |
|
|
|
|
|
$wms_data = []; |
|
|
|
|
|
$bpm_data = []; |
|
|
|
|
|
|
|
|
$sql_str = " |
|
|
$sql_str = " |
|
|
SELECT |
|
|
SELECT |
|
|
sm.system_name, |
|
|
sm.system_name, |
|
@ -90,8 +202,8 @@ class signDetails |
|
|
a.name AS user_name, |
|
|
a.name AS user_name, |
|
|
d.department_id, |
|
|
d.department_id, |
|
|
d.depart_name AS depart_name, |
|
|
d.depart_name AS depart_name, |
|
|
-- d.name AS depart_name, |
|
|
sf.update_date, |
|
|
sf.update_date |
|
|
DATEDIFF(NOW(),sf.update_date) AS diff_days |
|
|
FROM flow AS f |
|
|
FROM flow AS f |
|
|
LEFT JOIN system_main as sm |
|
|
LEFT JOIN system_main as sm |
|
|
ON f.system_id = sm.system_id |
|
|
ON f.system_id = sm.system_id |
|
@ -124,8 +236,85 @@ class signDetails |
|
|
AND sf.current_assigner != '' |
|
|
AND sf.current_assigner != '' |
|
|
AND sf.current_assigner IS NOT NULL |
|
|
AND sf.current_assigner IS NOT NULL |
|
|
"; |
|
|
"; |
|
|
|
|
|
$sql_str .= !empty($department_id) ? " AND a.department_id = :department_id " : ""; |
|
|
|
|
|
$sql_str .= !empty($user_id) ? " AND sf.current_assigner = :user_id " : ""; |
|
|
|
|
|
if (!empty($search)) { |
|
|
|
|
|
$sql_str .= " AND ( |
|
|
|
|
|
sm.system_name LIKE :search |
|
|
|
|
|
OR fm.flow_name LIKE :search |
|
|
|
|
|
OR f.form_key LIKE :search |
|
|
|
|
|
OR sf.current_assigner LIKE :search |
|
|
|
|
|
OR a.name LIKE :search |
|
|
|
|
|
OR d.department_id LIKE :search |
|
|
|
|
|
OR d.depart_name LIKE :search |
|
|
|
|
|
OR sf.update_date LIKE :search |
|
|
|
|
|
) "; |
|
|
|
|
|
} |
|
|
|
|
|
$sql_str .= " LIMIT :per OFFSET :limit_start"; |
|
|
$stmt = $conn->prepare($sql_str); |
|
|
$stmt = $conn->prepare($sql_str); |
|
|
|
|
|
!empty($department_id) ? $stmt->bindParam(':department_id', $department_id) : ''; |
|
|
|
|
|
!empty($user_id) ? $stmt->bindParam(':user_id', $user_id) : ''; |
|
|
|
|
|
$stmt->bindParam(':limit_start', $limit_start, PDO::PARAM_INT); |
|
|
|
|
|
$stmt->bindParam(':per', $per, PDO::PARAM_INT); |
|
|
|
|
|
!empty($search) ? $stmt->bindValue(':search', '%' . $search . '%') : ''; |
|
|
|
|
|
$stmt->execute(); |
|
|
|
|
|
$wms_data = $stmt->fetchAll(PDO::FETCH_ASSOC); |
|
|
|
|
|
|
|
|
|
|
|
$sql_str = " |
|
|
|
|
|
SELECT |
|
|
|
|
|
'藍凌BPM' AS system_name, |
|
|
|
|
|
krt.fd_name AS flow_name, -- 流程名稱 |
|
|
|
|
|
lp.fd_id AS form_key, |
|
|
|
|
|
soe.fd_no AS current_assigner, -- 預計處理人員工編號 |
|
|
|
|
|
soe.fd_name AS user_name, -- 預計處理人名稱 |
|
|
|
|
|
'' AS department_id, |
|
|
|
|
|
soe2.fd_name AS depart_name, -- 部門 |
|
|
|
|
|
SUBSTR(lp.fd_create_time,1,19) AS update_date, -- 創建時間 |
|
|
|
|
|
DATEDIFF(NOW(),lp.fd_create_time) AS diff_days |
|
|
|
|
|
FROM lbpm_process AS lp |
|
|
|
|
|
LEFT JOIN km_review_template AS krt |
|
|
|
|
|
ON lp.fd_template_model_id = krt.fd_id |
|
|
|
|
|
LEFT JOIN lbpm_workitem AS lw |
|
|
|
|
|
ON lp.fd_id = lw.fd_process_id |
|
|
|
|
|
LEFT JOIN sys_org_element AS soe |
|
|
|
|
|
ON lw.fd_expected_id = soe.fd_id |
|
|
|
|
|
LEFT JOIN sys_org_element AS soe2 |
|
|
|
|
|
ON soe2.fd_id = soe.fd_parentid |
|
|
|
|
|
LEFT JOIN lbpm_history_workitem AS lhw |
|
|
|
|
|
ON lp.fd_id = lhw.fd_process_id |
|
|
|
|
|
WHERE 1=1 |
|
|
|
|
|
-- AND lw.fd_status = '20' |
|
|
|
|
|
AND lhw.fd_activity_type = 'reviewWorkitem' |
|
|
|
|
|
AND krt.fd_name != '' |
|
|
|
|
|
AND soe.fd_no != '' |
|
|
|
|
|
"; |
|
|
|
|
|
$sql_str .= !empty($department_id) ? " AND a.department_id = :department_id " : ""; |
|
|
|
|
|
$sql_str .= !empty($user_id) ? " AND sf.current_assigner = :user_id " : ""; |
|
|
|
|
|
if (!empty($search)) { |
|
|
|
|
|
$sql_str .= " AND ( |
|
|
|
|
|
krt.fd_name LIKE :search |
|
|
|
|
|
OR lp.fd_id LIKE :search |
|
|
|
|
|
OR soe.fd_no LIKE :search |
|
|
|
|
|
OR soe.fd_name LIKE :search |
|
|
|
|
|
OR soe2.fd_name LIKE :search |
|
|
|
|
|
OR lp.fd_create_time LIKE :search |
|
|
|
|
|
) "; |
|
|
|
|
|
} |
|
|
|
|
|
$sql_str .= " LIMIT :per OFFSET :limit_start"; |
|
|
|
|
|
$stmt = $connEkp->prepare($sql_str); |
|
|
|
|
|
!empty($department_id) ? $stmt->bindParam(':department_id', $department_id) : ''; |
|
|
|
|
|
!empty($user_id) ? $stmt->bindParam(':user_id', $user_id) : ''; |
|
|
|
|
|
$stmt->bindParam(':limit_start', $limit_start, PDO::PARAM_INT); |
|
|
|
|
|
$stmt->bindParam(':per', $per, PDO::PARAM_INT); |
|
|
|
|
|
!empty($search) ? $stmt->bindValue(':search', '%' . $search . '%') : ''; |
|
|
$stmt->execute(); |
|
|
$stmt->execute(); |
|
|
return $stmt->rowCount(); |
|
|
$bpm_data = $stmt->fetchAll(PDO::FETCH_ASSOC); |
|
|
|
|
|
|
|
|
|
|
|
$data = array_merge($wms_data, $bpm_data); |
|
|
|
|
|
if ($system_name == 'wms') |
|
|
|
|
|
return json_encode($wms_data, JSON_UNESCAPED_UNICODE); |
|
|
|
|
|
if ($system_name == 'bpm') |
|
|
|
|
|
return json_encode($bpm_data, JSON_UNESCAPED_UNICODE); |
|
|
|
|
|
return json_encode($data, JSON_UNESCAPED_UNICODE); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |