地铁二期项目正式开始

CallRecordController.cs 74KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806
  1. using CallCenter.Utility;
  2. using Newtonsoft.Json;
  3. using Newtonsoft.Json.Linq;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Web;
  11. using System.Web.Mvc;
  12. using YTSoft.BaseCallCenter.Model;
  13. using YTSoft.BaseCallCenter.MVCWeb.Commons;
  14. using YTSoft.BaseCallCenter.MVCWeb.Models;
  15. using YTSoft.Common;
  16. using YTSoft.DBUtility;
  17. namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
  18. {
  19. public class CallRecordController : BaseController
  20. {
  21. //工单信息
  22. BLL.T_Wo_WorkOrderBase orderBLL = new BLL.T_Wo_WorkOrderBase();
  23. //客户信息
  24. BLL.T_Cus_CustomerBase cusBLL = new BLL.T_Cus_CustomerBase();
  25. //部门表
  26. BLL.T_Sys_Department deptBll = new BLL.T_Sys_Department();
  27. //用户表
  28. BLL.T_Sys_UserAccount userBll = new BLL.T_Sys_UserAccount();
  29. //通话记录
  30. BLL.T_Call_CallRecords recordBLL = new BLL.T_Call_CallRecords();
  31. #region 来电弹屏信息
  32. /// <summary>
  33. /// 来电弹屏页面
  34. /// </summary>
  35. /// <param name="workOrderNum">工单编号</param>
  36. /// <returns></returns>
  37. public ActionResult CallScreen(string workOrderNum)
  38. {
  39. //workOrderNum = "12";
  40. //实例化基础信息表
  41. CallScreenModel callScreenModel = new CallScreenModel();
  42. //获取业务工单信息
  43. if (!string.IsNullOrEmpty(workOrderNum))
  44. {
  45. callScreenModel.WorkOrderBaseModel = orderBLL.GetModel(int.Parse(workOrderNum.ToString()));
  46. if (callScreenModel.WorkOrderBaseModel==null)
  47. {
  48. callScreenModel.WorkOrderBaseModel = new Model.T_Wo_WorkOrderBase()
  49. {
  50. CustomerBaseModel = new T_Cus_CustomerBase { F_CustomerId = 0 },
  51. F_WORKORDERID = 0
  52. };
  53. }
  54. //如果电话号码不为空
  55. if (callScreenModel.WorkOrderBaseModel != null && !string.IsNullOrEmpty(callScreenModel.WorkOrderBaseModel.F_CUSTOMERTELEPHONE))
  56. {
  57. //获取客户基本信息
  58. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = cusBLL.GetCusInfoModel(callScreenModel.WorkOrderBaseModel.F_CUSTOMERTELEPHONE);
  59. }
  60. if (callScreenModel.WorkOrderBaseModel != null && !string.IsNullOrEmpty(callScreenModel.WorkOrderBaseModel.F_KSHADDRESSCODE))
  61. {
  62. Model.T_Call_CallRecords callRecordModel = recordBLL.GetModelByCallId(callScreenModel.WorkOrderBaseModel.F_KSHADDRESSCODE);
  63. if (callRecordModel != null)
  64. {
  65. if (callRecordModel.BusinessType != null)
  66. {
  67. //业务选择按键
  68. callScreenModel.SelectBussType = int.Parse(callRecordModel.BusinessType.ToString());
  69. }
  70. else
  71. {
  72. callScreenModel.SelectBussType =1;
  73. }
  74. }
  75. }
  76. }
  77. callScreenModel.WorkOrderTypeModelList = GetWorkTypeModelList();//业务类型字典表
  78. //获取处理年龄段字典表
  79. callScreenModel.AgeModelList = GetCodeType("NLD");
  80. return View(callScreenModel);
  81. }
  82. /// <summary>
  83. /// 业务工单录入页面
  84. /// </summary>
  85. /// <param name="workOrderNum">工单编号</param>
  86. /// <param name="flowid">业务类型</param>
  87. /// <returns></returns>
  88. public ActionResult CallWorkFolw(string workOrderNum, int? flowid)
  89. {
  90. //实例化基础信息表
  91. CallScreenModel callScreenModel = new CallScreenModel();
  92. //选择的业务类型
  93. if (flowid != null && flowid > 0)
  94. {
  95. callScreenModel.Flowid = flowid;
  96. }
  97. else
  98. {
  99. callScreenModel.Flowid = 0;
  100. }
  101. //获取业务工单信息
  102. if (!string.IsNullOrEmpty(workOrderNum))
  103. {
  104. callScreenModel.WorkOrderBaseModel = orderBLL.GetModel(int.Parse(workOrderNum.ToString()));
  105. if (callScreenModel.WorkOrderBaseModel == null)
  106. {
  107. callScreenModel.WorkOrderBaseModel = new Model.T_Wo_WorkOrderBase()
  108. {
  109. CustomerBaseModel = new T_Cus_CustomerBase { F_CustomerId = 0 },
  110. F_WORKORDERID = 0
  111. };
  112. }
  113. //如果电话号码不为空
  114. if (callScreenModel.WorkOrderBaseModel != null && !string.IsNullOrEmpty(callScreenModel.WorkOrderBaseModel.F_CUSTOMERTELEPHONE))
  115. {
  116. T_Cus_CustomerBase baseCusModel = cusBLL.GetCusInfoModel(callScreenModel.WorkOrderBaseModel.F_CUSTOMERTELEPHONE);
  117. if (baseCusModel != null && baseCusModel.F_CustomerId > 0)
  118. {
  119. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = baseCusModel;
  120. }
  121. else
  122. {
  123. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  124. callScreenModel.WorkOrderBaseModel.CustomerBaseModel.F_CustomerName = callScreenModel.WorkOrderBaseModel.F_CUSTOMERNAME;
  125. }
  126. //选择的业务类型
  127. if (flowid != null && flowid > 0)
  128. {
  129. callScreenModel.BussnessContnet = GetTypeContenet(int.Parse(flowid.ToString()), callScreenModel.WorkOrderBaseModel.F_CREATEDATE.ToString());
  130. }
  131. }
  132. else
  133. {
  134. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  135. callScreenModel.WorkOrderBaseModel.CustomerBaseModel.F_CustomerName = callScreenModel.WorkOrderBaseModel.F_CUSTOMERNAME;
  136. }
  137. //获取客户基本信息
  138. }
  139. //业务类型字典表
  140. callScreenModel.WorkOrderTypeModelList = GetWorkTypeModelList();
  141. //获取处理方式字典表
  142. callScreenModel.GoTypeModelList = GetCodeType("CLFS");
  143. //获取处理年龄段字典表
  144. callScreenModel.AgeModelList = GetCodeType("NLD");
  145. //获取部门列表
  146. callScreenModel.DepartmentList = deptBll.GetModelList("F_ParentId=0");
  147. callScreenModel.HistoryOrderList = historyBll.GetModelList("F_INSTANCEID=" + workOrderNum.ToInt32());
  148. return View(callScreenModel);
  149. }
  150. //历史工单表
  151. BLL.T_Wo_WorkOrderHistory historyBll = new BLL.T_Wo_WorkOrderHistory();
  152. /// <summary>
  153. /// 业务工单录入页面
  154. /// </summary>
  155. /// <param name="workOrderNum">工单编号</param>
  156. /// <param name="flowid">业务类型</param>
  157. /// <returns></returns>
  158. public ActionResult EditCallWorkFolw(string workOrderNum)
  159. {
  160. //实例化基础信息表
  161. CallScreenModel callScreenModel = new CallScreenModel();
  162. //获取业务工单信息
  163. if (!string.IsNullOrEmpty(workOrderNum))
  164. {
  165. callScreenModel.WorkOrderBaseModel = orderBLL.GetModel(int.Parse(workOrderNum.ToString()));
  166. //如果电话号码不为空
  167. if (callScreenModel.WorkOrderBaseModel != null && !string.IsNullOrEmpty(callScreenModel.WorkOrderBaseModel.F_CUSTOMERTELEPHONE))
  168. {
  169. T_Cus_CustomerBase baseCusModel = cusBLL.GetCusInfoModel(callScreenModel.WorkOrderBaseModel.F_CUSTOMERTELEPHONE);
  170. if (baseCusModel != null && baseCusModel.F_CustomerId > 0)
  171. {
  172. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = baseCusModel;
  173. }
  174. else
  175. {
  176. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  177. callScreenModel.WorkOrderBaseModel.CustomerBaseModel.F_CustomerName = callScreenModel.WorkOrderBaseModel.F_CUSTOMERNAME;
  178. }
  179. }
  180. else
  181. {
  182. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  183. callScreenModel.WorkOrderBaseModel.CustomerBaseModel.F_CustomerName = callScreenModel.WorkOrderBaseModel.F_CUSTOMERNAME;
  184. }
  185. //获取客户基本信息
  186. if (!string.IsNullOrEmpty( callScreenModel.WorkOrderBaseModel.F_EMPCODE))
  187. {
  188. T_Cus_CustomerBase baseCusModel = cusBLL.GetCusInfoModel(1,callScreenModel.WorkOrderBaseModel.F_EMPCODE);
  189. if (baseCusModel != null && baseCusModel.F_CustomerId > 0)
  190. {
  191. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = baseCusModel;
  192. }
  193. else
  194. {
  195. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  196. }
  197. }
  198. }
  199. //业务类型字典表
  200. callScreenModel.WorkOrderTypeModelList = GetWorkTypeModelList();
  201. //获取处理方式字典表
  202. callScreenModel.GoTypeModelList = GetCodeType("CLFS");
  203. //回访满意度
  204. callScreenModel.MYdModelList = GetCodeType("khyjfl");
  205. //获取处理年龄段字典表
  206. callScreenModel.AgeModelList = GetCodeType("NLD");
  207. //获取部门列表
  208. callScreenModel.DepartmentList = deptBll.GetModelList("F_ParentId=0");
  209. return View(callScreenModel);
  210. }
  211. /// <summary>
  212. /// 编辑历史工单
  213. /// </summary>
  214. /// <param name="workOrderBaseModel"></param>
  215. /// <returns></returns>
  216. [AcceptVerbs(HttpVerbs.Post)]
  217. public bool workOrderEditData(T_Wo_WorkOrderBase workOrderBaseModel)
  218. {
  219. //工单来源
  220. //workOrderBaseModel.F_REPAIRMANID = 1;
  221. //workOrderBaseModel.F_WORKORDERFROM = "语音";
  222. string F_UserCode = "";
  223. if (Request.Cookies["BaseCallCenter_T_User"] != null)
  224. {
  225. F_UserCode = Request.Cookies["BaseCallCenter_T_User"]["F_UserCode"];
  226. }
  227. string bu = "";
  228. if (workOrderBaseModel.CustomerBaseModel != null)
  229. {
  230. string linkman= DbHelperSQL.GetSingle("select F_LINKMAN from T_Wo_WorkOrderBase where F_WORKORDERID='"+
  231. workOrderBaseModel.F_WORKORDERID + "'").ToString();
  232. if (linkman.Equals(F_UserCode))
  233. {
  234. //最近联络方式
  235. if (workOrderBaseModel.F_REPAIRMANID.ToString() == "4")
  236. {
  237. workOrderBaseModel.CustomerBaseModel.F_Kind = "3";
  238. workOrderBaseModel.F_CUSTOMERTELEPHONE = workOrderBaseModel.CustomerBaseModel.F_Mobile;
  239. }
  240. else
  241. {
  242. workOrderBaseModel.CustomerBaseModel.F_Kind = workOrderBaseModel.F_REPAIRMANID.ToString();
  243. }
  244. workOrderBaseModel.CustomerBaseModel.F_CustomerNature = workOrderBaseModel.F_WORKORDERFROM;
  245. //业务类型
  246. workOrderBaseModel.CustomerBaseModel.F_IndustryId = workOrderBaseModel.F_REPAIRLEVEL;
  247. workOrderBaseModel.CustomerBaseModel.F_Url = workOrderBaseModel.F_ADSLACCOUNT;
  248. //修改客户基础信息
  249. bu += "F_Kind old is:" + workOrderBaseModel.F_REPAIRMANID.ToString() + " F_Kind new is:" + workOrderBaseModel.CustomerBaseModel.F_Kind;
  250. bu += "F_CustomerNature old is:" + workOrderBaseModel.F_WORKORDERFROM + " F_CustomerNature new is:" + workOrderBaseModel.CustomerBaseModel.F_CustomerNature;
  251. bu += "F_IndustryId old is:" + workOrderBaseModel.F_REPAIRLEVEL + " F_IndustryId new is:" + workOrderBaseModel.CustomerBaseModel.F_IndustryId;
  252. bu += "F_Url old is:" + workOrderBaseModel.F_ADSLACCOUNT + " F_Url new is:" + workOrderBaseModel.CustomerBaseModel.F_Url;
  253. int cusid = cusBLL.EditCusInfoModel(workOrderBaseModel.CustomerBaseModel);
  254. if (cusid > 0)
  255. {
  256. workOrderBaseModel.F_CUSTOMERID = cusid;
  257. }
  258. }
  259. var res= DbHelperSQL.Query("select top 1 * from T_Wo_WorkOrderBase where F_WORKORDERID='" +
  260. workOrderBaseModel.F_WORKORDERID + "'").Tables[0];
  261. for (int i = 0; i < res.Rows.Count; i++)
  262. {
  263. bu += "F_CUSTOMERTELEPHONE old is:" + res.Rows[i]["F_CUSTOMERTELEPHONE"] + " CustomerBaseModel new is:" + workOrderBaseModel.F_CUSTOMERTELEPHONE ;
  264. bu += "F_CUSTOMERID old is:" + res.Rows[i]["F_CUSTOMERID"] + " F_CUSTOMERID new is:" + workOrderBaseModel.F_CUSTOMERID;
  265. }
  266. AddLog("T_Cus_CustomerBase", "T_Cus_CustomerBase", "记录工单操作记录", bu, "操作记录");
  267. return orderBLL.UpdateHistoryWorkOrderInfoModel(workOrderBaseModel);
  268. }
  269. else
  270. {
  271. return false;
  272. }
  273. }
  274. /// <summary>
  275. /// 撤回历史工单
  276. /// </summary>
  277. /// <param name="workOrderBaseModel"></param>
  278. /// <returns></returns>
  279. [AcceptVerbs(HttpVerbs.Get)]
  280. public bool ResetWorkOrder(int workOrderId)
  281. {
  282. string F_UserCode = "";
  283. if (Request.Cookies["BaseCallCenter_T_User"] != null)
  284. {
  285. F_UserCode = Request.Cookies["BaseCallCenter_T_User"]["F_UserCode"];
  286. }
  287. string linkman = DbHelperSQL.GetSingle("select F_LINKMAN from T_Wo_WorkOrderBase where F_WORKORDERID='" +
  288. workOrderId + "'").ToString();
  289. if (linkman.Equals(F_UserCode))
  290. {
  291. bool result = false; ;
  292. string bycode = F_UserCode;
  293. string byname = F_UserName;
  294. int bmid = F_DeptId;
  295. string bmmc = "";
  296. if (F_UserID > 0)
  297. {
  298. YTSoft.BaseCallCenter.BLL.T_Sys_Department depBll = new BLL.T_Sys_Department();
  299. List<Model.T_Sys_Department> list = new List<T_Sys_Department>();
  300. list = depBll.GetModelList("F_DeptId=" + bmid);
  301. if (list.Count > 0)
  302. {
  303. bmmc = list[0].F_DeptName.ToString();
  304. result = orderBLL.ResetWorkOrder(workOrderId, F_UserID, F_UserName, F_DeptId, bmmc);
  305. }
  306. }
  307. return result;
  308. }
  309. else
  310. {
  311. return false;
  312. }
  313. }
  314. /// <summary>
  315. /// 获取业务术语模板信息
  316. /// </summary>
  317. /// <param name="bussnessType">业务类型</param>
  318. /// <returns></returns>
  319. public string GetTypeContenet(int bussnessType, string creatDateTime)
  320. {
  321. try
  322. {
  323. //模板内容
  324. string bussContent = "";
  325. if (bussnessType > 0)
  326. {
  327. if (bussnessType > 0)
  328. {
  329. BLL.T_Wo_WorkOrderType bll = new BLL.T_Wo_WorkOrderType();
  330. Model.T_Wo_WorkOrderType orderTypeModel = new T_Wo_WorkOrderType();
  331. orderTypeModel = bll.GetModel(bussnessType);
  332. if (orderTypeModel != null && !string.IsNullOrEmpty(orderTypeModel.F_Remark))
  333. {
  334. bussContent += string.Format(orderTypeModel.F_Remark, DateTime.Parse(creatDateTime).ToString("f") + "分");
  335. }
  336. }
  337. }
  338. return bussContent;
  339. }
  340. catch (Exception ex)
  341. {
  342. }
  343. return null;
  344. }
  345. /// <summary>
  346. /// 保存用户信息
  347. /// </summary>
  348. /// <param name="workOrderBaseModel"></param>
  349. /// <returns></returns>
  350. [AcceptVerbs(HttpVerbs.Post)]
  351. public bool SaveCunInfo(T_Cus_CustomerBase CustomerBaseModel)
  352. {
  353. //客户属性
  354. if (string.IsNullOrEmpty(CustomerBaseModel.F_Kind))
  355. {
  356. CustomerBaseModel.F_Kind = "1";
  357. }
  358. if (string.IsNullOrEmpty(CustomerBaseModel.F_CustomerNature))
  359. {
  360. CustomerBaseModel.F_CustomerNature = "语音";
  361. }
  362. if (CustomerBaseModel.F_CustomerId > 0)
  363. {
  364. AddAction("t_cus_customerbase", CustomerBaseModel.F_CustomerId.ToMyString(), "更新客户信息", CustomerBaseModel.F_CustomerName.ToMyString());
  365. AddAction("t_cus_customerbase", CustomerBaseModel.F_CustomerId.ToMyString(), "更新客户信息", "数据:" + JsonConvert.SerializeObject(CustomerBaseModel), "关键信息");
  366. }
  367. else
  368. {
  369. YTSoft.BaseCallCenter.Model.T_Cus_CustomerBase modelcus= cusBLL.GetCusInfoModel(CustomerBaseModel.F_Telephone);
  370. if ( modelcus.F_CustomerId>0)
  371. {
  372. }
  373. AddAction("t_cus_customerbase", CustomerBaseModel.F_Telephone, "添加客户信息", CustomerBaseModel.F_CustomerName.ToMyString());
  374. AddAction("t_cus_customerbase", CustomerBaseModel.F_Telephone, "添加客户信息","数据:"+JsonConvert.SerializeObject(CustomerBaseModel), "关键信息");
  375. }
  376. return cusBLL.UpdateCusInfoModel(CustomerBaseModel);
  377. }
  378. /// <summary>
  379. /// 获取员工信息
  380. /// </summary>
  381. /// <param name="deptId">部门id</param>
  382. /// <returns></returns>
  383. public string GetDeptUsers(string deptId)
  384. {
  385. try
  386. {
  387. return JsonConvert.SerializeObject(userBll.GetModelList("F_DeptId=" + deptId));
  388. }
  389. catch (Exception ex)
  390. {
  391. }
  392. return null;
  393. }
  394. #endregion
  395. #region 微博工单
  396. /// <summary>
  397. /// 微信微博工单录入页面
  398. /// </summary>
  399. /// <param name="workOrderNum">工单编号</param>
  400. /// <param name="flowid">业务类型</param>
  401. /// <returns></returns>
  402. public ActionResult WBWorkFlow(string workOrderNum, int? flowid)
  403. {
  404. workOrderNum = "0"; flowid = 0;
  405. //实例化基础信息表
  406. CallScreenModel callScreenModel = new CallScreenModel();
  407. //选择的业务类型
  408. if (flowid != null && flowid > 0)
  409. {
  410. callScreenModel.Flowid = flowid;
  411. }
  412. else
  413. {
  414. callScreenModel.Flowid = 0;
  415. }
  416. //业务类型字典表
  417. callScreenModel.WorkOrderTypeModelList = GetWorkTypeModelList();
  418. //获取处理方式字典表
  419. callScreenModel.GoTypeModelList = GetCodeType("CLFS");
  420. //获取处理年龄段字典表
  421. callScreenModel.AgeModelList = GetCodeType("NLD");
  422. //获取部门列表
  423. callScreenModel.DepartmentList = deptBll.GetModelList("F_ParentId=0");
  424. return View(callScreenModel);
  425. }
  426. /// <summary>
  427. /// 微信编辑
  428. /// </summary>
  429. /// <param name="webChartNum">微信号</param>
  430. /// <param name="recordId">历史记录号</param>
  431. /// <param name="recordId">工单id</param>
  432. /// <returns></returns>
  433. public ActionResult WXWorkFlowEdit(int workOrderNum)
  434. {
  435. //实例化基础信息表
  436. CallScreenModel callScreenModel = new CallScreenModel();
  437. if ( workOrderNum > 0)
  438. {
  439. callScreenModel.WorkOrderBaseModel = orderBLL.GetModel(workOrderNum);
  440. //获取业务工单信息
  441. if (!string.IsNullOrEmpty(callScreenModel.WorkOrderBaseModel.F_EMPCODE))
  442. {
  443. T_Cus_CustomerBase baseCusModel = cusBLL.GetCusInfoModel(1, callScreenModel.WorkOrderBaseModel.F_EMPCODE);
  444. if (baseCusModel != null && baseCusModel.F_CustomerId > 0)
  445. {
  446. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = baseCusModel;
  447. }
  448. else
  449. {
  450. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  451. }
  452. }
  453. else
  454. {
  455. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  456. }
  457. //业务类型字典表
  458. callScreenModel.WorkOrderTypeModelList = GetWorkTypeModelList();
  459. //获取处理方式字典表
  460. callScreenModel.GoTypeModelList = GetCodeType("CLFS");
  461. //获取处理年龄段字典表
  462. callScreenModel.AgeModelList = GetCodeType("NLD");
  463. //获取部门列表
  464. callScreenModel.DepartmentList = deptBll.GetModelList("F_ParentId=0");
  465. callScreenModel.HistoryOrderList = historyBll.GetModelList("F_INSTANCEID=" + int.Parse(workOrderNum.ToString()));
  466. return View(callScreenModel);
  467. }
  468. return View();
  469. }
  470. /// <summary>
  471. /// 微博编辑
  472. /// </summary>
  473. /// <param name="webChartNum">微信号</param>
  474. /// <param name="recordId">历史记录号</param>
  475. /// <param name="recordId">工单id</param>
  476. /// <returns></returns>
  477. public ActionResult WBWorkFlowEdit(int workOrderNum)
  478. {
  479. //实例化基础信息表
  480. CallScreenModel callScreenModel = new CallScreenModel();
  481. if (workOrderNum > 0)
  482. {
  483. callScreenModel.WorkOrderBaseModel = orderBLL.GetModel(workOrderNum);
  484. //获取业务工单信息
  485. if (!string.IsNullOrEmpty(callScreenModel.WorkOrderBaseModel.F_EMPCODE))
  486. {//1微信,2微博
  487. T_Cus_CustomerBase baseCusModel = cusBLL.GetCusInfoModel(1, callScreenModel.WorkOrderBaseModel.F_EMPCODE);
  488. if (baseCusModel != null && baseCusModel.F_CustomerId > 0)
  489. {
  490. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = baseCusModel;
  491. }
  492. else
  493. {
  494. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  495. }
  496. }
  497. else
  498. {
  499. callScreenModel.WorkOrderBaseModel.CustomerBaseModel = new T_Cus_CustomerBase();
  500. }
  501. //业务类型字典表
  502. callScreenModel.WorkOrderTypeModelList = GetWorkTypeModelList();
  503. //获取处理方式字典表
  504. callScreenModel.GoTypeModelList = GetCodeType("CLFS");
  505. //获取处理年龄段字典表
  506. callScreenModel.AgeModelList = GetCodeType("NLD");
  507. //获取部门列表
  508. callScreenModel.DepartmentList = deptBll.GetModelList("F_ParentId=0");
  509. callScreenModel.HistoryOrderList = historyBll.GetModelList("F_INSTANCEID=" + int.Parse(workOrderNum.ToString()));
  510. return View(callScreenModel);
  511. }
  512. return View();
  513. }
  514. #endregion
  515. /// <summary>
  516. /// 补录工单处理信息
  517. /// </summary>
  518. /// <param name="workOrderBaseModel"></param>
  519. /// <returns></returns>
  520. [AcceptVerbs(HttpVerbs.Post)]
  521. public bool workOrderAddData(T_Wo_WorkOrderBase workOrderBaseModel)
  522. {
  523. if (workOrderBaseModel.F_REPAIRMANID == 4)
  524. {
  525. workOrderBaseModel.F_WORKORDERFROM = "微博工单";
  526. string wbh = workOrderBaseModel.CustomerBaseModel.F_CustomerEName.ToMyString().Trim();
  527. if (!string.IsNullOrEmpty(wbh))
  528. {
  529. workOrderBaseModel.F_EMPCODE = wbh;
  530. workOrderBaseModel.CustomerBaseModel.F_PostCode = wbh;
  531. }
  532. ////客户等级
  533. workOrderBaseModel.CustomerBaseModel.F_Kind = "3";
  534. workOrderBaseModel.CustomerBaseModel.F_ScaleResume = "1";
  535. workOrderBaseModel.CustomerBaseModel.F_CustomerClass = "一般客户";
  536. }
  537. else if (workOrderBaseModel.F_REPAIRMANID == 3)
  538. {
  539. workOrderBaseModel.F_WORKORDERFROM = "微信工单";
  540. string wbh = workOrderBaseModel.CustomerBaseModel.F_CustomerEName.ToMyString().Trim();
  541. if (!string.IsNullOrEmpty(wbh))
  542. {
  543. workOrderBaseModel.F_EMPCODE = wbh;
  544. workOrderBaseModel.CustomerBaseModel.F_PostCode = wbh;
  545. }
  546. ////客户等级
  547. workOrderBaseModel.CustomerBaseModel.F_Kind = "2";
  548. workOrderBaseModel.CustomerBaseModel.F_ScaleResume = "1";
  549. workOrderBaseModel.CustomerBaseModel.F_CustomerClass = "一般客户";
  550. }
  551. workOrderBaseModel.F_USERID = F_UserID;//id
  552. workOrderBaseModel.F_LINKMAN = F_UserCode;//工号
  553. workOrderBaseModel.F_REPAIRMANNAME = F_UserName;//姓名
  554. workOrderBaseModel.F_LINKMANTELEPHONE = workOrderBaseModel.CustomerBaseModel.F_Mobile;
  555. workOrderBaseModel.F_USERNAME = F_UserName;
  556. workOrderBaseModel.F_DEPTID = F_DeptId;
  557. T_Sys_Department deptmodel = deptBll.GetModel(F_DeptId);
  558. if (deptmodel != null)
  559. {
  560. workOrderBaseModel.F_DEPTCODE = deptmodel.F_DeptName;
  561. }
  562. AddAction("T_Wo_WorkOrderBase", workOrderBaseModel.F_WORKORDERID.ToMyString(), "录入工单", "数据:"+JsonConvert.SerializeObject(workOrderBaseModel), "关键信息");
  563. if (workOrderBaseModel.F_CONTENT == null)
  564. {
  565. workOrderBaseModel.F_CONTENT = "-";
  566. }
  567. if (workOrderBaseModel.F_RETURNVISITCONTENT == null)
  568. {
  569. workOrderBaseModel.F_RETURNVISITCONTENT = "-";
  570. }
  571. if (workOrderBaseModel.CustomerBaseModel != null)
  572. {
  573. //最近联络方式
  574. if (workOrderBaseModel.F_REPAIRMANID != 4&& workOrderBaseModel.F_REPAIRMANID != 3)
  575. {
  576. workOrderBaseModel.CustomerBaseModel.F_Kind = workOrderBaseModel.F_REPAIRMANID.ToString();
  577. }
  578. workOrderBaseModel.CustomerBaseModel.F_CustomerNature = workOrderBaseModel.F_WORKORDERFROM;
  579. //业务类型
  580. workOrderBaseModel.CustomerBaseModel.F_IndustryId = workOrderBaseModel.F_REPAIRLEVEL;
  581. workOrderBaseModel.CustomerBaseModel.F_Url = workOrderBaseModel.F_ADSLACCOUNT;
  582. //修改客户基础信息
  583. int cusid = cusBLL.EditCusInfoModel(workOrderBaseModel.CustomerBaseModel);
  584. if (cusid > 1)
  585. {
  586. workOrderBaseModel.F_CUSTOMERID = cusid;
  587. }
  588. }
  589. if (workOrderBaseModel.F_WORKORDERSTATEID > 0)
  590. {
  591. workOrderBaseModel.F_CODE= orderBLL.GetOrderNumber(workOrderBaseModel.F_REPAIRLEVEL.ToInt32());
  592. if (workOrderBaseModel.F_HOUSING == "表扬" || workOrderBaseModel.F_HOUSING == "咨询" || workOrderBaseModel.F_HOUSING == "挂失")
  593. {
  594. //workOrderBaseModel.F_WORKORDERTYPEID = 3;
  595. if (workOrderBaseModel.F_WORKORDERTYPEID == 1)
  596. {
  597. if (workOrderBaseModel.HistoryOrderList != null && workOrderBaseModel.HistoryOrderList.Count > 0)
  598. {
  599. Dictionary<int, string> dict = new Dictionary<int, string>() { };
  600. for (int i = workOrderBaseModel.HistoryOrderList.Count - 1; i >= 0; i--)
  601. {
  602. T_Wo_WorkOrderHistory modelhis = workOrderBaseModel.HistoryOrderList[i];
  603. Model.T_Sys_Department model = new BLL.T_Sys_Department().GetModel(string.Format("F_DeptId=(select top 1 F_DeptId from T_Sys_UserAccount where F_UserId={0})", modelhis.F_OPTUSERID));
  604. if (model != null && model.F_DeptId > 0)
  605. {
  606. if (dict.ContainsKey(model.F_DeptId))
  607. {
  608. workOrderBaseModel.HistoryOrderList.Remove(workOrderBaseModel.HistoryOrderList[i]);
  609. continue;
  610. }
  611. modelhis.F_OPTBTNID = model.F_DeptId;
  612. modelhis.F_NEXTOWNERARRID = model.F_DeptName;
  613. dict.Add(model.F_DeptId, "1");
  614. }
  615. }
  616. }
  617. }
  618. }
  619. if (workOrderBaseModel.F_WORKORDERTYPEID == 3)
  620. {
  621. Model.T_Wo_WorkOrderHistory historyModel = new Model.T_Wo_WorkOrderHistory();
  622. historyModel.F_INSTANCEID = workOrderBaseModel.F_WORKORDERID;
  623. historyModel.F_OPTDATE = DateTime.Now;
  624. historyModel.ReplayTime = DateTime.Now;
  625. if (workOrderBaseModel.F_WORKORDERSTATEID >0)
  626. historyModel.F_WORKORDERSTATEID = (int)workOrderBaseModel.F_WORKORDERSTATEID;
  627. else
  628. historyModel.F_WORKORDERSTATEID = 1;
  629. historyModel.F_StateName = "已处理";
  630. historyModel.NeedReplayTime = workOrderBaseModel.F_REQUESTSERVICETIME;
  631. historyModel.F_OPTUSERID = F_UserID;
  632. historyModel.F_OPTBTNID = F_DeptId;
  633. historyModel.F_UserName = F_UserName;
  634. historyModel.F_REMARK = workOrderBaseModel.F_RETURNVISITCONTENT;
  635. historyModel.F_NEXTOWNERARRID = "计划经营部";
  636. workOrderBaseModel.HistoryOrderList = new List<T_Wo_WorkOrderHistory>();
  637. workOrderBaseModel.HistoryOrderList.Add(historyModel);
  638. }
  639. else
  640. {
  641. if (workOrderBaseModel.HistoryOrderList != null && workOrderBaseModel.HistoryOrderList.Count > 0)
  642. {
  643. Dictionary<int, string> dict = new Dictionary<int, string>() { };
  644. for (int i= workOrderBaseModel.HistoryOrderList.Count-1; i>=0;i--)
  645. {
  646. T_Wo_WorkOrderHistory modelhis = workOrderBaseModel.HistoryOrderList[i];
  647. if (dict.ContainsKey(modelhis.F_OPTUSERID.ToInt32()))
  648. {
  649. workOrderBaseModel.HistoryOrderList.Remove(workOrderBaseModel.HistoryOrderList[i]);
  650. continue;
  651. }
  652. new BLL.T_Com_Class().UpdateRate(F_UserCode, modelhis.F_OPTUSERID.ToInt32());
  653. Model.T_Sys_Department model= new BLL.T_Sys_Department().GetModel(string.Format("F_DeptId=(select top 1 F_DeptId from T_Sys_UserAccount where F_UserId={0})", modelhis.F_OPTUSERID));
  654. if (model != null && model.F_DeptId > 0)
  655. {
  656. modelhis.F_OPTBTNID = model.F_DeptId;
  657. modelhis.F_NEXTOWNERARRID = model.F_DeptName;
  658. }
  659. dict.Add(modelhis.F_OPTUSERID.ToInt32(), "1");
  660. }
  661. }
  662. }
  663. if (workOrderBaseModel.F_WORKORDERTYPEID == 1)
  664. {
  665. AddAction("t_wo_workorderbase", workOrderBaseModel.F_WORKORDERID.ToMyString(), "转单处理工单", workOrderBaseModel.F_CODE);
  666. }
  667. else
  668. {
  669. AddAction("t_wo_workorderbase", workOrderBaseModel.F_WORKORDERID.ToMyString(), "即时处理工单", workOrderBaseModel.F_CODE);
  670. }
  671. }
  672. else
  673. { workOrderBaseModel.F_CODE = ""; }
  674. if (workOrderBaseModel.F_WORKORDERID == 0&& (workOrderBaseModel.F_REPAIRMANID == 4|| workOrderBaseModel.F_REPAIRMANID==3))
  675. {
  676. //model.F_SERVICEWAY 记录id
  677. workOrderBaseModel.F_CREATEDATE = DateTime.Now;
  678. workOrderBaseModel.F_HASTENCOUNTS = 0;
  679. int workid = orderBLL.AddWbgd(workOrderBaseModel);
  680. if (workid == 0)
  681. {
  682. return false;
  683. }
  684. else if(workOrderBaseModel.F_REPAIRMANID == 3)
  685. {
  686. try
  687. {
  688. StringBuilder returnStr = new StringBuilder();
  689. string wxAddUrl = string.Format("http://rexian.zzmetro.com/api/customer/close/{0}/{1}", workOrderBaseModel.F_SERVICEWAY, workid);
  690. HttpHelper.HttpGet(wxAddUrl);
  691. }
  692. catch (Exception ex)
  693. {
  694. }
  695. }
  696. workOrderBaseModel.F_WORKORDERID = workid;
  697. }
  698. return orderBLL.UpdateWorkOrderInfoModel(workOrderBaseModel);
  699. }
  700. /// <summary>
  701. /// 来电弹屏处理工单 新增工单
  702. /// </summary>
  703. /// <param name="workOrderBaseModel"></param>
  704. /// <returns></returns>
  705. [AcceptVerbs(HttpVerbs.Post)]
  706. public bool workOrderAddDatanew(T_Wo_WorkOrderBase workOrderBaseModel)
  707. {
  708. bool bl = false;
  709. try
  710. {
  711. //工单来源
  712. workOrderBaseModel.F_REPAIRMANID = 4;
  713. workOrderBaseModel.F_WORKORDERFROM = "微博工单";
  714. string wbh = workOrderBaseModel.CustomerBaseModel.F_CustomerEName.Trim();
  715. if (!string.IsNullOrEmpty(wbh))
  716. {
  717. workOrderBaseModel.F_EMPCODE = wbh;
  718. workOrderBaseModel.CustomerBaseModel.F_PostCode = wbh;
  719. }
  720. //当前用户信息
  721. workOrderBaseModel.F_USERID = F_UserID;//id
  722. workOrderBaseModel.F_LINKMAN = F_UserCode;//工号
  723. workOrderBaseModel.F_REPAIRMANNAME = F_UserName;//姓名
  724. workOrderBaseModel.F_LINKMANTELEPHONE = workOrderBaseModel.CustomerBaseModel.F_Mobile;
  725. if (F_UserID > 0)
  726. {
  727. T_Sys_UserAccount usermodel = new T_Sys_UserAccount();
  728. usermodel = userBll.GetModel(F_UserID);
  729. workOrderBaseModel.F_REPAIRMANNAME = usermodel.F_UserName;//姓名
  730. }
  731. if (workOrderBaseModel.CustomerBaseModel != null)
  732. {
  733. //最近联络方式
  734. if (workOrderBaseModel.F_REPAIRMANID.ToString() == "4")
  735. { workOrderBaseModel.CustomerBaseModel.F_Kind = "3"; }
  736. else
  737. {
  738. workOrderBaseModel.CustomerBaseModel.F_Kind = workOrderBaseModel.F_REPAIRMANID.ToString();
  739. }
  740. workOrderBaseModel.CustomerBaseModel.F_CustomerNature = workOrderBaseModel.F_WORKORDERFROM;
  741. //业务类型
  742. workOrderBaseModel.CustomerBaseModel.F_IndustryId = workOrderBaseModel.F_REPAIRLEVEL;
  743. workOrderBaseModel.CustomerBaseModel.F_Url = workOrderBaseModel.F_ADSLACCOUNT;
  744. workOrderBaseModel.CustomerBaseModel.F_CustomerId = Convert.ToInt32(workOrderBaseModel.F_CUSTOMERID);
  745. ////客户等级
  746. workOrderBaseModel.CustomerBaseModel.F_ScaleResume = "1";
  747. workOrderBaseModel.CustomerBaseModel.F_CustomerClass = "一般客户";
  748. //保存工单基础信息
  749. //修改客户基础信息
  750. int cusid = cusBLL.EditCusInfoModel(workOrderBaseModel.CustomerBaseModel);
  751. if (cusid > 0)
  752. {
  753. workOrderBaseModel.F_CUSTOMERID = cusid;
  754. }
  755. }
  756. if (workOrderBaseModel.F_WORKORDERID == 0)
  757. {
  758. workOrderBaseModel.F_CREATEDATE = DateTime.Now;
  759. workOrderBaseModel.F_HASTENCOUNTS = 0;
  760. bl = orderBLL.AddWbgd(workOrderBaseModel)>0;
  761. }
  762. else
  763. {
  764. try
  765. {
  766. YTSoft.BaseCallCenter.Model.T_Wo_WorkOrderBase m = new YTSoft.BaseCallCenter.BLL.T_Wo_WorkOrderBase().GetModel(workOrderBaseModel.F_WORKORDERID);
  767. workOrderBaseModel.F_LINKMANTELEPHONE = m.F_LINKMANTELEPHONE;
  768. workOrderBaseModel.F_CUSTOMERTELEPHONE = m.F_CUSTOMERTELEPHONE;
  769. workOrderBaseModel.F_NUMBER = m.F_CODE;
  770. }
  771. catch
  772. { }
  773. if (workOrderBaseModel.F_SERVICETYPE == "待处理")
  774. {
  775. workOrderBaseModel.F_WORKORDERNAME = "手工工单";
  776. return orderBLL.UpdateWorkOrderInfoModel(workOrderBaseModel);
  777. }
  778. else
  779. {
  780. workOrderBaseModel.F_WORKORDERNAME = "手工工单";
  781. return orderBLL.UpdateWorkOrderInfoModel(workOrderBaseModel);
  782. }
  783. }
  784. }
  785. catch (Exception ex) { }
  786. return bl;
  787. }
  788. /// <summary>
  789. /// 初始化列表
  790. /// </summary>
  791. /// <returns></returns>
  792. public ActionResult CallRecordList()
  793. {
  794. WorkOrderMyModel model = new WorkOrderMyModel();
  795. return View(model);
  796. }
  797. /// <summary>
  798. /// 听取录音
  799. /// </summary>
  800. /// <returns></returns>
  801. public ActionResult VoicePlay(string type, string callid)
  802. {
  803. Models.VoicePlayModel model = new VoicePlayModel();
  804. model.playpath = type;
  805. AddAction("VoicePlay", callid, "听录音", string.Format("听了callid={0}的录音", callid), "敏感信息");
  806. if (!string.IsNullOrEmpty(callid))
  807. {
  808. if (callid.Contains("http://"))
  809. {
  810. model.downpath = callid;
  811. }
  812. else
  813. {
  814. BLL.rec_file_info busFile = new BLL.rec_file_info();
  815. if (type == "0")
  816. {
  817. //录音
  818. Model.rec_file_info modelfile= busFile.GetModel(callid);
  819. if (modelfile != null)
  820. {
  821. if (modelfile.FileName.Length > 10)
  822. {
  823. model.downpath = string.Format("{0}/oldyuyin/{1}", "http://10.200.46.21:8020", modelfile.FileName);
  824. }
  825. }
  826. }
  827. else if (type == "1")
  828. {
  829. //留言
  830. model.downpath = string.Format("{0}/oldliuyan/{1}", "http://10.200.46.21:8020", callid);// GetSysconfig("newPlayPath")
  831. }
  832. } }
  833. return View(model);
  834. }
  835. public ActionResult VoicePlay1(string type, string callid)
  836. {
  837. VoicePlayModel voicePlayModel = new VoicePlayModel();
  838. voicePlayModel.playpath = "";
  839. voicePlayModel.downpath = "";
  840. try
  841. {
  842. voicePlayModel.playpath = this.GetSrc(type, callid);
  843. voicePlayModel.downpath = !(type == "0") ? voicePlayModel.playpath.Replace("playvoicemail", "downvoicemail") : voicePlayModel.playpath.Replace("playbyappid", "downbyappid");
  844. if (!string.IsNullOrEmpty(voicePlayModel.playpath))
  845. {
  846. StringBuilder stringBuilder = new StringBuilder();
  847. string str = HttpHelper.HttpPost(voicePlayModel.playpath, (object)null);
  848. voicePlayModel.playpath = str;
  849. }
  850. }
  851. catch
  852. {
  853. }
  854. AddAction("VoicePlay1", callid, "听录音", string.Format("听了callid={0}的录音", callid), "敏感信息");
  855. return (ActionResult)this.View((object)voicePlayModel);
  856. }
  857. public string GetSrc(string type, string callid)
  858. {
  859. string s = "";
  860. BLL.T_Sys_SystemConfig bll_T_Sys_SystemConfig = new BLL.T_Sys_SystemConfig();
  861. try
  862. {
  863. string valueByParamCode = bll_T_Sys_SystemConfig.GetParamValueByParamCode(!(type == "0") ? "PlayLeaveVoice" : "PlayPath");
  864. string str = callid;
  865. s = str.IndexOf(":") >= 0 ? str.Replace("D:", valueByParamCode) : valueByParamCode + str;
  866. s = HttpUtility.HtmlEncode(s);
  867. }
  868. catch
  869. {
  870. }
  871. return s;
  872. }
  873. //public string GetSrc(string type, string callid)
  874. //{
  875. // string res = "";
  876. // try
  877. // {
  878. // string para = "PlayPath";
  879. // if (type == "0")
  880. // {
  881. // para = "PlayPath";
  882. // }
  883. // else
  884. // {
  885. // para = "PlayLeaveVoice";
  886. // }
  887. // BLL.T_Sys_SystemConfig bll_T_Sys_SystemConfig = new BLL.T_Sys_SystemConfig();
  888. // string CTIserverIP = bll_T_Sys_SystemConfig.GetParamValueByParamCode(para);//CTIIP
  889. // string path = callid;
  890. // if (path.IndexOf(":") < 0)
  891. // {
  892. // res = CTIserverIP + path;
  893. // }
  894. // else
  895. // {
  896. // res = path.Replace("D:", CTIserverIP);
  897. // }
  898. // res = HttpUtility.HtmlEncode(res);
  899. // }
  900. // catch
  901. // {
  902. // }
  903. // return res;
  904. //}
  905. /// <summary>
  906. /// 留言管理
  907. /// </summary>
  908. /// <returns></returns>
  909. public ActionResult CallLeaveList()
  910. {
  911. string userid = "0";
  912. YTSoft.BaseCallCenter.Model.T_Sys_UserAccount p_LoginUser = new YTSoft.BaseCallCenter.Model.T_Sys_UserAccount();
  913. try
  914. {
  915. if (Request.Cookies["BaseCallCenter_T_User"] != null)
  916. {
  917. userid = Request.Cookies["BaseCallCenter_T_User"]["F_UserId"];
  918. }
  919. int u = Convert.ToInt32(userid);
  920. }
  921. catch
  922. { }
  923. if (userid != "0")
  924. {
  925. p_LoginUser = new BLL.T_Sys_UserAccount().GetModel(Convert.ToInt32(userid));
  926. if (p_LoginUser != null)
  927. {
  928. if (Request.Cookies["BaseCallCenter_T_User"] != null)
  929. {
  930. p_LoginUser.F_ExtensionNumber = Request.Cookies["BaseCallCenter_T_User"]["F_ExtensionNumber"];
  931. }
  932. }
  933. }
  934. else
  935. {
  936. Response.Redirect("/Default/Login");
  937. }
  938. return View(p_LoginUser);
  939. }
  940. /// <summary>
  941. /// 坐席监控
  942. /// </summary>
  943. /// <returns></returns>
  944. public ActionResult SeatMonitoringList()
  945. {
  946. return View();
  947. }
  948. /// <summary>
  949. /// 获取通话记录
  950. /// </summary>
  951. /// <param name="page">当前页码</param>
  952. /// <param name="limit">每页数据量</param>
  953. /// <param name="sqlWhere">查询条件</param>
  954. /// <returns></returns>
  955. [ActionName("CallRecordData")]
  956. [HttpGet]
  957. public string CallRecordData(DateTime? NowDateTime, int page, int limit, string callnumber, string usercode, string callType,
  958. string callStatus, string dateParty,
  959. int F_WORKORDERTYPEID=0,string F_CONTENT="", string F_HOUSING="", string callid="0",string sort="",int ringtimes=0)
  960. {
  961. AddAction("T_Call_CallRecords", callid.ToMyString(), "获取通话记录列表", string.Format("获取{0}通话记录列表", dateParty), "敏感信息");
  962. //数据结果集
  963. ResponseData dataModel = new ResponseData();
  964. string sql = "";
  965. if (callid!="0"&&!string.IsNullOrEmpty(callid))
  966. {
  967. sql += string.Format(" and callid='{0}'", callid);
  968. }
  969. if (ringtimes > 0)
  970. {
  971. sql += string.Format(" and RingLongTime>{0}", ringtimes);
  972. }
  973. if (!string.IsNullOrEmpty(dateParty))
  974. {
  975. string startDate = dateParty.Substring(0, 10);
  976. string endDate = dateParty.Substring(12);
  977. sql += " and BeginTime>= '" + startDate + " 00:00:00" + "'";
  978. sql += " and BeginTime<= '" + endDate + " 23:59:59" + "'";
  979. }
  980. else
  981. {
  982. sql += " and BeginTime>= '" + DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00" + "'";
  983. sql += " and BeginTime<= '" + DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59" + "'";
  984. }
  985. if (!string.IsNullOrEmpty(callnumber))
  986. {
  987. sql += " and CallNumber like '%" + callnumber.Trim() + "%'";
  988. }
  989. if (!string.IsNullOrEmpty(usercode))
  990. {
  991. sql += " and UserCode like '%" + usercode.Trim() + "%'";
  992. }
  993. //呼叫类型,0呼入1呼出
  994. if (!string.IsNullOrEmpty(callType))
  995. {
  996. sql += " and CallType =" + callType;
  997. }
  998. //呼叫状态,0:未接通电话1已接通电话
  999. if (!string.IsNullOrEmpty(callStatus))
  1000. {
  1001. sql += " and CallState =" + callStatus;
  1002. }
  1003. //工单类型 F_HOUSING select F_WORKORDERTYPEID,F_CONTENT,F_HOUSING from T_Wo_WorkOrderBase where 1=1 and F_CONTENT like '%'++'%'
  1004. //工单类型
  1005. if (!string.IsNullOrEmpty(F_HOUSING))
  1006. {
  1007. //sql += string.Format(" AND F_WorkOrderTypeId IS NOT null and T2.F_HOUSING='{0}'", F_HOUSING);
  1008. string F_HOUSINGint = "0";
  1009. switch (F_HOUSING)
  1010. {
  1011. case "咨询":
  1012. F_HOUSINGint = "1";
  1013. break;
  1014. case "投诉":
  1015. F_HOUSINGint = "2";
  1016. break;
  1017. case "建议":
  1018. F_HOUSINGint = "3";
  1019. break;
  1020. case "表扬":
  1021. F_HOUSINGint = "4";
  1022. break;
  1023. case "挂失":
  1024. F_HOUSINGint = "5";
  1025. break;
  1026. }
  1027. sql += string.Format("AND F_ServiceType={0} ", F_HOUSINGint);
  1028. }
  1029. //呼叫状态,0:未接通电话1已接通电话
  1030. if (!string.IsNullOrEmpty(callStatus))
  1031. {
  1032. sql += " and CallState =" + callStatus;
  1033. }
  1034. DataTable dt = new DataTable();
  1035. int recordCount = 0;
  1036. //BLL.T_Call_CallRecords busCall_CallRecords = new BLL.T_Call_CallRecords();
  1037. //busCall_CallRecords.GetListByPage();
  1038. Model.PageData<Model.T_Call_CallRecords_All> pageModel = new Model.PageData<Model.T_Call_CallRecords_All>();
  1039. // dt = BLL.PagerBLL.GetTableList(
  1040. // " (T_Call_CallRecords T1 LEFT JOIN T_Wo_WorkOrderBase T2 ON T1.CallId=T2.F_KSHADDRESSCODE ) ",
  1041. // "CallRecordsId",
  1042. // "T1.*,F_WORKORDERID,F_HOUSING,CONVERT(varchar,BeginTime, 120 ) as BeginTimeNew,CONVERT(varchar,TalkStartTime, 120 ) as TalkStartTimeNew,CONVERT(varchar,TalkEndTime, 120 ) as TalkEndTimeNew"
  1043. // + @",(select top 1 F_ScaleResume from T_Cus_CustomerBase n where
  1044. //CallNumber=F_Telephone) as F_ScaleResume,
  1045. //replace(replace(FilePath,'\','/'),'" + GetSysconfig("newFilePath") + "','" + GetSysconfig("newPlayPath") + "')" +
  1046. //@" as fileurl,case
  1047. // when BusinessType=1 then '咨询'
  1048. // when BusinessType=2 then '建议'
  1049. // when BusinessType=3 then '表扬'
  1050. // when BusinessType=4 then '挂失'
  1051. // when BusinessType=9 then '投诉'
  1052. // when T1.F_ServiceType=1 then '咨询'
  1053. // when T1.F_ServiceType = 2 then '投诉'
  1054. // when T1.F_ServiceType = 3 then '建议'
  1055. // when T1.F_ServiceType = 4 then '表扬'
  1056. // when T1.F_ServiceType = 5 then '挂失'
  1057. // else '' end as
  1058. //BType, case when (isnull(BusinessType,0)>0 or isnull(T1.F_ServiceType,0)>0) then '人工服务' else '' end as ywtype ",
  1059. // sql,
  1060. // // "ORDER BY LongTime,CallRecordsId desc",
  1061. // string.IsNullOrEmpty(sort) ? " BeginTime desc": sort + " desc"
  1062. // ,
  1063. // limit,
  1064. // page,
  1065. // out recordCount);
  1066. dt = BLL.PagerBLL.GetListPager(
  1067. " T_Call_CallRecords ",
  1068. "CallRecordsId",
  1069. "*," +
  1070. "(select top 1 F_WORKORDERID from T_Wo_WorkOrderBase where F_KSHADDRESSCODE=CallId) as F_WORKORDERID," +
  1071. "CONVERT(varchar,BeginTime, 120 ) as BeginTimeNew,CONVERT(varchar,TalkStartTime, 120 ) as TalkStartTimeNew,CONVERT(varchar,TalkEndTime, 120 ) as TalkEndTimeNew"
  1072. + @",(select top 1 F_ScaleResume from T_Cus_CustomerBase n where
  1073. CallNumber=F_Telephone) as F_ScaleResume,
  1074. replace(replace(FilePath,'\','/'),'" + GetSysconfig("newFilePath") + "','" + GetSysconfig("newPlayPath") + "')" +
  1075. @" as fileurl,case
  1076. when BusinessType=1 then '咨询'
  1077. when BusinessType=2 then '建议'
  1078. when BusinessType=3 then '表扬'
  1079. when BusinessType=4 then '挂失'
  1080. when BusinessType=9 then '投诉'
  1081. when F_ServiceType=1 then '咨询'
  1082. when F_ServiceType = 2 then '投诉'
  1083. when F_ServiceType = 3 then '建议'
  1084. when F_ServiceType = 4 then '表扬'
  1085. when F_ServiceType = 5 then '挂失'
  1086. else '' end as
  1087. BType, case when (isnull(BusinessType,0)>0 or isnull(F_ServiceType,0)>0) then '人工服务' else '' end as ywtype ",
  1088. sql,
  1089. // "ORDER BY LongTime,CallRecordsId desc",
  1090. string.IsNullOrEmpty(sort) ? "ORDER BY BeginTime desc" : "ORDER BY "+ sort + " desc"
  1091. ,
  1092. limit,
  1093. page,
  1094. true,
  1095. out recordCount);
  1096. dataModel.code = 0;
  1097. dataModel.count = recordCount;
  1098. dataModel.data = dt;
  1099. string json = JsonConvert.SerializeObject(dataModel);
  1100. return json;
  1101. }
  1102. /// <summary>
  1103. /// 获取留言记录
  1104. /// </summary>
  1105. /// <param name="page">当前页码</param>
  1106. /// <param name="limit">每页数据量</param>
  1107. /// <param name="sqlWhere">查询条件</param>
  1108. /// <returns></returns>
  1109. [ActionName("LeaveRecordData")]
  1110. [HttpGet]
  1111. public string LeaveRecordData(DateTime? NowDateTime, int page, int limit, string callnumber, string leavedate, string status)
  1112. {
  1113. AddAction("T_Call_LeaveRecord", status, "获取通话记录列表", string.Format("获取{0}留言记录列表", leavedate), "敏感信息");
  1114. //数据结果集
  1115. ResponseData dataModel = new ResponseData();
  1116. string sql = "";
  1117. if (!string.IsNullOrEmpty(callnumber))
  1118. {
  1119. sql += " and F_Phone like '%" + callnumber.Trim() + "%'";
  1120. }
  1121. //if (!string.IsNullOrEmpty(leavedate))
  1122. //{
  1123. // sql += " and datediff(day,'" + leavedate + "',F_LeaveTime)=0 ";
  1124. //}
  1125. string startDate = "";
  1126. string endDate = "";
  1127. if (!string.IsNullOrEmpty(leavedate))
  1128. {
  1129. startDate = leavedate.Substring(0, 10);
  1130. endDate = leavedate.Substring(12);
  1131. sql += " and F_LeaveTime>= '" + startDate + " 00:00:00" + "'";
  1132. sql += " and F_LeaveTime<= '" + endDate + " 23:59:59" + "'";
  1133. }
  1134. else {
  1135. startDate = DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd");
  1136. endDate = DateTime.Now.ToString("yyyy-MM-dd");
  1137. sql += " and F_LeaveTime>= '" + startDate + " 00:00:00" + "'";
  1138. sql += " and F_LeaveTime<= '" + endDate + " 23:59:59" + "'";
  1139. }
  1140. if (!string.IsNullOrEmpty(status))
  1141. {
  1142. sql += " and F_Status=" + status + " ";
  1143. }
  1144. DataTable dt = new DataTable();
  1145. int recordCount = 0;
  1146. dt = BLL.PagerBLL.GetListPager(
  1147. "T_Call_LeaveRecord",
  1148. "F_Id",
  1149. "*,CONVERT(varchar,F_LeaveTime, 120 ) as F_LeaveTimeNew,CONVERT(varchar,F_DealTime, 120 ) as F_DealTimeNew"
  1150. + ",(select top 1 F_ScaleResume from T_Cus_CustomerBase n where F_Phone=F_Telephone) as F_ScaleResume ," +
  1151. @"replace(replace(F_RecFileUrl, '\','/'),'" + GetSysconfig("newFilePath") + "','" + GetSysconfig("newPlayPath") + "') as TheLuyin",
  1152. sql,
  1153. "ORDER BY F_Id desc",
  1154. limit,
  1155. page,
  1156. true,
  1157. out recordCount);
  1158. dataModel.code = 0;
  1159. dataModel.count = recordCount;
  1160. dataModel.data = dt;
  1161. if (dt != null && recordCount > 0)
  1162. {
  1163. foreach (DataRow dr in dt.Rows)
  1164. {
  1165. if (dr["F_RecFileUrl"].ToMyString().Contains(GetSysconfig("newFilePath").Substring(0,2)))
  1166. {
  1167. if (!System.IO.File.Exists(dr["F_RecFileUrl"].ToMyString()))
  1168. {
  1169. dr["TheLuyin"] = "";
  1170. }
  1171. }
  1172. }
  1173. }
  1174. string json = JsonConvert.SerializeObject(dataModel);
  1175. return json;
  1176. }
  1177. /// <summary>
  1178. /// 留言创建工单处理
  1179. /// </summary>
  1180. /// <param name="LeaveOptAjax"></param>
  1181. /// <returns></returns>
  1182. [ActionName("LeaveOptAjax")]
  1183. [HttpGet]
  1184. public string LeaveOptAjax(string optaction, string timeno, string callid, string userid, string usercode, string username, string extnumber, string callernum, string leaveid)
  1185. {
  1186. //&timeno=" + timeno+"&callid=" + callID + "&userid=" + userid + "&usercode=" + usercode
  1187. //+ "&username=" + username + "&extnumber" + extnumber + "&callernum=" + callerNum
  1188. string res = "error";
  1189. try
  1190. {
  1191. switch (optaction)
  1192. {
  1193. case "leaveAddOrderEvent":
  1194. //振铃事件
  1195. res = leaveAddOrderEvent(callid, userid, usercode, username, extnumber, callernum, leaveid);
  1196. break;
  1197. }
  1198. }
  1199. catch
  1200. { }
  1201. return res;
  1202. }
  1203. #region 来电归属地查询
  1204. public string GetPhoneLocation(string phoneNumber, bool isPhone)
  1205. {
  1206. string location = "未知";
  1207. try
  1208. {
  1209. //如果是手机号码
  1210. if (isPhone)
  1211. {
  1212. BLL.T_Sys_MobileData mobile_Bll = new BLL.T_Sys_MobileData();
  1213. Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModel(phoneNumber.Substring(0, 7));
  1214. return mobileModel != null ? (mobileModel.F_CityDes + mobileModel.F_CardDes) : location;
  1215. }
  1216. else//如果是电话号码
  1217. {
  1218. BLL.T_Sys_TelTitleData numbBll = new BLL.T_Sys_TelTitleData();
  1219. List<Model.T_Sys_TelTitleData> mobileModel = numbBll.GetModelList(" 1=1 and F_KeyPhoneNum='" + phoneNumber.Substring(0, 4) + "'");
  1220. if (mobileModel == null || mobileModel.Count <= 0)
  1221. mobileModel = numbBll.GetModelList(" 1=1 and F_KeyPhoneNum='" + phoneNumber.Substring(0, 3) + "'");
  1222. return mobileModel.Count > 0 ? mobileModel[0].F_TitleName : location;
  1223. }
  1224. }
  1225. catch (System.Exception ex)
  1226. {
  1227. return location;
  1228. }
  1229. }
  1230. #endregion
  1231. #region 自动添加工单
  1232. public bool SubmitOSubmit(string phone, string recordid, string callid, string locationaddress, string userid, string username, string usercode, out int workorderid)
  1233. {
  1234. bool bl = false;
  1235. workorderid = 0;
  1236. try
  1237. {
  1238. Model.T_Wo_WorkOrderBase model = new Model.T_Wo_WorkOrderBase();
  1239. #region 工单信息
  1240. //model.F_WORKORDERTYPEID = Convert.ToInt32(typeid);//类型ID
  1241. model.F_WORKORDERSTATEID = 0;//状态ID
  1242. model.F_REPAIRREQUEST = "未处理";
  1243. model.F_CODE = "";//工单编号
  1244. model.F_WORKORDERNAME = "";//工单名称
  1245. model.F_NUMBER = model.F_CODE;
  1246. //model.F_CUSTOMERNAME = txtCustomerName.Text.Trim();//客户姓名
  1247. model.F_CUSTOMERTELEPHONE = phone.Trim();//客户电话
  1248. model.F_USERID = Convert.ToInt32(userid);//坐席id
  1249. model.F_LINKMAN = usercode.Trim();//坐席工号
  1250. model.F_REPAIRMANNAME = username.Trim();//坐席名称
  1251. model.F_LINKMANTELEPHONE = phone.Trim();//联系人电话
  1252. //model.F_ADSLACCOUNT = hfCallId.Value.Trim();
  1253. model.F_BANDWIDTH = "";
  1254. model.F_STANDARDADDRESS = locationaddress.Trim();
  1255. //model.F_INSTALLADDRESS = F_INSTALLADDRESS;
  1256. model.F_KSHADDRESSCODE = callid;
  1257. model.F_RANGEID = Convert.ToInt32(recordid);
  1258. model.F_PROVINCE = "";
  1259. model.F_CITY = "";
  1260. model.F_AREA = "";
  1261. model.F_ROAD = "";
  1262. model.F_HOUSING = "";
  1263. model.F_REPAIRMANID = 2;
  1264. model.F_WORKORDERFROM = "留言工单";
  1265. //model.F_WORKORDERLEVELID = F_WORKORDERLEVELID;
  1266. model.F_FILEFLAG = 0;
  1267. model.F_CREATEBY = Convert.ToInt32(userid.Trim());
  1268. model.F_CREATEDATE = DateTime.Now;
  1269. model.F_RETURNVISITFLAG = 0;
  1270. model.F_RETURNVISITSTATE = 0;
  1271. model.F_RETURNVISITRESULT = 0;
  1272. model.F_RETURNVISITCONTENT = "";
  1273. model.F_DELETEFLAG = 0;
  1274. model.F_ALLUSETIMES = 0;
  1275. model.F_STARTTIME = DateTime.Now;
  1276. model.F_OVERTIMES = 0;
  1277. model.F_FORMID = 0;
  1278. model.F_HASTENCOUNTS = 0;
  1279. model.F_RANGEX = 0;
  1280. model.F_RANGEY = 0;
  1281. model.F_REPAIRCLOSEMANID = 0;
  1282. model.F_REPAIRCLOSEMANNAME = "";
  1283. model.F_REPAIRCLOSEREASONS = "";
  1284. model.F_REPAIRCLOSEREPTID = 0;
  1285. model.F_REPAIRCLOSEREPT = "";
  1286. #endregion
  1287. int resorderbase = new BLL.T_Wo_WorkOrderBase().Add(model);//添加基本信息
  1288. workorderid = resorderbase;
  1289. if (resorderbase > 0)
  1290. {
  1291. bl = true;
  1292. }
  1293. else
  1294. {
  1295. bl = false;
  1296. }
  1297. }
  1298. catch (Exception ex)
  1299. {
  1300. }
  1301. return bl;
  1302. }
  1303. #endregion
  1304. #region 处理留言创建工单事件
  1305. public string leaveAddOrderEvent(string callid, string userid, string usercode, string username, string extnumber, string callernum, string leaveid)
  1306. {
  1307. string res = "error";
  1308. try
  1309. {
  1310. AddAction("leaveAddOrderEvent", callid, "创建留言工单", string.Format("{0}创建callid={1}留言工单{2}", username, callid, leaveid), "关键信息");
  1311. Model.T_Call_CallRecords vmodel = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
  1312. if (vmodel != null)
  1313. {
  1314. string phone = callernum;
  1315. #region 来电归属地查询
  1316. string location = "";
  1317. //来电归属地查询
  1318. if (phone.Trim().Length == 11 && phone.Substring(0, 1) != "0")
  1319. {
  1320. location = GetPhoneLocation(phone, true);
  1321. }
  1322. else
  1323. {
  1324. location = GetPhoneLocation(phone, false);
  1325. }
  1326. #endregion
  1327. #region 创建工单
  1328. int workorderid = 0;
  1329. bool wobl = SubmitOSubmit(phone, vmodel.CallRecordsId.ToString(), callid, location, userid, username, usercode, out workorderid);
  1330. if (wobl)
  1331. {
  1332. //处理留言
  1333. #region 处理留言
  1334. Model.T_Call_LeaveRecord leavemodel = new BLL.T_Call_LeaveRecord().GetModel(Convert.ToInt32(leaveid));
  1335. if (leavemodel != null)
  1336. {
  1337. //leavemodel.F_CallAppId = workorderid.ToString();
  1338. //leavemodel.F_Status = 1;
  1339. //leavemodel.F_UserId = Convert.ToInt32(userid);
  1340. //leavemodel.F_UserName = username;
  1341. //leavemodel.F_UserCode = usercode;
  1342. //leavemodel.F_DealTime = DateTime.Now;
  1343. //leavemodel.F_DealContent = "留言创建工单";
  1344. //new BLL.T_Call_LeaveRecord().Update(leavemodel);
  1345. string strSql = @"
  1346. update T_Call_LeaveRecord set
  1347. F_CallAppId = " + workorderid.ToString() + @",F_Status = 1,
  1348. F_UserId = " + Convert.ToInt32(userid) + @",F_UserName = '" + username + @"',F_UserCode = '" + usercode + @"',F_DealTime = '" + DateTime.Now + @"',
  1349. F_DealContent = '留言创建工单' where F_Id = " + leavemodel.F_Id;
  1350. int rows = DbHelperSQL.ExecuteSql(strSql);
  1351. }
  1352. #endregion
  1353. try
  1354. {
  1355. Model.T_Call_WorkOrder modelorder = new Model.T_Call_WorkOrder();
  1356. modelorder.CallId = callid;
  1357. modelorder.F_WORKORDERID = workorderid;
  1358. modelorder.F_WORKORDERSTATEID = 0;
  1359. new BLL.T_Call_WorkOrder().Add(modelorder);
  1360. }
  1361. catch { }
  1362. res = workorderid.ToString();
  1363. }
  1364. #endregion
  1365. }
  1366. }
  1367. catch (Exception ex)
  1368. {
  1369. //res = ex.ToString();
  1370. }
  1371. return res;
  1372. }
  1373. #endregion
  1374. /// <summary>
  1375. /// 获取坐席监控坐席列表
  1376. /// </summary>
  1377. /// <returns></returns>
  1378. [ActionName("getseatnewlist")]
  1379. [HttpGet]
  1380. public string getseatnewlist()
  1381. {
  1382. string strHtml = "";
  1383. string strList = "";
  1384. DataTable dt = new DataTable();
  1385. try
  1386. {
  1387. AddAction("T_Sys_UserAccount", "0", "获取坐席监控列表", "", "关键信息");
  1388. BLL.T_Sys_UserAccount bll = new BLL.T_Sys_UserAccount();
  1389. dt = bll.GetList(" f_seatflag=1 order by f_userid desc ").Tables[0];
  1390. if (dt.Rows.Count > 0)
  1391. {
  1392. for (int i = 0; i < dt.Rows.Count; i++)
  1393. {
  1394. strList += dt.Rows[i]["F_WorkNumber"] + ",";// "-" + dt.Rows[i]["ExtensionCode"] + ",";
  1395. strHtml += "<div id=\"div_" + dt.Rows[i]["F_WorkNumber"] + "\" style='float: left; width: 120px; height: 120px; text-align: center; padding: 8px;cursor:pointer'>";
  1396. strHtml += "<div style='height: 90px; border: 1px solid #CCCCCC; padding: 3px; text-align: center;cursor:pointer'";
  1397. strHtml += "onmouseover=\"this.style.border='1px solid #3A8BDC'\" onmouseout=\"this.style.border='1px solid #CCCCCC'\">";
  1398. strHtml += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" height=\"100%\" style=\"text-align: center;cursor:pointer\" ";
  1399. strHtml += " onclick=\"GetOneState('" + dt.Rows[i]["F_WorkNumber"] + "','"+ dt.Rows[i]["ExtensionCode"] + "','" + dt.Rows[i]["F_UserName"] + "')\">";
  1400. strHtml += " <tr><td><input type=\"text\" id=\"" + dt.Rows[i]["F_WorkNumber"] + "\" style=\"display: none\" /><input type=\"text\" id=\"txtSeatState_" + dt.Rows[i]["F_WorkNumber"] + "\" value=\"0\" style=\"display: none\" />";
  1401. strHtml += " <span id=\"span_" + dt.Rows[i]["F_WorkNumber"] + "\" style=\"color: #000000;\">";
  1402. strHtml += dt.Rows[i]["F_WorkNumber"] + "(" + dt.Rows[i]["F_UserName"] + ")</span>";
  1403. strHtml += "</td></tr> <tr> <td><img id=\"img_" + dt.Rows[i]["F_WorkNumber"] + "\" src=\"/Content/images/seatimgs/weiqianru.jpg\" />";
  1404. strHtml += "</td></tr><tr><td><span id=\"span_state_" + dt.Rows[i]["F_WorkNumber"] + "\" style=\"color: #cccccc;\">未签入</span>";
  1405. strHtml += " </td></tr></table></div></div>";
  1406. }
  1407. }
  1408. strList += "!@#";
  1409. strList = strList.Replace(",!@#", "").Replace("!@#", "");
  1410. }
  1411. catch
  1412. {
  1413. }
  1414. finally
  1415. {
  1416. dt.Clear();
  1417. dt.Dispose();
  1418. }
  1419. return strList + "~" + strHtml;
  1420. }
  1421. //外呼判断本地外地以及加前缀返回
  1422. [ActionName("GetCallOutprefix")]
  1423. [HttpGet]
  1424. public string GetCallOutprefix(string phone) {
  1425. AddAction("T_Sys_UserAccount", phone, "外呼获取外呼前缀", phone);
  1426. string phone1 = CallCenter.Utility.RequestString.ToDBC(RequestString.RemoveNotNumber(StringHelper.NoHTML(phone)));
  1427. string tophone = phone1;
  1428. string zipcode = ""; string bfix = ""; string wfix = ""; string fix = "";
  1429. // string userseatgroupid = CurrentUser.UserData.F_SeartGroupID.ToString();
  1430. //if (userseatgroupid != "" && userseatgroupid != "0")
  1431. //{
  1432. //Model.T_Sys_SeatGroup smodel = new BLL.T_Sys_SeatGroup().GetModel(int.Parse(userseatgroupid));
  1433. //if (smodel != null)
  1434. //{
  1435. zipcode = "0371";
  1436. bfix ="9";
  1437. wfix = "90";
  1438. //}
  1439. //}
  1440. int zip = GetZipCodeByPhone(phone1, zipcode);
  1441. #region
  1442. if (zip == 1)
  1443. {//手机本地号码
  1444. fix = bfix;
  1445. }
  1446. else if (zip == 2)
  1447. {//手机外地号码
  1448. fix = wfix;
  1449. }
  1450. else
  1451. {
  1452. tophone = phone1.TrimStart('0');
  1453. if (zip == 3)
  1454. {//本地固话去0加9 比如:988888517,937188888517
  1455. fix = bfix;
  1456. }
  1457. else if (zip == 4)
  1458. {//外地固话前加9 比如:9037188888517
  1459. fix = wfix;
  1460. }
  1461. }
  1462. #endregion
  1463. var obj = new
  1464. {
  1465. phone = fix + tophone,
  1466. fix = fix
  1467. };
  1468. return fix;
  1469. // return Success("外呼号码加前缀" + phone, obj);
  1470. }
  1471. /// <summary>
  1472. /// 根据号码和区号判断号码是否为归属地号码
  1473. /// 返回0为分机号或特殊号码
  1474. /// 返回1为手机本地号码
  1475. /// 返回2为手机外地号码
  1476. /// 返回3为固定电话本地号码
  1477. /// 返回4为固定电话外地号码
  1478. /// </summary>
  1479. /// <param name="phone"></param>
  1480. /// <param name="zipcode"></param>
  1481. /// <returns></returns>
  1482. [NonAction]
  1483. public int GetZipCodeByPhone(string phone, string zipcode)
  1484. {
  1485. int n = 0;
  1486. if (phone.Trim().Length >= 7)
  1487. {
  1488. //7位及7位以上是固定电话或手机
  1489. //判断是否手机
  1490. if (phone.Trim().Length == 11 && phone[0] == '1')
  1491. {//号码为11位,首位是1,为手机号
  1492. BLL.T_Sys_MobileData mobile_Bll = new BLL.T_Sys_MobileData();
  1493. Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModelList("F_MobileNum='" + phone.Substring(0, 7) + "'").FirstOrDefault();
  1494. if (mobileModel != null)
  1495. {
  1496. if (mobileModel.F_ZipCode.Equals(zipcode))
  1497. {
  1498. return 1;
  1499. }
  1500. else
  1501. {
  1502. return 2;
  1503. }
  1504. }
  1505. }
  1506. else
  1507. {
  1508. if (phone.Trim().Length == 11 && phone.Substring(0, 3).Equals(zipcode))
  1509. {//号码为11位
  1510. //截取前三位区号判断是否本地
  1511. bool resbd3 = phone.Substring(0, 3).Equals(zipcode);
  1512. //截取前四位区号判断是否本地
  1513. bool resbd4 = phone.Substring(0, 4).Equals(zipcode);
  1514. if (resbd3 || resbd4)
  1515. {
  1516. return 3;
  1517. }
  1518. else
  1519. {
  1520. return 4;
  1521. }
  1522. }
  1523. else if (phone.Trim().Length < 11)
  1524. {//号码小于11位,为本地
  1525. return 3;
  1526. }
  1527. else if (phone.Trim().Length > 11 && phone.Substring(0, 4).Equals(zipcode))
  1528. {//号码大于11位,截取前四位区号判断是否本地
  1529. return 3;
  1530. }
  1531. else
  1532. {
  1533. return 4;
  1534. }
  1535. }
  1536. }
  1537. else
  1538. {
  1539. return 3;
  1540. }
  1541. return n;
  1542. }
  1543. /// <summary>
  1544. /// 获取来电业务类型
  1545. /// </summary>
  1546. /// <param name="CallId">通话记录Callid </param>
  1547. /// <returns></returns>
  1548. [ActionName("GetCallType")]
  1549. [HttpGet]
  1550. public string GetCallType(string CallId)
  1551. {
  1552. //数据结果集
  1553. ResponseData dataModel = new ResponseData();
  1554. //来电业务类型
  1555. string sql = " select F_ServiceType from T_Call_CallRecords where CallId='" + CallId + "' order by BeginTime desc ";
  1556. //排队数量
  1557. // string sql2 = " select COUNT(CallId) as CallId from T_Call_CallRecords where F_linenum=1 ";
  1558. DataTable dt = new DataTable();
  1559. DataSet ds = DbHelperSQL.Query(sql);
  1560. dt = ds.Tables[0];
  1561. //来电业务类型
  1562. dataModel.code = Convert.ToInt32(dt.Rows[0]["F_ServiceType"].ToString() == "" ? "0" : dt.Rows[0]["F_ServiceType"].ToString());
  1563. //DataTable dt2 = new DataTable();
  1564. //DataSet ds2 = DbHelperSQL.Query(sql2);
  1565. //dt2 = ds2.Tables[0];
  1566. ////排队数量
  1567. //dataModel.msg = dt2.Rows[0]["CallId"].ToString() == "" ? "0" : dt2.Rows[0]["CallId"].ToString();
  1568. // dataModel.count = recordCount;
  1569. // dataModel.data = dt;
  1570. string json = JsonConvert.SerializeObject(dataModel);
  1571. return json;
  1572. }
  1573. /// <summary>
  1574. /// 获取排队数量
  1575. /// </summary>
  1576. /// <param name="CallId">通话记录Callid </param>
  1577. /// <returns></returns>
  1578. [ActionName("GetCallLineNum")]
  1579. [HttpGet]
  1580. public string GetCallLineNum()
  1581. {
  1582. //数据结果集
  1583. ResponseData dataModel = new ResponseData();
  1584. //排队数量
  1585. string sql2 = " select COUNT(CallId) as CallId from T_Call_CallRecords where F_linenum=1 and isnull(TalkStartTime,0)=0 ";
  1586. DataTable dt2 = new DataTable();
  1587. DataSet ds2 = DbHelperSQL.Query(sql2);
  1588. dt2 = ds2.Tables[0];
  1589. //排队数量
  1590. dataModel.code = Convert.ToInt32(dt2.Rows[0]["CallId"].ToString() == "" ? "0" : dt2.Rows[0]["CallId"].ToString());
  1591. // dataModel.count = recordCount;
  1592. // dataModel.data = dt;
  1593. string json = JsonConvert.SerializeObject(dataModel);
  1594. // return json;
  1595. return dataModel.code.ToString();
  1596. }
  1597. }
  1598. }