@things-factory/operato-wms 4.3.450 → 4.3.453

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 (27) hide show
  1. package/client/constants/order.js +2 -1
  2. package/client/pages/order/draft-release-good/draft-release-good-card.js +292 -0
  3. package/client/pages/order/draft-release-good/draft-release-good-detail.js +24 -5
  4. package/client/pages/order/draft-release-good/draft-release-good-list.js +82 -27
  5. package/client/pages/order/draft-release-good/draft-release-good-popup.js +366 -0
  6. package/client/pages/order/release-order/b2b/b2b-order-list.js +33 -5
  7. package/client/pages/order/release-order/b2c/b2c-order-requests.js +12 -0
  8. package/client/pages/order/release-order/create-release-order.js +63 -27
  9. package/client/pages/order/release-order/release-order-detail.js +90 -27
  10. package/client/pages/order/vas-order/popup/order-vas-popup.js +236 -0
  11. package/client/pages/report/order-vas-report.js +101 -39
  12. package/client/pages/report/vas-report.js +2 -25
  13. package/client/pages/vas/add-vas-order-level.js +383 -0
  14. package/client/pages/vas/vas-execution-page.js +41 -5
  15. package/client/pages/vas/worksheet-ref-vas.js +20 -18
  16. package/dist-server/graphql/resolvers/reports/shortage-report.js +3 -2
  17. package/dist-server/graphql/resolvers/reports/shortage-report.js.map +1 -1
  18. package/dist-server/graphql/resolvers/reports/vas-report.js +199 -88
  19. package/dist-server/graphql/resolvers/reports/vas-report.js.map +1 -1
  20. package/helps/release-note.md +9 -6
  21. package/package.json +21 -21
  22. package/server/graphql/resolvers/reports/shortage-report.ts +3 -2
  23. package/server/graphql/resolvers/reports/vas-report.ts +203 -95
  24. package/translations/en.json +13 -0
  25. package/translations/ko.json +13 -0
  26. package/translations/ms.json +13 -0
  27. package/translations/zh.json +13 -0
@@ -2,7 +2,8 @@ export const DRAFT_RELEASE_ORDER_STATUS = {
2
2
  DRAFT: 'DRAFT',
3
3
  INSUFFICIENT: 'INSUFFICIENT',
4
4
  SUBMITTED: 'SUBMITTED',
5
- CANCELLED: 'CANCELLED'
5
+ CANCELLED: 'CANCELLED',
6
+ PARTIAL_RELEASED: 'PARTIAL RELEASED'
6
7
  }
7
8
 
8
9
  /**
@@ -0,0 +1,292 @@
1
+ import gql from 'graphql-tag'
2
+ import { css, html, LitElement } from 'lit-element'
3
+
4
+ import { i18next, localize } from '@things-factory/i18n-base'
5
+ import { client } from '@things-factory/shell'
6
+ import { isMobileDevice } from '@things-factory/utils'
7
+
8
+ class DraftReleaseGoodCard extends localize(i18next)(LitElement) {
9
+ closeCard() {
10
+ this.dispatchEvent(new CustomEvent('remove-card', { detail: null, bubbles: true, composed: true }))
11
+ this.parentElement.removeChild(this)
12
+ }
13
+
14
+ handleInputChange(event) {
15
+ const checkbox = this.shadowRoot.querySelector('input[id="selectDraftOrder"]')
16
+ const radioValue = this.shadowRoot.querySelector('input[name="orderType"]:checked')?.value || ''
17
+
18
+ const value = {
19
+ valueInfo: checkbox.value,
20
+ valueRadio: radioValue,
21
+ valueCheckBox: checkbox.checked
22
+ }
23
+
24
+ this.dispatchEvent(new CustomEvent('value-change', { detail: value, bubbles: true, composed: true }))
25
+ }
26
+
27
+ updated(changedProperties) {
28
+ super.updated(changedProperties)
29
+ if (changedProperties.has('selected') && this.selected) {
30
+ this.handleInputChange()
31
+ }
32
+ }
33
+
34
+ static get properties() {
35
+ return {
36
+ config: Object,
37
+ fetchHandler: Object,
38
+ draftInfo: Object,
39
+ draftOrder: Object,
40
+ checkDisable: Object,
41
+ selected: Boolean,
42
+ checkReleaseType: Boolean,
43
+ checkStatus: Boolean,
44
+ checkAvailableQty: Boolean
45
+ }
46
+ }
47
+
48
+ static get styles() {
49
+ return [
50
+ css`
51
+ :host {
52
+ display: flex;
53
+ flex-direction: column;
54
+ width: 100%;
55
+ }
56
+
57
+ table {
58
+ padding: 18px;
59
+ }
60
+
61
+ th,
62
+ td {
63
+ padding-top: 5px;
64
+ padding-bottom: 5px;
65
+ padding-left: 5x;
66
+ padding-right: 5px;
67
+ }
68
+
69
+ td {
70
+ text-align: center;
71
+ }
72
+
73
+ table,
74
+ th,
75
+ td {
76
+ border: 1px solid black;
77
+ }
78
+
79
+ .card {
80
+ width: 1300px;
81
+ margin: auto;
82
+ background-color: rgb(255, 255, 249);
83
+ min-height: 200px;
84
+ position: relative;
85
+ border-radius: 10px;
86
+ border: 2px solid rgb(20, 154, 155);
87
+ }
88
+
89
+ #close {
90
+ float: right;
91
+ display: inline-block;
92
+ padding: 2px 5px;
93
+ margin-top: 3px;
94
+ margin-right: 3px;
95
+ background: #696969;
96
+ border-radius: 50%;
97
+ font-size: 8px;
98
+ color: white;
99
+ }
100
+
101
+ .topLeft {
102
+ color: rgb(20, 155, 155);
103
+ font-size: 14px;
104
+ display: flex;
105
+ margin-left: 7px;
106
+ }
107
+
108
+ .selectOption {
109
+ position: absolute;
110
+ left: 5px;
111
+ top: 30px;
112
+ margin-top: 10px;
113
+ }
114
+
115
+ label {
116
+ color: #3a5877;
117
+ }
118
+
119
+ .grist {
120
+ margin-top: 13px;
121
+ margin-left: auto;
122
+ margin-right: auto;
123
+ width: 95%;
124
+ height: 125px;
125
+ }
126
+
127
+ .border1 {
128
+ border-top: 1px solid black;
129
+ width: 100%;
130
+ margin-top: 10px;
131
+ }
132
+
133
+ .center {
134
+ margin-left: auto;
135
+ margin-right: auto;
136
+ margin-top: 40px;
137
+ border-collapse: collapse;
138
+ }
139
+
140
+ .button button {
141
+ width: 20px;
142
+ height: 20px;
143
+ border-radius: 50%;
144
+ background-color: #909090;
145
+ color: white;
146
+ border: none;
147
+ outline: none;
148
+ cursor: pointer;
149
+ display: flex;
150
+ justify-content: center;
151
+ align-items: center;
152
+ float: right;
153
+ margin-right: 10px;
154
+ margin-top: 5px;
155
+ }
156
+ `
157
+ ]
158
+ }
159
+
160
+ constructor() {
161
+ super()
162
+
163
+ this.properties = {
164
+ config: {},
165
+ fetchHandler: () => {},
166
+ draftInfo: {},
167
+ checkStatus: false,
168
+ checkAvailableQty: false
169
+ }
170
+ this.selected = false
171
+ }
172
+
173
+ render() {
174
+ return html`
175
+ <div class="card">
176
+ <div class="button">
177
+ <button @click=${() => this.closeCard()} ${this.closeCard}>X</button>
178
+ </div>
179
+ <div class="topLeft">
180
+ <h3>
181
+ <input
182
+ type="checkbox"
183
+ id="selectDraftOrder"
184
+ value="${this.draftInfo.id}"
185
+ .checked=${this.selected ? true : false}
186
+ @change=${(this.selected ? this.handleInputChange : null) || this.handleInputChange}
187
+ ?disabled="${this.draftInfo.status === 'SUBMITTED'}"
188
+ />
189
+ <b> ${this.draftInfo.name} [${this.draftInfo.status}]</b>
190
+ </h3>
191
+ </div>
192
+ <div class="selectOption">
193
+ <input
194
+ type="radio"
195
+ id="releaseOrder"
196
+ name="orderType"
197
+ value="release"
198
+ .checked="${!this.checkStatus}"
199
+ @change=${this.handleInputChange}
200
+ ?hidden=${this.checkStatus}
201
+ />
202
+ <label ?hidden=${this.checkStatus}><b> Release Order </b></label>
203
+ <input
204
+ type="radio"
205
+ id="partialReleaseOrder"
206
+ name="orderType"
207
+ value="partial"
208
+ .checked="${this.draftInfo.source === 'OTHERS' && this.checkStatus && !this.checkAvailableQty}"
209
+ @change=${this.handleInputChange}
210
+ ?hidden="${!(this.draftInfo.source === 'OTHERS' && this.checkStatus)}"
211
+ ?disabled="${this.checkAvailableQty}"
212
+ />
213
+ <label ?hidden="${!(this.draftInfo.source === 'OTHERS' && this.checkStatus)}"
214
+ ><b> Partial Release Order </b></label
215
+ >
216
+ </div>
217
+ <data-grist
218
+ class="grist"
219
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
220
+ .config=${this.config}
221
+ .fetchHandler=${this.draftReleaseGoodInfo.bind(this, this.draftOrder)}
222
+ ></data-grist>
223
+ </div>
224
+ `
225
+ }
226
+
227
+ async draftReleaseGoodInfo() {
228
+ const orderItem = this.draftOrder
229
+ const response = await client.query({
230
+ query: gql`
231
+ query draftReleaseGoodByName($id: String) {
232
+ draftReleaseGoodByName(id: $id) {
233
+ id
234
+ name
235
+ type
236
+ status
237
+ bizplace {
238
+ id
239
+ name
240
+ description
241
+ }
242
+ orderProducts {
243
+ id
244
+ name
245
+ product {
246
+ id
247
+ name
248
+ sku
249
+ }
250
+ uomValue
251
+ uom
252
+ releaseQty
253
+ remainQty
254
+ remainUomValue
255
+ groupType
256
+ remainUomValueWithUom
257
+ status
258
+ }
259
+ createdAt
260
+ updatedAt
261
+ }
262
+ }
263
+ `,
264
+ variables: { id: orderItem.id }
265
+ })
266
+
267
+ if (!response.errors) {
268
+ const items = response.data.draftReleaseGoodByName
269
+
270
+ this.draftOrderStatus = response.data.draftReleaseGoodByName.status
271
+ const records = items.orderProducts.map(itm => {
272
+ return {
273
+ sku: itm.product.sku,
274
+ groupType: itm.groupType,
275
+ releaseQty: itm.releaseQty,
276
+ bizplace: items.bizplace.name,
277
+ availableQty: itm.remainQty,
278
+ status: itm.status
279
+ }
280
+ })
281
+
282
+ this.checkStatus = records.some(itm => itm.status === 'INSUFFICIENT')
283
+ this.checkAvailableQty = records.every(itm => itm.availableQty == 0)
284
+
285
+ return {
286
+ records
287
+ }
288
+ }
289
+ }
290
+ }
291
+
292
+ window.customElements.define('draft-release-good-card', DraftReleaseGoodCard)
@@ -4,20 +4,38 @@ import '@things-factory/warehouse-ui'
4
4
  import '@things-factory/import-ui'
5
5
 
6
6
  import gql from 'graphql-tag'
7
- import { css, html } from 'lit-element'
7
+ import {
8
+ css,
9
+ html
10
+ } from 'lit-element'
8
11
  import isEmpty from 'lodash-es/isEmpty'
9
12
  import { connect } from 'pwa-helpers/connect-mixin'
10
13
 
11
14
  import { getCodeByName } from '@things-factory/code-base'
12
15
  import { MultiColumnFormStyles } from '@things-factory/form-ui'
13
- import { i18next, localize } from '@things-factory/i18n-base'
16
+ import {
17
+ i18next,
18
+ localize
19
+ } from '@things-factory/i18n-base'
14
20
  import { openPopup } from '@things-factory/layout-base'
15
21
  import { fetchSettingRule } from '@things-factory/setting-ui'
16
- import { client, CustomAlert, navigate, PageView, store } from '@things-factory/shell'
22
+ import {
23
+ client,
24
+ CustomAlert,
25
+ navigate,
26
+ PageView,
27
+ store
28
+ } from '@things-factory/shell'
17
29
  import { CommonButtonStyles } from '@things-factory/styles'
18
- import { flattenObject, isMobileDevice } from '@things-factory/utils'
30
+ import {
31
+ flattenObject,
32
+ isMobileDevice
33
+ } from '@things-factory/utils'
19
34
 
20
- import { DRAFT_RELEASE_ORDER_STATUS, PRODUCT_GROUP_TYPES } from '../../../constants'
35
+ import {
36
+ DRAFT_RELEASE_ORDER_STATUS,
37
+ PRODUCT_GROUP_TYPES
38
+ } from '../../../constants'
21
39
 
22
40
  class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView)) {
23
41
  static get properties() {
@@ -235,6 +253,7 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
235
253
 
236
254
  if (
237
255
  this._draftOrderData?.status != DRAFT_RELEASE_ORDER_STATUS.PENDING &&
256
+ this._draftOrderData?.status != DRAFT_RELEASE_ORDER_STATUS.PARTIAL_RELEASED &&
238
257
  this._draftOrderData?.status != DRAFT_RELEASE_ORDER_STATUS.SUBMITTED &&
239
258
  this._draftOrderData?.status != DRAFT_RELEASE_ORDER_STATUS.CANCELLED
240
259
  ) {
@@ -1,27 +1,15 @@
1
1
  import '@things-factory/form-ui'
2
2
  import '@things-factory/grist-ui'
3
+ import './draft-release-good-popup'
3
4
 
4
5
  import gql from 'graphql-tag'
5
- import {
6
- css,
7
- html
8
- } from 'lit-element'
6
+ import { css, html } from 'lit-element'
9
7
 
10
8
  import { GhostPrint } from '@operato/ghost-print'
11
- import {
12
- i18next,
13
- localize
14
- } from '@things-factory/i18n-base'
15
- import {
16
- client,
17
- CustomAlert,
18
- navigate,
19
- PageView
20
- } from '@things-factory/shell'
21
- import {
22
- CommonButtonStyles,
23
- ScrollbarStyles
24
- } from '@things-factory/styles'
9
+ import { openPopup } from '@operato/layout'
10
+ import { i18next, localize } from '@things-factory/i18n-base'
11
+ import { client, CustomAlert, navigate, PageView } from '@things-factory/shell'
12
+ import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
25
13
  import { isMobileDevice } from '@things-factory/utils'
26
14
 
27
15
  import { DRAFT_RELEASE_ORDER_STATUS } from '../../../constants'
@@ -32,6 +20,10 @@ import { DRAFT_RELEASE_ORDER_STATUS } from '../../../constants'
32
20
  // }
33
21
 
34
22
  class DraftReleaseGoodList extends localize(i18next)(PageView) {
23
+ connectedCallback() {
24
+ super.connectedCallback()
25
+ this.addEventListener('reload-page', this.pageUpdated, true)
26
+ }
35
27
  static get styles() {
36
28
  return [
37
29
  ScrollbarStyles,
@@ -58,7 +50,9 @@ class DraftReleaseGoodList extends localize(i18next)(PageView) {
58
50
  return {
59
51
  _searchFields: Array,
60
52
  config: Object,
61
- data: Object
53
+ data: Object,
54
+ _source: String,
55
+ _settingValue: String
62
56
  }
63
57
  }
64
58
 
@@ -81,10 +75,17 @@ class DraftReleaseGoodList extends localize(i18next)(PageView) {
81
75
  name: i18next.t('title.draft_release_order'),
82
76
  data: this.exportableData.bind(this)
83
77
  },
78
+
84
79
  actions: [
85
80
  {
86
81
  title: i18next.t('button.create_release_order'),
87
- action: this._generateReleaseGood.bind(this),
82
+ action: () => {
83
+ if (this._settingValue == 'true') {
84
+ this._generatePopupReleaseGood(this)
85
+ } else {
86
+ this._generateReleaseGoods(this)
87
+ }
88
+ },
88
89
  ...CommonButtonStyles.activate
89
90
  },
90
91
  {
@@ -388,6 +389,7 @@ class DraftReleaseGoodList extends localize(i18next)(PageView) {
388
389
  exportOption
389
390
  releaseDate
390
391
  status
392
+ source
391
393
  platformCode
392
394
  createdAt
393
395
  updatedAt
@@ -397,6 +399,7 @@ class DraftReleaseGoodList extends localize(i18next)(PageView) {
397
399
  description
398
400
  }
399
401
  }
402
+ settingValue
400
403
  total
401
404
  }
402
405
  }
@@ -411,6 +414,7 @@ class DraftReleaseGoodList extends localize(i18next)(PageView) {
411
414
  if (!response.errors) {
412
415
  this._ownTransport = response.data.draftReleaseGoods.ownTransport
413
416
  this._exportOption = response.data.draftReleaseGoods.exportOption
417
+ this._settingValue = response.data.draftReleaseGoods.settingValue
414
418
  return {
415
419
  total: response.data.draftReleaseGoods.total || 0,
416
420
  records: response.data.draftReleaseGoods.items || []
@@ -422,16 +426,16 @@ class DraftReleaseGoodList extends localize(i18next)(PageView) {
422
426
  return this.config.columns
423
427
  }
424
428
 
425
- async _generateReleaseGood() {
429
+ async _generateReleaseGoods() {
426
430
  try {
427
431
  let orderIds = []
428
-
429
432
  let selectedGristData = this.dataGrist.selected
433
+
430
434
  if (selectedGristData.filter(itm => itm.status == DRAFT_RELEASE_ORDER_STATUS.DRAFT).length <= 0)
431
435
  throw new Error(i18next.t('text.please_select_a_valid_draft_order_to_generate_release_order'))
432
436
 
433
437
  let selectedOrders = selectedGristData.filter(itm => itm.status === DRAFT_RELEASE_ORDER_STATUS.DRAFT)
434
- orderIds = selectedOrders.map(record => record.id)
438
+ orderIds = selectedOrders.map(record => ({ id: record.id, releaseType: 'release' }))
435
439
 
436
440
  let result = await CustomAlert({
437
441
  title: i18next.t('title.are_you_sure'),
@@ -442,19 +446,22 @@ class DraftReleaseGoodList extends localize(i18next)(PageView) {
442
446
 
443
447
  if (!result.value) return
444
448
 
445
- const response = await client.mutate({
449
+ let response = await client.mutate({
446
450
  mutation: gql`
447
- mutation generateReleaseGoodsFromDraft($ids: [String!]!) {
448
- generateReleaseGoodsFromDraft(ids: $ids)
451
+ mutation generateReleaseGoodsfromDraft($releaseInfo: [DraftReleaseGoodInfos!]!) {
452
+ generateReleaseGoodsfromDraft(releaseInfo: $releaseInfo) {
453
+ draftName
454
+ }
449
455
  }
450
456
  `,
451
457
  variables: {
452
- ids: orderIds
458
+ releaseInfo: orderIds
453
459
  }
454
460
  })
455
461
 
456
462
  if (!response.errors) {
457
463
  this.dataGrist.fetch()
464
+
458
465
  this._showToast({ message: i18next.t('text.release_order(s)_has_been_generated') })
459
466
  }
460
467
  } catch (e) {
@@ -462,6 +469,54 @@ class DraftReleaseGoodList extends localize(i18next)(PageView) {
462
469
  }
463
470
  }
464
471
 
472
+ async _generatePopupReleaseGood() {
473
+ let selectedGristData = this.dataGrist.selected
474
+ const selectedStatuses = [
475
+ DRAFT_RELEASE_ORDER_STATUS.DRAFT,
476
+ DRAFT_RELEASE_ORDER_STATUS.INSUFFICIENT,
477
+ DRAFT_RELEASE_ORDER_STATUS.PARTIAL_RELEASED
478
+ ]
479
+ let selectedOrders
480
+
481
+ try {
482
+ if (selectedGristData.length > 10) {
483
+ throw new Error(i18next.t('text.only_ten_draft_orders_are_allowed_to_generate_release_order_at_a_time'))
484
+ }
485
+
486
+ if (selectedGristData.length < 1) {
487
+ throw new Error(i18next.t('text.please_select_a_valid_draft_order_to_generate_release_order'))
488
+ }
489
+
490
+ let submittedOrders = selectedGristData.some(itm => itm.status === DRAFT_RELEASE_ORDER_STATUS.SUBMITTED)
491
+
492
+ selectedOrders = selectedGristData.filter(itm => selectedStatuses.includes(itm.status))
493
+
494
+ if (submittedOrders) {
495
+ this._showToast({ message: i18next.t('text.submitted_draft_orders_will_not_be_displayed') })
496
+ }
497
+
498
+ if (selectedOrders.length < 1) {
499
+ throw new Error('No draft orders to display')
500
+ }
501
+
502
+ openPopup(
503
+ html`
504
+ <draft-release-good-popup
505
+ .draftOrder="${selectedOrders}"
506
+ @reload-page="${this.pageUpdated.bind(this)}"
507
+ ></draft-release-good-popup>
508
+ `,
509
+ {
510
+ backdrop: true,
511
+ size: 'large',
512
+ title: i18next.t('title.create_release_order')
513
+ }
514
+ )
515
+ } catch (e) {
516
+ this._showToast(e)
517
+ }
518
+ }
519
+
465
520
  _navigateToCreate() {
466
521
  navigate(`draft_release_good_detail/new`)
467
522
  }