V1.111 edit by lijun 2025-03-13
1.新增锁具工作模式读取
2.新增根据平台锁具模式设置当前所有锁具的模式
| | |
| | | 设备ID:10000001
|
| | |
|
| | |
|
| | | V1.111 edit by lijun 2025-03-13
|
| | | 1.新增锁具工作模式读取
|
| | | 2.新增根据平台锁具模式设置当前所有锁具的模式
|
| | | |
| | | V1.110 edit by lijun 2025-01-20
|
| | | 1.新增锁具告警记录功能
|
| | | 2.记录每年月季度的开锁次数,以及每年锁具状态变化记录-已完成
|
| | |
| | |
|
| | | private boolean S_thread_run_flag = true;
|
| | |
|
| | | private int plat_model;
|
| | |
|
| | | public Lock_SocketClient_Thread(MysqlConnPool pool,ElectLock_Array GB_Lock_Array ,AppConfig config,Socket tmp_socket) {
|
| | | this.pool = pool;
|
| | |
| | | Lock_Task_SQL.insertLock_Ctl_Log_Table(pool, tmp_log);
|
| | | mLock_State.setIDOpen(false);
|
| | | tmp_log = null;
|
| | | }
|
| | | |
| | | plat_model = Lock_Task_SQL.querySystemLockMode(pool);
|
| | | if(plat_model != ElectLock_ComBase.CMD_Fail) {
|
| | | if(plat_model != mLock_State.getWorkmodel()) {
|
| | | logger.info("LockID:"+client_id + " Start change Model :");
|
| | | |
| | | mRtu_Tx.mkBusRtu(MyModBusRtu.CMD_TYPE_WRITE_STD, ElectLock_ComBase.LOCK_SET_Model_ADDR, ElectLock_ComBase.RegCount_Sigle);
|
| | | SocketComm(mRtu_Tx, ComBase.mkUInt16Buffer(plat_model));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | isSuccess = true;
|
| | | logger.info("LockId:" + client_id + " LockIp:"+client_ip + " 设置锁具地址:" + mLock_param.getLock_addr_set() + "成功");
|
| | | }
|
| | | }else if(ElectLock_ComBase.LOCK_SET_Model_ADDR == mRtu_Rx.reg_addr) {
|
| | | //设置锁具工作模式
|
| | | if(plat_model == mRtu_Rx.result) {
|
| | | isSuccess = true;
|
| | | logger.info("LockId:" + client_id + " LockIp:"+client_ip + " 设置锁具模式:" + plat_model + "成功");
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | }else if(MyModBusRtu.CMD_TYPE_WRITE_MULTY == mRtu_Rx.Cmd) {
|
| | | if(ElectLock_ComBase.LOCK_Add_ID_AUTH_ADDR == mRtu_Rx.reg_addr) {
|
| | | //添加授权ID卡
|
| | |
| | | " ,lock_online = " + state.getLock_online() +
|
| | | " ,lock_mac = '" + state.getLockMacAddr() + "'" +
|
| | | " ,lock_open_count = " + state.getLock_open_count() +
|
| | | " ,model = " + state.getWorkmodel() + |
| | | " ,last_update_time = '" + Com.getDateTimeFormat(state.getLast_update_time(), Com.DTF_YMDhms) + "'" +
|
| | | " WHERE lock_id = " + inf.getLock_id();
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 当平台锁具模式未配置时返回-1
|
| | | * 返回0-离线模式 1-在线模式
|
| | | * @param pool
|
| | | * @return
|
| | | */
|
| | | public static int querySystemLockMode(MysqlConnPool pool) {
|
| | | int sys_model = -1;
|
| | | String sql_str_sel = "SELECT plate_model FROM " + Sql_Mysql.Plate_Info_Table;
|
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
| | | ResultSet res = null;
|
| | | try {
|
| | | res = sql.sqlMysqlQuery(sql_str_sel);
|
| | | if(res.next()) {
|
| | | sys_model = res.getInt("plate_model");
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | sql.logger.error(e.toString(),e);
|
| | | } finally {
|
| | | if(null != res) {
|
| | | try {
|
| | | res.close();
|
| | | } catch (SQLException e) {
|
| | | sql.logger.error(e.toString(),e);
|
| | | }
|
| | | }
|
| | | sql.close_con();
|
| | | }
|
| | | return sys_model;
|
| | | }
|
| | | |
| | | /**
|
| | | * 插入远程开锁失败记录
|
| | | */
|
| | |
| | |
|
| | | public class ElectLock_ComBase {
|
| | |
|
| | | |
| | | public static final int Lock_Model_OffLine = 0; //离线模式
|
| | | public static final int Lock_Model_OnLine = 1; //在线模式
|
| | | |
| | | |
| | | public static final int CMD_Fail = -1; //失败
|
| | |
|
| | | public static final int CMD_ClearIdCard = 0x10; //清空所有授权卡
|
| | |
| | | public static final int LOCK_SET_ADDR_ADDR = 0; //设置设备地址
|
| | | public static final int LOCK_Add_ID_AUTH_ADDR = 1; //授权ID卡地址
|
| | | public static final int LOCK_Clear_ID_AUTH_ADDR = 3; //取消授权ID卡地址
|
| | | public static final int LOCK_SET_Model_ADDR = 5; //设置锁具工作模式
|
| | |
|
| | |
|
| | | public static final int RegCount_Sigle = 1; //单点控制时点位
|
| | |
| | |
|
| | |
|
| | | // public static int Reg_Count_Real = 8; //寄存器数量
|
| | | public static int Reg_Count_Real = 11; //寄存器数量
|
| | | // public static int Reg_Count_Real = 11; //寄存器数量
|
| | | public static int Reg_Count_Real = 12; //寄存器数量
|
| | |
|
| | | private Date record_time = new Date(0); //'更新时间',
|
| | | private String gprs_sn; //'gprs模块SN码',
|
| | |
| | | private int op_cmd; //'控制命令',
|
| | | private int id_card_set; //'授权ID卡号',
|
| | | private int lock_addr_set; //'设置设备地址[慎用]',
|
| | | private int workmodel; //工作模式【0-离线模式 1-在线模式】
|
| | |
|
| | | private int lock_online; //锁具在线状态[0-离线 1-在线]
|
| | |
|
| | |
| | | for(int k =0;k<mac_addr.length;k++) {
|
| | | mac_addr[k] = ComBase.changeByteToInt(buffer.get());
|
| | | }
|
| | | workmodel = ComBase.changeShortToInt(buffer.getShort()); |
| | |
|
| | | // System.out.println("BlutoothMAC:" + getLockMacAddr());
|
| | |
|
| | |
| | | }
|
| | |
|
| | |
|
| | | public int getWorkmodel() {
|
| | | return workmodel;
|
| | | }
|
| | |
|
| | |
|
| | | public void setWorkmodel(int workmodel) {
|
| | | this.workmodel = workmodel;
|
| | | }
|
| | |
|
| | |
|
| | | public int getMax_id_count() {
|
| | | return max_id_count;
|
| | | }
|
| | |
| | | public static final String Lock_Rt_Table = DB_LOCK_RAM + ".tb_lock_rt";
|
| | | public static final String Lock_Ctl_Log_Table = DB_LOCK_RAM + ".tb_lock_ctl_log";
|
| | | public static final String Lock_Report_Table = DB_LOCK_RAM + ".tb_lock_report"; //锁具开锁次数统计表
|
| | | public static final String Plate_Info_Table = DB_LOCK_RAM + ".tb_plate_info"; //平台锁具模式设定表
|
| | | /*********************************************************/
|
| | | /*************** ************ db_area ******************************/
|
| | | public static final String Lock_Inf_Table = DB_AREA + ".tb_lock_inf";
|
| | |
| | | 设备ID:10000001
|
| | |
|
| | |
|
| | | V1.111 edit by lijun 2025-03-13
|
| | | 1.新增锁具工作模式读取
|
| | | 2.新增根据平台锁具模式设置当前所有锁具的模式
|
| | | |
| | | V1.110 edit by lijun 2025-01-20
|
| | | 1.新增锁具告警记录功能
|
| | | 2.记录每年月季度的开锁次数,以及每年锁具状态变化记录-已完成
|