@things-factory/operato-wms 4.3.77 → 4.3.79-alpha.1

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 (51) hide show
  1. package/client/pages/components/select-inventory-popup.js +7 -1
  2. package/client/pages/components/select-product-popup.js +10 -2
  3. package/client/pages/inventory/inventory-adjustment.js +259 -238
  4. package/client/pages/inventory/serial-number-list-popup.js +24 -7
  5. package/client/pages/inventory-check/create-cycle-count.js +2 -3
  6. package/client/pages/order/draft-release-good/draft-release-good-detail.js +7 -1
  7. package/client/pages/order/release-order/create-release-order.js +23 -0
  8. package/client/pages/order/release-order/release-extra-product-popup.js +4 -1
  9. package/client/pages/order/release-order/release-order-detail.js +7 -3
  10. package/client/pages/outbound/generate-worksheet-popup.js +21 -7
  11. package/client/pages/outbound/inventory-reassign-popup.js +6 -0
  12. package/client/pages/outbound/packing-product.js +94 -30
  13. package/client/pages/outbound/picking-product.js +11 -1
  14. package/client/util/index.js +1 -0
  15. package/client/util/page-settings.js +43 -0
  16. package/dist-server/graphql/resolvers/index.js +5 -4
  17. package/dist-server/graphql/resolvers/index.js.map +1 -1
  18. package/dist-server/graphql/resolvers/{extra → other}/add-release-good-products.js +7 -11
  19. package/dist-server/graphql/resolvers/other/add-release-good-products.js.map +1 -0
  20. package/dist-server/graphql/resolvers/{extra → other}/index.js +3 -1
  21. package/dist-server/graphql/resolvers/other/index.js.map +1 -0
  22. package/dist-server/graphql/resolvers/other/page-settings.js +87 -0
  23. package/dist-server/graphql/resolvers/other/page-settings.js.map +1 -0
  24. package/dist-server/graphql/types/index.js +7 -2
  25. package/dist-server/graphql/types/index.js.map +1 -1
  26. package/dist-server/graphql/types/other/index.js +19 -0
  27. package/dist-server/graphql/types/other/index.js.map +1 -0
  28. package/dist-server/graphql/types/other/page-setting.js +36 -0
  29. package/dist-server/graphql/types/other/page-setting.js.map +1 -0
  30. package/helps/release-note.ko.md +6 -19
  31. package/helps/release-note.md +6 -19
  32. package/helps/release-note.ms.md +6 -19
  33. package/helps/release-note.zh.md +6 -19
  34. package/package.json +50 -50
  35. package/server/graphql/resolvers/index.ts +5 -4
  36. package/server/graphql/resolvers/{extra → other}/add-release-good-products.ts +8 -12
  37. package/server/graphql/resolvers/other/index.ts +10 -0
  38. package/server/graphql/resolvers/other/page-settings.ts +105 -0
  39. package/server/graphql/types/index.ts +8 -2
  40. package/server/graphql/types/other/index.ts +19 -0
  41. package/server/graphql/types/other/page-setting.ts +33 -0
  42. package/translations/en.json +11 -3
  43. package/translations/ko.json +9 -1
  44. package/translations/ms.json +9 -1
  45. package/translations/zh.json +9 -1
  46. package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +0 -1
  47. package/dist-server/graphql/resolvers/extra/index.js.map +0 -1
  48. package/dist-server/graphql/types/extra/index.js +0 -11
  49. package/dist-server/graphql/types/extra/index.js.map +0 -1
  50. package/server/graphql/resolvers/extra/index.ts +0 -5
  51. package/server/graphql/types/extra/index.ts +0 -7
@@ -35,6 +35,9 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
35
35
  releaseGoodId: String,
36
36
  shippingProvider: String,
37
37
  trackingNo: String,
38
+ totalBinRO: Number,
39
+ binRo: String,
40
+ toggleComplete: Boolean,
38
41
  _bizplaceName: String,
39
42
  _enableProductScanning: Boolean,
40
43
  _productName: String,
@@ -78,11 +81,9 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
78
81
  }
79
82
 
80
83
  get completed() {
81
- if (this?.orderRemark) {
82
- return this.data.records.every(record => record.completed) && Boolean(this.checkedRemarkAt)
83
- } else {
84
- return this.data.records.every(record => record.completed)
85
- }
84
+ return this.orderRemark
85
+ ? this.data.records.every(record => record.completed) && Boolean(this.checkedRemarkAt)
86
+ : this.data.records.every(record => record.completed)
86
87
  }
87
88
 
88
89
  get context() {
@@ -119,9 +120,9 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
119
120
 
120
121
  if (
121
122
  this.releaseGoodNo &&
122
- (this.orderInformation.status === 'packed' ||
123
- this.orderInformation.status === 'unfulfilled' ||
124
- this.orderInformation.status === 'processing') &&
123
+ (this.orderInformation?.status === 'packed' ||
124
+ this.orderInformation?.status === 'unfulfilled' ||
125
+ this.orderInformation?.status === 'processing') &&
125
126
  !this._trackingNo &&
126
127
  !this._logisticsInitiated &&
127
128
  (this.platform === PLATFORM.LAZADA.value ||
@@ -152,7 +153,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
152
153
  })
153
154
  }
154
155
 
155
- if (this.completed) {
156
+ if (this.toggleComplete) {
156
157
  actions.push({
157
158
  title: i18next.t('button.complete'),
158
159
  action: this._complete.bind(this),
@@ -225,7 +226,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
225
226
 
226
227
  render() {
227
228
  return html`
228
- <form id="info-form" class="multi-column-form">
229
+ <form id="info-form" class="multi-column-form" style="align-items:center">
229
230
  <fieldset>
230
231
  <label>${i18next.t('label.release_good_no')}</label>
231
232
  <barcode-scanable-input
@@ -287,11 +288,14 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
287
288
  this.data = { records: [] }
288
289
  this.releaseGoodNo = ''
289
290
  this.releaseGoodId = ''
291
+ this.totalBinRO = 0
292
+ this.checkedRemarkAt = ''
290
293
  this._enableProductScanning = false
291
294
  this._productName = ''
292
295
  this._selectedOrderInventory = null
293
296
  this._selectedTaskStatus = null
294
297
  this._scanning = false
298
+ this.toggleComplete = false
295
299
  this._isRequireSerialNumberScanningOutbound = false
296
300
  this._isBatchPicking = false
297
301
  }
@@ -395,6 +399,8 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
395
399
  name
396
400
  remark
397
401
  checkedRemarkAt
402
+ totalInventoriesByBin
403
+ isOrderInventoryBin
398
404
  }
399
405
  bizplaceName
400
406
  partnerDomainId
@@ -476,11 +482,18 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
476
482
  })
477
483
 
478
484
  if (!response.errors) {
485
+ // @oscar a more efficient writing of this line of code would be defining a const for the response of accessing releaseGood, kindly improve this.
486
+ if (response.data.packingWorksheet.worksheetInfo.releaseGood.isOrderInventoryBin) {
487
+ this.totalBinRO = response.data.packingWorksheet.worksheetInfo.releaseGood.totalInventoriesByBin
488
+ this.binRo = releaseGoodNo
489
+ }
490
+
479
491
  this.releaseGoodNo = response.data.packingWorksheet.worksheetInfo.releaseGood.name
480
492
  this.releaseGoodId = response.data.packingWorksheet.worksheetInfo.releaseGood.id
481
493
  if (!response.data?.packingWorksheet) return
482
494
 
483
495
  const { worksheetInfo, worksheetDetailInfos } = response.data.packingWorksheet
496
+
484
497
  this.data = { records: this.formatWorksheetDetailInfos(worksheetDetailInfos) }
485
498
 
486
499
  this.trackingNo = worksheetInfo.trackingNo
@@ -492,6 +505,10 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
492
505
  this.orderInformation = worksheetInfo.marketplaceOrder
493
506
  this.orderRemark = worksheetInfo.releaseGood?.remark
494
507
  this.checkedRemarkAt = worksheetInfo.releaseGood?.checkedRemarkAt
508
+ this.toggleComplete = Boolean(worksheetInfo.releaseGood?.remark)
509
+ ? worksheetDetailInfos.every(res => res.status === 'DONE') &&
510
+ worksheetInfo.releaseGood?.checkedRemarkAt !== null
511
+ : worksheetDetailInfos.every(res => res.status === 'DONE')
495
512
 
496
513
  this._isBatchPicking = worksheetDetailInfos[0].relatedOrderInv?.refWorksheetId ? true : false
497
514
 
@@ -500,7 +517,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
500
517
 
501
518
  if (this._selectedOrderInventory) {
502
519
  const record = this.data.records.find(record => record.name === this._selectedOrderInventory.name)
503
- if (record.packedQty == record.releaseQty) {
520
+ if (record?.packedQty == record?.releaseQty) {
504
521
  this._selectedOrderInventory = null
505
522
  this._selectedTaskStatus = null
506
523
  this.inputForm.reset()
@@ -511,6 +528,10 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
511
528
  worksheetDetailInfos[0].product?.isRequireSerialNumberScanningOutbound
512
529
  }
513
530
 
531
+ if (this.completed && this.airwayBill) {
532
+ this.printBill()
533
+ }
534
+
514
535
  this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
515
536
 
516
537
  if (this._enableProductScanning) {
@@ -518,6 +539,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
518
539
  } else {
519
540
  this._focusOnReleaseQtyInput()
520
541
  }
542
+
521
543
  this.updateContext()
522
544
  }
523
545
  }
@@ -529,7 +551,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
529
551
  record.locationName = record?.binLocation?.name
530
552
  record.sku = record?.sku
531
553
  record.product = record?.product
532
- record.packingProgress = `${record.packedQty} / ${record.releaseQty}`
554
+ record.packingProgress = `${record?.packedQty} / ${record.releaseQty}`
533
555
 
534
556
  return record
535
557
  })
@@ -543,6 +565,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
543
565
  this.releaseGoodNo = ''
544
566
  this._selectedOrderInventory = null
545
567
  this._selectedTaskStatus = null
568
+ this.toggleComplete = false
546
569
  }
547
570
 
548
571
  checkShippingProviderAndDeliveryType() {
@@ -723,12 +746,13 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
723
746
  async packing(e) {
724
747
  if (e.keyCode === 13) {
725
748
  e.preventDefault()
749
+ console.time('time execution for product barcode scanning')
726
750
  try {
727
751
  await this._validatePacking()
728
752
 
729
- let response
730
- if (this._enableProductScanning) response = await this.productBarcodePacking()
731
- else response = await this.commonPacking()
753
+ let response = this._enableProductScanning ? await this.productBarcodePacking() : await this.commonPacking()
754
+
755
+ console.timeLog('time execution for product barcode scanning')
732
756
 
733
757
  if (!response.errors) {
734
758
  if (this._enableProductScanning) {
@@ -749,17 +773,20 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
749
773
  } catch (e) {
750
774
  if (this._isRequireSerialNumberScanningOutbound && this._isBatchPicking) this.serialInput.value = ''
751
775
  else if (this._enableProductScanning && !this._isRequireSerialNumberScanningOutbound) {
752
- this.productBarcodeInput.value = ''
753
776
  this._focusOnProductBarcodeInput()
754
777
  } else {
755
- this.releaseQtyInput.value = ''
756
778
  this._focusOnReleaseQtyInput()
757
779
  this._selectedTaskStatus = null
758
780
  }
759
781
  this._selectedOrderInventory = null
760
782
  this._showToast(e)
761
783
  } finally {
784
+ this._enableProductScanning && !this._isRequireSerialNumberScanningOutbound
785
+ ? (this.productBarcodeInput.value = '')
786
+ : (this.releaseQtyInput.value = '')
762
787
  this._scanning = false
788
+ // time execution for product barcode scanning (without scanning machines): 308.0390625 ms
789
+ console.timeEnd('time execution for product barcode scanning')
763
790
  }
764
791
  }
765
792
  }
@@ -821,12 +848,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
821
848
  //find product match with input barcode
822
849
  const foundOrderInventory = this.data.records.find(
823
850
  itm =>
824
- itm.product.productDetails.find(
825
- detail =>
826
- detail.gtin === this.productBarcodeInput.value.trim() &&
827
- detail.packingType == itm.packingType &&
828
- detail.packingSize == itm.packingSize
829
- ) != undefined
851
+ itm.product.productDetails.find(detail => detail.gtin === this.productBarcodeInput.value.trim()) != undefined
830
852
  )
831
853
 
832
854
  if (foundOrderInventory) {
@@ -836,6 +858,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
836
858
  throw new Error(i18next.t('text.scanned_product_status_is_done'))
837
859
  }
838
860
  } else {
861
+ this._focusOnProductBarcodeInput()
839
862
  throw new Error(i18next.t('text.incorrect_product_barcode'))
840
863
  }
841
864
  } else {
@@ -865,6 +888,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
865
888
  }
866
889
 
867
890
  async _complete() {
891
+ const totalBinRO = this.totalBinRO
868
892
  const response = await client.mutate({
869
893
  mutation: gql`
870
894
  mutation completePacking($releaseGoodNo: String!) {
@@ -875,13 +899,43 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
875
899
  })
876
900
 
877
901
  if (!response.errors) {
878
- this._clearView()
879
- this.updateContext()
880
- await CustomAlert({
881
- title: i18next.t('title.packing'),
882
- text: i18next.t('text.packing_is_completed'),
883
- confirmButton: { text: i18next.t('button.confirm') }
884
- })
902
+ if (totalBinRO > 1) {
903
+ const resultNextOrder = await CustomAlert({
904
+ title: i18next.t('title.packing'),
905
+ text: i18next.t('text.packing_is_completed'),
906
+ confirmButton: { text: i18next.t('button.next_order') }
907
+ })
908
+
909
+ if (!resultNextOrder.value) {
910
+ this._focusOnReleaseGoodInput()
911
+ this._clearView()
912
+ this.updateContext()
913
+ return
914
+ }
915
+
916
+ this._clearView()
917
+ this.updateContext()
918
+
919
+ this.checkedRemarkAt = ''
920
+ await this._fetchInventories(this.binRo)
921
+ this.toggleComplete = false
922
+ this._focusOnProductBarcodeInput()
923
+ } else {
924
+ this.toggleComplete = false
925
+
926
+ this._clearView()
927
+ this.updateContext()
928
+
929
+ const result = await CustomAlert({
930
+ title: i18next.t('title.packing'),
931
+ text: i18next.t('text.packing_is_completed'),
932
+ timer: 1000
933
+ })
934
+
935
+ if (result.dismiss === 'timer' && result.isDismissed) {
936
+ this._focusOnReleaseGoodInput()
937
+ }
938
+ }
885
939
  }
886
940
  }
887
941
 
@@ -920,6 +974,16 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
920
974
  )
921
975
  }
922
976
 
977
+ async printBill() {
978
+ if (this.releaseGoodNo && this.platform != 'operato' && this.completed && this.trackingNo) {
979
+ await this.printAirwayBill()
980
+ }
981
+
982
+ if (this.releaseGoodNo && this.platform == 'operato' && this.airwayBill && this.completed) {
983
+ await this.printSellercraftDocument('awb')
984
+ }
985
+ }
986
+
923
987
  async openSerialNumberPopup() {
924
988
  await sleep(1010)
925
989
  openPopup(
@@ -704,6 +704,9 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
704
704
  description
705
705
  isRequireSerialNumberScanningOutbound
706
706
  }
707
+ productDetail {
708
+ id
709
+ }
707
710
  }
708
711
  }
709
712
  }
@@ -844,6 +847,9 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
844
847
  description
845
848
  sku
846
849
  }
850
+ productDetail {
851
+ id
852
+ }
847
853
  }
848
854
  }
849
855
  }
@@ -946,6 +952,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
946
952
  }
947
953
  record.locationName = record?.location?.name
948
954
  record.product = record?.relatedOrderInv && record?.relatedOrderInv?.product
955
+ record.productDetail = record?.relatedOrderInv.productDetail
949
956
 
950
957
  if (this._crossDocking) {
951
958
  record.batchId = record.relatedOrderInv.batchId
@@ -1394,7 +1401,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1394
1401
  batchId: this._selectedOrderInventory.batchId,
1395
1402
  packingType: this._selectedOrderInventory.packingType,
1396
1403
  packingSize: this._selectedOrderInventory.packingSize,
1397
- product: { id: this._selectedOrderInventory.product.id }
1404
+ productDetail: { id: this._selectedOrderInventory.productDetail.id }
1398
1405
  },
1399
1406
  binLocationName:
1400
1407
  this._hasBinPicking && (!this.toteNo || this.tote == '') ? this.binLocationInput.value : null,
@@ -1855,6 +1862,9 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1855
1862
  name
1856
1863
  description
1857
1864
  }
1865
+ productDetail {
1866
+ id
1867
+ }
1858
1868
  }
1859
1869
  }
1860
1870
  }
@@ -0,0 +1 @@
1
+ export * from './page-settings'
@@ -0,0 +1,43 @@
1
+ import { client, gqlContext } from '@things-factory/shell'
2
+ import gql from 'graphql-tag'
3
+
4
+ export const fetchPageSettings = async function (variables = { codes, partners }) {
5
+ try {
6
+ const response = await client.query({
7
+ query: gql`
8
+ query pageSettings($codes: [Filter!], $partners: [Filter!]) {
9
+ pageSettings(codes: $codes, partners: $partners) {
10
+ type
11
+ details {
12
+ id
13
+ name
14
+ description
15
+ settingDetails {
16
+ id
17
+ name
18
+ description
19
+ rank
20
+ }
21
+ }
22
+ }
23
+ }
24
+ `,
25
+ variables,
26
+ context: gqlContext()
27
+ })
28
+
29
+ if (!response.errors && response.data.pageSettings) {
30
+ return {
31
+ codes: response.data.pageSettings.find(x => x.type == 'code')?.details || [],
32
+ partners: response.data.pageSettings.find(x => x.type == 'partner')?.details || []
33
+ }
34
+ } else {
35
+ return {
36
+ code: [],
37
+ partners: []
38
+ }
39
+ }
40
+ } catch (error) {
41
+ console.log(error)
42
+ }
43
+ }
@@ -28,7 +28,7 @@ const BoardSetting = __importStar(require("./board-setting"));
28
28
  const CustomElccl = __importStar(require("./custom/elccl"));
29
29
  const CustomKimeda = __importStar(require("./custom/kimeda"));
30
30
  const Dashboard = __importStar(require("./dashboard"));
31
- const Extra = __importStar(require("./extra"));
31
+ const Other = __importStar(require("./other"));
32
32
  const OpaMenu = __importStar(require("./opa-menu"));
33
33
  const Reports = __importStar(require("./reports"));
34
34
  const InventoryComparison = __importStar(require("./inventory-comparison"));
@@ -39,10 +39,11 @@ exports.queries = [
39
39
  CustomElccl.Query,
40
40
  CustomKimeda.Query,
41
41
  Dashboard.Query,
42
+ InventoryComparison.Query,
42
43
  OpaMenu.Query,
44
+ Other.Query,
43
45
  Reports.Query,
44
- InventoryComparison.Query,
45
- ShippingProviders.Query,
46
+ ShippingProviders.Query
46
47
  ];
47
- exports.mutations = [Extra.Mutation, WarehouseInventoryAdjustment.Mutation];
48
+ exports.mutations = [Other.Mutation, WarehouseInventoryAdjustment.Mutation];
48
49
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/graphql/resolvers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAA+C;AAC/C,4DAA6C;AAC7C,8DAA+C;AAC/C,uDAAwC;AACxC,+CAAgC;AAChC,oDAAqC;AACrC,mDAAoC;AACpC,4EAA6D;AAC7D,uEAAwD;AACxD,+FAAgF;AAEnE,QAAA,OAAO,GAAG;IACrB,YAAY,CAAC,KAAK;IAClB,WAAW,CAAC,KAAK;IACjB,YAAY,CAAC,KAAK;IAClB,SAAS,CAAC,KAAK;IACf,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,KAAK;IACb,mBAAmB,CAAC,KAAK;IACzB,iBAAiB,CAAC,KAAK;CACxB,CAAA;AAEY,QAAA,SAAS,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAC,4BAA4B,CAAC,QAAQ,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/graphql/resolvers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAA+C;AAC/C,4DAA6C;AAC7C,8DAA+C;AAC/C,uDAAwC;AACxC,+CAAgC;AAChC,oDAAqC;AACrC,mDAAoC;AACpC,4EAA6D;AAC7D,uEAAwD;AACxD,+FAAgF;AAEnE,QAAA,OAAO,GAAG;IACrB,YAAY,CAAC,KAAK;IAClB,WAAW,CAAC,KAAK;IACjB,YAAY,CAAC,KAAK;IAClB,SAAS,CAAC,KAAK;IACf,mBAAmB,CAAC,KAAK;IACzB,OAAO,CAAC,KAAK;IACb,KAAK,CAAC,KAAK;IACX,OAAO,CAAC,KAAK;IACb,iBAAiB,CAAC,KAAK;CACxB,CAAA;AAEY,QAAA,SAAS,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,4BAA4B,CAAC,QAAQ,CAAC,CAAA"}
@@ -29,7 +29,7 @@ exports.addReleaseGoodProducts = {
29
29
  curOrderInv.domain = domain;
30
30
  curOrderInv.bizplace = bizplace;
31
31
  curOrderInv.releaseGood = releaseGood;
32
- curOrderInv.product = await tx.getRepository(product_base_1.Product).findOne(oi.product.id);
32
+ curOrderInv.productDetail = await tx.getRepository(product_base_1.ProductDetail).findOne(oi.productDetail.id);
33
33
  let existingOrderInv;
34
34
  if ((_a = curOrderInv === null || curOrderInv === void 0 ? void 0 : curOrderInv.inventory) === null || _a === void 0 ? void 0 : _a.id) {
35
35
  const foundInv = await tx.getRepository(warehouse_base_1.Inventory).findOne(curOrderInv.inventory.id);
@@ -37,9 +37,8 @@ exports.addReleaseGoodProducts = {
37
37
  existingOrderInv = await tx.getRepository(sales_base_1.OrderInventory).findOne({
38
38
  where: {
39
39
  releaseGood,
40
- product: curOrderInv.product,
40
+ productDetail: curOrderInv.productDetail,
41
41
  batchId: curOrderInv.batchId,
42
- packingType: curOrderInv.packingType,
43
42
  inventory: foundInv
44
43
  }
45
44
  });
@@ -132,7 +131,6 @@ exports.addReleaseGoodProducts = {
132
131
  newOrderInv.status = pickingWorksheet ? sales_base_1.ORDER_INVENTORY_STATUS.PICKING : sales_base_1.ORDER_INVENTORY_STATUS.PENDING;
133
132
  newOrderInv.name = sales_base_1.OrderNoGenerator.orderInventory();
134
133
  newOrderInv.releaseGood = releaseGood;
135
- newOrderInv.product = await tx.getRepository(product_base_1.Product).findOne(oi.product.id);
136
134
  newOrderInv.creator = user;
137
135
  newOrderInv.updater = user;
138
136
  let existingOrderInv;
@@ -141,8 +139,7 @@ exports.addReleaseGoodProducts = {
141
139
  domain,
142
140
  releaseGood,
143
141
  batchId: oi.batchId,
144
- packingType: oi.packingType,
145
- product: newOrderInv.product
142
+ productDetail: newOrderInv.productDetail
146
143
  }
147
144
  });
148
145
  // check if it is release by inventory (has inventory value) or product
@@ -156,9 +153,8 @@ exports.addReleaseGoodProducts = {
156
153
  existingOrderInv = await tx.getRepository(sales_base_1.OrderInventory).findOne({
157
154
  where: {
158
155
  releaseGood,
159
- product: newOrderInv.product,
156
+ productDetail: newOrderInv.productDetail,
160
157
  batchId: newOrderInv.batchId,
161
- packingType: newOrderInv.packingType,
162
158
  inventory: foundInv
163
159
  }
164
160
  });
@@ -177,9 +173,8 @@ exports.addReleaseGoodProducts = {
177
173
  existingOrderInv = await tx.getRepository(sales_base_1.OrderInventory).findOne({
178
174
  where: {
179
175
  releaseGood,
180
- product: newOrderInv.product,
181
- batchId: newOrderInv.batchId,
182
- packingType: newOrderInv.packingType
176
+ productDetail: newOrderInv.productDetail,
177
+ batchId: newOrderInv.batchId
183
178
  }
184
179
  });
185
180
  }
@@ -219,6 +214,7 @@ exports.addReleaseGoodProducts = {
219
214
  savedOrderInv.packingType = newOrderInv.packingType;
220
215
  savedOrderInv.uom = newOrderInv.uom;
221
216
  savedOrderInv.product = newOrderInv.product;
217
+ savedOrderInv.productDetail = newOrderInv.productDetail;
222
218
  savedOrderInv.inventory = newOrderInv.inventory;
223
219
  savedOrderInv.status = newOrderInv.status;
224
220
  savedOrderInv.releaseGood = newOrderInv.releaseGood;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-release-good-products.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/other/add-release-good-products.ts"],"names":[],"mappings":";;;AAAA,qCAAgD;AAIhD,+DAAqE;AACrE,2DAOmC;AAEnC,mEAA0D;AAC1D,mEAMuC;AAE1B,QAAA,sBAAsB,GAAG;IACpC,KAAK,CAAC,sBAAsB,CAAC,CAAM,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,EAAE,OAAY;;QACrG,IAAI;YACF,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAsD,OAAO,CAAC,KAAK,CAAA;YAE7F,IAAI,WAAW,GAAgB,MAAM,EAAE,CAAC,aAAa,CAAC,wBAAW,CAAC,CAAC,OAAO,CAAC;gBACzE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE;gBAC7B,SAAS,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC;aACzC,CAAC,CAAA;YAEF,MAAM,QAAQ,GAAa,WAAW,CAAC,QAAQ,CAAA;YAE/C,IAAI,gBAAgB,GAAc,MAAM,EAAE,CAAC,aAAa,CAAC,0BAAS,CAAC,CAAC,OAAO,CAAC;gBAC1E,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,+BAAc,CAAC,OAAO,EAAE;aACrD,CAAC,CAAA;YAEF,IAAI,gBAAgB,GAAc,MAAM,EAAE,CAAC,aAAa,CAAC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;IACH,CAAC;CACF,CAAA"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mutation = void 0;
3
+ exports.Mutation = exports.Query = void 0;
4
4
  const add_release_good_products_1 = require("./add-release-good-products");
5
+ const page_settings_1 = require("./page-settings");
6
+ exports.Query = Object.assign({}, page_settings_1.pageSettings);
5
7
  exports.Mutation = Object.assign({}, add_release_good_products_1.addReleaseGoodProducts);
6
8
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/other/index.ts"],"names":[],"mappings":";;;AAAA,2EAAoE;AACpE,mDAA8C;AAEjC,QAAA,KAAK,qBACX,4BAAY,EAClB;AAEY,QAAA,QAAQ,qBACd,kDAAsB,EAC5B"}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pageSettings = void 0;
4
+ const typeorm_1 = require("typeorm");
5
+ const shell_1 = require("@things-factory/shell");
6
+ const biz_base_1 = require("@things-factory/biz-base");
7
+ const code_base_1 = require("@things-factory/code-base");
8
+ exports.pageSettings = {
9
+ async pageSettings(_, { codes, partners }, context) {
10
+ const { domain, user, tx } = context.state;
11
+ try {
12
+ let promiseTask = [];
13
+ if (codes) {
14
+ promiseTask.push(queryCommonCode(codes, domain, tx, context));
15
+ }
16
+ if (partners) {
17
+ promiseTask.push(queryPartners(partners, domain, tx, context));
18
+ }
19
+ return await Promise.all(promiseTask);
20
+ }
21
+ catch (error) {
22
+ throw error;
23
+ }
24
+ }
25
+ };
26
+ async function queryCommonCode(codes, domain, tx, context) {
27
+ const codeQb = tx.getRepository(code_base_1.CommonCode).createQueryBuilder('cc');
28
+ (0, shell_1.buildQuery)(codeQb, { filters: codes }, context);
29
+ codes = (await codeQb
30
+ .leftJoinAndSelect('cc.details', 'ccdet')
31
+ .orderBy('cc.name')
32
+ .addOrderBy('ccdet.rank')
33
+ .addOrderBy('ccdet.name')
34
+ .getMany()).map((cc) => {
35
+ return {
36
+ id: cc.id,
37
+ name: cc.name,
38
+ description: cc.description,
39
+ settingDetails: cc.details.map(det => {
40
+ return {
41
+ id: det.id,
42
+ name: det.name,
43
+ description: det.description,
44
+ rank: det.rank
45
+ };
46
+ })
47
+ };
48
+ });
49
+ return {
50
+ type: 'code',
51
+ details: codes
52
+ };
53
+ }
54
+ async function queryPartners(partners, domain, tx, context) {
55
+ var _a;
56
+ let partnersBizplaceIds = [];
57
+ let bizplaceIndex = (_a = partners.filters) === null || _a === void 0 ? void 0 : _a.findIndex(x => x.name === 'bizplace');
58
+ if (bizplaceIndex && bizplaceIndex > -1) {
59
+ partnersBizplaceIds = partners.filters
60
+ .filter(x => x.name === 'bizplace')
61
+ .map(item => {
62
+ return item.value;
63
+ });
64
+ partners.filters.splice(bizplaceIndex, 1);
65
+ }
66
+ const convertedParams = (0, shell_1.convertListParams)({ filters: partners });
67
+ if (!(partnersBizplaceIds.length > 0)) {
68
+ const partnersBizplaces = await (0, biz_base_1.getPartnersBizplaces)(context.state.domain, context.state.user);
69
+ partnersBizplaceIds = partnersBizplaces.map((bizplace) => bizplace.id || null);
70
+ convertedParams.where.id = (0, typeorm_1.In)(partnersBizplaceIds);
71
+ }
72
+ else {
73
+ convertedParams.where.id = (0, typeorm_1.In)(partnersBizplaceIds);
74
+ }
75
+ partners = ((await tx.getRepository(biz_base_1.Bizplace).find(Object.assign(Object.assign({}, convertedParams), { relations: ['domain', 'company', 'users', 'creator', 'updater'] }))).map((biz) => {
76
+ return {
77
+ id: biz.id,
78
+ name: biz.name,
79
+ description: biz.description,
80
+ };
81
+ }));
82
+ return {
83
+ type: 'partner',
84
+ details: partners
85
+ };
86
+ }
87
+ //# sourceMappingURL=page-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-settings.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/other/page-settings.ts"],"names":[],"mappings":";;;AAA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QACrC,MAAM,iBAAiB,GAAe,MAAM,IAAA,+BAAoB,EAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC1G,mBAAmB,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,IAAI,CAAC,CAAA;QACxF,eAAe,CAAC,KAAK,CAAC,EAAE,GAAG,IAAA,YAAE,EAAC,mBAAmB,CAAC,CAAA;KACnD;SAAM;QACL,eAAe,CAAC,KAAK,CAAC,EAAE,GAAG,IAAA,YAAE,EAAC,mBAAmB,CAAC,CAAA;KACnD;IAED,QAAQ,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,mBAAQ,CAAC,CAAC,IAAI,iCAC7C,eAAe,KAClB,SAAS,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,IAC/D,CAAC,CAAC,GAAG,CAAC,CAAC,GAAa,EAAE,EAAE;QACxB,OAAO;YACL,EAAE,EAAE,GAAG,CAAC,EAAE;YACV,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,WAAW,EAAE,GAAG,CAAC,WAAW;SAC7B,CAAA;IACH,CAAC,CAAC,CAAC,CAAA;IAEH,OAAO;QACL,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ;KAClB,CAAA;AACH,CAAC"}
@@ -28,7 +28,7 @@ const BoardSetting = __importStar(require("./board-setting"));
28
28
  const CustomElccl = __importStar(require("./custom/elccl"));
29
29
  const CustomKimeda = __importStar(require("./custom/kimeda"));
30
30
  const Dashboard = __importStar(require("./dashboard"));
31
- const Extra = __importStar(require("./extra"));
31
+ const Other = __importStar(require("./other"));
32
32
  const OpaMenu = __importStar(require("./opa-menu"));
33
33
  const Reports = __importStar(require("./reports"));
34
34
  const InventoryComparison = __importStar(require("./inventory-comparison"));
@@ -43,8 +43,12 @@ exports.queries = [
43
43
  Reports.Query,
44
44
  InventoryComparison.Query,
45
45
  ShippingProvider.Query,
46
+ Other.Query
47
+ ];
48
+ exports.mutations = [
49
+ Other.Mutation,
50
+ WarehouseInventory.Mutation
46
51
  ];
47
- exports.mutations = [Extra.Mutation, WarehouseInventory.Mutation];
48
52
  exports.types = [
49
53
  ...BoardSetting.Types,
50
54
  ...CustomElccl.Types,
@@ -53,5 +57,6 @@ exports.types = [
53
57
  ...Reports.Types,
54
58
  ...InventoryComparison.Types,
55
59
  ...ShippingProvider.Types,
60
+ ...Other.Types
56
61
  ];
57
62
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/graphql/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAA+C;AAC/C,4DAA6C;AAC7C,8DAA+C;AAC/C,uDAAwC;AACxC,+CAAgC;AAChC,oDAAqC;AACrC,mDAAoC;AACpC,4EAA6D;AAC7D,sEAAuD;AACvD,qFAAsE;AACzD,QAAA,OAAO,GAAG;IACrB,YAAY,CAAC,KAAK;IAClB,WAAW,CAAC,KAAK;IACjB,YAAY,CAAC,KAAK;IAClB,SAAS,CAAC,KAAK;IACf,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,KAAK;IACb,mBAAmB,CAAC,KAAK;IACzB,gBAAgB,CAAC,KAAK;CACvB,CAAA;AAEY,QAAA,SAAS,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAA;AAExD,QAAA,KAAK,GAAG;IACnB,GAAG,YAAY,CAAC,KAAK;IACrB,GAAG,WAAW,CAAC,KAAK;IACpB,GAAG,SAAS,CAAC,KAAK;IAClB,GAAG,OAAO,CAAC,KAAK;IAChB,GAAG,OAAO,CAAC,KAAK;IAChB,GAAG,mBAAmB,CAAC,KAAK;IAC5B,GAAG,gBAAgB,CAAC,KAAK;CAC1B,CA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