Repository navigation
Expand file tree
/
Copy pathworkButton.js
More file actions
381 lines (354 loc) · 18.4 KB
/
Copy pathworkButton.js
File metadata and controls
381 lines (354 loc) · 18.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
/* ✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤
This code written by : Sudhagona Rajyalaxmi
Date : 10/01/2024
♦ Start ♦
Step 1 - This code assigns specifications of a selected product type
Step 2 - This code is triggerd when user gives input on Specifications field
Change log :
1. 10/01/2024 : Initial script
2. 11/01/2023 : Comments updated by Sudhagona Rajyalaxmi
♦ End ♦
✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤✤
*/
if(row["Result"].value != null && row["Result"].value != undefined && row["Result"].value>=0) {
if (row["Specification"].value.includes("(0 = Pass & 1 = Fail)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either 0 for PASS and 1 for FAIL")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 0 ){
row["Status"].value ="Pass"
row["Remarks"].value = "Pass"
} else if (row["Result"].value == 1 ){
row["Status"].value ="Fail"
row["Remarks"].value = "Fail"
}
} else if (row["Specification"].value.includes("(0 = Absent & 1 = Present)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either 0 for ABSENT and 1 for PRESENT")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 0 ){
row["Status"].value ="Pass"
row["Remarks"].value = "Absent"
} else if (row["Result"].value == 1 ){
row["Status"].value ="Fail"
row["Remarks"].value = "Present"
}
} else if (row["Specification"].value.includes("(0 = Medium Brown & 1 = Non Medium Brown)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either 0 for MEDIUM BROWN and 1 for NON MEDIUM BROWN")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 0 ){
row["Status"].value ="Pass"
row["Remarks"].value = "Medium Brown"
} else if (row["Result"].value == 1 ){
row["Status"].value ="Fail"
row["Remarks"].value = "Non Medium Brown"
}
} else if (row["Specification"].value.includes("(0 = White Crystalline Powder & 1 = Others)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either 0 for WHITE CRYTALLINE POWDER and 1 for OTHERS")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 0 ){
row["Status"].value ="Pass"
row["Remarks"].value = "White Crystalline Powder"
} else if (row["Result"].value == 1 ){
row["Status"].value ="Fail"
row["Remarks"].value = "Others"
}
} else if (row["Specification"].value.includes("(0 = Clean, Characteristic of wheat free from Rancid odour & 1 = Others)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either 0 for CLEAN, CHARACTERISTIC OF WHEAT FREE FROM RANCID ODOUR and 1 for Others")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 0 ){
row["Status"].value ="Pass"
row["Remarks"].value = "Clean, Characteristic of wheat free from Rancid odour"
} else if (row["Result"].value == 1 ){
row["Status"].value ="Fail"
row["Remarks"].value = "Others"
}
} else if (row["Specification"].value.includes("(0 = Not Ok & 1 = Ok)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either 0 for Not Ok or 1 for Ok)")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 0 ){
row["Status"].value ="Fail"
row["Remarks"].value = "Not Ok"
} else if (row["Result"].value == 1 ){
row["Status"].value ="Pass"
row["Remarks"].value = "Ok"
}
} else if (row["Specification"].value.includes("(0 = Free from Contamination with clay,grit and other extraneous adulterant & Impurities & 1 = Others)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either (0 = Free from Contamination with clay ,grit and other extraneous adulterant & Impurities & 1 = Others)")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 0 ){
row["Status"].value ="Pass"
row["Remarks"].value = "Free from Contamination with clay,grit and other extraneous adulterant & Impurities"
} else if (row["Result"].value == 1 ){
row["Status"].value ="Fail"
row["Remarks"].value = "Others"
}
} else if (row["Specification"].value.includes("(0 = White & 1 = Others)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either 0 for White or 1 for Others)")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 0 ){
row["Status"].value ="Pass"
row["Remarks"].value = "White"
} else if (row["Result"].value == 1 ){
row["Status"].value ="Fail"
row["Remarks"].value = "Others"
}
} else if (row["Specification"].value.includes("(0 = No off Odour & 1 = Others)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either 0 for No off Odour or 1 for Others)")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 0 ){
row["Status"].value ="Pass"
row["Remarks"].value = "No off Odour"
} else if (row["Result"].value == 1 ){
row["Status"].value ="Fail"
row["Remarks"].value = "Others"
}
} else if (row["Specification"].value.includes("(0 = Free flow & 1 = Others)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either 0 for Free flow or 1 for Others)")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 0 ){
row["Status"].value ="Pass"
row["Remarks"].value = "Free flow"
} else if (row["Result"].value == 1 ){
row["Status"].value ="Fail"
row["Remarks"].value = "Others"
}
} else if (row["Specification"].value.includes("(0 = Positive & 1 = Negative)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either 0 for Positive & 1 for Negative")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 0 ){
row["Status"].value ="Pass"
row["Remarks"].value = "Positive"
} else if (row["Result"].value == 1 ){
row["Status"].value ="Fail"
row["Remarks"].value = "Negative"
}
} else if (row["Specification"].value.includes("(1 = ok, 0 = Not ok)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either 0 for ok & 1 for Not ok")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 1 ){
row["Status"].value ="Pass"
row["Remarks"].value = "ok"
} else if (row["Result"].value == 0 ){
row["Status"].value ="Fail"
row["Remarks"].value = "Not ok"
}
} else if (row["Specification"].value.includes("(0 = absent & 1 = present)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either 0 for absent & 1 for present")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 0 ){
row["Status"].value ="Pass"
row["Remarks"].value = "absent"
} else if (row["Result"].value == 1 ){
row["Status"].value ="Fail"
row["Remarks"].value = "present"
}
} else if (row["Specification"].value.includes("(0 = Present & 1 = Absent)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either 0 for Present & 1 for Absent")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 0 ){
row["Status"].value ="Pass"
row["Remarks"].value = "present"
} else if (row["Result"].value == 1 ){
row["Status"].value ="Fail"
row["Remarks"].value = "absent"
}
} else if (row["Specification"].value.includes("(0 = Positive / 1 = Negative)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either (0 = Positive / 1 = Negative) ")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 1 ){
row["Status"].value ="Pass"
row["Remarks"].value = "Negative"
} else if (row["Result"].value == 0 ){
row["Status"].value ="Fail"
row["Remarks"].value = "Positive"
}
} else if (row["Specification"].value.includes("(0 = Ok / 1 = Not Ok)")) {
if (row["Result"].value != 0 && row["Result"].value != 1 && row["Result"].value != undefined){
app_lib.showWarn("Please enter either (0 = Ok / 1 = Not Ok) ")
row["Result"].value =""
row["Status"].value =""
} else if (row["Result"].value == 1 ){
row["Status"].value ="Pass"
row["Remarks"].value = "Ok"
} else if (row["Result"].value == 0 ){
row["Status"].value ="Fail"
row["Remarks"].value = "Not Ok"
}
} else {
if(row["Min_Value"].value != ""){
var inputMin = Number(row["Min_Value"].value)
}else{
var inputMin = "Kellton"
}
if(row["Max_Value"].value != ""){
var inputMax = Number(row["Max_Value"].value)
}else{
var inputMax = "Kellton"
}
if (inputMin != "Kellton" && inputMax !="Kellton") {
//check if result value is in between inputMin and inputMax
var result = Number(row["Result"].value)
if(!isNaN(result) && ( result != null || result != undefined)){
if(result >= inputMin && result <= inputMax){
row["Status"].value = "Pass"
}
else {
row["Status"].value = "Fail"
}
} else {
row["Status"].value = "Fail"
}
} else if (inputMin != "Kellton" && inputMax =="Kellton") {
//check if result value is less than inputMin
var result = Number(row["Result"].value)
if(!isNaN(result) && ( result != null || result != undefined)){
if(result < inputMin){
row["Status"].value = "Fail"
}
else {
row["Status"].value = "Pass"
}
} else {
row["Status"].value = "Fail"
}
} else if (inputMin == "Kellton" && inputMax !="Kellton") {
//check if result value is more than inputMax
var result = Number(row["Result"].value)
if(!isNaN(result) && ( result != null || result != undefined)){
if(result > inputMax){
row["Status"].value = "Fail"
}
else {
row["Status"].value = "Pass"
}
} else {
row["Status"].value = "Fail"
}
}
}
} else {
row["Remarks"].value=""
row["Status"].value=""
}
//code for specific parameters based on Category, Product Type and Brand
if (fields["Category"].value == "Dry Fruits" && fields["Brand"].value == "Tata Sampann" && fields["Product_Type"].value == "Dry Fruits - Luxe Dry Fruits & Nuts Mix") {
if (row["Parameters_Checked"].value == "Appearance") {
row["Remarks"].value = "The product should be mixture of Almonds, Cashews, Raisins, Cranberries and Pistachio kernels. The product shall be sound, whole, clean and free from living or dead insects, visible foreign matter, visible moulds and rodent contamination."
}
if (row["Parameters_Checked"].value == "Texture") {
row["Remarks"].value = "Characteristic crunchy texture of nuts and seeds."
}
if (row["Parameters_Checked"].value == "Aroma") {
row["Remarks"].value = "Characteristic aroma of individual ingredients without any off flavour, and evidence of fermentation, Rancidity."
}
if (row["Parameters_Checked"].value == "Taste") {
row["Remarks"].value = "Characteristic taste of individual ingredients without any off taste of nuts and evidence of fermentation, rancidity."
}
}
if (fields["Category"].value == "Dry Fruits" && fields["Brand"].value == "Tata Sampann" && fields["Product_Type"].value == "Delight (Dry Fruits & Seed Mix)") {
if (row["Parameters_Checked"].value == "Appearance") {
row["Remarks"].value = "The product shall be mixture of sound, clean, sufficiently developed dry fruits dried cranberries, green raisins, black raisins, roasted almonds and roasted seeds of Pumpkin, Flax and Chia. It shall be free from visible mold, living insects and mites, dead insects, rodent contamination, insect fragments and damage caused by insects or other parasites etc."
}
}
if (fields["Category"].value == "Dry Fruits" && fields["Brand"].value == "Tata Sampann" && fields["Product_Type"].value == "Dry Fruits - Fox Nuts") {
if (row["Parameters_Checked"].value == "Appearance") {
row["Remarks"].value = "White to off white in colour, oval to round with small brown specks. It should be free from foreign bodies & impurities, infestation, living insects, mould, dead insects, insect fragments,rodent contamination and artificial colouring."
}
}
if (fields["Category"].value == "Dry Fruits" && fields["Brand"].value == "Tata Sampann" && fields["Product_Type"].value == "7 in 1 Seeds & Nuts FG") {
if (row["Parameters_Checked"].value == "Appearance") {
row["Remarks"].value = "The product shall be mixture of sound, clean, sufficiently developed and roasted seeds of Pumpkin, Watermelon, Sunflower, Flax, Sesame, Chia, Soy nuts. The product shall be free from visible mold, living insects and mites, dead insects, rodent contamination, insect fragments and damage caused by insects or other parasites etc."
}
if (row["Parameters_Checked"].value == "Taste") {
row["Remarks"].value = "Characteristic taste of roasted seeds. Free from presence of rancidity disagreeable, bitter and foreign taste."
}
}
if (fields["Category"].value == "Dry Fruits" && fields["Brand"].value == "Tata Sampann" && fields["Product_Type"].value == "Walnut Kernels") {
if (row["Parameters_Checked"].value == "Appearance") {
row["Remarks"].value = "The kernels shall be sound, clean, sufficiently developed and dry. It shall be free from added colour. They shall be free from rancidity, visible mold, foreign smell and/or taste, living insects and mites. It shall also be free from dead insects, rodent contamination, insect fragments and damage caused by insects or other parasites visible to the naked eye."
}
}
if (fields["Category"].value == "Dry Fruits" && fields["Brand"].value == "Tata Sampann" && fields["Product_Type"].value == "Dry Fruits - Sunflower Seeds") {
if (row["Parameters_Checked"].value == "Appearance") {
row["Remarks"].value = "The kernels shall be sound, clean, sufficiently developed and dry. It shall be free from added colour. They shall be free from rancidity, visible mold, foreign smell and/or taste, living insects and mites. It shall also be free from dead insects, rodent contamination, insect fragments and damage caused by insects or other parasites visible to the naked eye."
}
}
if (fields["Category"].value == "Dry Fruits" && fields["Brand"].value == "Tata Sampann" && fields["Product_Type"].value == "Dry Fruits - Flax Seeds") {
if (row["Parameters_Checked"].value == "Appearance") {
row["Remarks"].value = "Oval shaped & clean Seeds, free from living/dead insects,moulds, insects fragments, rodent contamination."
}
}
if (fields["Category"].value == "Dry Fruits" && fields["Brand"].value == "Tata Sampann" && fields["Product_Type"].value == "Dry Fruits - Chia Seeds") {
if (row["Parameters_Checked"].value == "Appearance") {
row["Remarks"].value = "Oval Shaped, it should be from moulds, living/dead insects, insects fragments, rodent contamination.Uniform suspension of seeds in water soaked for 30 min in 10% sol. of water."
}
}
if (fields["Category"].value == "Dry Fruits" && fields["Brand"].value == "Tata Sampann" && fields["Product_Type"].value == "Dry Fruits - Pistachios California") {
if (row["Parameters_Checked"].value == "Appearance") {
row["Remarks"].value = "The product shall be free from foreign matter,living insects,mould,dead insects,insects fragments and rodent contamination."
}
if (row["Parameters_Checked"].value == "Aroma") {
row["Remarks"].value = "The prodcut shall have pleasant taste and flavour,free from odour and taste,mustiness and rancidity."
}
if (row["Parameters_Checked"].value == "Colour") {
row["Remarks"].value = "The product shall have uniform colour. Reddish Brown skin, Green/yellowish Brown Kernels. Free from black, dark brown or dark gray spots."
}
}
if (fields["Category"].value == "Dry Fruits" && fields["Brand"].value == "Tata Sampann" && fields["Product_Type"].value == "Dry Fruits - Indian Green Raisins") {
if (row["Parameters_Checked"].value == "Appearance") {
row["Remarks"].value = "The product shall be free from foreign matter, living insects, mould, dead insects, insect fragments and rodent contamination(Green to green yellow)."
}
}
if (fields["Category"].value == "Dry Fruits" && fields["Brand"].value == "Tata Sampann" && fields["Product_Type"].value == "Dry Fruits - Cashew-W320") {
if (row["Parameters_Checked"].value == "Appearance") {
row["Remarks"].value = "The kernels shall be sound ,clean,sufficiently developed and dry. It shall also be free from any, dead insects, rodent contamination, insect fragments and damage caused by insects, mites or other parasites visible to the naked eye."
}
if (row["Parameters_Checked"].value == "Taste/aroma") {
row["Remarks"].value = "Cashew kernels shall be free from any rancidity, shell liquid, foreign smell and/or taste smell and/or taste."
}
if (row["Parameters_Checked"].value == "Colour") {
row["Remarks"].value = "The kernels shall be of uniform and characteristic colour. They may be either in the form of whole or pieces."
}
}
if (fields["Category"].value == "Dry Fruits" && fields["Brand"].value == "Tata Sampann" && fields["Product_Type"].value == "Dry Fruits - Almonds") {
if (row["Parameters_Checked"].value == "Appearance") {
row["Remarks"].value = "The product shall be sound, whole, clean, sufficiently dried and free from living or dead insects, rancidity, visible foreign matter, visible moulds and rodent contamination."
}
if (row["Parameters_Checked"].value == "Aroma") {
row["Remarks"].value = "Characteristic taste without any off taste flavour of nuts, free from off odour and evidence of fermentation."
}
}
if (fields["Category"].value == "Poha & Pulses" && fields["Brand"].value == "Tata Sampann" && fields["Product_Type"].value == "Daliya 400g") {
if (row["Parameters_Checked"].value == "Appearance") {
row["Remarks"].value = "Broken Wheat (Triticum aestivum), free from foreignbodies and impurities, infestation and artificial colouring. It should have a clean Wheat like aroma free from rancid odour."
}
}