|
@@ -593,6 +593,9 @@ class destination_delivery {
|
|
|
//栏位信息
|
|
//栏位信息
|
|
|
$column = column::getInstance()->getDisplayColumn('destination_delivery_shipment_search');
|
|
$column = column::getInstance()->getDisplayColumn('destination_delivery_shipment_search');
|
|
|
$BookingTableColumns = column::getInstance()->tableColumns('destination_delivery_shipment_search',$column);
|
|
$BookingTableColumns = column::getInstance()->tableColumns('destination_delivery_shipment_search',$column);
|
|
|
|
|
+
|
|
|
|
|
+ //Packing List 和 Commercial Invoice 顺序处理,以后自定义了可以移除这个函数
|
|
|
|
|
+ $BookingTableColumns = common::destination_delivery_shipment_search_sort($BookingTableColumns);
|
|
|
$data['TrackingTableColumns'] = $BookingTableColumns;
|
|
$data['TrackingTableColumns'] = $BookingTableColumns;
|
|
|
common::echo_json_encode(200,$data);
|
|
common::echo_json_encode(200,$data);
|
|
|
exit();
|
|
exit();
|
|
@@ -1215,6 +1218,13 @@ class destination_delivery {
|
|
|
common::echo_json_encode(200,$data);
|
|
common::echo_json_encode(200,$data);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
|
+ * download batch P AND CI document
|
|
|
|
|
+ */
|
|
|
|
|
+ if ($operate == "batch_download_ci_p_file") {
|
|
|
|
|
+ $this->_batch_download_ci_p_file();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private function getCommunicationNew($serial_no) {
|
|
private function getCommunicationNew($serial_no) {
|
|
@@ -1283,6 +1293,16 @@ class destination_delivery {
|
|
|
if (isset($_REQUEST['ata_end']) && !empty($_REQUEST['ata_end']))
|
|
if (isset($_REQUEST['ata_end']) && !empty($_REQUEST['ata_end']))
|
|
|
$sqlWhere .= " and ata <= '" . common::usDate2sqlDate($_REQUEST['ata_end']) . " 23:59:59'";
|
|
$sqlWhere .= " and ata <= '" . common::usDate2sqlDate($_REQUEST['ata_end']) . " 23:59:59'";
|
|
|
|
|
|
|
|
|
|
+ $recommended_delivery_sql = ' 1=1 ';
|
|
|
|
|
+ if (isset($_REQUEST['recommended_delivery_date']) && !empty($_REQUEST['recommended_delivery_date']))
|
|
|
|
|
+ $recommended_delivery_sql .= " and ((recommended_delivery_from_date is not null and recommended_delivery_from_date <= '" . common::usDate2sqlDate($_REQUEST['recommended_delivery_date']) . " 00:00:00')
|
|
|
|
|
+ OR
|
|
|
|
|
+ recommended_delivery_from_date is null)";
|
|
|
|
|
+ if (isset($_REQUEST['recommended_delivery_date']) && !empty($_REQUEST['recommended_delivery_date']))
|
|
|
|
|
+ $recommended_delivery_sql .= " and ((recommended_delivery_to_date is not null and recommended_delivery_to_date >= '" . common::usDate2sqlDate($_REQUEST['recommended_delivery_date']) . " 00:00:00')
|
|
|
|
|
+ OR
|
|
|
|
|
+ recommended_delivery_to_date is null)";
|
|
|
|
|
+
|
|
|
$sql = "with oo as(
|
|
$sql = "with oo as(
|
|
|
select oo.serial_no,
|
|
select oo.serial_no,
|
|
|
oo.h_bol,
|
|
oo.h_bol,
|
|
@@ -1495,7 +1515,7 @@ class destination_delivery {
|
|
|
) r ON true
|
|
) r ON true
|
|
|
order by md.eta desc,md.h_bol asc
|
|
order by md.eta desc,md.h_bol asc
|
|
|
)
|
|
)
|
|
|
- select * from shipment_table";
|
|
|
|
|
|
|
+ select * from shipment_table where ".$recommended_delivery_sql;
|
|
|
|
|
|
|
|
$rs = common::excuteListSql($sql);
|
|
$rs = common::excuteListSql($sql);
|
|
|
error_log($sql);
|
|
error_log($sql);
|
|
@@ -1743,6 +1763,139 @@ class destination_delivery {
|
|
|
}
|
|
}
|
|
|
return array("msg"=>"","result"=>$result);
|
|
return array("msg"=>"","result"=>$result);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 批量选着文件下载 CI & P
|
|
|
|
|
+ */
|
|
|
|
|
+ private function _batch_download_ci_p_file(){
|
|
|
|
|
+ //ocean的相关配置参数
|
|
|
|
|
+ $OutFileURL = common::excuteOneSql("select item_value from config where item='OutFileURL'");
|
|
|
|
|
+ $ocean_can_view_file = common::excuteOneSql("select ocean_can_view_file from ra_online_user where user_login='".$_SESSION['ONLINE_USER']['user_login']."'");
|
|
|
|
|
+ //$ocean_can_view_file = '{"HBL":[{"type":"TELEX","value":""}],"MBL":[{"type":"TELEX","value":""}]}';
|
|
|
|
|
+ $tar = json_decode($ocean_can_view_file,true);
|
|
|
|
|
+ $sqlFiterWhere = "1<>1 ";
|
|
|
|
|
+ foreach($tar as $_tar){
|
|
|
|
|
+ foreach($_tar as $dkey => $dvalue){
|
|
|
|
|
+ $sqlFiterWhere.= " or (lower(format_serailno) in ('".strtolower(str_replace(";","','",$dvalue['value']))."')
|
|
|
|
|
+ and upper((string_to_array((string_to_array(file_name,'.'))[1], '_'))[2]) = '".$dvalue['type']."')";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //air的相关配置参数
|
|
|
|
|
+ $air_can_view_file = common::excuteOneSql("select air_can_view_file from ra_online_user where lower(user_login)='".strtolower($_SESSION['ONLINE_USER']['user_login'])."'");
|
|
|
|
|
+ $air_tar = json_decode($air_can_view_file,true);
|
|
|
|
|
+ $air_sqlFiterWhere = "1<>1 ";
|
|
|
|
|
+ foreach($air_tar as $_air_tar){
|
|
|
|
|
+ foreach($_air_tar as $air_dkey => $air_dvalue){
|
|
|
|
|
+ $air_sqlFiterWhere.= " or (lower(format_serailno) in ('".strtolower(str_replace(";","','",$air_dvalue['value']))."')
|
|
|
|
|
+ and upper((string_to_array((string_to_array(file_name,'.'))[1], '_'))[2]) = '".$air_dvalue['type']."')";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $serial_no_arr = array($_POST['serial_no']);
|
|
|
|
|
+ $file_type = $_POST['file_type'];
|
|
|
|
|
+
|
|
|
|
|
+ $file_arr = array();
|
|
|
|
|
+ foreach($serial_no_arr as $key =>$serial_no){
|
|
|
|
|
+ $ocean = common::excuteObjectSql("select m_bol as _m_bol,
|
|
|
|
|
+ h_bol as _h_bol,
|
|
|
|
|
+ transport_mode,
|
|
|
|
|
+ order_from,
|
|
|
|
|
+ case when transport_mode = 'sea' and order_from = 'public' then (select job_no from public.ocean o where o.serial_no = oo.serial_no)
|
|
|
|
|
+ when transport_mode = 'sea' and order_from = 'sfs' then (select job_no from sfs.ocean o where o.serial_no = oo.serial_no)
|
|
|
|
|
+ else ''::text end as _job_bol
|
|
|
|
|
+ from public.kln_ocean oo where oo.serial_no = '$serial_no'");
|
|
|
|
|
+
|
|
|
|
|
+ $_schemas = $ocean["order_from"];
|
|
|
|
|
+ if ($ocean["transport_mode"] == 'sea'){
|
|
|
|
|
+ //ocean 能看的文件类型
|
|
|
|
|
+ $document = _getViewDocType($_schemas);
|
|
|
|
|
+ $file_serial_nos = array();
|
|
|
|
|
+ foreach ($document as $v) {
|
|
|
|
|
+ $types = $v['serial_no'];
|
|
|
|
|
+ $types = strtolower($types);
|
|
|
|
|
+ $types = explode(";", $types);
|
|
|
|
|
+ foreach ($types as $k => $type) {
|
|
|
|
|
+ $file_serial_nos[] = $type;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $file_serial_nos = utils::implode(';',$file_serial_nos);
|
|
|
|
|
+ $formatSerailnoWhere = "";
|
|
|
|
|
+ if($file_type == 'Packing List'){
|
|
|
|
|
+ $formatSerailnoWhere = " and lower(format_serailno) = '".strtolower('abfee0ffac630983976b336b37624c73')."'";
|
|
|
|
|
+ } else if ($file_type == 'C/I'){
|
|
|
|
|
+ $formatSerailnoWhere = " and lower(format_serailno) = '".strtolower('4f0a5400c6829')."'";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $filefilter = " ('TELEX') ";
|
|
|
|
|
+ $fileSql = "SELECT file_path, file_name from $_schemas.ra_online_doc_upload doc
|
|
|
|
|
+ left join $_schemas.ra_online_file_format ff on ff.serial_no = doc.format_serailno
|
|
|
|
|
+ where (lower(bol) = '" . strtolower($ocean['_m_bol']) . "' or lower(bol) = '" . strtolower($ocean['_h_bol']) . "' or lower(bol) = '".strtolower($ocean['_job_bol'])."' )
|
|
|
|
|
+ and (
|
|
|
|
|
+ (upper(coalesce((string_to_array((string_to_array(file_name,'.'))[1], '_'))[2],'')) not in ".$filefilter.")
|
|
|
|
|
+ or ".$sqlFiterWhere."
|
|
|
|
|
+ ) and lower(format_serailno) " . common::getInNotInSql($file_serial_nos) . " ". $formatSerailnoWhere." order by ff.format_name ASC,doc.id desc";
|
|
|
|
|
+
|
|
|
|
|
+ $rss = common::excuteListSql($fileSql);
|
|
|
|
|
+ foreach ($rss as $rs) {
|
|
|
|
|
+ if ($rs['from_system']=="TOPOCEAN"||$rs['from_system']=="KSMART") {
|
|
|
|
|
+ //这种类型现在没有了
|
|
|
|
|
+ }else {
|
|
|
|
|
+ $file_arr[] = $rs['file_path'] . DS . $rs['file_name'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($ocean["transport_mode"] == 'air'){
|
|
|
|
|
+ //air能看的文件类型
|
|
|
|
|
+ $document = _getAirViewDocType($_schemas);
|
|
|
|
|
+ $file_serial_nos = array();
|
|
|
|
|
+ foreach ($document as $v) {
|
|
|
|
|
+ $types = $v['serial_no'];
|
|
|
|
|
+ $types = strtolower($types);
|
|
|
|
|
+ $types = explode(";", $types);
|
|
|
|
|
+ foreach ($types as $k => $type) {
|
|
|
|
|
+ $file_serial_nos[] = $type;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $file_serial_nos = utils::implode(';',$file_serial_nos);
|
|
|
|
|
+
|
|
|
|
|
+ $formatSerailnoWhere = "";
|
|
|
|
|
+ if($file_type == 'Packing List'){
|
|
|
|
|
+ $formatSerailnoWhere = " and lower(format_serailno) = '".strtolower('abfee0ffac630983976b336b37624c73')."'";
|
|
|
|
|
+ } else if ($file_type == 'C/I'){
|
|
|
|
|
+ $formatSerailnoWhere = " and lower(format_serailno) = '".strtolower('4f0a5400c6829')."'";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $filefilter = " ('TELEX') ";
|
|
|
|
|
+ $fileSql = "SELECT file_path, file_name from $_schemas.air_doc_upload
|
|
|
|
|
+ left join $_schemas.air_file_format ff on ff.serial_no = air_doc_upload.format_serailno
|
|
|
|
|
+ where (lower(bol) = '" . strtolower($ocean['_m_bol']) . "' or lower(bol) = '" . strtolower($ocean['_h_bol']) . "')
|
|
|
|
|
+ and (
|
|
|
|
|
+ (upper(coalesce((string_to_array((string_to_array(file_name,'.'))[1], '_'))[2],'')) not in ".$filefilter.")
|
|
|
|
|
+ or ".$sqlFiterWhere."
|
|
|
|
|
+ ) and lower(format_serailno) " . common::getInNotInSql($file_serial_nos) . " order by ff.format_name ASC,air_doc_upload.id desc";
|
|
|
|
|
+
|
|
|
|
|
+ $rss = common::excuteListSql($fileSql);
|
|
|
|
|
+ foreach ($rss as $rs) {
|
|
|
|
|
+ $file_arr[] = $rs['file_path'] . DS . $rs['file_name'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if($file_type == 'Packing List'){
|
|
|
|
|
+ $zipName = "Packing_List";
|
|
|
|
|
+ } else if ($file_type == 'C/I'){
|
|
|
|
|
+ $zipName = "C/I";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(empty($file_arr)){
|
|
|
|
|
+ $data = array('msg' => 'No file to download','data' => '');
|
|
|
|
|
+ common::echo_json_encode(500, $data);
|
|
|
|
|
+ exit();
|
|
|
|
|
+ }
|
|
|
|
|
+ common::downloadFilesAsSimapleZip($file_arr,$zipName);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
?>
|