@pksep/zod-shared 0.0.537 → 0.0.538
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/utils/sorting.d.ts +2 -1
- package/dist/utils/sorting.js +1 -0
- package/dist/utils/tables-config/enum.d.ts +1 -0
- package/dist/utils/tables-config/enum.js +1 -0
- package/dist/utils/tables-config/methods.js +40 -12
- package/dist/utils/tables-config/tables-array.js +5 -0
- package/package.json +1 -1
package/dist/utils/sorting.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ export declare enum ProductionPlanSortField {
|
|
|
6
6
|
calculatedCreateTime = "calculatedCreateTime",
|
|
7
7
|
warehouseReadinessDate = "warehouseReadinessDate",
|
|
8
8
|
orderedByProduction = "orderedByProduction",
|
|
9
|
-
productionDelay = "productionDelay"
|
|
9
|
+
productionDelay = "productionDelay",
|
|
10
|
+
startTimeDelay = "startTimeDelay"
|
|
10
11
|
}
|
|
11
12
|
export type ProductionPlanSortRule = {
|
|
12
13
|
sortField?: ProductionPlanSortField | null;
|
package/dist/utils/sorting.js
CHANGED
|
@@ -10,6 +10,7 @@ var ProductionPlanSortField;
|
|
|
10
10
|
ProductionPlanSortField["warehouseReadinessDate"] = "warehouseReadinessDate";
|
|
11
11
|
ProductionPlanSortField["orderedByProduction"] = "orderedByProduction";
|
|
12
12
|
ProductionPlanSortField["productionDelay"] = "productionDelay";
|
|
13
|
+
ProductionPlanSortField["startTimeDelay"] = "startTimeDelay";
|
|
13
14
|
})(ProductionPlanSortField || (exports.ProductionPlanSortField = ProductionPlanSortField = {}));
|
|
14
15
|
exports.ProductionPlanSortRuleSchema = zod_1.z.object({
|
|
15
16
|
sortField: zod_1.z.nativeEnum(ProductionPlanSortField).nullable().optional(),
|
|
@@ -11,6 +11,7 @@ export declare enum tablesEnumConfig {
|
|
|
11
11
|
calculateAssembleTime = "calculateAssembleTime",
|
|
12
12
|
orderedByProduction = "orderedByProduction",
|
|
13
13
|
productionDelay = "productionDelay",
|
|
14
|
+
startTimeDelay = "startTimeDelay",
|
|
14
15
|
ordered = "ordered",
|
|
15
16
|
deficitChildCreateTime = "deficitChildCreateTime",
|
|
16
17
|
remainingByProductionTask = "remainingByProductionTask",
|
|
@@ -24,6 +24,7 @@ var tablesEnumConfig;
|
|
|
24
24
|
// заказано по ПЗ
|
|
25
25
|
tablesEnumConfig["orderedByProduction"] = "orderedByProduction";
|
|
26
26
|
tablesEnumConfig["productionDelay"] = "productionDelay";
|
|
27
|
+
tablesEnumConfig["startTimeDelay"] = "startTimeDelay";
|
|
27
28
|
// заказано
|
|
28
29
|
tablesEnumConfig["ordered"] = "ordered";
|
|
29
30
|
// Время изг. дефицитных Д/СБ
|
|
@@ -29,24 +29,52 @@ const createCorrectColumnConfig = (columns, arrayToCheck) => {
|
|
|
29
29
|
const uniqueColumns = new Map();
|
|
30
30
|
columns
|
|
31
31
|
.filter(currentColumn => availableColumns.has(currentColumn.columnName))
|
|
32
|
-
.sort((leftColumn, rightColumn) =>
|
|
32
|
+
.sort((leftColumn, rightColumn) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const leftPosition = (_a = leftColumn.position) !== null && _a !== void 0 ? _a : 0;
|
|
35
|
+
const rightPosition = (_b = rightColumn.position) !== null && _b !== void 0 ? _b : 0;
|
|
36
|
+
return leftPosition - rightPosition;
|
|
37
|
+
})
|
|
33
38
|
.forEach(currentColumn => {
|
|
39
|
+
if (uniqueColumns.has(currentColumn.columnName))
|
|
40
|
+
return;
|
|
34
41
|
uniqueColumns.set(currentColumn.columnName, currentColumn);
|
|
35
42
|
});
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
const normalizedOrder = Array.from(uniqueColumns.keys());
|
|
44
|
+
/**
|
|
45
|
+
* Вычисляет индекс колонки по эталонному порядку
|
|
46
|
+
*/
|
|
47
|
+
const getActualInsertIndex = (currentColumn) => {
|
|
48
|
+
const currentIndex = arrayToCheck.indexOf(currentColumn);
|
|
49
|
+
for (let leftIndex = currentIndex - 1; leftIndex >= 0; leftIndex -= 1) {
|
|
50
|
+
const existedIndex = normalizedOrder.indexOf(arrayToCheck[leftIndex]);
|
|
51
|
+
if (existedIndex !== -1)
|
|
52
|
+
return existedIndex + 1;
|
|
53
|
+
}
|
|
54
|
+
for (let rightIndex = currentIndex + 1; rightIndex < arrayToCheck.length; rightIndex += 1) {
|
|
55
|
+
const existedIndex = normalizedOrder.indexOf(arrayToCheck[rightIndex]);
|
|
56
|
+
if (existedIndex !== -1)
|
|
57
|
+
return existedIndex;
|
|
58
|
+
}
|
|
59
|
+
return normalizedOrder.length;
|
|
60
|
+
};
|
|
42
61
|
arrayToCheck.forEach(currentItem => {
|
|
43
62
|
if (uniqueColumns.has(currentItem))
|
|
44
63
|
return;
|
|
45
|
-
|
|
46
|
-
columnName: currentItem,
|
|
47
|
-
isShow: true
|
|
48
|
-
});
|
|
64
|
+
normalizedOrder.splice(getActualInsertIndex(currentItem), 0, currentItem);
|
|
49
65
|
});
|
|
50
|
-
return addPositionForColumns(
|
|
66
|
+
return addPositionForColumns(normalizedOrder.map(currentColumn => {
|
|
67
|
+
const savedColumn = uniqueColumns.get(currentColumn);
|
|
68
|
+
if (savedColumn) {
|
|
69
|
+
return {
|
|
70
|
+
columnName: savedColumn.columnName,
|
|
71
|
+
isShow: savedColumn.isShow
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
columnName: currentColumn,
|
|
76
|
+
isShow: true
|
|
77
|
+
};
|
|
78
|
+
}));
|
|
51
79
|
};
|
|
52
80
|
exports.createCorrectColumnConfig = createCorrectColumnConfig;
|
|
@@ -14,6 +14,7 @@ exports.metalloworkingTableConfig = [
|
|
|
14
14
|
enum_1.tablesEnumConfig.ordered,
|
|
15
15
|
enum_1.tablesEnumConfig.dateByUrgency,
|
|
16
16
|
enum_1.tablesEnumConfig.dateShipment,
|
|
17
|
+
enum_1.tablesEnumConfig.productionDelay,
|
|
17
18
|
enum_1.tablesEnumConfig.workpieceParameters,
|
|
18
19
|
enum_1.tablesEnumConfig.material,
|
|
19
20
|
enum_1.tablesEnumConfig.operationsLength,
|
|
@@ -36,6 +37,7 @@ exports.metalDeficitByAssembleTableConfig = [
|
|
|
36
37
|
enum_1.tablesEnumConfig.deficitByProductionTask,
|
|
37
38
|
enum_1.tablesEnumConfig.orderedByProduction,
|
|
38
39
|
enum_1.tablesEnumConfig.ordered,
|
|
40
|
+
enum_1.tablesEnumConfig.productionDelay,
|
|
39
41
|
enum_1.tablesEnumConfig.operationsLength,
|
|
40
42
|
enum_1.tablesEnumConfig.operationList,
|
|
41
43
|
enum_1.tablesEnumConfig.totalTimePerItem,
|
|
@@ -60,6 +62,7 @@ exports.onlineBoardProductionTableConfig = [
|
|
|
60
62
|
enum_1.tablesEnumConfig.deficitByCurrentProductionTask,
|
|
61
63
|
enum_1.tablesEnumConfig.deficitByProductionTask,
|
|
62
64
|
enum_1.tablesEnumConfig.ordered,
|
|
65
|
+
enum_1.tablesEnumConfig.productionDelay,
|
|
63
66
|
enum_1.tablesEnumConfig.readyToComplect,
|
|
64
67
|
enum_1.tablesEnumConfig.operationsLength,
|
|
65
68
|
enum_1.tablesEnumConfig.operationList,
|
|
@@ -82,6 +85,7 @@ exports.onlineBoardTableConfig = [
|
|
|
82
85
|
enum_1.tablesEnumConfig.dateShipment,
|
|
83
86
|
enum_1.tablesEnumConfig.deficitByProductionTask,
|
|
84
87
|
enum_1.tablesEnumConfig.ordered,
|
|
88
|
+
enum_1.tablesEnumConfig.productionDelay,
|
|
85
89
|
enum_1.tablesEnumConfig.readyToComplect,
|
|
86
90
|
enum_1.tablesEnumConfig.operationsLength,
|
|
87
91
|
enum_1.tablesEnumConfig.operationList,
|
|
@@ -102,6 +106,7 @@ exports.assembleTableConfig = [
|
|
|
102
106
|
enum_1.tablesEnumConfig.calculateNeedsTime,
|
|
103
107
|
enum_1.tablesEnumConfig.dateByUrgency,
|
|
104
108
|
enum_1.tablesEnumConfig.dateShipment,
|
|
109
|
+
enum_1.tablesEnumConfig.productionDelay,
|
|
105
110
|
enum_1.tablesEnumConfig.operationsLength,
|
|
106
111
|
enum_1.tablesEnumConfig.readyInProcent,
|
|
107
112
|
enum_1.tablesEnumConfig.readyToComplect,
|