@things-factory/ops-master 10.1.316 → 10.1.319
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.
|
@@ -37,6 +37,7 @@ export * from './location/location-master';
|
|
|
37
37
|
export * from './location/location-query';
|
|
38
38
|
export * from './location/sites-of-system';
|
|
39
39
|
export * from './location/zone-of-place';
|
|
40
|
+
export * from './location/shift-names-of-place';
|
|
40
41
|
export * from './location/zone-of-home-place';
|
|
41
42
|
export * from './material/material-class';
|
|
42
43
|
export * from './material/material-definition';
|
|
@@ -42,6 +42,7 @@ tslib_1.__exportStar(require("./location/location-master"), exports);
|
|
|
42
42
|
tslib_1.__exportStar(require("./location/location-query"), exports);
|
|
43
43
|
tslib_1.__exportStar(require("./location/sites-of-system"), exports);
|
|
44
44
|
tslib_1.__exportStar(require("./location/zone-of-place"), exports);
|
|
45
|
+
tslib_1.__exportStar(require("./location/shift-names-of-place"), exports);
|
|
45
46
|
tslib_1.__exportStar(require("./location/zone-of-home-place"), exports);
|
|
46
47
|
tslib_1.__exportStar(require("./material/material-class"), exports);
|
|
47
48
|
tslib_1.__exportStar(require("./material/material-definition"), exports);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** The columns the walk reads - a place's name, its row id, its parent, the work shifts it declares and when it was in service. */
|
|
2
|
+
export interface ShiftPlaceRow {
|
|
3
|
+
/** The row id - a child may name its parent by it (`parentId` holds a row id in some sites and a name in others). */
|
|
4
|
+
id?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
parentId?: string | null;
|
|
7
|
+
workShiftNames?: string[] | null;
|
|
8
|
+
effectiveStart?: Date | string | null;
|
|
9
|
+
effectiveEnd?: Date | string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface PlaceShifts {
|
|
12
|
+
/** The places walked, from the start up to and including the one it stopped at. */
|
|
13
|
+
walked: string[];
|
|
14
|
+
/** The place that declares the shifts - the start itself or its nearest ancestor that names any. */
|
|
15
|
+
declaredAt?: ShiftPlaceRow;
|
|
16
|
+
/** The shift names that place declares, each once. */
|
|
17
|
+
shiftNames?: string[];
|
|
18
|
+
/** The walk met a place not in service at the time asked, and stopped there - it does not skip to the grandparent. */
|
|
19
|
+
notInService?: ShiftPlaceRow;
|
|
20
|
+
}
|
|
21
|
+
/** In service at `atMs` - the start is inclusive, the end is not (a place retired at T is not used from T). No time asked, no check. */
|
|
22
|
+
export declare function placeInServiceAt(place: ShiftPlaceRow, atMs?: number): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* **The work shifts a place runs** - its own `workShiftNames`, else the nearest ancestor's (`OperationalLocation.workShiftNames`:
|
|
25
|
+
* "locations below inherit this unless they say their own"). A pure walk over the rows given.
|
|
26
|
+
*
|
|
27
|
+
* - A parent is found by row id first, then by name - both spellings stand in real data (as `zoneOfPlace`).
|
|
28
|
+
* - The walk stops at a loop, at a parent it cannot find, and - when `atMs` is given - at a place not in service then. It does not skip
|
|
29
|
+
* a retired place to inherit the grandparent's shifts: nobody declared that answer, so it says where it stopped instead.
|
|
30
|
+
* - Nothing declared answers no `shiftNames` - "no constraint stated", which is not "no shifts".
|
|
31
|
+
*
|
|
32
|
+
* Lifted on 2026-11-28 from operato-plant (`work-calendar-for`: `walkedLocations` · `declaringAncestor`) and operato-yard
|
|
33
|
+
* (`door-hours-rules`: `inheritedShiftNames`), which had each written the walk and had begun to answer differently.
|
|
34
|
+
*/
|
|
35
|
+
export declare function shiftNamesOfPlace(places: readonly ShiftPlaceRow[], start: string | undefined, atMs?: number): PlaceShifts;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.placeInServiceAt = placeInServiceAt;
|
|
4
|
+
exports.shiftNamesOfPlace = shiftNamesOfPlace;
|
|
5
|
+
const ms = (said) => {
|
|
6
|
+
if (said === null || said === undefined || said === '')
|
|
7
|
+
return undefined;
|
|
8
|
+
const at = said instanceof Date ? said.getTime() : Date.parse(String(said));
|
|
9
|
+
return Number.isNaN(at) ? undefined : at;
|
|
10
|
+
};
|
|
11
|
+
/** In service at `atMs` - the start is inclusive, the end is not (a place retired at T is not used from T). No time asked, no check. */
|
|
12
|
+
function placeInServiceAt(place, atMs) {
|
|
13
|
+
if (atMs === undefined)
|
|
14
|
+
return true;
|
|
15
|
+
const from = ms(place.effectiveStart);
|
|
16
|
+
const to = ms(place.effectiveEnd);
|
|
17
|
+
if (from !== undefined && atMs < from)
|
|
18
|
+
return false;
|
|
19
|
+
return !(to !== undefined && atMs >= to);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* **The work shifts a place runs** - its own `workShiftNames`, else the nearest ancestor's (`OperationalLocation.workShiftNames`:
|
|
23
|
+
* "locations below inherit this unless they say their own"). A pure walk over the rows given.
|
|
24
|
+
*
|
|
25
|
+
* - A parent is found by row id first, then by name - both spellings stand in real data (as `zoneOfPlace`).
|
|
26
|
+
* - The walk stops at a loop, at a parent it cannot find, and - when `atMs` is given - at a place not in service then. It does not skip
|
|
27
|
+
* a retired place to inherit the grandparent's shifts: nobody declared that answer, so it says where it stopped instead.
|
|
28
|
+
* - Nothing declared answers no `shiftNames` - "no constraint stated", which is not "no shifts".
|
|
29
|
+
*
|
|
30
|
+
* Lifted on 2026-11-28 from operato-plant (`work-calendar-for`: `walkedLocations` · `declaringAncestor`) and operato-yard
|
|
31
|
+
* (`door-hours-rules`: `inheritedShiftNames`), which had each written the walk and had begun to answer differently.
|
|
32
|
+
*/
|
|
33
|
+
function shiftNamesOfPlace(places, start, atMs) {
|
|
34
|
+
const walked = [];
|
|
35
|
+
if (!start)
|
|
36
|
+
return { walked };
|
|
37
|
+
const byId = new Map(places.filter(place => place.id).map(place => [place.id, place]));
|
|
38
|
+
const byName = new Map(places.map(place => [place.name, place]));
|
|
39
|
+
const find = (key) => byId.get(key) ?? byName.get(key);
|
|
40
|
+
const seen = new Set();
|
|
41
|
+
let at = byName.get(start) ?? byId.get(start);
|
|
42
|
+
while (at && !seen.has(at)) {
|
|
43
|
+
seen.add(at);
|
|
44
|
+
walked.push(at.name);
|
|
45
|
+
if (!placeInServiceAt(at, atMs))
|
|
46
|
+
return { walked, notInService: at };
|
|
47
|
+
if (at.workShiftNames?.length)
|
|
48
|
+
return { walked, declaredAt: at, shiftNames: [...new Set(at.workShiftNames)] };
|
|
49
|
+
at = at.parentId ? find(at.parentId) : undefined;
|
|
50
|
+
}
|
|
51
|
+
return { walked };
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=shift-names-of-place.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/ops-master",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.319",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"things-factory": true,
|
|
6
6
|
"author": "heartyoh <heartyoh@hatiolab.com>",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"@operato/shell": "^10.29.69",
|
|
43
43
|
"@operato/styles": "^10.0.0",
|
|
44
44
|
"@operato/utils": "^10.29.39",
|
|
45
|
-
"@things-factory/auth-base": "^10.1.
|
|
45
|
+
"@things-factory/auth-base": "^10.1.319",
|
|
46
46
|
"@things-factory/env": "^10.1.298",
|
|
47
47
|
"@things-factory/shell": "^10.1.304",
|
|
48
|
-
"@things-factory/worklist": "^10.1.
|
|
48
|
+
"@things-factory/worklist": "^10.1.319"
|
|
49
49
|
},
|
|
50
50
|
"browser": "dist-client/index.js",
|
|
51
51
|
"files": [
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"!**/.DS_Store"
|
|
65
65
|
],
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@things-factory/notification": "^10.1.
|
|
67
|
+
"@things-factory/notification": "^10.1.319",
|
|
68
68
|
"copyfiles": "^2.4.1",
|
|
69
69
|
"rimraf": "^6.1.3"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "9740f0f13130271ec920b435b6d833afdf611267"
|
|
72
72
|
}
|
package/translations/ko.json
CHANGED
|
@@ -388,9 +388,9 @@
|
|
|
388
388
|
"title.electricity-tariff": "전기 요금제",
|
|
389
389
|
"title.electricity-tariff-band": "시간대 요금 구간",
|
|
390
390
|
"text.master-empty-electricityTariff": "아직 전기 요금제가 없습니다",
|
|
391
|
-
"text.master-empty-electricityTariff-hint": "
|
|
391
|
+
"text.master-empty-electricityTariff-hint": "요금제를 등록하면 트윈에서 전기 사용량에 따른 요금을 계산할 수 있습니다.",
|
|
392
392
|
"text.master-empty-electricityTariffBand": "아직 시간대 요금 구간이 없습니다",
|
|
393
|
-
"text.master-empty-electricityTariffBand-hint": "
|
|
393
|
+
"text.master-empty-electricityTariffBand-hint": "시간대별 요금제에서는 하루 24시간을 빠짐없이 요금 구간으로 지정하세요. 공휴일에 별도 요금을 적용한다면 공휴일 구간도 지정하세요. 단일 단가 요금제는 구간 지정이 필요 없습니다.",
|
|
394
394
|
"axis.electricityTariff": "전기 요금제",
|
|
395
395
|
"axis.electricityTariffBand": "시간대 요금 구간",
|
|
396
396
|
"axis-help.electricityTariff": "현장이 공급자와 맺은 요금 계약입니다. 사용량을 금액으로 바꾸는 기준입니다.",
|
|
@@ -416,8 +416,8 @@
|
|
|
416
416
|
"error.tariff-negative": "「{row}」: {field} 은(는) 0 이상이어야 합니다({value}).",
|
|
417
417
|
"error.tariff-not-in-vocabulary": "「{row}」: {field} 은(는) {allowed} 중 하나여야 합니다(「{value}」).",
|
|
418
418
|
"error.tariff-format": "「{row}」: {field} 은(는) {format} 형식이어야 합니다(「{value}」).",
|
|
419
|
-
"error.tariff-currency-required": "「{row}」: 단가를
|
|
420
|
-
"error.tariff-season-pair": "「{row}」:
|
|
419
|
+
"error.tariff-currency-required": "「{row}」: 단가를 입력했다면 통화도 지정하세요.",
|
|
420
|
+
"error.tariff-season-pair": "「{row}」: 계절의 시작일과 종료일을 함께 입력하세요. 연중 적용하려면 두 항목을 모두 비워 두세요.",
|
|
421
421
|
"error.tariff-end-not-after-start": "「{row}」: 끝 시각이 시작보다 늦어야 합니다({from}~{to}). 자정을 넘는 구간은 두 줄로 적습니다.",
|
|
422
422
|
"error.tariff-flat-and-bands": "「{row}」: 구간이 있는 요금제입니다. 단일 사용량 단가는 비웁니다.",
|
|
423
423
|
"error.tariff-broken-bands": "「{row}」: 규칙에 맞지 않는 구간이 {count}개 있습니다.",
|