/// <summary> /// 巡检押金读卡器,有新的卡号就显示押金 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tmReader_Tick(object sender, EventArgs e) { if (this.cmdCard == null) return; string cardnum = this.cmdCard.CardNum; string portname = string.Empty; if (this.cmdCard.Targetwr != null) { portname = this.cmdCard.Targetwr.PortName + ":" + "3"; error[portname] = string.IsNullOrEmpty(this.cmdCard.StateResponse) ? "通讯正常" : this.cmdCard.StateResponse; } if (string.IsNullOrEmpty(this.devNumOut) || cardnum == this.cardNoFirst) return; if ("结束" == this.State || "模式对话" == this.State) return; this.cardNoFirst = cardnum; if (string.IsNullOrEmpty(cardnum)) return; NameObjectList pm = new NameObjectList(); pm["卡号"] = cardnum; DataTable tab = this.Query.getTable("获得卡信息", pm); if (null == tab || tab.Rows.Count < 1) return; //根据数据库初始化tag信息 string tag = ""; DataRow dr = tab.Rows[0]; foreach (DataColumn c in tab.Columns) tag = basefun.setvaltag(tag, "{" + c.ColumnName + "}", Convert.ToString(dr[c])); string dtparkin = basefun.valtag(tag, "{入场时间}"); //补充识别车牌号码及收费金额 string cardtype = basefun.valtag(tag, "{卡类}"); string dtNow = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); DataTable dtDev = this.Query.getTable("设备列表", this.paramSystem); if (string.IsNullOrEmpty(dtparkin)) tag = basefun.setvaltag(tag, "{识别车牌号码}", basefun.valtag(this.CarNumberInfoIn, "{车牌号码}")); else { // 抓拍图片并上传服务器 string filepath = "", filedest = ""; if (videoFlag > 0) { int videonum = 1; string imgkey = "出场图片"; // filepath = CutVideo(videonum, p_out2); if (dtDev.Rows.Count > 2) { DataTable yjDev = this.Query.getTable("押金设备", this.paramSystem); if (yjDev.Rows.Count < 1) return; filepath = Video(2, false, Convert.ToInt16(yjDev.Rows[0]["通讯站址"].ToString())); } else { filepath = CutVideo(videonum, 0 == videonum ? p_in2 : p_out2); } if (!string.IsNullOrEmpty(filepath)) filedest = filepath.ToLower().Substring(filepath.IndexOf("image")); tag = basefun.setvaltag(tag, imgkey, filedest); } SendImage(filepath, filedest, ""); tag = basefun.setvaltag(tag, "{识别车牌号码}", basefun.valtag(this.CarNumberInfoOut, "{车牌号码}")); tag = basefun.setvaltag(tag, "{出场时间}", dtNow); tag = basefun.setvaltag(tag, "{出入场时间}", dtNow); if ("3" != cardtype) { string responseFormat = CmdExecute("停车场", "计算收费金额", tag, this.devNumOut, true); if (string.IsNullOrEmpty(responseFormat)) return; tag = basefun.setvaltag(tag, "{收费金额}", basefun.valtag(responseFormat, "{收费金额}")); } else tag = basefun.setvaltag(tag, "{收费金额}", "0"); } //模式对话,当前卡信息 DialogResult rsl = DialogResult.Yes; tag = SendSound(tag, dtNow, dtparkin, cardtype, false); this.Pause(true); FrmTempTotalMoeny win = new FrmTempTotalMoeny(); NameObjectList info = new NameObjectList(); string oper = BindManager.getUser().UserAccounts; tag = basefun.setvaltag(tag, "操作员", oper); win.DataTag = tag; win.Query = this.Query; rsl = win.ShowDialog(); tag = win.DataTag; this.Pause(false); if (DialogResult.Yes != rsl && DialogResult.OK != rsl) { this.Pause(true); CmdExecute("停车场", "删除一条停车记录", tag, this.devNumIn); this.Pause(false); this.InOutParkRecord(tag, "出场管理"); RefreshParkInfo(); return; } string ps = tag; string strts = "0"; if (!string.IsNullOrEmpty(dtparkin)) { TimeSpan ts = Convert.ToDateTime(dtNow) - Convert.ToDateTime(dtparkin); strts = Convert.ToInt32(ts.Days * 24 * 60 + ts.Hours * 60 + ts.Minutes).ToString(); } tag = SendSound(tag, dtNow, dtparkin, cardtype, true); this.Pause(true); CmdExecute("停车场", "删除一条停车记录", tag, this.devNumIn); this.Pause(false); this.InOutParkRecord(tag, "出场管理"); RefreshParkInfo(); }
/// <summary> /// Ѳ��Ѻ�������,���µĿ��ž���ʾѺ�� /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tmReader_Tick(object sender, EventArgs e) { if (this.cmdCard == null) return; string cardnum = this.cmdCard.CardNum; string portname = string.Empty; if (this.cmdCard.Targetwr != null) { portname = this.cmdCard.Targetwr.PortName + ":" + "3"; error[portname] = string.IsNullOrEmpty(this.cmdCard.StateResponse) ? "ͨѶ����" : this.cmdCard.StateResponse; } if (string.IsNullOrEmpty(this.devNumOut) || cardnum == this.cardNoFirst) return; if ("����" == tagData || "ģʽ�Ի�" == tagData ) return; this.cardNoFirst = cardnum; if (string.IsNullOrEmpty(cardnum)) return; NameObjectList pm = new NameObjectList(); pm["����"] = cardnum; DataTable tab = this.Query.getTable("��ÿ���Ϣ", pm); if (null == tab || tab.Rows.Count < 1) return; //�������ݿ��ʼ��tag��Ϣ string tag = ""; DataRow dr = tab.Rows[0]; foreach (DataColumn c in tab.Columns) tag = basefun.setvaltag(tag, "{" + c.ColumnName + "}", Convert.ToString(dr[c])); string dtparkin = basefun.valtag(tag, "{�볡ʱ��}"); //����ʶ���ƺ��뼰�շѽ�� string cardtype = basefun.valtag(tag, "{����}"); string dtNow = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (string.IsNullOrEmpty(dtparkin)) tag = basefun.setvaltag(tag, "{ʶ���ƺ���}", basefun.valtag(this.CarNumberInfoIn, "{���ƺ���}")); else { // ץ��ͼƬ���ϴ������� string filepath = "", filedest = ""; if (videoFlag > 0) { int videonum = 1; string imgkey = "����ͼƬ"; filepath = CutVideo(videonum, p_out2); if (!string.IsNullOrEmpty(filepath)) filedest = filepath.ToLower().Substring(filepath.IndexOf("image")); tag = basefun.setvaltag(tag, imgkey, filedest); } SendImage(filepath, filedest); tag = basefun.setvaltag(tag, "{ʶ���ƺ���}", basefun.valtag(this.CarNumberInfoOut, "{���ƺ���}")); tag = basefun.setvaltag(tag, "{����ʱ��}", dtNow); tag = basefun.setvaltag(tag, "{���볡ʱ��}", dtNow); if ("3" != cardtype) { string responseFormat = CmdExecute("ͣ����", "�����շѽ��", tag, this.devNumOut, true); if (string.IsNullOrEmpty(responseFormat)) return; tag = basefun.setvaltag(tag, "{�շѽ��}", basefun.valtag(responseFormat, "{�շѽ��}")); } else tag = basefun.setvaltag(tag, "{�շѽ��}", "0"); } //û�г���ʶ��ϵͳʱ����֮ǰ����ij���ʶ�����ȡ���ÿ� if (videoFlag != 2) tag = basefun.setvaltag(tag, "{ʶ���ƺ���}", ""); //ģʽ�Ի�����ǰ����Ϣ DialogResult rsl = DialogResult.Yes; tag = SendSound(tag, dtNow, dtparkin, cardtype, false); this.Pause(true); FrmTempTotalMoeny win = new FrmTempTotalMoeny(); NameObjectList info = new NameObjectList(); string oper = BindManager.getUser().UserAccounts; tag = basefun.setvaltag(tag, "����Ա", oper); win.DataTag = tag; win.Query = this.Query; rsl = win.ShowDialog(); tag = win.DataTag; this.Pause(false); if (DialogResult.Yes != rsl && DialogResult.OK != rsl) { CmdExecute("ͣ����", "ɾ��һ��ͣ����¼", tag, this.devNumIn); this.InOutParkRecord(tag, "��������"); RefreshParkInfo(); return; } string ps = tag; string strts = "0"; if (!string.IsNullOrEmpty(dtparkin)) { TimeSpan ts = Convert.ToDateTime(dtNow) - Convert.ToDateTime(dtparkin); strts = Convert.ToInt32(ts.Days * 24 * 60 + ts.Hours * 60 + ts.Minutes).ToString(); } tag = SendSound(tag, dtNow, dtparkin, cardtype, true); CmdExecute("ͣ����", "ɾ��һ��ͣ����¼", tag, this.devNumIn); this.InOutParkRecord(tag, "��������"); RefreshParkInfo(); }