@pksep/zod-shared 0.0.500 → 0.0.501
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/assemble/dto/get-assemble-operation-count.dto.d.ts +41 -41
- package/dist/assemble/dto/get-assemble-pagination-sclad.dto.d.ts +2 -2
- package/dist/assemble/schemas/assemble-coming.schema.d.ts +29 -29
- package/dist/assemble/schemas/assemble.schema.d.ts +29 -29
- package/dist/assemble-kit/schemas/assemble-kit.schema.d.ts +10 -10
- package/dist/cbed/dto/recursive-childrens.dto.d.ts +3 -0
- package/dist/cbed/dto/recursive-childrens.dto.js +1 -0
- package/dist/company/dto/create-company.dto.d.ts +2 -2
- package/dist/company/dto/update-company.dto.d.ts +2 -2
- package/dist/deliveries/schemas/deliveries.schema.d.ts +4 -4
- package/dist/detal/dto/get-deficit.dto.d.ts +2 -2
- package/dist/detal/dto/get-detal-deficit-dto.d.ts +2 -2
- package/dist/detal/dto/set-actual-shipment.dto.d.ts +1 -1
- package/dist/detal/schemas/detal-deficit.schema.d.ts +36 -28
- package/dist/detal/schemas/detal.schema.d.ts +26 -18
- package/dist/detal/schemas/detal.schema.js +1 -0
- package/dist/equipment/schemas/equipment.schema.d.ts +8 -8
- package/dist/material/dto/get-deficit.dto.d.ts +31 -0
- package/dist/material/dto/get-deficit.dto.js +18 -0
- package/dist/material/dto/set-actual-shipment.dto.d.ts +18 -0
- package/dist/material/dto/set-actual-shipment.dto.js +10 -0
- package/dist/material/index.d.ts +2 -0
- package/dist/material/index.js +2 -0
- package/dist/material/schemas/material.schema.d.ts +5 -0
- package/dist/material/schemas/material.schema.js +1 -0
- package/dist/metaloworking/dto/get-metallworking-pagination.dto.d.ts +2 -2
- package/dist/product/dto/recursive-childrens.dto.d.ts +3 -0
- package/dist/product/dto/recursive-childrens.dto.js +1 -0
- package/dist/product/schemas/product-deficit.schema.d.ts +10 -10
- package/dist/rack/dto/update-cell.dto.d.ts +5 -5
- package/dist/settings/schemas/sebestoim.schema.d.ts +2 -2
- package/dist/shipments/schemas/sh-complit.schema.d.ts +2 -2
- package/dist/shipments/schemas/shipments.schema.d.ts +5 -5
- package/dist/specification/dto/specification-attributes.dto.d.ts +2 -2
- package/dist/specification/schema/attributes.schema.d.ts +44 -27
- package/dist/tech-process/schemas/tech-process.schema.d.ts +2 -2
- package/dist/utils/methods.d.ts +1 -0
- package/dist/utils/methods.js +60 -18
- package/dist/utils/types/types.d.ts +5 -0
- package/dist/waybill/dto/create-waybill-product.dto.d.ts +2 -2
- package/dist/waybill/dto/create-waybill.dto.d.ts +4 -4
- package/package.json +1 -1
|
@@ -193,8 +193,8 @@ export declare const TechProcessSchema: z.ZodObject<{
|
|
|
193
193
|
id?: number | null | undefined;
|
|
194
194
|
name?: number | undefined;
|
|
195
195
|
detalId?: number | null | undefined;
|
|
196
|
-
cbedId?: number | null | undefined;
|
|
197
196
|
productId?: number | null | undefined;
|
|
197
|
+
cbedId?: number | null | undefined;
|
|
198
198
|
operations?: {
|
|
199
199
|
ban: boolean;
|
|
200
200
|
description: string;
|
|
@@ -245,8 +245,8 @@ export declare const TechProcessSchema: z.ZodObject<{
|
|
|
245
245
|
id?: number | null | undefined;
|
|
246
246
|
name?: number | undefined;
|
|
247
247
|
detalId?: number | null | undefined;
|
|
248
|
-
cbedId?: number | null | undefined;
|
|
249
248
|
productId?: number | null | undefined;
|
|
249
|
+
cbedId?: number | null | undefined;
|
|
250
250
|
operations?: {
|
|
251
251
|
name: number;
|
|
252
252
|
full_name: string;
|
package/dist/utils/methods.d.ts
CHANGED
|
@@ -193,6 +193,7 @@ export declare const countUniqueValueChildren: (entities: any[], countField: str
|
|
|
193
193
|
id: number;
|
|
194
194
|
[key: string]: number;
|
|
195
195
|
}[];
|
|
196
|
+
export declare const concatedLists: (firstArray: any[], seconsArray: any[]) => any[];
|
|
196
197
|
/**
|
|
197
198
|
* Функция формирует графовый объект с потомками сущности
|
|
198
199
|
* @param data
|
package/dist/utils/methods.js
CHANGED
|
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.intersect = exports.shipmentsNullOne = exports.differencesShipments = exports.dateDifference = exports.toFormatString = exports.comparison = exports.comparisonTimestamp = exports.parseDate = exports.dataFormat = exports.dateToTimestampFormat = exports.convertStringValuesToNumbers = exports.dateToFormat = exports.photoPreloadUrl = exports.isImage = exports.getReversDate = exports.isValidNumber = exports.returnTypePosition = exports.checkMissingEntity = exports.countChildrensRelative = exports.countUniqueValueChildren = exports.removeArrDublicateByAttr = exports.getOnCommonListChildrens = exports.sleep = exports.parseBoolean = exports.strIsBoolean = exports.useWorkpieceCharacterizationItems = exports.getFileType = exports.calculateEndDate = exports.leftToDoByProductionTask = exports.calculateByMeasurementRate = void 0;
|
|
23
|
+
exports.intersect = exports.shipmentsNullOne = exports.differencesShipments = exports.dateDifference = exports.toFormatString = exports.comparison = exports.comparisonTimestamp = exports.parseDate = exports.dataFormat = exports.dateToTimestampFormat = exports.convertStringValuesToNumbers = exports.dateToFormat = exports.photoPreloadUrl = exports.isImage = exports.getReversDate = exports.isValidNumber = exports.returnTypePosition = exports.checkMissingEntity = exports.countChildrensRelative = exports.concatedLists = exports.countUniqueValueChildren = exports.removeArrDublicateByAttr = exports.getOnCommonListChildrens = exports.sleep = exports.parseBoolean = exports.strIsBoolean = exports.useWorkpieceCharacterizationItems = exports.getFileType = exports.calculateEndDate = exports.leftToDoByProductionTask = exports.calculateByMeasurementRate = void 0;
|
|
24
24
|
exports.moreMinusNum = moreMinusNum;
|
|
25
25
|
exports.getFieldsSpetification = getFieldsSpetification;
|
|
26
26
|
exports.isThisExclusionDesignation = isThisExclusionDesignation;
|
|
@@ -44,6 +44,7 @@ exports.openInNewTab = openInNewTab;
|
|
|
44
44
|
const edizm_1 = require("./edizm");
|
|
45
45
|
const enums_1 = require("./enums");
|
|
46
46
|
const types_1 = require("./types");
|
|
47
|
+
const sequelize_1 = require("./methods/sequelize");
|
|
47
48
|
/**
|
|
48
49
|
* Возвращает ноль или число больше нуля
|
|
49
50
|
* @param num
|
|
@@ -689,6 +690,8 @@ const countUniqueValueChildren = (entities, countField) => {
|
|
|
689
690
|
return uniqueItems;
|
|
690
691
|
};
|
|
691
692
|
exports.countUniqueValueChildren = countUniqueValueChildren;
|
|
693
|
+
const concatedLists = (firstArray, seconsArray) => (firstArray || []).concat(seconsArray || []).filter(Boolean);
|
|
694
|
+
exports.concatedLists = concatedLists;
|
|
692
695
|
/**
|
|
693
696
|
* Функция формирует графовый объект с потомками сущности
|
|
694
697
|
* @param data
|
|
@@ -701,17 +704,19 @@ const countChildrensRelative = (data) => {
|
|
|
701
704
|
const countChildrens = (relative, relativeType) => {
|
|
702
705
|
var _a, _b, _c, _d;
|
|
703
706
|
const relativeNeeds = (relative === null || relative === void 0 ? void 0 : relative.needs) || 1;
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
707
|
+
relative.cbedGraph = [];
|
|
708
|
+
relative.detalsGraph = [];
|
|
709
|
+
if (data.isNeedsTypes && !(relative === null || relative === void 0 ? void 0 : relative.entity_type))
|
|
710
|
+
relative.entity_type = relativeEntityType;
|
|
708
711
|
if (isAppendedMaterials)
|
|
709
712
|
relative.materialGraph = [];
|
|
710
713
|
if (relative === null || relative === void 0 ? void 0 : relative.listCbed) {
|
|
711
714
|
relative.cbeds =
|
|
712
715
|
((_a = relative === null || relative === void 0 ? void 0 : relative.listCbed) === null || _a === void 0 ? void 0 : _a.map((listCbedItem) => {
|
|
713
716
|
const foundedCbed = cbeds.find(cbed => listCbedItem.id === cbed.id);
|
|
714
|
-
return Object.assign(Object.assign({}, foundedCbed),
|
|
717
|
+
return Object.assign(Object.assign(Object.assign({}, foundedCbed), (0, sequelize_1.addFieldByCondition)(data.isNeedsTypes, {
|
|
718
|
+
entity_type: enums_1.IzdType.cbed
|
|
719
|
+
})), { count_to_obj: listCbedItem.quantity, count_to_needs: relativeNeeds * listCbedItem.quantity, needs: relativeNeeds * listCbedItem.quantity, parent_id: relative.id, parent_type: relativeType, parent_designation: (relative === null || relative === void 0 ? void 0 : relative.designation) || '-', parent_name: (relative === null || relative === void 0 ? void 0 : relative.name) || '-' });
|
|
715
720
|
})) || [];
|
|
716
721
|
relative.cbedGraph = [...relative.cbeds];
|
|
717
722
|
}
|
|
@@ -719,26 +724,59 @@ const countChildrensRelative = (data) => {
|
|
|
719
724
|
relative.detals =
|
|
720
725
|
((_b = relative === null || relative === void 0 ? void 0 : relative.listDetal) === null || _b === void 0 ? void 0 : _b.map((listDetalItem) => {
|
|
721
726
|
const foundedDetal = detals.find(detal => listDetalItem.id === detal.id);
|
|
722
|
-
return Object.assign(Object.assign({}, foundedDetal),
|
|
727
|
+
return Object.assign(Object.assign(Object.assign({}, foundedDetal), (0, sequelize_1.addFieldByCondition)(data.isNeedsTypes, {
|
|
728
|
+
entity_type: enums_1.IzdType.detal
|
|
729
|
+
})), { count_to_obj: listDetalItem.quantity, count_to_needs: relativeNeeds * listDetalItem.quantity, needs: relativeNeeds * listDetalItem.quantity, parent_id: relative.id, parent_type: relativeType, parent_designation: (relative === null || relative === void 0 ? void 0 : relative.designation) || '-', parent_name: (relative === null || relative === void 0 ? void 0 : relative.name) || '-' });
|
|
723
730
|
})) || [];
|
|
724
731
|
relative.detalsGraph = [...relative.detals];
|
|
725
732
|
}
|
|
726
733
|
if (isAppendedMaterials) {
|
|
727
|
-
/**
|
|
728
|
-
* @todo если в одной детали материал будет и заготовкой, и в спецификации, то
|
|
729
|
-
* в materialGraph этот материал продублируется с одинаковым родителем,
|
|
730
|
-
* хотя должен был увеличиться needs.
|
|
731
|
-
* На unicalMaterialNeeds это не влияет. Там подсчеты верны
|
|
732
|
-
*/
|
|
733
734
|
const concatedMaterialLists = ((relative === null || relative === void 0 ? void 0 : relative.materialList) || [])
|
|
734
|
-
.concat((relative === null || relative === void 0 ? void 0 : relative.listPokDet) || []
|
|
735
|
-
? { id: relative === null || relative === void 0 ? void 0 : relative.mat_zag_zam, quantity: 1 }
|
|
736
|
-
: null)
|
|
735
|
+
.concat((relative === null || relative === void 0 ? void 0 : relative.listPokDet) || [])
|
|
737
736
|
.filter(Boolean);
|
|
738
|
-
relative
|
|
737
|
+
if (relative === null || relative === void 0 ? void 0 : relative.mat_zag) {
|
|
738
|
+
const material = materials.find(currentMaterial => currentMaterial.id === (relative === null || relative === void 0 ? void 0 : relative.mat_zag));
|
|
739
|
+
if (material) {
|
|
740
|
+
const detalMass = relative.workpiece_characterization.mass;
|
|
741
|
+
const materialConverRate = (0, exports.calculateByMeasurementRate)(material.units_measurement, 3);
|
|
742
|
+
const characteristicValue = materialConverRate
|
|
743
|
+
? Math.ceil(detalMass / materialConverRate)
|
|
744
|
+
: 0;
|
|
745
|
+
const characteristicQuantity = characteristicValue
|
|
746
|
+
? characteristicValue
|
|
747
|
+
: 0;
|
|
748
|
+
if (characteristicQuantity)
|
|
749
|
+
concatedMaterialLists.push({
|
|
750
|
+
id: relative === null || relative === void 0 ? void 0 : relative.mat_zag,
|
|
751
|
+
quantity: characteristicQuantity
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
const materialMap = new Map();
|
|
756
|
+
const materialsArray = concatedMaterialLists.map((listMaterialItem) => {
|
|
739
757
|
const foundedMaterials = materials.find(material => listMaterialItem.id === material.id);
|
|
740
|
-
|
|
758
|
+
//конвертируем потребность в ШТ
|
|
759
|
+
const materialConverRate = foundedMaterials
|
|
760
|
+
? (0, exports.calculateByMeasurementRate)(foundedMaterials.units_measurement, listMaterialItem.measureId)
|
|
761
|
+
: 0;
|
|
762
|
+
const specificationConvertedQuantity = materialConverRate
|
|
763
|
+
? Math.ceil(listMaterialItem.quantity / materialConverRate)
|
|
764
|
+
: 0;
|
|
765
|
+
return Object.assign(Object.assign(Object.assign({}, foundedMaterials), (0, sequelize_1.addFieldByCondition)(data.isNeedsTypes, {
|
|
766
|
+
entity_type: enums_1.IzdType.material
|
|
767
|
+
})), { measure_id: listMaterialItem.measureId, count_to_obj_not_converted: listMaterialItem.quantity, count_to_needs_not_converted: relativeNeeds * listMaterialItem.quantity, count_to_obj: specificationConvertedQuantity, count_to_needs: relativeNeeds * specificationConvertedQuantity, needs: relativeNeeds * specificationConvertedQuantity, parent_id: relative.id, parent_type: relativeType, parent_designation: (relative === null || relative === void 0 ? void 0 : relative.designation) || '-', parent_name: (relative === null || relative === void 0 ? void 0 : relative.name) || '-' });
|
|
768
|
+
});
|
|
769
|
+
materialsArray.forEach((currentMaterial) => {
|
|
770
|
+
const materialKey = `${currentMaterial.parent_id}_${currentMaterial.parent_type}_${currentMaterial.id}`;
|
|
771
|
+
if (materialMap.has(materialKey)) {
|
|
772
|
+
const material = materialMap.get(materialKey);
|
|
773
|
+
materialMap.set(materialKey, Object.assign(Object.assign({}, material), { needs: material.needs + currentMaterial.needs, count_to_obj: material.count_to_obj + currentMaterial.count_to_obj, count_to_needs: material.count_to_needs + currentMaterial.count_to_needs }));
|
|
774
|
+
}
|
|
775
|
+
else {
|
|
776
|
+
materialMap.set(materialKey, currentMaterial);
|
|
777
|
+
}
|
|
741
778
|
});
|
|
779
|
+
relative.materials = Array.from(materialMap.values());
|
|
742
780
|
relative.materialGraph = [...relative.materials];
|
|
743
781
|
}
|
|
744
782
|
if ((_c = relative === null || relative === void 0 ? void 0 : relative.listCbed) === null || _c === void 0 ? void 0 : _c.length) {
|
|
@@ -788,6 +826,10 @@ const countChildrensRelative = (data) => {
|
|
|
788
826
|
})
|
|
789
827
|
.filter(entity => entity.id);
|
|
790
828
|
}
|
|
829
|
+
else {
|
|
830
|
+
relative.unicalDetalNeeds = [];
|
|
831
|
+
relative.unicalCbedNeeds = [];
|
|
832
|
+
}
|
|
791
833
|
if (isAppendedMaterials) {
|
|
792
834
|
const unicalMaterialNeedsObject = {};
|
|
793
835
|
for (const material of relative.materialGraph) {
|
|
@@ -65,6 +65,7 @@ export type ParentTypeFilter = {
|
|
|
65
65
|
};
|
|
66
66
|
export type countChildrensRelativeType = {
|
|
67
67
|
relativeEntity: any;
|
|
68
|
+
isNeedsTypes?: boolean;
|
|
68
69
|
relativeEntityType: IzdType;
|
|
69
70
|
isAppendedMaterials: boolean;
|
|
70
71
|
detals: ModelDetal[];
|
|
@@ -73,6 +74,7 @@ export type countChildrensRelativeType = {
|
|
|
73
74
|
};
|
|
74
75
|
export type RecursiveGraphParentType = {
|
|
75
76
|
id: number;
|
|
77
|
+
entity_type?: IzdType;
|
|
76
78
|
listCbed: EntityCommonSpecificationArray;
|
|
77
79
|
listDetal: EntityCommonSpecificationArray;
|
|
78
80
|
materialList: EntityCommonSpecificationArray;
|
|
@@ -103,6 +105,9 @@ export type RecursiveGraphType = {
|
|
|
103
105
|
count_to_needs?: number;
|
|
104
106
|
needs?: number;
|
|
105
107
|
parent_id?: number;
|
|
108
|
+
measure_id?: number;
|
|
109
|
+
count_to_obj_not_converted?: number;
|
|
110
|
+
count_to_needs_not_converted?: number;
|
|
106
111
|
parent_type?: IzdType;
|
|
107
112
|
parent_designation?: string;
|
|
108
113
|
parent_name?: string;
|
|
@@ -31,9 +31,9 @@ export declare const CreateWaybillProductSchema: z.ZodObject<{
|
|
|
31
31
|
detalId?: number | null | undefined;
|
|
32
32
|
equipmentId?: number | null | undefined;
|
|
33
33
|
materialId?: number | null | undefined;
|
|
34
|
+
productId?: number | null | undefined;
|
|
34
35
|
sum?: number | undefined;
|
|
35
36
|
cbedId?: number | null | undefined;
|
|
36
|
-
productId?: number | null | undefined;
|
|
37
37
|
assembleId?: number | null | undefined;
|
|
38
38
|
toolsId?: number | null | undefined;
|
|
39
39
|
instrumentId?: number | null | undefined;
|
|
@@ -51,9 +51,9 @@ export declare const CreateWaybillProductSchema: z.ZodObject<{
|
|
|
51
51
|
detalId?: number | null | undefined;
|
|
52
52
|
equipmentId?: number | null | undefined;
|
|
53
53
|
materialId?: number | null | undefined;
|
|
54
|
+
productId?: number | null | undefined;
|
|
54
55
|
sum?: number | undefined;
|
|
55
56
|
cbedId?: number | null | undefined;
|
|
56
|
-
productId?: number | null | undefined;
|
|
57
57
|
assembleId?: number | null | undefined;
|
|
58
58
|
toolsId?: number | null | undefined;
|
|
59
59
|
instrumentId?: number | null | undefined;
|
|
@@ -32,9 +32,9 @@ export declare const CreateWaybillDtoZod: z.ZodObject<{
|
|
|
32
32
|
detalId?: number | null | undefined;
|
|
33
33
|
equipmentId?: number | null | undefined;
|
|
34
34
|
materialId?: number | null | undefined;
|
|
35
|
+
productId?: number | null | undefined;
|
|
35
36
|
sum?: number | undefined;
|
|
36
37
|
cbedId?: number | null | undefined;
|
|
37
|
-
productId?: number | null | undefined;
|
|
38
38
|
assembleId?: number | null | undefined;
|
|
39
39
|
toolsId?: number | null | undefined;
|
|
40
40
|
instrumentId?: number | null | undefined;
|
|
@@ -52,9 +52,9 @@ export declare const CreateWaybillDtoZod: z.ZodObject<{
|
|
|
52
52
|
detalId?: number | null | undefined;
|
|
53
53
|
equipmentId?: number | null | undefined;
|
|
54
54
|
materialId?: number | null | undefined;
|
|
55
|
+
productId?: number | null | undefined;
|
|
55
56
|
sum?: number | undefined;
|
|
56
57
|
cbedId?: number | null | undefined;
|
|
57
|
-
productId?: number | null | undefined;
|
|
58
58
|
assembleId?: number | null | undefined;
|
|
59
59
|
toolsId?: number | null | undefined;
|
|
60
60
|
instrumentId?: number | null | undefined;
|
|
@@ -84,9 +84,9 @@ export declare const CreateWaybillDtoZod: z.ZodObject<{
|
|
|
84
84
|
detalId?: number | null | undefined;
|
|
85
85
|
equipmentId?: number | null | undefined;
|
|
86
86
|
materialId?: number | null | undefined;
|
|
87
|
+
productId?: number | null | undefined;
|
|
87
88
|
sum?: number | undefined;
|
|
88
89
|
cbedId?: number | null | undefined;
|
|
89
|
-
productId?: number | null | undefined;
|
|
90
90
|
assembleId?: number | null | undefined;
|
|
91
91
|
toolsId?: number | null | undefined;
|
|
92
92
|
instrumentId?: number | null | undefined;
|
|
@@ -112,9 +112,9 @@ export declare const CreateWaybillDtoZod: z.ZodObject<{
|
|
|
112
112
|
detalId?: number | null | undefined;
|
|
113
113
|
equipmentId?: number | null | undefined;
|
|
114
114
|
materialId?: number | null | undefined;
|
|
115
|
+
productId?: number | null | undefined;
|
|
115
116
|
sum?: number | undefined;
|
|
116
117
|
cbedId?: number | null | undefined;
|
|
117
|
-
productId?: number | null | undefined;
|
|
118
118
|
assembleId?: number | null | undefined;
|
|
119
119
|
toolsId?: number | null | undefined;
|
|
120
120
|
instrumentId?: number | null | undefined;
|