1

Unit Report and Commands

(edited by farah.aidid 14/10/2020 16:17:27)

Topic: Unit Report and Commands

this is my request:
{"reportResourceId":20170575,"reportTemplateId":5,"reportTemplate":null,"reportObjectId":20171323,"reportObjectSecId":0,"interval":{"from":1574697600,"to":1574791199,"flags":16777216}}

path: /wialon/ajax.html?svc=report/exec_report&sid=<sid>



request params is like:

{"reportResourceId":20170575,"reportTemplateId":5,"reportTemplate":null,"reportObjectId":20171323,"reportObjectSecId":0,"interval":{"flags":16777216,"from":1574697600,"to":1574783999},"remoteExec":1,"reportObjectIdList":[]}

but, getting different response.

i am getting
2: "2019-11-25 22:43:07"
3: "2019-11-26 09:13:14"

but in your application getting:

2: "2019-11-26 06:43:07"
3: "2019-11-26 17:13:14"




Another issue i faced getting commands,
unit.getCommands()
this method sometimes returns null sometimes a list of commands .

I am getting user-access as value : 19327369763 (unit.getUserAccess())
and wialon.item.Unit.accessFlag.executeCommands value is: 16777216
so, when checking whether can-execute the command or not, returns false.
so, though i get a list of commands, i cannot execute them,

but when i go to the site from you [/ ] , i can see commands and also can execute them successfully.

I am confused about these issues, just want to know am i making any mistake or not.
please help me about this.

2

Unit Report and Commands

Re: Unit Report and Commands

Hello!

1. Reports results, messages result and other layesr are using UNIX time UTC+0
To get resutls with user's time zone you need to execute request render/set_locale after login
2. To execute commands the value is 16777216 - bit 24 is activated, but for value =  19327369763 the bit 24 is not
Please check the token access ritghts first.

Diana Cheley
Wialon Hosting Expert
Gurtam
3

Unit Report and Commands

Re: Unit Report and Commands

Hi, how can I execute such commands via JavaScript?

I was trying to follow : https://sdk.wialon.com/api/index.html#wialon
this site.

and, for "svc=unit/registry_fuel_filling_event" this, i faced issue:
I saw "registryFuelFillingEvent" in https://sdk.wialon.com/api/index.html#w … tRegistrar
but, when i try to get this method on code or browser console with wialon.item.MUnitEventRegistrar.registryFuelFillingEvent,
then, it says, "noSuchMethod",

can you please help me

4

Unit Report and Commands

Re: Unit Report and Commands

Hello!

you need to apply method registryFuelFillingEvent to element (item) unit.
For example,

var u = wialon.core.Session.getInstance().getItem(itemId); // get unit by id 
u.registryFuelFillingEvent(1575451750, "fill Dec 4", 27.42944, 53.905012, "Prituckogo 79, Minsk",512, 2000, 0, function (code) {  
    if (code) {
        msg(wialon.core.Errors.getErrorText(code));
    } 
});
Diana Cheley
Wialon Hosting Expert
Gurtam
5

Unit Report and Commands

Re: Unit Report and Commands

thank you so much

6

Unit Report and Commands

(edited by farah.aidid 14/10/2020 16:17:50)

Re: Unit Report and Commands

Hi, I am getting "Access Denied"

Request params : {"date":1572619983,"volume":2,"cost":4.36,"location":"Kampung Lakota, Jeli","deviation":30,"x":0,"y":0,"description":"Fuel filling of 0 l to the amount of 0 was made.","itemId":20022689}

7

Unit Report and Commands

Re: Unit Report and Commands

Hi farah.aidid

please check access rights (flags) via token

Diana Cheley
Wialon Hosting Expert
Gurtam
8

Unit Report and Commands

Re: Unit Report and Commands

Hi, when i am registering fuel event with registryFuelFillingEvent

i am sending time for example 15:30
but it is registered as 17:30

before sending i am also using :  customRenderer.setLocale(wialon.util.DateTime.getTimezone(),"en",{flags:256,formatDate:"%Y-%m-%E %H:%M:%S"}, (code) => {

9

Unit Report and Commands

Re: Unit Report and Commands

farah.aidid wrote:

Report

Hi!

via JS you need to register event in UTC+0 (unix time) if then the result will be viewed in Wialon - for example, in reports or on web part the result will be viewed depend on current user's timezone

Diana Cheley
Wialon Hosting Expert
Gurtam