/// <summary> /// 叫号 * 有绿色通道插队 /// </summary> /// <param name="wlBusy"></param> /// <param name="gwlBusy"></param> /// <param name="windowNumber"></param> /// <param name="windowUser"></param> /// <returns></returns> public BCallModel CallNo(List <TWindowBusinessModel> wlBusy, List <TWindowBusinessModel> gwlBusy, string windowNumber, string windowUser) { BCallModel tcModel = null; try { LockAction.Run(FLockKey.Call, () => { if (gwlBusy == null) { gwlBusy = new List <TWindowBusinessModel>(); } var busyList = wlBusy.Select(w => w.busiSeq).ToList(); var unitList = wlBusy.Select(w => w.unitSeq).ToList(); var gbList = gwlBusy.Select(w => w.busiSeq).ToList(); var guList = gwlBusy.Select(w => w.unitSeq).ToList(); var date = DateTime.Now; BQueueModel line = null; var lineGreen = db.Query <BQueueModel>().Where(a => a.AreaNo == this.areaNo).Where(q => gbList.Contains(q.busTypeSeq) && guList.Contains(q.unitSeq) && q.state == 0 && q.ticketTime.Date == date.Date).OrderBy(o => o.ID).FirstOrDefault(); if (lineGreen == null) { var lineQueue = db.Query <BQueueModel>().Where(a => a.AreaNo == this.areaNo).Where(q => busyList.Contains(q.busTypeSeq) && unitList.Contains(q.unitSeq) && q.state == 0 && q.ticketTime.Date == date.Date).OrderBy(o => o.ID).ToList();//取到当天 窗口业务排队队列 line = lineQueue.FirstOrDefault(); if (line == null) { return; } } else { line = lineGreen; } line.state = 1; new BQueueDAL(this.db, this.areaNo).Update(line); var call = new BCallModel(); call.ID = this.GetMaxId(); call.AreaNo = this.areaNo; call.busiSeq = line.busTypeSeq; call.handleId = DateTime.Now.ToString("yyyyMMddHHmmss"); call.handleTime = DateTime.Now; call.idCard = line.idCard; call.qId = line.ID; call.qNmae = line.qNmae; call.reserveSeq = line.reserveSeq; call.state = 0; call.ticketNumber = line.ticketNumber; call.ticketTime = line.ticketTime; call.unitSeq = line.unitSeq; call.windowNumber = windowNumber; call.windowUser = windowUser; var ret = this.Insert(call); tcModel = ret; }); } catch { return(null); } return(tcModel); }
public void Print(BQueueModel model, string area, int wait) { var open = TxOpenPrinter(0, 0); var state = TxGetStatus2(); TxInit(); //初始化 TxDoFunction(TX_FEED, 15, 0); //走纸,留空行 15毫米 TxDoFunction(TX_HOR_POS, 15, 0); //距离左边15毫米 TxDoFunction(TX_FONT_SIZE, TX_SIZE_3X, TX_SIZE_2X); //设置标题字体大小 TxOutputStringLn("阳江市票务大厅排队叫号系统"); TxDoFunction(TX_FONT_SIZE, TX_SIZE_1X, TX_SIZE_1X); //设置字体 TxOutputStringLn("排队区域:" + area); TxOutputStringLn("排队部门:" + model.unitName); TxOutputStringLn("排队业务:" + model.busTypeName); TxOutputString("当前号码:"); TxDoFunction(TX_FONT_BOLD, TX_ON, 0); //使用粗体 TxDoFunction(TX_FONT_SIZE, TX_SIZE_3X, TX_SIZE_3X); //设置字体 TxOutputStringLn(model.ticketNumber); TxDoFunction(TX_FONT_SIZE, TX_SIZE_1X, TX_SIZE_1X); //设置字体 TxDoFunction(TX_FONT_BOLD, TX_OFF, 0); //关闭粗体 TxOutputStringLn(string.Format("你前面还有 {0} 人在等待。", wait.ToString())); TxOutputStringLn("请在休息区等候,注意呼叫及大屏显示信息。"); TxOutputStringLn("过号无效,请您重新取号。"); TxOutputStringLn(string.Format(" {0} ", DateTime.Now)); TxDoFunction(TX_CUT, TX_CUT_PARTIAL, 5);//切纸,切纸前 走纸5毫米 TxClosePrinter(); }
//获取业务属性类型 string GetVipLever(BQueueModel model) { var isGreen = ""; var att = baList.Where(b => b.unitSeq == model.unitSeq && b.busiSeq == model.busTypeSeq).FirstOrDefault(); if (att != null) { isGreen = att.isGreenChannel == 1 ? "绿色通道" : ""; } if (model.appType == 1 && model.type == 0 && model.reserveEndTime >= DateTime.Now && isGreen == "") { isGreen = "网上预约"; } else if (model.type == 1 && isGreen == "") { isGreen = "网上申办"; } return(isGreen); }
//组织票数据 * 暂时不用了 private DataTable GetQueue(BQueueModel model, string area, string windowStr, int wait, string vip) { DataTable table = new DataTable("table"); table.Columns.AddRange(new DataColumn[] { new DataColumn("id", typeof(string)), new DataColumn("area", typeof(string)), new DataColumn("windowStr", typeof(string)), new DataColumn("waitCount", typeof(string)), new DataColumn("unitSeq", typeof(string)), new DataColumn("busySeq", typeof(string)), new DataColumn("unitName", typeof(string)), new DataColumn("busyName", typeof(string)), new DataColumn("ticketNumber", typeof(string)), new DataColumn("cardId", typeof(string)), new DataColumn("reserveSeq", typeof(string)), new DataColumn("vip", typeof(string)), }); DataRow row = table.NewRow(); row["id"] = model.ID; row["area"] = area; row["windowStr"] = windowStr; row["waitCount"] = wait.ToString(); row["unitSeq"] = model.unitSeq; row["busySeq"] = model.busTypeSeq; row["unitName"] = model.unitName; row["busyName"] = model.busTypeName; row["ticketNumber"] = model.ticketNumber; row["cardId"] = string.IsNullOrEmpty(model.idCard) ? "" : model.idCard.Length > 6 ? model.idCard.Substring(model.idCard.Length - 6, 6) : model.idCard; row["reserveSeq"] = model.reserveSeq; row["vip"] = vip; table.Rows.Add(row); return(table); }
private void BindData() { List <msInfo> mList = new List <msInfo>(); #region 正式数据 var vList = new List <BCallModel>(); try { vList = cBll.ScreenShowByArea(areaList).Take(rowCount).ToList(); ShowError = false; } catch (Exception ex) { WriterLog("获取大屏显示数据异常,方法[ScreenShowByArea],错误原因:" + ex.Message); ShowError = (isShowError == 0 ? false : true); } int i = 0; Font vipFont = new Font(fontName, VIPFontSize, FontStyle.Bold); Font msgFont = new Font(fontName, fontSize, FontStyle.Bold); if (vList == null || vList.Count == 0) { this.pnMain.Controls.Clear(); this.pnMain.ResumeLayout(); return; } #region foreach (var v in vList) { var bam = baList.Where(b => b.busiSeq == v.busiSeq && b.unitSeq == v.unitSeq).FirstOrDefault(); BQueueModel queue = null; try { queue = qBll.GetModel(q => q.ID == v.qId); } catch (Exception ex) { WriterLog("获取排队数据异常,方法[GetModel],错误原因:" + ex.Message); } string strVip = ""; if (bam != null && bam.isGreenChannel == 1) { strVip = "绿色\r\n通道"; } else { if ((queue != null && queue.type == 0 && queue.appType == 1 && queue.reserveStartTime <= v.handleTime && queue.reserveEndTime >= v.handleTime)) { strVip = "网上\r\n预约"; } else if (queue != null && queue.type == 1) { strVip = "网上\r\n申办"; } } msInfo ms = new msInfo(); ms.Index = (i + 1); ms.RowHeight = rowHeight; ms.TextFont = msgFont; ms.WindowColor = window; ms.TicketColor = ticket; ms.VIPColor = vipColor; ms.VIPFont = vipFont; ms.VIPText = strVip; ms.OtherColor = other; ms.WindowNumber = v.windowNumber; ms.QueueNumber = v.ticketNumber; ms.msClick += ms_Click; if (i % 2 != 0) { ms.BackColorPage = blue; } else { ms.BackColorPage = gray; } mList.Add(ms); i++; } #endregion #endregion if (pnMain.Controls.Count == 0) { int t = 0; foreach (var ms in mList) { ms.Location = new Point(0, t); this.pnMain.Controls.Add(ms); t += ms.Height; } pnMain.ResumeLayout(); } else { var deleteControl = new List <Control>(); int jCount = pnMain.Controls.Count; for (int j = 0; j < jCount; j++) { if ((j + 1) <= mList.Count) { var ctl = pnMain.Controls[j] as msInfo; ctl.WindowNumber = mList[j].WindowNumber; ctl.QueueNumber = mList[j].QueueNumber; ctl.VIPText = mList[j].VIPText; ctl.Refresh(); ctl.Invalidate(); } else { deleteControl.Add(pnMain.Controls[j]); } } foreach (var con in deleteControl) { pnMain.Controls.Remove(con); } pnMain.Refresh(); pnMain.Invalidate(); pnMain.ResumeLayout(); int tCount = pnMain.Controls.Count; if (tCount < mList.Count) { int t = (pnMain.Controls[0] as msInfo).Height * pnMain.Controls.Count; for (int m = 0; m < mList.Count - tCount; m++) { var ms = mList[m + tCount]; ms.Location = new Point(0, t); this.pnMain.Controls.Add(ms); t += ms.Height; } pnMain.Refresh(); pnMain.Invalidate(); pnMain.ResumeLayout(); } } }
/// <summary> /// 叫号 * 有绿色通道插队 /// </summary> /// <param name="wlBusy"></param> /// <param name="gwlBusy"></param> /// <param name="windowNumber"></param> /// <param name="windowUser"></param> /// <returns></returns> public BCallModel CallNo(List <TWindowBusinessModel> wlBusy, List <TWindowBusinessModel> gwlBusy, string windowNumber, string windowUser) { BCallModel tcModel = null; try { lock (lockObj) { db.Session.BeginTransaction(System.Data.IsolationLevel.ReadCommitted); if (gwlBusy == null) { gwlBusy = new List <TWindowBusinessModel>(); } var busyList = wlBusy.Select(w => w.busiSeq).ToList(); var unitList = wlBusy.Select(w => w.unitSeq).ToList(); var gbList = gwlBusy.Select(w => w.busiSeq).ToList(); var guList = gwlBusy.Select(w => w.unitSeq).ToList(); var date = DateTime.Now; BQueueModel line = null; var lineGreen = db.Query <BQueueModel>().Where(a => a.AreaNo == this.areaNo).Where(q => gbList.Contains(q.busTypeSeq) && guList.Contains(q.unitSeq) && q.state == 0 && q.ticketTime.Date == date.Date).OrderBy(o => o.ID).FirstOrDefault(); if (lineGreen == null) { var lineQueue = db.Query <BQueueModel>().Where(a => a.AreaNo == this.areaNo).Where(q => busyList.Contains(q.busTypeSeq) && unitList.Contains(q.unitSeq) && q.state == 0 && q.ticketTime.Date == date.Date).OrderBy(o => o.ID).ToList();//取到当天 窗口业务排队队列 line = lineQueue.FirstOrDefault(); if (line == null) { return(null); } } else { line = lineGreen; } line.state = 1; new BQueueDAL(this.db, this.areaNo).Update(line); var call = new BCallModel(); call.ID = this.GetMaxId(); call.AreaNo = this.areaNo; call.busiSeq = line.busTypeSeq; call.handleId = DateTime.Now.ToString("yyyyMMddHHmmssfff"); call.handleTime = DateTime.Now; call.idCard = line.idCard; call.qId = line.ID; call.qNmae = line.qNmae; call.reserveSeq = line.reserveSeq; call.state = 0; call.ticketNumber = line.ticketNumber; call.ticketTime = line.ticketTime; call.unitSeq = line.unitSeq; call.windowNumber = windowNumber; call.windowUser = windowUser; call.finishTime = DateTime.MinValue; var ret = this.Insert(call); tcModel = ret; db.Session.CommitTransaction(); } } catch { db.Session.RollbackTransaction(); return(null); } finally { db.Session.Dispose(); } return(tcModel); }