@things-factory/operato-wms 4.3.137 → 4.3.139
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/adjustment/transfer-inventory.js +14 -6
- package/client/pages/bulk-operation/bulk-operation.js +3 -1
- package/client/pages/components/select-inventory-popup.js +7 -1
- package/client/pages/components/select-product-popup.js +33 -3
- package/client/pages/constants/order.js +3 -1
- package/client/pages/inbound/external-return-worksheet.js +39 -2
- package/client/pages/inbound/undo-putaway-popup.js +5 -9
- package/client/pages/inbound/undo-unload-popup.js +42 -35
- package/client/pages/inbound/unload-product.js +79 -69
- package/client/pages/inventory/inventory-adjustment-approval.js +4 -5
- package/client/pages/inventory/inventory-adjustment.js +56 -2
- package/client/pages/inventory/inventory-by-product-detail.js +23 -17
- package/client/pages/inventory/inventory-by-product.js +7 -0
- package/client/pages/inventory/inventory-history-by-pallet.js +14 -5
- package/client/pages/inventory/inventory-history.js +10 -0
- package/client/pages/inventory-check/check-inventory-popup.js +1 -1
- package/client/pages/inventory-check/create-cycle-count.js +2 -3
- package/client/pages/inventory-check/inspecting-product.js +7 -3
- package/client/pages/manifest/create-loading-manifest.js +8 -1
- package/client/pages/manifest/loading-manifest-detail.js +7 -4
- package/client/pages/master/generate-location-list.js +30 -22
- package/client/pages/master/location-list.js +141 -70
- package/client/pages/master/pallet-list.js +137 -58
- package/client/pages/master/product/product-details-popup.js +3 -3
- package/client/pages/master/tote-list.js +40 -27
- package/client/pages/master/transport-driver.js +48 -41
- package/client/pages/master/transport-vehicle.js +45 -41
- package/client/pages/master/warehouse-list.js +56 -34
- package/client/pages/order/arrival-notice/arrival-notice-detail.js +36 -25
- package/client/pages/order/arrival-notice/create-arrival-notice.js +79 -97
- package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +2 -0
- package/client/pages/order/arrival-notice/edit-product-popup.js +10 -8
- package/client/pages/order/draft-release-good/draft-release-good-detail.js +88 -4
- package/client/pages/order/draft-release-good/draft-release-good-list.js +1 -1
- package/client/pages/order/release-order/create-release-order.js +34 -9
- package/client/pages/order/release-order/release-extra-product-popup.js +4 -1
- package/client/pages/order/release-order/release-order-detail.js +40 -3
- package/client/pages/order/return-order/create-return-order.js +5 -0
- package/client/pages/order/return-order/return-order-inventory-popup.js +1 -0
- package/client/pages/order/return-order/return-order-requests.js +37 -2
- package/client/pages/order/transport-order/delivery-note-popup.js +30 -24
- package/client/pages/order/transport-order/delivery-order-list.js +27 -1
- package/client/pages/outbound/inventory-reassign-popup.js +7 -3
- package/client/pages/outbound/packing-product.js +7 -7
- package/client/pages/outbound/packing-worksheet-list.js +3 -1
- package/client/pages/outbound/picking-product.js +17 -5
- package/client/pages/outbound/serial-number-popup.js +1 -1
- package/client/pages/outbound/show-my-worksheet-list-popup.js +12 -3
- package/client/pages/report/custom-elccl/elccl-daily-collection-report.js +5 -2
- package/client/pages/report/custom-elccl/elccl-daily-order-inventory-report.js +2 -2
- package/client/pages/report/custom-elccl/elccl-delivery-order-summary.js +34 -8
- package/client/pages/report/custom-elccl/elccl-inventory-pallet-detail-report.js +42 -4
- package/client/pages/report/custom-elccl/elccl-inventory-summary-report.js +46 -4
- package/client/pages/report/volume-summary-report.js +8 -3
- package/config.development.js +28 -21
- package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js +6 -5
- package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js.map +1 -1
- package/dist-server/graphql/resolvers/other/add-release-good-products.js +7 -11
- package/dist-server/graphql/resolvers/other/add-release-good-products.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/costing-report.js +18 -24
- package/dist-server/graphql/resolvers/reports/costing-report.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js +6 -6
- package/dist-server/graphql/resolvers/reports/inbound-serial-number-report.js +1 -1
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +8 -9
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/release-inventory-report.js +3 -3
- package/dist-server/graphql/resolvers/reports/release-inventory-report.js.map +1 -1
- package/package.json +24 -24
- package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.ts +6 -5
- package/server/graphql/resolvers/other/add-release-good-products.ts +8 -12
- package/server/graphql/resolvers/reports/costing-report.ts +18 -24
- package/server/graphql/resolvers/reports/inbound-order-details-report.ts +6 -6
- package/server/graphql/resolvers/reports/inbound-serial-number-report.ts +1 -1
- package/server/graphql/resolvers/reports/outbound-order-details-report.ts +8 -9
- package/server/graphql/resolvers/reports/release-inventory-report.ts +6 -4
- package/translations/en.json +28 -3
- package/translations/ko.json +26 -2
- package/translations/ms.json +26 -2
- package/translations/zh.json +26 -2
|
@@ -872,7 +872,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
|
|
|
872
872
|
|
|
873
873
|
if (changedColumn === 'unitPrice') {
|
|
874
874
|
let unitPrice = changeRecord.unitPrice
|
|
875
|
-
if (typeof unitPrice === undefined || unitPrice < 0) {
|
|
875
|
+
if (typeof unitPrice === undefined || unitPrice < 0 || isNaN(unitPrice)) {
|
|
876
876
|
throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.unit_price') } }))
|
|
877
877
|
}
|
|
878
878
|
}
|
|
@@ -1004,49 +1004,6 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
|
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
1006
|
|
|
1007
|
-
async fetchProducts(bizplace = []) {
|
|
1008
|
-
const filters = [...bizplace]
|
|
1009
|
-
|
|
1010
|
-
const response = await client.query({
|
|
1011
|
-
query: gql`
|
|
1012
|
-
query productDetails($filters: [Filter!]!) {
|
|
1013
|
-
productDetails(filters: $filters) {
|
|
1014
|
-
items {
|
|
1015
|
-
id
|
|
1016
|
-
packingType
|
|
1017
|
-
packingSize
|
|
1018
|
-
uom
|
|
1019
|
-
uomValue
|
|
1020
|
-
isDefault
|
|
1021
|
-
product {
|
|
1022
|
-
id
|
|
1023
|
-
name
|
|
1024
|
-
sku
|
|
1025
|
-
description
|
|
1026
|
-
type
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
`,
|
|
1032
|
-
variables: { filters }
|
|
1033
|
-
})
|
|
1034
|
-
|
|
1035
|
-
if (!response.errors) {
|
|
1036
|
-
return (
|
|
1037
|
-
response.data.productDetails.items.map(item => {
|
|
1038
|
-
return {
|
|
1039
|
-
...item,
|
|
1040
|
-
productId: item.product.id,
|
|
1041
|
-
sku: item.product.sku,
|
|
1042
|
-
name: item.product.name,
|
|
1043
|
-
description: item.product.description
|
|
1044
|
-
}
|
|
1045
|
-
}) || []
|
|
1046
|
-
)
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
1007
|
async _generateArrivalNotice() {
|
|
1051
1008
|
try {
|
|
1052
1009
|
this._validateForm()
|
|
@@ -1210,7 +1167,12 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
|
|
|
1210
1167
|
_validateForm() {
|
|
1211
1168
|
if (!this.arrivalNoticeForm.checkValidity()) throw new Error(i18next.t('text.arrival_notice_form_invalid'))
|
|
1212
1169
|
|
|
1213
|
-
if (this._hasContainer)
|
|
1170
|
+
if (this._hasContainer) {
|
|
1171
|
+
if (!this.containerNo.value) throw new Error(i18next.t('text.container_no_is_empty'))
|
|
1172
|
+
|
|
1173
|
+
if (!this.arrivalNoticeForm?.containerSize?.value || this.arrivalNoticeForm?.containerSize?.value == '')
|
|
1174
|
+
throw new Error(i18next.t('text.please_select_container_size'))
|
|
1175
|
+
}
|
|
1214
1176
|
|
|
1215
1177
|
if (this._ownTransport && this._warehouseTransport)
|
|
1216
1178
|
throw new Error(i18next.t('text.you_can_only_select_one_transport_type'))
|
|
@@ -1218,21 +1180,24 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
|
|
|
1218
1180
|
throw new Error(i18next.t('text.please_select_transport_type'))
|
|
1219
1181
|
}
|
|
1220
1182
|
|
|
1221
|
-
_validateProducts() {
|
|
1183
|
+
_validateProducts(records = []) {
|
|
1222
1184
|
// no records
|
|
1223
|
-
|
|
1185
|
+
if (!records?.length) records = this.productGrist.dirtyData.records
|
|
1224
1186
|
if (!records?.length) throw new Error(i18next.t('text.no_products'))
|
|
1225
1187
|
|
|
1226
1188
|
this._checkProductDuplication()
|
|
1227
1189
|
|
|
1228
|
-
const checkRequiredFields = ({ batchId,
|
|
1229
|
-
!batchId || !packingType || !uomValue || !uom || !packQty
|
|
1190
|
+
const checkRequiredFields = ({ batchId, packQty }) => !batchId || !packQty
|
|
1230
1191
|
|
|
1231
1192
|
// required field (batchId, packingType, uomValue, uom, packQty, palletQty)
|
|
1232
1193
|
if (records.some(checkRequiredFields)) {
|
|
1233
1194
|
throw new Error(i18next.t('text.empty_value_in_list'))
|
|
1234
1195
|
}
|
|
1235
1196
|
|
|
1197
|
+
if (records.some(({ unitPrice }) => unitPrice < 0)) {
|
|
1198
|
+
throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.unit_price') } }))
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1236
1201
|
if (records.some(({ packQty }) => packQty < 0)) {
|
|
1237
1202
|
throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.pack_qty') } }))
|
|
1238
1203
|
}
|
|
@@ -1352,6 +1317,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
|
|
|
1352
1317
|
batchId: record.batchId,
|
|
1353
1318
|
batchIdRef: record?.batchIdRef ? record.batchIdRef : null,
|
|
1354
1319
|
product: { id: record.product.id },
|
|
1320
|
+
productDetail: record?.productDetail?.id ? record.productDetail : { id: record.productDetailId },
|
|
1355
1321
|
packingType: record.packingType,
|
|
1356
1322
|
packingSize: record.packingSize || record.product.packingSize,
|
|
1357
1323
|
uomValue: record?.uomValue ? record.uomValue : 0,
|
|
@@ -1698,69 +1664,83 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
|
|
|
1698
1664
|
primaryUnit
|
|
1699
1665
|
primaryValue
|
|
1700
1666
|
}
|
|
1667
|
+
productDetail {
|
|
1668
|
+
id
|
|
1669
|
+
}
|
|
1701
1670
|
}
|
|
1702
1671
|
}
|
|
1703
1672
|
`,
|
|
1704
1673
|
variables: { orderProducts: patches, partnerBizplaceId: this._bizplaceId }
|
|
1705
1674
|
})
|
|
1706
|
-
|
|
1707
|
-
if (
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
packQty: parseFloat(item.packQty) || '',
|
|
1714
|
-
palletQty: parseFloat(item.palletQty) || ''
|
|
1715
|
-
}
|
|
1716
|
-
})
|
|
1717
|
-
this.productData = {
|
|
1718
|
-
...this.productData,
|
|
1719
|
-
records: data.map((dt, idx) => {
|
|
1675
|
+
let foundErrors = response.data.bulkUploadValidateOrderProducts.find(item => item.isError != 0)
|
|
1676
|
+
if (foundErrors) {
|
|
1677
|
+
return this._showToast({ message: i18next.t('text.invalid_product_sku') })
|
|
1678
|
+
}
|
|
1679
|
+
if (!foundErrors) {
|
|
1680
|
+
if (!response.errors) {
|
|
1681
|
+
const data = response.data.bulkUploadValidateOrderProducts.map(item => {
|
|
1720
1682
|
return {
|
|
1721
|
-
...
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1683
|
+
...item,
|
|
1684
|
+
productName: item?.productName,
|
|
1685
|
+
unitPrice: parseFloat(item.unitPrice) || '',
|
|
1686
|
+
packQty: parseFloat(item.packQty) || '',
|
|
1687
|
+
palletQty: parseFloat(item.palletQty) || ''
|
|
1725
1688
|
}
|
|
1726
1689
|
})
|
|
1690
|
+
this.productData = {
|
|
1691
|
+
...this.productData,
|
|
1692
|
+
records: data.map((dt, idx) => {
|
|
1693
|
+
return {
|
|
1694
|
+
...dt,
|
|
1695
|
+
id: idx,
|
|
1696
|
+
name: idx,
|
|
1697
|
+
__dirty__: '+'
|
|
1698
|
+
}
|
|
1699
|
+
})
|
|
1700
|
+
}
|
|
1701
|
+
this.productGrist.fetch()
|
|
1702
|
+
} else {
|
|
1703
|
+
throw response.errors
|
|
1727
1704
|
}
|
|
1728
|
-
|
|
1729
|
-
this.productGrist.fetch()
|
|
1730
1705
|
}
|
|
1731
1706
|
}
|
|
1732
1707
|
|
|
1733
1708
|
async importHandler(patches) {
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1709
|
+
try {
|
|
1710
|
+
patches.map(itm => {
|
|
1711
|
+
itm.unitPrice = parseFloat(itm.unitPrice) || ''
|
|
1712
|
+
if (itm.manufactureDate) {
|
|
1713
|
+
let mdt = new Date(itm.manufactureDate)
|
|
1714
|
+
itm.manufactureDate =
|
|
1715
|
+
mdt < new Date() ? `${mdt.getFullYear()}-${mdt.getMonth() + 1}-${mdt.getDate()}` || '' : ''
|
|
1716
|
+
} else {
|
|
1717
|
+
delete itm.manufactureDate
|
|
1718
|
+
}
|
|
1719
|
+
itm.uomValue = parseFloat(itm.uomValue) || ''
|
|
1720
|
+
itm.packQty = parseInt(itm.packQty) || ''
|
|
1721
|
+
itm.palletQty = parseInt(itm.palletQty) || ''
|
|
1722
|
+
})
|
|
1747
1723
|
|
|
1748
|
-
|
|
1749
|
-
|
|
1724
|
+
const orderProducts = patches.map(patch => {
|
|
1725
|
+
delete patch.cuFlag
|
|
1726
|
+
return {
|
|
1727
|
+
...patch,
|
|
1728
|
+
unitPrice: parseFloat(patch.unitPrice) || 0,
|
|
1729
|
+
uomValue: parseFloat(patch.uomValue) || 0,
|
|
1730
|
+
packQty: parseInt(patch.packQty) || 0,
|
|
1731
|
+
palletQty: parseInt(patch.palletQty) || 0
|
|
1732
|
+
}
|
|
1733
|
+
})
|
|
1734
|
+
// redundant as records also patched during bulkUploadValidateOrderProducts and we don't need it to write on grist before validation
|
|
1735
|
+
// this.productData = {
|
|
1736
|
+
// records: [...patches]
|
|
1737
|
+
// }
|
|
1738
|
+
await this.bulkUploadValidateOrderProducts(orderProducts)
|
|
1739
|
+
history.back()
|
|
1740
|
+
} catch (e) {
|
|
1741
|
+
history.back()
|
|
1742
|
+
return
|
|
1750
1743
|
}
|
|
1751
|
-
|
|
1752
|
-
const orderProducts = patches.map(patch => {
|
|
1753
|
-
delete patch.cuFlag
|
|
1754
|
-
return {
|
|
1755
|
-
...patch,
|
|
1756
|
-
unitPrice: parseFloat(patch.unitPrice) || 0,
|
|
1757
|
-
uomValue: parseFloat(patch.uomValue) || 0,
|
|
1758
|
-
packQty: parseFloat(patch.packQty) || 0,
|
|
1759
|
-
palletQty: parseFloat(patch.palletQty) || 0
|
|
1760
|
-
}
|
|
1761
|
-
})
|
|
1762
|
-
await this.bulkUploadValidateOrderProducts(orderProducts)
|
|
1763
|
-
history.back()
|
|
1764
1744
|
}
|
|
1765
1745
|
|
|
1766
1746
|
async _importableData(records) {
|
|
@@ -1774,6 +1754,8 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
|
|
|
1774
1754
|
}
|
|
1775
1755
|
})
|
|
1776
1756
|
|
|
1757
|
+
this._validateProducts(records)
|
|
1758
|
+
|
|
1777
1759
|
openPopup(
|
|
1778
1760
|
html`
|
|
1779
1761
|
<import-pop-up
|
|
@@ -1425,6 +1425,7 @@ class DuplicateArrivalNotice extends localize(i18next)(PageView) {
|
|
|
1425
1425
|
batchId: record.batchId,
|
|
1426
1426
|
batchIdRef: record?.batchIdRef ? record.batchIdRef : null,
|
|
1427
1427
|
product: { id: record.product.id },
|
|
1428
|
+
productDetail: { id: record.productDetailId },
|
|
1428
1429
|
packingType: record.packingType,
|
|
1429
1430
|
packingSize: record?.product?.packingSize ? record.product.packingSize : record.packingSize,
|
|
1430
1431
|
uomValue: record?.uomValue ? record.uomValue : 0,
|
|
@@ -1480,6 +1481,7 @@ class DuplicateArrivalNotice extends localize(i18next)(PageView) {
|
|
|
1480
1481
|
} else if (record.targetType === VAS_BATCH_AND_PRODUCT_TYPE) {
|
|
1481
1482
|
result.targetBatchId = record.target.batchId
|
|
1482
1483
|
result.targetProduct = { id: record.target.productId }
|
|
1484
|
+
result.targetProductDetail = { id: record.target.productDetailId }
|
|
1483
1485
|
result.packingType = record.packingType
|
|
1484
1486
|
result.qty = record.qty
|
|
1485
1487
|
result.uomValue = record.uomValue
|
|
@@ -406,7 +406,7 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
|
|
|
406
406
|
return this.shadowRoot.querySelector('data-grist#addProduct')
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
-
_onProductChangeHandler(event) {
|
|
409
|
+
async _onProductChangeHandler(event) {
|
|
410
410
|
try {
|
|
411
411
|
this._checkProductDuplication()
|
|
412
412
|
let changeRecord = event.detail.after
|
|
@@ -423,15 +423,15 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
|
|
|
423
423
|
|
|
424
424
|
const amountRelatedColumns = ['uomValue', 'uom', 'packQty']
|
|
425
425
|
if (amountRelatedColumns.indexOf(changedColumn) >= 0) {
|
|
426
|
-
const calcedAmount = this._calcAmount(changedColumn, changeRecord)
|
|
426
|
+
const calcedAmount = await this._calcAmount(changedColumn, changeRecord)
|
|
427
427
|
for (let key in calcedAmount) {
|
|
428
|
-
changeRecord[key] = calcedAmount[key]
|
|
428
|
+
changeRecord[key] = key == 'packQty' ? Math.ceil(calcedAmount[key]) : calcedAmount[key]
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
431
|
|
|
432
432
|
if (changedColumn === 'unitPrice') {
|
|
433
433
|
let unitPrice = changeRecord.unitPrice
|
|
434
|
-
if (typeof unitPrice === undefined || unitPrice < 0) {
|
|
434
|
+
if (typeof unitPrice === undefined || unitPrice < 0 || isNaN(unitPrice)) {
|
|
435
435
|
throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.unit_price') } }))
|
|
436
436
|
}
|
|
437
437
|
}
|
|
@@ -596,8 +596,8 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
|
|
|
596
596
|
let existingOrderProducts = []
|
|
597
597
|
let newOrderProducts = []
|
|
598
598
|
|
|
599
|
-
existingOrderProducts = this._getExistingOrderProducts()
|
|
600
|
-
newOrderProducts = this._getNewOrderProducts()
|
|
599
|
+
existingOrderProducts = await this._getExistingOrderProducts()
|
|
600
|
+
newOrderProducts = await this._getNewOrderProducts()
|
|
601
601
|
|
|
602
602
|
if (existingOrderProducts?.length || newOrderProducts?.length) {
|
|
603
603
|
const result = await CustomAlert({
|
|
@@ -624,8 +624,8 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
|
|
|
624
624
|
`,
|
|
625
625
|
variables: {
|
|
626
626
|
ganNo: this.ganNo,
|
|
627
|
-
newOrderProducts
|
|
628
|
-
existingOrderProducts
|
|
627
|
+
newOrderProducts,
|
|
628
|
+
existingOrderProducts
|
|
629
629
|
}
|
|
630
630
|
})
|
|
631
631
|
|
|
@@ -650,6 +650,7 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
|
|
|
650
650
|
palletQty: 0,
|
|
651
651
|
adjustedPalletQty: record?.palletQty ? record.palletQty : null,
|
|
652
652
|
product: { id: record.product.id },
|
|
653
|
+
productDetail: { id: record.productDetailId },
|
|
653
654
|
packingType: 'N/A',
|
|
654
655
|
adjustedPackingType: record.packingType,
|
|
655
656
|
uomValue: 0,
|
|
@@ -682,6 +683,7 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
|
|
|
682
683
|
adjustedBatchIdRef: record.batchIdRef === record.__origin__.batchIdRef ? null : record.batchIdRef,
|
|
683
684
|
adjustedPalletQty: record.palletQty == record.__origin__.palletQty ? null : record.palletQty,
|
|
684
685
|
product: { id: record.product.id },
|
|
686
|
+
productDetail: { id: record.productDetail.id },
|
|
685
687
|
adjustedPackingType: record.packingType === record.__origin__.packingType ? null : record.packingType,
|
|
686
688
|
adjustedUomValue: record.uomValue == record.__origin__.uomValue ? null : record.uomValue,
|
|
687
689
|
adjustedUom: record.uom === record.__origin__.uom ? null : record.uom,
|
|
@@ -14,6 +14,7 @@ import { fetchSettingRule } from '@things-factory/setting-ui'
|
|
|
14
14
|
import { client, CustomAlert, navigate, PageView, store } from '@things-factory/shell'
|
|
15
15
|
import { CommonButtonStyles } from '@things-factory/styles'
|
|
16
16
|
import { flattenObject, isMobileDevice } from '@things-factory/utils'
|
|
17
|
+
import isEmpty from 'lodash-es/isEmpty'
|
|
17
18
|
|
|
18
19
|
import { DRAFT_RELEASE_ORDER_STATUS, PRODUCT_GROUP_TYPES } from '../../../constants'
|
|
19
20
|
|
|
@@ -223,6 +224,7 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
|
|
|
223
224
|
get context() {
|
|
224
225
|
let actions = []
|
|
225
226
|
|
|
227
|
+
// first time getting the draft order data
|
|
226
228
|
if (this._draftOrderData) {
|
|
227
229
|
actions = [
|
|
228
230
|
{
|
|
@@ -480,6 +482,7 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
|
|
|
480
482
|
|
|
481
483
|
if (!this._packingTypes) this._packingTypes = await getCodeByName('PACKING_TYPES')
|
|
482
484
|
|
|
485
|
+
// getting orderNo and see whether it's enw or existing draft order
|
|
483
486
|
let orderNo = changes.resourceId || this._orderNo
|
|
484
487
|
this._orderNo = orderNo == 'new' ? '' : orderNo
|
|
485
488
|
await this._fetchOrder()
|
|
@@ -543,7 +546,8 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
|
|
|
543
546
|
let returnObj = {
|
|
544
547
|
...record,
|
|
545
548
|
...record.product,
|
|
546
|
-
product: { ...record.product, id: record.product
|
|
549
|
+
product: { ...record.product, id: record.product?.id || record.product.productId },
|
|
550
|
+
productDetail: { id: record.productDetail?.id || record.product.productDetailId },
|
|
547
551
|
name: record.name ? record.name : idx,
|
|
548
552
|
releaseQty: record.releaseQty < 0 ? 0 : record.releaseQty,
|
|
549
553
|
id: record.id
|
|
@@ -597,6 +601,7 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
|
|
|
597
601
|
select: [
|
|
598
602
|
{ name: 'id', hidden: true },
|
|
599
603
|
{ name: 'productId', hidden: true },
|
|
604
|
+
{ name: 'productDetailId', hidden: true },
|
|
600
605
|
{ name: 'remainUomValue', hidden: true },
|
|
601
606
|
{
|
|
602
607
|
name: 'groupType',
|
|
@@ -816,6 +821,9 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
|
|
|
816
821
|
sku
|
|
817
822
|
description
|
|
818
823
|
}
|
|
824
|
+
productDetail {
|
|
825
|
+
id
|
|
826
|
+
}
|
|
819
827
|
packingType
|
|
820
828
|
packingSize
|
|
821
829
|
uomValue
|
|
@@ -855,10 +863,10 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
|
|
|
855
863
|
|
|
856
864
|
if (!response.errors) {
|
|
857
865
|
this._draftOrderData = {
|
|
866
|
+
// this is where data is
|
|
858
867
|
...response.data.draftReleaseGoodByName
|
|
859
868
|
// shippingOrder: this._exportOption ? this._serializeForm(this._shippingOrderForm) : null
|
|
860
869
|
}
|
|
861
|
-
|
|
862
870
|
this._productData = {
|
|
863
871
|
records: response.data.draftReleaseGoodByName.orderProducts.map(itm => {
|
|
864
872
|
return {
|
|
@@ -906,6 +914,10 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
|
|
|
906
914
|
this._validateForm()
|
|
907
915
|
this._validateProducts()
|
|
908
916
|
|
|
917
|
+
if (this._draftOrderData.bizplace.id != null) {
|
|
918
|
+
this._validateChanges()
|
|
919
|
+
}
|
|
920
|
+
|
|
909
921
|
const result = await CustomAlert({
|
|
910
922
|
title: i18next.t('title.are_you_sure'),
|
|
911
923
|
text: i18next.t('text.update_draft_release_order'),
|
|
@@ -1003,8 +1015,30 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
|
|
|
1003
1015
|
_validateForm() {
|
|
1004
1016
|
if (!this._draftReleaseOrderForm.checkValidity()) throw new Error(i18next.t('text.draft_order_form_invalid'))
|
|
1005
1017
|
|
|
1006
|
-
if (this._draftOrderData?.container && !this.containerNo.value)
|
|
1007
|
-
|
|
1018
|
+
// if (this._draftOrderData?.container && !this.containerNo.value)
|
|
1019
|
+
// throw new Error(i18next.t('text.container_no_is_empty'))
|
|
1020
|
+
|
|
1021
|
+
if (this._exportOption == true) {
|
|
1022
|
+
let e = ''
|
|
1023
|
+
if (
|
|
1024
|
+
isEmpty(this._shippingOrderForm.containerNo.value) ||
|
|
1025
|
+
isEmpty(this._shippingOrderForm.shipName.value) ||
|
|
1026
|
+
isEmpty(this._shippingOrderForm.containerArrivalDate.value) ||
|
|
1027
|
+
isEmpty(this._shippingOrderForm.containerLeavingDate.value)
|
|
1028
|
+
) {
|
|
1029
|
+
if (isEmpty(this._shippingOrderForm.containerNo.value)) e = i18next.t('text.container_no_is_empty')
|
|
1030
|
+
|
|
1031
|
+
if (isEmpty(this._shippingOrderForm.shipName.value)) e = i18next.t('text.ship_name_is_empty')
|
|
1032
|
+
|
|
1033
|
+
if (isEmpty(this._shippingOrderForm.containerArrivalDate.value))
|
|
1034
|
+
e = i18next.t('text.container_arrival_date_is_empty')
|
|
1035
|
+
|
|
1036
|
+
if (isEmpty(this._shippingOrderForm.containerLeavingDate.value))
|
|
1037
|
+
e = i18next.t('text.container_leaving_date_is_empty')
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
if (e != '') throw new Error(e)
|
|
1041
|
+
}
|
|
1008
1042
|
}
|
|
1009
1043
|
|
|
1010
1044
|
_validateProducts() {
|
|
@@ -1028,6 +1062,15 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
|
|
|
1028
1062
|
if (this._productGrist.dirtyData.records.some(record => !record.releaseQty))
|
|
1029
1063
|
throw new Error(i18next.t('text.invalid_release_qty'))
|
|
1030
1064
|
|
|
1065
|
+
// data changes validator
|
|
1066
|
+
if (this._draftOrderData.bizplace.id != null) {
|
|
1067
|
+
// // check changes in form info
|
|
1068
|
+
// let checkFormInfoChange = this._serializeForm(this._draftReleaseOrderForm).refNo == this._draftOrderData.refNo && this._serializeForm(this._draftReleaseOrderForm).refNo2 == this._draftOrderData.refNo2 && this._serializeForm(this._draftReleaseOrderForm).refNo3 == this._draftOrderData.refNo3 && this._serializeForm(this._draftReleaseOrderForm).releaseDate == this._draftOrderData.releaseDate && this._serializeForm(this._draftReleaseOrderForm).collectionOrderNo == this._draftOrderData.collectionOrderNo
|
|
1069
|
+
// // check changes in product
|
|
1070
|
+
// let checkProductDataChange = this._compareArray(this._productGrist.dirtyData.records, this.___draftOrderData.orderProducts)
|
|
1071
|
+
// if (checkFormInfoChange == true && checkProductDataChange != true)
|
|
1072
|
+
// throw new Error(i18next.t('text.nothing_changed'))
|
|
1073
|
+
}
|
|
1031
1074
|
return true
|
|
1032
1075
|
}
|
|
1033
1076
|
|
|
@@ -1036,12 +1079,30 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
|
|
|
1036
1079
|
return formData
|
|
1037
1080
|
}
|
|
1038
1081
|
|
|
1082
|
+
_compareArray(a, b) {
|
|
1083
|
+
// Comparing the length of each array
|
|
1084
|
+
if (a.length != b.length) return true
|
|
1085
|
+
else {
|
|
1086
|
+
for (var i = 0; i < a.length; i++) {
|
|
1087
|
+
// compare releaseQty of both array
|
|
1088
|
+
if (a[i].releaseQty != b[i].releaseQty) {
|
|
1089
|
+
return true
|
|
1090
|
+
}
|
|
1091
|
+
// compare product of both array
|
|
1092
|
+
if (a[i].product.id != b[i].product.id) {
|
|
1093
|
+
return true
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1039
1099
|
_getOrderProducts() {
|
|
1040
1100
|
return this._productGrist.dirtyData.records.map(record => {
|
|
1041
1101
|
let orderProduct = {
|
|
1042
1102
|
id: record.id ? record.id.toString() : null,
|
|
1043
1103
|
name: record.name ? record.name.toString() : null,
|
|
1044
1104
|
product: { id: record.product.id },
|
|
1105
|
+
productDetail: { id: record.productDetail.id },
|
|
1045
1106
|
packingType: record.packingType,
|
|
1046
1107
|
uomValue: record?.uomValue ? record.uomValue : 0,
|
|
1047
1108
|
uom: record.uom,
|
|
@@ -1071,6 +1132,29 @@ class DraftReleaseGoodDetail extends connect(store)(localize(i18next)(PageView))
|
|
|
1071
1132
|
return inputDate
|
|
1072
1133
|
}
|
|
1073
1134
|
|
|
1135
|
+
_validateChanges() {
|
|
1136
|
+
// check changes in form info
|
|
1137
|
+
let checkFormInfoChange =
|
|
1138
|
+
this._serializeForm(this._draftReleaseOrderForm).refNo == this._draftOrderData.refNo &&
|
|
1139
|
+
this._serializeForm(this._draftReleaseOrderForm).refNo2 == this._draftOrderData.refNo2 &&
|
|
1140
|
+
this._serializeForm(this._draftReleaseOrderForm).refNo3 == this._draftOrderData.refNo3 &&
|
|
1141
|
+
this._serializeForm(this._draftReleaseOrderForm).releaseDate == this._draftOrderData.releaseDate &&
|
|
1142
|
+
this._serializeForm(this._draftReleaseOrderForm).collectionOrderNo == this._draftOrderData.collectionOrderNo
|
|
1143
|
+
// check changes in shipping form info
|
|
1144
|
+
let checkShippingFormInfo =
|
|
1145
|
+
this._draftOrderData.shippingOrder.containerNo == this._shippingOrderForm.containerNo.value &&
|
|
1146
|
+
this._draftOrderData.shippingOrder.containerArrivalDate == this._shippingOrderForm.containerArrivalDate.value &&
|
|
1147
|
+
this._draftOrderData.shippingOrder.containerLeavingDate == this._shippingOrderForm.containerLeavingDate.value &&
|
|
1148
|
+
this._draftOrderData.shippingOrder.shipName == this._shippingOrderForm.shipName.value
|
|
1149
|
+
// check changes in product
|
|
1150
|
+
let checkProductDataChange = this._compareArray(
|
|
1151
|
+
this._productGrist.dirtyData.records,
|
|
1152
|
+
this.___draftOrderData.orderProducts
|
|
1153
|
+
)
|
|
1154
|
+
if (checkFormInfoChange == true && checkProductDataChange != true && checkShippingFormInfo == true)
|
|
1155
|
+
throw new Error(i18next.t('text.nothing_changed'))
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1074
1158
|
_clearView() {
|
|
1075
1159
|
this.refNo = ''
|
|
1076
1160
|
this.refNo2 = ''
|
|
@@ -197,7 +197,7 @@ class DraftReleaseGoodList extends localize(i18next)(PageView) {
|
|
|
197
197
|
this.config = {
|
|
198
198
|
rows: { selectable: { multiple: true }, appendable: false },
|
|
199
199
|
list: { fields: ['name', 'releaseDate', 'status', 'updatedAt'] },
|
|
200
|
-
pagination: { limit: 50, pages: [50, 100, 200, 500] },
|
|
200
|
+
pagination: { limit: 50, pages: [50, 100, 200, 500, 1000] },
|
|
201
201
|
columns: [
|
|
202
202
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
203
203
|
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
@@ -1204,14 +1204,10 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1204
1204
|
this.matchDeliveryAddressInput.checked = false
|
|
1205
1205
|
this.quickFindContent.currentTabKey = i18next.t('label.order')
|
|
1206
1206
|
|
|
1207
|
-
this.initProperties()
|
|
1207
|
+
// this.initProperties()
|
|
1208
1208
|
this._clearGristConditions()
|
|
1209
1209
|
this._validateTransport()
|
|
1210
1210
|
this._getAllPostCode()
|
|
1211
|
-
|
|
1212
|
-
if (this._exportOptionInput.checked === true && this._recallInput.checked === false) {
|
|
1213
|
-
this._exportOption = true
|
|
1214
|
-
}
|
|
1215
1211
|
}
|
|
1216
1212
|
|
|
1217
1213
|
async switchPickingType() {
|
|
@@ -1556,6 +1552,9 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1556
1552
|
product: {
|
|
1557
1553
|
id: record?.inventory?.productId,
|
|
1558
1554
|
name: record?.inventory?.productName
|
|
1555
|
+
},
|
|
1556
|
+
productDetail: {
|
|
1557
|
+
id: record?.inventory?.productDetailId
|
|
1559
1558
|
}
|
|
1560
1559
|
}
|
|
1561
1560
|
}
|
|
@@ -1788,6 +1787,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
1788
1787
|
bundleId
|
|
1789
1788
|
bundleQty
|
|
1790
1789
|
productId
|
|
1790
|
+
productDetailId
|
|
1791
1791
|
productSku
|
|
1792
1792
|
productName
|
|
1793
1793
|
productDescription
|
|
@@ -2118,6 +2118,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2118
2118
|
packingType: record?.inventory?.packingType,
|
|
2119
2119
|
packingSize: record?.inventory?.packingSize,
|
|
2120
2120
|
productId: record?.inventory?.productId,
|
|
2121
|
+
productDetailId: record?.inventory?.productDetailId,
|
|
2121
2122
|
groupType: record?.inventory?.groupType,
|
|
2122
2123
|
releaseQty: record.releaseQty || 0,
|
|
2123
2124
|
releaseUomValue: record.releaseUomValue || 0
|
|
@@ -2292,6 +2293,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2292
2293
|
bundleReleaseDetail = bundleReleaseDetail.records.map(item => {
|
|
2293
2294
|
return {
|
|
2294
2295
|
product: { id: item.productId, name: item.productName },
|
|
2296
|
+
productDetail: { id: item.productDetailId },
|
|
2295
2297
|
batchId: item.batchId,
|
|
2296
2298
|
packingType: item.packingType,
|
|
2297
2299
|
packingSize: item.packingSize,
|
|
@@ -2328,11 +2330,17 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2328
2330
|
id: record.inventory.productId,
|
|
2329
2331
|
name: record.inventory.productName
|
|
2330
2332
|
}
|
|
2333
|
+
newRecord.productDetail = {
|
|
2334
|
+
id: record.inventory.productDetailId
|
|
2335
|
+
}
|
|
2331
2336
|
} else {
|
|
2332
2337
|
newRecord.product = {
|
|
2333
2338
|
id: record.inventory.productId || record.inventory.product.id,
|
|
2334
2339
|
name: record.inventory.productName || record.inventory.product.name
|
|
2335
2340
|
}
|
|
2341
|
+
newRecord.productDetail = {
|
|
2342
|
+
id: record.inventory.productDetailId || record.inventory.productDetail.id
|
|
2343
|
+
}
|
|
2336
2344
|
newRecord.inventory = { id: record.id }
|
|
2337
2345
|
}
|
|
2338
2346
|
|
|
@@ -2627,6 +2635,9 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2627
2635
|
name
|
|
2628
2636
|
description
|
|
2629
2637
|
}
|
|
2638
|
+
productDetail {
|
|
2639
|
+
id
|
|
2640
|
+
}
|
|
2630
2641
|
}
|
|
2631
2642
|
}
|
|
2632
2643
|
}
|
|
@@ -2646,6 +2657,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2646
2657
|
op.inventory = {
|
|
2647
2658
|
batchId: op.batchId,
|
|
2648
2659
|
productId: op.product.id,
|
|
2660
|
+
productDetailId: op.productDetail.id,
|
|
2649
2661
|
product: op.product,
|
|
2650
2662
|
productName: op.product.name,
|
|
2651
2663
|
palletId: i18next.t('label.cross_docking'),
|
|
@@ -2730,6 +2742,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2730
2742
|
batchId
|
|
2731
2743
|
batchIdRef
|
|
2732
2744
|
productId
|
|
2745
|
+
productDetailId
|
|
2733
2746
|
productSKU
|
|
2734
2747
|
productName
|
|
2735
2748
|
remainQty
|
|
@@ -2746,6 +2759,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2746
2759
|
batchId
|
|
2747
2760
|
batchIdRef
|
|
2748
2761
|
productId
|
|
2762
|
+
productDetailId
|
|
2749
2763
|
productSKU
|
|
2750
2764
|
productName
|
|
2751
2765
|
remainQty
|
|
@@ -2760,6 +2774,9 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2760
2774
|
name
|
|
2761
2775
|
sku
|
|
2762
2776
|
}
|
|
2777
|
+
productDetail {
|
|
2778
|
+
id
|
|
2779
|
+
}
|
|
2763
2780
|
}
|
|
2764
2781
|
}
|
|
2765
2782
|
`,
|
|
@@ -2835,10 +2852,6 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2835
2852
|
|
|
2836
2853
|
async importHandler(patches) {
|
|
2837
2854
|
try {
|
|
2838
|
-
this.inventoryData = {
|
|
2839
|
-
records: [...patches]
|
|
2840
|
-
}
|
|
2841
|
-
|
|
2842
2855
|
const orderInventories = patches.map(patch => {
|
|
2843
2856
|
delete patch.cuFlag
|
|
2844
2857
|
return {
|
|
@@ -2846,6 +2859,18 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
|
|
|
2846
2859
|
}
|
|
2847
2860
|
})
|
|
2848
2861
|
|
|
2862
|
+
// validate releaseQty
|
|
2863
|
+
// only positive integers permitted
|
|
2864
|
+
for (const orderInventory of orderInventories) {
|
|
2865
|
+
const rQty = orderInventory.releaseQty
|
|
2866
|
+
if (!Number.isInteger(rQty)) throw new Error(`${rQty} ${i18next.t('text.is_not_an_integer')}`)
|
|
2867
|
+
if (rQty <= 0) throw new Error(i18next.t('text.release_qty_must_be_at_least_1'))
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
this.inventoryData = {
|
|
2871
|
+
records: [...patches]
|
|
2872
|
+
}
|
|
2873
|
+
|
|
2849
2874
|
await this.bulkUploadValidateWarehousePartnersProductsQuantity(orderInventories)
|
|
2850
2875
|
|
|
2851
2876
|
history.back()
|