⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thread.h

📁 数据采集
💻 H
字号:
#ifndef threadH
#define threadH
//----------------------------------------------------------------------------
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include <Classes.hpp>
#include <System.hpp>
#define MAX_CE 100 //与global.h里的MAX_CE同步


//----------------------------------------------------------------------------
class TDonThread : public TThread
{
private:
  long qin[MAX_CE],hou[MAX_CE],qin_hou[MAX_CE],wei[MAX_CE],ad[MAX_CE];
  long qin1[MAX_CE],qin2[MAX_CE],hou1[MAX_CE],hou2[MAX_CE];
  long ad_n1[MAX_CE],ad_n2[MAX_CE],ad_n3[MAX_CE],ad_n4[MAX_CE],wei_n1[MAX_CE],wei_n2[MAX_CE],wei_n3[MAX_CE],wei_n4[MAX_CE];
  long ad_w1[MAX_CE],ad_w2[MAX_CE],ad_w3[MAX_CE],ad_w4[MAX_CE],wei_w1[MAX_CE],wei_w2[MAX_CE],wei_w3[MAX_CE],wei_w4[MAX_CE];
  long   w[MAX_CE]; // 纵向偏载
  float r_q[MAX_CE],r_h[MAX_CE],r_zc[MAX_CE];    // 前后转向架的偏载率,整车偏载率
  float y1[MAX_CE],y2[MAX_CE],y3[MAX_CE],y4[MAX_CE];   // 4根轴的偏载率
  int spd[MAX_CE];
  float k_dz[MAX_CE],kx1,kx2,kx3;
  char tm[30];
  char save_name[30];
  int EXIT_OK,EXIT_YC,EXIT_ESC,NOT_EXIT;
  char direct; //方向

  int real_wei;  // 超偏载没有圆整之前的重量

  char _ch[MAX_CE][8]; //for test 简配车号
  char _cx[MAX_CE][7]; //for test 简配车号
  int _nono;

  void __fastcall TDonThread::start_wb(); //for test 简配车号
  void __fastcall TDonThread::stop_wb(); //for test 简配车号
  bool __fastcall TDonThread::get_ch(char* ch,char* cx); //for test 简配车号
  bool __fastcall TDonThread::get_jpch(char* buf); //for test 简配车号
  void __fastcall TDonThread::save_ch(); //for test 简配车号
  bool __fastcall TDonThread::zero_is_ok();  //检查是否进入动态称重时台面压车
  void __fastcall TDonThread::show_zero_err();


protected:
	virtual void __fastcall Execute(void);

public:
    int ce_cnt;

    __fastcall TDonThread(void);
    int static __fastcall create_db(char *);
    void __fastcall save_wav();//  save wave for debug
    void __fastcall save_ad();
    void __fastcall refresh_dir();    /*** refresh dir database***/
    void __fastcall new_db();
    int  __fastcall weight_don_2j1z();
    int  __fastcall weight_don_cpzgz();
    int  __fastcall weight_don_wave();
    int  __fastcall weight_don_kg();
    void __fastcall collect_zero();
    void __fastcall create_savename_dbname_del_old();
    void __fastcall print();
    void __fastcall show();
    void __fastcall show_start();
    void __fastcall show_being();
    void __fastcall show_end();
    void __fastcall show_error();
    void __fastcall show_yc();
    void __fastcall show_zero();
    void __fastcall repaint();
    void __fastcall lock_weight(int n=0);
    void __fastcall make_visible();
    void __fastcall c_wei(long,long); //计算重量
    void __fastcall c_spd(int); //计算速度
    float __fastcall c_dz(int); //计算速度
    void __fastcall save_zero_in_buf();
    void __fastcall get_direct();  //判方向
    void __fastcall be_ready_for_suspend();
    void __fastcall c_cpz(); //计算超偏载
    void __fastcall c_newcpz(); //计算超偏载
    void __fastcall js_pzc_pzl(); //已知wei_n1,wei_w1...计算pzc,pzl
    void __fastcall c_cpz24(); //计算超偏载

    void __fastcall init_weightdon_wave();
    void __fastcall save_outfile();
    int __fastcall check_exit();
    int __fastcall pb_head();
    void  __fastcall check_kg();
    void __fastcall show_ofst_time();
    void __fastcall set_tm_cecnt(char* str_tm,int int_cecnt);
    //bool __fastcall check_qz(int ofst1,int ofst2);// 判轻车(ret==true)重车(ret==false)
    int __fastcall get_cecnt();
    void __fastcall set_cecnt(int);

    void __fastcall static load_vxd();
    void __fastcall static open_port();
    //void __fastcall static set_port_address();
    void __fastcall create_txtfile_forlw();
    //long __fastcall js_ad(int whtm,int ofst1,int ofst2);
    friend int get_which_j_down(int wh_tm);
    friend int get_which_j_up(int wh_tm);
    void __fastcall TDonThread::refresh_cpz_data(bool add_cnt,int nono);
    void __fastcall TDonThread::lock_cpz24(bool add_cnt,int nono);
    void __fastcall TDonThread::pzc_c_newcpz(); // 重新计算wei_n1,wei_n2....
    void __fastcall TDonThread::pzl_c_newcpz(); // 重新计算wei_n1,wei_n2....
    //int __fastcall TDonThread::get_no();
    bool __fastcall deal_kg(int to_ofst);
    bool __fastcall deal_kg_cpz24(int to_ofst,int j);
    void __fastcall show_cnt_exit();
    void __fastcall TDonThread::show_kg();
    void __fastcall TDonThread::write_kkg(int j,short who,int ofst,short dlt,short up_down);
    void __fastcall TDonThread::create_txt();
    bool __fastcall TDonThread::check_is_hc(int& nono);
    long __fastcall TDonThread::ad_to_wei(long ad,char direct);
    bool __fastcall TDonThread::k_changed();
    void __fastcall TDonThread::yes_refresh_cpz_data();

};
//----------------------------------------------------------------------------
class TGetdataThread : public TThread
{
private:
        unsigned kg_in;
protected:
	virtual void __fastcall Execute(void);
public:
	__fastcall TGetdataThread(void);
        void __fastcall get_data_from_port();
        void __fastcall get_data_from_bus();
        void __fastcall get_kg(unsigned);
        void __fastcall for_fx();
        bool __fastcall do_k1();
        bool __fastcall do_k2();
        bool __fastcall do_k3();
        bool __fastcall do_k4();
        void __fastcall show_comm_error();
        void __fastcall show_offset();
        void __fastcall show_kgin();
        void __fastcall show_kg();

};
//----------------------------------------------------------------------------

class TLwThread : public TThread
{
private:
        bool __fastcall TLwThread::time_ok(char* filename);
protected:
	virtual void __fastcall Execute(void);
public:
	__fastcall TLwThread(void);
        void __fastcall longfile_to_shortfile(char *from,char *to);
        bool __fastcall open_port();
        bool __fastcall dial();
        bool __fastcall close_port();
        bool __fastcall send_file(char *trans_filename);
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -