@things-factory/operato-pms 3.8.13 → 3.8.14

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 (60) hide show
  1. package/client/pages/dispatchment/daily-dispatch-detail.js +1 -1
  2. package/client/pages/dispatchment/dispatchment-create-record.js +15 -40
  3. package/client/pages/harvesting/daily-harvesting-detail.js +2 -2
  4. package/client/pages/harvesting/edit-harvesting-record.js +2 -2
  5. package/client/pages/harvesting/harvesting-create-record.js +2 -2
  6. package/client/pages/inventory/inventory-ramp-tonnage.js +23 -31
  7. package/client/pages/report/report-daily-ffb-dispatch-and-production.js +167 -124
  8. package/client/pages/report/report-ffb-tonnage-between-individual-block.js +12 -7
  9. package/dist-server/constants/transaction.js +2 -1
  10. package/dist-server/constants/transaction.js.map +1 -1
  11. package/dist-server/entities/daily-dispatch.js +1 -2
  12. package/dist-server/entities/daily-dispatch.js.map +1 -1
  13. package/dist-server/graphql/resolvers/daily-dispatch/update-daily-dispatch.js +1 -1
  14. package/dist-server/graphql/resolvers/daily-dispatch/update-daily-dispatch.js.map +1 -1
  15. package/dist-server/graphql/resolvers/daily-harvest/generate-daily-harvest.js +2 -2
  16. package/dist-server/graphql/resolvers/daily-harvest/generate-daily-harvest.js.map +1 -1
  17. package/dist-server/graphql/resolvers/daily-loading/update-daily-loading.js +19 -6
  18. package/dist-server/graphql/resolvers/daily-loading/update-daily-loading.js.map +1 -1
  19. package/dist-server/graphql/resolvers/dashboard/dashboard-query.js +165 -43
  20. package/dist-server/graphql/resolvers/dashboard/dashboard-query.js.map +1 -1
  21. package/dist-server/graphql/resolvers/report/daily-ffb-dispatch-production-reports.js +111 -0
  22. package/dist-server/graphql/resolvers/report/daily-ffb-dispatch-production-reports.js.map +1 -0
  23. package/dist-server/graphql/resolvers/report/daily-production-reports.js +6 -6
  24. package/dist-server/graphql/resolvers/report/index.js +2 -1
  25. package/dist-server/graphql/resolvers/report/index.js.map +1 -1
  26. package/dist-server/graphql/resolvers/report/monthly-block-dispatch-reports.js +10 -8
  27. package/dist-server/graphql/resolvers/report/monthly-block-dispatch-reports.js.map +1 -1
  28. package/dist-server/graphql/resolvers/report/monthly-ffb-sale-reports.js +1 -1
  29. package/dist-server/graphql/resolvers/report/monthly-production-reports.js +1 -1
  30. package/dist-server/graphql/types/report/daily-ffb-dispatch-production-report-list.js +14 -0
  31. package/dist-server/graphql/types/report/daily-ffb-dispatch-production-report-list.js.map +1 -0
  32. package/dist-server/graphql/types/report/daily-ffb-dispatch-production-report.js +15 -0
  33. package/dist-server/graphql/types/report/daily-ffb-dispatch-production-report.js.map +1 -0
  34. package/dist-server/graphql/types/report/index.js +13 -0
  35. package/dist-server/graphql/types/report/index.js.map +1 -1
  36. package/dist-server/utils/core-values.js +2 -2
  37. package/dist-server/utils/transaction-util.js +2 -1
  38. package/dist-server/utils/transaction-util.js.map +1 -1
  39. package/package.json +2 -2
  40. package/server/constants/transaction.ts +2 -1
  41. package/server/entities/daily-dispatch.ts +1 -4
  42. package/server/graphql/resolvers/daily-dispatch/update-daily-dispatch.ts +2 -2
  43. package/server/graphql/resolvers/daily-harvest/generate-daily-harvest.ts +2 -2
  44. package/server/graphql/resolvers/daily-loading/update-daily-loading.ts +39 -11
  45. package/server/graphql/resolvers/dashboard/dashboard-query.ts +208 -52
  46. package/server/graphql/resolvers/report/daily-ffb-dispatch-production-reports.ts +138 -0
  47. package/server/graphql/resolvers/report/daily-production-reports.ts +6 -6
  48. package/server/graphql/resolvers/report/index.ts +3 -1
  49. package/server/graphql/resolvers/report/monthly-block-dispatch-reports.ts +11 -9
  50. package/server/graphql/resolvers/report/monthly-ffb-sale-reports.ts +1 -1
  51. package/server/graphql/resolvers/report/monthly-production-reports.ts +1 -1
  52. package/server/graphql/types/report/daily-ffb-dispatch-production-report-list.ts +8 -0
  53. package/server/graphql/types/report/daily-ffb-dispatch-production-report.ts +9 -0
  54. package/server/graphql/types/report/index.ts +13 -0
  55. package/server/utils/core-values.ts +2 -2
  56. package/server/utils/transaction-util.ts +2 -1
  57. package/translations/en.json +7 -6
  58. package/translations/ko.json +7 -6
  59. package/translations/ms.json +10 -9
  60. package/translations/zh.json +7 -6
@@ -127,7 +127,7 @@ class DailyDispatchDetail extends localize(i18next)(PageView) {
127
127
  <label>${i18next.t('label.chit_no')}</label>
128
128
  <input name="chitNo" />
129
129
 
130
- <label>${i18next.t('label.percentage')}</label>
130
+ <label>${i18next.t('label.oer_percentage')}</label>
131
131
  <input name="percentage" type="number" min="0" />
132
132
  </fieldset>
133
133
  </form>
@@ -141,7 +141,7 @@ class DispatchmentCreateRecord extends localize(i18next)(PageView) {
141
141
  <label>${i18next.t('label.chit_no')}</label>
142
142
  <input name="chitNo" />
143
143
 
144
- <label>${i18next.t('label.percentage')}</label>
144
+ <label>${i18next.t('label.oer_percentage')}</label>
145
145
  <input name="percentage" type="number" min="0" />
146
146
  </fieldset>
147
147
  </form>
@@ -215,38 +215,20 @@ class DispatchmentCreateRecord extends localize(i18next)(PageView) {
215
215
  },
216
216
  {
217
217
  type: 'object',
218
- name: 'plantationInventory',
218
+ name: 'ramp',
219
219
  header: i18next.t('field.ramp'),
220
220
  record: {
221
221
  editable: true,
222
222
  options: {
223
- queryName: 'plantationInventories',
224
- nameField: 'rampName',
225
- basicArgs: {
226
- filters: [{ name: 'type', value: 'RAMP_TONNAGE', operator: 'eq' }]
227
- },
223
+ queryName: 'ramps',
228
224
  select: [
229
225
  { name: 'id', hidden: true },
230
- { name: 'rampId', hidden: true },
231
- { name: 'rampName', header: i18next.t('field.ramp'), width: 200 },
232
- {
233
- name: 'totalTonnage',
234
- type: 'float',
235
- header: i18next.t('field.remaining_tonnage'),
236
- width: 200,
237
- ignoreCondition: true
238
- }
226
+ { name: 'name', header: i18next.t('field.name'), width: 200 }
239
227
  ],
240
- list: { fields: ['rampName', 'totalTonnage'] }
228
+ list: { fields: ['id', 'name'] }
241
229
  }
242
230
  },
243
- width: 300
244
- },
245
- {
246
- type: 'integer',
247
- name: 'totalTonnage',
248
- header: i18next.t('field.available_tonnage'),
249
- width: 140
231
+ width: 130
250
232
  },
251
233
  {
252
234
  type: 'float',
@@ -286,7 +268,7 @@ class DispatchmentCreateRecord extends localize(i18next)(PageView) {
286
268
 
287
269
  try {
288
270
  if (changedColumn === 'collectedRampWeight') {
289
- this._validateReleaseTonnage(changeRecord.collectedRampWeight, changeRecord.totalTonnage)
271
+ this._validateReleaseTonnage(changeRecord.collectedRampWeight)
290
272
  }
291
273
  this._updateInventoryList()
292
274
  } catch (e) {
@@ -300,34 +282,29 @@ class DispatchmentCreateRecord extends localize(i18next)(PageView) {
300
282
  }
301
283
  }
302
284
 
303
- _validateReleaseTonnage(collectedRampWeight, totalTonnage) {
304
- if (totalTonnage === undefined) throw new Error(i18next.t('text.there_is_no_selected_items'))
305
- if (collectedRampWeight > totalTonnage) {
306
- throw new Error(i18next.t('text.available_tonnage_insufficient'))
307
- } else if (collectedRampWeight <= 0) {
285
+ _validateReleaseTonnage(collectedRampWeight) {
286
+ if (collectedRampWeight <= 0 || isNaN(collectedRampWeight)) {
308
287
  throw new Error(i18next.t('text.invalid_tonnage_input'))
309
288
  }
310
289
  }
311
290
 
312
291
  async _updateInventoryList() {
313
- const _selectedInventories = (this.dispatchmentGrist.dirtyData.records || []).map(
314
- record => record.plantationInventory.id
315
- )
292
+ const _selectedRamp = (this.dispatchmentGrist.dirtyData.records || []).map(record => record.ramp.id)
316
293
  this.dispatchmentGristConfig = {
317
294
  ...this.dispatchmentGristConfig,
318
295
  columns: this.dispatchmentGristConfig.columns.map(column => {
319
- if (column.name === 'plantationInventory') {
296
+ if (column.name === 'ramp') {
320
297
  column.record.options.basicArgs = {
321
298
  ...column.record.options.basicArgs,
322
299
  filters: [...column.record.options.basicArgs.filters.filter(filter => filter.name !== 'id')]
323
300
  }
324
301
 
325
- if (_selectedInventories.length)
302
+ if (_selectedRamp.length)
326
303
  column.record.options.basicArgs.filters = [
327
304
  ...column.record.options.basicArgs.filters,
328
305
  {
329
306
  name: 'id',
330
- value: _selectedInventories,
307
+ value: _selectedRamp,
331
308
  operator: 'notin'
332
309
  }
333
310
  ]
@@ -399,16 +376,14 @@ class DispatchmentCreateRecord extends localize(i18next)(PageView) {
399
376
  if (!this.dispatchmentGrist.dirtyData.records || !this.dispatchmentGrist.dirtyData.records.length)
400
377
  throw new Error(i18next.t('text.no_records_in_dispatchment_list'))
401
378
 
402
- if (
403
- this.dispatchmentGrist.dirtyData.records.filter(record => !record.rampName || !record.collectedRampWeight).length
404
- )
379
+ if (this.dispatchmentGrist.dirtyData.records.filter(record => !record.ramp || !record.collectedRampWeight).length)
405
380
  throw new Error(i18next.t('text.empty_value_in_dispatchment_data'))
406
381
  }
407
382
 
408
383
  _getDispatchDetails() {
409
384
  return this.dispatchmentGrist.dirtyData.records.map(record => {
410
385
  let dailyDispatchDetails = {
411
- ramp: { id: record.plantationInventory.rampId, name: record.plantationInventory.rampName },
386
+ ramp: { id: record.ramp.id, name: record.ramp.name },
412
387
  collectedRampWeight: Number(record.collectedRampWeight),
413
388
  remark: record?.remark ? record.remark : null
414
389
  }
@@ -197,9 +197,9 @@ class DailyHarvestingDetail extends localize(i18next)(PageView) {
197
197
  {
198
198
  type: 'float',
199
199
  name: 'totalTonnageHarvested',
200
- header: i18next.t('field.total_tonnage_harvested'),
200
+ header: i18next.t('field.total_tonnage_estimated'),
201
201
  label: true,
202
- width: 150
202
+ width: 200
203
203
  },
204
204
  {
205
205
  type: 'string',
@@ -215,9 +215,9 @@ class EditHarvestingRecord extends localize(i18next)(PageView) {
215
215
  {
216
216
  type: 'float',
217
217
  name: 'totalTonnageHarvested',
218
- header: i18next.t('field.total_tonnage_harvested'),
218
+ header: i18next.t('field.total_tonnage_estimated'),
219
219
  record: { editable: true },
220
- width: 150
220
+ width: 200
221
221
  },
222
222
  {
223
223
  type: 'string',
@@ -210,9 +210,9 @@ class HarvestingCreateRecord extends localize(i18next)(PageView) {
210
210
  {
211
211
  type: 'float',
212
212
  name: 'totalTonnageHarvested',
213
- header: i18next.t('field.total_tonnage_harvested'),
213
+ header: i18next.t('field.total_tonnage_estimated'),
214
214
  record: { editable: true },
215
- width: 150
215
+ width: 200
216
216
  },
217
217
  {
218
218
  type: 'string',
@@ -1,14 +1,16 @@
1
1
  import '@things-factory/form-ui'
2
2
  import '@things-factory/grist-ui'
3
+ import './inventory-history-by-tonnage'
4
+
5
+ import gql from 'graphql-tag'
6
+ import { css, html } from 'lit-element'
7
+ import { connect } from 'pwa-helpers/connect-mixin'
8
+
3
9
  import { i18next, localize } from '@things-factory/i18n-base'
4
10
  import { openPopup } from '@things-factory/layout-base'
5
11
  import { client, PageView, store } from '@things-factory/shell'
6
12
  import { ScrollbarStyles } from '@things-factory/styles'
7
13
  import { isMobileDevice } from '@things-factory/utils'
8
- import gql from 'graphql-tag'
9
- import { css, html } from 'lit-element'
10
- import { connect } from 'pwa-helpers/connect-mixin'
11
- import './inventory-history-by-tonnage'
12
14
 
13
15
  class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
14
16
  static get styles() {
@@ -79,20 +81,20 @@ class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
79
81
  }
80
82
 
81
83
  async pageInitialized() {
82
- const _blocks = await this.fetchBlocks()
84
+ const _ramps = await this._fetchRamp()
83
85
 
84
86
  this._searchFields = [
85
87
  {
86
- label: i18next.t('field.block'),
87
- name: 'blockId',
88
+ label: i18next.t('field.ramp'),
89
+ name: 'rampId',
88
90
  type: 'select',
89
91
  options: [
90
92
  { value: '' },
91
- ..._blocks
92
- .map(block => {
93
+ ..._ramps
94
+ .map(ramp => {
93
95
  return {
94
- name: block.name,
95
- value: block.id
96
+ name: ramp.name,
97
+ value: ramp.id
96
98
  }
97
99
  })
98
100
  .sort(this._compareValues('name', 'asc'))
@@ -103,15 +105,10 @@ class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
103
105
 
104
106
  this.config = {
105
107
  list: {
106
- fields: ['block', 'ramp', 'tonnage', 'updatedAt']
107
- },
108
- pagination: { pages: [10, 20, 50, 2500] },
109
- rows: {
110
- selectable: {
111
- multiple: true
112
- },
113
- appendable: false
108
+ fields: ['ramp', 'tonnage', 'updatedAt']
114
109
  },
110
+ pagination: { pages: [10, 20, 50, 100] },
111
+ rows: { appendable: false },
115
112
  columns: [
116
113
  { type: 'gutter', gutterName: 'sequence' },
117
114
  {
@@ -122,20 +119,13 @@ class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
122
119
  click: this._showTonnageMovement.bind(this)
123
120
  }
124
121
  },
125
- {
126
- type: 'object',
127
- name: 'block',
128
- header: i18next.t('field.block'),
129
- imex: { header: i18next.t('field.block'), key: 'block', width: 50, type: 'string' },
130
- sortable: true,
131
- width: 150
132
- },
133
122
  {
134
123
  type: 'object',
135
124
  name: 'ramp',
136
125
  header: i18next.t('field.ramp'),
137
126
  imex: { header: i18next.t('field.ramp'), key: 'ramp', width: 50, type: 'string' },
138
127
  sortable: true,
128
+ label: true,
139
129
  width: 150
140
130
  },
141
131
  {
@@ -144,6 +134,7 @@ class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
144
134
  header: i18next.t('field.tonnage_remaining'),
145
135
  imex: { header: i18next.t('field.tonnage_remaining'), key: 'tonnage', width: 30, type: 'string' },
146
136
  sortable: true,
137
+ label: true,
147
138
  width: 200
148
139
  },
149
140
  {
@@ -151,6 +142,7 @@ class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
151
142
  name: 'updatedAt',
152
143
  header: i18next.t('field.updated_at'),
153
144
  sortable: true,
145
+ label: true,
154
146
  imex: { header: i18next.t('field.updated_at'), key: 'updatedAt', width: 75, type: 'date' },
155
147
  width: 150
156
148
  }
@@ -233,12 +225,12 @@ class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
233
225
  }
234
226
  }
235
227
 
236
- async fetchBlocks() {
228
+ async _fetchRamp() {
237
229
  const filters = []
238
230
  const response = await client.query({
239
231
  query: gql`
240
- query blocks($filters: [Filter]) {
241
- blocks(filters: $filters) {
232
+ query ramps($filters: [Filter]) {
233
+ ramps(filters: $filters) {
242
234
  items {
243
235
  id
244
236
  name
@@ -249,7 +241,7 @@ class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
249
241
  `,
250
242
  variables: { filters }
251
243
  })
252
- return response.data.blocks.items
244
+ return response.data.ramps.items
253
245
  }
254
246
 
255
247
  _showTonnageMovement(columns, data, column, record, rowIndex) {
@@ -39,15 +39,16 @@ class ReportDailyFfbDispatchAndProduction extends connect(store)(localize(i18nex
39
39
  _config: Object,
40
40
  _gristData: Object,
41
41
  _blocks: Object,
42
+ _mills: Object,
42
43
  _month: String,
43
44
  data: Object
44
45
  }
45
46
  }
46
47
 
47
48
  get context() {
48
- let fileName = `${i18next.t('title.ffb_tonnage_between_individual_block')}`
49
+ let fileName = `${i18next.t('title.daily_ffb_dispatch_and_production')}`
49
50
  return {
50
- title: i18next.t('title.ffb_tonnage_between_individual_block'),
51
+ title: i18next.t('title.daily_ffb_dispatch_and_production'),
51
52
  printable: {
52
53
  accept: ['preview'],
53
54
  content: this
@@ -119,120 +120,138 @@ class ReportDailyFfbDispatchAndProduction extends connect(store)(localize(i18nex
119
120
  }
120
121
  }
121
122
 
122
- get sectionOneColumns() {
123
- return [
124
- {
125
- type: 'string',
126
- name: 'date',
127
- header: i18next.t('field.date'),
128
- record: { editable: false, align: 'left' },
129
- imex: {
130
- header: i18next.t('field.date'),
131
- key: 'date',
132
- width: 20,
133
- type: 'string'
134
- },
135
- width: 120
136
- },
137
- {
138
- type: 'string',
139
- name: 'runningNo',
140
- header: i18next.t('field.no'),
141
- record: { editable: false, align: 'left' },
142
- imex: {
143
- header: i18next.t('field.no'),
144
- key: 'runningNo',
145
- width: 10,
146
- type: 'string'
147
- },
148
- width: 60
149
- },
150
- {
151
- type: 'string',
152
- name: 'dispatchTo',
153
- header: i18next.t('field.dispatch_to'),
154
- record: { editable: false, align: 'left' },
155
- imex: {
156
- header: i18next.t('field.dispatch_to'),
157
- key: 'dispatchTo',
158
- width: 50,
159
- type: 'string'
160
- },
161
- width: 200
162
- },
163
- {
164
- type: 'string',
165
- name: 'lorryNo',
166
- header: i18next.t('field.lorry_no'),
167
- record: { editable: false, align: 'left' },
168
- imex: {
169
- header: i18next.t('field.lorry_no'),
170
- key: 'lorryNo',
171
- width: 50,
172
- type: 'string'
173
- },
174
- width: 200
175
- }
176
- ]
177
- }
178
-
179
- get sectionTwoColumns() {
180
- return this._blocks.sort(this._compareValues('name', 'asc')).map(blk => {
181
- return {
182
- type: 'number',
183
- name: blk.name,
184
- header: blk.name,
185
- record: { editable: false, align: 'center' },
186
- imex: {
187
- header: blk.name,
188
- key: blk.name,
189
- width: 30,
190
- type: 'decimal'
191
- },
192
- width: 120
193
- }
194
- })
195
- }
196
-
197
- get sectionThreeColumns() {
198
- return [
199
- {
200
- type: 'string',
201
- name: 'today',
202
- header: i18next.t('field.today'),
203
- record: { editable: false, align: 'center' },
204
- imex: {
205
- header: i18next.t('field.today'),
206
- key: 'today',
207
- width: 30,
208
- type: 'string'
209
- },
210
- width: 120
211
- },
212
- {
213
- type: 'string',
214
- name: 'todate',
215
- header: i18next.t('field.to_date'),
216
- record: { editable: false, align: 'center' },
217
- imex: {
218
- header: i18next.t('field.to_date'),
219
- key: 'todate',
220
- width: 30,
221
- type: 'string'
222
- },
223
- width: 120
224
- }
225
- ]
226
- }
123
+ // get sectionOneColumns() {
124
+ // return [
125
+ // {
126
+ // type: 'string',
127
+ // name: 'date',
128
+ // header: i18next.t('field.date'),
129
+ // record: { editable: false, align: 'left' },
130
+ // imex: {
131
+ // header: i18next.t('field.date'),
132
+ // key: 'date',
133
+ // width: 20,
134
+ // type: 'string'
135
+ // },
136
+ // width: 120
137
+ // }
138
+ // ]
139
+ // }
140
+
141
+ // get sectionTwoColumns() {
142
+ // return this._blocks.sort(this._compareValues('name', 'asc')).map(blk => {
143
+ // return {
144
+ // type: 'number',
145
+ // name: blk.name,
146
+ // header: blk.name,
147
+ // record: { editable: false, align: 'center' },
148
+ // imex: {
149
+ // header: blk.name,
150
+ // key: blk.name,
151
+ // width: 30,
152
+ // type: 'decimal'
153
+ // },
154
+ // width: 120
155
+ // }
156
+ // })
157
+ // }
158
+
159
+ // get sectionThreeColumns() {
160
+ // return this._mills.sort(this._compareValues('name', 'asc')).map(mill => {
161
+ // return {
162
+ // type: 'number',
163
+ // name: mill.name,
164
+ // header: mill.name,
165
+ // record: { editable: false, align: 'center' },
166
+ // imex: {
167
+ // header: mill.name,
168
+ // key: mill.name,
169
+ // width: 30,
170
+ // type: 'decimal'
171
+ // },
172
+ // width: 120
173
+ // }
174
+ // })
175
+ // }
227
176
 
228
177
  async pageInitialized() {
229
- let blocks = [...(await this._fetchBlocks())]
230
- this._blocks = blocks
178
+ this._blocks = [...(await this._fetchBlocks())]
179
+ this._mills = [...(await this._fetchMills())]
231
180
  this._gristData = { total: 0, records: [] }
232
181
  this._searchFields = this.searchFields
233
182
  this._config = {
234
183
  ...this.reportConfig,
235
- columns: [...this.sectionOneColumns, ...this.sectionTwoColumns, ...this.sectionThreeColumns]
184
+ columns: [
185
+ {
186
+ type: 'string',
187
+ name: 'date',
188
+ header: i18next.t('field.date'),
189
+ record: { editable: false, align: 'left' },
190
+ imex: {
191
+ header: i18next.t('field.date'),
192
+ key: 'date',
193
+ width: 20,
194
+ type: 'string'
195
+ },
196
+ width: 120
197
+ },
198
+ ...this._blocks.sort(this._compareValues('name', 'asc')).map(blk => {
199
+ return {
200
+ type: 'string',
201
+ name: blk.name,
202
+ header: blk.name,
203
+ record: { editable: false, align: 'center' },
204
+ imex: {
205
+ header: blk.name,
206
+ key: blk.name,
207
+ width: 30,
208
+ type: 'string'
209
+ },
210
+ width: 130
211
+ }
212
+ }),
213
+ ...this._mills.sort(this._compareValues('name', 'asc')).map(mill => {
214
+ return {
215
+ type: 'string',
216
+ name: mill.name,
217
+ header: mill.name,
218
+ record: { editable: false, align: 'center' },
219
+ imex: {
220
+ header: mill.name,
221
+ key: mill.name,
222
+ width: 30,
223
+ type: 'string'
224
+ },
225
+ width: 130
226
+ }
227
+ }),
228
+ {
229
+ type: 'string',
230
+ name: 'unknown',
231
+ header: 'UNKNOWN',
232
+ record: { editable: false, align: 'center' },
233
+ imex: {
234
+ header: 'UNKNOWN',
235
+ key: 'unknown',
236
+ width: 30,
237
+ type: 'string'
238
+ },
239
+ width: 130
240
+ },
241
+ {
242
+ type: 'string',
243
+ name: 'today',
244
+ header: i18next.t('field.today'),
245
+ record: { editable: false, align: 'center' },
246
+ imex: {
247
+ header: i18next.t('field.today'),
248
+ key: 'today',
249
+ width: 30,
250
+ type: 'string'
251
+ },
252
+ width: 130
253
+ }
254
+ ]
236
255
  }
237
256
  }
238
257
 
@@ -250,16 +269,12 @@ class ReportDailyFfbDispatchAndProduction extends connect(store)(localize(i18nex
250
269
 
251
270
  const response = await client.query({
252
271
  query: gql`
253
- query monthlyBlockDispatchReports($filters: [Filter], $pagination: Pagination, $sortings: [Sorting]) {
254
- monthlyBlockDispatchReports(filters: $filters, pagination: $pagination, sortings: $sortings) {
272
+ query dailyFfbDispatchProductionReports($filters: [Filter], $pagination: Pagination, $sortings: [Sorting]) {
273
+ dailyFfbDispatchProductionReports(filters: $filters, pagination: $pagination, sortings: $sortings) {
255
274
  items {
256
- no
257
275
  date
258
276
  blockData
259
- lorryNo
260
- dispatchTo
261
277
  today
262
- todate
263
278
  }
264
279
  total
265
280
  }
@@ -270,7 +285,7 @@ class ReportDailyFfbDispatchAndProduction extends connect(store)(localize(i18nex
270
285
 
271
286
  const data = {
272
287
  records:
273
- response.data.monthlyBlockDispatchReports.items.map((item, idx) => {
288
+ response.data.dailyFfbDispatchProductionReports.items.map((item, idx) => {
274
289
  let blockData = JSON.parse(item.blockData)
275
290
  return {
276
291
  ...item,
@@ -278,7 +293,7 @@ class ReportDailyFfbDispatchAndProduction extends connect(store)(localize(i18nex
278
293
  runningNo: idx + 1
279
294
  }
280
295
  }) || [],
281
- total: response.data.monthlyBlockDispatchReports.total
296
+ total: response.data.dailyFfbDispatchProductionReports.total
282
297
  }
283
298
 
284
299
  this._gristData = {
@@ -316,16 +331,42 @@ class ReportDailyFfbDispatchAndProduction extends connect(store)(localize(i18nex
316
331
  })
317
332
 
318
333
  if (!response.errors) {
319
- return response.data.ramps.items.map(ramp => {
320
- return {
321
- id: ramp.block.id,
322
- name: ramp.block.name
334
+ return response.data.ramps.items.reduce((acc, ramp) => {
335
+ if (!acc.find(itm => itm.id == ramp.block.id) && !ramp.block.deletedAt)
336
+ acc.push({
337
+ id: ramp.block.id,
338
+ name: ramp.block.name
339
+ })
340
+
341
+ return acc
342
+ }, [])
343
+ }
344
+ }
345
+
346
+ async _fetchMills() {
347
+ const filters = [{ name: 'type', operator: 'eq', value: 'MILL' }]
348
+ const pagination = { page: 1, limit: 99999999 }
349
+
350
+ const response = await client.query({
351
+ query: gql`
352
+ query organizations($filters: [Filter], $pagination: Pagination) {
353
+ organizations(filters: $filters, pagination: $pagination) {
354
+ items {
355
+ id
356
+ name
357
+ }
358
+ }
323
359
  }
324
- })
360
+ `,
361
+ variables: { filters, pagination }
362
+ })
363
+
364
+ if (!response.errors) {
365
+ return [...response.data.organizations.items]
325
366
  }
326
367
  }
327
368
 
328
- _dateChange() {
369
+ _dateChange(e) {
329
370
  const monthNames = [
330
371
  'January',
331
372
  'February',
@@ -342,6 +383,8 @@ class ReportDailyFfbDispatchAndProduction extends connect(store)(localize(i18nex
342
383
  ]
343
384
  let selectedDate = this._monthInput.valueAsDate
344
385
  this._month = `${monthNames[selectedDate.getMonth()]} ${selectedDate.getFullYear().toString()}`
386
+
387
+ this.searchForm.submit()
345
388
  }
346
389
 
347
390
  async _exportableData() {