diff --git a/wms/createFacilityNo.php b/wms/createFacilityNo.php index 4ae4adbb..931eaedf 100644 --- a/wms/createFacilityNo.php +++ b/wms/createFacilityNo.php @@ -1,481 +1,481 @@ - false, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_EMULATE_PREPARES => false, - PDO::ATTR_STRINGIFY_FETCHES => false, - PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4', - ]; - $pdo = new PDO('mysql:host=localhost;port=3306;dbname=appwms', 'masadaroot', 'x6h5E5p#u8y', $options); - $pdo->exec('SET CHARACTER SET utf8mb4'); - return $pdo; - } catch (PDOException $e) { - die("Something wrong: {$e->getMessage()}"); - } - } - - /** - * 結束資料庫連線 - */ - function endConnectionDB($pdo) - { - unset($pdo); - } - - /** - * 取得下一個新的作番 - * @param string $facility_type : M:新梯 T:汰改 B:保養 - * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 - * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 - * @param int $num : 號機 - * @return array $new_facility_arr - */ - function getNextFacilityNo($facility_type, $sale_type, $make_type, $num = 1) - { - $this->checkYearAndResetAllSeq(); - $Y = substr(date("Y"), 3, 1); - - switch ($facility_type) { - case "M": - $next_seq = $this->getNextFacilitySeq("mf_vol_no") + 1; - $new_facility_arr = []; - for ($start_num = 1; $start_num <= $num; $start_num++) { - $facility_no_tmp = $Y . $sale_type . $make_type - . str_pad($next_seq, 5, "0", STR_PAD_LEFT); - array_push($new_facility_arr, $facility_no_tmp); - $next_seq++; - } - return $new_facility_arr; - case "T": - $next_seq = $this->getNextFacilitySeq("tf_vol_no"); - $new_facility_arr = []; - for ($start_num = 1; $start_num <= $num; $start_num++) { - $facility_no_tmp = $Y . $sale_type . $make_type - . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) - . str_pad($start_num, 2, "0", STR_PAD_LEFT); - array_push($new_facility_arr, $facility_no_tmp); - } - return $new_facility_arr; - case "B": - $next_seq = $this->getNextFacilitySeq("bf_vol_no"); - $new_facility_arr = []; - for ($start_num = 1; $start_num <= $num; $start_num++) { - $facility_no_tmp = $Y . $sale_type . $make_type - . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) - . str_pad($start_num, 2, "0", STR_PAD_LEFT); - array_push($new_facility_arr, $facility_no_tmp); - } - return $new_facility_arr; - default: - return "不存在的作番類型"; - } - } - - /** - * 建立新的作番 - * @param string $facility_type : M:新梯 T:汰改 B:保養 - * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 - * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 - * @param string $num : 號機 (非必填) - * @return string $new_facility_no - */ - function makeFacilityNo($facility_type, $sale_type, $make_type, $num = null) - { - - $this->checkYearAndResetAllSeq(); - - $faclikity_details = array( - 'facility_type' => $facility_type, - 'sale_type' => $sale_type, - 'make_type' => $make_type, - 'num' => $num - ); - - switch ($facility_type) { - case "M": - return $this->makeNewMFacilityNo($faclikity_details); - break; - case "T": - return $this->makeNewTFacilityNo($faclikity_details); - break; - case "B": - return $this->makeNewBFacilityNo($faclikity_details); - break; - default: - return "不存在的作番類型"; - } - } - - /** - * 建立作番 -- 新梯 - */ - function makeNewMFacilityNo($faclikity_details) - { - $Y = substr(date("Y"), 3, 1); - $sale_type = $faclikity_details['sale_type']; - $make_type = $faclikity_details['make_type']; - $num = $faclikity_details['num']; - $next_seq = $this->getNextFacilitySeq("mf_vol_no") + 1; - $new_facility_no_arr = []; - - for ($i = 1; $i <= $num; $i++) { - $new_facility_no = $Y . $sale_type . $make_type - . str_pad($next_seq, 5, "0", STR_PAD_LEFT); - array_push($new_facility_no_arr, $new_facility_no); - $next_seq++; - } - - foreach ($new_facility_no_arr as $new_facility_no) { - if ($this->getMakeNewMFacilityNoStatus($faclikity_details) !== "1") { - return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details); - } - // seq +1 - $this->facilitySeqAddOne("M"); - } - return $new_facility_no_arr; - } - - /** - * 建立作番 -- 汰改 - */ - function makeNewTFacilityNo($faclikity_details) - { - - $Y = substr(date("Y"), 3, 1); - $sale_type = $faclikity_details['sale_type']; - $make_type = $faclikity_details['make_type']; - $num = $faclikity_details['num']; - $next_seq = $this->getNextFacilitySeq("tf_vol_no"); - $new_facility_no_arr = []; - - for ($i = 1; $i <= $num; $i++) { - $new_facility_no = $Y . $sale_type . $make_type - . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) - . str_pad($i, 2, "0", STR_PAD_LEFT); - array_push($new_facility_no_arr, $new_facility_no); - } - - foreach ($new_facility_no_arr as $new_facility_no) { - if ($this->getMakeNewTFacilityNoStatus($faclikity_details) !== "1") { - return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details); - } - // seq +1 - $this->facilitySeqAddOne("T"); - return $new_facility_no_arr; - } - } - - /** - * 建立作番 -- 保養 - */ - function makeNewBFacilityNo($faclikity_details) - { - - $Y = substr(date("Y"), 3, 1); - $sale_type = $faclikity_details['sale_type']; - $make_type = $faclikity_details['make_type']; - $num = $faclikity_details['num']; - $next_seq = $this->getNextFacilitySeq("bf_vol_no"); - $new_facility_no_arr = []; - - for ($i = 1; $i <= $num; $i++) { - $new_facility_no = $Y . $sale_type . $make_type - . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) - . str_pad($i, 2, "0", STR_PAD_LEFT); - array_push($new_facility_no_arr, $new_facility_no); - } - - foreach ($new_facility_no_arr as $new_facility_no) { - if ($this->getMakeNewTFacilityNoStatus($faclikity_details) !== "1") { - return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details); - } - // seq +1 - $this->facilitySeqAddOne("B"); - return $new_facility_no_arr; - } - } - - /** - * 檢查作番編列狀態 - 新梯 - * @param array $faclikity_details - * @return string $status : 1:正確 else:error message - */ - function getMakeNewMFacilityNoStatus($faclikity_details) - { - $Y = substr(date("Y"), 3, 1); - $sale_type = $faclikity_details['sale_type']; - $make_type = $faclikity_details['make_type']; - $next_seq = $this->getNextFacilitySeq("mf_vol_no"); - $new_facility_no = $Y . $sale_type . $make_type . str_pad($next_seq + 1, 5, "0", STR_PAD_LEFT); - - if ($this->checkSaleTypeStatus($sale_type) == false) - return "銷售代號錯誤"; - if ($this->checkMakeTypeStatus($make_type) == false) - return "製造編號類型錯誤"; - return "1"; - } - - /** - * 檢查作番編列狀態 - 汰改 - * @param array $faclikity_details - * @return string $status : 1:正確 else:error message - */ - function getMakeNewTFacilityNoStatus($faclikity_details) - { - $Y = substr(date("Y"), 3, 1); - $sale_type = $faclikity_details['sale_type']; - $make_type = $faclikity_details['make_type']; - $num = $faclikity_details['num']; - $next_seq = $this->getNextFacilitySeq("mf_vol_no"); - $new_facility_no = $Y . $sale_type . $make_type - . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) - . str_pad($num, 2, "0", STR_PAD_LEFT); - - if ($this->checkSaleTypeStatus($sale_type) == false) - return "銷售代號錯誤"; - if ($this->checkMakeTypeStatus($make_type) == false) - return "製造編號類型錯誤"; - return "1"; - } - - /** - * seq 取號 - * @param string $type M:新梯 T:汰改 B:保養 - */ - function facilitySeqAddOne($type) - { - $type_arr = array( - "M" => "mf_vol_no", - "T" => "tf_vol_no", - "B" => "bf_vol_no", - ); - if (!empty($type_arr[$type])) { - $pdo = $this->connectionDB(); - $pdo->exec('SET CHARACTER SET utf8mb4'); - $sth = $pdo->prepare('UPDATE sequence SET current_val = current_val + 1 WHERE `seq_name` = ?'); - $sth->bindValue(1, $type_arr[$type]); - $sth->execute(); - } - } - - /** - * 修正 seq 取號 - * @param string $type M:新梯 T:汰改 B:保養 - */ - function facilityFixSeq($type) - { - $pdo = $this->connectionDB(); - $pdo->exec('SET CHARACTER SET utf8mb4'); - $type_arr = array( - "M" => "mf_vol_no", - "T" => "tf_vol_no", - "B" => "bf_vol_no", - ); - $after_fix_seq = $this->getMaxSeq($type); - $sql = " - UPDATE sequence - SET current_val = ? - WHERE seq_name = ? - "; - $sth = $pdo->prepare($sql); - $sth->bindValue(1, $after_fix_seq); - $sth->bindValue(2, $type_arr[$type]); - $sth->execute(); - } - - function getMaxSeq($type) - { - $pdo = $this->connectionDB(); - $pdo->exec('SET CHARACTER SET utf8mb4'); - $Y = substr(date("Y"), 3, 1); - $seq_num = $type == 'M' ? 5 : 3; - $sql = " - SELECT MAX(SUBSTR(f.facilityno,4,?))+1 AS seq - FROM facility AS f - WHERE 1=1 - AND SUBSTR(f.facilityno,1,1) = ? - AND f.define = ? - ORDER BY SUBSTR(f.facilityno,4,3) ASC - "; - $sth = $pdo->prepare($sql); - $sth->bindValue(1, $seq_num); - $sth->bindValue(2, $Y); - $sth->bindValue(3, $type); - $sth->execute(); - $result = $sth->fetch(); - return $result['seq']; - } - - /** - * 檢查年月後 新梯及汰改seq歸零 - */ - function checkYearAndResetAllSeq() - { - $pdo = $this->connectionDB(); - $pdo->exec('SET CHARACTER SET utf8mb4'); - $sth = $pdo->prepare('SELECT * FROM `sequence` WHERE `seq_name` = ?'); - $sth->bindValue(1, 'mf_vol_no'); - $sth->execute(); - $result = $sth->fetch(); - $yyyymm = $result['yyyymm']; - $dataY = substr($yyyymm, 0, 4); - $today_Y = date("Y"); - $today_Ym = date("Ym"); - if ($dataY != $today_Y) { - $sth = $pdo->prepare('UPDATE `sequence` SET `current_val` = ? , `yyyymm` = ? WHERE `seq_name` = ?'); - $sth->bindValue(1, '0'); - $sth->bindValue(2, $today_Ym); - $sth->bindValue(3, 'mf_vol_no'); - $sth->execute(); - } - } - - /** - * 檢查作番在 facility table 中是否重複 - * @param string|array $facility_no - * @return boolean $status : true:沒重複 false:重複 - */ - function checkFacilityRepeatStatus($facility_no) - { - if (gettype($facility_no) == "string") { - $pdo = $this->connectionDB(); - $pdo->exec('SET CHARACTER SET utf8mb4'); - $sth = $pdo->prepare('SELECT * FROM `facility` WHERE `facilityno` = ?'); - $sth->bindValue(1, $facility_no); - $sth->execute(); - if ($sth->rowCount() == 0) - return true; - return false; - } - if (gettype($facility_no) == "array") { - $pdo = $this->connectionDB(); - $pdo->exec('SET CHARACTER SET utf8mb4'); - $status = true; - foreach ($facility_no as $row) { - $sth = $pdo->prepare('SELECT * FROM `facility` WHERE `facilityno` = ?'); - $sth->bindValue(1, $row); - $sth->execute(); - if ($sth->rowCount() !== 0) - $status = false; - } - return $status; - } - } - - /** - * 檢查 $sale_type 是否有存在規則之中 - * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 - * @return boolean $status : true:合法代碼 false:非法代碼 - */ - function checkSaleTypeStatus($sale_type) - { - if (in_array($sale_type, ['M', 'E', 'T', 'J', 'X'])) - return true; - return false; - } - - /** - * 檢查 $sale_type 是否有存在規則之中 - * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 - * @return boolean $status : true:合法代碼 false:非法代碼 - */ - function checkMakeTypeStatus($make_type) - { - if (in_array($make_type, ['X', 'W', 'H', 'Z', 'F', 'B', 'Q', 'T', 'N', 'W', 'J', 'Y'])) - return true; - return false; - } - - /** - * 檢查 取得下個作番的 seq - * @param string $seq_name : 新梯:mf_vol_no 汰改:tf_vol_no 保養:bf_vol_no - * @return int $seq : 作番流水號 - */ - function getNextFacilitySeq($seq_name) - { - $pdo = $this->connectionDB(); - $pdo->exec('SET CHARACTER SET utf8mb4'); - $sth = $pdo->prepare('SELECT * FROM `sequence` WHERE `seq_name` = ?'); - $sth->bindValue(1, $seq_name); - $sth->execute(); - $result = $sth->fetch(); - return $result['current_val']; - } - - /** - * 建立新的新梯作番 - * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 - * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 - * @param int $seq_name : 幾個案場 0-99 - * @return array $new_facilityno : 作番號 - */ - function makeMFacilityNo($sale_type, $make_type, $num) - { - $new_facility_no = $this->getNextFacilityNo("M", $sale_type, $make_type, $num); - if ($this->checkFacilityRepeatStatus($new_facility_no) == false) { - // 如果作番號重複 使用此函數修正 - $this->facilityFixSeq("M"); - } - return $this->makeFacilityNo("M", $sale_type, $make_type, $num); - } - - /** - * 建立新的汰改作番 - * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 - * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 - * @param int $seq_name : 幾個案場 0-99 - * @return array $new_facilityno : 作番號 - */ - function makeTFacilityNo($sale_type, $make_type, $num) - { - $new_facility_no = $this->getNextFacilityNo("T", $sale_type, $make_type, $num); - if ($this->checkFacilityRepeatStatus($new_facility_no) == false) { - // 如果作番號重複 使用此函數修正 - $this->facilityFixSeq("T"); - } - return $this->makeFacilityNo("T", $sale_type, $make_type, $num); - } - - /** - * 建立新的保養作番 - * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 - * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 - * @param int $seq_name : 幾個案場 0-99 - * @return array $new_facilityno : 作番號 - */ - function makeBFacilityNo($sale_type, $make_type, $num) - { - $new_facility_no = $this->getNextFacilityNo("B", $sale_type, $make_type, $num); - if ($this->checkFacilityRepeatStatus($new_facility_no) == false) { - // 如果作番號重複 使用此函數修正 - $this->facilityFixSeq("B"); - } - return $this->makeFacilityNo("B", $sale_type, $make_type, $num); - } -} - - -$cfn = new CreateFacilityNo; - -// 建立作番號 - 新梯 -print_r($cfn->makeMFacilityNo("M", "X", 5)); -echo "

"; -// 建立作番號 - 汰改 -print_r($cfn->makeTFacilityNo( "M", "X", 1)); -echo "

"; -// 建立作番號 - 保養 -print_r($cfn->makeBFacilityNo( "M", "X", 1)); + false, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_EMULATE_PREPARES => false, + PDO::ATTR_STRINGIFY_FETCHES => false, + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4', + ]; + $pdo = new PDO('mysql:host=localhost;port=3306;dbname=appwms', 'masadaroot', 'x6h5E5p#u8y', $options); + $pdo->exec('SET CHARACTER SET utf8mb4'); + return $pdo; + } catch (PDOException $e) { + die("Something wrong: {$e->getMessage()}"); + } + } + + /** + * 結束資料庫連線 + */ + function endConnectionDB($pdo) + { + unset($pdo); + } + + /** + * 取得下一個新的作番 + * @param string $facility_type : M:新梯 T:汰改 B:保養 + * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 + * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 + * @param int $num : 號機 + * @return array $new_facility_arr + */ + function getNextFacilityNo($facility_type, $sale_type, $make_type, $num = 1) + { + $this->checkYearAndResetAllSeq(); + $Y = substr(date("Y"), 3, 1); + + switch ($facility_type) { + case "M": + $next_seq = $this->getNextFacilitySeq("mf_vol_no") + 1; + $new_facility_arr = []; + for ($start_num = 1; $start_num <= $num; $start_num++) { + $facility_no_tmp = $Y . $sale_type . $make_type + . str_pad($next_seq, 5, "0", STR_PAD_LEFT); + array_push($new_facility_arr, $facility_no_tmp); + $next_seq++; + } + return $new_facility_arr; + case "T": + $next_seq = $this->getNextFacilitySeq("tf_vol_no"); + $new_facility_arr = []; + for ($start_num = 1; $start_num <= $num; $start_num++) { + $facility_no_tmp = $Y . $sale_type . $make_type + . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) + . str_pad($start_num, 2, "0", STR_PAD_LEFT); + array_push($new_facility_arr, $facility_no_tmp); + } + return $new_facility_arr; + case "B": + $next_seq = $this->getNextFacilitySeq("bf_vol_no"); + $new_facility_arr = []; + for ($start_num = 1; $start_num <= $num; $start_num++) { + $facility_no_tmp = $Y . $sale_type . $make_type + . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) + . str_pad($start_num, 2, "0", STR_PAD_LEFT); + array_push($new_facility_arr, $facility_no_tmp); + } + return $new_facility_arr; + default: + return "不存在的作番類型"; + } + } + + /** + * 建立新的作番 + * @param string $facility_type : M:新梯 T:汰改 B:保養 + * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 + * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 + * @param string $num : 號機 (非必填) + * @return string $new_facility_no + */ + function makeFacilityNo($facility_type, $sale_type, $make_type, $num = null) + { + + $this->checkYearAndResetAllSeq(); + + $faclikity_details = array( + 'facility_type' => $facility_type, + 'sale_type' => $sale_type, + 'make_type' => $make_type, + 'num' => $num + ); + + switch ($facility_type) { + case "M": + return $this->makeNewMFacilityNo($faclikity_details); + break; + case "T": + return $this->makeNewTFacilityNo($faclikity_details); + break; + case "B": + return $this->makeNewBFacilityNo($faclikity_details); + break; + default: + return "不存在的作番類型"; + } + } + + /** + * 建立作番 -- 新梯 + */ + function makeNewMFacilityNo($faclikity_details) + { + $Y = substr(date("Y"), 3, 1); + $sale_type = $faclikity_details['sale_type']; + $make_type = $faclikity_details['make_type']; + $num = $faclikity_details['num']; + $next_seq = $this->getNextFacilitySeq("mf_vol_no") + 1; + $new_facility_no_arr = []; + + for ($i = 1; $i <= $num; $i++) { + $new_facility_no = $Y . $sale_type . $make_type + . str_pad($next_seq, 5, "0", STR_PAD_LEFT); + array_push($new_facility_no_arr, $new_facility_no); + $next_seq++; + } + + foreach ($new_facility_no_arr as $new_facility_no) { + if ($this->getMakeNewMFacilityNoStatus($faclikity_details) !== "1") { + return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details); + } + // seq +1 + $this->facilitySeqAddOne("M"); + } + return $new_facility_no_arr; + } + + /** + * 建立作番 -- 汰改 + */ + function makeNewTFacilityNo($faclikity_details) + { + + $Y = substr(date("Y"), 3, 1); + $sale_type = $faclikity_details['sale_type']; + $make_type = $faclikity_details['make_type']; + $num = $faclikity_details['num']; + $next_seq = $this->getNextFacilitySeq("tf_vol_no"); + $new_facility_no_arr = []; + + for ($i = 1; $i <= $num; $i++) { + $new_facility_no = $Y . $sale_type . $make_type + . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) + . str_pad($i, 2, "0", STR_PAD_LEFT); + array_push($new_facility_no_arr, $new_facility_no); + } + + foreach ($new_facility_no_arr as $new_facility_no) { + if ($this->getMakeNewTFacilityNoStatus($faclikity_details) !== "1") { + return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details); + } + // seq +1 + $this->facilitySeqAddOne("T"); + return $new_facility_no_arr; + } + } + + /** + * 建立作番 -- 保養 + */ + function makeNewBFacilityNo($faclikity_details) + { + + $Y = substr(date("Y"), 3, 1); + $sale_type = $faclikity_details['sale_type']; + $make_type = $faclikity_details['make_type']; + $num = $faclikity_details['num']; + $next_seq = $this->getNextFacilitySeq("bf_vol_no"); + $new_facility_no_arr = []; + + for ($i = 1; $i <= $num; $i++) { + $new_facility_no = $Y . $sale_type . $make_type + . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) + . str_pad($i, 2, "0", STR_PAD_LEFT); + array_push($new_facility_no_arr, $new_facility_no); + } + + foreach ($new_facility_no_arr as $new_facility_no) { + if ($this->getMakeNewTFacilityNoStatus($faclikity_details) !== "1") { + return $new_facility_no . ":" . $this->getMakeNewTFacilityNoStatus($faclikity_details); + } + // seq +1 + $this->facilitySeqAddOne("B"); + return $new_facility_no_arr; + } + } + + /** + * 檢查作番編列狀態 - 新梯 + * @param array $faclikity_details + * @return string $status : 1:正確 else:error message + */ + function getMakeNewMFacilityNoStatus($faclikity_details) + { + $Y = substr(date("Y"), 3, 1); + $sale_type = $faclikity_details['sale_type']; + $make_type = $faclikity_details['make_type']; + $next_seq = $this->getNextFacilitySeq("mf_vol_no"); + $new_facility_no = $Y . $sale_type . $make_type . str_pad($next_seq + 1, 5, "0", STR_PAD_LEFT); + + if ($this->checkSaleTypeStatus($sale_type) == false) + return "銷售代號錯誤"; + if ($this->checkMakeTypeStatus($make_type) == false) + return "製造編號類型錯誤"; + return "1"; + } + + /** + * 檢查作番編列狀態 - 汰改 + * @param array $faclikity_details + * @return string $status : 1:正確 else:error message + */ + function getMakeNewTFacilityNoStatus($faclikity_details) + { + $Y = substr(date("Y"), 3, 1); + $sale_type = $faclikity_details['sale_type']; + $make_type = $faclikity_details['make_type']; + $num = $faclikity_details['num']; + $next_seq = $this->getNextFacilitySeq("mf_vol_no"); + $new_facility_no = $Y . $sale_type . $make_type + . str_pad($next_seq + 1, 3, "0", STR_PAD_LEFT) + . str_pad($num, 2, "0", STR_PAD_LEFT); + + if ($this->checkSaleTypeStatus($sale_type) == false) + return "銷售代號錯誤"; + if ($this->checkMakeTypeStatus($make_type) == false) + return "製造編號類型錯誤"; + return "1"; + } + + /** + * seq 取號 + * @param string $type M:新梯 T:汰改 B:保養 + */ + function facilitySeqAddOne($type) + { + $type_arr = array( + "M" => "mf_vol_no", + "T" => "tf_vol_no", + "B" => "bf_vol_no", + ); + if (!empty($type_arr[$type])) { + $pdo = $this->connectionDB(); + $pdo->exec('SET CHARACTER SET utf8mb4'); + $sth = $pdo->prepare('UPDATE sequence SET current_val = current_val + 1 WHERE `seq_name` = ?'); + $sth->bindValue(1, $type_arr[$type]); + $sth->execute(); + } + } + + /** + * 修正 seq 取號 + * @param string $type M:新梯 T:汰改 B:保養 + */ + function facilityFixSeq($type) + { + $pdo = $this->connectionDB(); + $pdo->exec('SET CHARACTER SET utf8mb4'); + $type_arr = array( + "M" => "mf_vol_no", + "T" => "tf_vol_no", + "B" => "bf_vol_no", + ); + $after_fix_seq = $this->getMaxSeq($type); + $sql = " + UPDATE sequence + SET current_val = ? + WHERE seq_name = ? + "; + $sth = $pdo->prepare($sql); + $sth->bindValue(1, $after_fix_seq); + $sth->bindValue(2, $type_arr[$type]); + $sth->execute(); + } + + function getMaxSeq($type) + { + $pdo = $this->connectionDB(); + $pdo->exec('SET CHARACTER SET utf8mb4'); + $Y = substr(date("Y"), 3, 1); + $seq_num = $type == 'M' ? 5 : 3; + $sql = " + SELECT MAX(SUBSTR(f.facilityno,4,?))+1 AS seq + FROM facility AS f + WHERE 1=1 + AND SUBSTR(f.facilityno,1,1) = ? + AND f.define = ? + ORDER BY SUBSTR(f.facilityno,4,3) ASC + "; + $sth = $pdo->prepare($sql); + $sth->bindValue(1, $seq_num); + $sth->bindValue(2, $Y); + $sth->bindValue(3, $type); + $sth->execute(); + $result = $sth->fetch(); + return $result['seq']; + } + + /** + * 檢查年月後 新梯及汰改seq歸零 + */ + function checkYearAndResetAllSeq() + { + $pdo = $this->connectionDB(); + $pdo->exec('SET CHARACTER SET utf8mb4'); + $sth = $pdo->prepare('SELECT * FROM `sequence` WHERE `seq_name` = ?'); + $sth->bindValue(1, 'mf_vol_no'); + $sth->execute(); + $result = $sth->fetch(); + $yyyymm = $result['yyyymm']; + $dataY = substr($yyyymm, 0, 4); + $today_Y = date("Y"); + $today_Ym = date("Ym"); + if ($dataY != $today_Y) { + $sth = $pdo->prepare('UPDATE `sequence` SET `current_val` = ? , `yyyymm` = ? WHERE `seq_name` = ?'); + $sth->bindValue(1, '0'); + $sth->bindValue(2, $today_Ym); + $sth->bindValue(3, 'mf_vol_no'); + $sth->execute(); + } + } + + /** + * 檢查作番在 facility table 中是否重複 + * @param string|array $facility_no + * @return boolean $status : true:沒重複 false:重複 + */ + function checkFacilityRepeatStatus($facility_no) + { + if (gettype($facility_no) == "string") { + $pdo = $this->connectionDB(); + $pdo->exec('SET CHARACTER SET utf8mb4'); + $sth = $pdo->prepare('SELECT * FROM `facility` WHERE `facilityno` = ?'); + $sth->bindValue(1, $facility_no); + $sth->execute(); + if ($sth->rowCount() == 0) + return true; + return false; + } + if (gettype($facility_no) == "array") { + $pdo = $this->connectionDB(); + $pdo->exec('SET CHARACTER SET utf8mb4'); + $status = true; + foreach ($facility_no as $row) { + $sth = $pdo->prepare('SELECT * FROM `facility` WHERE `facilityno` = ?'); + $sth->bindValue(1, $row); + $sth->execute(); + if ($sth->rowCount() !== 0) + $status = false; + } + return $status; + } + } + + /** + * 檢查 $sale_type 是否有存在規則之中 + * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 + * @return boolean $status : true:合法代碼 false:非法代碼 + */ + function checkSaleTypeStatus($sale_type) + { + if (in_array($sale_type, ['M', 'E', 'T', 'J', 'X'])) + return true; + return false; + } + + /** + * 檢查 $sale_type 是否有存在規則之中 + * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 + * @return boolean $status : true:合法代碼 false:非法代碼 + */ + function checkMakeTypeStatus($make_type) + { + if (in_array($make_type, ['X', 'W', 'H', 'Z', 'F', 'B', 'Q', 'T', 'N', 'W', 'J', 'Y'])) + return true; + return false; + } + + /** + * 檢查 取得下個作番的 seq + * @param string $seq_name : 新梯:mf_vol_no 汰改:tf_vol_no 保養:bf_vol_no + * @return int $seq : 作番流水號 + */ + function getNextFacilitySeq($seq_name) + { + $pdo = $this->connectionDB(); + $pdo->exec('SET CHARACTER SET utf8mb4'); + $sth = $pdo->prepare('SELECT * FROM `sequence` WHERE `seq_name` = ?'); + $sth->bindValue(1, $seq_name); + $sth->execute(); + $result = $sth->fetch(); + return $result['current_val']; + } + + /** + * 建立新的新梯作番 + * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 + * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 + * @param int $seq_name : 幾個案場 0-99 + * @return array $new_facilityno : 作番號 + */ + function makeMFacilityNo($sale_type, $make_type, $num) + { + $new_facility_no = $this->getNextFacilityNo("M", $sale_type, $make_type, $num); + if ($this->checkFacilityRepeatStatus($new_facility_no) == false) { + // 如果作番號重複 使用此函數修正 + $this->facilityFixSeq("M"); + } + return $this->makeFacilityNo("M", $sale_type, $make_type, $num); + } + + /** + * 建立新的汰改作番 + * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 + * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 + * @param int $seq_name : 幾個案場 0-99 + * @return array $new_facilityno : 作番號 + */ + function makeTFacilityNo($sale_type, $make_type, $num) + { + $new_facility_no = $this->getNextFacilityNo("T", $sale_type, $make_type, $num); + if ($this->checkFacilityRepeatStatus($new_facility_no) == false) { + // 如果作番號重複 使用此函數修正 + $this->facilityFixSeq("T"); + } + return $this->makeFacilityNo("T", $sale_type, $make_type, $num); + } + + /** + * 建立新的保養作番 + * @param string $sale_type : M:内銷 E:外銷 T:他社维保 J:汰改 X:特殊部品 + * @param string $make_type : X:小機房 W:無機房 H:家用梯 Z:雜物梯 F:扶梯 B:部品 Q:品保對策 T:研究開發 N:設備 W:出貨現場要求購買 J:營業問題對策 Y:已出貨作番營業進行規格訂正 + * @param int $seq_name : 幾個案場 0-99 + * @return array $new_facilityno : 作番號 + */ + function makeBFacilityNo($sale_type, $make_type, $num) + { + $new_facility_no = $this->getNextFacilityNo("B", $sale_type, $make_type, $num); + if ($this->checkFacilityRepeatStatus($new_facility_no) == false) { + // 如果作番號重複 使用此函數修正 + $this->facilityFixSeq("B"); + } + return $this->makeFacilityNo("B", $sale_type, $make_type, $num); + } +} + + +$cfn = new CreateFacilityNo; + +// 建立作番號 - 新梯 +print_r($cfn->makeMFacilityNo("M", "X", 5)); +echo "

"; +// 建立作番號 - 汰改 +print_r($cfn->makeTFacilityNo( "M", "X", 1)); +echo "

"; +// 建立作番號 - 保養 +print_r($cfn->makeBFacilityNo( "M", "X", 1)); echo "

"; \ No newline at end of file diff --git a/wms/wipwhole-index-table-html.php b/wms/wipwhole-index-table-html.php index 59e59c3f..d83fdd65 100644 --- a/wms/wipwhole-index-table-html.php +++ b/wms/wipwhole-index-table-html.php @@ -1,224 +1,246 @@ - - - - - - - - - - - - - - - - - - - - $data) : - //工務 - $data['gongwuok'] = 0; - // 營業 - $data['yingyeok'] = 0; - // 設計 - $data['shejiok'] = 0; - // 生管 - $data['shengguanok'] = 0; - // 財務 - // $caiwuok = 0; - - // 工務統計已確認 - if ($data['building_heigh_verify'] == 0 || $data['building_heigh_verify'] == 2) - $data['gongwuok'] += 1; - if (!in_array($data['site_survey_contact_verify'], ['1', 'A'])) - $data['gongwuok'] += 1; - - // 營業統計已確認 - if ($data['sales_spec_verify'] == 0 || $data['sales_spec_verify'] == 2) - $data['yingyeok'] += 1; - if ($data['customer_planning_verify'] == 0 || $data['customer_planning_verify'] == 2) - $data['yingyeok'] += 1; - if ($data['customer_color_verify'] == 0 || $data['customer_color_verify'] == 2) - $data['yingyeok'] += 1; - if ($data['customer_style_verify'] == 0 || $data['customer_style_verify'] == 2) - $data['yingyeok'] += 1; - if ($data['site_survey_contact_form_verify'] == 0 || $data['site_survey_contact_form_verify'] == 2) - $data['yingyeok'] += 1; - - // 設計統計已確認 - if ($data['desin_spec_verify'] == 0 || $data['desin_spec_verify'] == 2) - $data['shejiok'] += 1; - if ($data['desin_planning_verify'] == 0 || $data['desin_planning_verify'] == 2) - $data['shejiok'] += 1; - if ($data['desin_color_verify'] == 0 || $data['desin_color_verify'] == 2) - $data['shejiok'] += 1; - if ($data['desin_style_verify'] == 0 || $data['desin_style_verify'] == 2) - $data['shejiok'] += 1; - if ($data['desin_leader_verify'] == 0 || $data['desin_leader_verify'] == 2) - $data['shejiok'] += 1; - - // 生管統計已確認 - if ($data['shengguanok_status'] == 0 || $data['shengguanok_status'] == 2) - $data['shengguanok'] += 1; - if ($data['prattford_order_date_verify'] == 0 || $data['prattford_order_date_verify'] == 2) - $data['shengguanok'] += 1; - if ($data['estimated_shipping_date_verify'] == 0 || $data['estimated_shipping_date_verify'] == 2) - $data['shengguanok'] += 1; - if ($data['estimated_shipping_schedule_date_verify'] == 0 || $data['estimated_shipping_schedule_date_verify'] == 2) - $data['shengguanok'] += 1; - if ($data['goods_type'] == 'A' || $data['goods_type'] == 'C') - $data['shengguanok'] += 1; - if ($data['taiwan_goods_type'] == 'A' || $data['taiwan_goods_type'] == 'C') - $data['shengguanok'] += 1; - if ($data['arrival_date_verify'] == 'A') - $data['shengguanok'] += 1; - - ?> - - - - - - $val) { - if ((string)$data['site_survey_contact_verify'] == (string)$key) { - if (in_array($data['site_survey_contact_verify'], ['1', 'A'])) { - echo ""; - } else { - echo ""; - } - } - } - ?> - - - - - = date("Y/m/d", strtotime($data['real_contract_arrival_date']))) { - if ($data['yingyeok'] != '5' && $data['shejiok'] != '5' && $data['gongwuok'] != '2' && $data['shengguanok'] != '1') { - echo ""; - } else { - echo ""; - } - } else { - echo ""; - } - } else { - echo ""; - } - ?> - - - - - - - - + "table_index2", + "A" => "table_index3", + "B" => "table_index4", + "G" => "table_index5", + "CH" => "table_index6", + "Z" => "table_index7" +); +?> +
合約號電梯編號客戶姓名地址工勘狀態下單日
(普來特富)
預計到廠日
(觀音廠)
實際到廠日
(觀音廠)
預計出貨日
(到工地)
營業/契約確認設計確認工務確認生管(業 務)確認
- " . $data['contractno'] . ""; - } - } else { - echo $data['contractno']; - } - ?> - $val$val - - - - - - " . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . " - -

- - - - -

- -
- -

- - - 郭承瑋 - -

- -
- -

- - - - -

- -
- -

- - - - -

- -
+ + + + + + + + + + + + + + + + + + + + $data) : + + //規格 + $Specification = $data['facility_kind']; + $Specification .= !empty($data['numberofpassenger']) ? "-" . $data['numberofpassenger'] : ""; + $Specification .= !empty($data['weight']) ? "-" . $data['weight'] : ""; + $Specification .= !empty($data['numberofstop']) ? "-" . $data['numberofstop'] : ""; + $Specification .= !empty($data['numberoffloor']) ? "/" . $data['numberoffloor'] : ""; + $Specification .= !empty($data['opentype']) ? "-" . $data['opentype'] : ""; + $Specification .= !empty($data['speed']) ? $data['speed'] : ""; + + //工務 + $data['gongwuok'] = 0; + // 營業 + $data['yingyeok'] = 0; + // 設計 + $data['shejiok'] = 0; + // 生管 + $data['shengguanok'] = 0; + // 財務 + // $caiwuok = 0; + + // 工務統計已確認 + if ($data['building_heigh_verify'] == 0 || $data['building_heigh_verify'] == 2) + $data['gongwuok'] += 1; + if (!in_array($data['site_survey_contact_verify'], ['1', 'A'])) + $data['gongwuok'] += 1; + + // 營業統計已確認 + if ($data['sales_spec_verify'] == 0 || $data['sales_spec_verify'] == 2) + $data['yingyeok'] += 1; + if ($data['customer_planning_verify'] == 0 || $data['customer_planning_verify'] == 2) + $data['yingyeok'] += 1; + if ($data['customer_color_verify'] == 0 || $data['customer_color_verify'] == 2) + $data['yingyeok'] += 1; + if ($data['customer_style_verify'] == 0 || $data['customer_style_verify'] == 2) + $data['yingyeok'] += 1; + if ($data['site_survey_contact_form_verify'] == 0 || $data['site_survey_contact_form_verify'] == 2) + $data['yingyeok'] += 1; + + // 設計統計已確認 + if ($data['desin_spec_verify'] == 0 || $data['desin_spec_verify'] == 2) + $data['shejiok'] += 1; + if ($data['desin_planning_verify'] == 0 || $data['desin_planning_verify'] == 2) + $data['shejiok'] += 1; + if ($data['desin_color_verify'] == 0 || $data['desin_color_verify'] == 2) + $data['shejiok'] += 1; + if ($data['desin_style_verify'] == 0 || $data['desin_style_verify'] == 2) + $data['shejiok'] += 1; + if ($data['desin_leader_verify'] == 0 || $data['desin_leader_verify'] == 2) + $data['shejiok'] += 1; + + // 生管統計已確認 + if ($data['shengguanok_status'] == 0 || $data['shengguanok_status'] == 2) + $data['shengguanok'] += 1; + if ($data['prattford_order_date_verify'] == 0 || $data['prattford_order_date_verify'] == 2) + $data['shengguanok'] += 1; + if ($data['estimated_shipping_date_verify'] == 0 || $data['estimated_shipping_date_verify'] == 2) + $data['shengguanok'] += 1; + if ($data['estimated_shipping_schedule_date_verify'] == 0 || $data['estimated_shipping_schedule_date_verify'] == 2) + $data['shengguanok'] += 1; + if ($data['goods_type'] == 'A' || $data['goods_type'] == 'C') + $data['shengguanok'] += 1; + if ($data['taiwan_goods_type'] == 'A' || $data['taiwan_goods_type'] == 'C') + $data['shengguanok'] += 1; + if ($data['arrival_date_verify'] == 'A') + $data['shengguanok'] += 1; + + ?> + + + + + + + $val) { + if ((string)$data['site_survey_contact_verify'] == (string)$key) { + if (in_array($data['site_survey_contact_verify'], ['1', 'A'])) { + echo ""; + } else { + echo ""; + } + } + } + ?> + + + + + = date("Y/m/d", strtotime($data['real_contract_arrival_date']))) { + if ($data['yingyeok'] != '5' && $data['shejiok'] != '5' && $data['gongwuok'] != '2' && $data['shengguanok'] != '1') { + echo ""; + } else { + echo ""; + } + } else { + echo ""; + } + } else { + echo ""; + } + ?> + + + + + + + +
合約號電梯編號客戶姓名規格地址工勘狀態下單日
(普來特富)
預計到廠日
(觀音廠)
實際到廠日
(觀音廠)
預計出貨日
(到工地)
營業/契約確認設計確認工務確認生管(業 務)確認
+ " . $data['contractno'] . ""; + } + } else { + echo $data['contractno']; + } + ?> + $val$val + + + + + + " . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . " + +

+ + + + +

+ +
+ +

+ + + 郭承瑋 + +

+ +
+ +

+ + + + +

+ +
+ +

+ + + + +

+ +
\ No newline at end of file diff --git a/wms/wipwhole-renovate-index-table-html.php b/wms/wipwhole-renovate-index-table-html.php index 1685c3bd..88177497 100644 --- a/wms/wipwhole-renovate-index-table-html.php +++ b/wms/wipwhole-renovate-index-table-html.php @@ -1,229 +1,252 @@ - - - - - - - - - - - - - - - - - - - - - $data) : - // 營業 - $data['yingyeok'] = 0; - // 設計 - $data['shejiok'] = 0; - // 工務 - $data['gongwuok'] = 0; - // 生管 - $data['shengguanok'] = 0; - // 財務 - // $data['caiwuok'] = 0; - - // 工務統計已確認 - if ($data['building_heigh_verify'] == 0 || $data['building_heigh_verify'] == 2) - $data['gongwuok'] += 1; - if (!in_array($data['site_survey_contact_verify'], ['1', 'A'])) - $data['gongwuok'] += 1; - if ($data['customer_planning_verify'] == 0 || $data['customer_planning_verify'] == 2) - $data['gongwuok'] += 1; - - // 營業統計已確認 - if ($data['sales_spec_verify'] == 0 || $data['sales_spec_verify'] == 2) - $data['yingyeok'] += 1; - if ($data['customer_color_verify'] == 0 || $data['customer_color_verify'] == 2) - $data['yingyeok'] += 1; - if ($data['customer_style_verify'] == 0 || $data['customer_style_verify'] == 2) - $data['yingyeok'] += 1; - if ($data['site_survey_contact_form_verify'] == 0 || $data['site_survey_contact_form_verify'] == 2) - $data['yingyeok'] += 1; - - // 設計統計已確認 - if ($data['desin_spec_verify'] == 0 || $data['desin_spec_verify'] == 2) - $data['shejiok'] += 1; - if ($data['desin_planning_verify'] == 0 || $data['desin_planning_verify'] == 2) - $data['shejiok'] += 1; - if ($data['desin_color_verify'] == 0 || $data['desin_color_verify'] == 2) - $data['shejiok'] += 1; - if ($data['desin_style_verify'] == 0 || $data['desin_style_verify'] == 2) - $data['shejiok'] += 1; - if ($data['desin_leader_verify'] == 0 || $data['desin_leader_verify'] == 2) - $data['shejiok'] += 1; - - // 生管統計已確認 - if ($data['shengguanok_status'] == 0 || $data['shengguanok_status'] == 2) - $data['shengguanok'] += 1; - if ($data['prattford_order_date_verify'] == 0 || $data['prattford_order_date_verify'] == 2) - $data['shengguanok'] += 1; - if ($data['estimated_shipping_date_verify'] == 0 || $data['estimated_shipping_date_verify'] == 2) - $data['shengguanok'] += 1; - if ($data['estimated_shipping_schedule_date_verify'] == 0 || $data['estimated_shipping_schedule_date_verify'] == 2) - $data['shengguanok'] += 1; - if ($data['goods_type'] == 'A' || $data['goods_type'] == 'C') - $data['shengguanok'] += 1; - if ($data['taiwan_goods_type'] == 'A' || $data['taiwan_goods_type'] == 'C') - $data['shengguanok'] += 1; - if ($data['arrival_date_verify'] == 'A') - $data['shengguanok'] += 1; - - ?> - - - - - - - $val) { - if ((string)$data['site_survey_contact_verify'] == (string)$key) { - if (in_array($data['site_survey_contact_verify'], ['1', 'A'])) { - echo ""; - } else { - echo ""; - } - } - } - ?> - - - - - = date("Y/m/d", strtotime($data['real_contract_arrival_date']))) { - if ($data['yingyeok'] != '4' && $data['shejiok'] != '5' && $data['gongwuok'] != '3' && $data['shengguanok'] != '1') { - echo ""; - } else { - echo ""; - } - } else { - echo ""; - } - } else { - echo ""; - } - ?> - - - - - - - + "table_index2", + "A" => "table_index3", + "B" => "table_index4", + "C" => "table_index5", + "D" => "table_index6", + "Z" => "table_index7" +); +?> +
合約號汰改種類電梯編號客戶姓名地址工勘狀態下單日
(普來特富)
預計到廠日
(觀音廠)
實際到廠日
(觀音廠)
預計出貨日
(到工地)
工務確認營業/契約確認設計確認生管(業務)
確認
- " . $data['contractno'] . ""; - } - } else { - echo $data['contractno']; - } - ?> - - - $val$val - - - - - - " . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . " - -

- - - - -

- -
- -

- - - - - -

- -
- -

- - - 林昭翰 - -

- -
- -

- - - - - -

- -
+ + + + + + + + + + + + + + + + + + + + + $data) : + + //規格 + $Specification = $data['facility_kind']; + $Specification .= !empty($data['numberofpassenger']) ? "-" . $data['numberofpassenger'] : ""; + $Specification .= !empty($data['weight']) ? "-" . $data['weight'] : ""; + $Specification .= !empty($data['numberofstop']) ? "-" . $data['numberofstop'] : ""; + $Specification .= !empty($data['numberoffloor']) ? "/" . $data['numberoffloor'] : ""; + $Specification .= !empty($data['opentype']) ? "-" . $data['opentype'] : ""; + $Specification .= !empty($data['speed']) ? $data['speed'] : ""; + + + // 營業 + $data['yingyeok'] = 0; + // 設計 + $data['shejiok'] = 0; + // 工務 + $data['gongwuok'] = 0; + // 生管 + $data['shengguanok'] = 0; + // 財務 + // $data['caiwuok'] = 0; + + // 工務統計已確認 + if ($data['building_heigh_verify'] == 0 || $data['building_heigh_verify'] == 2) + $data['gongwuok'] += 1; + if (!in_array($data['site_survey_contact_verify'], ['1', 'A'])) + $data['gongwuok'] += 1; + if ($data['customer_planning_verify'] == 0 || $data['customer_planning_verify'] == 2) + $data['gongwuok'] += 1; + + // 營業統計已確認 + if ($data['sales_spec_verify'] == 0 || $data['sales_spec_verify'] == 2) + $data['yingyeok'] += 1; + if ($data['customer_color_verify'] == 0 || $data['customer_color_verify'] == 2) + $data['yingyeok'] += 1; + if ($data['customer_style_verify'] == 0 || $data['customer_style_verify'] == 2) + $data['yingyeok'] += 1; + if ($data['site_survey_contact_form_verify'] == 0 || $data['site_survey_contact_form_verify'] == 2) + $data['yingyeok'] += 1; + + // 設計統計已確認 + if ($data['desin_spec_verify'] == 0 || $data['desin_spec_verify'] == 2) + $data['shejiok'] += 1; + if ($data['desin_planning_verify'] == 0 || $data['desin_planning_verify'] == 2) + $data['shejiok'] += 1; + if ($data['desin_color_verify'] == 0 || $data['desin_color_verify'] == 2) + $data['shejiok'] += 1; + if ($data['desin_style_verify'] == 0 || $data['desin_style_verify'] == 2) + $data['shejiok'] += 1; + if ($data['desin_leader_verify'] == 0 || $data['desin_leader_verify'] == 2) + $data['shejiok'] += 1; + + // 生管統計已確認 + if ($data['shengguanok_status'] == 0 || $data['shengguanok_status'] == 2) + $data['shengguanok'] += 1; + if ($data['prattford_order_date_verify'] == 0 || $data['prattford_order_date_verify'] == 2) + $data['shengguanok'] += 1; + if ($data['estimated_shipping_date_verify'] == 0 || $data['estimated_shipping_date_verify'] == 2) + $data['shengguanok'] += 1; + if ($data['estimated_shipping_schedule_date_verify'] == 0 || $data['estimated_shipping_schedule_date_verify'] == 2) + $data['shengguanok'] += 1; + if ($data['goods_type'] == 'A' || $data['goods_type'] == 'C') + $data['shengguanok'] += 1; + if ($data['taiwan_goods_type'] == 'A' || $data['taiwan_goods_type'] == 'C') + $data['shengguanok'] += 1; + if ($data['arrival_date_verify'] == 'A') + $data['shengguanok'] += 1; + + ?> + + + + + + + + $val) { + if ((string)$data['site_survey_contact_verify'] == (string)$key) { + if (in_array($data['site_survey_contact_verify'], ['1', 'A'])) { + echo ""; + } else { + echo ""; + } + } + } + ?> + + + + + = date("Y/m/d", strtotime($data['real_contract_arrival_date']))) { + if ($data['yingyeok'] != '4' && $data['shejiok'] != '5' && $data['gongwuok'] != '3' && $data['shengguanok'] != '1') { + echo ""; + } else { + echo ""; + } + } else { + echo ""; + } + } else { + echo ""; + } + ?> + + + + + + +
合約號汰改種類電梯編號客戶姓名規格地址工勘狀態下單日
(普來特富)
預計到廠日
(觀音廠)
實際到廠日
(觀音廠)
預計出貨日
(到工地)
工務確認營業/契約確認設計確認生管(業務)
確認
+ " . $data['contractno'] . ""; + } + } else { + echo $data['contractno']; + } + ?> + + + $val$val + + + + + + " . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . " + +

+ + + + +

+ +
+ +

+ + + + + +

+ +
+ +

+ + + 林昭翰 + +

+ +
+ +

+ + + + + +

+ +
\ No newline at end of file diff --git a/wms/wipwhole-renovate-index.php b/wms/wipwhole-renovate-index.php index 836f4ff8..af1e45bd 100644 --- a/wms/wipwhole-renovate-index.php +++ b/wms/wipwhole-renovate-index.php @@ -1,462 +1,518 @@ - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
-

作番大日程(汰改)

-
合約號電梯編號客戶姓名預計出貨日 - - ~ - -
- 區域 - - "全部", - "N" => "N:北區", - "Y" => "Y:宜蘭", - "T" => "T:桃區", - "C" => "C:中區", - "K" => "K:南區" - ); - ?> - - - 工勘狀態 - - "已確認", - "1" => "未確認", - "2" => "無工勘需求", - "A" => "未動工", - "B" => "地下室施工", - "C" => "打樁", - "D" => "地基", - "E" => "挖土", - "G" => "機房", - "H" => "機械式淨高", - "M" => "樓中樓", - "OH" => "最高層(頂樓高度)", - "P" => "PIT(機坑深度)", - "R" => "R 樓", - "S" => "停工", - "T" => "TOP", - "TC" => "頂部間隙", - "TS" => "行程", - "TH" => "全高", - "Y" => "已搭、已出", - "YB" => "退購結案", - "YF" => "既有建物", - "YN" => "已搭、未出" - ); - for ($i = 1; $i < 200; $i++) { - $site_survey_status[$i . "F"] = $i . "F"; - } - ?> - - - - - 新增 - - - - - - -
-
- - $data, - "A" => $dataA, - "B" => $dataB, - "C" => $dataC, - "D" => $dataD, - "Z" => $dataZ -); -foreach ($dataArr as $key => $val) { - if ($val) : - $dataDetailsArr = $val; - echo "
"; - include "wipwhole-renovate-index-table-html.php"; - echo "
"; - endif; -} - -#結束連線 -mysqli_close($link); -?> - - - - + \ No newline at end of file