@things-factory/operato-wms 4.3.549 → 4.3.551

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.
@@ -0,0 +1,192 @@
1
+ import '@things-factory/grist-ui'
2
+
3
+ import {
4
+ css,
5
+ html,
6
+ LitElement
7
+ } from 'lit-element'
8
+ import { connect } from 'pwa-helpers/connect-mixin'
9
+
10
+ import { SingleColumnFormStyles } from '@things-factory/form-ui'
11
+ import {
12
+ i18next,
13
+ localize
14
+ } from '@things-factory/i18n-base'
15
+ import { store } from '@things-factory/shell'
16
+ import { isMobileDevice } from '@things-factory/utils'
17
+
18
+ class PutawaySameCartonPopup extends connect(store)(localize(i18next)(LitElement)) {
19
+ static get properties() {
20
+ return {
21
+ config: Object,
22
+ data: Object,
23
+ putawayInventories: Array
24
+ }
25
+ }
26
+
27
+ constructor() {
28
+ super()
29
+ this._selectedInventoryIds = []
30
+ }
31
+
32
+ static get styles() {
33
+ return [
34
+ SingleColumnFormStyles,
35
+ css`
36
+ .button-container {
37
+ padding: var(--button-container-padding);
38
+ margin: var(--button-container-margin);
39
+ text-align: var(--button-container-align);
40
+ background-color: var(--button-container-background);
41
+ height: var(--button-container-height);
42
+ }
43
+ .button-container button {
44
+ background-color: var(--button-container-button-background-color);
45
+ border-radius: var(--button-container-button-border-radius);
46
+ height: var(--button-container-button-height);
47
+ border: var(--button-container-button-border);
48
+ margin: var(--button-container-button-margin);
49
+
50
+ padding: var(--button-padding);
51
+ color: var(--theme-white-color);
52
+ font: var(--button-font);
53
+ text-transform: var(--button-text-transform);
54
+ }
55
+ .button-container button:hover,
56
+ .button-container button:active {
57
+ background-color: var(--button-background-focus-color);
58
+ }
59
+ data-grist {
60
+ overflow-y: hidden;
61
+ flex: 1;
62
+ }
63
+ .grist {
64
+ display: flex;
65
+ flex-direction: column;
66
+ flex: 1;
67
+ overflow-y: auto;
68
+ }
69
+ :host {
70
+ padding: 10px;
71
+ display: flex;
72
+ flex-direction: column;
73
+ overflow: hidden;
74
+ background-color: white;
75
+ }
76
+ `
77
+ ]
78
+ }
79
+
80
+ get dataGrist() {
81
+ return this.shadowRoot.querySelector('data-grist')
82
+ }
83
+
84
+ updated(changeProps) {
85
+ if (changeProps.has('putawayInventories')) {
86
+ if (this.putawayInventories && this.putawayInventories.length) {
87
+ this.data = { records: this.putawayInventories }
88
+ }
89
+ }
90
+ }
91
+
92
+ render() {
93
+ return html`
94
+ <div class="grist">
95
+ <data-grist
96
+ id="grist"
97
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
98
+ .config=${this.config}
99
+ .data="${this.data}"
100
+ ></data-grist>
101
+ </div>
102
+
103
+ <div class="button-container">
104
+ <mwc-button
105
+ raised
106
+ @click="${this._selectPutawayInventories.bind(this)}"
107
+ label="${i18next.t('button.select')}"
108
+ ></mwc-button>
109
+ </div>
110
+ `
111
+ }
112
+
113
+ firstUpdated() {
114
+ this.config = {
115
+ pagination: { infinite: true },
116
+ rows: { selectable: { multiple: false }, appendable: false },
117
+ list: { fields: ['palletId', 'cartonId', 'batchId', 'product', 'packingType', 'packingSize', 'qty', 'status'] },
118
+ columns: [
119
+ { type: 'gutter', gutterName: 'sequence' },
120
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
121
+ { name: 'id', hidden: true },
122
+ {
123
+ type: 'string',
124
+ name: 'cartonId',
125
+ label: true,
126
+ header: i18next.t('field.carton_id'),
127
+ width: 150
128
+ },
129
+ {
130
+ type: 'object',
131
+ name: 'product',
132
+ label: true,
133
+ header: i18next.t('field.product'),
134
+ width: 250
135
+ },
136
+ {
137
+ type: 'string',
138
+ name: 'batchId',
139
+ label: true,
140
+ header: i18next.t('field.batch_id'),
141
+ width: 150
142
+ },
143
+ {
144
+ type: 'string',
145
+ name: 'packingType',
146
+ label: true,
147
+ header: i18next.t('field.packing_type'),
148
+ width: 120
149
+ },
150
+ {
151
+ type: 'integer',
152
+ name: 'packingSize',
153
+ label: true,
154
+ header: i18next.t('field.packing_size'),
155
+ width: 100
156
+ },
157
+ {
158
+ type: 'integer',
159
+ name: 'qty',
160
+ label: true,
161
+ header: i18next.t('field.qty'),
162
+ width: 100
163
+ }
164
+ ]
165
+ }
166
+ }
167
+
168
+ async _selectPutawayInventories() {
169
+ try {
170
+ let selectedInventories = this.dataGrist.selected
171
+ if (!selectedInventories) throw new Error(i18next.t('text.select_at_least_one_inventory_to_putaway'))
172
+
173
+ this.dispatchEvent(new CustomEvent('selections', { detail: selectedInventories }))
174
+ history.back()
175
+ } catch (e) {
176
+ this._showToast(e)
177
+ }
178
+ }
179
+
180
+ _showToast({ type, message }) {
181
+ document.dispatchEvent(
182
+ new CustomEvent('notify', {
183
+ detail: {
184
+ type,
185
+ message
186
+ }
187
+ })
188
+ )
189
+ }
190
+ }
191
+
192
+ window.customElements.define('putaway-replenishment-same-product-popup', PutawaySameCartonPopup)
@@ -1,24 +1,11 @@
1
1
  import gql from 'graphql-tag'
2
- import {
3
- css,
4
- html,
5
- LitElement
6
- } from 'lit-element'
7
-
8
- import {
9
- i18next,
10
- localize
11
- } from '@things-factory/i18n-base'
12
- import {
13
- client,
14
- CustomAlert
15
- } from '@things-factory/shell'
2
+ import { css, html, LitElement } from 'lit-element'
3
+
4
+ import { i18next, localize } from '@things-factory/i18n-base'
5
+ import { client, CustomAlert } from '@things-factory/shell'
16
6
  import { isMobileDevice } from '@things-factory/utils'
17
7
 
18
- import {
19
- INVENTORY_STATUS,
20
- ORDER_INVENTORY_STATUS
21
- } from '../constants'
8
+ import { INVENTORY_STATUS, ORDER_INVENTORY_STATUS } from '../../constants'
22
9
 
23
10
  class PutawayWorksheetGeneratePopup extends localize(i18next)(LitElement) {
24
11
  static get properties() {
@@ -104,15 +91,17 @@ class PutawayWorksheetGeneratePopup extends localize(i18next)(LitElement) {
104
91
  render() {
105
92
  return html`
106
93
  <div class="grist">
107
- ${this.crossDocking
108
- ? html` <h2><mwc-icon>list_alt</mwc-icon>${i18next.t('title.cross_docking')}</h2>
109
- <data-grist
110
- id="cross-dock-grist"
111
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
112
- .config=${this.crossDockGristConfig}
113
- .data="${this.crossDockGristData}"
114
- ></data-grist>`
115
- : ''}
94
+ ${
95
+ this.crossDocking
96
+ ? html` <h2><mwc-icon>list_alt</mwc-icon>${i18next.t('title.cross_docking')}</h2>
97
+ <data-grist
98
+ id="cross-dock-grist"
99
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
100
+ .config=${this.crossDockGristConfig}
101
+ .data="${this.crossDockGristData}"
102
+ ></data-grist>`
103
+ : ''
104
+ }
116
105
 
117
106
  <h2><mwc-icon>list_alt</mwc-icon>${i18next.t('title.unloaded_pallets')}</h2>
118
107
  <data-grist
@@ -413,30 +402,29 @@ class PutawayWorksheetGeneratePopup extends localize(i18next)(LitElement) {
413
402
  return { id: record.id }
414
403
  })
415
404
 
416
-
417
405
  if (!this._isExecuting) {
418
406
  this._isExecuting = true
419
- const response = await client.mutate({
420
- mutation: gql`
421
- mutation generatePartialPutawayWorksheet($arrivalNoticeNo: String!, $inventories: [InventoryPatch]!) {
422
- generatePartialPutawayWorksheet(arrivalNoticeNo: $arrivalNoticeNo, inventories: $inventories)
423
- }
424
- `,
425
- variables: { arrivalNoticeNo: this.arrivalNotice.name, inventories }
426
- })
427
-
428
-
429
- if (!response.errors) {
430
- await CustomAlert({
431
- title: i18next.t('title.completed'),
432
- text: i18next.t('text.generate_putaway_worksheet'),
433
- confirmButton: { text: i18next.t('button.confirm') }
407
+ const response = await client.mutate({
408
+ mutation: gql`
409
+ mutation generatePartialPutawayWorksheet($arrivalNoticeNo: String!, $inventories: [InventoryPatch]!) {
410
+ generatePartialPutawayWorksheet(arrivalNoticeNo: $arrivalNoticeNo, inventories: $inventories)
411
+ }
412
+ `,
413
+ variables: { arrivalNoticeNo: this.arrivalNotice.name, inventories }
434
414
  })
435
415
 
436
- this.dispatchEvent(new CustomEvent('completed'))
437
- history.back()
416
+ if (!response.errors) {
417
+ await CustomAlert({
418
+ title: i18next.t('title.completed'),
419
+ text: i18next.t('text.generate_putaway_worksheet'),
420
+ confirmButton: { text: i18next.t('button.confirm') }
421
+ })
422
+
423
+ this.dispatchEvent(new CustomEvent('completed'))
424
+ history.back()
425
+ }
438
426
  }
439
- }}
427
+ }
440
428
 
441
429
  if (this.returnOrder) {
442
430
  if (!this.returnOrder || !this.returnOrder.name) return
@@ -452,7 +440,7 @@ class PutawayWorksheetGeneratePopup extends localize(i18next)(LitElement) {
452
440
  const inventories = this.inventoryGrist.selected.map(record => {
453
441
  return { id: record.id }
454
442
  })
455
-
443
+
456
444
  const response = await client.mutate({
457
445
  mutation: gql`
458
446
  mutation generatePartialPutawayReturnWorksheet($returnOrderNo: String!, $inventories: [InventoryPatch]!) {
@@ -467,10 +455,11 @@ class PutawayWorksheetGeneratePopup extends localize(i18next)(LitElement) {
467
455
  title: i18next.t('title.completed'),
468
456
  text: i18next.t('text.generate_putaway_worksheet'),
469
457
  confirmButton: { text: i18next.t('button.confirm') }
470
- })}
458
+ })
459
+ }
471
460
 
472
- this.dispatchEvent(new CustomEvent('completed'))
473
- history.back()
461
+ this.dispatchEvent(new CustomEvent('completed'))
462
+ history.back()
474
463
  }
475
464
  } catch (e) {
476
465
  this._showToast(e)
@@ -1,31 +1,15 @@
1
1
  import '@things-factory/grist-ui'
2
2
 
3
3
  import gql from 'graphql-tag'
4
- import {
5
- css,
6
- html,
7
- LitElement
8
- } from 'lit-element'
4
+ import { css, html, LitElement } from 'lit-element'
9
5
  import { connect } from 'pwa-helpers/connect-mixin'
10
6
 
11
7
  import { SingleColumnFormStyles } from '@things-factory/form-ui'
12
- import {
13
- i18next,
14
- localize
15
- } from '@things-factory/i18n-base'
16
- import {
17
- client,
18
- CustomAlert,
19
- store
20
- } from '@things-factory/shell'
8
+ import { i18next, localize } from '@things-factory/i18n-base'
9
+ import { client, CustomAlert, store } from '@things-factory/shell'
21
10
  import { isMobileDevice } from '@things-factory/utils'
22
11
 
23
- import {
24
- ARRIVAL_NOTICE,
25
- CUSTOMER_RETURN,
26
- REPLENISHMENT,
27
- WAREHOUSE_RETURN
28
- } from '../constants'
12
+ import { ARRIVAL_NOTICE, CUSTOMER_RETURN, REPLENISHMENT, WAREHOUSE_RETURN } from '../../constants'
29
13
 
30
14
  const AVAIL_ORDER_TYPES = { ARRIVAL_NOTICE, CUSTOMER_RETURN, WAREHOUSE_RETURN, REPLENISHMENT }
31
15
 
@@ -37,6 +21,8 @@ class UndoPutawayPopup extends connect(store)(localize(i18next)(LitElement)) {
37
21
  config: Object,
38
22
  data: Object,
39
23
  enableCartonLabel: Boolean,
24
+ enableProductScanning: Boolean,
25
+ replenishmentId: String,
40
26
  orderType: String,
41
27
  orderNo: String,
42
28
  putawayInventories: Array
@@ -119,20 +105,20 @@ class UndoPutawayPopup extends connect(store)(localize(i18next)(LitElement)) {
119
105
  <fieldset>
120
106
  ${this.enableCartonLabel
121
107
  ? html`<label>${i18next.t('label.carton_id')}</label>
122
- <barcode-scanable-input
123
- name="cartonId"
124
- custom-input
125
- @keypress="${ e=> {
126
- this._populateTargetedInventory(e)
127
- }}"
108
+ <barcode-scanable-input
109
+ name="cartonId"
110
+ custom-input
111
+ @keypress="${e => {
112
+ this._populateTargetedInventory(e)
113
+ }}"
128
114
  ></barcode-scanable-input>`
129
115
  : html`<label>${i18next.t('label.lot_id')}</label>
130
- <barcode-scanable-input
131
- name="lotId"
132
- custom-input
133
- @keypress="${ e=> {
134
- this._populateTargetedInventory(e)
135
- }}"
116
+ <barcode-scanable-input
117
+ name="lotId"
118
+ custom-input
119
+ @keypress="${e => {
120
+ this._populateTargetedInventory(e)
121
+ }}"
136
122
  ></barcode-scanable-input>`}
137
123
  </fieldset>
138
124
  </form>
@@ -254,16 +240,39 @@ class UndoPutawayPopup extends connect(store)(localize(i18next)(LitElement)) {
254
240
  }
255
241
  }
256
242
 
257
- _populateTargetedInventory(e) {
243
+ async _populateTargetedInventory(e) {
258
244
  if (e.keyCode === 13) {
259
245
  e.preventDefault()
260
246
 
261
247
  let targetedUndoInventories = []
262
248
 
263
249
  if (this.enableCartonLabel) {
264
- targetedUndoInventories = this.putawayInventories.filter(
265
- inventory => inventory.cartonId === this.cartonInput?.value
266
- )
250
+ if (this.enableProductScanning && this.orderType === AVAIL_ORDER_TYPES.REPLENISHMENT.value) {
251
+ let inventories = await this._getReplenishedInventories()
252
+ const matchedInventories = inventories.filter(
253
+ inventory => inventory.cartonId === this.cartonInput?.value
254
+ )
255
+
256
+ if (matchedInventories.length > 0) {
257
+ targetedUndoInventories = this.putawayInventories
258
+ .filter(
259
+ inventory => matchedInventories.some(inv => inventory.cartonId === inv.refInventory?.cartonId)
260
+ )
261
+ .map( inventory => {
262
+ return {
263
+ ...inventory,
264
+ newCartonId: matchedInventories[0].cartonId
265
+ }}
266
+ )
267
+ } else {
268
+ targetedUndoInventories = []
269
+ }
270
+
271
+ } else {
272
+ targetedUndoInventories = this.putawayInventories.filter(
273
+ inventory => inventory.cartonId === this.cartonInput?.value
274
+ )
275
+ }
267
276
  } else {
268
277
  targetedUndoInventories = this.putawayInventories.filter(
269
278
  inventory => inventory.palletId === this.lotInput?.value
@@ -286,6 +295,34 @@ class UndoPutawayPopup extends connect(store)(localize(i18next)(LitElement)) {
286
295
  }
287
296
  }
288
297
 
298
+ async _getReplenishedInventories() {
299
+ const replenishmentId = this.replenishmentId
300
+ const inventoryIds = this.putawayInventories.map(inventory => inventory.inventoryId)
301
+
302
+ const response = await client.query({
303
+ query: gql`
304
+ query putawayReplenishmentInventories($replenishmentId: String!, $inventoryId: [String!]!) {
305
+ putawayReplenishmentInventories(replenishmentId: $replenishmentId, inventoryId: $inventoryId) {
306
+ items {
307
+ cartonId
308
+ refInventory {
309
+ cartonId
310
+ }
311
+ }
312
+ }
313
+ }
314
+ `,
315
+ variables: {
316
+ replenishmentId: replenishmentId,
317
+ inventoryId: inventoryIds
318
+ }
319
+ })
320
+
321
+ if (!response.errors) {
322
+ return response.data.putawayReplenishmentInventories.items || []
323
+ }
324
+ }
325
+
289
326
  async _undoArrivalNoticePutaway(selectedInventories) {
290
327
  try {
291
328
  if (selectedInventories.length > 1) {
@@ -373,6 +410,10 @@ class UndoPutawayPopup extends connect(store)(localize(i18next)(LitElement)) {
373
410
  }
374
411
  }
375
412
 
413
+ const cartonId = this.enableCartonLabel
414
+ ? (this.enableProductScanning ? selectedInventories[0].newCartonId : selectedInventories[0].cartonId)
415
+ : null
416
+
376
417
  const response = await client.mutate({
377
418
  mutation: gql`
378
419
  mutation undoReplenishmentPutaway($worksheetDetailName: [String]!, $cartonId: String) {
@@ -381,7 +422,7 @@ class UndoPutawayPopup extends connect(store)(localize(i18next)(LitElement)) {
381
422
  `,
382
423
  variables: {
383
424
  worksheetDetailName: selectedInventories.map(inventory => inventory.name),
384
- cartonId: this.enableCartonLabel ? selectedInventories[0].cartonId : null
425
+ cartonId: cartonId
385
426
  }
386
427
  })
387
428
 
@@ -7,7 +7,7 @@ import { CommonButtonStyles } from '@things-factory/styles'
7
7
  import { isMobileDevice } from '@things-factory/utils'
8
8
  import gql from 'graphql-tag'
9
9
  import { css, html } from 'lit-element'
10
- import { WORKSHEET_STATUS } from '../constants'
10
+ import { WORKSHEET_STATUS } from '../../constants'
11
11
 
12
12
  class WorksheetPutawayReturn extends localize(i18next)(PageView) {
13
13
  static get properties() {
@@ -17,7 +17,7 @@ import {
17
17
  VAS_ETC_TYPE,
18
18
  VAS_PRODUCT_TYPE,
19
19
  WORKSHEET_STATUS
20
- } from '../constants'
20
+ } from '../../constants'
21
21
 
22
22
  //vas --inbound
23
23
  class WorksheetPutaway extends localize(i18next)(PageView) {
@@ -12,7 +12,7 @@ import { fetchSettingRule } from '../../fetch-setting-value'
12
12
  import { WORKSHEET_STATUS } from '../constants'
13
13
  import './carton-label-popup'
14
14
  import './pallet-label-popup'
15
- import './putaway-worksheet-generate-popup'
15
+ import './putaway/putaway-worksheet-generate-popup'
16
16
 
17
17
  class WorksheetUnloadingReturn extends localize(i18next)(PageView) {
18
18
  static get properties() {
@@ -5,7 +5,7 @@ import '../vas/related-vas-list'
5
5
  import './adjust-pallet-qty'
6
6
  import './carton-label-popup'
7
7
  import './pallet-label-popup'
8
- import './putaway-worksheet-generate-popup'
8
+ import './putaway/putaway-worksheet-generate-popup'
9
9
 
10
10
  import gql from 'graphql-tag'
11
11
  import { css, html } from 'lit-element'
@@ -592,7 +592,6 @@ class WorksheetUnloading extends localize(i18next)(PageView) {
592
592
  .sort((a, b) => {
593
593
  const skuComparison = a.product.sku.localeCompare(b.product.sku)
594
594
  if (skuComparison !== 0) {
595
-
596
595
  return skuComparison
597
596
  }
598
597
  return a.targetProduct.batchId.localeCompare(b.targetProduct.batchId)