ProManagerController.cs 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436
  1. using Newtonsoft.Json;
  2. using Newtonsoft.Json.Linq;
  3. using PMS.BusinessModels;
  4. using PMS.BusinessModels.Account;
  5. using PMS.BusinessModels.ComplaintManage;
  6. using PMS.BusinessModels.Product;
  7. using PMS.BusinessModels.Project;
  8. using PMS.BusinessModels.Search;
  9. using PMS.EntityModels.ProManager;
  10. using PMS.Interface;
  11. using PMS.Interface.MedicalRecordManager;
  12. using PMS.Interface.ProManager;
  13. using PMS.Interface.SysManager;
  14. using PMS.Plugins.PluginsModels;
  15. using QWPlatform.SystemLibrary;
  16. using QWPlatform.SystemLibrary.Utils;
  17. using System;
  18. using System.Collections.Generic;
  19. using System.Configuration;
  20. using System.Data;
  21. using System.IO;
  22. using System.Linq;
  23. using System.Net.Http;
  24. using System.Security.Policy;
  25. using System.Text;
  26. using System.Web;
  27. using System.Web.Helpers;
  28. using System.Web.Mvc;
  29. using System.Web.Razor.Tokenizer.Symbols;
  30. using System.Web.Services.Description;
  31. namespace PMS.WebUI.Controllers
  32. {
  33. /// <summary>
  34. /// 创建人:王璐
  35. /// 创建日期:2018/12/30
  36. /// 模块功能:项目信息
  37. /// </summary>
  38. public class ProManagerController : BaseController
  39. {
  40. /// <summary>
  41. /// 实例接口
  42. /// </summary>
  43. IProModule ProModule = InterfaceFactory.CreateBusinessInstance<IProModule>();
  44. IAccount Acount = InterfaceFactory.CreateBusinessInstance<IAccount>();
  45. public static string ZLPMSAPI = ConfigurationManager.AppSettings["ZLPMSAPI"].ToStringEx();//问题管理系统webAPI
  46. [HttpGet]
  47. public ActionResult Index()
  48. {
  49. return View();
  50. }
  51. /// <summary>
  52. /// 项目表单主页
  53. /// </summary>
  54. /// <returns></returns>
  55. [HttpGet]
  56. public ActionResult ProjectForm()
  57. {
  58. return View();
  59. }
  60. #region 信息显示
  61. /// <summary>
  62. /// 获取全部渠道信息
  63. /// </summary>
  64. /// <param name="UserID"></param>
  65. /// <returns></returns>
  66. public ActionResult Datagrid()
  67. {
  68. string json = ProModule.GetAll_Channel(GetAuthDats().Channel);
  69. return Content(json, "application/json");
  70. }
  71. /// <summary>
  72. /// 根据数据权限获取项目
  73. /// </summary>
  74. /// <param name="ChannelID"></param>
  75. /// <param name="UserID"></param>
  76. /// <returns></returns>
  77. public ActionResult BingProData(string ChannelID, string Search)
  78. {
  79. string json = ProModule.Get_Pro_NoAuthor(ChannelID, Search);
  80. return Content(json, "application/json");
  81. }
  82. /// <summary>
  83. /// 根据项目ID获取机构信息
  84. /// </summary>
  85. /// <param name="ChannelID"></param>
  86. /// <param name="UserID"></param>
  87. /// <returns></returns>
  88. [HttpGet]
  89. public ActionResult BingStationData(string id, int page, int rows, string Search)
  90. {
  91. string json = ProModule.Get_Station_ById(id, page, rows, Search);
  92. return Content(json, "application/json");
  93. }
  94. /// <summary>
  95. /// 根据项目ID获取服务器信息
  96. /// </summary>
  97. /// <param name="id"></param>
  98. /// <param name="page"></param>
  99. /// <param name="rows"></param>
  100. /// <returns></returns>
  101. public ActionResult BingServerData(string id, int page, int rows)
  102. {
  103. string json = ProModule.Get_Server_ById(id, page, rows);
  104. return Content(json, "application/json");
  105. }
  106. /// <summary>
  107. /// 根据项目ID获取项目人员信息
  108. /// </summary>
  109. /// <param name="id"></param>
  110. /// <param name="page"></param>
  111. /// <param name="rows"></param>
  112. /// <returns></returns>
  113. public ActionResult BingWorkerData(string id, int page, int rows)
  114. {
  115. string json = ProModule.Get_Worker_ById(id, page, rows);
  116. return Content(json, "application/json");
  117. }
  118. /// <summary>
  119. /// 根据项目ID获取项目产品信息
  120. /// </summary>
  121. /// <param name="id"></param>
  122. /// <param name="page"></param>
  123. /// <param name="rows"></param>
  124. /// <returns></returns>
  125. public ActionResult BingProductData(string id)
  126. {
  127. string json = ProModule.Get_Product_ById(id);
  128. return Content(json, "application/json");
  129. }
  130. /// <summary>
  131. /// 返回当前登陆人信息
  132. /// </summary>
  133. /// <returns></returns>
  134. [HttpPost]
  135. public ActionResult GetFeedbackID()
  136. {
  137. var user = GetCurrentUser();
  138. var obj = new
  139. {
  140. jobcode = user.JobCode,
  141. nature = user.PersonProperty,
  142. id = user.PersonID
  143. };
  144. return Content(Strings.ObjectToJson(obj), "application/json");
  145. }
  146. #endregion
  147. #region 项目添加
  148. /// <summary>
  149. /// 添加项目的弹窗
  150. /// </summary>
  151. /// <param name="id"></param>
  152. /// <returns></returns>
  153. public ActionResult ProjectInfo(string id)
  154. {
  155. ViewBag.id = id;
  156. return View();
  157. }
  158. /// <summary>
  159. /// 添加项目
  160. /// </summary>
  161. /// <returns></returns>
  162. [HttpPost]
  163. public int Add_Project(ProBusinessModel model)
  164. {
  165. //获取登录者信息
  166. var user = this.GetCurrentUser();
  167. Session["identifyID"] = "null";
  168. //创建项目
  169. string projectID = ProModule.Add_Project(model, user);
  170. //判断创建是否成功
  171. if (projectID == "NO")
  172. {
  173. return -1;
  174. }
  175. else if (projectID == null || projectID.Length == 0)
  176. {
  177. return 0;
  178. }
  179. else
  180. {
  181. //将创建的项目自动分配给创建者
  182. if (Acount.AuthProjectToAccount(user.ID, user.CompanyID, projectID))
  183. {
  184. Session["channel"] = model.id;
  185. Session["project"] = projectID;
  186. return 1;
  187. }
  188. }
  189. return 0;
  190. }
  191. /// <summary>
  192. /// 根据项目ID获取该项目的信息
  193. /// </summary>
  194. /// <param name="ID"></param>
  195. /// <returns></returns>
  196. public ActionResult Get_Pro_ById(string ID)
  197. {
  198. var dt = ProModule.ProInfo_ById(ID);
  199. return this.ResponseJson(System.Net.HttpStatusCode.OK, "读取成功", dt);
  200. }
  201. /// <summary>
  202. /// 获取项目性质
  203. /// </summary>
  204. /// <returns></returns>
  205. public ActionResult GetNature()
  206. {
  207. var dt = ProModule.GetNature();
  208. return Content(dt, "application/json");
  209. }
  210. /// <summary>
  211. /// 实施方式
  212. /// </summary>
  213. /// <returns></returns>
  214. public ActionResult GetImplementation()
  215. {
  216. var dt = ProModule.GetImplementation();
  217. return Content(dt, "application/json");
  218. }
  219. /// <summary>
  220. /// 项目状态
  221. /// </summary>
  222. /// <returns></returns>
  223. public ActionResult GetState()
  224. {
  225. var dt = ProModule.GetState();
  226. return Content(dt, "application/json");
  227. }
  228. #endregion
  229. #region 项目修改
  230. /// <summary>
  231. /// 修改项目弹窗
  232. /// </summary>
  233. /// <param name="id"></param>
  234. /// <returns></returns>
  235. public ActionResult UpdateProjectInfo(string id)
  236. {
  237. ViewBag.id = id;
  238. return View();
  239. }
  240. /// <summary>
  241. /// 更新操作
  242. /// </summary>
  243. /// <returns></returns>
  244. public int Update_Project(ProBusinessModel model)
  245. {
  246. Session["channel"] = model.id;
  247. Session["project"] = model.PID;
  248. int r = ProModule.SaveProject(model);
  249. return r;
  250. }
  251. /// <summary>
  252. /// 根据项目ID获取项目审核流程信息
  253. /// </summary>
  254. /// <param name="ID"></param>
  255. /// <returns></returns>
  256. public ActionResult GetXMWTLC(string id)
  257. {
  258. var dt = ProModule.GetXMWTLC(id);
  259. return Content(dt, "application/json");
  260. }
  261. public ActionResult GetProblem(string XMID, string ID)
  262. {
  263. var dt = ProModule.GetProblem(XMID, ID);
  264. return Content(dt, "application/json");
  265. }
  266. public ActionResult GetProInfo(string id)
  267. {
  268. var dt = ProModule.GetProInfo(id);
  269. return this.ResponseJson(System.Net.HttpStatusCode.OK, "读取成功", dt);
  270. }
  271. #endregion
  272. #region 项目删除
  273. /// <summary>
  274. /// 根据项目ID删除项目
  275. /// </summary>
  276. /// <param name="id"></param>
  277. /// <returns></returns>
  278. [HttpPost]
  279. public int Del_Project(string id)
  280. {
  281. int r = ProModule.Del_Project(id);
  282. return r;
  283. }
  284. #endregion
  285. #region 机构添加
  286. /// <summary>
  287. /// 添加机构的弹窗
  288. /// </summary>
  289. /// <param name="id"></param>
  290. /// <returns></returns>
  291. public ActionResult StationInfo(string id)
  292. {
  293. ViewBag.id = id;
  294. return View();
  295. }
  296. /// <summary>
  297. /// 机构等级
  298. /// </summary>
  299. /// <returns></returns>
  300. public ActionResult GetLevel()
  301. {
  302. var dt = ProModule.GetLevel();
  303. return Content(dt, "application/json");
  304. }
  305. /// <summary>
  306. /// 添加机构
  307. /// </summary>
  308. /// <returns></returns>
  309. [HttpPost]
  310. public int Add_Station(StationBusinessModel model)
  311. {
  312. return ProModule.Add_Station(model);
  313. }
  314. /// <summary>
  315. /// 工作流分组目录
  316. /// </summary>
  317. /// <returns></returns>
  318. public ActionResult GetCatalog(string id)
  319. {
  320. return Content(ProModule.GetCatalog(id), "application/json");
  321. }
  322. #endregion
  323. #region 机构修改
  324. /// <summary>
  325. /// 添加修改弹窗
  326. /// </summary>
  327. /// <param name="id"></param>
  328. /// <returns></returns>
  329. public ActionResult UpdatStationInfo(string id)
  330. {
  331. ViewBag.id = id;
  332. return View();
  333. }
  334. /// <summary>
  335. /// 接受渠道ID
  336. /// </summary>
  337. /// <param name="id"></param>
  338. /// <returns></returns>
  339. [HttpPost]
  340. public void PostChannelId(string id)
  341. {
  342. TempData["ProjectID"] = id;
  343. }
  344. /// <summary>
  345. /// 更新操作
  346. /// </summary>
  347. /// <returns></returns>
  348. public int UpdateStation(StationBusinessModel model)
  349. {
  350. int r = ProModule.SaveStation(model);
  351. return r;
  352. }
  353. /// <summary>
  354. /// 根据ID获取机构信息
  355. /// </summary>
  356. /// <returns></returns>
  357. public ActionResult GetStationInfo(string id)
  358. {
  359. var dt = ProModule.GetStationInfo(id);
  360. return this.ResponseJson(System.Net.HttpStatusCode.OK, "读取成功", dt);
  361. }
  362. #endregion
  363. #region 机构删除
  364. /// <summary>
  365. /// 根据项目ID删除项目
  366. /// </summary>
  367. /// <param name="id"></param>
  368. /// <returns></returns>
  369. [HttpPost]
  370. public int Del_Station(string id)
  371. {
  372. int r = ProModule.Del_Station(id);
  373. return r;
  374. }
  375. #endregion
  376. #region 服务器添加
  377. /// <summary>
  378. /// 添加服务器的弹窗
  379. /// </summary>
  380. /// <param name="id"></param>
  381. /// <returns></returns>
  382. public ActionResult ServerInfo(string id)
  383. {
  384. ViewBag.id = id;
  385. return View();
  386. }
  387. /// <summary>
  388. /// 服务器类型
  389. /// </summary>
  390. /// <returns></returns>
  391. public ActionResult GetServerType()
  392. {
  393. var dt = ProModule.GetServerType();
  394. return Content(dt, "application/json");
  395. }
  396. /// <summary>
  397. /// 安装服务类型
  398. /// </summary>
  399. /// <returns></returns>
  400. public ActionResult GetInstallServerType()
  401. {
  402. var dt = ProModule.GetInstallServerType();
  403. return Content(dt, "application/json");
  404. }
  405. /// <summary>
  406. /// 数据库类型
  407. /// </summary>
  408. /// <returns></returns>
  409. public ActionResult GetDataBaseType()
  410. {
  411. var dt = ProModule.GetDataBaseType();
  412. return Content(dt, "application/json");
  413. }
  414. /// <summary>
  415. /// 预警类型
  416. /// </summary>
  417. /// <returns></returns>
  418. public ActionResult GetEarlyWarningType()
  419. {
  420. var dt = ProModule.GetEarlyWarningType();
  421. return Content(dt, "application/json");
  422. }
  423. /// <summary>
  424. /// 预警处理状态
  425. /// </summary>
  426. /// <returns></returns>
  427. public ActionResult GetWarningProcessingStatu()
  428. {
  429. var dt = ProModule.GetWarningProcessingStatu();
  430. return Content(dt, "application/json");
  431. }
  432. /// <summary>
  433. /// 项目监控状态
  434. /// </summary>
  435. /// <returns></returns>
  436. public ActionResult GetProjectMonitoringStatus()
  437. {
  438. var dt = ProModule.GetProjectMonitoringStatus();
  439. return Content(dt, "application/json");
  440. }
  441. /// <summary>
  442. /// 指标信息类型
  443. /// </summary>
  444. /// <returns></returns>
  445. public ActionResult GetIndicatorInformationType()
  446. {
  447. var dt = ProModule.GetIndicatorInformationType();
  448. return Content(dt, "application/json");
  449. }
  450. /// <summary>
  451. /// 指标信息状态
  452. /// </summary>
  453. /// <returns></returns>
  454. public ActionResult GetIndicatorInformationStatu()
  455. {
  456. var dt = ProModule.GetIndicatorInformationStatu();
  457. return Content(dt, "application/json");
  458. }
  459. /// <summary>
  460. /// 产品
  461. /// </summary>
  462. /// <returns></returns>
  463. public ActionResult GetProduct()
  464. {
  465. var dt = ProModule.GetProduct();
  466. return Content(dt, "application/json");
  467. }
  468. /// <summary>
  469. /// 添加服务器
  470. /// </summary>
  471. /// <returns></returns>
  472. [HttpPost]
  473. public int Add_Server(ServerBusinessModel model)
  474. {
  475. return ProModule.Add_Server(model);
  476. }
  477. #endregion
  478. #region 服务器修改
  479. /// <summary>
  480. /// 服务器修改弹窗
  481. /// </summary>
  482. /// <param name="id"></param>
  483. /// <returns></returns>
  484. public ActionResult UpdateServerInfo(string id)
  485. {
  486. ViewBag.id = id;
  487. return View();
  488. }
  489. /// <summary>
  490. /// 更新操作
  491. /// </summary>
  492. /// <returns></returns>
  493. public int UpdateServer(ServerBusinessModel model)
  494. {
  495. int r = ProModule.UpdateServer(model);
  496. return r;
  497. }
  498. /// <summary>
  499. /// 根据ID获取机构信息
  500. /// </summary>
  501. /// <returns></returns>
  502. public ActionResult GetServerInfo(string id)
  503. {
  504. var dt = ProModule.GetServerInfo(id);
  505. return this.ResponseJson(System.Net.HttpStatusCode.OK, "读取成功", dt);
  506. }
  507. #endregion
  508. #region 服务器删除
  509. /// <summary>
  510. /// 根据服务器ID删除服务器
  511. /// </summary>
  512. /// <param name="id"></param>
  513. /// <returns></returns>
  514. [HttpPost]
  515. public int Del_Server(string id)
  516. {
  517. int r = ProModule.Del_Server(id);
  518. return r;
  519. }
  520. #endregion
  521. /// <summary>
  522. /// 添加服务器数据库的弹窗
  523. /// </summary>
  524. /// <param name="id"></param>
  525. /// <returns></returns>
  526. public ActionResult ServerDataBaseInfo()
  527. {
  528. return View();
  529. }
  530. #region 项目人员添加
  531. /// <summary>
  532. /// 添加项目人员的弹窗
  533. /// </summary>
  534. /// <param name="id"></param>
  535. /// <returns></returns>
  536. public ActionResult WorkerInfo(string id)
  537. {
  538. ViewBag.id = id;
  539. TempData["ProID"] = id;
  540. TempData["ProjectID"] = id;
  541. return View();
  542. }
  543. /// <summary>
  544. /// 获取渠道对应的人员
  545. /// </summary>
  546. /// <returns></returns>
  547. public ActionResult GetWorkerInfo()
  548. {
  549. string id = TempData["ProID"].ToString();
  550. var dt = ProModule.GetWorkerInfo(id);
  551. return Content(dt, "application/json");
  552. }
  553. /// <summary>
  554. /// 获取项目对应的人员
  555. /// </summary>
  556. /// <returns></returns>
  557. public ActionResult GetWorker(string id)
  558. {
  559. var dt = ProModule.GetWorker(id);
  560. return Content(dt, "application/json");
  561. }
  562. /// <summary>
  563. /// 添加项目人员
  564. /// </summary>
  565. /// <returns></returns>
  566. [HttpPost]
  567. public int Add_Worker(WorkerBusinessModel model)
  568. {
  569. return ProModule.Add_Worker(model);
  570. }
  571. #endregion
  572. #region 项目人员修改
  573. /// <summary>
  574. ///项目人员修改弹窗
  575. /// </summary>
  576. /// <param name="id"></param>
  577. /// <returns></returns>
  578. public ActionResult UpdateWorkerInfo(string id)
  579. {
  580. ViewBag.id = id;
  581. return View();
  582. }
  583. /// <summary>
  584. /// 更新操作
  585. /// </summary>
  586. /// <returns></returns>
  587. [HttpPost]
  588. public int UpdateWorker(string id)
  589. {
  590. int r = ProModule.UpdateWorker(id);
  591. return r;
  592. }
  593. /// <summary>
  594. /// 根据ID获取人员信息
  595. /// </summary>
  596. /// <returns></returns>
  597. public ActionResult GetWorkerInfoByID(string id)
  598. {
  599. var user = GetCurrentUser();
  600. var dt = ProModule.GetWorkerInfoByID(user.PersonID);
  601. return this.ResponseJson(System.Net.HttpStatusCode.OK, "读取成功", dt);
  602. }
  603. #endregion
  604. #region 项目产品添加
  605. /// <summary>
  606. /// 添加项目产品的弹窗
  607. /// </summary>
  608. /// <param name="id"></param>
  609. /// <returns></returns>
  610. public ActionResult ProductInfo(string id)
  611. {
  612. ViewBag.id = id;
  613. return View();
  614. }
  615. /// <summary>
  616. /// 添加项目产品
  617. /// </summary>
  618. /// <param name="model"></param>
  619. /// <returns></returns>
  620. [HttpPost]
  621. public int Add_Product(ProductBusinessModel model)
  622. {
  623. return ProModule.Add_Product(model);
  624. }
  625. /// <summary>
  626. /// 获取产品名称
  627. /// </summary>
  628. /// <returns></returns>
  629. public ActionResult GetProductByID()
  630. {
  631. var dt = ProModule.GetProductByID();
  632. return Content(dt, "application/json");
  633. }
  634. /// <summary>
  635. /// 根据产品ID获取版本号
  636. /// </summary>
  637. /// <returns></returns>
  638. public ActionResult GetEditionByID(string id)
  639. {
  640. var json = ProModule.GetEditionByID(id);
  641. return Content(json, "text/json");
  642. }
  643. #endregion
  644. #region 项目产品修改
  645. /// <summary>
  646. /// 项目产品修改弹窗
  647. /// </summary>
  648. /// <param name="id"></param>
  649. /// <param name="xmid"></param>
  650. /// <returns></returns>
  651. public ActionResult UpdateProductInfo(string id, string xmid)
  652. {
  653. ViewBag.id = id;
  654. ViewBag.xmid = xmid;
  655. return View();
  656. }
  657. /// <summary>
  658. /// 变更产品状态
  659. /// </summary>
  660. /// <param name="id"></param>
  661. /// <param name="xmid"></param>
  662. /// <param name="qdid"></param>
  663. /// <param name="type">1新增2修改</param>
  664. /// <returns></returns>
  665. public ActionResult UpdateProductStatusChange(string id, string xmid, string qdid,int type)
  666. {
  667. ViewBag.id = id;
  668. ViewBag.xmid = xmid;
  669. ViewBag.qdid = qdid;
  670. ViewBag.type = type;
  671. return View();
  672. }
  673. /// <summary>
  674. /// 调整服务时间
  675. /// </summary>
  676. /// <param name="model"></param>
  677. /// <returns></returns>
  678. public int AdjustServiceTime(ProjectMainRecordsModel model)
  679. {
  680. var user = GetCurrentUser();
  681. model.DJR= user.Name;
  682. model.DJRID = user.PersonID;
  683. int r = ProModule.AdjustServiceTime(model);
  684. return r;
  685. } /// <summary>
  686. /// 修改产品服务时间
  687. /// </summary>
  688. /// <param name="model"></param>
  689. /// <returns></returns>
  690. public int UpdateAdjustServiceTime(ProjectMainRecordsModel model)
  691. {
  692. var user = GetCurrentUser();
  693. model.DJR = user.Name;
  694. model.DJRID = user.PersonID;
  695. int r = ProModule.UpdateAdjustServiceTime(model);
  696. return r;
  697. }
  698. /// <summary>
  699. /// 删除产品服务记录
  700. /// </summary>
  701. /// <param name="ID"></param>
  702. /// <returns></returns>
  703. public int DeleteAdjustServiceTime(string ID)
  704. {
  705. ProjectMainRecordsModel model= new ProjectMainRecordsModel();
  706. var user = GetCurrentUser();
  707. model.ID=ID;
  708. model.DJR = user.Name;
  709. model.DJRID = user.PersonID;
  710. int r = ProModule.DeleteAdjustServiceTime(model);
  711. return r;
  712. }
  713. /// <summary>
  714. /// 查询单条维保记录
  715. /// </summary>
  716. /// <param name="ID"></param>
  717. /// <returns></returns>
  718. public ActionResult Get_SingleServiceRecord(string id)
  719. {
  720. var json = ProModule.Get_SingleServiceRecord(id);
  721. return Content(json, "text/json");
  722. }
  723. /// <summary>
  724. /// 根据产品ID获取服务时间
  725. /// </summary>
  726. /// <param name="QDID"></param>
  727. /// <param name="XMID"></param>
  728. /// <param name="CPID"></param>
  729. /// <returns></returns>
  730. public ActionResult Get_ProductAdjustService(string QDID, string XMID, string CPID)
  731. {
  732. string json = ProModule.Get_ProductAdjustService(QDID, XMID, CPID).ToJson();
  733. return Content(json, "application/json");
  734. }
  735. /// <summary>
  736. /// 获取BH客户信息
  737. /// </summary>
  738. /// <returns></returns>
  739. public ActionResult GetBHCustomer(string q)
  740. {
  741. var url = ZLPMSAPI+"/api/ProblemManagSystem/GetBHCustomer";
  742. string data = "{\"name\": \"" + q + "\"}";
  743. var client = new HttpClient();
  744. var content = new StringContent(data, Encoding.UTF8, "application/json");
  745. var statereslut = client.PostAsync(url, content).Result.Content.ReadAsStringAsync().Result;
  746. JObject jResult = JObject.Parse(statereslut);
  747. var Result = jResult["data"];
  748. string strResult = Result.ToString();
  749. return Content(strResult, "application/json");
  750. }
  751. /// <summary>
  752. /// 更新操作
  753. /// </summary>
  754. /// <returns></returns>
  755. public int UpdateProduct(ProductBusinessModel model)
  756. {
  757. int r = ProModule.UpdateProduct(model);
  758. return r;
  759. }
  760. /// <summary>
  761. /// 产品ID根据ID获取产品名称
  762. /// </summary>
  763. /// <returns></returns>
  764. public ActionResult GetProductInfo(string id)
  765. {
  766. var json = ProModule.GetProductInfo(id);
  767. //return this.ResponseJson(System.Net.HttpStatusCode.OK, "读取成功", dt);
  768. return Content(json, "text/json");
  769. }
  770. //根据项目产品模块ID获取版本和说明
  771. [HttpPost]
  772. public ActionResult GetProjectProducct(string id)
  773. {
  774. var json = ProModule.GetProjectProducct(id);
  775. return Content(json, "text/json");
  776. }
  777. #endregion
  778. #region 项目产品删除
  779. /// <summary>
  780. /// 根据项目产品ID删除项目产品
  781. /// </summary>
  782. /// <param name="id"></param>
  783. /// <returns></returns>
  784. [HttpPost]
  785. public int Del_Product(string id)
  786. {
  787. int r = ProModule.Del_Product(id);
  788. return r;
  789. }
  790. #endregion
  791. #region 批量导入
  792. public ActionResult Itemupload(string ItemInfoId)
  793. {
  794. ViewBag.id = ItemInfoId;
  795. Session["ProjectID"] = ItemInfoId;
  796. return View();
  797. }
  798. [HttpPost]
  799. public string ItemSiteBatch()
  800. {
  801. var itemInfoId = Session["ProjectID"].ToString();// Request.Form["itemInfoId"];
  802. try
  803. {
  804. if (Request.Files.Count > 0)
  805. {
  806. var inputstream = Request.Files[0].InputStream;
  807. byte[] b = new byte[inputstream.Length];
  808. inputstream.Read(b, 0, (int)inputstream.Length);
  809. string inputstr = Encoding.Default.GetString(b);
  810. var rstr = ProModule.ItemSiteBatch(itemInfoId, inputstr);
  811. return rstr;
  812. }
  813. else
  814. {
  815. return "{\"code\":0,\"msg\":\"未获取上传文件\"}";
  816. }
  817. }
  818. catch (Exception)
  819. {
  820. return "{\"code\":0,\"msg\":\"调用人员批量录入时发生异常错误,请查看日志!\"}";
  821. }
  822. }
  823. #endregion
  824. #region 工具上传
  825. public ActionResult toolupload()
  826. {
  827. return View();
  828. }
  829. //上传操作
  830. [HttpPost]
  831. public string tool()
  832. {
  833. var files = this.Request.Files;
  834. if (this.Request.Files.Count > 0)
  835. {
  836. using (BinaryReader br = new BinaryReader(files[0].InputStream))
  837. {
  838. byte[] byteData = br.ReadBytes((int)files[0].InputStream.Length);
  839. var uploadFile = files[0];
  840. var fileName = uploadFile.FileName;
  841. var fileLen = uploadFile.ContentLength;
  842. var fileType = uploadFile.ContentType;
  843. string _tp = System.IO.Path.GetExtension(fileName);
  844. var r = UploadFile(byteData, fileName, fileType);
  845. }
  846. }
  847. return "1";
  848. }
  849. #endregion
  850. #region 附件上传/下载/删除
  851. //项目上传附件
  852. [HttpPost]
  853. public ActionResult FileUpload()
  854. {
  855. var result = false;
  856. var files = this.Request.Files;
  857. if (this.Request.Files.Count > 0)
  858. {
  859. using (BinaryReader br = new BinaryReader(files[0].InputStream))
  860. {
  861. byte[] byteData = br.ReadBytes((int)files[0].InputStream.Length);
  862. var uploadFile = files[0];
  863. var fileName = uploadFile.FileName;
  864. var fileLen = uploadFile.ContentLength;
  865. var fileType = uploadFile.ContentType;
  866. string _tp = System.IO.Path.GetExtension(fileName);
  867. var r = UploadFile(byteData, fileName, fileType);
  868. if (r.code == 100)
  869. {
  870. ///数据库存储附件ID
  871. result = ProModule.FileUpload(Session["project"].ToString(), r.data, GetCurrentUser().Name, fileType, Session["identifyID"]==null?"":Session["identifyID"].ToString(), Session["interfaceID"] == null ? "" : Session["interfaceID"].ToString());
  872. Session["identifyID"] = null;
  873. Session["interfaceID"] = null;
  874. }
  875. }
  876. }
  877. return Content(new PmsJsonResoult(result).ToString(), "application/json");
  878. }
  879. //获取项目附件
  880. [HttpPost]
  881. public ActionResult Attachment(string id, string type)
  882. {
  883. DataTable dt = ProModule.GetAttachment(id, type);
  884. List<FTPFileModel> list = new List<FTPFileModel>();
  885. for (int i = 0; i < dt.Rows.Count; i++)
  886. {
  887. var filetype = (dt.Rows[i]["类型"].ToString() == "image/png" || dt.Rows[i]["类型"].ToString() == "image/jpeg") ? 1 : 0;
  888. var ID = dt.Rows[i]["附件ID"].ToString();
  889. FtpDownloadResult model = DownloadFileBase64(ID, "o");
  890. FTPFileModel ftpmodel = new FTPFileModel();
  891. if (model != null)
  892. {
  893. ftpmodel.id = ID;
  894. ftpmodel.format = model.format;
  895. ftpmodel.fileName = model.fileName;
  896. ftpmodel.base64 = model.base64;
  897. ftpmodel.type = filetype;
  898. list.Add(ftpmodel);
  899. }
  900. }
  901. return Content(Strings.ObjectToJson(list), "application/json");
  902. }
  903. //删除项目附件
  904. [HttpPost]
  905. public int Delete_Attachment(string id)
  906. {
  907. return ProModule.Delete_Img(id);
  908. }
  909. #endregion
  910. #region 远程方式
  911. /// <summary>
  912. /// 根据项目ID获取远程方式
  913. /// </summary>
  914. /// <param name="id"></param>
  915. /// <returns></returns>
  916. [HttpPost]
  917. public ActionResult BingRemote(string id)
  918. {
  919. string json = ProModule.BingRemote(id);
  920. return Content(json, "application/json");
  921. }
  922. /// <summary>
  923. /// 弹窗
  924. /// </summary>
  925. /// <param name="id"></param>
  926. /// <returns></returns>
  927. public ActionResult Remote_Window(string id, int type)
  928. {
  929. ViewBag.type = type;
  930. ViewBag.id = id;
  931. return View();
  932. }
  933. /// <summary>
  934. /// 添加
  935. /// </summary>
  936. /// <returns></returns>
  937. [HttpPost]
  938. public int Add_Remote(RemoteBusinessModel model)
  939. {
  940. return ProModule.Add_Remote(model);
  941. }
  942. /// <summary>
  943. /// 编辑
  944. /// </summary>
  945. /// <returns></returns>
  946. [HttpPost]
  947. public int Edit_Remote(RemoteBusinessModel model)
  948. {
  949. return ProModule.Edit_Remote(model);
  950. }
  951. /// <summary>
  952. /// 删除
  953. /// </summary>
  954. /// <returns></returns>
  955. [HttpPost]
  956. public bool Del_Remote(RemoteBusinessModel model)
  957. {
  958. return ProModule.Del_Remote(model) != 0;
  959. }
  960. #endregion
  961. #region 个性化修改
  962. /// <summary>
  963. /// 根据项目ID获取个性化修改
  964. /// </summary>
  965. /// <param name="id"></param>
  966. /// <returns></returns>
  967. [HttpPost]
  968. public ActionResult BingIdentify(string id)
  969. {
  970. string json = ProModule.BingIdentify(id);
  971. return Content(json, "application/json");
  972. }
  973. /// <summary>
  974. /// 编辑获取数据
  975. /// </summary>
  976. /// <param name="id"></param>
  977. /// <returns></returns>
  978. public ActionResult GetDataById(string id)
  979. {
  980. return Content(ProModule.GetDataById(id), "application/json");
  981. }
  982. /// <summary>
  983. /// 弹窗
  984. /// </summary>
  985. /// <param name="id"></param>
  986. /// <returns></returns>
  987. public ActionResult Identify_Window(string id, int type)
  988. {
  989. ViewBag.type = type;
  990. ViewBag.id = id;
  991. return View();
  992. }
  993. /// <summary>
  994. /// 添加
  995. /// </summary>
  996. /// <returns></returns>
  997. [HttpPost]
  998. public string Add_Identify(Identify_Model model)
  999. {
  1000. model.XGSM = HttpUtility.UrlDecode(model.XGSM);
  1001. var result = ProModule.Add_Identify(model);
  1002. if (result.Length == 36)
  1003. {
  1004. Session["identifyID"] = result;
  1005. Session["project"] = model.XMID;
  1006. }
  1007. else
  1008. {
  1009. Session["identifyID"] = "null";
  1010. }
  1011. return result;
  1012. }
  1013. /// <summary>
  1014. /// 编辑
  1015. /// </summary>
  1016. /// <returns></returns>
  1017. [HttpPost]
  1018. public string Edit_Identify(Identify_Model model)
  1019. {
  1020. model.XGSM =HttpUtility.UrlDecode( model.XGSM);
  1021. var result = ProModule.Edit_Identify(model);
  1022. if (result.Length == 36) {
  1023. Session["identifyID"] = result;
  1024. Session["project"] = model.XMID;
  1025. }
  1026. else
  1027. {
  1028. Session["identifyID"] = "null";
  1029. }
  1030. return result;
  1031. }
  1032. /// <summary>
  1033. /// 删除
  1034. /// </summary>
  1035. /// <returns></returns>
  1036. [HttpPost]
  1037. public int Del_Identify(string id, string type)
  1038. {
  1039. if (type == "1")
  1040. {
  1041. return ProModule.Del_Identify(id);
  1042. }
  1043. else
  1044. {
  1045. return ProModule.Giveup_Identify(id);
  1046. }
  1047. }
  1048. #endregion
  1049. #region 验收仪器
  1050. /// <summary>
  1051. /// 根据项目ID获取验收仪器
  1052. /// </summary>
  1053. /// <param name="id"></param>
  1054. /// <returns></returns>
  1055. [HttpPost]
  1056. public ActionResult Binginstrument(string id)
  1057. {
  1058. string json = ProModule.Binginstrument(id);
  1059. return Content(json, "application/json");
  1060. }
  1061. /// <summary>
  1062. /// 添加验收仪器的弹窗
  1063. /// </summary>
  1064. /// <param name="id"></param>
  1065. /// <returns></returns>
  1066. public ActionResult Instrument_Window(string id)
  1067. {
  1068. ViewBag.id = id;
  1069. return View();
  1070. }
  1071. /// <summary>
  1072. /// 添加验收仪器
  1073. /// </summary>
  1074. /// <returns></returns>
  1075. [HttpPost]
  1076. public int Add_instrument(CheckinstrumentBusinessModel model)
  1077. {
  1078. return ProModule.Add_instrument(model);
  1079. }
  1080. /// <summary>
  1081. /// 删除验收仪器
  1082. /// </summary>
  1083. /// <returns></returns>
  1084. [HttpPost]
  1085. public int Del_instrument(string id)
  1086. {
  1087. return ProModule.Del_instrument(id);
  1088. }
  1089. #endregion
  1090. #region 验收模块
  1091. /// <summary>
  1092. /// 根据项目ID获取验收模块
  1093. /// </summary>
  1094. /// <param name="id"></param>
  1095. /// <returns></returns>
  1096. [HttpPost]
  1097. public ActionResult Bingmodual(string id)
  1098. {
  1099. string json = ProModule.Bingmodual(id);
  1100. return Content(json, "application/json");
  1101. }
  1102. /// <summary>
  1103. /// 添加验收模块的弹窗
  1104. /// </summary>
  1105. /// <param name="id"></param>
  1106. /// <returns></returns>
  1107. public ActionResult Modual_Window(string id)
  1108. {
  1109. ViewBag.id = id;
  1110. return View();
  1111. }
  1112. /// <summary>
  1113. /// 添加验收模块
  1114. /// </summary>
  1115. /// <returns></returns>
  1116. [HttpPost]
  1117. public int Add_modual(CheckModualBusinessModel model)
  1118. {
  1119. return ProModule.Add_modual(model);
  1120. }
  1121. /// <summary>
  1122. /// 删除验收模块
  1123. /// </summary>
  1124. /// <returns></returns>
  1125. [HttpPost]
  1126. public int Del_modual(string id)
  1127. {
  1128. return ProModule.Del_modual(id);
  1129. }
  1130. #endregion
  1131. #region 接口信息
  1132. #region 渠道
  1133. /// <summary>
  1134. /// 根据项目ID获取接口信息
  1135. /// </summary>
  1136. /// <param name="id"></param>
  1137. /// <returns></returns>
  1138. [HttpPost]
  1139. public ActionResult BingInterface(GlobalInte req)
  1140. {
  1141. string json = ProModule.BingInterface(req);
  1142. return Content(json, "application/json");
  1143. }
  1144. /// <summary>
  1145. /// 添加接口信息的弹窗
  1146. /// </summary>
  1147. /// <param name="id"></param>
  1148. /// <returns></returns>
  1149. public ActionResult Interface_Window(string id, int type, string state)
  1150. {
  1151. ViewBag.type = type;
  1152. ViewBag.id = id;
  1153. ViewBag.state = state;
  1154. return View();
  1155. }
  1156. /// <summary>
  1157. /// 添加接口信息
  1158. /// </summary>
  1159. /// <returns></returns>
  1160. [HttpPost]
  1161. public int Add_Interface(InterfaceBusinessModel model)
  1162. {
  1163. model.ID = Guid.NewGuid().ToString();
  1164. var result=ProModule.Add_Interface(model,GetCurrentUser().PersonID);
  1165. if(result==1)
  1166. {
  1167. Session["project"] = model.XMID;
  1168. Session["interfaceID"] = model.ID;
  1169. }
  1170. return result;
  1171. }
  1172. /// <summary>
  1173. /// 编辑接口信息
  1174. /// </summary>
  1175. /// <returns></returns>
  1176. [HttpPost]
  1177. public int Edit_Interface(InterfaceBusinessModel model)
  1178. {
  1179. var result = ProModule.Edit_Interface(model);
  1180. if (result == 1)
  1181. {
  1182. Session["project"] = model.XMID;
  1183. Session["interfaceID"] = model.ID;
  1184. }
  1185. return result;
  1186. }
  1187. /// <summary>
  1188. /// 删除接口信息
  1189. /// </summary>
  1190. /// <returns></returns>
  1191. [HttpPost]
  1192. public int Del_Interface(string id)
  1193. {
  1194. return ProModule.Del_Interface(id);
  1195. }
  1196. /// <summary>
  1197. /// 根据ID获取接口信息
  1198. /// </summary>
  1199. /// <param name="id"></param>
  1200. /// <returns></returns>
  1201. [HttpPost]
  1202. public ActionResult GetInterface(string id)
  1203. {
  1204. string json = ProModule.GetInterface(id).ToJson();
  1205. return Content(json, "application/json");
  1206. }
  1207. #endregion
  1208. #region 总部
  1209. public ActionResult GolbalInte()
  1210. {
  1211. ViewBag.userInfo = GetCurrentUser().PersonProperty;
  1212. return View();
  1213. }
  1214. /// <summary>
  1215. /// 添加接口信息的弹窗
  1216. /// </summary>
  1217. /// <param name="id"></param>
  1218. /// <returns></returns>
  1219. public ActionResult GlobalInteWindow(int type, string id, string state)
  1220. {
  1221. ViewBag.type = type;
  1222. ViewBag.state = state;
  1223. ViewBag.id = id;
  1224. return View();
  1225. }
  1226. /// <summary>
  1227. /// 变更接口状态的弹窗
  1228. /// </summary>
  1229. /// <param name="id"></param>
  1230. /// <returns></returns>
  1231. public ActionResult DealWindow(string id)
  1232. {
  1233. ViewBag.id = id;
  1234. return View();
  1235. }
  1236. /// <summary>
  1237. /// 根据ID获取接口过程
  1238. /// </summary>
  1239. /// <param name="id"></param>
  1240. /// <returns></returns>
  1241. [HttpPost]
  1242. public int DealInte(InterfaceBusinessModel model)
  1243. {
  1244. var result = ProModule.DealInte(model, GetCurrentUser().PersonID);
  1245. if (result == 1)
  1246. {
  1247. Session["project"] = model.XMID;
  1248. Session["interfaceID"] = model.ID;
  1249. }
  1250. return result;
  1251. }
  1252. /// <summary>
  1253. /// 根据ID获取接口过程
  1254. /// </summary>
  1255. /// <param name="id"></param>
  1256. /// <returns></returns>
  1257. [HttpPost]
  1258. public ActionResult GetInteProcess(string id)
  1259. {
  1260. string json = ProModule.GetInteProcess(id);
  1261. return Content(json, "application/json");
  1262. }
  1263. /// <summary>
  1264. /// 获取性质除了客户的人员信息
  1265. /// </summary>
  1266. /// <param name="id"></param>
  1267. /// <returns></returns>
  1268. public ActionResult GetinfoBynature(int type)
  1269. {
  1270. string json = ProModule.GetinfoBynature(type);
  1271. return Content(json, "application/json");
  1272. }
  1273. #endregion
  1274. #endregion
  1275. #region 查询字典表
  1276. /// <summary>
  1277. /// 查询字典表
  1278. /// </summary>
  1279. /// <param name="ID"></param>
  1280. /// <returns></returns>
  1281. public ActionResult SelectNature(string ID)
  1282. {
  1283. var list = account_obj.SelectNature(ID);
  1284. var json = Strings.ObjectToJson(list);
  1285. return Content(json, "application/json");
  1286. }
  1287. #endregion
  1288. #region 迁移机构数据变成项目
  1289. /// <summary>
  1290. /// 迁移渠道项目【将机构变成项目】
  1291. /// </summary>
  1292. /// <param name="ProjectID">项目ID</param>
  1293. /// <param name="SiteID">机构ID</param>
  1294. /// <returns></returns>
  1295. public ActionResult MigrationOrganization(string ProjectID, string SiteID)
  1296. {
  1297. var msg = "";
  1298. var state = ProModule.MigrationOrganization( ProjectID, SiteID, GetCurrentUser(), out msg);
  1299. return Content(new PmsJsonResoult(true, msg, null).ToString(), "text/json");
  1300. }
  1301. #endregion
  1302. }
  1303. }