|
|
@@ -1179,7 +1179,7 @@ class login {
|
|
|
and a.act_date is not null
|
|
|
order by id desc limit 1) cc on true
|
|
|
LEFT JOIN LATERAL ( SELECT incoterms as incoterms,shippr_uncode,shipper_city,
|
|
|
- consignee_uncode,consignee_city
|
|
|
+ consignee_uncode,consignee_city,fport_of_loading_un,mport_of_discharge_un
|
|
|
FROM online_ocean WHERE online_ocean.serial_no = o.serial_no) oo ON true
|
|
|
LEFT JOIN LATERAL ( SELECT company as cn_company,
|
|
|
address_1 as cn_address_1,
|
|
|
@@ -1220,9 +1220,9 @@ class login {
|
|
|
or lower(po_no) = '" . strtolower($reference_number) . "'
|
|
|
or lower(quote_no) = '" . strtolower($reference_number) . "'
|
|
|
or lower(invoice_no) = '" . strtolower($reference_number) . "'
|
|
|
- or exists (select 1 from oc_container oc where o.serial_no = oc.serial_no and oc.ctnr = '$reference_number'))";
|
|
|
+ or exists (select 1 from oc_container oc where o.serial_no = oc.serial_no and oc.ctnr = '$reference_number')) limit 1";
|
|
|
$ocean_arr = common::excuteListSql($sql);
|
|
|
- error_log($sql);
|
|
|
+
|
|
|
if(empty($ocean_arr)){
|
|
|
$sql = $this->trackingSfsSql($reference_number);
|
|
|
$ocean_arr = common::excuteListSql($sql);
|
|
|
@@ -1237,10 +1237,20 @@ class login {
|
|
|
}
|
|
|
|
|
|
$ocean = $ocean_arr[0];
|
|
|
+ //获取对应uncode 对应的时间
|
|
|
+ $uncodes = $ocean['fport_of_loading_un'].";".$ocean['mport_of_discharge_un'];
|
|
|
+ $codeinfo = common::getCityPortsInfo($uncodes);
|
|
|
+
|
|
|
//处理transportInfo信息数据
|
|
|
$transportInfo = array("Tracking No." =>$ocean['tracking_no'],"status"=>$ocean['new_status'],"mode" => "Ocean Freight",
|
|
|
"origin" =>$ocean['origin_station'],"destination" =>$ocean['destination_station'],
|
|
|
- "etd" =>$ocean['f_etd'],"atd" =>"","eta" =>$ocean['m_eta'],"ata" =>"");
|
|
|
+ "etd" =>$ocean['f_etd'],"atd" =>$ocean['atd'],
|
|
|
+ "etd_timezone" =>$codeinfo[$ocean['fport_of_loading_un']],
|
|
|
+ "atd_timezone" =>$codeinfo[$ocean['fport_of_loading_un']],
|
|
|
+ "eta" =>$ocean['m_eta'],"ata" =>$ocean['ata'],
|
|
|
+ "eta_timezone" =>$codeinfo[$ocean['mport_of_discharge_un']],
|
|
|
+ "ata_timezone" =>$codeinfo[$ocean['mport_of_discharge_un']]);
|
|
|
+ $data['transportInfo'] = $transportInfo;
|
|
|
|
|
|
//处理basicInfo信息数据
|
|
|
$vessel = utils::outDisplayForMerge($ocean['f_vessel'],$ocean['m_vessel']);
|
|
|
@@ -1268,22 +1278,33 @@ class login {
|
|
|
//处理marksAndDescription
|
|
|
$marksAndDescription = array("marks"=>$ocean['marks'],"description"=>$ocean['description']);
|
|
|
|
|
|
- $sql = "SELECT " . column::getInstance()->getSearchSql('Ocean_Container') . " from oc_container where lower(serial_no) = '" . strtolower($ocean['serial_no']) . "'";
|
|
|
+ $sql = "SELECT " . column::getInstance()->getSearchSql('Ocean_Container') . " ,net_lbs from oc_container where lower(serial_no) = '" . strtolower($ocean['serial_no']) . "'";
|
|
|
$rss = common::excuteListSql($sql);
|
|
|
- $quantity_tolal = 0;
|
|
|
- $packages = "CTN";
|
|
|
+
|
|
|
+ $quantity_unit = array();
|
|
|
$g_weight_tolal = 0;
|
|
|
$ch_weight_tolal = 0;
|
|
|
+ $ch_weight_tolal_grs_lbs = 0;
|
|
|
$cbm_tolal = 0;
|
|
|
foreach ($rss as $key => $rs) {
|
|
|
- $quantity_tolal += $rs['qty'];
|
|
|
+ $unit = $rs['unit'];
|
|
|
+ if (array_key_exists($unit, $quantity_unit)) {
|
|
|
+ $quantity_unit[$unit] = $quantity_unit[$unit] + $rs['qty'];
|
|
|
+ } else {
|
|
|
+ $quantity_unit[$unit] = $rs['qty'];
|
|
|
+ }
|
|
|
$g_weight_tolal += $rs['grs_kgs'];
|
|
|
- $ch_weight_tolal += $rs['grs_lbs'];
|
|
|
+ $ch_weight_tolal += $rs['net_lbs'];
|
|
|
+ $ch_weight_tolal_grs_lbs += $rs['grs_lbs'];
|
|
|
$cbm_tolal += $rs['cbm'];
|
|
|
- $packages = " ".$rs['unit'];
|
|
|
}
|
|
|
+ $quantity_tolal = "";
|
|
|
+ foreach($quantity_unit as $uk => $uv){
|
|
|
+ $quantity_tolal.=$uv." ".$uk." ";
|
|
|
+ }
|
|
|
+ $ch_weight_tolal = empty($ch_weight_tolal) ? $ch_weight_tolal_grs_lbs : $ch_weight_tolal;
|
|
|
//Packing 不确定信息
|
|
|
- $packing = array("Quantity/Unit"=>$quantity_tolal.$packages,"G. Weight" => $g_weight_tolal." KGS","Ch. Weight" => $ch_weight_tolal." LBS","Volume" => $cbm_tolal." CBM");
|
|
|
+ $packing = array("Quantity/Unit"=>$quantity_tolal,"G. Weight" => $g_weight_tolal." KGS","Ch. Weight" => $ch_weight_tolal." LBS","Volume" => $cbm_tolal." CBM");
|
|
|
|
|
|
//Milestones 数据信息待定
|
|
|
$Milestones = common::getMilestonesInfo($ocean);
|