@things-factory/operato-wms 4.3.356 → 4.3.358

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 (40) hide show
  1. package/client/pages/components/select-cc-product-popup.js +321 -0
  2. package/client/pages/constants/order.js +15 -0
  3. package/client/pages/inventory-check/add-extra-inventory-popup.js +306 -0
  4. package/client/pages/inventory-check/check-inventory-popup.js +183 -167
  5. package/client/pages/inventory-check/create-cycle-count.js +292 -141
  6. package/client/pages/inventory-check/cycle-count-inventory-details-popup.js +282 -0
  7. package/client/pages/inventory-check/cycle-count-recheck-popup.js +129 -31
  8. package/client/pages/inventory-check/cycle-count-report.js +425 -306
  9. package/client/pages/inventory-check/cycle-count-review.js +742 -0
  10. package/client/pages/inventory-check/cycle-count-worksheet-list.js +476 -0
  11. package/client/pages/inventory-check/inspecting-product.js +954 -1029
  12. package/client/pages/inventory-check/inventory-check-detail.js +378 -0
  13. package/client/pages/inventory-check/inventory-check-list.js +35 -109
  14. package/client/pages/inventory-check/relocate-inventory-popup.js +222 -0
  15. package/client/pages/inventory-check/search-popup.js +1 -1
  16. package/client/pages/inventory-check/select-cc-location-popup.js +230 -0
  17. package/client/pages/inventory-check/worksheet-cycle-count.js +112 -90
  18. package/client/pages/outbound/route-label-popup.js +16 -0
  19. package/client/route.js +8 -0
  20. package/dist-server/graphql/resolvers/reports/cycle-count-report.js +244 -0
  21. package/dist-server/graphql/resolvers/reports/cycle-count-report.js.map +1 -0
  22. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  23. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  24. package/dist-server/graphql/types/reports/cycle-count-report-list.js +14 -0
  25. package/dist-server/graphql/types/reports/cycle-count-report-list.js.map +1 -0
  26. package/dist-server/graphql/types/reports/cycle-count-report.js +25 -0
  27. package/dist-server/graphql/types/reports/cycle-count-report.js.map +1 -0
  28. package/dist-server/graphql/types/reports/index.js +5 -0
  29. package/dist-server/graphql/types/reports/index.js.map +1 -1
  30. package/package.json +6 -6
  31. package/server/graphql/resolvers/reports/cycle-count-report.ts +267 -0
  32. package/server/graphql/resolvers/reports/index.ts +3 -4
  33. package/server/graphql/types/reports/cycle-count-report-list.ts +8 -0
  34. package/server/graphql/types/reports/cycle-count-report.ts +19 -0
  35. package/server/graphql/types/reports/index.ts +7 -8
  36. package/things-factory.config.js +8 -0
  37. package/translations/en.json +34 -0
  38. package/translations/ko.json +34 -0
  39. package/translations/ms.json +35 -1
  40. package/translations/zh.json +37 -3
@@ -0,0 +1,222 @@
1
+ import '@things-factory/barcode-ui'
2
+ import { SingleColumnFormStyles } from '@things-factory/form-ui'
3
+ import { client, CustomAlert } from '@things-factory/shell'
4
+ import gql from 'graphql-tag'
5
+ import { i18next, localize } from '@things-factory/i18n-base'
6
+ import { css, html, LitElement } from 'lit-element'
7
+
8
+ class RelocateInventoryPopup extends localize(i18next)(LitElement) {
9
+ static get properties() {
10
+ return {
11
+ config: Object,
12
+ data: Object
13
+ }
14
+ }
15
+
16
+ static get styles() {
17
+ return [
18
+ SingleColumnFormStyles,
19
+ css`
20
+ :host {
21
+ padding: 10px;
22
+ display: flex;
23
+ flex-direction: column;
24
+ overflow-x: overlay;
25
+ background-color: var(--main-section-background-color);
26
+ }
27
+ .button-container {
28
+ padding: var(--button-container-padding);
29
+ margin: var(--button-container-margin);
30
+ text-align: var(--button-container-align);
31
+ background-color: var(--button-container-background);
32
+ height: var(--button-container-height);
33
+ }
34
+ .button-container button {
35
+ background-color: var(--button-container-button-background-color);
36
+ border-radius: var(--button-container-button-border-radius);
37
+ height: var(--button-container-button-height);
38
+ border: var(--button-container-button-border);
39
+ margin: var(--button-container-button-margin);
40
+ padding: var(--button-padding);
41
+ color: var(--theme-white-color);
42
+ font: var(--button-font);
43
+ text-transform: var(--button-text-transform);
44
+ }
45
+ .button-container button:hover,
46
+ .button-container button:active {
47
+ background-color: var(--button-background-focus-color);
48
+ }
49
+ .button-container > barcode-scanable-input {
50
+ margin: auto;
51
+ }
52
+ `
53
+ ]
54
+ }
55
+
56
+ async firstUpdated() {
57
+ await this.updateComplete
58
+
59
+ this.focusOnLocationInput()
60
+ }
61
+
62
+ get locationInput() {
63
+ return this.shadowRoot.querySelector('barcode-scanable-input[name=location]').shadowRoot.querySelector('input')
64
+ }
65
+
66
+ render() {
67
+ return html`
68
+ <form
69
+ id="input-form"
70
+ class="single-column-form"
71
+ @keypress="${async e => {
72
+ if (e.keyCode === 13) {
73
+ e.preventDefault()
74
+ this._relocateInv()
75
+ }
76
+ }}"
77
+ >
78
+ <fieldset>
79
+ <legend>${i18next.t('title.scan_area')}</legend>
80
+ <label>${i18next.t('label.location')}</label>
81
+ <barcode-scanable-input name="location" custom-input></barcode-scanable-input>
82
+ </fieldset>
83
+ </form>
84
+ <div class="button-container">
85
+ <mwc-button raised @click="${this._relocateInv}" label="${i18next.t('button.relocate')}"></mwc-button>
86
+ </div>
87
+ `
88
+ }
89
+
90
+ focusOnLocationInput() {
91
+ this.locationInput.focus()
92
+ }
93
+
94
+ async _relocateInv() {
95
+ try {
96
+ await this._validateInput()
97
+
98
+ let { inspectedQty, inspectedUomValue, cartonId, palletId, productDetailId, batchId, locationId } =
99
+ this.currentCard
100
+ inspectedQty = Number(inspectedQty)
101
+ inspectedUomValue = cartonId && palletId ? inspectedQty : Number(inspectedUomValue)
102
+
103
+ const result = await CustomAlert({
104
+ title: i18next.t('title.are_you_sure'),
105
+ text: i18next.t('button.relocate'),
106
+ confirmButton: { text: i18next.t('button.confirm') },
107
+ cancelButton: { text: i18next.t('button.cancel') }
108
+ })
109
+
110
+ if (!result.value) {
111
+ return
112
+ }
113
+
114
+ const variables = {
115
+ worksheetDetailName: this.currentCard.name,
116
+ inspectedBatchNo: this.currentCard.inspectedBatchNo,
117
+ inspectedQty: inspectedQty,
118
+ inspectedUomValue: inspectedUomValue,
119
+ inspectedLocationName: this.locationInput.value
120
+ }
121
+ let response
122
+
123
+ if (!this.enableCartonLabel) {
124
+ response = await client.mutate({
125
+ mutation: gql`
126
+ mutation relocateInventory(
127
+ $worksheetDetailName: String!
128
+ $inspectedBatchNo: String!
129
+ $inspectedQty: Int!
130
+ $inspectedUomValue: Float!
131
+ $inspectedLocationName: String!
132
+ ) {
133
+ relocateInventory(
134
+ worksheetDetailName: $worksheetDetailName
135
+ inspectedBatchNo: $inspectedBatchNo
136
+ inspectedQty: $inspectedQty
137
+ inspectedUomValue: $inspectedUomValue
138
+ inspectedLocationName: $inspectedLocationName
139
+ )
140
+ }
141
+ `,
142
+ variables: {
143
+ worksheetDetailName: this.currentCard.name,
144
+ inspectedBatchNo: this.currentCard.inspectedBatchNo,
145
+ inspectedQty: Number(this.currentCard.inspectedQty),
146
+ inspectedUomValue: inspectedUomValue,
147
+ inspectedLocationName: this.locationInput.value
148
+ }
149
+ })
150
+ } else {
151
+ response = await client.mutate({
152
+ mutation: gql`
153
+ mutation relocateInventoryCarton(
154
+ $productDetailId: String!
155
+ $cartonId: String!
156
+ $batchId: String!
157
+ $locationId: String!
158
+ $inspectedBatchNo: String!
159
+ $inspectedQty: Int!
160
+ $inspectedUomValue: Float!
161
+ $inspectedLocationName: String!
162
+ ) {
163
+ relocateInventoryCarton(
164
+ productDetailId: $productDetailId
165
+ cartonId: $cartonId
166
+ batchId: $batchId
167
+ locationId: $locationId
168
+ inspectedBatchNo: $inspectedBatchNo
169
+ inspectedQty: $inspectedQty
170
+ inspectedUomValue: $inspectedUomValue
171
+ inspectedLocationName: $inspectedLocationName
172
+ )
173
+ }
174
+ `,
175
+ variables: {
176
+ productDetailId: this.currentCard.productDetailId,
177
+ cartonId: this.currentCard.cartonId,
178
+ batchId: this.currentCard.batchId,
179
+ locationId: this.currentCard.locationId,
180
+ inspectedBatchNo: this.currentCard.inspectedBatchNo,
181
+ inspectedQty: Number(this.currentCard.inspectedQty),
182
+ inspectedUomValue: inspectedUomValue,
183
+ inspectedLocationName: this.locationInput.value
184
+ }
185
+ })
186
+ }
187
+ this.dispatchEvent(new CustomEvent('relocate', {}))
188
+ this._showToast({ message: i18next.t('text.the_inventory_has_been_relocated') })
189
+ } catch (e) {
190
+ this._showToast(e)
191
+ }
192
+ }
193
+
194
+ _validateInput() {
195
+ const locationName = this.locationInput.value
196
+ if (!locationName) {
197
+ this.selectOnInput(this.locationInput)
198
+ throw new Error(i18next.t('text.invalid_x', { state: { x: i18next.t('label.location') } }))
199
+ }
200
+
201
+ if (this.currentCard.locationName === this.locationInput.value) {
202
+ throw new Error(`You can't relocate to the same location.`)
203
+ }
204
+ }
205
+
206
+ selectOnInput(input) {
207
+ setTimeout(() => input.select(), 100)
208
+ }
209
+
210
+ _showToast({ type, message }) {
211
+ document.dispatchEvent(
212
+ new CustomEvent('notify', {
213
+ detail: {
214
+ type,
215
+ message
216
+ }
217
+ })
218
+ )
219
+ }
220
+ }
221
+
222
+ window.customElements.define('relocate-inventory-popup', RelocateInventoryPopup)
@@ -140,7 +140,7 @@ class SearchPopup extends localize(i18next)(LitElement) {
140
140
  return this.shadowRoot.querySelector('search-form')
141
141
  }
142
142
 
143
- async fetchBizplaces({ page, limit, sorters = [] }) {
143
+ async fetchBizplaces({ page, limit, sorters = [{ name: 'name' }] }) {
144
144
  const filters = await this.searchForm.getQueryFilters()
145
145
  const response = await client.query({
146
146
  query: gql`
@@ -0,0 +1,230 @@
1
+ import '@things-factory/grist-ui'
2
+ import gql from 'graphql-tag'
3
+ import { i18next, localize } from '@things-factory/i18n-base'
4
+ import { store } from '@things-factory/shell'
5
+ import { isMobileDevice } from '@things-factory/utils'
6
+ import { css, html, LitElement } from 'lit-element'
7
+ import { client } from '@things-factory/shell'
8
+ import { connect } from 'pwa-helpers/connect-mixin'
9
+ import { LOCATION_TYPE } from '../constants'
10
+
11
+ class SelectCcLocationPopup extends connect(store)(localize(i18next)(LitElement)) {
12
+ static get properties() {
13
+ return {
14
+ bizplaceId: String,
15
+ config: Object,
16
+ data: Object,
17
+ locations: Array,
18
+ selectMultipleLocations: Boolean,
19
+ _searchFields: Array
20
+ }
21
+ }
22
+
23
+ static get styles() {
24
+ return [
25
+ css`
26
+ :host {
27
+ padding: 10px;
28
+ display: flex;
29
+ flex-direction: column;
30
+ overflow-x: overlay;
31
+ background-color: var(--main-section-background-color);
32
+ }
33
+ .grist {
34
+ background-color: var(--main-section-background-color);
35
+ display: flex;
36
+ flex-direction: column;
37
+ flex: 1;
38
+ overflow-y: auto;
39
+ }
40
+ data-grist {
41
+ overflow-y: hidden;
42
+ flex: 1;
43
+ }
44
+ .button-container {
45
+ padding: var(--button-container-padding);
46
+ margin: var(--button-container-margin);
47
+ text-align: var(--button-container-align);
48
+ background-color: var(--button-container-background);
49
+ height: var(--button-container-height);
50
+ }
51
+ `
52
+ ]
53
+ }
54
+
55
+ render() {
56
+ return html`
57
+ <search-form
58
+ id="search-form"
59
+ .fields=${this._searchFields}
60
+ @submit=${() => this.locationGrist.fetch()}
61
+ ></search-form>
62
+
63
+ <div class="grist">
64
+ <data-grist
65
+ id="location"
66
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
67
+ .config=${this.config}
68
+ .fetchHandler=${this.fetchLocations.bind(this)}
69
+ ></data-grist>
70
+ </div>
71
+
72
+ <div class="button-container">
73
+ <mwc-button
74
+ raised
75
+ @click="${this._selectLocation.bind(this)}"
76
+ label="${i18next.t('button.select')}"
77
+ ></mwc-button>
78
+ </div>
79
+ `
80
+ }
81
+
82
+ get locationGrist() {
83
+ return this.shadowRoot.querySelector('data-grist#location')
84
+ }
85
+
86
+ get searchForm() {
87
+ return this.shadowRoot.querySelector('search-form')
88
+ }
89
+
90
+ async firstUpdated() {
91
+ this._searchFields = [
92
+ {
93
+ label: i18next.t('field.name'),
94
+ name: 'name',
95
+ type: 'text',
96
+ props: { searchOper: 'i_like' }
97
+ },
98
+ {
99
+ label: i18next.t('field.type'),
100
+ name: 'type',
101
+ type: 'select',
102
+ options: [
103
+ { value: '' },
104
+ ...Object.values(LOCATION_TYPE)
105
+ .map(type => {
106
+ return {
107
+ name: type.name,
108
+ value: type.value
109
+ }
110
+ })
111
+ .sort((a, b) => (a.name > b.name ? 1 : -1))
112
+ ],
113
+ props: { searchOper: 'eq' }
114
+ }
115
+ ]
116
+
117
+ this.config = {
118
+ pagination: { infinite: true },
119
+ rows: {
120
+ selectable: { multiple: this.selectMultipleLocations ? this.selectMultipleLocations : false },
121
+ appendable: false
122
+ },
123
+ list: { fields: ['name', 'status'] },
124
+ columns: [
125
+ { type: 'gutter', gutterName: 'sequence' },
126
+ {
127
+ type: 'gutter',
128
+ gutterName: 'row-selector',
129
+ multiple: this.selectMultipleLocations ? this.selectMultipleLocations : false
130
+ },
131
+ {
132
+ type: 'string',
133
+ name: 'name',
134
+ header: i18next.t('field.name'),
135
+ width: 150
136
+ },
137
+ {
138
+ type: 'select',
139
+ name: 'type',
140
+ header: i18next.t('field.type'),
141
+ record: {
142
+ editable: true,
143
+ options: [
144
+ '',
145
+ ...Object.values(LOCATION_TYPE)
146
+ .map(type => type.value)
147
+ .sort()
148
+ ]
149
+ },
150
+ sortable: true,
151
+ width: 150
152
+ }
153
+ ]
154
+ }
155
+ }
156
+
157
+ async fetchLocations() {
158
+ try {
159
+ const filters = this.searchForm.queryFilters || []
160
+ const { data, errors } = await client.query({
161
+ query: gql`
162
+ query locationByInventories($filters: [Filter!], $bizplaceId: String!) {
163
+ locationByInventories(filters: $filters, bizplaceId: $bizplaceId) {
164
+ items {
165
+ id
166
+ name
167
+ type
168
+ }
169
+ total
170
+ }
171
+ }
172
+ `,
173
+ variables: { filters, bizplaceId: this.bizplaceId }
174
+ })
175
+
176
+ if (errors) {
177
+ console.error(errors)
178
+ throw new Error('Error fetching locations')
179
+ }
180
+
181
+ return {
182
+ records: data.locationByInventories.items || [],
183
+ total: data.locationByInventories.total || 0
184
+ }
185
+ } catch (e) {}
186
+ }
187
+
188
+ _selectLocation() {
189
+ if (this.selectMultipleLocations !== true) {
190
+ const selectedLocation = this.locationGrist.selected[0]
191
+ if (selectedLocation) {
192
+ this.dispatchEvent(
193
+ new CustomEvent('location-selected', { detail: { location: selectedLocation, keyCode: 13 } })
194
+ )
195
+ history.back()
196
+ } else {
197
+ document.dispatchEvent(
198
+ new CustomEvent('notify', { detail: { message: i18next.t('text.location_is_not_selected') } })
199
+ )
200
+ }
201
+ } else {
202
+ const selectedMultipleLocations = this.locationGrist.selected
203
+ if (selectedMultipleLocations) {
204
+ const multipleLocations = selectedMultipleLocations.map(itm => {
205
+ return {
206
+ location: {
207
+ id: itm.id,
208
+ name: itm.name,
209
+ type: itm.type
210
+ }
211
+ }
212
+ })
213
+
214
+ this.dispatchEvent(
215
+ new CustomEvent('location-selected', {
216
+ detail: {
217
+ multipleLocations
218
+ }
219
+ })
220
+ )
221
+ history.back()
222
+ } else {
223
+ document.dispatchEvent(
224
+ new CustomEvent('notify', { detail: { message: i18next.t('text.location_is_not_selected') } })
225
+ )
226
+ }
227
+ }
228
+ }
229
+ }
230
+ window.customElements.define('select-cc-location-popup', SelectCcLocationPopup)