main_new_version.php 48 KB

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