diff --git a/wms/mkt/api/postFlow.php b/wms/mkt/api/postFlow.php index 44d5b4a5..10fbeaf0 100644 --- a/wms/mkt/api/postFlow.php +++ b/wms/mkt/api/postFlow.php @@ -53,4 +53,6 @@ function createFlow($mid, $current_assigner, $flow_code, $ekind, $form_key=null) $stmt->bindParam(':create_date', $created_at); $stmt->execute(); + + return $form_key; } \ No newline at end of file diff --git a/wms/mkt/api/postNewElevatorPricereview.php b/wms/mkt/api/postNewElevatorPricereview.php index 148e8001..0337ae81 100644 --- a/wms/mkt/api/postNewElevatorPricereview.php +++ b/wms/mkt/api/postNewElevatorPricereview.php @@ -713,7 +713,6 @@ try{ //發送待簽通知 include_once "./postFlow.php"; $createFlow = createFlow($mid, $manager, "A", $ekind, $form_key); - echo $createFlow; //發送系統通知 include_once "./postSystemNotice.php"; $sql_str = "SELECT * FROM pricereview_main WHERE id = :id ORDER BY id DESC LIMIT 1"; diff --git a/wms/mkt/api/resaveFlow.php b/wms/mkt/api/resaveFlow.php new file mode 100644 index 00000000..0926d48a --- /dev/null +++ b/wms/mkt/api/resaveFlow.php @@ -0,0 +1,101 @@ +prepare($sql_str); + $stmt->execute(); + $signs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $total = 0; + foreach($signs as $sign){ + $total++; + echo $total . "
"; + $currentSigner = ""; + $form_key = null; + if(!empty($sign['sign1'])){ + $sign1 = explode(",", $sign['sign1'])[1]; // M0033,, + if($sign1 == ""){ + $currentSigner = explode(",", $sign['sign1'])[0]; + $form_key = createFlow($sign['mid'], $currentSigner, "A", $sign['ekind'], $form_key ); + continue; + }else{ + if(!empty($sign['sign2'])){ + $sign2 = explode(",", $sign['sign2'])[1]; + if($sign2 == "" && $sign1 == "Y"){ + $currentSigner = explode(",", $sign['sign1'])[0]; + $form_key = createFlow($sign['mid'], $currentSigner, "A", $sign['ekind'], $form_key ); + $currentSigner = explode(",", $sign['sign2'])[0]; + createFlow($sign['mid'], $currentSigner, "B", $sign['ekind'], $form_key ); + continue; + } + $sign3 = explode(",", $sign['sign3'])[1]; + if($sign3 == "" && $sign2 == "Y"){ + $currentSigner = explode(",", $sign['sign1'])[0]; + $form_key = createFlow($sign['mid'], $currentSigner, "A", $sign['ekind'], $form_key ); + $currentSigner = explode(",", $sign['sign2'])[0]; + createFlow($sign['mid'], $currentSigner, "B", $sign['ekind'], $form_key ); + $currentSigner = explode(",", $sign['sign3'])[0]; + createFlow($sign['mid'], $currentSigner, "B", $sign['ekind'], $form_key ); + continue; + } + if(!empty($sign['sign4'])){ + $sign4 = explode(",", $sign['sign4'])[1]; + if($sign4 == "" && $sign3 == "Y"){ + $currentSigner = explode(",", $sign['sign1'])[0]; + $form_key = createFlow($sign['mid'], $currentSigner, "A", $sign['ekind'], $form_key ); + $currentSigner = explode(",", $sign['sign2'])[0]; + createFlow($sign['mid'], $currentSigner, "B", $sign['ekind'], $form_key ); + $currentSigner = explode(",", $sign['sign3'])[0]; + createFlow($sign['mid'], $currentSigner, "B", $sign['ekind'], $form_key ); + $currentSigner = explode(",", $sign['sign4'])[0]; + createFlow($sign['mid'], $currentSigner, "B", $sign['ekind'], $form_key ); + continue; + } + } + + }else{ + $sign3 = explode(",", $sign['sign3'])[1]; + if($sign3 == "" && $sign1 == "Y"){ + $currentSigner = explode(",", $sign['sign1'])[0]; + $form_key = createFlow($sign['mid'], $currentSigner, "A", $sign['ekind'], $form_key ); + $currentSigner = explode(",", $sign['sign3'])[0]; + createFlow($sign['mid'], $currentSigner, "B", $sign['ekind'], $form_key ); + continue; + } + if(!empty($sign['sign4'])){ + $sign4 = explode(",", $sign['sign4'])[1]; + if($sign4 == "" && $sign3 == "Y"){ + $currentSigner = explode(",", $sign['sign1'])[0]; + $form_key = createFlow($sign['mid'], $currentSigner, "A", $sign['ekind'], $form_key ); + $currentSigner = explode(",", $sign['sign3'])[0]; + createFlow($sign['mid'], $currentSigner, "B", $sign['ekind'], $form_key ); + $currentSigner = explode(",", $sign['sign4'])[0]; + createFlow($sign['mid'], $currentSigner, "B", $sign['ekind'], $form_key ); + continue; + } + } + } + } + + } + } +} \ No newline at end of file diff --git a/wms/mkt/pricereviewCheck.php b/wms/mkt/pricereviewCheck.php index 84309ff2..a98f9ba3 100644 --- a/wms/mkt/pricereviewCheck.php +++ b/wms/mkt/pricereviewCheck.php @@ -325,8 +325,8 @@ function getSignerName($signer){ - - + + diff --git a/wms/sign/conn.php b/wms/sign/conn.php new file mode 100644 index 00000000..84d118b9 --- /dev/null +++ b/wms/sign/conn.php @@ -0,0 +1,49 @@ +errorInfo()的形式獲取錯誤資訊 + //PDO::ERRMODE_WARNING: 引發 E_WARNING 錯誤,主動報錯 + //PDO::ERRMODE_EXCEPTION: 主動抛出 exceptions 異常,需要以try{}cath(){}輸出錯誤資訊。 + //設定主動以警告的形式報錯 + $conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); + //如果連接錯誤,將抛出一個PDOException異常對象 +} +catch ( PDOException $e ){ + //如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作 + die("ERROR!!!: ". $e->getMessage()); +} + +//$conn = null; //關閉資料庫的連線 \ No newline at end of file diff --git a/wms/sign/list.php b/wms/sign/list.php index 7b4ab5b0..f2d65bf5 100644 --- a/wms/sign/list.php +++ b/wms/sign/list.php @@ -9,7 +9,7 @@ // 載入db.php來連結資料庫 require_once "../database.php"; require_once "../header.php"; - +require_once("../mkt/conn.php"); function getWipwholestatusDataByFormkey($link, $form_key, $flow_id) { @@ -84,6 +84,42 @@ $sql_get = "SELECT d.form_id,c.form_key, a.system_id,b.flow_id ,a.system_name,c AND c.form_key=d.form_key and b.flow_id NOT IN ('wws04') $where_system_id +$where_flow_id + "; + + $sql_get = "SELECT + d.form_id, + c.form_key, + a.system_id, + b.flow_id, + a.system_name, + c.current_assigner, + CONCAT(c.current_assigner, '-', f_return_name(c.current_assigner)) AS current_assigner_name, + flow_name, + c.update_date, + c.create_date, + b.path, + d.flow_code +FROM + system_main a +JOIN + flow_main b ON a.system_id = b.system_id +JOIN + flow d ON b.flow_id = d.flow_id +JOIN + (SELECT + form_key, + MAX(seq) AS max_seq + FROM + subflow + GROUP BY + form_key) AS sf ON d.form_key = sf.form_key +JOIN + subflow c ON c.form_key = sf.form_key AND c.seq = sf.max_seq +WHERE + c.current_assigner = '$user_id' + AND b.flow_id NOT IN ('wws04') + $where_system_id $where_flow_id "; // echo '
';
@@ -107,6 +143,16 @@ $flow_name_opt = array_map(function ($item) {
 }, $res_get);
 $flow_name_opt = (array_unique($flow_name_opt, SORT_REGULAR));
 
+
+function getPricereviewDataByFormkey($form_key){
+    global $conn;
+    $sql_str = "SELECT pricereview_main.contractno, pricereview_main.company FROM flow LEFT JOIN pricereview_main ON flow.form_id = pricereview_main.id WHERE flow.form_key = :form_key ORDER BY pricereview_main.id DESC LIMIT 1";
+    $stmt = $conn->prepare($sql_str);
+    $stmt->bindParam(':form_key', $form_key);
+    $stmt->execute();
+    $result = $stmt->fetch(PDO::FETCH_ASSOC);
+    return $result;
+}
 ?>