//暂停 private void Pause() { lock (objLock) { LockAction.RunWindowLock(windowNo, () => { stateModel = csBll.GetModelByWindowNo(windowNo); if (stateModel == null) { stateModel = new FCallStateModel(); stateModel.windowNo = windowNo; stateModel.workState = (int)WorkState.Defalt; csBll.Insert(stateModel); } if (stateModel.workState != (int)WorkState.PauseService) { string mess = windowNo + "号窗口暂停服务"; this.client.SendMessage(new OperateMessage() { WindowNo = windowNo, Operate = Operate.Pause }); this.Invoke(new Action(() => { this.listView1.Items.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff") + " : " + mess); })); stateModel.pauseState = stateModel.workState; stateModel.workState = (int)WorkState.PauseService; csBll.Update(stateModel); WriterCallLog(0, mess); } }); } }
//呼叫*顺呼 private void CallNo() { lock (objLock) { LockAction.RunWindowLock(windowNo, () => { stateModel = csBll.GetModelByWindowNo(windowNo); if (stateModel == null) { stateModel = new FCallStateModel(); stateModel.windowNo = windowNo; stateModel.workState = (int)WorkState.Defalt; csBll.Insert(stateModel); } if (stateModel.workState == (int)WorkState.PauseService) { this.client.SendMessage(new OperateMessage() { WindowNo = windowNo, Operate = Operate.Reset }); stateModel.workState = stateModel.pauseState; csBll.Update(stateModel); } if (stateModel.workState == (int)WorkState.Defalt || stateModel.workState == (int)WorkState.Evaluate) { try { var model = cBll.CallNo(windowBusys, windowBusyGreens, windowNo, userId); if (model != null) { stateModel.callId = model.ID; var callString = "请" + model.ticketNumber + "号到 " + windowNo + "号窗口办理 "; client.SendMessage(new CallMessage() { TicketNo = model.ticketNumber, WindowNo = windowNo, AreaNo = windowModel.AreaName.ToString(), IsLEDMessage = true, IsSoundMessage = true }); client.SendMessage(new WeChatMessage() { ID = model.qId.ToString() }); stateModel.workState = (int)WorkState.Call; stateModel.ticketNo = model.ticketNumber; stateModel.callId = model.ID; stateModel.reCallTimes = 0; csBll.Update(stateModel); this.Invoke(new Action(() => { this.listView1.Items.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff") + " : " + callString); })); //SendTicket(adress, model.ticketNumber.Substring(model.ticketNumber.Length - 3, 3)); WriterCallLog(0, callString); } } catch (Exception ex) { WriterLog("叫号异常:" + ex.Message); } } }); } }
//回呼 private void CallBack() { lock (objLock) { LockAction.RunWindowLock(windowNo, () => { stateModel = csBll.GetModel(windowNo); if (stateModel == null) { return; } if (stateModel.workState == (int)WorkState.PauseService) { this.client.SendMessage(new OperateMessage() { WindowNo = windowNo, Operate = Operate.Reset }); stateModel.workState = stateModel.pauseState; csBll.Update(stateModel); } if (stateModel.workState == (int)WorkState.Defalt || stateModel.workState == (int)WorkState.Evaluate) { var model = cBll.GetModel(stateModel.hangId); if (model == null) { return; } else { if (model.ticketTime.Date != DateTime.Now.Date) { stateModel.hangId = 0; csBll.Update(stateModel); return; } } model.state = 0; model.sysFlag = 1; cBll.Update(model); var callString = model.ticketNumber + "号回呼"; client.SendMessage(new CallMessage() { TicketNo = model.ticketNumber, WindowNo = windowNo, AreaNo = windowModel.AreaName.ToString(), IsLEDMessage = true, IsSoundMessage = true }); this.Invoke(new Action(() => { this.listView1.Items.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff") + " : " + callString); })); //SendTicket(adress, wHang[adress].ticketNumber.Substring(wHang[adress].ticketNumber.Length - 3, 3)); stateModel.workState = (int)WorkState.Call; stateModel.ticketNo = model.ticketNumber; stateModel.callId = model.id; stateModel.reCallTimes = 0; stateModel.hangId = 0; csBll.Update(stateModel); WriterCallLog(7, callString); } }); } }
//弃号 private void GiveUpNo() { lock (objLock) { LockAction.RunWindowLock(windowNo, () => { stateModel = csBll.GetModel(windowNo); if (stateModel == null) { return; } if (stateModel.workState == (int)WorkState.PauseService) { this.client.SendMessage(new OperateMessage() { WindowNo = windowNo, Operate = Operate.Reset }); stateModel.workState = stateModel.pauseState; csBll.Update(stateModel); } if (stateModel.workState == (int)WorkState.Call) { try { var model = cBll.GetModel(stateModel.callId); if (model == null) { return; } string mess = model.ticketNumber + "号已弃号。"; model.state = -1; model.sysFlag = 1; cBll.Update(model); stateModel.workState = (int)WorkState.Evaluate; stateModel.callId = 0; stateModel.ticketNo = ""; csBll.Update(stateModel); this.Invoke(new Action(() => { this.listView1.Items.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff") + " : " + mess); })); this.client.SendMessage(new OperateMessage() { WindowNo = windowNo, Operate = Operate.Reset }); //SendWait(adress); WriterCallLog(4, mess); } catch (Exception ex) { WriterLog("弃号异常:" + ex.Message); } } }); } }
//转移-丢回去 private void Transfer() { lock (objLock) { LockAction.RunWindowLock(windowNo, () => { stateModel = csBll.GetModelByWindowNo(windowNo); if (stateModel == null) { stateModel = new FCallStateModel(); stateModel.windowNo = windowNo; stateModel.workState = (int)WorkState.Defalt; csBll.Insert(stateModel); } if (stateModel.workState == (int)WorkState.PauseService) { this.client.SendMessage(new OperateMessage() { WindowNo = windowNo, Operate = Operate.Reset }); stateModel.workState = stateModel.pauseState; csBll.Update(stateModel); } if (stateModel.workState == (int)WorkState.Call) { var model = cBll.GetModel(stateModel.callId); if (model == null) { return; } //转移号码 cBll.Transfer(model); this.client.SendMessage(new OperateMessage() { WindowNo = windowNo, Operate = Operate.Reset }); var callString = model.ticketNumber + "号已转移(重置) "; this.Invoke(new Action(() => { this.listView1.Items.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff") + " : " + callString); })); //SendWait(adress); stateModel.workState = (int)WorkState.Defalt; stateModel.callId = 0; stateModel.ticketNo = ""; stateModel.reCallTimes = 0; csBll.Update(stateModel); WriterCallLog(5, callString); } }); } }
//重呼 private void ReCallNo() { lock (objLock) { LockAction.RunWindowLock(windowNo, () => { stateModel = csBll.GetModelByWindowNo(windowNo); if (stateModel == null) { return; } if (stateModel.workState == (int)WorkState.PauseService) { this.client.SendMessage(new OperateMessage() { WindowNo = windowNo, Operate = Operate.Reset }); stateModel.workState = stateModel.pauseState; csBll.Update(stateModel); } if (stateModel.workState == (int)WorkState.Call) { var model = cBll.GetModel(stateModel.callId); if (model == null) { return; } if (stateModel.reCallTimes >= 5) { return; } else { stateModel.reCallTimes = stateModel.reCallTimes + 1; csBll.Update(stateModel); } var callString = "请" + model.ticketNumber + "号到 " + windowNo + "号窗口办理(重呼) "; client.SendMessage(new CallMessage() { TicketNo = model.ticketNumber, WindowNo = windowNo, AreaNo = windowModel.AreaName.ToString(), IsLEDMessage = true, IsSoundMessage = true }); this.Invoke(new Action(() => { this.listView1.Items.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff") + " : " + callString); })); //SendTicket(adress, wModel[adress].ticketNumber.Substring(wModel[adress].ticketNumber.Length - 3, 3)); WriterCallLog(1, callString); } }); } }
//评价 private void EvaluateService() { lock (objLock) { LockAction.RunWindowLock(windowNo, () => { stateModel = csBll.GetModelByWindowNo(windowNo); if (stateModel == null) { stateModel = new FCallStateModel(); stateModel.windowNo = windowNo; stateModel.workState = (int)WorkState.Defalt; csBll.Insert(stateModel); } if (stateModel.workState == (int)WorkState.PauseService) { this.client.SendMessage(new OperateMessage() { WindowNo = windowNo, Operate = Operate.Reset }); stateModel.workState = stateModel.pauseState; csBll.Update(stateModel); } if (stateModel.workState == (int)WorkState.Call) { try { var model = cBll.GetModel(stateModel.callId); if (model == null) { return; } model.state = 1; cBll.Update(model); stateModel.workState = (int)WorkState.Evaluate; //stateModel.callId = 0; stateModel.ticketNo = ""; csBll.Update(stateModel); client.SendMessage(new RateMessage() //发送评价请求 { WindowNo = windowNo, RateId = model.handleId, ItemName = "项目名称", WorkDate = DateTime.Now.ToShortDateString(), Transactor = model.qNmae, reserveSeq = model.reserveSeq } ); //SendWait(adress); string mess = " [" + model.ticketNumber + "]号已评价。"; this.Invoke(new Action(() => { this.listView1.Items.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff") + " : [" + model.ticketNumber + "]号已评价。"); })); WriterCallLog(2, mess); } catch (Exception ex) { WriterLog("评价异常:" + ex.Message); } } else { if (stateModel.workState == (int)WorkState.Defalt || stateModel.workState == (int)WorkState.Evaluate) { //SendWait(adress); } } }); } }