@things-factory/operato-wms 4.3.238 → 4.3.241
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.
- package/client/pages/components/vas-templates/vas-pallet-add-popup.js +1 -0
- package/client/pages/components/vas-templates/vas-relabel.js +1 -0
- package/client/pages/components/vas-templates/vas-repack-relabel.js +1 -0
- package/client/pages/components/vas-templates/vas-repack.js +1 -0
- package/client/pages/components/vas-templates/vas-repalletizing.js +1 -0
- package/client/pages/components/vas-templates/vas-template.js +1 -0
- package/client/pages/components/vas-templates/vas-unpack.js +1 -0
- package/client/pages/constants/vas-target-type.js +1 -0
- package/client/pages/constants/worksheet.js +4 -0
- package/client/pages/inbound/adjust-pallet-qty.js +1 -1
- package/client/pages/inbound/inbound-worksheet.js +1 -0
- package/client/pages/inbound/palletizing-pallets-popup.js +1 -1
- package/client/pages/inbound/unload-product.js +1 -0
- package/client/pages/inbound/vas-selector.js +1 -0
- package/client/pages/inbound/worksheet-putaway.js +1 -0
- package/client/pages/inbound/worksheet-unloading.js +1 -0
- package/client/pages/order/arrival-notice/arrival-notice-detail.js +1 -0
- package/client/pages/order/arrival-notice/assign-buffer-location.js +1 -0
- package/client/pages/order/arrival-notice/check-arrived-notice.js +1 -0
- package/client/pages/order/arrival-notice/create-arrival-notice.js +1 -0
- package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +1 -0
- package/client/pages/order/arrival-notice/receive-arrival-notice.js +1 -0
- package/client/pages/order/arrival-notice/rejected-arrival-notice.js +1 -0
- package/client/pages/order/release-order/create-release-order.js +713 -84
- package/client/pages/order/release-order/receive-release-order-request.js +1 -0
- package/client/pages/order/release-order/rejected-release-order.js +1 -0
- package/client/pages/order/release-order/release-order-detail.js +1020 -388
- package/client/pages/order/return-order/check-return-order.js +1 -0
- package/client/pages/order/return-order/rejected-return-order.js +2 -0
- package/client/pages/order/return-order/return-order-assign-buffer-location.js +1 -0
- package/client/pages/order/return-order/return-order-detail.js +1 -0
- package/client/pages/order/reverse-kitting-order/reverse-kitting-pallet-label-popup.js +1 -0
- package/client/pages/order/transfer-order/rejected-transfer-order.js +1 -0
- package/client/pages/order/vas-order/create-vas-order.js +1 -0
- package/client/pages/order/vas-order/popup/abastract-vas-create-form.js +1 -0
- package/client/pages/order/vas-order/popup/select-vas-popup.js +220 -0
- package/client/pages/order/vas-order/popup/vas-create-batch-product-type-form.js +1 -0
- package/client/pages/order/vas-order/popup/vas-create-batch-type-form.js +1 -0
- package/client/pages/order/vas-order/popup/vas-create-etc-type-form.js +1 -0
- package/client/pages/order/vas-order/popup/vas-create-popup.js +1 -0
- package/client/pages/order/vas-order/popup/vas-create-product-type-form.js +1 -0
- package/client/pages/order/vas-order/popup/vas-target-product-popup.js +644 -0
- package/client/pages/order/vas-order/receive-vas-order.js +1 -0
- package/client/pages/order/vas-order/vas-order-detail.js +1 -0
- package/client/pages/order/vas-order/vas-order-list.js +1 -0
- package/client/pages/order/vas-order/vas-order-requests.js +1 -0
- package/client/pages/outbound/loading-product.js +109 -14
- package/client/pages/outbound/picking-product.js +59 -1
- package/client/pages/outbound/vas-list-popup.js +367 -0
- package/client/pages/outbound/worksheet-loading.js +13 -8
- package/client/pages/outbound/worksheet-picking.js +4 -0
- package/client/pages/report/vas-report.js +534 -0
- package/client/pages/vas/abstract-execute-vas.js +2 -1
- package/client/pages/vas/execute-pure-vas.js +1 -0
- package/client/pages/vas/execute-ref-vas.js +1 -0
- package/client/pages/vas/execute-vas.js +2 -2
- package/client/pages/vas/related-vas-list.js +1 -0
- package/client/pages/vas/vas-execution-page.js +469 -0
- package/client/pages/vas/vas-pallet-label-popup.js +1 -0
- package/client/pages/vas/vas-worksheet-list.js +1 -0
- package/client/pages/vas/worksheet-ref-vas.js +97 -36
- package/client/pages/vas/worksheet-vas.js +1 -0
- package/client/route.js +9 -0
- package/config.development.js +16 -16
- package/dist-server/graphql/resolvers/reports/index.js +2 -1
- package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/vas-report.js +118 -0
- package/dist-server/graphql/resolvers/reports/vas-report.js.map +1 -0
- package/dist-server/graphql/types/reports/index.js +6 -1
- package/dist-server/graphql/types/reports/index.js.map +1 -1
- package/dist-server/graphql/types/reports/vas-report-list.js +14 -0
- package/dist-server/graphql/types/reports/vas-report-list.js.map +1 -0
- package/dist-server/graphql/types/reports/vas-report.js +18 -0
- package/dist-server/graphql/types/reports/vas-report.js.map +1 -0
- package/package.json +7 -7
- package/server/graphql/resolvers/reports/index.ts +3 -1
- package/server/graphql/resolvers/reports/vas-report.ts +135 -0
- package/server/graphql/types/reports/index.ts +7 -1
- package/server/graphql/types/reports/vas-report-list.ts +8 -0
- package/server/graphql/types/reports/vas-report.ts +12 -0
- package/things-factory.config.js +11 -0
- package/translations/en.json +30 -5
- package/translations/ko.json +26 -1
- package/translations/ms.json +26 -1
- package/translations/zh.json +26 -1
|
@@ -5,29 +5,18 @@ import '@things-factory/component-ui'
|
|
|
5
5
|
import '../../components/vas-templates'
|
|
6
6
|
import '../../order/vas-order/popup/vas-create-popup'
|
|
7
7
|
import '../../components/select-inventory-popup'
|
|
8
|
+
import '../../components/select-product-popup'
|
|
9
|
+
import '../../order/vas-order/popup/vas-target-product-popup'
|
|
10
|
+
import '../../order/vas-order/popup/select-vas-popup'
|
|
8
11
|
|
|
9
12
|
import gql from 'graphql-tag'
|
|
10
|
-
import {
|
|
11
|
-
css,
|
|
12
|
-
html
|
|
13
|
-
} from 'lit-element'
|
|
13
|
+
import { css, html } from 'lit-element'
|
|
14
14
|
|
|
15
15
|
import { getCodeByName } from '@things-factory/code-base'
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
SingleColumnFormStyles
|
|
19
|
-
} from '@things-factory/form-ui'
|
|
20
|
-
import {
|
|
21
|
-
i18next,
|
|
22
|
-
localize
|
|
23
|
-
} from '@things-factory/i18n-base'
|
|
16
|
+
import { MultiColumnFormStyles, SingleColumnFormStyles } from '@things-factory/form-ui'
|
|
17
|
+
import { i18next, localize } from '@things-factory/i18n-base'
|
|
24
18
|
import { openPopup } from '@things-factory/layout-base'
|
|
25
|
-
import {
|
|
26
|
-
client,
|
|
27
|
-
CustomAlert,
|
|
28
|
-
navigate,
|
|
29
|
-
PageView
|
|
30
|
-
} from '@things-factory/shell'
|
|
19
|
+
import { client, CustomAlert, navigate, PageView } from '@things-factory/shell'
|
|
31
20
|
import { CommonButtonStyles } from '@things-factory/styles'
|
|
32
21
|
import { isMobileDevice } from '@things-factory/utils'
|
|
33
22
|
|
|
@@ -42,9 +31,12 @@ import {
|
|
|
42
31
|
RO_TYPES,
|
|
43
32
|
VAS_BATCH_AND_PRODUCT_TYPE,
|
|
44
33
|
VAS_BATCH_NO_TYPE,
|
|
45
|
-
VAS_PRODUCT_TYPE
|
|
34
|
+
VAS_PRODUCT_TYPE,
|
|
35
|
+
ORDER_VAS_STATUS
|
|
46
36
|
} from '../../constants'
|
|
47
37
|
|
|
38
|
+
import { v4 as uuidv4 } from 'uuid'
|
|
39
|
+
|
|
48
40
|
class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
49
41
|
static get properties() {
|
|
50
42
|
return {
|
|
@@ -90,7 +82,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
90
82
|
_packingOption: Boolean,
|
|
91
83
|
_disableTransport: Boolean,
|
|
92
84
|
_enableTransportationServiceSetting: Boolean,
|
|
93
|
-
_vasExpanded: Boolean,
|
|
85
|
+
// _vasExpanded: Boolean,
|
|
94
86
|
_selectedCP: String,
|
|
95
87
|
|
|
96
88
|
/* Shipping Form Field */
|
|
@@ -130,10 +122,16 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
130
122
|
_showReleasedOrderInfo: Boolean,
|
|
131
123
|
_showShippingInfo: Boolean,
|
|
132
124
|
_disableBillingAddress: Boolean,
|
|
133
|
-
_showExportInfo: Boolean
|
|
125
|
+
_showExportInfo: Boolean,
|
|
126
|
+
_showVasInfo: Boolean,
|
|
127
|
+
_showVasSummary: Boolean,
|
|
128
|
+
|
|
129
|
+
// Type
|
|
130
|
+
_selectBy: String
|
|
134
131
|
}
|
|
135
132
|
}
|
|
136
133
|
|
|
134
|
+
//vas --edit this
|
|
137
135
|
static get styles() {
|
|
138
136
|
return [
|
|
139
137
|
MultiColumnFormStyles,
|
|
@@ -232,16 +230,16 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
232
230
|
width: 50%;
|
|
233
231
|
}
|
|
234
232
|
|
|
235
|
-
.vas
|
|
236
|
-
height:
|
|
237
|
-
}
|
|
238
|
-
.vas[collapsable][collapsed] {
|
|
239
|
-
display: none;
|
|
233
|
+
.vas {
|
|
234
|
+
height: 100%;
|
|
240
235
|
}
|
|
236
|
+
|
|
241
237
|
data-grist#vas-grist {
|
|
242
238
|
padding-top: 0px;
|
|
243
239
|
height: 100%;
|
|
240
|
+
flex: 1;
|
|
244
241
|
}
|
|
242
|
+
|
|
245
243
|
h2.vas-title {
|
|
246
244
|
padding-bottom: 0px;
|
|
247
245
|
}
|
|
@@ -291,7 +289,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
291
289
|
}
|
|
292
290
|
|
|
293
291
|
get context() {
|
|
294
|
-
this._vasExpanded = false
|
|
292
|
+
// this._vasExpanded = false
|
|
295
293
|
|
|
296
294
|
return {
|
|
297
295
|
title: i18next.t('title.create_release_order'),
|
|
@@ -317,13 +315,17 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
317
315
|
const RELEASE_ORDER_TABS = {
|
|
318
316
|
RELEASE_ORDER_INFO: i18next.t('label.order'),
|
|
319
317
|
SHIPPING_INFO: i18next.t('label.shipment'),
|
|
320
|
-
EXPORT_INFO: i18next.t('label.export')
|
|
318
|
+
EXPORT_INFO: i18next.t('label.export'),
|
|
319
|
+
VAS_INFO: i18next.t('label.vas'),
|
|
320
|
+
VAS_SUMMARY: i18next.t('label.vas_summary')
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
const orderSet = {
|
|
324
324
|
[RELEASE_ORDER_TABS.RELEASE_ORDER_INFO]: {},
|
|
325
325
|
[RELEASE_ORDER_TABS.SHIPPING_INFO]: {},
|
|
326
|
-
[RELEASE_ORDER_TABS.EXPORT_INFO]: {}
|
|
326
|
+
[RELEASE_ORDER_TABS.EXPORT_INFO]: {},
|
|
327
|
+
[RELEASE_ORDER_TABS.VAS_INFO]: {},
|
|
328
|
+
[RELEASE_ORDER_TABS.VAS_SUMMARY]: {}
|
|
327
329
|
}
|
|
328
330
|
|
|
329
331
|
const disabledKey = {
|
|
@@ -447,6 +449,15 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
447
449
|
/>
|
|
448
450
|
<label for="packingOption" ?hidden="${!this._checkTransport}">${i18next.t('label.packing')}</label>
|
|
449
451
|
|
|
452
|
+
<input
|
|
453
|
+
id="vas"
|
|
454
|
+
type="checkbox"
|
|
455
|
+
name="vas"
|
|
456
|
+
.checked="${this.vasData.records.length > 0}"
|
|
457
|
+
disabled
|
|
458
|
+
/>
|
|
459
|
+
<label for="vas" >${i18next.t('label.vas')}</label>
|
|
460
|
+
|
|
450
461
|
${
|
|
451
462
|
this._crossDocking
|
|
452
463
|
? html`
|
|
@@ -715,7 +726,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
715
726
|
</form>
|
|
716
727
|
|
|
717
728
|
<form class="picking-std-container multi-column-form" ?hidden="${
|
|
718
|
-
!this._showShippingInfo || !this._showExportInfo
|
|
729
|
+
!this._showShippingInfo || !this._showExportInfo || !this._showVasInfo || !this._showVasSummary
|
|
719
730
|
}">
|
|
720
731
|
<fieldset>
|
|
721
732
|
<legend>${i18next.t('title.inventory_selection_strategy')}</legend>
|
|
@@ -805,15 +816,31 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
805
816
|
</fieldset>
|
|
806
817
|
</form>
|
|
807
818
|
|
|
808
|
-
<div class="container">
|
|
819
|
+
<div class="container" ?hidden = ${!this._showVasSummary}>
|
|
820
|
+
|
|
809
821
|
<div class="grist">
|
|
810
|
-
|
|
822
|
+
<!-- vas -->
|
|
823
|
+
<h2 ?hidden=${this._showVasInfo} class="vas-title">
|
|
824
|
+
${i18next.t('title.vas')}
|
|
825
|
+
</h2>
|
|
826
|
+
<div ?hidden=${this._showVasInfo} class="vas">
|
|
827
|
+
<data-grist
|
|
828
|
+
id="vas-grist"
|
|
829
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
830
|
+
.config=${this.vasGristConfig}
|
|
831
|
+
.data="${this.vasData}"
|
|
832
|
+
@record-change="${this.onVasChangeHandler.bind(this)}"
|
|
833
|
+
></data-grist>
|
|
834
|
+
</div>
|
|
835
|
+
|
|
836
|
+
<!-- release product list-->
|
|
837
|
+
<h2 ?hidden= ${!this._showVasInfo}>
|
|
811
838
|
<mwc-icon>list_alt</mwc-icon>${i18next.t('title.release_product_list')}${` [${i18next.t(
|
|
812
839
|
PICKING_STANDARD[this._pickingStd].name
|
|
813
840
|
)}]`}
|
|
814
841
|
</h2>
|
|
815
|
-
|
|
816
|
-
|
|
842
|
+
<data-grist
|
|
843
|
+
?hidden= ${!this._showVasInfo}
|
|
817
844
|
id="inventory-grist"
|
|
818
845
|
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
819
846
|
.config=${this.inventoryGristConfig}
|
|
@@ -834,28 +861,15 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
834
861
|
.data="${this.bundleData}"
|
|
835
862
|
@field-change="${this._onBundleFieldChanged.bind(this)}"
|
|
836
863
|
></data-grist>
|
|
837
|
-
|
|
838
|
-
<h2
|
|
839
|
-
@click="${e => {
|
|
840
|
-
this._vasExpanded = !this._vasExpanded
|
|
841
|
-
}}"
|
|
842
|
-
class="vas-title"
|
|
843
|
-
>
|
|
844
|
-
<mwc-icon>list_alt</mwc-icon>${i18next.t('title.vas')}<mwc-icon
|
|
845
|
-
>${this._vasExpanded ? 'expand_less' : 'expand_more'}</mwc-icon
|
|
846
|
-
>
|
|
847
|
-
</h2>
|
|
848
|
-
<div class="vas" collapsable ?collapsed=${!this._vasExpanded}>
|
|
849
|
-
<data-grist
|
|
850
|
-
id="vas-grist"
|
|
851
|
-
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
852
|
-
.config=${this.vasGristConfig}
|
|
853
|
-
.data="${this.vasData}"
|
|
854
|
-
></data-grist>
|
|
855
|
-
</div>
|
|
856
864
|
</div>
|
|
857
865
|
</div>
|
|
858
866
|
</div>
|
|
867
|
+
|
|
868
|
+
<div class="container" ?hidden =${this._showVasSummary}>
|
|
869
|
+
<!-- <search-form id="search-form" .fields=${this._searchFields} @submit=${e =>
|
|
870
|
+
this.report.fetch()}></search-form> -->
|
|
871
|
+
<data-report .config=${this.vasSummaryConfig} .data=${this.vasData} ></data-report>
|
|
872
|
+
</div>
|
|
859
873
|
`
|
|
860
874
|
}
|
|
861
875
|
|
|
@@ -1058,15 +1072,46 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1058
1072
|
this._validateTransport()
|
|
1059
1073
|
|
|
1060
1074
|
this.vasGristConfig = {
|
|
1061
|
-
list: {
|
|
1075
|
+
list: {
|
|
1076
|
+
fields: [
|
|
1077
|
+
'batchId',
|
|
1078
|
+
'sku',
|
|
1079
|
+
'qty',
|
|
1080
|
+
'packingType',
|
|
1081
|
+
'uom',
|
|
1082
|
+
'uomValue',
|
|
1083
|
+
'vas',
|
|
1084
|
+
'vasQty',
|
|
1085
|
+
'newSKU',
|
|
1086
|
+
'newPackingType',
|
|
1087
|
+
'newUom',
|
|
1088
|
+
'newUomValue',
|
|
1089
|
+
'outputQty',
|
|
1090
|
+
'remark'
|
|
1091
|
+
]
|
|
1092
|
+
},
|
|
1062
1093
|
pagination: { infinite: true },
|
|
1063
1094
|
rows: {
|
|
1064
1095
|
handlers: {
|
|
1065
1096
|
click: (columns, data, column, record, rowIndex) => {
|
|
1066
1097
|
this._selectedVasRecord = record
|
|
1067
1098
|
this._selectedVasRecordIdx = rowIndex
|
|
1068
|
-
if (column.name) {
|
|
1069
|
-
this.
|
|
1099
|
+
if (column.name === 'sku') {
|
|
1100
|
+
this.openTargetproductVasPopup(record)
|
|
1101
|
+
}
|
|
1102
|
+
if (column.name === 'newSKU') {
|
|
1103
|
+
this._openBulkProductSelectionForVas(this._selectBy, rowIndex)
|
|
1104
|
+
}
|
|
1105
|
+
if (column.name === 'vas') {
|
|
1106
|
+
try {
|
|
1107
|
+
if (!record.qty) {
|
|
1108
|
+
throw new Error(i18next.t('text.empty_field_field', { field: i18next.t('field.qty') }))
|
|
1109
|
+
} else {
|
|
1110
|
+
this.openSelectVasPopup(record, rowIndex)
|
|
1111
|
+
}
|
|
1112
|
+
} catch (e) {
|
|
1113
|
+
this._showToast(e)
|
|
1114
|
+
}
|
|
1070
1115
|
}
|
|
1071
1116
|
}
|
|
1072
1117
|
}
|
|
@@ -1079,51 +1124,109 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1079
1124
|
icon: 'close',
|
|
1080
1125
|
handlers: {
|
|
1081
1126
|
click: (columns, data, column, record, rowIndex) => {
|
|
1082
|
-
this.vasData = {
|
|
1127
|
+
this.vasData = {
|
|
1128
|
+
...this.vasData,
|
|
1129
|
+
records: data.records.filter((_, idx) =>
|
|
1130
|
+
record.sku ? _.vasGristId !== record.vasGristId : idx !== rowIndex
|
|
1131
|
+
)
|
|
1132
|
+
}
|
|
1083
1133
|
}
|
|
1084
1134
|
}
|
|
1085
1135
|
},
|
|
1086
1136
|
{
|
|
1087
|
-
type: '
|
|
1088
|
-
name: '
|
|
1089
|
-
header: i18next.t('field.
|
|
1090
|
-
width:
|
|
1137
|
+
type: 'string',
|
|
1138
|
+
name: 'batchId',
|
|
1139
|
+
header: i18next.t('field.batch_no'),
|
|
1140
|
+
width: 150
|
|
1091
1141
|
},
|
|
1092
1142
|
{
|
|
1093
1143
|
type: 'string',
|
|
1094
|
-
name: '
|
|
1095
|
-
header: i18next.t('field.
|
|
1144
|
+
name: 'sku',
|
|
1145
|
+
header: i18next.t('field.sku'),
|
|
1096
1146
|
width: 150
|
|
1097
1147
|
},
|
|
1098
1148
|
{
|
|
1099
|
-
type: '
|
|
1100
|
-
name: '
|
|
1101
|
-
header: i18next.t('field.
|
|
1102
|
-
|
|
1149
|
+
type: 'integer',
|
|
1150
|
+
name: 'qty',
|
|
1151
|
+
header: i18next.t('field.qty'),
|
|
1152
|
+
record: { editable: true, options: { min: 0 } },
|
|
1153
|
+
width: 100
|
|
1103
1154
|
},
|
|
1104
1155
|
{
|
|
1105
1156
|
type: 'string',
|
|
1106
1157
|
name: 'packingType',
|
|
1107
|
-
header: i18next.t('field.
|
|
1108
|
-
width:
|
|
1158
|
+
header: i18next.t('field.packing_type_sku', { sku: 'SKU' }),
|
|
1159
|
+
width: 150
|
|
1109
1160
|
},
|
|
1110
1161
|
{
|
|
1111
1162
|
type: 'integer',
|
|
1112
|
-
name: '
|
|
1113
|
-
header: i18next.t('field.
|
|
1114
|
-
width:
|
|
1163
|
+
name: 'uom',
|
|
1164
|
+
header: i18next.t('field.uom_sku', { sku: 'SKU' }),
|
|
1165
|
+
width: 150
|
|
1115
1166
|
},
|
|
1116
1167
|
{
|
|
1117
1168
|
type: 'integer',
|
|
1118
1169
|
name: 'uomValue',
|
|
1119
|
-
header: i18next.t('field.
|
|
1170
|
+
header: i18next.t('field.uom_value_sku', { sku: 'SKU' }),
|
|
1171
|
+
width: 150
|
|
1172
|
+
},
|
|
1173
|
+
{
|
|
1174
|
+
type: 'object',
|
|
1175
|
+
name: 'vas',
|
|
1176
|
+
header: i18next.t('field.vas'),
|
|
1177
|
+
width: 250
|
|
1178
|
+
},
|
|
1179
|
+
{
|
|
1180
|
+
type: 'integer',
|
|
1181
|
+
name: 'vasQty',
|
|
1182
|
+
header: i18next.t('field.vas_qty'),
|
|
1183
|
+
record: { editable: true, options: { min: 0 } },
|
|
1120
1184
|
width: 100
|
|
1121
1185
|
},
|
|
1186
|
+
{
|
|
1187
|
+
type: 'string',
|
|
1188
|
+
name: 'newSKU',
|
|
1189
|
+
header: i18next.t('field.new_sku'),
|
|
1190
|
+
record: { editable: true },
|
|
1191
|
+
width: 150
|
|
1192
|
+
},
|
|
1193
|
+
{
|
|
1194
|
+
type: 'code',
|
|
1195
|
+
name: 'newPackingType',
|
|
1196
|
+
header: i18next.t('field.packing_type_sku', { sku: 'NEW SKU' }),
|
|
1197
|
+
record: {
|
|
1198
|
+
editable: true,
|
|
1199
|
+
codeName: 'PACKING_TYPES'
|
|
1200
|
+
},
|
|
1201
|
+
width: 150
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
type: 'code',
|
|
1205
|
+
name: 'newUom',
|
|
1206
|
+
header: i18next.t('field.uom_sku', { sku: 'NEW SKU' }),
|
|
1207
|
+
record: { editable: true, codeName: 'UOM' },
|
|
1208
|
+
width: 150
|
|
1209
|
+
},
|
|
1210
|
+
{
|
|
1211
|
+
type: 'integer',
|
|
1212
|
+
name: 'newUomValue',
|
|
1213
|
+
header: i18next.t('field.uom_value_sku', { sku: 'NEW SKU' }),
|
|
1214
|
+
record: { editable: true },
|
|
1215
|
+
width: 150
|
|
1216
|
+
},
|
|
1122
1217
|
{
|
|
1123
1218
|
type: 'integer',
|
|
1124
|
-
name: '
|
|
1125
|
-
header: i18next.t('field.
|
|
1219
|
+
name: 'outputQty',
|
|
1220
|
+
header: i18next.t('field.output_qty'),
|
|
1221
|
+
record: { editable: true, options: { min: 0 } },
|
|
1126
1222
|
width: 100
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
type: 'string',
|
|
1226
|
+
name: 'remark',
|
|
1227
|
+
header: i18next.t('field.remark'),
|
|
1228
|
+
record: { editable: true },
|
|
1229
|
+
width: 250
|
|
1127
1230
|
}
|
|
1128
1231
|
]
|
|
1129
1232
|
}
|
|
@@ -1232,6 +1335,8 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1232
1335
|
this.containerSizes = []
|
|
1233
1336
|
this._containerClosureDate = ''
|
|
1234
1337
|
this._recallToggle = false
|
|
1338
|
+
this._showVasInfo = true
|
|
1339
|
+
this._showVasSummary = true
|
|
1235
1340
|
}
|
|
1236
1341
|
|
|
1237
1342
|
resetPage() {
|
|
@@ -1300,7 +1405,8 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1300
1405
|
imex: { header: i18next.t('field.inventory_list'), key: 'productName', width: 50, type: 'string' },
|
|
1301
1406
|
handlers: {
|
|
1302
1407
|
click: (columns, data, column, record, rowIndex) => {
|
|
1303
|
-
this.
|
|
1408
|
+
this._selectBy = 'product'
|
|
1409
|
+
this._openBulkProductSelection(this._selectBy, rowIndex)
|
|
1304
1410
|
}
|
|
1305
1411
|
},
|
|
1306
1412
|
width: 350
|
|
@@ -1412,7 +1518,8 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1412
1518
|
imex: { header: i18next.t('field.inventory_list'), key: 'productName', width: 50, type: 'string' },
|
|
1413
1519
|
handlers: {
|
|
1414
1520
|
click: (columns, data, column, record, rowIndex) => {
|
|
1415
|
-
this.
|
|
1521
|
+
this._selectBy = 'pallet'
|
|
1522
|
+
this._openBulkProductSelection(this._selectBy, rowIndex)
|
|
1416
1523
|
}
|
|
1417
1524
|
},
|
|
1418
1525
|
width: 350
|
|
@@ -1716,6 +1823,64 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1716
1823
|
}
|
|
1717
1824
|
}
|
|
1718
1825
|
|
|
1826
|
+
onVasChangeHandler(event) {
|
|
1827
|
+
this._updateVasTargets()
|
|
1828
|
+
const initialRecord = event.detail.before
|
|
1829
|
+
const changeRecord = event.detail.after
|
|
1830
|
+
const changedColumn = event.detail.column.name
|
|
1831
|
+
const inventoryData = this.inventoryData.records.find(invData => invData.id == event.detail.after.id)
|
|
1832
|
+
|
|
1833
|
+
try {
|
|
1834
|
+
if (changedColumn === 'qty') {
|
|
1835
|
+
if (changeRecord.qty === undefined) throw new Error(i18next.t('text.there_is_no_selected_items'))
|
|
1836
|
+
// total up the qty
|
|
1837
|
+
if (changeRecord.qty > inventoryData.releaseQty) {
|
|
1838
|
+
throw new Error(i18next.t('text.qty_exceed_release_qty'))
|
|
1839
|
+
}
|
|
1840
|
+
if (
|
|
1841
|
+
this.vasData?.records
|
|
1842
|
+
.filter(vas => vas.sku === changeRecord.sku && vas.batchId == changeRecord.batchId && vas.qty)
|
|
1843
|
+
.map(a => a.qty)
|
|
1844
|
+
.reduce((a, b) => a + b, 0) > inventoryData.releaseQty
|
|
1845
|
+
) {
|
|
1846
|
+
throw new Error(i18next.t('text.qty_exceed_release_qty'))
|
|
1847
|
+
} else if (changeRecord.qty <= 0) {
|
|
1848
|
+
throw new Error(i18next.t('text.invalid_quantity_input'))
|
|
1849
|
+
} else {
|
|
1850
|
+
let uomValue = initialRecord.releaseUomValue / initialRecord.releaseQty
|
|
1851
|
+
let newUomValue = initialRecord.newUomValue
|
|
1852
|
+
? initialRecord.qty
|
|
1853
|
+
? initialRecord.newUomValue / initialRecord.qty
|
|
1854
|
+
: initialRecord.newUomValue
|
|
1855
|
+
: null
|
|
1856
|
+
changeRecord.uomValue = uomValue * changeRecord.qty
|
|
1857
|
+
changeRecord.newUomValue ? (changeRecord.newUomValue = changeRecord.qty * newUomValue) : null
|
|
1858
|
+
changeRecord.vasQty = changeRecord.qty
|
|
1859
|
+
changeRecord.outputQty = null
|
|
1860
|
+
}
|
|
1861
|
+
} else if (changedColumn === 'outputQty' || changedColumn === 'vasQty' || changedColumn === 'newUomValue') {
|
|
1862
|
+
if (changeRecord.outputQty === undefined || changeRecord.vasQty === undefined)
|
|
1863
|
+
throw new Error(i18next.t('text.there_is_no_selected_items'))
|
|
1864
|
+
if (
|
|
1865
|
+
changeRecord.outputQty <= 0 ||
|
|
1866
|
+
changeRecord.vasQty <= 0 ||
|
|
1867
|
+
(initialRecord.newProductId && initialRecord.productId && changeRecord.newUomValue <= 0)
|
|
1868
|
+
) {
|
|
1869
|
+
throw new Error(i18next.t('text.invalid_quantity_input'))
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
this._updateVasTargets()
|
|
1873
|
+
} catch (e) {
|
|
1874
|
+
const beforeValue = event.detail.before && event.detail.before[event.detail.column.name]
|
|
1875
|
+
if (beforeValue) {
|
|
1876
|
+
event.detail.after[event.detail.column.name] = beforeValue
|
|
1877
|
+
} else {
|
|
1878
|
+
delete event.detail.after[event.detail.column.name]
|
|
1879
|
+
}
|
|
1880
|
+
this._showToast(e)
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1719
1884
|
_validateReleaseQty(releaseQty, remainQty) {
|
|
1720
1885
|
if (remainQty === undefined) throw new Error(i18next.t('text.there_is_no_selected_items'))
|
|
1721
1886
|
if (releaseQty > remainQty) {
|
|
@@ -1925,8 +2090,9 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1925
2090
|
// await this._executeRelatedTrxs()
|
|
1926
2091
|
let releaseGood = this._serializeForm(this.releaseOrderForm)
|
|
1927
2092
|
delete releaseGood.warehouseTransport
|
|
2093
|
+
releaseGood.vas = undefined
|
|
1928
2094
|
releaseGood.orderInventories = await this._getOrderInventories()
|
|
1929
|
-
releaseGood.orderVass = this._getOrderVass()
|
|
2095
|
+
// releaseGood.orderVass = this._getOrderVass()
|
|
1930
2096
|
releaseGood.ownTransport = this._ownTransport
|
|
1931
2097
|
releaseGood.type = RO_TYPES.B2B.value
|
|
1932
2098
|
releaseGood.orderMethod = this._pickingStd
|
|
@@ -1960,6 +2126,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1960
2126
|
},
|
|
1961
2127
|
shippingOrder: this._exportOption ? this._serializeForm(this.exportInfoForm) : null,
|
|
1962
2128
|
shippingOrderInfo: shippingOrderInfo ? shippingOrderInfo : null,
|
|
2129
|
+
orderVas: null,
|
|
1963
2130
|
attachments: this._document?.files ? this._document.files : undefined
|
|
1964
2131
|
},
|
|
1965
2132
|
context: { hasUpload: true }
|
|
@@ -1975,6 +2142,9 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1975
2142
|
this._selectedBillingPostCode = ''
|
|
1976
2143
|
this._recallInput.checked = false
|
|
1977
2144
|
|
|
2145
|
+
// create order Vas
|
|
2146
|
+
const orderVas = await this.createOrderVas(response.data.generateReleaseGood)
|
|
2147
|
+
|
|
1978
2148
|
navigate(`release_order_detail/${response.data.generateReleaseGood.name}`)
|
|
1979
2149
|
this._showToast({ message: i18next.t('text.release_order_created') })
|
|
1980
2150
|
} else {
|
|
@@ -2010,6 +2180,80 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2010
2180
|
}
|
|
2011
2181
|
}
|
|
2012
2182
|
|
|
2183
|
+
async createOrderVas(releaseGood) {
|
|
2184
|
+
let patches = this.vasData.records
|
|
2185
|
+
.filter(vas => vas.sku)
|
|
2186
|
+
.map(ov => {
|
|
2187
|
+
return {
|
|
2188
|
+
bizplace: { id: this._bizplaceId },
|
|
2189
|
+
cuFlag: '+',
|
|
2190
|
+
name: ov.vasGristId,
|
|
2191
|
+
newProduct: ov.newProductId,
|
|
2192
|
+
newProductDetail: ov.newProductDetailId,
|
|
2193
|
+
outputQty: ov.outputQty === null ? ov.qty : ov.outputQty,
|
|
2194
|
+
packingType: ov.packingType,
|
|
2195
|
+
productName: ov.productName,
|
|
2196
|
+
qty: ov.qty,
|
|
2197
|
+
releaseGood: releaseGood,
|
|
2198
|
+
remark: ov.remark,
|
|
2199
|
+
status: 'PENDING',
|
|
2200
|
+
batchId: ov.batchId,
|
|
2201
|
+
product: ov.product,
|
|
2202
|
+
productDetail: this.selectByPalletInput.checked ? { id: ov.productDetailId } : ov.productDetail,
|
|
2203
|
+
uom: ov.uom,
|
|
2204
|
+
uomValue: ov.uomValue,
|
|
2205
|
+
newPackingType: ov.newPackingType,
|
|
2206
|
+
newUom: ov.newUom,
|
|
2207
|
+
newUomValue: ov.newUomValue
|
|
2208
|
+
}
|
|
2209
|
+
})
|
|
2210
|
+
|
|
2211
|
+
const response = await client.mutate({
|
|
2212
|
+
mutation: gql`
|
|
2213
|
+
mutation updateMultipleOrderVas($patches: [OrderVasPatch!]!) {
|
|
2214
|
+
updateMultipleOrderVas(patches: $patches) {
|
|
2215
|
+
id
|
|
2216
|
+
name
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
`,
|
|
2220
|
+
variables: { patches }
|
|
2221
|
+
})
|
|
2222
|
+
|
|
2223
|
+
await this.createOrderVasItem(response.data.updateMultipleOrderVas)
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
async createOrderVasItem(orderVas) {
|
|
2227
|
+
let patches = this.vasData.records.map(ovi => {
|
|
2228
|
+
let ov = orderVas.filter(ov => ov.name == ovi.vasGristId).reduce(a => a)
|
|
2229
|
+
return {
|
|
2230
|
+
cuFlag: '+',
|
|
2231
|
+
name: `${ovi.vas.name}- ${ov.id}`,
|
|
2232
|
+
orderVas: ov,
|
|
2233
|
+
vas: {
|
|
2234
|
+
id: ovi.vas.id,
|
|
2235
|
+
name: ovi.vas.name,
|
|
2236
|
+
description: ovi.vas.description
|
|
2237
|
+
},
|
|
2238
|
+
vasQty: ovi.vasQty
|
|
2239
|
+
}
|
|
2240
|
+
})
|
|
2241
|
+
|
|
2242
|
+
const response = await client.mutate({
|
|
2243
|
+
mutation: gql`
|
|
2244
|
+
mutation updateMultipleOrderVasItem($patches: [OrderVasItemPatch!]!) {
|
|
2245
|
+
updateMultipleOrderVasItem(patches: $patches) {
|
|
2246
|
+
id
|
|
2247
|
+
name
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
`,
|
|
2251
|
+
variables: { patches }
|
|
2252
|
+
})
|
|
2253
|
+
|
|
2254
|
+
response
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2013
2257
|
async _executeRelatedTrxs() {
|
|
2014
2258
|
if (!this.vasGrist?.dirtyData?.records?.length) return
|
|
2015
2259
|
|
|
@@ -2096,7 +2340,86 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2096
2340
|
}
|
|
2097
2341
|
|
|
2098
2342
|
_validateVas() {
|
|
2099
|
-
|
|
2343
|
+
const roData = this.inventoryData.records
|
|
2344
|
+
roData.find(ro => {
|
|
2345
|
+
let newSKU = []
|
|
2346
|
+
this.vasData.records.map(vas => {
|
|
2347
|
+
if (vas.sku === ro.productSKU && vas.batchId === ro.batchId && vas.newSKU) {
|
|
2348
|
+
newSKU.push(vas)
|
|
2349
|
+
}
|
|
2350
|
+
})
|
|
2351
|
+
if (newSKU.length > 1) {
|
|
2352
|
+
const totalVasReleaseQty = newSKU.map(vas => vas.qty).reduce((a, b) => a + b, 0)
|
|
2353
|
+
if (totalVasReleaseQty > ro.releaseQty) {
|
|
2354
|
+
throw new Error(i18next.t('text.qty_vas_exceed_release_qty_sku', { sku: `${ro.productSKU} (${ro.batchId})` }))
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
})
|
|
2358
|
+
this.vasData.records.find(record => {
|
|
2359
|
+
if (!record.qty && record.sku)
|
|
2360
|
+
throw new Error(i18next.t('text.empty_field_field', { field: i18next.t('field.qty') }))
|
|
2361
|
+
if ((record.newPackingType || record.newUomValue || record.newUom) && !record.newSKU)
|
|
2362
|
+
throw new Error(i18next.t('text.empty_field_field', { field: i18next.t('field.new_sku') }))
|
|
2363
|
+
if (!record.vasQty) throw new Error(i18next.t('text.empty_field_field', { field: i18next.t('field.vas_qty') }))
|
|
2364
|
+
// enable empty outputQty
|
|
2365
|
+
// if (!record.outputQty && record.sku)
|
|
2366
|
+
// throw new Error(i18next.t('text.empty_field_field', { field: i18next.t('field.output_qty') }))
|
|
2367
|
+
if (!record.vas) throw new Error(i18next.t('text.empty_field_field', { field: i18next.t('field.vas') }))
|
|
2368
|
+
// allowing repacking to same SKU
|
|
2369
|
+
// if (record.productSKU == record.newSKU)
|
|
2370
|
+
// throw new Error(i18next.t('text.empty_field_field', { field: i18next.t('field.new_sku_same_as_original_sku') }))
|
|
2371
|
+
if (record.newSKU) {
|
|
2372
|
+
if (!record.newPackingType) {
|
|
2373
|
+
throw new Error(
|
|
2374
|
+
i18next.t('text.empty_field_field', { field: i18next.t('field.packing_type_sku', { sku: 'NEW SKU' }) })
|
|
2375
|
+
)
|
|
2376
|
+
}
|
|
2377
|
+
if (!record.newUom) {
|
|
2378
|
+
throw new Error(
|
|
2379
|
+
i18next.t('text.empty_field_field', { field: i18next.t('field.uom_sku', { sku: 'NEW SKU' }) })
|
|
2380
|
+
)
|
|
2381
|
+
}
|
|
2382
|
+
if (!record.newUomValue) {
|
|
2383
|
+
throw new Error(
|
|
2384
|
+
i18next.t('text.empty_field_field', { field: i18next.t('field.uom_value_sku', { sku: 'NEW SKU' }) })
|
|
2385
|
+
)
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
if (record.newUomValue < 0) {
|
|
2389
|
+
throw new Error(
|
|
2390
|
+
i18next.t('text.negative_value_field', { field: i18next.t('field.uom_value_sku', { sku: 'NEW SKU' }) })
|
|
2391
|
+
)
|
|
2392
|
+
}
|
|
2393
|
+
})
|
|
2394
|
+
|
|
2395
|
+
// unique
|
|
2396
|
+
const unique = []
|
|
2397
|
+
for (const item of this.vasData.records) {
|
|
2398
|
+
// "name" and "location" used for duplicate check
|
|
2399
|
+
const duplicate = unique.find(
|
|
2400
|
+
obj =>
|
|
2401
|
+
obj.name === item.name &&
|
|
2402
|
+
obj.vasGristId === item.vasGristId &&
|
|
2403
|
+
obj.vas.id === item.vas.id &&
|
|
2404
|
+
obj.remark === item.remark &&
|
|
2405
|
+
obj.qty === item.qty &&
|
|
2406
|
+
obj.vasQty === item.vasQty &&
|
|
2407
|
+
obj.outputQty === item.outputQty &&
|
|
2408
|
+
obj.newProductId === item.newProductId &&
|
|
2409
|
+
obj.uom === item.uom &&
|
|
2410
|
+
obj.uomValue === item.uomValue &&
|
|
2411
|
+
obj.newUom === item.newUom &&
|
|
2412
|
+
obj.newUomValue === item.newUomValue &&
|
|
2413
|
+
obj.newPackingType === item.newPackingType
|
|
2414
|
+
)
|
|
2415
|
+
if (!duplicate) {
|
|
2416
|
+
unique.push(item)
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2420
|
+
if (unique.length != this.vasData.records.length) {
|
|
2421
|
+
throw new Error(i18next.t('text.duplicate_entry_in_vas_details'))
|
|
2422
|
+
}
|
|
2100
2423
|
}
|
|
2101
2424
|
|
|
2102
2425
|
_openBulkProductSelection(type, rowIndex) {
|
|
@@ -2145,6 +2468,64 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2145
2468
|
}
|
|
2146
2469
|
}
|
|
2147
2470
|
|
|
2471
|
+
_openBulkProductSelectionForVas(type, rowIndex) {
|
|
2472
|
+
if (this._bizplaceId) {
|
|
2473
|
+
openPopup(
|
|
2474
|
+
html`
|
|
2475
|
+
<select-product-popup
|
|
2476
|
+
.bizplaceId="${this._bizplaceId}"
|
|
2477
|
+
@selected="${e => {
|
|
2478
|
+
try {
|
|
2479
|
+
if (!e.detail) {
|
|
2480
|
+
throw new Error(i18next.t('text.invalid_selection_more_than_one_product'))
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2483
|
+
let newRecords = {
|
|
2484
|
+
newSKU: e.detail.product.sku,
|
|
2485
|
+
newPackingType: e.detail.packingType,
|
|
2486
|
+
newUom: e.detail.uom,
|
|
2487
|
+
newProductId: e.detail.product.id,
|
|
2488
|
+
newUomValue: e.detail.uomValue,
|
|
2489
|
+
newProductDetailId: e.detail.productDetailId
|
|
2490
|
+
}
|
|
2491
|
+
// for (let i = 0; i < e.detail.multipleProducts.length; i++) {
|
|
2492
|
+
// newRecords.push(e.detail.multipleProducts[i])
|
|
2493
|
+
// }
|
|
2494
|
+
// update existing inventory data records
|
|
2495
|
+
this.vasGrist.dirtyData.records.splice(rowIndex, 1, {
|
|
2496
|
+
...this.vasGrist.dirtyData.records[rowIndex],
|
|
2497
|
+
...newRecords
|
|
2498
|
+
})
|
|
2499
|
+
|
|
2500
|
+
this.vasGrist.dirtyData.records.map(record => {
|
|
2501
|
+
record.newSKU
|
|
2502
|
+
? record.qty
|
|
2503
|
+
? (record.newUomValue = record.qty * record.newUomValue)
|
|
2504
|
+
: record.newUomValue
|
|
2505
|
+
: (record.newUomValue = null)
|
|
2506
|
+
})
|
|
2507
|
+
|
|
2508
|
+
// here
|
|
2509
|
+
this.vasData = {
|
|
2510
|
+
...this.vasData,
|
|
2511
|
+
records: [...this.vasGrist.dirtyData.records]
|
|
2512
|
+
}
|
|
2513
|
+
} catch (error) {
|
|
2514
|
+
this._showToast(error)
|
|
2515
|
+
}
|
|
2516
|
+
}}"
|
|
2517
|
+
></select-product-popup>
|
|
2518
|
+
`,
|
|
2519
|
+
{
|
|
2520
|
+
backdrop: true,
|
|
2521
|
+
size: 'large',
|
|
2522
|
+
title: i18next.t('title.select_item')
|
|
2523
|
+
}
|
|
2524
|
+
)
|
|
2525
|
+
} else {
|
|
2526
|
+
this._showToast({ message: i18next.t('text.company_selection_is_empty') })
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2148
2529
|
_updateInventoryGristConfig() {
|
|
2149
2530
|
if (this._pickingStd === PICKING_STANDARD.SELECT_BY_PRODUCT.value) {
|
|
2150
2531
|
const _selectedInv = (this.inventoryGrist.dirtyData.records || [])
|
|
@@ -2558,12 +2939,12 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2558
2939
|
return obj
|
|
2559
2940
|
}
|
|
2560
2941
|
|
|
2561
|
-
|
|
2942
|
+
openTargetproductVasPopup(record) {
|
|
2562
2943
|
try {
|
|
2563
2944
|
this.checkInventoryValidity()
|
|
2564
2945
|
openPopup(
|
|
2565
2946
|
html`
|
|
2566
|
-
<vas-
|
|
2947
|
+
<vas-target-product-popup
|
|
2567
2948
|
.targetList="${this.inventoryGrist.dirtyData.records
|
|
2568
2949
|
.map(record => {
|
|
2569
2950
|
const unitUomValue = record.releaseUomValue / record.releaseQty
|
|
@@ -2609,8 +2990,15 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2609
2990
|
.filter(record => record.packQty > 0)}"
|
|
2610
2991
|
.vasList="${this.vasData.records}"
|
|
2611
2992
|
.record="${record}"
|
|
2612
|
-
@
|
|
2613
|
-
const newRecords = e.detail
|
|
2993
|
+
@selected="${e => {
|
|
2994
|
+
const newRecords = e.detail.map(d => {
|
|
2995
|
+
return {
|
|
2996
|
+
...d,
|
|
2997
|
+
sku: d.productSKU,
|
|
2998
|
+
maxQty: d.releaseQty,
|
|
2999
|
+
uomValue: d.releaseUomValue / d.releaseQty
|
|
3000
|
+
}
|
|
3001
|
+
})
|
|
2614
3002
|
|
|
2615
3003
|
if (this.vasGrist.dirtyData.records.length !== this._selectedVasRecordIdx) {
|
|
2616
3004
|
// update existing vasData records
|
|
@@ -2626,8 +3014,23 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2626
3014
|
records: [...this.vasGrist.dirtyData.records, ...newRecords]
|
|
2627
3015
|
}
|
|
2628
3016
|
}
|
|
3017
|
+
// assign Id
|
|
3018
|
+
this.vasData = {
|
|
3019
|
+
...this.vasData,
|
|
3020
|
+
records: this.vasData.records.map(record => {
|
|
3021
|
+
return {
|
|
3022
|
+
...record,
|
|
3023
|
+
vasGristId: record.vasGristId ? record.vasGristId : `${record.batchId} (${record.sku})- ${uuidv4()}`
|
|
3024
|
+
}
|
|
3025
|
+
})
|
|
3026
|
+
}
|
|
3027
|
+
// sorting
|
|
3028
|
+
this.vasData = {
|
|
3029
|
+
...this.vasData,
|
|
3030
|
+
records: this.sortByNameField(this.vasData.records, 'vasGristId')
|
|
3031
|
+
}
|
|
2629
3032
|
}}"
|
|
2630
|
-
></vas-
|
|
3033
|
+
></vas-target-product-popup>
|
|
2631
3034
|
`,
|
|
2632
3035
|
{
|
|
2633
3036
|
backdrop: true,
|
|
@@ -2640,6 +3043,67 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2640
3043
|
}
|
|
2641
3044
|
}
|
|
2642
3045
|
|
|
3046
|
+
openSelectVasPopup(record, rowIndex) {
|
|
3047
|
+
try {
|
|
3048
|
+
openPopup(
|
|
3049
|
+
html`
|
|
3050
|
+
<select-vas-popup
|
|
3051
|
+
@selected="${e => {
|
|
3052
|
+
let newRecords = []
|
|
3053
|
+
for (let i = 0; i < e.detail.length; i++) {
|
|
3054
|
+
newRecords.push({ ...record, vas: e.detail[i] })
|
|
3055
|
+
}
|
|
3056
|
+
if (newRecords.length == 1) {
|
|
3057
|
+
// update existing inventory data records
|
|
3058
|
+
this.vasGrist.dirtyData.records.splice(rowIndex, 1, {
|
|
3059
|
+
...this.vasGrist.dirtyData.records[rowIndex],
|
|
3060
|
+
...newRecords[0]
|
|
3061
|
+
})
|
|
3062
|
+
this.vasData = {
|
|
3063
|
+
...this.vasData,
|
|
3064
|
+
records: [...this.vasGrist.dirtyData.records]
|
|
3065
|
+
}
|
|
3066
|
+
} else {
|
|
3067
|
+
// update existing inventory data records
|
|
3068
|
+
this.vasGrist.dirtyData.records.splice(rowIndex, 1, {
|
|
3069
|
+
...this.vasGrist.dirtyData.records[rowIndex],
|
|
3070
|
+
...newRecords[0]
|
|
3071
|
+
})
|
|
3072
|
+
this.vasData = {
|
|
3073
|
+
...this.vasData,
|
|
3074
|
+
records: [...this.vasGrist.dirtyData.records]
|
|
3075
|
+
}
|
|
3076
|
+
// add new data
|
|
3077
|
+
newRecords = newRecords.slice(1).map(nrecord => {
|
|
3078
|
+
return {
|
|
3079
|
+
vasGristId: record.vasGristId,
|
|
3080
|
+
vasQty: nrecord.vasQty,
|
|
3081
|
+
vas: nrecord.vas
|
|
3082
|
+
}
|
|
3083
|
+
})
|
|
3084
|
+
this.vasData = {
|
|
3085
|
+
...this.vasData,
|
|
3086
|
+
records: [...this.vasGrist.dirtyData.records, ...newRecords]
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
this.vasData = {
|
|
3090
|
+
...this.vasData,
|
|
3091
|
+
records: this.sortByNameField(this.vasData.records, 'vasGristId')
|
|
3092
|
+
}
|
|
3093
|
+
}}"
|
|
3094
|
+
></select-vas-popup>
|
|
3095
|
+
`,
|
|
3096
|
+
{
|
|
3097
|
+
backdrop: true,
|
|
3098
|
+
size: 'large',
|
|
3099
|
+
title: i18next.t('title.vas')
|
|
3100
|
+
}
|
|
3101
|
+
)
|
|
3102
|
+
} catch (e) {
|
|
3103
|
+
this._showToast(e)
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
|
|
2643
3107
|
checkInventoryValidity() {
|
|
2644
3108
|
const inventories = this.inventoryGrist?.dirtyData?.records
|
|
2645
3109
|
if (!inventories?.length) throw new Error(i18next.t('text.there_is_no_inventory'))
|
|
@@ -2985,16 +3449,33 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2985
3449
|
this._showReleasedOrderInfo = false
|
|
2986
3450
|
this._showShippingInfo = true
|
|
2987
3451
|
this._showExportInfo = true
|
|
3452
|
+
this._showVasInfo = true
|
|
3453
|
+
this._showVasSummary = true
|
|
2988
3454
|
} else if (key == 'shipment') {
|
|
2989
3455
|
this._showReleasedOrderInfo = true
|
|
2990
3456
|
this._showShippingInfo = false
|
|
2991
3457
|
this._showExportInfo = true
|
|
3458
|
+
this._showVasInfo = true
|
|
3459
|
+
this._showVasSummary = true
|
|
3460
|
+
} else if (key == 'vas') {
|
|
3461
|
+
this._showReleasedOrderInfo = true
|
|
3462
|
+
this._showShippingInfo = true
|
|
3463
|
+
this._showExportInfo = true
|
|
3464
|
+
this._showVasInfo = false
|
|
3465
|
+
this._showVasSummary = true
|
|
3466
|
+
} else if (key == 'vas summary') {
|
|
3467
|
+
this._showReleasedOrderInfo = true
|
|
3468
|
+
this._showShippingInfo = true
|
|
3469
|
+
this._showExportInfo = true
|
|
3470
|
+
this._showVasInfo = true
|
|
3471
|
+
this._showVasSummary = false
|
|
2992
3472
|
} else {
|
|
2993
3473
|
this.containerSizes = await getCodeByName('CONTAINER_SIZES')
|
|
2994
3474
|
|
|
2995
3475
|
this._showReleasedOrderInfo = true
|
|
2996
3476
|
this._showShippingInfo = true
|
|
2997
3477
|
this._showExportInfo = false
|
|
3478
|
+
this._showVasInfo = true
|
|
2998
3479
|
}
|
|
2999
3480
|
}
|
|
3000
3481
|
|
|
@@ -3050,6 +3531,154 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
3050
3531
|
}
|
|
3051
3532
|
}
|
|
3052
3533
|
|
|
3534
|
+
get vasSummaryConfig() {
|
|
3535
|
+
return {
|
|
3536
|
+
rows: {
|
|
3537
|
+
selectable: false,
|
|
3538
|
+
groups: [
|
|
3539
|
+
{ column: 'productSKU' },
|
|
3540
|
+
{ column: 'batchId' },
|
|
3541
|
+
{ column: 'releaseQty' },
|
|
3542
|
+
{ column: 'packingType' },
|
|
3543
|
+
{ column: 'uom' },
|
|
3544
|
+
{ column: 'releaseUomValue' }
|
|
3545
|
+
],
|
|
3546
|
+
totals: []
|
|
3547
|
+
},
|
|
3548
|
+
columns: [
|
|
3549
|
+
{
|
|
3550
|
+
type: 'string',
|
|
3551
|
+
name: 'productSKU',
|
|
3552
|
+
header: i18next.t('field.sku'),
|
|
3553
|
+
sortable: false,
|
|
3554
|
+
imex: { header: i18next.t('field.sku'), key: 'productSKU', width: 75, type: 'string' },
|
|
3555
|
+
width: 200
|
|
3556
|
+
},
|
|
3557
|
+
{
|
|
3558
|
+
type: 'string',
|
|
3559
|
+
name: 'batchId',
|
|
3560
|
+
header: i18next.t('field.batch_no'),
|
|
3561
|
+
sortable: false,
|
|
3562
|
+
imex: { header: i18next.t('field.batch_no'), key: 'batchId', width: 75, type: 'string' },
|
|
3563
|
+
width: 200
|
|
3564
|
+
},
|
|
3565
|
+
{
|
|
3566
|
+
type: 'integer',
|
|
3567
|
+
name: 'releaseQty',
|
|
3568
|
+
header: i18next.t('field.release_qty'),
|
|
3569
|
+
sortable: false,
|
|
3570
|
+
imex: { header: i18next.t('field.release_qty'), key: 'releaseQty', width: 75, type: 'integer' },
|
|
3571
|
+
width: 150
|
|
3572
|
+
},
|
|
3573
|
+
{
|
|
3574
|
+
type: 'string',
|
|
3575
|
+
name: 'packingType',
|
|
3576
|
+
header: i18next.t('field.packing_type'),
|
|
3577
|
+
sortable: false,
|
|
3578
|
+
imex: { header: i18next.t('field.product_type'), key: 'packingType', width: 25, type: 'string' },
|
|
3579
|
+
width: 150
|
|
3580
|
+
},
|
|
3581
|
+
{
|
|
3582
|
+
type: 'string',
|
|
3583
|
+
name: 'uom',
|
|
3584
|
+
header: i18next.t('field.uom'),
|
|
3585
|
+
imex: { header: i18next.t('field.uom'), key: 'uom', width: 25, type: 'string' },
|
|
3586
|
+
width: 150
|
|
3587
|
+
},
|
|
3588
|
+
{
|
|
3589
|
+
type: 'number',
|
|
3590
|
+
name: 'releaseUomValue',
|
|
3591
|
+
header: i18next.t('field.release_uom_value'),
|
|
3592
|
+
sortable: false,
|
|
3593
|
+
imex: { header: i18next.t('field.release_uom_value'), key: 'releaseUomValue', width: 25, type: 'string' },
|
|
3594
|
+
width: 150
|
|
3595
|
+
},
|
|
3596
|
+
{
|
|
3597
|
+
type: 'object',
|
|
3598
|
+
name: 'vas',
|
|
3599
|
+
header: i18next.t('field.vas'),
|
|
3600
|
+
sortable: false,
|
|
3601
|
+
imex: { header: i18next.t('field.vas'), key: 'vas', width: 25, type: 'string' },
|
|
3602
|
+
width: 150
|
|
3603
|
+
},
|
|
3604
|
+
{
|
|
3605
|
+
type: 'integer',
|
|
3606
|
+
name: 'vasQty',
|
|
3607
|
+
header: i18next.t('field.vas_qty'),
|
|
3608
|
+
sortable: false,
|
|
3609
|
+
imex: { header: i18next.t('field.vas_qty'), key: 'vasQty', width: 25, type: 'integer' },
|
|
3610
|
+
width: 150
|
|
3611
|
+
},
|
|
3612
|
+
{
|
|
3613
|
+
type: 'string',
|
|
3614
|
+
name: 'newSKU',
|
|
3615
|
+
header: i18next.t('field.new_sku'),
|
|
3616
|
+
sortable: false,
|
|
3617
|
+
imex: { header: i18next.t('field.new_sku'), key: 'newSKU', width: 25, type: 'string' },
|
|
3618
|
+
width: 150
|
|
3619
|
+
},
|
|
3620
|
+
{
|
|
3621
|
+
type: 'string',
|
|
3622
|
+
name: 'newPackingType',
|
|
3623
|
+
header: i18next.t('field.packing_type_sku', { sku: 'NEW SKU' }),
|
|
3624
|
+
sortable: false,
|
|
3625
|
+
imex: {
|
|
3626
|
+
header: i18next.t('field.packing_type_sku', { sku: 'NEW SKU' }),
|
|
3627
|
+
key: 'newPackingType',
|
|
3628
|
+
width: 25,
|
|
3629
|
+
type: 'string'
|
|
3630
|
+
},
|
|
3631
|
+
width: 150
|
|
3632
|
+
},
|
|
3633
|
+
{
|
|
3634
|
+
type: 'integer',
|
|
3635
|
+
name: 'outputQty',
|
|
3636
|
+
header: i18next.t('field.output_qty'),
|
|
3637
|
+
sortable: false,
|
|
3638
|
+
imex: { header: i18next.t('field.output_qty'), key: 'outputQty', width: 25, type: 'integer' },
|
|
3639
|
+
width: 150
|
|
3640
|
+
},
|
|
3641
|
+
{
|
|
3642
|
+
type: 'string',
|
|
3643
|
+
name: 'newUom',
|
|
3644
|
+
header: i18next.t('field.uom_sku', { sku: 'NEW SKU' }),
|
|
3645
|
+
sortable: false,
|
|
3646
|
+
imex: { header: i18next.t('field.uom_sku', { sku: 'NEW SKU' }), key: 'newUom', width: 25, type: 'string' },
|
|
3647
|
+
width: 150
|
|
3648
|
+
},
|
|
3649
|
+
{
|
|
3650
|
+
type: 'string',
|
|
3651
|
+
name: 'newUomValue',
|
|
3652
|
+
header: i18next.t('field.uom_value_sku', { sku: 'NEW SKU' }),
|
|
3653
|
+
sortable: false,
|
|
3654
|
+
imex: {
|
|
3655
|
+
header: i18next.t('field.uom_value_sku', { sku: 'NEW SKU' }),
|
|
3656
|
+
key: 'newUom',
|
|
3657
|
+
width: 25,
|
|
3658
|
+
type: 'string'
|
|
3659
|
+
},
|
|
3660
|
+
width: 150
|
|
3661
|
+
}
|
|
3662
|
+
]
|
|
3663
|
+
}
|
|
3664
|
+
}
|
|
3665
|
+
|
|
3666
|
+
sortByNameField(items, nameField, nameField2) {
|
|
3667
|
+
if (nameField2) {
|
|
3668
|
+
items?.sort((a, b) => {
|
|
3669
|
+
if (a[nameField] == b[nameField]) {
|
|
3670
|
+
return a[nameField2] > b[nameField2] ? 1 : a[nameField2] < b[nameField2] ? -1 : 0
|
|
3671
|
+
} else {
|
|
3672
|
+
return a[nameField] > b[nameField] ? 1 : a[nameField] < b[nameField] ? -1 : 0
|
|
3673
|
+
}
|
|
3674
|
+
})
|
|
3675
|
+
} else {
|
|
3676
|
+
items?.sort((a, b) => (a[nameField] > b[nameField] ? 1 : a[nameField] < b[nameField] ? -1 : 0))
|
|
3677
|
+
}
|
|
3678
|
+
|
|
3679
|
+
return items
|
|
3680
|
+
}
|
|
3681
|
+
|
|
3053
3682
|
_showToast({ type, message }) {
|
|
3054
3683
|
document.dispatchEvent(
|
|
3055
3684
|
new CustomEvent('notify', {
|