|
@@ -138,7 +138,6 @@ class ocean_order {
|
|
|
$bol = $_POST['h_bol'];
|
|
$bol = $_POST['h_bol'];
|
|
|
if ($transport_mode == "sea") {
|
|
if ($transport_mode == "sea") {
|
|
|
$count = common::excuteObjectSql("select * from ocean where lower(h_bol) = '" . strtolower($bol) . "'");
|
|
$count = common::excuteObjectSql("select * from ocean where lower(h_bol) = '" . strtolower($bol) . "'");
|
|
|
-
|
|
|
|
|
} elseif ($transport_mode == "air") {
|
|
} elseif ($transport_mode == "air") {
|
|
|
$count = common::excuteObjectSql("select * from air where lower(hawb) = '" . strtolower($bol) . "'");
|
|
$count = common::excuteObjectSql("select * from air where lower(hawb) = '" . strtolower($bol) . "'");
|
|
|
}
|
|
}
|
|
@@ -170,7 +169,7 @@ class ocean_order {
|
|
|
}
|
|
}
|
|
|
$size = floor($_FILES ["file"]['size'][$i] / 1024 / 1024);
|
|
$size = floor($_FILES ["file"]['size'][$i] / 1024 / 1024);
|
|
|
if ($size > 5) {
|
|
if ($size > 5) {
|
|
|
- $errorMsg = $_FILES['file']["name"][$i] . "is larger than 5M";
|
|
|
|
|
|
|
+ $errorMsg = $_FILES['file']["name"][$i] . "is larger than 5M.";
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
if ($_FILES["file"]["error"][$i] > 0) {
|
|
if ($_FILES["file"]["error"][$i] > 0) {
|
|
@@ -185,10 +184,9 @@ class ocean_order {
|
|
|
$exten = $path_parts['extension'];
|
|
$exten = $path_parts['extension'];
|
|
|
if (stristr($allow_extend, "|." . $exten . "|") === FALSE) {
|
|
if (stristr($allow_extend, "|." . $exten . "|") === FALSE) {
|
|
|
//$errorMsg .= ' Only can upload PDF/Excel/Doc file;';
|
|
//$errorMsg .= ' Only can upload PDF/Excel/Doc file;';
|
|
|
- $errorMsg = $_FILES['file']["name"][$i].' must PDF type';
|
|
|
|
|
|
|
+ $errorMsg = $_FILES['file']["name"][$i].' must PDF Type.';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //$filename = $file_name[$i];
|
|
|
|
|
$filename = $bol."_".$format['standard']."_V".($i+1+$num). "." . $exten;
|
|
$filename = $bol."_".$format['standard']."_V".($i+1+$num). "." . $exten;
|
|
|
$file_size = floor($_FILES ["file"]['size'][$i] / 1024) . "KB";
|
|
$file_size = floor($_FILES ["file"]['size'][$i] / 1024) . "KB";
|
|
|
$order_type = $transport_mode == "sea" ? "ocean" : "air";
|
|
$order_type = $transport_mode == "sea" ? "ocean" : "air";
|
|
@@ -214,26 +212,54 @@ class ocean_order {
|
|
|
|
|
|
|
|
$save_path = $folder . DS . date("Ymd") . DS;
|
|
$save_path = $folder . DS . date("Ymd") . DS;
|
|
|
if (common::mkdirs($save_path) === FALSE){
|
|
if (common::mkdirs($save_path) === FALSE){
|
|
|
- $errorMsg = " Save folder create error";
|
|
|
|
|
- }
|
|
|
|
|
- if (move_uploaded_file($_FILES['file']['tmp_name'][$i], $save_path . $filename)) {
|
|
|
|
|
- $sql .= "insert into $_schemas.$_table (file_name, file_path, upload_date, upload_ip, upload_by, bol, file_type, file_size, online_upload,
|
|
|
|
|
- origin, destination, from_station, serial_no,
|
|
|
|
|
- online_format,format_serailno,source_filename)
|
|
|
|
|
- values ('" . common::check_input($filename) . "','" . common::check_input($save_path) . "', now(), '" . common::ip() . "',
|
|
|
|
|
- '" . common::check_input(_getLoginName()) . "','" . common::check_input(strtoupper($bol)) . "', '$order_type', '" . common::check_input($file_size) . "',
|
|
|
|
|
- 't', '" . common::check_input($origin_station) . "', '" .common::check_input($destination_station) . "',
|
|
|
|
|
- '" . common::check_input($from_station) . "', '" . $serial_no . "',
|
|
|
|
|
- '" . common::check_input($file_type) . "','" . common::check_input($format_serialno) . "','" . common::check_input($filename) . "');";
|
|
|
|
|
|
|
+ $errorMsg = "Save Folder create error.";
|
|
|
|
|
+ continue;
|
|
|
}
|
|
}
|
|
|
- //根据配置,看需要同步文件
|
|
|
|
|
|
|
+ //pdf文件不需要处理宏,直接保存
|
|
|
|
|
+ if($exten == "pdf"){
|
|
|
|
|
+ if (move_uploaded_file($_FILES['file']['tmp_name'][$i], $save_path . $filename)) {
|
|
|
|
|
+ $sql .= "insert into $_schemas.$_table (file_name, file_path, upload_date, upload_ip, upload_by, bol, file_type, file_size, online_upload,
|
|
|
|
|
+ origin, destination, from_station, serial_no,
|
|
|
|
|
+ online_format,format_serailno,source_filename)
|
|
|
|
|
+ values ('" . common::check_input($filename) . "','" . common::check_input($save_path) . "', now(), '" . common::ip() . "',
|
|
|
|
|
+ '" . common::check_input(_getLoginName()) . "','" . common::check_input(strtoupper($bol)) . "', '$order_type', '" . common::check_input($file_size) . "',
|
|
|
|
|
+ 't', '" . common::check_input($origin_station) . "', '" .common::check_input($destination_station) . "',
|
|
|
|
|
+ '" . common::check_input($from_station) . "', '" . $serial_no . "',
|
|
|
|
|
+ '" . common::check_input($file_type) . "','" . common::check_input($format_serialno) . "','" . common::check_input($filename) . "');";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $errorMsg = "Upload Filed Failed.";
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //读取文件内容后,重新生成无宏版本文件,支持docx,xlsx
|
|
|
|
|
+ // $from_filename = $file_name[$i];
|
|
|
|
|
+ // $inputFileName = $save_path . $from_filename;
|
|
|
|
|
+ // $outputFileName = $save_path . $filename;
|
|
|
|
|
+ // if(move_uploaded_file($_FILES['file']['tmp_name'][$i],$outputFileName)){
|
|
|
|
|
+ // $outputFileName = $save_path . $filename;
|
|
|
|
|
+ // //按outputFileName路径重新生成文件,并且删除旧文件(inputFileName)
|
|
|
|
|
+ // //utils::removeFIlemacro($inputFileName,$outputFileName,$exten);
|
|
|
|
|
+ // //utils::hasMacros($outputFileName);
|
|
|
|
|
+ // //utils::checkExcelMacros($outputFileName,$filename_no_exten);
|
|
|
|
|
+ // $sql .= "insert into $_schemas.$_table (file_name, file_path, upload_date, upload_ip, upload_by, bol, file_type, file_size, online_upload,
|
|
|
|
|
+ // origin, destination, from_station, serial_no,
|
|
|
|
|
+ // online_format,format_serailno,source_filename)
|
|
|
|
|
+ // values ('" . common::check_input($filename) . "','" . common::check_input($save_path) . "', now(), '" . common::ip() . "',
|
|
|
|
|
+ // '" . common::check_input(_getLoginName()) . "','" . common::check_input(strtoupper($bol)) . "', '$order_type', '" . common::check_input($file_size) . "',
|
|
|
|
|
+ // 't', '" . common::check_input($origin_station) . "', '" .common::check_input($destination_station) . "',
|
|
|
|
|
+ // '" . common::check_input($from_station) . "', '" . $serial_no . "',
|
|
|
|
|
+ // '" . common::check_input($file_type) . "','" . common::check_input($format_serialno) . "','" . common::check_input($filename) . "');";
|
|
|
|
|
+ // }
|
|
|
|
|
+ }
|
|
|
|
|
+ //根据配置,看需要同步文件,
|
|
|
|
|
+ $doc_upload_log_table = $transport_mode == "sea" ? "ra_online_doc_upload_log" : "air_doc_upload_log";
|
|
|
if(!empty($format['auto_sync_to_station'])){
|
|
if(!empty($format['auto_sync_to_station'])){
|
|
|
if($format['auto_sync_to_station'] == "Origin Station"){
|
|
if($format['auto_sync_to_station'] == "Origin Station"){
|
|
|
- $sql .= "INSERT INTO public.ra_online_doc_upload_log(serial_no, station, download_time)
|
|
|
|
|
|
|
+ $sql .= "INSERT INTO public.$doc_upload_log_table(serial_no, station, download_time)
|
|
|
VALUES ('".$serial_no."', '" .common::check_input($destination_station) . "', now());";
|
|
VALUES ('".$serial_no."', '" .common::check_input($destination_station) . "', now());";
|
|
|
}
|
|
}
|
|
|
if($format['auto_sync_to_station'] == "Destination Station"){
|
|
if($format['auto_sync_to_station'] == "Destination Station"){
|
|
|
- $sql .= "INSERT INTO public.ra_online_doc_upload_log(serial_no, station, download_time)
|
|
|
|
|
|
|
+ $sql .= "INSERT INTO public.$doc_upload_log_table(serial_no, station, download_time)
|
|
|
VALUES ('".$serial_no."', '" .common::check_input($origin_station) . "', now());";
|
|
VALUES ('".$serial_no."', '" .common::check_input($origin_station) . "', now());";
|
|
|
}
|
|
}
|
|
|
if($format['auto_sync_to_station'] == "Origin and Destination Stations"){
|
|
if($format['auto_sync_to_station'] == "Origin and Destination Stations"){
|
|
@@ -241,15 +267,16 @@ class ocean_order {
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
//如果没有配置。这代表不同步文件
|
|
//如果没有配置。这代表不同步文件
|
|
|
- $sql .= "INSERT INTO public.ra_online_doc_upload_log(serial_no, station, download_time)
|
|
|
|
|
|
|
+ $sql .= "INSERT INTO public.$doc_upload_log_table(serial_no, station, download_time)
|
|
|
VALUES ('".$serial_no."', '" .common::check_input($destination_station) . "', now());";
|
|
VALUES ('".$serial_no."', '" .common::check_input($destination_station) . "', now());";
|
|
|
- $sql .= "INSERT INTO public.ra_online_doc_upload_log(serial_no, station, download_time)
|
|
|
|
|
|
|
+ $sql .= "INSERT INTO public.$doc_upload_log_table(serial_no, station, download_time)
|
|
|
VALUES ('".$serial_no."', '" .common::check_input($origin_station) . "', now());";
|
|
VALUES ('".$serial_no."', '" .common::check_input($origin_station) . "', now());";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
//根据配置发送通知邮件 相同文件类型只提醒一次
|
|
//根据配置发送通知邮件 相同文件类型只提醒一次
|
|
|
- if(!empty($format['notify_station'])){
|
|
|
|
|
|
|
+ if(!empty($format['notify_station']) && empty($errorMsg)){
|
|
|
$origin_op_email = common::excuteOneSql("select email from employee where employee_id = '".$count["origin_op_id"]."' limit 1");
|
|
$origin_op_email = common::excuteOneSql("select email from employee where employee_id = '".$count["origin_op_id"]."' limit 1");
|
|
|
$dest_op_email = common::excuteOneSql("select email from employee where employee_id = '".$count["dest_op"]."' limit 1");
|
|
$dest_op_email = common::excuteOneSql("select email from employee where employee_id = '".$count["dest_op"]."' limit 1");
|
|
|
$ks_from = common::excuteOneSql("select ksmart_station from public.contract_region_mapping where overeas = '".$count["from_station"]."' limit 1");
|
|
$ks_from = common::excuteOneSql("select ksmart_station from public.contract_region_mapping where overeas = '".$count["from_station"]."' limit 1");
|
|
@@ -257,7 +284,7 @@ class ocean_order {
|
|
|
$ks_from = empty($ks_from)? 'f' : $ks_from;
|
|
$ks_from = empty($ks_from)? 'f' : $ks_from;
|
|
|
$ks_to = empty($ks_to)? 'f' : $ks_to;
|
|
$ks_to = empty($ks_to)? 'f' : $ks_to;
|
|
|
if($ks_from == "f" && $ks_to == "f"){
|
|
if($ks_from == "f" && $ks_to == "f"){
|
|
|
- $errorMsg = "Both Non Ksmart,pls checked Info";
|
|
|
|
|
|
|
+ $errorMsg = "Both Non Ksmart,pls checked";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$curr_date_config = common::excuteObjectSql("SELECT to_char(now()::date,'Mon_DD_YYYY') as d1_day,to_char(now()::date,'Mon_DD_YYYY HH:MM') as d2_day");
|
|
$curr_date_config = common::excuteObjectSql("SELECT to_char(now()::date,'Mon_DD_YYYY') as d1_day,to_char(now()::date,'Mon_DD_YYYY HH:MM') as d2_day");
|
|
@@ -411,7 +438,6 @@ class ocean_order {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!empty($errorMsg)) {
|
|
if (!empty($errorMsg)) {
|
|
@@ -430,7 +456,7 @@ class ocean_order {
|
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
|
error_log($e->getTraceAsString());
|
|
error_log($e->getTraceAsString());
|
|
|
$data = array(
|
|
$data = array(
|
|
|
- 'msg' => "Save Booking Failed:Upload Filed Failed."
|
|
|
|
|
|
|
+ 'msg' => "Upload Filed Failed."
|
|
|
);
|
|
);
|
|
|
common::echo_json_encode(500,$data);
|
|
common::echo_json_encode(500,$data);
|
|
|
}
|
|
}
|
|
@@ -1227,7 +1253,6 @@ class ocean_order {
|
|
|
'simplexData' =>$simplexData,
|
|
'simplexData' =>$simplexData,
|
|
|
'containerStatusData' => $containerStatusData,
|
|
'containerStatusData' => $containerStatusData,
|
|
|
'document_info' => $document_info,
|
|
'document_info' => $document_info,
|
|
|
- 'containers' => $containers,
|
|
|
|
|
'Milestones' => $Milestones,
|
|
'Milestones' => $Milestones,
|
|
|
'routes' => $routes,
|
|
'routes' => $routes,
|
|
|
'email' => $email,
|
|
'email' => $email,
|
|
@@ -1255,7 +1280,7 @@ class ocean_order {
|
|
|
$_schemas = $_REQUEST["_schemas"];
|
|
$_schemas = $_REQUEST["_schemas"];
|
|
|
$air_milestone_status = common::excuteListSql("select code,
|
|
$air_milestone_status = common::excuteListSql("select code,
|
|
|
act_date,est_date,timezone
|
|
act_date,est_date,timezone
|
|
|
- from ocean_milestone a
|
|
|
|
|
|
|
+ from air_milestone a
|
|
|
where a.serial_no='$serial_no' and code in('IFFCPU','IFFREC','IFFONB','IFFARR','IFFDEL')
|
|
where a.serial_no='$serial_no' and code in('IFFCPU','IFFREC','IFFONB','IFFARR','IFFDEL')
|
|
|
order by id");
|
|
order by id");
|
|
|
$state = -1;
|
|
$state = -1;
|