|
@@ -151,9 +151,9 @@ class tools {
|
|
|
if ($operate == "personal_profile_save") {
|
|
if ($operate == "personal_profile_save") {
|
|
|
$save_model = common::check_input($_POST['save_model']);
|
|
$save_model = common::check_input($_POST['save_model']);
|
|
|
if ($save_model == "profile"){
|
|
if ($save_model == "profile"){
|
|
|
- $user_name = common::check_input($_POST['user_name']);
|
|
|
|
|
- $email = common::check_input($_POST['email']);
|
|
|
|
|
- $sql = "update public.ra_online_user set user_login = '$user_name',email = '$email' where lower(user_login) = '".strtolower(_getLoginName())."'";
|
|
|
|
|
|
|
+ $first_name = common::check_input($_POST['first_name']);
|
|
|
|
|
+ $last_name = common::check_input($_POST['last_name']);
|
|
|
|
|
+ $sql = "update public.ra_online_user set first_name = '$first_name',last_name = '$last_name' where lower(user_login) = '".strtolower(_getLoginName())."'";
|
|
|
}else{
|
|
}else{
|
|
|
$date_fromat = common::check_input($_POST['date_fromat']);
|
|
$date_fromat = common::check_input($_POST['date_fromat']);
|
|
|
$numbers_format = common::check_input($_POST['numbers_format']);
|
|
$numbers_format = common::check_input($_POST['numbers_format']);
|
|
@@ -286,21 +286,58 @@ class tools {
|
|
|
$operate = utils::_get('operate');
|
|
$operate = utils::_get('operate');
|
|
|
$operate = strtolower($operate);
|
|
$operate = strtolower($operate);
|
|
|
|
|
|
|
|
|
|
+ if ($operate == "monitoring_rules_init"){
|
|
|
|
|
+ $ret = array();
|
|
|
|
|
+ //Milestone Update的页面配置数据
|
|
|
|
|
+ $milestones = common::excuteListSql("select * from customer_service_milestone_sno order by type, sno");
|
|
|
|
|
+ $oceanMilestone = array();
|
|
|
|
|
+ $airMilestone = array();
|
|
|
|
|
+ foreach($milestones as $milestone){
|
|
|
|
|
+ if($milestone['type'] == "air"){
|
|
|
|
|
+ $airMilestone[] = array("label"=>$milestone['description'],"value"=>$milestone['description'],
|
|
|
|
|
+ "code"=>$milestone['code'],"description"=>$milestone['description']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if($milestone['type'] == "sea"){
|
|
|
|
|
+ $oceanMilestone[] = array("label"=>$milestone['description'],"value"=>$milestone['description'],
|
|
|
|
|
+ "code"=>$milestone['code'],"description"=>$milestone['description']);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $ret["OceanCheckBoxList"] = $oceanMilestone;
|
|
|
|
|
+ $ret["AirCheckBoxList"] = $airMilestone;
|
|
|
|
|
+
|
|
|
|
|
+ //Milestone Update的结构处理
|
|
|
|
|
+ //这里基准event 写死, 根据online查询页面的通用的来, 这里需提问确定
|
|
|
|
|
+ $event =common::getEDICtnrEvent();
|
|
|
|
|
+ $ctnrStatus = array();
|
|
|
|
|
+ foreach($event as $e){
|
|
|
|
|
+ $ctnrStatus[] = array("label"=>$e['description'],"value"=>$e['description']);
|
|
|
|
|
+ }
|
|
|
|
|
+ $ret["CtnrCheckBoxList"] = $ctnrStatus;
|
|
|
|
|
+ common::echo_json_encode(200,$ret);
|
|
|
|
|
+ exit();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if ($operate == "monitoring_rules_search") {
|
|
if ($operate == "monitoring_rules_search") {
|
|
|
$cp = common::check_input($_POST ['cp']); //current_page
|
|
$cp = common::check_input($_POST ['cp']); //current_page
|
|
|
$ps = common::check_input($_POST ['ps']); //ps
|
|
$ps = common::check_input($_POST ['ps']); //ps
|
|
|
if (empty($ps))
|
|
if (empty($ps))
|
|
|
- $ps = 50;
|
|
|
|
|
|
|
+ $ps = 15;
|
|
|
|
|
|
|
|
$sql = "select count(1) from public.notifications_rules where lower(user_login) = '".strtolower(_getLoginName())."' and notifications_type = 'Monitoring'";
|
|
$sql = "select count(1) from public.notifications_rules where lower(user_login) = '".strtolower(_getLoginName())."' and notifications_type = 'Monitoring'";
|
|
|
$rc = common::excuteOneSql($sql);
|
|
$rc = common::excuteOneSql($sql);
|
|
|
|
|
|
|
|
$tp = ceil($rc / $ps);
|
|
$tp = ceil($rc / $ps);
|
|
|
if ($rc > 0) {
|
|
if ($rc > 0) {
|
|
|
- $sql = "select count(1) from public.notifications_rules
|
|
|
|
|
|
|
+ $sql = "select *,replace(rules_type, '_', ' ') AS _rules_type_display,
|
|
|
|
|
+ case when rules_type = 'Milestone_Update' then 'Milestone'
|
|
|
|
|
+ when rules_type = 'Container_Status_Update' then 'Container'
|
|
|
|
|
+ when rules_type = 'Departure/Arrival_Delay' then 'Departure'
|
|
|
|
|
+ when rules_type = 'ETD/ETA_Change' then 'ETDChange'
|
|
|
|
|
+ else '' end as notifications_option
|
|
|
|
|
+ from public.notifications_rules
|
|
|
where lower(user_login) = '".strtolower(_getLoginName())."'
|
|
where lower(user_login) = '".strtolower(_getLoginName())."'
|
|
|
and notifications_type = 'Monitoring' order by id desc limit " . $ps . " offset " . ($cp - 1) * $ps;
|
|
and notifications_type = 'Monitoring' order by id desc limit " . $ps . " offset " . ($cp - 1) * $ps;
|
|
|
- $monitoringRules = common::excuteObjectSql($sql);
|
|
|
|
|
|
|
+ $monitoringRules = common::excuteListSql($sql);
|
|
|
$arrTmp = array('monitoringRules' => $monitoringRules,
|
|
$arrTmp = array('monitoringRules' => $monitoringRules,
|
|
|
'rc' => intval($rc),
|
|
'rc' => intval($rc),
|
|
|
'ps' => $ps,
|
|
'ps' => $ps,
|
|
@@ -318,6 +355,41 @@ class tools {
|
|
|
common::echo_json_encode(200,$arrTmp);
|
|
common::echo_json_encode(200,$arrTmp);
|
|
|
exit();
|
|
exit();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if ($operate == "monitoring_rules_edit"){
|
|
|
|
|
+ $id = $_POST['id'];
|
|
|
|
|
+ $rules_type = common::check_input($_POST['rules_type']);
|
|
|
|
|
+ $subscribe_rule_sql = "select *,
|
|
|
|
|
+ TO_CHAR(daily_time, 'HH24:MI') as _daily_time,
|
|
|
|
|
+ TO_CHAR(weekly_time, 'HH24:MI') as _weekly_time,
|
|
|
|
|
+ case when rules_type = 'Milestone_Update' then 'Milestone'
|
|
|
|
|
+ when rules_type = 'Container_Status_Update' then 'Container'
|
|
|
|
|
+ when rules_type = 'Departure/Arrival_Delay' then 'Departure'
|
|
|
|
|
+ when rules_type = 'ETD/ETA_Change' then 'ETDChange'
|
|
|
|
|
+ else '' end as notifications_option
|
|
|
|
|
+ from public.notifications_rules where notifications_type = 'Monitoring' and lower(user_login) = '".strtolower(_getLoginName())."'
|
|
|
|
|
+ and id = '$id' order by id";
|
|
|
|
|
+ $subscribe_rules = common::excuteListSql($subscribe_rule_sql);
|
|
|
|
|
+
|
|
|
|
|
+ $rules = $this->getSubscribeRules($rules_type,$subscribe_rules);
|
|
|
|
|
+
|
|
|
|
|
+ //数据转换前端需要的
|
|
|
|
|
+ $converMode = array();
|
|
|
|
|
+ $shipment_transport_mode_arr = explode(";", $rules["shipment_transport_mode"]);
|
|
|
|
|
+ foreach($shipment_transport_mode_arr as $model){
|
|
|
|
|
+ if (strtolower($model) == "sea"){
|
|
|
|
|
+ $converMode[] = 'Ocean';
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $converMode[] = ucfirst($model);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $rules["shipment_transport_mode"] = utils::implode(";",$converMode);
|
|
|
|
|
+
|
|
|
|
|
+ $monitoring_data[$rules_type] = $rules;
|
|
|
|
|
+ common::echo_json_encode(200,$monitoring_data);
|
|
|
|
|
+ exit();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if ($operate == "monitoring_rules_do") {
|
|
if ($operate == "monitoring_rules_do") {
|
|
|
$rules_type = common::check_input($_POST["rules_type"]);
|
|
$rules_type = common::check_input($_POST["rules_type"]);
|
|
|
//检查编辑提交的Monitoring规则,是否允许保存
|
|
//检查编辑提交的Monitoring规则,是否允许保存
|
|
@@ -343,9 +415,8 @@ class tools {
|
|
|
}
|
|
}
|
|
|
if ($operate == "monitoring_rules_delete"){
|
|
if ($operate == "monitoring_rules_delete"){
|
|
|
$id = common::check_input($_POST['id']);
|
|
$id = common::check_input($_POST['id']);
|
|
|
- $rules_type = common::check_input($_POST['rules_type']);
|
|
|
|
|
$sql = "delete from notifications_rules where notifications_type = 'Monitoring'
|
|
$sql = "delete from notifications_rules where notifications_type = 'Monitoring'
|
|
|
- and rules_type = '$rules_type' and lower(user_login) = '".strtolower(_getLoginName())."' and id = '$id '";
|
|
|
|
|
|
|
+ and lower(user_login) = '".strtolower(_getLoginName())."' and id = '$id'";
|
|
|
common::excuteUpdateSql($sql);
|
|
common::excuteUpdateSql($sql);
|
|
|
$data = array("msg" => "Delete Successful");
|
|
$data = array("msg" => "Delete Successful");
|
|
|
common::echo_json_encode(200,$data);
|
|
common::echo_json_encode(200,$data);
|
|
@@ -390,13 +461,13 @@ class tools {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if(!empty($v['daily'])){
|
|
if(!empty($v['daily'])){
|
|
|
- //取第一个显示
|
|
|
|
|
- $v['daily'][0]['numericRecords'] = count($v['daily']);
|
|
|
|
|
- $instant_sum[]= $v['daily'][0];
|
|
|
|
|
|
|
+ //取第一组的第一个显示
|
|
|
|
|
+ $dailyFristAndFrist = utils::getDailyAndweeklyFrist($v['daily']);
|
|
|
|
|
+ $instant_sum[]= $dailyFristAndFrist;
|
|
|
}
|
|
}
|
|
|
- if(!empty($milestoneData['weekly'])){
|
|
|
|
|
- $v['weekly'][0]['numericRecords'] = count($v['weekly']);
|
|
|
|
|
- $instant_sum[]= $v['weekly'][0];
|
|
|
|
|
|
|
+ if(!empty($v['weekly'])){
|
|
|
|
|
+ $weeklyFristAndFrist = utils::getDailyAndweeklyFrist($v['weekly']);
|
|
|
|
|
+ $instant_sum[]= $weeklyFristAndFrist;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//根据时间顺序排序
|
|
//根据时间顺序排序
|
|
@@ -405,14 +476,57 @@ class tools {
|
|
|
|
|
|
|
|
$info = array();
|
|
$info = array();
|
|
|
foreach($instant_sum as $mInfo){
|
|
foreach($instant_sum as $mInfo){
|
|
|
- $eventCard = $this->getEventCard($mInfo,"Milestone_Update");
|
|
|
|
|
- $Info[] = $eventCard;
|
|
|
|
|
|
|
+ $eventCard = $this->getEventCard($mInfo);
|
|
|
|
|
+ $info[] = array("notificationType"=>"event","info" =>$eventCard);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $returnData = array("notificationType"=>"event","info" =>$info);
|
|
|
|
|
|
|
+ $returnData = $info;
|
|
|
|
|
+ common::echo_json_encode(200,$returnData);
|
|
|
|
|
+ exit();
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if($operate == "notifications_see_all"){
|
|
|
|
|
+ $rules_type = common::check_input($_REQUEST['rules_type']);
|
|
|
|
|
+ $frequency_type = common::check_input($_REQUEST['frequency_type']); //这个只会传daily 和weekly
|
|
|
|
|
+
|
|
|
|
|
+ $data = $this->getNotifications($rules_type,$frequency_type);
|
|
|
|
|
+ $moreData = $data[strtolower($frequency_type)];
|
|
|
|
|
+
|
|
|
|
|
+ //这个函数里面带有分开计数的信息
|
|
|
|
|
+ $dataInfo =utils::getDailyAndweeklyFrist($moreData);
|
|
|
|
|
+
|
|
|
|
|
+ $returnData = array();
|
|
|
|
|
+ $notificationList = array();
|
|
|
|
|
+ foreach($moreData as $key => $data){
|
|
|
|
|
+ $eventCard = $this->getEventCard($data);
|
|
|
|
|
+ //sea all的数据格式和查询全部的格式有区别
|
|
|
|
|
+ if($key == 0){
|
|
|
|
|
+ $returnData["title"] = $eventCard["title"];
|
|
|
|
|
+ if($eventCard["type"] == "change" || $eventCard["type"] == "delay"){
|
|
|
|
|
+ $returnData["numericRecords_one"] = $dataInfo["numericRecords_one"];
|
|
|
|
|
+ $returnData["numericRecords_two"] =$dataInfo["numericRecords_two"];
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $returnData["numericRecords"] = $dataInfo["numericRecords"];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //移除不需要的字段
|
|
|
|
|
+ unset($eventCard["title"]);
|
|
|
|
|
+ $notificationList[] = $eventCard;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!empty($notificationList)){
|
|
|
|
|
+ $returnData["notificationList"] = $notificationList;
|
|
|
|
|
+ }
|
|
|
|
|
+ //点击seall会默认全部标记为已读
|
|
|
|
|
+
|
|
|
common::echo_json_encode(200,$returnData);
|
|
common::echo_json_encode(200,$returnData);
|
|
|
exit();
|
|
exit();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ if($operate == "notifications_read"){
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ exit();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -442,7 +556,7 @@ class tools {
|
|
|
$airMilestone[] = array("label"=>$milestone['description'],"value"=>$milestone['description'],
|
|
$airMilestone[] = array("label"=>$milestone['description'],"value"=>$milestone['description'],
|
|
|
"code"=>$milestone['code'],"description"=>$milestone['description']);
|
|
"code"=>$milestone['code'],"description"=>$milestone['description']);
|
|
|
}
|
|
}
|
|
|
- if($milestone['type'] == "ocean"){
|
|
|
|
|
|
|
+ if($milestone['type'] == "sea"){
|
|
|
$oceanMilestone[] = array("label"=>$milestone['description'],"value"=>$milestone['description'],
|
|
$oceanMilestone[] = array("label"=>$milestone['description'],"value"=>$milestone['description'],
|
|
|
"code"=>$milestone['code'],"description"=>$milestone['description']);
|
|
"code"=>$milestone['code'],"description"=>$milestone['description']);
|
|
|
}
|
|
}
|
|
@@ -462,7 +576,7 @@ class tools {
|
|
|
//Milestone Update的结构处理
|
|
//Milestone Update的结构处理
|
|
|
if($rule_name == "Container_Status_Update"){
|
|
if($rule_name == "Container_Status_Update"){
|
|
|
//这里基准event 写死, 根据online查询页面的通用的来, 这里需提问确定
|
|
//这里基准event 写死, 根据online查询页面的通用的来, 这里需提问确定
|
|
|
- $event =$this->getEDICtnrEvent();
|
|
|
|
|
|
|
+ $event =common::getEDICtnrEvent();
|
|
|
$ctnrStatus = array();
|
|
$ctnrStatus = array();
|
|
|
foreach($event as $e){
|
|
foreach($event as $e){
|
|
|
$ctnrStatus[] = array("label"=>$e['description'],"value"=>$e['description']);
|
|
$ctnrStatus[] = array("label"=>$e['description'],"value"=>$e['description']);
|
|
@@ -594,13 +708,22 @@ class tools {
|
|
|
$event_details = common::check_input($_POST['event_details']);
|
|
$event_details = common::check_input($_POST['event_details']);
|
|
|
$frequency_display = common::check_input($_POST['frequency_display']);
|
|
$frequency_display = common::check_input($_POST['frequency_display']);
|
|
|
$method_display = common::check_input($_POST['method_display']);
|
|
$method_display = common::check_input($_POST['method_display']);
|
|
|
|
|
+ $shipment_detail = common::check_input($_POST['shipment_details']);
|
|
|
|
|
|
|
|
//当规则是 Monitoring类型是,需要配置的range
|
|
//当规则是 Monitoring类型是,需要配置的range
|
|
|
$shipment_transport_mode = "";
|
|
$shipment_transport_mode = "";
|
|
|
$shipment_etd_limit = "";
|
|
$shipment_etd_limit = "";
|
|
|
$shipment_eta_limit = "";
|
|
$shipment_eta_limit = "";
|
|
|
if($notifications_type == "Monitoring"){
|
|
if($notifications_type == "Monitoring"){
|
|
|
- $shipment_transport_mode = utils::implode(";",$_POST['shipment_transport_mode']);
|
|
|
|
|
|
|
+ $converMode = array();
|
|
|
|
|
+ foreach($_POST['shipment_transport_mode'] as $model){
|
|
|
|
|
+ if (strtolower($model) == "ocean"){
|
|
|
|
|
+ $converMode[] = 'sea';
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $converMode[] = strtolower($model);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $shipment_transport_mode = utils::implode(";",$converMode);
|
|
|
$shipment_etd_limit = common::check_input($_POST['shipment_etd_limit']);
|
|
$shipment_etd_limit = common::check_input($_POST['shipment_etd_limit']);
|
|
|
$shipment_eta_limit = common::check_input($_POST['shipment_eta_limit']);
|
|
$shipment_eta_limit = common::check_input($_POST['shipment_eta_limit']);
|
|
|
}
|
|
}
|
|
@@ -627,17 +750,17 @@ class tools {
|
|
|
user_login, notifications_type, rules_type, ocean_milestone,
|
|
user_login, notifications_type, rules_type, ocean_milestone,
|
|
|
air_milestone, frequency_type, daily_time, daily_time_zone,
|
|
air_milestone, frequency_type, daily_time, daily_time_zone,
|
|
|
weekly_week, weekly_time, weekly_time_zone, method_by_email, method_by_message,
|
|
weekly_week, weekly_time, weekly_time_zone, method_by_email, method_by_message,
|
|
|
- event_details, frequency_display, method_display,
|
|
|
|
|
|
|
+ event_details, frequency_display, method_display,shipment_details,
|
|
|
shipment_transport_mode,shipment_etd_limit,shipment_eta_limit)
|
|
shipment_transport_mode,shipment_etd_limit,shipment_eta_limit)
|
|
|
VALUES ('".strtolower(_getLoginName())."', '$notifications_type', '$rules_type', '$ocean_milestone',
|
|
VALUES ('".strtolower(_getLoginName())."', '$notifications_type', '$rules_type', '$ocean_milestone',
|
|
|
'$air_milestone', '$frequency_type', $daily_time, '$daily_time_zone',
|
|
'$air_milestone', '$frequency_type', $daily_time, '$daily_time_zone',
|
|
|
'$weekly_week', $weekly_time, '$weekly_time_zone', '$method_by_email', '$method_by_message',
|
|
'$weekly_week', $weekly_time, '$weekly_time_zone', '$method_by_email', '$method_by_message',
|
|
|
- '$event_details', '$frequency_display', '$method_display',
|
|
|
|
|
|
|
+ '$event_details', '$frequency_display', '$method_display','$shipment_detail',
|
|
|
'$shipment_transport_mode','$shipment_etd_limit','$shipment_eta_limit');";
|
|
'$shipment_transport_mode','$shipment_etd_limit','$shipment_eta_limit');";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if ($rules_type == "Container_Status_Update"){
|
|
if ($rules_type == "Container_Status_Update"){
|
|
|
- $event = $this->getEDICtnrEvent();
|
|
|
|
|
|
|
+ $event = common::getEDICtnrEvent();
|
|
|
$ocean_ctnr_status = $this->convertCodeForMilestoneAndCtnr("Container_Status_Update",$_POST['ocean_ctnr_status'],$event);
|
|
$ocean_ctnr_status = $this->convertCodeForMilestoneAndCtnr("Container_Status_Update",$_POST['ocean_ctnr_status'],$event);
|
|
|
$ocean_ctnr_status = utils::implode(";",$ocean_ctnr_status);
|
|
$ocean_ctnr_status = utils::implode(";",$ocean_ctnr_status);
|
|
|
|
|
|
|
@@ -645,34 +768,34 @@ class tools {
|
|
|
user_login, notifications_type, rules_type, ocean_ctnr_status,
|
|
user_login, notifications_type, rules_type, ocean_ctnr_status,
|
|
|
frequency_type, daily_time, daily_time_zone,
|
|
frequency_type, daily_time, daily_time_zone,
|
|
|
weekly_week, weekly_time, weekly_time_zone, method_by_email, method_by_message,
|
|
weekly_week, weekly_time, weekly_time_zone, method_by_email, method_by_message,
|
|
|
- event_details, frequency_display, method_display,
|
|
|
|
|
|
|
+ event_details, frequency_display, method_display,shipment_details,
|
|
|
shipment_transport_mode,shipment_etd_limit,shipment_eta_limit)
|
|
shipment_transport_mode,shipment_etd_limit,shipment_eta_limit)
|
|
|
VALUES ('".strtolower(_getLoginName())."', '$notifications_type', '$rules_type', '$ocean_ctnr_status',
|
|
VALUES ('".strtolower(_getLoginName())."', '$notifications_type', '$rules_type', '$ocean_ctnr_status',
|
|
|
'$frequency_type', $daily_time, '$daily_time_zone',
|
|
'$frequency_type', $daily_time, '$daily_time_zone',
|
|
|
'$weekly_week', $weekly_time, '$weekly_time_zone', '$method_by_email', '$method_by_message',
|
|
'$weekly_week', $weekly_time, '$weekly_time_zone', '$method_by_email', '$method_by_message',
|
|
|
- '$event_details', '$frequency_display', '$method_display',
|
|
|
|
|
|
|
+ '$event_details', '$frequency_display', '$method_display','$shipment_detail',
|
|
|
'$shipment_transport_mode','$shipment_etd_limit','$shipment_eta_limit');";
|
|
'$shipment_transport_mode','$shipment_etd_limit','$shipment_eta_limit');";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if ($rules_type == "Departure/Arrival_Delay"){
|
|
if ($rules_type == "Departure/Arrival_Delay"){
|
|
|
- $ocean_atd_sub_etd = $_POST['ocean_atd_sub_etd'];
|
|
|
|
|
- $ocean_atd_sub_etd_unit = $_POST['ocean_atd_sub_etd_unit'];
|
|
|
|
|
|
|
+ $ocean_atd_sub_etd = common::check_input($_POST['ocean_atd_sub_etd']);
|
|
|
|
|
+ $ocean_atd_sub_etd_unit = common::check_input($_POST['ocean_atd_sub_etd_unit']);
|
|
|
if(!empty($ocean_atd_sub_etd_unit)){
|
|
if(!empty($ocean_atd_sub_etd_unit)){
|
|
|
$ocean_atd_sub_etd_unit = $ocean_atd_sub_etd_unit=="Day(s)" ? "days":"hours";
|
|
$ocean_atd_sub_etd_unit = $ocean_atd_sub_etd_unit=="Day(s)" ? "days":"hours";
|
|
|
}
|
|
}
|
|
|
- $ocean_ata_sub_eta = $_POST['ocean_ata_sub_eta'];
|
|
|
|
|
- $ocean_ata_sub_eta_unit = $_POST['ocean_ata_sub_eta_unit'];
|
|
|
|
|
|
|
+ $ocean_ata_sub_eta = common::check_input($_POST['ocean_ata_sub_eta']);
|
|
|
|
|
+ $ocean_ata_sub_eta_unit = common::check_input($_POST['ocean_ata_sub_eta_unit']);
|
|
|
if(!empty($ocean_ata_sub_eta_unit)){
|
|
if(!empty($ocean_ata_sub_eta_unit)){
|
|
|
$ocean_ata_sub_eta_unit = $ocean_ata_sub_eta_unit=="Day(s)" ? "days":"hours";
|
|
$ocean_ata_sub_eta_unit = $ocean_ata_sub_eta_unit=="Day(s)" ? "days":"hours";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $air_atd_sub_etd = $_POST['air_atd_sub_etd'];
|
|
|
|
|
- $air_atd_sub_etd_unit = $_POST['air_atd_sub_etd_unit'];
|
|
|
|
|
|
|
+ $air_atd_sub_etd = common::check_input($_POST['air_atd_sub_etd']);
|
|
|
|
|
+ $air_atd_sub_etd_unit = common::check_input($_POST['air_atd_sub_etd_unit']);
|
|
|
if(!empty($air_atd_sub_etd_unit)){
|
|
if(!empty($air_atd_sub_etd_unit)){
|
|
|
$air_atd_sub_etd_unit = $air_atd_sub_etd_unit=="Day(s)" ? "days":"hours";
|
|
$air_atd_sub_etd_unit = $air_atd_sub_etd_unit=="Day(s)" ? "days":"hours";
|
|
|
}
|
|
}
|
|
|
- $air_ata_sub_eta = $_POST['air_ata_sub_eta'];
|
|
|
|
|
- $air_ata_sub_eta_unit = $_POST['air_ata_sub_eta_unit'];
|
|
|
|
|
|
|
+ $air_ata_sub_eta = common::check_input($_POST['air_ata_sub_eta']);
|
|
|
|
|
+ $air_ata_sub_eta_unit = common::check_input($_POST['air_ata_sub_eta_unit']);
|
|
|
if(!empty($air_ata_sub_eta_unit)){
|
|
if(!empty($air_ata_sub_eta_unit)){
|
|
|
$air_ata_sub_eta_unit = $air_ata_sub_eta_unit=="Day(s)" ? "days":"hours";
|
|
$air_ata_sub_eta_unit = $air_ata_sub_eta_unit=="Day(s)" ? "days":"hours";
|
|
|
}
|
|
}
|
|
@@ -683,40 +806,40 @@ class tools {
|
|
|
air_atd_sub_etd, air_atd_sub_etd_unit,air_ata_sub_eta,air_ata_sub_eta_unit,
|
|
air_atd_sub_etd, air_atd_sub_etd_unit,air_ata_sub_eta,air_ata_sub_eta_unit,
|
|
|
frequency_type, daily_time, daily_time_zone,
|
|
frequency_type, daily_time, daily_time_zone,
|
|
|
weekly_week, weekly_time, weekly_time_zone, method_by_email, method_by_message,
|
|
weekly_week, weekly_time, weekly_time_zone, method_by_email, method_by_message,
|
|
|
- event_details, frequency_display, method_display,
|
|
|
|
|
|
|
+ event_details, frequency_display, method_display,shipment_details,
|
|
|
shipment_transport_mode,shipment_etd_limit,shipment_eta_limit)
|
|
shipment_transport_mode,shipment_etd_limit,shipment_eta_limit)
|
|
|
VALUES ('".strtolower(_getLoginName())."', '$notifications_type', '$rules_type',
|
|
VALUES ('".strtolower(_getLoginName())."', '$notifications_type', '$rules_type',
|
|
|
'$ocean_atd_sub_etd','$ocean_atd_sub_etd_unit','$ocean_ata_sub_eta','$ocean_ata_sub_eta_unit',
|
|
'$ocean_atd_sub_etd','$ocean_atd_sub_etd_unit','$ocean_ata_sub_eta','$ocean_ata_sub_eta_unit',
|
|
|
'$air_atd_sub_etd','$air_atd_sub_etd_unit','$air_ata_sub_eta','$air_ata_sub_eta_unit',
|
|
'$air_atd_sub_etd','$air_atd_sub_etd_unit','$air_ata_sub_eta','$air_ata_sub_eta_unit',
|
|
|
'$frequency_type', $daily_time, '$daily_time_zone',
|
|
'$frequency_type', $daily_time, '$daily_time_zone',
|
|
|
'$weekly_week', $weekly_time, '$weekly_time_zone', '$method_by_email', '$method_by_message',
|
|
'$weekly_week', $weekly_time, '$weekly_time_zone', '$method_by_email', '$method_by_message',
|
|
|
- '$event_details', '$frequency_display', '$method_display',
|
|
|
|
|
|
|
+ '$event_details', '$frequency_display', '$method_display','$shipment_detail',
|
|
|
'$shipment_transport_mode','$shipment_etd_limit','$shipment_eta_limit');";
|
|
'$shipment_transport_mode','$shipment_etd_limit','$shipment_eta_limit');";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if ($rules_type == "ETD/ETA_Change"){
|
|
if ($rules_type == "ETD/ETA_Change"){
|
|
|
- $ocean_etd_change = $_POST['ocean_etd_change'];
|
|
|
|
|
- $ocean_etd_old_sub_new = $_POST['ocean_etd_old_sub_new'];
|
|
|
|
|
- $ocean_etd_old_sub_new_unit = $_POST['ocean_etd_old_sub_new_unit'];
|
|
|
|
|
|
|
+ $ocean_etd_change = common::check_input($_POST['ocean_etd_change']);
|
|
|
|
|
+ $ocean_etd_old_sub_new = common::check_input($_POST['ocean_etd_old_sub_new']);
|
|
|
|
|
+ $ocean_etd_old_sub_new_unit = common::check_input($_POST['ocean_etd_old_sub_new_unit']);
|
|
|
if(!empty($ocean_etd_old_sub_new_unit)){
|
|
if(!empty($ocean_etd_old_sub_new_unit)){
|
|
|
$ocean_etd_old_sub_new_unit = $ocean_etd_old_sub_new_unit=="Day(s)" ? "days":"hours";
|
|
$ocean_etd_old_sub_new_unit = $ocean_etd_old_sub_new_unit=="Day(s)" ? "days":"hours";
|
|
|
}
|
|
}
|
|
|
- $ocean_eta_change = $_POST['ocean_eta_change'];
|
|
|
|
|
- $ocean_eta_old_sub_new = $_POST['ocean_eta_old_sub_new'];
|
|
|
|
|
- $ocean_eta_old_sub_new_unit = $_POST['ocean_eta_old_sub_new_unit'];
|
|
|
|
|
|
|
+ $ocean_eta_change = common::check_input($_POST['ocean_eta_change']);
|
|
|
|
|
+ $ocean_eta_old_sub_new = common::check_input($_POST['ocean_eta_old_sub_new']);
|
|
|
|
|
+ $ocean_eta_old_sub_new_unit = common::check_input($_POST['ocean_eta_old_sub_new_unit']);
|
|
|
if(!empty($ocean_eta_old_sub_new_unit)){
|
|
if(!empty($ocean_eta_old_sub_new_unit)){
|
|
|
$ocean_eta_old_sub_new_unit = $ocean_eta_old_sub_new_unit=="Day(s)" ? "days":"hours";
|
|
$ocean_eta_old_sub_new_unit = $ocean_eta_old_sub_new_unit=="Day(s)" ? "days":"hours";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $air_etd_change = $_POST['air_etd_change'];
|
|
|
|
|
- $air_etd_old_sub_new = $_POST['air_etd_old_sub_new'];
|
|
|
|
|
- $air_etd_old_sub_new_unit = $_POST['air_etd_old_sub_new_unit'];
|
|
|
|
|
|
|
+ $air_etd_change = common::check_input($_POST['air_etd_change']);
|
|
|
|
|
+ $air_etd_old_sub_new = common::check_input($_POST['air_etd_old_sub_new']);
|
|
|
|
|
+ $air_etd_old_sub_new_unit = common::check_input($_POST['air_etd_old_sub_new_unit']);
|
|
|
if(!empty($air_etd_old_sub_new_unit)){
|
|
if(!empty($air_etd_old_sub_new_unit)){
|
|
|
$air_etd_old_sub_new_unit = $air_etd_old_sub_new_unit=="Day(s)" ? "days":"hours";
|
|
$air_etd_old_sub_new_unit = $air_etd_old_sub_new_unit=="Day(s)" ? "days":"hours";
|
|
|
}
|
|
}
|
|
|
- $air_eta_change = $_POST['air_eta_change'];
|
|
|
|
|
- $air_eta_old_sub_new = $_POST['air_eta_old_sub_new'];
|
|
|
|
|
- $air_eta_old_sub_new_unit = $_POST['air_eta_old_sub_new_unit'];
|
|
|
|
|
|
|
+ $air_eta_change = common::check_input($_POST['air_eta_change']);
|
|
|
|
|
+ $air_eta_old_sub_new = common::check_input($_POST['air_eta_old_sub_new']);
|
|
|
|
|
+ $air_eta_old_sub_new_unit = common::check_input($_POST['air_eta_old_sub_new_unit']);
|
|
|
if(!empty($air_eta_old_sub_new_unit)){
|
|
if(!empty($air_eta_old_sub_new_unit)){
|
|
|
$air_eta_old_sub_new_unit = $air_eta_old_sub_new_unit=="Day(s)" ? "days":"hours";
|
|
$air_eta_old_sub_new_unit = $air_eta_old_sub_new_unit=="Day(s)" ? "days":"hours";
|
|
|
}
|
|
}
|
|
@@ -727,14 +850,14 @@ class tools {
|
|
|
air_etd_change, air_etd_old_sub_new,air_etd_old_sub_new_unit,air_eta_change,air_eta_old_sub_new,air_eta_old_sub_new_unit,
|
|
air_etd_change, air_etd_old_sub_new,air_etd_old_sub_new_unit,air_eta_change,air_eta_old_sub_new,air_eta_old_sub_new_unit,
|
|
|
frequency_type, daily_time, daily_time_zone,
|
|
frequency_type, daily_time, daily_time_zone,
|
|
|
weekly_week, weekly_time, weekly_time_zone, method_by_email, method_by_message,
|
|
weekly_week, weekly_time, weekly_time_zone, method_by_email, method_by_message,
|
|
|
- event_details, frequency_display, method_display,
|
|
|
|
|
|
|
+ event_details, frequency_display, method_display,shipment_details,
|
|
|
shipment_transport_mode,shipment_etd_limit,shipment_eta_limit)
|
|
shipment_transport_mode,shipment_etd_limit,shipment_eta_limit)
|
|
|
VALUES ('".strtolower(_getLoginName())."', '$notifications_type', '$rules_type',
|
|
VALUES ('".strtolower(_getLoginName())."', '$notifications_type', '$rules_type',
|
|
|
'$ocean_etd_change','$ocean_etd_old_sub_new','$ocean_etd_old_sub_new_unit','$ocean_eta_change','$ocean_eta_old_sub_new','$ocean_eta_old_sub_new_unit',
|
|
'$ocean_etd_change','$ocean_etd_old_sub_new','$ocean_etd_old_sub_new_unit','$ocean_eta_change','$ocean_eta_old_sub_new','$ocean_eta_old_sub_new_unit',
|
|
|
'$air_etd_change','$air_etd_old_sub_new','$air_etd_old_sub_new_unit','$air_eta_change','$air_eta_old_sub_new','$air_eta_old_sub_new_unit',
|
|
'$air_etd_change','$air_etd_old_sub_new','$air_etd_old_sub_new_unit','$air_eta_change','$air_eta_old_sub_new','$air_eta_old_sub_new_unit',
|
|
|
'$frequency_type', $daily_time, '$daily_time_zone',
|
|
'$frequency_type', $daily_time, '$daily_time_zone',
|
|
|
'$weekly_week', $weekly_time, '$weekly_time_zone', '$method_by_email', '$method_by_message',
|
|
'$weekly_week', $weekly_time, '$weekly_time_zone', '$method_by_email', '$method_by_message',
|
|
|
- '$event_details', '$frequency_display', '$method_display',
|
|
|
|
|
|
|
+ '$event_details', '$frequency_display', '$method_display','$shipment_detail',
|
|
|
'$shipment_transport_mode','$shipment_etd_limit','$shipment_eta_limit');";
|
|
'$shipment_transport_mode','$shipment_etd_limit','$shipment_eta_limit');";
|
|
|
}
|
|
}
|
|
|
return $sql;
|
|
return $sql;
|
|
@@ -819,22 +942,6 @@ class tools {
|
|
|
return $msg;
|
|
return $msg;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 这里基准event 写死, 根据online查询页面的通用的来, 这里需提问确定
|
|
|
|
|
- */
|
|
|
|
|
- public function getEDICtnrEvent(){
|
|
|
|
|
- $event =array(array("event_name"=>"EE","description"=>"Empty Equipment Dispatched"),array("event_name"=>"I","description"=>"Gate in full for a booking"),array("event_name"=>"AE","description"=>"Container loaded on vessel"),
|
|
|
|
|
- array("event_name"=>"VD","description"=>"Vessel Departure"),array("event_name"=>"VA_RELAY","description"=>"Arrive Relay Port"),array("event_name"=>"UV_RELAY","description"=>"Unloaded at Relay Port"),
|
|
|
|
|
- array("event_name"=>"AE_RELAY","description"=>"Loaded at Relay Port"),array("event_name"=>"VD_RELAY","description"=>"Depart Relay Port"),array("event_name"=>"CU","description"=>"Carrier and Customs Release"),
|
|
|
|
|
- array("event_name"=>"CT","description"=>"Customs release"),array("event_name"=>"CR","description"=>"Carrier release"),array("event_name"=>"VA","description"=>"Vessel Arrival"),
|
|
|
|
|
- array("event_name"=>"UV","description"=>"Unloaded From Vessel"),array("event_name"=>"AG","description"=>"Estimated Delivery"),array("event_name"=>"OA","description"=>"Gate out full from final discharge port"),
|
|
|
|
|
- array("event_name"=>"FT","description"=>"Free Time Expired"),array("event_name"=>"AL","description"=>"Container loaded on Rail"),array("event_name"=>"AR","description"=>"Container unloaded from Rail"),
|
|
|
|
|
- array("event_name"=>"AV","description"=>"Shipment available for pickup or delivery"),array("event_name"=>"D","description"=>"Gate out for delivery to customer"),array("event_name"=>"RD","description"=>"Container returned empty"),
|
|
|
|
|
- array("event_name"=>"C","description"=>"Vessel Estimated Time of Departure"),array("event_name"=>"C_RELAY","description"=>"Estimated Time of Departure from Tranship Port"),array("event_name"=>"AG_DES","description"=>"Estimated Delivery Destination"),
|
|
|
|
|
- array("event_name"=>"IFFADW","description"=>"Shipment in CFS warehouse"),array("event_name"=>"IFFDDW","description"=>"Shipment Out from CFS House"));
|
|
|
|
|
- return $event;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
public function getNotifications($notifiation_type,$frequency_type){
|
|
public function getNotifications($notifiation_type,$frequency_type){
|
|
|
if ($frequency_type == "all"){
|
|
if ($frequency_type == "all"){
|
|
@@ -849,96 +956,322 @@ class tools {
|
|
|
and ni.weekly_week ilike '%'|| EXTRACT(dow FROM timezone(ni.weekly_time_zone, NOW())) ||'%')";
|
|
and ni.weekly_week ilike '%'|| EXTRACT(dow FROM timezone(ni.weekly_time_zone, NOW())) ||'%')";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if ($notifiation_type == "Milestone_Update"){
|
|
|
|
|
- $sql = "select ni.*,
|
|
|
|
|
|
|
+ $sql = "select ni.*,
|
|
|
|
|
+ case when ni.notifiation_type = 'Departure/Arrival_Delay' and ni.delay_unit = 'days'
|
|
|
|
|
+ then (EXTRACT(DAY FROM ((delay_act_date||' '||delay_act_time)::timestamp - (delay_est_date||' '||delay_est_time)::timestamp)))
|
|
|
|
|
+ when ni.notifiation_type = 'Departure/Arrival_Delay' and ni.delay_unit = 'hours'
|
|
|
|
|
+ then (EXTRACT(HOUR FROM ((delay_act_date||' '||delay_act_time)::timestamp - (delay_est_date||' '||delay_est_time)::timestamp)))
|
|
|
|
|
+ else 0
|
|
|
|
|
+ end as delay_diff,
|
|
|
case when COALESCE(ni.frequency_type,'') = 'Daily'
|
|
case when COALESCE(ni.frequency_type,'') = 'Daily'
|
|
|
- then to_char(timezone(ni.daily_time_zone, insert_date),'Mon DD, YYYY')
|
|
|
|
|
|
|
+ then to_char(timezone(ni.daily_time_zone, now()),'Mon DD, YYYY')
|
|
|
when COALESCE(ni.frequency_type,'') = 'Weekly'
|
|
when COALESCE(ni.frequency_type,'') = 'Weekly'
|
|
|
- then to_char(timezone(ni.weekly_time_zone, insert_date),'Mon DD, YYYY')
|
|
|
|
|
|
|
+ then to_char(timezone(ni.weekly_time_zone, now()),'Mon DD, YYYY')
|
|
|
else ''
|
|
else ''
|
|
|
end as insert_date_format,
|
|
end as insert_date_format,
|
|
|
- ccc.order_from,ccc.h_bol,ccc.transport_mode,ccc.milestone_desc
|
|
|
|
|
- from public.kln_notifiation_info ni
|
|
|
|
|
- left join LATERAL (select oo.h_bol,oo.transport_mode,oo.order_from,
|
|
|
|
|
- case when COALESCE(ni.milestone_code,'') <> '' and oo.transport_mode = 'sea'
|
|
|
|
|
- then (select description from public.customer_service_milestone_sno where type = 'sea' and code = ni.milestone_code)
|
|
|
|
|
- else (select description from public.customer_service_milestone_sno where type = 'air' and code = ni.milestone_code)
|
|
|
|
|
- end as milestone_desc
|
|
|
|
|
- from public.kln_ocean oo
|
|
|
|
|
|
|
+ ccc.order_from,ccc.h_bol,ccc.transport_mode
|
|
|
|
|
+ from public.kln_notifiation_info ni
|
|
|
|
|
+ left join LATERAL (select oo.h_bol,oo.transport_mode,oo.order_from
|
|
|
|
|
+ from public.kln_ocean oo
|
|
|
where oo.serial_no = ni.serial_no limit 1) ccc on true
|
|
where oo.serial_no = ni.serial_no limit 1) ccc on true
|
|
|
- where lower(ni.user_login) = '"._getLoginName()."'
|
|
|
|
|
|
|
+ where lower(ni.user_login) = '"._getLoginName()."'
|
|
|
and ni.notifiation_type = '".$notifiation_type."'
|
|
and ni.notifiation_type = '".$notifiation_type."'
|
|
|
- ".$sql_where." and ni.notifications_method = true and ni.is_send_message = false order by ni.insert_date desc";
|
|
|
|
|
- }
|
|
|
|
|
- if ($notifiation_type == "Milestone_Update"){
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ ".$sql_where." and ni.notifications_method = true order by ni.insert_date desc";
|
|
|
error_log($sql);
|
|
error_log($sql);
|
|
|
$data = common::excuteListSql($sql);
|
|
$data = common::excuteListSql($sql);
|
|
|
//统一处理数据Instant Daily weekly_week 先分开在处理
|
|
//统一处理数据Instant Daily weekly_week 先分开在处理
|
|
|
$instant = array();
|
|
$instant = array();
|
|
|
$daily = array();
|
|
$daily = array();
|
|
|
$daily_uniqe = array();
|
|
$daily_uniqe = array();
|
|
|
|
|
+ $daily_all_id = array();
|
|
|
|
|
+
|
|
|
$weekly = array();
|
|
$weekly = array();
|
|
|
$weekly_uniqe = array();
|
|
$weekly_uniqe = array();
|
|
|
|
|
+ $weekly_all_id = array();
|
|
|
|
|
+
|
|
|
foreach($data as $d){
|
|
foreach($data as $d){
|
|
|
if ($d['frequency_type'] == "Instant"){
|
|
if ($d['frequency_type'] == "Instant"){
|
|
|
$instant[] = $d;
|
|
$instant[] = $d;
|
|
|
}
|
|
}
|
|
|
|
|
+ //类型为这个时才用这个去重,否则要加上描述(转船的情况,会让相同的HBOL显示)
|
|
|
|
|
+ $uniqe_str = $d['serial_no'];
|
|
|
|
|
+ if ($notifiation_type == "Departure/Arrival_Delay"){
|
|
|
|
|
+ $uniqe_str = $d['serial_no']."_".$d['delay_name'];
|
|
|
|
|
+ } else if($notifiation_type == "ETD/ETA_Change"){
|
|
|
|
|
+ $uniqe_str = $d['serial_no']."_".$d['date_change_name'];
|
|
|
|
|
+ }
|
|
|
if ($d['frequency_type'] == "Daily"){
|
|
if ($d['frequency_type'] == "Daily"){
|
|
|
- if(utils::in_array($d['serial_no'],$daily_uniqe)){
|
|
|
|
|
- $temp = $daily[$d['serial_no']];
|
|
|
|
|
- $temp[] = $d;
|
|
|
|
|
- $daily[$d['serial_no']] = $temp;
|
|
|
|
|
|
|
+ $daily_all_id[] = $d["id"];
|
|
|
|
|
+ if(utils::in_array($uniqe_str,$daily_uniqe)){
|
|
|
|
|
+ $temp = $daily[$uniqe_str];
|
|
|
|
|
+ //previous只更新最近的一次,并且是需要查询详细的时候,才放开previous的查询
|
|
|
|
|
+ if(empty($temp['previous']) && $frequency_type <> "all"){
|
|
|
|
|
+ $temp['previous'] = $d;
|
|
|
|
|
+ }
|
|
|
|
|
+ $daily[$uniqe_str] = $temp;
|
|
|
} else {
|
|
} else {
|
|
|
- $daily[$d['serial_no']] = $d['serial_no'];
|
|
|
|
|
- $daily_uniqe[] = $d;
|
|
|
|
|
|
|
+ $daily[$uniqe_str] = $d;
|
|
|
|
|
+ $daily_uniqe[] = $uniqe_str;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if ($d['frequency_type'] == "Weekly"){
|
|
if ($d['frequency_type'] == "Weekly"){
|
|
|
- if(utils::in_array($d['serial_no'],$weekly_uniqe)){
|
|
|
|
|
- $temp = $weekly[$d['serial_no']];
|
|
|
|
|
- $temp[] = $d;
|
|
|
|
|
- $weekly[$d['serial_no']] = $temp;
|
|
|
|
|
|
|
+ $weekly_all_id[] = $d["id"];
|
|
|
|
|
+ if(utils::in_array($uniqe_str,$weekly_uniqe)){
|
|
|
|
|
+ $temp = $weekly[$uniqe_str];
|
|
|
|
|
+ //previous只更新最近的一次,并且是需要查询详细的时候,才放开previous的查询
|
|
|
|
|
+ if(empty($temp['previous']) && $frequency_type <> "all"){
|
|
|
|
|
+ $temp['previous'] = $d;
|
|
|
|
|
+ }
|
|
|
|
|
+ $weekly[$uniqe_str] = $temp;
|
|
|
} else {
|
|
} else {
|
|
|
- $weekly[$d['serial_no']] = $d;
|
|
|
|
|
- $weekly_uniqe[] = $d['serial_no'];
|
|
|
|
|
|
|
+ $weekly[$uniqe_str] = $d;
|
|
|
|
|
+ $weekly_uniqe[] = $uniqe_str;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return array("instant" =>$instant,"daily" =>utils::arrayKeyToInt($daily),"weekly"=>utils::arrayKeyToInt($weekly));
|
|
|
|
|
|
|
+ return array("instant" =>$instant,"daily" =>utils::arrayKeyToInt($daily),"weekly"=>utils::arrayKeyToInt($weekly),
|
|
|
|
|
+ "daily_all_id" =>$daily_all_id,"weekly_all_id"=>$weekly_all_id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function getEventCard($mInfo,$notifiation_type){
|
|
|
|
|
|
|
+ public function getEventCard($mInfo){
|
|
|
|
|
+ $eventCard = array();
|
|
|
|
|
+ $notifiation_type = $mInfo['notifiation_type'];
|
|
|
if($notifiation_type == "Milestone_Update"){
|
|
if($notifiation_type == "Milestone_Update"){
|
|
|
- $timeAndlocations = common::getMilestoneTimeAndlocations($mInfo["milestone_code"],$mInfo["transport_mode"],$mInfo["serial_no"],$mInfo["order_from"]);
|
|
|
|
|
$eventCard = array("type" =>'milestone',
|
|
$eventCard = array("type" =>'milestone',
|
|
|
"numericRecords"=>0,
|
|
"numericRecords"=>0,
|
|
|
- "isRead"=>false,
|
|
|
|
|
|
|
+ "isRead"=>$mInfo["is_send_message"] == 't' ? true : false,
|
|
|
"title"=>"Milestone Update",
|
|
"title"=>"Milestone Update",
|
|
|
- "mode"=>$mInfo["transport_mode"],
|
|
|
|
|
|
|
+ "mode"=>$mInfo["transport_mode"] == 'sea' ? "Ocean Freight": "Air Freight",
|
|
|
"no"=>$mInfo["h_bol"],
|
|
"no"=>$mInfo["h_bol"],
|
|
|
- "tag"=>$mInfo["milestone_desc"],
|
|
|
|
|
- "location"=>$timeAndlocations["locations"],
|
|
|
|
|
- "timezone"=>$timeAndlocations["timezone"],
|
|
|
|
|
|
|
+ "tag"=>$mInfo["milestone_description"],
|
|
|
|
|
+ "location"=>$mInfo["milestone_locations"],
|
|
|
|
|
+ "timezone"=>$mInfo["milestone_timezone"],
|
|
|
"time"=>$mInfo["milestone_date"]." ".$mInfo["milestone_time"],
|
|
"time"=>$mInfo["milestone_date"]." ".$mInfo["milestone_time"],
|
|
|
|
|
+ "timeLabel"=>"",
|
|
|
"previous"=>"",
|
|
"previous"=>"",
|
|
|
"frequency_type"=>$mInfo["frequency_type"],
|
|
"frequency_type"=>$mInfo["frequency_type"],
|
|
|
- "delayInfo"=>array(),"changeInfo"=>array());
|
|
|
|
|
|
|
+ "serial_no"=>$mInfo["serial_no"],
|
|
|
|
|
+ "order_from"=>$mInfo["order_from"],
|
|
|
|
|
+ "id"=>$mInfo["id"],
|
|
|
|
|
+ "info"=>new stdClass());
|
|
|
|
|
|
|
|
if ($mInfo["frequency_type"] == "Daily"){
|
|
if ($mInfo["frequency_type"] == "Daily"){
|
|
|
- $eventCard["numericRecords"] = $mInfo["numericRecords"];
|
|
|
|
|
|
|
+ $eventCard["numericRecords"] = !empty($mInfo["numericRecords"]) ? $mInfo["numericRecords"] : 0;
|
|
|
$eventCard["title"] = "Milestone Update Daily Summary(".$mInfo["insert_date_format"].")";
|
|
$eventCard["title"] = "Milestone Update Daily Summary(".$mInfo["insert_date_format"].")";
|
|
|
|
|
+ if(!empty($mInfo["previous"])){
|
|
|
|
|
+ $eventCard["previous"] = array("tag" =>"Previous:".$mInfo["previous"]["milestone_description"]." from ".$mInfo["previous"]["milestone_locations"],
|
|
|
|
|
+ "time" => $mInfo["previous"]["milestone_time"],
|
|
|
|
|
+ "timezone" =>$mInfo["previous"]["milestone_timezone"]);
|
|
|
|
|
+ }
|
|
|
} else if($mInfo["frequency_type"] == "Weekly"){
|
|
} else if($mInfo["frequency_type"] == "Weekly"){
|
|
|
- $eventCard["numericRecords"] = $mInfo["numericRecords"];
|
|
|
|
|
|
|
+ $eventCard["numericRecords"] = !empty($mInfo["numericRecords"]) ? $mInfo["numericRecords"] : 0;
|
|
|
$eventCard["title"] = "Milestone Update Weekly Summary(".$mInfo["insert_date_format"].")";
|
|
$eventCard["title"] = "Milestone Update Weekly Summary(".$mInfo["insert_date_format"].")";
|
|
|
|
|
+ if(!empty($mInfo["previous"])){
|
|
|
|
|
+ $eventCard["previous"] = array("tag" =>"Previous:".$mInfo["previous"]["milestone_desc"]." from ".$mInfo["previous"]["milestone_description"],
|
|
|
|
|
+ "time" => $mInfo["previous"]["milestone_time"],
|
|
|
|
|
+ "timezone" =>$mInfo["previous"]["milestone_timezone"]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if($notifiation_type == "Container_Status_Update"){
|
|
|
|
|
+ //当前状态的描述
|
|
|
|
|
+ $ctnrStatusdesc = $this->getContainerStatusDesc($mInfo["ctnr_status_code"]);
|
|
|
|
|
+ $eventCard = array("type" =>'container',
|
|
|
|
|
+ "numericRecords"=>0,
|
|
|
|
|
+ "isRead"=>$mInfo["is_send_message"] == 't' ? true : false,
|
|
|
|
|
+ "title"=>"Container_Status_Update",
|
|
|
|
|
+ "mode"=>"Ocean Freight",
|
|
|
|
|
+ "no"=>$mInfo["ctnr"],
|
|
|
|
|
+ "tag"=>$ctnrStatusdesc,
|
|
|
|
|
+ "location"=>$mInfo["ctnr_status_locations"],
|
|
|
|
|
+ "timezone"=>$mInfo["ctnr_status_timezone"],
|
|
|
|
|
+ "time"=>$mInfo["ctnr_status_date"]." ".$mInfo["ctnr_status_time"],
|
|
|
|
|
+ "timeLabel"=>"",
|
|
|
|
|
+ "previous"=>"",
|
|
|
|
|
+ "frequency_type"=>$mInfo["frequency_type"],
|
|
|
|
|
+ "serial_no"=>$mInfo["serial_no"],
|
|
|
|
|
+ "order_from"=>$mInfo["order_from"],
|
|
|
|
|
+ "id"=>$mInfo["id"],
|
|
|
|
|
+ "info"=>new stdClass());
|
|
|
|
|
+
|
|
|
|
|
+ if ($mInfo["frequency_type"] == "Daily"){
|
|
|
|
|
+ $eventCard["numericRecords"] = !empty($mInfo["numericRecords"]) ? $mInfo["numericRecords"] : 0;
|
|
|
|
|
+ $eventCard["title"] = "Container Status Update Daily Summary(".$mInfo["insert_date_format"].")";
|
|
|
|
|
+ if(!empty($mInfo["previous"])){
|
|
|
|
|
+ //当前状态 前一个的描述
|
|
|
|
|
+ $previousCtnrStatusdesc = $this->getContainerStatusDesc($mInfo["previous"]["ctnr_status_code"]);
|
|
|
|
|
+ $eventCard["previous"] = array("tag" =>"Previous:" .$previousCtnrStatusdesc. " from " .$mInfo["previous"]["ctnr_status_locations"],
|
|
|
|
|
+ "time" => $mInfo["previous"]["ctnr_status_time"],
|
|
|
|
|
+ "timezone" =>$mInfo["previous"]["ctnr_status_timezone"]);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if($mInfo["frequency_type"] == "Weekly"){
|
|
|
|
|
+ $eventCard["numericRecords"] = !empty($mInfo["numericRecords"]) ? $mInfo["numericRecords"] : 0;
|
|
|
|
|
+ $eventCard["title"] = "Container Status Update Weekly Summary(".$mInfo["insert_date_format"].")";
|
|
|
|
|
+ if(!empty($mInfo["previous"])){
|
|
|
|
|
+ //当前状态 前一个的描述
|
|
|
|
|
+ $previousCtnrStatusdesc = $this->getContainerStatusDesc($mInfo["previous"]["ctnr_status_code"]);
|
|
|
|
|
+ $eventCard["previous"] = array("tag" =>"Previous:" .$previousCtnrStatusdesc. " from " .$mInfo["previous"]["ctnr_status_locations"],
|
|
|
|
|
+ "time" => $mInfo["previous"]["ctnr_status_time"],
|
|
|
|
|
+ "timezone" =>$mInfo["previous"]["ctnr_status_timezone"]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if($notifiation_type == "Departure/Arrival_Delay"){
|
|
|
|
|
+ //代表信息为转船信息,title要处理一下: leg 2/3 Departure_Delay => Departure_Delay
|
|
|
|
|
+ $title = $mInfo["delay_name"];
|
|
|
|
|
+ $outsideLocation = "";
|
|
|
|
|
+ $outsideTimezone = "";
|
|
|
|
|
+ $outsideTimeLabel= "";
|
|
|
|
|
+ $insideTimeLabel= "";
|
|
|
|
|
+ if(utils::checkExist($mInfo["delay_name"],"Departure_Delay")){
|
|
|
|
|
+ $outsideTimeLabel = "ETD";
|
|
|
|
|
+ $insideTimeLabel = "ATD";
|
|
|
|
|
+ }
|
|
|
|
|
+ if(utils::checkExist($mInfo["delay_name"],"Arrival_Delay")){
|
|
|
|
|
+ $outsideTimeLabel = "ETA";
|
|
|
|
|
+ $insideTimeLabel = "ATA";
|
|
|
|
|
+ }
|
|
|
|
|
+ //直航的的
|
|
|
|
|
+ if(utils::checkExist($mInfo["delay_name"],"Departure_Delay") and $mInfo["delay_is_direct"] == 't'){
|
|
|
|
|
+ $outsideLocation = $mInfo["delay_locations_from"];
|
|
|
|
|
+ }
|
|
|
|
|
+ if(utils::checkExist($mInfo["delay_name"],"Arrival_Delay") and $mInfo["delay_is_direct"] == 't'){
|
|
|
|
|
+ $outsideLocation = $mInfo["delay_locations_to"];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $route = array();
|
|
|
|
|
+ $leg = array();
|
|
|
|
|
+ if($mInfo["delay_is_direct"] <>'t'){
|
|
|
|
|
+ $title = substr($mInfo["delay_name"],8);
|
|
|
|
|
+ $route = array($mInfo["delay_locations_from"],$mInfo["delay_locations_transshipment"],$mInfo["delay_locations_to"]);
|
|
|
|
|
+ //当前current Leg
|
|
|
|
|
+ $leg = array($mInfo["delay_locations_from"],$mInfo["delay_locations_transshipment"]);
|
|
|
|
|
+ if($mInfo["delay_current"] == "2"){
|
|
|
|
|
+ $leg = array($mInfo["delay_locations_transshipment"],$mInfo["delay_locations_to"]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $act_date = $mInfo["delay_act_date"]." ".$mInfo["delay_act_time"];
|
|
|
|
|
+ $est_date = $mInfo["delay_est_date"]." ".$mInfo["delay_est_time"];
|
|
|
|
|
+ $delay_diff = $mInfo["delay_diff"];
|
|
|
|
|
+ $delay_unit = $mInfo["delay_unit"];
|
|
|
|
|
+ $eventCard = array("type" =>'delay',
|
|
|
|
|
+ "numericRecords"=>0,
|
|
|
|
|
+ "isRead"=>$mInfo["is_send_message"] == 't' ? true : false,
|
|
|
|
|
+ "title"=>$title,
|
|
|
|
|
+ "mode"=>$mInfo["transport_mode"] == 'sea' ? "Ocean Freight": "Air Freight",
|
|
|
|
|
+ "no"=>$mInfo["h_bol"],
|
|
|
|
|
+ "tag"=>$mInfo["delay_name"],
|
|
|
|
|
+ "location"=>$outsideLocation,
|
|
|
|
|
+ "timezone"=>$mInfo["delay_timezone"],
|
|
|
|
|
+ "time"=>$est_date,
|
|
|
|
|
+ "timeLabel"=>$outsideTimeLabel,
|
|
|
|
|
+ "previous"=>"",
|
|
|
|
|
+ "frequency_type"=>$mInfo["frequency_type"],
|
|
|
|
|
+ "serial_no"=>$mInfo["serial_no"],
|
|
|
|
|
+ "order_from"=>$mInfo["order_from"],
|
|
|
|
|
+ "id"=>$mInfo["id"],
|
|
|
|
|
+ "info"=>array("route"=>$route,
|
|
|
|
|
+ "leg"=>$leg,
|
|
|
|
|
+ "etdOrdeparturNum"=>0,
|
|
|
|
|
+ "etaOrarrivalNum"=>0,
|
|
|
|
|
+ "time"=>$act_date,
|
|
|
|
|
+ "timeLabel"=>$insideTimeLabel,
|
|
|
|
|
+ "delayTimeTip"=>"+".$delay_diff." ".$delay_unit." delay",
|
|
|
|
|
+ "timezone"=>$mInfo["delay_timezone"]
|
|
|
|
|
+ ));
|
|
|
|
|
+
|
|
|
|
|
+ if ($mInfo["frequency_type"] == "Daily"){
|
|
|
|
|
+ $eventCard["numericRecords"] = !empty($mInfo["numericRecords"]) ? $mInfo["numericRecords"] : 0;
|
|
|
|
|
+ $eventCard["info"]["etdOrdeparturNum"] = !empty($mInfo["numericRecords_one"]) ? $mInfo["numericRecords_one"] : 0;
|
|
|
|
|
+ $eventCard["info"]["etaOrarrivalNum"] = !empty($mInfo["numericRecords_two"]) ? $mInfo["numericRecords_two"] : 0;
|
|
|
|
|
+ $eventCard["title"] = "Container Status Update Daily Summary(".$mInfo["insert_date_format"].")";
|
|
|
|
|
+ } else if($mInfo["frequency_type"] == "Weekly"){
|
|
|
|
|
+ $eventCard["numericRecords"] = !empty($mInfo["numericRecords"]) ? $mInfo["numericRecords"] : 0;
|
|
|
|
|
+ $eventCard["info"]["etdOrdeparturNum"] = !empty($mInfo["numericRecords_one"]) ? $mInfo["numericRecords_one"] : 0;
|
|
|
|
|
+ $eventCard["info"]["etaOrarrivalNum"] = !empty($mInfo["numericRecords_two"]) ? $mInfo["numericRecords_two"] : 0;
|
|
|
|
|
+ $eventCard["title"] = "Container Status Update Weekly Summary(".$mInfo["insert_date_format"].")";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if($notifiation_type == "ETD/ETA_Change"){
|
|
|
|
|
+ $title = $mInfo["date_change_name"];
|
|
|
|
|
+ if(utils::checkExist($mInfo["date_change_name"],"ETD Change")){
|
|
|
|
|
+ $outsideTimeLabel = "Original ETD";
|
|
|
|
|
+ $insideTimeLabel = "Upoated ETD";
|
|
|
|
|
+ }
|
|
|
|
|
+ if(utils::checkExist($mInfo["date_change_name"],"ETA Change")){
|
|
|
|
|
+ $outsideTimeLabel = "Original ETA";
|
|
|
|
|
+ $insideTimeLabel = "Upoated ETA";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if($mInfo["date_change_is_direct"] <>'t'){
|
|
|
|
|
+ //代表信息为转船信息,title要处理一下: leg 1/3 ETD Change
|
|
|
|
|
+ $title = substr($mInfo["date_change_name"],8);
|
|
|
|
|
+ $route = array($mInfo["date_change_locations_from"],$mInfo["date_change_locations_transshipment"],$mInfo["date_change_locations_to"]);
|
|
|
|
|
+ $leg = array($mInfo["date_change_locations_from"],$mInfo["date_change_locations_transshipment"]);
|
|
|
|
|
+ if($mInfo["delay_current"] == "2"){
|
|
|
|
|
+ $leg = array($mInfo["date_change_locations_transshipment"],$mInfo["date_change_locations_to"]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $updated_date = $mInfo["date_change_updated_date"]." ".$mInfo["date_change_updated_time"];
|
|
|
|
|
+ $original_date = $mInfo["date_change_original_date"]." ".$mInfo["date_change_original_time"];
|
|
|
|
|
+ $eventCard = array("type" =>'change',
|
|
|
|
|
+ "numericRecords"=>0,
|
|
|
|
|
+ "isRead"=>$mInfo["is_send_message"] == 't' ? true : false,
|
|
|
|
|
+ "title"=>$title,
|
|
|
|
|
+ "mode"=>$mInfo["transport_mode"] == 'sea' ? "Ocean Freight": "Air Freight",
|
|
|
|
|
+ "no"=>$mInfo["h_bol"],
|
|
|
|
|
+ "tag"=>$mInfo["date_change_name"],
|
|
|
|
|
+ "location"=>"",
|
|
|
|
|
+ "timezone"=>$mInfo["date_change_timezone"],
|
|
|
|
|
+ "time"=>$original_date,
|
|
|
|
|
+ "timeLabel"=>$outsideTimeLabel,
|
|
|
|
|
+ "previous"=>"",
|
|
|
|
|
+ "frequency_type"=>$mInfo["frequency_type"],
|
|
|
|
|
+ "serial_no"=>$mInfo["serial_no"],
|
|
|
|
|
+ "order_from"=>$mInfo["order_from"],
|
|
|
|
|
+ "id"=>$mInfo["id"],
|
|
|
|
|
+ "info"=>array("route"=>$route,
|
|
|
|
|
+ "leg"=>$leg,
|
|
|
|
|
+ "etdOrdeparturNum"=>0,
|
|
|
|
|
+ "etaOrarrivalNum"=>0,
|
|
|
|
|
+ "time"=>$updated_date,
|
|
|
|
|
+ "timeLabel"=>$insideTimeLabel,
|
|
|
|
|
+ "delayTimeTip"=>"",
|
|
|
|
|
+ "timezone"=>$mInfo["date_change_timezone"]
|
|
|
|
|
+ ));
|
|
|
|
|
|
|
|
|
|
+ if ($mInfo["frequency_type"] == "Daily"){
|
|
|
|
|
+ $eventCard["numericRecords"] = !empty($mInfo["numericRecords"]) ? $mInfo["numericRecords"] : 0;
|
|
|
|
|
+ $eventCard["info"]["etdOrdeparturNum"] = !empty($mInfo["numericRecords_one"]) ? $mInfo["numericRecords_one"] : 0;
|
|
|
|
|
+ $eventCard["info"]["etaOrarrivalNum"] = !empty($mInfo["numericRecords_two"]) ? $mInfo["numericRecords_two"] : 0;
|
|
|
|
|
+ $eventCard["title"] = "ETD/ETA Change Daily Summary(".$mInfo["insert_date_format"].")";
|
|
|
|
|
+ } else if($mInfo["frequency_type"] == "Weekly"){
|
|
|
|
|
+ $eventCard["numericRecords"] = !empty($mInfo["numericRecords"]) ? $mInfo["numericRecords"] : 0;
|
|
|
|
|
+ $eventCard["info"]["etdOrdeparturNum"] = !empty($mInfo["numericRecords_one"]) ? $mInfo["numericRecords_one"] : 0;
|
|
|
|
|
+ $eventCard["info"]["etaOrarrivalNum"] = !empty($mInfo["numericRecords_two"]) ? $mInfo["numericRecords_two"] : 0;
|
|
|
|
|
+ $eventCard["title"] = "ETD/ETA Change Weekly Summary(".$mInfo["insert_date_format"].")";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
return $eventCard;
|
|
return $eventCard;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 返回当前柜子的status信息描述
|
|
|
|
|
+ */
|
|
|
|
|
+ public static function getContainerStatusDesc($ctnr_status_code){
|
|
|
|
|
+ $event =common::getEDICtnrEvent();
|
|
|
|
|
+ $ctnrStatusdesc = "";
|
|
|
|
|
+ foreach($event as $e){
|
|
|
|
|
+ if($e['event_name'] == $ctnr_status_code){
|
|
|
|
|
+ $ctnrStatusdesc = $e['description'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return $ctnrStatusdesc;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
?>
|