Form1.cs 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251
  1. using CarMeterSystem.OptionCls;
  2. using com.hnshituo.core.webapp.vo;
  3. using Common;
  4. using iCore.Rtdb.RtdbTable;
  5. using MeterConditionLibrary;
  6. using MeterModelLibrary;
  7. using MeterModuleLibrary.uc;
  8. using MeterPlugInLibrary;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.Linq;
  14. using System.Windows.Forms;
  15. namespace CarMeterSystem
  16. {
  17. public partial class Form1 : Form
  18. {
  19. public Form1()
  20. {
  21. InitializeComponent();
  22. }
  23. private Log l = Log.GetInstance();
  24. private Print printClass = new Print();//打印
  25. //内存表
  26. private MemoryTableDataSocket MemoClass = new MemoryTableDataSocket("");
  27. //实时表数据采集
  28. private DataCollectionControl collection = new DataCollectionControl();
  29. //图片控制器含图片压缩及上传curl
  30. private ImageCurlControl imageCurlControl = new ImageCurlControl();
  31. //与监控界面对接的表
  32. private MeterWorkMonitorService meterWorkMonitor = new MeterWorkMonitorService();
  33. //零点报警表
  34. private meterworkzeroalarmservice zeroAlarmService = new meterworkzeroalarmservice();
  35. //车号修正
  36. private CarNoModfiy modfiy = new CarNoModfiy();
  37. //验证对射
  38. private validParkStatus valid = new validParkStatus();
  39. //语音播报
  40. private VoicePlay vicPlayClass = new VoicePlay();
  41. //扫码枪
  42. private SweepCode sweepCodeClass = new SweepCode();
  43. private LED_Control led_controler = null;
  44. //验证校秤数据
  45. private validCalibration vCalib = new validCalibration();
  46. private MeterWorkCarActualFirstService workCarActualFirstService = new MeterWorkCarActualFirstService(); //一次计量数据
  47. //查询当前是否校秤
  48. private bool bRelation = true;
  49. /// <summary>
  50. /// 欢迎界面
  51. /// </summary>
  52. private frmWelcome_Jisco frmWelcome = new frmWelcome_Jisco();//欢迎
  53. /// <summary>
  54. /// 基础数据载入
  55. /// </summary>
  56. private BaseDbCls bd = new BaseDbCls();
  57. //扫码修正车号标识
  58. private bool codeFlag = false;
  59. private List<ucBusinessType> lu = new List<ucBusinessType>();
  60. private bool isVoiceDownCar = false;//车上人员请下车播放一次
  61. private bool isShowFrmWelcome = false; //是否显示欢迎界面;在这个测试界面,不显示欢迎界面
  62. private bool isOpened = false;//是否已经打开了扫码计量界面
  63. private void Form1_Load(object sender, EventArgs e)
  64. {
  65. //*
  66. try
  67. {
  68. //CollectModel temp = new CollectModel();
  69. //temp.weight = 501;
  70. //PbCache.collect = temp;
  71. //frmMatMsgInfo frmMatMsgInfo = new frmMatMsgInfo();
  72. //frmMatMsgInfo.Show();
  73. timer1.Start();
  74. //2021年6月21日 杨秀东添加
  75. if (isShowFrmWelcome)
  76. {
  77. frmWelcome.Show();
  78. frmWelcome.Visible = true;
  79. }
  80. LoginCls lg = new LoginCls();
  81. if (lg.LoginIn())
  82. {
  83. // 加载并验证基本配置
  84. if (bd.setBaseDb() && bd.getBaseDb())
  85. {
  86. if (!string.IsNullOrEmpty(PbCache.sportInfo.ledIp))
  87. {
  88. led_controler = new LED_Control(PbCache.sportInfo.ledIp);
  89. }
  90. //调用该方法时已赋值
  91. RESTfulResult<List<MeterWorkMonitor>> rm = meterWorkMonitor.doQueryOneWf(new MeterWorkMonitor { validFlag = "1", pointNo = PbCache.sportInfo.baseSpotNo });
  92. if (!rm.Succeed)
  93. {
  94. l.WriteLog(1, "载入监控表数据异常");
  95. return;
  96. }
  97. else if (rm.Data != null && rm.Data.Count > 0)
  98. {
  99. if (string.IsNullOrEmpty(PbCache.collect_no))
  100. {
  101. PbCache.collect_no = rm.Data[0].collectionCode;
  102. MemoClass = new MemoryTableDataSocket(PbCache.collect_no);
  103. }
  104. }
  105. else
  106. {
  107. //l.WriteLog(1, "为配置监控数据");
  108. //return;
  109. }
  110. //若未校秤的话,也不允许计量
  111. //载入界面业务按钮
  112. if (PbCache.businessType != null && PbCache.businessType.Count > 0)
  113. {
  114. foreach (ComBaseInfo info in PbCache.businessType)
  115. {
  116. ucBusinessType uc = new ucBusinessType();
  117. switch (info.baseCode)
  118. {
  119. case "001006003":
  120. uc.setControl(info.baseName, info.memo, info.baseCode);
  121. break;
  122. case "001006001":
  123. case "001006002":
  124. uc.setControl(info.baseName, info.memo, info.baseCode);
  125. break;
  126. default:
  127. uc.setControl(info.baseName, info.memo, info.baseCode);
  128. break;
  129. }
  130. uc.Dock = DockStyle.Top;
  131. //uc.setControl("","","",);
  132. uc.ucEvent += new EventHandler(ucEvents);
  133. lu.Add(uc);
  134. panel7.Controls.Add(uc);
  135. }
  136. }
  137. //开启基础进程
  138. l.WriteLog(0, "系统登录成功");
  139. collection.EventDataCollectionArgs += new EventDataCollection(EventData);//数据采集
  140. collection.Start(PbCache.sportInfo.baseSpotNo, PbCache.sportInfo.baseSpotName);
  141. imageCurlControl.Start(); //图片采集线程
  142. //sweepCodeClass.StartThreadSweep(); //扫码线程
  143. ////***********************暂时注释掉*****************************************************
  144. ////sweepCodeClass.StartThreadSweep();
  145. ////**************************************************************************************
  146. }
  147. else
  148. {
  149. l.WriteLog(0, "系统登录失败");
  150. }
  151. }
  152. else
  153. {
  154. l.WriteLog(0, "按IP地址找不到计量点信息,系统登录失败");
  155. }
  156. }
  157. catch (Exception ex)
  158. {
  159. l.WriteLog(0, "系统加载失败:" + ex.Message);
  160. }
  161. //*/
  162. }
  163. #region
  164. //*
  165. public void ucEvents(object sender, EventArgs e)
  166. {
  167. Control control = (Control)sender;
  168. ucBusinessType um = control.Parent.Parent as ucBusinessType;
  169. try
  170. {
  171. switch (control.Name)
  172. {
  173. case "btnContext":
  174. case "btnPurchase":
  175. {
  176. PbCache.bussinessTypeName = um._bussiness == null ? "" : um._bussiness;
  177. PbCache.bussinessTypeCode = um._code;
  178. switch (um._code)
  179. {
  180. case "001006003":
  181. frmInternalTransport frm = new frmInternalTransport();
  182. frm.isTest = true;
  183. frm.ShowDialog();
  184. break;
  185. /*
  186. case "001006001":
  187. case "001006002":
  188. frmCarSalePurchase frmCar = new frmCarSalePurchase();
  189. frmCar.ShowDialog();
  190. break;
  191. //*/
  192. default:
  193. frmCarSalePurchase frmCar = new frmCarSalePurchase();
  194. frmCar.isTest = true;
  195. frmCar.ShowDialog();
  196. break;
  197. }
  198. };
  199. break;
  200. default: break;
  201. }
  202. }
  203. catch (Exception ex)
  204. {
  205. MessageBox.Show("操作异常:" + ex.Message);
  206. }
  207. }
  208. //*/
  209. #endregion
  210. #region
  211. private void setWelecomeVis(bool visb)
  212. {
  213. /*
  214. if (frmWelcome.InvokeRequired)
  215. {
  216. Action<bool> action = new Action<bool>(setWelecomeVis);
  217. Invoke(action, new object[] { visb });
  218. }
  219. else
  220. {
  221. if (frmWelcome.Visible != visb)
  222. {
  223. frmWelcome.Visible = visb;
  224. frmWelcome.setLogin();
  225. }
  226. }
  227. //*/
  228. }
  229. #endregion
  230. private int iCount = 0, iHodeTime = 0;
  231. private bool flagCarMonit = false;//车号修正
  232. private bool isOpenMeter = false; //是否已打开计量界面,若已经打开则这里关于超量程及红外的语音将停止播报
  233. private string firstCode = "";//上次扫码的信息
  234. private string ledTxt = "";
  235. private bool isLedWrite = true;//是否写入一次LED
  236. private string sCarNo = "";
  237. private string editCarNo = "";
  238. private string preCarNo = "";
  239. /// <summary>
  240. /// 数据采集
  241. /// </summary>
  242. /// <param name="o"></param>
  243. /// <param name="e"></param>
  244. private void EventData(object o, DataCollectionArgs e)
  245. {
  246. //这里每隔0.5秒执行一次
  247. try
  248. {
  249. #region
  250. /*
  251. if (e.licType == PbCache.collect.licType)
  252. {
  253. iCollection++;
  254. if (iCollection > 59 && iCollection % 20 == 0) //若连续30秒采集不到数据则提示中断,并每隔10秒播放一次
  255. {
  256. //采集线程中断
  257. vicPlayClass.GetVoicePlay("实时库采集中断", "");
  258. sweepCodeClass.StrState = "";
  259. }
  260. }
  261. else
  262. {
  263. sweepCodeClass.StrState = e.weightStatus + "";
  264. iCollection = 0;
  265. }
  266. //*/
  267. #endregion
  268. #region 扫码信息
  269. sweepCodeClass.StrState = e.weightStatus + ""; //重量状态信息;当StrState= 0时,获取扫码信息,StrState= 2时将扫码信息置位“”空;其他状态不处理
  270. l.WriteLog(12,sweepCodeClass.ToString());
  271. if (string.IsNullOrEmpty(sweepCodeClass.StrCode))
  272. {
  273. if (string.IsNullOrEmpty(PbCache.strCode))
  274. {
  275. firstCode = "";
  276. PbCache.strCode = "";
  277. l.WriteLog(12, "主线程扫码值为空时清空;sweepCodeClass.StrCode值为" + sweepCodeClass.StrCode + " ;PbCache.strCode值为:" + PbCache.strCode);
  278. }
  279. }
  280. else
  281. {
  282. ////日期2021年12月22日:重复扫码,取前面12位
  283. //if (sweepCodeClass.StrCode.Length > 15)
  284. //{
  285. // sweepCodeClass.StrCode = sweepCodeClass.StrCode.Substring(12);
  286. //}
  287. //if (firstCode != sweepCodeClass.StrCode || string.IsNullOrEmpty(PbCache.strCode))
  288. //{
  289. // l.WriteLog(12, "主线程扫码值赋值;sweepCodeClass.StrCode值为" + sweepCodeClass.StrCode + " ;PbCache.strCode前值为:" + PbCache.strCode);
  290. // PbCache.strCode = sweepCodeClass.StrCode;
  291. // firstCode = PbCache.strCode;
  292. //}
  293. l.WriteLog(12, "测试扫码值"+PbCache.strCode);
  294. PbCache.collect.carno = sweepCodeClass.StrCode;
  295. codeFlag = true;
  296. }
  297. #endregion
  298. #region 秤上无车10分钟获取一次基础数据
  299. if (iCount < 1200)
  300. {
  301. iCount++;
  302. }
  303. else
  304. {
  305. iCount = 0;
  306. try
  307. {
  308. //秤上没有车时,每隔10分钟获取一次基础数据
  309. if (e.weight < 500)
  310. {
  311. editCarNo = "";
  312. preCarNo = "";
  313. if (bd.setBaseDb())
  314. {
  315. l.WriteLog(0, "十分钟获取基础数据成功");
  316. }
  317. else
  318. {
  319. l.WriteLog(0, "十分钟获取基础数据失败");
  320. }
  321. }
  322. }
  323. catch (Exception ex)
  324. {
  325. l.WriteLog(0, "十分钟获取基础数据失败:" + ex.Message);
  326. }
  327. }
  328. #endregion
  329. #region 每10秒写入一次当前时间
  330. if (iCount % 20 == 0)
  331. {
  332. RESTfulResult<string> rms = meterWorkMonitor.doUpdateWf(new MeterWorkMonitor { pointNo = PbCache.sportInfo.baseSpotNo, lastTime = DateTime.Now });
  333. if (!rms.Succeed)
  334. {
  335. l.WriteLog(0, "frmMain.EventData异常:写入时间异常");
  336. }
  337. }
  338. #endregion
  339. #region
  340. //一旦界面锁定则不采集数据
  341. //if (!PbCache.isLockFrm)
  342. //{
  343. PbCache.collect.pointid = PbCache.sportInfo.baseSpotNo;
  344. PbCache.collect.parkStatus = e.parkStatus;
  345. PbCache.collect.datetime = e.datetime;
  346. PbCache.collect.licType = e.licType;
  347. if (testFlag)
  348. {
  349. sCarNo = testCarNo;
  350. //PbCache.collect.carno = testCarNo;
  351. PbCache.collect.weight = testWgt;
  352. PbCache.collect.weightStatus = 0;
  353. PbCache.monitorResult.valid_park_status = true;
  354. PbCache.collect.parkStatus = 0;
  355. if (PbCache.collect.weight > e.weight)
  356. e.weight = PbCache.collect.weight;
  357. PbCache.strCode = testPlanNo;
  358. e.carno = testCarNo;
  359. //PbCache.strQRCode = testCode;
  360. }
  361. else
  362. {
  363. PbCache.collect.weight = e.weight;
  364. PbCache.collect.weightStatus = e.weightStatus;
  365. }
  366. if (!flagCarMonit)
  367. {
  368. sCarNo = e.carno;
  369. //PbCache.collect.carno = e.carno;
  370. }
  371. #if DEBUG
  372. #endif
  373. #region 摄像头当前采集的车号与上次采集的不一样且当前未勾选不验证的情况
  374. if (preCarNo != e.carno && PbCache.monitor != null && PbCache.monitor.validCarno != "0")
  375. {
  376. flagCarMonit = false;
  377. }
  378. preCarNo = e.carno;
  379. #endregion
  380. //*
  381. //有车号,且重量稳定的情况下,只修正一次车号
  382. if (!string.IsNullOrEmpty(e.carno) && e.weightStatus == 0 && !flagCarMonit && PbCache.monitor != null && PbCache.monitor.carMonitor == "1" && PbCache.monitor.carMonitorLvl > 0)
  383. {
  384. flagCarMonit = true;
  385. string methods = "";
  386. for (int i = 0; i <= PbCache.monitor.carMonitorLvl; i++)
  387. {
  388. methods += "CarNoTrustCorrect" + i + ",";
  389. }
  390. editCarNo = modfiy.CarNoCorrect(e.carno, methods.Substring(0, methods.Length - 1));
  391. sCarNo = editCarNo;
  392. }
  393. //勾选了不验证车号的情况
  394. if (PbCache.monitor.validCarno == "0")
  395. {
  396. flagCarMonit = true;
  397. }
  398. //}
  399. //*/
  400. //重量大于500的情况下
  401. if (e.weight > 500)
  402. {
  403. if (PbCache.dtStartTime == null)
  404. PbCache.dtStartTime = DateTime.Now;
  405. isLedWrite = true;
  406. #region 查一次是否校秤,若未校秤则不能计量
  407. /*
  408. if (bRelation)
  409. {
  410. string msgInfo = "";
  411. isCalibration = vCalib.ValidMethod(new MeterWorkCalibrationMain { baseSpotNo = PbCache.sportInfo.baseSpotNo, valueFlag = "2" }, out msgInfo);
  412. if (!isCalibration)
  413. {
  414. foreach (ucBusinessType uc in lu)
  415. {
  416. uc.setControlEnable(false);
  417. }
  418. ledTxt = msgInfo;
  419. l.WriteLog(1, msgInfo);
  420. }
  421. bRelation = false;
  422. }
  423. if (!isCalibration)
  424. {
  425. vicPlayClass.GetVoicePlay("未校秤", "");
  426. Thread.Sleep(2000);
  427. return;
  428. }
  429. //*/
  430. #endregion
  431. #region 车上人员请下车
  432. try
  433. {
  434. //界面未锁定的情况下,有车号,如果重量稳定了,停车线验证通过,未超量程的情况下,则按钮可用
  435. if (!string.IsNullOrEmpty(PbCache.collect.carno) && PbCache.collect.weightStatus == 0 && PbCache.monitorResult.valid_park_status && PbCache.collect.weight < PbCache.range.upperRange)
  436. {
  437. if (!isVoiceDownCar)
  438. {
  439. isVoiceDownCar = true;
  440. vicPlayClass.GetVoicePlay("车上人员请下车", PbCache.collect.carno);
  441. }
  442. }
  443. }
  444. catch { }
  445. #endregion
  446. setWelecomeVis(false);
  447. //每隔1秒刷一次计量实时监控表数据值
  448. if (iCount % 2 == 0)
  449. {
  450. #region 停留超时
  451. iHodeTime++;
  452. MeterWorkMonitor mwUpdate = new MeterWorkMonitor();
  453. mwUpdate.pointNo = PbCache.sportInfo.baseSpotNo;
  454. if (PbCache.holdTime != null && PbCache.holdTime.Count > 0)
  455. {
  456. if (PbCache.holdTime[0].retentionTime != null)
  457. {
  458. if (PbCache.holdTime[0].retentionTime.Value < iHodeTime)
  459. {
  460. PbCache.isOvertimeAlarm = true; //是否超时报警
  461. mwUpdate.stopOverTime = "1"; //写入一次停留超时
  462. //mwUpdate.isHelp = "1";//派位
  463. //mwUpdate.isTakeOver = "1";
  464. iHodeTime = 99999;//不再增长避免超出
  465. }
  466. }
  467. }
  468. #endregion
  469. #region 车号信息
  470. mwUpdate.rfidCar = "";
  471. mwUpdate.photoCar = e.vdioCarNos;
  472. //e.RfidNos = "0003";
  473. if (!string.IsNullOrEmpty(e.RfidNos))
  474. {
  475. if (PbCache.ltCarCard != null && PbCache.ltCarCard.Count > 0)
  476. {
  477. MeterBaseCarCard carCard = PbCache.ltCarCard.Where(s => s.cardNo == e.RfidNos).FirstOrDefault();
  478. if (carCard != null)
  479. {
  480. mwUpdate.rfidCar = carCard.carNo;
  481. sCarNo = carCard.carNo;
  482. //PbCache.collect.carno = carCard.carNo;
  483. }
  484. }
  485. }
  486. if (PbCache.monitor != null && !string.IsNullOrEmpty(PbCache.monitor.setCar))
  487. {
  488. //未锁定的情况下,若监控界面设置了车号,则车号将改为设定车号
  489. sCarNo = PbCache.monitor.setCar;
  490. codeFlag = false;
  491. sweepCodeClass.StrCode = "";
  492. }
  493. #endregion
  494. #region 重量信息
  495. if (!PbCache.isLockFrm)
  496. {
  497. mwUpdate.wgt = e.weight;
  498. }
  499. else
  500. {
  501. mwUpdate.wgt = Convert.ToInt32(PbCache.lockWgt);
  502. }
  503. #endregion
  504. #region 写入一次监控表,将重量/车号停留超时等信息写入
  505. mwUpdate.msgInfo = PbCache.monitorResultMessage;
  506. //另外初始化一次监控数据
  507. RESTfulResult<string> rms = meterWorkMonitor.doUpdateWf(mwUpdate);
  508. if (!rms.Succeed)
  509. {
  510. l.WriteLog(0, "frmMain.EventData异常doUpdateWf:写入信息异常");
  511. }
  512. #endregion
  513. //调用该方法时已赋值
  514. RESTfulResult<List<MeterWorkMonitor>> rm = meterWorkMonitor.doQueryOneWf(new MeterWorkMonitor { validFlag = "1", pointNo = PbCache.sportInfo.baseSpotNo });
  515. if (!rm.Succeed)
  516. {
  517. l.WriteLog(0, "frmMain.EventData异常doQueryWf:" + rm.ResultMessage);
  518. }
  519. else
  520. {
  521. if (rm.Data != null && rm.Data.Count > 0)
  522. {
  523. PbCache.monitor = rm.Data[0];
  524. if (string.IsNullOrEmpty(PbCache.collect_no))
  525. {
  526. PbCache.collect_no = rm.Data[0].collectionCode;
  527. }
  528. if (ledTxt != rm.Data[0].ledWriter && rm.Data[0].ledWriter != "")
  529. {
  530. //调用LED信息写入******************************
  531. ledTxt = rm.Data[0].ledWriter;
  532. }
  533. if (string.IsNullOrEmpty(ledTxt))
  534. {
  535. ledTxt = "车号甘A12345,重量98.76吨,计量完成";
  536. }
  537. }
  538. }
  539. //验证对射
  540. valid.ValidMethod();
  541. if (!isOpenMeter)
  542. {
  543. //if (PbCache.range != null && PbCache.range.upperRange < e.weight)
  544. if (PbCache.range != null && PbCache.range.upperRange < e.weight)
  545. {
  546. //超量程
  547. vicPlayClass.GetVoicePlay("已超量程", e.carno);
  548. //return;
  549. }
  550. else if (e.weightStatus == 0 && !PbCache.monitorResult.valid_park_status)
  551. {
  552. //重量稳定,且对射验证不合格
  553. vicPlayClass.GetVoicePlay("您的车辆未停到位", e.carno);
  554. //return;
  555. }
  556. }
  557. if (!lu[0].bcEnable)
  558. {
  559. foreach (ucBusinessType uc in lu)
  560. {
  561. uc.setControlEnable(true);
  562. }
  563. }
  564. if (sweepCodeClass.StrCode == "" && !codeFlag)
  565. {
  566. PbCache.collect.carno = sCarNo;
  567. }
  568. }
  569. //写入LED信息
  570. if (PbCache.sportInfo != null && PbCache.ledInfo != PbCache.OldLedInfo)
  571. {
  572. PbCache.OldLedInfo = PbCache.ledInfo;
  573. if (PbCache.monitor != null && PbCache.monitor.ledKeep == "0")
  574. {
  575. //led_controler.setOneLineMsg(PbCache.sportInfo.ledIp, PbCache.ledInfo);
  576. }
  577. }
  578. }
  579. else
  580. {
  581. if (e.weight > 0 && e.weight < 200)
  582. {
  583. doOperateLive();
  584. }
  585. if (e.weight==0)
  586. {
  587. PbCache.isZeroAlarm = false;
  588. }
  589. //======测试 的时候注释,正式用的时候启用下面这行代码***************************************************************
  590. //PbCache.ResultMessage = "";
  591. PbCache.isOvertimeAlarm = false;
  592. isOpened = false;
  593. isVoiceDownCar = false;
  594. flagCarMonit = false;
  595. iHodeTime = 0;
  596. sCarNo = "";
  597. if (!testFlag)
  598. {
  599. bRelation = true;
  600. PbCache.isLockFrm = false;
  601. PbCache.dtStartTime = null;
  602. PbCache.voiceOver = true;
  603. setWelecomeVis(true);
  604. if (lu[0].bcEnable)
  605. {
  606. foreach (ucBusinessType uc in lu)
  607. {
  608. uc.setControlEnable(false);
  609. }
  610. }
  611. //LED写入
  612. if (isLedWrite)
  613. {
  614. if (PbCache.monitor == null || string.IsNullOrEmpty(PbCache.monitor.ledWriter))
  615. {
  616. PbCache.ledInfo = "车号甘A12345,重量98.76吨,计量完成";
  617. }
  618. else
  619. {
  620. PbCache.ledInfo = PbCache.monitor == null ? "" : PbCache.monitor.ledWriter;
  621. }
  622. //led_controler.setStaticLineMsg(PbCache.sportInfo.ledIp, PbCache.ledInfo);
  623. led_controler.setOneLineMsg(PbCache.sportInfo.ledIp, PbCache.ledInfo);
  624. isLedWrite = false;
  625. //*
  626. //另外初始化一次监控数据
  627. RESTfulResult<string> rms = meterWorkMonitor.doUpdateWf(new MeterWorkMonitor
  628. {
  629. pointNo = PbCache.sportInfo.baseSpotNo,
  630. validWgt = "1",
  631. validCarno = "1",
  632. validTareTime = "1",
  633. validMatTime = "1",
  634. validTimeInterval = "1",
  635. validParkStatus = "1",
  636. validExceedWgt = "1",
  637. validPredictionDiff = "1",
  638. validLianda = "1",
  639. validMatClick = "1",
  640. setCar = "",
  641. rfidCar = "",
  642. photoCar = "",
  643. scanCar = "",
  644. editCar = "",
  645. carErr = "0",
  646. wgtErr = "0",
  647. stopOverTime = "0",
  648. msgInfo = "",
  649. ledWriter = "",
  650. isOverWgt = "",
  651. isHelp = "0",
  652. wgt = 0
  653. });
  654. if (!rms.Succeed)
  655. {
  656. l.WriteLog(0, "frmMain.EventData异常:写入信息异常");
  657. isLedWrite = true;
  658. }
  659. //*/
  660. }
  661. //*
  662. }
  663. else
  664. {
  665. if (!lu[0].bcEnable)
  666. {
  667. foreach (ucBusinessType uc in lu)
  668. {
  669. uc.setControlEnable(true);
  670. }
  671. }
  672. }
  673. //*/
  674. }
  675. #endregion
  676. }
  677. catch (Exception ex)
  678. {
  679. l.WriteLog(0, "frmMain.EventData异常:" + ex.Message);
  680. }
  681. }
  682. private delegate void ShowBtnTare(bool flag);//定义委托 期限皮重按钮
  683. private int testWgt = 1000;
  684. private string testCarNo = "", testPlanNo = "";
  685. private bool testFlag = false;
  686. /// <summary>
  687. /// 截图测试
  688. /// </summary>
  689. /// <param name="sender"></param>
  690. /// <param name="e"></param>
  691. private void button2_Click(object sender, EventArgs e)
  692. {
  693. CameraShotCls cameraShot = new CameraShotCls();
  694. //cameraShot.CapMethod("1");
  695. _ = Invoke(new Action(() => { cameraShot.CapMethod("15"); }));
  696. }
  697. //测试打印
  698. private string strFirstNo = "";
  699. private void btnTestPrint_Click(object sender, EventArgs e)
  700. {
  701. Print1(txtPlanNo.Text);
  702. }
  703. //弹窗
  704. private static FrmMessage FrmMess(string strMess, string strBtnSaveInfo)
  705. {
  706. FrmMessage frmMessage = new FrmMessage();
  707. frmMessage.StartPosition = FormStartPosition.Manual;
  708. frmMessage.Location = new Point(350, 450);
  709. frmMessage.ShowMessage = strMess;
  710. frmMessage.BtnSaveText = strBtnSaveInfo;
  711. frmMessage.BtnCancelText = "取消";
  712. return frmMessage;
  713. }
  714. private class PrintCls
  715. {
  716. public int printNum { get; set; }
  717. public MeterWorkCarActual printDb { get; set; }
  718. public int iType { get; set; } //0毛 1 皮 2净
  719. public string qrCode { get; set; }
  720. }
  721. private PrintCls printData = new PrintCls();
  722. private void Print1(string firstNo)
  723. {
  724. try
  725. {
  726. //lg.WriteLog(1, "打印开始");
  727. #region 获取打印信息,若需要打印则调用打印操作
  728. List<PrintCls> prrintC = new List<PrintCls>();
  729. string sql = @"select actual_no actualNo,
  730. prediction_no predictionNo,
  731. car_no carNo,
  732. matter_no matterNo,
  733. matter_name matterName,
  734. gross_weight grossWeight,
  735. gross_time grossTime,
  736. tare_weight tareWeight,
  737. tare_time tareTime,
  738. net_weight netWeight,
  739. net_Time netTime,
  740. 'x' meterTypeNo,
  741. meter_type_name meterTypeName,
  742. spec_name specName,
  743. forwarding_unit_name forwardingUnitName,
  744. receiving_uint_name receivingUintName,
  745. load_point_name loadPointName,
  746. add_weight addWeight,
  747. '1' uploadFlag --1结净数据 0一次表数据
  748. from meter_work_car_actual where actual_first1_no = '" + firstNo + @"' or actual_first2_no='" + firstNo + @"'
  749. union all
  750. select t.actual_first_no actualNo,
  751. t.prediction_no predictionNo,
  752. t.car_no carNo,
  753. t.matter_no matterNo,
  754. t.matter_name matterName,
  755. t.meter_weight grossWeight,
  756. t.create_time grossTime,
  757. 0 tareWeight,
  758. t.create_time tareTime,
  759. 0 netWeight,
  760. null netTime,
  761. t.weight_type meterTypeNo, --0毛重 否则皮重
  762. t.meter_type_name meterTypeName,
  763. t.spec_name specName,
  764. t.forwarding_unit_name forwardingUnitName,
  765. t.receiving_uint_name receivingUintName,
  766. t.load_point_name loadPointName,
  767. t.add_weight addWeight,
  768. '0' uploadFlag
  769. from METER_WORK_CAR_ACTUAL_FIRST t
  770. where t.actual_first_no = '" + firstNo + "' or t.actual_first_no = (select max(actual_first2_no) from meter_work_car_actual where actual_first1_no='" + firstNo + "')";
  771. //查下如果有毛重或者结净数据,则可进入打印判断
  772. PbModelDbService<List<MeterWorkCarActual>> pbModelDbService = new PbModelDbService<List<MeterWorkCarActual>>();
  773. RESTfulResult<List<MeterWorkCarActual>> rm = pbModelDbService.executeSqlDataWf(sql);
  774. //lg.WriteLog(1, "打印第一个sql:" + sql);
  775. if (rm.Succeed)
  776. {
  777. if (rm.Data != null && rm.Data.Count > 0)
  778. {
  779. //2021年6月26日 对一车联运的进行处理;用一次计量编号查二次计量数据,
  780. sql = @"select t3.actual_no actualNo, t3.prediction_no predictionNo, t3.car_no carNo, t3.matter_no matterNo, t3.matter_name matterName,
  781. t3.gross_weight grossWeight, t3.gross_time grossTime, t3.tare_weight tareWeight, t3.tare_time tareTime, t3.net_weight netWeight,
  782. t3.net_Time netTime, 'x' meterTypeNo, t3.meter_type_name meterTypeName, t3.spec_name specName,
  783. t3.forwarding_unit_name forwardingUnitName, t3.receiving_uint_name receivingUintName, t3.load_point_name loadPointName,
  784. t3.add_weight addWeight, '1' uploadFlag from meter_work_car_actual_first t2
  785. left join meter_work_car_actual t3 on t2.actual_first_no = t3.actual_first1_no
  786. where t2.prediction_combination in (select t.prediction_combination
  787. from meter_work_car_actual_first t
  788. where t3.value_flag = '0' and t.actual_first_no = '" + firstNo + @"' and
  789. instr(t.prediction_combination, '20') > 0) order by t3.net_time desc";
  790. RESTfulResult<List<MeterWorkCarActual>> rmLy = pbModelDbService.executeSqlDataWf(sql);
  791. if (rmLy.Succeed && rmLy.Data != null && rmLy.Data.Count == 1)
  792. {
  793. rm.Data = rmLy.Data; //一车联运,将毛重替换为净重数据
  794. }
  795. //若有毛重或者净重,找到对应数据的物料信息,若有,那么去找打印配置信息数据
  796. List<MeterWorkCarActual> mwa = rm.Data.Where(s => !string.IsNullOrEmpty(s.matterNo) && (s.meterTypeNo == "x" || s.meterTypeNo == "0")).ToList();
  797. if (mwa != null && mwa.Count > 0 && !string.IsNullOrEmpty(mwa[0].matterNo))
  798. {
  799. sql = @"select BASE_SPOT_NO baseSpotNo,
  800. load_point_no loadPointNo,
  801. matter_no matterNo,
  802. METER_TYPE_NO meterTypeNo,
  803. weight_type_name weightTypeName,
  804. PRINT_NUM printNum
  805. from METER_BASE_BILL_PRINT
  806. where matter_no = '" + mwa[0].matterNo + @"'
  807. and nvl(BASE_SPOT_NO, '" + PbCache.sportInfo.baseSpotNo + @"') = '" + PbCache.sportInfo.baseSpotNo + @"'
  808. and nvl(load_point_no, '" + (mwa[0].loadPointNo == null ? "1" : mwa[0].loadPointNo) + @"') = '" + (mwa[0].loadPointNo == null ? "1" : mwa[0].loadPointNo) + @"'";
  809. //lg.WriteLog(1, "打印第二个sql:" + sql); and nvl(METER_TYPE_NO, '" + PbCache.bussinessTypeCode + @"') = '" + PbCache.bussinessTypeCode + @"'
  810. //and nvl(METER_TYPE_NO, '') = ''
  811. PbModelDbService<List<MeterBaseBillPrint>> pbPrintService = new PbModelDbService<List<MeterBaseBillPrint>>();
  812. RESTfulResult<List<MeterBaseBillPrint>> rmPint = pbPrintService.executeSqlDataWf(sql);
  813. if (rmPint.Succeed)
  814. {
  815. if (rmPint.Data != null && rmPint.Data.Count > 0)
  816. {
  817. //若有净重信息:1毛重时间晚于皮重时间,则打印毛、皮、净重,2毛重早于皮重,打印皮、净
  818. //若只有毛重信息则打印毛重
  819. List<MeterBaseBillPrint> lGrossprint = rmPint.Data.Where(s => s.weightTypeName.Contains("毛")).ToList();
  820. List<MeterBaseBillPrint> lTarePrint = rmPint.Data.Where(s => s.weightTypeName.Contains("皮")).ToList();
  821. List<MeterBaseBillPrint> lNetprint = rmPint.Data.Where(s => s.weightTypeName.Contains("净")).ToList();
  822. List<MeterWorkCarActual> mwaChild = mwa.Where(s => s.meterTypeNo == "x").ToList();
  823. if (mwaChild != null && mwaChild.Count > 0) //若有净重信息
  824. {
  825. if (lTarePrint != null && lTarePrint.Count > 0)
  826. {
  827. //获取非毛,非净重信息如果没有则用的期限皮,此时不打,否则则打印
  828. MeterWorkCarActual mwca = rm.Data.Where(s => s.meterTypeNo != "x" && s.meterTypeNo != "0").FirstOrDefault();
  829. if (mwca != null)
  830. {
  831. PrintCls cls = new PrintCls();
  832. cls.printNum = (int)(lTarePrint[0].printNum == null ? 0 : lTarePrint[0].printNum.Value);
  833. cls.iType = 1;//皮重
  834. cls.printDb = mwca;
  835. prrintC.Add(cls);
  836. }
  837. }
  838. if (lGrossprint != null && lGrossprint.Count > 0)
  839. {
  840. //获取毛重信息
  841. MeterWorkCarActual mwca = rm.Data.Where(s => s.meterTypeNo == "0").FirstOrDefault();
  842. if (mwca != null)
  843. {
  844. PrintCls cls = new PrintCls();
  845. cls.printNum = (int)(lGrossprint[0].printNum == null ? 0 : lGrossprint[0].printNum.Value);
  846. cls.iType = 0;//毛重
  847. cls.printDb = mwca;
  848. prrintC.Add(cls);
  849. }
  850. }
  851. if (lNetprint != null && lNetprint.Count > 0)
  852. {
  853. //获取净重信息
  854. MeterWorkCarActual mwca = rm.Data.Where(s => s.meterTypeNo == "x").FirstOrDefault();
  855. if (mwca != null)
  856. {
  857. PrintCls cls = new PrintCls();
  858. cls.printNum = (int)(lNetprint[0].printNum == null ? 0 : lNetprint[0].printNum.Value);
  859. cls.iType = 2;//净重
  860. cls.printDb = mwca;
  861. prrintC.Add(cls);
  862. }
  863. }
  864. }
  865. else //只有毛重信息则打印毛重
  866. {
  867. if (lGrossprint != null && lGrossprint.Count > 0)
  868. {
  869. //获取毛重信息
  870. MeterWorkCarActual mwca = rm.Data.Where(s => s.meterTypeNo == "0").FirstOrDefault();
  871. if (mwca != null)
  872. {
  873. PrintCls cls = new PrintCls();
  874. cls.printNum = (int)(lGrossprint[0].printNum == null ? 0 : lGrossprint[0].printNum.Value);
  875. cls.iType = 0;//毛重
  876. cls.printDb = mwca;
  877. prrintC.Add(cls);
  878. }
  879. }
  880. }
  881. if (prrintC != null && prrintC.Count > 0)
  882. {
  883. FrmMessage frmMessage = FrmMess("是否打印第【1】张票据!", "打印");
  884. if (frmMessage.ShowDialog(this) == DialogResult.OK)
  885. {
  886. l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】是否打印选择了【是】");
  887. l.WriteLog(15, PbCache.lockCarNo + "是否打印选择了【是】");
  888. strFirstNo = firstNo;
  889. //printDocument1.PrinterSettings.PrinterName = PbCache.sportInfo.printerName;//strPntSvrName;
  890. System.Drawing.Printing.PaperSize customSize1 = new System.Drawing.Printing.PaperSize("TestPaper", 398, 433); //101mm*110mm,换算成英寸
  891. printDocument1.DefaultPageSettings.PaperSize = customSize1;//将自定义的Papersize赋给PrintDocument
  892. System.Drawing.Printing.Margins marginss = new System.Drawing.Printing.Margins(0, 0, 0, 0);
  893. printDocument1.DefaultPageSettings.Margins = marginss;
  894. printDocument1.PrintController = new System.Drawing.Printing.StandardPrintController();
  895. foreach (PrintCls db in prrintC)
  896. {
  897. switch (db.printDb.meterTypeNo)
  898. {
  899. case "0": //毛
  900. db.qrCode = db.printDb.actualNo + "," + db.printDb.grossWeight + "," + "1";
  901. break;
  902. case "x": //净
  903. db.qrCode = db.printDb.actualNo + "," + db.printDb.netWeight + "," + "2";
  904. break;
  905. default: //皮
  906. db.qrCode = db.printDb.actualNo + "," + db.printDb.grossWeight + "," + "1";
  907. break;
  908. }
  909. RESTfulResult<string> rQRCode = workCarActualFirstService.doQRCodeWf(db.qrCode);
  910. db.qrCode = rQRCode.Data;
  911. for (int i = 0; i < db.printNum; i++)
  912. {
  913. if (i == 0)
  914. {
  915. printData = db;
  916. printDocument1.Print();
  917. l.WriteLog(10, "当前第" + (i + 1) + "次打印:" + printData.iType + " 车号:" + db.printDb.carNo + ",二维码:" + db.qrCode);
  918. }
  919. else
  920. {
  921. FrmMessage frmMessageContinue = FrmMess("已打印【" + i + "】张,是否继续打印第【" + (i + 1) + "】张票据!", "打印");
  922. if (frmMessageContinue.ShowDialog(this) == DialogResult.OK)
  923. {
  924. printData = db;
  925. printDocument1.Print();
  926. l.WriteLog(10, "当前第" + (i + 1) + "次打印:" + printData.iType + " 车号:" + db.printDb.carNo + ",二维码:" + db.qrCode);
  927. }
  928. else
  929. {
  930. l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】第" + i + "次是否打印,选择了【否】");
  931. }
  932. }
  933. //printData = db;
  934. //printDocument1.Print();
  935. //lg.WriteLog(11, "当前打印:" + printData.iType + " 车号:" + db.printDb.carNo);
  936. }
  937. }
  938. }
  939. else
  940. {
  941. l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】是否打印选择了【否】");
  942. l.WriteLog(15, PbCache.lockCarNo + "是否打印选择了【否】");
  943. }
  944. }
  945. }
  946. }
  947. else
  948. {
  949. l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】获取打印配置数据信息异常sql:【" + sql + "】");
  950. }
  951. }
  952. }
  953. }
  954. else
  955. {
  956. l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】获取计量数据信息异常sql:【" + sql + "】");
  957. }
  958. #endregion 获取打印信息,若需要打印则调用打印操作
  959. }
  960. catch (Exception ex)
  961. {
  962. l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】打印异常" + ex);
  963. }
  964. }
  965. private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
  966. {
  967. try
  968. {
  969. if (printData != null && printData.printDb != null)
  970. {
  971. printClass.PrintAllPage(e, printData.printDb, printData.qrCode);
  972. /*
  973. //结净打印
  974. if (printData.iType == 2)
  975. {
  976. printClass.PrintPage(e, printData.printDb, PbCache.strQRCode);
  977. }
  978. else //非结净打印
  979. {
  980. printClass.PrintWgtPage(e, printData.printDb, PbCache.strQRCode);
  981. }
  982. //*/
  983. }
  984. }
  985. catch (Exception ex)
  986. {
  987. l.WriteLog(11, "打印异常" + ex);
  988. }
  989. }
  990. /// <summary>
  991. /// 重量大于500,直接打开主界面
  992. /// </summary>
  993. /// <param name="sender"></param>
  994. /// <param name="e"></param>
  995. private void timer1_Tick(object sender, EventArgs e)
  996. {
  997. if (!isOpened && PbCache.collect?.weight > 500)
  998. {
  999. isOpened = true;
  1000. isOpenMeter = true;
  1001. PbCache.bussinessTypeName = "";
  1002. PbCache.bussinessTypeCode = "";
  1003. frmOneYardToEnd fcc = new frmOneYardToEnd();
  1004. fcc.ShowDialog();
  1005. }
  1006. }
  1007. /// <summary>
  1008. /// 操作Live表的数据:零点报警
  1009. /// </summary>
  1010. private void doOperateLive()
  1011. {
  1012. if (PbCache.collect_no == null)
  1013. {
  1014. return;
  1015. }
  1016. List<LiveData> ll = MemoClass.getWarnInfo(PbCache.collect_no);
  1017. if (ll != null)
  1018. {
  1019. foreach (LiveData lv in ll)
  1020. {
  1021. switch (lv.Tagname.Replace(PbCache.collect_no, ""))
  1022. {
  1023. case "StaticStatus"://车辆检测 "0、东西方向激光均无报警;否则报警
  1024. break;
  1025. case "SwitchLight"://PLC红绿灯控制模式状态 "PLC有三种控制模式:1、自动、2、远控;3、检修
  1026. break;
  1027. case "LightWest"://红绿灯:1、为绿灯;2、为红灯;"
  1028. break;
  1029. case "ZeroWeightStatus": //0、其它,1、零点报警,红绿灯变红,
  1030. if (((lv.Value ?? "0") + "").Equals("1"))
  1031. {
  1032. doInsertZeroAlarm();
  1033. PbCache.isZeroAlarm = true;
  1034. }
  1035. else
  1036. {
  1037. PbCache.isZeroAlarm = false;
  1038. }
  1039. break;
  1040. }
  1041. }
  1042. }
  1043. }
  1044. /// <summary>
  1045. /// 新增零点报警的数据
  1046. /// </summary>
  1047. private void doInsertZeroAlarm()
  1048. {
  1049. if (!PbCache.isZeroAlarm)
  1050. {
  1051. PbCache.isZeroAlarm = true;
  1052. MeterWorkZeroAlarm workZeroAlarm = new MeterWorkZeroAlarm();
  1053. workZeroAlarm.zeroWeight = PbCache.collect.weight;
  1054. workZeroAlarm.spotTypeNo = PbCache.sportInfo.spotTypeNo;
  1055. workZeroAlarm.spotTypeName = PbCache.sportInfo.spotTypeName;
  1056. workZeroAlarm.baseSpotNo = PbCache.sportInfo.baseSpotNo;
  1057. workZeroAlarm.baseSpotName = PbCache.sportInfo.baseSpotName;
  1058. workZeroAlarm.scalePointNo = PbCache.collect_no;
  1059. workZeroAlarm.createManNo = PbCache.sportInfo.baseSpotNo;
  1060. workZeroAlarm.createManName = PbCache.sportInfo.baseSpotName;
  1061. RESTfulResult<String> rms = zeroAlarmService.doInsertZeroAlarm(workZeroAlarm);
  1062. if (rms.Succeed)
  1063. {
  1064. l.WriteLog(20, "新增成功:" + workZeroAlarm.baseSpotName + ":" + workZeroAlarm.zeroWeight);
  1065. }
  1066. else
  1067. {
  1068. l.WriteLog(20, "操作失败:" + workZeroAlarm.baseSpotName + ":" + workZeroAlarm.zeroWeight + rms.Data + rms.Message);
  1069. }
  1070. }
  1071. }
  1072. private void button3_Click(object sender, EventArgs e)
  1073. {
  1074. string limsResult = "";
  1075. JGLimsInterface gLimsInterface = new JGLimsInterface();
  1076. }
  1077. /// <summary>
  1078. /// 查询重量信息,显示在界面上面
  1079. /// </summary>
  1080. /// <param name="sender"></param>
  1081. /// <param name="e"></param>
  1082. private void button4_Click(object sender, EventArgs e)
  1083. {
  1084. try
  1085. {
  1086. string sqls = @"select '毛重:' || t.gross_weight / 1000 || ' T / 皮重:' || t.tare_weight / 1000 || ' T / 净重:' || t.net_weight / 1000 || ' T ' as text
  1087. from meter_work_car_actual t where t.value_flag = '0' and T.Prediction_No = '" + txtPlanNo.Text + @"'";
  1088. PbModelDbService<List<PbModelDb>> pbRelation = new PbModelDbService<List<PbModelDb>>();
  1089. RESTfulResult<List<PbModelDb>> rmRelation = pbRelation.executeSqlDataWf(sqls);
  1090. if (rmRelation.Succeed && rmRelation.Data != null && rmRelation.Data.Count > 0)
  1091. {
  1092. MessageBox.Show(rmRelation.Data[0].text);
  1093. }
  1094. else
  1095. {
  1096. MessageBox.Show("空");
  1097. }
  1098. }
  1099. catch (Exception ex)
  1100. {
  1101. }
  1102. }
  1103. private void button1_Click(object sender, EventArgs e)
  1104. {
  1105. isOpened = false;
  1106. testFlag = true;
  1107. PbCache.isTest= true;
  1108. testWgt = (int)numericUpDown1.Value;
  1109. //CollectModel model = new CollectModel();
  1110. //model.weight = testWgt;
  1111. //PbCache.collect = model;
  1112. testCarNo = textBox1.Text.Trim();
  1113. testPlanNo = txtPlanNo.Text.Trim();
  1114. }
  1115. private void Form1_FormClosing(object sender, FormClosingEventArgs e)
  1116. {
  1117. collection.Stop();
  1118. imageCurlControl.Stop();
  1119. sweepCodeClass.CloseThread();
  1120. timer1.Stop();
  1121. timer1.Dispose();
  1122. }
  1123. }
  1124. }