@pksep/zod-shared 0.0.528 → 0.0.530

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/dist/action/dto/actions-by-param.dto.d.ts +2 -2
  2. package/dist/action/schemas/actions.schema.d.ts +18 -18
  3. package/dist/assemble/dto/get-assemble-operation-count.dto.d.ts +90 -81
  4. package/dist/assemble/schemas/assemble-coming.schema.d.ts +75 -68
  5. package/dist/assemble/schemas/assemble.schema.d.ts +69 -62
  6. package/dist/assemble-kit/schemas/assemble-kit.schema.d.ts +13 -13
  7. package/dist/buyer/schemas/buyer.schema.d.ts +1 -1
  8. package/dist/cbed/dto/cbed-pagination.dto.d.ts +1 -1
  9. package/dist/cbed/dto/get-one-cbed-dto.d.ts +2 -2
  10. package/dist/cbed/dto/up-create-cbed.dto.d.ts +6 -6
  11. package/dist/cbed/schemas/cbed-material.schema.d.ts +2 -2
  12. package/dist/cbed/schemas/cbed.schema.d.ts +21 -21
  13. package/dist/company/dto/companies-pagination.dto.d.ts +3 -0
  14. package/dist/company/dto/companies-pagination.dto.js +1 -0
  15. package/dist/company/dto/create-company.dto.d.ts +10 -10
  16. package/dist/company/dto/update-company.dto.d.ts +10 -10
  17. package/dist/company/schemas/companies.schema.d.ts +4 -4
  18. package/dist/contact/dto/create-contact.dto.d.ts +6 -6
  19. package/dist/contact/dto/update-contact.dto.d.ts +6 -6
  20. package/dist/contact/schemas/contact.schema.d.ts +3 -3
  21. package/dist/deliveries/dto/create-deliveries.dto.d.ts +3 -3
  22. package/dist/deliveries/schemas/deliveries-inventary.schema.d.ts +2 -2
  23. package/dist/deliveries/schemas/deliveries.schema.d.ts +4 -4
  24. package/dist/detal/dto/detal-pagination.dto.d.ts +2 -2
  25. package/dist/detal/dto/get-one-detal-dto.d.ts +1 -1
  26. package/dist/detal/dto/update-detal.dto.d.ts +9 -9
  27. package/dist/detal/schemas/detal-deficit.schema.d.ts +203 -203
  28. package/dist/detal/schemas/detal.schema.d.ts +200 -200
  29. package/dist/document/schemas/documentsSchema.d.ts +4 -4
  30. package/dist/equipment/dto/create-equipment.dto.d.ts +1 -1
  31. package/dist/equipment/dto/update-equipment.dto.d.ts +1 -1
  32. package/dist/equipment/schemas/equipment.schema.d.ts +98 -93
  33. package/dist/expenditure/schema/expenditure-consumption.schema.d.ts +2 -2
  34. package/dist/expenditure/schema/expenditure.schema.d.ts +2 -2
  35. package/dist/instrument/dto/create-name-instrument.dto.d.ts +1 -1
  36. package/dist/instrument/dto/update-name-instrument.dto.d.ts +2 -2
  37. package/dist/inventary/dto/create-inventary.dto.d.ts +1 -1
  38. package/dist/marks/dto/change-mark-quantity.dto.d.ts +16 -16
  39. package/dist/marks/dto/create-mark.dto.d.ts +8 -8
  40. package/dist/marks/dto/update-mark.dto.d.ts +2 -2
  41. package/dist/marks/schemas/marks.schema.d.ts +8 -8
  42. package/dist/marks/type/type.d.ts +2 -2
  43. package/dist/material/dto/create-material.dto.d.ts +20 -20
  44. package/dist/material/schemas/material-characteristics.schema.d.ts +6 -6
  45. package/dist/material/schemas/material.schema.d.ts +26 -26
  46. package/dist/metaloworking/schemas/metaloworking-by-operation.schema.d.ts +4 -4
  47. package/dist/metaloworking/schemas/metaloworking-coming.schema.d.ts +2 -2
  48. package/dist/movement-error/schemas/movement-error.schema.d.ts +2 -2
  49. package/dist/moving/schemas/moving.schema.d.ts +463 -456
  50. package/dist/operations/dto/create-type-operation.dto.d.ts +4 -0
  51. package/dist/operations/dto/create-type-operation.dto.js +5 -1
  52. package/dist/operations/dto/update-type-operation.dto.d.ts +4 -0
  53. package/dist/operations/dto/update-type-operation.dto.js +5 -1
  54. package/dist/operations/enums/enums.d.ts +7 -0
  55. package/dist/operations/enums/enums.js +21 -1
  56. package/dist/operations/index.d.ts +2 -0
  57. package/dist/operations/index.js +2 -0
  58. package/dist/operations/interfaces/interface.d.ts +5 -0
  59. package/dist/operations/schemas/operation.schema.d.ts +21 -17
  60. package/dist/operations/schemas/operation.schema.js +4 -0
  61. package/dist/operations/schemas/type-operation.schema.d.ts +4 -0
  62. package/dist/operations/schemas/type-operation.schema.js +2 -0
  63. package/dist/product/dto/up-create-product.dto.d.ts +7 -7
  64. package/dist/product/schemas/product-deficit.schema.d.ts +20 -20
  65. package/dist/product/schemas/product-material.schema.d.ts +2 -2
  66. package/dist/product/schemas/product-specification.schema.d.ts +2 -2
  67. package/dist/product/schemas/product.schema.d.ts +17 -17
  68. package/dist/production-tasks/dto/create-operation-pos.dto.d.ts +2 -2
  69. package/dist/production-tasks/dto/get-production-task-by-equipment.dto.d.ts +4 -0
  70. package/dist/production-tasks/dto/get-production-task-by-equipment.dto.js +3 -1
  71. package/dist/production-tasks/dto/get-production-task-by-user.dto.d.ts +4 -0
  72. package/dist/production-tasks/dto/get-production-task-by-user.dto.js +2 -0
  73. package/dist/production-tasks/dto/workload-by-entity.dto.d.ts +2 -2
  74. package/dist/production-tasks/interfaces/production-tasks.d.ts +2 -0
  75. package/dist/production-tasks/interfaces/workload-by-entity.d.ts +19 -0
  76. package/dist/production-tasks/schemas/operation-positions.schema.d.ts +7 -4
  77. package/dist/production-tasks/schemas/operation-positions.schema.js +1 -0
  78. package/dist/production-tasks/schemas/production-operation-pos.schema.d.ts +4 -4
  79. package/dist/provider/dto/create-provider.dto.d.ts +4 -4
  80. package/dist/provider/schemas/provider.schema.d.ts +1 -1
  81. package/dist/rack/dto/get-all-racks.dto.d.ts +3 -0
  82. package/dist/rack/dto/get-all-racks.dto.js +2 -1
  83. package/dist/role/schemas/role.schema.d.ts +455 -448
  84. package/dist/sclad/schemas/remain.schema.d.ts +2 -2
  85. package/dist/sclad/schemas/remains.schema.d.ts +6 -6
  86. package/dist/shipments/dto/get-attributes.dto.d.ts +2 -2
  87. package/dist/shipments/dto/shipments-list-pagination.dto.d.ts +1 -1
  88. package/dist/shipments/dto/shipments-paginate.dto.d.ts +2 -2
  89. package/dist/shipments/schemas/sh-complit.schema.d.ts +2 -2
  90. package/dist/shipments/schemas/shipments.schema.d.ts +2 -2
  91. package/dist/specification/dto/specification-attributes.dto.d.ts +1 -1
  92. package/dist/specification/schema/attributes.schema.d.ts +472 -472
  93. package/dist/stock-order/schemas/stock-order-item.schema.d.ts +2 -2
  94. package/dist/tech-process/schemas/tech-process.schema.d.ts +31 -26
  95. package/dist/thread/dto/add-thread.dto.d.ts +8 -8
  96. package/dist/user/dto/create-user.dto.d.ts +5 -5
  97. package/dist/user/dto/get-one-user.dto.d.ts +2 -2
  98. package/dist/user/schemas/user.schema.d.ts +267 -262
  99. package/dist/utils/enums.d.ts +2 -1
  100. package/dist/utils/enums.js +2 -1
  101. package/dist/utils/methods.d.ts +13 -0
  102. package/dist/utils/methods.js +106 -26
  103. package/dist/utils/types/types.d.ts +1 -0
  104. package/dist/waybill/dto/create-waybill-product.dto.d.ts +8 -2
  105. package/dist/waybill/dto/create-waybill-product.dto.js +15 -1
  106. package/dist/waybill/dto/create-waybill.dto.d.ts +16 -6
  107. package/dist/waybill/dto/create-waybill.dto.js +1 -1
  108. package/dist/waybill/interface/interface.d.ts +1 -0
  109. package/dist/waybill/schemas/waybill-product.schema.d.ts +8 -8
  110. package/dist/waybill/schemas/waybill.schema.d.ts +2 -2
  111. package/package.json +1 -1
  112. package/dist/issue/dto/up-create-issue.dto.d.ts +0 -49
  113. package/dist/issue/dto/up-create-issue.dto.js +0 -21
  114. package/dist/issue/index.d.ts +0 -5
  115. package/dist/issue/index.js +0 -21
  116. package/dist/issue/interfaces/interface.d.ts +0 -4
  117. package/dist/issue/schemas/issue-user-controller.schema.d.ts +0 -15
  118. package/dist/issue/schemas/issue-user-controller.schema.js +0 -9
  119. package/dist/issue/schemas/issue-user.schema.d.ts +0 -15
  120. package/dist/issue/schemas/issue-user.schema.js +0 -9
  121. package/dist/issue/schemas/issue.schema.d.ts +0 -51
  122. package/dist/issue/schemas/issue.schema.js +0 -21
  123. package/dist/library/dto/create-chapter.dto.d.ts +0 -12
  124. package/dist/library/dto/create-chapter.dto.js +0 -8
  125. package/dist/library/dto/create-link.dto.d.ts +0 -30
  126. package/dist/library/dto/create-link.dto.js +0 -14
  127. package/dist/library/index.d.ts +0 -5
  128. package/dist/library/index.js +0 -21
  129. package/dist/library/interfaces/interface.d.ts +0 -3
  130. package/dist/library/interfaces/interface.js +0 -2
  131. package/dist/library/schemas/links-user.schema.d.ts +0 -15
  132. package/dist/library/schemas/links-user.schema.js +0 -9
  133. package/dist/library/schemas/links.schema.d.ts +0 -30
  134. package/dist/library/schemas/links.schema.js +0 -14
  135. package/dist/production-tasks/dto/update-marks.dto.d.ts +0 -13
  136. package/dist/production-tasks/dto/update-marks.dto.js +0 -8
  137. package/dist/tech-process/schemas/tech-process-with-options.schema.d.ts +0 -306
  138. package/dist/tech-process/schemas/tech-process-with-options.schema.js +0 -8
  139. package/dist/utils/interface/mat.interface.d.ts +0 -10
  140. package/dist/utils/interface/mat.interface.js +0 -2
  141. /package/dist/{issue/interfaces/interface.js → production-tasks/interfaces/workload-by-entity.js} +0 -0
@@ -48,6 +48,7 @@ export declare enum StatusScladWorking {
48
48
  export declare enum statusShipment {
49
49
  all = "\u0412\u0441\u0435",
50
50
  order = "\u0417\u0430\u043A\u0430\u0437\u0430\u043D\u043E",
51
+ readyToShip = "\u0413\u043E\u0442\u043E\u0432\u043E \u043A \u043E\u0442\u0433\u0440\u0443\u0437\u043A\u0435",
51
52
  ban = "\u0423\u0434\u0430\u043B\u0435\u043D\u043E",
52
53
  done = "\u041E\u0442\u0433\u0440\u0443\u0436\u0435\u043D\u043E",
53
54
  overbue = "\u041F\u0440\u043E\u0441\u0440\u043E\u0447\u0435\u043D\u043E"
@@ -226,7 +227,7 @@ export declare enum WorkSpaceObject {
226
227
  inventary = "\u0418\u043D\u0432\u0435\u043D\u0442\u0430\u0440\u044C",
227
228
  inventary_type = "\u0422\u0438\u043F \u0438\u043D\u0432\u0435\u043D\u0442\u0430\u0440\u044F",
228
229
  inventary_p_type = "\u041F\u043E\u0434 \u0442\u0438\u043F \u0438\u043D\u0432\u0435\u043D\u0442\u0430\u0440\u044F",
229
- material = "\u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B",
230
+ material = "\u041C\u0430\u0442\u0435\u0440\u0438\u0430\u043B",
230
231
  material_type = "\u0422\u0438\u043F \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B\u0430",
231
232
  material_p_type = "\u041F\u043E\u0434 \u0442\u0438\u043F \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B\u0430",
232
233
  issue = "\u0417\u0430\u0434\u0430\u0447\u0438",
@@ -60,6 +60,7 @@ var statusShipment;
60
60
  (function (statusShipment) {
61
61
  statusShipment["all"] = "\u0412\u0441\u0435";
62
62
  statusShipment["order"] = "\u0417\u0430\u043A\u0430\u0437\u0430\u043D\u043E";
63
+ statusShipment["readyToShip"] = "\u0413\u043E\u0442\u043E\u0432\u043E \u043A \u043E\u0442\u0433\u0440\u0443\u0437\u043A\u0435";
63
64
  statusShipment["ban"] = "\u0423\u0434\u0430\u043B\u0435\u043D\u043E";
64
65
  statusShipment["done"] = "\u041E\u0442\u0433\u0440\u0443\u0436\u0435\u043D\u043E";
65
66
  statusShipment["overbue"] = "\u041F\u0440\u043E\u0441\u0440\u043E\u0447\u0435\u043D\u043E";
@@ -259,7 +260,7 @@ var WorkSpaceObject;
259
260
  WorkSpaceObject["inventary"] = "\u0418\u043D\u0432\u0435\u043D\u0442\u0430\u0440\u044C";
260
261
  WorkSpaceObject["inventary_type"] = "\u0422\u0438\u043F \u0438\u043D\u0432\u0435\u043D\u0442\u0430\u0440\u044F";
261
262
  WorkSpaceObject["inventary_p_type"] = "\u041F\u043E\u0434 \u0442\u0438\u043F \u0438\u043D\u0432\u0435\u043D\u0442\u0430\u0440\u044F";
262
- WorkSpaceObject["material"] = "\u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B";
263
+ WorkSpaceObject["material"] = "\u041C\u0430\u0442\u0435\u0440\u0438\u0430\u043B";
263
264
  WorkSpaceObject["material_type"] = "\u0422\u0438\u043F \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B\u0430";
264
265
  WorkSpaceObject["material_p_type"] = "\u041F\u043E\u0434 \u0442\u0438\u043F \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B\u0430";
265
266
  WorkSpaceObject["issue"] = "\u0417\u0430\u0434\u0430\u0447\u0438";
@@ -60,7 +60,20 @@ export interface HolidayConfig {
60
60
  */
61
61
  skipDefaultJanuaryHolidays?: boolean;
62
62
  }
63
+ export declare const WORK_DAY_START_HOUR = 5;
64
+ export declare const WORK_DAY_END_HOUR = 13;
65
+ export declare const WORK_DAY_END_MINUTE = 30;
63
66
  export declare const calculateEndDate: (startDate: Date, totalMinutes: number, config?: HolidayConfig) => Date;
67
+ /**
68
+ * Возвращает время начала работы, вычитая рабочие минуты из конечной даты.
69
+ * Обратное направление по сравнению с calculateEndDate.
70
+ * Учитываются только рабочие часы (5:00-13:30 UTC, будни).
71
+ * @param endDate Конечная дата (от которой идем назад)
72
+ * @param totalMinutes Количество минут, которое нужно вычесть
73
+ * @param config Опциональная конфигурация праздников
74
+ * @returns Дата начала работы
75
+ */
76
+ export declare const calculateStartDate: (endDate: Date, totalMinutes: number, config?: HolidayConfig) => Date;
64
77
  /**
65
78
  * Функция получает сущность и генерирует из него элемент спецификации
66
79
  * @param entity
@@ -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.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;
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.calculateStartDate = exports.calculateEndDate = exports.WORK_DAY_END_MINUTE = exports.WORK_DAY_END_HOUR = exports.WORK_DAY_START_HOUR = exports.leftToDoByProductionTask = exports.calculateByMeasurementRate = void 0;
24
24
  exports.moreMinusNum = moreMinusNum;
25
25
  exports.getFieldsSpetification = getFieldsSpetification;
26
26
  exports.isThisExclusionDesignation = isThisExclusionDesignation;
@@ -113,13 +113,12 @@ const leftToDoByProductionTask = (marks, myQuantity) => {
113
113
  return moreMinusNum(myQuantity - createByMarks);
114
114
  };
115
115
  exports.leftToDoByProductionTask = leftToDoByProductionTask;
116
+ exports.WORK_DAY_START_HOUR = 5;
117
+ exports.WORK_DAY_END_HOUR = 13;
118
+ exports.WORK_DAY_END_MINUTE = 30;
116
119
  const calculateEndDate = (startDate, totalMinutes, config) => {
117
120
  let currentDate = new Date(startDate);
118
121
  let remainingMinutes = totalMinutes;
119
- const workDayStartHour = 5;
120
- const workDayHours = 8;
121
- const workDayEndHour = workDayStartHour + workDayHours;
122
- // Функция для проверки, является ли дата рабочим днем
123
122
  const isWorkDay = (date) => {
124
123
  var _a, _b;
125
124
  const dayOfWeek = date.getUTCDay();
@@ -129,7 +128,6 @@ const calculateEndDate = (startDate, totalMinutes, config) => {
129
128
  if (skipJanuary && month === 0 && day >= 1 && day <= 14) {
130
129
  return false;
131
130
  }
132
- // Проверяем кастомные праздники из конфига
133
131
  if ((_b = config === null || config === void 0 ? void 0 : config.holidays) === null || _b === void 0 ? void 0 : _b.length) {
134
132
  const isHoliday = config.holidays.some(holiday => holiday.month === month && holiday.day === day);
135
133
  if (isHoliday) {
@@ -140,12 +138,12 @@ const calculateEndDate = (startDate, totalMinutes, config) => {
140
138
  };
141
139
  const getWorkDayStart = (date) => {
142
140
  const start = new Date(date);
143
- start.setUTCHours(workDayStartHour, 0, 0, 0);
141
+ start.setUTCHours(exports.WORK_DAY_START_HOUR, 0, 0, 0);
144
142
  return start;
145
143
  };
146
144
  const getWorkDayEnd = (date) => {
147
145
  const end = new Date(date);
148
- end.setUTCHours(workDayEndHour, 0, 0, 0);
146
+ end.setUTCHours(exports.WORK_DAY_END_HOUR, exports.WORK_DAY_END_MINUTE, 0, 0);
149
147
  return end;
150
148
  };
151
149
  const moveToNextWorkDay = (date) => {
@@ -153,7 +151,7 @@ const calculateEndDate = (startDate, totalMinutes, config) => {
153
151
  do {
154
152
  nextDay.setUTCDate(nextDay.getUTCDate() + 1);
155
153
  } while (!isWorkDay(nextDay));
156
- nextDay.setUTCHours(workDayStartHour, 0, 0, 0);
154
+ nextDay.setUTCHours(exports.WORK_DAY_START_HOUR, 0, 0, 0);
157
155
  return nextDay;
158
156
  };
159
157
  if (!isWorkDay(currentDate)) {
@@ -163,12 +161,12 @@ const calculateEndDate = (startDate, totalMinutes, config) => {
163
161
  const currentHour = currentDate.getUTCHours();
164
162
  const currentMinutes = currentDate.getUTCMinutes();
165
163
  const currentTimeInMinutes = currentHour * 60 + currentMinutes;
166
- const workDayStartInMinutes = workDayStartHour * 60;
167
- const workDayEndInMinutes = workDayEndHour * 60;
164
+ const workDayStartInMinutes = exports.WORK_DAY_START_HOUR * 60;
165
+ const workDayEndInMinutes = exports.WORK_DAY_END_HOUR * 60 + exports.WORK_DAY_END_MINUTE;
168
166
  if (currentTimeInMinutes < workDayStartInMinutes) {
169
167
  currentDate = getWorkDayStart(currentDate);
170
168
  }
171
- else if (currentTimeInMinutes >= workDayEndInMinutes) {
169
+ else if (currentTimeInMinutes > workDayEndInMinutes) {
172
170
  currentDate = moveToNextWorkDay(currentDate);
173
171
  }
174
172
  }
@@ -186,6 +184,83 @@ const calculateEndDate = (startDate, totalMinutes, config) => {
186
184
  return currentDate;
187
185
  };
188
186
  exports.calculateEndDate = calculateEndDate;
187
+ /**
188
+ * Возвращает время начала работы, вычитая рабочие минуты из конечной даты.
189
+ * Обратное направление по сравнению с calculateEndDate.
190
+ * Учитываются только рабочие часы (5:00-13:30 UTC, будни).
191
+ * @param endDate Конечная дата (от которой идем назад)
192
+ * @param totalMinutes Количество минут, которое нужно вычесть
193
+ * @param config Опциональная конфигурация праздников
194
+ * @returns Дата начала работы
195
+ */
196
+ const calculateStartDate = (endDate, totalMinutes, config) => {
197
+ let currentDate = new Date(endDate);
198
+ let remainingMinutes = totalMinutes;
199
+ const isWorkDay = (date) => {
200
+ var _a, _b;
201
+ const dayOfWeek = date.getUTCDay();
202
+ const month = date.getUTCMonth();
203
+ const day = date.getUTCDate();
204
+ const skipJanuary = (_a = config === null || config === void 0 ? void 0 : config.skipDefaultJanuaryHolidays) !== null && _a !== void 0 ? _a : true;
205
+ if (skipJanuary && month === 0 && day >= 1 && day <= 14) {
206
+ return false;
207
+ }
208
+ if ((_b = config === null || config === void 0 ? void 0 : config.holidays) === null || _b === void 0 ? void 0 : _b.length) {
209
+ const isHoliday = config.holidays.some(holiday => holiday.month === month && holiday.day === day);
210
+ if (isHoliday) {
211
+ return false;
212
+ }
213
+ }
214
+ return dayOfWeek !== 0 && dayOfWeek !== 6;
215
+ };
216
+ const getWorkDayStart = (date) => {
217
+ const start = new Date(date);
218
+ start.setUTCHours(exports.WORK_DAY_START_HOUR, 0, 0, 0);
219
+ return start;
220
+ };
221
+ const getWorkDayEnd = (date) => {
222
+ const end = new Date(date);
223
+ end.setUTCHours(exports.WORK_DAY_END_HOUR, exports.WORK_DAY_END_MINUTE, 0, 0);
224
+ return end;
225
+ };
226
+ const moveToPrevWorkDay = (date) => {
227
+ const prevDay = new Date(date);
228
+ do {
229
+ prevDay.setUTCDate(prevDay.getUTCDate() - 1);
230
+ } while (!isWorkDay(prevDay));
231
+ prevDay.setUTCHours(exports.WORK_DAY_END_HOUR, exports.WORK_DAY_END_MINUTE, 0, 0);
232
+ return prevDay;
233
+ };
234
+ if (!isWorkDay(currentDate)) {
235
+ currentDate = moveToPrevWorkDay(currentDate);
236
+ }
237
+ else {
238
+ const currentHour = currentDate.getUTCHours();
239
+ const currentMinutes = currentDate.getUTCMinutes();
240
+ const currentTimeInMinutes = currentHour * 60 + currentMinutes;
241
+ const workDayStartInMinutes = exports.WORK_DAY_START_HOUR * 60;
242
+ const workDayEndInMinutes = exports.WORK_DAY_END_HOUR * 60 + exports.WORK_DAY_END_MINUTE;
243
+ if (currentTimeInMinutes > workDayEndInMinutes) {
244
+ currentDate = getWorkDayEnd(currentDate);
245
+ }
246
+ else if (currentTimeInMinutes < workDayStartInMinutes) {
247
+ currentDate = moveToPrevWorkDay(currentDate);
248
+ }
249
+ }
250
+ while (remainingMinutes > 0) {
251
+ const workDayStart = getWorkDayStart(currentDate);
252
+ const availableMinutesToday = Math.min(remainingMinutes, (currentDate.getTime() - workDayStart.getTime()) / (1000 * 60));
253
+ if (availableMinutesToday > 0) {
254
+ currentDate = new Date(currentDate.getTime() - availableMinutesToday * 60 * 1000);
255
+ remainingMinutes -= availableMinutesToday;
256
+ }
257
+ if (remainingMinutes > 0) {
258
+ currentDate = moveToPrevWorkDay(currentDate);
259
+ }
260
+ }
261
+ return currentDate;
262
+ };
263
+ exports.calculateStartDate = calculateStartDate;
189
264
  /**
190
265
  * Функция получает сущность и генерирует из него элемент спецификации
191
266
  * @param entity
@@ -735,26 +810,31 @@ const countChildrensRelative = (data) => {
735
810
  const characteristicValue = materialConverRate
736
811
  ? Math.ceil(detalMass / materialConverRate)
737
812
  : 0;
738
- const characteristicQuantity = characteristicValue
739
- ? characteristicValue
740
- : 0;
741
- if (characteristicQuantity)
742
- concatedMaterialLists.push({
743
- id: relative === null || relative === void 0 ? void 0 : relative.mat_zag,
744
- quantity: characteristicQuantity
745
- });
813
+ const characteristicQuantity = characteristicValue || 0;
814
+ // всегда добавляем материал, даже если количество = 0, чтобы не терять его в графе
815
+ concatedMaterialLists.push({
816
+ id: relative === null || relative === void 0 ? void 0 : relative.mat_zag,
817
+ quantity: characteristicQuantity
818
+ });
746
819
  }
747
820
  }
748
821
  const materialMap = new Map();
749
822
  const materialsArray = concatedMaterialLists.map((listMaterialItem) => {
750
823
  const foundedMaterials = materials.find(material => listMaterialItem.id === material.id);
824
+ // если материал не найден, пропускаем
825
+ if (!foundedMaterials) {
826
+ return null;
827
+ }
828
+ // проверяем: это реальный 0 или результат ошибки/расчета
829
+ const isZeroQuantity = listMaterialItem.quantity === 0;
751
830
  //конвертируем потребность в ШТ
752
- const materialConverRate = foundedMaterials
753
- ? (0, exports.calculateByMeasurementRate)(foundedMaterials.units_measurement, listMaterialItem.measureId)
754
- : 0;
755
- const specificationConvertedQuantity = materialConverRate
756
- ? Math.ceil(listMaterialItem.quantity / materialConverRate)
757
- : 0;
831
+ const materialConverRate = (0, exports.calculateByMeasurementRate)(foundedMaterials.units_measurement, listMaterialItem.measureId);
832
+ // если количество 0, не пересчитываем, иначе - считаем как раньше
833
+ const specificationConvertedQuantity = isZeroQuantity
834
+ ? 0
835
+ : materialConverRate
836
+ ? Math.ceil(listMaterialItem.quantity / materialConverRate)
837
+ : 0;
758
838
  return Object.assign(Object.assign(Object.assign({}, foundedMaterials), (0, sequelize_1.addFieldByCondition)(data.isNeedsTypes, {
759
839
  entity_type: enums_1.IzdType.material
760
840
  })), { 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) || '-' });
@@ -33,6 +33,7 @@ export type RelativesProductionTasksType = {
33
33
  relativeDescription: string;
34
34
  relativeId: number;
35
35
  startTime: Date;
36
+ calculateStartTime: Date | null;
36
37
  relativeType: string;
37
38
  };
38
39
  export type DateRangeType = {
@@ -6,7 +6,9 @@ export declare const CreateWaybillProductSchema: z.ZodObject<{
6
6
  quantity: z.ZodNumber;
7
7
  entityType: z.ZodNativeEnum<typeof PositionItemType>;
8
8
  workerType: z.ZodNativeEnum<typeof WaybilTypeComingEnums>;
9
- sum: z.ZodOptional<z.ZodNumber>;
9
+ sum: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
10
+ deliveryId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
11
+ deliveryPositionIndex: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
10
12
  productId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
11
13
  toolsId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
12
14
  cbedId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
@@ -36,6 +38,8 @@ export declare const CreateWaybillProductSchema: z.ZodObject<{
36
38
  cbedId?: number | null | undefined;
37
39
  productId?: number | null | undefined;
38
40
  assembleId?: number | null | undefined;
41
+ deliveryId?: number | null | undefined;
42
+ deliveryPositionIndex?: number | null | undefined;
39
43
  toolsId?: number | null | undefined;
40
44
  inventaryId?: number | null | undefined;
41
45
  metalloworkingId?: number | null | undefined;
@@ -51,11 +55,13 @@ export declare const CreateWaybillProductSchema: z.ZodObject<{
51
55
  detalId?: number | null | undefined;
52
56
  equipmentId?: number | null | undefined;
53
57
  materialId?: number | null | undefined;
54
- sum?: number | undefined;
58
+ sum?: unknown;
55
59
  instrumentId?: number | null | undefined;
56
60
  cbedId?: number | null | undefined;
57
61
  productId?: number | null | undefined;
58
62
  assembleId?: number | null | undefined;
63
+ deliveryId?: number | null | undefined;
64
+ deliveryPositionIndex?: number | null | undefined;
59
65
  toolsId?: number | null | undefined;
60
66
  inventaryId?: number | null | undefined;
61
67
  metalloworkingId?: number | null | undefined;
@@ -8,7 +8,21 @@ exports.CreateWaybillProductSchema = zod_1.z.object({
8
8
  quantity: zod_1.z.number(),
9
9
  entityType: zod_1.z.nativeEnum(enum_1.PositionItemType),
10
10
  workerType: zod_1.z.nativeEnum(utils_1.WaybilTypeComingEnums),
11
- sum: zod_1.z.number().optional(),
11
+ sum: zod_1.z.preprocess(val => {
12
+ if (val === '' || val === null || val === undefined)
13
+ return undefined;
14
+ if (typeof val === 'string') {
15
+ const normalizedValue = val.trim().replace(',', '.');
16
+ if (!normalizedValue.length)
17
+ return undefined;
18
+ const parsedValue = Number(normalizedValue);
19
+ if (!isNaN(parsedValue))
20
+ return parsedValue;
21
+ }
22
+ return val;
23
+ }, zod_1.z.number().optional()),
24
+ deliveryId: zod_1.z.number().optional().nullish(),
25
+ deliveryPositionIndex: zod_1.z.number().int().optional().nullish(),
12
26
  productId: zod_1.z.number().optional().nullish(),
13
27
  toolsId: zod_1.z.number().optional().nullish(),
14
28
  cbedId: zod_1.z.number().optional().nullish(),
@@ -2,12 +2,14 @@ import { z } from 'zod';
2
2
  import { WaybilTypeComingEnums } from '../../utils';
3
3
  export declare const CreateWaybillDtoZod: z.ZodObject<{
4
4
  materialId: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, number | null | undefined, unknown>;
5
- providerId: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodString]>>>;
5
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodString]>>>;
6
6
  productList: z.ZodOptional<z.ZodArray<z.ZodObject<{
7
7
  quantity: z.ZodNumber;
8
8
  entityType: z.ZodNativeEnum<typeof import("..").PositionItemType>;
9
9
  workerType: z.ZodNativeEnum<typeof WaybilTypeComingEnums>;
10
- sum: z.ZodOptional<z.ZodNumber>;
10
+ sum: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, unknown>;
11
+ deliveryId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
12
+ deliveryPositionIndex: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
11
13
  productId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
12
14
  toolsId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
13
15
  cbedId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
@@ -37,6 +39,8 @@ export declare const CreateWaybillDtoZod: z.ZodObject<{
37
39
  cbedId?: number | null | undefined;
38
40
  productId?: number | null | undefined;
39
41
  assembleId?: number | null | undefined;
42
+ deliveryId?: number | null | undefined;
43
+ deliveryPositionIndex?: number | null | undefined;
40
44
  toolsId?: number | null | undefined;
41
45
  inventaryId?: number | null | undefined;
42
46
  metalloworkingId?: number | null | undefined;
@@ -52,11 +56,13 @@ export declare const CreateWaybillDtoZod: z.ZodObject<{
52
56
  detalId?: number | null | undefined;
53
57
  equipmentId?: number | null | undefined;
54
58
  materialId?: number | null | undefined;
55
- sum?: number | undefined;
59
+ sum?: unknown;
56
60
  instrumentId?: number | null | undefined;
57
61
  cbedId?: number | null | undefined;
58
62
  productId?: number | null | undefined;
59
63
  assembleId?: number | null | undefined;
64
+ deliveryId?: number | null | undefined;
65
+ deliveryPositionIndex?: number | null | undefined;
60
66
  toolsId?: number | null | undefined;
61
67
  inventaryId?: number | null | undefined;
62
68
  metalloworkingId?: number | null | undefined;
@@ -73,8 +79,8 @@ export declare const CreateWaybillDtoZod: z.ZodObject<{
73
79
  typeComing: WaybilTypeComingEnums;
74
80
  sclad?: boolean | null | undefined;
75
81
  materialId?: number | null | undefined;
76
- providerId?: string | number | null | undefined;
77
82
  documentsIds?: number[] | null | undefined;
83
+ companyId?: string | number | null | undefined;
78
84
  productList?: {
79
85
  quantity: number;
80
86
  ezId: number;
@@ -89,6 +95,8 @@ export declare const CreateWaybillDtoZod: z.ZodObject<{
89
95
  cbedId?: number | null | undefined;
90
96
  productId?: number | null | undefined;
91
97
  assembleId?: number | null | undefined;
98
+ deliveryId?: number | null | undefined;
99
+ deliveryPositionIndex?: number | null | undefined;
92
100
  toolsId?: number | null | undefined;
93
101
  inventaryId?: number | null | undefined;
94
102
  metalloworkingId?: number | null | undefined;
@@ -101,8 +109,8 @@ export declare const CreateWaybillDtoZod: z.ZodObject<{
101
109
  typeComing: WaybilTypeComingEnums;
102
110
  sclad?: unknown;
103
111
  materialId?: unknown;
104
- providerId?: string | number | null | undefined;
105
112
  documentsIds?: number[] | null | undefined;
113
+ companyId?: string | number | null | undefined;
106
114
  productList?: {
107
115
  quantity: number;
108
116
  ezId: number;
@@ -112,11 +120,13 @@ export declare const CreateWaybillDtoZod: z.ZodObject<{
112
120
  detalId?: number | null | undefined;
113
121
  equipmentId?: number | null | undefined;
114
122
  materialId?: number | null | undefined;
115
- sum?: number | undefined;
123
+ sum?: unknown;
116
124
  instrumentId?: number | null | undefined;
117
125
  cbedId?: number | null | undefined;
118
126
  productId?: number | null | undefined;
119
127
  assembleId?: number | null | undefined;
128
+ deliveryId?: number | null | undefined;
129
+ deliveryPositionIndex?: number | null | undefined;
120
130
  toolsId?: number | null | undefined;
121
131
  inventaryId?: number | null | undefined;
122
132
  metalloworkingId?: number | null | undefined;
@@ -6,7 +6,7 @@ const utils_1 = require("../../utils");
6
6
  const create_waybill_product_dto_1 = require("./create-waybill-product.dto");
7
7
  exports.CreateWaybillDtoZod = zod_1.z.object({
8
8
  materialId: zod_1.z.preprocess(val => typeof val === 'string' && parseInt(val, 10) ? parseInt(val, 10) : null, zod_1.z.number().nullable().optional()),
9
- providerId: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]).nullish(),
9
+ companyId: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]).nullish(),
10
10
  productList: create_waybill_product_dto_1.CreateWaybillProductSchema.array().optional(),
11
11
  documentsIds: zod_1.z.number().array().nullable().optional(),
12
12
  description: zod_1.z.string(),
@@ -7,6 +7,7 @@ export interface IKitSelected {
7
7
  export interface IWaybillCreationAttr {
8
8
  readonly name: string;
9
9
  readonly type_сoming: string;
10
+ readonly company_id?: number;
10
11
  }
11
12
  export interface IWaybillProductCreate {
12
13
  quantity: number;
@@ -39,20 +39,20 @@ export declare const WaybillProductSchema: z.ZodObject<{
39
39
  }, "strip", z.ZodTypeAny, {
40
40
  id: number;
41
41
  quantity: number;
42
- sum: number;
43
42
  waybill_id: number;
43
+ sum: number;
44
44
  entity_type: PositionItemType;
45
45
  worker_type: WaybilTypeComingEnums;
46
46
  description?: string | undefined;
47
47
  assemble_id?: number | null | undefined;
48
- cbed_id?: number | null | undefined;
49
- provider_id?: number | null | undefined;
50
- inventary_id?: number | null | undefined;
51
48
  equipment_id?: number | null | undefined;
49
+ provider_id?: number | null | undefined;
52
50
  material_id?: number | null | undefined;
53
51
  instrument_id?: number | null | undefined;
54
52
  detal_id?: number | null | undefined;
53
+ cbed_id?: number | null | undefined;
55
54
  product_id?: number | null | undefined;
55
+ inventary_id?: number | null | undefined;
56
56
  metalloworking_id?: number | null | undefined;
57
57
  ez_id?: number | undefined;
58
58
  tools_id?: number | null | undefined;
@@ -61,20 +61,20 @@ export declare const WaybillProductSchema: z.ZodObject<{
61
61
  }, {
62
62
  id: number;
63
63
  quantity: number;
64
- sum: number;
65
64
  waybill_id: number;
65
+ sum: number;
66
66
  entity_type: PositionItemType;
67
67
  worker_type: WaybilTypeComingEnums;
68
68
  description?: string | undefined;
69
69
  assemble_id?: number | null | undefined;
70
- cbed_id?: number | null | undefined;
71
- provider_id?: number | null | undefined;
72
- inventary_id?: number | null | undefined;
73
70
  equipment_id?: number | null | undefined;
71
+ provider_id?: number | null | undefined;
74
72
  material_id?: number | null | undefined;
75
73
  instrument_id?: number | null | undefined;
76
74
  detal_id?: number | null | undefined;
75
+ cbed_id?: number | null | undefined;
77
76
  product_id?: number | null | undefined;
77
+ inventary_id?: number | null | undefined;
78
78
  metalloworking_id?: number | null | undefined;
79
79
  ez_id?: number | undefined;
80
80
  tools_id?: number | null | undefined;
@@ -19,16 +19,16 @@ export declare const WaybillSchema: z.ZodObject<{
19
19
  name: string;
20
20
  type_сoming: WaybilTypeComingEnums;
21
21
  id?: number | null | undefined;
22
- company_id?: number | undefined;
23
22
  createdAt?: string | Date | undefined;
23
+ company_id?: number | undefined;
24
24
  }, {
25
25
  name: string;
26
26
  type_сoming: WaybilTypeComingEnums;
27
27
  ban?: boolean | undefined;
28
28
  description?: string | undefined;
29
29
  id?: number | null | undefined;
30
- company_id?: number | undefined;
31
30
  createdAt?: string | Date | undefined;
31
+ company_id?: number | undefined;
32
32
  }>;
33
33
  export type ModelWaybill = z.infer<typeof WaybillSchema> & {
34
34
  documents?: ModelDocuments[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pksep/zod-shared",
3
- "version": "0.0.528",
3
+ "version": "0.0.530",
4
4
  "description": "Zod package for erp project. Contains dto, interfaces, schems, types, enum",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,49 +0,0 @@
1
- import { z } from 'zod';
2
- import { StatusIssue } from '../../utils';
3
- export declare const UpCreateIssueDtoZod: z.ZodObject<{
4
- description: z.ZodString;
5
- dateUse: z.ZodString;
6
- normTime: z.ZodString;
7
- sourse: z.ZodString;
8
- srok: z.ZodString;
9
- status: z.ZodNativeEnum<typeof StatusIssue>;
10
- controllerList: z.ZodString;
11
- executorList: z.ZodString;
12
- izdList: z.ZodString;
13
- shopNeeds: z.ZodString;
14
- fileArrModal: z.ZodString;
15
- srok_control: z.ZodString;
16
- id: z.ZodNumber;
17
- name: z.ZodString;
18
- }, "strip", z.ZodTypeAny, {
19
- status: StatusIssue;
20
- id: number;
21
- name: string;
22
- description: string;
23
- dateUse: string;
24
- normTime: string;
25
- sourse: string;
26
- srok: string;
27
- controllerList: string;
28
- executorList: string;
29
- srok_control: string;
30
- izdList: string;
31
- shopNeeds: string;
32
- fileArrModal: string;
33
- }, {
34
- status: StatusIssue;
35
- id: number;
36
- name: string;
37
- description: string;
38
- dateUse: string;
39
- normTime: string;
40
- sourse: string;
41
- srok: string;
42
- controllerList: string;
43
- executorList: string;
44
- srok_control: string;
45
- izdList: string;
46
- shopNeeds: string;
47
- fileArrModal: string;
48
- }>;
49
- export type UpCreateIssueDtoType = z.infer<typeof UpCreateIssueDtoZod>;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UpCreateIssueDtoZod = void 0;
4
- const zod_1 = require("zod");
5
- const utils_1 = require("../../utils");
6
- exports.UpCreateIssueDtoZod = zod_1.z.object({
7
- description: zod_1.z.string(),
8
- dateUse: zod_1.z.string(),
9
- normTime: zod_1.z.string(),
10
- sourse: zod_1.z.string(),
11
- srok: zod_1.z.string(),
12
- status: zod_1.z.nativeEnum(utils_1.StatusIssue),
13
- controllerList: zod_1.z.string(),
14
- executorList: zod_1.z.string(),
15
- izdList: zod_1.z.string(),
16
- shopNeeds: zod_1.z.string(),
17
- fileArrModal: zod_1.z.string(),
18
- srok_control: zod_1.z.string(),
19
- id: zod_1.z.number(),
20
- name: zod_1.z.string()
21
- });
@@ -1,5 +0,0 @@
1
- export * from './schemas/issue.schema';
2
- export * from './schemas/issue-user.schema';
3
- export * from './schemas/issue-user-controller.schema';
4
- export * from './interfaces/interface';
5
- export * from './dto/up-create-issue.dto';
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./schemas/issue.schema"), exports);
18
- __exportStar(require("./schemas/issue-user.schema"), exports);
19
- __exportStar(require("./schemas/issue-user-controller.schema"), exports);
20
- __exportStar(require("./interfaces/interface"), exports);
21
- __exportStar(require("./dto/up-create-issue.dto"), exports);
@@ -1,4 +0,0 @@
1
- export interface IIssueCreationAttrs {
2
- name: string;
3
- instans: number;
4
- }
@@ -1,15 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const issueUserControllerSchema: z.ZodObject<{
3
- id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
4
- issueId: z.ZodNumber;
5
- userId: z.ZodNumber;
6
- }, "strip", z.ZodTypeAny, {
7
- userId: number;
8
- issueId: number;
9
- id?: number | null | undefined;
10
- }, {
11
- userId: number;
12
- issueId: number;
13
- id?: number | null | undefined;
14
- }>;
15
- export type ModelIssueUserController = z.infer<typeof issueUserControllerSchema>;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.issueUserControllerSchema = void 0;
4
- const zod_1 = require("zod");
5
- exports.issueUserControllerSchema = zod_1.z.object({
6
- id: zod_1.z.number().nullish(),
7
- issueId: zod_1.z.number().int().positive(),
8
- userId: zod_1.z.number().int().positive()
9
- });