/// <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); }
/// <summary> /// 排队 微信接口使用 /// </summary> /// <param name="selectBusy"></param> /// <param name="selectUnit"></param> /// <param name="ticketStart"></param> /// <param name="idCard"></param> /// <param name="name"></param> /// <param name="app"></param> /// <returns></returns> public TQueueModel QueueLine(string unitSeq, string unitName, string busiSeq, string busiName, string ticketStart, string idCard, string name, string wxId, TAppointmentModel app) { TQueueModel qModel = null; try { LockAction.Run(LockKey.Queue, () => { var maxNo = new TLineUpMaxNoDAL(this.db).GetModelList().Where(l => l.unitSeq == unitSeq && l.busiSeq == busiSeq).FirstOrDefault(); int ticketNo = maxNo == null ? 1 : maxNo.lineDate.Date != DateTime.Now.Date ? 1 : maxNo.maxNo + 1; TQueueModel line = new TQueueModel(); line.busTypeName = busiName; line.busTypeSeq = busiSeq; line.qNumber = ticketNo.ToString(); line.state = 0; line.ticketNumber = ticketStart + ticketNo.ToString("000"); line.ticketTime = DateTime.Now; line.unitName = unitName; line.unitSeq = unitSeq; line.vipLever = ""; line.windowName = ""; line.windowNumber = ""; line.idCard = idCard; line.qNmae = name; line.sysFlag = 0; line.wxId = wxId; line.qType = 1; if (app != null) { line.appType = app.appType; line.reserveSeq = app.reserveSeq; line.reserveStartTime = app.reserveStartTime; line.reserveEndTime = app.reserveEndTime; line.type = app.type; } line = this.Insert(line); if (maxNo == null) { maxNo = new TLineUpMaxNoModel(); maxNo.areaSeq = ""; maxNo.busiSeq = busiSeq; maxNo.lineDate = DateTime.Now; maxNo.maxNo = 1; maxNo.unitSeq = unitSeq; maxNo.sysFlag = 0; new TLineUpMaxNoDAL(this.db).Insert(maxNo); } else { if (maxNo.lineDate.Date != DateTime.Now.Date) { maxNo.maxNo = 1; } else { maxNo.maxNo = maxNo.maxNo + 1; } maxNo.lineDate = DateTime.Now; maxNo.sysFlag = 1; new TLineUpMaxNoDAL(this.db).Update(maxNo); } qModel = line; }); } catch { return(null); } return(qModel); }
public ArrayList UploadUnitAndBusy(List <TUnitModel> uList, List <TBusinessModel> bList) { ArrayList arr = null; try { LockAction.Run(LockKey.Upload, () => { var businessList = new TBusinessDAL().GetModelList(); var unitList = new TUnitDAL().GetModelList(); var serchBlist = new List <TBusinessModel>(); //循环接口返回的部门,按照部门获取到业务类型 var insertBlist = new List <TBusinessModel>(); //筛选获取到的业务类型。把需要添加的列表整理出来 var inserUlist = new List <TUnitModel>(); var busyBll = new TBusinessDAL(this.db); foreach (var uSeq in uList) { var unitBusy = bList.Where(b => b.unitSeq == uSeq.unitSeq && b.unitName == uSeq.unitName).ToList(); if (unitBusy != null) { serchBlist.AddRange(unitBusy); } var unit = unitList.Where(b => b.unitSeq == uSeq.unitSeq && b.unitName == uSeq.unitName); if (unit.Count() == 0) { inserUlist.Add(uSeq); } //else // uSeq.orderNum = unit.FirstOrDefault().orderNum; } foreach (var i in serchBlist) { if (businessList.Where(b => b.unitSeq == i.unitSeq && b.unitName == i.unitName && b.busiSeq == i.busiSeq && b.busiName == i.busiName).Count() == 0) { insertBlist.Add(i); } } var deleteBusy = new List <TBusinessModel>(); var deleteUnit = new List <TUnitModel>(); foreach (var busy in businessList) { if (bList.Where(b => b.unitSeq == busy.unitSeq && b.unitName == busy.unitName && b.busiSeq == busy.busiSeq && b.busiName == busy.busiName).Count() == 0) { deleteBusy.Add(busy); } } foreach (var unit in unitList) { if (uList.Where(u => u.unitSeq == unit.unitSeq && u.unitName == unit.unitName).Count() == 0) { deleteUnit.Add(unit); } } foreach (var u in inserUlist) { this.Insert(u); } foreach (var d in deleteUnit) { this.Delete(d); } foreach (var i in insertBlist) { busyBll.Insert(i); } foreach (var d in deleteBusy) { busyBll.Delete(d); } arr = new ArrayList(); arr.Add(uList.OrderBy(o => o.orderNum).ToList()); arr.Add(serchBlist); }); return(arr); } catch (Exception ex) { return(arr); } }
/// <summary> /// 叫号 * 加入绿色通道插队 /// </summary> /// <param name="wlBusy"></param> /// <param name="gwlBusy"></param> /// <param name="windowNumber"></param> /// <param name="windowUser"></param> /// <returns></returns> public TCallModel CallNo(List <TWindowBusinessModel> wlBusy, List <TWindowBusinessModel> gwlBusy, string windowNumber, string windowUser) { TCallModel tcModel = null; try { LockAction.Run(LockKey.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; TQueueModel line = null; var lineGreen = db.Query <TQueueModel>().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 lineFirst = db.Query <TQueueModel>().Where(q => busyList.Contains(q.busTypeSeq) && unitList.Contains(q.unitSeq) && q.state == 0 && q.ticketTime.Date == date.Date && ( (q.appType == 1 && q.type == 0 && q.reserveStartTime <= date && q.reserveEndTime >= date) || q.type == 1)).OrderBy(o => o.id).FirstOrDefault(); if (lineFirst == null) { var lineQueue = db.Query <TQueueModel>().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 = lineFirst; } } else { line = lineGreen; } line.state = 1; line.sysFlag = 1; new TQueueDAL(this.db).Update(line); var call = new TCallModel(); 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; call.sysFlag = 0; var ret = this.Insert(call); tcModel = ret; }); } catch { return(null); } return(tcModel); }
/// <summary> /// 排队 /// </summary> /// <param name="selectBusy"></param> /// <param name="selectUnit"></param> /// <param name="ticketStart"></param> /// <param name="idCard"></param> /// <param name="name"></param> /// <param name="app"></param> /// <returns></returns> public BQueueModel QueueLine(TBusinessModel selectBusy, TUnitModel selectUnit, string ticketStart, string idCard, string name) { BQueueModel qModel = null; try { LockAction.Run(FLockKey.Queue, () => { var dal = new BLineUpMaxNoDAL(this.db, this.areaNo); var maxNo = dal.GetModelList().Where(a => a.AreaNo == this.areaNo).Where(l => l.unitSeq == selectUnit.unitSeq && l.busiSeq == selectBusy.busiSeq).FirstOrDefault(); int ticketNo = maxNo == null ? 1 : maxNo.lineDate.Date != DateTime.Now.Date ? 1 : maxNo.maxNo + 1; BQueueModel line = new BQueueModel(); line.ID = this.GetMaxId(); line.AreaNo = this.areaNo; line.busTypeName = selectBusy.busiName; line.busTypeSeq = selectBusy.busiSeq; line.qNumber = ticketNo.ToString(); line.state = 0; line.ticketNumber = ticketStart + ticketNo.ToString("000"); line.ticketTime = DateTime.Now; line.unitName = selectUnit.unitName; line.unitSeq = selectUnit.unitSeq; line.vipLever = ""; line.windowName = ""; line.windowNumber = ""; line.idCard = idCard; line.qNmae = name; line.qType = 0; line = this.Insert(line); if (maxNo == null) { maxNo = new BLineUpMaxNoModel(); maxNo.ID = dal.GetMaxId(); maxNo.AreaNo = this.areaNo; maxNo.areaSeq = ""; maxNo.busiSeq = selectBusy.busiSeq; maxNo.lineDate = DateTime.Now; maxNo.maxNo = 1; maxNo.unitSeq = selectUnit.unitSeq; dal.Insert(maxNo); } else { if (maxNo.lineDate.Date != DateTime.Now.Date) { maxNo.maxNo = 1; } else { maxNo.maxNo = maxNo.maxNo + 1; } maxNo.lineDate = DateTime.Now; dal.Update(maxNo); } qModel = line; }); } catch { return(null); } return(qModel); }