地铁二期项目正式开始

CallRecordController.cs 75KB

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