@things-factory/operato-wms 4.3.2 → 4.4.0-alpha.0

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 (96) 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/putaway-product.js +1 -3
  4. package/client/pages/inbound/unload-product.js +11 -21
  5. package/client/pages/inventory/inventory-adjustment-approval.js +9 -24
  6. package/client/pages/inventory/inventory-adjustment.js +13 -79
  7. package/client/pages/master/product/product-list.js +1 -1
  8. package/client/pages/order/arrival-notice/arrival-notice-detail.js +2 -0
  9. package/client/pages/order/arrival-notice/receive-arrival-notice.js +2 -0
  10. package/client/pages/order/goods-received-note/customer-received-note.js +0 -3
  11. package/client/pages/order/goods-received-note/received-note-detail.js +0 -3
  12. package/client/pages/order/release-order/b2c/b2c-order-requests.js +30 -21
  13. package/client/pages/order/release-order/bulk-print-packing-list.js +0 -4
  14. package/client/pages/order/release-order/receive-release-order-request.js +2 -0
  15. package/client/pages/order/release-order/release-order-detail.js +26 -44
  16. package/client/pages/order/return-order/receive-return-order-requests.js +2 -0
  17. package/client/pages/order/transfer-order/receive-transfer-order-request.js +1 -1
  18. package/client/pages/order/transport-order/print-delivery-note.js +1 -0
  19. package/client/pages/order/transport-order/view-delivery-note.js +1 -1
  20. package/client/pages/order/vas-order/receive-vas-order.js +2 -0
  21. package/client/pages/outbound/inventory-assign-popup.js +2 -7
  22. package/client/pages/outbound/inventory-auto-assign-popup.js +1 -2
  23. package/client/pages/outbound/loading-product.js +11 -49
  24. package/client/pages/outbound/packing-product.js +6 -42
  25. package/client/pages/outbound/packing-worksheet-list.js +0 -15
  26. package/client/pages/outbound/picking-product.js +13 -150
  27. package/client/pages/outbound/single-outbound-worksheet.js +22 -10
  28. package/client/pages/outbound/sorting-product.js +15 -78
  29. package/client/pages/outbound/worksheet-batch-picking.js +2 -9
  30. package/client/pages/outbound/worksheet-packing.js +2 -7
  31. package/client/pages/outbound/worksheet-picking.js +2 -9
  32. package/client/pages/report/inventory-summary-report.js +0 -8
  33. package/client/pages/report/outbound-order-details-report.js +0 -18
  34. package/client/pages/vas/abstract-execute-vas.js +7 -12
  35. package/client/pages/vas/print-product-label.js +6 -15
  36. package/client/pages/vas/reverse-kitting/execute-reverse-kitting.js +1 -3
  37. package/client/pages/vas/reverse-kitting/popup-reverse-kitting-template.js +1 -3
  38. package/client/route.js +0 -12
  39. package/dist-server/entities/index.js +1 -2
  40. package/dist-server/entities/index.js.map +1 -1
  41. package/dist-server/graphql/index.js +5 -1
  42. package/dist-server/graphql/index.js.map +1 -1
  43. package/dist-server/graphql/resolvers/board-setting/board-settings.js +1 -2
  44. package/dist-server/graphql/resolvers/board-setting/board-settings.js.map +1 -1
  45. package/dist-server/graphql/resolvers/index.js +7 -4
  46. package/dist-server/graphql/resolvers/index.js.map +1 -1
  47. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +1 -3
  48. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  49. package/dist-server/graphql/types/index.js +8 -5
  50. package/dist-server/graphql/types/index.js.map +1 -1
  51. package/dist-server/graphql/types/reports/outbound-order-details-report.js +0 -2
  52. package/dist-server/graphql/types/reports/outbound-order-details-report.js.map +1 -1
  53. package/dist-server/index.js +5 -2
  54. package/dist-server/index.js.map +1 -1
  55. package/dist-server/opa-app-setting-constants.js +1 -2
  56. package/dist-server/opa-app-setting-constants.js.map +1 -1
  57. package/dist-server/utils/index.js +5 -1
  58. package/dist-server/utils/index.js.map +1 -1
  59. package/helps/release-note.ko.md +9 -11
  60. package/helps/release-note.md +9 -11
  61. package/helps/release-note.ms.md +9 -11
  62. package/helps/release-note.zh.md +9 -11
  63. package/package.json +50 -50
  64. package/server/entities/index.ts +2 -2
  65. package/server/graphql/resolvers/board-setting/board-settings.ts +2 -4
  66. package/server/graphql/resolvers/index.ts +2 -3
  67. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +2 -6
  68. package/server/graphql/types/index.ts +4 -4
  69. package/server/graphql/types/reports/outbound-order-details-report.ts +0 -2
  70. package/server/index.ts +1 -2
  71. package/server/opa-app-setting-constants.ts +0 -1
  72. package/things-factory.config.js +0 -13
  73. package/translations/en.json +8 -48
  74. package/translations/ko.json +1 -35
  75. package/translations/ms.json +1 -35
  76. package/translations/zh.json +1 -35
  77. package/client/constants/index.js +0 -1
  78. package/client/constants/order.js +0 -14
  79. package/client/pages/constants/tote.js +0 -14
  80. package/client/pages/master/tote-list.js +0 -740
  81. package/client/pages/order/draft-release-good/draft-release-good-detail.js +0 -1163
  82. package/client/pages/order/draft-release-good/draft-release-good-list.js +0 -546
  83. package/client/pages/outbound/order-remark-popup.js +0 -112
  84. package/client/pages/outbound/tote-popup.js +0 -461
  85. package/dist-server/entities/warehouse-bizplace-onhand-inventory.js +0 -168
  86. package/dist-server/entities/warehouse-bizplace-onhand-inventory.js.map +0 -1
  87. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/index.js +0 -6
  88. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/index.js.map +0 -1
  89. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js +0 -58
  90. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js.map +0 -1
  91. package/dist-server/graphql/types/warehouse-inventory-adjustment/index.js +0 -9
  92. package/dist-server/graphql/types/warehouse-inventory-adjustment/index.js.map +0 -1
  93. package/server/entities/warehouse-bizplace-onhand-inventory.ts +0 -141
  94. package/server/graphql/resolvers/warehouse-inventory-adjustment/index.ts +0 -5
  95. package/server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.ts +0 -68
  96. 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,168 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.WarehouseBizplaceOnhandInventory = void 0;
13
- const typeorm_1 = require("typeorm");
14
- let WarehouseBizplaceOnhandInventory = class WarehouseBizplaceOnhandInventory {
15
- };
16
- __decorate([
17
- (0, typeorm_1.ViewColumn)(),
18
- __metadata("design:type", String)
19
- ], WarehouseBizplaceOnhandInventory.prototype, "domainName", void 0);
20
- __decorate([
21
- (0, typeorm_1.ViewColumn)(),
22
- __metadata("design:type", String)
23
- ], WarehouseBizplaceOnhandInventory.prototype, "bizplaceName", void 0);
24
- __decorate([
25
- (0, typeorm_1.ViewColumn)(),
26
- __metadata("design:type", String)
27
- ], WarehouseBizplaceOnhandInventory.prototype, "domainId", void 0);
28
- __decorate([
29
- (0, typeorm_1.ViewColumn)(),
30
- __metadata("design:type", String)
31
- ], WarehouseBizplaceOnhandInventory.prototype, "bizplaceId", void 0);
32
- __decorate([
33
- (0, typeorm_1.ViewColumn)(),
34
- __metadata("design:type", String)
35
- ], WarehouseBizplaceOnhandInventory.prototype, "packingType", void 0);
36
- __decorate([
37
- (0, typeorm_1.ViewColumn)(),
38
- __metadata("design:type", Number)
39
- ], WarehouseBizplaceOnhandInventory.prototype, "packingSize", void 0);
40
- __decorate([
41
- (0, typeorm_1.ViewColumn)(),
42
- __metadata("design:type", String)
43
- ], WarehouseBizplaceOnhandInventory.prototype, "uom", void 0);
44
- __decorate([
45
- (0, typeorm_1.ViewColumn)(),
46
- __metadata("design:type", String)
47
- ], WarehouseBizplaceOnhandInventory.prototype, "productId", void 0);
48
- __decorate([
49
- (0, typeorm_1.ViewColumn)(),
50
- __metadata("design:type", String)
51
- ], WarehouseBizplaceOnhandInventory.prototype, "productBundleId", void 0);
52
- __decorate([
53
- (0, typeorm_1.ViewColumn)(),
54
- __metadata("design:type", Number)
55
- ], WarehouseBizplaceOnhandInventory.prototype, "remainQty", void 0);
56
- __decorate([
57
- (0, typeorm_1.ViewColumn)(),
58
- __metadata("design:type", Number)
59
- ], WarehouseBizplaceOnhandInventory.prototype, "remainUomValue", void 0);
60
- __decorate([
61
- (0, typeorm_1.ViewColumn)(),
62
- __metadata("design:type", String)
63
- ], WarehouseBizplaceOnhandInventory.prototype, "groupType", void 0);
64
- WarehouseBizplaceOnhandInventory = __decorate([
65
- (0, typeorm_1.ViewEntity)({
66
- expression: `
67
- select d.name as "domainName", b.name as "bizplaceName", src.* from (
68
- WITH oi as (
69
- select
70
- oi.domain_id,
71
- oi.bizplace_id,
72
- SUM(oi.release_qty) AS release_qty,
73
- SUM(oi.release_uom_value) AS release_uom_value,
74
- oi.batch_id,
75
- oi.batch_id_ref,
76
- oi.product_id,
77
- oi.packing_type,
78
- oi.packing_size,
79
- oi.uom
80
- FROM
81
- order_inventories oi
82
- WHERE
83
- (oi.status = 'PENDING' or oi.status = 'PENDING_RECEIVE' or oi.status = 'PENDING_WORKSHEET' or oi.status = 'PENDING_SPLIT')
84
- AND oi.batch_id NOTNULL
85
- AND oi.product_id NOTNULL
86
- AND oi.packing_type NOTNULL
87
- AND oi.packing_size NOTNULL
88
- AND oi.inventory_id IS NULL
89
- GROUP BY
90
- oi.domain_id,
91
- oi.bizplace_id,
92
- oi.batch_id,
93
- oi.batch_id_ref,
94
- oi.product_id,
95
- oi.packing_type,
96
- oi.packing_size,
97
- oi.uom
98
- )
99
- -- SINGLE ITEM INVENTORY QUERY
100
- select
101
- i.domain_id as "domainId",
102
- i.bizplace_id as "bizplaceId",
103
- i.packing_type as "packingType",
104
- i.packing_size as "packingSize",
105
- i.uom,
106
- i.product_id as "productId",
107
- null as "productBundleId",
108
- COALESCE(SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0))) AS "remainQty",
109
- COALESCE(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)), 0) AS "remainUomValue",
110
- 'SINGLE' AS "groupType"
111
- FROM inventories i
112
- INNER JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id AND l2.type NOT IN ('QUARANTINE', 'RESERVE')
113
- LEFT JOIN oi ON i.batch_id = oi.batch_id AND i.product_id = oi.product_id AND i.packing_type = oi.packing_type AND i.packing_size = oi.packing_size AND i.uom = oi.uom
114
- WHERE i.status = 'STORED'
115
- GROUP by
116
- i.domain_id,
117
- i.bizplace_id,
118
- i.product_id,
119
- i.packing_type,
120
- i.packing_size,
121
- i.uom
122
- union all
123
- -- BUNDLE ITEM INVENTORY QUERY
124
- SELECT
125
- pbs.domain_id as "domainId",
126
- pbs.bizplace_id as "bizplaceId",
127
- pb.packing_type as "packingType",
128
- pb.packing_size as "packingSize",
129
- 'UNIT' AS "uom",
130
- null as "productId",
131
- pb.id AS "productBundleId",
132
- COALESCE(MIN(FLOOR(pbs."availableQty")),0) AS "remainQty",
133
- COALESCE(MIN(FLOOR(pbs."availableUomValue")),0) AS "remainUomValue",
134
- 'BUNDLE' AS "groupType"
135
- FROM product_bundles pb
136
- INNER JOIN (
137
- SELECT i.domain_id, i.bizplace_id, pbs.product_id, pbs.product_bundle_id, min(pbs.bundle_qty),
138
- (SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0))) / min(pbs.bundle_qty) AS "availableQty",
139
- (SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0))) / min(pbs.bundle_qty) AS "availableUomValue"
140
- FROM product_bundle_settings pbs
141
- LEFT JOIN inventories i ON i.product_id = pbs.product_id AND i.status = 'STORED'
142
- INNER JOIN locations l ON i.location_id = l.id AND i.domain_id = l.domain_id AND l.type NOT IN ('QUARANTINE', 'RESERVE')
143
- LEFT JOIN oi ON oi.product_id = i.product_id
144
- GROUP by
145
- i.domain_id,
146
- i.bizplace_id,
147
- pbs.product_id,
148
- pbs.product_bundle_id
149
- ) pbs ON pbs.product_bundle_id = pb.id
150
- GROUP BY
151
- pbs.domain_id,
152
- pbs.bizplace_id,
153
- pb.packing_type,
154
- pb.packing_size,
155
- pb.name,
156
- pb.sku,
157
- pb.id
158
- )
159
- AS src
160
- inner join domains d on d.id = src."domainId"
161
- inner join bizplaces b on b.id = src."bizplaceId"
162
- where src."remainQty" > 0
163
- order by src."domainId"
164
- `
165
- })
166
- ], WarehouseBizplaceOnhandInventory);
167
- exports.WarehouseBizplaceOnhandInventory = WarehouseBizplaceOnhandInventory;
168
- //# sourceMappingURL=warehouse-bizplace-onhand-inventory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warehouse-bizplace-onhand-inventory.js","sourceRoot":"","sources":["../../server/entities/warehouse-bizplace-onhand-inventory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgD;AAwGhD,IAAa,gCAAgC,GAA7C,MAAa,gCAAgC;CAoC5C,CAAA;AAlCC;IADC,IAAA,oBAAU,GAAE;;oEACK;AAGlB;IADC,IAAA,oBAAU,GAAE;;sEACO;AAGpB;IADC,IAAA,oBAAU,GAAE;;kEACG;AAGhB;IADC,IAAA,oBAAU,GAAE;;oEACK;AAGlB;IADC,IAAA,oBAAU,GAAE;;qEACM;AAGnB;IADC,IAAA,oBAAU,GAAE;;qEACM;AAGnB;IADC,IAAA,oBAAU,GAAE;;6DACF;AAGX;IADC,IAAA,oBAAU,GAAE;;mEACI;AAGjB;IADC,IAAA,oBAAU,GAAE;;yEACU;AAGvB;IADC,IAAA,oBAAU,GAAE;;mEACI;AAGjB;IADC,IAAA,oBAAU,GAAE;;wEACS;AAGtB;IADC,IAAA,oBAAU,GAAE;;mEACI;AAnCN,gCAAgC;IAtG5C,IAAA,oBAAU,EAAC;QACV,UAAU,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGX;KACF,CAAC;GAEW,gCAAgC,CAoC5C;AApCY,4EAAgC"}
@@ -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