blob: 4fece46c6a21f25cb19b79d13ff77f752f1b35aa (
plain)
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
|
//*****************************************************
// чтение файла настроек и данных
// все настройки, клиенты, камазы и 1 взвешивания = data/
void loadSetup() {
JSONArray values;
// Считываем путь до папки с настройками из put/sourse.json:
try {
values = loadJSONArray(put + "source.json"); // = data/ + ... // Ядиск
for (int i = 0; i < values.size(); i++) {
JSONObject animal = values.getJSONObject(i);
filePath = animal.getString("filePath"); // адрес папки с Ядиск
println(filePath);
}
}
catch (Exception e) {
printFileLog("File 'source.json' - undetected");
selectFolder("Select a folder to process:", "folderSelected");
while (!flagWork) {
delay(100);
}
}
values = new JSONArray();
JSONObject animal = new JSONObject();
animal.setString("filePath", filePath);
values.setJSONObject(0, animal);
saveJSONArray(values, "data/" + "source.json");
println("NEXT--->>>");
try {
values = loadJSONArray(filePath + "option.json"); // = data/Custom/ + ...
for (int i = 0; i < values.size(); i++) {
animal = values.getJSONObject(i);
serialPort = animal.getInt("COMport"); // номер COM порта
portSpeed = animal.getInt("portSpeed"); // скорость порта (9600)
lf = animal.getInt("numberScales"); // кол-во символов в посылке с весов
beginIn = animal.getInt("beginIn"); // начало значащих символов посылки
vIn = animal.getString("scalesIn"); // начало не значащих символов посылки
vOut = animal.getString("scalesOut"); // конец не значащих символов посылки
vOff = animal.getString("scalesOff"); // вся посылка полностью
//filePath = animal.getString("filePath"); // Ядиск
threshold = animal.getInt("threshold"); // нижний порог для обработки з2
stab = animal.getInt("stabWeight"); // кол-во весовых посылок для "стабильного" веса
tara = animal.getInt("tara"); // минимальная тара камаза для %
protsUmolch = animal.getInt("protsUmolch"); // % засора по умолчанию
numberReport = animal.getInt("numberReport"); // порядковый номер отчета
}
}
catch (Exception e) {
printFileLog("File 'option.json' - undetected");
System.exit(1);
}
try {
values = loadJSONArray(filePath + "temp.json");
for (int i = 0; i < values.size(); ++i) {
animal = values.getJSONObject(i);
dataM1[animal.getInt("id")][1] = "" + animal.getInt("zas2");
dataM1[animal.getInt("id")][2] = animal.getString("nomer");
dataM1[animal.getInt("id")][3] = animal.getString("client");
dataM1[animal.getInt("id")][4] = animal.getString("object");
dataM1[animal.getInt("id")][5] = "" + animal.getInt("price");
dataM1[animal.getInt("id")][6] = "" + animal.getInt("prots");
dataM1[animal.getInt("id")][7] = "" + animal.getInt("arenda");
dataM1[animal.getInt("id")][8] = "" + animal.getInt("dopsor");
dataM1[animal.getInt("id")][9] = animal.getString("note");
dataM1[animal.getInt("id")][0] = "" + animal.getInt("ves");
dataM1[animal.getInt("id")][10] = animal.getString("time");
dataM1[animal.getInt("id")][11] = "" + animal.getInt("1/2");
}
}
catch (Exception e) {
printFileLog("File 'temp.json' - undetected");
System.exit(1);
}
String[] temp;
temp = loadStrings(filePath + "kamazy.txt");
if (temp == null) {
printFileLog("File 'kamazy.txt' - undetected");
} else {
kamazy = temp;
}
temp = loadStrings(filePath + "clients.txt");
if (temp == null) {
printFileLog("File 'clients.txt' - undetected");
} else {
clients = temp;
}
for (int i = 0; i < m2; ++i) {
inData[i] = "";
}
inData[6] = str(protsUmolch);
}
|