@pksep/zod-shared 0.0.549 → 0.0.551
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 +38 -24
- package/dist/assemble/interfaces/interfaces.d.ts +1 -0
- package/dist/assemble/schemas/assemble-coming.schema.d.ts +28 -18
- package/dist/assemble/schemas/assemble.schema.d.ts +28 -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/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.d.ts +56 -0
- package/dist/material/utils/workpiece-mass.js +536 -0
- package/dist/material/workpiece-mass.d.ts +45 -0
- package/dist/material/workpiece-mass.js +400 -0
- package/dist/metaloworking/dto/get-metallworking-pagination.dto.d.ts +3 -0
- package/dist/metaloworking/dto/get-metallworking-pagination.dto.js +1 -0
- package/dist/metaloworking/schemas/metaloworking-coming.schema.d.ts +2 -2
- package/dist/movement-object/schemas/get-one-object-history.schema.d.ts +40 -6
- package/dist/movement-object/schemas/get-one-object-history.schema.js +7 -1
- 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/interfaces/online-board.d.ts +1 -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/format-list-shipment.dto.d.ts +3 -0
- package/dist/shipments/dto/format-list-shipment.dto.js +1 -0
- package/dist/shipments/dto/get-shipment-items-by-entity.dto.d.ts +22 -0
- package/dist/shipments/dto/get-shipment-items-by-entity.dto.js +12 -0
- package/dist/shipments/dto/shipments-list-pagination-response.dto.d.ts +18 -18
- package/dist/shipments/dto/up-create-shipments.dto.d.ts +342 -4
- package/dist/shipments/dto/up-create-shipments.dto.js +97 -3
- package/dist/shipments/dto/update-ready-to-ship-status.dto.d.ts +9 -0
- package/dist/shipments/dto/update-ready-to-ship-status.dto.js +7 -0
- package/dist/shipments/index.d.ts +2 -0
- package/dist/shipments/index.js +2 -0
- 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/specification/type/type.d.ts +47 -1
- 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/default-value/default-value.js +2 -1
- package/dist/utils/enums.d.ts +4 -2
- package/dist/utils/enums.js +2 -0
- package/dist/utils/schemas/schema.d.ts +2 -2
- package/dist/utils/types.d.ts +6 -0
- package/dist/waybill/dto/create-waybill-product.dto.d.ts +3 -3
- package/dist/waybill/dto/create-waybill-product.dto.js +1 -1
- package/dist/waybill/dto/create-waybill.dto.d.ts +5 -5
- package/dist/waybill/schemas/waybill.schema.d.ts +6 -0
- package/dist/waybill/schemas/waybill.schema.js +3 -1
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -3,6 +3,7 @@ import { IFiltersByByOrder, IFiltersByParents } from '../../production-tasks';
|
|
|
3
3
|
export declare const GetMetaloworkingPaginationDtoZod: z.ZodObject<{
|
|
4
4
|
page: z.ZodNumber;
|
|
5
5
|
responsibleUserId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
6
|
+
metalloworkingID: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
6
7
|
searchString: z.ZodString;
|
|
7
8
|
isBan: z.ZodBoolean;
|
|
8
9
|
byParents: z.ZodOptional<z.ZodNullable<z.ZodType<IFiltersByParents, z.ZodTypeDef, IFiltersByParents>>>;
|
|
@@ -32,6 +33,7 @@ export declare const GetMetaloworkingPaginationDtoZod: z.ZodObject<{
|
|
|
32
33
|
byParents?: IFiltersByParents | null | undefined;
|
|
33
34
|
byOrder?: IFiltersByByOrder | null | undefined;
|
|
34
35
|
childrenByProductionTaskIds?: number[] | null | undefined;
|
|
36
|
+
metalloworkingID?: number | null | undefined;
|
|
35
37
|
}, {
|
|
36
38
|
page: number;
|
|
37
39
|
searchString: string;
|
|
@@ -45,5 +47,6 @@ export declare const GetMetaloworkingPaginationDtoZod: z.ZodObject<{
|
|
|
45
47
|
byParents?: IFiltersByParents | null | undefined;
|
|
46
48
|
byOrder?: IFiltersByByOrder | null | undefined;
|
|
47
49
|
childrenByProductionTaskIds?: number[] | null | undefined;
|
|
50
|
+
metalloworkingID?: number | null | undefined;
|
|
48
51
|
}>;
|
|
49
52
|
export type GetMetaloworkingPaginationDtoZodType = z.infer<typeof GetMetaloworkingPaginationDtoZod>;
|
|
@@ -6,6 +6,7 @@ const utils_1 = require("../../utils");
|
|
|
6
6
|
exports.GetMetaloworkingPaginationDtoZod = zod_1.z.object({
|
|
7
7
|
page: zod_1.z.number(),
|
|
8
8
|
responsibleUserId: zod_1.z.number().nullable().optional(),
|
|
9
|
+
metalloworkingID: zod_1.z.number().nullable().optional(),
|
|
9
10
|
searchString: zod_1.z.string(),
|
|
10
11
|
isBan: zod_1.z.boolean(),
|
|
11
12
|
byParents: zod_1.z.custom().nullable().optional(),
|
|
@@ -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;
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { IFiltersByParents } from '../../production-tasks';
|
|
3
2
|
export declare const GetOneObjectHistorySchema: z.ZodEffects<z.ZodObject<{
|
|
4
3
|
isCheckChildrens: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>>;
|
|
5
|
-
byParents: z.ZodOptional<z.ZodNullable<z.
|
|
4
|
+
byParents: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
5
|
+
productIds: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>>;
|
|
6
|
+
cbedIds: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>>;
|
|
7
|
+
detalIds: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>>;
|
|
8
|
+
materialIds: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
detalIds: number[];
|
|
11
|
+
cbedIds: number[];
|
|
12
|
+
productIds: number[];
|
|
13
|
+
materialIds: number[];
|
|
14
|
+
}, {
|
|
15
|
+
detalIds?: number[] | undefined;
|
|
16
|
+
cbedIds?: number[] | undefined;
|
|
17
|
+
productIds?: number[] | undefined;
|
|
18
|
+
materialIds?: number[] | undefined;
|
|
19
|
+
}>>>;
|
|
6
20
|
date: z.ZodObject<{
|
|
7
21
|
start: z.ZodDate;
|
|
8
22
|
end: z.ZodDate;
|
|
@@ -21,14 +35,24 @@ export declare const GetOneObjectHistorySchema: z.ZodEffects<z.ZodObject<{
|
|
|
21
35
|
};
|
|
22
36
|
isCheckChildrens: boolean | null;
|
|
23
37
|
page?: number | undefined;
|
|
24
|
-
byParents?:
|
|
38
|
+
byParents?: {
|
|
39
|
+
detalIds: number[];
|
|
40
|
+
cbedIds: number[];
|
|
41
|
+
productIds: number[];
|
|
42
|
+
materialIds: number[];
|
|
43
|
+
} | null | undefined;
|
|
25
44
|
}, {
|
|
26
45
|
date: {
|
|
27
46
|
start: Date;
|
|
28
47
|
end: Date;
|
|
29
48
|
};
|
|
30
49
|
page?: number | undefined;
|
|
31
|
-
byParents?:
|
|
50
|
+
byParents?: {
|
|
51
|
+
detalIds?: number[] | undefined;
|
|
52
|
+
cbedIds?: number[] | undefined;
|
|
53
|
+
productIds?: number[] | undefined;
|
|
54
|
+
materialIds?: number[] | undefined;
|
|
55
|
+
} | null | undefined;
|
|
32
56
|
isCheckChildrens?: boolean | null | undefined;
|
|
33
57
|
}>, {
|
|
34
58
|
date: {
|
|
@@ -37,14 +61,24 @@ export declare const GetOneObjectHistorySchema: z.ZodEffects<z.ZodObject<{
|
|
|
37
61
|
};
|
|
38
62
|
isCheckChildrens: boolean | null;
|
|
39
63
|
page?: number | undefined;
|
|
40
|
-
byParents?:
|
|
64
|
+
byParents?: {
|
|
65
|
+
detalIds: number[];
|
|
66
|
+
cbedIds: number[];
|
|
67
|
+
productIds: number[];
|
|
68
|
+
materialIds: number[];
|
|
69
|
+
} | null | undefined;
|
|
41
70
|
}, {
|
|
42
71
|
date: {
|
|
43
72
|
start: Date;
|
|
44
73
|
end: Date;
|
|
45
74
|
};
|
|
46
75
|
page?: number | undefined;
|
|
47
|
-
byParents?:
|
|
76
|
+
byParents?: {
|
|
77
|
+
detalIds?: number[] | undefined;
|
|
78
|
+
cbedIds?: number[] | undefined;
|
|
79
|
+
productIds?: number[] | undefined;
|
|
80
|
+
materialIds?: number[] | undefined;
|
|
81
|
+
} | null | undefined;
|
|
48
82
|
isCheckChildrens?: boolean | null | undefined;
|
|
49
83
|
}>;
|
|
50
84
|
export type GetOneObjectHistorySchemaType = z.infer<typeof GetOneObjectHistorySchema>;
|
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetOneObjectHistorySchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const MovementObjectParentsSchema = zod_1.z.object({
|
|
6
|
+
productIds: zod_1.z.array(zod_1.z.number()).optional().default([]),
|
|
7
|
+
cbedIds: zod_1.z.array(zod_1.z.number()).optional().default([]),
|
|
8
|
+
detalIds: zod_1.z.array(zod_1.z.number()).optional().default([]),
|
|
9
|
+
materialIds: zod_1.z.array(zod_1.z.number()).optional().default([])
|
|
10
|
+
});
|
|
5
11
|
exports.GetOneObjectHistorySchema = zod_1.z
|
|
6
12
|
.object({
|
|
7
13
|
isCheckChildrens: zod_1.z.boolean().nullish().default(false),
|
|
8
|
-
byParents:
|
|
14
|
+
byParents: MovementObjectParentsSchema.nullable().optional(),
|
|
9
15
|
date: zod_1.z.object({
|
|
10
16
|
start: zod_1.z.date(),
|
|
11
17
|
end: zod_1.z.date()
|
|
@@ -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;
|