@things-factory/operato-wms 4.3.19 → 4.4.0-alpha.3

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 (103) hide show
  1. package/client/pages/constants/index.js +0 -1
  2. package/client/pages/constants/setting.js +0 -1
  3. package/client/pages/inbound/pallet-label-popup.js +0 -6
  4. package/client/pages/inbound/putaway-product.js +1 -3
  5. package/client/pages/inbound/unload-product.js +11 -21
  6. package/client/pages/inventory/inventory-adjustment-approval.js +9 -24
  7. package/client/pages/inventory/inventory-adjustment.js +16 -121
  8. package/client/pages/master/product/product-list.js +1 -1
  9. package/client/pages/order/arrival-notice/arrival-notice-detail.js +2 -0
  10. package/client/pages/order/arrival-notice/receive-arrival-notice.js +2 -0
  11. package/client/pages/order/goods-received-note/customer-received-note.js +0 -3
  12. package/client/pages/order/goods-received-note/received-note-detail.js +0 -3
  13. package/client/pages/order/release-order/b2c/b2c-order-requests.js +30 -21
  14. package/client/pages/order/release-order/bulk-print-packing-list.js +0 -4
  15. package/client/pages/order/release-order/receive-release-order-request.js +2 -0
  16. package/client/pages/order/release-order/release-order-detail.js +26 -44
  17. package/client/pages/order/return-order/receive-return-order-requests.js +2 -0
  18. package/client/pages/order/transfer-order/receive-transfer-order-request.js +1 -1
  19. package/client/pages/order/transport-order/print-delivery-note.js +1 -0
  20. package/client/pages/order/transport-order/view-delivery-note.js +1 -1
  21. package/client/pages/order/vas-order/receive-vas-order.js +2 -0
  22. package/client/pages/outbound/inventory-assign-popup.js +2 -7
  23. package/client/pages/outbound/inventory-auto-assign-popup.js +1 -2
  24. package/client/pages/outbound/loading-product.js +11 -49
  25. package/client/pages/outbound/packing-product.js +6 -42
  26. package/client/pages/outbound/packing-worksheet-list.js +0 -15
  27. package/client/pages/outbound/picking-product.js +13 -153
  28. package/client/pages/outbound/single-outbound-worksheet.js +22 -10
  29. package/client/pages/outbound/sorting-product.js +15 -78
  30. package/client/pages/outbound/worksheet-batch-picking.js +2 -9
  31. package/client/pages/outbound/worksheet-packing.js +2 -7
  32. package/client/pages/outbound/worksheet-picking.js +2 -9
  33. package/client/pages/report/inventory-summary-report.js +0 -8
  34. package/client/pages/report/outbound-order-details-report.js +0 -18
  35. package/client/pages/vas/abstract-execute-vas.js +7 -12
  36. package/client/pages/vas/print-product-label.js +6 -15
  37. package/client/pages/vas/reverse-kitting/execute-reverse-kitting.js +1 -3
  38. package/client/pages/vas/reverse-kitting/popup-reverse-kitting-template.js +1 -3
  39. package/client/route.js +0 -12
  40. package/dist-server/entities/index.js +5 -0
  41. package/dist-server/entities/index.js.map +1 -0
  42. package/dist-server/graphql/index.js +5 -1
  43. package/dist-server/graphql/index.js.map +1 -1
  44. package/dist-server/graphql/resolvers/board-setting/board-settings.js +1 -2
  45. package/dist-server/graphql/resolvers/board-setting/board-settings.js.map +1 -1
  46. package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js +6 -5
  47. package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js.map +1 -1
  48. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js +22 -53
  49. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js.map +1 -1
  50. package/dist-server/graphql/resolvers/index.js +7 -4
  51. package/dist-server/graphql/resolvers/index.js.map +1 -1
  52. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +1 -3
  53. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  54. package/dist-server/graphql/types/dashboard/inventory-expiry-counter.js +3 -2
  55. package/dist-server/graphql/types/dashboard/inventory-expiry-counter.js.map +1 -1
  56. package/dist-server/graphql/types/index.js +8 -5
  57. package/dist-server/graphql/types/index.js.map +1 -1
  58. package/dist-server/graphql/types/reports/outbound-order-details-report.js +0 -2
  59. package/dist-server/graphql/types/reports/outbound-order-details-report.js.map +1 -1
  60. package/dist-server/index.js +5 -1
  61. package/dist-server/index.js.map +1 -1
  62. package/dist-server/opa-app-setting-constants.js +1 -2
  63. package/dist-server/opa-app-setting-constants.js.map +1 -1
  64. package/dist-server/utils/index.js +5 -1
  65. package/dist-server/utils/index.js.map +1 -1
  66. package/helps/release-note.ko.md +9 -11
  67. package/helps/release-note.md +9 -11
  68. package/helps/release-note.ms.md +9 -11
  69. package/helps/release-note.zh.md +9 -11
  70. package/package.json +51 -51
  71. package/server/entities/index.ts +3 -0
  72. package/server/graphql/resolvers/board-setting/board-settings.ts +2 -4
  73. package/server/graphql/resolvers/dashboard/inventory-expiry-monitor.ts +6 -5
  74. package/server/graphql/resolvers/dashboard/outbound-order-by-status.ts +22 -53
  75. package/server/graphql/resolvers/index.ts +2 -3
  76. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +2 -6
  77. package/server/graphql/types/dashboard/inventory-expiry-counter.ts +3 -2
  78. package/server/graphql/types/index.ts +4 -4
  79. package/server/graphql/types/reports/outbound-order-details-report.ts +0 -2
  80. package/server/index.ts +1 -1
  81. package/server/opa-app-setting-constants.ts +0 -1
  82. package/things-factory.config.js +0 -13
  83. package/translations/en.json +8 -50
  84. package/translations/ko.json +1 -37
  85. package/translations/ms.json +1 -37
  86. package/translations/zh.json +1 -37
  87. package/client/constants/index.js +0 -1
  88. package/client/constants/order.js +0 -14
  89. package/client/pages/constants/tote.js +0 -14
  90. package/client/pages/master/tote-list.js +0 -740
  91. package/client/pages/order/draft-release-good/draft-release-good-detail.js +0 -1163
  92. package/client/pages/order/draft-release-good/draft-release-good-list.js +0 -546
  93. package/client/pages/outbound/order-remark-popup.js +0 -112
  94. package/client/pages/outbound/tote-popup.js +0 -461
  95. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/index.js +0 -6
  96. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/index.js.map +0 -1
  97. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js +0 -58
  98. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js.map +0 -1
  99. package/dist-server/graphql/types/warehouse-inventory-adjustment/index.js +0 -9
  100. package/dist-server/graphql/types/warehouse-inventory-adjustment/index.js.map +0 -1
  101. package/server/graphql/resolvers/warehouse-inventory-adjustment/index.ts +0 -5
  102. package/server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.ts +0 -68
  103. package/server/graphql/types/warehouse-inventory-adjustment/index.ts +0 -5
@@ -1,461 +0,0 @@
1
- import '@things-factory/grist-ui'
2
- import '@things-factory/barcode-ui'
3
-
4
- import gql from 'graphql-tag'
5
- import { css, html, LitElement } from 'lit-element'
6
-
7
- import { MultiColumnFormStyles, SingleColumnFormStyles } from '@things-factory/form-ui'
8
- import { i18next, localize } from '@things-factory/i18n-base'
9
- import { client } from '@things-factory/shell'
10
- import { ScrollbarStyles } from '@things-factory/styles'
11
- import { isMobileDevice } from '@things-factory/utils'
12
- import { TOTE_STATUS } from '../constants'
13
-
14
- class TotePopup extends localize(i18next)(LitElement) {
15
- static get properties() {
16
- return {
17
- bizplace: String,
18
- config: Object,
19
- grist: Object,
20
- data: Object,
21
- orderNo: String,
22
- toteNo: String,
23
- _totalSeal: Number,
24
- _selectedToteNo: String,
25
- _toteNoList: Object,
26
- _sealNoList: Object,
27
- _sealed: Boolean
28
- }
29
- }
30
-
31
- static get styles() {
32
- return [
33
- MultiColumnFormStyles,
34
- SingleColumnFormStyles,
35
- ScrollbarStyles,
36
- css`
37
- :host {
38
- display: flex;
39
- flex-direction: column;
40
- overflow: hidden;
41
- background-color: white;
42
- }
43
-
44
- .grist {
45
- display: flex;
46
- flex-direction: column;
47
- flex: 1;
48
- overflow-y: auto;
49
- }
50
- .grist-container {
51
- overflow-y: hidden;
52
- display: flex;
53
- flex: 1;
54
- padding: 10px;
55
- }
56
- data-grist {
57
- overflow-y: hidden;
58
- flex: 1;
59
- }
60
- h2 {
61
- padding: var(--subtitle-padding);
62
- font: var(--subtitle-font);
63
- color: var(--subtitle-text-color);
64
- border-bottom: var(--subtitle-border-bottom);
65
- }
66
- .grist h2 {
67
- font: var(--grist-title-font);
68
- }
69
- .button-container {
70
- padding: var(--button-container-padding);
71
- margin: var(--button-container-margin);
72
- text-align: var(--button-container-align);
73
- background-color: var(--button-container-background);
74
- height: var(--button-container-height);
75
- }
76
- .break {
77
- word-wrap: break-word;
78
- }
79
- `
80
- ]
81
- }
82
-
83
- render() {
84
- return html`
85
- <form class="multi-column-form">
86
- <fieldset>
87
- <legend>${i18next.t('title.tote')}</legend>
88
-
89
- <label class="break">${i18next.t('field.now_scanning')}</label>
90
- <input type="text" .value="${this.toteNo || ''} ${this._sealed ? '(Sealed)' : ''}" disabled />
91
- </fieldset>
92
- </form>
93
-
94
- <form id="info-form" class="multi-column-form">
95
- <fieldset>
96
- <label>${i18next.t('field.tote')}</label>
97
- <barcode-scanable-input
98
- name="toteNo"
99
- custom-input
100
- @keypress="${e => {
101
- if (e.keyCode === 13) {
102
- e.preventDefault()
103
- this._checkToteAndOrderTote()
104
- }
105
- }}"
106
- ></barcode-scanable-input>
107
- </fieldset>
108
-
109
- <fieldset>
110
- <label>${i18next.t('field.scanned')}</label>
111
- <select
112
- name="toteNoList"
113
- @change="${e => {
114
- this._selectedToteNo = this._toteNoList.filter(itm => itm.id == e.currentTarget.value)
115
- if (this._selectedToteNo) this.grist.fetch()
116
- }}"
117
- >
118
- <option value="" selected>-- ${i18next.t('text.tote_number')} --</option>
119
- ${(this._toteNoList || []).map(list => html` <option value=${list.id}>${list.name}</option> `)}
120
- </select>
121
- </fieldset>
122
- </form>
123
-
124
- <form class="multi-column-form">
125
- <fieldset>
126
- <label>${i18next.t('field.seal_no')}</label>
127
- <barcode-scanable-input
128
- name="sealNo"
129
- custom-input
130
- @keypress="${e => {
131
- if (e.keyCode === 13) {
132
- e.preventDefault()
133
- this.sealNo = this.sealNoInput.value
134
- if (this.toteNo) {
135
- this._sealTote()
136
- } else {
137
- this._showToast({ message: i18next.t('text.tote_is_not_scanned') })
138
- }
139
- }
140
- }}"
141
- ></barcode-scanable-input>
142
- </fieldset>
143
-
144
- <label>${i18next.t('field.scanned')} (${this._totalSeal || 0})</label>
145
- <select name="sealNoList">
146
- <option value="">-- ${i18next.t('text.seal_number')} --</option>
147
- ${(this._sealNoList?.orderToteSeals || []).map(
148
- list => html` <option value="${list.name}">${list.name}</option> `
149
- )}
150
- </select>
151
- </form>
152
-
153
- <div class="grist-container">
154
- <div class="grist">
155
- <data-grist
156
- id="grist"
157
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
158
- .config=${this.config}
159
- .fetchHandler=${this.fetchOrderToteItems.bind(this)}
160
- ></data-grist>
161
- </div>
162
- </div>
163
-
164
- <div class="button-container">
165
- <mwc-button
166
- danger
167
- @click=${() => {
168
- this.dispatchEvent(
169
- new CustomEvent('completed', {
170
- detail: this._sealed ? '' : this.toteNo
171
- })
172
- )
173
- history.back()
174
- }}
175
- raised
176
- label="${i18next.t('button.back')}"
177
- ></mwc-button>
178
- </div>
179
- `
180
- }
181
-
182
- get grist() {
183
- return this.shadowRoot.querySelector('data-grist#grist')
184
- }
185
-
186
- get toteNoInput() {
187
- return this.shadowRoot.querySelector('barcode-scanable-input[name=toteNo]').shadowRoot.querySelector('input')
188
- }
189
-
190
- get sealNoInput() {
191
- return this.shadowRoot.querySelector('barcode-scanable-input[name=sealNo]').shadowRoot.querySelector('input')
192
- }
193
-
194
- _focusOnSealNoInput() {
195
- setTimeout(() => this.sealNoInput.focus(), 50)
196
- }
197
-
198
- _focusOnToteNoInput() {
199
- setTimeout(() => this.toteNoInput.focus(), 50)
200
- }
201
-
202
- async firstUpdated() {
203
- this.config = {
204
- pagination: { pages: [10, 20, 50, 100] },
205
- rows: {
206
- appendable: false
207
- },
208
- columns: [
209
- { type: 'gutter', gutterName: 'sequence' },
210
- {
211
- type: 'string',
212
- name: 'sku',
213
- header: i18next.t('field.sku'),
214
- width: 180
215
- },
216
- {
217
- type: 'string',
218
- name: 'packingType',
219
- header: i18next.t('field.packing_type'),
220
- width: 180
221
- },
222
- {
223
- type: 'string',
224
- name: 'pickedQty',
225
- header: i18next.t('field.picked_qty'),
226
- width: 180
227
- }
228
- ]
229
- }
230
-
231
- await this._fetchToteList()
232
- this._focusOnToteNoInput()
233
- }
234
-
235
- async fetchOrderToteItems({ sorters = [] }) {
236
- if (!this._selectedToteNo || this._selectedToteNo.length < 1) {
237
- this._totalSeal = 0
238
- this._sealNoList = null
239
- return {
240
- total: 0,
241
- records: []
242
- }
243
- }
244
-
245
- const sortings = sorters
246
-
247
- const response = await client.query({
248
- query: gql`
249
- query orderToteItems($toteNo: String!, $orderNo: String!, $sortings: [Sorting!]!) {
250
- orderToteItems(toteNo: $toteNo, orderNo: $orderNo, sortings: $sortings) {
251
- items {
252
- id
253
- name
254
- orderProduct {
255
- id
256
- product {
257
- id
258
- sku
259
- packingType
260
- }
261
- }
262
- qty
263
- }
264
- total
265
- }
266
- }
267
- `,
268
- variables: {
269
- toteNo: this._selectedToteNo[0].name,
270
- sortings,
271
- orderNo: this.orderNo
272
- }
273
- })
274
-
275
- if (!response.errors) {
276
- if (this._selectedToteNo) {
277
- this._sealNoList = this._toteNoList.find(itm => itm.name == this._selectedToteNo[0].name)
278
- this._totalSeal = this._sealNoList.orderToteSeals.length
279
- }
280
-
281
- if (this.toteNo && this.toteNo !== '') {
282
- this._focusOnSealNoInput()
283
- } else {
284
- this._focusOnToteNoInput()
285
- }
286
-
287
- return {
288
- total: response.data.orderToteItems.total || 0,
289
- records:
290
- response.data.orderToteItems.items.map(item => {
291
- return {
292
- ...item,
293
- sku: item.orderProduct.product.sku,
294
- packingType: item.orderProduct.product.packingType,
295
- pickedQty: item.qty
296
- }
297
- }) || []
298
- }
299
- }
300
- }
301
-
302
- async _checkToteAndOrderTote() {
303
- try {
304
- this.toteNo = this.toteNoInput.value
305
- let result = await this._checkIsSealed()
306
-
307
- if (result) {
308
- await this._checkToteAvailability()
309
- } else {
310
- this.toteNoInput.value = ''
311
- this.toteNo = ''
312
- }
313
- } catch (e) {
314
- this._showToast(e)
315
- }
316
-
317
- if (this.toteNo && this.toteNo !== '') {
318
- this._focusOnSealNoInput()
319
- } else {
320
- this._focusOnToteNoInput()
321
- }
322
- }
323
-
324
- async _sealTote() {
325
- try {
326
- const response = await client.mutate({
327
- mutation: gql`
328
- mutation sealTote($sealNo: String!, $toteNo: String!, $orderNo: String!) {
329
- sealTote(sealNo: $sealNo, toteNo: $toteNo, orderNo: $orderNo)
330
- }
331
- `,
332
- variables: {
333
- sealNo: this.sealNo,
334
- toteNo: this.toteNo,
335
- orderNo: this.orderNo
336
- }
337
- })
338
-
339
- if (!response.errors) {
340
- await this._checkIsSealed()
341
- this._selectedToteNo = ''
342
- this._toteNoList = null
343
- this._sealNoList = null
344
- await this._fetchToteList()
345
- await this.grist.fetch()
346
- this.sealNoInput.value = ''
347
- this.sealNo = ''
348
- this._focusOnSealNoInput()
349
- }
350
- } catch (e) {
351
- this._showToast(e)
352
- }
353
- }
354
-
355
- async _checkIsSealed() {
356
- try {
357
- const response = await client.query({
358
- query: gql`
359
- query checkOrderTote($name: String!, $orderNo: String!) {
360
- checkOrderTote(name: $name, orderNo: $orderNo)
361
- }
362
- `,
363
- variables: { name: this.toteNo, orderNo: this.orderNo }
364
- })
365
-
366
- if (!response.errors) {
367
- this._sealed = response.data.checkOrderTote
368
- return true
369
- }
370
- } catch (e) {
371
- this._showToast(e)
372
- return false
373
- }
374
- }
375
-
376
- async _checkToteAvailability() {
377
- try {
378
- const response = await client.query({
379
- query: gql`
380
- query checkToteStatus($name: String!, $bizplace: String!) {
381
- checkToteStatus(name: $name, bizplace: $bizplace)
382
- }
383
- `,
384
- variables: { name: this.toteNo, bizplace: this.bizplace }
385
- })
386
-
387
- if (!response.errors) {
388
- const status = response.data?.checkToteStatus
389
- if (status !== '') {
390
- if (status == TOTE_STATUS.DAMAGED.value) {
391
- this.toteNo = ''
392
- throw new Error(i18next.t('text.tote_is_damaged_please_scan_again'))
393
- }
394
-
395
- if (status == TOTE_STATUS.DISPATCHED.value) {
396
- this.toteNo = ''
397
- throw new Error(i18next.t('text.tote_is_dispatched_please_scan_again'))
398
- }
399
-
400
- this._showToast({ message: i18next.t('text.tote_carton_(x)_is_scanned', { x: this.toteNoInput?.value }) })
401
- } else if (this.toteNoInput?.value !== '') {
402
- this._showToast({ message: i18next.t('text.tote_box_(x)_is_scanned', { x: this.toteNoInput?.value }) })
403
- }
404
- }
405
- } catch (e) {
406
- this._showToast(e)
407
- } finally {
408
- this.toteNoInput.value = ''
409
- }
410
- }
411
-
412
- async _fetchToteList() {
413
- try {
414
- let filters = [{ name: 'releaseGoodNo', operator: 'eq', value: this.orderNo }]
415
-
416
- const response = await client.query({
417
- query: gql`
418
- query orderTotes($filters: [Filter!]!) {
419
- orderTotes(filters: $filters) {
420
- items {
421
- id
422
- name
423
- orderToteSeals {
424
- id
425
- name
426
- }
427
- }
428
- total
429
- }
430
- }
431
- `,
432
- variables: {
433
- filters
434
- }
435
- })
436
-
437
- if (!response.errors) {
438
- response.data?.orderTotes.items.map(itm => {
439
- itm.orderToteSeals.orderToteId = itm.id
440
- })
441
-
442
- this._toteNoList = response.data?.orderTotes.items
443
- }
444
- } catch (e) {
445
- this._showToast(e)
446
- }
447
- }
448
-
449
- _showToast({ type, message }) {
450
- document.dispatchEvent(
451
- new CustomEvent('notify', {
452
- detail: {
453
- type,
454
- message
455
- }
456
- })
457
- )
458
- }
459
- }
460
-
461
- window.customElements.define('tote-popup', TotePopup)
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mutation = void 0;
4
- const warehouse_intentory_adjustment_1 = require("./warehouse-intentory-adjustment");
5
- exports.Mutation = Object.assign({}, warehouse_intentory_adjustment_1.warehouseInventoryAdjustment);
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/warehouse-inventory-adjustment/index.ts"],"names":[],"mappings":";;;AAAA,qFAA+E;AAElE,QAAA,QAAQ,qBAChB,6DAA4B,EAChC"}
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.warehouseInventoryAdjustment = void 0;
4
- const warehouse_base_1 = require("@things-factory/warehouse-base");
5
- const typeorm_1 = require("typeorm");
6
- const sales_base_1 = require("@things-factory/sales-base");
7
- const worksheet_base_1 = require("@things-factory/worksheet-base");
8
- exports.warehouseInventoryAdjustment = {
9
- async warehouseInventoryAdjustment(_, { patches }, context) {
10
- try {
11
- const item = await (0, warehouse_base_1.approveInventoryChanges)(patches, context);
12
- // Retrieve order inventory
13
- const { tx } = context.state;
14
- const _inventoryChanges = await tx.getRepository(warehouse_base_1.InventoryChange).find({
15
- where: { id: (0, typeorm_1.In)(patches.map(item => item.id)) },
16
- relations: [
17
- 'inventory',
18
- 'inventory.bizplace',
19
- 'inventory.bizplace.domain',
20
- 'inventory.product',
21
- 'inventory.location',
22
- 'inventory.warehouse',
23
- 'bizplace',
24
- 'bizplace.domain',
25
- 'bizplace.company',
26
- 'bizplace.company.domain',
27
- 'product',
28
- 'product.productDetails',
29
- 'product.productDetails.childProductDetail',
30
- 'location'
31
- ],
32
- order: {
33
- createdAt: 'ASC'
34
- }
35
- });
36
- if (_inventoryChanges.length > 0) {
37
- const invId = _inventoryChanges
38
- .filter((ic) => ic.transactionType == 'MISSING')
39
- .map((ic) => ic.inventory.id);
40
- const orderInventory = await tx.getRepository(sales_base_1.OrderInventory).find({
41
- where: { inventory: (0, typeorm_1.In)(invId), status: 'PICKING' }
42
- });
43
- await tx.getRepository(sales_base_1.OrderInventory).update({
44
- inventory: (0, typeorm_1.In)(invId), status: "PICKING"
45
- }, { status: 'MISSING' });
46
- const orderInvId = orderInventory.map((oi) => oi.id);
47
- await tx.getRepository(worksheet_base_1.WorksheetDetail).update({
48
- targetInventory: (0, typeorm_1.In)(orderInvId), status: "EXECUTING"
49
- }, { status: 'MISSING' });
50
- }
51
- return item;
52
- }
53
- catch (error) {
54
- throw error;
55
- }
56
- }
57
- };
58
- //# sourceMappingURL=warehouse-intentory-adjustment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warehouse-intentory-adjustment.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.ts"],"names":[],"mappings":";;;AACA,mEAAyF;AACzF,qCAAyC;AACzC,2DAA2D;AAC3D,mEAAgE;AAEnD,QAAA,4BAA4B,GAAG;IAC1C,KAAK,CAAC,4BAA4B,CAAC,CAAM,EAAE,EAAE,OAAO,EAAE,EAAE,OAAY;QAClE,IAAI;YACF,MAAM,IAAI,GAAG,MAAM,IAAA,wCAAuB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YAE5D,2BAA2B;YAC3B,MAAM,EAAE,EAAE,EAAE,GAA0B,OAAO,CAAC,KAAK,CAAA;YAEnD,MAAM,iBAAiB,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,gCAAe,CAAC,CAAC,IAAI,CAAC;gBACrE,KAAK,EAAE,EAAE,EAAE,EAAE,IAAA,YAAE,EAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE;gBAC/C,SAAS,EAAE;oBACT,WAAW;oBACX,oBAAoB;oBACpB,2BAA2B;oBAC3B,mBAAmB;oBACnB,oBAAoB;oBACpB,qBAAqB;oBACrB,UAAU;oBACV,iBAAiB;oBACjB,kBAAkB;oBAClB,yBAAyB;oBACzB,SAAS;oBACT,wBAAwB;oBACxB,2CAA2C;oBAC3C,UAAU;iBACX;gBACD,KAAK,EAAE;oBACL,SAAS,EAAE,KAAK;iBACjB;aACF,CAAC,CAAA;YAEF,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;gBAChC,MAAM,KAAK,GAAU,iBAAiB;qBACnC,MAAM,CAAC,CAAC,EAAO,EAAE,EAAE,CAAC,EAAE,CAAC,eAAe,IAAI,SAAS,CAAC;qBACpD,GAAG,CAAC,CAAC,EAAO,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;gBAEpC,MAAM,cAAc,GAAqB,MAAM,EAAE,CAAC,aAAa,CAAC,2BAAc,CAAC,CAAC,IAAI,CAAC;oBACnF,KAAK,EAAE,EAAE,SAAS,EAAE,IAAA,YAAE,EAAC,KAAK,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE;iBACnD,CAAC,CAAA;gBAEF,MAAM,EAAE,CAAC,aAAa,CAAC,2BAAc,CAAC,CAAC,MAAM,CAC3C;oBACE,SAAS,EAAE,IAAA,YAAE,EAAC,KAAK,CAAC,EAAC,MAAM,EAAC,SAAS;iBACtC,EACD,EAAE,MAAM,EAAE,SAAS,EAAE,CACtB,CAAA;gBAED,MAAM,UAAU,GAAU,cAAc,CAAC,GAAG,CAAC,CAAC,EAAO,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;gBAEhE,MAAM,EAAE,CAAC,aAAa,CAAC,gCAAe,CAAC,CAAC,MAAM,CAC5C;oBACE,eAAe,EAAE,IAAA,YAAE,EAAC,UAAU,CAAC,EAAC,MAAM,EAAC,WAAW;iBACnD,EACD,EAAE,MAAM,EAAE,SAAS,EAAE,CACtB,CAAA;aACF;YACD,OAAO,IAAI,CAAA;SACZ;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF,CAAA"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mutation = void 0;
4
- exports.Mutation = `
5
- warehouseInventoryAdjustment (
6
- patches: [InventoryChangePatch]!
7
- ): InventoryChangeList @privilege(category: "inventory_adjustment_approval", privilege: "mutation") @transaction
8
- `;
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/warehouse-inventory-adjustment/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAiB;;;;CAIrC,CAAA"}
@@ -1,5 +0,0 @@
1
- import { warehouseInventoryAdjustment } from './warehouse-intentory-adjustment'
2
-
3
- export const Mutation = {
4
- ...warehouseInventoryAdjustment
5
- }
@@ -1,68 +0,0 @@
1
- import { EntityManager } from 'typeorm'
2
- import { InventoryChange, approveInventoryChanges } from '@things-factory/warehouse-base'
3
- import { In, Not, IsNull } from 'typeorm'
4
- import { OrderInventory } from '@things-factory/sales-base'
5
- import { WorksheetDetail } from '@things-factory/worksheet-base'
6
-
7
- export const warehouseInventoryAdjustment = {
8
- async warehouseInventoryAdjustment(_: any, { patches }, context: any) {
9
- try {
10
- const item = await approveInventoryChanges(patches, context)
11
-
12
- // Retrieve order inventory
13
- const { tx }: { tx: EntityManager } = context.state
14
-
15
- const _inventoryChanges = await tx.getRepository(InventoryChange).find({
16
- where: { id: In(patches.map(item => item.id)) },
17
- relations: [
18
- 'inventory',
19
- 'inventory.bizplace',
20
- 'inventory.bizplace.domain',
21
- 'inventory.product',
22
- 'inventory.location',
23
- 'inventory.warehouse',
24
- 'bizplace',
25
- 'bizplace.domain',
26
- 'bizplace.company',
27
- 'bizplace.company.domain',
28
- 'product',
29
- 'product.productDetails',
30
- 'product.productDetails.childProductDetail',
31
- 'location'
32
- ],
33
- order: {
34
- createdAt: 'ASC'
35
- }
36
- })
37
-
38
- if (_inventoryChanges.length > 0) {
39
- const invId: any[] = _inventoryChanges
40
- .filter((ic: any) => ic.transactionType == 'MISSING')
41
- .map((ic: any) => ic.inventory.id)
42
-
43
- const orderInventory: OrderInventory[] = await tx.getRepository(OrderInventory).find({
44
- where: { inventory: In(invId), status: 'PICKING' }
45
- })
46
-
47
- await tx.getRepository(OrderInventory).update(
48
- {
49
- inventory: In(invId),status:"PICKING"
50
- },
51
- { status: 'MISSING' }
52
- )
53
-
54
- const orderInvId: any[] = orderInventory.map((oi: any) => oi.id)
55
-
56
- await tx.getRepository(WorksheetDetail).update(
57
- {
58
- targetInventory: In(orderInvId),status:"EXECUTING"
59
- },
60
- { status: 'MISSING' }
61
- )
62
- }
63
- return item
64
- } catch (error) {
65
- throw error
66
- }
67
- }
68
- }
@@ -1,5 +0,0 @@
1
- export const Mutation = /* GraphQL */ `
2
- warehouseInventoryAdjustment (
3
- patches: [InventoryChangePatch]!
4
- ): InventoryChangeList @privilege(category: "inventory_adjustment_approval", privilege: "mutation") @transaction
5
- `