240717班级,工业化控制系统,煤矿相关行业,昆仑系统
lhl
2024-11-05 a4170bd5a193943ad71bcc35f9e35344dbfaba96
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
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
#ifndef COMMON_H
#define COMMON_H
 
#include <string.h>
 
enum TypeInfo {
 
    //注册登录
    LOGIN_REQ, // 登录请求
    LOGIN_RES, // 登录响应
    REGISTER_REQ, //注册请求
    REGISTER_RES, //注册响应
    RESET_REQ, //重置密码请求
    RESET_RES, //重置密码响应
 
 
    //权限管理
    QUERY_PMS_REQ,      // 按员工编号、名字或职位查询人员权限信息请求
    UPDATE_PMS_REQ,     // 按角色id更新权限信息请求
    QUERY_PMS_RES,      // 查询人员和角色信息的响应结构体
    UPDATE_PMS_RES,     // 权限更新结果响应体
 
    //设备管理
    AD_REQ,//添加设备请求
    AD_RES,//添加设备响应
    MD_REQ,//修改设备请求
    MD_RES,//修改设备响应
    QD_REQ,//查询设备请求
    QD_RES,//查询设备响应
 
    //地图标注
    MML_REQ,//地图标注加载请求
    MML_RES,//地图标注加载响应    
    MMI_REQ,//地图标注插入请求
    MMI_RES,//地图标注插入响应    
    MMD_REQ,//地图标注删除请求
    MMD_RES,//地图标注删除响应
 
    //大屏显示
    ENVIRONMENT_REQ,//环境数据请求
    ENVIRONMENT_RES,//环境数据响应
    DEVICESTATUS_REQ,//设备状态请求
    DEVICESTATUS_RES,//设备状态响应
    MOVEMENTRECORD_REQ,//操作日志请求
    MOVEMENTRECORD_RES,//操作日志响应
    ALARMRECORD_REQ,//警报记录请求
    ALARMRECORD_RES,//警报记录响应
    YIELD_REQ,//煤矿产量请求
    YIELD_RES,//煤矿产量响应
 
    //警报管理
    WARNING_REQ, // 警报请求
    WARNING_RES, // 警报响应
 
 
    //生产计划管理
    ADD_PDPLAN_REQ,//添加一条生产计划的请求结构体
    ADD_PDPLAN_RES,//添加一条生产计划的响应结构体
    DEL_PDPLAN_REQ,//删除一条生产计划的请求结构体
    DEL_PDPLAN_RES,//删除一条生产计划的响应结构体
    UPDATE_PDPLAN_REQ,//更改一条生产计划的请求结构体
    UPDATE_PDPLAN_RES,//更改一条生产计划的响应结构体
    QUERY_PDPLAN_REQ,//查询一条生产计划的请求结构体
    QUERY_PDPLAN_RES,//查询一条生产计划的响应结构体
 
 
    ADD_MONOUTPUT_REQ,//添加月产量的请求结构体
    ADD_MONOUTPUT_RES,//添加月产量的响应结构体
    DEL_MONOUTPUT_REQ,//删除月产量的请求结构体
    DEL_MONOUTPUT_RES,//删除月产量的响应结构体
    UPDATE_MONOUTPUT_REQ,//更新月产量的请求结构体
    UPDATE_MONOUTPUT_RES,//更新月产量的响应结构体
    QUERY_MONOUTPUT_REQ,//查询月产量的请求结构体
    QUERY_MONOUTPUT_RES,//查询月产量的响应结构体
 
 
    //自动升级
    VERSION_NUM_REQ,  // 版本号请求
    VERSION_NUM_RES,   // 版本号响应
    UPLOAD_FILE_REQ, // 上传文件的请求
    UPLOAD_FILE_RES, // 上传文件的响应
    VERSION_INFOENTRY_REQ,       // 版本信息录入请求
    VERSION_INFOENTRY_RES,       //版本信息录入响应
    VERSION_UPDATE_REQ, // 版本更新请求
    VERSION_UPDATE_RES, // 版本更新响应
    FILE_DOWNLOADS_REQ, // 版本更新文件下载请求
    FILE_DOWNLOADS_RES, // 版本更新文件下载响应
    DOWNLOAD_SUCCESSFULLY_RES,       // 更新文件下载成功的响应
 
    //日志
    LOGSEARCH_REQ,//日志查询请求
    LOGSEARCH_RES,//日志查询响应
 
};
 
struct Head {
    int type;
    int len;
};
 
//注册登录
//登录请求 
struct LoginReq
{
    Head head;
    char userName[32];
    char password[32];
    LoginReq() {
        head.type = LOGIN_REQ;
        head.len = sizeof(LoginReq);
    }
};
 
struct Permission
{
    int admin;//超级管理员
    int loggerSearch; //日志查询
    int queryHistory; //历史记录
    int mapMark;//地图
    int versionManage; // 版本管理
    int warning; //警报
    int devManage; //设备管理
    int productPlan;//生产计划
    char roleName[32]; // 角色名
};
 
//登录响应
struct LoginRes
{
    Head head;
    char userName[32];
    int status; // 登录状态
    // 登录成功时,该账号对应的权限组合
    Permission per;
    LoginRes()
    {
        head.type = LOGIN_RES;
        head.len = sizeof(LoginRes);
    }
};
 
//注册请求 
struct RegisterReq
{
    Head head;
    char userName[32];
    char password[32];
    char email[50];
    char capcha[10];//验证码
    char telephone[32];
    RegisterReq() {
        head.type = REGISTER_REQ;
        head.len = sizeof(RegisterReq);
    }
};
 
//注册响应
struct RegisterRes
{
    Head head;
    char userName[32];
    int status; // 注册状态
    RegisterRes()
    {
        head.type = REGISTER_RES;
        head.len = sizeof(RegisterRes);
    }
};
 
//重置密码请求 
struct ResetReq
{
    Head head;
    char email[50];
    char capcha[10];//验证码
    char password[32];//新密码
    char confirmPassword[32];//确认密码
    ResetReq() {
        head.type = RESET_REQ;
        head.len = sizeof(ResetReq);
    }
};
 
//重置密码响应
struct ResetRes
{
    Head head;
    char user_name[32];
    int status; // 重置密码状态
    ResetRes()
    {
        head.type = RESET_RES;
        head.len = sizeof(ResetRes);
    }
};
 
//权限管理
// 按员工编号、名字或职位查询人员权限信息请求
typedef struct QueryPmsReq {
    Head head;
    char userNo[32];
    char name[32];
    char permissonType[32];
    QueryPmsReq() {
        head.type = QUERY_PMS_REQ;
        memset(userNo, 0, 32);
        memset(permissonType, 0, 32);
        memset(name, 0, 32);
        head.len = sizeof(QueryPmsReq);
    }
} QueryPmsReq;
 
// 按角色id更新权限信息请求
typedef struct UpdatePmsReq {
    Head head;
    // 人员表主键id
    int id;
    int queryHistory;
    int loggerSearch;
    int mapMark;
    int devManage;
    int productPlan;
    int warningManage;
    int versionManage; //版本管理
    int admin; //系统管理员
    UpdatePmsReq() {
        head.type = QUERY_PMS_RES;
        head.len = sizeof(UpdatePmsReq);
    }
} UpdatePmsReq;
 
// 单个人员和权限联合查询结构体
typedef struct PmsRes {
    int queryHistory;
    int loggerSearch;
    int mapMark;
    int devManage;
    int productPlan;
    int id;
 
    char userNo[32];
    char name[32];
 
    char permissonType[32];  // 角色类型
    int versionManage; //版本管理
    int admin; //系统管理员
    char department[32];
    char loginTime[32];
    char registerTime[32];
} PmsRes;
 
// 查询人员和角色信息的响应结构体
typedef struct QueryPmsRes {
    Head head;
    int success; // 1为成功 ,0为失败
    PmsRes pmsList[0];
    QueryPmsRes() {
        head.type = QUERY_PMS_REQ;
    }
} QueryPmsRes;
 
// 权限更新结果响应体
struct UpdatePmsRes {
    Head head;
    int success; // 1为成功 ,0为失败
    UpdatePmsRes() {
        head.type = UPDATE_PMS_RES;
        head.len = sizeof(UpdatePmsRes);
    }
 
} UpdatePmsRes;
 
 
 
 
//设备管理
struct DevicesInfo
{
    char deviceName[32];//设备名称
    char deviceStatus[32];//设备状态
    char area[32]; // 地区
    double longitude;//经度
    double latitude;//纬度
    char purchasingTime[15];//购买时间
    char installTime[15];//安装时间
    char manufacturer[100];//厂家
    char devicesSerialNumber[32];//设备编码
    char devicesType[32];//设备类型
};
//添加设备
struct ADReq//添加请求
{
    Head head;
    DevicesInfo devInfo[0];
    ADReq() {
        head.type = AD_REQ;
        head.len = sizeof(ADReq);
    }
 
};
 
struct ADRes//添加响应
{
    Head head;
    int status;
    ADRes() {
        head.type = AD_RES;
        head.len = sizeof(ADRes);
    }
 
};
//修改设备
struct MDReq//修改请求
{
    Head head;
    
    MDReq() {
        head.type = MD_REQ;
        head.len = sizeof(MDReq);
    }
};
struct MDRes//修改响应
{
    Head head;
    DevicesInfo info;
    int status;
    MDRes() {
        head.type = MD_RES;
        head.len = sizeof(MDRes);
    }
};
//查询设备
struct QDReq//查询请求
{
    Head head;
    DevicesInfo info;
    QDReq() {
        head.type = QD_REQ;
        head.len = sizeof(QDReq);
    }
};
struct QDRes//查询响应
{
    Head head;
    int status;
    QDRes() {
        head.type = QD_RES;
        head.len = sizeof(QDRes);
    }
};
 
 
//地图标注
struct MarkInfo
{
    int markId;//标注点id
    double latitude;//纬度
    double longitude;//经度
    int deviceId;//设备ID
    int deviceStatus;//设备状态
    char deviceName[32];//设备名称
};
//地图标注加载请求
struct MMLReq//地图
{
    Head head;
    MMLReq() {
        head.type = MML_REQ;
        head.len = sizeof(MMLReq);
    }
};
//地图标注加载响应:
struct MMLRes
{
    Head head;
    int status;//操作状态
    MarkInfo info[0];
    MMLRes() {
        head.type = MML_RES;
        head.len = sizeof(MMLRes);
    }
};
//地图标注插入请求
struct MMIReq//地图
{
    Head head;
    MarkInfo info[0];
    MMIReq() {
        head.type = MMI_REQ;
        head.len = sizeof(MMIReq);
    }
};
//地图标注插入响应:
struct MMIRes
{
    Head head;
    int status;//操作状态
    MarkInfo info[0];
    MMIRes() {
        head.type = MMI_RES;
        head.len = sizeof(MMIRes);
    }
};
 
//地图标注删除请求
struct MMDReq//地图
{
    Head head;
    MarkInfo info[0];
    MMDReq() {
        head.type = MMD_REQ;
        head.len = sizeof(MMDReq);
    }
};
//地图标注删除响应:
struct MMDRes
{
    Head head;
    int status;//操作状态
    MarkInfo info[0];
    MMDRes() {
        head.type = MMD_RES;
        head.len = sizeof(MMDRes);
    }
};
 
//大屏显示
//环境数据请求
struct EnvironmentReq
{
    Head head;
    EnvironmentReq() {
        head.type = ENVIRONMENT_REQ;
        head.len = sizeof(EnvironmentReq);
    }
};
//环境数据响应
struct Environment
{
    double longitude;//经度
    double latitude;//纬度
    float temp;//温度
    float humidity;//湿度
    float oxygen;//氧气浓度
    float carbon;//一氧化碳浓度
};
struct EnvironmentRes
{
    Head head;
    int status;
    Environment environment[0];
    EnvironmentRes() {
        head.type = ENVIRONMENT_RES;
        head.len = sizeof(EnvironmentRes);
    }
};
//设备状态请求
struct DeviceStatusReq
{
    Head head;
    DeviceStatusReq() {
        head.type = DEVICESTATUS_REQ;
        head.len = sizeof(DeviceStatusReq);
    }
};
//设备状态响应
struct DeviceStatus
{
    double longitude;//经度
    double latitude;//纬度
    int deviceID;//设备编号
    char deviceName[32];//设备名称
    char deviceStatus[32];//设备状态
};
struct DeviceStatusRes
{
    Head head;
    int status;
    DeviceStatus deviceStatus[0];
    DeviceStatusRes() {
        head.type = DEVICESTATUS_RES;
        head.len = sizeof(DeviceStatusRes);
    }
};
//操作日志请求
struct MovementRecordReq
{
    Head head;
    MovementRecordReq() {
        head.type = MOVEMENTRECORD_REQ;
        head.len = sizeof(MovementRecordReq);
    }
};
//操作日志响应
struct MovementRecord
{
    double longitude;//经度
    double latitude;//纬度
    char userName;//操作用户名
    char operateTime[32];//操作时间
    char deviceName[32];//操作设备
    char movement[256];//操作描述
};
struct MovementRecordRes
{
    Head head;
    int status;
    MovementRecord movementRecord[0];
    MovementRecordRes() {
        head.type = MOVEMENTRECORD_RES;
        head.len = sizeof(MovementRecordRes);
    }
};
//警报记录请求
struct AlarmRecordReq
{
    Head head;
    AlarmRecordReq() {
        head.type = ALARMRECORD_REQ;
        head.len = sizeof(AlarmRecordReq);
    }
};
//警报记录响应
struct AlarmRecord
{
    double longitude;//经度
    double latitude;//纬度
    char alarmTime[32];//警报时间
    char alarmtype[32];//处理时间
    char alarmContent[256];//警报内容
};
struct AlarmRecordRes
{
    Head head;
    int status;
    AlarmRecord alarmRecord[0];
    AlarmRecordRes() {
        head.type = ALARMRECORD_RES;
        head.len = sizeof(AlarmRecordRes);
    }
};
//煤矿产量请求
struct YieldReq
{
    Head head;
    YieldReq() {
        head.type = YIELD_REQ;
        head.len = sizeof(YieldReq);
    }
};
//煤矿产量响应
struct Yield
{
    int month;//月份
    int output;//产量
};
struct YieldRes
{
    Head head;
    int status;
    Yield yield[0];
    YieldRes() {
        head.type = YIELD_RES;
        head.len = sizeof(YieldRes);
    }
};
 
//警报管理
// 警报请求结构体  
struct WarningReq {
    Head head;
 
    float oxygenWarning;
    float carbonWarning;
    float tempWarning;
    float humidityWarning;
 
    WarningReq() {
        head.type = WARNING_REQ;
        head.len = sizeof(WarningReq);
    }
};
 
 
struct DataThreshold {
    //阈值
    float oxygenThreshold;
    float carbonThreshold;
    float tempThreshold;
    float humidityThreshold;
};
 
struct Data {
    float oxygen;   // 氧气浓度  
    float carbon;   // 一氧化碳浓度  
    float temp;     // 温度  
    float humidity; // 湿度 
};
 
// 警报响应结构体  
struct WarningRes {
    Head head;
    int status;         // 响应状态(比如 0 表示成功,1 表示失败等)  
    const char* message; // 响应消息描述  
 
    WarningRes(int stat, const char* msg) {
        head.type = WARNING_RES;
        head.len = sizeof(WarningRes);
        status = stat;
        message = msg;
    }
};
 
//生产计划管理
struct PdplanInfo
{
    int planId;//订单编号
    char planName[32];//订单名字
    char startDate[32];//起始日期
    char closingDate[32];//交付日期
    char pdName[8];//产品名
    double plannedPd;//计划生产量
    double actualPd;//实际生产量
    double progress;//生产进度
    int finishOntime;//是否按期完成
};
 
struct MonoutputInfo
{
    int month;//月份
    double aOutput;//a产品月产量
    double bOutput;//b产品月产量
    double cOutput;//c产品月产量
};
 
//添加一条生产计划的请求结构体
struct AddPdplanReq
{
    Head head;
    PdplanInfo info[0];
    AddPdplanReq() {
        head.type = ADD_PDPLAN_REQ;
        head.len = sizeof(AddPdplanReq);
    }
};
 
//添加一条生产计划的响应结构体
struct AddPdplanRes
{
    Head head;
    int status;//表示是否添加成功,0否1是
    AddPdplanRes() {
        head.type = ADD_PDPLAN_RES;
        head.len = sizeof(AddPdplanRes);
    }
};
 
//删除一条生产计划的请求结构体
struct DelPdplanReq
{
    Head head;
    PdplanInfo info[0];
    DelPdplanReq() {
        head.type = DEL_PDPLAN_REQ;
        head.len = sizeof(DelPdplanReq);
    }
};
 
//删除一条生产计划的响应结构体
struct DelPdplanRes
{
    Head head;
    int status;//表示是否删除成功,0否1是
    DelPdplanRes() {
        head.type = DEL_PDPLAN_RES;
        head.len = sizeof(DelPdplanRes);
    }
};
 
//更改一条生产计划的请求结构体.
struct UpdatePdplanReq
{
    Head head;
    PdplanInfo info[0];
    UpdatePdplanReq() {
        head.type = UPDATE_PDPLAN_REQ;
        head.len = sizeof(UpdatePdplanReq);
    }
};
 
//更改一条生产计划的响应结构体
struct UpdatePdplanRes
{
    Head head;
    int status;//表示是否更新成功,0否1是
    PdplanInfo info[0];
    UpdatePdplanRes() {
        head.type = UPDATE_PDPLAN_RES;
        head.len = sizeof(UpdatePdplanRes);
    }
};
 
//查询一条生产计划的请求结构体
struct QueryPdplanReq
{
    Head head;
    int planId;//订单编号
    char planName[32];//订单划名字
    char startDate[32];//起始日期
    char closingDate[32];//交付日期
    char pdName[8];//产品名
    double plannedPd;//计划生产量
    double actualPd;//实际生产量
    double progress;//生产进度
    int finishOntime;//是否按期完成
    QueryPdplanReq() {
        head.type = QUERY_PDPLAN_REQ;
        head.len = sizeof(QueryPdplanReq);
    }
};
 
//查询一条生产计划的响应结构体
struct QueryPdplanRes
{
    Head head;
    int status;//表示是否添加成功,0否1是
    PdplanInfo info[0];
    QueryPdplanRes() {
        head.type = QUERY_PDPLAN_RES;
        head.len = sizeof(QueryPdplanRes);
    }
};
 
 
//添加月产量的请求结构体
struct AddMonoutputReq
{
    Head head;
    MonoutputInfo info[0];
    AddMonoutputReq() {
        head.type = ADD_MONOUTPUT_REQ;
        head.len = sizeof(AddMonoutputReq);
    }
};
 
//添加月产量的响应结构体
struct AddMonoutputRes
{
    Head head;
    int status;//表示是否添加成功,0否1是
    AddMonoutputRes() {
        head.type = ADD_MONOUTPUT_RES;
        head.len = sizeof(AddMonoutputRes);
    }
};
 
//删除月产量的请求结构体
struct DelMonoutputReq
{
    Head head;
    MonoutputInfo info[0];
    DelMonoutputReq() {
        head.type = DEL_MONOUTPUT_REQ;
        head.len = sizeof(DelMonoutputReq);
    }
};
 
//删除月产量的响应结构体
struct DelMonoutputRes
{
    Head head;
    int status;//表示是否删除成功,0否1是
    DelMonoutputRes() {
        head.type = DEL_MONOUTPUT_RES;
        head.len = sizeof(DelMonoutputRes);
    }
};
 
//更改月产量的请求结构体.
struct UpdateMonoutputReq
{
    Head head;
    MonoutputInfo info[0];
    UpdateMonoutputReq() {
        head.type = UPDATE_MONOUTPUT_REQ;
        head.len = sizeof(UpdateMonoutputReq);
    }
};
 
//更改月产量的响应结构体
struct UpdateMonoutputRes
{
    Head head;
    int status;//表示是否更新成功,0否1是
    MonoutputInfo info[0];
    UpdateMonoutputRes() {
        head.type = UPDATE_MONOUTPUT_RES;
        head.len = sizeof(UpdateMonoutputRes);
    }
};
 
//查询月产量的请求结构体
struct QueryMonoutputReq
{
    Head head;
    int month;//月份
    double aOutput;//a产品月产量
    double bOutput;//b产品月产量
    double cOutput;//c产品月产量
    QueryMonoutputReq() {
        head.type = QUERY_MONOUTPUT_REQ;
        head.len = sizeof(QueryMonoutputReq);
    }
};
 
//查询月产量的响应结构体
struct QueryMonoutputRes
{
    Head head;
    int status;//表示是否添加成功,0否1是
    MonoutputInfo info[0];
    QueryMonoutputRes() {
        head.type = QUERY_MONOUTPUT_RES;
        head.len = sizeof(QueryMonoutputRes);
    }
};
 
 
 
//历史查询分析
// 历史查询请求结构体
struct HistoryQueryReq {
    Head head;
    //根据时间范围查询
    char startTime[32];
    char endTime[32];
    //关键字查询
    char keyWord[32];
    HistoryQueryReq() {
        // 初始化数据头
        head.type = QUERY_MONOUTPUT_REQ;
        head.len = sizeof(HistoryQueryReq);
        // 初始化查询条件字段
        std::memset(startTime, 0, sizeof(startTime));
        std::memset(endTime, 0, sizeof(endTime));
 
    }
};
 
// 历史查询响应结构体
 
// 系统运行状态表相关信息
struct HistroyInfo {
    WarningRes warn;//警报查询
    QDRes dev;//设备查询
    QueryPdplanRes  pro;//生产计划查询
};
struct HistoryQueryRes {
    Head head;
    HistroyInfo sys[0];
    HistoryQueryRes() {
        // 初始化数据头
        head.type = QUERY_MONOUTPUT_RES;
        head.len = sizeof(HistoryQueryRes);
    }
};
 
 
//自动升级
struct VersionNumReq        // 版本号请求
{
    Head head;
    VersionNumReq() {
        head.type = VERSION_NUM_REQ;
        head.len = sizeof(VersionNumReq);
    }
};
 
struct VersionNumRes        // 版本号响应
{
    Head head;
    char versionId[64]; // 版本号
    VersionNumRes() {
        head.type = VERSION_NUM_RES;
        head.len = sizeof(VersionNumRes);
    }
};
 
// 文件传输
struct FileInfo
{
    char fileName[256];
    long long fileSize;
    char s_filepath[128];
    char content[0];
};
 
struct UploadFileReq        // 上传文件的请求
{
    Head head;
    FileInfo fileInfo;
    UploadFileReq() {
        head.type = UPLOAD_FILE_REQ;
        head.len = sizeof(UploadFileReq);
    }
};
 
struct UploadFileRes {      // 上传文件的响应
    Head head;
    bool state = false;
    char fileName[256];
    long long file_size;
    UploadFileRes()
    {
        head.type = UPLOAD_FILE_RES;
        head.len = sizeof(UploadFileRes);
    }
};
 
// 版本信息录入
// 请求
struct VersionInfoEntryReq {
    Head head;
    char versionId[64]; // 版本号
    char versionIdOld[64]; // 上一个版本号
    int fileNum;
    char context[0];        //包含下载文件信息
 
    VersionInfoEntryReq()
    {
        head.type = VERSION_INFOENTRY_REQ;
        head.len = sizeof(VersionInfoEntryReq);
    }
};
 
// 版本信息录入响应
struct VersionInfoEntryRes {
    Head head;
    bool state = false;
    VersionInfoEntryRes()
    {
        head.type = VERSION_INFOENTRY_RES;
        head.len = sizeof(VersionInfoEntryRes);
    }
};
 
// 版本更新请求
struct VersionUpdateReq {
    Head head;
 
    char curVersionId[64]; // 版本号
    VersionUpdateReq()
    {
        head.type = VERSION_UPDATE_REQ;
        head.len = sizeof(VersionUpdateReq);
    }
};
 
// 版本更新响应
struct VersionUpdateRes {
    Head head;
    bool state = false;
    char versionId[64]; // 版本号
    char updateDate[32]; // 更新时间
    char versionDescription[1024]; //更新描述
 
    VersionUpdateRes()
    {
        head.type = VERSION_UPDATE_RES;
        head.len = sizeof(VersionUpdateRes);
    }
};
 
// 版本更新文件下载请求
struct FileDownloadsReq {
    Head head;
    char versionId[64]; // 版本号
    FileDownloadsReq()
    {
        head.type = FILE_DOWNLOADS_REQ;
        head.len = sizeof(FileDownloadsReq);
    }
};
 
// 版本更新文件下载响应
struct FileDownloadsRes {
    Head head;
    char versionId[64]; // 版本号
    char filename[128]; //文件名
    long long filesize; //文件大小
    char c_filepath[128];    //客户端放最新版本的本地路径
    int fileNum; // 文件数量
    long long allFileSize; // 文件总大小
    char content[0];
    FileDownloadsRes()
    {
        head.type = FILE_DOWNLOADS_RES;
        head.len = sizeof(FileDownloadsRes);
    }
};
 
// 更新文件下载成功的响应
struct DownloadSuccessfullyRes {
    Head head;
    bool state = false;
    char fileName[256];
    long long fileSize;
    DownloadSuccessfullyRes()
    {
        head.type = DOWNLOAD_SUCCESSFULLY_RES;
        head.len = sizeof(DownloadSuccessfullyRes);
    }
};
 
 
//日志
struct ParsedLog {
    char timeStamp[64]; // 时间戳
    char deviceId[64]; // 设备ID
    char level[16];    // 日志级别
    char content[256];  // 日志内容
    char userId[64];    // 用户ID
    char fileName[32];   //文件名
    char functionName[32];  //函数名
    int problemLine;    //产生错误行号
};
 
// 日志查询请求结构体
// 日志查询请求结构体
struct LogQueryReq {
    Head head;                      // 数据头
    char timeStamp[64];             // 时间戳
    char content[256];           // 日志内容
    char level[16];                 //日志级别
    char deviceId[64];             // 设备ID
    // 无参构造函数
    LogQueryReq() {
        head.type = LOGSEARCH_REQ;
        head.len = sizeof(LogQueryReq);
    }
};
 
// 日志查询响应结构体
struct LogQueryRes {
    Head head;
    int status;                    // 响应状态 (如 0 表示成功,非 0 表示失败)
    char errorMessage[256];        // 错误信息(如果有)
 
    // 无参构造函数
    LogQueryRes() {
        head.type = LOGSEARCH_RES;
        head.len = sizeof(LogQueryRes);
    }
};
 
 
 
 
#endif // COMMON_H