@things-factory/operato-pms 4.3.371 → 4.3.378

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 (30) hide show
  1. package/client/pages/dispatchment/dispatchment-list.js +17 -3
  2. package/client/pages/harvesting/harvesting-list.js +17 -3
  3. package/client/pages/loading/loading-list.js +17 -3
  4. package/config.development.js +86 -0
  5. package/dist-server/graphql/resolvers/daily-dispatch/daily-dispatch-query.js +24 -7
  6. package/dist-server/graphql/resolvers/daily-dispatch/daily-dispatch-query.js.map +1 -1
  7. package/dist-server/graphql/resolvers/daily-dispatch/generate-daily-dispatch.js +60 -4
  8. package/dist-server/graphql/resolvers/daily-dispatch/generate-daily-dispatch.js.map +1 -1
  9. package/dist-server/graphql/resolvers/daily-harvest/daily-harvest-query.js +24 -2
  10. package/dist-server/graphql/resolvers/daily-harvest/daily-harvest-query.js.map +1 -1
  11. package/dist-server/graphql/resolvers/daily-loading/daily-loading-query.js +24 -2
  12. package/dist-server/graphql/resolvers/daily-loading/daily-loading-query.js.map +1 -1
  13. package/dist-server/graphql/resolvers/daily-loading/generate-daily-loading.js +3 -2
  14. package/dist-server/graphql/resolvers/daily-loading/generate-daily-loading.js.map +1 -1
  15. package/dist-server/graphql/resolvers/report/daily-production-reports.js +59 -56
  16. package/dist-server/graphql/resolvers/report/daily-production-reports.js.map +1 -1
  17. package/dist-server/utils/transaction-util.js +68 -1
  18. package/dist-server/utils/transaction-util.js.map +1 -1
  19. package/package.json +41 -41
  20. package/server/graphql/resolvers/daily-dispatch/daily-dispatch-query.ts +25 -8
  21. package/server/graphql/resolvers/daily-dispatch/generate-daily-dispatch.ts +100 -16
  22. package/server/graphql/resolvers/daily-harvest/daily-harvest-query.ts +26 -0
  23. package/server/graphql/resolvers/daily-loading/daily-loading-query.ts +26 -0
  24. package/server/graphql/resolvers/daily-loading/generate-daily-loading.ts +64 -53
  25. package/server/graphql/resolvers/report/daily-production-reports.ts +1 -0
  26. package/server/utils/transaction-util.ts +95 -1
  27. package/translations/en.json +2 -0
  28. package/translations/ja.json +9 -9
  29. package/translations/ko.json +9 -9
  30. package/translations/zh.json +9 -9
@@ -1,7 +1,15 @@
1
1
  import { User } from '@things-factory/auth-base'
2
2
  import { Domain } from '@things-factory/shell'
3
3
  import { INVENTORY_STATUS, RAMP_STATUS, TRANSACTION_TYPE } from '../constants'
4
- import { PlantationInventory, RecordTransaction, Ramp, Block } from '../entities'
4
+ import {
5
+ DailyDispatch,
6
+ DailyLoading,
7
+ PlantationInventory,
8
+ RecordTransaction,
9
+ Ramp,
10
+ Block,
11
+ RampBlockHistory
12
+ } from '../entities'
5
13
  import { NoGenerator } from '../utils'
6
14
  import { EntityManager, getRepository, Repository } from 'typeorm'
7
15
 
@@ -53,6 +61,92 @@ export async function generateTransactionHistory(
53
61
  return recTransactionHistory
54
62
  }
55
63
 
64
+ /**
65
+ * @description It will insert new record into transaction table.
66
+ * seq will be calculated based on number of records for one specific plantation inventory
67
+ */
68
+
69
+ export async function generateRampBlockHistories(
70
+ block: Block,
71
+ domain: Domain,
72
+ ramp: Ramp,
73
+ transactionType: string,
74
+ transactionDate: string,
75
+ rampWeight: number,
76
+ user: User,
77
+ deletedAt?: any,
78
+ dailyDispatch?: DailyDispatch,
79
+ trxMgr?: EntityManager
80
+ ): Promise<RampBlockHistory> {
81
+ console.log(block, domain, ramp, user)
82
+ const rampBlockHistoryRepo: Repository<RampBlockHistory> =
83
+ trxMgr?.getRepository(RampBlockHistory) || getRepository(RampBlockHistory)
84
+
85
+ if (!ramp?.id) throw new Error(`Can't find a matching ramp.`)
86
+
87
+ const lastRampBlockHistory: RampBlockHistory = await rampBlockHistoryRepo.findOne({
88
+ where: { domain, ramp, block },
89
+ order: { seq: 'DESC' }
90
+ })
91
+
92
+ let res: any
93
+
94
+ if (!lastRampBlockHistory) {
95
+ res = await rampBlockHistoryRepo
96
+ .createQueryBuilder()
97
+ .insert()
98
+ .into(RampBlockHistory)
99
+ .values([
100
+ {
101
+ transactionDate,
102
+ transactionType,
103
+ seq: 0,
104
+ domain,
105
+ block,
106
+ ramp,
107
+ weight: rampWeight,
108
+ previousWeight: 0,
109
+ currentWeight: rampWeight,
110
+ dailyDispatch,
111
+ deletedAt: deletedAt ? deletedAt : null,
112
+ creator: user,
113
+ updater: user
114
+ }
115
+ ])
116
+ .returning('*')
117
+ .execute()
118
+ } else {
119
+ const previousWeight: number = lastRampBlockHistory.currentWeight
120
+
121
+ res = await rampBlockHistoryRepo
122
+ .createQueryBuilder()
123
+ .insert()
124
+ .into(RampBlockHistory)
125
+ .values([
126
+ {
127
+ domain,
128
+ block,
129
+ ramp,
130
+ transactionType,
131
+ transactionDate,
132
+ weight: rampWeight,
133
+ previousWeight,
134
+ currentWeight: parseFloat((previousWeight + rampWeight).toFixed(4)),
135
+ creator: user,
136
+ updater: user,
137
+ seq: () =>
138
+ `(select seq from ramp_block_histories where ramp_id = '${ramp.id}' and block_id = '${block.id}' and domain_id = '${domain.id}' order by seq desc limit 1) + 1`
139
+ }
140
+ ])
141
+ .returning('*')
142
+ .execute()
143
+ }
144
+
145
+ let newRampBlockHistory: RampBlockHistory = res.generatedMaps[0]
146
+
147
+ return newRampBlockHistory
148
+ }
149
+
56
150
  /**
57
151
  * @description: Check ramp emptiness and update status of ramp
58
152
  * @param domain
@@ -31,6 +31,7 @@
31
31
  "field.estimated_ffb": "estimated ffb",
32
32
  "field.estimated_last_ffb": "estimated last ffb",
33
33
  "field.field_bunches": "field bunches",
34
+ "field.from": "from",
34
35
  "field.harvest_date": "harvest date",
35
36
  "field.harvested_today": "harvested today",
36
37
  "field.harvesting_rd": "harvesting rd",
@@ -66,6 +67,7 @@
66
67
  "field.staff": "staff",
67
68
  "field.status": "status",
68
69
  "field.task_no": "task no",
70
+ "field.to": "to",
69
71
  "field.to_date_bunch_harvest": "to date bunch harvest",
70
72
  "field.to_date_out_turn": "to date out turn",
71
73
  "field.to_date_weight_dispatch": "to date weight dispatch",
@@ -30,10 +30,10 @@
30
30
  "field.total_no_of_bunches": "total no of bunches",
31
31
  "field.total_stand": "total stand",
32
32
  "field.total_tonnage": "total tonnage",
33
- "field.total_tonnage_estimated": "total tonnage (estimated)",
34
33
  "field.total_weight_loaded": "total weight loaded",
35
34
  "field.total_weight": "total weight",
36
35
  "field.trip": "trip",
36
+ "field.total_tonnage_estimated": "total tonnage (estimated)",
37
37
  "field.type": "type",
38
38
  "field.valid_from": "valid from",
39
39
  "field.year_planted": "year planted",
@@ -41,7 +41,7 @@
41
41
  "label.block": "block",
42
42
  "label.chit_no": "chit no",
43
43
  "label.collected_bunch": "collected bunch",
44
- "label.contractor": "[jp] contractor",
44
+ "label.contractor": "kontraktor",
45
45
  "label.coverage": "coverage",
46
46
  "label.date": "date",
47
47
  "label.harvesting_round": "harvesting round",
@@ -55,7 +55,7 @@
55
55
  "label.total_task_covered": "total task covered",
56
56
  "label.total_tonnage": "total tonnage",
57
57
  "label.yesterday_balance_bunch": "yesterday balance bunch",
58
- "text.code-management": "[jp] code management",
58
+ "text.code-management": "[ms] code management",
59
59
  "text.create_harvesting_record": "create harvesting record",
60
60
  "text.create_loading_record": "create loading record",
61
61
  "text.destination_is_not_selected": "destination is not selected",
@@ -64,8 +64,8 @@
64
64
  "text.harvesting_record_invalid": "harvesting record invalid",
65
65
  "text.loading_record_created": "loading record created",
66
66
  "text.loading_record_invalid": "loading record invalid",
67
- "text.invalid_percentage_value": "invalid percentage value",
68
67
  "text.no_records": "no records",
68
+ "text.invalid_percentage_value": "invalid percentage value",
69
69
  "text.there_is_duplicated_staff_in_record": "there is duplicated staff in this record",
70
70
  "text.total_bunch_weight_should_be_positive": "total bunch weight should be positive",
71
71
  "text.total_bunches_loaded_should_be_positive": "total bunches loaded should be positive",
@@ -75,16 +75,16 @@
75
75
  "text.x_has_invalid_value": "{x} has invalid value",
76
76
  "text.x_should_be_positive": "{x} should be positive",
77
77
  "text.you_wont_be_able_to_revert_this": "you wont be able to revert this",
78
- "title.are_you_sure": "are you sure",
79
- "title.block_details": "block details",
80
- "title.block": "block",
81
- "title.company": "company",
78
+ "title.are_you_sure": "adakah anda pasti",
79
+ "title.block_details": "butiran blok",
80
+ "title.block": "blok",
81
+ "title.company": "syarikat",
82
82
  "title.create_harvesting_record": "create harvesting record",
83
83
  "title.create_loading_record": "create loading record",
84
84
  "title.daily_ffb_dispatch_and_production": "daily FFB dispatch and production",
85
85
  "title.daily_loading_record": "daily loading record",
86
86
  "title.daily_production_report": "daily production report",
87
- "title.global_plantation_setting": "[jp] global plantation setting",
87
+ "title.global_plantation_setting": "[ms] global plantation setting",
88
88
  "title.harvest_data": "harvest data",
89
89
  "title.harvest_list": "harvesting list",
90
90
  "title.harvest_no": "harvest no",
@@ -30,10 +30,10 @@
30
30
  "field.total_no_of_bunches": "total no of bunches",
31
31
  "field.total_stand": "total stand",
32
32
  "field.total_tonnage": "total tonnage",
33
- "field.total_tonnage_estimated": "total tonnage (estimated)",
34
33
  "field.total_weight_loaded": "total weight loaded",
35
34
  "field.total_weight": "total weight",
36
35
  "field.trip": "trip",
36
+ "field.total_tonnage_estimated": "total tonnage (estimated)",
37
37
  "field.type": "type",
38
38
  "field.valid_from": "valid from",
39
39
  "field.year_planted": "year planted",
@@ -41,7 +41,7 @@
41
41
  "label.block": "block",
42
42
  "label.chit_no": "chit no",
43
43
  "label.collected_bunch": "collected bunch",
44
- "label.contractor": "[ko] contractor",
44
+ "label.contractor": "kontraktor",
45
45
  "label.coverage": "coverage",
46
46
  "label.date": "date",
47
47
  "label.harvesting_round": "harvesting round",
@@ -55,7 +55,7 @@
55
55
  "label.total_task_covered": "total task covered",
56
56
  "label.total_tonnage": "total tonnage",
57
57
  "label.yesterday_balance_bunch": "yesterday balance bunch",
58
- "text.code-management": "[ko] code management",
58
+ "text.code-management": "[ms] code management",
59
59
  "text.create_harvesting_record": "create harvesting record",
60
60
  "text.create_loading_record": "create loading record",
61
61
  "text.destination_is_not_selected": "destination is not selected",
@@ -64,8 +64,8 @@
64
64
  "text.harvesting_record_invalid": "harvesting record invalid",
65
65
  "text.loading_record_created": "loading record created",
66
66
  "text.loading_record_invalid": "loading record invalid",
67
- "text.invalid_percentage_value": "invalid percentage value",
68
67
  "text.no_records": "no records",
68
+ "text.invalid_percentage_value": "invalid percentage value",
69
69
  "text.there_is_duplicated_staff_in_record": "there is duplicated staff in this record",
70
70
  "text.total_bunch_weight_should_be_positive": "total bunch weight should be positive",
71
71
  "text.total_bunches_loaded_should_be_positive": "total bunches loaded should be positive",
@@ -75,16 +75,16 @@
75
75
  "text.x_has_invalid_value": "{x} has invalid value",
76
76
  "text.x_should_be_positive": "{x} should be positive",
77
77
  "text.you_wont_be_able_to_revert_this": "you wont be able to revert this",
78
- "title.are_you_sure": "are you sure",
79
- "title.block_details": "block details",
80
- "title.block": "block",
81
- "title.company": "company",
78
+ "title.are_you_sure": "adakah anda pasti",
79
+ "title.block_details": "butiran blok",
80
+ "title.block": "blok",
81
+ "title.company": "syarikat",
82
82
  "title.create_harvesting_record": "create harvesting record",
83
83
  "title.create_loading_record": "create loading record",
84
84
  "title.daily_ffb_dispatch_and_production": "daily FFB dispatch and production",
85
85
  "title.daily_loading_record": "daily loading record",
86
86
  "title.daily_production_report": "daily production report",
87
- "title.global_plantation_setting": "[ko] global plantation setting",
87
+ "title.global_plantation_setting": "[ms] global plantation setting",
88
88
  "title.harvest_data": "harvest data",
89
89
  "title.harvest_list": "harvesting list",
90
90
  "title.harvest_no": "harvest no",
@@ -30,10 +30,10 @@
30
30
  "field.total_no_of_bunches": "total no of bunches",
31
31
  "field.total_stand": "total stand",
32
32
  "field.total_tonnage": "total tonnage",
33
- "field.total_tonnage_estimated": "total tonnage (estimated)",
34
33
  "field.total_weight_loaded": "total weight loaded",
35
34
  "field.total_weight": "total weight",
36
35
  "field.trip": "trip",
36
+ "field.total_tonnage_estimated": "total tonnage (estimated)",
37
37
  "field.type": "type",
38
38
  "field.valid_from": "valid from",
39
39
  "field.year_planted": "year planted",
@@ -41,7 +41,7 @@
41
41
  "label.block": "block",
42
42
  "label.chit_no": "chit no",
43
43
  "label.collected_bunch": "collected bunch",
44
- "label.contractor": "contractor",
44
+ "label.contractor": "kontraktor",
45
45
  "label.coverage": "coverage",
46
46
  "label.date": "date",
47
47
  "label.harvesting_round": "harvesting round",
@@ -55,7 +55,7 @@
55
55
  "label.total_task_covered": "total task covered",
56
56
  "label.total_tonnage": "total tonnage",
57
57
  "label.yesterday_balance_bunch": "yesterday balance bunch",
58
- "text.code-management": "[zh] code management",
58
+ "text.code-management": "[ms] code management",
59
59
  "text.create_harvesting_record": "create harvesting record",
60
60
  "text.create_loading_record": "create loading record",
61
61
  "text.destination_is_not_selected": "destination is not selected",
@@ -65,26 +65,26 @@
65
65
  "text.loading_record_created": "loading record created",
66
66
  "text.loading_record_invalid": "loading record invalid",
67
67
  "text.no_records": "no records",
68
+ "text.invalid_percentage_value": "invalid percentage value",
68
69
  "text.there_is_duplicated_staff_in_record": "there is duplicated staff in this record",
69
70
  "text.total_bunch_weight_should_be_positive": "total bunch weight should be positive",
70
71
  "text.total_bunches_loaded_should_be_positive": "total bunches loaded should be positive",
71
72
  "text.total_no_of_bunches_should_be_positive": "total no of bunches should be positive",
72
73
  "text.total_tonnage_harvested_should_be_positive": "total tonnage harvested should be positive",
73
74
  "text.tracked_inventory_setting": "tracked inventory setting",
74
- "text.invalid_percentage_value": "invalid percentage value",
75
75
  "text.x_has_invalid_value": "{x} has invalid value",
76
76
  "text.x_should_be_positive": "{x} should be positive",
77
77
  "text.you_wont_be_able_to_revert_this": "you wont be able to revert this",
78
- "title.are_you_sure": "are you sure",
79
- "title.block_details": "block details",
80
- "title.block": "block",
81
- "title.company": "company",
78
+ "title.are_you_sure": "adakah anda pasti",
79
+ "title.block_details": "butiran blok",
80
+ "title.block": "blok",
81
+ "title.company": "syarikat",
82
82
  "title.create_harvesting_record": "create harvesting record",
83
83
  "title.create_loading_record": "create loading record",
84
84
  "title.daily_ffb_dispatch_and_production": "daily FFB dispatch and production",
85
85
  "title.daily_loading_record": "daily loading record",
86
86
  "title.daily_production_report": "daily production report",
87
- "title.global_plantation_setting": "[zh] global plantation setting",
87
+ "title.global_plantation_setting": "[ms] global plantation setting",
88
88
  "title.harvest_data": "harvest data",
89
89
  "title.harvest_list": "harvesting list",
90
90
  "title.harvest_no": "harvest no",