地铁二期项目正式开始

CallRecordController.cs 76KB

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