| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- using System.Collections.Concurrent;
- using HXX.Scanner.Common;
- using HXX.Scanner.Biz.Socket;
- namespace HXX.Scanner.Biz
- {
- /// <summary>
- /// 扫描环境相关
- /// </summary>
- public class biz_environment
- {
- /// <summary>
- /// 根据int参数判断纸张规格
- /// </summary>
- /// <param name="size"></param>
- /// <returns></returns>
- public static PaperSize get_paper_size(int size)
- {
- PaperSize result;
- switch (size)
- {
- case 3:
- result = PaperSize.A3;
- break;
- case 4:
- result = PaperSize.A4;
- break;
- case 8:
- result = PaperSize.K8;
- break;
- case 16:
- result = PaperSize.K16;
- break;
- default:
- result = PaperSize.A4;
- break;
- }
- return result;
- }
- /// <summary>
- /// 根据纸张规格判断纸张参数
- /// </summary>
- /// <param name="size"></param>
- /// <returns></returns>
- public static Tuple<int, PaperSize> get_paper_size(string size)
- {
- Tuple<int, PaperSize> result;
- switch (size)
- {
- case "A3":
- result = new Tuple<int, PaperSize>(3, PaperSize.A3);
- break;
- case "A4":
- result = new Tuple<int, PaperSize>(4, PaperSize.A4);
- break;
- default:
- result = new Tuple<int, PaperSize>(4, PaperSize.A4);
- break;
- }
- return result;
- }
- /// <summary>
- /// 判断当前扫描环境(正式扫描还是测试扫描)
- /// </summary>
- /// <param name="data"></param>
- /// <returns></returns>
- public static ScanType get_scan_type(int data)
- {
- ScanType result;
- switch (data)
- {
- case 0:
- result = ScanType.Formal;
- break;
- case 1:
- result = ScanType.Test_From_Web;
- break;
- case 2:
- result = ScanType.Test_3rd_Party;
- break;
- default:
- result = ScanType.Test_Panel_1_Side;
- break;
- }
- return result;
- }
- /// <summary>
- /// 判断扫单面还是双面
- /// </summary>
- /// <param name="data"></param>
- /// <returns></returns>
- public static bool get_ab(int data)
- {
- if (data == 1)
- {
- return false;
- }
- else
- {
- return true;
- }
- }
- /// <summary>
- /// 获取客户端专属uuid
- /// </summary>
- public static void init_unique_client_id()
- {
- var key = "unique_client_id";
- var id = config_manager.Get(key);
- if (string.IsNullOrEmpty(id))
- {
- id = Guid.NewGuid().ToString();
- config_manager.Set(key, id);
- }
- config_environment.unique_client_id = id;
- }
- }
- }
|