LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發(fā)文檔 其他文檔  
 
網(wǎng)站管理員

中控考勤機二次開發(fā)小記

admin
2017年11月10日 9:0 本文熱度 7605

上圖

讀取考勤數(shù)據(jù)代碼 :


axCZKEM1.EnableDevice(iMachineNumber, false);//disable the device
                if (axCZKEM1.ReadGeneralLogData(iMachineNumber))
//讀取所有考勤數(shù)據(jù)到內(nèi)存緩存
                {
                    while (axCZKEM1.SSR_GetGeneralLogData(iMachineNumber, out sdwEnrollNumber, out idwVerifyMode,
                               out idwInOutMode, out idwYear, out idwMonth, out idwDay, out idwHour, out idwMinute, out idwSecond, ref idwWorkcode))
//從內(nèi)存緩存取得所有的考勤記錄數(shù)據(jù)
                    {
                         
                        iGLCount++;
                        lv_kq.Items.Add(iGLCount.ToString());
                        lv_kq.Items[iIndex].SubItems.Add(sdwEnrollNumber);//modify by Darcy on Nov.26 2009
                        lv_kq.Items[iIndex].SubItems.Add(idwVerifyMode.ToString());
                        lv_kq.Items[iIndex].SubItems.Add(idwInOutMode.ToString());
//這里有點悲劇,中控SDK提供的API讀取時間是int類型的,如果時間01,05等以0開頭的時間或分鐘,會變成單個0,或單個1.如:2017-08-31 12:01:09 會變成:2017-08-31 12:1:9 很難看,所以需要在此轉(zhuǎn)換。
                        if (idwMinute < 10)
                        {
                            strMinute = "0" + idwMinute.ToString();
 
                        }
                        else { strMinute = idwMinute.ToString(); }
                        if (idwSecond < 10)
                        {
 
                            strSecond = "0" + idwSecond.ToString();
                        }
                        else { strSecond = idwSecond.ToString(); }
 
                        if(idwHour<10){
                         
                        strHour="0"+idwHour.ToString();
                         
                        }else{
                         
                            strHour=idwHour.ToString();
                         
                        }
 
                        lv_kq.Items[iIndex].SubItems.Add(idwYear.ToString() + "-" + idwMonth.ToString() + "-" + idwDay.ToString() + " " + strHour + ":" + strMinute + ":" + strSecond);
                        lv_kq.Items[iIndex].SubItems.Add(idwWorkcode.ToString());
                        iIndex++;
                    }
                }
                else
                {
                    Cursor = Cursors.Default;
                    axCZKEM1.GetLastError(ref idwErrorCode);
 
                    if (idwErrorCode != 0)
                    {
                        MessageBox.Show("Reading data from terminal failed,ErrorCode: " + idwErrorCode.ToString(), "Error");
                    }
                    else
                    {
                        MessageBox.Show("No data from terminal returns!", "Error");
                    }
                }
                axCZKEM1.EnableDevice(iMachineNumber, true);//enable the device
                Cursor = Cursors.Default;
 
//讀取用戶數(shù)據(jù)
 
 axCZKEM1.EnableDevice(iMachineNumber, false);
                Cursor = Cursors.WaitCursor;
 
                axCZKEM1.ReadAllUserID(iMachineNumber);
//讀取所有卡機上的用戶信息到內(nèi)存緩存
                axCZKEM1.ReadAllTemplate(iMachineNumber);
//讀取所有的指紋模板到內(nèi)存緩存
                while (axCZKEM1.SSR_GetAllUserInfo(iMachineNumber, out sdwEnrollNumber, out sName, out sPassword, out iPrivilege, out bEnabled))//get all the users'' information from the memory
                {
 
                    for (idwFingerIndex = 0; idwFingerIndex < 10; idwFingerIndex++)
                    {
                        if (axCZKEM1.SSR_GetUserTmpStr(iMachineNumber, sdwEnrollNumber, idwFingerIndex, out sTmpData, out iTmpLength))
 
                        {
 
                            ListViewItem list = new ListViewItem();
 
                            list.Text = iSn.ToString();
                            list.SubItems.Add(sdwEnrollNumber);
                            list.SubItems.Add(sName);
                            list.SubItems.Add(idwFingerIndex.ToString());
                            list.SubItems.Add(sTmpData);
                            list.SubItems.Add(iPrivilege.ToString());
                            list.SubItems.Add(sPassword);
                            if (bEnabled == true)
                            {
                                list.SubItems.Add("true");
                            }
                            else
                            {
                                list.SubItems.Add("false");
                            }
                            list.SubItems.Add(iFlag.ToString());
                            lv_finger.Items.Add(list);
                        }
                       
                    }
                    iSn++;
                }
                lv_finger.EndUpdate();
                axCZKEM1.EnableDevice(iMachineNumber, true);
                Cursor = Cursors.Default;
            }
 
            CardConn.DisConn();
 
 
//連接中控考勤機,通過IP
 
 private void conn_card(string ip, string port)
        {
            //string ip = "", port = "";
 
            if (ip == "" || port == "")
            {
                MessageBox.Show("IP地址或端口不能為空", "錯誤");
                return;
            }
            int idwErrorCode = 0;
 
            Cursor = Cursors.WaitCursor;
            bIsConnected = axCZKEM1.Connect_Net(ip.Trim(), Convert.ToInt32(port.Trim()));
 
            if (bIsConnected == true)
            {
 
                //status_lbl.Text = "當(dāng)前狀態(tài):連接成功。";
                iMachineNumber = 1;
//In fact,when you are using the tcp/ip communication,this parameter will be ignored,that is any integer will all right.Here we use 1.
                axCZKEM1.RegEvent(iMachineNumber, 65535);
//在這里注冊卡機的實時事件使用65535參數(shù)注冊的是全部)
            }
            else
            {
                axCZKEM1.GetLastError(ref idwErrorCode);
                MessageBox.Show("不能連接到此設(shè)置,錯誤碼=" + idwErrorCode.ToString(), "Error");
            }
            Cursor = Cursors.Default;
        }

該文章在 2017/11/10 9:00:52 編輯過
關(guān)鍵字查詢
相關(guān)文章
正在查詢...
點晴ERP是一款針對中小制造業(yè)的專業(yè)生產(chǎn)管理軟件系統(tǒng),系統(tǒng)成熟度和易用性得到了國內(nèi)大量中小企業(yè)的青睞。
點晴PMS碼頭管理系統(tǒng)主要針對港口碼頭集裝箱與散貨日常運作、調(diào)度、堆場、車隊、財務(wù)費用、相關(guān)報表等業(yè)務(wù)管理,結(jié)合碼頭的業(yè)務(wù)特點,圍繞調(diào)度、堆場作業(yè)而開發(fā)的。集技術(shù)的先進(jìn)性、管理的有效性于一體,是物流碼頭及其他港口類企業(yè)的高效ERP管理信息系統(tǒng)。
點晴WMS倉儲管理系統(tǒng)提供了貨物產(chǎn)品管理,銷售管理,采購管理,倉儲管理,倉庫管理,保質(zhì)期管理,貨位管理,庫位管理,生產(chǎn)管理,WMS管理系統(tǒng),標(biāo)簽打印,條形碼,二維碼管理,批號管理軟件。
點晴免費OA是一款軟件和通用服務(wù)都免費,不限功能、不限時間、不限用戶的免費OA協(xié)同辦公管理系統(tǒng)。
Copyright 2010-2025 ClickSun All Rights Reserved

黄频国产免费高清视频,久久不卡精品中文字幕一区,激情五月天AV电影在线观看,欧美国产韩国日本一区二区
亚洲区一区二区三AV | 亚洲性爱免费观看视频 | 亚洲国产综合精品蜜芽 | 亚洲一区二区中文字幕无 | 日韩一区二区三区四区五 | 亚洲欧美视频在线播放 |