地铁二期项目正式开始

CallRecordController.cs 75KB

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