main_new_version.php 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887
  1. <?php
  2. $max_ec = ini_get('max_execution_time'); //set max_excution_time
  3. ini_set('max_execution_time', '600');
  4. $memory_limit = "";
  5. $action = "";
  6. if (isset($_GET['action']))
  7. $action = strtolower($_GET['action']);
  8. if (isset($_POST['action']))
  9. $action = strtolower($_POST['action']);
  10. include "include.ini.php";
  11. include 'service/ocean_booking.class.php';
  12. include 'service/ocean_order.class.php';
  13. include 'service/operation_log.class.php';
  14. include 'service/search.class.php';
  15. include 'service/column.class.php';
  16. include 'service/ajax.class.php';
  17. include 'service/login.class.php';
  18. include 'service/tools.class.php';
  19. include 'service/robot.class.php';
  20. include 'service/AIClientFactory.php';
  21. include 'service/destination_delivery.class.php';
  22. include 'service/report.class.php';
  23. //为了调用,临时做一个登录动作 如果是正式版 要注释掉菜单System Settings
  24. //$_POST['uname'] = "ra.admin";
  25. //$_POST['psw'] = common::excuteOneSql("select ra_password from public.ra_online_user where user_login = 'ra.admin'");
  26. // $name = "dddde";
  27. // $name = "ra.admin";
  28. // $_POST['uname'] = $name;
  29. // $_POST['psw'] = common::excuteOneSql("select ra_password from public.ra_online_user where user_login = '".$name."'");
  30. // login::getInstance()->do_login_auto();
  31. //验证路由权限
  32. common::securityCheckHandNew($action);
  33. if (_is_only_vgm()) {
  34. Header("Location:main.php?action=main");
  35. }
  36. error_log("--------------前端请求post参数---------------");
  37. error_log(utils::jsonFiltration("null", "\"\"", json_encode($_POST)));
  38. error_log("--------------前端请求get参数---------------");
  39. error_log(utils::jsonFiltration("null", "\"\"", json_encode($_GET)));
  40. //Operation log 日志记录
  41. utils::operation_log_records();
  42. switch ($action) {
  43. case 'ocean_booking':
  44. ocean_booking::getInstance()->ocean_booking();
  45. break;
  46. case 'ocean_order':
  47. ocean_order::getInstance()->ocean_order();
  48. break;
  49. case 'ajax':
  50. echo ajax::getInstance()->run();
  51. break;
  52. case 'opreation_log':
  53. echo operation_log::getInstance()->operation_log();
  54. break;
  55. case 'main':
  56. //如果在没有登录前,没有登录信息,指定用户
  57. if(!isset($_SESSION['ONLINE_USER'])){
  58. $menuList = array();
  59. $menuList[] = array("index"=>'1',"label"=>"Dashboard","icon"=>"icon_data_fill_b","path"=>"/dashboard");
  60. $menuList[] = array("index"=>'2',"label"=>"Booking","icon"=>"icon_booking__fill_b","path"=>"/booking");
  61. $menuList[] = array("index"=>'3',"label"=>"Tracking","icon"=>"icon_tracking__fill_b","path"=>"/tracking");
  62. } else {
  63. //d登录后,根据配置的权限,是否显示
  64. if (_isAdmin())
  65. $sql = "select f_column, min(menu_id) as menu_id, max(menu_icon_font) as menu_icon_font from public.ra_online_permission where has_new_version=true group by f_column order by min(order_by)";
  66. elseif (_isNewUser())
  67. $sql = "select f_column, min(menu_id) as menu_id, max(menu_icon_font) as menu_icon_font from public.ra_online_permission where has_new_version=true and customer_check = true group by f_column ORDER BY min(order_by)";
  68. else
  69. $sql = "select p.f_column, min(menu_id) as menu_id, max(menu_icon_font) as menu_icon_font from public.ra_online_user_permission up left join public.ra_online_permission p on up.p_id = p.id where has_new_version=true and lower(user_name) = '" . common::check_input(strtolower(_getLoginName())) . "' group by p.f_column ORDER BY min(p.order_by)";
  70. $rs = common::excuteListSql($sql);
  71. if (empty($rs) && _isApexLogin()) {
  72. $sql = "select f_column, min(menu_id) as menu_id, max(menu_icon_font) as menu_icon_font from public.ra_online_permission where has_new_version=true and default_check = true group by f_column ORDER BY min(order_by)";
  73. $rs = common::excuteListSql($sql);
  74. }
  75. $menuSetting = array("Ocean Booking" => array("label"=>"Booking","path"=>"/booking","icon"=>"icon_booking__fill_b"),
  76. "Ocean B/L Info." => array("label"=>"Tracking","path"=>"/tracking","icon"=>"icon_tracking__fill_b"));
  77. $menuList = array();
  78. $menuList[] = array("index"=>'1',"label"=>"Dashboard","icon"=>"icon_data_fill_b","path"=>"/dashboard");
  79. $index = 2;
  80. foreach ($rs as $value) {
  81. if ($value['f_column'] == "Shipment Info."){
  82. if (_isAdmin())
  83. $ll = common::excuteListSql("select s_column, url_action, sub_menu_id from public.ra_online_permission where has_new_version=true and f_column = '" . common::check_input($value['f_column']) . "' ORDER BY order_by");
  84. elseif (_isNewUser())
  85. $ll = common::excuteListSql("select s_column, url_action, sub_menu_id from public.ra_online_permission where has_new_version=true and customer_check = true and f_column = '" . common::check_input($value['f_column']) . "' ORDER BY order_by");
  86. else
  87. $ll = common::excuteListSql("select s_column, url_action, sub_menu_id from public.ra_online_permission p left join public.ra_online_user_permission gp on gp.p_id = p.id where has_new_version=true and f_column = '" . common::check_input($value['f_column']) . "' and lower(gp.user_name) = '" . common::check_input(strtolower(_getLoginName())) . "' ORDER BY p.order_by");
  88. if (empty($ll) && _isApexLogin()) {
  89. $ll = common::excuteListSql("select s_column, url_action, sub_menu_id from public.ra_online_permission where has_new_version=true and f_column = '" . common::check_input($value['f_column']) . "' and default_check = true ORDER BY order_by");
  90. }
  91. //单独拼接URL
  92. foreach ($ll as $v) {
  93. if($v['s_column'] =="Ocean B/L Info."){
  94. $urlData = $menuSetting[$v['s_column']];
  95. $menuList[] = array("index"=>"$index","label"=>$urlData['label'],"icon"=>$urlData['icon'],"path"=>$urlData['path']);
  96. $index = $index + 1;
  97. }
  98. //特殊处理book,需要加二级菜
  99. if($v['s_column'] =="Ocean Booking"){
  100. // $urlData = $menuSetting[$v['s_column']];
  101. // $menuList[] = array("index"=>"$index","label"=>$urlData['label'],"icon"=>$urlData['icon'],"path"=>$urlData['path']);
  102. $bookingManagement = array("index"=>"$index","label"=>"Booking","icon"=>"icon_booking__fill_b","type"=>"list");
  103. $children = array();
  104. $urlData = $menuSetting[$v['s_column']];
  105. $children[] = array("index"=>$index.'-1',"label"=>"Booking Management","path"=>$urlData['path']);
  106. $children[] = array("index"=>$index.'-2',"label"=>"Destination Delivery","path"=>"/destination-delivery");
  107. $bookingManagement["children"] = $children;
  108. $menuList[] = $bookingManagement;
  109. $index = $index + 1;
  110. }
  111. }
  112. }
  113. }
  114. //Report 暂时先这么写,后面这个kln 单独维护独有的菜单栏,和online 隔离开
  115. $urlData = $menuSetting[$v['s_column']];
  116. $menuList[] = array("index"=>"4","label"=>"Report","icon"=>'icon_report__fill_b',"path"=>'/report');
  117. $index = $index + 1;
  118. $systemManagement = array("index"=>"$index","label"=>"System Management","icon"=>"icon_system__management_fill_b","type"=>"list");
  119. $children = array();
  120. if(_isVipReportAdmin(_getLoginName())){
  121. $children[] = array("index" =>$index.'-7',"label" =>"Template Management","path"=>"/template-management");
  122. }
  123. $children[] = array("index" =>$index.'-1',"label" =>"System Message","path"=>"/system-message");
  124. $children[] = array("index" =>$index.'-2',"label" =>"System Settings","path"=>"/system-settings");
  125. //只有chud的账户可以看日志记录
  126. if(strtolower(_getLoginName()) == "chud"
  127. || strtolower(_getLoginName()) == strtolower("IT.Andywu")
  128. || strtolower(_getLoginName()) == "ra.admin"){
  129. $children[] = array("index" =>$index.'-3',"label" =>"Chat Log","path"=>"/chat-log");
  130. $children[] = array("index" =>$index.'-4',"label" =>"AI API Log","path"=>"/ai-api-log");
  131. $children[] = array("index" =>$index.'-5',"label" =>"Operation Log","path"=>"/operation-log");
  132. $children[] = array("index" =>$index.'-6',"label" =>"Prompt Configuration","path"=>"/prompt-configuration");
  133. }
  134. $systemManagement["children"] = $children;
  135. if (!empty($children)){
  136. $menuList[] = $systemManagement;
  137. }
  138. }
  139. common::echo_json_encode(200, $menuList);
  140. exit();
  141. break;
  142. case 'main_filter':
  143. $data = common::getManagement();
  144. common::echo_json_encode(200, $data['dashboard_filter']);
  145. exit();
  146. break;
  147. case 'main_report':
  148. //分担查询
  149. include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
  150. //这里只剩下r3,r4的查询
  151. $type = $_REQUEST["r_type"];
  152. $sqlWhere = ' and ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
  153. $sqlWhere = " " . $sqlWhere;
  154. $sqlWhere .= common::getDashboardTransportationSqlWhere();
  155. $sqlWhere .= common::getDashboardContactIDSqlWhere();
  156. $sqlWhere = common::check_input($sqlWhere);
  157. // $list = common::excuteListSql("select * from public.online_order_status_date_kln_pending('$type'::text, '$sqlWhere'::text) "
  158. // . "r (c bigint, e integer, b integer, d text)");
  159. $sql = "select * from public.online_order_status_date_kln_pending('$type'::text, '$sqlWhere'::text) "
  160. . "r (c bigint, e integer, b integer, d text)";
  161. $list = $mapdb->GetAll($sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $sql), 0));
  162. $key = "[";
  163. $value = "[";
  164. $totalValue = 0;
  165. foreach ($list as $vv) {
  166. if ($key != "[") {
  167. $key .= ",";
  168. $value .= ",";
  169. }
  170. if ($type == "r2" || $type == "r3" || $type == "r4") {
  171. $key .= '"' . $vv["d"] . '"';
  172. $value .= '{"value":"' . $vv["c"] . '","name":"' . $vv["d"] . '" }';
  173. $totalValue = $totalValue + $vv["c"];
  174. } else {
  175. if ($vv["e"] == -1) {
  176. $key .= '"Over 80 Days"';
  177. $value .= '{"value":"' . $vv["c"] . '","name":"Over 80 Days"}';
  178. } else {
  179. $key .= '"' . $vv["b"] . '-' . $vv["e"] . ' Days"';
  180. $value .= '{"value":"' . $vv["c"] . '","name":"' . $vv["b"] . '-' . $vv["e"] . ' Days"}';
  181. }
  182. $totalValue = $totalValue + $vv["c"];
  183. }
  184. }
  185. $key .= "]";
  186. $value .= "]";
  187. //处理返回原表数据格式 r1 r3 r4的数据返回
  188. $data = common::mian_repot_do($value,$type,$totalValue);
  189. common::echo_json_encode(200, $data);
  190. exit();
  191. break;
  192. case 'main_report_etd':
  193. //分担查询
  194. include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
  195. //这里只有r1查询
  196. $type = "r1";
  197. $container_type = "";
  198. $date_type = strtolower($_REQUEST["date_type"]);
  199. if (empty($_REQUEST["date_start"])) {
  200. $bdate = "null";
  201. } else {
  202. $bdate = $_REQUEST["date_start"];
  203. $bdate = "'$bdate'";
  204. }
  205. if (empty($_REQUEST["date_end"])) {
  206. $edate = "null";
  207. } else {
  208. $edate = $_REQUEST["date_end"];
  209. $edate = "'$edate'";
  210. }
  211. $sqlWhere = ' and ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
  212. $sqlWhere = " " . $sqlWhere;
  213. $sqlWhere = $sqlWhere . common::getDashboardTransportationSqlWhere();
  214. $sqlWhere .= common::getDashboardContactIDSqlWhere();
  215. $sqlWhere = common::check_input($sqlWhere);
  216. // $list = common::excuteListSql("select * from public.online_order_status_date_kln_r1_r2('$type'::text, 'eta'::text, 'etd'::text, $bdate, $edate, '$sqlWhere'::text, '$container_type'::text,'$date_type'::text) "
  217. // . "r (c bigint, e integer, b integer, d text)");
  218. $sql = "select * from public.online_order_status_date_kln_r1_r2('$type'::text, 'eta'::text, 'etd'::text, $bdate, $edate, '$sqlWhere'::text, '$container_type'::text,'$date_type'::text) "
  219. . "r (c bigint, e integer, b integer, d text)";
  220. $list = $mapdb->GetAll($sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $sql), 0));
  221. $key = "[";
  222. $value = "[";
  223. $totalValue = 0;
  224. foreach ($list as $vv) {
  225. if ($key != "[") {
  226. $key .= ",";
  227. $value .= ",";
  228. }
  229. if ($type == "r2" || $type == "r3" || $type == "r4") {
  230. $key .= '"' . $vv["d"] . '"';
  231. $value .= '{"value":"' . $vv["c"] . '","name":"' . $vv["d"] . '" }';
  232. $totalValue = $totalValue + $vv["c"];
  233. } else {
  234. if ($vv["e"] == -1) {
  235. $key .= '"Over 80 Days"';
  236. $value .= '{"value":"' . $vv["c"] . '","name":"Over 80 Days"}';
  237. } else {
  238. $key .= '"' . $vv["b"] . '-' . $vv["e"] . ' Days"';
  239. $value .= '{"value":"' . $vv["c"] . '","name":"' . $vv["b"] . '-' . $vv["e"] . ' Days"}';
  240. }
  241. $totalValue = $totalValue + $vv["c"];
  242. }
  243. }
  244. $key .= "]";
  245. $value .= "]";
  246. //处理返回原表数据格式 r1 r3 r4的数据返回
  247. $data = common::mian_repot_do($value,$type,$totalValue);
  248. common::echo_json_encode(200, $data);
  249. exit();
  250. break;
  251. case 'main_report_kpi':
  252. //分担查询
  253. include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
  254. $type = $_REQUEST["r_type"];
  255. $sqlWhere = ' and ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
  256. $sqlWhere = " " . $sqlWhere;
  257. $sqlWhere = $sqlWhere . common::getDashboardTransportationSqlWhere();
  258. $sqlWhere .= common::getDashboardContactIDSqlWhere();
  259. $sqlWhere = common::check_input($sqlWhere);
  260. $date_type = strtolower($_REQUEST["date_type"]);
  261. if (isset($_REQUEST['date_start']) && !empty($_REQUEST['date_start']))
  262. $sqlWhere .= " and $date_type >= ''" . common::usDate2sqlDate($_REQUEST['date_start']) . " 00:00:00''";
  263. if (isset($_REQUEST['date_end']) && !empty($_REQUEST['date_end']))
  264. $sqlWhere .= " and $date_type <= ''" . common::usDate2sqlDate($_REQUEST['date_end']) . " 23:59:59''";
  265. // $list = common::excuteListSql("select * from public.online_order_status_date_kln_kpi('$type'::text,'$sqlWhere'::text) "
  266. // . "r (c bigint, d text)");
  267. $sql = "select * from public.online_order_status_date_kln_kpi('$type'::text,'$sqlWhere'::text) "
  268. . "r (c bigint, d text)";
  269. $list = $mapdb->GetAll($sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $sql), 0));
  270. $key = "[";
  271. $value = "[";
  272. $totalValue = 0;
  273. foreach ($list as $vv) {
  274. if ($key != "[") {
  275. $key .= ",";
  276. $value .= ",";
  277. }
  278. if ($type == "ata_r3" || $type == "atd_r4" ) {
  279. $key .= '"' . $vv["d"] .'"';
  280. $value .= '{"value":"' . $vv["c"] . '","name":"' . $vv["d"] .'"}';
  281. $totalValue = $totalValue + $vv["c"];
  282. }
  283. }
  284. $key .= "]";
  285. $value .= "]";
  286. //处理返回原表数据格式
  287. $ETDList = array();
  288. $value_arr = json_decode($value,true);
  289. foreach($value_arr as $arr){
  290. $color = common::getItemStyle($type,$arr['name']);
  291. if($arr['name'] == "0 Day"){
  292. $arr['name'] = "≤1 Day";
  293. }
  294. if($arr['name'] == "7 Days"){
  295. $arr['name'] = "≥7 Days";
  296. }
  297. $ETDList[] = array("value" =>intval($arr['value']),"name" =>$arr['name'],"itemStyle" =>array("color" =>$color));
  298. }
  299. // 排序依据的键数组(这里我们用一个数字数组来表示)
  300. $order = ["≤1 Day", "1-2 Days", "3-6 Days","≥7 Days"];
  301. $ETDList = utils::arrayOrderBykeys($order,$ETDList,"name");
  302. if($type == 'atd_r4'){
  303. $data = array("ETDList" =>$ETDList,"ETD_Radius"=>array('30%','50%'),"title1" =>"Departure","title2" =>"(ATD-ETD)","download_name" => "KPI Departure");
  304. }
  305. if($type == 'ata_r3'){
  306. $data = array("ETDList" =>$ETDList,"ETD_Radius"=>array('30%','50%'),"title1" =>"Arrival","title2" =>"(ATA-ETA)","download_name" => "KPI Arrival");
  307. }
  308. common::echo_json_encode(200, $data);
  309. exit();
  310. break;
  311. case 'main_report_container_bar':
  312. //新UI 20 40 45 3份数据同时查询,且是柱状图,所以与r3 r4查询分开
  313. $container_type ='';
  314. $ContainerCounSeries = array();
  315. $date_type = strtolower($_REQUEST["date_type"]);
  316. $type = $_REQUEST["r_type"];
  317. if (empty($_REQUEST["date_start"])) {
  318. $bdate = "null";
  319. } else {
  320. $bdate = $_REQUEST["date_start"];
  321. $bdate = "'$bdate'";
  322. }
  323. if (empty($_REQUEST["date_end"])) {
  324. $edate = "null";
  325. } else {
  326. $edate = $_REQUEST["date_end"];
  327. $edate = "'$edate'";
  328. }
  329. $list= array();
  330. $sqlWhere = ' and ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
  331. $sqlWhere = common::check_input($sqlWhere);
  332. $sqlWhere .= common::getDashboardContactIDSqlWhere("container_bar");
  333. $sqlWhere = " " . $sqlWhere;
  334. //这个20 40 45都查询出来。否则值查询都对应的size,其他的不查询
  335. $value_arr = common::excuteListSql("select * from public.online_order_status_date_kln_r1_r2('$type'::text, 'eta'::text, 'etd'::text, $bdate, $edate, '$sqlWhere'::text, '$container_type'::text, '$date_type'::text) "
  336. . "r (month_group text, _20_rc numeric, _40_rc numeric, _45_rc numeric)");
  337. $key_arr = array();
  338. $container_type_arr = array("20","40","45");
  339. foreach($container_type_arr as $_container_type){
  340. $data = array();
  341. //每一个size 的所有月份总计
  342. $total = 0;
  343. //每一个size 对应的最大值
  344. $max = 0;
  345. foreach($value_arr as $arr){
  346. $data[] = intval($arr['_'.$_container_type.'_rc']);
  347. $total = $total + intval($arr['_'.$_container_type.'_rc']);
  348. $max = $max < intval($arr['_'.$_container_type.'_rc']) ? intval($arr['_'.$_container_type.'_rc']) : $max;
  349. if ($_container_type == '20'){
  350. $key_arr[] = $arr['month_group'];
  351. }
  352. }
  353. $ContainerCounSeries[$_container_type] = array("data"=>$data,"total"=>$total,"max"=>$max);
  354. }
  355. //处理返回时数据格式
  356. $ContainerCounSeries_return = array();
  357. //横坐标栏位
  358. $ContainerCount_Title = $key_arr;
  359. //所查的所有模式计算总和
  360. $total = 0;
  361. //所有size下的最大值,方便标注计算最长的Y坐标
  362. $max_all = 0;
  363. foreach($ContainerCounSeries as $k =>$v){
  364. //这个type 是页面传过来的。这个固定r2
  365. $color = common::getItemStyle($type,$k);
  366. $total = $total + $v['total'];
  367. $ContainerCounSeries_return[] = array("name"=>strval($k),"type"=>"bar","emphasis" => array("focus" =>"none"),
  368. "stack" =>"总计","data" =>$v['data'],"itemStyle" =>array("color" =>$color));
  369. $max_all = $max_all + $v['max'];
  370. }
  371. //计算Y坐标的间隔
  372. $interval = utils::calculateTicks(0,$max_all,5);
  373. if($interval == 0){
  374. //处理返回默认值
  375. $interval = 2;
  376. }
  377. $returnData = array("ContainerCount_Title"=>"Total: $total","ContainerCountList" =>$ContainerCount_Title,"ContainerCounSeries" =>$ContainerCounSeries_return,
  378. "min" => 0,"Max" =>$interval*5,"interval" =>$interval,"download_name" => "Container Count");
  379. //demo
  380. // $json = '{"code":200,"data":{"ContainerCount_Title":"Total: 463518","ContainerCountList":["OCT,23","NOV,23","DEC,23","JAN,24","FEB,24","MAR,24","APR,24","MAY,24","JUN,24","JUL,24","AUG,24","SEP,24","OCT,24"],"ContainerCounSeries":[{"name":"20","type":"bar","emphasis":{"focus":"none"},"stack":"\u603b\u8ba1","data":[4400,8600,8804,9271,8961,8793,8534,9476,9530,10277,10081,8997,5784],"itemStyle":{"color":"#FF7500"}},{"name":"40","type":"bar","emphasis":{"focus":"none"},"stack":"\u603b\u8ba1","data":[13652,28021,30422,30136,26320,27035,23979,26494,28406,33318,32318,30962,16369],"itemStyle":{"color":"#FFAC66"}},{"name":"45","type":"bar","emphasis":{"focus":"none"},"stack":"\u603b\u8ba1","data":[189,337,415,437,439,321,250,320,324,603,328,415,200],"itemStyle":{"color":"#FFE3CC"}}],"min":0,"Max":45000,"interval":9000}}';
  381. // $returnData = json_decode($json,true);
  382. // echo json_encode($returnData);
  383. // exit();
  384. common::echo_json_encode(200, $returnData);
  385. exit();
  386. break;
  387. case 'main_report_co2e_bar':
  388. $returnData = common::getCo2eBar();
  389. common::echo_json_encode(200, $returnData);
  390. exit();
  391. break;
  392. case 'main_report_top10_bar':
  393. $returnData = common::getTopBarNew();
  394. common::echo_json_encode(200, $returnData);
  395. exit();
  396. break;
  397. case 'main_report_revenue':
  398. $returnData = common::getRevenue();
  399. common::echo_json_encode(200, $returnData);
  400. exit();
  401. break;
  402. case 'main_map':
  403. $uncode = $_POST["uncode"];
  404. $serial_no = $_POST["serial_no"];
  405. $unall = explode("|", $uncode);
  406. $sql = "";
  407. if (!empty($unall[0]) && $unall[0] != "''") {
  408. $sql .= "select lon as lng, lat as lat, uncode, 'Place of receipt: '||name1 as location_namewo, 'por' as type from vessel.vt_unlocode where "
  409. . "lon<>0 and lat<>0 and lon is not null and lat is not null and uncode in "
  410. . "($unall[0])";
  411. }
  412. if (!empty($unall[1]) && $unall[1] != "''") {
  413. if (!empty($sql)) {
  414. $sql .= " union ";
  415. }
  416. $sql .= "select lon as lng, lat as lat, uncode, 'POL: '||name1 as location_namewo, 'pol' as type from vessel.vt_unlocode where "
  417. . "lon<>0 and lat<>0 and lon is not null and lat is not null and uncode in "
  418. . "($unall[1])";
  419. }
  420. if (!empty($unall[2]) && $unall[2] != "''") {
  421. if (!empty($sql)) {
  422. $sql .= " union ";
  423. }
  424. $sql .= "select lon as lng, lat as lat, uncode, 'POD: '||name1 as location_namewo, 'pod' as type from vessel.vt_unlocode where "
  425. . "lon<>0 and lat<>0 and lon is not null and lat is not null and uncode in "
  426. . "($unall[2])";
  427. }
  428. if (!empty($unall[3]) && $unall[3] != "''") {
  429. if (!empty($sql)) {
  430. $sql .= " union ";
  431. }
  432. $sql .= "select lon as lng, lat as lat, uncode, 'Place of delivery: '||name1 as location_namewo, 'poe' as type from vessel.vt_unlocode where "
  433. . "lon<>0 and lat<>0 and lon is not null and lat is not null and uncode in "
  434. . "($unall[3])";
  435. }
  436. $tkStatus = common::excuteListSql("select tl.by_pickup, g.consignee_exp, g.pickup_from_exp, c.ctnr, g.deliveryto_exp, g.serial_no, tl.location, tl.type, tl.id,
  437. to_char(tl.upload_time, 'MM/DD/YYYY HH24:MI:SS') as utime
  438. from public.tk_general g, public.tk_commodity c left join public.tk_location tl on c.serial_no=tl.serial_no
  439. where g.serial_no=c.serial_no and g.bol=(select m_bol from public.ocean where serial_no='$serial_no') order by tl.order_id");
  440. foreach ($tkStatus as $vv) {
  441. $ll = explode(",", $vv["location"]);
  442. if ($vv["by_pickup"] == "t") {
  443. $pf = explode("\r\n", $vv["pickup_from_exp"]);
  444. $pf = common::check_input($pf[0]) . "(" . $vv["ctnr"] . ")";
  445. $dt = explode("\r\n", $vv["consignee_exp"]);
  446. $dt = common::check_input($dt[0]) . "(" . $vv["ctnr"] . ")";
  447. } else {
  448. $pf = explode("\r\n", $vv["consignee_exp"]);
  449. $pf = common::check_input($pf[0]) . "(" . $vv["ctnr"] . ")";
  450. $dt = explode("\r\n", $vv["deliveryto_exp"]);
  451. $dt = common::check_input($dt[0]) . "(" . $vv["ctnr"] . ")";
  452. }
  453. if ($vv["type"] == "26" && !empty($ll[1])) {
  454. if (!empty($sql)) {
  455. $sql .= " union ";
  456. }
  457. $sql .= "select '" . $ll[1] . "' as lng, '" . $ll[0] . "' as lat, '" . $vv["ctnr"] . "' as uncode, 'Pick up: " . $vv["utime"] . "<br>'||'" . $pf . "' as location_namewo, 'pickup' as type";
  458. } elseif ($vv["type"] == "25" && !empty($ll[1])) {
  459. if (!empty($sql)) {
  460. $sql .= " union ";
  461. }
  462. $sql .= "select '" . $ll[1] . "' as lng, '" . $ll[0] . "' as lat, '" . $vv["ctnr"] . "' as uncode, 'Delivery: " . $vv["utime"] . "<br>'||'" . $dt . "' as location_namewo, 'delivery' as type";
  463. }
  464. }
  465. if (!empty($sql)) {
  466. $gps = common::excuteListSql($sql . "");
  467. }
  468. if (!empty($serial_no)) {
  469. $all = explode(",", $serial_no);
  470. foreach ($all as $a) {
  471. $rs = common::excuteOneSql("select public.get_vessel_position('$a'::text)");
  472. if (!empty($rs)) {
  473. $rss = explode("|", $rs);
  474. $lng_lat = explode(",", $rss[1]);
  475. $gps[] = array("lng" => $lng_lat[0], "lat" => $lng_lat[1], "uncode" => "", "location_namewo" => "", "type" => "vessel", "vessel_name" => $rss[2], "m_shipname" => "", "mmsi" => "", "imo" => "", "m_shipstate" => "", "m_shiptype" => "", "m_dest" => "", "m_newshiparrive" => "", "m_newlasttime" => "", "lasttime" => "", "sub" => "");
  476. }
  477. }
  478. }
  479. $data = array("gps" => $gps);
  480. common::echo_json_encode("200", $data);
  481. exit();
  482. break;
  483. case 'main_map_new':
  484. include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
  485. //修改添加port_of_transshipment 和port_of_transshipment_name的坐标获取(有为空的可能)
  486. $serial_no = $_REQUEST["serial_no"];
  487. $_schemas = $_REQUEST['_schemas'];
  488. if(empty($_schemas)){
  489. $_schemas ="public";
  490. }
  491. //$serial_no = "F41E6016-1A97-4C93-8198-53D8B3B26220";
  492. $transport_mode = common::excuteOneSql("SELECT transport_mode FROM public.kln_ocean ko
  493. WHERE ko.serial_no = '$serial_no' and order_from = '$_schemas'");
  494. if($transport_mode == "sea"){
  495. $sql = "with ss as (select '$serial_no' as sn)
  496. , aa as (
  497. select place_of_receipt_un, place_of_delivery_un, fport_of_loading_un, mport_of_discharge_un, port_of_loading, port_of_discharge, place_of_delivery_exp, place_of_receipt_exp,dd.*
  498. from public.kln_ocean oo
  499. left join LATERAL (
  500. select (select uncode from ports where code = o.port_of_transshipment) as port_of_transshipment_un,
  501. port_of_transshipment_name
  502. from $_schemas.ocean o where o.serial_no=oo.serial_no order by id desc limit 1
  503. ) dd on true
  504. where serial_no=(select sn from ss) limit 1
  505. )
  506. , rr as (
  507. select lon as lng, lat as lat, 'Origin' as label, port_of_loading as infor, 1 as sort, null::timestamp without time zone as stime, 'pol'::text as ptype
  508. from vessel.vt_unlocode, aa where (lat<=90 and lat>=-90) and (lon<=180 and lon>=-180) and lon is not null and lat is not null and uncode=fport_of_loading_un
  509. union all
  510. select lon as lng, lat as lat, 'Destination' as label, port_of_discharge as infor, 2 as sort, null::timestamp without time zone as stime, 'pod'::text as ptype
  511. from vessel.vt_unlocode, aa where (lat<=90 and lat>=-90) and (lon<=180 and lon>=-180) and lon is not null and lat is not null and uncode=mport_of_discharge_un
  512. union all
  513. select lon as lng, lat as lat, 'Transfer' as label, port_of_transshipment_name as infor, 3 as sort, null::timestamp without time zone as stime, 'poe'::text as ptype
  514. from vessel.vt_unlocode, aa where (lat<=90 and lat>=-90) and (lon<=180 and lon>=-180) and lon is not null and lat is not null and uncode=port_of_transshipment_un
  515. )
  516. select * from rr order by sort, stime";
  517. } elseif ($transport_mode == "air"){
  518. $sql = "with ss as (select '$serial_no' as sn)
  519. , aa as (
  520. select place_of_receipt_un, place_of_delivery_un, fport_of_loading_un, mport_of_discharge_un, port_of_loading, port_of_discharge, place_of_delivery_exp, place_of_receipt_exp
  521. from public.kln_ocean oo
  522. where serial_no=(select sn from ss) limit 1
  523. )
  524. , rr as (
  525. select lon as lng, lat as lat, 'Origin' as label, port_of_loading as infor, 1 as sort, null::timestamp without time zone as stime, 'pol'::text as ptype
  526. from vessel.vt_unlocode, aa where (lat<=90 and lat>=-90) and (lon<=180 and lon>=-180) and lon is not null and lat is not null and uncode=fport_of_loading_un
  527. union all
  528. select lon as lng, lat as lat, 'Destination' as label, port_of_discharge as infor, 2 as sort, null::timestamp without time zone as stime, 'pod'::text as ptype
  529. from vessel.vt_unlocode, aa where (lat<=90 and lat>=-90) and (lon<=180 and lon>=-180) and lon is not null and lat is not null and uncode=mport_of_discharge_un
  530. )
  531. select * from rr order by sort, stime";
  532. }
  533. $rss = common::excuteListSql($sql);
  534. //$rss = $mapdb->GetAll($sql);
  535. //先固定死
  536. // $json = '[{"lng":"100.78594000","lat":"13.68521000","label":"Origin","infor":"LAT KRABANG, THAILAND","sort":"0","stime":null,"ptype":"por"},
  537. // {"lng":"100.88333333","lat":"13.08333333","label":"Destination","infor":"LAEM CHABANG PORT,THAILAND","sort":"1","stime":null,"ptype":"pol"},
  538. // {"lng":"-122.28640000","lat":"37.79784000","label":"Transfer","infor":"OAKLAND, CA, USA","sort":"2","stime":null,"ptype":"pod"}]';
  539. //$rss = json_decode($json,true);
  540. ///global $mapdb;
  541. //查询线(包含所有的线) 空运不查询航线
  542. if ($transport_mode == "air"){
  543. $Line =array();
  544. }else{
  545. error_log("select * from get_track_data('$serial_no',true)");
  546. $map_sql = "select * from get_track_data('$serial_no',true)";
  547. $Line = $mapdb->GetAll($map_sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $map_sql), 0));
  548. }
  549. $solidLine = array();
  550. $dottedLine = array();
  551. $rangePoint = array();
  552. foreach($Line as $line){
  553. if($line['tp'] == "1"){
  554. $solidLine[] = $line;
  555. }elseif($line['tp'] == "0"){
  556. $dottedLine[] = $line;
  557. }else{
  558. $rangePoint[] = $line;
  559. }
  560. }
  561. //如果没有虚线,这这个范围点也是异常的,不需要显示
  562. if(empty($dottedLine)){
  563. $rangePoint = array();
  564. }
  565. $data = array("point"=>$rss,"solidLine"=>$solidLine,"dottedLine"=>$dottedLine,"rangePoint"=>$rangePoint);
  566. common::echo_json_encode(200, $data);
  567. //common::echo_json_encode(200, $rss);
  568. exit();
  569. break;
  570. case 'main_welcome':
  571. //分担查询
  572. include ONLINE_ROOT . 'libs' . DS . 'map_config.ini.php';
  573. $cp = common::check_input($_POST ['cp']); //current_page
  574. $ps = common::check_input($_POST ['ps']); //ps
  575. if (empty($ps))
  576. $ps = 10;
  577. $sqlWhere = ' where ' . common::searchExtendHand_KLN("ocean", $_SESSION["ONLINE_USER"]);
  578. $sqlWhere .= common::getDashboardTransportationSqlWhere();
  579. $sqlWhere .= common::getDashboardContactIDSqlWhere();
  580. // test dome
  581. // $_POST['is_default'] = "no";
  582. // $_POST['date_start'] =null;
  583. // $_POST['date_end'] = null;
  584. //默认初始条件:ALL& ETD& Current Month 当前月的1号到最后一天 这个默认条件已经废除,前端不会这样传参数
  585. if (isset($_POST['is_default']) && strtolower($_POST['is_default']) == "yes" && false){
  586. $sqlWhere .= "and etd>='" . date("Y-m") . "-01' and etd<='" . date("Y-m") . "-01'::date + interval '1 month'";
  587. } else {
  588. $date_type = strtolower(common::check_input($_POST ['date_type']));
  589. if (isset($_POST['date_start']) && !empty($_POST['date_start']))
  590. $sqlWhere .= " and $date_type >= '" . common::usDate2sqlDate($_POST['date_start']) . " 00:00:00'";
  591. if (isset($_POST['date_end']) && !empty($_POST['date_end']))
  592. $sqlWhere .= " and $date_type <= '" . common::usDate2sqlDate($_POST['date_end']) . " 23:59:59'";
  593. }
  594. if (isset($_POST['customer']) && !empty($_POST['customer'])){
  595. $sqlWhere .= " and (shipper ilike '%".common::check_input($_POST['customer'])."%' or shipper_id ilike '%".common::check_input($_POST['customer'])."%'
  596. or consignee ilike '%".common::check_input($_POST['customer'])."%' or consignee_id ilike '%".common::check_input($_POST['customer'])."%')";
  597. }
  598. $rc = $_POST ['rc'];
  599. if ($rc == - 1) {
  600. $sql = "SELECT count(1) from public.kln_ocean" . $sqlWhere;
  601. //$rc = common::excuteOneSql($sql);
  602. $rc = $mapdb->GetOne($sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $sql), 0));
  603. }
  604. $tp = ceil($rc / $ps);
  605. if ($rc > 0) {
  606. $sql = "SELECT order_from as _schemas,serial_no, consignee, shipper, h_bol,final_desination_uncode, transport_mode,transport_mode_extend,
  607. to_char(etd, 'MM/DD/YYYY'::text) as etd,
  608. to_char(eta, 'MM/DD/YYYY'::text) AS eta,
  609. fport_of_loading_un, mport_of_discharge_un, place_of_receipt_un, place_of_delivery_un, booking_no,
  610. f_vessel,f_voyage,origin,
  611. CASE
  612. 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
  613. WHEN ((m_iffcpu is not null or m_iffrec is not null) and m_iffdep is null and m_iffarr is null and m_iffdel is null) THEN 'Cargo Received'::text
  614. WHEN (m_iffdep is not null and m_iffarr is null and m_iffdel is null) THEN 'Departure'::text
  615. WHEN (m_iffarr is not null and m_iffdel is null) THEN 'Arrived'::text
  616. WHEN (m_iffdel is not null) THEN 'Completed'::text
  617. ELSE 'Created'::text
  618. END AS new_status
  619. FROM public.kln_ocean $sqlWhere";
  620. //$sqlWhere and last_status_315_update_time is not null";
  621. $sql .= " ORDER BY eta desc,id DESC limit " . $ps . " offset " . ($cp - 1) * $ps;
  622. //$sql .= " ORDER BY last_status_315_update_time DESC limit " . $ps . " offset " . ($cp - 1) * $ps;
  623. //$rss = common::excuteListSql($sql);
  624. $rss = $mapdb->GetAll($sql) or ( (!$mapdb->ErrorMsg()) or error_log(common::dbLog($mapdb, $sql), 0));
  625. //RecentStatusList
  626. $RecentStatusList = array();
  627. foreach ($rss as $key => $value) {
  628. $serial_no = $value["serial_no"];
  629. $_schemas_bk = $value['_schemas'];
  630. $_schemas = $value['_schemas'];
  631. if($_schemas == "public"){
  632. $_schemas = "ocean";
  633. }
  634. //单独取查询milestone信息
  635. if ($value['transport_mode'] == "sea"){
  636. $milestone_sql = "select a.act_date,a.act_time,sn.description,a.timezone,
  637. a.code as dd_code
  638. from public.ocean_milestone a
  639. inner join public.customer_service_milestone_sno sn on sn.code=a.code and sn.type = 'sea'
  640. where a.serial_no='$serial_no'
  641. and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFDEP,IFFARR,IFFDEL', ','))
  642. and a.act_date is not null
  643. order by sn.sno desc limit 1";
  644. } elseif ($value['transport_mode'] == "air"){
  645. //air milestone 的Departed实际描述要替换: IFFDEP =》 IFFONB
  646. $milestone_sql = "select a.act_date,a.act_time,sn.description,a.timezone,
  647. a.code as dd_code
  648. from $_schemas_bk.air_milestone a
  649. inner join public.customer_service_milestone_sno sn on sn.code=a.code and sn.type = 'air'
  650. where a.serial_no='$serial_no'
  651. and a.code in (select regexp_split_to_table('IFFBCF,IFFCPU,IFFREC,IFFONB,IFFARR,IFFDEL', ','))
  652. and a.act_date is not null
  653. order by sn.sno desc limit 1";
  654. }
  655. $milestone = common::excuteObjectSql($milestone_sql);
  656. $value["act_date"] = $milestone["act_date"];
  657. $value["act_time"] = $milestone["act_time"];
  658. $value["description"] = $milestone["description"];
  659. $value["timezone"] = $milestone["timezone"];
  660. $value["dd_code"] = $milestone["dd_code"];
  661. $timezone = "";
  662. //按照最新execl Timezone From 来自于origin
  663. if($value['dd_code'] == "IFFBCF" || $value['dd_code'] == "IFFCPU"){
  664. $sql = "SELECT (select time_zone from public.city_timezone where uncode = LEFT(c.country, 2) || COALESCE(c.city_code,'')) as timezone
  665. FROM $_schemas.contacts c WHERE c.contact_id = '".$value['origin']."'";
  666. $timezone = common::excuteOneSql($sql);
  667. }
  668. //按照最新execl Timezone From 来自于final_destination
  669. if($value['dd_code'] == "IFFDEL"){
  670. $sql = "select time_zone from public.city_timezone where uncode = '".$value['final_desination_uncode']."'";
  671. $timezone = common::excuteOneSql($sql);
  672. }
  673. if($value['dd_code'] == "IFFREC" || $value['dd_code'] == "IFFDEP" || $value['dd_code'] == "IFFARR"){
  674. $EDI315Time = array();
  675. if ($value['transport_mode'] == "sea"){
  676. //Timezone From 来自于EDI315
  677. $EDI315Time = common::getEDI315Time($serial_no,$value['_schemas']);
  678. }
  679. if($value['dd_code'] == "IFFREC" || $value['dd_code'] == "IFFDEP"){
  680. //先以EDI315 时区为准,如果没有这代表数据是手动输入,或者没有同步情况
  681. $timezone = $EDI315Time[$value['dd_code']]['timezone'];
  682. if(empty($timezone)){
  683. if($value['dd_code'] == "IFFREC"){
  684. $sql = "select time_zone from public.city_timezone where uncode = '".$value['place_of_receipt_un']."'";
  685. }else{
  686. $sql = "select time_zone from public.city_timezone where uncode = '".$value['fport_of_loading_un']."'";
  687. }
  688. $timezone = common::excuteOneSql($sql);
  689. }
  690. }
  691. if($value['dd_code'] == "IFFARR"){
  692. $timezone = $EDI315Time[$value['dd_code']]['timezone'];
  693. if(empty($timezone)){
  694. $sql = "select time_zone from public.city_timezone where uncode = '".$value['mport_of_discharge_un']."'";
  695. $timezone = common::excuteOneSql($sql);
  696. }
  697. }
  698. }
  699. $Arrived = $value['description'];
  700. $startStation=$value['fport_of_loading_un'];
  701. $endStation=$value['mport_of_discharge_un'];
  702. if ($value['transport_mode'] == "sea"){
  703. $startStation=$value['place_of_receipt_un'];
  704. $endStation=$value['place_of_delivery_un'];
  705. }
  706. if ($value['transport_mode'] == "air"){
  707. $startStation=!empty($ocean['place_of_receipt_un'])? $ocean['place_of_receipt_un'] : $ocean['fport_of_loading_un'];
  708. $endStation=!empty($ocean['place_of_delivery_un']) ? $ocean['place_of_delivery_un'] : $ocean['mport_of_discharge_un'];
  709. }
  710. $RecentStatusList[] = array("Title"=>$value['h_bol'],
  711. "name"=>utils::outDisplayForMerge($value['f_vessel'],$value['f_voyage']),
  712. "bookingNumber" =>$value['booking_no'],
  713. "IsSubscribe" =>false,
  714. "shipperName"=>$value['shipper'],
  715. "consigneeName" =>$value['consignee'],
  716. "startStation"=>$startStation,
  717. "endStation"=>$endStation,
  718. "ETD"=>$value['etd'],
  719. "ETA"=>$value['eta'],
  720. "type"=>$value['new_status'],
  721. "Arrived"=>$Arrived,
  722. "Time"=>$value["act_date"],
  723. "act_time" =>$value["act_time"],
  724. "timezone"=>$timezone,
  725. "_schemas"=>$value["_schemas"],
  726. "transport_mode"=>$value["transport_mode_extend"],
  727. 'is_subscribe' =>common::checkedSubscribe($value['serial_no']),
  728. "a" =>common::deCode($value['serial_no'], 'E'));
  729. }
  730. $data = common::getManagement();
  731. $arrTmp = array('searchData' => $RecentStatusList,
  732. 'Management' => $data['Management'],
  733. 'dashboard_filter' => $data['dashboard_filter'],
  734. 'is_customer' =>_isCustomerLogin(),
  735. 'rc' => $rc,
  736. 'ps' => $ps,
  737. 'cp' => $cp,
  738. 'tp' => $tp);
  739. } else {
  740. $data = common::getManagement();
  741. $arrTmp = array('searchData' => array(),
  742. 'Management' => $data['Management'],
  743. 'dashboard_filter' => $data['dashboard_filter']);
  744. }
  745. common::echo_json_encode(200,$arrTmp);
  746. exit();
  747. break;
  748. case 'save_layout':
  749. $management = json_encode($_POST["management"]);
  750. $dashboard_filter = json_encode($_POST["dashboardObj"]);
  751. $_param = "";
  752. if(!empty($_POST["management"])){
  753. $_param .= " management = '$management' ";
  754. }
  755. if(isset($_POST["dashboardObj"]) && !empty($dashboard_filter)){
  756. $_param .= ",dashboard_filter = '$dashboard_filter' ";
  757. }
  758. if(!empty($_param)){
  759. common::excuteUpdateSql("update public.ra_online_user set $_param where lower(user_login) = '" . strtolower(_getLoginName()) . "'");
  760. }
  761. $returnData = array("msg" => "success");
  762. common::echo_json_encode(200, $returnData);
  763. exit();
  764. break;
  765. case 'password':
  766. tools::getInstance()->updatePassword();
  767. break;
  768. case 'tools':
  769. tools::getInstance()->markSystem();
  770. break;
  771. case 'robot':
  772. robot::getInstance()->robot_prompt_configuration();
  773. break;
  774. case 'robot_chat':
  775. robot::getInstance()->ai_chat();
  776. break;
  777. case 'robot_chat_log':
  778. robot::getInstance()->robot_chat_log();
  779. break;
  780. case 'robot_api_log':
  781. robot::getInstance()->robot_api_log();
  782. break;
  783. case 'system_setting':
  784. tools::getInstance()->user_system_setting();
  785. break;
  786. case 'monitoring_setting':
  787. tools::getInstance()->user_monitoring_setting();
  788. break;
  789. case 'notifications_rules':
  790. tools::getInstance()->notifications_rules();
  791. break;
  792. case 'destination_delivery_load':
  793. destination_delivery::getInstance()->destination_delivery_load();
  794. break;
  795. case 'destination_delivery_config':
  796. destination_delivery::getInstance()->destination_delivery_config();
  797. break;
  798. case 'destination_delivery_booking':
  799. destination_delivery::getInstance()->destination_delivery_booking();
  800. break;
  801. case 'report_config':
  802. report::getInstance()->report_config();
  803. break;
  804. case 'shipment_status_report':
  805. report::getInstance()->shipment_status_report();
  806. break;
  807. case 'user_guide':
  808. $rootPath = realpath(dirname(__FILE__)) . DS;
  809. //common::download_file($rootPath."images\ACE-M1_ISF_ACI_User_Guide\ACE-M1_ISF_ACI_User_Guide.pdf", "ACE-M1_ISF_ACI_User_Guide_V2.0.pdf");
  810. // PDF文件在服务器上的位置
  811. $filename = $rootPath."userFile". DS."KLN_Online_User_Guide_24.11.26.pdf";
  812. $display_name = "KLN_Online_User_Guide_24_11_26.pdf";
  813. // Header content type
  814. header("Content-type: application/pdf");
  815. header("Content-Length: " . filesize($filename));
  816. header("Content-Disposition:attachment;filename=\"" . $display_name . "\"");
  817. // 将文件发送到浏览器。
  818. readfile($filename);
  819. break;
  820. case 'feature_update':
  821. $id = $_REQUEST["id"];
  822. $rootPath = realpath(dirname(__FILE__)) . DS;
  823. //common::download_file($rootPath."images\ACE-M1_ISF_ACI_User_Guide\ACE-M1_ISF_ACI_User_Guide.pdf", "ACE-M1_ISF_ACI_User_Guide_V2.0.pdf");
  824. // PDF文件在服务器上的位置
  825. $filename = $rootPath."upload". DS."feature_update_".$id.".pdf";
  826. $display_name = "feature_update.pdf";
  827. // Header content type
  828. header("Content-type: application/pdf");
  829. header("Content-Length: " . filesize($filename));
  830. header("Content-Disposition:inline;filename=\"" . $display_name . "\"");
  831. // 将文件发送到浏览器。
  832. readfile($filename);
  833. break;
  834. default:
  835. $data = array(
  836. 'msg' => 'Page not found',
  837. );
  838. common::echo_json_encode(500, $data);
  839. }
  840. $db->Close();
  841. $db = null;
  842. if ($max_ec > 0)
  843. ini_set('max_execution_time', $max_ec); //recover old value
  844. if (!empty($memory_limit))
  845. ini_set('memory_limit', $memory_limit);
  846. ?>