|
|
@@ -68,15 +68,15 @@ switch ($action) {
|
|
|
$edate = $_REQUEST["e_date"];
|
|
|
$edate = "'$edate'";
|
|
|
}
|
|
|
- //Demo测试数据 日期全为空
|
|
|
+ //Demo测试数据 日期全为空 :前端是由日期过来来的
|
|
|
$edate = "null";
|
|
|
$bdate = "null";
|
|
|
|
|
|
$sqlWhere = ' and ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
|
|
|
$sqlWhere = common::check_input($sqlWhere);
|
|
|
$sqlWhere = " " . $sqlWhere;
|
|
|
-
|
|
|
- $list = common::excuteListSql("select * from public.online_order_status_date('$type'::text, 'eta'::text, 'etd'::text, $bdate, $edate, '$sqlWhere'::text, '$container_type'::text) "
|
|
|
+ //online_order_status_date_new 与本地的区分,发布上去这去掉new
|
|
|
+ $list = common::excuteListSql("select * from public.online_order_status_date_new('$type'::text, 'eta'::text, 'etd'::text, $bdate, $edate, '$sqlWhere'::text, '$container_type'::text) "
|
|
|
. "r (c bigint, e integer, b integer, d text)");
|
|
|
$key = "[";
|
|
|
$value = "[";
|
|
|
@@ -103,8 +103,6 @@ switch ($action) {
|
|
|
}
|
|
|
$key .= "]";
|
|
|
$value .= "]";
|
|
|
-
|
|
|
- //$data = array($key, $value, $totalValue);
|
|
|
//处理返回原表数据格式
|
|
|
$data = common::mian_repot_do($value,$type,$totalValue);
|
|
|
common::echo_json_encode(200, $data);
|
|
|
@@ -133,10 +131,8 @@ switch ($action) {
|
|
|
$sqlWhere = common::check_input($sqlWhere);
|
|
|
$sqlWhere = " " . $sqlWhere;
|
|
|
|
|
|
- $list = common::excuteListSql("select * from public.online_order_status_date_kpi('$type'::text, 'eta'::text, 'etd'::text, $bdate, $edate, '$sqlWhere'::text, '$container_type'::text) "
|
|
|
- . "r (c bigint, d text)");
|
|
|
- error_log("select * from public.online_order_status_date_kpi('$type'::text, 'eta'::text, 'etd'::text, $bdate, $edate, '$sqlWhere'::text, '$container_type'::text) "
|
|
|
- . "r (c bigint, d text)");
|
|
|
+ $list = common::excuteListSql("select * from public.online_order_status_date_kpi_new('$type'::text,'$sqlWhere'::text) "
|
|
|
+ . "r (c bigint, d text)");
|
|
|
$key = "[";
|
|
|
$value = "[";
|
|
|
$totalValue = 0;
|
|
|
@@ -191,14 +187,12 @@ switch ($action) {
|
|
|
$edate = $_REQUEST["e_date"];
|
|
|
$edate = "'$edate'";
|
|
|
}
|
|
|
- //Demo测试数据 日期全为空
|
|
|
- $edate = "null";
|
|
|
- $bdate = "null";
|
|
|
$list= array();
|
|
|
//all 查询所有
|
|
|
$sqlWhere = ' and ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
|
|
|
$sqlWhere = common::check_input($sqlWhere);
|
|
|
$sqlWhere = " " . $sqlWhere;
|
|
|
+ //如果页面查询的是ALL 这个20 40 45都查询出来。否则值查询都对应的size,其他的不查询
|
|
|
if(strtolower($container_type_param) == "all"){
|
|
|
$list = common::excuteListSql("select * from public.online_order_status_date('$type'::text, 'eta'::text, 'etd'::text, $bdate, $edate, '$sqlWhere'::text, '$container_type'::text) "
|
|
|
. "r (c bigint, e integer, b integer, d text)");
|
|
|
@@ -236,8 +230,11 @@ switch ($action) {
|
|
|
$value .= "]";
|
|
|
$key_arr = json_decode($key,true);
|
|
|
$value_arr = json_decode($value,true);
|
|
|
+
|
|
|
$data = array();
|
|
|
+ //每一个size 的所有月份总计
|
|
|
$total = 0;
|
|
|
+ //每一个size 对应的最大值
|
|
|
$max = 0;
|
|
|
foreach($value_arr as $arr){
|
|
|
$data[] = intval($arr['value']);
|
|
|
@@ -249,18 +246,22 @@ switch ($action) {
|
|
|
|
|
|
//处理返回时数据格式
|
|
|
$ContainerCounSeries_return = array();
|
|
|
+ //横坐标栏位
|
|
|
$ContainerCount_Title = $key_arr;
|
|
|
+
|
|
|
+ //所查的所有模式计算总和
|
|
|
$total = 0;
|
|
|
+ //所有size下的最大值,方便标注计算最长的Y坐标
|
|
|
$max_all = 0;
|
|
|
foreach($ContainerCounSeries as $k =>$v){
|
|
|
- //这个type 是页面传过来的
|
|
|
+ //这个type 是页面传过来的。这个固定r2
|
|
|
$color = common::getItemStyle($type,$k);
|
|
|
$total = $total + $v['total'];
|
|
|
$ContainerCounSeries_return[] = array("name"=>$k,"type"=>"bar","emphasis" => array("focus" =>"none"),
|
|
|
"stack" =>"总计","data" =>$v['data'],"itemStyle" =>array("color" =>$color));
|
|
|
$max_all = $max_all + $v['max'];
|
|
|
}
|
|
|
- //处理返回原表数据格式
|
|
|
+ //计算Y坐标的间隔
|
|
|
$interval = utils::calculateTicks(0,$max_all,5);
|
|
|
if($interval == 0){
|
|
|
//处理返回默认值
|
|
|
@@ -365,40 +366,43 @@ switch ($action) {
|
|
|
exit();
|
|
|
break;
|
|
|
case 'main_map_new':
|
|
|
-
|
|
|
+ //修改添加port_of_transshipment 和port_of_transshipment_name的坐标获取(有为空的可能)
|
|
|
$serial_no = $_POST["serial_no"];
|
|
|
$sql = "with ss as (select '$serial_no' as sn)
|
|
|
- , aa as (
|
|
|
- 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 from public.online_ocean oo where serial_no=(select sn from ss) limit 1
|
|
|
- )
|
|
|
- , v1 as (select public.get_vessel_position(sn::text) bbb from ss)
|
|
|
- , t1 as (select tl.upload_time, tl.by_pickup, split_part(g.consignee_exp,'\n',1) as consignee_exp, split_part(g.pickup_from_exp,'\n',1) as pickup_from_exp, c.ctnr, split_part(g.deliveryto_exp,'\n',1) as deliveryto_exp, g.serial_no, tl.location, tl.type, tl.id,
|
|
|
- to_char(tl.upload_time, 'MM/DD/YYYY HH24:MI:SS') as utime
|
|
|
- from public.tk_general g, public.tk_commodity c left join public.tk_location tl on c.serial_no=tl.serial_no
|
|
|
+ , aa as (
|
|
|
+ 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.*
|
|
|
+ from public.online_ocean oo
|
|
|
+ left join LATERAL (
|
|
|
+ select (select uncode from ports where code = o.port_of_transshipment) as port_of_transshipment_un,
|
|
|
+ port_of_transshipment_name
|
|
|
+ from ocean o where o.serial_no=oo.serial_no order by id desc limit 1
|
|
|
+ ) dd on true
|
|
|
+ where serial_no=(select sn from ss) limit 1
|
|
|
+ )
|
|
|
+ , v1 as (select public.get_vessel_position(sn::text) bbb from ss)
|
|
|
+ , t1 as (
|
|
|
+ select tl.upload_time, tl.by_pickup, split_part(g.consignee_exp,'\n',1) as consignee_exp, split_part(g.pickup_from_exp,'\n',1) as pickup_from_exp,
|
|
|
+ c.ctnr, split_part(g.deliveryto_exp,'\n',1) as deliveryto_exp,g.serial_no, tl.location, tl.type, tl.id,
|
|
|
+ to_char(tl.upload_time, 'MM/DD/YYYY HH24:MI:SS') as utime
|
|
|
+ from public.tk_general g, public.tk_commodity c
|
|
|
+ left join public.tk_location tl on c.serial_no=tl.serial_no
|
|
|
where g.serial_no=c.serial_no and g.bol=(select m_bol from public.ocean where serial_no=(select sn from ss)) order by tl.order_id)
|
|
|
- , vv as (select split_part(split_part(bbb, '|', 2), ',', 1)::numeric as lng, split_part(split_part(bbb, '|', 2), ',', 2)::numeric as lat, 'Vessel: '||split_part(bbb, '|', 3) as infor, 5 as sort, null::timestamp without time zone as stime, 'vessel'::text as ptype from v1 where bbb is not null and bbb<>'')
|
|
|
- , tt as (select split_part(location, ',', 2)::numeric as lng, split_part(location, ',', 1)::numeric as lat, (
|
|
|
- case when type='26' then ctnr||': Pick up: '||utime||', '||(case when by_pickup=true then pickup_from_exp else consignee_exp end)
|
|
|
- else ctnr||': Delivery: '||utime||', '||(case when by_pickup=true then consignee_exp else deliveryto_exp end)
|
|
|
- end
|
|
|
- ) as infor, 6 as sort, upload_time as stime, case when type='26' then 'pickup'::text else 'delivery'::text end as ptype from t1 where location is not null and location<>'')
|
|
|
- , rr as (
|
|
|
- select lon as lng, lat as lat, 'Place of receipt: '||place_of_receipt_exp as infor, 0 as sort, null::timestamp without time zone as stime, 'por'::text as ptype from vessel.vt_unlocode, aa where lon<>0 and lat<>0 and lon is not null and lat is not null and uncode=place_of_receipt_un
|
|
|
- union all
|
|
|
- select lon as lng, lat as lat, 'POL: '||port_of_loading as infor, 1 as sort, null::timestamp without time zone as stime, 'pol'::text as ptype from vessel.vt_unlocode, aa where lon<>0 and lat<>0 and lon is not null and lat is not null and uncode=fport_of_loading_un
|
|
|
- union all
|
|
|
- select lon as lng, lat as lat, 'POD: '||port_of_discharge as infor, 2 as sort, null::timestamp without time zone as stime, 'pod'::text as ptype from vessel.vt_unlocode, aa where lon<>0 and lat<>0 and lon is not null and lat is not null and uncode=mport_of_discharge_un
|
|
|
- union all
|
|
|
- select lon as lng, lat as lat, 'Place of delivery: '||place_of_delivery_exp as infor, 3 as sort, null::timestamp without time zone as stime, 'poe'::text as ptype from vessel.vt_unlocode, aa where lon<>0 and lat<>0 and lon is not null and lat is not null and uncode=place_of_delivery_un
|
|
|
- union all
|
|
|
- select * from vv
|
|
|
- union all
|
|
|
- select * from tt
|
|
|
- )
|
|
|
+ , rr as (
|
|
|
+ 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
|
|
|
+ from vessel.vt_unlocode, aa where lon<>0 and lat<>0 and lon is not null and lat is not null and uncode=fport_of_loading_un
|
|
|
+ union all
|
|
|
+ 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
|
|
|
+ from vessel.vt_unlocode, aa where lon<>0 and lat<>0 and lon is not null and lat is not null and uncode=mport_of_discharge_un
|
|
|
+ union all
|
|
|
+ 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
|
|
|
+ from vessel.vt_unlocode, aa where lon<>0 and lat<>0 and lon is not null and lat is not null and uncode=port_of_transshipment_un
|
|
|
+ )
|
|
|
select * from rr order by sort, stime";
|
|
|
$rss = common::excuteListSql($sql);
|
|
|
//先固定死
|
|
|
- $json = '[{"lng":"100.78594000","lat":"13.68521000","infor":"Place of receipt: LAT KRABANG, THAILAND","sort":"0","stime":null,"ptype":"por"},{"lng":"100.88333333","lat":"13.08333333","infor":"POL: LAEM CHABANG PORT,THAILAND","sort":"1","stime":null,"ptype":"pol"},{"lng":"-122.28640000","lat":"37.79784000","infor":"POD: OAKLAND, CA, USA","sort":"2","stime":null,"ptype":"pod"},{"lng":"93.78333333","lat":"37.68333333","infor":"Place of delivery: STOCKTON, CA, USA","sort":"3","stime":null,"ptype":"poe"}]';
|
|
|
+ $json = '[{"lng":"100.78594000","lat":"13.68521000","label":"Origin","infor":"LAT KRABANG, THAILAND","sort":"0","stime":null,"ptype":"por"},
|
|
|
+ {"lng":"100.88333333","lat":"13.08333333","label":"Destination","infor":"LAEM CHABANG PORT,THAILAND","sort":"1","stime":null,"ptype":"pol"},
|
|
|
+ {"lng":"-122.28640000","lat":"37.79784000","label":"Transfer","infor":"OAKLAND, CA, USA","sort":"2","stime":null,"ptype":"pod"}]';
|
|
|
$rss = json_decode($json,true);
|
|
|
common::echo_json_encode(200, $rss);
|
|
|
exit();
|