Main.cs 98 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028
  1. using CCWin;
  2. using Newtonsoft.Json;
  3. using Newtonsoft.Json.Linq;
  4. using SufeiUtil;
  5. using SXLibrary;
  6. using System;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. using System.Data.SQLite;
  10. using System.Drawing;
  11. using System.IO;
  12. using System.IO.Ports;
  13. using System.Linq;
  14. using System.Net;
  15. using System.Threading;
  16. using System.Threading.Tasks;
  17. using System.Web.Configuration;
  18. using System.Windows.Forms;
  19. namespace MOKA_Factory_Tools
  20. {
  21. public delegate void MoveHandler(Point XY, ArrayList formlocationmsg, int num);
  22. public delegate void KeyDownHandler(ArrayList formlocationmsg, IntPtr intPtr);
  23. public partial class Main : Skin_Color
  24. {
  25. public static string Is_Smt { get; set; }
  26. MidList midList1 = new MidList();
  27. UpgradeMsgList UpgradeMsgList1 = new UpgradeMsgList();
  28. MidAddress midAddress1 = new MidAddress();
  29. Config_ReadCheck cfg_readcheck = new Config_ReadCheck();
  30. Config_WriteCheck cfg_writecheck = new Config_WriteCheck();
  31. Config_WriteDone cfg_writedone = new Config_WriteDone();
  32. FunctionSetting functionSetting1 = new FunctionSetting();
  33. SQLiteConnection LocalDB = null;
  34. SQLiteConnection ErrorDB = null;
  35. SQLiteConnection ReportDB = null;
  36. Dictionary<string, string> ChannelMapList = new Dictionary<string, string>();
  37. Dictionary<string, string> LanguageMapList = new Dictionary<string, string>();
  38. List<KeyType> key2Write = null;
  39. string Custom_ProjectID = "";
  40. ArrayList formlocationmsg = new ArrayList();
  41. string ErrorDBPath = AppDomain.CurrentDomain.BaseDirectory + "\\Error.db";
  42. string ReportDBPath = AppDomain.CurrentDomain.BaseDirectory + "\\DB\\ReportData.db";
  43. Thread uploadbackground;
  44. bool LocalWrite = false;//离线抄写开关
  45. bool LocationMark = true;//操作窗体换行点
  46. int LocationNum = 0;//一行操作窗体数
  47. public event KeyDownHandler KeyDownEvent;
  48. public event MoveHandler MoveEvent;
  49. public Main(int enable)
  50. {
  51. InitializeComponent();
  52. LockSettingFunction(enable == 0 || enable == 3);
  53. CreateKeyManually.Visible = enable == 1;
  54. LocalWrite = enable == 3;
  55. }
  56. private void Form1_Load(object sender, EventArgs e)
  57. {
  58. uploadbackground = new Thread(UploadBackGround);
  59. uploadbackground.IsBackground = true;
  60. TVCOM.Items.AddRange(SerialPort.GetPortNames());
  61. LoadJsonConfig();
  62. this.StartPosition = FormStartPosition.Manual;
  63. this.Location = new Point(0, 0);
  64. //增加整机抄写和板卡抄写文字提示,界面颜色随之修改
  65. //根据配置文件,这个是整机抄写模式
  66. if(functionSetting1.IsSmt == "0")
  67. {
  68. this.Text = CommonMethod.FactoryName + " " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()+" " + "整机抄写";
  69. }
  70. else
  71. {
  72. this.Text = CommonMethod.FactoryName + " " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + " " + "板卡抄写";
  73. // 修改底色;
  74. this.CaptionBackColorTop = Color.Red;
  75. this.CaptionBackColorBottom = Color.Goldenrod;
  76. this.BackColor = Color.AliceBlue;
  77. }
  78. if (!File.Exists(ErrorDBPath))
  79. {
  80. if (SQLiteHelper.NewDbFile(ErrorDBPath))
  81. {
  82. SQLiteHelper.NewTable(ErrorDBPath, "ErrorReport", "(ID INTEGER PRIMARY KEY AUTOINCREMENT,url varchar,content varvhar,gener_date DATETIME DEFAULT (datetime(CURRENT_TIMESTAMP,'localtime')),report_date DATETIME)");
  83. SQLiteHelper.NewTable(ErrorDBPath, "CopyDelayReport", "(ID INTEGER PRIMARY KEY AUTOINCREMENT,bid varchar,url varchar,content varvhar,copy_date DATETIME DEFAULT (datetime(CURRENT_TIMESTAMP,'localtime')),report_date DATETIME)");
  84. SQLiteHelper.NewTable(ErrorDBPath, "ProductionCount", "(bid varchar,count varchar)");
  85. }
  86. }
  87. if (ErrorDB == null)
  88. {
  89. ErrorDB = new SQLiteConnection("data source=" + ErrorDBPath);
  90. ErrorDB.Open();
  91. }
  92. if (ReportDB == null)
  93. {
  94. ReportDB = new SQLiteConnection("data source=" + ReportDBPath);
  95. ReportDB.Open();
  96. }
  97. #region 研发账号
  98. if (CommonMethod.GetLoginAccout().Equals("RD", StringComparison.OrdinalIgnoreCase))
  99. {
  100. if(functionSetting1.IsSmt == "0")
  101. {
  102. // 修改标题;
  103. this.Text = "研发抄写专用版" + " " +"整机抄写";
  104. // 修改底色;
  105. this.CaptionBackColorTop = Color.AntiqueWhite;
  106. this.CaptionBackColorBottom = Color.Beige;
  107. this.BackColor = Color.AliceBlue;
  108. }
  109. else
  110. {
  111. // 修改标题;
  112. this.Text = "研发抄写专用版" + " " + "板卡抄写";
  113. // 修改底色;
  114. this.CaptionBackColorTop = Color.Aqua;
  115. this.CaptionBackColorBottom = Color.Azure;
  116. this.BackColor = Color.AliceBlue;
  117. }
  118. }
  119. #endregion
  120. }
  121. private void SetDSNLimit()
  122. {
  123. #region 试产订单,不需要自动限制条码;
  124. string strValue = CommonMethod.ReadProfileString("MOKAFactoryTools", "OrderType", "");
  125. if (strValue.Equals("TR", StringComparison.OrdinalIgnoreCase))
  126. {
  127. return;
  128. }
  129. #endregion
  130. // 如果抄写PSN,不自动赋值条码限制;
  131. if (BarcodeWrite.Checked)
  132. return;
  133. // 设置条码限制默认打上勾;
  134. if (midList1.keytype != null && !functionSetting1.MITVEnable && !functionSetting1.IndiaMITVEnable && midList1.keytype.ContainsKey("DSN"))
  135. {
  136. BarcodeLimit.Checked = true;
  137. BarCodeKeyCodeText.Text = OrderText.Text;
  138. }
  139. }
  140. private void OrderSubmit_Click(object sender, EventArgs e)
  141. {
  142. SQLiteHelper.DeleteOldData(ErrorDB);//删除30天以前已经上报的数据
  143. if (TestMode.serverurl == Serverurl.Testurl)
  144. {// 此软件连接测试服务器,请勿用于生产
  145. MessageBoxButtons messButton = MessageBoxButtons.YesNo;
  146. DialogResult dr = MessageBox.Show(LResource.TestServerUsingError, LResource.Error, messButton);
  147. if (dr == DialogResult.Yes)
  148. {
  149. //
  150. }
  151. else
  152. {
  153. return;
  154. }
  155. }
  156. if (TVCOM.SelectedItem == null)
  157. {
  158. MessageBox.Show(LResource.TVCOMNullError, LResource.Error);
  159. return;
  160. }
  161. if (OrderText.Text.Trim().Length == 0)
  162. {
  163. MessageBox.Show(LResource.OrderNullError, LResource.Error);
  164. return;
  165. }
  166. if (!SQLiteHelper.CheckProductionNum(ErrorDB, OrderText.Text.Trim()))
  167. {
  168. MessageBox.Show(LResource.CheckProductionNumError, LResource.Error);
  169. return;
  170. }
  171. if (timer1.Enabled == false)
  172. timer1.Start();
  173. OrderSubmit.Text = LResource.Waiting;
  174. SaveJsonConfig("LastOrder", OrderText.Text.ToString());
  175. functionSetting1.TVCOM = TVCOM.SelectedItem.ToString();
  176. functionSetting1.TVBaud = TVBaud.SelectedItem.ToString();
  177. functionSetting1.ChannelList = ChannelList.SelectedItem.ToString();
  178. functionSetting1.WriteChannel = WriteChannel.Checked;
  179. functionSetting1.WriteOSD = WriteOSD.Checked;
  180. functionSetting1.OSDList = OSDList.SelectedItem.ToString();
  181. functionSetting1.WriteSHOP = WriteSHOP.Checked;
  182. functionSetting1.SHOPList = SHOPList.SelectedItem.ToString();
  183. functionSetting1.WriteWB = WriteWB.Checked;
  184. functionSetting1.WBInit = WBInit.Checked;
  185. functionSetting1.WBPath = WBPath.Text;
  186. if (!LocalWrite)
  187. {
  188. if (Preload.Checked)
  189. {
  190. string dbPath = AppDomain.CurrentDomain.BaseDirectory + "\\Keys\\" + OrderText.Text.Trim() + ".db";
  191. if (File.Exists(dbPath))
  192. {
  193. if (LocalDB == null)
  194. {
  195. LocalDB = new SQLiteConnection("data source=" + dbPath);
  196. LocalDB.Open();
  197. }
  198. if (SQLiteHelper.WholeCheckDownloadStatus(LocalDB, OrderText.Text.Trim()))
  199. {
  200. try
  201. {
  202. if (SQLiteHelper.GetDBMidInfo(LocalDB, OrderText.Text.Trim(), out midAddress1))
  203. {
  204. if (UsinglocalIDCheck.Checked)
  205. {
  206. midAddress1.pid = Custom_ProjectID;
  207. MessageBox.Show(LResource.WilluseLocalPID, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  208. }
  209. else if (midAddress1.pid != Custom_ProjectID && Custom_ProjectID.Trim().Length > 0)
  210. {
  211. if (midAddress1.pid != null)
  212. if (midAddress1.pid.Trim().Length > 0)
  213. PID_Num.Value = Convert.ToDecimal(midAddress1.pid);
  214. MessageBox.Show(LResource.WilluseOnlinePID, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
  215. }
  216. if (SQLiteHelper.GetrokuCustomer(LocalDB, OrderText.Text, out RokuCustomer rokuCustomer_1))
  217. {
  218. midList1.rokuCustomer = rokuCustomer_1;
  219. };
  220. if (SQLiteHelper.Getdsn(LocalDB, OrderText.Text, out string firetvdsn))
  221. {
  222. midList1.keytype = new Dictionary<string, string>();
  223. midList1.keytype.Add("DSN", firetvdsn);
  224. };
  225. if (SQLiteHelper.Getwhitebalance(LocalDB, OrderText.Text, out WhiteBalanceInfo whiteBalanceInfo_1))
  226. {
  227. functionSetting1.WBPath = dbPath;
  228. functionSetting1.WriteWB = true;
  229. functionSetting1.NormalRGB = new byte[3];
  230. functionSetting1.CoolRGB = new byte[3];
  231. functionSetting1.WarmRGB = new byte[3];
  232. functionSetting1.NormalRGB[0] = (byte)Convert.ToDouble(whiteBalanceInfo_1.hdmirgain);
  233. functionSetting1.NormalRGB[1] = (byte)Convert.ToDouble(whiteBalanceInfo_1.hdmiggain);
  234. functionSetting1.NormalRGB[2] = (byte)Convert.ToDouble(whiteBalanceInfo_1.hdmibgain);
  235. functionSetting1.CoolRGB[0] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.lrgain) + 256);
  236. functionSetting1.CoolRGB[1] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.lggain) + 256);
  237. functionSetting1.CoolRGB[2] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.lbgain) + 256);
  238. functionSetting1.WarmRGB[0] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.nrgain) + 256);
  239. functionSetting1.WarmRGB[1] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.nggain) + 256);
  240. functionSetting1.WarmRGB[2] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.nbgain) + 256);
  241. };
  242. OperationPanel operationPanel1 = new OperationPanel(this, LocalDB, ErrorDB, midAddress1, functionSetting1, cfg_writecheck, cfg_readcheck, cfg_writedone, Preload.Checked, midList1, OrderText.Text.Trim());
  243. operationPanel1.StartPosition = FormStartPosition.Manual;
  244. if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width && LocationMark)
  245. {
  246. LocationMark = false;
  247. LocationNum = formlocationmsg.Count;
  248. }
  249. if (formlocationmsg.Count == 0)
  250. operationPanel1.Location = (Point)new Size(this.Right, this.Top);
  251. else if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width)
  252. {
  253. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  254. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * (formlocationmsg.Count - LocationNum), this.Top + operationPanel1.Size.Height);
  255. }
  256. else
  257. {
  258. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  259. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * formlocationmsg.Count, this.Top);
  260. }
  261. operationPanel1.DeleteIntptr += new OperationPanel.DisplayUpdateDelegate(DeleteIntptr);
  262. operationPanel1.SNKeyDownEven += new OperationPanel.SNKeyDown(SNKeyDownEven);
  263. IntPtr intPtr = operationPanel1.Handle;
  264. Dictionary<IntPtr, Point> part1 = new Dictionary<IntPtr, Point>();
  265. part1.Add(intPtr, (Point)new Size(operationPanel1.Right, operationPanel1.Top));
  266. formlocationmsg.Add(part1);
  267. operationPanel1.Show();
  268. }
  269. else
  270. {
  271. MessageBox.Show("Read LocalDB error,please delete old db file and download a new one");
  272. }
  273. }
  274. catch (Exception ex)
  275. {
  276. Log.WriteErrorLog(ex.Message);
  277. }
  278. // 是否有dsn要抄写;
  279. SetDSNLimit();
  280. }
  281. }
  282. else
  283. {
  284. // 预绑定模式下:没有db数据库时需要下载json包;
  285. if (V2Method.GetMidInfo(OrderText.Text.Trim(), TestMode.MAC, ErrorDB, out midList1))
  286. {
  287. CommonMethod.SetCommonsData(functionSetting1, midList1);
  288. if (V2Method.GetOfflineData(midList1.host, OrderText.Text.Trim(), ErrorDB, out List<MidAddress> midAddress2))
  289. {
  290. WhiteBalanceList WhiteBalanceListNow;
  291. // 如果是抄写EDID,则不获取白平衡数据;
  292. if (CommonMethod.IsEDIDCopy(midList1))
  293. midList1.whiteType = "-1";
  294. #if DEBUG
  295. midList1.whiteType = "-1";
  296. #endif
  297. switch (midList1.whiteType)//订单白平衡预置状态
  298. {
  299. case "0"://旧订单,默认值
  300. {
  301. CommonMethod.GetWhiteBalanceInfo(TestMode.getWhiteBalanceInfoUrl, OrderText.Text.Trim(), TestMode.MAC, ErrorDB, out WhiteBalanceListNow);
  302. break;
  303. }
  304. case "1"://未预置或预置LR数据
  305. {
  306. CommonMethod.GetWhiteBalanceInfo(TestMode.getWhiteBalanceInfoUrl, OrderText.Text.Trim(), TestMode.MAC, ErrorDB, out WhiteBalanceListNow);
  307. if (WhiteBalanceListNow.whiteBalanceInfo == null)
  308. {
  309. MessageBox.Show("White balance info error, please contact factory engineer!");
  310. return;
  311. }
  312. break;
  313. }
  314. case "2"://已预置PR数据
  315. {
  316. CommonMethod.GetWhiteBalanceInfo(TestMode.getWhiteBalanceInfoUrl, OrderText.Text.Trim(), TestMode.MAC, ErrorDB, out WhiteBalanceListNow);
  317. break;
  318. }
  319. default:
  320. {
  321. WhiteBalanceListNow = null;
  322. break;
  323. }
  324. }
  325. foreach (var midAddress1 in midAddress2)
  326. {
  327. string KeyPath = AppDomain.CurrentDomain.BaseDirectory + "\\download\\" + midAddress1.order + ".json";
  328. if (System.IO.File.Exists(KeyPath))
  329. {
  330. if (GetMD5.GetMD5HashFromFile(KeyPath) == midAddress1.pmd5)
  331. {
  332. if (SQLiteHelper.NewDbFile(dbPath))
  333. {
  334. SQLiteHelper.NewTable(dbPath, "keys", "(sn varchar,keys varvhar,copy_date DATETIME,report_date DATETIME)");
  335. SQLiteHelper.NewTable(dbPath, "mid", "(bid varchar,number varchar, pid varchar,ctype varvhar,version varvhar,host varchar,purl varvhar,psize varvhar,pmd5 varvhar,status varvhar,start_date DATETIME DEFAULT (datetime(CURRENT_TIMESTAMP,'localtime')),finish_date DATETIME,desc varvhar)");
  336. SQLiteHelper.NewTable(dbPath, "report", "(url varchar,content varchar,gener_date DATETIME,report_date DATETIME)");
  337. SQLiteHelper.NewTable(dbPath, "rokuCustomer", "(ordernum varchar, data varchar)");
  338. SQLiteHelper.NewTable(dbPath, "whitebalance", "(ordernum varchar,hdmirgain varchar,hdmiggain varchar,hdmibgain varchar,nrgain varchar,nggain varchar,nbgain varchar,lrgain varchar,lggain varchar,lbgain varchar,updatetime DATETIME DEFAULT (datetime(CURRENT_TIMESTAMP,'localtime')))");
  339. SQLiteHelper.NewTable(dbPath, "dsn", "(ordernum varchar,dsn varchar,updatetime DATETIME DEFAULT (datetime(CURRENT_TIMESTAMP,'localtime')))");
  340. SQLiteHelper.AddOneLine(dbPath, new object[] { midAddress1.order, midAddress1.number, midAddress1.pid, midAddress1.ctype, midAddress1.version, midList1.host, midAddress1.purl, midAddress1.psize, midAddress1.pmd5, "1" });
  341. if (midList1.rokuCustomer != null)
  342. {
  343. SQLiteHelper.AddRokuOneLine(dbPath, new object[]{
  344. midList1.rokuCustomer.ordernum,
  345. JsonConvert.SerializeObject(midList1.rokuCustomer).ToString()
  346. });
  347. }
  348. if (WhiteBalanceListNow != null)
  349. if (WhiteBalanceListNow.whiteBalanceInfo != null)
  350. SQLiteHelper.AddwbOneLine(dbPath, new object[] {
  351. WhiteBalanceListNow.whiteBalanceInfo.ordernum,
  352. WhiteBalanceListNow.whiteBalanceInfo.hdmirgain,
  353. WhiteBalanceListNow.whiteBalanceInfo.hdmiggain,
  354. WhiteBalanceListNow.whiteBalanceInfo.hdmibgain,
  355. WhiteBalanceListNow.whiteBalanceInfo.nrgain,
  356. WhiteBalanceListNow.whiteBalanceInfo.nggain,
  357. WhiteBalanceListNow.whiteBalanceInfo.nbgain,
  358. WhiteBalanceListNow.whiteBalanceInfo.lrgain,
  359. WhiteBalanceListNow.whiteBalanceInfo.lggain,
  360. WhiteBalanceListNow.whiteBalanceInfo.lbgain
  361. });
  362. if (midList1.keytype.ContainsKey("DSN"))
  363. {
  364. SQLiteHelper.AdddsnOneLine(dbPath, new object[] { midAddress1.order, midList1.keytype["DSN"] });
  365. }
  366. SQLiteHelper.UpdateTime(dbPath, midAddress1.order);
  367. }
  368. if (File.Exists(dbPath))
  369. {
  370. List<object[]> keyDatas = new List<object[]>();
  371. using (System.IO.StreamReader file = System.IO.File.OpenText(KeyPath))
  372. {
  373. using (JsonTextReader reader = new JsonTextReader(file))
  374. {
  375. JArray o = (JArray)JToken.ReadFrom(reader);
  376. foreach (var ss in o) //查找某个字段与值
  377. {
  378. var sn = ((JObject)ss)["sn"];
  379. var data = ((JObject)ss)["key"];
  380. keyDatas.Add(new object[] { sn, data });
  381. }
  382. }
  383. }
  384. SQLiteHelper.InsertKeys(dbPath, keyDatas);
  385. }
  386. try
  387. {
  388. if (LocalDB == null)
  389. {
  390. LocalDB = new SQLiteConnection("data source=" + dbPath);
  391. LocalDB.Open();
  392. }
  393. OperationPanel operationPanel1 = new OperationPanel(this, LocalDB, ErrorDB, midAddress1, functionSetting1, cfg_writecheck, cfg_readcheck, cfg_writedone, Preload.Checked, midList1, OrderText.Text.Trim());
  394. operationPanel1.StartPosition = FormStartPosition.Manual;
  395. if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width && LocationMark)
  396. {
  397. LocationMark = false;
  398. LocationNum = formlocationmsg.Count;
  399. }
  400. if (formlocationmsg.Count == 0)
  401. operationPanel1.Location = (Point)new Size(this.Right, this.Top);
  402. else if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width)
  403. {
  404. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  405. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * (formlocationmsg.Count - LocationNum), this.Top + operationPanel1.Size.Height);
  406. }
  407. else
  408. {
  409. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  410. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * formlocationmsg.Count, this.Top);
  411. }
  412. operationPanel1.DeleteIntptr += new OperationPanel.DisplayUpdateDelegate(DeleteIntptr);
  413. operationPanel1.SNKeyDownEven += new OperationPanel.SNKeyDown(SNKeyDownEven);
  414. IntPtr intPtr = operationPanel1.Handle;
  415. Dictionary<IntPtr, Point> part1 = new Dictionary<IntPtr, Point>();
  416. part1.Add(intPtr, (Point)new Size(operationPanel1.Right, operationPanel1.Top));
  417. formlocationmsg.Add(part1);
  418. operationPanel1.Show();
  419. }
  420. catch (Exception ex)
  421. {
  422. Log.WriteErrorLog(ex.Message);
  423. }
  424. }
  425. else
  426. {
  427. Download DownloadPage = new Download(ErrorDB, midAddress1, -1, midList1, WhiteBalanceListNow);
  428. DownloadPage.ShowDialog();
  429. int gid = GC.GetGeneration(DownloadPage);
  430. DownloadPage = null;
  431. GC.Collect(gid);
  432. }
  433. }
  434. else
  435. {
  436. Download DownloadPage = new Download(ErrorDB, midAddress1, -1, midList1, WhiteBalanceListNow);
  437. DownloadPage.ShowDialog();
  438. int gid = GC.GetGeneration(DownloadPage);
  439. DownloadPage = null;
  440. GC.Collect(gid);
  441. }
  442. }
  443. if (File.Exists(dbPath))
  444. {
  445. if (LocalDB == null)
  446. {
  447. LocalDB = new SQLiteConnection("data source=" + dbPath);
  448. LocalDB.Open();
  449. }
  450. if (SQLiteHelper.WholeCheckDownloadStatus(LocalDB, OrderText.Text.Trim()))
  451. {
  452. if (V2Method.ReportDownloadStatus(midList1.host, OrderText.Text.Trim(), ErrorDB))
  453. MessageBox.Show(LResource.DownloadSuccess);
  454. else
  455. MessageBox.Show(LResource.DownloadReportFail);
  456. }
  457. }
  458. }
  459. else
  460. {
  461. MessageBox.Show(LResource.GetMidAdresserror);
  462. }
  463. }
  464. else
  465. {
  466. MessageBox.Show(LResource.GetMidInfoerror);
  467. }
  468. // 是否有dsn要抄写;
  469. SetDSNLimit();
  470. }
  471. }
  472. else
  473. {
  474. if (V2Method.GetMidInfo(OrderText.Text.Trim(), TestMode.MAC, ErrorDB, out midList1))
  475. {
  476. CommonMethod.SetCommonsData(functionSetting1, midList1);
  477. CommonMethod.CheckKeyType(midList1.keytype, cfg_writedone, out key2Write);
  478. OperationPanel.key2Write = key2Write;
  479. if (UsinglocalIDCheck.Checked)
  480. {
  481. midList1.projectid = Custom_ProjectID;
  482. MessageBox.Show(LResource.WilluseLocalPID, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  483. }
  484. else if (midList1.projectid != Custom_ProjectID && Custom_ProjectID.Trim().Length > 0)
  485. {
  486. if (midList1.projectid != null)
  487. if (midList1.projectid.Trim().Length > 0)
  488. PID_Num.Value = Convert.ToDecimal(midList1.projectid);
  489. MessageBox.Show(LResource.WilluseOnlinePID, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
  490. }
  491. try
  492. {
  493. OperationPanel operationPanel1 = new OperationPanel(this, LocalDB, ErrorDB, midAddress1, functionSetting1, cfg_writecheck, cfg_readcheck, cfg_writedone, Preload.Checked, midList1, OrderText.Text.Trim());
  494. operationPanel1.StartPosition = FormStartPosition.Manual;
  495. if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width && LocationMark)
  496. {
  497. LocationMark = false;
  498. LocationNum = formlocationmsg.Count;
  499. }
  500. if (formlocationmsg.Count == 0)
  501. operationPanel1.Location = (Point)new Size(this.Right, this.Top);
  502. else if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width)
  503. {
  504. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  505. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * (formlocationmsg.Count - LocationNum), this.Top + operationPanel1.Size.Height);
  506. }
  507. else
  508. {
  509. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  510. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * formlocationmsg.Count, this.Top);
  511. }
  512. operationPanel1.DeleteIntptr += new OperationPanel.DisplayUpdateDelegate(DeleteIntptr);
  513. operationPanel1.SNKeyDownEven += new OperationPanel.SNKeyDown(SNKeyDownEven);
  514. IntPtr intPtr = operationPanel1.Handle;
  515. Dictionary<IntPtr, Point> part1 = new Dictionary<IntPtr, Point>();
  516. part1.Add(intPtr, (Point)new Size(operationPanel1.Right, operationPanel1.Top));
  517. formlocationmsg.Add(part1);
  518. operationPanel1.Show();
  519. }
  520. catch (Exception ex)
  521. {
  522. Log.WriteErrorLog(ex.Message);
  523. }
  524. // 是否有dsn要抄写;
  525. SetDSNLimit();
  526. }
  527. else
  528. {
  529. MessageBox.Show(LResource.GetMidInfoerror);
  530. }
  531. }
  532. }
  533. else
  534. {
  535. MessageBox.Show(LResource.LocalKeyMode);
  536. try
  537. {
  538. if (Preload.Checked)
  539. {
  540. string dbPath = AppDomain.CurrentDomain.BaseDirectory + "\\Keys\\" + OrderText.Text.Trim() + ".db";
  541. if (File.Exists(dbPath))
  542. {
  543. if (LocalDB == null)
  544. {
  545. LocalDB = new SQLiteConnection("data source=" + dbPath);
  546. LocalDB.Open();
  547. }
  548. if (SQLiteHelper.WholeCheckDownloadStatus(LocalDB, OrderText.Text.Trim()))
  549. {
  550. if (SQLiteHelper.GetDBMidInfo(LocalDB, OrderText.Text.Trim(), out midAddress1))
  551. {
  552. if (UsinglocalIDCheck.Checked)
  553. {
  554. midAddress1.pid = Custom_ProjectID;
  555. MessageBox.Show(LResource.WilluseLocalPID, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  556. }
  557. else if (midAddress1.pid != Custom_ProjectID && Custom_ProjectID.Trim().Length > 0)
  558. {
  559. if (midAddress1.pid != null)
  560. if (midAddress1.pid.Trim().Length > 0)
  561. PID_Num.Value = Convert.ToDecimal(midAddress1.pid);
  562. MessageBox.Show(LResource.WilluseOnlinePID, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
  563. }
  564. midList1 = new MidList()
  565. {
  566. keytype = new Dictionary<string, string>(),
  567. clienttype = midAddress1.ctype,
  568. version = midAddress1.version,
  569. projectid = midAddress1.pid,
  570. host = "LocalPC"
  571. };
  572. if (SQLiteHelper.GetrokuCustomer(LocalDB, OrderText.Text, out RokuCustomer rokuCustomer_1))
  573. {
  574. midList1.rokuCustomer = rokuCustomer_1;
  575. };
  576. if (SQLiteHelper.Getdsn(LocalDB, OrderText.Text, out string firetvdsn))
  577. {
  578. midList1.keytype = new Dictionary<string, string>();
  579. midList1.keytype.Add("DSN", firetvdsn);
  580. };
  581. if (SQLiteHelper.Getwhitebalance(LocalDB, OrderText.Text, out WhiteBalanceInfo whiteBalanceInfo_1))
  582. {
  583. functionSetting1.WBPath = dbPath;
  584. functionSetting1.WriteWB = true;
  585. functionSetting1.NormalRGB = new byte[3];
  586. functionSetting1.CoolRGB = new byte[3];
  587. functionSetting1.WarmRGB = new byte[3];
  588. functionSetting1.NormalRGB[0] = (byte)Convert.ToDouble(whiteBalanceInfo_1.hdmirgain);
  589. functionSetting1.NormalRGB[1] = (byte)Convert.ToDouble(whiteBalanceInfo_1.hdmiggain);
  590. functionSetting1.NormalRGB[2] = (byte)Convert.ToDouble(whiteBalanceInfo_1.hdmibgain);
  591. functionSetting1.CoolRGB[0] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.lrgain) + 256);
  592. functionSetting1.CoolRGB[1] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.lggain) + 256);
  593. functionSetting1.CoolRGB[2] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.lbgain) + 256);
  594. functionSetting1.WarmRGB[0] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.nrgain) + 256);
  595. functionSetting1.WarmRGB[1] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.nggain) + 256);
  596. functionSetting1.WarmRGB[2] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.nbgain) + 256);
  597. };
  598. }
  599. else
  600. {
  601. MessageBox.Show(LResource.FailtoReadLocalDB);
  602. return;
  603. }
  604. }
  605. else
  606. {
  607. MessageBox.Show(LResource.LocalDBIncomplete);
  608. return;
  609. }
  610. }
  611. else
  612. {
  613. MessageBox.Show(LResource.NofoundLocalDB);
  614. return;
  615. }
  616. }
  617. else
  618. {
  619. midList1 = new MidList()
  620. {
  621. keytype = new Dictionary<string, string>(),
  622. projectid = Custom_ProjectID,
  623. host = "LocalPC"
  624. };
  625. #region EDID离线模式;
  626. if (functionSetting1.edid_offline)
  627. {
  628. midList1.keytype.Add("edid_pid", functionSetting1.edid_pid);
  629. midList1.keytype.Add("edid_model_name", functionSetting1.edid_model_name);
  630. }
  631. #endregion
  632. }
  633. OperationPanel operationPanel1 = new OperationPanel(this, LocalDB, ErrorDB, null, functionSetting1, cfg_writecheck, cfg_readcheck, cfg_writedone, Preload.Checked, midList1, OrderText.Text.Trim());
  634. operationPanel1.StartPosition = FormStartPosition.Manual;
  635. if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width && LocationMark)
  636. {
  637. LocationMark = false;
  638. LocationNum = formlocationmsg.Count;
  639. }
  640. if (formlocationmsg.Count == 0)
  641. operationPanel1.Location = (Point)new Size(this.Right, this.Top);
  642. else if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width)
  643. {
  644. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  645. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * (formlocationmsg.Count - LocationNum), this.Top + operationPanel1.Size.Height);
  646. }
  647. else
  648. {
  649. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  650. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * formlocationmsg.Count, this.Top);
  651. }
  652. operationPanel1.DeleteIntptr += new OperationPanel.DisplayUpdateDelegate(DeleteIntptr);
  653. operationPanel1.SNKeyDownEven += new OperationPanel.SNKeyDown(SNKeyDownEven);
  654. IntPtr intPtr = operationPanel1.Handle;
  655. Dictionary<IntPtr, Point> part1 = new Dictionary<IntPtr, Point>();
  656. part1.Add(intPtr, (Point)new Size(operationPanel1.Right, operationPanel1.Top));
  657. formlocationmsg.Add(part1);
  658. operationPanel1.Show();
  659. }
  660. catch
  661. {
  662. //
  663. }
  664. }
  665. OrderSubmit.Text = LResource.submitbutton;
  666. #if DEBUG
  667. #else
  668. LockSettingFunction(false);
  669. #endif
  670. if (!LocalWrite)
  671. {
  672. if (!uploadbackground.IsAlive)
  673. if (!Preload.Checked || LocalDB != null)
  674. uploadbackground.Start();
  675. }
  676. }
  677. /// <summary>
  678. /// 加载配置
  679. /// </summary>
  680. public void LoadJsonConfig()
  681. {
  682. StreamReader file = File.OpenText(LocalPath.localpath + "\\Config.json");
  683. using (JsonTextReader reader = new JsonTextReader(file))
  684. {
  685. JObject jObject = (JObject)JToken.ReadFrom(reader);
  686. reader.Close();
  687. var COM = jObject["COM"].Value<string>();
  688. var Baudrate = jObject["Baudrate"].Value<string>();
  689. var WriteChannelConfig = jObject["WriteChannel"].Value<string>();
  690. var ChannelSelect = jObject["ChannelSelect"].Value<string>();
  691. var WriteOSDLanguageConfig = jObject["WriteOSDLanguage"].Value<string>();
  692. var OSDLanguageSelect = jObject["OSDLanguageSelect"].Value<string>();
  693. var WriteSHOPLanguageConfig = jObject["WriteSHOPLanguage"].Value<string>();
  694. var SHOPLanguageSelect = jObject["SHOPLanguageSelect"].Value<string>();
  695. var WriteWhiteBalanceConfig = jObject["WriteWhiteBalance"].Value<string>();
  696. var WhiteBalanceInitConfig = jObject["WhiteBalanceInit"].Value<string>();
  697. var WhiteBalancePath = jObject["WhiteBalancePath"].Value<string>();
  698. var LastOrder = jObject["LastOrder"].Value<string>();
  699. var Preloadmode = jObject["Preload"].Value<string>();
  700. var UsingLocalPID = jObject["UsingLocalPID"].Value<string>();
  701. Custom_ProjectID = jObject["Custom_ProjectID"].Value<string>();
  702. functionSetting1.Wait_after_completion = jObject["Wait_after_completion"].Value<int>();
  703. functionSetting1.EnterFactoryRetry = jObject["EnterFactoryRetry"].Value<int>();
  704. functionSetting1.AllowNoScanning = jObject["AllowNoScanning"].Value<bool>();
  705. functionSetting1.ReportTimeOut = jObject["ReportTimeOut"].Value<int>();
  706. if (jObject["Parity"] == null)
  707. SaveJsonConfig("Parity", functionSetting1.TVParity);
  708. functionSetting1.TVParity = jObject["Parity"] != null ? jObject["Parity"].Value<int>() : 0;
  709. //本地离线抄写时key长度设置获取
  710. functionSetting1.LocalDidSize = jObject["LocalSize"]["DID"].Value<int>();
  711. functionSetting1.LocalMacSize = jObject["LocalSize"]["MAC"].Value<int>();
  712. functionSetting1.LocalHdcpSize = jObject["LocalSize"]["HDCP"].Value<int>();
  713. functionSetting1.LocalWidiSize = jObject["LocalSize"]["WIDI"].Value<int>();
  714. functionSetting1.LocalHdcp22Size = jObject["LocalSize"]["HDCP22"].Value<int>();
  715. functionSetting1.LocalEsnSize = jObject["LocalSize"]["ESN"].Value<int>();
  716. functionSetting1.LocalWidevineSize = jObject["LocalSize"]["WIDEVINE"].Value<int>();
  717. functionSetting1.LocalCiSize = jObject["LocalSize"]["CI"].Value<int>();
  718. functionSetting1.LocalMGKSize = jObject["LocalSize"]["MGK"].Value<int>();
  719. functionSetting1.LocalFairplaySize = jObject["LocalSize"]["Fairplay"] == null ? (CommonMethod.InsertJsonConfig("LocalSize", "Fairplay") ? -1 : 0) : jObject["LocalSize"]["Fairplay"].Value<int>();
  720. functionSetting1.LocalECPSize = jObject["LocalSize"]["ECP"] == null ? (CommonMethod.InsertJsonConfig("LocalSize", "ECP") ? -1 : 0) : jObject["LocalSize"]["ECP"].Value<int>();
  721. functionSetting1.LocalWifiMacSize = jObject["LocalSize"]["WifiMac"] == null ? (CommonMethod.InsertJsonConfig("LocalSize", "WifiMac") ? -1 : 0) : jObject["LocalSize"]["WifiMac"].Value<int>();
  722. functionSetting1.LocalBTMacSize = jObject["LocalSize"]["BTMac"] == null ? (CommonMethod.InsertJsonConfig("LocalSize", "BTMac") ? -1 : 0) : jObject["LocalSize"]["BTMac"].Value<int>();
  723. //本地DB离线抄写时是否不允许重复抄写
  724. functionSetting1.NoDoublewrite = jObject["NodoubleWrite"].Value<bool>();
  725. //条码限制
  726. functionSetting1.BarcodeLimit = jObject["BarcodeLimit"].Value<bool>();
  727. functionSetting1.BarcodeWrite = jObject["BarcodeWrite"] == null ? CommonMethod.AddJsonConfig("BarcodeWrite", false) : jObject["BarcodeWrite"].Value<bool>();
  728. functionSetting1.BarcodeLength = jObject["BarcodeLength"].Value<int>();
  729. functionSetting1.BarcodeKeyword = jObject["BarcodeKeyword"].Value<string>();
  730. //串口延迟
  731. //functionSetting1.SerailDelay = jObject["SerailDelay"].Value<int>(); // 名字不易理解,使用NextCommandWaitTime代替;
  732. //SerialCMD.SerialTimeout = jObject["SerialTimeout"].Value<int>(); // 名字不易理解,目前不再使用;
  733. // G客户防呆措施;
  734. functionSetting1.UsingGFoolProofing = jObject["UsingGFoolProofing"] == null ? false : jObject["UsingGFoolProofing"].Value<bool>();
  735. functionSetting1.GFoolProofingCount = jObject["GFoolProofingCount"] == null ? 2 : jObject["GFoolProofingCount"].Value<int>();
  736. functionSetting1.LeaveFactory = jObject["LeaveFactory"] == null ? false : jObject["LeaveFactory"].Value<bool>();
  737. functionSetting1.SNDoubleTips = jObject["SNDoubleTips"] == null ? false : jObject["SNDoubleTips"].Value<bool>();
  738. functionSetting1.EnableSanhuaMES = jObject["EnableSanhuaMES"] == null ? false : jObject["EnableSanhuaMES"].Value<bool>();
  739. #region 是否启用墨西哥抄写
  740. if (CommonMethod.GetLoginAccout().Equals("Mexico", StringComparison.OrdinalIgnoreCase) )
  741. {
  742. // NTF;
  743. if (jObject["Mexican_NTF"] == null)
  744. SaveJsonConfig("Mexican_NTF", functionSetting1.Mexican_NTF);
  745. else
  746. functionSetting1.Mexican_NTF = jObject["Mexican_NTF"].Value<bool>();
  747. GMethod.SetMexicanConfig(functionSetting1.Mexican_NTF);
  748. // IDM;
  749. if (jObject["Mexican_IDM"] == null)
  750. SaveJsonConfig("Mexican_IDM", functionSetting1.Mexican_IDM);
  751. else
  752. functionSetting1.Mexican_IDM = jObject["Mexican_IDM"].Value<bool>();
  753. if (functionSetting1.Mexican_IDM )
  754. V2Method.SetGetMessageUrl("http://10.138.96.32:81/IDManage/v1/order/getMessage");
  755. }
  756. #endregion
  757. // 导出日规acas与sn;
  758. if (jObject["ExportSNACASID"] == null)
  759. {
  760. SaveJsonConfig("ExportSNACASID", functionSetting1.ExportSNACASID);
  761. }
  762. else
  763. {
  764. functionSetting1.ExportSNACASID = jObject["ExportSNACASID"].Value<bool>();
  765. }
  766. // 获取ReadTimeout值;
  767. if (jObject["ReadTimeout"] == null)
  768. {
  769. SaveJsonConfig("ReadTimeout", SerialCMD.ReadTimeout);
  770. }
  771. else
  772. {
  773. functionSetting1.ReadTimeout = SerialCMD.ReadTimeout = jObject["ReadTimeout"].Value<int>();
  774. }
  775. // 获取NextCommandWaitTime值;
  776. if (jObject["NextCommandWaitTime"] == null)
  777. {
  778. SaveJsonConfig("NextCommandWaitTime", SerialCMD.NextCommandWaitTime);
  779. }
  780. else
  781. {
  782. functionSetting1.NextCommandWaitTime = SerialCMD.NextCommandWaitTime = jObject["NextCommandWaitTime"].Value<int>();
  783. }
  784. // 后台上报数据;
  785. if (jObject["BackgroudReportData"] == null)
  786. {
  787. SaveJsonConfig("BackgroudReportData", false);
  788. }
  789. else
  790. {
  791. functionSetting1.BackgroudReportData = jObject["BackgroudReportData"].Value<bool>();
  792. }
  793. #region EDID离线模式,使用offline账号登录;
  794. if (jObject["edid_offline"] == null)
  795. {
  796. SaveJsonConfig("edid_offline", functionSetting1.edid_offline);
  797. }
  798. else
  799. {
  800. functionSetting1.edid_offline = jObject["edid_offline"].Value<bool>();
  801. }
  802. if (jObject["edid_pid"] == null)
  803. {
  804. SaveJsonConfig("edid_pid", functionSetting1.edid_pid);
  805. }
  806. else
  807. {
  808. functionSetting1.edid_pid = jObject["edid_pid"].Value<string>();
  809. }
  810. if (jObject["edid_model_name"] == null)
  811. {
  812. SaveJsonConfig("edid_model_name", functionSetting1.edid_model_name);
  813. }
  814. else
  815. {
  816. functionSetting1.edid_model_name = jObject["edid_model_name"].Value<string>();
  817. }
  818. #endregion
  819. #region 波兰工厂DHA解决方案
  820. if (jObject["CheckDHAWaitTime"] == null)
  821. {
  822. SaveJsonConfig("CheckDHAWaitTime", functionSetting1.CheckDHAWaitTime);
  823. }
  824. else
  825. {
  826. functionSetting1.CheckDHAWaitTime = jObject["CheckDHAWaitTime"].Value<int>();
  827. }
  828. if (jObject["DHA"] == null)
  829. {
  830. SaveJsonConfig("DHA", functionSetting1.DHA);
  831. }
  832. else
  833. {
  834. functionSetting1.DHA = jObject["DHA"].Value<bool>();
  835. }
  836. #endregion
  837. #region G客户NTF功能;
  838. if ( jObject["NTF"] != null )
  839. {
  840. functionSetting1.NTF = jObject["NTF"].Value<bool>();
  841. if (functionSetting1.NTF == true)
  842. Log.WriteInfoLog("开启NTF功能");
  843. }
  844. else
  845. {
  846. SaveJsonConfig("NTF", false);
  847. }
  848. if (jObject["Line"] != null)
  849. {
  850. functionSetting1.Line = jObject["Line"].Value<string>();
  851. }
  852. else
  853. {
  854. SaveJsonConfig("Line", "");
  855. }
  856. #endregion
  857. #region 小米FireTV功能模块启用;
  858. if (jObject["MITVEnable"] != null)
  859. {
  860. functionSetting1.MITVEnable = jObject["MITVEnable"].Value<bool>();
  861. }
  862. else
  863. {
  864. SaveJsonConfig("MITVEnable", false);
  865. }
  866. // 获取key的url;
  867. if (jObject["MIKeyUrl"] != null)
  868. {
  869. functionSetting1.MIKeyUrl = jObject["MIKeyUrl"].Value<string>();
  870. }
  871. else
  872. {
  873. SaveJsonConfig("MIKeyUrl", functionSetting1.MIKeyUrl);
  874. }
  875. // 上报key的url;
  876. if (jObject["MIKeyReportUrl"] != null)
  877. {
  878. functionSetting1.MIKeyReportUrl = jObject["MIKeyReportUrl"].Value<string>();
  879. }
  880. else
  881. {
  882. SaveJsonConfig("MIKeyReportUrl", functionSetting1.MIKeyReportUrl);
  883. }
  884. if (jObject["IndiaMITVEnable"] != null)
  885. {
  886. functionSetting1.IndiaMITVEnable = jObject["IndiaMITVEnable"].Value<bool>();
  887. }
  888. else
  889. {
  890. SaveJsonConfig("IndiaMITVEnable", false);
  891. }
  892. // 变更接口地址;
  893. if (functionSetting1.IndiaMITVEnable)
  894. {
  895. functionSetting1.MIKeyUrl = "http://10.40.7.61:9006/api/SMESCustomer/GetXMCard";
  896. functionSetting1.MIKeyReportUrl = "http://10.40.7.61:9006/api/SMESCustomer/UploadXMDataControl";
  897. V2Method.SetGetMessageUrl("http://10.40.7.93:81/IDManage/v1/order/getMessage ");
  898. }
  899. #endregion
  900. #region 北美DSN的配置项使用SMES里面的
  901. if (jObject["UserDSNFromSmes"] == null)
  902. {
  903. SaveJsonConfig("UserDSNFromSmes", functionSetting1.UserDSNFromSmes);
  904. }
  905. else
  906. {
  907. functionSetting1.UserDSNFromSmes = jObject["UserDSNFromSmes"].Value<bool>();
  908. }
  909. #endregion
  910. #region 串口重试机制;
  911. if (jObject["EnableRetry"] != null)
  912. {
  913. functionSetting1.EnableRetry = jObject["EnableRetry"].Value<bool>();
  914. }
  915. else
  916. {
  917. SaveJsonConfig("EnableRetry", false);
  918. }
  919. if (jObject["RetryCount"] != null)
  920. {
  921. functionSetting1.RetryCount = jObject["RetryCount"].Value<int>();
  922. }
  923. else
  924. {
  925. SaveJsonConfig("RetryCount", 3);
  926. }
  927. #endregion
  928. #region 是否整机抄写
  929. if (jObject["IsSmt"] != null)
  930. {
  931. functionSetting1.IsSmt = jObject["IsSmt"].Value<string>();
  932. Is_Smt = functionSetting1.IsSmt;
  933. }
  934. else
  935. {
  936. SaveJsonConfig("IsSmt", functionSetting1.IsSmt);
  937. }
  938. #endregion
  939. foreach (var ss in jObject["Channel"]) //遍历Channel
  940. {
  941. Dictionary<string, string> ChannelValues = JsonConvert.DeserializeObject<Dictionary<string, string>>(ss.ToString());
  942. foreach (string key in ChannelValues.Keys)
  943. {
  944. ChannelMapList.Add(key, ChannelValues[key]);
  945. ChannelList.Items.Add(key);
  946. }
  947. }
  948. foreach (var ss in jObject["Language"]) //遍历Language
  949. {
  950. Dictionary<string, string> LanguageValues = JsonConvert.DeserializeObject<Dictionary<string, string>>(ss.ToString());
  951. foreach (string key in LanguageValues.Keys)
  952. {
  953. OSDList.Items.Add(key);
  954. SHOPList.Items.Add(key);
  955. LanguageMapList.Add(key, LanguageValues[key]);
  956. }
  957. }
  958. foreach (var ss in jObject["CustomCMD"]) //遍历自定义命令表
  959. {
  960. functionSetting1.CustomCMD = JsonConvert.DeserializeObject<Dictionary<string, string>>(ss.ToString());
  961. }
  962. #region ReadCheck配置读取
  963. cfg_readcheck.PIDReadcheck = jObject["ReadCheck"]["PID"].Value<bool>();
  964. cfg_readcheck.OSDReadcheck = jObject["ReadCheck"]["OSD"].Value<bool>();
  965. cfg_readcheck.SHOPReadcheck = jObject["ReadCheck"]["SHOP"].Value<bool>();
  966. cfg_readcheck.DIDReadcheck = jObject["ReadCheck"]["DID"].Value<bool>();
  967. cfg_readcheck.MacReadcheck = jObject["ReadCheck"]["MAC"].Value<bool>();
  968. cfg_readcheck.HDCPReadcheck = jObject["ReadCheck"]["HDCP"].Value<bool>();
  969. cfg_readcheck.HDCP22Readcheck = jObject["ReadCheck"]["HDCP22"].Value<bool>();
  970. cfg_readcheck.WidevineReadcheck = jObject["ReadCheck"]["WIDEVINE"].Value<bool>();
  971. cfg_readcheck.ESNReadcheck = jObject["ReadCheck"]["ESN"].Value<bool>();
  972. cfg_readcheck.CI_plusReadcheck = jObject["ReadCheck"]["CI"].Value<bool>();
  973. cfg_readcheck.AttestationReadcheck = jObject["ReadCheck"]["Attestation"].Value<bool>();
  974. cfg_readcheck.MGKReadcheck = jObject["ReadCheck"]["MGK"].Value<bool>();
  975. if(jObject["ReadCheck"]["Fairplay"] == null )
  976. {
  977. CommonMethod.InsertJsonConfig("ReadCheck", "Fairplay");
  978. cfg_readcheck.FairplayReadcheck = false;
  979. }
  980. else
  981. {
  982. cfg_readcheck.FairplayReadcheck = jObject["ReadCheck"]["Fairplay"].Value<bool>();
  983. }
  984. if(jObject["ReadCheck"]["ECP"] == null)
  985. {
  986. CommonMethod.InsertJsonConfig("ReadCheck", "ECP");
  987. cfg_readcheck.ECPReadcheck = false;
  988. }
  989. else
  990. {
  991. cfg_readcheck.ECPReadcheck = jObject["ReadCheck"]["ECP"].Value<bool>();
  992. }
  993. if(jObject["ReadCheck"]["WifiMac"] == null)
  994. {
  995. CommonMethod.InsertJsonConfig("ReadCheck", "WifiMac");
  996. cfg_readcheck.WifiMacReadcheck = false;
  997. }
  998. else
  999. {
  1000. cfg_readcheck.WifiMacReadcheck = jObject["ReadCheck"]["WifiMac"].Value<bool>();
  1001. }
  1002. if(jObject["ReadCheck"]["BTMac"] == null)
  1003. {
  1004. CommonMethod.InsertJsonConfig("ReadCheck", "BTMac");
  1005. cfg_readcheck.BTMacReadcheck = false;
  1006. }
  1007. else
  1008. {
  1009. cfg_readcheck.BTMacReadcheck = jObject["ReadCheck"]["BTMac"].Value<bool>();
  1010. }
  1011. if(jObject["ReadCheck"]["LEK"] == null)
  1012. {
  1013. CommonMethod.InsertJsonConfig("ReadCheck", "LEK");
  1014. cfg_readcheck.LEKReadcheck = false;
  1015. }
  1016. else
  1017. {
  1018. cfg_readcheck.LEKReadcheck = jObject["ReadCheck"]["LEK"].Value<bool>();
  1019. }
  1020. if(jObject["ReadCheck"]["PEK"] == null)
  1021. {
  1022. CommonMethod.InsertJsonConfig("ReadCheck", "PEK");
  1023. cfg_readcheck.PEKReadcheck = false;
  1024. }
  1025. else
  1026. {
  1027. cfg_readcheck.PEKReadcheck = jObject["ReadCheck"]["PEK"].Value<bool>();
  1028. }
  1029. if(jObject["ReadCheck"]["Playready"] == null)
  1030. {
  1031. CommonMethod.InsertJsonConfig("ReadCheck", "Playready");
  1032. cfg_readcheck.PlayreadyReadcheck = false ;
  1033. }
  1034. else
  1035. {
  1036. cfg_readcheck.PlayreadyReadcheck = jObject["ReadCheck"]["Playready"].Value<bool>();
  1037. }
  1038. if (jObject["ReadCheck"]["Hash"] == null)
  1039. {
  1040. CommonMethod.InsertJsonConfig("ReadCheck", "Hash");
  1041. cfg_readcheck.HashReadcheck = false ;
  1042. }
  1043. else
  1044. {
  1045. cfg_readcheck.HashReadcheck = jObject["ReadCheck"]["Hash"].Value<bool>();
  1046. }
  1047. if(jObject["ReadCheck"]["DSN"] == null)
  1048. {
  1049. CommonMethod.InsertJsonConfig("ReadCheck", "DSN");
  1050. cfg_readcheck.DSNReadcheck = false;
  1051. }
  1052. else
  1053. {
  1054. cfg_readcheck.DSNReadcheck = jObject["ReadCheck"]["DSN"].Value<bool>();
  1055. }
  1056. if(jObject["ReadCheck"]["YouTube"] == null)
  1057. {
  1058. CommonMethod.InsertJsonConfig("ReadCheck", "YouTube");
  1059. cfg_readcheck.YouTubeReadcheck = false;
  1060. }
  1061. else
  1062. {
  1063. cfg_readcheck.YouTubeReadcheck = jObject["ReadCheck"]["YouTube"].Value<bool>();
  1064. }
  1065. if(jObject["ReadCheck"]["EDIDPID"] == null)
  1066. {
  1067. CommonMethod.InsertJsonConfig("ReadCheck", "EDIDPID");
  1068. cfg_readcheck.EDIDPIDReadcheck = false;
  1069. }
  1070. else
  1071. {
  1072. cfg_readcheck.EDIDPIDReadcheck = jObject["ReadCheck"]["EDIDPID"].Value<bool>();
  1073. }
  1074. if(jObject["ReadCheck"]["EDIDModeName"] == null)
  1075. {
  1076. CommonMethod.InsertJsonConfig("ReadCheck", "EDIDModeName");
  1077. cfg_readcheck.EDIDModeNameReadcheck = false;
  1078. }
  1079. else
  1080. {
  1081. cfg_readcheck.EDIDModeNameReadcheck = jObject["ReadCheck"]["EDIDModeName"].Value<bool>();
  1082. }
  1083. if(jObject["ReadCheck"]["ACASKey"] == null)
  1084. {
  1085. CommonMethod.InsertJsonConfig("ReadCheck", "ACASKey");
  1086. cfg_readcheck.ACASKeyReadcheck = false;
  1087. }
  1088. else
  1089. {
  1090. cfg_readcheck.ACASKeyReadcheck = jObject["ReadCheck"]["ACASKey"].Value<bool>();
  1091. }
  1092. if(jObject["ReadCheck"]["FVP"] == null)
  1093. {
  1094. CommonMethod.InsertJsonConfig("ReadCheck", "FVP");
  1095. cfg_readcheck.FVPReadcheck = false;
  1096. }
  1097. else
  1098. {
  1099. cfg_readcheck.FVPReadcheck = jObject["ReadCheck"]["FVP"].Value<bool>();
  1100. }
  1101. if (jObject["ReadCheck"]["DAK"] == null)
  1102. {
  1103. CommonMethod.InsertJsonConfig("ReadCheck", "DAK");
  1104. cfg_readcheck.DAKReadcheck = false;
  1105. }
  1106. else
  1107. {
  1108. cfg_readcheck.DAKReadcheck = jObject["ReadCheck"]["DAK"].Value<bool>();
  1109. }
  1110. if (jObject["ReadCheck"]["Dolby"] == null)
  1111. {
  1112. CommonMethod.InsertJsonConfig("ReadCheck", "Dolby");
  1113. cfg_readcheck.DolbyReadcheck = false;
  1114. }
  1115. else
  1116. {
  1117. cfg_readcheck.DolbyReadcheck=jObject["ReadCheck"]["Dolby"].Value<bool>();
  1118. }
  1119. if (jObject["ReadCheck"]["KFP"] == null)
  1120. {
  1121. CommonMethod.InsertJsonConfig("ReadCheck", "KFP");
  1122. cfg_readcheck.KFPReadcheck = false;
  1123. }
  1124. else
  1125. {
  1126. cfg_readcheck.KFPReadcheck = jObject["ReadCheck"]["KFP"].Value<bool>();
  1127. }
  1128. #endregion
  1129. #region WriteCheck配置读取
  1130. cfg_writecheck.DIDCheckcheck = jObject["WriteCheck"]["DID"].Value<bool>();
  1131. cfg_writecheck.MacCheckcheck = jObject["WriteCheck"]["MAC"].Value<bool>();
  1132. cfg_writecheck.HDCPCheckcheck = jObject["WriteCheck"]["HDCP"].Value<bool>();
  1133. cfg_writecheck.HDCP22Checkcheck = jObject["WriteCheck"]["HDCP22"].Value<bool>();
  1134. cfg_writecheck.WidevineCheckcheck = jObject["WriteCheck"]["WIDEVINE"].Value<bool>();
  1135. cfg_writecheck.ESNCheckcheck = jObject["WriteCheck"]["ESN"].Value<bool>();
  1136. cfg_writecheck.CI_plusCheckcheck = jObject["WriteCheck"]["CI"].Value<bool>();
  1137. cfg_writecheck.AttestationCheckcheck = jObject["WriteCheck"]["Attestation"].Value<bool>();
  1138. cfg_writecheck.MGKCheckcheck = jObject["WriteCheck"]["MGK"].Value<bool>();
  1139. if (jObject["WriteCheck"]["Fairplay"] == null)
  1140. {
  1141. CommonMethod.InsertJsonConfig("WriteCheck", "Fairplay");
  1142. cfg_writecheck.FairplayCheckcheck = false;
  1143. }
  1144. else
  1145. {
  1146. cfg_writecheck.FairplayCheckcheck = jObject["WriteCheck"]["Fairplay"].Value<bool>();
  1147. }
  1148. if (jObject["WriteCheck"]["ECP"] == null)
  1149. {
  1150. CommonMethod.InsertJsonConfig("WriteCheck", "ECP");
  1151. cfg_writecheck.ECPCheckcheck = false;
  1152. }
  1153. else
  1154. {
  1155. cfg_writecheck.ECPCheckcheck = jObject["WriteCheck"]["ECP"].Value<bool>();
  1156. }
  1157. if (jObject["WriteCheck"]["WifiMac"] == null)
  1158. {
  1159. CommonMethod.InsertJsonConfig("WriteCheck", "WifiMac");
  1160. cfg_writecheck.WifiMacCheckcheck = false;
  1161. }
  1162. else
  1163. {
  1164. cfg_writecheck.WifiMacCheckcheck = jObject["WriteCheck"]["WifiMac"].Value<bool>();
  1165. }
  1166. if (jObject["WriteCheck"]["BTMac"] == null)
  1167. {
  1168. CommonMethod.InsertJsonConfig("WriteCheck", "BTMac");
  1169. cfg_writecheck.BTMacCheckcheck = false;
  1170. }
  1171. else
  1172. {
  1173. cfg_writecheck.BTMacCheckcheck = jObject["WriteCheck"]["BTMac"].Value<bool>();
  1174. }
  1175. if (jObject["WriteCheck"]["LEK"] == null)
  1176. {
  1177. CommonMethod.InsertJsonConfig("WriteCheck", "LEK");
  1178. cfg_writecheck.LEKCheckcheck = false;
  1179. }
  1180. else
  1181. {
  1182. cfg_writecheck.LEKCheckcheck = jObject["WriteCheck"]["LEK"].Value<bool>();
  1183. }
  1184. if (jObject["WriteCheck"]["PEK"] == null)
  1185. {
  1186. CommonMethod.InsertJsonConfig("WriteCheck", "PEK");
  1187. cfg_writecheck.PEKCheckcheck = false;
  1188. }
  1189. else
  1190. {
  1191. cfg_writecheck.PEKCheckcheck = jObject["WriteCheck"]["PEK"].Value<bool>();
  1192. }
  1193. if (jObject["WriteCheck"]["Playready"] == null)
  1194. {
  1195. CommonMethod.InsertJsonConfig("WriteCheck", "Playready");
  1196. cfg_writecheck.PlayreadyCheckcheck = false;
  1197. }
  1198. else
  1199. {
  1200. cfg_writecheck.PlayreadyCheckcheck = jObject["WriteCheck"]["Playready"].Value<bool>();
  1201. }
  1202. if (jObject["WriteCheck"]["Hash"] == null)
  1203. {
  1204. CommonMethod.InsertJsonConfig("WriteCheck", "Hash");
  1205. cfg_writecheck.HashCheckcheck = false;
  1206. }
  1207. else
  1208. {
  1209. cfg_writecheck.HashCheckcheck = jObject["WriteCheck"]["Hash"].Value<bool>();
  1210. }
  1211. if (jObject["WriteCheck"]["DSN"] == null)
  1212. {
  1213. CommonMethod.InsertJsonConfig("WriteCheck", "DSN");
  1214. cfg_writecheck.DSNCheckcheck = false;
  1215. }
  1216. else
  1217. {
  1218. cfg_writecheck.DSNCheckcheck = jObject["WriteCheck"]["DSN"].Value<bool>();
  1219. }
  1220. if (jObject["WriteCheck"]["YouTube"] == null)
  1221. {
  1222. CommonMethod.InsertJsonConfig("WriteCheck", "YouTube");
  1223. cfg_writecheck.YouTubeCheckcheck = false;
  1224. }
  1225. else
  1226. {
  1227. cfg_writecheck.YouTubeCheckcheck = jObject["WriteCheck"]["YouTube"].Value<bool>();
  1228. }
  1229. if (jObject["WriteCheck"]["ACASKey"] == null)
  1230. {
  1231. CommonMethod.InsertJsonConfig("WriteCheck", "ACASKey");
  1232. cfg_writecheck.ACASKeyCheckcheck = false;
  1233. }
  1234. else
  1235. {
  1236. cfg_writecheck.ACASKeyCheckcheck = jObject["WriteCheck"]["ACASKey"].Value<bool>();
  1237. }
  1238. if (jObject["WriteCheck"]["FVP"] == null)
  1239. {
  1240. CommonMethod.InsertJsonConfig("WriteCheck", "FVP");
  1241. cfg_writecheck.FVPCheckcheck = false;
  1242. }
  1243. else
  1244. {
  1245. cfg_writecheck.FVPCheckcheck = jObject["WriteCheck"]["FVP"].Value<bool>();
  1246. }
  1247. if (jObject["WriteCheck"]["DAK"] == null)
  1248. {
  1249. CommonMethod.InsertJsonConfig("WriteCheck", "DAK");
  1250. cfg_writecheck.DAKCheckcheck = false;
  1251. }
  1252. else
  1253. {
  1254. cfg_writecheck.DAKCheckcheck = jObject["WriteCheck"]["DAK"].Value<bool>();
  1255. }
  1256. if (jObject["WriteCheck"]["Dolby"] == null)
  1257. {
  1258. CommonMethod.InsertJsonConfig("WriteCheck", "Dolby");
  1259. cfg_writecheck.DolbyCheckcheck = false;
  1260. }
  1261. else
  1262. {
  1263. cfg_writecheck.DolbyCheckcheck = jObject["WriteCheck"]["Dolby"].Value<bool>();
  1264. }
  1265. if (jObject["WriteCheck"]["KFP"] == null)
  1266. {
  1267. CommonMethod.InsertJsonConfig("WriteCheck", "KFP");
  1268. cfg_writecheck.KFPCheckcheck = false;
  1269. }
  1270. else
  1271. {
  1272. cfg_writecheck.KFPCheckcheck = jObject["WriteCheck"]["KFP"].Value<bool>();
  1273. }
  1274. #endregion
  1275. #region WriteDone配置读取
  1276. cfg_writedone.PIDWrite_YesNo = jObject["WriteDone"]["PID"].Value<bool>();
  1277. cfg_writedone.PIDWriteDelay = jObject["WriteDone"]["PIDWirteDelay"].Value<int>();
  1278. cfg_writedone.ClientTypeCheck_YesNo = jObject["WriteDone"]["ClientType"].Value<bool>();
  1279. cfg_writedone.SoftwareVersionCheck_YesNo = jObject["WriteDone"]["SoftwareVersion"].Value<bool>();
  1280. cfg_writedone.DIDWrite_YesNo = jObject["WriteDone"]["DID"].Value<bool>();
  1281. cfg_writedone.MacWrite_YesNo = jObject["WriteDone"]["MAC"].Value<bool>();
  1282. cfg_writedone.HDCPWrite_YesNo = jObject["WriteDone"]["HDCP"].Value<bool>();
  1283. cfg_writedone.HDCP22Write_YesNo = jObject["WriteDone"]["HDCP22"].Value<bool>();
  1284. cfg_writedone.WidevineWrite_YesNo = jObject["WriteDone"]["WIDEVINE"].Value<bool>();
  1285. cfg_writedone.ESNWrite_YesNo = jObject["WriteDone"]["ESN"].Value<bool>();
  1286. cfg_writedone.CI_plusWrite_YesNo = jObject["WriteDone"]["CI"].Value<bool>();
  1287. cfg_writedone.AttestationWrite_YesNo = jObject["WriteDone"]["Attestation"].Value<bool>();
  1288. cfg_writedone.MGKWrite_YesNo = jObject["WriteDone"]["MGK"].Value<bool>();
  1289. if (jObject["WriteDone"]["Fairplay"] == null)
  1290. {
  1291. CommonMethod.InsertJsonConfig("WriteDone", "Fairplay");
  1292. cfg_writedone.FairplayWrite_YesNo = false;
  1293. }
  1294. else
  1295. {
  1296. cfg_writedone.FairplayWrite_YesNo = jObject["WriteDone"]["Fairplay"].Value<bool>();
  1297. }
  1298. if (jObject["WriteDone"]["ECP"] == null)
  1299. {
  1300. CommonMethod.InsertJsonConfig("WriteDone", "ECP");
  1301. cfg_writedone.ECPWrite_YesNo = false;
  1302. }
  1303. else
  1304. {
  1305. cfg_writedone.ECPWrite_YesNo = jObject["WriteDone"]["ECP"].Value<bool>();
  1306. }
  1307. if (jObject["WriteDone"]["WifiMac"] == null)
  1308. {
  1309. CommonMethod.InsertJsonConfig("WriteDone", "WifiMac");
  1310. cfg_writedone.WifiMacWrite_YesNo = false;
  1311. }
  1312. else
  1313. {
  1314. cfg_writedone.WifiMacWrite_YesNo = jObject["WriteDone"]["WifiMac"].Value<bool>();
  1315. }
  1316. if (jObject["WriteDone"]["BTMac"] == null)
  1317. {
  1318. CommonMethod.InsertJsonConfig("WriteDone", "BTMac");
  1319. cfg_writedone.BTMacWrite_YesNo = false;
  1320. }
  1321. else
  1322. {
  1323. cfg_writedone.BTMacWrite_YesNo = jObject["WriteDone"]["BTMac"].Value<bool>();
  1324. }
  1325. if (jObject["WriteDone"]["LEK"] == null)
  1326. {
  1327. CommonMethod.InsertJsonConfig("WriteDone", "LEK");
  1328. cfg_writedone.LEKWrite_YesNo = false;
  1329. }
  1330. else
  1331. {
  1332. cfg_writedone.LEKWrite_YesNo = jObject["WriteDone"]["LEK"].Value<bool>();
  1333. }
  1334. if (jObject["WriteDone"]["PEK"] == null)
  1335. {
  1336. CommonMethod.InsertJsonConfig("WriteDone", "PEK");
  1337. cfg_writedone.PEKWrite_YesNo = false;
  1338. }
  1339. else
  1340. {
  1341. cfg_writedone.PEKWrite_YesNo = jObject["WriteDone"]["PEK"].Value<bool>();
  1342. }
  1343. if (jObject["WriteDone"]["Playready"] == null)
  1344. {
  1345. CommonMethod.InsertJsonConfig("WriteDone", "Playready");
  1346. cfg_writedone.PlayreadyWrite_YesNo = false;
  1347. }
  1348. else
  1349. {
  1350. cfg_writedone.PlayreadyWrite_YesNo = jObject["WriteDone"]["Playready"].Value<bool>();
  1351. }
  1352. if (jObject["WriteDone"]["Hash"] == null)
  1353. {
  1354. CommonMethod.InsertJsonConfig("WriteDone", "Hash");
  1355. cfg_writedone.HashWrite_YesNo = false;
  1356. }
  1357. else
  1358. {
  1359. cfg_writedone.HashWrite_YesNo = jObject["WriteDone"]["Hash"].Value<bool>();
  1360. }
  1361. if (jObject["WriteDone"]["DSN"] == null)
  1362. {
  1363. CommonMethod.InsertJsonConfig("WriteDone", "DSN");
  1364. cfg_writedone.DSNWrite_YesNo = false;
  1365. }
  1366. else
  1367. {
  1368. cfg_writedone.DSNWrite_YesNo = jObject["WriteDone"]["DSN"].Value<bool>();
  1369. }
  1370. if(jObject["WriteDone"]["AutoWhiteBalance"] == null)
  1371. {
  1372. CommonMethod.InsertJsonConfig("WriteDone", "AutoWhiteBalance");
  1373. cfg_writedone.AutoWhiteBalance = false;
  1374. }
  1375. else
  1376. {
  1377. cfg_writedone.AutoWhiteBalance = jObject["WriteDone"]["AutoWhiteBalance"].Value<bool>();
  1378. }
  1379. ///
  1380. if (jObject["WriteDone"]["YouTube"] == null)
  1381. {
  1382. CommonMethod.InsertJsonConfig("WriteDone", "YouTube");
  1383. cfg_writedone.YouTubeWrite_YesNo = false;
  1384. }
  1385. else
  1386. {
  1387. cfg_writedone.YouTubeWrite_YesNo = jObject["WriteDone"]["YouTube"].Value<bool>();
  1388. }
  1389. if (jObject["WriteDone"]["EDIDPID"] == null)
  1390. {
  1391. CommonMethod.InsertJsonConfig("WriteDone", "EDIDPID");
  1392. cfg_writedone.EDIDPIDWrite_YesNo = false;
  1393. }
  1394. else
  1395. {
  1396. cfg_writedone.EDIDPIDWrite_YesNo = jObject["WriteDone"]["EDIDPID"].Value<bool>();
  1397. }
  1398. if (jObject["WriteDone"]["EDIDModeName"] == null)
  1399. {
  1400. CommonMethod.InsertJsonConfig("WriteDone", "EDIDModeName");
  1401. cfg_writedone.EDIDModeNameWrite_YesNo = false;
  1402. }
  1403. else
  1404. {
  1405. cfg_writedone.EDIDModeNameWrite_YesNo = jObject["WriteDone"]["EDIDModeName"].Value<bool>();
  1406. }
  1407. if (jObject["WriteDone"]["ACASKey"] == null)
  1408. {
  1409. CommonMethod.InsertJsonConfig("WriteDone", "ACASKey");
  1410. cfg_writedone.ACASKeyWrite_YesNo = false;
  1411. }
  1412. else
  1413. {
  1414. cfg_writedone.ACASKeyWrite_YesNo = jObject["WriteDone"]["ACASKey"].Value<bool>();
  1415. }
  1416. if (jObject["WriteDone"]["FVP"] == null)
  1417. {
  1418. CommonMethod.InsertJsonConfig("WriteDone", "FVP");
  1419. cfg_writedone.FVPWrite_YesNo = false;
  1420. }
  1421. else
  1422. {
  1423. cfg_writedone.FVPWrite_YesNo = jObject["WriteDone"]["FVP"].Value<bool>();
  1424. }
  1425. if (jObject["WriteDone"]["DAK"] == null)
  1426. {
  1427. CommonMethod.InsertJsonConfig("WriteDone", "DAK");
  1428. cfg_writedone.DAKWrite_YesNo = false;
  1429. }
  1430. else
  1431. {
  1432. cfg_writedone.DAKWrite_YesNo = jObject["WriteDone"]["DAK"].Value<bool>();
  1433. }
  1434. if (jObject["WriteDone"]["Dolby"] == null)
  1435. {
  1436. CommonMethod.InsertJsonConfig("WriteDone", "Dolby");
  1437. cfg_writedone.DolbyWrite_YesNo = false;
  1438. }
  1439. else
  1440. {
  1441. cfg_writedone.DolbyWrite_YesNo = jObject["WriteDone"]["Dolby"].Value<bool>();
  1442. }
  1443. if (jObject["WriteDone"]["KFP"] == null)
  1444. {
  1445. CommonMethod.InsertJsonConfig("WriteDone", "KFP");
  1446. cfg_writedone.KFPWrite_YesNo = false;
  1447. }
  1448. else
  1449. {
  1450. cfg_writedone.KFPWrite_YesNo = jObject["WriteDone"]["KFP"].Value<bool>();
  1451. }
  1452. #endregion
  1453. file.Close();
  1454. if (Custom_ProjectID != null)
  1455. if (Custom_ProjectID.Trim().Length > 0)
  1456. PID_Num.Value = Convert.ToDecimal(Custom_ProjectID);
  1457. if (TVCOM.Items.Contains(COM))
  1458. TVCOM.SelectedItem = COM;
  1459. if (TVBaud.Items.Contains(Baudrate))
  1460. TVBaud.SelectedItem = Baudrate;
  1461. if (ChannelList.Items.Contains(ChannelSelect))
  1462. {
  1463. ChannelList.SelectedItem = ChannelSelect;
  1464. functionSetting1.ChannelCode = SerialInit.HexToByte(ChannelMapList[ChannelSelect]);
  1465. }
  1466. if (OSDList.Items.Contains(OSDLanguageSelect))
  1467. {
  1468. OSDList.SelectedItem = OSDLanguageSelect;
  1469. functionSetting1.OSDLCode = SerialInit.HexToByte(LanguageMapList[OSDLanguageSelect]);
  1470. }
  1471. if (SHOPList.Items.Contains(SHOPLanguageSelect))
  1472. {
  1473. SHOPList.SelectedItem = SHOPLanguageSelect;
  1474. functionSetting1.ShopLCode = SerialInit.HexToByte(LanguageMapList[SHOPLanguageSelect]);
  1475. }
  1476. BarcodeLimit.Checked = functionSetting1.BarcodeLimit;
  1477. BarcodeWrite.Checked = functionSetting1.BarcodeWrite;
  1478. BarCodeKeyCodeText.Text = functionSetting1.BarcodeKeyword;
  1479. BarCodeLengthText.Value = functionSetting1.BarcodeLength;
  1480. Preload.Checked = Preloadmode == "True";
  1481. WriteChannel.Checked = WriteChannelConfig == "True";
  1482. WriteOSD.Checked = WriteOSDLanguageConfig == "True";
  1483. WriteSHOP.Checked = WriteSHOPLanguageConfig == "True";
  1484. WBInit.Checked = WhiteBalanceInitConfig == "True";
  1485. UsinglocalIDCheck.Checked = UsingLocalPID == "True";
  1486. OrderText.Text = LastOrder;
  1487. if (File.Exists(WhiteBalancePath))
  1488. {
  1489. if (!LoadWBConfig(WhiteBalancePath))
  1490. {
  1491. MessageBox.Show(LResource.ReadWBError);
  1492. WriteWB.Checked = false;
  1493. }
  1494. else
  1495. {
  1496. WBPath.Text = WhiteBalancePath;
  1497. WriteWB.Checked = WriteWhiteBalanceConfig == "True";
  1498. }
  1499. }
  1500. else
  1501. WriteWB.Checked = false;
  1502. }
  1503. }
  1504. /// <summary>
  1505. /// 加载本地白平衡配置
  1506. /// </summary>
  1507. /// <param name="filepath"></param>
  1508. /// <returns></returns>
  1509. public bool LoadWBConfig(string filepath)
  1510. {
  1511. try
  1512. {
  1513. functionSetting1.NormalRGB = new byte[3];
  1514. functionSetting1.CoolRGB = new byte[3];
  1515. functionSetting1.WarmRGB = new byte[3];
  1516. functionSetting1.NormalRGB[0] = (byte)Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "HDMI white R:", null, filepath));
  1517. functionSetting1.NormalRGB[1] = (byte)Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "HDMI white G:", null, filepath));
  1518. functionSetting1.NormalRGB[2] = (byte)Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "HDMI white B:", null, filepath));
  1519. functionSetting1.CoolRGB[0] = (byte)(Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "Cool white R:", null, filepath)) + 256);
  1520. functionSetting1.CoolRGB[1] = (byte)(Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "Cool white G:", null, filepath)) + 256);
  1521. functionSetting1.CoolRGB[2] = (byte)(Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "Cool white B:", null, filepath)) + 256);
  1522. functionSetting1.WarmRGB[0] = (byte)(Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "Warm white R:", null, filepath)) + 256);
  1523. functionSetting1.WarmRGB[1] = (byte)(Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "Warm white G:", null, filepath)) + 256);
  1524. functionSetting1.WarmRGB[2] = (byte)(Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "Warm white B:", null, filepath)) + 256);
  1525. return true;
  1526. }
  1527. catch (Exception ex)
  1528. {
  1529. MessageBox.Show(ex.Message);
  1530. return false;
  1531. }
  1532. }
  1533. private void ChannelList_SelectedIndexChanged(object sender, EventArgs e)
  1534. {
  1535. string ChannelSelect = ChannelList.SelectedItem.ToString();
  1536. string channelcode = ChannelMapList[ChannelSelect];
  1537. functionSetting1.ChannelCode = SerialInit.HexToByte(channelcode);
  1538. SaveJsonConfig("ChannelSelect", ChannelSelect);
  1539. Log.WriteInfoLog("\r\nSet channel setting to " + ChannelSelect + "\r\nchannel code is " + channelcode);
  1540. }
  1541. private void OSDList_SelectedIndexChanged(object sender, EventArgs e)
  1542. {
  1543. string OSDLanguageSelect = OSDList.SelectedItem.ToString();
  1544. string OSDLcode = LanguageMapList[OSDLanguageSelect];
  1545. functionSetting1.OSDLCode = SerialInit.HexToByte(OSDLcode);
  1546. SaveJsonConfig("OSDLanguageSelect", OSDLanguageSelect);
  1547. Log.WriteInfoLog("\r\nSet channel setting to " + OSDLanguageSelect + "\r\nchannel code is " + OSDLcode);
  1548. }
  1549. private void SHOPList_SelectedIndexChanged(object sender, EventArgs e)
  1550. {
  1551. string SHOPLanguageSelect = SHOPList.SelectedItem.ToString();
  1552. string SHOPLcode = LanguageMapList[SHOPLanguageSelect];
  1553. functionSetting1.ShopLCode = SerialInit.HexToByte(SHOPLcode);
  1554. SaveJsonConfig("SHOPLanguageSelect", SHOPLanguageSelect);
  1555. Log.WriteInfoLog("\r\nSet channel setting to " + SHOPLanguageSelect + "\r\nchannel code is " + SHOPLcode);
  1556. }
  1557. private void skinButton1_Click(object sender, EventArgs e)
  1558. {
  1559. SaveJsonConfig("COM", "COM3");
  1560. string strFileName = null;
  1561. openFileDialog1.Filter = "WBConfig file|*.wba";
  1562. openFileDialog1.FileName = "";
  1563. openFileDialog1.Title = "Please select the WB config file";
  1564. if (openFileDialog1.ShowDialog() == DialogResult.OK)
  1565. {
  1566. strFileName = System.IO.Path.GetFullPath(openFileDialog1.FileName);
  1567. WBPath.Text = strFileName;
  1568. if (LoadWBConfig(strFileName))
  1569. {
  1570. functionSetting1.WBFileName = Path.GetFileName(openFileDialog1.FileName);
  1571. SaveJsonConfig("WhiteBalancePath", strFileName);
  1572. MessageBox.Show(LResource.LoadWBsuccess);
  1573. }
  1574. }
  1575. }
  1576. private void WriteWB_CheckedChanged(object sender, EventArgs e)
  1577. {
  1578. if (WriteWB.Checked == true)
  1579. {
  1580. if (WBPath.Text.Trim().Length > 0)
  1581. {
  1582. LoadWBConfig(WBPath.Text.Trim());
  1583. SaveJsonConfig("WriteWhiteBalance", true);
  1584. }
  1585. else
  1586. {
  1587. MessageBox.Show(LResource.SelectWBfirst);
  1588. WriteWB.Checked = false;
  1589. }
  1590. }
  1591. else
  1592. {
  1593. SaveJsonConfig("WriteWhiteBalance", false);
  1594. }
  1595. }
  1596. public void SaveJsonConfig(string node, object value)
  1597. {
  1598. StreamReader file = File.OpenText(LocalPath.localpath + "\\Config.json");
  1599. using (JsonTextReader reader = new JsonTextReader(file))
  1600. {
  1601. JObject jObject = (JObject)JToken.ReadFrom(reader);
  1602. jObject[node] = value.ToString();
  1603. file.Close();
  1604. using (StreamWriter writer = new StreamWriter(LocalPath.localpath + "\\Config.json"))
  1605. {
  1606. writer.Write(jObject.ToString()); //将JToken.ReadFrom(reader)的数据写入文件,这样的数据有空行。
  1607. }
  1608. }
  1609. }
  1610. private void WBInit_CheckedChanged(object sender, EventArgs e)
  1611. {
  1612. if (WBInit.Checked)
  1613. {
  1614. SaveJsonConfig("WhiteBalanceInit", true);
  1615. }
  1616. else
  1617. SaveJsonConfig("WhiteBalanceInit", false);
  1618. }
  1619. private void WriteChannel_CheckedChanged(object sender, EventArgs e)
  1620. {
  1621. if (WriteChannel.Checked)
  1622. {
  1623. SaveJsonConfig("WriteChannel", true);
  1624. }
  1625. else
  1626. SaveJsonConfig("WriteChannel", false);
  1627. }
  1628. private void WriteOSD_CheckedChanged(object sender, EventArgs e)
  1629. {
  1630. if (WriteOSD.Checked)
  1631. {
  1632. SaveJsonConfig("WriteOSDLanguage", true);
  1633. }
  1634. else
  1635. SaveJsonConfig("WriteOSDLanguage", false);
  1636. }
  1637. private void WriteSHOP_CheckedChanged(object sender, EventArgs e)
  1638. {
  1639. if (WriteSHOP.Checked)
  1640. {
  1641. SaveJsonConfig("WriteSHOPLanguage", true);
  1642. }
  1643. else
  1644. SaveJsonConfig("WriteSHOPLanguage", false);
  1645. }
  1646. private void TVCOM_SelectedIndexChanged(object sender, EventArgs e)
  1647. {
  1648. SaveJsonConfig("COM", TVCOM.SelectedItem.ToString());
  1649. }
  1650. private void TVBaud_SelectedIndexChanged(object sender, EventArgs e)
  1651. {
  1652. SaveJsonConfig("Baudrate", TVBaud.SelectedItem.ToString());
  1653. }
  1654. private void Form1_FormClosed(object sender, FormClosedEventArgs e)
  1655. {
  1656. Environment.Exit(0);
  1657. }
  1658. public void LockSettingFunction(bool locksetting)
  1659. {
  1660. ChannelList.Enabled = locksetting;
  1661. WriteOSD.Enabled = locksetting;
  1662. WriteSHOP.Enabled = locksetting;
  1663. WriteChannel.Enabled = locksetting;
  1664. OSDList.Enabled = locksetting;
  1665. SHOPList.Enabled = locksetting;
  1666. skinButton1.Enabled = locksetting;
  1667. WriteOSD.Enabled = locksetting;
  1668. WBInit.Enabled = locksetting;
  1669. WriteWB.Enabled = locksetting;
  1670. OrderText.Enabled = locksetting;
  1671. Preload.Enabled = locksetting;
  1672. PID_Num.Enabled = locksetting;
  1673. BarcodeLimit.Enabled = locksetting;
  1674. BarCodeLengthText.Enabled = locksetting;
  1675. BarCodeKeyCodeText.Enabled = locksetting;
  1676. }
  1677. private void TVCOM_MouseClick(object sender, MouseEventArgs e)
  1678. {
  1679. TVCOM.Items.Clear();
  1680. TVCOM.Items.AddRange(SerialPort.GetPortNames());
  1681. }
  1682. private void CreateKeyManually_Click(object sender, EventArgs e)
  1683. {
  1684. CreateDBManually CreateDBManually1 = new CreateDBManually(TestMode.serverurl, ErrorDB);
  1685. CreateDBManually1.ShowDialog();
  1686. }
  1687. private void Preload_CheckedChanged(object sender, EventArgs e)
  1688. {
  1689. SaveJsonConfig("Preload", Preload.Checked.ToString());
  1690. }
  1691. private void Form1_Move(object sender, EventArgs e)
  1692. {
  1693. if (this.MoveEvent != null)
  1694. {
  1695. Point XY = this.Location;
  1696. XY.X = this.Right;
  1697. XY.Y = this.Top;
  1698. this.MoveEvent(XY, formlocationmsg, LocationNum);
  1699. }
  1700. }
  1701. private void DeleteIntptr(IntPtr intPtr)
  1702. {
  1703. foreach (Dictionary<IntPtr, Point> pairs in formlocationmsg)
  1704. {
  1705. if (pairs.ContainsKey(intPtr))
  1706. {
  1707. formlocationmsg.Remove(pairs);
  1708. if (this.MoveEvent != null)
  1709. {
  1710. Point XY = this.Location;
  1711. XY.X = this.Right;
  1712. XY.Y = this.Top;
  1713. this.MoveEvent(XY, formlocationmsg, LocationNum);
  1714. }
  1715. break;
  1716. }
  1717. }
  1718. }
  1719. private void SNKeyDownEven(IntPtr intPtr)
  1720. {
  1721. this.KeyDownEvent(formlocationmsg, intPtr);
  1722. }
  1723. private void timer1_Tick(object sender, EventArgs e)
  1724. {
  1725. string count = SQLiteHelper.GetProductionNum(ErrorDB, OrderText.Text.Trim());
  1726. UpdateCountLabel(ProductionNum_Text, count);
  1727. }
  1728. /// <summary>
  1729. /// 刷新订单数量
  1730. /// </summary>
  1731. /// <param name="label"></param>
  1732. /// <param name="str"></param>
  1733. public void UpdateCountLabel(Label label, string str)
  1734. {
  1735. if (label.InvokeRequired)
  1736. {
  1737. BeginInvoke(new Action<string>(x => { label.Text = x.ToString(); }), str);
  1738. }
  1739. else
  1740. {
  1741. label.Text = str;
  1742. }
  1743. }
  1744. /// <summary>
  1745. /// 后台上报
  1746. /// </summary>
  1747. public void UploadBackGround()
  1748. {
  1749. while (true)
  1750. {
  1751. if (!CommonMethod.HTTPChecker(StructList.CheckServerConnectionUrl))
  1752. {
  1753. Thread.Sleep(20000);
  1754. continue;
  1755. }
  1756. try
  1757. {
  1758. string url;
  1759. string content;
  1760. string id;
  1761. if (SQLiteHelper.GetDelayReportData(ErrorDB, out url, out content, out id))
  1762. {
  1763. if (content.Contains("@"))
  1764. {
  1765. string[] data = content.Split('@');
  1766. if (V2Method.ReportOfflineData(url, data[1], data[0], LocalDB, ErrorDB, true, id))
  1767. {
  1768. SQLiteHelper.UpdateReportData(ErrorDB, "CopyDelayReport", "ID", id);
  1769. }
  1770. }
  1771. else if (V2Method.ReportOnlineData(url, OrderText.Text.Trim(), content, ErrorDB, true, id, functionSetting1.ReportTimeOut))
  1772. {
  1773. SQLiteHelper.UpdateReportData(ErrorDB, "CopyDelayReport", "ID", id);
  1774. }
  1775. }
  1776. }
  1777. catch (Exception ex)
  1778. {
  1779. Log.WriteErrorLog(ex.Message);
  1780. }
  1781. try
  1782. {
  1783. string url;
  1784. string content;
  1785. string id;
  1786. if (SQLiteHelper.GetErrorReportData(ErrorDB, out url, out content, out id))
  1787. {
  1788. bool mark = false;
  1789. if ( url.EndsWith("smes/RecordKey") )
  1790. {
  1791. GMethod.ReportDataBurningResultToMES(url, content, out mark);
  1792. }
  1793. else
  1794. {
  1795. CommonMethod.ReportErrormsg2(url, content, out mark);
  1796. }
  1797. if (mark)
  1798. {
  1799. SQLiteHelper.UpdateReportData(ErrorDB, "ErrorReport", "ID", id);
  1800. }
  1801. }
  1802. }
  1803. catch (Exception ex)
  1804. {
  1805. Log.WriteErrorLog(ex.Message);
  1806. }
  1807. try
  1808. {
  1809. string url;
  1810. string content;
  1811. string id;
  1812. if (SQLiteHelper.GetReportData(ReportDB, out id, out url, out content))
  1813. {
  1814. if ( V2Method.ReportOnlineDataSQL(url, content, 5000) )
  1815. {
  1816. // 删除该记录;
  1817. SQLiteCommand cmd = new SQLiteCommand();
  1818. cmd.Connection = ReportDB;
  1819. cmd.CommandText = string.Format("delete from ReportData where id = {0}", id);
  1820. cmd.ExecuteNonQuery();
  1821. cmd.Dispose();
  1822. }
  1823. }
  1824. }
  1825. catch (Exception ex)
  1826. {
  1827. Log.WriteErrorLog(ex.Message);
  1828. }
  1829. // 频率5秒一次;
  1830. Thread.Sleep(5000);
  1831. }
  1832. }
  1833. private void PID_Num_ValueChanged(object sender, EventArgs e)
  1834. {
  1835. Custom_ProjectID = PID_Num.Value.ToString();
  1836. SaveJsonConfig("Custom_ProjectID", Custom_ProjectID);
  1837. }
  1838. private void BarCodeLengthText_ValueChanged(object sender, EventArgs e)
  1839. {
  1840. functionSetting1.BarcodeLength = Convert.ToInt32(BarCodeLengthText.Value);
  1841. SaveJsonConfig("BarcodeLength", functionSetting1.BarcodeLength);
  1842. }
  1843. private void BarcodeLimit_CheckedChanged(object sender, EventArgs e)
  1844. {
  1845. functionSetting1.BarcodeLimit = BarcodeLimit.Checked;
  1846. SaveJsonConfig("BarcodeLimit", BarcodeLimit.Checked);
  1847. }
  1848. private void BarCodeKeyCodeText_TextChanged(object sender, EventArgs e)
  1849. {
  1850. functionSetting1.BarcodeKeyword = BarCodeKeyCodeText.Text;
  1851. SaveJsonConfig("BarcodeKeyword", BarCodeKeyCodeText.Text);
  1852. }
  1853. private void UsinglocalIDCheck_CheckedChanged(object sender, EventArgs e)
  1854. {
  1855. SaveJsonConfig("UsingLocalPID", UsinglocalIDCheck.Checked);
  1856. }
  1857. private void BarcodeWrite_CheckedChanged(object sender, EventArgs e)
  1858. {
  1859. functionSetting1.BarcodeWrite = BarcodeWrite.Checked;
  1860. SaveJsonConfig("BarcodeWrite", BarcodeWrite.Checked);
  1861. }
  1862. }
  1863. }