mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-12-02 04:08:54 +08:00
fix:jienuo
This commit is contained in:
parent
f3389364f9
commit
71c34270e1
@ -598,7 +598,7 @@ get_history_data(ProductId, DeviceId, Type, Function, FunctionMap, Group,Having,
|
||||
%% LimitAndSkip = limit_skip(Limit, Skip),
|
||||
case dgiot_tdengine:transaction(Channel,
|
||||
fun(Context) ->
|
||||
Sql = <<"SELECT ", Select/binary, " FROM ", From/binary, GROPU/binary,Have/binary, WHERE/binary, ORDER/binary, ";">>,
|
||||
Sql = <<"SELECT ", Select/binary, " FROM ", From/binary, WHERE/binary,GROPU/binary,Have/binary, ORDER/binary, ";">>,
|
||||
io:format("~s ~p Sql = ~p ~n", [?FILE, ?LINE, Sql]),
|
||||
dgiot_tdengine_pool:run_sql(Context#{<<"channel">> => Channel}, execute_query, Sql)
|
||||
end)
|
||||
|
@ -111,7 +111,8 @@ do_request(get_worker_shift, #{<<"date">> := Data, <<"workshop">> := Workshop, <
|
||||
WorkerList = re:split(Worker, " "),
|
||||
Options = lists:foldl(
|
||||
fun(X, Acc) ->
|
||||
Acc ++ [#{<<"label">> => X, <<"value">> => X}]
|
||||
V = dgiot_factory_shift:format_worker(X),
|
||||
Acc ++ [#{<<"label">> => X, <<"value">> => V}]
|
||||
end, [], WorkerList),
|
||||
{ok, #{<<"status">> => 0, msg => <<"数据请求成功"/utf8>>, <<"data">> => #{<<"options">> => Options}}};
|
||||
_ ->
|
||||
|
@ -18,7 +18,7 @@
|
||||
-author("jonhl").
|
||||
-include_lib("dgiot/include/logger.hrl").
|
||||
-include("dgiot_factory.hrl").
|
||||
-export([get_one_shift/1, save_one_shift/1, updata_id/0, get_shift/3, post_shift/1, get_all_shift/4, get_workshop/2]).
|
||||
-export([get_one_shift/1, save_one_shift/1, updata_id/0, get_shift/3, post_shift/1, get_all_shift/4, get_workshop/2,format_worker/1]).
|
||||
-export([post_one_shift/1, get_shift_time/1]).
|
||||
-export([ bits_to_workerlist/1, workerlist_to_bits/1]).
|
||||
-define(DAY, 86400).
|
||||
@ -148,7 +148,7 @@ get_shift(Department, Date, Workshop) ->
|
||||
fun(X, Acc) ->
|
||||
case get_one_shift(#{<<"date">> => Date, <<"device">> => Workshop, <<"shift">> => X}) of
|
||||
{ok, #{<<"worker">> := Worker}} ->
|
||||
Acc ++ [#{<<"date">> => Date, <<"device">> => Workshop, <<"shift">> => X, <<"worker">> => Worker}];
|
||||
Acc ++ [#{<<"date">> => Date, <<"device">> => Workshop, <<"shift">> => X, <<"worker">> => format_worker(Worker)}];
|
||||
_ ->
|
||||
Acc
|
||||
end
|
||||
@ -318,3 +318,18 @@ bits_to_workerlist(Bits) ->
|
||||
end
|
||||
end, {<<>>, 1}, List),
|
||||
Res.
|
||||
|
||||
|
||||
format_worker(Worker) ->
|
||||
WorkerList = re:split(Worker,<<" ">>),
|
||||
lists:foldl(
|
||||
fun(X, Acc)->
|
||||
case dgiot_data:get(?WORKERTREE,X) of
|
||||
not_find ->
|
||||
<<Acc/binary," ",X/binary>>;
|
||||
{_,_,Name,_} ->
|
||||
io:format("~s ~p Name = ~p.~n", [?FILE, ?LINE, Name]),
|
||||
|
||||
<<Acc/binary," ",Name/binary>>
|
||||
end
|
||||
end,<<"">>,WorkerList).
|
||||
|
Loading…
Reference in New Issue
Block a user