@pksep/zod-shared 0.0.518 → 0.0.520
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/action/dto/actions-by-param.dto.d.ts +3 -0
- package/dist/action/dto/actions-by-param.dto.js +1 -0
- package/dist/action/schemas/actions.schema.d.ts +3 -0
- package/dist/action/schemas/actions.schema.js +2 -1
- package/dist/action/types/types.d.ts +3 -0
- package/dist/assemble/dto/get-assemble-operation-count.dto.d.ts +0 -16
- package/dist/assemble/schemas/assemble-coming.schema.d.ts +0 -12
- package/dist/assemble/schemas/assemble.schema.d.ts +0 -12
- package/dist/assemble-kit/schemas/assemble-kit.schema.d.ts +0 -5
- package/dist/cbed/dto/get-deficit.dto.d.ts +1 -4
- package/dist/cbed/dto/get-deficit.dto.js +0 -1
- package/dist/detal/dto/get-deficit.dto.d.ts +1 -4
- package/dist/detal/dto/get-deficit.dto.js +0 -1
- package/dist/detal/dto/get-detal-deficit-dto.d.ts +1 -4
- package/dist/detal/dto/get-detal-deficit-dto.js +0 -1
- package/dist/detal/schemas/detal-deficit.schema.d.ts +0 -10
- package/dist/detal/schemas/detal.schema.d.ts +0 -5
- package/dist/equipment/schemas/equipment.schema.d.ts +5 -0
- package/dist/material/dto/get-deficit.dto.d.ts +1 -4
- package/dist/material/dto/get-deficit.dto.js +0 -1
- package/dist/moving/schemas/moving.schema.d.ts +7 -0
- package/dist/product/dto/get-deficit.dto.d.ts +1 -4
- package/dist/product/dto/get-deficit.dto.js +0 -1
- package/dist/product/schemas/product-deficit.schema.d.ts +0 -5
- package/dist/production-tasks/dto/get-production-task-by-equipment.dto.d.ts +3 -0
- package/dist/production-tasks/dto/get-production-task-by-equipment.dto.js +1 -0
- package/dist/production-tasks/dto/get-production-task-by-operation.dto.d.ts +3 -0
- package/dist/production-tasks/dto/get-production-task-by-operation.dto.js +1 -0
- package/dist/production-tasks/dto/get-production-task-by-user.dto.d.ts +3 -0
- package/dist/production-tasks/dto/get-production-task-by-user.dto.js +1 -0
- package/dist/production-tasks/dto/workload-by-entity.dto.d.ts +9 -0
- package/dist/production-tasks/dto/workload-by-entity.dto.js +4 -1
- package/dist/production-tasks/interfaces/production-tasks.d.ts +21 -5
- package/dist/production-tasks/schemas/operation-positions.schema.d.ts +3 -0
- package/dist/production-tasks/schemas/operation-positions.schema.js +1 -0
- package/dist/role/schemas/role.schema.d.ts +7 -0
- package/dist/sclad/dto/set-warehouse-readiness-date.dto.d.ts +12 -0
- package/dist/sclad/dto/set-warehouse-readiness-date.dto.js +8 -0
- package/dist/shipments/dto/shipments-list-pagination-response.dto.d.ts +0 -5
- package/dist/shipments/index.d.ts +0 -1
- package/dist/shipments/index.js +0 -1
- package/dist/shipments/schemas/shipment-list-item.schema.d.ts +0 -3
- package/dist/shipments/schemas/shipment-list-item.schema.js +0 -1
- package/dist/shipments/schemas/shipments.schema.d.ts +0 -3
- package/dist/shipments/schemas/shipments.schema.js +0 -1
- package/dist/specification/schema/attributes.schema.d.ts +0 -7
- package/dist/user/schemas/user.schema.d.ts +5 -0
- package/dist/utils/date.methods.d.ts +8 -0
- package/dist/utils/date.methods.js +47 -0
- package/dist/utils/tables-config/methods.d.ts +4 -0
- package/dist/utils/tables-config/methods.js +4 -0
- package/dist/utils/tables-config/tables-array.js +2 -2
- package/dist/utils/types/types.d.ts +2 -0
- package/dist/utils/workings.js +1 -16
- package/package.json +1 -1
|
@@ -896,7 +896,6 @@ export declare const SpecificationAttributesSchema: z.ZodObject<{
|
|
|
896
896
|
ban: z.ZodDefault<z.ZodBoolean>;
|
|
897
897
|
date_order: z.ZodDate;
|
|
898
898
|
date_shipments: z.ZodDate;
|
|
899
|
-
date_by_urgency: z.ZodDate;
|
|
900
899
|
number_order: z.ZodString;
|
|
901
900
|
kol: z.ZodNumber;
|
|
902
901
|
bron: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -955,7 +954,6 @@ export declare const SpecificationAttributesSchema: z.ZodObject<{
|
|
|
955
954
|
date_shipments: Date;
|
|
956
955
|
productId: number;
|
|
957
956
|
date_order: Date;
|
|
958
|
-
date_by_urgency: Date;
|
|
959
957
|
bron: boolean;
|
|
960
958
|
is_custom_product: boolean;
|
|
961
959
|
buyerId: number;
|
|
@@ -984,7 +982,6 @@ export declare const SpecificationAttributesSchema: z.ZodObject<{
|
|
|
984
982
|
date_shipments: Date;
|
|
985
983
|
productId: number;
|
|
986
984
|
date_order: Date;
|
|
987
|
-
date_by_urgency: Date;
|
|
988
985
|
buyerId: number;
|
|
989
986
|
manager_id: number;
|
|
990
987
|
status?: string | undefined;
|
|
@@ -1082,7 +1079,6 @@ export declare const SpecificationAttributesSchema: z.ZodObject<{
|
|
|
1082
1079
|
date_shipments: Date;
|
|
1083
1080
|
productId: number;
|
|
1084
1081
|
date_order: Date;
|
|
1085
|
-
date_by_urgency: Date;
|
|
1086
1082
|
bron: boolean;
|
|
1087
1083
|
is_custom_product: boolean;
|
|
1088
1084
|
buyerId: number;
|
|
@@ -1364,7 +1360,6 @@ export declare const SpecificationAttributesSchema: z.ZodObject<{
|
|
|
1364
1360
|
date_shipments: Date;
|
|
1365
1361
|
productId: number;
|
|
1366
1362
|
date_order: Date;
|
|
1367
|
-
date_by_urgency: Date;
|
|
1368
1363
|
buyerId: number;
|
|
1369
1364
|
manager_id: number;
|
|
1370
1365
|
status?: string | undefined;
|
|
@@ -2456,7 +2451,6 @@ export declare const SpecificationAttributesSchema: z.ZodObject<{
|
|
|
2456
2451
|
date_shipments: Date;
|
|
2457
2452
|
productId: number;
|
|
2458
2453
|
date_order: Date;
|
|
2459
|
-
date_by_urgency: Date;
|
|
2460
2454
|
bron: boolean;
|
|
2461
2455
|
is_custom_product: boolean;
|
|
2462
2456
|
buyerId: number;
|
|
@@ -2887,7 +2881,6 @@ export declare const SpecificationAttributesSchema: z.ZodObject<{
|
|
|
2887
2881
|
date_shipments: Date;
|
|
2888
2882
|
productId: number;
|
|
2889
2883
|
date_order: Date;
|
|
2890
|
-
date_by_urgency: Date;
|
|
2891
2884
|
buyerId: number;
|
|
2892
2885
|
manager_id: number;
|
|
2893
2886
|
status?: string | undefined;
|
|
@@ -287,6 +287,7 @@ export declare const UserSchema: z.ZodObject<{
|
|
|
287
287
|
role_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
288
288
|
parent_action_idL: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
289
289
|
production_task_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
290
|
+
createdAt: z.ZodOptional<z.ZodUnion<[z.ZodDate, z.ZodString]>>;
|
|
290
291
|
}, "strip", z.ZodTypeAny, {
|
|
291
292
|
ban: boolean;
|
|
292
293
|
action: import("../..").IActionText[];
|
|
@@ -301,6 +302,7 @@ export declare const UserSchema: z.ZodObject<{
|
|
|
301
302
|
inventary_id?: number | null | undefined;
|
|
302
303
|
responsible_id?: number | null | undefined;
|
|
303
304
|
tech_process_id?: number | null | undefined;
|
|
305
|
+
createdAt?: string | Date | undefined;
|
|
304
306
|
equipment_id?: number | null | undefined;
|
|
305
307
|
movement_object_id?: number | null | undefined;
|
|
306
308
|
deliveries_id?: number | null | undefined;
|
|
@@ -335,6 +337,7 @@ export declare const UserSchema: z.ZodObject<{
|
|
|
335
337
|
inventary_id?: number | null | undefined;
|
|
336
338
|
responsible_id?: number | null | undefined;
|
|
337
339
|
tech_process_id?: number | null | undefined;
|
|
340
|
+
createdAt?: string | Date | undefined;
|
|
338
341
|
equipment_id?: number | null | undefined;
|
|
339
342
|
movement_object_id?: number | null | undefined;
|
|
340
343
|
deliveries_id?: number | null | undefined;
|
|
@@ -543,6 +546,7 @@ export declare const UserSchema: z.ZodObject<{
|
|
|
543
546
|
inventary_id?: number | null | undefined;
|
|
544
547
|
responsible_id?: number | null | undefined;
|
|
545
548
|
tech_process_id?: number | null | undefined;
|
|
549
|
+
createdAt?: string | Date | undefined;
|
|
546
550
|
equipment_id?: number | null | undefined;
|
|
547
551
|
movement_object_id?: number | null | undefined;
|
|
548
552
|
deliveries_id?: number | null | undefined;
|
|
@@ -732,6 +736,7 @@ export declare const UserSchema: z.ZodObject<{
|
|
|
732
736
|
inventary_id?: number | null | undefined;
|
|
733
737
|
responsible_id?: number | null | undefined;
|
|
734
738
|
tech_process_id?: number | null | undefined;
|
|
739
|
+
createdAt?: string | Date | undefined;
|
|
735
740
|
equipment_id?: number | null | undefined;
|
|
736
741
|
movement_object_id?: number | null | undefined;
|
|
737
742
|
deliveries_id?: number | null | undefined;
|
|
@@ -21,6 +21,14 @@ export declare class DateMethods {
|
|
|
21
21
|
* @returns
|
|
22
22
|
*/
|
|
23
23
|
comparison: (one_date?: string, two_date?: string, operation?: string) => boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Выссчитываем дельту двух дат.
|
|
26
|
+
* Результат возвращается в минутах
|
|
27
|
+
* @param calculatedCreateTime
|
|
28
|
+
* @param planReadyTime
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
calculateDeltaTime: (calculatedCreateTime: Date, planReadyTime: Date) => number;
|
|
24
32
|
/**
|
|
25
33
|
* Функция возвращает текущее время в UTC формате
|
|
26
34
|
* @param config
|
|
@@ -47,6 +47,53 @@ class DateMethods {
|
|
|
47
47
|
}
|
|
48
48
|
return result;
|
|
49
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* Выссчитываем дельту двух дат.
|
|
52
|
+
* Результат возвращается в минутах
|
|
53
|
+
* @param calculatedCreateTime
|
|
54
|
+
* @param planReadyTime
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
this.calculateDeltaTime = (calculatedCreateTime, planReadyTime) => {
|
|
58
|
+
const calculatedCreateTimeDate = new Date(calculatedCreateTime);
|
|
59
|
+
const planReadyTimeDate = new Date(planReadyTime);
|
|
60
|
+
const sign = calculatedCreateTimeDate <= planReadyTimeDate ? 1 : -1;
|
|
61
|
+
const start = calculatedCreateTimeDate <= planReadyTimeDate
|
|
62
|
+
? calculatedCreateTimeDate
|
|
63
|
+
: planReadyTimeDate;
|
|
64
|
+
const end = calculatedCreateTimeDate <= planReadyTimeDate
|
|
65
|
+
? planReadyTimeDate
|
|
66
|
+
: calculatedCreateTimeDate;
|
|
67
|
+
const workDayStartHour = 5;
|
|
68
|
+
const workDayHours = 8;
|
|
69
|
+
const workDayEndHour = workDayStartHour + workDayHours;
|
|
70
|
+
const isWorkDay = (date) => {
|
|
71
|
+
const dayOfWeek = date.getUTCDay();
|
|
72
|
+
return dayOfWeek !== 0 && dayOfWeek !== 6;
|
|
73
|
+
};
|
|
74
|
+
let totalMinutes = 0;
|
|
75
|
+
const current = new Date(start);
|
|
76
|
+
while (current < end) {
|
|
77
|
+
if (!isWorkDay(current)) {
|
|
78
|
+
current.setUTCDate(current.getUTCDate() + 1);
|
|
79
|
+
current.setUTCHours(0, 0, 0, 0);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const workStart = new Date(current);
|
|
83
|
+
workStart.setUTCHours(workDayStartHour, 0, 0, 0);
|
|
84
|
+
const workEnd = new Date(current);
|
|
85
|
+
workEnd.setUTCHours(workDayEndHour, 0, 0, 0);
|
|
86
|
+
const actualStart = current > workStart ? current : workStart;
|
|
87
|
+
const actualEnd = end < workEnd ? end : workEnd;
|
|
88
|
+
if (actualStart < actualEnd) {
|
|
89
|
+
totalMinutes +=
|
|
90
|
+
(actualEnd.getTime() - actualStart.getTime()) / (1000 * 60);
|
|
91
|
+
}
|
|
92
|
+
current.setUTCDate(current.getUTCDate() + 1);
|
|
93
|
+
current.setUTCHours(0, 0, 0, 0);
|
|
94
|
+
}
|
|
95
|
+
return Math.round(totalMinutes) * sign;
|
|
96
|
+
};
|
|
50
97
|
/**
|
|
51
98
|
* Функция возвращает текущее время в UTC формате
|
|
52
99
|
* @param config
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { UserTableConfigItem } from '../../user';
|
|
2
2
|
import { tablesEnumConfig } from './enum';
|
|
3
3
|
export declare const generateDefaultConfigArray: (configArray: tablesEnumConfig[]) => UserTableConfigItem[];
|
|
4
|
+
/**
|
|
5
|
+
* Возвращает список колонок из `arrayToCheck`, которые отсутствуют в текущей конфигурации `columns`.
|
|
6
|
+
* Используется на фронтенде для определения недостающих колонок в пользовательской конфигурации таблиц.
|
|
7
|
+
*/
|
|
4
8
|
export declare const checkMissingColumns: (columns: UserTableConfigItem[], arrayToCheck: tablesEnumConfig[]) => tablesEnumConfig[];
|
|
5
9
|
export declare const createCorrectColumnConfig: (columns: UserTableConfigItem[], arrayToCheck: tablesEnumConfig[]) => UserTableConfigItem[];
|
|
@@ -8,6 +8,10 @@ const generateDefaultConfigArray = (configArray) => configArray.map(currentConfi
|
|
|
8
8
|
};
|
|
9
9
|
});
|
|
10
10
|
exports.generateDefaultConfigArray = generateDefaultConfigArray;
|
|
11
|
+
/**
|
|
12
|
+
* Возвращает список колонок из `arrayToCheck`, которые отсутствуют в текущей конфигурации `columns`.
|
|
13
|
+
* Используется на фронтенде для определения недостающих колонок в пользовательской конфигурации таблиц.
|
|
14
|
+
*/
|
|
11
15
|
const checkMissingColumns = (columns, arrayToCheck) => {
|
|
12
16
|
const columnsSet = new Set();
|
|
13
17
|
columns.forEach(currentColumn => columnsSet.add(currentColumn.columnName));
|
|
@@ -177,10 +177,10 @@ exports.productionTaskByEquipmentTableConfig = [
|
|
|
177
177
|
enum_1.tablesEnumConfig.startTime,
|
|
178
178
|
enum_1.tablesEnumConfig.calculatedCreateTime,
|
|
179
179
|
enum_1.tablesEnumConfig.calculateNeedsTime,
|
|
180
|
-
enum_1.tablesEnumConfig.calculateAssembleTime,
|
|
181
180
|
enum_1.tablesEnumConfig.deltaTime,
|
|
182
|
-
enum_1.tablesEnumConfig.
|
|
181
|
+
enum_1.tablesEnumConfig.calculateAssembleTime,
|
|
183
182
|
enum_1.tablesEnumConfig.remainingByProductionTask,
|
|
183
|
+
enum_1.tablesEnumConfig.orderedByProduction,
|
|
184
184
|
enum_1.tablesEnumConfig.timeToProduction,
|
|
185
185
|
enum_1.tablesEnumConfig.operationsLength,
|
|
186
186
|
enum_1.tablesEnumConfig.prevOperation,
|
|
@@ -26,6 +26,8 @@ export type RelativesProductionTasksType = {
|
|
|
26
26
|
dueData: Date;
|
|
27
27
|
relativeName: string;
|
|
28
28
|
relativeDesignation: string;
|
|
29
|
+
equipmentId: number | null;
|
|
30
|
+
userId: number | null;
|
|
29
31
|
relativeAttention: boolean;
|
|
30
32
|
relativeDiscontinued: boolean;
|
|
31
33
|
relativeDescription: string;
|
package/dist/utils/workings.js
CHANGED
|
@@ -90,14 +90,6 @@ const sortProductionItems = (data) => {
|
|
|
90
90
|
try {
|
|
91
91
|
const sortedResults = (0, lodash_1.orderBy)(data.itemToSort, [
|
|
92
92
|
item => ((0, exports.getValueByPath)(item, data.shipmentPath) ? 0 : 1),
|
|
93
|
-
item => {
|
|
94
|
-
const foundedShipment = (0, exports.getValueByPath)(item, data.shipmentPath);
|
|
95
|
-
if (!foundedShipment)
|
|
96
|
-
return Infinity;
|
|
97
|
-
return foundedShipment.date_by_urgency
|
|
98
|
-
? new Date(foundedShipment.date_by_urgency).getTime()
|
|
99
|
-
: Infinity;
|
|
100
|
-
},
|
|
101
93
|
item => {
|
|
102
94
|
const foundedShipment = (0, exports.getValueByPath)(item, data.shipmentPath);
|
|
103
95
|
if (!foundedShipment)
|
|
@@ -121,7 +113,7 @@ const sortProductionItems = (data) => {
|
|
|
121
113
|
var _a, _b;
|
|
122
114
|
return ((_b = (_a = (0, exports.getValueByPath)(item, data.entityPath)) === null || _a === void 0 ? void 0 : _a.designation) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()) || '';
|
|
123
115
|
}
|
|
124
|
-
], ['asc', 'asc', 'asc', 'asc'
|
|
116
|
+
], ['asc', 'asc', 'asc', 'asc']);
|
|
125
117
|
return sortedResults;
|
|
126
118
|
}
|
|
127
119
|
catch (error) {
|
|
@@ -138,13 +130,6 @@ exports.sortProductionItems = sortProductionItems;
|
|
|
138
130
|
const sortShipments = (data) => {
|
|
139
131
|
try {
|
|
140
132
|
const sortedResults = (0, lodash_1.orderBy)(data.shipments, [
|
|
141
|
-
item => {
|
|
142
|
-
if (!item)
|
|
143
|
-
return Infinity;
|
|
144
|
-
return item.date_by_urgency
|
|
145
|
-
? new Date(item.date_by_urgency).getTime()
|
|
146
|
-
: Infinity;
|
|
147
|
-
},
|
|
148
133
|
item => {
|
|
149
134
|
return item.date_shipments
|
|
150
135
|
? new Date(item.date_shipments).getTime()
|