| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- using System.Threading;
- using System.Collections.Concurrent;
- using SqlSugar;
- using Newtonsoft.Json;
- using HXX.Scanner.Database;
- using HXX.Scanner.Common;
- using HXX.Scanner.Biz.Socket;
- using HXX.Scanner.Socket;
- namespace HXX.Scanner.Biz.Socket
- {
- /// <summary>
- /// 业务处理 扫描完毕时发送信息
- /// </summary>
- public class biz_scanFinishBatch
- {
- /// <summary>
- /// 主业务
- /// </summary>
- /// <param name="stopStatus"> 1:正常完成 2:手动取消 3:异常 4:弹框取消 5:开始重连扫描仪 6:重连扫描仪成功 7:扫描完成(上传尚未完成)</param>
- /// <param name="immediate">等待标记</param>
- public static void Work(int stopStatus, bool immediate)
- {
- //是否等待所有http上传结束再发送
- if (!immediate)
- {
- while (!http_manager.check_is_queue_empty())
- {
- Thread.Sleep(100);
- }
- Thread.Sleep(1000);
- }
- if (config_environment.web_parameter != null)
- {
- config_environment.web_parameter.examPaperId = "0";
- }
- if (config_environment.scan_type == ScanType.Formal || config_environment.scan_type == ScanType.Test_From_Web)
- {
- //Task.Run(() =>
- //{
- //SocketServerManager.Send_Family(config_environment.current_invoker, get_cmd(stopStatus).ToJson());
- SocketServerManager.Send_Single(config_environment.current_invoker, get_cmd(stopStatus).ToJson());
- //});
- if (stopStatus == 1|| stopStatus == 3)
- {
- http_manager.notify_scan_finish();
- }
- }
- }
- /// <summary>
- /// 构造返回值
- /// </summary>
- /// <param name="stopStatus"></param>
- /// <returns></returns>
- private static cmd_scanFinishBatch get_cmd(int stopStatus)
- {
- cmd_scanFinishBatch result = new cmd_scanFinishBatch();
- result.action = "scanFinishBatch";
- result.param = new subCmd_scanFinishBatch();
- result.param.stopStatus = stopStatus;
- if (config_environment.web_parameter != null)
- {
- result.param.zipId = config_environment.web_parameter.zipId;
- result.param.isTest = config_environment.web_parameter.isTest;
- }
- return result;
- }
- }
- }
|