|
|
@@ -0,0 +1,284 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+if (!defined('IN_ONLINE')) {
|
|
|
+ exit('Access Denied');
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Description of operation_log
|
|
|
+ *
|
|
|
+ * @author Administrator
|
|
|
+ */
|
|
|
+class destination_delivery {
|
|
|
+
|
|
|
+ private static $_destination_delivery;
|
|
|
+
|
|
|
+ public static function getInstance() {
|
|
|
+ if (!self::$_destination_delivery) {
|
|
|
+ $c = __CLASS__;
|
|
|
+ self::$_destination_delivery = new $c;
|
|
|
+ }
|
|
|
+ return self::$_destination_delivery;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 关于destination_delivery 页面的所有的静态加载数据查询
|
|
|
+ */
|
|
|
+ public function destination_delivery_load(){
|
|
|
+ $operate = utils::_get('operate');
|
|
|
+ $operate = strtolower($operate);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * select country
|
|
|
+ */
|
|
|
+ if ($operate == "country") {
|
|
|
+ $$cp = common::check_input($_POST ['cp']); //current_page
|
|
|
+ $ps = common::check_input($_POST ['ps']); //ps
|
|
|
+ if (empty($ps))
|
|
|
+ $ps = 20;
|
|
|
+ $term = $_POST['term'];
|
|
|
+ $term = trim($term);
|
|
|
+
|
|
|
+ $rc = $_POST ['rc'];
|
|
|
+ if ($rc == - 1) {
|
|
|
+ $sql = "select COUNT(DISTINCT SUBSTRING(c.country FROM 1 FOR 2)) AS total_count
|
|
|
+ from public.contract_region_mapping crm
|
|
|
+ left join ocean.contacts c on c.contact_id = crm.overeas and crm.ksmart_station_new ilike 'ksmart%'
|
|
|
+ where coalesce(c.country,'')<> ''
|
|
|
+ and SUBSTRING(c.country FROM 1 FOR 2) ilike '" . common::check_input($term) . "%'";
|
|
|
+ $rc = common::excuteOneSql($sql);
|
|
|
+ }
|
|
|
+ $tp = ceil($rc / $ps);
|
|
|
+ if ($rc > 0) {
|
|
|
+ $sql = "select DISTINCT SUBSTRING(c.country FROM 1 FOR 2) AS country_code
|
|
|
+ from public.contract_region_mapping crm
|
|
|
+ left join ocean.contacts c on c.contact_id = crm.overeas and crm.ksmart_station_new ilike 'ksmart%'
|
|
|
+ where coalesce(c.country,'')<> ''
|
|
|
+ and SUBSTRING(c.country FROM 1 FOR 2) ilike '" . common::check_input($term) . "%'";
|
|
|
+ $sql .= " order by country_code limit " . $ps . " offset " . ($cp - 1) * $ps;
|
|
|
+
|
|
|
+ $rs = common::excuteListSql($sql);
|
|
|
+ //前端要加上id 从1开始
|
|
|
+ $retData = array();
|
|
|
+ foreach($rs as $key => $val){
|
|
|
+ if(!empty($val['country_code'])){
|
|
|
+ $val["id"] = $key +1;
|
|
|
+ $retData[] = $val;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $arrTmp = array('searchData' => $retData,
|
|
|
+ 'rc' => $rc,
|
|
|
+ 'ps' => $ps,
|
|
|
+ 'cp' => $cp,
|
|
|
+ 'tp' => $tp);
|
|
|
+ common::echo_json_encode(200,$arrTmp);
|
|
|
+ exit();
|
|
|
+ }else{
|
|
|
+ $arrTmp = array('searchData' => array());
|
|
|
+ common::echo_json_encode(200, $arrTmp);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * select station 选择国家后再展示 station list数据
|
|
|
+ */
|
|
|
+ if ($operate == "station") {
|
|
|
+ $country = common::check_input($_REQUEST['country']);
|
|
|
+ $sql = "select crm.overeas from public.contract_region_mapping crm
|
|
|
+ left join ocean.contacts c on c.contact_id = crm.overeas and crm.ksmart_station_new ilike 'ksmart%'
|
|
|
+ where SUBSTRING(c.country FROM 1 FOR 2) = '".$country."'";
|
|
|
+ $data = common::excuteListSql($sql);
|
|
|
+
|
|
|
+ common::echo_json_encode(200,$data);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * select KLN PIC 下拉可供选择的employee帐号,且帐号权限站点包含选中的station
|
|
|
+ */
|
|
|
+ if ($operate == "employee_account") {
|
|
|
+ $station = $_REQUEST['station'];
|
|
|
+ $more_param = common::getInNotInSqlForSearch(utils::implode(';',$station));
|
|
|
+
|
|
|
+ $sql = "select email from employee where contact_id in ($more_param) ";
|
|
|
+ $data = common::excuteListSql($sql);
|
|
|
+
|
|
|
+ common::echo_json_encode(200,$data);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下拉可供选择的ports
|
|
|
+ */
|
|
|
+ if ($operate == "ports") {
|
|
|
+ $mode = $_REQUEST['mode'];
|
|
|
+ if ($mode == 'sea'){
|
|
|
+ $sql = "select DISTINCT uncode from public.ports where coalesce(uncode,'')<> '' order by uncode";
|
|
|
+ } else {
|
|
|
+ $sql = "select DISTINCT coalesce(airport.country_abb,'')||airport.airport_code as uncode from sfs.airport
|
|
|
+ where coalesce(country_abb,'')<>'' order by uncode";
|
|
|
+ }
|
|
|
+ $data = common::excuteListSql($sql);
|
|
|
+ common::echo_json_encode(200,$data);
|
|
|
+ exit();
|
|
|
+
|
|
|
+ $cp = common::check_input($_POST ['cp']); //current_page
|
|
|
+ $ps = common::check_input($_POST ['ps']); //ps
|
|
|
+ if (empty($ps))
|
|
|
+ $ps = 20;
|
|
|
+
|
|
|
+ $mode = $_POST['mode'];
|
|
|
+ $term = $_POST['term'];
|
|
|
+ $term = trim($term);
|
|
|
+
|
|
|
+ $rc = $_POST ['rc'];
|
|
|
+ if ($rc == - 1) {
|
|
|
+ if ($mode == 'sea'){
|
|
|
+ $sql = "select COUNT(DISTINCT uncode) from public.ports
|
|
|
+ where coalesce(uncode,'')<>'' and uncode ilike '" . common::check_input($term) . "%'";
|
|
|
+ } else {
|
|
|
+ $sql = "select COUNT(DISTINCT coalesce(airport.country_abb,'')||airport.airport_code) from sfs.airport
|
|
|
+ where coalesce(country_abb,'')<>''
|
|
|
+ and coalesce(airport.country_abb,'')||airport.airport_code ilike '" . common::check_input($term) . "%'";
|
|
|
+ }
|
|
|
+ $rc = common::excuteOneSql($sql);
|
|
|
+ }
|
|
|
+ $tp = ceil($rc / $ps);
|
|
|
+ if ($rc > 0) {
|
|
|
+ if ($mode == 'sea'){
|
|
|
+ $sql = "select DISTINCT uncode from public.ports
|
|
|
+ where coalesce(uncode,'')<> '' and uncode ilike '" . common::check_input($term) . "%'";
|
|
|
+ } else {
|
|
|
+ $sql = "select DISTINCT coalesce(airport.country_abb,'')||airport.airport_code as uncode from sfs.airport
|
|
|
+ where coalesce(country_abb,'')<>''
|
|
|
+ and coalesce(airport.country_abb,'')||airport.airport_code ilike '" . common::check_input($term) . "%'";
|
|
|
+ }
|
|
|
+ $sql .= " order by uncode limit " . $ps . " offset " . ($cp - 1) * $ps;
|
|
|
+
|
|
|
+ $rs = common::excuteListSql($sql);
|
|
|
+ //前端要加上id 从1开始
|
|
|
+ $retData = array();
|
|
|
+ foreach($rs as $key => $val){
|
|
|
+ if(!empty($val['uncode'])){
|
|
|
+ $val["id"] = $key +1;
|
|
|
+ $retData[] = $val;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $arrTmp = array('searchData' => $retData,
|
|
|
+ 'rc' => $rc,
|
|
|
+ 'ps' => $ps,
|
|
|
+ 'cp' => $cp,
|
|
|
+ 'tp' => $tp);
|
|
|
+ common::echo_json_encode(200,$arrTmp);
|
|
|
+ exit();
|
|
|
+ }else{
|
|
|
+ $arrTmp = array('searchData' => array());
|
|
|
+ common::echo_json_encode(200, $arrTmp);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下拉可供选择的carrier
|
|
|
+ */
|
|
|
+ if ($operate == "carrier") {
|
|
|
+ $cp = common::check_input($_POST ['cp']); //current_page
|
|
|
+ $ps = common::check_input($_POST ['ps']); //ps
|
|
|
+ if (empty($ps))
|
|
|
+ $ps = 20;
|
|
|
+
|
|
|
+ $term = $_POST['term'];
|
|
|
+ $term = trim($term);
|
|
|
+
|
|
|
+ $rc = $_POST ['rc'];
|
|
|
+ if ($rc == - 1) {
|
|
|
+ $sql = "select COUNT(DISTINCT scac) from public.vessel_company
|
|
|
+ where coalesce(scac,'')<> '' and scac ilike '" . common::check_input($term) . "%'";
|
|
|
+ $rc = common::excuteOneSql($sql);
|
|
|
+ }
|
|
|
+ $tp = ceil($rc / $ps);
|
|
|
+ if ($rc > 0) {
|
|
|
+ $sql = "select DISTINCT scac from public.vessel_company
|
|
|
+ where coalesce(scac,'')<> '' and scac ilike '" . common::check_input($term) . "%'";
|
|
|
+ $sql .= " order by scac limit " . $ps . " offset " . ($cp - 1) * $ps;
|
|
|
+
|
|
|
+ $rs = common::excuteListSql($sql);
|
|
|
+ //前端要加上id 从1开始
|
|
|
+ $retData = array();
|
|
|
+ foreach($rs as $key => $val){
|
|
|
+ if(!empty($val['scac'])){
|
|
|
+ $val["id"] = $key +1;
|
|
|
+ $retData[] = $val;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $arrTmp = array('searchData' => $retData,
|
|
|
+ 'rc' => $rc,
|
|
|
+ 'ps' => $ps,
|
|
|
+ 'cp' => $cp,
|
|
|
+ 'tp' => $tp);
|
|
|
+ common::echo_json_encode(200,$arrTmp);
|
|
|
+ exit();
|
|
|
+ }else{
|
|
|
+ $arrTmp = array('searchData' => array());
|
|
|
+ common::echo_json_encode(200, $arrTmp);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * destination_delivery 配置
|
|
|
+ */
|
|
|
+ public function destination_delivery_config(){
|
|
|
+ $operate = utils::_get('operate');
|
|
|
+ $operate = strtolower($operate);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 这个是嵌套在destination_delivery的配置查询,
|
|
|
+ */
|
|
|
+ if ($operate == "search"){
|
|
|
+ $sql = "select * from public.kln_destination_delivery_config";
|
|
|
+ $data = common::excuteListSql($sql);
|
|
|
+ common::echo_json_encode(200,$data);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($operate == "add"){
|
|
|
+ $id = common::deCode($_GET['a'], 'D');
|
|
|
+ if (!empty($id)){
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ global $_COPYRIGHT;
|
|
|
+ $data = array('copyright' =>$_COPYRIGHT,
|
|
|
+ 'website' =>"");
|
|
|
+ common::echo_json_encode(200,$data);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($operate == "save"){
|
|
|
+ $id = common::deCode($_GET['a'], 'D');
|
|
|
+ if (!empty($id)){
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ $data = "";
|
|
|
+ common::echo_json_encode(200,$data);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * booking
|
|
|
+ */
|
|
|
+ public function destination_delivery(){
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+?>
|