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){
'; @@ -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; +} ?>