ocean_booking.class.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <?php
  2. if (!defined('IN_ONLINE')) {
  3. exit('Access Denied');
  4. }
  5. /**
  6. * Description of ocean
  7. *
  8. * @author Administrator
  9. */
  10. class ocean_booking {
  11. private static $_ocean;
  12. function __construct() {
  13. }
  14. public static function getInstance() {
  15. global $memory_limit;
  16. $memory_limit = ini_get("memory_limit");
  17. ini_set("memory_limit", '2048M');
  18. if (!self::$_ocean) {
  19. $c = __CLASS__;
  20. self::$_ocean = new $c;
  21. }
  22. return self::$_ocean;
  23. }
  24. public function ocean_booking() {
  25. $operate = utils::_get('operate');
  26. $operate = strtolower($operate);
  27. /*
  28. * index page
  29. */
  30. if (empty($operate)) {
  31. $data = array();
  32. if (_isCustomerLogin())
  33. $data['is_customer'] = "yes";
  34. else
  35. $data['is_customer'] = "no";
  36. //栏位信息
  37. $column = column::getInstance()->getDisplayColumn('Booking_Search');
  38. $BookingTableColumns = column::getInstance()->tableColumns('Booking_Search',$column);
  39. $data['BookingTableColumns'] = $BookingTableColumns;
  40. common::echo_json_encode(200,$data);
  41. exit();
  42. }
  43. /*
  44. * ocean order search
  45. */
  46. if ($operate == "search") {
  47. $this->_booking_search();
  48. }
  49. if ($operate == "setting_display") {
  50. column::getInstance()->settingDisplay('Booking_Search', 'main_new_version.php?action=ocean_booking');
  51. }
  52. if ($operate == "detail") {
  53. $this->_booking_detail();
  54. }
  55. if ($operate == "excel") {
  56. $this->_booking_excel();
  57. }
  58. if ($operate == "save_communication") {
  59. try {
  60. $content = $_POST["content"];
  61. $content = common::check_input($content);
  62. $text = $_POST["text"];
  63. $content = urldecode($content);
  64. $web_content = urldecode($text);
  65. $communication_cc = $_POST["communication_cc"];
  66. $serial_no = common::uuid();
  67. $email_uuid = $_POST["serial_no"];
  68. $add_by = _getLoginName();
  69. $refer_id = 0;
  70. $email = $this->getEmail($email_uuid);
  71. $from_email = "US.KApex.Online@kerryapex.com";
  72. $to_email = $email["email"];
  73. $cc_email = $_SESSION['ONLINE_USER']['email'] . ";ApexOnlineCommunication@apexshipping.com";
  74. $communication_cc = trim($communication_cc);
  75. if (!empty($communication_cc)) {
  76. $communication_cc = common::check_input($communication_cc);
  77. $cc_email .= ";" . $communication_cc;
  78. }
  79. $user_from = _getLoginName();
  80. $user_to = $email["name"];
  81. $user_cc = $_SESSION['ONLINE_USER']['first_name'];
  82. if (empty($user_cc)) {
  83. $user_cc = _getLoginName();
  84. }
  85. $user_cc .= ";ApexOnlineCommunication";
  86. //邮件发送
  87. $poKey = "<br><br>Important note: when you reply this email, do not remove ApexOnlineCommunication@apexshipping.com<br>Below is system code, do not delete.<br>@@";
  88. $emailSql = "select encode(public.pgp_sym_encrypt('" . $serial_no . "','pom_key'), 'base64')::text;";
  89. $key = common::excuteOneSql($emailSql);
  90. $historyEmails = "";
  91. $title = "Communication from " . _getLoginName() . ", HBOL: " . $email["h_bol"] . ", Consignee: " . $email["consignee"];
  92. $emailContent = $content . $poKey . $key . ";" . "@@<br>For your convenience weblink: https://ra.kerryapex.com/<br><br>" . $historyEmails;
  93. common::excuteUpdateSql("insert into public.email_record (type,title,from_email,to_email,cc_email,content,insert_date)values('Communication','$title','$from_email','$to_email','$cc_email','$emailContent',now());");
  94. $rs = common::excuteUpdateSql("INSERT INTO public.online_ocean_communication(serial_no, email_uuid, content,web_content,user_from, user_to, user_cc, refer_id, add_by, add_time, cc_email)
  95. VALUES ('$serial_no', '$email_uuid', '$emailContent','$web_content', '$user_from', '$to_email', '$cc_email', $refer_id, '$add_by', now(), '$communication_cc');");
  96. $emailRecords = $this->getCommunicationNew($email_uuid);
  97. common::echo_json_encode(200,array("msg" => "Sent Successfully", "emailRecords" => $emailRecords));
  98. exit();
  99. } catch (Exception $e) {
  100. common::echo_json_encode(500,array("msg" => "Sent Error."));
  101. exit();
  102. }
  103. }
  104. }
  105. private function _booking_search() {
  106. $cp = common::check_input($_POST ['cp']); //current_page
  107. $ps = common::check_input($_POST ['ps']); //ps
  108. if (empty($ps)){
  109. $ps = 50;
  110. }
  111. $sqlWhere = ' where ' . common::searchExtendHandNew("booking", $_SESSION["ONLINE_USER"]);
  112. $sqlWhere .= search::getInstance()->getSearchSQL("Booking_Search");
  113. //前端提交是数组
  114. if (!empty($_POST['filterTag']) && utils::count($_POST['filterTag']) < 4) {
  115. if (utils::count($_POST['filterTag']) == 1){
  116. $filterTag = $_POST['filterTag'][0];
  117. }else{
  118. $filterTag = utils::implode(",", $_POST['filterTag']);
  119. }
  120. $_sqlwhere = "1<>1";
  121. if (stripos($filterTag, "Confirmed") !== FALSE) {
  122. $_sqlwhere .= " or (bol_type = 'BOOKING' and status!='Cancelled')";
  123. }
  124. if (stripos($filterTag, "type2") !== FALSE) {
  125. $_sqlwhere .= " or (bol_type != 'BOOKING' and booking_no is not null and booking_no <> '')";
  126. }
  127. if (stripos($filterTag, "Cancelled") !== FALSE) {
  128. $_sqlwhere .= " or (status='Cancelled')";
  129. }
  130. if (stripos($filterTag, "Created") !== FALSE) {
  131. $_sqlwhere .= " or (bol_type != 'BOOKING' and (booking_no is null or booking_no = ''))";
  132. }
  133. if(strtolower($filterTag) <> "all" && !empty($filterTag)){
  134. $sqlWhere .= " and ($_sqlwhere)";
  135. }
  136. }
  137. //移除掉全文检索 但保留代码
  138. // if (!empty($_POST["_textSearch"])) {
  139. // $sqlWhere .= " and text_search @@ (str_to_tsquery('" . common::check_input($_POST["_textSearch"]) . "'))";
  140. // }
  141. //处理reference类型的组合查询 Search booking No./HBL No./PO No./Carrier Booking No.
  142. if (!empty($_POST["_textSearch"])) {
  143. $textSearch_arr = $_POST['_textSearch'];
  144. if(!is_array($textSearch_arr)){
  145. $textSearch_arr = array($textSearch_arr);
  146. }
  147. $more_sql = "1<>1";
  148. foreach($textSearch_arr as $tsv){
  149. $more_sql .= " or booking_no ilike '%" . common::check_input(trim($tsv)) . "%'";
  150. $more_sql .= " or h_bol ilike '%" . common::check_input(trim($tsv)) . "%'";
  151. $more_sql .= " or po_no ilike '%" . common::check_input(trim($tsv)) . "%'";
  152. $more_sql .= " or carrier_booking ilike '%" . common::check_input(trim($tsv)) . "%'";
  153. }
  154. if ($more_sql <> "1<>1"){
  155. $sqlWhere .= " and ($more_sql)";
  156. }
  157. }
  158. $rc = $_POST ['rc'];
  159. //这里都要查询,除非多传几个参数回来
  160. if ($rc == - 1 || true) {
  161. //查询ALL
  162. $sql = "SELECT count(1) from public.online_booking" . $sqlWhere;
  163. $rc = common::excuteOneSql($sql);
  164. error_log("online_booking_count_ALL_SQL: ".$sql);
  165. //查询Creatd
  166. $Creatd_sqlWhere = " and (1<>1 or (bol_type != 'BOOKING' and (booking_no is null or booking_no = '')))";
  167. $Creatd_sql = "SELECT count(1) from public.online_booking" . $sqlWhere.$Creatd_sqlWhere;
  168. $Creatd = common::excuteOneSql($Creatd_sql);
  169. error_log("online_booking_count_Creatd_SQL: ".$sql);
  170. //查询Confirmed
  171. $Confirmed_sqlWhere = " and (1<>1 or (bol_type = 'BOOKING' and status!='Cancelled'))";
  172. $Confirmed_sql = "SELECT count(1) from public.online_booking" . $sqlWhere.$Confirmed_sqlWhere;
  173. $Confirmed = common::excuteOneSql($Confirmed_sql);
  174. error_log("online_booking_count_Confirmed_SQL: ".$sql);
  175. //查询Concelled
  176. $Concelled_sqlWhere = " and (1<>1 or (status='Cancelled'))";
  177. $Concelled_sql = "SELECT count(1) from public.online_booking" . $sqlWhere.$Concelled_sqlWhere;
  178. $Concelled = common::excuteOneSql($Concelled_sql);
  179. error_log("online_booking_count_Concelled_SQL: ".$sql);
  180. //前端数据返回,不管有无数据
  181. if (!empty($_POST["filterTag"])) {
  182. $tagsList = array(array("name"=>"All","number"=>$rc,"type"=>"all","checked"=>utils::in_array('All', $_POST["filterTag"])? true : false),
  183. array("name"=>"Created","number"=>$Creatd,"type"=>"created","checked"=>utils::in_array('Created', $_POST["filterTag"])? true : false),
  184. array("name"=>"Confirmed","number"=>$Confirmed,"type"=>"confirmed","checked"=>utils::in_array('Confirmed', $_POST["filterTag"])? true : false),
  185. array("name"=>"Cancelled","number"=>$Concelled,"type"=>"cancelled","checked"=>utils::in_array('Cancelled', $_POST["filterTag"])? true : false));
  186. }else{
  187. //初始,前端有选择着带入选择
  188. $tagsList = array(array("name"=>"All","number"=>$rc,"type"=>"all","checked"=>true),
  189. array("name"=>"Created","number"=>$Creatd,"type"=>"created","checked"=>false),
  190. array("name"=>"Confirmed","number"=>$Confirmed,"type"=>"confirmed","checked"=>false),
  191. array("name"=>"Cancelled","number"=>$Concelled,"type"=>"cancelled","checked"=>false));
  192. }
  193. $TransportList = array(
  194. array("name"=>"Ocean Freight","number"=>$rc,"checked"=>false,"icon"=>"#icon-icon_ocean_b"));
  195. //现在下载交给前端,后台预先只返回全部字段的列,
  196. $allColumn = column::getInstance()->getDisplayColumnAllReomveDefault('Booking_Search');
  197. $allBookingColumns = column::getInstance()->tableColumns('Booking_Search',$allColumn);
  198. }
  199. $tp = ceil($rc / $ps);
  200. if ($rc > 0 ) {
  201. $order_by = " f_etd desc NULLS LAST, id";
  202. //TopOcean的不用考虑
  203. $ocean_dest_sql = "";
  204. //合并显示两个特殊字段 voyage_m_voyage/vessel_m_vessel
  205. if (!empty($_POST["_textSearch"])) {
  206. $sql = "SELECT order_from as _schemas, serial_no as __serial_no, created_time as __created_time, color,
  207. m_voyage as __m_voyage,m_vessel as __m_vessel," .
  208. column::getInstance()->getSearchSqlForDisplay('Booking_Search') . " from public.online_booking $ocean_dest_sql " . $sqlWhere . " "
  209. . "order by $order_by limit " . $ps . " offset " . ($cp - 1) * $ps;
  210. } else {
  211. $sql = "SELECT order_from as _schemas, serial_no as __serial_no, created_time as __created_time, color,
  212. f_voyage as __f_voyage, m_voyage as __m_voyage,f_vessel as __f_vessel, m_vessel as __m_vessel," .
  213. column::getInstance()->getSearchSqlForDisplay('Booking_Search') . " from public.online_booking $ocean_dest_sql " . $sqlWhere . " order by $order_by limit " . $ps . " offset " . ($cp - 1) * $ps;
  214. }
  215. $rs = common::excuteListSql($sql);
  216. error_log("online_booking_search_SQL: ".$sql);
  217. //对查询的结果做特殊处理,比如要拼接某个值,合并值等
  218. foreach($rs as $index => $val) {
  219. //合并显示 vessel
  220. if(array_key_exists("f_vessel", $val)){
  221. $rs[$index]["f_vessel"] = utils::outDisplayForMerge($val['f_vessel'],$val['__m_vessel']);
  222. }
  223. //合并显示 voyage
  224. if(array_key_exists("f_voyage", $val)){
  225. $rs[$index]["f_voyage"] = utils::outDisplayForMerge($val['f_voyage'],$val['__m_voyage']);
  226. }
  227. //返回加密serial_no
  228. $rs[$index]["__serial_no"] = common::deCode($val['__serial_no'], 'E');
  229. //按新逻辑处理status,现在是管理员权限,客户权限少了一种状态,先设置默认值防止出错
  230. $status = "Created";
  231. if(!($val['color'] == "FFFF0000" || $val['color'] == "FF00FF00" || $val['color'] == "FF0000FF")){
  232. $status = "Confirmed";
  233. }
  234. if ($val['color'] == "FF0000FF"){
  235. $status = "Created";
  236. }
  237. if ($val['color'] == "FFFF0000"){
  238. $status = "Cancelled";
  239. }
  240. $rs[$index]["Status"] = $status;
  241. $rs[$index]["Transportation Mode"] = "Ocean Freight";
  242. }
  243. $arrTmp = array('searchData' => $rs,
  244. 'tagsList' => $tagsList,
  245. 'TransportList' => $TransportList,
  246. 'allColums' => $allBookingColumns,
  247. 'rc' => $rc,
  248. 'ps' => $ps,
  249. 'cp' => $cp,
  250. 'tp' => $tp,
  251. 'tmp_search' => common::deCode($sql, 'E'),
  252. 'type' => common::check_input($_POST ['_ntype']));
  253. } else {
  254. $arrTmp = array('searchData' => array(),
  255. 'tagsList' => $tagsList,
  256. 'TransportList' => $TransportList,
  257. 'allColums' => $allBookingColumns,
  258. 'rc' => $rc,
  259. 'ps' => $ps,
  260. 'cp' => $cp,
  261. 'tp' => $tp,
  262. 'tmp_search' => "",
  263. 'type' => common::check_input($_POST ['_ntype']));
  264. }
  265. common::echo_json_encode(200,$arrTmp);
  266. exit();
  267. }
  268. private function _booking_detail() {
  269. $serial_no = common::deCode($_GET['a'], 'D');
  270. $status = $_GET['status'];
  271. $_schemas = $_GET['_schemas'];
  272. if($_schemas == 'public'){
  273. $_schemas = "ocean";
  274. }
  275. $sql = "SELECT o.serial_no, o.booking_no as _booking_no, o.* ,sh.*, cn.* ,aa.*,dd.* from ocean o
  276. LEFT JOIN LATERAL ( SELECT company as cn_company,
  277. address_1 as cn_address_1,
  278. address_2 as cn_address_2,
  279. address_3 as cn_address_3,
  280. address_4 as cn_address_4,
  281. city as cn_city, state as cn_state, zipcode as cn_zipcode, country as cn_country,
  282. phone_1 as cn_phone
  283. FROM $_schemas.contacts c WHERE o.consignee::text = c.contact_id::text) cn ON true
  284. LEFT JOIN LATERAL ( SELECT company as sh_company,
  285. address_1 as sh_address_1,
  286. address_2 as sh_address_2,
  287. address_3 as sh_address_3,
  288. address_4 as sh_address_4,
  289. city as sh_city, state as sh_state, zipcode as sh_zipcode, country as sh_country,
  290. phone_1 as sh_phone
  291. FROM $_schemas.contacts c WHERE o.shipper::text = c.contact_id::text) sh ON true
  292. LEFT JOIN LATERAL ( SELECT company as aa_company,
  293. address_1 as aa_address_1,
  294. address_2 as aa_address_2,
  295. address_3 as aa_address_3,
  296. address_4 as aa_address_4,
  297. city as aa_city, state as aa_state, zipcode as aa_zipcode, country as aa_country,
  298. phone_1 as aa_phone
  299. FROM $_schemas.contacts c WHERE o.origin_station::text = c.contact_id::text) aa ON true
  300. LEFT JOIN LATERAL ( SELECT company as dd_company,
  301. address_1 as dd_address_1,
  302. address_2 as dd_address_2,
  303. address_3 as dd_address_3,
  304. address_4 as dd_address_4,
  305. city as dd_city, state as dd_state, zipcode as dd_zipcode, country as dd_country,
  306. phone_1 as dd_phone
  307. FROM $_schemas.contacts c WHERE o.destination_station::text = c.contact_id::text) dd ON true
  308. where lower(serial_no) = '" . strtolower($serial_no) . "'";
  309. $ocean = common::excuteObjectSql($sql);
  310. $vueData = $this->returnBookingDetailData($ocean,$status);
  311. //处理transportInfo信息数据
  312. $transportInfo = $vueData["transportInfo"];
  313. //处理basicInfo信息数据
  314. $basicInfo = $vueData["basicInfo"];
  315. //处理 拼接地址 ocean表单exp 字段无法精准分割电话和地址信息,只能从contacts表里查询
  316. $businessPartners = $vueData["businessPartners"];
  317. $marksAndDescription = $vueData["marksAndDescription"];
  318. //处理ocean_reference
  319. $ref_no = array();
  320. $ref_arr = common::excuteListSql("select * from ocean_reference where lower(serial_no) = '" . strtolower($serial_no) . "'");
  321. if(!empty($ref_arr)){
  322. foreach($ref_arr as $ref) {
  323. $ref_no[] = array("label"=>$ref["ref_code"],"value"=>$ref["ref_value"]);
  324. }
  325. }
  326. //处理返回booking的 Container 信息数据
  327. $booking_container_column = array();
  328. $container_column = column::getInstance()->getDisplayColumnAll('Booking_Container');
  329. foreach($container_column as $cc){
  330. $booking_container_column[] =array("field" =>$cc['database_column_name'],"title" =>$cc['name'],"formatter" =>"","type" =>"normal");
  331. }
  332. if (!empty($ocean['_booking_no'])) {
  333. $sql = "SELECT " . column::getInstance()->getSearchSql('Booking_Container') . " from ocean_booking_container where lower(serial_no) = '" . strtolower($serial_no) . "'";
  334. $rss = common::excuteListSql($sql);
  335. } else {
  336. $sql = "SELECT " . column::getInstance()->getSearchSql('Booking_Container') . " from oc_container_booking_v where lower(serial_no) = '" . strtolower($serial_no) . "'";
  337. $rss = common::excuteListSql($sql);
  338. }
  339. $containers = array("container_column"=>$booking_container_column,"container_data" =>$rss);
  340. //packing
  341. $quantity_tolal = 0;
  342. $packages = "CTN";
  343. $g_weight_tolal = 0;
  344. $ch_weight_tolal = 0;
  345. $cbm_tolal = 0;
  346. foreach($rss as $pk => $pv){
  347. $quantity_tolal += $pv['qty'];
  348. $g_weight_tolal += $pv['kgs'];
  349. $ch_weight_tolal += $pv['kgs'];
  350. $cbm_tolal += $pv['cbm'];
  351. $packages = " ".$pv['unit'];
  352. }
  353. //$packing = array("Quantity/Unit"=>"47 CTN","G. Weight" => "480.25 KGS","Ch. Weight" => "689.26 KGS","Volume" => "3.801 CBM");
  354. $packing = array("Quantity/Unit"=>$quantity_tolal.$packages,"G. Weight" => $g_weight_tolal." KGS","Ch. Weight" => $ch_weight_tolal." LBS","Volume" => $cbm_tolal." CBM");
  355. //处理邮件信息返回
  356. $emailRecords = $this->getCommunicationNew($ocean["serial_no"]);
  357. $cc_email = common::excuteOneSql("select cc_email from public.online_ocean_communication where email_uuid='" . $ocean["serial_no"] . "' order by id desc limit 1");
  358. $email = $this->getEmail($ocean["serial_no"]);
  359. $email['cc_email'] = $cc_email;
  360. $email['emailRecords'] = $emailRecords;
  361. global $_COPYRIGHT;
  362. $data = array('transportInfo' => $transportInfo,
  363. 'basicInfo' => $basicInfo,
  364. 'businessPartners' => $businessPartners,
  365. 'ref_no' => $ref_no,
  366. 'packing' => $packing,
  367. 'marksAndDescription' => $marksAndDescription,
  368. 'containers' => $containers,
  369. 'email' => $email,
  370. 'serial_no' => $serial_no,
  371. '_schemas' => $_GET['_schemas'],
  372. '__serial_no' => common::deCode($ocean['serial_no'], 'E'),
  373. 'copyright' =>$_COPYRIGHT);
  374. common::echo_json_encode(200,$data);
  375. exit();
  376. }
  377. private function _booking_excel() {
  378. //现在下载交给前端,后台最后只返回全部字段的列,
  379. $allColumn = column::getInstance()->getDisplayColumnAll('Booking_Search');
  380. $allBookingColumns = column::getInstance()->tableColumns('Booking_Search',$allColumn);
  381. common::echo_json_encode(200,array("msg"=>"success","allColums" => $allBookingColumns));
  382. exit;
  383. }
  384. private function getEmail($serial_no) {
  385. return utils::getEmail($serial_no);
  386. }
  387. private function getCommunicationNew($serial_no) {
  388. $list = common::excuteListSql("select to_char(add_time, 'MM/dd/yyyy hh24:MI:ss') as add_times, * from public.online_ocean_communication where email_uuid='$serial_no' and refer_id = 0 order by id");
  389. $emialRecords =array();
  390. foreach ($list as $k => $v) {
  391. $msg =array();
  392. $msg["name"] = $v["add_by"];
  393. $msg["creatTime"] = $v["add_times"];
  394. $msg["content"] = urldecode($v["web_content"]);
  395. $emialRecords[] = $msg;
  396. }
  397. return $emialRecords;
  398. }
  399. private function retStationInfo($address_1,$address_2,$address_3,$address_4,$city,$state,$country,$zipcode){
  400. $stationInfo = "";
  401. if(!empty($address_1)){
  402. $stationInfo .= $address_1;
  403. }
  404. if(!empty($address_2)){
  405. $stationInfo .= " ".$address_2;
  406. }
  407. if(!empty($address_3)){
  408. $stationInfo .= " ".$address_3;
  409. }
  410. if(!empty($address_4)){
  411. $stationInfo .= " ".$address_4;
  412. }
  413. $temp_str = "";
  414. if(!empty($city)){
  415. $temp_str .= $city." ";
  416. }
  417. if(!empty($state)){
  418. $temp_str .= $state." ";
  419. }
  420. if(!empty($zipcode)){
  421. $temp_str .= $zipcode." ";
  422. }
  423. if(!empty($country)){
  424. $temp_str .= $country." ";
  425. }
  426. if(!empty($temp_str)){
  427. return $stationInfo." ".trim($temp_str);
  428. }
  429. return $stationInfo;
  430. }
  431. private function returnBookingDetailData($ocean,$status){
  432. $data = array();
  433. //处理transportInfo信息数据
  434. $transportInfo = array("bookingNo." =>$ocean['booking_no'],"status"=>$status,"mode" => "","origin" =>$ocean['origin_station'],"destination" =>$ocean['destination_station'],
  435. "etd" =>$ocean['f_etd'],"atd" =>"","eta" =>$ocean['m_eta'],"ata" =>"");
  436. $data["transportInfo"] = $transportInfo;
  437. //处理basicInfo信息数据
  438. $vessel = utils::outDisplayForMerge($ocean['f_vessel'],$ocean['m_vessel']);
  439. $voyage = utils::outDisplayForMerge($ocean['f_voyage'],$ocean['m_voyage']);
  440. $basicInfo = array("bookingNo." =>$ocean['booking_no'],"HAWB/HBOL" => $ocean['h_bol'],"Carrier_Booking_No" =>$ocean['carrier_booking'],
  441. "PO_NO" =>$ocean['po_no'],"Vessel/Airline" =>$vessel,"Voyage/Filght" =>$voyage,
  442. "Incoterm" =>$ocean['incoterms'],"Service_Type" =>$ocean['service']);
  443. $data["basicInfo"] = $basicInfo;
  444. //处理 拼接地址 ocean表单exp 字段无法精准分割电话和地址信息,只能从contacts表里查询
  445. $shipper_address = common::retStationInfo($ocean['sh_address_1'], $ocean['sh_address_2'], $ocean['sh_address_3'], $ocean['sh_address_4'],
  446. $ocean['sh_city'], $ocean['sh_state'], $ocean['sh_zipcode'], $ocean['sh_country']);
  447. $consignee_address = common::retStationInfo($ocean['cn_address_1'], $ocean['cn_address_2'], $ocean['cn_address_3'], $ocean['cn_address_4'],
  448. $ocean['cn_city'], $ocean['cn_state'], $ocean['cn_zipcode'], $ocean['cn_country']);
  449. $origin_address = common::retStationInfo($ocean['aa_address_1'], $ocean['aa_address_2'], $ocean['aa_address_3'], $ocean['aa_address_4'],
  450. $ocean['aa_city'], $ocean['aa_state'], $ocean['aa_zipcode'], $ocean['aa_country']);
  451. $destination_address = common::retStationInfo($ocean['dd_address_1'], $ocean['dd_address_2'], $ocean['dd_address_3'], $ocean['dd_address_4'],
  452. $ocean['dd_city'], $ocean['dd_state'], $ocean['dd_zipcode'], $ocean['dd_country']);
  453. $shipperPartners = array("company" =>$ocean['sh_company'],"address"=>$shipper_address,"phone"=>$ocean['sh_phone']);
  454. $consigneePartners = array("company" =>$ocean['cn_company'],"address"=>$consignee_address,"phone"=>$ocean['cn_phone']);
  455. $originPartners = array("company" =>$ocean['aa_company'],"address"=>$origin_address,"phone"=>$ocean['aa_phone']);
  456. $destinationPartners = array("company" =>$ocean['dd_company'],"address"=>$destination_address,"phone"=>$ocean['dd_phone']);
  457. $businessPartners = array("shipper"=>$shipperPartners,"consignee" => $consigneePartners,"origin" => $originPartners,"destination" => $destinationPartners);
  458. $data["businessPartners"] = $businessPartners;
  459. $marksAndDescription = array("marks"=>$ocean['marks'],"description"=>$ocean['description']);
  460. $data["marksAndDescription"] = $marksAndDescription;
  461. return $data;
  462. }
  463. }
  464. ?>