You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

420 lines
12 KiB

<!doctype html>
<html lang="en">
<!-- 主頁header -->
<?php
/*--- 處理session ----*/
include "include-session-security.php"; #確認session
/*
if(isset($_SESSION['user_id'])){
#echo $_SESSION['user_id'];
$userid = $_SESSION['user_id'];
}
*/
/*--- 處理session ----*/
#$userid = "B000000001";
$facilityno = $_REQUEST["facilityno"];
require_once "db/database.php"; # 載入db.php來連結資料庫
$data = array(); # 設置一個空陣列來放資料is
if ($user_id == 'A000000001') {
$sql = "SELECT * FROM wipproduction where (facilityno = '$facilityno') order by id desc"; # sql語法存在變數中
} else {
if (in_array($facilityno, [
'3JX01701', '3JX01702', '3JX01703', '3JX01704', '3JX01705', '3JX01706', '3JX01707', '3JX01708', '3JX01709', '3JX01710', '3JX01711'
])) {
$sql = "
SELECT
'0' AS id,
facilityno,
'2024-06-30' AS issue_time,
'生產中' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
UNION
SELECT
'1' AS id,
facilityno,
SUBSTR(estimated_shipping_date,1,10) AS issue_time,
'生產完成' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND estimated_shipping_date != ''
AND estimated_shipping_date IS NOT NULL
UNION
SELECT
'2' AS id,
facilityno,
SUBSTR(estimated_shipping_schedule_date,1,10) AS issue_time,
'預計攬收' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND estimated_shipping_schedule_date != ''
AND estimated_shipping_schedule_date IS NOT NULL
UNION
SELECT
'3' AS id,
facilityno,
SUBSTR(actual_tofactory_date,1,10) AS issue_time,
'攬收成功(桃園)' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND actual_tofactory_date != ''
AND actual_tofactory_date IS NOT NULL
UNION
SELECT
'4' AS id,
facilityno,
'2023-05-10' AS issue_time,
'預計出貨日' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND real_contract_arrival_date != ''
AND real_contract_arrival_date IS NOT NULL
UNION
SELECT
'5' AS id,
facilityno,
SUBSTR(real_arrival_date,1,10) AS issue_time,
'出貨' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND real_arrival_date != ''
AND real_arrival_date IS NOT NULL
ORDER BY id DESC
";
} else {
$sql = "
SELECT
'0' AS id,
facilityno,
'' AS issue_time,
'生產中' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
UNION
SELECT
'1' AS id,
facilityno,
SUBSTR(estimated_shipping_date,1,10) AS issue_time,
'生產完成' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND estimated_shipping_date != ''
AND estimated_shipping_date IS NOT NULL
UNION
SELECT
'2' AS id,
facilityno,
SUBSTR(estimated_shipping_schedule_date,1,10) AS issue_time,
'預計攬收' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND estimated_shipping_schedule_date != ''
AND estimated_shipping_schedule_date IS NOT NULL
UNION
SELECT
'3' AS id,
facilityno,
SUBSTR(actual_tofactory_date,1,10) AS issue_time,
'攬收成功(桃園)' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND actual_tofactory_date != ''
AND actual_tofactory_date IS NOT NULL
UNION
SELECT
'4' AS id,
facilityno,
SUBSTR(real_contract_arrival_date,1,10) AS issue_time,
'預計出貨日' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND real_contract_arrival_date != ''
AND real_contract_arrival_date IS NOT NULL
UNION
SELECT
'5' AS id,
facilityno,
SUBSTR(real_arrival_date,1,10) AS issue_time,
'出貨' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND real_arrival_date != ''
AND real_arrival_date IS NOT NULL
/*
UNION
SELECT
'1' AS id,
facilityno,
SUBSTR(prattford_order_date,1,10) AS issue_time,
CASE prattford_order_date_verify
WHEN 0 THEN '生產完成'
WHEN 1 THEN '安排生產中'
WHEN 2 THEN '無須生產'
ELSE '未知'
END AS 'process',
CASE prattford_order_date_verify
WHEN 0 THEN 'bg-success'
WHEN 1 THEN 'bg-warning'
WHEN 2 THEN 'bg-success'
ELSE '未知'
END AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE (facilityno = '$facilityno')
UNION
SELECT
'2' AS id,
facilityno,
SUBSTR(goods_type_date,1,10) AS issue_time,
CASE goods_type
WHEN '1' THEN '生產中'
WHEN 'A' THEN '已發貨'
WHEN 'B' THEN '發貨中'
WHEN 'C' THEN '無須發貨'
ELSE '未知'
END AS 'process',
CASE goods_type
WHEN '1' THEN 'bg-warning'
WHEN 'A' THEN 'bg-success'
WHEN 'B' THEN 'bg-warning'
WHEN 'C' THEN 'bg-success'
ELSE '未知'
END AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE (facilityno = '$facilityno')
UNION
SELECT
'3' AS id,
facilityno,
SUBSTR(actual_tofactory_date,1,10) AS issue_time,
CASE arrival_date_verify
WHEN '1' THEN '覽收中'
WHEN 'A' THEN '攬收成功(桃園)'
WHEN 'B' THEN '攬收中(桃園)'
WHEN 'C' THEN '攬收中(桃園)'
WHEN 'D' THEN '攬收中(桃園)'
ELSE '未知'
END AS 'process',
CASE arrival_date_verify
WHEN '1' THEN 'bg-warning'
WHEN 'A' THEN 'bg-success'
WHEN 'B' THEN 'bg-warning'
WHEN 'C' THEN 'bg-warning'
WHEN 'D' THEN 'bg-warning'
ELSE '未知'
END AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE (facilityno = '$facilityno')
UNION
SELECT
'4' AS id,
facilityno,
SUBSTR(real_arrival_date,1,10) AS issue_time,
IF(real_arrival_date IS NOT NULL || real_arrival_date != '','已出貨','未出貨') AS 'process',
IF(real_arrival_date IS NOT NULL || real_arrival_date != '','bg-success','bg-warning') AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE (facilityno = '$facilityno')
*/
ORDER BY id DESC
";
}
}
$data = mysqli_query($link, $sql); # 用mysqli_query方法執行(sql語法)將結果存在變數中
include "include-header.php";
?>
<!-- * 主頁header -->
<body>
<!-- loader -->
<div id="loader">
<div class="spinner-border text-primary" role="status"></div>
</div>
<!-- * loader -->
<!-- App Header -->
<div class="appHeader bg-primary text-light">
<div class="left">
<a href="javascript:;" class="headerButton goBack">
<ion-icon name="chevron-back-outline"></ion-icon>
</a>
</div>
<div class="pageTitle">生產進度</div>
<!-- div class="right"></div> -->
</div>
<!-- * App Header -->
<!-- App Capsule -->
<div id="appCapsule">
<div class="section full mt-2">
<div class="section-title">電梯編號:<?php echo $facilityno; ?></div>
<!-- <div class="content-header mb-05">訂單編號 <code>DDDDDD</code></div> -->
<div class="wide-block">
<!-- timeline -->
<div class="timeline timed">
<?php $j = 0;
foreach ($data as $data) {
$j = $j + 1;
// if (!empty($data['issue_time'])) {
?>
<div class="item">
<span class="time"><?php echo $data['issue_time']; ?></span>
<?php
// if ($j == 1) {
// echo "<div class='dot bg-warning'></div>";
// } else {
// echo "<div class='dot'></div>";
// }
?>
<div class="dot <?php echo $data['light_color']; ?>"></div>
<div class="content">
<h4 class="title"><?php echo $data['process']; ?></h4>
<div class="text"><?php echo $data['memo']; ?></div>
</div>
</div>
<!--
<div class="item">
<span class="time">09-01 17:34</span>
<div class="dot"></div>
<div class="content">
<h4 class="title">已發貨</h4>
<div class="text">
攬收成功(桃園)
<img src="assets/img/sample/photo/sensor-1.jpg" alt="avatar" class="imaged w24 rounded">
</div>
</div>
</div>
-->
<?php
// }
}
?>
</div>
<!-- * timeline -->
</div>
</div>
</div>
<!-- * App Capsule -->
<!-- 主頁頁尾 -->
<?php
include "include-footer.php";
mysqli_close($link); #代表結束連線
?>
<!-- * 主頁頁尾 -->
<!-- 主頁頁尾按鈕 -->
<?php
#include "include-bottom-menu.php";
?>
<!-- * 主頁頁尾按鈕 -->
<!-- ///////////// Js Files //////////////////// -->
<!-- Jquery -->
<?php
include "include-jsfiles.php";
?>
</body>
</html>