@pksep/zod-shared 0.0.554 → 0.0.556
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/enums/enums.d.ts +10 -0
- package/dist/action/enums/enums.js +10 -0
- package/dist/assemble/dto/get-assemble-operation-count.dto.d.ts +24 -24
- package/dist/assemble/schemas/assemble-coming.schema.d.ts +18 -18
- package/dist/assemble/schemas/assemble.schema.d.ts +18 -18
- package/dist/assemble-kit/schemas/assemble-kit.schema.d.ts +6 -6
- package/dist/buyer/schemas/buyer.schema.d.ts +2 -2
- package/dist/buyer/schemas/purchases.schema.d.ts +2 -2
- package/dist/cbed/schemas/cbed.schema.d.ts +2 -2
- package/dist/company/schemas/companies.schema.d.ts +2 -2
- package/dist/detal/default-values/default-values.d.ts +4 -0
- package/dist/detal/default-values/default-values.js +4 -0
- package/dist/detal/schemas/detal-deficit.schema.d.ts +198 -28
- package/dist/detal/schemas/detal.schema.d.ts +192 -22
- package/dist/document/dto/update-document.dto.d.ts +2 -2
- package/dist/edizm/schemas/edizm.schema.d.ts +2 -2
- package/dist/edizm/schemas/type-edizm.schema.d.ts +6 -6
- package/dist/equipment/dto/udate-equipment-type.dto.d.ts +2 -2
- package/dist/equipment/dto/update-equipment.dto.d.ts +1 -1
- package/dist/equipment/schemas/equipment-pt.schema.d.ts +2 -2
- package/dist/equipment/schemas/equipment.schema.d.ts +6 -6
- package/dist/expenditure/schema/expenditure-consumption.schema.d.ts +4 -4
- package/dist/expenditure/schema/expenditure-position.schema.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/instrument/dto/update-instrument.dto.d.ts +2 -2
- package/dist/instrument/dto/update-pt.dto.d.ts +2 -2
- package/dist/instrument/schemas/pt-instrument.schema.d.ts +2 -2
- package/dist/inventary/dto/update-inventary.dto.d.ts +2 -2
- package/dist/material/dto/create-material.dto.d.ts +136 -0
- package/dist/material/dto/create-material.dto.js +16 -0
- package/dist/material/dto/up-create-type-material.dto.d.ts +4 -0
- package/dist/material/dto/up-create-type-material.dto.js +6 -1
- package/dist/material/enum/enum.d.ts +10 -0
- package/dist/material/enum/enum.js +12 -1
- package/dist/material/index.d.ts +1 -0
- package/dist/material/index.js +1 -0
- package/dist/material/interfaces/interface.d.ts +5 -0
- package/dist/material/schemas/material-characteristics.schema.d.ts +56 -0
- package/dist/material/schemas/material-characteristics.schema.js +3 -1
- package/dist/material/schemas/material-shipments-response.schema.d.ts +130 -6
- package/dist/material/schemas/material.schema.d.ts +130 -6
- package/dist/material/schemas/subtype-material.schema.d.ts +2 -2
- package/dist/material/schemas/subtype-material.schema.js +1 -1
- package/dist/material/schemas/type-material.schema.d.ts +118 -2
- package/dist/material/schemas/type-material.schema.js +9 -2
- package/dist/material/utils/workpiece-mass.js +13 -6
- package/dist/material/workpiece-mass.d.ts +45 -0
- package/dist/material/workpiece-mass.js +400 -0
- package/dist/metaloworking/schemas/metaloworking-coming.schema.d.ts +2 -2
- package/dist/moving/schemas/moving.schema.d.ts +6 -6
- package/dist/operations/dto/get-type-operation-by-id.dto.d.ts +3 -3
- package/dist/operations/dto/update-type-operation.dto.d.ts +2 -2
- package/dist/product/schemas/product-deficit.schema.d.ts +6 -6
- package/dist/production-tasks/index.d.ts +1 -0
- package/dist/production-tasks/index.js +1 -0
- package/dist/production-tasks/interfaces/production-tasks.d.ts +8 -3
- package/dist/production-tasks/schemas/orders-summary-by-entity.schema.d.ts +349 -0
- package/dist/production-tasks/schemas/orders-summary-by-entity.schema.js +83 -0
- package/dist/role/dto/update-role.dto.d.ts +2 -2
- package/dist/role/schemas/role.schema.d.ts +8 -8
- package/dist/sclad/schemas/remain.schema.d.ts +2 -2
- package/dist/sclad/schemas/remains.schema.d.ts +16 -16
- package/dist/settings/dto/update-edizm.dto.d.ts +2 -2
- package/dist/shipments/dto/shipments-list-pagination-response.dto.d.ts +18 -18
- package/dist/shipments/dto/up-create-shipments.dto.d.ts +4 -4
- package/dist/shipments/schemas/shipment-list-item.schema.d.ts +12 -12
- package/dist/shipments/schemas/shipments.schema.d.ts +4 -4
- package/dist/shipments/types/increment-shipments-kolvo.type.d.ts +12 -12
- package/dist/shipments/types/types.d.ts +1 -0
- package/dist/shipments/types/update-shipments-by-product.type.d.ts +12 -12
- package/dist/specification/schema/attributes.schema.d.ts +432 -46
- package/dist/tech-process/schemas/tech-process.schema.d.ts +2 -2
- package/dist/user/schemas/user.schema.d.ts +4 -4
- package/dist/utils/interface/status-flags.interface.d.ts +4 -0
- package/dist/utils/methods.js +4 -2
- package/dist/utils/schemas/schema.d.ts +2 -2
- package/dist/utils/types.d.ts +6 -0
- package/package.json +1 -1
- package/dist/issue/dto/up-create-issue.dto.d.ts +0 -49
- package/dist/issue/dto/up-create-issue.dto.js +0 -21
- package/dist/issue/index.d.ts +0 -5
- package/dist/issue/index.js +0 -21
- package/dist/issue/interfaces/interface.d.ts +0 -4
- package/dist/issue/schemas/issue-user-controller.schema.d.ts +0 -15
- package/dist/issue/schemas/issue-user-controller.schema.js +0 -9
- package/dist/issue/schemas/issue-user.schema.d.ts +0 -15
- package/dist/issue/schemas/issue-user.schema.js +0 -9
- package/dist/issue/schemas/issue.schema.d.ts +0 -51
- package/dist/issue/schemas/issue.schema.js +0 -21
- package/dist/library/dto/create-chapter.dto.d.ts +0 -12
- package/dist/library/dto/create-chapter.dto.js +0 -8
- package/dist/library/dto/create-link.dto.d.ts +0 -30
- package/dist/library/dto/create-link.dto.js +0 -14
- package/dist/library/index.d.ts +0 -5
- package/dist/library/index.js +0 -21
- package/dist/library/interfaces/interface.d.ts +0 -3
- package/dist/library/interfaces/interface.js +0 -2
- package/dist/library/schemas/links-user.schema.d.ts +0 -15
- package/dist/library/schemas/links-user.schema.js +0 -9
- package/dist/library/schemas/links.schema.d.ts +0 -30
- package/dist/library/schemas/links.schema.js +0 -14
- package/dist/production-tasks/dto/update-marks.dto.d.ts +0 -13
- package/dist/production-tasks/dto/update-marks.dto.js +0 -8
- package/dist/production-tasks/dto/update-responsible.dto.d.ts +0 -12
- package/dist/production-tasks/dto/update-responsible.dto.js +0 -8
- package/dist/production-tasks/dto/update-status.dto.d.ts +0 -13
- package/dist/production-tasks/dto/update-status.dto.js +0 -9
- package/dist/tech-process/schemas/tech-process-with-options.schema.d.ts +0 -306
- package/dist/tech-process/schemas/tech-process-with-options.schema.js +0 -8
- package/dist/utils/interface/mat.interface.d.ts +0 -10
- package/dist/utils/interface/mat.interface.js +0 -2
- /package/dist/{issue/interfaces/interface.js → utils/interface/status-flags.interface.js} +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TypeMaterialSchema = exports.TypeMaterialCharacteristicsSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const enum_1 = require("../enum/enum");
|
|
5
6
|
const utils_1 = require("../../utils");
|
|
6
7
|
const TypeMaterialCharacteristicsItemSchema = zod_1.z.object({
|
|
7
8
|
edizmId: zod_1.z.number().int(),
|
|
@@ -15,12 +16,18 @@ exports.TypeMaterialCharacteristicsSchema = zod_1.z.object({
|
|
|
15
16
|
wallThickness: TypeMaterialCharacteristicsItemSchema,
|
|
16
17
|
outsideDiameter: TypeMaterialCharacteristicsItemSchema,
|
|
17
18
|
thickness: TypeMaterialCharacteristicsItemSchema,
|
|
18
|
-
areaCrossSectional: TypeMaterialCharacteristicsItemSchema
|
|
19
|
+
areaCrossSectional: TypeMaterialCharacteristicsItemSchema,
|
|
20
|
+
acrossFlats: TypeMaterialCharacteristicsItemSchema,
|
|
21
|
+
massPerMeter: TypeMaterialCharacteristicsItemSchema
|
|
19
22
|
});
|
|
20
23
|
exports.TypeMaterialSchema = zod_1.z.object({
|
|
21
24
|
id: zod_1.z.number().int().positive(),
|
|
22
25
|
ban: zod_1.z.boolean(),
|
|
23
26
|
name: zod_1.z.string(),
|
|
24
27
|
characteristics: exports.TypeMaterialCharacteristicsSchema,
|
|
25
|
-
instance_type: zod_1.z.number().int().min(1).max(3)
|
|
28
|
+
instance_type: zod_1.z.number().int().min(1).max(3),
|
|
29
|
+
workpieceMassFormulaKey: zod_1.z
|
|
30
|
+
.nativeEnum(enum_1.WorkpieceMassFormulaKey)
|
|
31
|
+
.nullable()
|
|
32
|
+
.optional()
|
|
26
33
|
});
|
|
@@ -173,17 +173,24 @@ exports.WORKPIECE_MASS_FORMULAS = [
|
|
|
173
173
|
]
|
|
174
174
|
}
|
|
175
175
|
];
|
|
176
|
+
const normalizeCharacteristicNumericValue = (value) => {
|
|
177
|
+
if (typeof value === 'number' && !Number.isNaN(value)) {
|
|
178
|
+
return value;
|
|
179
|
+
}
|
|
180
|
+
if (typeof value === 'string') {
|
|
181
|
+
const normalizedValue = Number(value);
|
|
182
|
+
return !Number.isNaN(normalizedValue) ? normalizedValue : null;
|
|
183
|
+
}
|
|
184
|
+
return null;
|
|
185
|
+
};
|
|
176
186
|
const getMaterialCharacteristicValue = (context, key) => {
|
|
177
187
|
var _a, _b;
|
|
178
188
|
const item = (_b = (_a = context.material) === null || _a === void 0 ? void 0 : _a.characteristics) === null || _b === void 0 ? void 0 : _b[key];
|
|
179
|
-
return
|
|
180
|
-
? item.znach
|
|
181
|
-
: null;
|
|
189
|
+
return normalizeCharacteristicNumericValue(item === null || item === void 0 ? void 0 : item.znach);
|
|
182
190
|
};
|
|
183
191
|
const getWorkpieceCharacteristicValue = (context, key) => {
|
|
184
192
|
var _a;
|
|
185
|
-
|
|
186
|
-
return typeof value === 'number' && !Number.isNaN(value) ? value : null;
|
|
193
|
+
return normalizeCharacteristicNumericValue((_a = context.workpieceCharacterization) === null || _a === void 0 ? void 0 : _a[key]);
|
|
187
194
|
};
|
|
188
195
|
/**
|
|
189
196
|
* Возвращаем первое осмысленное положительное значение.
|
|
@@ -216,7 +223,7 @@ const getPreparedWorkpieceValues = (context) => {
|
|
|
216
223
|
? pickPreparedCharacteristicValue(getMaterialCharacteristicValue(context, characteristicKey), getWorkpieceCharacteristicValue(context, characteristicKey))
|
|
217
224
|
: pickPreparedCharacteristicValue(getWorkpieceCharacteristicValue(context, characteristicKey), getMaterialCharacteristicValue(context, characteristicKey));
|
|
218
225
|
}
|
|
219
|
-
const density = getMaterialCharacteristicValue(context, 'density');
|
|
226
|
+
const density = pickPreparedCharacteristicValue(getWorkpieceCharacteristicValue(context, 'density'), getMaterialCharacteristicValue(context, 'density'));
|
|
220
227
|
if (density !== null)
|
|
221
228
|
result.density = density;
|
|
222
229
|
const mass = getWorkpieceCharacteristicValue(context, 'mass');
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { WorkpieceMassFormulaKey } from './enum/enum';
|
|
2
|
+
import type { ModelMaterial } from './schemas/material.schema';
|
|
3
|
+
import type { ModelTypeMaterial } from './schemas/type-material.schema';
|
|
4
|
+
export type TWorkpieceMassVariableKey = 'density' | 'length' | 'width' | 'height' | 'thickness' | 'wallThickness' | 'outsideDiameter' | 'areaCrossSectional' | 'acrossFlats' | 'massPerMeter';
|
|
5
|
+
export interface IWorkpieceMassFormulaVariable {
|
|
6
|
+
key: TWorkpieceMassVariableKey;
|
|
7
|
+
name: string;
|
|
8
|
+
source: 'material' | 'workpiece';
|
|
9
|
+
required: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface IWorkpieceMassFormula {
|
|
12
|
+
key: WorkpieceMassFormulaKey;
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
variables: IWorkpieceMassFormulaVariable[];
|
|
16
|
+
}
|
|
17
|
+
export type TResolvedWorkpieceMassVariables = Partial<Record<TWorkpieceMassVariableKey, number>>;
|
|
18
|
+
export interface ICalculateWorkpieceMassContext {
|
|
19
|
+
typeMaterial: ModelTypeMaterial;
|
|
20
|
+
material: ModelMaterial;
|
|
21
|
+
workpieceCharacterization?: Record<string, number | null | undefined>;
|
|
22
|
+
workpieceMassFormulaKey?: WorkpieceMassFormulaKey;
|
|
23
|
+
}
|
|
24
|
+
export interface ICalculateWorkpieceMassResult {
|
|
25
|
+
formulaKey: WorkpieceMassFormulaKey;
|
|
26
|
+
mass: number;
|
|
27
|
+
variables: TResolvedWorkpieceMassVariables;
|
|
28
|
+
}
|
|
29
|
+
type TPreparedWorkpieceValues = Partial<Record<TWorkpieceMassVariableKey | 'mass' | 'trash', number>>;
|
|
30
|
+
type TWorkpieceMassVariableResolver = (context: ICalculateWorkpieceMassContext, prepared: TPreparedWorkpieceValues) => number | null;
|
|
31
|
+
type TWorkpieceMassCalculator = (vars: TResolvedWorkpieceMassVariables) => number;
|
|
32
|
+
export declare const WORKPIECE_MASS_FORMULAS: IWorkpieceMassFormula[];
|
|
33
|
+
/**
|
|
34
|
+
* Реестр источников значений переменных.
|
|
35
|
+
* Здесь описано, откуда брать каждую переменную под расчет массы заготовки.
|
|
36
|
+
*/
|
|
37
|
+
export declare const WORKPIECE_MASS_VARIABLE_RESOLVERS: Record<TWorkpieceMassVariableKey, TWorkpieceMassVariableResolver>;
|
|
38
|
+
/**
|
|
39
|
+
* Реестр математических алгоритмов расчета.
|
|
40
|
+
* Здесь только математика, без поиска значений по моделям.
|
|
41
|
+
*/
|
|
42
|
+
export declare const WORKPIECE_MASS_CALCULATORS: Record<WorkpieceMassFormulaKey, TWorkpieceMassCalculator>;
|
|
43
|
+
export declare const resolveWorkpieceMassVariables: (context: ICalculateWorkpieceMassContext, variableKeys: TWorkpieceMassVariableKey[]) => TResolvedWorkpieceMassVariables;
|
|
44
|
+
export declare const calculateWorkpieceMassPreview: (context: ICalculateWorkpieceMassContext) => ICalculateWorkpieceMassResult | null;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateWorkpieceMassPreview = exports.resolveWorkpieceMassVariables = exports.WORKPIECE_MASS_CALCULATORS = exports.WORKPIECE_MASS_VARIABLE_RESOLVERS = exports.WORKPIECE_MASS_FORMULAS = void 0;
|
|
4
|
+
const enum_1 = require("./enum/enum");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
exports.WORKPIECE_MASS_FORMULAS = [
|
|
7
|
+
{
|
|
8
|
+
key: enum_1.WorkpieceMassFormulaKey.boundingBox,
|
|
9
|
+
name: 'Прямоугольная заготовка',
|
|
10
|
+
description: 'm = ρ * L * B * H',
|
|
11
|
+
variables: [
|
|
12
|
+
{
|
|
13
|
+
key: 'density',
|
|
14
|
+
name: 'Плотность',
|
|
15
|
+
source: 'material',
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
key: 'length',
|
|
20
|
+
name: 'Длина',
|
|
21
|
+
source: 'workpiece',
|
|
22
|
+
required: true
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
key: 'width',
|
|
26
|
+
name: 'Ширина',
|
|
27
|
+
source: 'workpiece',
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
key: 'height',
|
|
32
|
+
name: 'Высота',
|
|
33
|
+
source: 'workpiece',
|
|
34
|
+
required: true
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: enum_1.WorkpieceMassFormulaKey.rectangularSection,
|
|
40
|
+
name: 'Прямоугольное сечение',
|
|
41
|
+
description: 'm = ρ * L * B * t',
|
|
42
|
+
variables: [
|
|
43
|
+
{
|
|
44
|
+
key: 'density',
|
|
45
|
+
name: 'Плотность',
|
|
46
|
+
source: 'material',
|
|
47
|
+
required: true
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
key: 'length',
|
|
51
|
+
name: 'Длина',
|
|
52
|
+
source: 'workpiece',
|
|
53
|
+
required: true
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: 'width',
|
|
57
|
+
name: 'Ширина',
|
|
58
|
+
source: 'workpiece',
|
|
59
|
+
required: true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
key: 'thickness',
|
|
63
|
+
name: 'Толщина',
|
|
64
|
+
source: 'material',
|
|
65
|
+
required: true
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: enum_1.WorkpieceMassFormulaKey.solidRoundSection,
|
|
71
|
+
name: 'Полнотелое круглое сечение',
|
|
72
|
+
description: 'm = ρ * π * D² / 4 * L',
|
|
73
|
+
variables: [
|
|
74
|
+
{
|
|
75
|
+
key: 'density',
|
|
76
|
+
name: 'Плотность',
|
|
77
|
+
source: 'material',
|
|
78
|
+
required: true
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
key: 'outsideDiameter',
|
|
82
|
+
name: 'Наружный диаметр',
|
|
83
|
+
source: 'material',
|
|
84
|
+
required: true
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
key: 'length',
|
|
88
|
+
name: 'Длина',
|
|
89
|
+
source: 'workpiece',
|
|
90
|
+
required: true
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: enum_1.WorkpieceMassFormulaKey.hollowRoundSection,
|
|
96
|
+
name: 'Полое круглое сечение',
|
|
97
|
+
description: 'm = ρ * π * t * (D - t) * L',
|
|
98
|
+
variables: [
|
|
99
|
+
{
|
|
100
|
+
key: 'density',
|
|
101
|
+
name: 'Плотность',
|
|
102
|
+
source: 'material',
|
|
103
|
+
required: true
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
key: 'outsideDiameter',
|
|
107
|
+
name: 'Наружный диаметр',
|
|
108
|
+
source: 'material',
|
|
109
|
+
required: true
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
key: 'wallThickness',
|
|
113
|
+
name: 'Толщина стенки',
|
|
114
|
+
source: 'material',
|
|
115
|
+
required: true
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: 'length',
|
|
119
|
+
name: 'Длина',
|
|
120
|
+
source: 'workpiece',
|
|
121
|
+
required: true
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
key: enum_1.WorkpieceMassFormulaKey.hollowProfileSection,
|
|
127
|
+
name: 'Полое профильное сечение',
|
|
128
|
+
description: 'm = ρ * (B * H - (B - 2t) * (H - 2t)) * L',
|
|
129
|
+
variables: [
|
|
130
|
+
{
|
|
131
|
+
key: 'density',
|
|
132
|
+
name: 'Плотность',
|
|
133
|
+
source: 'material',
|
|
134
|
+
required: true
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
key: 'width',
|
|
138
|
+
name: 'Ширина профиля',
|
|
139
|
+
source: 'material',
|
|
140
|
+
required: true
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
key: 'height',
|
|
144
|
+
name: 'Высота профиля',
|
|
145
|
+
source: 'material',
|
|
146
|
+
required: true
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
key: 'wallThickness',
|
|
150
|
+
name: 'Толщина стенки',
|
|
151
|
+
source: 'material',
|
|
152
|
+
required: true
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
key: 'length',
|
|
156
|
+
name: 'Длина',
|
|
157
|
+
source: 'workpiece',
|
|
158
|
+
required: true
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
key: enum_1.WorkpieceMassFormulaKey.hexSection,
|
|
164
|
+
name: 'Шестигранное сечение',
|
|
165
|
+
description: 'm = ρ * 0.866025 * S² * L',
|
|
166
|
+
variables: [
|
|
167
|
+
{
|
|
168
|
+
key: 'density',
|
|
169
|
+
name: 'Плотность',
|
|
170
|
+
source: 'material',
|
|
171
|
+
required: true
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
key: 'acrossFlats',
|
|
175
|
+
name: 'Размер под ключ',
|
|
176
|
+
source: 'material',
|
|
177
|
+
required: true
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
key: 'length',
|
|
181
|
+
name: 'Длина',
|
|
182
|
+
source: 'workpiece',
|
|
183
|
+
required: true
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
key: enum_1.WorkpieceMassFormulaKey.sectionArea,
|
|
189
|
+
name: 'По площади сечения',
|
|
190
|
+
description: 'm = ρ * A * L',
|
|
191
|
+
variables: [
|
|
192
|
+
{
|
|
193
|
+
key: 'density',
|
|
194
|
+
name: 'Плотность',
|
|
195
|
+
source: 'material',
|
|
196
|
+
required: true
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
key: 'areaCrossSectional',
|
|
200
|
+
name: 'Площадь поперечного сечения',
|
|
201
|
+
source: 'material',
|
|
202
|
+
required: true
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
key: 'length',
|
|
206
|
+
name: 'Длина',
|
|
207
|
+
source: 'workpiece',
|
|
208
|
+
required: true
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
key: enum_1.WorkpieceMassFormulaKey.linearMass,
|
|
214
|
+
name: 'По массе погонного метра',
|
|
215
|
+
description: 'm = q * L',
|
|
216
|
+
variables: [
|
|
217
|
+
{
|
|
218
|
+
key: 'massPerMeter',
|
|
219
|
+
name: 'Масса погонного метра',
|
|
220
|
+
source: 'material',
|
|
221
|
+
required: true
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
key: 'length',
|
|
225
|
+
name: 'Длина',
|
|
226
|
+
source: 'workpiece',
|
|
227
|
+
required: true
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
];
|
|
232
|
+
const getMaterialCharacteristicValue = (context, key) => {
|
|
233
|
+
var _a, _b;
|
|
234
|
+
const item = (_b = (_a = context.material) === null || _a === void 0 ? void 0 : _a.characteristics) === null || _b === void 0 ? void 0 : _b[key];
|
|
235
|
+
return typeof (item === null || item === void 0 ? void 0 : item.znach) === 'number' && !Number.isNaN(item.znach)
|
|
236
|
+
? item.znach
|
|
237
|
+
: null;
|
|
238
|
+
};
|
|
239
|
+
const getWorkpieceCharacteristicValue = (context, key) => {
|
|
240
|
+
var _a;
|
|
241
|
+
const value = (_a = context.workpieceCharacterization) === null || _a === void 0 ? void 0 : _a[key];
|
|
242
|
+
return typeof value === 'number' && !Number.isNaN(value) ? value : null;
|
|
243
|
+
};
|
|
244
|
+
const getPreparedWorkpieceValues = (context) => {
|
|
245
|
+
var _a, _b, _c, _d;
|
|
246
|
+
const result = {};
|
|
247
|
+
const typeMaterialCharacteristics = ((_a = context.typeMaterial) === null || _a === void 0 ? void 0 : _a.characteristics) || {};
|
|
248
|
+
for (const characteristicKey of Object.keys(typeMaterialCharacteristics)) {
|
|
249
|
+
const characteristicMode = (_b = typeMaterialCharacteristics[characteristicKey]) === null || _b === void 0 ? void 0 : _b.znach;
|
|
250
|
+
if (!characteristicMode)
|
|
251
|
+
continue;
|
|
252
|
+
result[characteristicKey] =
|
|
253
|
+
characteristicMode === utils_1.TypeMaterialCharZnachEnum.permanent
|
|
254
|
+
? ((_c = getMaterialCharacteristicValue(context, characteristicKey)) !== null && _c !== void 0 ? _c : undefined)
|
|
255
|
+
: ((_d = getWorkpieceCharacteristicValue(context, characteristicKey)) !== null && _d !== void 0 ? _d : undefined);
|
|
256
|
+
}
|
|
257
|
+
const density = getMaterialCharacteristicValue(context, 'density');
|
|
258
|
+
if (density !== null)
|
|
259
|
+
result.density = density;
|
|
260
|
+
const mass = getWorkpieceCharacteristicValue(context, 'mass');
|
|
261
|
+
if (mass !== null)
|
|
262
|
+
result.mass = mass;
|
|
263
|
+
const trash = getWorkpieceCharacteristicValue(context, 'trash');
|
|
264
|
+
if (trash !== null)
|
|
265
|
+
result.trash = trash;
|
|
266
|
+
return result;
|
|
267
|
+
};
|
|
268
|
+
const getPreparedValue = (prepared, key) => {
|
|
269
|
+
const value = prepared[key];
|
|
270
|
+
return typeof value === 'number' && !Number.isNaN(value) ? value : null;
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* Реестр источников значений переменных.
|
|
274
|
+
* Здесь описано, откуда брать каждую переменную под расчет массы заготовки.
|
|
275
|
+
*/
|
|
276
|
+
exports.WORKPIECE_MASS_VARIABLE_RESOLVERS = {
|
|
277
|
+
density: (context, prepared) => {
|
|
278
|
+
var _a;
|
|
279
|
+
return (_a = getPreparedValue(prepared, 'density')) !== null && _a !== void 0 ? _a : getMaterialCharacteristicValue(context, 'density');
|
|
280
|
+
},
|
|
281
|
+
length: (_context, prepared) => getPreparedValue(prepared, 'length'),
|
|
282
|
+
width: (_context, prepared) => getPreparedValue(prepared, 'width'),
|
|
283
|
+
height: (_context, prepared) => getPreparedValue(prepared, 'height'),
|
|
284
|
+
thickness: (_context, prepared) => getPreparedValue(prepared, 'thickness'),
|
|
285
|
+
wallThickness: (_context, prepared) => getPreparedValue(prepared, 'wallThickness'),
|
|
286
|
+
outsideDiameter: (_context, prepared) => getPreparedValue(prepared, 'outsideDiameter'),
|
|
287
|
+
areaCrossSectional: (_context, prepared) => getPreparedValue(prepared, 'areaCrossSectional'),
|
|
288
|
+
// TODO: добавить поле в model/type_material/material/workpiece_characterization
|
|
289
|
+
acrossFlats: (context, prepared) => {
|
|
290
|
+
var _a;
|
|
291
|
+
return (_a = getPreparedValue(prepared, 'acrossFlats')) !== null && _a !== void 0 ? _a : getMaterialCharacteristicValue(context, 'acrossFlats');
|
|
292
|
+
},
|
|
293
|
+
// TODO: добавить поле в material.characteristics или отдельную модель
|
|
294
|
+
massPerMeter: (context, prepared) => {
|
|
295
|
+
var _a;
|
|
296
|
+
return (_a = getPreparedValue(prepared, 'massPerMeter')) !== null && _a !== void 0 ? _a : getMaterialCharacteristicValue(context, 'massPerMeter');
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
const getRequiredVar = (vars, key) => {
|
|
300
|
+
const value = vars[key];
|
|
301
|
+
if (typeof value !== 'number' || Number.isNaN(value)) {
|
|
302
|
+
throw new Error(`Не заполнена переменная "${key}" для расчета массы заготовки`);
|
|
303
|
+
}
|
|
304
|
+
return value;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* Реестр математических алгоритмов расчета.
|
|
308
|
+
* Здесь только математика, без поиска значений по моделям.
|
|
309
|
+
*/
|
|
310
|
+
exports.WORKPIECE_MASS_CALCULATORS = {
|
|
311
|
+
[enum_1.WorkpieceMassFormulaKey.boundingBox]: vars => {
|
|
312
|
+
const density = getRequiredVar(vars, 'density');
|
|
313
|
+
const length = getRequiredVar(vars, 'length');
|
|
314
|
+
const width = getRequiredVar(vars, 'width');
|
|
315
|
+
const height = getRequiredVar(vars, 'height');
|
|
316
|
+
return density * length * width * height;
|
|
317
|
+
},
|
|
318
|
+
[enum_1.WorkpieceMassFormulaKey.rectangularSection]: vars => {
|
|
319
|
+
const density = getRequiredVar(vars, 'density');
|
|
320
|
+
const length = getRequiredVar(vars, 'length');
|
|
321
|
+
const width = getRequiredVar(vars, 'width');
|
|
322
|
+
const thickness = getRequiredVar(vars, 'thickness');
|
|
323
|
+
return density * length * width * thickness;
|
|
324
|
+
},
|
|
325
|
+
[enum_1.WorkpieceMassFormulaKey.solidRoundSection]: vars => {
|
|
326
|
+
const density = getRequiredVar(vars, 'density');
|
|
327
|
+
const outsideDiameter = getRequiredVar(vars, 'outsideDiameter');
|
|
328
|
+
const length = getRequiredVar(vars, 'length');
|
|
329
|
+
return (density * Math.PI * Math.pow(outsideDiameter, 2) * length) / 4;
|
|
330
|
+
},
|
|
331
|
+
[enum_1.WorkpieceMassFormulaKey.hollowRoundSection]: vars => {
|
|
332
|
+
const density = getRequiredVar(vars, 'density');
|
|
333
|
+
const outsideDiameter = getRequiredVar(vars, 'outsideDiameter');
|
|
334
|
+
const wallThickness = getRequiredVar(vars, 'wallThickness');
|
|
335
|
+
const length = getRequiredVar(vars, 'length');
|
|
336
|
+
return (density *
|
|
337
|
+
Math.PI *
|
|
338
|
+
wallThickness *
|
|
339
|
+
(outsideDiameter - wallThickness) *
|
|
340
|
+
length);
|
|
341
|
+
},
|
|
342
|
+
[enum_1.WorkpieceMassFormulaKey.hollowProfileSection]: vars => {
|
|
343
|
+
const density = getRequiredVar(vars, 'density');
|
|
344
|
+
const width = getRequiredVar(vars, 'width');
|
|
345
|
+
const height = getRequiredVar(vars, 'height');
|
|
346
|
+
const wallThickness = getRequiredVar(vars, 'wallThickness');
|
|
347
|
+
const length = getRequiredVar(vars, 'length');
|
|
348
|
+
return (density *
|
|
349
|
+
(width * height -
|
|
350
|
+
(width - 2 * wallThickness) * (height - 2 * wallThickness)) *
|
|
351
|
+
length);
|
|
352
|
+
},
|
|
353
|
+
[enum_1.WorkpieceMassFormulaKey.hexSection]: vars => {
|
|
354
|
+
const density = getRequiredVar(vars, 'density');
|
|
355
|
+
const acrossFlats = getRequiredVar(vars, 'acrossFlats');
|
|
356
|
+
const length = getRequiredVar(vars, 'length');
|
|
357
|
+
return density * 0.866025 * Math.pow(acrossFlats, 2) * length;
|
|
358
|
+
},
|
|
359
|
+
[enum_1.WorkpieceMassFormulaKey.sectionArea]: vars => {
|
|
360
|
+
const density = getRequiredVar(vars, 'density');
|
|
361
|
+
const areaCrossSectional = getRequiredVar(vars, 'areaCrossSectional');
|
|
362
|
+
const length = getRequiredVar(vars, 'length');
|
|
363
|
+
return density * areaCrossSectional * length;
|
|
364
|
+
},
|
|
365
|
+
[enum_1.WorkpieceMassFormulaKey.linearMass]: vars => {
|
|
366
|
+
const massPerMeter = getRequiredVar(vars, 'massPerMeter');
|
|
367
|
+
const length = getRequiredVar(vars, 'length');
|
|
368
|
+
return massPerMeter * length;
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
const resolveWorkpieceMassVariables = (context, variableKeys) => {
|
|
372
|
+
var _a;
|
|
373
|
+
const prepared = getPreparedWorkpieceValues(context);
|
|
374
|
+
const result = {};
|
|
375
|
+
for (const key of variableKeys) {
|
|
376
|
+
result[key] =
|
|
377
|
+
(_a = exports.WORKPIECE_MASS_VARIABLE_RESOLVERS[key](context, prepared)) !== null && _a !== void 0 ? _a : undefined;
|
|
378
|
+
}
|
|
379
|
+
return result;
|
|
380
|
+
};
|
|
381
|
+
exports.resolveWorkpieceMassVariables = resolveWorkpieceMassVariables;
|
|
382
|
+
const calculateWorkpieceMassPreview = (context) => {
|
|
383
|
+
var _a;
|
|
384
|
+
const formulaKey = context.workpieceMassFormulaKey ||
|
|
385
|
+
((_a = context.typeMaterial) === null || _a === void 0 ? void 0 : _a.workpieceMassFormulaKey) ||
|
|
386
|
+
null;
|
|
387
|
+
if (!formulaKey)
|
|
388
|
+
return null;
|
|
389
|
+
const formula = exports.WORKPIECE_MASS_FORMULAS.find(currentFormula => currentFormula.key === formulaKey);
|
|
390
|
+
if (!formula) {
|
|
391
|
+
throw new Error(`Формула расчета массы заготовки "${formulaKey}" не найдена`);
|
|
392
|
+
}
|
|
393
|
+
const variables = (0, exports.resolveWorkpieceMassVariables)(context, formula.variables.map(variable => variable.key));
|
|
394
|
+
return {
|
|
395
|
+
formulaKey,
|
|
396
|
+
mass: exports.WORKPIECE_MASS_CALCULATORS[formulaKey](variables),
|
|
397
|
+
variables
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
exports.calculateWorkpieceMassPreview = calculateWorkpieceMassPreview;
|
|
@@ -36,9 +36,9 @@ export declare const MetaloworkingComingSchema: z.ZodObject<{
|
|
|
36
36
|
wokrek_id: number;
|
|
37
37
|
designation?: string | undefined;
|
|
38
38
|
description?: string | undefined;
|
|
39
|
+
name?: string | undefined;
|
|
39
40
|
id?: number | null | undefined;
|
|
40
41
|
number_order?: string | undefined;
|
|
41
|
-
name?: string | undefined;
|
|
42
42
|
ava_path?: string | undefined;
|
|
43
43
|
detal_id?: number | null | undefined;
|
|
44
44
|
shipment_id?: number | null | undefined;
|
|
@@ -56,9 +56,9 @@ export declare const MetaloworkingComingSchema: z.ZodObject<{
|
|
|
56
56
|
ban?: boolean | undefined;
|
|
57
57
|
designation?: string | undefined;
|
|
58
58
|
description?: string | undefined;
|
|
59
|
+
name?: string | undefined;
|
|
59
60
|
id?: number | null | undefined;
|
|
60
61
|
number_order?: string | undefined;
|
|
61
|
-
name?: string | undefined;
|
|
62
62
|
ava_path?: string | undefined;
|
|
63
63
|
detal_id?: number | null | undefined;
|
|
64
64
|
shipment_id?: number | null | undefined;
|
|
@@ -131,8 +131,8 @@ export declare const MovingSchema: z.ZodObject<{
|
|
|
131
131
|
cbed: import("../..").CbedRelativeType[];
|
|
132
132
|
designation: string | null;
|
|
133
133
|
description: string | null;
|
|
134
|
-
id: number;
|
|
135
134
|
name: string;
|
|
135
|
+
id: number;
|
|
136
136
|
calculate_needs_time: Date | null;
|
|
137
137
|
entity_children_need_time: Date | null;
|
|
138
138
|
min_remaining: number;
|
|
@@ -162,8 +162,8 @@ export declare const MovingSchema: z.ZodObject<{
|
|
|
162
162
|
}, {
|
|
163
163
|
designation: string | null;
|
|
164
164
|
description: string | null;
|
|
165
|
-
id: number;
|
|
166
165
|
name: string;
|
|
166
|
+
id: number;
|
|
167
167
|
ava_path: string | null;
|
|
168
168
|
parametrs: import("../..").CbedParametrsField | null;
|
|
169
169
|
characteristic: import("../..").CbedCharacteristicField | null;
|
|
@@ -606,8 +606,8 @@ export declare const MovingSchema: z.ZodObject<{
|
|
|
606
606
|
cbed: import("../..").CbedRelativeType[];
|
|
607
607
|
designation: string | null;
|
|
608
608
|
description: string | null;
|
|
609
|
-
id: number;
|
|
610
609
|
name: string;
|
|
610
|
+
id: number;
|
|
611
611
|
calculate_needs_time: Date | null;
|
|
612
612
|
entity_children_need_time: Date | null;
|
|
613
613
|
min_remaining: number;
|
|
@@ -800,8 +800,8 @@ export declare const MovingSchema: z.ZodObject<{
|
|
|
800
800
|
cbeds: {
|
|
801
801
|
designation: string | null;
|
|
802
802
|
description: string | null;
|
|
803
|
-
id: number;
|
|
804
803
|
name: string;
|
|
804
|
+
id: number;
|
|
805
805
|
ava_path: string | null;
|
|
806
806
|
parametrs: import("../..").CbedParametrsField | null;
|
|
807
807
|
characteristic: import("../..").CbedCharacteristicField | null;
|
|
@@ -1095,8 +1095,8 @@ export declare const MovingSchema: z.ZodObject<{
|
|
|
1095
1095
|
cbed: import("../..").CbedRelativeType[];
|
|
1096
1096
|
designation: string | null;
|
|
1097
1097
|
description: string | null;
|
|
1098
|
-
id: number;
|
|
1099
1098
|
name: string;
|
|
1099
|
+
id: number;
|
|
1100
1100
|
calculate_needs_time: Date | null;
|
|
1101
1101
|
entity_children_need_time: Date | null;
|
|
1102
1102
|
min_remaining: number;
|
|
@@ -1317,8 +1317,8 @@ export declare const MovingSchema: z.ZodObject<{
|
|
|
1317
1317
|
cbeds: {
|
|
1318
1318
|
designation: string | null;
|
|
1319
1319
|
description: string | null;
|
|
1320
|
-
id: number;
|
|
1321
1320
|
name: string;
|
|
1321
|
+
id: number;
|
|
1322
1322
|
ava_path: string | null;
|
|
1323
1323
|
parametrs: import("../..").CbedParametrsField | null;
|
|
1324
1324
|
characteristic: import("../..").CbedCharacteristicField | null;
|
|
@@ -2,15 +2,15 @@ import z from 'zod';
|
|
|
2
2
|
import { ModelIncludeForTypeOperation } from '../enums/enums';
|
|
3
3
|
export declare const GetTypeOperationByIdDtoZod: z.ZodObject<{
|
|
4
4
|
id: z.ZodNumber;
|
|
5
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodEnum<["
|
|
5
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodEnum<["name", "id", "preTime", "helperTime", "mainTime", "cpu", "square", "list", "workStartCalcType", "countWorking"]>, "many">>;
|
|
6
6
|
modelInclude: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof ModelIncludeForTypeOperation>, "many">>;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
8
|
id: number;
|
|
9
|
-
attributes?: ("
|
|
9
|
+
attributes?: ("name" | "id" | "preTime" | "helperTime" | "mainTime" | "cpu" | "square" | "list" | "workStartCalcType" | "countWorking")[] | undefined;
|
|
10
10
|
modelInclude?: ModelIncludeForTypeOperation[] | undefined;
|
|
11
11
|
}, {
|
|
12
12
|
id: number;
|
|
13
|
-
attributes?: ("
|
|
13
|
+
attributes?: ("name" | "id" | "preTime" | "helperTime" | "mainTime" | "cpu" | "square" | "list" | "workStartCalcType" | "countWorking")[] | undefined;
|
|
14
14
|
modelInclude?: ModelIncludeForTypeOperation[] | undefined;
|
|
15
15
|
}>;
|
|
16
16
|
export type GetTypeOperationByIdDtoType = z.TypeOf<typeof GetTypeOperationByIdDtoZod>;
|
|
@@ -19,8 +19,8 @@ export declare const UpdateTypeOperationSchema: z.ZodObject<{
|
|
|
19
19
|
workStartCalcType: z.ZodDefault<z.ZodNativeEnum<typeof WorkStartCalcType>>;
|
|
20
20
|
}, "strip", z.ZodTypeAny, {
|
|
21
21
|
metaloworking: boolean;
|
|
22
|
-
id: number;
|
|
23
22
|
name: string;
|
|
23
|
+
id: number;
|
|
24
24
|
preTime: boolean;
|
|
25
25
|
helperTime: boolean;
|
|
26
26
|
mainTime: boolean;
|
|
@@ -36,8 +36,8 @@ export declare const UpdateTypeOperationSchema: z.ZodObject<{
|
|
|
36
36
|
users?: any;
|
|
37
37
|
}, {
|
|
38
38
|
metaloworking: boolean;
|
|
39
|
-
id: number;
|
|
40
39
|
name: string;
|
|
40
|
+
id: number;
|
|
41
41
|
preTime: boolean;
|
|
42
42
|
helperTime: boolean;
|
|
43
43
|
mainTime: boolean;
|