Form1.cs 79 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714
  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;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Diagnostics;
  14. using System.Drawing;
  15. using System.IO;
  16. using System.Linq;
  17. using System.Windows.Forms;
  18. using SystemOffLine;
  19. namespace CarMeterSystem
  20. {
  21. public partial class Form1 : Form
  22. {
  23. public Form1()
  24. {
  25. InitializeComponent();
  26. }
  27. private Log l = Log.GetInstance();
  28. private Print printClass = new Print();//打印
  29. //内存表
  30. private MemoryTableDataSocket MemoClass = new MemoryTableDataSocket("");
  31. //实时表数据采集
  32. private DataCollectionControl collection = new DataCollectionControl();
  33. //图片控制器含图片压缩及上传curl
  34. private ImageCurlControl imageCurlControl = new ImageCurlControl();
  35. //与监控界面对接的表
  36. private MeterWorkMonitorService meterWorkMonitor = new MeterWorkMonitorService();
  37. //零点报警表
  38. private meterworkzeroalarmservice zeroAlarmService = new meterworkzeroalarmservice();
  39. //车号修正
  40. private CarNoModfiy modfiy = new CarNoModfiy();
  41. //一码通接口调用
  42. private HttpRequest httpRequest = new HttpRequest();
  43. /// <summary>
  44. /// 这个是保存前一次采集中的车号信息
  45. /// </summary>
  46. private string preCarNo = "";
  47. //验证对射
  48. private validParkStatus valid = new validParkStatus();
  49. //语音播报
  50. private VoicePlay vicPlayClass = new VoicePlay();
  51. private LED_Control led_controler = null;
  52. //监控表操作
  53. private MeterMonitorWeightService monitorWeightService = new MeterMonitorWeightService();
  54. private MeterWorkScheduledHelpService meterWorkScheduledHelpService = new MeterWorkScheduledHelpService();
  55. //验证校秤数据
  56. private validCalibration vCalib = new validCalibration();
  57. private MeterWorkCarActualFirstService workCarActualFirstService = new MeterWorkCarActualFirstService(); //一次计量数据
  58. //查询当前是否校秤
  59. private bool bRelation = true;
  60. /// <summary>
  61. /// 欢迎界面
  62. /// </summary>
  63. private frmWelcome_Jisco frmWelcome = new frmWelcome_Jisco();//欢迎
  64. /// <summary>
  65. /// 计量页
  66. /// </summary>
  67. private frmOneYardToEnd fcc = null;
  68. /// <summary>
  69. /// 基础数据载入
  70. /// </summary>
  71. private BaseDbCls bd = new BaseDbCls();
  72. //扫码修正车号标识
  73. private bool codeFlag = false;
  74. private List<ucBusinessType> lu = new List<ucBusinessType>();
  75. private bool isVoiceDownCar = false;//车上人员请下车播放一次
  76. private bool isShowFrmWelcome = false; //是否显示欢迎界面;在这个测试界面,不显示欢迎界面
  77. private bool isOpened = false;//是否已经打开了扫码计量界面
  78. private SerialPortES sweepCodeClass = new SerialPortES();
  79. private SerialPortES sweepCodeClass2 = new SerialPortES();
  80. private void Form1_Load(object sender, EventArgs e)
  81. {
  82. //*
  83. try
  84. {
  85. //CollectModel temp = new CollectModel();
  86. //temp.weight = 501;
  87. //PbCache.collect = temp;
  88. //frmMatMsgInfo frmMatMsgInfo = new frmMatMsgInfo();
  89. //frmMatMsgInfo.Show();
  90. // 计量页
  91. fcc = new frmOneYardToEnd();
  92. timer1.Start();
  93. //2021年6月21日 杨秀东添加
  94. if (isShowFrmWelcome)
  95. {
  96. frmWelcome.Show();
  97. frmWelcome.Visible = true;
  98. }
  99. LoginCls lg = new LoginCls();
  100. if (lg.LoginIn())
  101. {
  102. //if (SystemUpdate(false))
  103. //{
  104. // return;
  105. //}
  106. // 加载并验证基本配置
  107. if (bd.setBaseDb() && bd.getBaseDb())
  108. {
  109. if (!string.IsNullOrEmpty(PbCache.sportInfo.ledIp))
  110. {
  111. led_controler = new LED_Control(PbCache.sportInfo.ledIp);
  112. }
  113. //调用该方法时已赋值
  114. RESTfulResult<List<MeterWorkMonitor>> rm = meterWorkMonitor.doQueryOneWf(new MeterWorkMonitor { validFlag = "1", pointNo = PbCache.sportInfo.baseSpotNo });
  115. if (!rm.Succeed)
  116. {
  117. l.WriteLog(1, "载入监控表数据异常");
  118. return;
  119. }
  120. else if (rm.Data != null && rm.Data.Count > 0)
  121. {
  122. if (string.IsNullOrEmpty(PbCache.collect_no))
  123. {
  124. PbCache.collect_no = rm.Data[0].collectionCode;
  125. MemoClass = new MemoryTableDataSocket(PbCache.collect_no);
  126. }
  127. }
  128. else
  129. {
  130. //l.WriteLog(1, "为配置监控数据");
  131. //return;
  132. }
  133. //若未校秤的话,也不允许计量
  134. //载入界面业务按钮
  135. if (PbCache.businessType != null && PbCache.businessType.Count > 0)
  136. {
  137. foreach (ComBaseInfo info in PbCache.businessType)
  138. {
  139. ucBusinessType uc = new ucBusinessType();
  140. switch (info.baseCode)
  141. {
  142. case "001006003":
  143. uc.setControl(info.baseName, info.memo, info.baseCode);
  144. break;
  145. case "001006001":
  146. case "001006002":
  147. uc.setControl(info.baseName, info.memo, info.baseCode);
  148. break;
  149. default:
  150. uc.setControl(info.baseName, info.memo, info.baseCode);
  151. break;
  152. }
  153. uc.Dock = DockStyle.Top;
  154. //uc.setControl("","","",);
  155. uc.ucEvent += new EventHandler(ucEvents);
  156. lu.Add(uc);
  157. panel7.Controls.Add(uc);
  158. }
  159. }
  160. //开启基础进程
  161. l.WriteLog(0, "系统登录成功");
  162. collection.EventDataCollectionArgs += new EventDataCollection(EventData);//数据采集
  163. collection.Start(PbCache.sportInfo.baseSpotNo, PbCache.sportInfo.baseSpotName);
  164. imageCurlControl.Start(); //图片采集线程
  165. //新扫码线程
  166. if (AppConfigCache._comPara?.Split(new char[] { ',' })?.Length == 5)
  167. {
  168. sweepCodeClass.StartThreadSweep(AppConfigCache._comPara); //扫码线程
  169. }
  170. if (AppConfigCache._comPara2?.Split(new char[] { ',' })?.Length == 5)
  171. {
  172. sweepCodeClass2.StartThreadSweep(AppConfigCache._comPara2); //扫码线程
  173. }
  174. }
  175. else
  176. {
  177. l.WriteLog(0, "系统登录失败");
  178. }
  179. }
  180. else
  181. {
  182. l.WriteLog(0, "按IP地址找不到计量点信息,系统登录失败");
  183. }
  184. }
  185. catch (Exception ex)
  186. {
  187. l.WriteLog(0, "系统加载失败:" + ex.Message);
  188. }
  189. //*/
  190. }
  191. #region
  192. //*
  193. /// <summary>
  194. /// 委托的方式调用控件的点击事件
  195. /// </summary>
  196. /// <param name="sender"></param>
  197. /// <param name="e"></param>
  198. public void ucEvents(object sender, EventArgs e)
  199. {
  200. Control control = (Control)sender;
  201. ucBusinessType um = control.Parent.Parent as ucBusinessType;
  202. try
  203. {
  204. switch (control.Name)
  205. {
  206. case "btnContext":
  207. case "btnPurchase":
  208. {
  209. PbCache.bussinessTypeName = um._bussiness == null ? "" : um._bussiness;
  210. PbCache.bussinessTypeCode = um._code;
  211. switch (um._code)
  212. {
  213. case "001006003":
  214. frmInternalTransport frm = new frmInternalTransport();
  215. frm.ShowDialog();
  216. break;
  217. /*
  218. case "001006001":
  219. case "001006002":
  220. frmCarSalePurchase frmCar = new frmCarSalePurchase();
  221. frmCar.ShowDialog();
  222. break;
  223. //*/
  224. default:
  225. frmCarSalePurchase frmCar = new frmCarSalePurchase();
  226. frmCar.ShowDialog();
  227. break;
  228. }
  229. };
  230. break;
  231. default: break;
  232. }
  233. }
  234. catch (Exception ex)
  235. {
  236. //MessageBox.Show("操作异常:" + ex.Message);
  237. }
  238. }
  239. //*/
  240. #endregion
  241. #region
  242. private void setWelecomeVis(bool visb)
  243. {
  244. /*
  245. if (frmWelcome.InvokeRequired)
  246. {
  247. Action<bool> action = new Action<bool>(setWelecomeVis);
  248. Invoke(action, new object[] { visb });
  249. }
  250. else
  251. {
  252. if (frmWelcome.Visible != visb)
  253. {
  254. frmWelcome.Visible = visb;
  255. frmWelcome.setLogin();
  256. }
  257. }
  258. //*/
  259. }
  260. #endregion
  261. private int iCount = 0, iHodeTime = 0;
  262. private bool flagCarMonit = false;//车号修正
  263. private bool bEditCar = false; //手动修正车号
  264. private bool isOpenMeter = false; //是否已打开计量界面,若已经打开则这里关于超量程及红外的语音将停止播报
  265. private string firstCode = "";//上次扫码的信息
  266. private string ledTxt = "";
  267. private bool isLedWrite = false;//是否写入一次LED
  268. private string sPreNo = ""; //记录重量曲线变化
  269. private int preWgt = 0;//前一次重量,用于重量曲线
  270. private string sCarNo = "";
  271. private int iCountPark = 0;
  272. private string editCarNo = "";
  273. private bool isResFlag = true;
  274. private string RFIDCarNo = "";
  275. private string isWriteRFID = AppConfigCache.isWriteRFID;
  276. //EventData实例化
  277. RESTfulResult<string> rmsEventDataLastTime = new RESTfulResult<string>();
  278. RESTfulResult<List<MeterWorkMonitor>> rmUpdateEventDataMonitor = new RESTfulResult<List<MeterWorkMonitor>>();
  279. MeterWorkMonitor updateEventDataMonitor = new MeterWorkMonitor();
  280. MeterMonitorWeight meterMonitorWeightEventData1 = new MeterMonitorWeight();
  281. MeterMonitorWeight meterMonitorWeightEventData2 = new MeterMonitorWeight();
  282. MeterWorkMonitor mwUpdate = new MeterWorkMonitor();
  283. PbModelDbService<List<PbModelDb>> pbpRFIDEventData = new PbModelDbService<List<PbModelDb>>();
  284. RESTfulResult<List<PbModelDb>> rmTRFIDEventData = new RESTfulResult<List<PbModelDb>>();
  285. RESTfulResult<string> rmsmwUpdateEventData = new RESTfulResult<string>();
  286. MeterWorkScheduledHelp meterWorkScheduledHelp1 = new MeterWorkScheduledHelp();
  287. MeterWorkScheduledHelp meterWorkScheduledHelpRFID = new MeterWorkScheduledHelp();
  288. RESTfulResult<string> rmsdoUpdateWfEventData = new RESTfulResult<string>();
  289. RESTfulResult<string> rmssEventData = new RESTfulResult<string>();
  290. MeterWorkMonitor meterWorkMonitorEventDataI = new MeterWorkMonitor();
  291. MeterWorkCarActualFirstService mwcfs = new MeterWorkCarActualFirstService();
  292. RESTfulResult<string> rmsSweepCodeClass = new RESTfulResult<string>();
  293. frmOneYardToEnd frmOneYardToEnd = new frmOneYardToEnd();
  294. /// <summary>
  295. /// 数据采集
  296. /// </summary>
  297. /// <param name="o"></param>
  298. /// <param name="e"></param>
  299. private void EventData(object o, DataCollectionArgs e)
  300. {
  301. if (!timer1.Enabled)
  302. {
  303. timer1.Enabled = true;
  304. l.WriteLog(32, "定时器重启(timer1_Tick:frmMain),车号:" + PbCache.resultCarNo + "||" + (PbCache.collect == null ? "" : PbCache.collect.carno));
  305. }
  306. #region
  307. //num++;
  308. //e.carno = "湘G88888";
  309. //if (num < 20)
  310. //{
  311. // e.weight = 23580;
  312. // e.weightStatus = 1;
  313. //}
  314. //else if (num < 26)
  315. //{
  316. // e.weight = 23580;
  317. // e.weightStatus = 0;
  318. //}
  319. //else if (num < 39)
  320. //{
  321. // e.weight = 23580;
  322. // e.weightStatus = 0;
  323. //}
  324. //else if (num < 45)
  325. //{
  326. // e.weight = 15000;
  327. // e.weightStatus = 1;
  328. //}
  329. //else
  330. //{
  331. // e.weight = 400;
  332. //}
  333. #endregion
  334. //这里每隔0.5秒执行一次
  335. try
  336. {
  337. if (e.carno == "nown")
  338. {
  339. e.carno = "";
  340. }
  341. #region 扫码信息
  342. //if (string.IsNullOrEmpty(sweepCodeClass.StrCode))
  343. //{
  344. // if (string.IsNullOrEmpty(PbCache.strCode))
  345. // {
  346. // codeFlag = false;
  347. // firstCode = "";
  348. // PbCache.strCode = "";
  349. // l.WriteLog(12, "主线程扫码值为空时清空;sweepCodeClass.StrCode值为" + sweepCodeClass.StrCode + " ;PbCache.strCode值为:" + PbCache.strCode);
  350. // }
  351. //}
  352. //else
  353. //{
  354. // codeFlag = true;
  355. // frmOneYardToEnd frmOneYardToEnd = new frmOneYardToEnd();
  356. // Hashtable hashTable = new Hashtable();
  357. // hashTable.Add("message", sweepCodeClass.StrCode);
  358. // rmsSweepCodeClass = mwcfs.DecryptionForWfTest(hashTable);
  359. // if (rmsSweepCodeClass.Code == "0")
  360. // {
  361. // PbCache.collect.carno = rmsSweepCodeClass.Data;
  362. // PbCache.strCode = rmsSweepCodeClass.Data;
  363. // }
  364. // if (rmsSweepCodeClass.Code == "1")
  365. // {
  366. // vicPlayClass.GetVoicePlay("车号二维码已过期", PbCache.collect.carno);
  367. // frmOneYardToEnd.setMsgInfo("车号二维码已过期");
  368. // }
  369. // if (rmsSweepCodeClass.Code == "2")
  370. // {
  371. // vicPlayClass.GetVoicePlay("不是有效车号二维码", PbCache.collect.carno);
  372. // frmOneYardToEnd.setMsgInfo("不是有效车号二维码");
  373. // }
  374. // if (rmsSweepCodeClass.Code == "9")
  375. // {
  376. // vicPlayClass.GetVoicePlay("不是有效车号二维码", PbCache.collect.carno);
  377. // frmOneYardToEnd.setMsgInfo("不是有效车号二维码");
  378. // }
  379. // l.WriteLog(12, "测试扫码值" + rmsSweepCodeClass.Data);
  380. //}
  381. // 司机扫码为空,取工控机二维码
  382. if (PbCache.sportInfo.scanRequireValid == "1")
  383. {
  384. if (PbCache.monitor.isValidScan == "0")
  385. {
  386. if (string.IsNullOrEmpty(sweepCodeClass2.StrCode))
  387. {
  388. if (string.IsNullOrEmpty(sweepCodeClass.StrCode))
  389. {
  390. if (string.IsNullOrEmpty(PbCache.strCode))
  391. {
  392. codeFlag = false;
  393. firstCode = "";
  394. PbCache.strCode = "";
  395. //l.WriteLog(12, "主线程扫码值为空时清空;sweepCodeClass.StrCode值为" + sweepCodeClass.StrCode + " ;PbCache.strCode值为:" + PbCache.strCode);
  396. }
  397. }
  398. else
  399. {
  400. if (sweepCodeClass.StrCode.Substring(0, 3) == "TWB")
  401. {
  402. DecodeQRCodeYMT(sweepCodeClass.StrCode);
  403. }
  404. else
  405. {
  406. DecodeQRCode(sweepCodeClass.StrCode);
  407. }
  408. }
  409. }
  410. else
  411. {
  412. if (sweepCodeClass2.StrCode.Substring(0, 3) == "TWB")
  413. {
  414. DecodeQRCodeYMT(sweepCodeClass2.StrCode);
  415. }
  416. else
  417. {
  418. DecodeQRCode(sweepCodeClass2.StrCode);
  419. }
  420. }
  421. }
  422. }
  423. else
  424. {
  425. if (string.IsNullOrEmpty(sweepCodeClass2.StrCode))
  426. {
  427. if (string.IsNullOrEmpty(sweepCodeClass.StrCode))
  428. {
  429. if (string.IsNullOrEmpty(PbCache.strCode))
  430. {
  431. codeFlag = false;
  432. firstCode = "";
  433. PbCache.strCode = "";
  434. //l.WriteLog(12, "主线程扫码值为空时清空;sweepCodeClass.StrCode值为" + sweepCodeClass.StrCode + " ;PbCache.strCode值为:" + PbCache.strCode);
  435. }
  436. }
  437. else
  438. {
  439. if (sweepCodeClass.StrCode.Substring(0, 3) == "TWB")
  440. {
  441. DecodeQRCodeYMT(sweepCodeClass.StrCode);
  442. }
  443. else
  444. {
  445. DecodeQRCode(sweepCodeClass.StrCode);
  446. }
  447. }
  448. }
  449. else
  450. {
  451. if (sweepCodeClass2.StrCode.Substring(0, 3) == "TWB")
  452. {
  453. DecodeQRCodeYMT(sweepCodeClass2.StrCode);
  454. }
  455. else
  456. {
  457. DecodeQRCode(sweepCodeClass2.StrCode);
  458. }
  459. }
  460. }
  461. #endregion
  462. #region 秤上无车10分钟获取一次基础数据
  463. if (iCount < 1200)
  464. {
  465. iCount++;
  466. }
  467. else
  468. {
  469. try
  470. {
  471. //秤上没有车时,每隔10分钟获取一次基础数据
  472. if (e.weight < 500)
  473. {
  474. if (bd.setBaseDb())
  475. {
  476. l.WriteLog(0, "十分钟获取基础数据成功");
  477. }
  478. else
  479. {
  480. l.WriteLog(0, "十分钟获取基础数据失败");
  481. }
  482. iCount = 0;
  483. }
  484. }
  485. catch (Exception ex)
  486. {
  487. l.WriteLog(0, "十分钟获取基础数据失败:" + ex.Message);
  488. iCount = 0;
  489. }
  490. }
  491. #endregion
  492. #region 每10秒写入一次当前时间
  493. if (iCount % 20 == 0)
  494. {
  495. //更新在线时间
  496. rmsEventDataLastTime = meterWorkMonitor.doUpdateWfBySpotNo(new MeterWorkMonitor { pointNo = PbCache.sportInfo.baseSpotNo });
  497. if (!rmsEventDataLastTime.Succeed)
  498. {
  499. l.WriteLog(0, "frmMain.EventData异常:写入时间异常,原因:" + rmsEventDataLastTime.ResultMessage);
  500. }
  501. }
  502. #endregion
  503. #region
  504. //一旦界面锁定则不采集数据
  505. PbCache.collect.pointid = PbCache.sportInfo.baseSpotNo;
  506. PbCache.collect.parkStatus = e.parkStatus;
  507. PbCache.collect.datetime = e.datetime;
  508. PbCache.collect.licType = e.licType;
  509. if (testFlag)
  510. {
  511. sCarNo = testCarNo;
  512. //PbCache.collect.carno = testCarNo;
  513. PbCache.collect.weight = testWgt;
  514. PbCache.collect.weightStatus = 0;
  515. PbCache.monitorResult.valid_park_status = true;
  516. PbCache.collect.parkStatus = 0;
  517. if (PbCache.collect.weight > e.weight)
  518. e.weight = PbCache.collect.weight;
  519. PbCache.strCode = testPlanNo;
  520. e.carno = testCarNo;
  521. //PbCache.strQRCode = testCode;
  522. }
  523. else
  524. {
  525. PbCache.collect.weight = e.weight;
  526. PbCache.collect.weightStatus = e.weightStatus;
  527. }
  528. if (PbCache.collect != null && PbCache.collect.weightStatus == 0)
  529. {
  530. if (string.IsNullOrEmpty(PbCache.resultWgt))
  531. {
  532. PbCache.resultWgt = e.weight + "";
  533. }
  534. if (!string.IsNullOrEmpty(PbCache.resultWgt) && e.weight > Convert.ToInt32(PbCache.resultWgt))
  535. {
  536. PbCache.resultWgt = e.weight + "";
  537. }
  538. if (!string.IsNullOrEmpty(e.carno) && PbCache.resultCarNo != e.carno)
  539. {
  540. PbCache.resultCarNo = e.carno + "";
  541. l.WriteLog(28, "车号賦值跟蹤:PbCache.resultCarNo" + PbCache.resultCarNo + "||e.carno" + e.carno);
  542. }
  543. }
  544. //*/
  545. // 更新监控表
  546. //doLive();
  547. //重量大于500的情况下
  548. if (e.weight > 500)
  549. {
  550. isResFlag = true;
  551. if (PbCache.dtStartTime == null)
  552. PbCache.dtStartTime = DateTime.Now;
  553. isLedWrite = true;
  554. PbCache.strState = "0";
  555. #region 车上人员请下车
  556. try
  557. {
  558. //界面未锁定的情况下,有车号,如果重量稳定了,停车线验证通过,未超量程的情况下,则按钮可用
  559. if (PbCache.collect != null && !string.IsNullOrEmpty(PbCache.collect.carno) && PbCache.collect.weightStatus == 0 && PbCache.monitorResult.valid_park_status && PbCache.collect.weight < PbCache.range.upperRange)
  560. {
  561. if (!isVoiceDownCar)
  562. {
  563. isVoiceDownCar = true;
  564. vicPlayClass.GetVoicePlay("车上人员请下车", PbCache.collect.carno);
  565. }
  566. }
  567. }
  568. catch { }
  569. #endregion
  570. setWelecomeVis(false);
  571. //每隔1秒刷一次计量实时监控表数据值
  572. if (iCount % 2 == 0)
  573. {
  574. //调用该方法时已赋值
  575. updateEventDataMonitor.validFlag = "1";
  576. updateEventDataMonitor.pointNo = PbCache.sportInfo.baseSpotNo;
  577. rmUpdateEventDataMonitor = meterWorkMonitor.doQueryOneWf(updateEventDataMonitor);
  578. if (!rmUpdateEventDataMonitor.Succeed)
  579. {
  580. l.WriteLog(0, "frmMain.EventData异常419:" + rmUpdateEventDataMonitor.ResultMessage);
  581. }
  582. else
  583. {
  584. if (rmUpdateEventDataMonitor.Data != null && rmUpdateEventDataMonitor.Data.Count > 0)
  585. {
  586. PbCache.monitor = rmUpdateEventDataMonitor.Data[0];
  587. if (string.IsNullOrEmpty(PbCache.collect_no))
  588. {
  589. PbCache.collect_no = rmUpdateEventDataMonitor.Data[0].collectionCode;
  590. }
  591. if (ledTxt != rmUpdateEventDataMonitor.Data[0].ledWriter && rmUpdateEventDataMonitor.Data[0].ledWriter != "")
  592. {
  593. //调用LED信息写入******************************
  594. ledTxt = rmUpdateEventDataMonitor.Data[0].ledWriter;
  595. }
  596. if (string.IsNullOrEmpty(ledTxt))
  597. {
  598. ledTxt = "欢迎使用酒钢汽车衡智能计量系统!";
  599. }
  600. }
  601. }
  602. #region 2021-03-29
  603. #region 摄像头当前采集的车号与上次采集的不一样且当前未勾选不验证,且当前车号未进行手动修正的情况下
  604. if (preCarNo != e.carno && PbCache.monitor != null && PbCache.monitor.validCarno != "0" && !bEditCar)
  605. {
  606. flagCarMonit = false;
  607. }
  608. preCarNo = e.carno;
  609. #endregion
  610. if (!flagCarMonit)
  611. {
  612. sCarNo = e.carno;
  613. }
  614. //*
  615. //有车号,且重量稳定的情况下,只修正一次车号
  616. if (!string.IsNullOrEmpty(e.carno) && e.weightStatus == 0 && !flagCarMonit && PbCache.monitor != null && PbCache.monitor.carMonitor == "1" && PbCache.monitor.carMonitorLvl > 0)
  617. {
  618. flagCarMonit = true;
  619. string methods = "";
  620. for (int i = 0; i <= PbCache.monitor.carMonitorLvl; i++)
  621. {
  622. methods += "CarNoTrustCorrect" + i + ",";
  623. }
  624. editCarNo = modfiy.CarNoCorrect(e.carno, methods.Substring(0, methods.Length - 1));
  625. sCarNo = editCarNo;
  626. //mwUpdate
  627. }
  628. //勾选了不验证车号的情况
  629. if (PbCache.monitor.validCarno == "0")
  630. {
  631. flagCarMonit = true;
  632. }
  633. #endregion
  634. #region 每隔1秒写入一次重量曲线
  635. try
  636. {
  637. if (preWgt != e.weight)
  638. {
  639. preWgt = e.weight;
  640. sPreNo = PbCache.sportInfo.baseSpotNo + DateTime.Now.ToString("yyyyMMddHHmmssfff");
  641. meterMonitorWeightEventData1.weightNo = sPreNo;
  642. meterMonitorWeightEventData1.baseSpotNo = PbCache.sportInfo.baseSpotNo;
  643. meterMonitorWeightEventData1.baseSpotName = PbCache.sportInfo.baseSpotName;
  644. meterMonitorWeightEventData1.collectWeight = e.weight + "";
  645. meterMonitorWeightEventData1.collectStartTime = PbCache.dtStartTime.Value;
  646. meterMonitorWeightEventData1.collectEndTime = DateTime.Now;
  647. meterMonitorWeightEventData1.spotTypeNo = "001002001";
  648. meterMonitorWeightEventData1.spotTypeName = "汽车衡";
  649. meterMonitorWeightEventData1.actualFirstNo = PbCache.actualFirstNo;
  650. monitorWeightService.doAddWf(meterMonitorWeightEventData1);
  651. }
  652. else
  653. {
  654. if (!string.IsNullOrEmpty(sPreNo))
  655. {
  656. meterMonitorWeightEventData2.weightNo = sPreNo;
  657. meterMonitorWeightEventData2.collectEndTime = DateTime.Now;
  658. monitorWeightService.doUpdateWf(meterMonitorWeightEventData2);
  659. }
  660. }
  661. }
  662. catch { }
  663. #endregion
  664. #region 停留超时
  665. iHodeTime++;
  666. mwUpdate.pointNo = PbCache.sportInfo.baseSpotNo;
  667. mwUpdate.editCar = editCarNo;
  668. if (PbCache.holdTime != null && PbCache.holdTime.Count > 0)
  669. {
  670. if (PbCache.holdTime[0].retentionTime != null)
  671. {
  672. if (PbCache.holdTime[0].retentionTime.Value < iHodeTime)
  673. {
  674. l.WriteLog(33, "iHodeTime:" + iHodeTime + ",PbCache.holdTime[0].retentionTime.Value:" + PbCache.holdTime[0].retentionTime.Value + ",mwUpdate.stopOverTime:" + mwUpdate.stopOverTime);
  675. PbCache.isOvertimeAlarm = true; //是否超时报警
  676. mwUpdate.stopOverTime = "1"; //写入一次停留超时
  677. //mwUpdate.isHelp = "1";//派位
  678. //mwUpdate.isTakeOver = "1";
  679. iHodeTime = 99999;//不再增长避免超出
  680. }
  681. }
  682. }
  683. #endregion
  684. #region RFID识别车号信息
  685. mwUpdate.rfidCar = "";
  686. mwUpdate.photoCar = e.vdioCarNos;
  687. mwUpdate.scanCar = "";
  688. if (testFlag)
  689. {
  690. mwUpdate.scanCar = PbCache.collect.carno;
  691. }
  692. //mwUpdate.photoCar = PbCache.collect.carno;
  693. if (!string.IsNullOrEmpty(e.RfidNos))
  694. {
  695. string sqls = @"SELECT RFID_ID id,CAR_NO text FROM METER_BASE_RFID_INFO where RFID_CODE = '" + e.RfidNos + "'";
  696. rmTRFIDEventData = pbpRFIDEventData.executeSqlDataWf(sqls);
  697. if (rmTRFIDEventData.Data == null || rmTRFIDEventData.Data.Count == 0)
  698. { }
  699. else
  700. {
  701. mwUpdate.rfidCar = rmTRFIDEventData.Data[0].text;
  702. sCarNo = rmTRFIDEventData.Data[0].text;
  703. RFIDCarNo = rmTRFIDEventData.Data[0].text;
  704. }
  705. }
  706. #endregion
  707. #region 计量员修改的车号信息
  708. if (PbCache.monitor != null && !string.IsNullOrEmpty(PbCache.monitor.setCar))
  709. {
  710. sCarNo = PbCache.monitor.setCar;
  711. bEditCar = true;
  712. flagCarMonit = true;
  713. codeFlag = false;
  714. sweepCodeClass.StrCode = "";
  715. sweepCodeClass2.StrCode = "";
  716. }
  717. #endregion
  718. #region 重量信息
  719. if (!PbCache.isLockFrm)
  720. {
  721. mwUpdate.wgt = e.weight;
  722. }
  723. else
  724. {
  725. mwUpdate.wgt = Convert.ToInt32(PbCache.lockWgt);
  726. }
  727. #endregion
  728. #region 写入一次监控表,将重量/车号停留超时等信息写入
  729. mwUpdate.msgInfo = PbCache.ResultMessage;
  730. mwUpdate.weightStatus = PbCache.collect.weightStatus;
  731. //另外初始化一次监控数据
  732. rmsmwUpdateEventData = meterWorkMonitor.doUpdateWf(mwUpdate);
  733. if (!rmsmwUpdateEventData.Succeed)
  734. {
  735. l.WriteLog(0, "frmMain.EventData异常583:写入信息异常" + mwUpdate);
  736. }
  737. #endregion
  738. //验证对射
  739. valid.ValidMethod();
  740. if (!isOpenMeter)
  741. {
  742. //if (PbCache.range != null && PbCache.range.upperRange < e.weight)
  743. if (PbCache.range != null && PbCache.range.upperRange < e.weight)
  744. {
  745. //超量程
  746. vicPlayClass.GetVoicePlay("已超量程", e.carno);
  747. //return;
  748. }
  749. else if (e.weightStatus == 0)
  750. {
  751. if (!PbCache.monitorResult.valid_park_status)
  752. {
  753. iCountPark++;
  754. if (iCountPark > 9)
  755. {
  756. //重量稳定,且对射验证不合格
  757. vicPlayClass.GetVoicePlay("您的车辆未停到位", e.carno);
  758. //return;
  759. iCountPark = 0; //2021年7月27日5s播一次,然后重新在播
  760. }
  761. }
  762. else
  763. {
  764. iCountPark = 0;
  765. }
  766. }
  767. }
  768. if (!lu[0].bcEnable)
  769. {
  770. foreach (ucBusinessType uc in lu)
  771. {
  772. uc.setControlEnable(true);
  773. }
  774. }
  775. if ((sweepCodeClass.StrCode == "" || sweepCodeClass2.StrCode == "") && !codeFlag)
  776. {
  777. PbCache.collect.carno = sCarNo;
  778. }
  779. }
  780. PbCache.collect.carno = sCarNo;
  781. //写入LED信息
  782. //if (PbCache.sportInfo != null && PbCache.ledInfo != PbCache.OldLedInfo)
  783. //{
  784. // PbCache.OldLedInfo = PbCache.ledInfo;
  785. // if (PbCache.monitor != null && PbCache.monitor.ledKeep == "0")
  786. // {
  787. // //led_controler.setOneLineMsg(PbCache.sportInfo.ledIp, PbCache.ledInfo);
  788. // }
  789. //}
  790. }
  791. else
  792. {
  793. isOpened = false; //下次上秤直接打开主界面
  794. if (e.weight > 10 && e.weight < 500)
  795. {
  796. //重量小于500,大于10
  797. MeterWorkMonitor mwUpdate = new MeterWorkMonitor();
  798. mwUpdate.pointNo = PbCache.sportInfo.baseSpotNo;
  799. mwUpdate.wgt = e.weight;
  800. rmsdoUpdateWfEventData = meterWorkMonitor.doUpdateWf(mwUpdate);
  801. }
  802. if (e.weight > 0 && e.weight < 200)
  803. {
  804. doOperateLive();
  805. }
  806. if (e.weight == 0)
  807. {
  808. PbCache.isZeroAlarm = false;
  809. }
  810. editCarNo = "";
  811. firstCode = ""; //历史的扫码枪的值
  812. preCarNo = "";
  813. sCarNo = "";
  814. sPreNo = "";
  815. preWgt = 0;
  816. //不等于空的时候说明写过一次日志了
  817. if (!testFlag)
  818. {
  819. isResFlag = false;
  820. meterWorkScheduledHelp1.baseSpotNo = PbCache.sportInfo.baseSpotNo;
  821. meterWorkScheduledHelp1.baseSpotName = PbCache.sportInfo.baseSpotName;
  822. meterWorkScheduledHelp1.carNo = string.IsNullOrEmpty(PbCache.collect.carno) ? PbCache.resultCarNo : PbCache.collect.carno;
  823. meterWorkScheduledHelp1.helpContent = "车号:" + (string.IsNullOrEmpty(PbCache.collect.carno) ? (string.IsNullOrEmpty(PbCache.resultCarNo) ? "未识别" : PbCache.resultCarNo) : PbCache.collect.carno) + ";重量:" + (PbCache.lockWgt == 0 ? PbCache.resultWgt : PbCache.lockWgt + "") + ";提示信息:" + PbCache.resultMsgAll;
  824. meterWorkScheduledHelp1.warmType = "5";
  825. meterWorkScheduledHelp1.warmTypeName = "计量提示跟踪";
  826. meterWorkScheduledHelpService.add(meterWorkScheduledHelp1);
  827. l.WriteLog(28, "车号:" + (string.IsNullOrEmpty(PbCache.collect.carno) ? (string.IsNullOrEmpty(PbCache.resultCarNo) ? "未识别" : PbCache.resultCarNo) : PbCache.collect.carno) + ";重量:" + (PbCache.lockWgt == 0 ? PbCache.resultWgt : PbCache.lockWgt + "") + ";提示信息:" + PbCache.resultMsgAll);
  828. }
  829. //不等于空的时候说明写过一次日志了
  830. if (!string.IsNullOrEmpty(RFIDCarNo) && isWriteRFID == "1")
  831. {
  832. meterWorkScheduledHelp1.baseSpotNo = PbCache.sportInfo.baseSpotNo;
  833. meterWorkScheduledHelp1.baseSpotName = PbCache.sportInfo.baseSpotName;
  834. meterWorkScheduledHelp1.carNo = string.IsNullOrEmpty(PbCache.collect.carno) ? PbCache.resultCarNo : PbCache.collect.carno;
  835. meterWorkScheduledHelp1.helpContent = RFIDCarNo;
  836. meterWorkScheduledHelp1.warmType = "7";
  837. meterWorkScheduledHelp1.warmTypeName = "RFID识别率";
  838. meterWorkScheduledHelpService.add(meterWorkScheduledHelp1);
  839. RFIDCarNo = "";
  840. }
  841. PbCache.isOvertimeAlarm = false; //是否超时报警
  842. PbCache.strCode = "";
  843. PbCache.strState = "";
  844. PbCache.ResultMessage = "";
  845. PbCache.resultMsgAll = "";
  846. PbCache.resultCarNo = "";
  847. PbCache.resultWgt = "";
  848. bEditCar = false;
  849. isVoiceDownCar = false;
  850. flagCarMonit = false;
  851. iHodeTime = 0;
  852. isOpenMeter = false;
  853. PbCache.isLockFrm = false;
  854. PbCache.dtStartTime = null;
  855. PbCache.voiceOver = true;
  856. if (PbCache.collect != null && !string.IsNullOrEmpty(PbCache.collect.carno))
  857. {
  858. PbCache.collect.carno = "";
  859. }
  860. setWelecomeVis(true);
  861. if (lu[0].bcEnable)
  862. {
  863. foreach (ucBusinessType uc in lu)
  864. {
  865. uc.setControlEnable(false);
  866. }
  867. }
  868. meterWorkMonitorEventDataI.pointNo = PbCache.sportInfo.baseSpotNo;
  869. meterWorkMonitorEventDataI.validWgt = "1";
  870. meterWorkMonitorEventDataI.validCarno = "1";
  871. meterWorkMonitorEventDataI.validTareTime = "1";
  872. meterWorkMonitorEventDataI.validMatTime = "1";
  873. meterWorkMonitorEventDataI.validTimeInterval = "1";
  874. meterWorkMonitorEventDataI.validParkStatus = "1";
  875. meterWorkMonitorEventDataI.validExceedWgt = "1";
  876. meterWorkMonitorEventDataI.validPredictionDiff = "1";
  877. meterWorkMonitorEventDataI.validLianda = "1";
  878. meterWorkMonitorEventDataI.validMatClick = "1";
  879. meterWorkMonitorEventDataI.setCar = "";
  880. meterWorkMonitorEventDataI.isValidScan = "1";
  881. meterWorkMonitorEventDataI.rfidCar = "";
  882. meterWorkMonitorEventDataI.photoCar = "";
  883. meterWorkMonitorEventDataI.scanCar = "";
  884. meterWorkMonitorEventDataI.editCar = "";
  885. meterWorkMonitorEventDataI.zeroState = "0";
  886. meterWorkMonitorEventDataI.carErr = "0";
  887. meterWorkMonitorEventDataI.ferroalloyResult = "0";
  888. meterWorkMonitorEventDataI.wgtErr = "0";
  889. meterWorkMonitorEventDataI.stopOverTime = "0";
  890. meterWorkMonitorEventDataI.msgInfo = "";
  891. meterWorkMonitorEventDataI.ledWriter = "";
  892. meterWorkMonitorEventDataI.isOverWgt = "";
  893. meterWorkMonitorEventDataI.isHelp = "0";
  894. meterWorkMonitorEventDataI.wgt = e.weight;
  895. //*
  896. //另外初始化一次监控数据
  897. RESTfulResult<string> rmssEventData = meterWorkMonitor.doUpdateWf(meterWorkMonitorEventDataI);
  898. if (!rmssEventData.Succeed)
  899. {
  900. l.WriteLog(0, "frmMain.EventData异常754:写入信息异常");
  901. }
  902. //*/
  903. //LED写入
  904. if (isLedWrite)
  905. {
  906. isLedWrite = false;
  907. }
  908. }
  909. #endregion
  910. }
  911. catch (Exception ex)
  912. {
  913. l.WriteLog(0, "frmMain.EventData异常:" + ex.Message);
  914. }
  915. }
  916. private void DecodeQRCodeYMT(string strCode)
  917. {
  918. try
  919. {
  920. string test = strCode.Substring(0, 3);
  921. codeFlag = true;
  922. string token = httpRequest.GetToken();
  923. string carNo = httpRequest.getCarNo(strCode,token);
  924. PbCache.collect.carno = carNo;
  925. PbCache.strCode = carNo;
  926. }
  927. catch (Exception e)
  928. {
  929. }
  930. }
  931. private void DecodeQRCode(string strCode)
  932. {
  933. codeFlag = true;
  934. //frmOneYardToEnd frmOneYardToEnd = new frmOneYardToEnd();
  935. Hashtable hashTable = new Hashtable();
  936. hashTable.Add("message", strCode);
  937. rmsSweepCodeClass = mwcfs.DecryptionForWfTest(hashTable);
  938. if (rmsSweepCodeClass.Code == "0")
  939. {
  940. PbCache.collect.carno = rmsSweepCodeClass.Data;
  941. PbCache.strCode = rmsSweepCodeClass.Data;
  942. }
  943. if (rmsSweepCodeClass.Code == "1")
  944. {
  945. vicPlayClass.GetVoicePlay("车号二维码已过期", PbCache.collect.carno);
  946. frmOneYardToEnd.setMsgInfo("车号二维码已过期");
  947. }
  948. if (rmsSweepCodeClass.Code == "2")
  949. {
  950. vicPlayClass.GetVoicePlay("不是有效车号二维码", PbCache.collect.carno);
  951. frmOneYardToEnd.setMsgInfo("不是有效车号二维码");
  952. }
  953. if (rmsSweepCodeClass.Code == "9")
  954. {
  955. vicPlayClass.GetVoicePlay("不是有效车号二维码", PbCache.collect.carno);
  956. frmOneYardToEnd.setMsgInfo("不是有效车号二维码");
  957. }
  958. l.WriteLog(12, "测试扫码值" + rmsSweepCodeClass.Data);
  959. }
  960. private delegate void ShowBtnTare(bool flag);//定义委托 期限皮重按钮
  961. private int testWgt = 1000;
  962. private string testCarNo = "", testPlanNo = "";
  963. private bool testFlag = false;
  964. /// <summary>
  965. /// 截图测试
  966. /// </summary>
  967. /// <param name="sender"></param>
  968. /// <param name="e"></param>
  969. private void button2_Click(object sender, EventArgs e)
  970. {
  971. CameraShotCls cameraShot = new CameraShotCls();
  972. //cameraShot.CapMethod("1");
  973. _ = Invoke(new Action(() => { cameraShot.CapMethod("15"); }));
  974. }
  975. //测试打印
  976. private string strFirstNo = "";
  977. private void btnTestPrint_Click(object sender, EventArgs e)
  978. {
  979. Print1(txtPlanNo.Text);
  980. }
  981. //弹窗
  982. private static FrmMessage FrmMess(string strMess, string strBtnSaveInfo)
  983. {
  984. FrmMessage frmMessage = new FrmMessage();
  985. frmMessage.StartPosition = FormStartPosition.Manual;
  986. frmMessage.Location = new Point(350, 450);
  987. frmMessage.ShowMessage = strMess;
  988. frmMessage.BtnSaveText = strBtnSaveInfo;
  989. frmMessage.BtnCancelText = "取消";
  990. return frmMessage;
  991. }
  992. private class PrintCls
  993. {
  994. public int printNum { get; set; }
  995. public MeterWorkCarActual printDb { get; set; }
  996. public int iType { get; set; } //0毛 1 皮 2净
  997. public string qrCode { get; set; }
  998. }
  999. private PrintCls printData = new PrintCls();
  1000. private void Print1(string firstNo)
  1001. {
  1002. try
  1003. {
  1004. //lg.WriteLog(1, "打印开始");
  1005. #region 获取打印信息,若需要打印则调用打印操作
  1006. List<PrintCls> prrintC = new List<PrintCls>();
  1007. string sql = @"select actual_no actualNo,
  1008. prediction_no predictionNo,
  1009. car_no carNo,
  1010. matter_no matterNo,
  1011. matter_name matterName,
  1012. gross_weight grossWeight,
  1013. gross_time grossTime,
  1014. tare_weight tareWeight,
  1015. tare_time tareTime,
  1016. net_weight netWeight,
  1017. net_Time netTime,
  1018. 'x' meterTypeNo,
  1019. meter_type_name meterTypeName,
  1020. spec_name specName,
  1021. forwarding_unit_name forwardingUnitName,
  1022. receiving_uint_name receivingUintName,
  1023. load_point_name loadPointName,
  1024. add_weight addWeight,
  1025. '1' uploadFlag --1结净数据 0一次表数据
  1026. from meter_work_car_actual where actual_first1_no = '" + firstNo + @"' or actual_first2_no='" + firstNo + @"'
  1027. union all
  1028. select t.actual_first_no actualNo,
  1029. t.prediction_no predictionNo,
  1030. t.car_no carNo,
  1031. t.matter_no matterNo,
  1032. t.matter_name matterName,
  1033. t.meter_weight grossWeight,
  1034. t.create_time grossTime,
  1035. 0 tareWeight,
  1036. t.create_time tareTime,
  1037. 0 netWeight,
  1038. null netTime,
  1039. t.weight_type meterTypeNo, --0毛重 否则皮重
  1040. t.meter_type_name meterTypeName,
  1041. t.spec_name specName,
  1042. t.forwarding_unit_name forwardingUnitName,
  1043. t.receiving_uint_name receivingUintName,
  1044. t.load_point_name loadPointName,
  1045. t.add_weight addWeight,
  1046. '0' uploadFlag
  1047. from METER_WORK_CAR_ACTUAL_FIRST t
  1048. 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 + "')";
  1049. //查下如果有毛重或者结净数据,则可进入打印判断
  1050. PbModelDbService<List<MeterWorkCarActual>> pbModelDbService = new PbModelDbService<List<MeterWorkCarActual>>();
  1051. RESTfulResult<List<MeterWorkCarActual>> rm = pbModelDbService.executeSqlDataWf(sql);
  1052. //lg.WriteLog(1, "打印第一个sql:" + sql);
  1053. if (rm.Succeed)
  1054. {
  1055. if (rm.Data != null && rm.Data.Count > 0)
  1056. {
  1057. //2021年6月26日 对一车联运的进行处理;用一次计量编号查二次计量数据,
  1058. sql = @"select t3.actual_no actualNo, t3.prediction_no predictionNo, t3.car_no carNo, t3.matter_no matterNo, t3.matter_name matterName,
  1059. t3.gross_weight grossWeight, t3.gross_time grossTime, t3.tare_weight tareWeight, t3.tare_time tareTime, t3.net_weight netWeight,
  1060. t3.net_Time netTime, 'x' meterTypeNo, t3.meter_type_name meterTypeName, t3.spec_name specName,
  1061. t3.forwarding_unit_name forwardingUnitName, t3.receiving_uint_name receivingUintName, t3.load_point_name loadPointName,
  1062. t3.add_weight addWeight, '1' uploadFlag from meter_work_car_actual_first t2
  1063. left join meter_work_car_actual t3 on t2.actual_first_no = t3.actual_first1_no
  1064. where t2.prediction_combination in (select t.prediction_combination
  1065. from meter_work_car_actual_first t
  1066. where t3.value_flag = '0' and t.actual_first_no = '" + firstNo + @"' and
  1067. instr(t.prediction_combination, '20') > 0) order by t3.net_time desc";
  1068. RESTfulResult<List<MeterWorkCarActual>> rmLy = pbModelDbService.executeSqlDataWf(sql);
  1069. if (rmLy.Succeed && rmLy.Data != null && rmLy.Data.Count == 1)
  1070. {
  1071. rm.Data = rmLy.Data; //一车联运,将毛重替换为净重数据
  1072. }
  1073. //若有毛重或者净重,找到对应数据的物料信息,若有,那么去找打印配置信息数据
  1074. List<MeterWorkCarActual> mwa = rm.Data.Where(s => !string.IsNullOrEmpty(s.matterNo) && (s.meterTypeNo == "x" || s.meterTypeNo == "0")).ToList();
  1075. if (mwa != null && mwa.Count > 0 && !string.IsNullOrEmpty(mwa[0].matterNo))
  1076. {
  1077. sql = @"select BASE_SPOT_NO baseSpotNo,
  1078. load_point_no loadPointNo,
  1079. matter_no matterNo,
  1080. METER_TYPE_NO meterTypeNo,
  1081. weight_type_name weightTypeName,
  1082. PRINT_NUM printNum
  1083. from METER_BASE_BILL_PRINT
  1084. where matter_no = '" + mwa[0].matterNo + @"'
  1085. and nvl(BASE_SPOT_NO, '" + PbCache.sportInfo.baseSpotNo + @"') = '" + PbCache.sportInfo.baseSpotNo + @"'
  1086. and nvl(load_point_no, '" + (mwa[0].loadPointNo == null ? "1" : mwa[0].loadPointNo) + @"') = '" + (mwa[0].loadPointNo == null ? "1" : mwa[0].loadPointNo) + @"'";
  1087. //lg.WriteLog(1, "打印第二个sql:" + sql); and nvl(METER_TYPE_NO, '" + PbCache.bussinessTypeCode + @"') = '" + PbCache.bussinessTypeCode + @"'
  1088. //and nvl(METER_TYPE_NO, '') = ''
  1089. PbModelDbService<List<MeterBaseBillPrint>> pbPrintService = new PbModelDbService<List<MeterBaseBillPrint>>();
  1090. RESTfulResult<List<MeterBaseBillPrint>> rmPint = pbPrintService.executeSqlDataWf(sql);
  1091. if (rmPint.Succeed)
  1092. {
  1093. if (rmPint.Data != null && rmPint.Data.Count > 0)
  1094. {
  1095. //若有净重信息:1毛重时间晚于皮重时间,则打印毛、皮、净重,2毛重早于皮重,打印皮、净
  1096. //若只有毛重信息则打印毛重
  1097. List<MeterBaseBillPrint> lGrossprint = rmPint.Data.Where(s => s.weightTypeName.Contains("毛")).ToList();
  1098. List<MeterBaseBillPrint> lTarePrint = rmPint.Data.Where(s => s.weightTypeName.Contains("皮")).ToList();
  1099. List<MeterBaseBillPrint> lNetprint = rmPint.Data.Where(s => s.weightTypeName.Contains("净")).ToList();
  1100. List<MeterWorkCarActual> mwaChild = mwa.Where(s => s.meterTypeNo == "x").ToList();
  1101. if (mwaChild != null && mwaChild.Count > 0) //若有净重信息
  1102. {
  1103. if (lTarePrint != null && lTarePrint.Count > 0)
  1104. {
  1105. //获取非毛,非净重信息如果没有则用的期限皮,此时不打,否则则打印
  1106. MeterWorkCarActual mwca = rm.Data.Where(s => s.meterTypeNo != "x" && s.meterTypeNo != "0").FirstOrDefault();
  1107. if (mwca != null)
  1108. {
  1109. PrintCls cls = new PrintCls();
  1110. cls.printNum = (int)(lTarePrint[0].printNum == null ? 0 : lTarePrint[0].printNum.Value);
  1111. cls.iType = 1;//皮重
  1112. cls.printDb = mwca;
  1113. prrintC.Add(cls);
  1114. }
  1115. }
  1116. if (lGrossprint != null && lGrossprint.Count > 0)
  1117. {
  1118. //获取毛重信息
  1119. MeterWorkCarActual mwca = rm.Data.Where(s => s.meterTypeNo == "0").FirstOrDefault();
  1120. if (mwca != null)
  1121. {
  1122. PrintCls cls = new PrintCls();
  1123. cls.printNum = (int)(lGrossprint[0].printNum == null ? 0 : lGrossprint[0].printNum.Value);
  1124. cls.iType = 0;//毛重
  1125. cls.printDb = mwca;
  1126. prrintC.Add(cls);
  1127. }
  1128. }
  1129. if (lNetprint != null && lNetprint.Count > 0)
  1130. {
  1131. //获取净重信息
  1132. MeterWorkCarActual mwca = rm.Data.Where(s => s.meterTypeNo == "x").FirstOrDefault();
  1133. if (mwca != null)
  1134. {
  1135. PrintCls cls = new PrintCls();
  1136. cls.printNum = (int)(lNetprint[0].printNum == null ? 0 : lNetprint[0].printNum.Value);
  1137. cls.iType = 2;//净重
  1138. cls.printDb = mwca;
  1139. prrintC.Add(cls);
  1140. }
  1141. }
  1142. }
  1143. else //只有毛重信息则打印毛重
  1144. {
  1145. if (lGrossprint != null && lGrossprint.Count > 0)
  1146. {
  1147. //获取毛重信息
  1148. MeterWorkCarActual mwca = rm.Data.Where(s => s.meterTypeNo == "0").FirstOrDefault();
  1149. if (mwca != null)
  1150. {
  1151. PrintCls cls = new PrintCls();
  1152. cls.printNum = (int)(lGrossprint[0].printNum == null ? 0 : lGrossprint[0].printNum.Value);
  1153. cls.iType = 0;//毛重
  1154. cls.printDb = mwca;
  1155. prrintC.Add(cls);
  1156. }
  1157. }
  1158. }
  1159. if (prrintC != null && prrintC.Count > 0)
  1160. {
  1161. FrmMessage frmMessage = FrmMess("是否打印第【1】张票据!", "打印");
  1162. if (frmMessage.ShowDialog(this) == DialogResult.OK)
  1163. {
  1164. l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】是否打印选择了【是】");
  1165. l.WriteLog(15, PbCache.lockCarNo + "是否打印选择了【是】");
  1166. strFirstNo = firstNo;
  1167. //printDocument1.PrinterSettings.PrinterName = PbCache.sportInfo.printerName;//strPntSvrName;
  1168. System.Drawing.Printing.PaperSize customSize1 = new System.Drawing.Printing.PaperSize("TestPaper", 398, 433); //101mm*110mm,换算成英寸
  1169. printDocument1.DefaultPageSettings.PaperSize = customSize1;//将自定义的Papersize赋给PrintDocument
  1170. System.Drawing.Printing.Margins marginss = new System.Drawing.Printing.Margins(0, 0, 0, 0);
  1171. printDocument1.DefaultPageSettings.Margins = marginss;
  1172. printDocument1.PrintController = new System.Drawing.Printing.StandardPrintController();
  1173. foreach (PrintCls db in prrintC)
  1174. {
  1175. switch (db.printDb.meterTypeNo)
  1176. {
  1177. case "0": //毛
  1178. db.qrCode = db.printDb.actualNo + "," + db.printDb.grossWeight + "," + "1";
  1179. break;
  1180. case "x": //净
  1181. db.qrCode = db.printDb.actualNo + "," + db.printDb.netWeight + "," + "2";
  1182. break;
  1183. default: //皮
  1184. db.qrCode = db.printDb.actualNo + "," + db.printDb.grossWeight + "," + "1";
  1185. break;
  1186. }
  1187. RESTfulResult<string> rQRCode = workCarActualFirstService.doQRCodeWf(db.qrCode);
  1188. db.qrCode = rQRCode.Data;
  1189. for (int i = 0; i < db.printNum; i++)
  1190. {
  1191. if (i == 0)
  1192. {
  1193. printData = db;
  1194. printDocument1.Print();
  1195. l.WriteLog(10, "当前第" + (i + 1) + "次打印:" + printData.iType + " 车号:" + db.printDb.carNo + ",二维码:" + db.qrCode);
  1196. }
  1197. else
  1198. {
  1199. FrmMessage frmMessageContinue = FrmMess("已打印【" + i + "】张,是否继续打印第【" + (i + 1) + "】张票据!", "打印");
  1200. if (frmMessageContinue.ShowDialog(this) == DialogResult.OK)
  1201. {
  1202. printData = db;
  1203. printDocument1.Print();
  1204. l.WriteLog(10, "当前第" + (i + 1) + "次打印:" + printData.iType + " 车号:" + db.printDb.carNo + ",二维码:" + db.qrCode);
  1205. }
  1206. else
  1207. {
  1208. l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】第" + i + "次是否打印,选择了【否】");
  1209. }
  1210. }
  1211. //printData = db;
  1212. //printDocument1.Print();
  1213. //lg.WriteLog(11, "当前打印:" + printData.iType + " 车号:" + db.printDb.carNo);
  1214. }
  1215. }
  1216. }
  1217. else
  1218. {
  1219. l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】是否打印选择了【否】");
  1220. l.WriteLog(15, PbCache.lockCarNo + "是否打印选择了【否】");
  1221. }
  1222. }
  1223. }
  1224. }
  1225. else
  1226. {
  1227. l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】获取打印配置数据信息异常sql:【" + sql + "】");
  1228. }
  1229. }
  1230. }
  1231. }
  1232. else
  1233. {
  1234. l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】获取计量数据信息异常sql:【" + sql + "】");
  1235. }
  1236. #endregion 获取打印信息,若需要打印则调用打印操作
  1237. }
  1238. catch (Exception ex)
  1239. {
  1240. l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】打印异常" + ex);
  1241. }
  1242. }
  1243. private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
  1244. {
  1245. try
  1246. {
  1247. if (printData != null && printData.printDb != null)
  1248. {
  1249. printClass.PrintAllPage(e, printData.printDb, printData.qrCode);
  1250. /*
  1251. //结净打印
  1252. if (printData.iType == 2)
  1253. {
  1254. printClass.PrintPage(e, printData.printDb, PbCache.strQRCode);
  1255. }
  1256. else //非结净打印
  1257. {
  1258. printClass.PrintWgtPage(e, printData.printDb, PbCache.strQRCode);
  1259. }
  1260. //*/
  1261. }
  1262. }
  1263. catch (Exception ex)
  1264. {
  1265. l.WriteLog(11, "打印异常" + ex);
  1266. }
  1267. }
  1268. /// <summary>
  1269. /// 重量大于500,直接打开主界面
  1270. /// </summary>
  1271. /// <param name="sender"></param>
  1272. /// <param name="e"></param>
  1273. private void timer1_Tick(object sender, EventArgs e)
  1274. {
  1275. //timer1.Stop();
  1276. try
  1277. {
  1278. if (!isOpened && PbCache.collect?.weight > 500)
  1279. {
  1280. PbCache.bussinessTypeName = "";
  1281. PbCache.bussinessTypeCode = "";
  1282. if (fcc.Visible == false)
  1283. {
  1284. fcc.Visible = true;
  1285. fcc.init();
  1286. }
  1287. }
  1288. timer1.Interval = 1000;
  1289. }
  1290. catch (Exception ee)
  1291. {
  1292. //GlobalInstanceController.Instance.LastCallMessage = ee.Message;
  1293. timer1.Interval = 1000;
  1294. }
  1295. //timer1.Start();
  1296. }
  1297. /// <summary>
  1298. /// 操作Live表的数据:零点报警
  1299. /// </summary>
  1300. private void doOperateLive()
  1301. {
  1302. if (PbCache.collect_no == null)
  1303. {
  1304. return;
  1305. }
  1306. List<LiveData> ll = MemoClass.getWarnInfo(PbCache.collect_no);
  1307. if (ll != null)
  1308. {
  1309. foreach (LiveData lv in ll)
  1310. {
  1311. switch (lv.Tagname.Replace(PbCache.collect_no, ""))
  1312. {
  1313. case "StaticStatus"://车辆检测 "0、东西方向激光均无报警;否则报警
  1314. break;
  1315. case "SwitchLight"://PLC红绿灯控制模式状态 "PLC有三种控制模式:1、自动、2、远控;3、检修
  1316. break;
  1317. case "LightWest"://红绿灯:1、为绿灯;2、为红灯;"
  1318. break;
  1319. case "ZeroWeightStatus": //0、其它,1、零点报警,红绿灯变红,
  1320. if (((lv.Value ?? "0") + "").Equals("1"))
  1321. {
  1322. doInsertZeroAlarm();
  1323. PbCache.isZeroAlarm = true;
  1324. }
  1325. else
  1326. {
  1327. PbCache.isZeroAlarm = false;
  1328. }
  1329. break;
  1330. }
  1331. }
  1332. }
  1333. }
  1334. /// <summary>
  1335. /// 操作Live表的数据:零点报警
  1336. /// </summary>
  1337. private void doLive()
  1338. {
  1339. if (PbCache.collect_no == null)
  1340. {
  1341. return;
  1342. }
  1343. List<LiveData> ll = MemoClass.getWarnInfo(PbCache.collect_no);
  1344. MeterWorkMonitor mwm = new MeterWorkMonitor();
  1345. mwm.pointNo = PbCache.sportInfo.baseSpotNo;
  1346. mwm.redGreenLightState = "0";
  1347. if (ll != null)
  1348. {
  1349. foreach (LiveData lv in ll)
  1350. {
  1351. switch (lv.Tagname.Replace(PbCache.collect_no, ""))
  1352. {
  1353. case "PowerStatus":
  1354. mwm.powerState = lv.Value.ToString();
  1355. break;
  1356. case "PlcWatchDog":
  1357. if (int.Parse(lv.Value.ToString()) >= 0 && int.Parse(lv.Value.ToString()) <= 0)
  1358. {
  1359. mwm.plcState = 0.ToString();
  1360. }
  1361. break;
  1362. case "InfraredWest":
  1363. if (lv.Value.ToString() == "2")
  1364. {
  1365. mwm.leftInfraredRayState = "0";
  1366. }
  1367. else
  1368. {
  1369. mwm.leftInfraredRayState = lv.Value.ToString();
  1370. }
  1371. break;
  1372. case "InfraredEast":
  1373. if (lv.Value.ToString() == "2")
  1374. {
  1375. mwm.rightInfraredRayState = "0";
  1376. }
  1377. else
  1378. {
  1379. mwm.rightInfraredRayState = lv.Value.ToString();
  1380. }
  1381. break;
  1382. case "AmplifierState":
  1383. mwm.amplifierState = lv.Value.ToString();
  1384. break;
  1385. case "LampState":
  1386. if (lv.Value.ToString() == "2")
  1387. {
  1388. mwm.lampState = "0";
  1389. }
  1390. else
  1391. {
  1392. mwm.lampState = lv.Value.ToString();
  1393. }
  1394. break;
  1395. case "InfraredLeft":
  1396. if (lv.Value.ToString() == "2")
  1397. {
  1398. mwm.frontInfraredRayState = "0";
  1399. }
  1400. else
  1401. {
  1402. mwm.frontInfraredRayState = lv.Value.ToString();
  1403. }
  1404. break;
  1405. case "InfraredRight":
  1406. if (lv.Value.ToString() == "2")
  1407. {
  1408. mwm.rearInfraredRayState = "0";
  1409. }
  1410. else
  1411. {
  1412. mwm.rearInfraredRayState = lv.Value.ToString();
  1413. }
  1414. break;
  1415. case "ZeroWeightStatus":
  1416. mwm.zeroState = lv.Value.ToString();
  1417. break;
  1418. case "RfidState":
  1419. mwm.rfidState = lv.Value.ToString();
  1420. if (((lv.Value ?? "0") + "").Equals("1"))
  1421. {
  1422. doInsertZeroAlarm();
  1423. PbCache.isZeroAlarm = true;
  1424. }
  1425. else
  1426. {
  1427. PbCache.isZeroAlarm = false;
  1428. }
  1429. break;
  1430. }
  1431. }
  1432. }
  1433. RESTfulResult<string> rms = meterWorkMonitor.doUpdateWf(mwm);
  1434. }
  1435. /// <summary>
  1436. /// 新增零点报警的数据
  1437. /// </summary>
  1438. private void doInsertZeroAlarm()
  1439. {
  1440. if (!PbCache.isZeroAlarm)
  1441. {
  1442. PbCache.isZeroAlarm = true;
  1443. MeterWorkZeroAlarm workZeroAlarm = new MeterWorkZeroAlarm();
  1444. workZeroAlarm.zeroWeight = PbCache.collect.weight;
  1445. workZeroAlarm.spotTypeNo = PbCache.sportInfo.spotTypeNo;
  1446. workZeroAlarm.spotTypeName = PbCache.sportInfo.spotTypeName;
  1447. workZeroAlarm.baseSpotNo = PbCache.sportInfo.baseSpotNo;
  1448. workZeroAlarm.baseSpotName = PbCache.sportInfo.baseSpotName;
  1449. workZeroAlarm.scalePointNo = PbCache.collect_no;
  1450. workZeroAlarm.createManNo = PbCache.sportInfo.baseSpotNo;
  1451. workZeroAlarm.createManName = PbCache.sportInfo.baseSpotName;
  1452. RESTfulResult<String> rms = zeroAlarmService.doInsertZeroAlarm(workZeroAlarm);
  1453. if (rms.Succeed)
  1454. {
  1455. l.WriteLog(20, "新增成功:" + workZeroAlarm.baseSpotName + ":" + workZeroAlarm.zeroWeight);
  1456. }
  1457. else
  1458. {
  1459. l.WriteLog(20, "操作失败:" + workZeroAlarm.baseSpotName + ":" + workZeroAlarm.zeroWeight + rms.Data + rms.Message);
  1460. }
  1461. }
  1462. }
  1463. private void button3_Click(object sender, EventArgs e)
  1464. {
  1465. string limsResult = "";
  1466. JGLimsInterface gLimsInterface = new JGLimsInterface();
  1467. }
  1468. /// <summary>
  1469. /// 查询重量信息,显示在界面上面
  1470. /// </summary>
  1471. /// <param name="sender"></param>
  1472. /// <param name="e"></param>
  1473. private void button4_Click(object sender, EventArgs e)
  1474. {
  1475. try
  1476. {
  1477. string sqls = @"select '毛重:' || t.gross_weight / 1000 || ' T / 皮重:' || t.tare_weight / 1000 || ' T / 净重:' || t.net_weight / 1000 || ' T ' as text
  1478. from meter_work_car_actual t where t.value_flag = '0' and T.Prediction_No = '" + txtPlanNo.Text + @"'";
  1479. PbModelDbService<List<PbModelDb>> pbRelation = new PbModelDbService<List<PbModelDb>>();
  1480. RESTfulResult<List<PbModelDb>> rmRelation = pbRelation.executeSqlDataWf(sqls);
  1481. if (rmRelation.Succeed && rmRelation.Data != null && rmRelation.Data.Count > 0)
  1482. {
  1483. MessageBox.Show(rmRelation.Data[0].text);
  1484. }
  1485. else
  1486. {
  1487. MessageBox.Show("空");
  1488. }
  1489. }
  1490. catch (Exception ex)
  1491. {
  1492. }
  1493. }
  1494. private void button1_Click(object sender, EventArgs e)
  1495. {
  1496. isOpened = false;
  1497. testFlag = true;
  1498. PbCache.isTest= true;
  1499. testWgt = (int)numericUpDown1.Value;
  1500. //CollectModel model = new CollectModel();
  1501. //model.weight = testWgt;
  1502. //PbCache.collect = model;
  1503. testCarNo = textBox1.Text.Trim();
  1504. testPlanNo = txtPlanNo.Text.Trim();
  1505. }
  1506. private void Form1_FormClosing(object sender, FormClosingEventArgs e)
  1507. {
  1508. collection.Stop();
  1509. imageCurlControl.Stop();
  1510. sweepCodeClass.CloseThread();
  1511. sweepCodeClass2.CloseThread();
  1512. timer1.Stop();
  1513. timer1.Dispose();
  1514. }
  1515. private bool SystemUpdate(bool isMessage)
  1516. {
  1517. ReleaseList releaseList = new ReleaseList(Application.StartupPath + @"\" + GlobalVariable.Instance.ReleaseFileName);
  1518. DownloadTools dt = new DownloadTools();
  1519. try
  1520. {
  1521. bool isDownload = dt.IsDownloadFile(GlobalVariable.Instance.LocalPath, GlobalVariable.Instance.ReleaseURL, GlobalVariable.Instance.ReleaseFileName);
  1522. if (!isDownload)
  1523. {
  1524. if (isMessage) MessageBox.Show("无法连接到远程主机!", Application.ProductName);
  1525. return false;
  1526. }
  1527. }
  1528. catch (Exception e)
  1529. {
  1530. MessageBox.Show(e.Message);
  1531. }
  1532. bool flag = this.CheckUpdate(releaseList);
  1533. if (flag)
  1534. {
  1535. MessageBox.Show("有新版本,现在更新");
  1536. string t = dt.DownloadFile(Application.StartupPath, GlobalVariable.Instance.ReleaseURL, GlobalVariable.Instance.ApplicationUpdater);
  1537. this.Close();
  1538. Application.Exit();
  1539. GC.Collect();
  1540. Process.Start(Application.StartupPath + @"\" + GlobalVariable.Instance.ApplicationUpdater);
  1541. return true;
  1542. }
  1543. else
  1544. {
  1545. if (isMessage) MessageBox.Show("你的系统已经是最新版本,不需要更新!", Application.ProductName);
  1546. return false;
  1547. }
  1548. }
  1549. private bool CheckUpdate(ReleaseList localRelease)
  1550. {
  1551. try
  1552. {
  1553. string fileNameAll = Application.StartupPath + "\\" + GlobalVariable.Instance.LocalPath + "\\" + GlobalVariable.Instance.ReleaseFileName;
  1554. ReleaseList remoteRelease = new ReleaseList(fileNameAll);
  1555. return (((localRelease != null) && (remoteRelease != null)) && localRelease.ReleaseDate.CompareTo(remoteRelease.ReleaseDate) < 0);
  1556. }
  1557. catch (Exception exception)
  1558. {
  1559. MessageBox.Show(exception.Message);
  1560. }
  1561. return false;
  1562. }
  1563. }
  1564. }