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.
267 lines
9.3 KiB
267 lines
9.3 KiB
<?php
|
|
|
|
// 指派工勘人員
|
|
if ($warehouseid !== $old_warehouseid) {
|
|
if (checkNowFormGStatus($link) == 'G') {
|
|
$sql = "SELECT form_key
|
|
FROM flow
|
|
WHERE form_id = '$id'
|
|
AND flow_id = 'wws01'
|
|
AND flow_code = 'G'
|
|
";
|
|
$result = mysqli_query($link, $sql);
|
|
$form_key = $result->fetch_row()[0];
|
|
if (!empty($form_key)) {
|
|
$sql = "UPDATE wipwholestatus
|
|
SET warehouseid = '$warehouseid'
|
|
WHERE id = '$id';
|
|
";
|
|
mysqli_query($link, $sql);
|
|
$sql = "UPDATE subflow
|
|
SET current_assigner = '$warehouseid'
|
|
WHERE 1 = 1
|
|
AND seq = '1'
|
|
AND form_key = '$form_key';
|
|
";
|
|
mysqli_query($link, $sql);
|
|
}
|
|
}
|
|
}
|
|
|
|
// 官檢日變更
|
|
if (!empty($official_check_date)) {
|
|
if ($official_check_date !== $old_official_check_date) {
|
|
$sql = "
|
|
SELECT accountid
|
|
FROM account
|
|
WHERE department_id = '250'
|
|
AND role_id IN ('1','2','3','4');
|
|
";
|
|
$result = mysqli_query($link, $sql);
|
|
foreach ($result as $row) {
|
|
$permission = $row["accountid"];
|
|
$title = "客戶:$custom 作番:$facilityno 官檢日變更";
|
|
$content = "客戶:$custom
|
|
作番:$facilityno
|
|
官檢日 $old_official_check_date => $official_check_date";
|
|
$data = array(
|
|
'kind' => 1,
|
|
'related_id' => $id,
|
|
'title' => $title,
|
|
'content' => $content,
|
|
'permission' => $permission,
|
|
'creater' => $creater,
|
|
'create_at' => date("Y-m-d H:i:s")
|
|
);
|
|
$cn->sendx($data);
|
|
}
|
|
|
|
$permission = "M0168";
|
|
$title = "官檢日變更 客戶:$custom 作番:$facilityno";
|
|
$content = "客戶:$custom
|
|
作番:$facilityno
|
|
官檢日 $old_official_check_date => $official_check_date";
|
|
$data = array(
|
|
'kind' => 1,
|
|
'related_id' => $id,
|
|
'title' => $title,
|
|
'content' => $content,
|
|
'permission' => $permission,
|
|
'creater' => $creater,
|
|
'create_at' => date("Y-m-d H:i:s")
|
|
);
|
|
$cn->sendx($data);
|
|
}
|
|
}
|
|
|
|
// 工勘變更
|
|
if ($site_survey_contact_verify !== $old_site_survey_contact_verify) {
|
|
$site_survey_status = array(
|
|
"1" => "請選擇",
|
|
"0" => "已確認",
|
|
"2" => "無工勘需求",
|
|
"A" => "未動工",
|
|
"B" => "地下室施工",
|
|
"C" => "打樁",
|
|
"D" => "地基",
|
|
"E" => "挖土",
|
|
"G" => "機房",
|
|
"H" => "機械式淨高",
|
|
"M" => "樓中樓",
|
|
"OH" => "最高層(頂樓高度)",
|
|
"P" => "PIT(機坑深度)",
|
|
"R" => "R 樓",
|
|
"S" => "停工",
|
|
"T" => "TOP",
|
|
"TC" => "頂部間隙",
|
|
"TS" => "行程",
|
|
"TH" => "全高",
|
|
"Y" => "已搭、已出",
|
|
"YB" => "退購結案",
|
|
"YF" => "既有建物",
|
|
"YN" => "已搭、未出"
|
|
);
|
|
$sql = "
|
|
SELECT accountid
|
|
FROM account
|
|
WHERE department_id = '321'
|
|
AND role_id IN ('2','3','5');
|
|
";
|
|
$result = mysqli_query($link, $sql);
|
|
foreach ($result as $row) {
|
|
$permission = $row["accountid"];
|
|
$title = "客戶:$custom 作番:$facilityno 工勘狀態更改";
|
|
$content = "客戶:$custom
|
|
作番:$facilityno
|
|
工勘狀態 $site_survey_status[$old_site_survey_contact_verify] => $site_survey_status[$site_survey_contact_verify]";
|
|
|
|
$data = array(
|
|
'kind' => 1,
|
|
'related_id' => $id,
|
|
'title' => $title,
|
|
'content' => $content,
|
|
'permission' => $permission,
|
|
'creater' => $creater,
|
|
'create_at' => date("Y-m-d H:i:s")
|
|
);
|
|
$cn->sendx($data);
|
|
}
|
|
}
|
|
|
|
// 追加技術文件變更
|
|
if (!empty($desin_documents_verify_file)) {
|
|
$title = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件";
|
|
$content = "合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件
|
|
<a href='wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&{token_link}&id=$id' target='_blank'>前往下載</a>
|
|
";
|
|
$data = array(
|
|
'kind' => 1,
|
|
'related_id' => $id,
|
|
'title' => $title,
|
|
'content' => $content,
|
|
'permission' => "M0168",
|
|
'creater' => $creater,
|
|
'create_at' => date("Y-m-d H:i:s")
|
|
);
|
|
$cn->sendx($data);
|
|
}
|
|
|
|
|
|
// 移交日變更
|
|
if (!empty($delivery_date)) {
|
|
if ($delivery_date !== $old_delivery_date) {
|
|
$permission_arr = ['M0168', 'M0012'];
|
|
foreach ($permission_arr as $permission) {
|
|
$title = "移交日變更 客戶:$custom 作番:$facilityno";
|
|
$content = "客戶:$custom
|
|
作番:$facilityno
|
|
移交日 $old_delivery_date => $delivery_date";
|
|
$data = array(
|
|
'kind' => 1,
|
|
'related_id' => $id,
|
|
'title' => $title,
|
|
'content' => $content,
|
|
'permission' => $permission,
|
|
'creater' => $creater,
|
|
'create_at' => date("Y-m-d H:i:s")
|
|
);
|
|
$cn->sendx($data);
|
|
}
|
|
|
|
|
|
if (empty($change_all_contractno)) {
|
|
$mail_title = "作番大日程(新梯)合約號:" . $contractno . "-移交日變更通知";
|
|
$mail_content = "作番大日程(新梯)
|
|
合約號:" . $contractno . "移交日:" . $old_delivery_date . " => " . $delivery_date;
|
|
} else {
|
|
$mail_title = "作番大日程(新梯)合約號:" . $contractno . "作番號:" . $facilityno . "-移交日變更通知";
|
|
$mail_content = "作番大日程(新梯)
|
|
合約號:" . $contractno . "
|
|
作番號:" . $facilityno . "
|
|
移交日:" . $old_delivery_date . " => " . $delivery_date;
|
|
}
|
|
|
|
$cmail->sendx(
|
|
$mail_title,
|
|
$mail_content,
|
|
[
|
|
[$salesname, $salesmail]
|
|
// ['gary', 'gary_chen@masada.com.tw']
|
|
],
|
|
"永佳捷科技"
|
|
);
|
|
}
|
|
}
|
|
|
|
// 當試車完工日變更
|
|
if (!empty($tryrun_end_date)) {
|
|
if ($tryrun_end_date !== $old_tryrun_end_date) {
|
|
$mail_title = "作番大日程(新梯)合約號:" . $contractno . "作番號:" . $facilityno . "客戶名稱:" . $custom . "-試車已完成通知";
|
|
$mail_content = "作番大日程(新梯)
|
|
合約號:" . $contractno . "
|
|
作番號:" . $facilityno . "
|
|
客戶名稱:" . $custom . "
|
|
已完成試車, 請注意後續交車時間, 如需要官檢, 請提供如下資料
|
|
<img style='width: 500px' src='https://masada.com.tw/wms/img/mail001.jpg' />
|
|
";
|
|
$mail_send_users = [];
|
|
// 分區通知品保人員
|
|
if (in_array($area_no, ['N', 'Y', 'T'])) {
|
|
array_push($mail_send_users, ['袁宏嘉', 'mars_yuan@masada.com.tw']);
|
|
}
|
|
if (in_array($area_no, ['C'])) {
|
|
array_push($mail_send_users, ['許登毓', 'f9711225@masada.com.tw']);
|
|
}
|
|
if (in_array($area_no, ['K'])) {
|
|
array_push($mail_send_users, ['廖常超', 'sy0933405566@masada.com.tw']);
|
|
array_push($mail_send_users, ['劉尚鑫', 'tw58604067@masada.com.tw']);
|
|
}
|
|
array_push($mail_send_users, [$salesname, $salesmail]);
|
|
array_push(
|
|
$mail_send_users,
|
|
[
|
|
accountid2name(manage_class_gary_ver($salesid))[manage_class_gary_ver($salesid)],
|
|
accountid2email(manage_class_gary_ver($salesid))[manage_class_gary_ver($salesid)]
|
|
]
|
|
);
|
|
array_push($mail_send_users, ['張崇傑', 'jaychang@masada.com.tw']);
|
|
array_push($mail_send_users, ['賴定國', 'guo@masada.com.tw']);
|
|
array_push($mail_send_users, ['郭承瑋', 'chengwei@masada.com.tw']);
|
|
array_push($mail_send_users, ['林坤翰', 'kain@masada.com.tw']);
|
|
$cmail->sendx(
|
|
$mail_title,
|
|
$mail_content,
|
|
$mail_send_users,
|
|
"永佳捷科技"
|
|
);
|
|
}
|
|
}
|
|
|
|
// 移交日附件變更
|
|
if (!empty($delivery_date_file) || !empty($delivery_date_file2)) {
|
|
if ($delivery_date_file !== $old_delivery_date_file || $delivery_date_file2 !== $old_delivery_date_file) {
|
|
$delivery_date_file_tmp = $delivery_date_file !== $old_delivery_date_file ? $delivery_date_file : $delivery_date_file2;
|
|
$mail_title = "作番大日程(新梯)合約號:" . $contractno . "-交車完成通知";
|
|
$mail_content = "作番大日程(新梯)
|
|
合約號:" . $contractno . "
|
|
作番號:" . $facilityno . "
|
|
客戶名稱:" . $custom . "
|
|
已完成交車並已上傳交車單或竣工單, 請至OA系統中填寫移交日, 並準備後續請款事宜!
|
|
";
|
|
$cmail->sendx(
|
|
$mail_title,
|
|
$mail_content,
|
|
[
|
|
[$salesname, $salesmail],
|
|
[
|
|
accountid2name(manage_class_gary_ver($salesid))[manage_class_gary_ver($salesid)],
|
|
accountid2email(manage_class_gary_ver($salesid))[manage_class_gary_ver($salesid)]
|
|
],
|
|
['葉俊麟', 'darren@masada.com.tw'],
|
|
['蘇淑娥 ', 'supe1218@masada.com.tw']
|
|
// ['gary', 'gary_chen@masada.com.tw']
|
|
],
|
|
"永佳捷科技"
|
|
);
|
|
}
|
|
}
|
|
|