biz_stopScan.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7. using System.Threading;
  8. using Newtonsoft.Json;
  9. using Saraff.Twain;
  10. using HXX.Scanner.Socket;
  11. using HXX.Scanner.Common;
  12. namespace HXX.Scanner.Biz.Socket
  13. {
  14. /// <summary>
  15. /// 业务处理 停止扫描
  16. /// </summary>
  17. public class biz_stopScan
  18. {
  19. /// <summary>
  20. /// 主业务
  21. /// </summary>
  22. /// <param name="connId"></param>
  23. /// <param name="data"></param>
  24. public static void Work(IntPtr connId, cmd_stopScan data)
  25. {
  26. var response = work_detail(connId, data);
  27. //SocketServerManager.Send_Family(connId, response.ToJson());
  28. SocketServerManager.Send_Single(connId, response.ToJson());
  29. }
  30. /// <summary>
  31. /// 停止扫描及构造返回值
  32. /// </summary>
  33. /// <param name="connId"></param>
  34. /// <param name="data"></param>
  35. /// <returns></returns>
  36. public static response_stopScan work_detail(IntPtr connId, cmd_stopScan data)
  37. {
  38. //修改环境参数为停止(真实停止业务根据本值做实时判断和操作)
  39. config_environment.scan_state = false;
  40. var response = new response_stopScan()
  41. {
  42. param = new response_stopScanSub()
  43. };
  44. try
  45. {
  46. if (config_environment.web_parameter != null)
  47. {
  48. response.param.examId = config_environment.web_parameter.examId;
  49. response.param.examPaperId = config_environment.web_parameter.examPaperId;
  50. response.param.scanCount = new biz_db().get_count_by_seq(config_environment.web_parameter.batchNumber, config_environment.web_parameter.zipId, config_environment.web_parameter.paperSchema);
  51. config_environment.web_parameter.examPaperId = "0";
  52. }
  53. }
  54. catch (Exception ee)
  55. {
  56. LogManager.WriteLog(ee);
  57. response.code = 500;
  58. response.msg = ee.Message;
  59. }
  60. return response;
  61. }
  62. }
  63. }