@things-factory/operato-wms 5.0.13 → 6.0.0-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 (206) hide show
  1. package/client/pages/bulk-operation/bulk-operation.js +96 -8
  2. package/client/pages/bulk-operation/validate-gan-popup.js +37 -27
  3. package/client/pages/bulk-operation/validate-ro-popup.js +40 -0
  4. package/client/pages/components/select-inventory-popup.js +633 -0
  5. package/client/pages/constants/order.js +2 -1
  6. package/client/pages/inbound/pallet-label-popup.js +2 -0
  7. package/client/pages/inbound/select-product-batch.js +7 -1
  8. package/client/pages/inbound/undo-unload-popup.js +37 -21
  9. package/client/pages/inbound/unload-product.js +147 -59
  10. package/client/pages/inbound/worksheet-putaway.js +1 -1
  11. package/client/pages/inbound/worksheet-unloading.js +11 -7
  12. package/client/pages/inventory/inventory-adjustment.js +261 -238
  13. package/client/pages/inventory/inventory-by-product-detail.js +99 -92
  14. package/client/pages/inventory/inventory-by-product.js +170 -68
  15. package/client/pages/inventory/onhand-inventory.js +10 -12
  16. package/client/pages/inventory/serial-number-list-popup.js +36 -5
  17. package/client/pages/inventory-check/inspecting-product.js +1 -1
  18. package/client/pages/manifest/create-loading-manifest.js +47 -22
  19. package/client/pages/manifest/dispatcher-verification-popup.js +24 -13
  20. package/client/pages/manifest/loading-manifest-detail.js +311 -46
  21. package/client/pages/manifest/loading-manifest-list.js +86 -13
  22. package/client/pages/order/arrival-notice/arrival-notice-detail.js +305 -52
  23. package/client/pages/order/arrival-notice/arrival-notice-list.js +20 -1
  24. package/client/pages/order/arrival-notice/create-arrival-notice.js +2 -2
  25. package/client/pages/order/goods-received-note/received-note-detail.js +187 -15
  26. package/client/pages/order/release-order/b2b/b2b-order-list.js +76 -80
  27. package/client/pages/order/release-order/b2c/b2c-order-requests.js +148 -123
  28. package/client/pages/order/release-order/batch-picking-popup.js +11 -0
  29. package/client/pages/order/release-order/create-release-order.js +762 -250
  30. package/client/pages/order/release-order/release-extra-product-popup.js +10 -3
  31. package/client/pages/order/release-order/release-order-detail.js +897 -215
  32. package/client/pages/order/transport-order/delivery-note-popup.js +1050 -107
  33. package/client/pages/order/transport-order/print-delivery-note.js +214 -33
  34. package/client/pages/order/transport-order/upload-delivery-note.js +6 -4
  35. package/client/pages/order/transport-order/view-delivery-note.js +0 -1
  36. package/client/pages/outbound/generate-worksheet-popup.js +374 -0
  37. package/client/pages/outbound/inventory-reassign-popup.js +1097 -0
  38. package/client/pages/outbound/loading-product.js +88 -78
  39. package/client/pages/outbound/merged-outbound-worksheet.js +1 -1
  40. package/client/pages/outbound/packing-product.js +193 -82
  41. package/client/pages/outbound/packing-worksheet-list.js +10 -9
  42. package/client/pages/outbound/picking-product.js +979 -905
  43. package/client/pages/outbound/route-label-popup.js +283 -191
  44. package/client/pages/outbound/serial-number-popup.js +1 -0
  45. package/client/pages/outbound/sorting-product.js +12 -12
  46. package/client/pages/outbound/worksheet-batch-picking.js +39 -5
  47. package/client/pages/outbound/worksheet-packing.js +17 -4
  48. package/client/pages/outbound/worksheet-picking.js +45 -6
  49. package/client/pages/report/inbound-serial-number-report.js +86 -9
  50. package/client/pages/report/inventory-report.js +10 -0
  51. package/client/pages/report/inventory-summary-report.js +28 -19
  52. package/client/pages/report/outbound-order-details-report.js +204 -43
  53. package/client/pages/report/outbound-serial-number-report.js +87 -9
  54. package/client/pages/report/release-inventory-report.js +503 -0
  55. package/client/route.js +5 -0
  56. package/client/util/index.js +2 -0
  57. package/client/util/page-settings.js +43 -0
  58. package/client/util/toast.js +10 -0
  59. package/dist-server/graphql/resolvers/board-setting/board-settings.js +3 -3
  60. package/dist-server/graphql/resolvers/board-setting/board-settings.js.map +1 -1
  61. package/dist-server/graphql/resolvers/custom/elccl/elccl-daily-collection-report.js +2 -2
  62. package/dist-server/graphql/resolvers/custom/elccl/elccl-daily-collection-report.js.map +1 -1
  63. package/dist-server/graphql/resolvers/custom/elccl/elccl-daily-order-inventory-report.js +1 -1
  64. package/dist-server/graphql/resolvers/custom/elccl/elccl-daily-order-inventory-report.js.map +1 -1
  65. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-pallet-detail-report.js +2 -2
  66. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-pallet-detail-report.js.map +1 -1
  67. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js +9 -10
  68. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js.map +1 -1
  69. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js +2 -2
  70. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js.map +1 -1
  71. package/dist-server/graphql/resolvers/custom/elccl/elccl-onhand-inventory-counter.js +6 -4
  72. package/dist-server/graphql/resolvers/custom/elccl/elccl-onhand-inventory-counter.js.map +1 -1
  73. package/dist-server/graphql/resolvers/custom/kimeda/kimeda-onhand-inventory-counter.js +6 -4
  74. package/dist-server/graphql/resolvers/custom/kimeda/kimeda-onhand-inventory-counter.js.map +1 -1
  75. package/dist-server/graphql/resolvers/dashboard/arrival-notices-by-status.js +21 -10
  76. package/dist-server/graphql/resolvers/dashboard/arrival-notices-by-status.js.map +1 -1
  77. package/dist-server/graphql/resolvers/dashboard/collection-orders-by-status.js +1 -2
  78. package/dist-server/graphql/resolvers/dashboard/collection-orders-by-status.js.map +1 -1
  79. package/dist-server/graphql/resolvers/dashboard/delivery-orders-by-status.js +1 -2
  80. package/dist-server/graphql/resolvers/dashboard/delivery-orders-by-status.js.map +1 -1
  81. package/dist-server/graphql/resolvers/dashboard/index.js +2 -1
  82. package/dist-server/graphql/resolvers/dashboard/index.js.map +1 -1
  83. package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js +17 -1
  84. package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js.map +1 -1
  85. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js +113 -75
  86. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js.map +1 -1
  87. package/dist-server/graphql/resolvers/dashboard/release-goods-by-status.js +21 -10
  88. package/dist-server/graphql/resolvers/dashboard/release-goods-by-status.js.map +1 -1
  89. package/dist-server/graphql/resolvers/dashboard/unit-inbounded-outbounded.js +56 -0
  90. package/dist-server/graphql/resolvers/dashboard/unit-inbounded-outbounded.js.map +1 -0
  91. package/dist-server/graphql/resolvers/index.js +5 -4
  92. package/dist-server/graphql/resolvers/index.js.map +1 -1
  93. package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js.map +1 -1
  94. package/dist-server/graphql/resolvers/opa-menu/opa-menus.js +8 -7
  95. package/dist-server/graphql/resolvers/opa-menu/opa-menus.js.map +1 -1
  96. package/dist-server/graphql/resolvers/{extra → other}/add-release-good-products.js +59 -8
  97. package/dist-server/graphql/resolvers/other/add-release-good-products.js.map +1 -0
  98. package/dist-server/graphql/resolvers/{extra → other}/index.js +3 -1
  99. package/dist-server/graphql/resolvers/other/index.js.map +1 -0
  100. package/dist-server/graphql/resolvers/other/page-settings.js +87 -0
  101. package/dist-server/graphql/resolvers/other/page-settings.js.map +1 -0
  102. package/dist-server/graphql/resolvers/reports/costing-report.js +4 -4
  103. package/dist-server/graphql/resolvers/reports/costing-report.js.map +1 -1
  104. package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js +3 -3
  105. package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js.map +1 -1
  106. package/dist-server/graphql/resolvers/reports/inbound-serial-number-report.js +36 -7
  107. package/dist-server/graphql/resolvers/reports/inbound-serial-number-report.js.map +1 -1
  108. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  109. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  110. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +69 -30
  111. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  112. package/dist-server/graphql/resolvers/reports/outbound-serial-number-report.js +36 -11
  113. package/dist-server/graphql/resolvers/reports/outbound-serial-number-report.js.map +1 -1
  114. package/dist-server/graphql/resolvers/reports/product-label-report.js +3 -3
  115. package/dist-server/graphql/resolvers/reports/product-label-report.js.map +1 -1
  116. package/dist-server/graphql/resolvers/reports/release-inventory-report.js +180 -0
  117. package/dist-server/graphql/resolvers/reports/release-inventory-report.js.map +1 -0
  118. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js +2 -2
  119. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js.map +1 -1
  120. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js +1 -1
  121. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js.map +1 -1
  122. package/dist-server/graphql/types/dashboard/index.js +1 -0
  123. package/dist-server/graphql/types/dashboard/index.js.map +1 -1
  124. package/dist-server/graphql/types/index.js +7 -2
  125. package/dist-server/graphql/types/index.js.map +1 -1
  126. package/dist-server/graphql/types/other/index.js +19 -0
  127. package/dist-server/graphql/types/other/index.js.map +1 -0
  128. package/dist-server/graphql/types/other/page-setting.js +34 -0
  129. package/dist-server/graphql/types/other/page-setting.js.map +1 -0
  130. package/dist-server/graphql/types/reports/index.js +6 -1
  131. package/dist-server/graphql/types/reports/index.js.map +1 -1
  132. package/dist-server/graphql/types/reports/outbound-order-details-report.js +17 -1
  133. package/dist-server/graphql/types/reports/outbound-order-details-report.js.map +1 -1
  134. package/dist-server/graphql/types/reports/release-inventory-report-list.js +12 -0
  135. package/dist-server/graphql/types/reports/release-inventory-report-list.js.map +1 -0
  136. package/dist-server/graphql/types/reports/release-inventory-report.js +27 -0
  137. package/dist-server/graphql/types/reports/release-inventory-report.js.map +1 -0
  138. package/dist-server/migrations/1568858861188-SeedSetting.js +5 -6
  139. package/dist-server/migrations/1568858861188-SeedSetting.js.map +1 -1
  140. package/dist-server/migrations/1623308919899-SeedLocationRecommendSetting.js +1 -1
  141. package/dist-server/migrations/1623308919899-SeedLocationRecommendSetting.js.map +1 -1
  142. package/dist-server/migrations/1623381200659-SeedStoringRule.js +1 -1
  143. package/dist-server/migrations/1623381200659-SeedStoringRule.js.map +1 -1
  144. package/dist-server/tsconfig.tsbuildinfo +1 -1
  145. package/dist-server/utils/report-query-util.js +5 -2
  146. package/dist-server/utils/report-query-util.js.map +1 -1
  147. package/helps/release-note.ko.md +8 -20
  148. package/helps/release-note.md +8 -20
  149. package/helps/release-note.ms.md +8 -20
  150. package/helps/release-note.zh.md +8 -20
  151. package/package.json +42 -42
  152. package/server/graphql/resolvers/board-setting/board-settings.ts +4 -6
  153. package/server/graphql/resolvers/custom/elccl/elccl-daily-collection-report.ts +4 -5
  154. package/server/graphql/resolvers/custom/elccl/elccl-daily-order-inventory-report.ts +9 -10
  155. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-pallet-detail-report.ts +4 -5
  156. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.ts +17 -19
  157. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.ts +10 -8
  158. package/server/graphql/resolvers/custom/elccl/elccl-onhand-inventory-counter.ts +9 -9
  159. package/server/graphql/resolvers/custom/kimeda/kimeda-onhand-inventory-counter.ts +9 -9
  160. package/server/graphql/resolvers/dashboard/arrival-notices-by-status.ts +23 -14
  161. package/server/graphql/resolvers/dashboard/collection-orders-by-status.ts +4 -5
  162. package/server/graphql/resolvers/dashboard/delivery-orders-by-status.ts +4 -5
  163. package/server/graphql/resolvers/dashboard/index.ts +3 -1
  164. package/server/graphql/resolvers/dashboard/inventory-expiry-monitor.ts +18 -6
  165. package/server/graphql/resolvers/dashboard/outbound-order-by-status.ts +114 -81
  166. package/server/graphql/resolvers/dashboard/release-goods-by-status.ts +23 -14
  167. package/server/graphql/resolvers/dashboard/unit-inbounded-outbounded.ts +61 -0
  168. package/server/graphql/resolvers/index.ts +5 -4
  169. package/server/graphql/resolvers/inventory-comparison/inventory-comparison-list.ts +11 -9
  170. package/server/graphql/resolvers/opa-menu/opa-menus.ts +7 -6
  171. package/server/graphql/resolvers/{extra → other}/add-release-good-products.ts +73 -12
  172. package/server/graphql/resolvers/other/index.ts +10 -0
  173. package/server/graphql/resolvers/other/page-settings.ts +105 -0
  174. package/server/graphql/resolvers/reports/costing-report.ts +8 -10
  175. package/server/graphql/resolvers/reports/inbound-order-details-report.ts +7 -9
  176. package/server/graphql/resolvers/reports/inbound-serial-number-report.ts +41 -13
  177. package/server/graphql/resolvers/reports/index.ts +3 -1
  178. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +76 -38
  179. package/server/graphql/resolvers/reports/outbound-serial-number-report.ts +42 -18
  180. package/server/graphql/resolvers/reports/product-label-report.ts +4 -6
  181. package/server/graphql/resolvers/reports/release-inventory-report.ts +201 -0
  182. package/server/graphql/resolvers/shipping-provider/shipping-providers.ts +3 -5
  183. package/server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.ts +10 -10
  184. package/server/graphql/types/dashboard/index.ts +1 -0
  185. package/server/graphql/types/index.ts +8 -2
  186. package/server/graphql/types/other/index.ts +19 -0
  187. package/server/graphql/types/other/page-setting.ts +33 -0
  188. package/server/graphql/types/reports/index.ts +6 -1
  189. package/server/graphql/types/reports/outbound-order-details-report.ts +17 -1
  190. package/server/graphql/types/reports/release-inventory-report-list.ts +8 -0
  191. package/server/graphql/types/reports/release-inventory-report.ts +23 -0
  192. package/server/migrations/1568858861188-SeedSetting.ts +4 -4
  193. package/server/migrations/1623308919899-SeedLocationRecommendSetting.ts +3 -2
  194. package/server/migrations/1623381200659-SeedStoringRule.ts +3 -2
  195. package/server/utils/report-query-util.ts +5 -2
  196. package/things-factory.config.js +4 -0
  197. package/translations/en.json +148 -27
  198. package/translations/ko.json +185 -105
  199. package/translations/ms.json +183 -98
  200. package/translations/zh.json +197 -112
  201. package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +0 -1
  202. package/dist-server/graphql/resolvers/extra/index.js.map +0 -1
  203. package/dist-server/graphql/types/extra/index.js +0 -11
  204. package/dist-server/graphql/types/extra/index.js.map +0 -1
  205. package/server/graphql/resolvers/extra/index.ts +0 -5
  206. package/server/graphql/types/extra/index.ts +0 -7
@@ -1,13 +1,15 @@
1
1
  import '@material/mwc-button/mwc-button'
2
2
  import '@things-factory/grist-ui'
3
+ import './inventory-history-by-pallet'
4
+
5
+ import gql from 'graphql-tag'
6
+ import { css, html, LitElement } from 'lit-element'
7
+
3
8
  import { i18next, localize } from '@things-factory/i18n-base'
4
9
  import { openPopup } from '@things-factory/layout-base'
5
10
  import { client } from '@things-factory/shell'
6
11
  import { ScrollbarStyles } from '@things-factory/styles'
7
12
  import { isMobileDevice } from '@things-factory/utils'
8
- import gql from 'graphql-tag'
9
- import { css, html, LitElement } from 'lit-element'
10
- import './inventory-history-by-pallet'
11
13
 
12
14
  class InventoryByProductDetail extends localize(i18next)(LitElement) {
13
15
  static get styles() {
@@ -54,6 +56,54 @@ class InventoryByProductDetail extends localize(i18next)(LitElement) {
54
56
  }
55
57
 
56
58
  firstUpdated() {
59
+ this._searchFields = [
60
+ {
61
+ label: i18next.t('field.batch_id'),
62
+ name: 'batchId',
63
+ type: 'text',
64
+ props: { searchOper: 'i_like' }
65
+ },
66
+ {
67
+ label: i18next.t('field.lot_id'),
68
+ name: 'palletId',
69
+ type: 'text',
70
+ props: { searchOper: 'i_like' }
71
+ },
72
+ {
73
+ label: i18next.t('field.carton_id'),
74
+ name: 'cartonId',
75
+ type: 'text',
76
+ props: { searchOper: 'i_like' }
77
+ },
78
+ {
79
+ label: i18next.t('field.location'),
80
+ name: 'location',
81
+ type: 'object',
82
+ queryName: 'locations',
83
+ field: 'name'
84
+ },
85
+ {
86
+ label: i18next.t('field.expirying_in'),
87
+ name: 'expiryingIn',
88
+ type: 'select',
89
+ options: [
90
+ { value: '' },
91
+ { name: i18next.t('text.3_months'), value: '3 months' },
92
+ { name: i18next.t('text.6_months'), value: '6 months' },
93
+ { name: i18next.t('text.9_months'), value: '9 months' },
94
+ { name: i18next.t('text.12_months'), value: '12 months' }
95
+ ],
96
+ props: { searchOper: 'eq' }
97
+ },
98
+ {
99
+ label: i18next.t('field.has_balance'),
100
+ name: 'remainOnly',
101
+ type: 'checkbox',
102
+ value: true,
103
+ props: { searchOper: 'eq' }
104
+ }
105
+ ]
106
+
57
107
  this.config = {
58
108
  list: { fields: ['palletId', 'batchId', 'orderRefNo', 'orderNo', 'zone', 'location', 'qty', 'batchIdRef'] },
59
109
  rows: { appendable: false },
@@ -68,39 +118,28 @@ class InventoryByProductDetail extends localize(i18next)(LitElement) {
68
118
  },
69
119
  {
70
120
  type: 'string',
71
- name: 'palletId',
72
- header: i18next.t('field.lot_id'),
73
- sortable: true,
121
+ name: 'batchId',
122
+ header: i18next.t('field.batch_id'),
74
123
  width: 200
75
124
  },
76
125
  {
77
126
  type: 'string',
78
- name: 'cartonId',
79
- header: i18next.t('field.carton_id'),
80
- sortable: true,
127
+ name: 'palletId',
128
+ header: i18next.t('field.lot_id'),
81
129
  width: 200
82
130
  },
83
131
  {
84
132
  type: 'string',
85
- name: 'batchId',
86
- header: i18next.t('field.batch_id'),
87
- sortable: true,
133
+ name: 'cartonId',
134
+ header: i18next.t('field.carton_id'),
88
135
  width: 200
89
136
  },
90
137
  {
91
138
  type: 'string',
92
139
  name: 'packingType',
93
140
  header: i18next.t('field.packing_type'),
94
- sortable: true,
95
141
  width: 200
96
142
  },
97
- {
98
- type: 'string',
99
- name: 'zone',
100
- header: i18next.t('field.zone'),
101
- sortable: true,
102
- width: 80
103
- },
104
143
  {
105
144
  type: 'object',
106
145
  name: 'location',
@@ -108,31 +147,24 @@ class InventoryByProductDetail extends localize(i18next)(LitElement) {
108
147
  sortable: true,
109
148
  width: 200
110
149
  },
111
- {
112
- type: 'number',
113
- name: 'qty',
114
- header: i18next.t('field.qty'),
115
- sortable: true,
116
- width: 80
117
- },
118
150
  {
119
151
  type: 'number',
120
152
  name: 'lockedQty',
121
153
  header: i18next.t('field.release_qty'),
122
- sortable: false,
154
+ sortable: true,
123
155
  width: 160
124
156
  },
125
157
  {
126
158
  type: 'number',
127
- name: 'remainingQty',
128
- header: i18next.t('field.remain_qty'),
159
+ name: 'qty',
160
+ header: i18next.t('field.available_qty'),
129
161
  sortable: true,
130
- width: 160
162
+ width: 80
131
163
  },
132
164
  {
133
165
  type: 'string',
134
166
  name: 'uomValue',
135
- header: i18next.t('field.uom_value'),
167
+ header: i18next.t('field.available_uom_value'),
136
168
  sortable: true,
137
169
  width: 80
138
170
  },
@@ -140,52 +172,24 @@ class InventoryByProductDetail extends localize(i18next)(LitElement) {
140
172
  type: 'string',
141
173
  name: 'batchIdRef',
142
174
  header: i18next.t('field.batch_no_ref'),
175
+ width: 200
176
+ },
177
+ {
178
+ type: 'date',
179
+ name: 'expirationDate',
180
+ header: i18next.t('field.expiry_date'),
181
+ sortable: true,
182
+ width: 200
183
+ },
184
+ {
185
+ type: 'date',
186
+ name: 'manufactureDate',
187
+ header: i18next.t('field.manufacture_date'),
143
188
  sortable: true,
144
189
  width: 200
145
190
  }
146
191
  ]
147
192
  }
148
-
149
- this._searchFields = [
150
- {
151
- label: i18next.t('field.batch_id'),
152
- name: 'batchId',
153
- type: 'text',
154
- props: { searchOper: 'i_like' }
155
- },
156
- {
157
- label: i18next.t('field.lot_id'),
158
- name: 'palletId',
159
- type: 'text',
160
- props: { searchOper: 'i_like' }
161
- },
162
- {
163
- label: i18next.t('field.carton_id'),
164
- name: 'cartonId',
165
- type: 'text',
166
- props: { searchOper: 'i_like' }
167
- },
168
- {
169
- label: i18next.t('field.location'),
170
- name: 'location',
171
- type: 'object',
172
- queryName: 'locations',
173
- field: 'name'
174
- },
175
- {
176
- label: i18next.t('field.zone'),
177
- name: 'zone',
178
- type: 'text',
179
- props: { searchOper: 'i_like' }
180
- },
181
- {
182
- label: i18next.t('field.has_balance'),
183
- name: 'remainOnly',
184
- type: 'checkbox',
185
- value: true,
186
- props: { searchOper: 'eq' }
187
- }
188
- ]
189
193
  }
190
194
 
191
195
  get dataGrist() {
@@ -199,35 +203,38 @@ class InventoryByProductDetail extends localize(i18next)(LitElement) {
199
203
  async fetchHandler({ page, limit, sorters = [] }) {
200
204
  try {
201
205
  if (!this.productId) return
202
- const filters = await this.searchForm.getQueryFilters()
206
+ let filters = await this.searchForm.getQueryFilters()
207
+
208
+ if (filters && filters.length > 2 && filters.find(filter => filter.name == 'remainOnly')) {
209
+ // only supports 2 filters including remainOnly (because its a boolean)
210
+ this._showToast({ type: 'warning', message: i18next.t('text.only_supports_search_of_single_field') })
211
+ return
212
+ } else if (!filters.find(filter => filter.name == 'remainOnly')) {
213
+ // when popup init, it doesnt capture the value of this field
214
+ // hence, we need to push a default value as follows
215
+ filters.push({ name: 'remainOnly', operator: 'eq', value: true })
216
+ }
217
+
203
218
  const response = await client.query({
204
219
  query: gql`
205
220
  query inventories($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
206
221
  inventories(filters: $filters, pagination: $pagination, sortings: $sortings) {
207
222
  items {
208
- packingType
223
+ batchId
209
224
  palletId
210
225
  cartonId
211
- batchId
212
- batchIdRef
213
- qty
214
- uomValue
215
- uom
216
- remainQty
217
- warehouse {
218
- name
219
- description
220
- }
221
- zone
226
+ packingType
222
227
  location {
223
228
  name
224
229
  description
225
230
  }
226
- updatedAt
227
- updater {
228
- name
229
- description
230
- }
231
+ uom
232
+ remainQty
233
+ qty
234
+ uomValue
235
+ batchIdRef
236
+ expirationDate
237
+ manufactureDate
231
238
  }
232
239
  total
233
240
  }
@@ -237,7 +244,7 @@ class InventoryByProductDetail extends localize(i18next)(LitElement) {
237
244
  filters: [
238
245
  ...filters,
239
246
  { name: 'product_id', operator: 'eq', value: this.productId },
240
- { name: 'status', operator: 'in', value: ['STORED', 'TERMINATED','MISSING'] }
247
+ { name: 'status', operator: 'in', value: ['STORED', 'TERMINATED', 'MISSING'] }
241
248
  ],
242
249
  pagination: { page, limit },
243
250
  sortings: sorters
@@ -15,6 +15,7 @@ import { isMobileDevice } from '@things-factory/utils'
15
15
  class InventoryByProduct extends localize(i18next)(PageView) {
16
16
  static get properties() {
17
17
  return {
18
+ _checkedBoxes: Array,
18
19
  _searchFields: Array,
19
20
  config: Object,
20
21
  data: Object
@@ -43,6 +44,11 @@ class InventoryByProduct extends localize(i18next)(PageView) {
43
44
  ]
44
45
  }
45
46
 
47
+ constructor() {
48
+ super()
49
+ this._checkedBoxes = []
50
+ }
51
+
46
52
  render() {
47
53
  return html`
48
54
  <search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.dataGrist.fetch()}></search-form>
@@ -70,12 +76,8 @@ class InventoryByProduct extends localize(i18next)(PageView) {
70
76
  return this.shadowRoot.querySelector('search-form')
71
77
  }
72
78
 
73
- get _lowStockCheckbox() {
74
- return this.searchForm.shadowRoot.querySelector('input[name=lowStock]')
75
- }
76
-
77
- get _overStockCheckbox() {
78
- return this.searchForm.shadowRoot.querySelector('input[name=overStock]')
79
+ get _availabletockCheckbox() {
80
+ return this.searchForm.shadowRoot.querySelector('input[name=availableStock]')
79
81
  }
80
82
 
81
83
  get dataGrist() {
@@ -84,6 +86,9 @@ class InventoryByProduct extends localize(i18next)(PageView) {
84
86
 
85
87
  pageUpdated(changes, lifecycle) {
86
88
  if (this.active) {
89
+ if (this._availabletockCheckbox && !this._checkedBoxes.length)
90
+ this._checkedBoxes = [this._availabletockCheckbox, { name: 'temp', checked: false }]
91
+
87
92
  this.dataGrist.fetch()
88
93
  }
89
94
  }
@@ -95,17 +100,25 @@ class InventoryByProduct extends localize(i18next)(PageView) {
95
100
  label: i18next.t('field.company'),
96
101
  name: 'bizplace',
97
102
  type: 'select',
98
- options: [
99
- { value: '' },
100
- ...partners
101
- .map(partner => {
102
- return {
103
- name: `${partner.name} ${partner.description ? `(${partner.description})` : ''}`,
104
- value: partner.id
105
- }
106
- })
107
- .sort(this._compareValues('name', 'asc'))
108
- ],
103
+ options:
104
+ partners?.length == 1
105
+ ? [
106
+ {
107
+ name: `${partners[0].name} ${partners[0].description ? `(${partners[0].description})` : ''}`,
108
+ value: partners[0].id
109
+ }
110
+ ]
111
+ : [
112
+ { value: '' },
113
+ ...partners
114
+ .map(partner => {
115
+ return {
116
+ name: `${partner.name} ${partner.description ? `(${partner.description})` : ''}`,
117
+ value: partner.id
118
+ }
119
+ })
120
+ .sort(this._compareValues('name', 'asc'))
121
+ ],
109
122
  props: { searchOper: 'eq' }
110
123
  },
111
124
  {
@@ -115,18 +128,18 @@ class InventoryByProduct extends localize(i18next)(PageView) {
115
128
  props: { searchOper: 'eq' }
116
129
  },
117
130
  {
118
- label: i18next.t('field.type'),
119
- name: 'type',
131
+ label: i18next.t('field.packing_type'),
132
+ name: 'packingType',
120
133
  type: 'string',
121
134
  props: { searchOper: 'eq' }
122
135
  },
123
- ,
124
136
  {
125
- label: i18next.t('field.available_stock_only'),
137
+ label: i18next.t('field.available_qty_only'),
126
138
  name: 'availableStock',
127
139
  type: 'checkbox',
128
140
  value: true,
129
- props: { searchOper: 'eq' }
141
+ props: { searchOper: 'eq' },
142
+ handlers: { change: this._updateSearchInputState.bind(this, 'availableStock') }
130
143
  },
131
144
  {
132
145
  label: i18next.t('field.low_on_stock'),
@@ -143,6 +156,22 @@ class InventoryByProduct extends localize(i18next)(PageView) {
143
156
  value: false,
144
157
  props: { searchOper: 'eq' },
145
158
  handlers: { change: this._updateSearchInputState.bind(this, 'overStock') }
159
+ },
160
+ {
161
+ label: i18next.t('field.quarantine_stock_only'),
162
+ name: 'quarantineStock',
163
+ type: 'checkbox',
164
+ value: false,
165
+ props: { searchOper: 'eq' },
166
+ handlers: { change: this._updateSearchInputState.bind(this, 'quarantineStock') }
167
+ },
168
+ {
169
+ label: i18next.t('field.reserve_stock_only'),
170
+ name: 'reserveStock',
171
+ type: 'checkbox',
172
+ value: false,
173
+ props: { searchOper: 'eq' },
174
+ handlers: { change: this._updateSearchInputState.bind(this, 'reserveStock') }
146
175
  }
147
176
  ]
148
177
 
@@ -167,6 +196,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
167
196
  header: i18next.t('field.company'),
168
197
  imex: { header: i18next.t('field.company'), key: 'bizplace', width: 50, type: 'string' },
169
198
  sortable: true,
199
+ label: true,
170
200
  width: 300
171
201
  },
172
202
  {
@@ -174,6 +204,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
174
204
  name: 'sku',
175
205
  imex: { header: i18next.t('field.sku'), key: 'sku', width: 30, type: 'string' },
176
206
  header: i18next.t('field.sku'),
207
+ label: true,
177
208
  width: 100
178
209
  },
179
210
  {
@@ -181,6 +212,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
181
212
  name: 'name',
182
213
  imex: { header: i18next.t('field.name'), key: 'name', width: 50, type: 'string' },
183
214
  header: i18next.t('field.name'),
215
+ label: true,
184
216
  width: 200
185
217
  },
186
218
  {
@@ -188,6 +220,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
188
220
  name: 'brand',
189
221
  imex: { header: i18next.t('field.brand'), key: 'brand', width: 30, type: 'string' },
190
222
  header: i18next.t('field.brand'),
223
+ label: true,
191
224
  width: 100
192
225
  },
193
226
  {
@@ -195,21 +228,15 @@ class InventoryByProduct extends localize(i18next)(PageView) {
195
228
  name: 'description',
196
229
  imex: { header: i18next.t('field.description'), key: 'description', width: 50, type: 'string' },
197
230
  header: i18next.t('field.description'),
198
- width: 300
199
- },
200
- {
201
- type: 'object',
202
- name: 'productRef',
203
- record: { options: { queryName: 'products' } },
204
- imex: { header: i18next.t('field.product_ref'), key: 'product_ref', width: 50, type: 'string' },
205
- header: i18next.t('field.product_ref'),
231
+ label: true,
206
232
  width: 300
207
233
  },
208
234
  {
209
235
  type: 'string',
210
- name: 'type',
211
- imex: { header: i18next.t('field.type'), key: 'type', width: 25, type: 'string' },
212
- header: i18next.t('field.type'),
236
+ name: 'packingType',
237
+ imex: { header: i18next.t('field.packing_type'), key: 'packingType', width: 25, type: 'string' },
238
+ header: i18next.t('field.packing_type'),
239
+ label: true,
213
240
  width: 150
214
241
  },
215
242
  {
@@ -217,6 +244,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
217
244
  name: 'minQty',
218
245
  imex: { header: i18next.t('field.min_qty'), key: 'minQty', width: 20, type: 'integer' },
219
246
  header: i18next.t('field.min_qty'),
247
+ label: true,
220
248
  width: 80
221
249
  },
222
250
  {
@@ -224,13 +252,52 @@ class InventoryByProduct extends localize(i18next)(PageView) {
224
252
  name: 'maxQty',
225
253
  imex: { header: i18next.t('field.max_qty'), key: 'maxQty', width: 20, type: 'integer' },
226
254
  header: i18next.t('field.max_qty'),
255
+ label: true,
256
+ width: 80
257
+ },
258
+ {
259
+ type: 'integer',
260
+ name: 'availableQty',
261
+ imex: { header: i18next.t('field.available_qty'), key: 'availableQty', width: 20, type: 'integer' },
262
+ header: i18next.t('field.available_qty'),
263
+ label: true,
264
+ sortable: true,
265
+ width: 80
266
+ },
267
+ {
268
+ type: 'integer',
269
+ name: 'releaseQty',
270
+ imex: { header: i18next.t('field.release_qty'), key: 'releaseQty', width: 20, type: 'integer' },
271
+ header: i18next.t('field.release_qty'),
272
+ label: true,
273
+ sortable: true,
227
274
  width: 80
228
275
  },
229
276
  {
230
277
  type: 'integer',
231
- name: 'qty',
232
- imex: { header: i18next.t('field.qty'), key: 'qty', width: 20, type: 'integer' },
233
- header: i18next.t('field.qty'),
278
+ name: 'quarantineQty',
279
+ imex: { header: i18next.t('field.quarantine_qty'), key: 'quarantineQty', width: 20, type: 'integer' },
280
+ header: i18next.t('field.quarantine_qty'),
281
+ label: true,
282
+ sortable: true,
283
+ width: 80
284
+ },
285
+ {
286
+ type: 'integer',
287
+ name: 'reserveQty',
288
+ imex: { header: i18next.t('field.reserve_qty'), key: 'reserveQty', width: 20, type: 'integer' },
289
+ header: i18next.t('field.reserve_qty'),
290
+ label: true,
291
+ sortable: true,
292
+ width: 80
293
+ },
294
+ {
295
+ type: 'integer',
296
+ name: 'warehouseQty',
297
+ imex: { header: i18next.t('field.warehouse_qty'), key: 'warehouseQty', width: 20, type: 'integer' },
298
+ header: i18next.t('field.warehouse_qty'),
299
+ label: true,
300
+ sortable: true,
234
301
  width: 80
235
302
  }
236
303
  ]
@@ -249,19 +316,19 @@ class InventoryByProduct extends localize(i18next)(PageView) {
249
316
  brand
250
317
  name
251
318
  description
252
- type
253
- bizplace {
254
- name
255
- }
256
- productRef {
257
- name
258
- description
259
- }
260
319
  minQty
261
320
  maxQty
262
321
  }
263
- qty
322
+ bizplace {
323
+ name
324
+ }
325
+ packingType
264
326
  averageUnitCost
327
+ availableQty
328
+ releaseQty
329
+ quarantineQty
330
+ reserveQty
331
+ warehouseQty
265
332
  }
266
333
  total
267
334
  }
@@ -274,10 +341,18 @@ class InventoryByProduct extends localize(i18next)(PageView) {
274
341
  return {
275
342
  total: response.data.inventoriesByProduct.total || 0,
276
343
  records: (response.data.inventoriesByProduct.items || []).map(item => {
277
- return {
278
- ...item,
279
- ...item.product
280
- }
344
+ // changed to direct assign instead of spread ...item, ...item.product to improve performance
345
+ let record = item.product
346
+ record.packingType = item.packingType
347
+ record.averageUnitCost = item.averageUnitCost
348
+ record.availableQty = item.availableQty
349
+ record.releaseQty = item.releaseQty
350
+ record.quarantineQty = item.quarantineQty
351
+ record.reserveQty = item.reserveQty
352
+ record.warehouseQty = item.warehouseQty
353
+ record.bizplace = item.bizplace
354
+
355
+ return record
281
356
  })
282
357
  }
283
358
  }
@@ -287,16 +362,44 @@ class InventoryByProduct extends localize(i18next)(PageView) {
287
362
  return this.config.columns
288
363
  }
289
364
 
290
- _updateSearchInputState(input) {
291
- switch (input) {
292
- case 'lowStock':
293
- this._overStockCheckbox.checked = false
294
- break
295
- case 'overStock':
296
- this._lowStockCheckbox.checked = false
297
- break
298
- default:
299
- break
365
+ _updateSearchInputState(fieldName) {
366
+ const targetField = this.searchForm.shadowRoot.querySelector(`input[name=${fieldName}]`)
367
+
368
+ if (targetField.checked) {
369
+ // clear all previously checked fields
370
+ this._checkedBoxes[1].checked = false
371
+ this._checkedBoxes[0].checked = false
372
+
373
+ const tempIdx = this._checkedBoxes.findIndex(cb => cb.name == 'temp')
374
+
375
+ if (fieldName == 'lowStock' || fieldName == 'overStock') {
376
+ const idx = this._checkedBoxes.findIndex(cb => cb.name == (fieldName == 'lowStock' ? 'overStock' : 'lowStock'))
377
+ if (idx == 1) {
378
+ this._checkedBoxes[1] = targetField
379
+ } else {
380
+ if (tempIdx == 1) {
381
+ this._checkedBoxes[1] = targetField
382
+ } else {
383
+ this._checkedBoxes[0] = this._checkedBoxes[1]
384
+ this._checkedBoxes[1] = targetField
385
+ }
386
+ }
387
+ } else {
388
+ if (tempIdx == 1) {
389
+ this._checkedBoxes[1] = targetField
390
+ } else {
391
+ this._checkedBoxes[0] = this._checkedBoxes[1]
392
+ this._checkedBoxes[1] = targetField
393
+ }
394
+ }
395
+
396
+ // reset all fields in _checkedBoxes array to TRUE
397
+ this._checkedBoxes[1].checked = true
398
+ this._checkedBoxes[0].checked = true
399
+ } else {
400
+ // replace unchecked field with default
401
+ const idx = this._checkedBoxes.findIndex(cb => cb.name == fieldName)
402
+ if (idx >= 0) this._checkedBoxes[idx] = { name: 'temp', checked: false }
300
403
  }
301
404
  }
302
405
 
@@ -321,6 +424,7 @@ class InventoryByProduct extends localize(i18next)(PageView) {
321
424
  return response.data.partnersBizplaces.items
322
425
  }
323
426
  }
427
+
324
428
  _compareValues(key, order = 'asc') {
325
429
  return function innerSort(a, b) {
326
430
  if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
@@ -360,11 +464,6 @@ class InventoryByProduct extends localize(i18next)(PageView) {
360
464
  })
361
465
 
362
466
  var data = records.map(item => {
363
- if (item.productRef) {
364
- var refName = item.productRef.name ? item.productRef.name : ''
365
- var refDesc = item.productRef.description ? ` (${item.productRef.description})` : ''
366
- }
367
-
368
467
  return {
369
468
  ...this._columns
370
469
  .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
@@ -378,12 +477,15 @@ class InventoryByProduct extends localize(i18next)(PageView) {
378
477
  name: item.name,
379
478
  sku: item.sku,
380
479
  description: item.description,
381
- type: item.type,
480
+ packingType: item.packingType,
382
481
  bizplace: item.bizplace.name,
383
- product_ref: refName + refDesc,
384
- qty: item.qty,
385
482
  minQty: item.minQty,
386
- maxQty: item.maxQty
483
+ maxQty: item.maxQty,
484
+ availableQty: item.availableQty,
485
+ releaseQty: item.releaseQty,
486
+ quarantineQty: item.quarantineQty,
487
+ reserveQty: item.reserveQty,
488
+ warehouseQty: item.warehouseQty
387
489
  // averageUnitCost: item.averageUnitCost
388
490
  }
389
491
  })