|
|
@@ -1087,6 +1087,7 @@ class ocean_order {
|
|
|
$sql = "with oo as (SELECT oe.*, order_from as _schemas,serial_no as __serial_no, serial_no,transport_mode,transport_mode_extend,
|
|
|
h_bol as _hbol, isf_bol as _isfbol, consignee_city as _consignee_city,piece_count as _piece_count,
|
|
|
f_vessel as _f_vessel, f_voyage as _f_voyage,
|
|
|
+ COALESCE(oe.import_po_no,po_no) as _po_no,
|
|
|
(select user_login from public.kln_user_subscribed us
|
|
|
where lower(us.user_login) = '".strtolower(_getLoginName())."' and us.subscribed_serial_no = kln_ocean.serial_no) as is_subscribe,
|
|
|
CASE
|
|
|
@@ -1103,24 +1104,18 @@ class ocean_order {
|
|
|
manifest_type,
|
|
|
volume,
|
|
|
last_mile_delivery_date,
|
|
|
- container_size
|
|
|
+ container_size,
|
|
|
+ import_po_no
|
|
|
FROM public.kln_ocean_extend oe WHERE oe.serial_no::text = kln_ocean.serial_no::text and oe.order_from::text = kln_ocean.order_from::text) oe ON true "
|
|
|
. $sqlWhere . " order by $order_by limit " . $ps . " offset " . ($cp - 1) * $ps.")
|
|
|
select oo.* ,
|
|
|
- case when oo.transport_mode ='sea' and oo._schemas ='public'
|
|
|
- then ( SELECT string_agg(ref_code ||ref_value, ', ') AS other_refenrence_no FROM public.ocean_reference temp
|
|
|
- WHERE temp.ref_code <> 'PO'
|
|
|
- AND COALESCE(temp.ref_value,'')<>''
|
|
|
- AND temp.ref_value IS NOT NULL
|
|
|
- AND LENGTH(TRIM(BOTH FROM temp.ref_value)) > 0
|
|
|
- AND temp.serial_no = oo.serial_no)
|
|
|
- when oo.transport_mode ='sea' and oo._schemas ='sfs'
|
|
|
- then ( SELECT string_agg(ref_code ||ref_value, ', ') AS other_refenrence_no FROM sfs.ocean_reference temp
|
|
|
- WHERE temp.ref_code <> 'PO'
|
|
|
- AND COALESCE(temp.ref_value,'')<>''
|
|
|
- AND temp.ref_value IS NOT NULL
|
|
|
- AND LENGTH(TRIM(BOTH FROM temp.ref_value)) > 0
|
|
|
- AND temp.serial_no = oo.serial_no)
|
|
|
+ case when oo.transport_mode ='sea'
|
|
|
+ then ( SELECT string_agg(code ||value, ', ') AS other_refenrence_no FROM public.reference_all temp
|
|
|
+ WHERE temp.code <> 'PO'
|
|
|
+ AND COALESCE(temp.value,'')<>''
|
|
|
+ AND temp.value IS NOT NULL
|
|
|
+ AND LENGTH(TRIM(BOTH FROM temp.value)) > 0
|
|
|
+ AND temp.serial_no = oo.serial_no group by code,value)
|
|
|
when oo.transport_mode ='air'
|
|
|
then ''
|
|
|
else ''
|
|
|
@@ -1130,6 +1125,7 @@ class ocean_order {
|
|
|
$tmp_search_without_limit = "with oo as (SELECT oe.*, order_from as _schemas,serial_no as __serial_no, serial_no,transport_mode,transport_mode_extend,
|
|
|
h_bol as _hbol, isf_bol as _isfbol, consignee_city as _consignee_city,piece_count as _piece_count,
|
|
|
f_vessel as _f_vessel, f_voyage as _f_voyage,
|
|
|
+ COALESCE(oe.import_po_no,po_no) as _po_no,
|
|
|
(select user_login from public.kln_user_subscribed us
|
|
|
where lower(us.user_login) = '".strtolower(_getLoginName())."' and us.subscribed_serial_no = kln_ocean.serial_no) as is_subscribe,
|
|
|
CASE
|
|
|
@@ -1146,24 +1142,18 @@ class ocean_order {
|
|
|
manifest_type,
|
|
|
volume,
|
|
|
last_mile_delivery_date,
|
|
|
- container_size
|
|
|
+ container_size,
|
|
|
+ import_po_no
|
|
|
FROM public.kln_ocean_extend oe WHERE oe.serial_no::text = kln_ocean.serial_no::text and oe.order_from::text = kln_ocean.order_from::text) oe ON true "
|
|
|
. $sqlWhere . " order by $order_by)
|
|
|
select oo.* ,
|
|
|
- case when oo.transport_mode ='sea' and oo._schemas ='public'
|
|
|
- then ( SELECT string_agg(ref_code ||ref_value, ', ') AS other_refenrence_no FROM public.ocean_reference temp
|
|
|
- WHERE temp.ref_code <> 'PO'
|
|
|
- AND COALESCE(temp.ref_value,'')<>''
|
|
|
- AND temp.ref_value IS NOT NULL
|
|
|
- AND LENGTH(TRIM(BOTH FROM temp.ref_value)) > 0
|
|
|
- AND temp.serial_no = oo.serial_no)
|
|
|
- when oo.transport_mode ='sea' and oo._schemas ='sfs'
|
|
|
- then ( SELECT string_agg(ref_code ||ref_value, ', ') AS other_refenrence_no FROM sfs.ocean_reference temp
|
|
|
- WHERE temp.ref_code <> 'PO'
|
|
|
- AND COALESCE(temp.ref_value,'')<>''
|
|
|
- AND temp.ref_value IS NOT NULL
|
|
|
- AND LENGTH(TRIM(BOTH FROM temp.ref_value)) > 0
|
|
|
- AND temp.serial_no = oo.serial_no)
|
|
|
+ case when oo.transport_mode ='sea'
|
|
|
+ then ( SELECT string_agg(code ||value, ', ') AS other_refenrence_no FROM public.reference_all temp
|
|
|
+ WHERE temp.code <> 'PO'
|
|
|
+ AND COALESCE(temp.value,'')<>''
|
|
|
+ AND temp.value IS NOT NULL
|
|
|
+ AND LENGTH(TRIM(BOTH FROM temp.value)) > 0
|
|
|
+ AND temp.serial_no = oo.serial_no group by code,value)
|
|
|
when oo.transport_mode ='air'
|
|
|
then ''
|
|
|
else ''
|
|
|
@@ -1184,7 +1174,10 @@ class ocean_order {
|
|
|
($val['transport_mode_extend'] == 'road' ? "Road Freight": "")));
|
|
|
|
|
|
$rs[$index]["Vessel/Airline"] = utils::outDisplayForMerge($val['_f_vessel'],$val['Vessel/Airline']);
|
|
|
- $rs[$index]["Voyage/Flight"] = utils::outDisplayForMerge($val['_f_voyage'],$val['Voyage/Flight']);
|
|
|
+ $rs[$index]["Voyage/Flight"] = utils::outDisplayForMerge($val['_f_voyage'],$val['Voyage/Flight']);
|
|
|
+
|
|
|
+ //po_no 处理 有import 显示import
|
|
|
+ $rs[$index]["PO No."] = $rs[$index]["_po_no"];
|
|
|
|
|
|
//status 改为ocean_milestone里的信息
|
|
|
$rs[$index]["Status"] = $rs[$index]["new_status"];
|
|
|
@@ -1305,14 +1298,14 @@ class ocean_order {
|
|
|
if(!empty($ocean['_invoice_no'])){
|
|
|
$ref_no[] = array("label"=>"Invoice No.","value"=>$ocean['_invoice_no']);
|
|
|
}
|
|
|
- $ref_arr = common::excuteListSql("select * from ocean_reference where ref_code <> 'PO'
|
|
|
- and COALESCE(ref_value,'')<>''
|
|
|
- AND ref_value IS NOT NULL
|
|
|
- AND LENGTH(TRIM(BOTH FROM ref_value)) > 0
|
|
|
- and lower(serial_no) = '" . strtolower($serial_no) . "'");
|
|
|
+ $ref_arr = common::excuteListSql("select code,value from public.reference_all where code <> 'PO'
|
|
|
+ and COALESCE(value,'')<>''
|
|
|
+ AND value IS NOT NULL
|
|
|
+ AND LENGTH(TRIM(BOTH FROM value)) > 0
|
|
|
+ and lower(serial_no) = '" . strtolower($serial_no) . "' group by code,value");
|
|
|
if(!empty($ref_arr)){
|
|
|
foreach($ref_arr as $ref) {
|
|
|
- $ref_no[] = array("label"=>$ref["ref_code"],"value"=>$ref["ref_value"]);
|
|
|
+ $ref_no[] = array("label"=>$ref["code"],"value"=>$ref["value"]);
|
|
|
}
|
|
|
}
|
|
|
//处理Container :配置Ocean_Container字段 UI 需要的字段有:Container.no Packing,quantity,Gross weight(kg),Gross weight(LB),CBM,seal#,size.service
|
|
|
@@ -1705,6 +1698,9 @@ class ocean_order {
|
|
|
|
|
|
//status 改为ocean_milestone里的信息
|
|
|
$rs[$index]["Status"] = $rs[$index]["new_status"];
|
|
|
+
|
|
|
+ //po_no 处理 有import 显示import
|
|
|
+ $rs[$index]["PO No."] = $rs[$index]["_po_no"];
|
|
|
}
|
|
|
common::echo_json_encode(200,array("msg"=>"success","Data" => $rs));
|
|
|
exit;
|
|
|
@@ -2219,7 +2215,8 @@ class ocean_order {
|
|
|
SELECT o.* from $order_from.ocean o where serial_no = '" . $serial_no . "'
|
|
|
)
|
|
|
SELECT m_eta as _m_eta, h_bol as _h_bol, m_bol as _m_bol,job_no as _job_bol,
|
|
|
- o.* ,sh.*, cn.* ,aa.*,dd.*,fd.*,oo.*,koe.loadterm
|
|
|
+ o.* ,sh.*, cn.* ,aa.*,dd.*,fd.*,oo.*,koe.loadterm,
|
|
|
+ COALESCE(koe.import_po_no,oo.po_no) as _po_no
|
|
|
from o
|
|
|
LEFT JOIN LATERAL ( SELECT tracking_no as _tracking_no,shippr_uncode,shipper_city,
|
|
|
consignee_uncode,consignee_city,incoterms,
|
|
|
@@ -2244,7 +2241,6 @@ class ocean_order {
|
|
|
(select uncity from $order_from.ports where uncode = oo.place_of_delivery_un limit 1) as pod_uncity,
|
|
|
(select time_zone from public.city_timezone where uncode = oo.final_desination_uncode limit 1) as _fd_timezone,
|
|
|
(select uncity from $order_from.ports where uncode = oo.final_desination_uncode limit 1) as _pd_uncity,
|
|
|
- po_no as _po_no,
|
|
|
invoice_no as _invoice_no,
|
|
|
CASE
|
|
|
WHEN ((m_iffbcf is not null or m_iffbcf is null) and m_iffcpu is null and m_iffrec is null and m_iffdep is null and m_iffarr is null and m_iffdel is null) THEN 'Created'::text
|