コード例 #1
0
        /// <summary>
        /// 处理进出场数据,并抓拍图像
        /// </summary>
        /// <param name="tag">出入场数据</param>
        /// <param name="display">判断是否显示刷卡数据信息</param>
        private void ExecuteInOut(string tag, bool display)
        {
            string station = basefun.valtag(tag, "{设备地址}");
            string cardnum = basefun.valtag(tag, "{卡号}");
            string cardtype = string.Empty;
            cardtype = basefun.valtag(tag, "卡类");
            if (string.IsNullOrEmpty(cardtype))
                cardtype = basefun.valtag(tag, "{卡类}");
            string dtparkin = basefun.valtag(tag, "{入场时间}");
            string dtparkout = basefun.valtag(tag, "{出入场时间}");
            string openmode = basefun.valtag(tag, "{开闸方式}");
            if (string.IsNullOrEmpty(cardnum))
                return;

            DataTable dtDev = this.Query.getTable("设备列表", this.paramSystem);
            #region 抓拍图片并上传服务器
            string filepath = "", filedest = "";
            if (videoFlag > 0)
            {
                int videonum = 1;
                string imgkey = "出场图片";
                if (dtparkin == dtparkout)
                {
                    videonum = 0;
                    imgkey = "入场图片";
                }
                bool flag = false;
                if (Convert.ToInt16(station) > 128)
                {
                    flag = false;
                    string cardno = basefun.valtag(tag, "{卡号}");
                    string time = basefun.valtag(tag, "{入场时间}");
                    string inParkPicFilepath = GetInParkPicFilePath(cardno, time);
                    DisplayPic(p_in2, inParkPicFilepath);
                }
                else
                {
                    flag = true;
                }

                string strTwoInTwoOut = System.Configuration.ConfigurationManager.AppSettings["TwoInTwoOut"].ToString();
                if (dtDev.Rows.Count > 2 && strTwoInTwoOut == "1")
                {
                    filepath = Video(2, flag, Convert.ToInt16(station));
                }
                else
                {
                    filepath = CutVideo(videonum, 0 == videonum ? p_in2 : p_out2);
                }
                if (!string.IsNullOrEmpty(filepath))
                {
                    //Billy
                    //filedest = filepath.ToLower().Substring(filepath.IndexOf("image"));
                    filedest = filepath;
                }
                tag = basefun.setvaltag(tag, imgkey, filedest);
            }
            // Autosave(basefun.valtag(tag,"{入场图片}"));

            SendImage(filepath, filedest, cardnum);
            #endregion

            //不同类别卡做出入场业务处理
            //1,无识别车牌,则模式对话输入
            //2,出场识别车牌与入场车牌不一致,则模式对话输入
            //3,临时卡入场识别车牌后直接开闸
            //4,储值卡车牌对比后再校验卡片余额
            //5,期卡车牌对比后直接开闸

            //储值卡已经入场再入场提示,未入场刷出场时提示
            if ("9" == cardtype)
            {
                int addr = Convert.ToInt32(station);
                string tipsound = "";
                if (addr < 128 && dtparkin != dtparkout)
                    tipsound = "0C";
                else if (addr >= 128 && dtparkin == dtparkout)
                    tipsound = "2A";

                // 0C此卡已入场,2A此卡已出场
                if (!string.IsNullOrEmpty(tipsound))
                {
                    string tagsound = string.Empty;
                    tagsound = basefun.setvaltag(tagsound, "{道闸命令}", "00");
                    tagsound = basefun.setvaltag(tagsound, "{语音命令}", tipsound);
                    CmdExecute("停车场", "屏显语音道闸", tagsound, station);
                    return;
                }
            }
            //出场时,首先计算临时卡和储值卡收费金额
            if ("9" == cardtype && dtparkin != dtparkout)
            {
                if (string.IsNullOrEmpty(dtparkout))
                {
                    dtparkout = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    tag = basefun.setvaltag(tag, "{出入场时间}", dtparkout);
                }
                tag = basefun.setvaltag(tag, "{出场时间}", dtparkout);
                string rsponseFormat = CmdExecute("停车场", "计算收费金额", tag, station, true);
                tag = basefun.setvaltag(tag, "{收费金额}", basefun.valtag(rsponseFormat, "{收费金额}"));
            }

            //识别车牌不一致,或临时卡时模式对话
            string carnum = basefun.valtag(tag, "{车牌号码}");
            string caravt = basefun.valtag(tag, "{识别车牌号码}");
            string strmoney = basefun.valtag(tag, "{卡片余额}");
            string strpay = basefun.valtag(tag, "{收费金额}");
            bool isDialog = false;
            if ("44" == openmode || string.IsNullOrEmpty(openmode) || cardtype == "7")
                isDialog = this.IsDialogInOut(cardtype, dtparkin, dtparkout, carnum, caravt, strmoney, strpay);
            //模式对话处理业务
            DialogResult rsl = DialogResult.Yes;
            if (isDialog)
            {
                this.Pause(true);
                if (Convert.ToInt16(station) >= 129)
                {

                    TimeSpan ts = Convert.ToDateTime(dtparkout) - Convert.ToDateTime(dtparkin);
                    string t = ts.Days + "天" + ts.Hours + "时" + ts.Minutes + "分" + ts.Seconds + "秒";
                    tag = basefun.setvaltag(tag, "{停车时长}", t);
                    FrmFee win = new FrmFee();
                    tag = basefun.setvaltag(tag, "操作员", BindManager.getUser().UserAccounts);
                    win.DataTag = tag;
                    win.Query = this.Query;
                    rsl = win.ShowDialog();
                    tag = win.DataTag;
                }
                this.Pause(false);
            }
            else
            {
                if (cardtype == "5")
                    tag = basefun.setvaltag(tag, "{车牌号码}", basefun.valtag(tag, "{识别车牌号码}"));
            }
            string db = dtparkin == dtparkout ? "入场管理" : "出场管理";
            //不开闸,临时卡和期卡删除下位机记录
            if (DialogResult.Yes != rsl && DialogResult.OK != rsl)
            {
                this.setContainerTagValue(this.grpInfoM, tag, "pm");
                this.InOutParkRecord(tag, db);
                RefreshParkInfo();
                this.Pause(true);
                CmdExecute("停车场", "删除一条停车记录", tag, station);
                this.Pause(false);
                CardMoney = string.Empty;
                return;
            }
            string ps = tag;
            string strts = "0";
            if (dtparkin != dtparkout)
            {
                TimeSpan ts = Convert.ToDateTime(dtparkout) - Convert.ToDateTime(dtparkin);
                strts = Convert.ToInt32(ts.Days * 24 * 60 + ts.Hours * 60 + ts.Minutes).ToString();
            }
            string[,] map ={ { "{道闸命令}", "02" }, { "{收费额}", "{收费金额}" }, { "{余额}", "{卡片余额}" }, { "{停车时长}", strts } };
            for (int i = 0; i < map.GetLength(0); i++)
            {
                if (map[i, 1].StartsWith("{"))
                    tag = basefun.setvaltag(tag, map[i, 0], basefun.valtag(tag, map[i, 1]));
                else
                    tag = basefun.setvaltag(tag, map[i, 0], map[i, 1]);
            }

            tag = basefun.setvaltag(tag, "{语音命令}", this.SoundCmd(cardtype, dtparkin, dtparkout));

            this.Pause(true);
            if (Convert.ToInt16(station) >= 129 && cardtype != "3" && cardtype != "4" && cardtype != "6" && cardtype != "8")
            {
                CmdExecute("停车场", "屏显语音道闸", tag, station);
            }
            this.Pause(false);
            TimeSpan tc = Convert.ToDateTime(dtparkout) - Convert.ToDateTime(dtparkin);
            string tt = tc.Days + "天" + tc.Hours + "时" + tc.Minutes + "分" + tc.Seconds + "秒";
            tag = basefun.setvaltag(tag, "{停车时长}", tt);
            this.setContainerTagValue(this.grpInfoM, tag, "pm");
            this.InOutParkRecord(tag, db);
            RefreshParkInfo();
        }
コード例 #2
0
        /// <summary>
        /// ������������ݣ���ץ��ͼ��
        /// </summary>
        /// <param name="tag">���볡����</param>
        /// <param name="display">�ж��Ƿ���ʾˢ��������Ϣ</param>
        private void ExecuteInOut(string tag, bool display)
        {
            string station = basefun.valtag(tag, "{�豸��ַ}");
            string cardnum = basefun.valtag(tag, "{����}");
            string cardtype = string.Empty;
            cardtype = basefun.valtag(tag, "����");
            if(string.IsNullOrEmpty(  cardtype))
                cardtype = basefun.valtag(tag, "{����}");
            string dtparkin = basefun.valtag(tag, "{�볡ʱ��}");
            string dtparkout = basefun.valtag(tag, "{���볡ʱ��}");
            string openmode = basefun.valtag(tag, "{��բ��ʽ}");
            if (string.IsNullOrEmpty(cardnum))
                return;

            #region ץ��ͼƬ���ϴ�������
            string filepath = "", filedest = "";
            if (videoFlag > 0)
            {
                int videonum = 1;
                string imgkey = "����ͼƬ";
                if (dtparkin == dtparkout)
                {
                    videonum = 0;
                    imgkey = "�볡ͼƬ";
                }
                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);
            #endregion

            //��ͬ��������볡ҵ����
            //1,��ʶ���ƣ���ģʽ�Ի�����
            //2,����ʶ�������볡���Ʋ�һ�£���ģʽ�Ի�����
            //3,��ʱ���볡ʶ���ƺ�ֱ�ӿ�բ
            //4,��ֵ�����ƶԱȺ���У�鿨Ƭ���
            //5,�ڿ����ƶԱȺ�ֱ�ӿ�բ

            //��ֵ���Ѿ��볡���볡��ʾ��δ�볡ˢ����ʱ��ʾ
            if ("9" == cardtype)
            {
                int addr = Convert.ToInt32(station);
                string tipsound = "";
                if (addr < 128 && dtparkin != dtparkout)
                    tipsound = "0C";
                else if (addr >= 128 && dtparkin == dtparkout)
                    tipsound = "2A";

                // 0C�˿����볡��2A�˿��ѳ���
                if (!string.IsNullOrEmpty(tipsound))
                {
                    string tagsound = string.Empty;
                    tagsound = basefun.setvaltag(tagsound, "{��բ����}", "00");
                    tagsound = basefun.setvaltag(tagsound, "{��������}", tipsound);
                    CmdExecute("ͣ����", "���������բ", tagsound, station);
                    return;
                }
            }
            //����ʱ�����ȼ�����ʱ���ʹ�ֵ���շѽ��
            if ("9" == cardtype && dtparkin != dtparkout)
            {
                if (string.IsNullOrEmpty(dtparkout))
                {
                    dtparkout = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    tag = basefun.setvaltag(tag, "{���볡ʱ��}", dtparkout);
                }
                tag = basefun.setvaltag(tag, "{����ʱ��}", dtparkout);
                string rsponseFormat = CmdExecute("ͣ����", "�����շѽ��", tag, station, true);
                tag = basefun.setvaltag(tag, "{�շѽ��}", basefun.valtag(rsponseFormat, "{�շѽ��}"));
            }
            //ʶ���Ʋ�һ�£�����ʱ��ʱģʽ�Ի�
            string carnum = basefun.valtag(tag, "{���ƺ���}");
            string caravt=string.Empty ;
            if (videoFlag == 2)
                caravt = basefun.valtag(tag, "{ʶ���ƺ���}");
            string strmoney = basefun.valtag(tag, "{��Ƭ���}");
            string strpay = basefun.valtag(tag, "{�շѽ��}");
            bool isDialog = false;
            if ("44" == openmode || string.IsNullOrEmpty(openmode))
            {
                if (videoFlag == 2)
                    isDialog = this.IsDialogInOut(cardtype, dtparkin, dtparkout, carnum, caravt, strmoney, strpay);
                else
                    isDialog = this.IsDialogInOut(cardtype, dtparkin, dtparkout, strmoney, strpay);
            }
            //ģʽ�Ի�����ҵ��
            DialogResult rsl = DialogResult.Yes;
            if (isDialog)
            {
                this.Pause(true);
                if (dtparkin == dtparkout)
                {
                    FrmCarNo inPark = new FrmCarNo();
                    inPark.tagDate = tag;
                    rsl = inPark.ShowDialog();
                    tag = inPark.tagDate;
                    if (videoFlag == 2)
                        tag = basefun.setvaltag(tag, "{���ƺ���}", basefun.valtag(inPark.tagDate, "�����������"));
                }
                else
                {
                    FrmFee win = new FrmFee();
                    tag = basefun.setvaltag(tag, "����Ա", BindManager.getUser().UserAccounts);
                    win.DataTag = tag;
                    win.Query = this.Query;
                    rsl = win.ShowDialog();
                    tag = win.DataTag;
                }
                this.Pause(false);
            }
            else
            {
                if (cardtype == "5" && videoFlag == 2)
                    tag = basefun.setvaltag(tag, "{���ƺ���}", basefun.valtag(tag, "{ʶ���ƺ���}"));
            }
            string db = dtparkin == dtparkout ? "�볡����" : "��������";
            //����բ����ʱ�����ڿ�ɾ����λ����¼
            if (DialogResult.Yes != rsl && DialogResult.OK != rsl)
            {
                this.setContainerTagValue(this.grpInfoM, tag, "pm");
                this.InOutParkRecord(tag, db);
                RefreshParkInfo();
                CmdExecute("ͣ����", "ɾ��һ��ͣ����¼", tag, station);
                CardMoney = string.Empty;
                return;
            }
            string ps = tag;
            string strts = "0";
            if (dtparkin != dtparkout)
            {
                TimeSpan ts = Convert.ToDateTime(dtparkout) - Convert.ToDateTime(dtparkin);
                strts = Convert.ToInt32(ts.Days * 24 * 60 + ts.Hours * 60 + ts.Minutes).ToString();
            }
            string[,] map ={ { "{��բ����}", "02" }, { "{�շѶ�}", "{�շѽ��}" }, { "{���}", "{��Ƭ���}" }, { "{ͣ��ʱ��}", strts } };
            for (int i = 0; i < map.GetLength(0); i++)
            {
                if (map[i, 1].StartsWith("{"))
                    tag = basefun.setvaltag(tag, map[i, 0], basefun.valtag(tag, map[i, 1]));
                else
                    tag = basefun.setvaltag(tag, map[i, 0], map[i, 1]);
            }
            tag = basefun.setvaltag(tag, "{��������}", this.SoundCmd(cardtype, dtparkin, dtparkout));
            this.Pause(true);
            CmdExecute("ͣ����", "���������բ", tag, station);
            this.Pause(false);
            this.setContainerTagValue(this.grpInfoM, tag, "pm");
            this.InOutParkRecord(tag, db);
            RefreshParkInfo();
        }