1 | else {
|
---|
2 | dbboh.mc2 += deltam;
|
---|
3 | dbboh.mcd65 += deltam;
|
---|
4 | dbboh.mcd2 += 10;
|
---|
5 | if (dbboh.tijd212) dbboh.t6 += deltam;
|
---|
6 | if (dbboh.mcd2 >= pco)
|
---|
7 | if (!dbboh.tijd212) {
|
---|
8 | HisInsertAutoF1(pco);
|
---|
9 | dbboh.tijd212 = dbhis.hstime - pco;
|
---|
10 | dbboh.t6 += dbboh.mcd65;
|
---|
11 | dbboh.mcd65 = 0;
|
---|
12 | }
|
---|
13 | if (dbboh.tijd22 && dbboh.mc65 == 0) {
|
---|
14 | dbboh.tijd22 = dbhis.hstime;
|
---|
15 | dbboh.mc65 = 1;
|
---|
16 | }
|
---|
17 | if (dbboh.tijd22)
|
---|
18 | if (dbboh.mcd2 >= 300)
|
---|
19 | dbboh.tijd32 = dbhis.hstime;
|
---|
20 | if (dbboh.tijd22) dbboh.t4 += deltam;
|
---|
21 | if (dbboh.tijd212 < 0)
|
---|
22 | dbboh.tijd212 += 86400;
|
---|
23 | }
|
---|
24 | dbboh.tijd42 = dbhis.hstime;
|
---|
25 | dbboh.me2 += deltam;
|
---|
26 | dbboh.ge2 += deltag;
|
---|
27 | dbboh.ee2 += deltae;
|
---|
28 | dbboh.ms2 = wslong;
|
---|
29 | dbboh.gs2 = ws1;
|
---|
30 | dbboh.es2 = ws2;
|
---|
31 | }
|
---|
32 | else if (dbboh.alijn == 3) {
|
---|
33 | if (dbboh.ms3 == 0 &&
|
---|
34 | dbboh.gs3 == 0 &&
|
---|
35 | dbboh.es3 == 0) {
|
---|
36 | dbboh.ms3 = wslong;
|
---|
37 | dbboh.gs3 = ws1;
|
---|
38 | dbboh.es3 = ws2;
|
---|
39 | }
|
---|
40 | deltam = wslong - dbboh.ms3;
|
---|
41 | deltag = ws1 - dbboh.gs3;
|
---|
42 | deltae = ws2 - dbboh.es3;
|
---|
43 | if (deltam < 0) deltam = 0;
|
---|
44 | if (deltag < 0) deltag = 0;
|
---|
45 | if (deltae < 0) deltae = 0;
|
---|
46 | if (!ws3) dbboh.mcd3 = dbboh.mcd65 = 0;
|
---|
47 | else {
|
---|
48 | dbboh.mc3 += deltam;
|
---|
49 | dbboh.mcd65 += deltam;
|
---|
50 | dbboh.mcd3 += 10;
|
---|
51 | if (dbboh.tijd213) dbboh.t6 += deltam;
|
---|
52 | if (dbboh.mcd3 >= pco)
|
---|
53 | if (!dbboh.tijd213) {
|
---|
54 | HisInsertAutoF1(pco);
|
---|
55 | dbboh.tijd213 = dbhis.hstime - pco;
|
---|
56 | dbboh.t6 += dbboh.mcd65;
|
---|
57 | dbboh.mcd65 = 0;
|
---|
58 | }
|
---|
59 | if (dbboh.tijd23 && dbboh.mc65 == 0) {
|
---|
60 | dbboh.tijd23 = dbhis.hstime;
|
---|
61 | dbboh.mc65 = 1;
|
---|
62 | }
|
---|
63 | if (dbboh.tijd23)
|
---|
64 | if (dbboh.mcd3 >= 300)
|
---|
65 | dbboh.tijd33 = dbhis.hstime;
|
---|
66 | if (dbboh.tijd23) dbboh.t4 += deltam;
|
---|
67 | if (dbboh.tijd213 < 0)
|
---|
68 | dbboh.tijd213 += 86400;
|
---|
69 | }
|
---|
70 | dbboh.tijd43 = dbhis.hstime;
|
---|
71 | dbboh.me3 += deltam;
|
---|
72 | dbboh.ge3 += deltag;
|
---|
73 | dbboh.ee3 += deltae;
|
---|
74 | dbboh.ms3 = wslong;
|
---|
75 | dbboh.gs3 = ws1;
|
---|
76 | dbboh.es3 = ws2;
|
---|
77 | }
|
---|
78 | else if (dbboh.alijn == 4) {
|
---|
79 | if (dbboh.ms4 == 0 &&
|
---|
80 | dbboh.gs4 == 0 &&
|
---|
81 | dbboh.es4 == 0) {
|
---|
82 | dbboh.ms4 = wslong;
|
---|
83 | dbboh.gs4 = ws1;
|
---|
84 | dbboh.es4 = ws2;
|
---|
85 | }
|
---|
86 | deltam = wslong - dbboh.ms4;
|
---|
87 | deltag = ws1 - dbboh.gs4;
|
---|
88 | deltae = ws2 - dbboh.es4;
|
---|
89 | if (deltam < 0) deltam = 0;
|
---|
90 | if (deltag < 0) deltag = 0;
|
---|
91 | if (deltae < 0) deltae = 0;
|
---|
92 | if (!ws3) dbboh.mcd4 = dbboh.mcd65 = 0;
|
---|
93 | else {
|
---|
94 | dbboh.mc4 += deltam;
|
---|
95 | dbboh.mcd65 += deltam;
|
---|
96 | dbboh.mcd4 += 10;
|
---|
97 | if (dbboh.tijd214) dbboh.t6 += deltam;
|
---|
98 | if (dbboh.mcd4 >= pco)
|
---|
99 | if (!dbboh.tijd214) {
|
---|
100 | HisInsertAutoF1(pco);
|
---|
101 | dbboh.tijd214 = dbhis.hstime - pco;
|
---|
102 | dbboh.t6 += dbboh.mcd65;
|
---|
103 | dbboh.mcd65 = 0;
|
---|
104 | }
|
---|
105 | if (dbboh.tijd24 && dbboh.mc65 == 0) {
|
---|
106 | dbboh.tijd24 = dbhis.hstime;
|
---|
107 | dbboh.mc65 = 1;
|
---|
108 | }
|
---|
109 | if (dbboh.tijd24)
|
---|
110 | if (dbboh.mcd4 >= 300)
|
---|
111 | dbboh.tijd34 = dbhis.hstime;
|
---|
112 | if (dbboh.tijd24) dbboh.t4 += deltam;
|
---|
113 | if (dbboh.tijd214 < 0)
|
---|
114 | dbboh.tijd214 += 86400;
|
---|
115 | }
|
---|
116 | dbboh.tijd44 = dbhis.hstime;
|
---|
117 | dbboh.me4 += deltam;
|
---|
118 | dbboh.ge4 += deltag;
|
---|
119 | dbboh.ee4 += deltae;
|
---|
120 | dbboh.ms4 = wslong;
|
---|
121 | dbboh.gs4 = ws1;
|
---|
122 | dbboh.es4 = ws2;
|
---|
123 | }
|
---|
124 | else if (dbboh.alijn == 5) {
|
---|
125 | if (dbboh.ms5 == 0 &&
|
---|
126 | dbboh.gs5 == 0 &&
|
---|
127 | dbboh.es5 == 0) {
|
---|
128 | dbboh.ms5 = wslong;
|
---|
129 | dbboh.gs5 = ws1;
|
---|
130 | dbboh.es5 = ws2;
|
---|
131 | }
|
---|
132 | deltam = wslong - dbboh.ms5;
|
---|
133 | deltag = ws1 - dbboh.gs5;
|
---|
134 | deltae = ws2 - dbboh.es5;
|
---|
135 | if (deltam < 0) deltam = 0;
|
---|
136 | if (deltag < 0) deltag = 0;
|
---|
137 | if (deltae < 0) deltae = 0;
|
---|
138 | if (!ws3) dbboh.mcd5 = dbboh.mcd65 = 0;
|
---|
139 | else {
|
---|
140 | dbboh.mc5 += deltam;
|
---|
141 | dbboh.mcd65 += deltam;
|
---|
142 | dbboh.mcd5 += 10;
|
---|
143 | if (dbboh.tijd215) dbboh.t6 += deltam;
|
---|
144 | if (dbboh.mcd5 >= pco)
|
---|
145 | if (!dbboh.tijd215) {
|
---|
146 | HisInsertAutoF1(pco);
|
---|
147 | dbboh.tijd215 = dbhis.hstime - pco;
|
---|
148 | dbboh.t6 += dbboh.mcd65;
|
---|
149 | dbboh.mcd65 = 0;
|
---|
150 | }
|
---|
151 | if (dbboh.tijd25 && dbboh.mc65 == 0) {
|
---|
152 | dbboh.tijd25 = dbhis.hstime;
|
---|
153 | dbboh.mc65 = 1;
|
---|
154 | }
|
---|
155 | if (dbboh.tijd25)
|
---|
156 | if (dbboh.mcd5 >= 300)
|
---|
157 | dbboh.tijd35 = dbhis.hstime;
|
---|
158 | if (dbboh.tijd25) dbboh.t4 += deltam;
|
---|
159 | if (dbboh.tijd215 < 0)
|
---|
160 | dbboh.tijd215 += 86400;
|
---|
161 | }
|
---|
162 | dbboh.tijd45 = dbhis.hstime;
|
---|
163 | dbboh.me5 += deltam;
|
---|
164 | dbboh.ge5 += deltag;
|
---|
165 | dbboh.ee5 += deltae;
|
---|
166 | dbboh.ms5 = wslong;
|
---|
167 | dbboh.gs5 = ws1;
|
---|
168 | dbboh.es5 = ws2;
|
---|
169 | }
|
---|
170 | else if (dbboh.alijn == 6) {
|
---|
171 | if (dbboh.ms51 == 0 &&
|
---|
172 | dbboh.gs51 == 0 &&
|
---|
173 | dbboh.es51 == 0) {
|
---|
174 | dbboh.ms51 = wslong;
|
---|
175 | dbboh.gs51 = ws1;
|
---|
176 | dbboh.es51 = ws2;
|
---|
177 | }
|
---|
178 | deltam = wslong - dbboh.ms51;
|
---|
179 | deltag = ws1 - dbboh.gs51;
|
---|
180 | deltae = ws2 - dbboh.es51;
|
---|
181 | if (deltam < 0) deltam = 0;
|
---|
182 | if (deltag < 0) deltag = 0;
|
---|
183 | if (deltae < 0) deltae = 0;
|
---|
184 | if (!ws3) dbboh.mcd51 = dbboh.mcd65 = 0;
|
---|
185 | else {
|
---|
186 | dbboh.mc51 += deltam;
|
---|
187 | dbboh.mcd65 += deltam;
|
---|
188 | dbboh.mcd51 += 10;
|
---|
189 | if (dbboh.tijd521) dbboh.t6 += deltam;
|
---|
190 | if (dbboh.mcd51 >= pco)
|
---|
191 | if (!dbboh.tijd521) {
|
---|
192 | HisInsertAutoF1(pco);
|
---|
193 | dbboh.tijd521 = dbhis.hstime - pco;
|
---|
194 | dbboh.t6 += dbboh.mcd65;
|
---|
195 | dbboh.mcd65 = 0;
|
---|
196 | }
|
---|
197 | if (dbboh.tijd51 && dbboh.mc65 == 0) {
|
---|
198 | dbboh.tijd51 = dbhis.hstime;
|
---|
199 | dbboh.mc65 = 1;
|
---|
200 | }
|
---|
201 | if (dbboh.tijd52)
|
---|
202 | if (dbboh.mcd51 >= 300)
|
---|
203 | dbboh.tijd53 = dbhis.hstime;
|
---|
204 | if (dbboh.tijd52) dbboh.t4 += deltam;
|
---|
205 | if (dbboh.tijd521 < 0)
|
---|
206 | dbboh.tijd521 += 86400;
|
---|
207 | }
|
---|
208 | dbboh.tijd54 = dbhis.hstime;
|
---|
209 | dbboh.me51 += deltam;
|
---|
210 | dbboh.ge51 += deltag;
|
---|
211 | dbboh.ee51 += deltae;
|
---|
212 | dbboh.ms51 = wslong;
|
---|
213 | dbboh.gs51 = ws1;
|
---|
214 | dbboh.es51 = ws2;
|
---|
215 | }
|
---|
216 | else if (dbboh.alijn == 7) {
|
---|
217 | if (dbboh.ms52 == 0 &&
|
---|
218 | dbboh.gs52 == 0 &&
|
---|
219 | dbboh.es52 == 0) {
|
---|
220 | dbboh.ms52 = wslong;
|
---|
221 | dbboh.gs52 = ws1;
|
---|
222 | dbboh.es52 = ws2;
|
---|
223 | }
|
---|
224 | deltam = wslong - dbboh.ms52;
|
---|
225 | deltag = ws1 - dbboh.gs52;
|
---|
226 | deltae = ws2 - dbboh.es52;
|
---|
227 | if (deltam < 0) deltam = 0;
|
---|
228 | if (deltag < 0) deltag = 0;
|
---|
229 | if (deltae < 0) deltae = 0;
|
---|
230 | if (!ws3) dbboh.mcd52 = dbboh.mcd65 = 0;
|
---|
231 | else {
|
---|
232 | dbboh.mc52 += deltam;
|
---|
233 | dbboh.mcd65 += deltam;
|
---|
234 | dbboh.mcd52 += 10;
|
---|
235 | if (dbboh.tijd5212) dbboh.t6 += deltam;
|
---|
236 | if (dbboh.mcd52 >= pco)
|
---|
237 | if (!dbboh.tijd5212) {
|
---|
238 | HisInsertAutoF1(pco);
|
---|
239 | dbboh.tijd5212 = dbhis.hstime - pco;
|
---|
240 | dbboh.t6 += dbboh.mcd65;
|
---|
241 | dbboh.mcd65 = 0;
|
---|
242 | }
|
---|
243 | if (dbboh.tijd522 && dbboh.mc65 == 0) {
|
---|
244 | dbboh.tijd522 = dbhis.hstime;
|
---|
245 | dbboh.mc65 = 1;
|
---|
246 | }
|
---|
247 | if (dbboh.tijd522)
|
---|
248 | if (dbboh.mcd52 >= 300)
|
---|
249 | dbboh.tijd532 = dbhis.hstime;
|
---|
250 | if (dbboh.tijd522) dbboh.t4 += deltam;
|
---|
251 | if (dbboh.tijd5212 < 0)
|
---|
252 | dbboh.tijd5212 += 86400;
|
---|
253 | }
|
---|
254 | dbboh.tijd542 = dbhis.hstime;
|
---|
255 | dbboh.me52 += deltam;
|
---|
256 | dbboh.ge52 += deltag;
|
---|
257 | dbboh.ee52 += deltae;
|
---|
258 | dbboh.ms52 = wslong;
|
---|
259 | dbboh.gs52 = ws1;
|
---|
260 | dbboh.es52 = ws2;
|
---|
261 | }
|
---|
262 | else if (dbboh.alijn == 8) {
|
---|
263 | if (dbboh.ms53 == 0 &&
|
---|
264 | dbboh.gs53 == 0 &&
|
---|
265 | dbboh.es53 == 0) {
|
---|
266 | dbboh.ms53 = wslong;
|
---|
267 | dbboh.gs53 = ws1;
|
---|
268 | dbboh.es53 = ws2;
|
---|
269 | }
|
---|
270 | deltam = wslong - dbboh.ms53;
|
---|
271 | deltag = ws1 - dbboh.gs53;
|
---|
272 | deltae = ws2 - dbboh.es53;
|
---|
273 | if (deltam < 0) deltam = 0;
|
---|
274 | if (deltag < 0) deltag = 0;
|
---|
275 | if (deltae < 0) deltae = 0;
|
---|
276 | if (!ws3) dbboh.mcd53 = dbboh.mcd65 = 0;
|
---|
277 | else {
|
---|
278 | dbboh.mc53 += deltam;
|
---|
279 | dbboh.mcd65 += deltam;
|
---|
280 | dbboh.mcd53 += 10;
|
---|
281 | if (dbboh.tijd5213) dbboh.t6 += deltam;
|
---|
282 | if (dbboh.mcd53 >= pco)
|
---|
283 | if (!dbboh.tijd5213) {
|
---|
284 | HisInsertAutoF1(pco);
|
---|
285 | dbboh.tijd5213 = dbhis.hstime - pco;
|
---|
286 | dbboh.t6 += dbboh.mcd65;
|
---|
287 | dbboh.mcd65 = 0;
|
---|
288 | }
|
---|
289 | if (dbboh.tijd523 && dbboh.mc65 == 0) {
|
---|
290 | dbboh.tijd523 = dbhis.hstime;
|
---|
291 | dbboh.mc65 = 1;
|
---|
292 | }
|
---|
293 | if (dbboh.tijd523)
|
---|
294 | if (dbboh.mcd53 >= 300)
|
---|
295 | dbboh.tijd533 = dbhis.hstime;
|
---|
296 | if (dbboh.tijd523) dbboh.t4 += deltam;
|
---|
297 | if (dbboh.tijd5213 < 0)
|
---|
298 | dbboh.tijd5213 += 86400;
|
---|
299 | }
|
---|
300 | dbboh.tijd543 = dbhis.hstime;
|
---|
301 | dbboh.me53 += deltam;
|
---|
302 | dbboh.ge53 += deltag;
|
---|
303 | dbboh.ee53 += deltae;
|
---|
304 | dbboh.ms53 = wslong;
|
---|
305 | dbboh.gs53 = ws1;
|
---|
306 | dbboh.es53 = ws2;
|
---|
307 | }
|
---|
308 | else if (dbboh.alijn == 9) {
|
---|
309 | if (dbboh.ms54 == 0 &&
|
---|
310 | dbboh.gs54 == 0 &&
|
---|
311 | dbboh.es54 == 0) {
|
---|
312 | dbboh.ms54 = wslong;
|
---|
313 | dbboh.gs54 = ws1;
|
---|
314 | dbboh.es54 = ws2;
|
---|
315 | }
|
---|
316 | deltam = wslong - dbboh.ms54;
|
---|
317 | deltag = ws1 - dbboh.gs54;
|
---|
318 | deltae = ws2 - dbboh.es54;
|
---|
319 | if (deltam < 0) deltam = 0;
|
---|
320 | if (deltag < 0) deltag = 0;
|
---|
321 | if (deltae < 0) deltae = 0;
|
---|
322 | if (!ws3) dbboh.mcd54 = dbboh.mcd65 = 0;
|
---|
323 | else {
|
---|
324 | dbboh.mc54 += deltam;
|
---|
325 | dbboh.mcd65 += deltam;
|
---|
326 | dbboh.mcd54 += 10;
|
---|
327 | if (dbboh.tijd5214) dbboh.t6 += deltam;
|
---|
328 | if (dbboh.mcd54 >= pco)
|
---|
329 | if (!dbboh.tijd5214) {
|
---|
330 | HisInsertAutoF1(pco);
|
---|
331 | dbboh.tijd5214 = dbhis.hstime - pco;
|
---|
332 | dbboh.t6 += dbboh.mcd65;
|
---|
333 | dbboh.mcd65 = 0;
|
---|
334 | }
|
---|
335 | if (dbboh.tijd524 && dbboh.mc65 == 0) {
|
---|
336 | dbboh.tijd524 = dbhis.hstime;
|
---|
337 | dbboh.mc65 = 1;
|
---|
338 | }
|
---|
339 | if (dbboh.tijd524)
|
---|
340 | if (dbboh.mcd54 >= 300)
|
---|
341 | dbboh.tijd534 = dbhis.hstime;
|
---|
342 | if (dbboh.tijd524) dbboh.t4 += deltam;
|
---|
343 | if (dbboh.tijd5214 < 0)
|
---|
344 | dbboh.tijd5214 += 86400;
|
---|
345 | }
|
---|
346 | dbboh.tijd544 = dbhis.hstime;
|
---|
347 | dbboh.me54 += deltam;
|
---|
348 | dbboh.ge54 += deltag;
|
---|
349 | dbboh.ee54 += deltae;
|
---|
350 | dbboh.ms54 = wslong;
|
---|
351 | dbboh.gs54 = ws1;
|
---|
352 | dbboh.es54 = ws2;
|
---|
353 | }
|
---|
354 | else if (dbboh.alijn == 10) {
|
---|
355 | if (dbboh.ms55 == 0 &&
|
---|
356 | dbboh.gs55 == 0 &&
|
---|
357 | dbboh.es55 == 0) {
|
---|
358 | dbboh.ms55 = wslong;
|
---|
359 | dbboh.gs55 = ws1;
|
---|
360 | dbboh.es55 = ws2;
|
---|
361 | }
|
---|
362 | deltam = wslong - dbboh.ms55;
|
---|
363 | deltag = ws1 - dbboh.gs55;
|
---|
364 | deltae = ws2 - dbboh.es55;
|
---|
365 | if (deltam < 0) deltam = 0;
|
---|
366 | if (deltag < 0) deltag = 0;
|
---|
367 | if (deltae < 0) deltae = 0;
|
---|
368 | if (!ws3) dbboh.mcd55 = dbboh.mcd65 = 0;
|
---|
369 | else {
|
---|
370 | dbboh.mc55 += deltam;
|
---|
371 | dbboh.mcd65 += deltam;
|
---|
372 | dbboh.mcd55 += 10;
|
---|
373 | if (dbboh.tijd5215) dbboh.t6 += deltam;
|
---|
374 | if (dbboh.mcd55 >= pco)
|
---|
375 | if (!dbboh.tijd5215) {
|
---|
376 | HisInsertAutoF1(pco);
|
---|
377 | dbboh.tijd5215 = dbhis.hstime - pco;
|
---|
378 | dbboh.t6 += dbboh.mcd65;
|
---|
379 | dbboh.mcd65 = 0;
|
---|
380 | }
|
---|
381 | if (dbboh.tijd525 && dbboh.mc65 == 0) {
|
---|
382 | dbboh.tijd525 = dbhis.hstime;
|
---|
383 | dbboh.mc65 = 1;
|
---|
384 | }
|
---|
385 | if (dbboh.tijd525)
|
---|
386 | if (dbboh.mcd55 >= 300)
|
---|
387 | dbboh.tijd535 = dbhis.hstime;
|
---|
388 | if (dbboh.tijd525) dbboh.t4 += deltam;
|
---|
389 | if (dbboh.tijd5215 < 0)
|
---|
390 | dbboh.tijd5215 += 86400;
|
---|
391 | }
|
---|
392 | dbboh.tijd545 = dbhis.hstime;
|
---|
393 | dbboh.me55 += deltam;
|
---|
394 | dbboh.ge55 += deltag;
|
---|
395 | dbboh.ee55 += deltae;
|
---|
396 | dbboh.ms55 = wslong;
|
---|
397 | dbboh.gs55 = ws1;
|
---|
398 | dbboh.es55 = ws2;
|
---|
399 | }
|
---|
400 | else if (dbboh.alijn == 11) {
|
---|
401 | if (dbboh.ms61 == 0 &&
|
---|
402 | dbboh.gs61 == 0 &&
|
---|
403 | dbboh.es61 == 0) {
|
---|
404 | dbboh.ms61 = wslong;
|
---|
405 | dbboh.gs61 = ws1;
|
---|
406 | dbboh.es61 = ws2;
|
---|
407 | }
|
---|
408 | deltam = wslong - dbboh.ms61;
|
---|
409 | deltag = ws1 - dbboh.gs61;
|
---|
410 | deltae = ws2 - dbboh.es61;
|
---|
411 | if (deltam < 0) deltam = 0;
|
---|
412 | if (deltag < 0) deltag = 0;
|
---|
413 | if (deltae < 0) deltae = 0;
|
---|
414 | if (!ws3) dbboh.mcd61 = dbboh.mcd65 = 0;
|
---|
415 | else {
|
---|
416 | dbboh.mc61 += deltam;
|
---|
417 | dbboh.mcd65 += deltam;
|
---|
418 | dbboh.mcd61 += 10;
|
---|
419 | if (dbboh.tijd621) dbboh.t6 += deltam;
|
---|
420 | if (dbboh.mcd61 >= pco)
|
---|
421 | if (!dbboh.tijd621) {
|
---|
422 | HisInsertAutoF1(pco);
|
---|
423 | dbboh.tijd621 = dbhis.hstime - pco;
|
---|
424 | dbboh.t6 += dbboh.mcd65;
|
---|
425 | dbboh.mcd65 = 0;
|
---|
426 | }
|
---|
427 | if (dbboh.tijd61 && dbboh.mc65 == 0) {
|
---|
428 | dbboh.tijd61 = dbhis.hstime;
|
---|
429 | dbboh.mc65 = 1;
|
---|
430 | }
|
---|
431 | if (dbboh.tijd62)
|
---|
432 | if (dbboh.mcd61 >= 300)
|
---|
433 | dbboh.tijd63 = dbhis.hstime;
|
---|
434 | if (dbboh.tijd62) dbboh.t4 += deltam;
|
---|
435 | if (dbboh.tijd621 < 0)
|
---|
436 | dbboh.tijd621 += 86400;
|
---|
437 | }
|
---|
438 | dbboh.tijd64 = dbhis.hstime;
|
---|
439 | dbboh.me61 += deltam;
|
---|
440 | dbboh.ge61 += deltag;
|
---|
441 | dbboh.ee61 += deltae;
|
---|
442 | dbboh.ms61 = wslong;
|
---|
443 | dbboh.gs61 = ws1;
|
---|
444 | dbboh.es61 = ws2;
|
---|
445 | }
|
---|
446 | else if (dbboh.alijn == 12) {
|
---|
447 | if (dbboh.ms62 == 0 &&
|
---|
448 | dbboh.gs62 == 0 &&
|
---|
449 | dbboh.es62 == 0) {
|
---|
450 | dbboh.ms62 = wslong;
|
---|
451 | dbboh.gs62 = ws1;
|
---|
452 | dbboh.es62 = ws2;
|
---|
453 | }
|
---|
454 | deltam = wslong - dbboh.ms62;
|
---|
455 | deltag = ws1 - dbboh.gs62;
|
---|
456 | deltae = ws2 - dbboh.es62;
|
---|
457 | if (deltam < 0) deltam = 0;
|
---|
458 | if (deltag < 0) deltag = 0;
|
---|
459 | if (deltae < 0) deltae = 0;
|
---|
460 | if (!ws3) dbboh.mcd62 = dbboh.mcd65 = 0;
|
---|
461 | else {
|
---|
462 | dbboh.mc62 += deltam;
|
---|
463 | dbboh.mcd65 += deltam;
|
---|
464 | dbboh.mcd62 += 10;
|
---|
465 | if (dbboh.tijd6212) dbboh.t6 += deltam;
|
---|
466 | if (dbboh.mcd62 >= pco)
|
---|
467 | if (!dbboh.tijd6212) {
|
---|
468 | HisInsertAutoF1(pco);
|
---|
469 | dbboh.tijd6212 = dbhis.hstime - pco;
|
---|
470 | dbboh.t6 += dbboh.mcd65;
|
---|
471 | dbboh.mcd65 = 0;
|
---|
472 | }
|
---|
473 | if (dbboh.tijd622 && dbboh.mc65 == 0) {
|
---|
474 | dbboh.tijd622 = dbhis.hstime;
|
---|
475 | dbboh.mc65 = 1;
|
---|
476 | }
|
---|
477 | if (dbboh.tijd622)
|
---|
478 | if (dbboh.mcd62 >= 300)
|
---|
479 | dbboh.tijd632 = dbhis.hstime;
|
---|
480 | if (dbboh.tijd622) dbboh.t4 += deltam;
|
---|
481 | if (dbboh.tijd6212 < 0)
|
---|
482 | dbboh.tijd6212 += 86400;
|
---|
483 | }
|
---|
484 | dbboh.tijd642 = dbhis.hstime;
|
---|
485 | dbboh.me62 += deltam;
|
---|
486 | dbboh.ge62 += deltag;
|
---|
487 | dbboh.ee62 += deltae;
|
---|
488 | dbboh.ms62 = wslong;
|
---|
489 | dbboh.gs62 = ws1;
|
---|
490 | dbboh.es62 = ws2;
|
---|
491 | }
|
---|
492 | else if (dbboh.alijn == 13) {
|
---|
493 | if (dbboh.ms63 == 0 &&
|
---|
494 | dbboh.gs63 == 0 &&
|
---|
495 | dbboh.es63 == 0) {
|
---|
496 | dbboh.ms63 = wslong;
|
---|
497 | dbboh.gs63 = ws1;
|
---|
498 | dbboh.es63 = ws2;
|
---|
499 | }
|
---|
500 | deltam = wslong - dbboh.ms63;
|
---|
501 | deltag = ws1 - dbboh.gs63;
|
---|
502 | deltae = ws2 - dbboh.es63;
|
---|
503 | if (deltam < 0) deltam = 0;
|
---|
504 | if (deltag < 0) deltag = 0;
|
---|
505 | if (deltae < 0) deltae = 0;
|
---|
506 | if (!ws3) dbboh.mcd63 = dbboh.mcd65 = 0;
|
---|
507 | else {
|
---|
508 | dbboh.mc63 += deltam;
|
---|
509 | dbboh.mcd65 += deltam;
|
---|
510 | dbboh.mcd63 += 10;
|
---|
511 | if (dbboh.tijd6213) dbboh.t6 += deltam;
|
---|
512 | if (dbboh.mcd63 >= pco)
|
---|
513 | if (!dbboh.tijd6213) {
|
---|
514 | HisInsertAutoF1(pco);
|
---|
515 | dbboh.tijd6213 = dbhis.hstime - pco;
|
---|
516 | dbboh.t6 += dbboh.mcd65;
|
---|
517 | dbboh.mcd65 = 0;
|
---|
518 | }
|
---|
519 | if (dbboh.tijd623 && dbboh.mc65 == 0) {
|
---|
520 | dbboh.tijd623 = dbhis.hstime;
|
---|
521 | dbboh.mc65 = 1;
|
---|
522 | }
|
---|
523 | if (dbboh.tijd623)
|
---|
524 | if (dbboh.mcd63 >= 300)
|
---|
525 | dbboh.tijd633 = dbhis.hstime;
|
---|
526 | if (dbboh.tijd623) dbboh.t4 += deltam;
|
---|
527 | if (dbboh.tijd6213 < 0)
|
---|
528 | dbboh.tijd6213 += 86400;
|
---|
529 | }
|
---|
530 | dbboh.tijd643 = dbhis.hstime;
|
---|
531 | dbboh.me63 += deltam;
|
---|
532 | dbboh.ge63 += deltag;
|
---|
533 | dbboh.ee63 += deltae;
|
---|
534 | dbboh.ms63 = wslong;
|
---|
535 | dbboh.gs63 = ws1;
|
---|
536 | dbboh.es63 = ws2;
|
---|
537 | }
|
---|
538 | else if (dbboh.alijn == 14) {
|
---|
539 | if (dbboh.ms64 == 0 &&
|
---|
540 | dbboh.gs64 == 0 &&
|
---|
541 | dbboh.es64 == 0) {
|
---|
542 | dbboh.ms64 = wslong;
|
---|
543 | dbboh.gs64 = ws1;
|
---|
544 | dbboh.es64 = ws2;
|
---|
545 | }
|
---|
546 | deltam = wslong - dbboh.ms64;
|
---|
547 | deltag = ws1 - dbboh.gs64;
|
---|
548 | deltae = ws2 - dbboh.es64;
|
---|
549 | if (deltam < 0) deltam = 0;
|
---|
550 | if (deltag < 0) deltag = 0;
|
---|
551 | if (deltae < 0) deltae = 0;
|
---|
552 | if (!ws3) dbboh.mcd64 = dbboh.mcd65 = 0;
|
---|
553 | else {
|
---|
554 | dbboh.mc64 += deltam;
|
---|
555 | dbboh.mcd65 += deltam;
|
---|
556 | dbboh.mcd64 += 10;
|
---|
557 | if (dbboh.tijd6214) dbboh.t6 += deltam;
|
---|
558 | if (dbboh.mcd64 >= pco)
|
---|
559 | if (!dbboh.tijd6214) {
|
---|
560 | HisInsertAutoF1(pco);
|
---|
561 | dbboh.tijd6214 = dbhis.hstime - pco;
|
---|
562 | dbboh.t6 += dbboh.mcd65;
|
---|
563 | dbboh.mcd65 = 0;
|
---|
564 | }
|
---|
565 | if (dbboh.tijd624 && dbboh.mc65 == 0) {
|
---|
566 | dbboh.tijd624 = dbhis.hstime;
|
---|
567 | dbboh.mc65 = 1;
|
---|
568 | }
|
---|
569 | if (dbboh.tijd624)
|
---|
570 | if (dbboh.mcd64 >= 300)
|
---|
571 | dbboh.tijd634 = dbhis.hstime;
|
---|
572 | if (dbboh.tijd624) dbboh.t4 += deltam;
|
---|
573 | if (dbboh.tijd6214 < 0)
|
---|
574 | dbboh.tijd6214 += 86400;
|
---|
575 | }
|
---|
576 | dbboh.tijd644 = dbhis.hstime;
|
---|
577 | dbboh.me64 += deltam;
|
---|
578 | dbboh.ge64 += deltag;
|
---|
579 | dbboh.ee64 += deltae;
|
---|
580 | dbboh.ms64 = wslong;
|
---|
581 | dbboh.gs64 = ws1;
|
---|
582 | dbboh.es64 = ws2;
|
---|
583 | }
|
---|
584 | if (dbboh.alijn) {
|
---|
585 | dbboh.t1 += deltam;
|
---|
586 | dbboh.t2 += deltag;
|
---|
587 | dbboh.t3 += deltae;
|
---|
588 | dbboh.t5 = dbboh.mc1 + dbboh.mc2 + dbboh.mc3 +
|
---|
589 | dbboh.mc4 + dbboh.mc5 + dbboh.mc51 +
|
---|
590 | dbboh.mc52 + dbboh.mc53 + dbboh.mc54 + dbboh.mc55 + dbboh.mc61 + dbboh.mc62 +
|
---|
591 | dbboh.mc63 + dbboh.mc64;
|
---|
592 |
|
---|
593 | if (dbboh.t4 > dbboh.t1) dbboh.t4 = dbboh.t1;
|
---|
594 | }
|
---|
595 | wsint = DBupdate(200,&dbboh);
|
---|
596 | wsint = DBupdate(202,&dbboh);
|
---|
597 | break;
|
---|
598 | case 'p' :
|
---|
599 | sscanf(&p->mess[1],"%ld/%ld/%ld",&wslong,&ws1,&ws2);
|
---|
600 | dbpul.macnr = dbter.macnr;
|
---|
601 | strcpy(dbpul.datum,dbhis.hsdate);
|
---|
602 | dbpul.bopnr = dbter.orderptr;
|
---|
603 | dbpul.hstime = dbhis.hstime;
|
---|
604 | dbpul.tellerm = wslong;
|
---|
605 | dbpul.tellerg = ws1;
|
---|
606 | dbpul.tellere = ws2;
|
---|
607 | wsint = DBinsert(230,&dbpul);
|
---|
608 | break;
|
---|
609 | case 'l' :
|
---|
610 | sscanf(&p->mess[1],"%ld/%ld/%ld",&wslong,&ws1,&ws2);
|
---|
611 | dblogt.macnr = dbter.macnr;
|
---|
612 | strcpy(dblogt.datum,dbhis.hsdate);
|
---|
613 | dblogt.bopnr = dbter.orderptr;
|
---|
614 | dblogt.hstime = dbhis.hstime;
|
---|
615 | dblogt.tellerm = wslong;
|
---|
616 | dblogt.tellerg = ws1;
|
---|
617 | dblogt.tellere = ws2;
|
---|
618 | wsint = DBinsert(310,&dblogt);
|
---|
619 | break;
|
---|
620 | case 't' :
|
---|
621 | dbhis.hstime = dbhis.hstime - (dbhis.hstime % 60);
|
---|
622 | wsint = 0;
|
---|
623 | sscanf(&p->mess[1],"%d",&wsint);
|
---|
624 | dbhis.fdec1 = wsint;
|
---|
625 | dbhis.fdec2 = 0; dbhis.fdec3 = 0;
|
---|
626 | dbhis.type = 1; dbhis.stat = 0;
|
---|
627 | wsint = DBinsert(120,&dbhis);
|
---|
628 | printf(" \n TOEREN %d", dbter.ternr);
|
---|
629 | break;
|
---|
630 | case 'e' :
|
---|
631 | sscanf(&p->mess[1],"%ld",&wslong);
|
---|
632 | printf(" \n ELEC %ld ", wslong);
|
---|
633 | dbmac.celec = wslong;
|
---|
634 | dbhis.fdec1 = dbter.orderptr;
|
---|
635 | dbhis.fdec2 = wslong;
|
---|
636 | dbhis.type = 30; dbhis.stat = 0;
|
---|
637 | wsint = DBinsert(120,&dbhis);
|
---|
638 | break;
|
---|
639 | case 'g' :
|
---|
640 | sscanf(&p->mess[1],"%ld",&wslong);
|
---|
641 | printf(" \n GAS %ld ", wslong);
|
---|
642 | dbmac.cgas = wslong;
|
---|
643 | dbhis.fdec1 = dbter.orderptr;
|
---|
644 | dbhis.fdec2 = wslong;
|
---|
645 | dbhis.type = 31; dbhis.stat = 0;
|
---|
646 | wsint = DBinsert(120,&dbhis);
|
---|
647 | if (dbter.tellerfl == 1) {
|
---|
648 | updatebop(1);
|
---|
649 | rbeep();
|
---|
650 | }
|
---|
651 | else if (dbter.tellerfl == 7) {
|
---|
652 | updatebop(7);
|
---|
653 | if (dbter.temp) sbeep();
|
---|
654 | if ((dbmac.o1 || dbmac.o2 || dbmac.o3 ||
|
---|
655 | dbmac.o4 || dbmac.o5)) {
|
---|
656 | verdeel();
|
---|
657 | clearbop();
|
---|
658 | dbter.orderptr = 0;
|
---|
659 | dbmac.o1 = dbmac.o2 = dbmac.o3 = 0;
|
---|
660 | dbmac.o4 = dbmac.o5 = 0;
|
---|
661 | dbmac.pohnr = 0;
|
---|
662 | }
|
---|
663 | if (dbter.temp) {
|
---|
664 | p->fkey = F_BC;
|
---|
665 | done = FALSE;
|
---|
666 | dbter.termstat = VERTREK;
|
---|
667 | while (!done) proc_vertrek(p,0);
|
---|
668 | }
|
---|
669 | else {
|
---|
670 | dbter.orderptr = 0;
|
---|
671 | dbmac.o1 = dbmac.o2 = dbmac.o3 = 0;
|
---|
672 | dbmac.o4 = dbmac.o5 = 0;
|
---|
673 | dbmac.pohnr = 0;
|
---|
674 | /* dbmac.cmeter = 0;
|
---|
675 | dbmac.celec = 0; dbmac.cgas = 0; */
|
---|
676 | }
|
---|
677 | }
|
---|
678 | break;
|
---|
679 | case 'a' :
|
---|
680 | sscanf(&p->mess[1],"%ld/%ld/%ld",&wslong,&ws1,&ws2);
|
---|
681 | dbmac.cmeterold = dbmac.cmeter;
|
---|
682 | /* dbmac.cmeter = wslong;
|
---|
683 | dbmac.cgas = ws1;
|
---|
684 | dbmac.celec = ws2; */
|
---|
685 |
|
---|
686 | dbhis.fdec1 = dbter.orderptr;
|
---|
687 | dbhis.fdec2 = wslong;
|
---|
688 | dbhis.fdec3 = ws1;
|
---|
689 | dbhis.fdec4 = ws2;
|
---|
690 | dbhis.type = 29; dbhis.stat = 0;
|
---|
691 | wsint = DBinsert(120,&dbhis);
|
---|
692 | if (dbter.tellerfl == 1) {
|
---|
693 | updatebop(1);
|
---|
694 | rbeep();
|
---|
695 | }
|
---|
696 | else if (dbter.tellerfl == 7) {
|
---|
697 | updatebop(7);
|
---|
698 | if (dbter.temp) sbeep();
|
---|
699 | if ((dbmac.o1 || dbmac.o2 || dbmac.o3 ||
|
---|
700 | dbmac.o4 || dbmac.o5)) {
|
---|
701 | verdeel();
|
---|
702 | clearbop();
|
---|
703 | dbter.orderptr = 0;
|
---|
704 | dbmac.o1 = dbmac.o2 = dbmac.o3 = 0;
|
---|
705 | dbmac.o4 = dbmac.o5 = 0;
|
---|
706 | dbmac.pohnr = 0;
|
---|
707 | }
|
---|
708 | if (dbter.temp) {
|
---|
709 | p->fkey = F_BC; done = FALSE;
|
---|
710 | dbter.termstat = VERTREK;
|
---|
711 | while (!done) proc_vertrek(p,0);
|
---|
712 | }
|
---|
713 | else {
|
---|
714 | dbter.orderptr = 0;
|
---|
715 | dbmac.o1 = dbmac.o2 = dbmac.o3 = 0;
|
---|
716 | dbmac.o4 = dbmac.o5 = 0;
|
---|
717 | dbmac.pohnr = 0;
|
---|
718 | /* dbmac.cmeter = 0;
|
---|
719 | dbmac.celec = 0; dbmac.cgas = 0; */
|
---|
720 | }
|
---|
721 | }
|
---|
722 | break;
|
---|
723 | case 'm' :
|
---|
724 | sscanf(&p->mess[1],"%ld",&wslong);
|
---|
725 | printf(" \n METER %d %d",wslong,dbter.tellerfl);
|
---|
726 | dbmac.cmeterold = dbmac.cmeter;
|
---|
727 | /* dbmac.cmeter = wslong; */
|
---|
728 | if (dbter.tellerfl == 5) updatebop(5);
|
---|
729 | else if (dbter.tellerfl == 6) updatebop(6);
|
---|
730 | break;
|
---|
731 | case 'w' :
|
---|
732 | sscanf(&p->mess[1],"%ld",&wslong);
|
---|
733 | sprintf(hulp,"%03dGEWICHT = %d",dbmac.cw,wslong);
|
---|
734 | transmitc(hulp);
|
---|
735 | saveternr = dbter.ternr;
|
---|
736 | dbter.ternr = dbmac.cw;
|
---|
737 | wsint = DBselect(110,&dbter);
|
---|
738 | dbter.temp2 = wslong;
|
---|
739 | wsint = DBupdate(110,&dbter);
|
---|
740 | dbter.ternr = saveternr;
|
---|
741 | wsint = DBselect(110,&dbter);
|
---|
742 | break;
|
---|
743 | case '1' :
|
---|
744 | printf(" \n COATING UP ");
|
---|
745 | dbhis.type = 5;
|
---|
746 | dbmac.coatp = abstijd % 864000; dbhis.stat = 0;
|
---|
747 | wsint = DBinsert(120,&dbhis);
|
---|
748 | dbter.tellerfl = 5;
|
---|
749 | strcat(pkoutput,"R01");
|
---|
750 | transmitc(pkoutput);
|
---|
751 | break;
|
---|
752 | case '2' :
|
---|
753 | printf(" \n COATING DOWN ");
|
---|
754 | dbhis.type = 6;
|
---|
755 | dbhis.stat = 0;
|
---|
756 | wsint = DBinsert(120,&dbhis);
|
---|
757 | dbter.tellerfl = 6;
|
---|
758 | strcat(pkoutput,"R01");
|
---|
759 | transmitc(pkoutput);
|
---|
760 | break;
|
---|
761 | case '3' :
|
---|
762 | printf(" \n DRAAI UP ");
|
---|
763 | dbhis.type = 7;
|
---|
764 | dbmac.draaip = abstijd % 864000;
|
---|
765 | if (dbmac.draaip == 0) dbmac.draaip = 1;
|
---|
766 | dbhis.stat = 0;
|
---|
767 | wsint = DBinsert(120,&dbhis);
|
---|
768 | break;
|
---|
769 | case '4' :
|
---|
770 | printf(" \n DRAAI DOWN ");
|
---|
771 | dbhis.type = 8;
|
---|
772 | dbmac.draaip = 0; dbhis.stat = 0;
|
---|
773 | wsint = DBinsert(120,&dbhis);
|
---|
774 | break;
|
---|
775 | case 'j' : /* download teller standen uit boh*/
|
---|
776 | dbboh.pohnr = dbter.orderptr;
|
---|
777 | erc = DBselect(200,&dbboh);
|
---|
778 | sprintf(hulp,"P53%ld",dbboh.t6);
|
---|
779 | plaatstekst(hulp);
|
---|
780 | transmitc(pkoutput);
|
---|
781 | sprintf(hulp,"P54%ld",dbboh.t1);
|
---|
782 | plaatstekst(hulp);
|
---|
783 | transmitc(pkoutput);
|
---|
784 | break;
|
---|
785 | case 'u' : /* download teller standen */
|
---|
786 | sprintf(hulp,"P50%ld",dbmac.cmeter);
|
---|
787 | plaatstekst(hulp);
|
---|
788 | transmitc(pkoutput);
|
---|
789 | sprintf(hulp,"P51%ld",dbmac.cgas);
|
---|
790 | plaatstekst(hulp);
|
---|
791 | transmitc(pkoutput);
|
---|
792 | sprintf(hulp,"P52%ld",dbmac.celec);
|
---|
793 | plaatstekst(hulp);
|
---|
794 | transmitc(pkoutput);
|
---|
795 | break;
|
---|
796 | case 'v' : /* download parameter */
|
---|
797 | sprintf(hulp,"P01%ld",dbmac.p01);
|
---|
798 | plaatstekst(hulp);
|
---|
799 | transmitc(pkoutput);
|
---|
800 | break;
|
---|
801 | case 'c' : /* error puls tellers */
|
---|
802 | strcpy(dbmes.mdate,dbhis.hsdate);
|
---|
803 | dbmes.mtime = dbhis.hstime;
|
---|
804 | dbmes.type = 2; dbmes.macnr = dbhis.macnr;
|
---|
805 | dbmes.pohnr = 0; dbmes.volgnr = 1;
|
---|
806 | strcpy(dbmes.oms,"ERROR PULS TELLER");
|
---|
807 | wsint = DBinsert(210,&dbmes);
|
---|
808 | break;
|
---|
809 | case 'x' : /* error gas */
|
---|
810 | strcpy(dbmes.mdate,dbhis.hsdate);
|
---|
811 | dbmes.mtime = dbhis.hstime;
|
---|
812 | dbmes.type = 2; dbmes.macnr = dbhis.macnr;
|
---|
813 | dbmes.pohnr = 0; dbmes.volgnr = 1;
|
---|
814 | strcpy(dbmes.oms,"ERROR TELLER GAS");
|
---|
815 | wsint = DBinsert(210,&dbmes);
|
---|
816 | break;
|
---|
817 | case 'y' : /* error elec */
|
---|
818 | strcpy(dbmes.mdate,dbhis.hsdate);
|
---|
819 | dbmes.mtime = dbhis.hstime;
|
---|
820 | dbmes.type = 2; dbmes.macnr = dbhis.macnr;
|
---|
821 | dbmes.pohnr = 0; dbmes.volgnr = 2;
|
---|
822 | strcpy(dbmes.oms,"ERROR TELLER KWH");
|
---|
823 | wsint = DBinsert(210,&dbmes);
|
---|
824 | break;
|
---|
825 | case 'z' : /* error metrage */
|
---|
826 | strcpy(dbmes.mdate,dbhis.hsdate);
|
---|
827 | dbmes.mtime = dbhis.hstime;
|
---|
828 | dbmes.type = 2; dbmes.macnr = dbhis.macnr;
|
---|
829 | dbmes.pohnr = 0; dbmes.volgnr = 3;
|
---|
830 | strcpy(dbmes.oms,"ERROR TELLER METRAGE");
|
---|
831 | wsint = DBinsert(210,&dbmes);
|
---|
832 | break;
|
---|
833 | }
|
---|
834 |
|
---|
835 | if (swchar == 'n') {
|
---|
836 | /*
|
---|
837 | if (wslong >= dbmac.cmeter) dbmac.cmeter = wslong;
|
---|
838 | if (ws1 >= dbmac.cgas) dbmac.cgas = ws1;
|
---|
839 | if (ws2 >= dbmac.celec) dbmac.celec = ws2;
|
---|
840 | */
|
---|
841 |
|
---|
842 | dbmac.cmeter = wslong;
|
---|
843 | dbmac.cgas = ws1;
|
---|
844 | dbmac.celec = ws2;
|
---|
845 |
|
---|
846 |
|
---|
847 | if(n[r].iTO_Type3 < iMaxTimeOutType3)
|
---|
848 | {
|
---|
849 | if(n[r].iLastTimeType3 > abstijd)
|
---|
850 | n[r].iTO_Type3 += 86400 + abstijd - n[r].iLastTimeType3;
|
---|
851 | else
|
---|
852 | n[r].iTO_Type3 += abstijd - n[r].iLastTimeType3;
|
---|
853 | }
|
---|
854 |
|
---|
855 | if(n[r].iTO_Type3 >= iMaxTimeOutType3)
|
---|
856 | {
|
---|
857 | n[r].iTO_Type3 = 0;
|
---|
858 |
|
---|
859 | dbhis.fdec1 = wslong;
|
---|
860 | dbhis.fdec2 = ws1;
|
---|
861 | dbhis.fdec3 = ws2;
|
---|
862 | dbhis.type = 3; dbhis.stat = 0;
|
---|
863 | wsint = DBinsert(120,&dbhis);
|
---|
864 | dbhis.fdec1 = 0; dbhis.fdec2 = 0; dbhis.fdec3 = 0;
|
---|
865 | }
|
---|
866 |
|
---|
867 | n[r].iLastTimeType3 = abstijd;
|
---|
868 |
|
---|
869 |
|
---|
870 | }
|
---|
871 | wsint = DBupdate(130,&dbmac);
|
---|
872 | }
|
---|
873 |
|
---|
874 | /*--------------------------------------------------------*/
|
---|
875 | enum pkstatustype singleterminal(struct P_IN *p, int r)
|
---|
876 | /*--------------------------------------------------------*/
|
---|
877 | { int j;
|
---|
878 | long wstemp;
|
---|
879 | m_time = time(&m_time);
|
---|
880 | systm = *localtime(&m_time);
|
---|
881 | done = FALSE;
|
---|
882 | if (r < 1 || r > NORMALSIZE) return(TO_HOST);
|
---|
883 | if (p->fkey < F_F1 || p->fkey > 'c') return(TO_HOST);
|
---|
884 | if (p->fkey == F_HELP) {
|
---|
885 | if (strlen(p->mess) > 0) {
|
---|
886 | sscanf(p->mess,"%s",&hulp);
|
---|
887 | if (hulp[0] == 0x2E) klok_refresh(dbter.ternr);
|
---|
888 | }
|
---|
889 | else if ((dbter.termstat != VERTREK) &&
|
---|
890 | (dbter.termstat != BEWERK) &&
|
---|
891 | (dbter.termstat != CBEWERK)) {
|
---|
892 | misteld = 0;
|
---|
893 | while (misteld++ <= 4) {
|
---|
894 | n[r].pread += 2;
|
---|
895 | n[r].pread %= 4;
|
---|
896 | if (dbter.info1[0]) break;
|
---|
897 | else if (dbter.info3[0]) break;
|
---|
898 | }
|
---|
899 | if (misteld > 3) plaatstekst(TEK60);
|
---|
900 | else if (n[r].pread == 2)
|
---|
901 | { concatlijn(1); plaatstekst(dbter.info2);
|
---|
902 | transmitc(pkoutput);
|
---|
903 | concatlijn(2); plaatstekst(dbter.info3);
|
---|
904 | transmitc(pkoutput);
|
---|
905 | concatlijn(3); plaatstekst(dbter.info5);
|
---|
906 | }
|
---|
907 | else if (n[r].pread == 0)
|
---|
908 | { concatlijn(1); plaatstekst(dbter.info4);
|
---|
909 | transmitc(pkoutput);
|
---|
910 | concatlijn(2); plaatstekst(dbter.info1);
|
---|
911 | }
|
---|
912 | }
|
---|
913 | else if (dbter.termstat == BEWERK || dbter.termstat == CBEWERK) {
|
---|
914 | dbmac.macnr = dbter.macnr;
|
---|
915 | r = DBselect(130,&dbmac);
|
---|
916 | misteld = 0;
|
---|
917 | n[r].pread += 2;
|
---|
918 | n[r].pread %= 4;
|
---|
919 | if (misteld > 3) plaatstekst(TEK60);
|
---|
920 | else if (n[r].pread == 0)
|
---|
921 | { concatlijn(1);
|
---|
922 | sprintf(hulp," %ld ",dbmac.o1);
|
---|
923 | plaatstekst(hulp);
|
---|
924 | transmitc(pkoutput);
|
---|
925 | concatlijn(2);
|
---|
926 | sprintf(hulp," %ld ",dbmac.o2);
|
---|
927 | plaatstekst(hulp);
|
---|
928 | transmitc(pkoutput);
|
---|
929 | concatlijn(3);
|
---|
930 | sprintf(hulp," %ld ",dbmac.o3);
|
---|
931 | plaatstekst(hulp);
|
---|
932 | }
|
---|
933 | else if (n[r].pread == 2) {
|
---|
934 | concatlijn(1);
|
---|
935 | sprintf(hulp," %ld ",dbmac.o4);
|
---|
936 | plaatstekst(hulp);
|
---|
937 | transmitc(pkoutput);
|
---|
938 | concatlijn(2);
|
---|
939 | sprintf(hulp," %ld ",dbmac.o5);
|
---|
940 | plaatstekst(hulp);
|
---|
941 | transmitc(pkoutput);
|
---|
942 | concatlijn(3);
|
---|
943 | }
|
---|
944 | }
|
---|
945 | else { concatlijn(1); plaatstekst(TEK60); }
|
---|
946 | return(TO_SENDPICO);
|
---|
947 | }
|
---|
948 | else if (p->fkey == 'c') {
|
---|
949 | machinepuls(p, r);
|
---|
950 | j = DBupdate(110,&dbter);
|
---|
951 | return(TO_HOST);
|
---|
952 | }
|
---|
953 | else if (p->fkey == F_F3) {
|
---|
954 | if (dbter.termstat == CBEWERK) {
|
---|
955 | dbter.termstat = dbter.otermstat;
|
---|
956 | dbter.otermstat = VERTREK;
|
---|
957 | p->fkey = F_DUMMY;
|
---|
958 | }
|
---|
959 | else {
|
---|
960 | strcat(pkoutput,"C20"); transmitc(pkoutput);
|
---|
961 | concatlijn(1);
|
---|
962 | plaatstekst(TEK38);
|
---|
963 | transmitc(pkoutput);
|
---|
964 | concatlijn(2);
|
---|
965 | transmitc(pkoutput);
|
---|
966 | dbter.temp = 0;
|
---|
967 | dbter.otermstat = dbter.termstat;
|
---|
968 | dbter.termstat = CBEWERK;
|
---|
969 | done = TRUE;
|
---|
970 | }
|
---|
971 | }
|
---|
972 | else if (p->fkey == F_BC || p->fkey == F_XMIT) {
|
---|
973 | if (strlen(p->mess) > 0) {
|
---|
974 | sscanf(p->mess,"%ld",&wstemp);
|
---|
975 | wstemp /= 10;
|
---|
976 | if (wstemp > 999000 && wstemp < 999500 &&
|
---|
977 | wstemp != 999305 && wstemp != 999306) {
|
---|
978 | wstemp %= 1000;
|
---|
979 | dbprs.prsnr = dbter.temp % 100;
|
---|
980 | wstemp /= 100;
|
---|
981 | dbhis.hstime = abstijd % 86400;
|
---|
982 | dbhis.macnr = dbter.macnr;
|
---|
983 | sprintf(dbhis.hsdate,"%02d/%02d/%04d",systm.tm_mon + 1,
|
---|
984 | systm.tm_mday,systm.tm_year + 1900);
|
---|
985 | dbhis.stat = 0;
|
---|
986 | if (dbter.temp4 == 999501) dbhis.stat = 1;
|
---|
987 | dbhis.fdec1 = dbprs.prsnr;
|
---|
988 | if (wstemp == 4) {
|
---|
989 | dbhis.type = 24;
|
---|
990 | concatlijn(3);
|
---|
991 | plaatstekst(TEK39b);
|
---|
992 | }
|
---|
993 | else if (wstemp == 3) {
|
---|
994 | dbhis.type = 23;
|
---|
995 | concatlijn(3);
|
---|
996 | plaatstekst(TEK39);
|
---|
997 | }
|
---|
998 | r = DBinsert(120,&dbhis);
|
---|
999 | transmitc(pkoutput);
|
---|
1000 | done = TRUE;
|
---|
1001 | }
|
---|
1002 | else if (wstemp == 999501) {
|
---|
1003 | concatlijn(3);
|
---|
1004 | plaatstekst(TEK39a);
|
---|
1005 | transmitc(pkoutput);
|
---|
1006 | dbter.temp4 = 999501;
|
---|
1007 | done = TRUE;
|
---|
1008 | }
|
---|
1009 | }
|
---|
1010 | }
|
---|
1011 |
|
---|
1012 | while (!done) {
|
---|
1013 | dbter.temp4 = 0;
|
---|
1014 | switch (dbter.termstat) {
|
---|
1015 | case VERTREK : proc_vertrek(p,r); break;
|
---|
1016 | case ORDER : proc_order(p,r); break;
|
---|
1017 | case BEWERK : proc_bewerk(p,r); break;
|
---|
1018 | case CBEWERK : proc_cbewerk(p,r); break;
|
---|
1019 | default :
|
---|
1020 | done = TRUE;
|
---|
1021 | dbter.termstat = VERTREK;
|
---|
1022 | n[r].userptr = 0;
|
---|
1023 | n[r].tebevest = FALSE;
|
---|
1024 | n[r].tstatus = VERTREK;
|
---|
1025 | n[r].ostatus = VERTREK;
|
---|
1026 | j = DBupdate(110,&dbter);
|
---|
1027 | return(TO_DISTURBED);
|
---|
1028 | }
|
---|
1029 | }
|
---|
1030 | j = DBupdate(110,&dbter);
|
---|
1031 | return(TO_SENDPICO);
|
---|
1032 | }
|
---|
1033 |
|
---|
1034 | /*------------------------------------------------------------*/
|
---|
1035 | void sluitsingle(int puser, int r, char einde)
|
---|
1036 | /*------------------------------------------------------------*/
|
---|
1037 | { int j;
|
---|
1038 |
|
---|
1039 | if (r < 1 || r > NORMALSIZE) return;
|
---|
1040 | n[r].tstatus = n[r].ostatus = VERTREK;
|
---|
1041 | }
|
---|
1042 |
|
---|
1043 |
|
---|
1044 |
|
---|