@pksep/zod-shared 0.0.519 → 0.0.521

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.
Files changed (47) hide show
  1. package/dist/action/enums/enums.d.ts +6 -1
  2. package/dist/action/enums/enums.js +5 -0
  3. package/dist/assemble/dto/get-assemble-operation-count.dto.d.ts +0 -16
  4. package/dist/assemble/schemas/assemble-coming.schema.d.ts +0 -12
  5. package/dist/assemble/schemas/assemble.schema.d.ts +0 -12
  6. package/dist/assemble-kit/schemas/assemble-kit.schema.d.ts +0 -5
  7. package/dist/cbed/dto/get-deficit.dto.d.ts +1 -4
  8. package/dist/cbed/dto/get-deficit.dto.js +0 -1
  9. package/dist/detal/dto/get-deficit.dto.d.ts +1 -4
  10. package/dist/detal/dto/get-deficit.dto.js +0 -1
  11. package/dist/detal/dto/get-detal-deficit-dto.d.ts +1 -4
  12. package/dist/detal/dto/get-detal-deficit-dto.js +0 -1
  13. package/dist/detal/schemas/detal-deficit.schema.d.ts +0 -10
  14. package/dist/detal/schemas/detal.schema.d.ts +0 -5
  15. package/dist/material/dto/get-deficit.dto.d.ts +1 -4
  16. package/dist/material/dto/get-deficit.dto.js +0 -1
  17. package/dist/product/dto/get-deficit.dto.d.ts +1 -4
  18. package/dist/product/dto/get-deficit.dto.js +0 -1
  19. package/dist/product/schemas/product-deficit.schema.d.ts +0 -5
  20. package/dist/production-tasks/interfaces/production-tasks.d.ts +6 -0
  21. package/dist/production-tasks/schemas/operation-positions.schema.d.ts +6 -0
  22. package/dist/production-tasks/schemas/operation-positions.schema.js +2 -0
  23. package/dist/sclad/dto/set-warehouse-readiness-date.dto.d.ts +12 -0
  24. package/dist/sclad/dto/set-warehouse-readiness-date.dto.js +8 -0
  25. package/dist/shipments/dto/shipments-list-pagination-response.dto.d.ts +0 -5
  26. package/dist/shipments/index.d.ts +0 -1
  27. package/dist/shipments/index.js +0 -1
  28. package/dist/shipments/schemas/shipment-list-item.schema.d.ts +0 -3
  29. package/dist/shipments/schemas/shipment-list-item.schema.js +0 -1
  30. package/dist/shipments/schemas/shipments.schema.d.ts +0 -3
  31. package/dist/shipments/schemas/shipments.schema.js +0 -1
  32. package/dist/specification/schema/attributes.schema.d.ts +0 -7
  33. package/dist/user/dto/get-one-user.dto.d.ts +16 -0
  34. package/dist/user/dto/get-one-user.dto.js +25 -0
  35. package/dist/user/index.d.ts +3 -0
  36. package/dist/user/index.js +3 -0
  37. package/dist/utils/date.methods.d.ts +7 -1
  38. package/dist/utils/date.methods.js +52 -5
  39. package/dist/utils/index.d.ts +3 -0
  40. package/dist/utils/index.js +3 -0
  41. package/dist/utils/methods.d.ts +17 -11
  42. package/dist/utils/methods.js +15 -20
  43. package/dist/utils/operation.d.ts +1 -1
  44. package/dist/utils/tables-config/methods.d.ts +4 -0
  45. package/dist/utils/tables-config/methods.js +4 -0
  46. package/dist/utils/workings.js +1 -16
  47. package/package.json +1 -1
@@ -6,7 +6,6 @@ const utils_1 = require("../../utils");
6
6
  exports.GetDeficitProductSchema = zod_1.z.object({
7
7
  productIds: zod_1.z.number().int().array(),
8
8
  statusWorking: zod_1.z.nativeEnum(utils_1.statusWorkingsDeficit),
9
- statusDeficit: zod_1.z.nativeEnum(utils_1.enumDeficit),
10
9
  searchString: zod_1.z.string(),
11
10
  shipmentIds: zod_1.z.number().int().array().optional().nullable(),
12
11
  page: zod_1.z.number().int().optional()
@@ -33,7 +33,6 @@ export declare const ProductDeficitSchema: z.ZodObject<{
33
33
  ban: z.ZodDefault<z.ZodBoolean>;
34
34
  date_order: z.ZodDate;
35
35
  date_shipments: z.ZodDate;
36
- date_by_urgency: z.ZodDate;
37
36
  number_order: z.ZodString;
38
37
  kol: z.ZodNumber;
39
38
  bron: z.ZodDefault<z.ZodBoolean>;
@@ -92,7 +91,6 @@ export declare const ProductDeficitSchema: z.ZodObject<{
92
91
  date_shipments: Date;
93
92
  productId: number;
94
93
  date_order: Date;
95
- date_by_urgency: Date;
96
94
  bron: boolean;
97
95
  is_custom_product: boolean;
98
96
  buyerId: number;
@@ -121,7 +119,6 @@ export declare const ProductDeficitSchema: z.ZodObject<{
121
119
  date_shipments: Date;
122
120
  productId: number;
123
121
  date_order: Date;
124
- date_by_urgency: Date;
125
122
  buyerId: number;
126
123
  manager_id: number;
127
124
  status?: string | undefined;
@@ -158,7 +155,6 @@ export declare const ProductDeficitSchema: z.ZodObject<{
158
155
  date_shipments: Date;
159
156
  productId: number;
160
157
  date_order: Date;
161
- date_by_urgency: Date;
162
158
  bron: boolean;
163
159
  is_custom_product: boolean;
164
160
  buyerId: number;
@@ -216,7 +212,6 @@ export declare const ProductDeficitSchema: z.ZodObject<{
216
212
  date_shipments: Date;
217
213
  productId: number;
218
214
  date_order: Date;
219
- date_by_urgency: Date;
220
215
  buyerId: number;
221
216
  manager_id: number;
222
217
  status?: string | undefined;
@@ -51,6 +51,7 @@ export interface IrecalculateStartTimeDetalByEquipment {
51
51
  equipmentId: number;
52
52
  startTime?: Date;
53
53
  transaction?: any;
54
+ preventTaskRelative?: boolean;
54
55
  }
55
56
  export interface IFilterByDate<T> {
56
57
  itemToSort: T[];
@@ -198,6 +199,11 @@ export interface IGetActualTaskRelative {
198
199
  };
199
200
  transaction?: any;
200
201
  }
202
+ export interface IRelevanceOfProductionTask {
203
+ operationId: number;
204
+ isStopActualPositions?: boolean;
205
+ transaction?: any;
206
+ }
201
207
  export interface IActualOperationPos {
202
208
  userId: number;
203
209
  indexStartFrom?: number | null;
@@ -14,7 +14,9 @@ export declare const OperationPositionSchema: z.ZodObject<{
14
14
  equipment_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
15
15
  production_operation_pos_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
16
16
  operation_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
17
+ count_created: z.ZodDefault<z.ZodNumber>;
17
18
  plan_ready_time: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
19
+ is_relevance: z.ZodDefault<z.ZodBoolean>;
18
20
  createdAt: z.ZodDate;
19
21
  updatedAt: z.ZodDate;
20
22
  }, "strip", z.ZodTypeAny, {
@@ -23,6 +25,8 @@ export declare const OperationPositionSchema: z.ZodObject<{
23
25
  createdAt: Date;
24
26
  updatedAt: Date;
25
27
  create_time_minutes: number;
28
+ count_created: number;
29
+ is_relevance: boolean;
26
30
  user_id?: number | null | undefined;
27
31
  idx?: number | undefined;
28
32
  equipment_id?: number | null | undefined;
@@ -44,7 +48,9 @@ export declare const OperationPositionSchema: z.ZodObject<{
44
48
  detal_idx?: number | undefined;
45
49
  create_time_minutes?: number | undefined;
46
50
  production_operation_pos_id?: number | null | undefined;
51
+ count_created?: number | undefined;
47
52
  plan_ready_time?: Date | null | undefined;
53
+ is_relevance?: boolean | undefined;
48
54
  }>;
49
55
  export type ModelOperationPosition = z.infer<typeof OperationPositionSchema> & {
50
56
  responsibleUser?: ModelUser;
@@ -13,7 +13,9 @@ exports.OperationPositionSchema = zod_1.z.object({
13
13
  equipment_id: zod_1.z.number().int().nullish(),
14
14
  production_operation_pos_id: zod_1.z.number().nullish(),
15
15
  operation_id: zod_1.z.number().int().nullish(),
16
+ count_created: zod_1.z.number().int().nonnegative().default(0),
16
17
  plan_ready_time: zod_1.z.date().nullish(),
18
+ is_relevance: zod_1.z.boolean().default(true),
17
19
  createdAt: zod_1.z.date(),
18
20
  updatedAt: zod_1.z.date()
19
21
  });
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ export declare const setWarehouseReadinessDateSchema: z.ZodObject<{
3
+ id: z.ZodNumber;
4
+ date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ id: number;
7
+ date?: string | null | undefined;
8
+ }, {
9
+ id: number;
10
+ date?: string | null | undefined;
11
+ }>;
12
+ export type setWarehouseReadinessDateDto = z.infer<typeof setWarehouseReadinessDateSchema>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setWarehouseReadinessDateSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.setWarehouseReadinessDateSchema = zod_1.z.object({
6
+ id: zod_1.z.number(),
7
+ date: zod_1.z.string().nullish()
8
+ });
@@ -2,7 +2,6 @@ import { z } from 'zod';
2
2
  export declare const ShipmentsListPaginationResponseSchema: z.ZodObject<{
3
3
  count: z.ZodNumber;
4
4
  rows: z.ZodArray<z.ZodObject<{
5
- date_by_urgency: z.ZodUnion<[z.ZodString, z.ZodDate]>;
6
5
  date_shipments: z.ZodUnion<[z.ZodString, z.ZodDate]>;
7
6
  id: z.ZodNumber;
8
7
  number_order: z.ZodString;
@@ -100,7 +99,6 @@ export declare const ShipmentsListPaginationResponseSchema: z.ZodObject<{
100
99
  id: number;
101
100
  number_order: string;
102
101
  date_shipments: string | Date;
103
- date_by_urgency: string | Date;
104
102
  product?: {
105
103
  id: number;
106
104
  name: string;
@@ -133,7 +131,6 @@ export declare const ShipmentsListPaginationResponseSchema: z.ZodObject<{
133
131
  id: number;
134
132
  number_order: string;
135
133
  date_shipments: string | Date;
136
- date_by_urgency: string | Date;
137
134
  product?: {
138
135
  id: number;
139
136
  name: string;
@@ -169,7 +166,6 @@ export declare const ShipmentsListPaginationResponseSchema: z.ZodObject<{
169
166
  id: number;
170
167
  number_order: string;
171
168
  date_shipments: string | Date;
172
- date_by_urgency: string | Date;
173
169
  product?: {
174
170
  id: number;
175
171
  name: string;
@@ -205,7 +201,6 @@ export declare const ShipmentsListPaginationResponseSchema: z.ZodObject<{
205
201
  id: number;
206
202
  number_order: string;
207
203
  date_shipments: string | Date;
208
- date_by_urgency: string | Date;
209
204
  product?: {
210
205
  id: number;
211
206
  name: string;
@@ -15,7 +15,6 @@ export * from './dto/shipments-paginate.dto';
15
15
  export * from './dto/up-create-shipments.dto';
16
16
  export * from './types/increment-shipments-kolvo.type';
17
17
  export * from './types/update-shipments-by-product.type';
18
- export * from './dto/change-date-urgency.dto';
19
18
  export * from './dto/format-list-shipment.dto';
20
19
  export * from './interface/interface';
21
20
  export * from './dto/entity-filtering-by-shipment.dto';
@@ -31,7 +31,6 @@ __exportStar(require("./dto/shipments-paginate.dto"), exports);
31
31
  __exportStar(require("./dto/up-create-shipments.dto"), exports);
32
32
  __exportStar(require("./types/increment-shipments-kolvo.type"), exports);
33
33
  __exportStar(require("./types/update-shipments-by-product.type"), exports);
34
- __exportStar(require("./dto/change-date-urgency.dto"), exports);
35
34
  __exportStar(require("./dto/format-list-shipment.dto"), exports);
36
35
  __exportStar(require("./interface/interface"), exports);
37
36
  __exportStar(require("./dto/entity-filtering-by-shipment.dto"), exports);
@@ -1,6 +1,5 @@
1
1
  import { z } from 'zod';
2
2
  export declare const ShipmentListItem: z.ZodObject<{
3
- date_by_urgency: z.ZodUnion<[z.ZodString, z.ZodDate]>;
4
3
  date_shipments: z.ZodUnion<[z.ZodString, z.ZodDate]>;
5
4
  id: z.ZodNumber;
6
5
  number_order: z.ZodString;
@@ -98,7 +97,6 @@ export declare const ShipmentListItem: z.ZodObject<{
98
97
  id: number;
99
98
  number_order: string;
100
99
  date_shipments: string | Date;
101
- date_by_urgency: string | Date;
102
100
  product?: {
103
101
  id: number;
104
102
  name: string;
@@ -131,7 +129,6 @@ export declare const ShipmentListItem: z.ZodObject<{
131
129
  id: number;
132
130
  number_order: string;
133
131
  date_shipments: string | Date;
134
- date_by_urgency: string | Date;
135
132
  product?: {
136
133
  id: number;
137
134
  name: string;
@@ -5,7 +5,6 @@ const zod_1 = require("zod");
5
5
  const shipments_detal_schema_1 = require("./shipments-detal.schema");
6
6
  const shipments_cbed_schema_1 = require("./shipments-cbed.schema");
7
7
  exports.ShipmentListItem = zod_1.z.object({
8
- date_by_urgency: zod_1.z.union([zod_1.z.string(), zod_1.z.date()]),
9
8
  date_shipments: zod_1.z.union([zod_1.z.string(), zod_1.z.date()]),
10
9
  id: zod_1.z.number().int(),
11
10
  number_order: zod_1.z.string(),
@@ -16,7 +16,6 @@ export declare const ShipmentsSchema: z.ZodObject<{
16
16
  ban: z.ZodDefault<z.ZodBoolean>;
17
17
  date_order: z.ZodDate;
18
18
  date_shipments: z.ZodDate;
19
- date_by_urgency: z.ZodDate;
20
19
  number_order: z.ZodString;
21
20
  kol: z.ZodNumber;
22
21
  bron: z.ZodDefault<z.ZodBoolean>;
@@ -75,7 +74,6 @@ export declare const ShipmentsSchema: z.ZodObject<{
75
74
  date_shipments: Date;
76
75
  productId: number;
77
76
  date_order: Date;
78
- date_by_urgency: Date;
79
77
  bron: boolean;
80
78
  is_custom_product: boolean;
81
79
  buyerId: number;
@@ -104,7 +102,6 @@ export declare const ShipmentsSchema: z.ZodObject<{
104
102
  date_shipments: Date;
105
103
  productId: number;
106
104
  date_order: Date;
107
- date_by_urgency: Date;
108
105
  buyerId: number;
109
106
  manager_id: number;
110
107
  status?: string | undefined;
@@ -9,7 +9,6 @@ exports.ShipmentsSchema = zod_1.z.object({
9
9
  ban: zod_1.z.boolean().default(false),
10
10
  date_order: zod_1.z.date(),
11
11
  date_shipments: zod_1.z.date(),
12
- date_by_urgency: zod_1.z.date(),
13
12
  number_order: zod_1.z.string(),
14
13
  kol: zod_1.z.number().int().nonnegative(),
15
14
  bron: zod_1.z.boolean().default(false),
@@ -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;
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ export declare const UserIncludeSchema: z.ZodEnum<["role", "documents", "avatars", "detals", "cbeds", "products", "equipments", "actions", "actionsUser", "responsibleForProduct", "responsibleForDocuments", "typeOperations", "tableConfigs"]>;
3
+ export declare const GetOneUserDtoSchema: z.ZodObject<{
4
+ id: z.ZodNumber;
5
+ includes: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<["role", "documents", "avatars", "detals", "cbeds", "products", "equipments", "actions", "actionsUser", "responsibleForProduct", "responsibleForDocuments", "typeOperations", "tableConfigs"]>, "many">>>, ("role" | "documents" | "equipments" | "actions" | "products" | "cbeds" | "responsibleForProduct" | "responsibleForDocuments" | "typeOperations" | "detals" | "avatars" | "actionsUser" | "tableConfigs")[], unknown>;
6
+ attributes: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>, string[], unknown>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ includes: ("role" | "documents" | "equipments" | "actions" | "products" | "cbeds" | "responsibleForProduct" | "responsibleForDocuments" | "typeOperations" | "detals" | "avatars" | "actionsUser" | "tableConfigs")[];
9
+ id: number;
10
+ attributes: string[];
11
+ }, {
12
+ id: number;
13
+ includes?: unknown;
14
+ attributes?: unknown;
15
+ }>;
16
+ export type GetOneUserDtoType = z.infer<typeof GetOneUserDtoSchema>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetOneUserDtoSchema = exports.UserIncludeSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const utils_1 = require("../../utils");
6
+ exports.UserIncludeSchema = zod_1.z.enum([
7
+ 'role',
8
+ 'documents',
9
+ 'avatars',
10
+ 'detals',
11
+ 'cbeds',
12
+ 'products',
13
+ 'equipments',
14
+ 'actions',
15
+ 'actionsUser',
16
+ 'responsibleForProduct',
17
+ 'responsibleForDocuments',
18
+ 'typeOperations',
19
+ 'tableConfigs'
20
+ ]);
21
+ exports.GetOneUserDtoSchema = zod_1.z.object({
22
+ id: zod_1.z.number(),
23
+ includes: zod_1.z.preprocess(value => typeof value === 'string' ? (0, utils_1.parseParamsOrBody)({ value }, []) : value, zod_1.z.array(exports.UserIncludeSchema).optional().default([])),
24
+ attributes: zod_1.z.preprocess(value => typeof value === 'string' ? (0, utils_1.parseParamsOrBody)({ value }, []) : value, zod_1.z.array(zod_1.z.string()).optional().default([]))
25
+ });
@@ -1,6 +1,7 @@
1
1
  export * from './dto/add-role.dto';
2
2
  export * from './dto/ban-user.dto';
3
3
  export * from './dto/get-users.dto';
4
+ export * from './dto/get-one-user.dto';
4
5
  export * from './dto/create-user.dto';
5
6
  export * from './schemas/user.schema';
6
7
  export * from './interfaces/create-user.interface';
@@ -8,3 +9,5 @@ export * from './dto/tabel-unique.dto';
8
9
  export * from './default-value/model';
9
10
  export * from './dto/auth-user.dto';
10
11
  export * from './enums';
12
+ export * from './schemas/user-table-config.schema';
13
+ export * from './dto/update-user-table-config.dto';
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./dto/add-role.dto"), exports);
18
18
  __exportStar(require("./dto/ban-user.dto"), exports);
19
19
  __exportStar(require("./dto/get-users.dto"), exports);
20
+ __exportStar(require("./dto/get-one-user.dto"), exports);
20
21
  __exportStar(require("./dto/create-user.dto"), exports);
21
22
  __exportStar(require("./schemas/user.schema"), exports);
22
23
  __exportStar(require("./interfaces/create-user.interface"), exports);
@@ -24,3 +25,5 @@ __exportStar(require("./dto/tabel-unique.dto"), exports);
24
25
  __exportStar(require("./default-value/model"), exports);
25
26
  __exportStar(require("./dto/auth-user.dto"), exports);
26
27
  __exportStar(require("./enums"), exports);
28
+ __exportStar(require("./schemas/user-table-config.schema"), exports);
29
+ __exportStar(require("./dto/update-user-table-config.dto"), exports);
@@ -28,7 +28,13 @@ export declare class DateMethods {
28
28
  * @param planReadyTime
29
29
  * @returns
30
30
  */
31
- calculateDeltaTime: (calculatedCreateTime: Date, planReadyTime: Date) => number;
31
+ calculateDeltaTime: (calculatedCreateTime: Date, planReadyTime: Date, config?: {
32
+ holidays?: Array<{
33
+ month: number;
34
+ day: number;
35
+ }>;
36
+ skipDefaultJanuaryHolidays?: boolean;
37
+ }) => number;
32
38
  /**
33
39
  * Функция возвращает текущее время в UTC формате
34
40
  * @param config
@@ -54,11 +54,58 @@ class DateMethods {
54
54
  * @param planReadyTime
55
55
  * @returns
56
56
  */
57
- this.calculateDeltaTime = (calculatedCreateTime, planReadyTime) => {
58
- const calculateDate = new Date(calculatedCreateTime);
59
- const planReadyDate = new Date(planReadyTime);
60
- const diffInMs = planReadyDate.getTime() - calculateDate.getTime();
61
- return Math.round(diffInMs / (1000 * 60));
57
+ this.calculateDeltaTime = (calculatedCreateTime, planReadyTime, config) => {
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
+ var _a, _b;
72
+ const dayOfWeek = date.getUTCDay();
73
+ const month = date.getUTCMonth();
74
+ const day = date.getUTCDate();
75
+ const skipJanuary = (_a = config === null || config === void 0 ? void 0 : config.skipDefaultJanuaryHolidays) !== null && _a !== void 0 ? _a : true;
76
+ if (skipJanuary && month === 0 && day >= 1 && day <= 14) {
77
+ return false;
78
+ }
79
+ if ((_b = config === null || config === void 0 ? void 0 : config.holidays) === null || _b === void 0 ? void 0 : _b.length) {
80
+ const isHoliday = config.holidays.some((h) => h.month === month && h.day === day);
81
+ if (isHoliday) {
82
+ return false;
83
+ }
84
+ }
85
+ return dayOfWeek !== 0 && dayOfWeek !== 6;
86
+ };
87
+ let totalMinutes = 0;
88
+ const current = new Date(start);
89
+ while (current < end) {
90
+ if (!isWorkDay(current)) {
91
+ current.setUTCDate(current.getUTCDate() + 1);
92
+ current.setUTCHours(0, 0, 0, 0);
93
+ continue;
94
+ }
95
+ const workStart = new Date(current);
96
+ workStart.setUTCHours(workDayStartHour, 0, 0, 0);
97
+ const workEnd = new Date(current);
98
+ workEnd.setUTCHours(workDayEndHour, 0, 0, 0);
99
+ const actualStart = current > workStart ? current : workStart;
100
+ const actualEnd = end < workEnd ? end : workEnd;
101
+ if (actualStart < actualEnd) {
102
+ totalMinutes +=
103
+ (actualEnd.getTime() - actualStart.getTime()) / (1000 * 60);
104
+ }
105
+ current.setUTCDate(current.getUTCDate() + 1);
106
+ current.setUTCHours(0, 0, 0, 0);
107
+ }
108
+ return Math.round(totalMinutes) * sign;
62
109
  };
63
110
  /**
64
111
  * Функция возвращает текущее время в UTC формате
@@ -24,3 +24,6 @@ export * from './interfaces';
24
24
  export * from './methods/utils';
25
25
  export * from './promise-pool';
26
26
  export * from './default-value/default-value';
27
+ export * from './tables-config/enum';
28
+ export * from './tables-config/methods';
29
+ export * from './tables-config/tables-array';
@@ -40,3 +40,6 @@ __exportStar(require("./interfaces"), exports);
40
40
  __exportStar(require("./methods/utils"), exports);
41
41
  __exportStar(require("./promise-pool"), exports);
42
42
  __exportStar(require("./default-value/default-value"), exports);
43
+ __exportStar(require("./tables-config/enum"), exports);
44
+ __exportStar(require("./tables-config/methods"), exports);
45
+ __exportStar(require("./tables-config/tables-array"), exports);
@@ -40,21 +40,27 @@ export declare const leftToDoByProductionTask: (marks: ModelMarks[], myQuantity:
40
40
  * @param startDate
41
41
  * @param totalMinutes
42
42
  * @returns
43
- * Возвращает время окончания работы над ТЗ
44
- * Обратить внимание, что считается только рабочее время.
45
- * Суббота и воскресенье не считаются за рабочий день.
46
- */
47
- /**
48
- *
49
- * @param startDate
50
- * @param totalMinutes
51
- * @returns
52
- * Возвращает время окончания работы над ТЗ
43
+ * Возвращает время окончания работы над ПЗ
53
44
  * Обратить внимание, что считается только рабочее время.
54
45
  * Суббота и воскресенье не считаются за рабочий день.
55
46
  * Если startDate выходит за пределы рабочего времени, отсчет начинается от ближайшей рабочей даты.
56
47
  */
57
- export declare const calculateEndDate: (startDate: Date, totalMinutes: number) => Date;
48
+ export interface HolidayConfig {
49
+ /**
50
+ * Массив кастомных выходных дней
51
+ * month: 0-11 (где 0 - январь), day: 1-31
52
+ */
53
+ holidays?: Array<{
54
+ month: number;
55
+ day: number;
56
+ }>;
57
+ /**
58
+ * Пропускать стандартные новогодние праздники (с 1 по 14 января).
59
+ * По умолчанию true.
60
+ */
61
+ skipDefaultJanuaryHolidays?: boolean;
62
+ }
63
+ export declare const calculateEndDate: (startDate: Date, totalMinutes: number, config?: HolidayConfig) => Date;
58
64
  /**
59
65
  * Функция получает сущность и генерирует из него элемент спецификации
60
66
  * @param entity
@@ -113,26 +113,7 @@ const leftToDoByProductionTask = (marks, myQuantity) => {
113
113
  return moreMinusNum(myQuantity - createByMarks);
114
114
  };
115
115
  exports.leftToDoByProductionTask = leftToDoByProductionTask;
116
- /**
117
- *
118
- * @param startDate
119
- * @param totalMinutes
120
- * @returns
121
- * Возвращает время окончания работы над ТЗ
122
- * Обратить внимание, что считается только рабочее время.
123
- * Суббота и воскресенье не считаются за рабочий день.
124
- */
125
- /**
126
- *
127
- * @param startDate
128
- * @param totalMinutes
129
- * @returns
130
- * Возвращает время окончания работы над ТЗ
131
- * Обратить внимание, что считается только рабочее время.
132
- * Суббота и воскресенье не считаются за рабочий день.
133
- * Если startDate выходит за пределы рабочего времени, отсчет начинается от ближайшей рабочей даты.
134
- */
135
- const calculateEndDate = (startDate, totalMinutes) => {
116
+ const calculateEndDate = (startDate, totalMinutes, config) => {
136
117
  let currentDate = new Date(startDate);
137
118
  let remainingMinutes = totalMinutes;
138
119
  const workDayStartHour = 5;
@@ -140,7 +121,21 @@ const calculateEndDate = (startDate, totalMinutes) => {
140
121
  const workDayEndHour = workDayStartHour + workDayHours;
141
122
  // Функция для проверки, является ли дата рабочим днем
142
123
  const isWorkDay = (date) => {
124
+ var _a, _b;
143
125
  const dayOfWeek = date.getUTCDay();
126
+ const month = date.getUTCMonth();
127
+ const day = date.getUTCDate();
128
+ const skipJanuary = (_a = config === null || config === void 0 ? void 0 : config.skipDefaultJanuaryHolidays) !== null && _a !== void 0 ? _a : true;
129
+ if (skipJanuary && month === 0 && day >= 1 && day <= 14) {
130
+ return false;
131
+ }
132
+ // Проверяем кастомные праздники из конфига
133
+ if ((_b = config === null || config === void 0 ? void 0 : config.holidays) === null || _b === void 0 ? void 0 : _b.length) {
134
+ const isHoliday = config.holidays.some(holiday => holiday.month === month && holiday.day === day);
135
+ if (isHoliday) {
136
+ return false;
137
+ }
138
+ }
144
139
  return dayOfWeek !== 0 && dayOfWeek !== 6;
145
140
  };
146
141
  const getWorkDayStart = (date) => {
@@ -25,7 +25,7 @@ export declare class OperationTime {
25
25
  preTime: number;
26
26
  mainTime: number;
27
27
  helperTime: number;
28
- } | null, count?: number);
28
+ } | null | ModelOperation, count?: number);
29
29
  private timeKolvo;
30
30
  }
31
31
  export declare function worksHors(operation: any, kolvo_all?: number): number;
@@ -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));
@@ -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', '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()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pksep/zod-shared",
3
- "version": "0.0.519",
3
+ "version": "0.0.521",
4
4
  "description": "Zod package for erp project. Contains dto, interfaces, schems, types, enum",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",