@idm-plugin/vessel 1.6.5 → 1.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +330 -331
- package/dist/index.umd.cjs +1 -1
- package/dist/speed/src/index.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,9 +7,9 @@ import w from "moment";
|
|
|
7
7
|
import { LngLatHelper as z, LaneHelper as B } from "@idm-plugin/geo";
|
|
8
8
|
import { MeteoHelper2 as ot, MeteoHelper as nt } from "@idm-plugin/meteo2";
|
|
9
9
|
import { Meteo2Assist as tt } from "@idm-plugin/meteo";
|
|
10
|
-
let
|
|
10
|
+
let g;
|
|
11
11
|
try {
|
|
12
|
-
|
|
12
|
+
g = Q.getLogger("vessel");
|
|
13
13
|
} catch {
|
|
14
14
|
} finally {
|
|
15
15
|
}
|
|
@@ -70,7 +70,7 @@ class vt extends U {
|
|
|
70
70
|
grant_type: "client_credentials"
|
|
71
71
|
}
|
|
72
72
|
}, a = await R.post(o, i).json();
|
|
73
|
-
|
|
73
|
+
g == null || g.info("[%s] fetch access token from: %s - %j", t.requestId, o, a), a.error || (this.token = {
|
|
74
74
|
accessToken: a.access_token,
|
|
75
75
|
tokenType: a.token_type,
|
|
76
76
|
expiresIn: a.expires_in,
|
|
@@ -80,21 +80,21 @@ class vt extends U {
|
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
async realTimePosition(t, o = {}) {
|
|
83
|
-
var
|
|
84
|
-
(!this.token || w().diff(w(this.token.issuedAt), "seconds") > ((
|
|
83
|
+
var h, y, l;
|
|
84
|
+
(!this.token || w().diff(w(this.token.issuedAt), "seconds") > ((h = this.token) == null ? void 0 : h.expiresIn) - 300) && await this.authToken(o);
|
|
85
85
|
const i = "https://svc.data.myvessel.cn/sdc/v1/vessels/status/location/unit", a = {
|
|
86
86
|
headers: {
|
|
87
|
-
Authorization: `${(y = this.token) == null ? void 0 : y.tokenType} ${(
|
|
87
|
+
Authorization: `${(y = this.token) == null ? void 0 : y.tokenType} ${(l = this.token) == null ? void 0 : l.accessToken}`
|
|
88
88
|
},
|
|
89
89
|
searchParams: { mmsi: t }
|
|
90
90
|
};
|
|
91
|
-
|
|
91
|
+
g == null || g.info("[%s] fetch realtime position from: %s - %j", o.requestId, i, a);
|
|
92
92
|
const n = await R.get(i, a).json();
|
|
93
93
|
if (n.code)
|
|
94
|
-
return
|
|
94
|
+
return g == null || g.warn("[%s] fetch realtime position failed: %j", o.requestId, i, { message: n.message, status: n.status, code: n.code }), n;
|
|
95
95
|
const s = n.data;
|
|
96
|
-
for (const
|
|
97
|
-
!isNaN(s[
|
|
96
|
+
for (const f in s)
|
|
97
|
+
!isNaN(s[f]) && Number(s[f]) !== 1 / 0 && (s[f] = Number(s[f]));
|
|
98
98
|
const d = w(`${s.postime} +08:00`, "YYYY-MM-DD HH:mm:ss +08:00");
|
|
99
99
|
return {
|
|
100
100
|
mmsi: s.mmsi,
|
|
@@ -123,16 +123,16 @@ class vt extends U {
|
|
|
123
123
|
}
|
|
124
124
|
async trajectory(t, o, i, a, n = !0, s = {}) {
|
|
125
125
|
(!this.token || w().diff(w(this.token.issuedAt), "seconds") > this.token.expiresIn - 300) && await this.authToken(s);
|
|
126
|
-
const d = await this.realTimePosition(t, s), r = w(o),
|
|
127
|
-
for (;
|
|
126
|
+
const d = await this.realTimePosition(t, s), r = w(o), h = w(i), y = [];
|
|
127
|
+
for (; h.diff(r, "day", !0) > 30; )
|
|
128
128
|
await this.trajectoryIn30Day(t, r, r.clone().add(30, "day"), d, a, y, s), r.add(30, "day");
|
|
129
|
-
return await this.trajectoryIn30Day(t, r,
|
|
129
|
+
return await this.trajectoryIn30Day(t, r, h, d, a, y, s), y;
|
|
130
130
|
}
|
|
131
131
|
async trajectoryIn30Day(t, o, i, a, n, s, d = {}) {
|
|
132
|
-
var u,
|
|
133
|
-
const r = "https://svc.data.myvessel.cn/sdc/v1/vessels/status/track",
|
|
132
|
+
var u, b, k, v, p;
|
|
133
|
+
const r = "https://svc.data.myvessel.cn/sdc/v1/vessels/status/track", h = {
|
|
134
134
|
headers: {
|
|
135
|
-
Authorization: `${(u = this.token) == null ? void 0 : u.tokenType} ${(
|
|
135
|
+
Authorization: `${(u = this.token) == null ? void 0 : u.tokenType} ${(b = this.token) == null ? void 0 : b.accessToken}`
|
|
136
136
|
},
|
|
137
137
|
json: {
|
|
138
138
|
mmsi: t,
|
|
@@ -140,16 +140,16 @@ class vt extends U {
|
|
|
140
140
|
endTime: i.utcOffset(8).format("YYYY-MM-DD HH:mm:ss")
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
|
-
|
|
144
|
-
const y = await R.post(r,
|
|
143
|
+
g == null || g.info("[%s] fetch trajectory from: %s - %j", d.requestId, r, h);
|
|
144
|
+
const y = await R.post(r, h).json();
|
|
145
145
|
if (y.code)
|
|
146
|
-
return
|
|
147
|
-
let
|
|
148
|
-
const
|
|
149
|
-
return (
|
|
150
|
-
for (const
|
|
151
|
-
!isNaN(c[
|
|
152
|
-
const
|
|
146
|
+
return g == null || g.warn("[%s] fetch trajectory failed: %j", d.requestId, r, { message: y.message, status: y.status, code: y.code }), y;
|
|
147
|
+
let l = -1;
|
|
148
|
+
const f = w(`${(v = (k = y.data) == null ? void 0 : k[0]) == null ? void 0 : v.postime} +08:00`, "YYYY-MM-DD HH:mm:ss +08:00");
|
|
149
|
+
return (p = y.data) == null || p.forEach((c) => {
|
|
150
|
+
for (const q in c)
|
|
151
|
+
!isNaN(c[q]) && Number(c[q]) !== 1 / 0 && (c[q] = Number(c[q]));
|
|
152
|
+
const M = w(`${c.postime} +08:00`, "YYYY-MM-DD HH:mm:ss +08:00"), N = c.status, { labelCn: m, labelEn: S } = this.parseStatus(N), j = {
|
|
153
153
|
mmsi: c.mmsi,
|
|
154
154
|
imo: a == null ? void 0 : a.imo,
|
|
155
155
|
lat: c.lat,
|
|
@@ -158,17 +158,17 @@ class vt extends U {
|
|
|
158
158
|
cog: c.cog,
|
|
159
159
|
hdg: c.hdg,
|
|
160
160
|
draught: c.draught,
|
|
161
|
-
status:
|
|
161
|
+
status: N,
|
|
162
162
|
eta: /\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/.test(c.eta) ? w(`${c.eta} +08:00`, "YYYY-MM-DD HH:mm:ss +08:00").utc().format() : void 0,
|
|
163
163
|
destination: c.dest,
|
|
164
|
-
positionTime:
|
|
165
|
-
labelCn:
|
|
166
|
-
labelEn:
|
|
164
|
+
positionTime: M.unix(),
|
|
165
|
+
labelCn: m,
|
|
166
|
+
labelEn: S,
|
|
167
167
|
method: "trajectory",
|
|
168
168
|
vendor: "myVessel",
|
|
169
|
-
utc:
|
|
170
|
-
},
|
|
171
|
-
|
|
169
|
+
utc: M.utc().format()
|
|
170
|
+
}, C = Math.floor(M.diff(f, "minute", !0) / (n || 1));
|
|
171
|
+
C !== l && (l = C, s.push(j));
|
|
172
172
|
}), s;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
@@ -185,14 +185,14 @@ class wt extends U {
|
|
|
185
185
|
usertoken: this.token
|
|
186
186
|
}
|
|
187
187
|
}, n = await R.post(i, a).json();
|
|
188
|
-
|
|
188
|
+
g == null || g.info("[%s] fetch realtime position from: %s - %j", o.requestId, i, a);
|
|
189
189
|
const s = n == null ? void 0 : n.list;
|
|
190
190
|
if (!s)
|
|
191
|
-
return
|
|
192
|
-
for (const
|
|
193
|
-
!isNaN(s[
|
|
191
|
+
return g == null || g.warn("[%s] fetch realtime position failed: %j", o.requestId, i, n), n;
|
|
192
|
+
for (const f in s)
|
|
193
|
+
!isNaN(s[f]) && Number(s[f]) !== 1 / 0 && (s[f] = Number(s[f]));
|
|
194
194
|
s.status = s.sp > 3 ? 0 : 1;
|
|
195
|
-
const d = s.status, { labelCn: r, labelEn:
|
|
195
|
+
const d = s.status, { labelCn: r, labelEn: h } = this.parseStatus(d), y = w(`${s.ti} +08:00`, "YYYY-MM-DD HH:mm:ss +08:00");
|
|
196
196
|
return {
|
|
197
197
|
mmsi: s.m,
|
|
198
198
|
name: s.n,
|
|
@@ -213,7 +213,7 @@ class wt extends U {
|
|
|
213
213
|
utc: y.utc().format(),
|
|
214
214
|
status: d,
|
|
215
215
|
labelCn: r,
|
|
216
|
-
labelEn:
|
|
216
|
+
labelEn: h,
|
|
217
217
|
method: "position",
|
|
218
218
|
vendor: "hifleet"
|
|
219
219
|
};
|
|
@@ -231,7 +231,7 @@ class wt extends U {
|
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
233
|
let n = await R.post(i, a).json();
|
|
234
|
-
|
|
234
|
+
g == null || g.info("[%s] fetch vessel props from: %s - %j", o.requestId, i, a), n instanceof Array && (n = n[0]);
|
|
235
235
|
for (const d in n)
|
|
236
236
|
!isNaN(n[d]) && Number(n[d]) !== 1 / 0 && (n[d] = Number(n[d]));
|
|
237
237
|
const s = {
|
|
@@ -244,7 +244,7 @@ class wt extends U {
|
|
|
244
244
|
draught: n.dr,
|
|
245
245
|
type: n.t
|
|
246
246
|
};
|
|
247
|
-
return i = "https://www.hifleet.com/hifleetapi/sameShipSearch.do", n = await R.post(i, a).json(),
|
|
247
|
+
return i = "https://www.hifleet.com/hifleetapi/sameShipSearch.do", n = await R.post(i, a).json(), g == null || g.info("[%s] search vessel dead weight from: %s - %j", o.requestId, i, a), n instanceof Array && (n = n[0]), n && (s.deadweight = Number(n.dwt)), s;
|
|
248
248
|
}
|
|
249
249
|
async suggest(t, o = {}) {
|
|
250
250
|
const i = "https://www.hifleet.com/hifleetapi/getShipSuggest.do", a = {
|
|
@@ -257,7 +257,7 @@ class wt extends U {
|
|
|
257
257
|
Host: "www.hifleet.com"
|
|
258
258
|
}
|
|
259
259
|
}, n = await R.post(i, a).json();
|
|
260
|
-
|
|
260
|
+
g == null || g.info("[%s] suggest vessel props from: %s - %j", o.requestId, i, a);
|
|
261
261
|
const s = [];
|
|
262
262
|
for (const d of n)
|
|
263
263
|
s.push({
|
|
@@ -270,52 +270,52 @@ class wt extends U {
|
|
|
270
270
|
return s.sort((d, r) => r.score - d.score), s;
|
|
271
271
|
}
|
|
272
272
|
async trajectory(t, o, i, a, n = !0, s = {}) {
|
|
273
|
-
var c,
|
|
273
|
+
var c, M, N;
|
|
274
274
|
const d = await this.realTimePosition(t, s);
|
|
275
275
|
let r = w(o);
|
|
276
|
-
const
|
|
276
|
+
const h = w(i), y = w();
|
|
277
277
|
if (n) {
|
|
278
|
-
let
|
|
279
|
-
|
|
278
|
+
let m = h.diff(r, "d", !0);
|
|
279
|
+
m < 0 ? r = h.clone().subtract(40, "d") : m < 30 ? r.subtract(10, "d") : m < 60 ? r.subtract(5, "d") : r = h.clone().subtract(80, "d"), m = y.diff(h, "d", !0), h.add(m > 10 ? 240 : m * 24, "h");
|
|
280
280
|
}
|
|
281
|
-
const
|
|
281
|
+
const l = {
|
|
282
282
|
searchParams: {
|
|
283
|
-
endtime:
|
|
283
|
+
endtime: h.utcOffset("+8:00").format("YYYY-MM-DD HH:mm:ss"),
|
|
284
284
|
starttime: r.utcOffset("+8:00").format("YYYY-MM-DD HH:mm:ss"),
|
|
285
285
|
mmsi: t,
|
|
286
286
|
usertoken: this.token
|
|
287
287
|
}
|
|
288
|
-
},
|
|
289
|
-
|
|
290
|
-
let
|
|
291
|
-
u && (
|
|
288
|
+
}, f = "https://api.hifleet.com/position/trajectory/nocompressed/withstatic/token", u = await R.get(f, l).json();
|
|
289
|
+
g == null || g.info("[%s] fetch trajectory from: %s - %j", s.requestId, f, l);
|
|
290
|
+
let b;
|
|
291
|
+
u && (b = ((M = (c = u.ships) == null ? void 0 : c.offors) == null ? void 0 : M.ship) || [], b.length || g == null || g.warn("[%s] fetch trajectory failed: %j", s.requestId, u));
|
|
292
292
|
const k = [];
|
|
293
|
-
let
|
|
294
|
-
const
|
|
295
|
-
for (const
|
|
296
|
-
for (const
|
|
297
|
-
!isNaN(
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
const { labelEn:
|
|
301
|
-
mmsi:
|
|
302
|
-
name:
|
|
293
|
+
let v = -1;
|
|
294
|
+
const p = w(`${(N = b == null ? void 0 : b[0]) == null ? void 0 : N.ti} +08:00`, "YYYY-MM-DD HH:mm:ss +08:00");
|
|
295
|
+
for (const m of b) {
|
|
296
|
+
for (const D in m)
|
|
297
|
+
!isNaN(m[D]) && Number(m[D]) !== 1 / 0 && (m[D] = Number(m[D]));
|
|
298
|
+
const S = w(`${m.ti} +08:00`, "YYYY-MM-DD HH:mm:ss +08:00");
|
|
299
|
+
m.status = m.sp > 4 ? 0 : 1;
|
|
300
|
+
const { labelEn: j, labelCn: C } = this.parseStatus(m.status), q = {
|
|
301
|
+
mmsi: m.m,
|
|
302
|
+
name: m.n,
|
|
303
303
|
imo: d == null ? void 0 : d.imo,
|
|
304
|
-
lat:
|
|
305
|
-
lng:
|
|
306
|
-
draught:
|
|
307
|
-
sog:
|
|
308
|
-
cog:
|
|
309
|
-
hdg:
|
|
310
|
-
positionTime:
|
|
311
|
-
utc:
|
|
312
|
-
status:
|
|
313
|
-
labelCn:
|
|
314
|
-
labelEn:
|
|
304
|
+
lat: m.la,
|
|
305
|
+
lng: m.lo,
|
|
306
|
+
draught: m.draught,
|
|
307
|
+
sog: m.sp,
|
|
308
|
+
cog: m.co,
|
|
309
|
+
hdg: m.hdg,
|
|
310
|
+
positionTime: S.unix(),
|
|
311
|
+
utc: S.utc().format(),
|
|
312
|
+
status: m.status,
|
|
313
|
+
labelCn: C,
|
|
314
|
+
labelEn: j,
|
|
315
315
|
method: "trajectory",
|
|
316
316
|
vendor: "hifleet"
|
|
317
|
-
},
|
|
318
|
-
|
|
317
|
+
}, T = Math.floor(S.diff(p, "minute", !0) / (a || 1));
|
|
318
|
+
T !== v && (v = T, k.push(q));
|
|
319
319
|
}
|
|
320
320
|
return k;
|
|
321
321
|
}
|
|
@@ -334,12 +334,12 @@ class pt extends U {
|
|
|
334
334
|
enc: 1
|
|
335
335
|
}
|
|
336
336
|
}, a = "https://api.shipxy.com/apicall/GetSingleShip", n = await R.get(a, i).json();
|
|
337
|
-
if (
|
|
337
|
+
if (g == null || g.info("[%s] fetch realtime position from: %s - %j", o.requestId, a, i), (n == null ? void 0 : n.status) !== 0)
|
|
338
338
|
return n;
|
|
339
339
|
const s = n.data[0];
|
|
340
|
-
for (const
|
|
341
|
-
!isNaN(s[
|
|
342
|
-
const { labelCn: d, labelEn: r } = await this.parseStatus(s.navistat),
|
|
340
|
+
for (const l in s)
|
|
341
|
+
!isNaN(s[l]) && Number(s[l]) !== 1 / 0 && (s[l] = Number(s[l]));
|
|
342
|
+
const { labelCn: d, labelEn: r } = await this.parseStatus(s.navistat), h = w.unix(s.lasttime);
|
|
343
343
|
return {
|
|
344
344
|
mmsi: s.ShipID,
|
|
345
345
|
name: s.name,
|
|
@@ -355,7 +355,7 @@ class pt extends U {
|
|
|
355
355
|
hdg: Math.round(s.hdg / 100 * 100) / 100,
|
|
356
356
|
rot: Math.round(s.rot / 100 * 100) / 100,
|
|
357
357
|
positionTime: s.lasttime,
|
|
358
|
-
utc:
|
|
358
|
+
utc: h.utc().format(),
|
|
359
359
|
status: s.navistat,
|
|
360
360
|
labelEn: r,
|
|
361
361
|
labelCn: d,
|
|
@@ -364,37 +364,37 @@ class pt extends U {
|
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
366
|
async trajectory(t, o, i, a, n = !0, s = {}) {
|
|
367
|
-
var
|
|
368
|
-
const d = await this.realTimePosition(t, s), r = w(o),
|
|
367
|
+
var p;
|
|
368
|
+
const d = await this.realTimePosition(t, s), r = w(o), h = w(i), y = "https://api.shipxy.com/apicall/GetShipTrack", l = {
|
|
369
369
|
searchParams: {
|
|
370
370
|
id: t,
|
|
371
371
|
k: this.token,
|
|
372
372
|
enc: 1,
|
|
373
373
|
cut: 0,
|
|
374
374
|
btm: r.unix(),
|
|
375
|
-
etm:
|
|
375
|
+
etm: h.unix()
|
|
376
376
|
}
|
|
377
|
-
},
|
|
378
|
-
if (
|
|
379
|
-
return
|
|
380
|
-
const u =
|
|
381
|
-
let
|
|
377
|
+
}, f = await R.get(y, l).json();
|
|
378
|
+
if (g == null || g.info("[%s] fetch trajectory from: %s - %j", s.requestId, y, l), (f == null ? void 0 : f.status) !== 0)
|
|
379
|
+
return f;
|
|
380
|
+
const u = f == null ? void 0 : f.points, b = [], k = w.unix((p = u[0]) == null ? void 0 : p.utc);
|
|
381
|
+
let v = -1;
|
|
382
382
|
for (const c of u) {
|
|
383
|
-
const
|
|
383
|
+
const M = w.unix(c.utc), N = {
|
|
384
384
|
imo: d == null ? void 0 : d.imo,
|
|
385
385
|
mmsi: t,
|
|
386
386
|
sog: Math.round(c.sog * 3600 / 1e3 / 1852 * 100) / 100,
|
|
387
387
|
cog: Math.round(c.cog / 100 * 100) / 100,
|
|
388
388
|
lat: Math.round(c.lat / 1e6 * 1e5) / 1e5,
|
|
389
389
|
lng: Math.round(c.lon / 1e6 * 1e5) / 1e5,
|
|
390
|
-
positionTime:
|
|
391
|
-
utc:
|
|
390
|
+
positionTime: M.unix(),
|
|
391
|
+
utc: M.utc().format(),
|
|
392
392
|
method: "trajectory",
|
|
393
393
|
vendor: "shipxy"
|
|
394
|
-
},
|
|
395
|
-
|
|
394
|
+
}, m = Math.floor(M.diff(k, "minute", !0) / (a || 1));
|
|
395
|
+
m !== v && (v = m, b.push(N));
|
|
396
396
|
}
|
|
397
|
-
return
|
|
397
|
+
return b;
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
class It extends U {
|
|
@@ -412,7 +412,7 @@ class It extends U {
|
|
|
412
412
|
mmsiList: t
|
|
413
413
|
}
|
|
414
414
|
}, a = "https://api3.myships.com/sp/ships/getShipIdByMMSI", n = await R.post(a, i).json();
|
|
415
|
-
return
|
|
415
|
+
return g == null || g.info("[%s] fetch ship id from: %s - %j", o.requestId, a, i), n.code !== "0" ? n : n.data[0].shipId;
|
|
416
416
|
}
|
|
417
417
|
async getShipInfo(t, o = {}) {
|
|
418
418
|
const i = {
|
|
@@ -423,11 +423,11 @@ class It extends U {
|
|
|
423
423
|
shipId: t
|
|
424
424
|
}
|
|
425
425
|
}, a = "https://api3.myships.com/sp/ships/aissta", n = await R.post(a, i).json();
|
|
426
|
-
if (
|
|
426
|
+
if (g == null || g.info("[%s] fetch ship info from: %s - %j", o.requestId, a, i), n.code !== "0")
|
|
427
427
|
return n;
|
|
428
428
|
const s = n.data;
|
|
429
429
|
let d = s.imo;
|
|
430
|
-
return t === "407170" && (d = "9198379",
|
|
430
|
+
return t === "407170" && (d = "9198379", g == null || g.warn("[%s] ship(%s) imo error: %s, should be %s", o.requestId, t, s.imo, d)), {
|
|
431
431
|
mmsi: s.mmsi,
|
|
432
432
|
name: s.shipnameEn,
|
|
433
433
|
imo: d,
|
|
@@ -446,11 +446,11 @@ class It extends U {
|
|
|
446
446
|
shipId: i
|
|
447
447
|
}
|
|
448
448
|
}, s = "https://api3.myships.com/sp/ships/position/latest", d = await R.post(s, n).json();
|
|
449
|
-
|
|
449
|
+
g == null || g.info("[%s] fetch realtime position from: %s - %j", o.requestId, s, n);
|
|
450
450
|
const r = d.data[0];
|
|
451
451
|
for (const u in r)
|
|
452
452
|
!isNaN(r[u]) && Number(r[u]) !== 1 / 0 && (r[u] = Number(r[u]));
|
|
453
|
-
const { labelCn:
|
|
453
|
+
const { labelCn: h, labelEn: y } = await this.parseStatus(r.aisNavStatus), l = w.unix(r.posTime);
|
|
454
454
|
return {
|
|
455
455
|
...a,
|
|
456
456
|
mmsi: t,
|
|
@@ -461,23 +461,23 @@ class It extends U {
|
|
|
461
461
|
hdg: Math.round(r.heading * 100) / 100,
|
|
462
462
|
rot: Math.round(r.rot * 100) / 100,
|
|
463
463
|
positionTime: r.posTime,
|
|
464
|
-
utc:
|
|
464
|
+
utc: l.utc().format(),
|
|
465
465
|
status: r.aisNavStatus,
|
|
466
466
|
labelEn: y,
|
|
467
|
-
labelCn:
|
|
467
|
+
labelCn: h,
|
|
468
468
|
method: "position",
|
|
469
469
|
vendor: "myship"
|
|
470
470
|
};
|
|
471
471
|
}
|
|
472
472
|
async trajectory(t, o, i, a, n = !0, s = {}) {
|
|
473
|
-
const d = w(o), r = w(i),
|
|
473
|
+
const d = w(o), r = w(i), h = await this.getShipId(t), y = await this.getShipInfo(h), l = [];
|
|
474
474
|
for (; r.diff(d, "day", !0) > 30; )
|
|
475
|
-
await this.trajectoryIn30Day(
|
|
476
|
-
return await this.trajectoryIn30Day(
|
|
475
|
+
await this.trajectoryIn30Day(h, d.unix(), d.add(30, "day").unix(), y, t, a, l);
|
|
476
|
+
return await this.trajectoryIn30Day(h, d.unix(), r.unix(), y, t, a, l), l;
|
|
477
477
|
}
|
|
478
478
|
async trajectoryIn30Day(t, o, i, a, n, s, d, r = {}) {
|
|
479
479
|
var k;
|
|
480
|
-
const
|
|
480
|
+
const h = {
|
|
481
481
|
headers: {
|
|
482
482
|
appKey: this.token
|
|
483
483
|
},
|
|
@@ -486,30 +486,30 @@ class It extends U {
|
|
|
486
486
|
startTime: o,
|
|
487
487
|
endTime: i
|
|
488
488
|
}
|
|
489
|
-
}, y = "https://api3.myships.com/sp/ships/position/history",
|
|
490
|
-
if (
|
|
491
|
-
return
|
|
492
|
-
const
|
|
493
|
-
for (const
|
|
494
|
-
!isNaN(
|
|
495
|
-
const u = w.unix((k =
|
|
496
|
-
let
|
|
497
|
-
for (const
|
|
498
|
-
const
|
|
489
|
+
}, y = "https://api3.myships.com/sp/ships/position/history", l = await R.post(y, h).json();
|
|
490
|
+
if (g == null || g.info("[%s] fetch trajectory from: %s - %j", r.requestId, y, h), l.code !== "0")
|
|
491
|
+
return g == null || g.warn("[%s] invoke myship trajectory failed: %j", r.requestId, l), l;
|
|
492
|
+
const f = l.data;
|
|
493
|
+
for (const v in f)
|
|
494
|
+
!isNaN(f[v]) && Number(f[v]) !== 1 / 0 && (f[v] = Number(f[v]));
|
|
495
|
+
const u = w.unix((k = f[0]) == null ? void 0 : k.posTime);
|
|
496
|
+
let b = -1;
|
|
497
|
+
for (const v of f) {
|
|
498
|
+
const p = w.unix(v.posTime), c = {
|
|
499
499
|
imo: a == null ? void 0 : a.imo,
|
|
500
500
|
mmsi: n,
|
|
501
|
-
lat: Math.round(
|
|
502
|
-
lng: Math.round(
|
|
503
|
-
sog: Math.round(
|
|
504
|
-
cog: Math.round(
|
|
505
|
-
hdg: Math.round(
|
|
506
|
-
rot: Math.round(
|
|
507
|
-
positionTime:
|
|
508
|
-
utc:
|
|
501
|
+
lat: Math.round(v.lat / 1e4 / 60 * 1e5) / 1e5,
|
|
502
|
+
lng: Math.round(v.lon / 1e4 / 60 * 1e5) / 1e5,
|
|
503
|
+
sog: Math.round(v.sog / 10 * 100) / 100,
|
|
504
|
+
cog: Math.round(v.cog / 10 * 100) / 100,
|
|
505
|
+
hdg: Math.round(v.heading * 100) / 100,
|
|
506
|
+
rot: Math.round(v.rot * 100) / 100,
|
|
507
|
+
positionTime: p.unix(),
|
|
508
|
+
utc: p.utc().format(),
|
|
509
509
|
method: "trajectory",
|
|
510
510
|
vendor: "myship"
|
|
511
|
-
},
|
|
512
|
-
|
|
511
|
+
}, M = Math.floor(p.diff(u, "minute", !0) / (s || 1));
|
|
512
|
+
M !== b && (b = M, d.push(c));
|
|
513
513
|
}
|
|
514
514
|
return d;
|
|
515
515
|
}
|
|
@@ -537,13 +537,13 @@ class rt {
|
|
|
537
537
|
if (!a)
|
|
538
538
|
return;
|
|
539
539
|
const n = {};
|
|
540
|
-
for (let
|
|
541
|
-
const y = (r = (d = a[
|
|
542
|
-
if (
|
|
540
|
+
for (let h = 0; h < (a == null ? void 0 : a.length); h++) {
|
|
541
|
+
const y = (r = (d = a[h].match(o)) == null ? void 0 : d[0]) == null ? void 0 : r.split("],");
|
|
542
|
+
if (h === 0 && !y)
|
|
543
543
|
n.scope = a[0];
|
|
544
544
|
else if (y)
|
|
545
|
-
for (let
|
|
546
|
-
const u = this.parseRule(y[
|
|
545
|
+
for (let l = 0, f = y.length; l < f; l++) {
|
|
546
|
+
const u = this.parseRule(y[l]);
|
|
547
547
|
u && (n[u.level] ? u.key ? n[u.level][u == null ? void 0 : u.key] = u : n[u.level] = u : u.key ? n[u.level] = { [u == null ? void 0 : u.key]: u } : n[u.level] = u);
|
|
548
548
|
}
|
|
549
549
|
}
|
|
@@ -575,26 +575,26 @@ class rt {
|
|
|
575
575
|
* @param options
|
|
576
576
|
*/
|
|
577
577
|
checkWeather(e, t, o = {}) {
|
|
578
|
-
var u,
|
|
578
|
+
var u, b, k, v, p, c, M, N, m, S, j, C, q, T, D;
|
|
579
579
|
let i = 0, a = 0, n = 0, s = 0;
|
|
580
|
-
const d = Math.round(((
|
|
580
|
+
const d = Math.round(((b = (u = t == null ? void 0 : t.SEVERE) == null ? void 0 : u.sigWave) == null ? void 0 : b.number) * 1.6 * 100) / 100, r = (v = (k = t == null ? void 0 : t.SEVERE) == null ? void 0 : k.sigWave) == null ? void 0 : v.number, h = (c = (p = t == null ? void 0 : t.HEAVY) == null ? void 0 : p.sigWave) == null ? void 0 : c.number, y = Math.round((((N = (M = t == null ? void 0 : t.SEVERE) == null ? void 0 : M.wind) == null ? void 0 : N.number) + 2) * 100) / 100, l = (S = (m = t == null ? void 0 : t.SEVERE) == null ? void 0 : m.wind) == null ? void 0 : S.number, f = (C = (j = t == null ? void 0 : t.HEAVY) == null ? void 0 : j.wind) == null ? void 0 : C.number;
|
|
581
581
|
for (let V = 0; V < (e == null ? void 0 : e.length); V++) {
|
|
582
|
-
const H = e[V],
|
|
583
|
-
s = J > s ? J : s, W == null || W.info("[%s] check sig.wave: %j", o.requestId, { ...
|
|
582
|
+
const H = e[V], P = (T = (q = H == null ? void 0 : H.meteo) == null ? void 0 : q.wave) == null ? void 0 : T.sig, A = (D = H == null ? void 0 : H.meteo) == null ? void 0 : D.wind, J = V ? w(H.eta).diff(w(e[V - 1].eta), "hour", !0) : 0;
|
|
583
|
+
s = J > s ? J : s, W == null || W.info("[%s] check sig.wave: %j", o.requestId, { ...P, dgThd4Wv: d, svThd4Wv: r, hvThd4Wv: h }), (P == null ? void 0 : P.height) >= d ? H.isDangerous = !0 : (P == null ? void 0 : P.height) >= r ? H.isSevere = !0 : (P == null ? void 0 : P.height) >= h && (H.isHeavy = !0), W == null || W.info("[%s] check wind: %j", o.requestId, { ...A, dgThd4Wd: y, svThd4Wd: l, hvThd4Wd: f }), (A == null ? void 0 : A.scale) >= y ? (H.isDangerous = !0, delete H.isSevere, delete H.isHeavy) : (A == null ? void 0 : A.scale) > l ? (H.isDangerous || (H.isSevere = !0), delete H.isHeavy) : (A == null ? void 0 : A.scale) === f && !H.isDangerous && !H.isSevere && (H.isHeavy = !0), i += H.isDangerous ? J : 0, a += H.isSevere ? J : 0, n += H.isHeavy ? J : 0;
|
|
584
584
|
}
|
|
585
|
-
return i = Math.round(i * 100) / 100, a = Math.round(a * 100) / 100, n = Math.round(n * 100) / 100, s = Math.round(s), { sample: e, dangerous: i, severe: a, heavy: n, step: s < 3 ? 3 : s, wind: { dgThd4Wd: y, svThd4Wd:
|
|
585
|
+
return i = Math.round(i * 100) / 100, a = Math.round(a * 100) / 100, n = Math.round(n * 100) / 100, s = Math.round(s), { sample: e, dangerous: i, severe: a, heavy: n, step: s < 3 ? 3 : s, wind: { dgThd4Wd: y, svThd4Wd: l, hvThd4Wd: f }, sig: { dgThd4Wv: d, svThd4Wv: r, hvThd4Wv: h } };
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
588
|
const kt = new rt();
|
|
589
|
-
let
|
|
589
|
+
let I;
|
|
590
590
|
try {
|
|
591
|
-
|
|
591
|
+
I = Q.getLogger("vessel");
|
|
592
592
|
} catch {
|
|
593
593
|
} finally {
|
|
594
594
|
}
|
|
595
595
|
const ct = new ot("", !0);
|
|
596
596
|
var dt = /* @__PURE__ */ ((Y) => (Y.common = "common", Y.container = "container", Y.tugs = "tugs", Y))(dt || {}), ut = /* @__PURE__ */ ((Y) => (Y.Ballast = "Ballast", Y.Laden = "Laden", Y))(ut || {}), ht = /* @__PURE__ */ ((Y) => (Y.Cp = "CP", Y.Perf = "Basis", Y.Instruct = "Other", Y))(ht || {});
|
|
597
|
-
class
|
|
597
|
+
class E {
|
|
598
598
|
/**
|
|
599
599
|
* @see https://baike.baidu.com/item/%E6%96%B9%E5%BD%A2%E7%B3%BB%E6%95%B0/4965568?fr=aladdin
|
|
600
600
|
* 方形系数(block coefficient)
|
|
@@ -706,8 +706,8 @@ class q {
|
|
|
706
706
|
* @private
|
|
707
707
|
*/
|
|
708
708
|
static assembleProperties(e, t, o, i) {
|
|
709
|
-
var
|
|
710
|
-
const a = e.lbp ?? e.length ?? e.lengthOverall ?? 198.9642, n = e.draught ?? 8, s = e.breadthMoulded ?? e.breadth ?? e.breadthExtreme ?? 32.4572, d = e.deadweight ?? 67035.7773, r = ((
|
|
709
|
+
var l;
|
|
710
|
+
const a = e.lbp ?? e.length ?? e.lengthOverall ?? 198.9642, n = e.draught ?? 8, s = e.breadthMoulded ?? e.breadth ?? e.breadthExtreme ?? 32.4572, d = e.deadweight ?? 67035.7773, r = ((l = e == null ? void 0 : e.type) == null ? void 0 : l.toLowerCase()) || "common";
|
|
711
711
|
return {
|
|
712
712
|
tag: r.indexOf("container") > -1 ? "container" : r.indexOf("tugs") > -1 ? "tugs" : "common",
|
|
713
713
|
lbp: a,
|
|
@@ -735,22 +735,22 @@ class q {
|
|
|
735
735
|
static async speedLoseAt(e, t, o, i = "", a = 2, n = !0, s = !1, d = {}) {
|
|
736
736
|
let r;
|
|
737
737
|
if (t.velocity && s && (e.speed = z.roundPrecision(t.velocity * 1852 / 3600, 6)), n) {
|
|
738
|
-
let
|
|
738
|
+
let h;
|
|
739
739
|
if (d.meteo2)
|
|
740
740
|
try {
|
|
741
|
-
const u = await ct.spotForecast(t.lat, t.lng, o.utc().format(), !1, !1, !0, d), [
|
|
742
|
-
|
|
741
|
+
const u = await ct.spotForecast(t.lat, t.lng, o.utc().format(), !1, !1, !0, d), [b] = tt.pickHourly(u, o);
|
|
742
|
+
h = tt.toLegacy(b);
|
|
743
743
|
} catch (u) {
|
|
744
|
-
|
|
744
|
+
I.warn("[%s] meteo2 spot(%j) forecast failed: %s", d.requestId, { ...t, eta: o.utc().format() }, u);
|
|
745
745
|
}
|
|
746
746
|
else
|
|
747
|
-
|
|
748
|
-
const y =
|
|
747
|
+
h = await nt.queryPointFactor(t.lng, t.lat, o.valueOf(), "wind,wave,current,watertemp", i, d);
|
|
748
|
+
const y = E.weatherFactor(e, h), l = E.currentFactor(e.bearing, h == null ? void 0 : h.current, a), f = Math.round((e.speed * 1.943844 + y + l) * 100) / 100;
|
|
749
749
|
r = {
|
|
750
|
-
meteo: { ...
|
|
750
|
+
meteo: { ...h },
|
|
751
751
|
wxFactor: y,
|
|
752
|
-
cFactor:
|
|
753
|
-
speed: t.velocity && s ? t.velocity :
|
|
752
|
+
cFactor: l,
|
|
753
|
+
speed: t.velocity && s ? t.velocity : f < 0 ? 1 : f,
|
|
754
754
|
eta: o.utc().format("YYYY-MM-DDTHH:mm[Z]"),
|
|
755
755
|
etd: o.utc().format("YYYY-MM-DDTHH:mm[Z]")
|
|
756
756
|
};
|
|
@@ -777,53 +777,53 @@ class q {
|
|
|
777
777
|
* @param useRouteParam true 启用航线上设置的参数 { suspend: 停留时长(小时), velocity: 速度(kts)}
|
|
778
778
|
* @private
|
|
779
779
|
*/
|
|
780
|
-
static async speedLoseInHoursStep(e, t, o, i, a, n, s = "", d = !0, r = !1,
|
|
780
|
+
static async speedLoseInHoursStep(e, t, o, i, a, n, s = "", d = !0, r = !1, h = {}) {
|
|
781
781
|
t.utc();
|
|
782
|
-
const y = t.clone().add(14, "days"),
|
|
783
|
-
let u = 0,
|
|
784
|
-
for (let
|
|
785
|
-
let c = n[
|
|
786
|
-
c.distanceFromStart = Math.round((a +
|
|
787
|
-
const
|
|
788
|
-
if (e.bearing = B.calculateBearing(c,
|
|
782
|
+
const y = t.clone().add(14, "days"), l = [], f = [];
|
|
783
|
+
let u = 0, b = 0, k, v;
|
|
784
|
+
for (let p = 0; p < n.length - 1; p++) {
|
|
785
|
+
let c = n[p];
|
|
786
|
+
c.distanceFromStart = Math.round((a + b) * 1e4) / 1e4;
|
|
787
|
+
const M = n[p + 1];
|
|
788
|
+
if (e.bearing = B.calculateBearing(c, M, !M.gcToPrevious), c.bearing = e.bearing, c.suspend && r) {
|
|
789
789
|
c.eta = c.eta || t.format("YYYY-MM-DDTHH:mm[Z]"), c.elapsed = c.elapsed ?? 0;
|
|
790
|
-
const
|
|
791
|
-
if (i - u >
|
|
792
|
-
i = i - u -
|
|
790
|
+
const S = c.suspend - c.elapsed;
|
|
791
|
+
if (i - u > S)
|
|
792
|
+
i = i - u - S, t.add(S, "hour"), c.elapsed = c.suspend;
|
|
793
793
|
else {
|
|
794
|
-
const
|
|
795
|
-
c.elapsed +=
|
|
794
|
+
const j = i - u;
|
|
795
|
+
c.elapsed += j, t.add(j, "hour"), i = 0;
|
|
796
796
|
}
|
|
797
|
-
if (
|
|
798
|
-
return c.distanceFromPrevious =
|
|
797
|
+
if (I == null || I.info(`[%s] suspend ${c.elapsed} hours at %j, and remain ${i} hours need to go...`, h.requestId, c), i === 0)
|
|
798
|
+
return c.distanceFromPrevious = b, { etd: t, from: v || c, to: c, next: n.filter((j) => j), wps: l, days: f };
|
|
799
799
|
} else
|
|
800
800
|
c.suspend = 0;
|
|
801
|
-
d = t.isAfter(y) ? !1 : d, c = await
|
|
802
|
-
const
|
|
803
|
-
let
|
|
804
|
-
if (u +
|
|
805
|
-
if (u +=
|
|
806
|
-
`[%s] go to %j from %j with ${
|
|
807
|
-
|
|
808
|
-
{ lat:
|
|
809
|
-
{ lat:
|
|
810
|
-
),
|
|
811
|
-
k =
|
|
801
|
+
d = t.isAfter(y) ? !1 : d, c = await E.speedLoseAt(e, c, t, s, 0, d, r, h), v = v || c, c.important && l.push(c), t.isSameOrAfter(o) && (f.push(c), o.add(24, "hour"));
|
|
802
|
+
const N = B.calculateDistance(c, M, !M.gcToPrevious);
|
|
803
|
+
let m = Math.ceil(N / v.speed * 1e4) / 1e4;
|
|
804
|
+
if (u + m < i) {
|
|
805
|
+
if (u += m, t.add(m, "hour"), delete n[p], I == null || I.debug(
|
|
806
|
+
`[%s] go to %j from %j with ${N}nm, and cost ${m} hours`,
|
|
807
|
+
h.requestId,
|
|
808
|
+
{ lat: M.lat, lng: M.lng },
|
|
809
|
+
{ lat: v.lat, lng: v.lng, etd: v.etd }
|
|
810
|
+
), b += N, n.filter((S) => S).length <= 1) {
|
|
811
|
+
k = M, k.eta = t.format("YYYY-MM-DDTHH:mm[Z]"), k.distanceFromPrevious = N, k.distanceFromStart = Math.round((a + b) * 1e4) / 1e4, l.push(k), delete n[p + 1];
|
|
812
812
|
break;
|
|
813
813
|
}
|
|
814
814
|
} else {
|
|
815
|
-
|
|
816
|
-
const
|
|
817
|
-
k = B.calculateCoordinate(c, e.bearing,
|
|
818
|
-
`[%s] go to %j from %j with ${
|
|
819
|
-
|
|
815
|
+
m = i - u, t.add(m, "hour");
|
|
816
|
+
const S = z.roundPrecision(v.speed * m, 4);
|
|
817
|
+
k = B.calculateCoordinate(c, e.bearing, S, "nauticalmiles", !M.gcToPrevious), k.eta = t.format("YYYY-MM-DDTHH:mm[Z]"), n[p] = k, I == null || I.debug(
|
|
818
|
+
`[%s] go to %j from %j with ${S}nm, and cost ${m} hours`,
|
|
819
|
+
h.requestId,
|
|
820
820
|
{ lat: k.lat, lng: k.lng },
|
|
821
821
|
{ lat: c.lat, lng: c.lng, etd: c.etd }
|
|
822
|
-
),
|
|
822
|
+
), b += S, k.distanceFromPrevious = Math.round(b * 1e4) / 1e4, k.distanceFromStart = Math.round((a + b) * 1e4) / 1e4;
|
|
823
823
|
break;
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
|
-
return { etd: t, from:
|
|
826
|
+
return { etd: t, from: v, to: k, next: n.filter((p) => p), wps: l, days: f };
|
|
827
827
|
}
|
|
828
828
|
/**
|
|
829
829
|
* 洋流影响因子
|
|
@@ -844,16 +844,16 @@ class q {
|
|
|
844
844
|
* @param wwc 气象要素
|
|
845
845
|
*/
|
|
846
846
|
static weatherFactor(e, t) {
|
|
847
|
-
var y,
|
|
848
|
-
|
|
849
|
-
const o =
|
|
847
|
+
var y, l, f, u, b, k, v;
|
|
848
|
+
I == null || I.debug("calculate weather factor via: %j", { ...e, ...t });
|
|
849
|
+
const o = E.blockCoefficient(e.displacement, e.lbp, e.breadthMoulded, e.draught), i = E.froudeNumber(e.speed, e.lbp), a = E.amendFactor(o, i, e.loadCondition);
|
|
850
850
|
let n = Math.abs(e.bearing % 360 - (((y = t == null ? void 0 : t.wind) == null ? void 0 : y.degree) % 360 || 0));
|
|
851
851
|
n = n > 180 ? 360 - n : n;
|
|
852
|
-
const s =
|
|
852
|
+
const s = E.directionFactor(n, (l = t == null ? void 0 : t.wind) == null ? void 0 : l.scale), d = E.vesselTagFactor(e.displacement, e.loadCondition, e.tag, (f = t == null ? void 0 : t.wind) == null ? void 0 : f.scale);
|
|
853
853
|
let r = s * a * d / 100 * e.speed;
|
|
854
|
-
r = Math.round(r * 1.943844 * 1e4) / 1e4 * -1, e.tag === "tugs" && Math.abs(r) > 1 && (r = r / (Math.abs(Math.round(r)) + 1)),
|
|
855
|
-
const
|
|
856
|
-
return
|
|
854
|
+
r = Math.round(r * 1.943844 * 1e4) / 1e4 * -1, e.tag === "tugs" && Math.abs(r) > 1 && (r = r / (Math.abs(Math.round(r)) + 1)), I == null || I.debug("wind wx factor = %d", r), n = Math.abs(e.bearing % 360 - (((b = (u = t == null ? void 0 : t.wave) == null ? void 0 : u.sig) == null ? void 0 : b.degree) % 360 || 0));
|
|
855
|
+
const h = E.waveHeightFactor(((v = (k = t == null ? void 0 : t.wave) == null ? void 0 : k.sig) == null ? void 0 : v.height) ?? 1, n);
|
|
856
|
+
return I == null || I.debug("wave wx factor = %d", h), r = r * 0.4 + h, I == null || I.debug("weather factor = %d", r), r = Math.abs(r) > 4 ? 4 * (Math.abs(r) / r) + Math.abs(r) / r * (Math.abs(r) - 4) * 0.1 : r, Math.round((r || 0) * 100) / 100;
|
|
857
857
|
}
|
|
858
858
|
/**
|
|
859
859
|
* 全程失速分析(走完航程)
|
|
@@ -867,14 +867,14 @@ class q {
|
|
|
867
867
|
* @param useMeteo true 启用气象分析
|
|
868
868
|
* @param useRouteParam
|
|
869
869
|
*/
|
|
870
|
-
static async analyseInstant(e, t, o, i, a, n = "", s = 0, d = !0, r = !1,
|
|
871
|
-
var J,
|
|
870
|
+
static async analyseInstant(e, t, o, i, a, n = "", s = 0, d = !0, r = !1, h = {}) {
|
|
871
|
+
var J, _, K, G, L;
|
|
872
872
|
const y = w().valueOf();
|
|
873
873
|
e.lng = z.convertToStdLng(e.lng);
|
|
874
|
-
const { route:
|
|
874
|
+
const { route: l, waypoints: f } = a.points, u = B.calculateSubRoute(e, l);
|
|
875
875
|
if (((J = u[0]) == null ? void 0 : J.length) <= 1)
|
|
876
876
|
return;
|
|
877
|
-
const { v0:
|
|
877
|
+
const { v0: b, label: k } = e.sog ? {
|
|
878
878
|
v0: e.sog,
|
|
879
879
|
label: "Other"
|
|
880
880
|
/* Instruct */
|
|
@@ -882,59 +882,59 @@ class q {
|
|
|
882
882
|
v0: i.speed,
|
|
883
883
|
label: "CP"
|
|
884
884
|
/* Cp */
|
|
885
|
-
},
|
|
886
|
-
|
|
885
|
+
}, v = E.assembleProperties(o, i.loadCondition, b, 0), p = f.length ? B.calculateSubWaypoints(e, f) : [];
|
|
886
|
+
p.forEach((x) => x.important = !0);
|
|
887
887
|
const c = {
|
|
888
888
|
from: { ...e },
|
|
889
889
|
route: u,
|
|
890
|
-
waypoints:
|
|
891
|
-
v0:
|
|
890
|
+
waypoints: p,
|
|
891
|
+
v0: b,
|
|
892
892
|
label: k
|
|
893
|
-
},
|
|
893
|
+
}, M = {
|
|
894
894
|
hours: [],
|
|
895
895
|
days: [],
|
|
896
896
|
wps: []
|
|
897
897
|
};
|
|
898
898
|
s || (B.calculateRouteDistance(u) / i.speed <= 72 ? s = 3 : s = 6);
|
|
899
|
-
let
|
|
899
|
+
let N = B.simplifyRouteToCoordinates(u, p, 0), m = 0, S = 0, j = 0, C = 0;
|
|
900
900
|
t = w(t).utc();
|
|
901
|
-
const
|
|
902
|
-
for (;
|
|
903
|
-
const
|
|
904
|
-
|
|
901
|
+
const q = t.clone();
|
|
902
|
+
for (; N.length > 0; ) {
|
|
903
|
+
const x = s - t.hour() % s, F = Math.ceil(t.clone().add(x, "h").set({ minute: 0, second: 0, millisecond: 0 }).diff(t, "h", !0) * 1e4) / 1e4, O = await E.speedLoseInHoursStep(
|
|
904
|
+
v,
|
|
905
905
|
t,
|
|
906
|
+
q,
|
|
906
907
|
F,
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
D,
|
|
908
|
+
m,
|
|
909
|
+
N,
|
|
910
910
|
n,
|
|
911
911
|
d,
|
|
912
912
|
r,
|
|
913
|
-
|
|
913
|
+
h
|
|
914
914
|
);
|
|
915
|
-
(
|
|
915
|
+
(_ = O.from) != null && _.speed && (M.hours.push(O.from), M.wps.push(...O.wps), M.days.push(...O.days)), N = O == null ? void 0 : O.next, N.length || M.hours.push(O == null ? void 0 : O.to), m += Math.round((((K = O == null ? void 0 : O.to) == null ? void 0 : K.distanceFromPrevious) ?? 0) * 1e4) / 1e4;
|
|
916
916
|
}
|
|
917
|
-
const
|
|
918
|
-
for (let
|
|
919
|
-
const
|
|
920
|
-
|
|
917
|
+
const T = M.hours;
|
|
918
|
+
for (let x = 0; x < T.length - 1; x++) {
|
|
919
|
+
const F = w(T[x + 1].eta).diff(T[x].etd, "hour", !0) || 1;
|
|
920
|
+
S += (T[x].wxFactor || 0) * F, j += (T[x].cFactor || 0) * F, C += F;
|
|
921
921
|
}
|
|
922
|
-
(G =
|
|
923
|
-
if (
|
|
924
|
-
const
|
|
922
|
+
(G = M.wps) == null || G.forEach((x, F) => {
|
|
923
|
+
if (F) {
|
|
924
|
+
const O = M.wps[F - 1], et = x.distanceFromStart - O.distanceFromStart, X = w(x.eta).diff(w(O.etd), "h", !0);
|
|
925
925
|
if (X < 1)
|
|
926
|
-
|
|
926
|
+
x.avgSpd = O.speed;
|
|
927
927
|
else {
|
|
928
|
-
|
|
929
|
-
const $ = Math.round((
|
|
930
|
-
|
|
928
|
+
x.avgSpd = Math.round(et / X * 100) / 100;
|
|
929
|
+
const $ = Math.round((O.speed + x.speed) / 2 * 100) / 100;
|
|
930
|
+
x.avgSpd = x.avgSpd > $ ? $ : x.avgSpd;
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
|
-
}), c.sample =
|
|
934
|
-
const
|
|
935
|
-
c.distance = Math.round(V.distanceFromStart * 1e4) / 1e4, c.etd = w(
|
|
936
|
-
const
|
|
937
|
-
return
|
|
933
|
+
}), c.sample = M;
|
|
934
|
+
const D = M.hours.at(0), V = M.hours.at(-1);
|
|
935
|
+
c.distance = Math.round(V.distanceFromStart * 1e4) / 1e4, c.etd = w(D.eta).utc().format(), c.eta = w(V.eta).utc().format(), c.wxFactor = Math.round(S / C * 1e4) / 1e4, c.cFactor = Math.round(j / C * 1e4) / 1e4, c.avgSpeed = Math.round(V.distanceFromStart / C * 1e4) / 1e4, c.totalHrs = Math.round(C * 1e4) / 1e4, c.totalFoCons = Math.round((i == null ? void 0 : i.fo) / 24 * c.totalHrs * 1e3) / 1e3, c.totalDgoCons = Math.round((i == null ? void 0 : i.dgo) / 24 * c.totalHrs * 1e3) / 1e3;
|
|
936
|
+
const P = w().valueOf() - y, A = ((L = M == null ? void 0 : M.hours) == null ? void 0 : L.length) || 1;
|
|
937
|
+
return I == null || I.info("[%s] each hour-sample speed analyse cost: (%d / %d = %d) ms", h == null ? void 0 : h.requestId, P, A, Math.round(P / A * 1e3) / 1e3), c;
|
|
938
938
|
}
|
|
939
939
|
/**
|
|
940
940
|
* 分段失速分析(最多走hours 小时)
|
|
@@ -949,11 +949,11 @@ class q {
|
|
|
949
949
|
* @param useMeteo true 启用气象分析
|
|
950
950
|
* @param useRouteParam
|
|
951
951
|
*/
|
|
952
|
-
static async analyseInstantWithThreshed(e, t, o, i, a, n, s, d = "", r = 3,
|
|
953
|
-
var J,
|
|
954
|
-
const
|
|
952
|
+
static async analyseInstantWithThreshed(e, t, o, i, a, n, s, d = "", r = 3, h = !0, y = !1, l = {}) {
|
|
953
|
+
var J, _, K, G;
|
|
954
|
+
const f = w().valueOf();
|
|
955
955
|
e.lng = z.convertToStdLng(e.lng);
|
|
956
|
-
const { v0: u, label:
|
|
956
|
+
const { v0: u, label: b } = e.sog ? {
|
|
957
957
|
v0: e.sog,
|
|
958
958
|
label: "Other"
|
|
959
959
|
/* Instruct */
|
|
@@ -961,64 +961,52 @@ class q {
|
|
|
961
961
|
v0: a.speed,
|
|
962
962
|
label: "CP"
|
|
963
963
|
/* Cp */
|
|
964
|
-
}, k =
|
|
965
|
-
if (((J =
|
|
964
|
+
}, k = E.assembleProperties(i, a.loadCondition, u, 0), v = B.calculateSubRoute(e, n);
|
|
965
|
+
if (((J = v[0]) == null ? void 0 : J.length) <= 1)
|
|
966
966
|
return;
|
|
967
|
-
const
|
|
968
|
-
|
|
969
|
-
let c = B.simplifyRouteToCoordinates(
|
|
970
|
-
const
|
|
967
|
+
const p = s.length ? B.calculateSubWaypoints(e, s) : [];
|
|
968
|
+
p.forEach((L) => L.important = !0);
|
|
969
|
+
let c = B.simplifyRouteToCoordinates(v, p, 0), M = 0, N = 0, m = 0, S = 0;
|
|
970
|
+
const j = {
|
|
971
971
|
hours: [],
|
|
972
972
|
wps: [],
|
|
973
973
|
days: []
|
|
974
974
|
};
|
|
975
975
|
t = w(t).utc();
|
|
976
|
-
const
|
|
976
|
+
const C = t.clone();
|
|
977
977
|
for (; c.length > 0; ) {
|
|
978
978
|
const L = r - t.hour() % r;
|
|
979
|
-
let
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
t,
|
|
984
|
-
T,
|
|
985
|
-
N,
|
|
986
|
-
b,
|
|
987
|
-
c,
|
|
988
|
-
d,
|
|
989
|
-
l,
|
|
990
|
-
y,
|
|
991
|
-
f
|
|
992
|
-
);
|
|
993
|
-
(K = x.from) != null && K.speed && (S.hours.push(x.from), x != null && x.wps && S.wps.push(...x.wps), S.days.push(...x.days)), c = x == null ? void 0 : x.next, c.length || S.hours.push(x == null ? void 0 : x.to), b += Math.round((((_ = x == null ? void 0 : x.to) == null ? void 0 : _.distanceFromPrevious) ?? 0) * 1e4) / 1e4;
|
|
994
|
-
} else
|
|
979
|
+
let x = Math.ceil(t.clone().add(L, "h").set({ minute: 0, second: 0, millisecond: 0 }).diff(t, "h", !0) * 1e4) / 1e4;
|
|
980
|
+
x = t.clone().add(x, "h").isSameOrAfter(o) ? o.diff(t, "h", !0) * 1e4 / 1e4 : x;
|
|
981
|
+
const F = await E.speedLoseInHoursStep(k, t, C, x, M, c, d, h, y, l);
|
|
982
|
+
if ((_ = F.from) != null && _.speed && (j.hours.push(F.from), F != null && F.wps && j.wps.push(...F.wps), j.days.push(...F.days)), c = F == null ? void 0 : F.next, c.length || j.hours.push(F == null ? void 0 : F.to), M += Math.round((((K = F == null ? void 0 : F.to) == null ? void 0 : K.distanceFromPrevious) ?? 0) * 1e4) / 1e4, !x)
|
|
995
983
|
break;
|
|
996
984
|
}
|
|
997
|
-
const
|
|
998
|
-
for (let L = 0; L <
|
|
999
|
-
const
|
|
1000
|
-
|
|
985
|
+
const q = j.hours;
|
|
986
|
+
for (let L = 0; L < q.length - 1; L++) {
|
|
987
|
+
const x = w(q[L + 1].eta).diff(q[L].etd, "hour", !0);
|
|
988
|
+
N += q[L].wxFactor * x, m += q[L].cFactor * x, S += x;
|
|
1001
989
|
}
|
|
1002
|
-
const
|
|
1003
|
-
sample:
|
|
1004
|
-
distance: Math.round(((
|
|
990
|
+
const T = j.hours.at(0), D = j.hours.at(-1), V = {
|
|
991
|
+
sample: j,
|
|
992
|
+
distance: Math.round(((D == null ? void 0 : D.distanceFromStart) || 0) * 1e4) / 1e4,
|
|
1005
993
|
// 注意,可能会在first节点Drift,所有采用eta做为初始出发时间
|
|
1006
|
-
etd: w(
|
|
1007
|
-
eta: w(
|
|
1008
|
-
wxFactor: Math.round(
|
|
1009
|
-
cFactor: Math.round(
|
|
1010
|
-
avgSpeed: Math.round(((
|
|
1011
|
-
totalHrs: Math.round(
|
|
1012
|
-
totalFoCons: Math.round((a == null ? void 0 : a.fo) / 24 *
|
|
1013
|
-
totalDgoCons: Math.round((a == null ? void 0 : a.dgo) / 24 *
|
|
1014
|
-
from:
|
|
1015
|
-
to:
|
|
1016
|
-
route:
|
|
1017
|
-
waypoints:
|
|
994
|
+
etd: w(T.eta).utc().format(),
|
|
995
|
+
eta: w(D == null ? void 0 : D.eta).utc().format(),
|
|
996
|
+
wxFactor: Math.round(N / S * 1e4) / 1e4,
|
|
997
|
+
cFactor: Math.round(m / S * 1e4) / 1e4,
|
|
998
|
+
avgSpeed: Math.round(((D == null ? void 0 : D.distanceFromStart) || 0) / S * 1e4) / 1e4,
|
|
999
|
+
totalHrs: Math.round(S * 1e4) / 1e4,
|
|
1000
|
+
totalFoCons: Math.round((a == null ? void 0 : a.fo) / 24 * S * 1e3) / 1e3,
|
|
1001
|
+
totalDgoCons: Math.round((a == null ? void 0 : a.dgo) / 24 * S * 1e3) / 1e3,
|
|
1002
|
+
from: T,
|
|
1003
|
+
to: D,
|
|
1004
|
+
route: v,
|
|
1005
|
+
waypoints: p,
|
|
1018
1006
|
v0: u,
|
|
1019
|
-
label:
|
|
1020
|
-
},
|
|
1021
|
-
return
|
|
1007
|
+
label: b
|
|
1008
|
+
}, P = w().valueOf() - f, A = ((G = j == null ? void 0 : j.hours) == null ? void 0 : G.length) || 1;
|
|
1009
|
+
return I == null || I.debug("[%s] each hour-sample speed analyse cost: (%d / %d = %d) ms", l == null ? void 0 : l.requestId, P, A, Math.round(P / A * 1e3) / 1e3), V;
|
|
1022
1010
|
}
|
|
1023
1011
|
/**
|
|
1024
1012
|
* 在指定航线条件下,基于多CP,动态计算最优成本(租金+油费)方案
|
|
@@ -1036,50 +1024,56 @@ class q {
|
|
|
1036
1024
|
* @param options
|
|
1037
1025
|
*/
|
|
1038
1026
|
static async analyseCost(e, t, o, i, a = {}) {
|
|
1039
|
-
var
|
|
1027
|
+
var v, p;
|
|
1040
1028
|
const n = w().valueOf(), s = [];
|
|
1041
|
-
a.meteo2 = !0, e.speedStep = e.speedStep || 3;
|
|
1042
|
-
const d =
|
|
1043
|
-
let r =
|
|
1044
|
-
|
|
1045
|
-
const
|
|
1029
|
+
a.meteo2 = !0, e.speedStep = e.speedStep || 3, e.alterStep = e.alterStep ?? 1;
|
|
1030
|
+
const d = B.calculateRouteDistance(i.route);
|
|
1031
|
+
let r = 0;
|
|
1032
|
+
o.forEach((c) => {
|
|
1033
|
+
const M = Math.ceil(d / c.speed / 24);
|
|
1034
|
+
r = r < M ? M : r;
|
|
1035
|
+
}), r = r * 1.3;
|
|
1036
|
+
const h = w.utc(e.etd).add(r ?? 14, "day");
|
|
1037
|
+
let y = 1;
|
|
1038
|
+
for (const c of o) {
|
|
1039
|
+
const M = JSON.parse(JSON.stringify(i.route)), N = JSON.parse(JSON.stringify(i.waypoints)), m = await E.analyseInstantWithThreshed(
|
|
1046
1040
|
{ lat: e.lat, lng: e.lng },
|
|
1047
1041
|
e.etd,
|
|
1048
|
-
|
|
1042
|
+
h,
|
|
1049
1043
|
t,
|
|
1050
|
-
m,
|
|
1051
|
-
v,
|
|
1052
1044
|
c,
|
|
1045
|
+
M,
|
|
1046
|
+
N,
|
|
1053
1047
|
e.meteoVendor,
|
|
1054
1048
|
e.speedStep,
|
|
1055
1049
|
e.useMeteo,
|
|
1056
1050
|
e.useRouteParam,
|
|
1057
1051
|
a
|
|
1058
1052
|
);
|
|
1059
|
-
|
|
1060
|
-
cost:
|
|
1061
|
-
distance:
|
|
1062
|
-
hours:
|
|
1063
|
-
cp: `${
|
|
1064
|
-
})),
|
|
1053
|
+
m && (await E.calculateCost(m, c, e, a), s.push(m), I == null || I.info("[%s][L%d-%d] analyse from %s to %s cost: %j", a.requestId, 1, y, e.etd, h.format(), {
|
|
1054
|
+
cost: m.cost.total,
|
|
1055
|
+
distance: m.distance,
|
|
1056
|
+
hours: m.totalHrs,
|
|
1057
|
+
cp: `${c.speed}/${c.fo}/${c.dgo}`
|
|
1058
|
+
})), y++;
|
|
1065
1059
|
}
|
|
1066
|
-
s.sort((
|
|
1067
|
-
const l = s.at(0),
|
|
1068
|
-
if (
|
|
1069
|
-
const
|
|
1070
|
-
let
|
|
1071
|
-
|
|
1072
|
-
let
|
|
1073
|
-
for (;
|
|
1074
|
-
const
|
|
1075
|
-
if (
|
|
1060
|
+
s.sort((c, M) => c.cost.total - M.cost.total);
|
|
1061
|
+
const l = s.at(0), f = s.at(1), u = [];
|
|
1062
|
+
if (u.push({ combined: !1, speeds: [l], cost: (v = l.cost) == null ? void 0 : v.total }), f) {
|
|
1063
|
+
const c = l.cost.cp, M = f.cost.cp, N = w(l.eta), m = w(l.etd), S = N.diff(m, "days", !0);
|
|
1064
|
+
let j = Math.ceil(S / 2);
|
|
1065
|
+
j = j > 7 ? 7 : j < e.alterStep ? e.alterStep : j;
|
|
1066
|
+
let C = 2, q = { combined: !1, speeds: [f], cost: (p = f.cost) == null ? void 0 : p.total }, T;
|
|
1067
|
+
for (; j >= e.alterStep; ) {
|
|
1068
|
+
const D = await E.combinedAnalyse(e, t, h, [c, M], i, j, { ...a, level: C });
|
|
1069
|
+
if (q.cost > D.cost ? T ? (T == null ? void 0 : T.cost) > D.cost && (T = D) : (T = q, q = D) : (!T || (T == null ? void 0 : T.cost) > D.cost) && (T = D), j <= e.alterStep)
|
|
1076
1070
|
break;
|
|
1077
|
-
|
|
1071
|
+
j = Math.ceil(j / 2), C += 1;
|
|
1078
1072
|
}
|
|
1079
|
-
|
|
1073
|
+
u.push(q), T && u.push(T);
|
|
1080
1074
|
}
|
|
1081
|
-
const
|
|
1082
|
-
return
|
|
1075
|
+
const k = w().valueOf() - n;
|
|
1076
|
+
return I == null || I.info("[%s] analyse elapsed: %d ms", a == null ? void 0 : a.requestId, k), u.sort((c, M) => c.cost - M.cost);
|
|
1083
1077
|
}
|
|
1084
1078
|
/**
|
|
1085
1079
|
* 按步长多次减半,分别用7,4,2,1天步长及cpa,cpb交替计算各种组合下的成本
|
|
@@ -1092,11 +1086,11 @@ class q {
|
|
|
1092
1086
|
* @param options
|
|
1093
1087
|
*/
|
|
1094
1088
|
static async combinedAnalyse(e, t, o, i, a, n, s = {}) {
|
|
1095
|
-
s.counter = 1,
|
|
1096
|
-
const d = await
|
|
1097
|
-
|
|
1098
|
-
const
|
|
1099
|
-
return
|
|
1089
|
+
s.counter = 1, I == null || I.info("[%s][L%d] analyse with alternate cp in every %d days", s.requestId, s.level, n);
|
|
1090
|
+
const d = await E.alternateAnalyse(e, t, o, i, 0, a, n, s), r = d.reduce((l, f) => l + f.cost.total, 0);
|
|
1091
|
+
I == null || I.info("[%s][L%d] cost with cpa/cpb turn: %d", s.requestId, s.level, r);
|
|
1092
|
+
const h = await E.alternateAnalyse(e, t, o, i, 1, a, n, s), y = h.reduce((l, f) => l + f.cost.total, 0);
|
|
1093
|
+
return I == null || I.info("[%s][L%d] cost with cpb/cpa turn: %d", s.requestId, s.level, y), r < y ? { combined: !0, cost: Math.round(r * 1e3) / 1e3, speeds: d, step: n } : { combined: !0, cost: Math.round(y * 1e3) / 1e3, speeds: h, step: n };
|
|
1100
1094
|
}
|
|
1101
1095
|
/**
|
|
1102
1096
|
* 基于cp索引,交替计算指定步长下的成本
|
|
@@ -1110,17 +1104,17 @@ class q {
|
|
|
1110
1104
|
* @param options
|
|
1111
1105
|
*/
|
|
1112
1106
|
static async alternateAnalyse(e, t, o, i, a, n, s, d = {}) {
|
|
1113
|
-
var
|
|
1107
|
+
var l, f;
|
|
1114
1108
|
let r = w.utc(e.etd);
|
|
1115
|
-
const
|
|
1109
|
+
const h = { lat: e.lat, lng: e.lng }, y = [];
|
|
1116
1110
|
for (; r.isBefore(o); ) {
|
|
1117
|
-
const u = r.clone().utc().add(s, "day"),
|
|
1118
|
-
|
|
1111
|
+
const u = r.clone().utc().add(s, "day"), b = JSON.parse(JSON.stringify(n.route)), k = JSON.parse(JSON.stringify(n.waypoints)), v = i[a], p = await E.analyseInstantWithThreshed(
|
|
1112
|
+
h,
|
|
1119
1113
|
r.format(),
|
|
1120
1114
|
u,
|
|
1121
1115
|
t,
|
|
1122
|
-
|
|
1123
|
-
|
|
1116
|
+
v,
|
|
1117
|
+
b,
|
|
1124
1118
|
k,
|
|
1125
1119
|
e.meteoVendor,
|
|
1126
1120
|
e.speedStep,
|
|
@@ -1128,18 +1122,18 @@ class q {
|
|
|
1128
1122
|
e.useRouteParam,
|
|
1129
1123
|
d
|
|
1130
1124
|
);
|
|
1131
|
-
|
|
1125
|
+
p && (await E.calculateCost(p, v, e, d), I == null || I.info(
|
|
1132
1126
|
"[%s][L%d-%d] analyse from %s to %s cost: %j",
|
|
1133
1127
|
d.requestId,
|
|
1134
1128
|
d.level,
|
|
1135
1129
|
d.counter,
|
|
1136
1130
|
r.utc().format(),
|
|
1137
1131
|
u.utc().format(),
|
|
1138
|
-
{ cost:
|
|
1132
|
+
{ cost: p.cost.total, distance: p.distance, hours: p.totalHrs, cp: `${v.speed}/${v.fo}/${v.dgo}` }
|
|
1139
1133
|
)), d.counter = d.counter + 1;
|
|
1140
|
-
const c = (
|
|
1134
|
+
const c = (f = (l = p == null ? void 0 : p.sample) == null ? void 0 : l.hours) == null ? void 0 : f.at(-1);
|
|
1141
1135
|
if (c)
|
|
1142
|
-
|
|
1136
|
+
h.lat = c.lat, h.lng = c.lng, r = w(c.eta), y.push(p), a = a ? 0 : 1;
|
|
1143
1137
|
else
|
|
1144
1138
|
break;
|
|
1145
1139
|
}
|
|
@@ -1165,23 +1159,28 @@ class q {
|
|
|
1165
1159
|
return e;
|
|
1166
1160
|
}
|
|
1167
1161
|
static async mergeSpeeds(e, t = {}) {
|
|
1162
|
+
var f;
|
|
1168
1163
|
const o = {
|
|
1169
1164
|
hours: [],
|
|
1170
1165
|
wps: [],
|
|
1171
1166
|
days: []
|
|
1172
|
-
}, i = e.reduce((
|
|
1173
|
-
for (const
|
|
1174
|
-
const
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1167
|
+
}, i = e.reduce((u, b) => u + b.distance, 0), a = e.reduce((u, b) => u + b.totalHrs, 0), n = e.reduce((u, b) => u + b.wxFactor * b.totalHrs / a, 0), s = e.reduce((u, b) => u + b.cFactor * b.totalHrs / a, 0), d = e.reduce((u, b) => u + b.totalFoCons, 0), r = e.reduce((u, b) => u + b.totalDgoCons, 0), h = e.reduce((u, b) => u + b.cost.total, 0), y = e.reduce((u, b) => u + b.cost.hire, 0), l = e.reduce((u, b) => u + b.cost.bunker, 0);
|
|
1168
|
+
for (const u of e) {
|
|
1169
|
+
const b = u.sample.hours, k = b.at(0);
|
|
1170
|
+
k.cp = u.cost.cp;
|
|
1171
|
+
const v = u.sample.wps, p = u.sample.days;
|
|
1172
|
+
b.forEach((M) => {
|
|
1173
|
+
var m;
|
|
1174
|
+
((m = o.hours) == null ? void 0 : m.findIndex((S) => S.eta === M.eta)) === -1 && o.hours.push(M);
|
|
1175
|
+
}), v.forEach((M) => {
|
|
1176
|
+
var m;
|
|
1177
|
+
((m = o.wps) == null ? void 0 : m.findIndex((S) => S.eta === M.eta)) === -1 && o.wps.push(M);
|
|
1178
|
+
}), p.forEach((M) => {
|
|
1179
|
+
var m;
|
|
1180
|
+
((m = o == null ? void 0 : o.days) == null ? void 0 : m.findIndex((S) => S.eta === M.eta)) === -1 && o.days.push(M);
|
|
1184
1181
|
});
|
|
1182
|
+
const c = (f = o.wps) == null ? void 0 : f.findIndex((M) => M.eta === k.eta);
|
|
1183
|
+
c === -1 ? o.wps.push(k) : o.wps[c] = k;
|
|
1185
1184
|
}
|
|
1186
1185
|
return {
|
|
1187
1186
|
sample: o,
|
|
@@ -1198,9 +1197,9 @@ class q {
|
|
|
1198
1197
|
totalFoCons: Math.round(d * 1e3) / 1e3,
|
|
1199
1198
|
totalDgoCons: Math.round(r * 1e3) / 1e3,
|
|
1200
1199
|
cost: {
|
|
1201
|
-
total: Math.round(
|
|
1200
|
+
total: Math.round(h * 1e3) / 1e3,
|
|
1202
1201
|
hire: Math.round(y * 1e3) / 1e3,
|
|
1203
|
-
bunker: Math.round(
|
|
1202
|
+
bunker: Math.round(l * 1e3) / 1e3
|
|
1204
1203
|
}
|
|
1205
1204
|
};
|
|
1206
1205
|
}
|
|
@@ -1214,7 +1213,7 @@ export {
|
|
|
1214
1213
|
It as MyShipImpl,
|
|
1215
1214
|
vt as MyVesselImpl,
|
|
1216
1215
|
pt as ShipxyImpl,
|
|
1217
|
-
|
|
1216
|
+
E as SpeedHelper,
|
|
1218
1217
|
ht as SpeedLabel,
|
|
1219
1218
|
dt as VesselTag,
|
|
1220
1219
|
kt as alertHelper
|