From 0322c5f40390862a42869f9008d6450f4b841161 Mon Sep 17 00:00:00 2001 From: guo Date: Tue, 2 Aug 2022 19:49:39 +0800 Subject: [PATCH] fix:factory --- apps/dgiot_factory/priv/swagger/swagger_factory.json | 9 +++++++-- apps/dgiot_factory/src/dgiot_factory_data.erl | 4 ++-- apps/dgiot_factory/src/dgiot_factory_getdata.erl | 1 - apps/dgiot_factory/src/dgiot_factory_handler.erl | 1 - apps/dgiot_factory/src/dgiot_factory_shift.erl | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/dgiot_factory/priv/swagger/swagger_factory.json b/apps/dgiot_factory/priv/swagger/swagger_factory.json index 1800f4c5..28a94857 100644 --- a/apps/dgiot_factory/priv/swagger/swagger_factory.json +++ b/apps/dgiot_factory/priv/swagger/swagger_factory.json @@ -42,9 +42,9 @@ "description": "自定义", "type": "string" } - } } } + } ], "consumes": [ "application/json" @@ -85,6 +85,12 @@ "type": "string", "description": "查询日期" }, + { + "name": "depart", + "in": "query", + "type": "string", + "description": "查询部门" + }, { "name": "workshop", "in": "query", @@ -305,7 +311,6 @@ "description": "factory" } ] - } diff --git a/apps/dgiot_factory/src/dgiot_factory_data.erl b/apps/dgiot_factory/src/dgiot_factory_data.erl index 31ff7a2a..bc0803a4 100644 --- a/apps/dgiot_factory/src/dgiot_factory_data.erl +++ b/apps/dgiot_factory/src/dgiot_factory_data.erl @@ -112,9 +112,9 @@ handle_product_condition(_Channel, ProductId, DeviceId, DevAddr, _Type, #{<<"pro handle_product_condition(_Channel, ProductId, DeviceId, DevAddr, _Type, #{<<"product_condition">> := 3, <<"product_id">> := Product_id, <<"product_pnumber">> := Pnumber} = Payload) -> dgiot_task:save_td_no_match(ProductId, DevAddr, Payload#{<<"product_id">> => dgiot_utils:to_list(Product_id)}, #{}), - handle_storehouse(3, Pnumber, DeviceId), + handle_storehouse(3, Pnumber, DeviceId); %% handle_dingdan(DeviceId), - dgiot_jienuo_meter:test(Payload, DeviceId); +%% dgiot_jienuo_meter:test(Payload, DeviceId); handle_product_condition(_, _, _, _, _, _) -> diff --git a/apps/dgiot_factory/src/dgiot_factory_getdata.erl b/apps/dgiot_factory/src/dgiot_factory_getdata.erl index 6f873f25..0b56bded 100644 --- a/apps/dgiot_factory/src/dgiot_factory_getdata.erl +++ b/apps/dgiot_factory/src/dgiot_factory_getdata.erl @@ -29,7 +29,6 @@ get_work_sheet(ProductId, Type, Channel, DeviceId, Where, Limit, Skip, New) -> {Total, Res} = filter_data(Limit, Skip, HistoryData), MergeData = merge_data(ParseData, Res, DeviceId, ThingMap), NamedData = dgiot_factory_utils:turn_name(MergeData, ThingMap), - io:format("~s ~p NamedData= ~p ~n",[?FILE,?LINE,NamedData]), {ok, {Total, NamedData}}; _ -> error diff --git a/apps/dgiot_factory/src/dgiot_factory_handler.erl b/apps/dgiot_factory/src/dgiot_factory_handler.erl index 48b68cae..d56e6b4d 100644 --- a/apps/dgiot_factory/src/dgiot_factory_handler.erl +++ b/apps/dgiot_factory/src/dgiot_factory_handler.erl @@ -123,7 +123,6 @@ do_request(get_worker_shift, #{<<"depart">> := Depart, <<"date">> := Data, <<"wo {error, Msg} end; _ -> - case dgiot_factory_shift:get_shift(Data, Workshop) of {ok, Res} -> {Total, Result} = dgiot_factory_getdata:filter_data(Limit, Skip, Res), diff --git a/apps/dgiot_factory/src/dgiot_factory_shift.erl b/apps/dgiot_factory/src/dgiot_factory_shift.erl index 215c9476..3133e716 100644 --- a/apps/dgiot_factory/src/dgiot_factory_shift.erl +++ b/apps/dgiot_factory/src/dgiot_factory_shift.erl @@ -68,7 +68,7 @@ get_workshop(Tree, Acc,Department) -> _ -> lists:foldl( fun(X, ACC) -> - case maps:get(<<"alias">>, X, <<"">>) of + case maps:get(<<"depname">>, X, <<"">>) of Department -> Child = maps:get(<<"children">>, X, []), lists:foldl(