| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409 |
- using CarMeterSystem.OptionCls;
- using com.hnshituo.core.webapp.vo;
- using Common;
- using iCore.Rtdb.RtdbTable;
- using MeterConditionLibrary;
- using MeterModelLibrary;
- using MeterModuleLibrary.uc;
- using MeterPlugInLibrary;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Diagnostics;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Windows.Forms;
- namespace CarMeterSystem
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private Log l = Log.GetInstance();
- private Print printClass = new Print();//打印
- //内存表
- private MemoryTableDataSocket MemoClass = new MemoryTableDataSocket("");
- //实时表数据采集
- private DataCollectionControl collection = new DataCollectionControl();
- //图片控制器含图片压缩及上传curl
- private ImageCurlControl imageCurlControl = new ImageCurlControl();
- //与监控界面对接的表
- private MeterWorkMonitorService meterWorkMonitor = new MeterWorkMonitorService();
- //零点报警表
- private meterworkzeroalarmservice zeroAlarmService = new meterworkzeroalarmservice();
- //车号修正
- private CarNoModfiy modfiy = new CarNoModfiy();
- //验证对射
- private validParkStatus valid = new validParkStatus();
- //语音播报
- private VoicePlay vicPlayClass = new VoicePlay();
- //扫码枪
- private SweepCode sweepCodeClass = new SweepCode();
- private LED_Control led_controler = null;
- //验证校秤数据
- private validCalibration vCalib = new validCalibration();
- private MeterWorkCarActualFirstService workCarActualFirstService = new MeterWorkCarActualFirstService(); //一次计量数据
- //查询当前是否校秤
- private bool bRelation = true;
- /// <summary>
- /// 欢迎界面
- /// </summary>
- private frmWelcome_Jisco frmWelcome = new frmWelcome_Jisco();//欢迎
- /// <summary>
- /// 基础数据载入
- /// </summary>
- private BaseDbCls bd = new BaseDbCls();
- //扫码修正车号标识
- private bool codeFlag = false;
- private List<ucBusinessType> lu = new List<ucBusinessType>();
- private bool isVoiceDownCar = false;//车上人员请下车播放一次
- private bool isShowFrmWelcome = false; //是否显示欢迎界面;在这个测试界面,不显示欢迎界面
- private bool isOpened = false;//是否已经打开了扫码计量界面
- private void Form1_Load(object sender, EventArgs e)
- {
- //*
- try
- {
- //CollectModel temp = new CollectModel();
- //temp.weight = 501;
- //PbCache.collect = temp;
- //frmMatMsgInfo frmMatMsgInfo = new frmMatMsgInfo();
- //frmMatMsgInfo.Show();
- timer1.Start();
- //2021年6月21日 杨秀东添加
- if (isShowFrmWelcome)
- {
- frmWelcome.Show();
- frmWelcome.Visible = true;
- }
- LoginCls lg = new LoginCls();
- if (lg.LoginIn())
- {
- //if (SystemUpdate(false))
- //{
- // return;
- //}
- // 加载并验证基本配置
- if (bd.setBaseDb() && bd.getBaseDb())
- {
- if (!string.IsNullOrEmpty(PbCache.sportInfo.ledIp))
- {
- led_controler = new LED_Control(PbCache.sportInfo.ledIp);
- }
- //调用该方法时已赋值
- RESTfulResult<List<MeterWorkMonitor>> rm = meterWorkMonitor.doQueryOneWf(new MeterWorkMonitor { validFlag = "1", pointNo = PbCache.sportInfo.baseSpotNo });
- if (!rm.Succeed)
- {
- l.WriteLog(1, "载入监控表数据异常");
- return;
- }
- else if (rm.Data != null && rm.Data.Count > 0)
- {
- if (string.IsNullOrEmpty(PbCache.collect_no))
- {
- PbCache.collect_no = rm.Data[0].collectionCode;
- MemoClass = new MemoryTableDataSocket(PbCache.collect_no);
- }
- }
- else
- {
- //l.WriteLog(1, "为配置监控数据");
- //return;
- }
- //若未校秤的话,也不允许计量
- //载入界面业务按钮
- if (PbCache.businessType != null && PbCache.businessType.Count > 0)
- {
- foreach (ComBaseInfo info in PbCache.businessType)
- {
- ucBusinessType uc = new ucBusinessType();
- switch (info.baseCode)
- {
- case "001006003":
- uc.setControl(info.baseName, info.memo, info.baseCode);
- break;
- case "001006001":
- case "001006002":
- uc.setControl(info.baseName, info.memo, info.baseCode);
- break;
- default:
- uc.setControl(info.baseName, info.memo, info.baseCode);
- break;
- }
- uc.Dock = DockStyle.Top;
- //uc.setControl("","","",);
- uc.ucEvent += new EventHandler(ucEvents);
- lu.Add(uc);
- panel7.Controls.Add(uc);
- }
- }
- //开启基础进程
- l.WriteLog(0, "系统登录成功");
- collection.EventDataCollectionArgs += new EventDataCollection(EventData);//数据采集
- collection.Start(PbCache.sportInfo.baseSpotNo, PbCache.sportInfo.baseSpotName);
- imageCurlControl.Start(); //图片采集线程
- sweepCodeClass.StartThreadSweep(); //扫码线程
- ////***********************暂时注释掉*****************************************************
- ////sweepCodeClass.StartThreadSweep();
- ////**************************************************************************************
- }
- else
- {
- l.WriteLog(0, "系统登录失败");
- }
- }
- else
- {
- l.WriteLog(0, "按IP地址找不到计量点信息,系统登录失败");
- }
- }
- catch (Exception ex)
- {
- l.WriteLog(0, "系统加载失败:" + ex.Message);
- }
- //*/
- }
- #region
- //*
- public void ucEvents(object sender, EventArgs e)
- {
- Control control = (Control)sender;
- ucBusinessType um = control.Parent.Parent as ucBusinessType;
- try
- {
- switch (control.Name)
- {
- case "btnContext":
- case "btnPurchase":
- {
- PbCache.bussinessTypeName = um._bussiness == null ? "" : um._bussiness;
- PbCache.bussinessTypeCode = um._code;
- switch (um._code)
- {
- case "001006003":
- frmInternalTransport frm = new frmInternalTransport();
- frm.isTest = true;
- frm.ShowDialog();
- break;
- /*
- case "001006001":
- case "001006002":
- frmCarSalePurchase frmCar = new frmCarSalePurchase();
- frmCar.ShowDialog();
- break;
- //*/
- default:
- frmCarSalePurchase frmCar = new frmCarSalePurchase();
- frmCar.isTest = true;
- frmCar.ShowDialog();
- break;
- }
- };
- break;
- default: break;
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("操作异常:" + ex.Message);
- }
- }
- //*/
- #endregion
- #region
- private void setWelecomeVis(bool visb)
- {
- /*
- if (frmWelcome.InvokeRequired)
- {
- Action<bool> action = new Action<bool>(setWelecomeVis);
- Invoke(action, new object[] { visb });
- }
- else
- {
- if (frmWelcome.Visible != visb)
- {
- frmWelcome.Visible = visb;
- frmWelcome.setLogin();
- }
- }
- //*/
- }
- #endregion
- private int iCount = 0, iHodeTime = 0;
- private bool flagCarMonit = false;//车号修正
- private bool isOpenMeter = false; //是否已打开计量界面,若已经打开则这里关于超量程及红外的语音将停止播报
- private string firstCode = "";//上次扫码的信息
- private string ledTxt = "";
- private bool isLedWrite = true;//是否写入一次LED
- private string sCarNo = "";
- private string editCarNo = "";
- private string preCarNo = "";
- /// <summary>
- /// 数据采集
- /// </summary>
- /// <param name="o"></param>
- /// <param name="e"></param>
- private void EventData(object o, DataCollectionArgs e)
- {
- //这里每隔0.5秒执行一次
- try
- {
- #region
- /*
- if (e.licType == PbCache.collect.licType)
- {
- iCollection++;
- if (iCollection > 59 && iCollection % 20 == 0) //若连续30秒采集不到数据则提示中断,并每隔10秒播放一次
- {
- //采集线程中断
- vicPlayClass.GetVoicePlay("实时库采集中断", "");
- sweepCodeClass.StrState = "";
- }
- }
- else
- {
- sweepCodeClass.StrState = e.weightStatus + "";
- iCollection = 0;
- }
- //*/
- #endregion
- #region 扫码信息
- sweepCodeClass.StrState = e.weightStatus + ""; //重量状态信息;当StrState= 0时,获取扫码信息,StrState= 2时将扫码信息置位“”空;其他状态不处理
- l.WriteLog(12,sweepCodeClass.ToString());
- if (string.IsNullOrEmpty(sweepCodeClass.StrCode))
- {
- if (string.IsNullOrEmpty(PbCache.strCode))
- {
- codeFlag = false;
- firstCode = "";
- PbCache.strCode = "";
- l.WriteLog(12, "主线程扫码值为空时清空;sweepCodeClass.StrCode值为" + sweepCodeClass.StrCode + " ;PbCache.strCode值为:" + PbCache.strCode);
- }
- }
- else
- {
- ////日期2021年12月22日:重复扫码,取前面12位
- //if (sweepCodeClass.StrCode.Length > 15)
- //{
- // sweepCodeClass.StrCode = sweepCodeClass.StrCode.Substring(12);
- //}
- //if (firstCode != sweepCodeClass.StrCode || string.IsNullOrEmpty(PbCache.strCode))
- //{
- // l.WriteLog(12, "主线程扫码值赋值;sweepCodeClass.StrCode值为" + sweepCodeClass.StrCode + " ;PbCache.strCode前值为:" + PbCache.strCode);
- // PbCache.strCode = sweepCodeClass.StrCode;
- // firstCode = PbCache.strCode;
- //}
- l.WriteLog(12, "测试扫码值"+PbCache.strCode);
- PbCache.collect.carno = sweepCodeClass.StrCode;
- PbCache.strCode = sweepCodeClass.StrCode;
- codeFlag = true;
- }
- #endregion
- #region 秤上无车10分钟获取一次基础数据
- if (iCount < 1200)
- {
- iCount++;
- }
- else
- {
- iCount = 0;
- try
- {
- //秤上没有车时,每隔10分钟获取一次基础数据
- if (e.weight < 500)
- {
- editCarNo = "";
- preCarNo = "";
- if (bd.setBaseDb())
- {
- l.WriteLog(0, "十分钟获取基础数据成功");
- }
- else
- {
- l.WriteLog(0, "十分钟获取基础数据失败");
- }
- }
- }
- catch (Exception ex)
- {
- l.WriteLog(0, "十分钟获取基础数据失败:" + ex.Message);
- }
- }
- #endregion
- #region 每10秒写入一次当前时间
- if (iCount % 20 == 0)
- {
- RESTfulResult<string> rms = meterWorkMonitor.doUpdateWf(new MeterWorkMonitor { pointNo = PbCache.sportInfo.baseSpotNo, lastTime = DateTime.Now });
- if (!rms.Succeed)
- {
- l.WriteLog(0, "frmMain.EventData异常:写入时间异常");
- }
- }
- #endregion
- #region
- //一旦界面锁定则不采集数据
- //if (!PbCache.isLockFrm)
- //{
- PbCache.collect.pointid = PbCache.sportInfo.baseSpotNo;
- PbCache.collect.parkStatus = e.parkStatus;
- PbCache.collect.datetime = e.datetime;
- PbCache.collect.licType = e.licType;
- if (testFlag)
- {
- sCarNo = testCarNo;
- //PbCache.collect.carno = testCarNo;
- PbCache.collect.weight = testWgt;
- PbCache.collect.weightStatus = 0;
- PbCache.monitorResult.valid_park_status = true;
- PbCache.collect.parkStatus = 0;
- if (PbCache.collect.weight > e.weight)
- e.weight = PbCache.collect.weight;
- PbCache.strCode = testPlanNo;
- e.carno = testCarNo;
- //PbCache.strQRCode = testCode;
- }
- else
- {
- PbCache.collect.weight = e.weight;
- PbCache.collect.weightStatus = e.weightStatus;
- }
-
- if (!flagCarMonit)
- {
- sCarNo = e.carno;
- //PbCache.collect.carno = e.carno;
- }
- #if DEBUG
-
- #endif
- #region 摄像头当前采集的车号与上次采集的不一样且当前未勾选不验证的情况
- if (preCarNo != e.carno && PbCache.monitor != null && PbCache.monitor.validCarno != "0")
- {
- flagCarMonit = false;
- }
- preCarNo = e.carno;
- #endregion
- //*
- //有车号,且重量稳定的情况下,只修正一次车号
- if (!string.IsNullOrEmpty(e.carno) && e.weightStatus == 0 && !flagCarMonit && PbCache.monitor != null && PbCache.monitor.carMonitor == "1" && PbCache.monitor.carMonitorLvl > 0)
- {
- flagCarMonit = true;
- string methods = "";
- for (int i = 0; i <= PbCache.monitor.carMonitorLvl; i++)
- {
- methods += "CarNoTrustCorrect" + i + ",";
- }
- editCarNo = modfiy.CarNoCorrect(e.carno, methods.Substring(0, methods.Length - 1));
- sCarNo = editCarNo;
- }
- //勾选了不验证车号的情况
- if (PbCache.monitor.validCarno == "0")
- {
- flagCarMonit = true;
- }
- // 更新监控表
- doLive();
- //}
- //*/
- //重量大于500的情况下
- if (e.weight > 500)
- {
- if (PbCache.dtStartTime == null)
- PbCache.dtStartTime = DateTime.Now;
- isLedWrite = true;
- #region 查一次是否校秤,若未校秤则不能计量
- /*
- if (bRelation)
- {
- string msgInfo = "";
- isCalibration = vCalib.ValidMethod(new MeterWorkCalibrationMain { baseSpotNo = PbCache.sportInfo.baseSpotNo, valueFlag = "2" }, out msgInfo);
- if (!isCalibration)
- {
- foreach (ucBusinessType uc in lu)
- {
- uc.setControlEnable(false);
- }
- ledTxt = msgInfo;
- l.WriteLog(1, msgInfo);
- }
- bRelation = false;
- }
- if (!isCalibration)
- {
- vicPlayClass.GetVoicePlay("未校秤", "");
- Thread.Sleep(2000);
- return;
- }
- //*/
- #endregion
- #region 车上人员请下车
- try
- {
- //界面未锁定的情况下,有车号,如果重量稳定了,停车线验证通过,未超量程的情况下,则按钮可用
- if (!string.IsNullOrEmpty(PbCache.collect.carno) && PbCache.collect.weightStatus == 0 && PbCache.monitorResult.valid_park_status && PbCache.collect.weight < PbCache.range.upperRange)
- {
- if (!isVoiceDownCar)
- {
- isVoiceDownCar = true;
- vicPlayClass.GetVoicePlay("车上人员请下车", PbCache.collect.carno);
- }
- }
- }
- catch { }
- #endregion
- setWelecomeVis(false);
- //每隔1秒刷一次计量实时监控表数据值
- if (iCount % 2 == 0)
- {
- #region 停留超时
- iHodeTime++;
- MeterWorkMonitor mwUpdate = new MeterWorkMonitor();
- mwUpdate.pointNo = PbCache.sportInfo.baseSpotNo;
- if (PbCache.holdTime != null && PbCache.holdTime.Count > 0)
- {
- if (PbCache.holdTime[0].retentionTime != null)
- {
- if (PbCache.holdTime[0].retentionTime.Value < iHodeTime)
- {
- PbCache.isOvertimeAlarm = true; //是否超时报警
- mwUpdate.stopOverTime = "1"; //写入一次停留超时
- //mwUpdate.isHelp = "1";//派位
- //mwUpdate.isTakeOver = "1";
- iHodeTime = 99999;//不再增长避免超出
- }
- }
- }
- #endregion
- #region 车号信息
- mwUpdate.rfidCar = "";
- mwUpdate.photoCar = e.vdioCarNos;
- if (testFlag)
- {
- mwUpdate.photoCar = PbCache.collect.carno;
- }
- //e.RfidNos = "0003";
- if (!string.IsNullOrEmpty(e.RfidNos))
- {
- string sqls = @"SELECT RFID_ID id,CAR_NO text FROM METER_BASE_RFID_INFO where RFID_CODE = '" + e.RfidNos + "'";
- PbModelDbService<List<PbModelDb>> pbp = new PbModelDbService<List<PbModelDb>>();
- RESTfulResult<List<PbModelDb>> rmT = pbp.executeSqlDataWf(sqls);
- if (rmT.Data == null || rmT.Data.Count == 0)
- {}
- else
- {
- mwUpdate.rfidCar = rmT.Data[0].text;
- sCarNo = rmT.Data[0].text;
- }
- }
- if (PbCache.monitor != null && !string.IsNullOrEmpty(PbCache.monitor.setCar))
- {
- //未锁定的情况下,若监控界面设置了车号,则车号将改为设定车号
- sCarNo = PbCache.monitor.setCar;
- codeFlag = false;
- sweepCodeClass.StrCode = "";
- }
- #endregion
- #region 重量信息
- if (!PbCache.isLockFrm)
- {
- mwUpdate.wgt = e.weight;
- }
- else
- {
- mwUpdate.wgt = Convert.ToInt32(PbCache.lockWgt);
- }
- #endregion
- #region 写入一次监控表,将重量/车号停留超时等信息写入
- mwUpdate.weightStatus = PbCache.collect.weightStatus;
- mwUpdate.msgInfo = PbCache.ResultMessage;
- if (codeFlag)
- {
- mwUpdate.scanCar = PbCache.collect.carno;
- }
- //另外初始化一次监控数据
- RESTfulResult<string> rms = meterWorkMonitor.doUpdateWf(mwUpdate);
- if (!rms.Succeed)
- {
- l.WriteLog(0, "frmMain.EventData异常doUpdateWf:写入信息异常");
- }
- #endregion
- //调用该方法时已赋值
- RESTfulResult<List<MeterWorkMonitor>> rm = meterWorkMonitor.doQueryOneWf(new MeterWorkMonitor { validFlag = "1", pointNo = PbCache.sportInfo.baseSpotNo });
- if (!rm.Succeed)
- {
- l.WriteLog(0, "frmMain.EventData异常doQueryWf:" + rm.ResultMessage);
- }
- else
- {
- if (rm.Data != null && rm.Data.Count > 0)
- {
- PbCache.monitor = rm.Data[0];
- if (string.IsNullOrEmpty(PbCache.collect_no))
- {
- PbCache.collect_no = rm.Data[0].collectionCode;
- }
- if (ledTxt != rm.Data[0].ledWriter && rm.Data[0].ledWriter != "")
- {
- //调用LED信息写入******************************
- ledTxt = rm.Data[0].ledWriter;
- }
- if (string.IsNullOrEmpty(ledTxt))
- {
- ledTxt = "车号甘A12345,重量98.76吨,计量完成";
- }
- }
- }
- //验证对射
- valid.ValidMethod();
- if (!isOpenMeter)
- {
- //if (PbCache.range != null && PbCache.range.upperRange < e.weight)
- if (PbCache.range != null && PbCache.range.upperRange < e.weight)
- {
- //超量程
- vicPlayClass.GetVoicePlay("已超量程", e.carno);
- //return;
- }
- else if (e.weightStatus == 0 && !PbCache.monitorResult.valid_park_status)
- {
- //重量稳定,且对射验证不合格
- vicPlayClass.GetVoicePlay("您的车辆未停到位", e.carno);
- //return;
- }
- }
- if (!lu[0].bcEnable)
- {
- foreach (ucBusinessType uc in lu)
- {
- uc.setControlEnable(true);
- }
- }
- if (sweepCodeClass.StrCode == "" && !codeFlag)
- {
- PbCache.collect.carno = sCarNo;
- }
- }
- ////写入LED信息
- //if (PbCache.sportInfo != null && PbCache.ledInfo != PbCache.OldLedInfo)
- //{
- // PbCache.OldLedInfo = PbCache.ledInfo;
- // if (PbCache.monitor != null && PbCache.monitor.ledKeep == "0")
- // {
- // //led_controler.setOneLineMsg(PbCache.sportInfo.ledIp, PbCache.ledInfo);
- // }
- //}
- }
- else
- {
- if (e.weight > 0 && e.weight < 200)
- {
- doOperateLive();
- }
- if (e.weight==0)
- {
- PbCache.isZeroAlarm = false;
- }
- //======测试 的时候注释,正式用的时候启用下面这行代码***************************************************************
- //PbCache.ResultMessage = "";
- PbCache.isOvertimeAlarm = false;
- isOpened = false;
- isVoiceDownCar = false;
- flagCarMonit = false;
- iHodeTime = 0;
- sCarNo = "";
- if (!testFlag)
- {
- bRelation = true;
- PbCache.isLockFrm = false;
- PbCache.dtStartTime = null;
- PbCache.voiceOver = true;
- setWelecomeVis(true);
- if (lu[0].bcEnable)
- {
- foreach (ucBusinessType uc in lu)
- {
- uc.setControlEnable(false);
- }
- }
- //LED写入
- if (isLedWrite)
- {
- //if (PbCache.monitor == null || string.IsNullOrEmpty(PbCache.monitor.ledWriter))
- //{
- // PbCache.ledInfo = "车号甘A12345\n\r重量98.76吨\n\r之前存在一个未结净的毛重\n\r请联系";
- //}
- //else
- //{
- // PbCache.ledInfo = PbCache.monitor == null ? "" : PbCache.monitor.ledWriter;
- //}
- //led_controler.setStaticLineMsg(PbCache.sportInfo.ledIp, PbCache.ledInfo);
- //led_controler.setStatic4LineMsg(PbCache.sportInfo.ledIp, PbCache.ledInfo);
- isLedWrite = false;
- //*
- //另外初始化一次监控数据
- RESTfulResult<string> rms = meterWorkMonitor.doUpdateWf(new MeterWorkMonitor
- {
- pointNo = PbCache.sportInfo.baseSpotNo,
- validWgt = "1",
- validCarno = "1",
- validTareTime = "1",
- validMatTime = "1",
- validTimeInterval = "1",
- validParkStatus = "1",
- validExceedWgt = "1",
- validPredictionDiff = "1",
- validLianda = "1",
- validMatClick = "1",
- setCar = "",
- rfidCar = "",
- photoCar = "",
- scanCar = "",
- editCar = "",
- carErr = "0",
- wgtErr = "0",
- ferroalloyResult = "0",
- stopOverTime = "0",
- msgInfo = "",
- ledWriter = "",
- isOverWgt = "",
- isHelp = "0",
- wgt = 0
- });
- if (!rms.Succeed)
- {
- l.WriteLog(0, "frmMain.EventData异常:写入信息异常");
- isLedWrite = true;
- }
- //*/
- }
- //*
- }
- else
- {
- if (!lu[0].bcEnable)
- {
- foreach (ucBusinessType uc in lu)
- {
- uc.setControlEnable(true);
- }
- }
- }
- //*/
- }
- #endregion
- }
- catch (Exception ex)
- {
- l.WriteLog(0, "frmMain.EventData异常:" + ex.Message);
- }
- }
- private delegate void ShowBtnTare(bool flag);//定义委托 期限皮重按钮
- private int testWgt = 1000;
- private string testCarNo = "", testPlanNo = "";
- private bool testFlag = false;
- /// <summary>
- /// 截图测试
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- CameraShotCls cameraShot = new CameraShotCls();
- //cameraShot.CapMethod("1");
- _ = Invoke(new Action(() => { cameraShot.CapMethod("15"); }));
- }
- //测试打印
- private string strFirstNo = "";
- private void btnTestPrint_Click(object sender, EventArgs e)
- {
- Print1(txtPlanNo.Text);
- }
- //弹窗
- private static FrmMessage FrmMess(string strMess, string strBtnSaveInfo)
- {
- FrmMessage frmMessage = new FrmMessage();
- frmMessage.StartPosition = FormStartPosition.Manual;
- frmMessage.Location = new Point(350, 450);
- frmMessage.ShowMessage = strMess;
- frmMessage.BtnSaveText = strBtnSaveInfo;
- frmMessage.BtnCancelText = "取消";
- return frmMessage;
- }
- private class PrintCls
- {
- public int printNum { get; set; }
- public MeterWorkCarActual printDb { get; set; }
- public int iType { get; set; } //0毛 1 皮 2净
- public string qrCode { get; set; }
- }
- private PrintCls printData = new PrintCls();
- private void Print1(string firstNo)
- {
- try
- {
- //lg.WriteLog(1, "打印开始");
- #region 获取打印信息,若需要打印则调用打印操作
- List<PrintCls> prrintC = new List<PrintCls>();
- string sql = @"select actual_no actualNo,
- prediction_no predictionNo,
- car_no carNo,
- matter_no matterNo,
- matter_name matterName,
- gross_weight grossWeight,
- gross_time grossTime,
- tare_weight tareWeight,
- tare_time tareTime,
- net_weight netWeight,
- net_Time netTime,
- 'x' meterTypeNo,
- meter_type_name meterTypeName,
- spec_name specName,
- forwarding_unit_name forwardingUnitName,
- receiving_uint_name receivingUintName,
- load_point_name loadPointName,
- add_weight addWeight,
- '1' uploadFlag --1结净数据 0一次表数据
- from meter_work_car_actual where actual_first1_no = '" + firstNo + @"' or actual_first2_no='" + firstNo + @"'
- union all
- select t.actual_first_no actualNo,
- t.prediction_no predictionNo,
- t.car_no carNo,
- t.matter_no matterNo,
- t.matter_name matterName,
- t.meter_weight grossWeight,
- t.create_time grossTime,
- 0 tareWeight,
- t.create_time tareTime,
- 0 netWeight,
- null netTime,
- t.weight_type meterTypeNo, --0毛重 否则皮重
- t.meter_type_name meterTypeName,
- t.spec_name specName,
- t.forwarding_unit_name forwardingUnitName,
- t.receiving_uint_name receivingUintName,
- t.load_point_name loadPointName,
- t.add_weight addWeight,
- '0' uploadFlag
- from METER_WORK_CAR_ACTUAL_FIRST t
- 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 + "')";
- //查下如果有毛重或者结净数据,则可进入打印判断
- PbModelDbService<List<MeterWorkCarActual>> pbModelDbService = new PbModelDbService<List<MeterWorkCarActual>>();
- RESTfulResult<List<MeterWorkCarActual>> rm = pbModelDbService.executeSqlDataWf(sql);
- //lg.WriteLog(1, "打印第一个sql:" + sql);
- if (rm.Succeed)
- {
- if (rm.Data != null && rm.Data.Count > 0)
- {
- //2021年6月26日 对一车联运的进行处理;用一次计量编号查二次计量数据,
- sql = @"select t3.actual_no actualNo, t3.prediction_no predictionNo, t3.car_no carNo, t3.matter_no matterNo, t3.matter_name matterName,
- t3.gross_weight grossWeight, t3.gross_time grossTime, t3.tare_weight tareWeight, t3.tare_time tareTime, t3.net_weight netWeight,
- t3.net_Time netTime, 'x' meterTypeNo, t3.meter_type_name meterTypeName, t3.spec_name specName,
- t3.forwarding_unit_name forwardingUnitName, t3.receiving_uint_name receivingUintName, t3.load_point_name loadPointName,
- t3.add_weight addWeight, '1' uploadFlag from meter_work_car_actual_first t2
- left join meter_work_car_actual t3 on t2.actual_first_no = t3.actual_first1_no
- where t2.prediction_combination in (select t.prediction_combination
- from meter_work_car_actual_first t
- where t3.value_flag = '0' and t.actual_first_no = '" + firstNo + @"' and
- instr(t.prediction_combination, '20') > 0) order by t3.net_time desc";
- RESTfulResult<List<MeterWorkCarActual>> rmLy = pbModelDbService.executeSqlDataWf(sql);
- if (rmLy.Succeed && rmLy.Data != null && rmLy.Data.Count == 1)
- {
- rm.Data = rmLy.Data; //一车联运,将毛重替换为净重数据
- }
- //若有毛重或者净重,找到对应数据的物料信息,若有,那么去找打印配置信息数据
- List<MeterWorkCarActual> mwa = rm.Data.Where(s => !string.IsNullOrEmpty(s.matterNo) && (s.meterTypeNo == "x" || s.meterTypeNo == "0")).ToList();
- if (mwa != null && mwa.Count > 0 && !string.IsNullOrEmpty(mwa[0].matterNo))
- {
- sql = @"select BASE_SPOT_NO baseSpotNo,
- load_point_no loadPointNo,
- matter_no matterNo,
- METER_TYPE_NO meterTypeNo,
- weight_type_name weightTypeName,
- PRINT_NUM printNum
- from METER_BASE_BILL_PRINT
- where matter_no = '" + mwa[0].matterNo + @"'
- and nvl(BASE_SPOT_NO, '" + PbCache.sportInfo.baseSpotNo + @"') = '" + PbCache.sportInfo.baseSpotNo + @"'
- and nvl(load_point_no, '" + (mwa[0].loadPointNo == null ? "1" : mwa[0].loadPointNo) + @"') = '" + (mwa[0].loadPointNo == null ? "1" : mwa[0].loadPointNo) + @"'";
- //lg.WriteLog(1, "打印第二个sql:" + sql); and nvl(METER_TYPE_NO, '" + PbCache.bussinessTypeCode + @"') = '" + PbCache.bussinessTypeCode + @"'
- //and nvl(METER_TYPE_NO, '') = ''
- PbModelDbService<List<MeterBaseBillPrint>> pbPrintService = new PbModelDbService<List<MeterBaseBillPrint>>();
- RESTfulResult<List<MeterBaseBillPrint>> rmPint = pbPrintService.executeSqlDataWf(sql);
- if (rmPint.Succeed)
- {
- if (rmPint.Data != null && rmPint.Data.Count > 0)
- {
- //若有净重信息:1毛重时间晚于皮重时间,则打印毛、皮、净重,2毛重早于皮重,打印皮、净
- //若只有毛重信息则打印毛重
- List<MeterBaseBillPrint> lGrossprint = rmPint.Data.Where(s => s.weightTypeName.Contains("毛")).ToList();
- List<MeterBaseBillPrint> lTarePrint = rmPint.Data.Where(s => s.weightTypeName.Contains("皮")).ToList();
- List<MeterBaseBillPrint> lNetprint = rmPint.Data.Where(s => s.weightTypeName.Contains("净")).ToList();
- List<MeterWorkCarActual> mwaChild = mwa.Where(s => s.meterTypeNo == "x").ToList();
- if (mwaChild != null && mwaChild.Count > 0) //若有净重信息
- {
- if (lTarePrint != null && lTarePrint.Count > 0)
- {
- //获取非毛,非净重信息如果没有则用的期限皮,此时不打,否则则打印
- MeterWorkCarActual mwca = rm.Data.Where(s => s.meterTypeNo != "x" && s.meterTypeNo != "0").FirstOrDefault();
- if (mwca != null)
- {
- PrintCls cls = new PrintCls();
- cls.printNum = (int)(lTarePrint[0].printNum == null ? 0 : lTarePrint[0].printNum.Value);
- cls.iType = 1;//皮重
- cls.printDb = mwca;
- prrintC.Add(cls);
- }
- }
- if (lGrossprint != null && lGrossprint.Count > 0)
- {
- //获取毛重信息
- MeterWorkCarActual mwca = rm.Data.Where(s => s.meterTypeNo == "0").FirstOrDefault();
- if (mwca != null)
- {
- PrintCls cls = new PrintCls();
- cls.printNum = (int)(lGrossprint[0].printNum == null ? 0 : lGrossprint[0].printNum.Value);
- cls.iType = 0;//毛重
- cls.printDb = mwca;
- prrintC.Add(cls);
- }
- }
- if (lNetprint != null && lNetprint.Count > 0)
- {
- //获取净重信息
- MeterWorkCarActual mwca = rm.Data.Where(s => s.meterTypeNo == "x").FirstOrDefault();
- if (mwca != null)
- {
- PrintCls cls = new PrintCls();
- cls.printNum = (int)(lNetprint[0].printNum == null ? 0 : lNetprint[0].printNum.Value);
- cls.iType = 2;//净重
- cls.printDb = mwca;
- prrintC.Add(cls);
- }
- }
- }
- else //只有毛重信息则打印毛重
- {
- if (lGrossprint != null && lGrossprint.Count > 0)
- {
- //获取毛重信息
- MeterWorkCarActual mwca = rm.Data.Where(s => s.meterTypeNo == "0").FirstOrDefault();
- if (mwca != null)
- {
- PrintCls cls = new PrintCls();
- cls.printNum = (int)(lGrossprint[0].printNum == null ? 0 : lGrossprint[0].printNum.Value);
- cls.iType = 0;//毛重
- cls.printDb = mwca;
- prrintC.Add(cls);
- }
- }
- }
- if (prrintC != null && prrintC.Count > 0)
- {
- FrmMessage frmMessage = FrmMess("是否打印第【1】张票据!", "打印");
- if (frmMessage.ShowDialog(this) == DialogResult.OK)
- {
- l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】是否打印选择了【是】");
- l.WriteLog(15, PbCache.lockCarNo + "是否打印选择了【是】");
- strFirstNo = firstNo;
- //printDocument1.PrinterSettings.PrinterName = PbCache.sportInfo.printerName;//strPntSvrName;
- System.Drawing.Printing.PaperSize customSize1 = new System.Drawing.Printing.PaperSize("TestPaper", 398, 433); //101mm*110mm,换算成英寸
- printDocument1.DefaultPageSettings.PaperSize = customSize1;//将自定义的Papersize赋给PrintDocument
- System.Drawing.Printing.Margins marginss = new System.Drawing.Printing.Margins(0, 0, 0, 0);
- printDocument1.DefaultPageSettings.Margins = marginss;
- printDocument1.PrintController = new System.Drawing.Printing.StandardPrintController();
- foreach (PrintCls db in prrintC)
- {
- switch (db.printDb.meterTypeNo)
- {
- case "0": //毛
- db.qrCode = db.printDb.actualNo + "," + db.printDb.grossWeight + "," + "1";
- break;
- case "x": //净
- db.qrCode = db.printDb.actualNo + "," + db.printDb.netWeight + "," + "2";
- break;
- default: //皮
- db.qrCode = db.printDb.actualNo + "," + db.printDb.grossWeight + "," + "1";
- break;
- }
- RESTfulResult<string> rQRCode = workCarActualFirstService.doQRCodeWf(db.qrCode);
- db.qrCode = rQRCode.Data;
- for (int i = 0; i < db.printNum; i++)
- {
- if (i == 0)
- {
- printData = db;
- printDocument1.Print();
- l.WriteLog(10, "当前第" + (i + 1) + "次打印:" + printData.iType + " 车号:" + db.printDb.carNo + ",二维码:" + db.qrCode);
- }
- else
- {
- FrmMessage frmMessageContinue = FrmMess("已打印【" + i + "】张,是否继续打印第【" + (i + 1) + "】张票据!", "打印");
- if (frmMessageContinue.ShowDialog(this) == DialogResult.OK)
- {
- printData = db;
- printDocument1.Print();
- l.WriteLog(10, "当前第" + (i + 1) + "次打印:" + printData.iType + " 车号:" + db.printDb.carNo + ",二维码:" + db.qrCode);
- }
- else
- {
- l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】第" + i + "次是否打印,选择了【否】");
- }
- }
- //printData = db;
- //printDocument1.Print();
- //lg.WriteLog(11, "当前打印:" + printData.iType + " 车号:" + db.printDb.carNo);
- }
- }
- }
- else
- {
- l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】是否打印选择了【否】");
- l.WriteLog(15, PbCache.lockCarNo + "是否打印选择了【否】");
- }
- }
- }
- }
- else
- {
- l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】获取打印配置数据信息异常sql:【" + sql + "】");
- }
- }
- }
- }
- else
- {
- l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】获取计量数据信息异常sql:【" + sql + "】");
- }
- #endregion 获取打印信息,若需要打印则调用打印操作
- }
- catch (Exception ex)
- {
- l.WriteLog(10, "车号【" + PbCache.lockCarNo + "】打印异常" + ex);
- }
- }
- private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
- {
- try
- {
- if (printData != null && printData.printDb != null)
- {
- printClass.PrintAllPage(e, printData.printDb, printData.qrCode);
- /*
- //结净打印
- if (printData.iType == 2)
- {
- printClass.PrintPage(e, printData.printDb, PbCache.strQRCode);
- }
- else //非结净打印
- {
- printClass.PrintWgtPage(e, printData.printDb, PbCache.strQRCode);
- }
- //*/
- }
- }
- catch (Exception ex)
- {
- l.WriteLog(11, "打印异常" + ex);
- }
- }
- /// <summary>
- /// 重量大于500,直接打开主界面
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void timer1_Tick(object sender, EventArgs e)
- {
-
- if (!isOpened && PbCache.collect?.weight > 500)
- {
- isOpened = true;
- isOpenMeter = true;
- PbCache.bussinessTypeName = "";
- PbCache.bussinessTypeCode = "";
- frmOneYardToEnd fcc = new frmOneYardToEnd();
- fcc.ShowDialog();
- }
- }
- /// <summary>
- /// 操作Live表的数据:零点报警
- /// </summary>
- private void doOperateLive()
- {
- if (PbCache.collect_no == null)
- {
- return;
- }
- List<LiveData> ll = MemoClass.getWarnInfo(PbCache.collect_no);
- if (ll != null)
- {
- foreach (LiveData lv in ll)
- {
- switch (lv.Tagname.Replace(PbCache.collect_no, ""))
- {
- case "StaticStatus"://车辆检测 "0、东西方向激光均无报警;否则报警
- break;
- case "SwitchLight"://PLC红绿灯控制模式状态 "PLC有三种控制模式:1、自动、2、远控;3、检修
- break;
- case "LightWest"://红绿灯:1、为绿灯;2、为红灯;"
- break;
- case "ZeroWeightStatus": //0、其它,1、零点报警,红绿灯变红,
- if (((lv.Value ?? "0") + "").Equals("1"))
- {
- doInsertZeroAlarm();
- PbCache.isZeroAlarm = true;
- }
- else
- {
- PbCache.isZeroAlarm = false;
- }
- break;
- }
- }
- }
- }
- /// <summary>
- /// 操作Live表的数据:零点报警
- /// </summary>
- private void doLive()
- {
- if (PbCache.collect_no == null)
- {
- return;
- }
- List<LiveData> ll = MemoClass.getWarnInfo(PbCache.collect_no);
- MeterWorkMonitor mwm = new MeterWorkMonitor();
- mwm.pointNo = PbCache.sportInfo.baseSpotNo;
- mwm.redGreenLightState = "0";
- if (ll != null)
- {
- foreach (LiveData lv in ll)
- {
- switch (lv.Tagname.Replace(PbCache.collect_no, ""))
- {
- case "PowerStatus":
- mwm.powerState = lv.Value.ToString();
- break;
- case "PlcWatchDog":
- if (int.Parse(lv.Value.ToString()) >= 0 && int.Parse(lv.Value.ToString()) <= 0)
- {
- mwm.plcState = 0.ToString();
- }
- break;
- case "InfraredWest":
- if (lv.Value.ToString() == "2")
- {
- mwm.leftInfraredRayState = "0";
- }
- else
- {
- mwm.leftInfraredRayState = lv.Value.ToString();
- }
- break;
- case "InfraredEast":
- if (lv.Value.ToString() == "2")
- {
- mwm.rightInfraredRayState = "0";
- }
- else
- {
- mwm.rightInfraredRayState = lv.Value.ToString();
- }
- break;
- case "AmplifierState":
- mwm.amplifierState = lv.Value.ToString();
- break;
- case "LampState":
- mwm.lampState = lv.Value.ToString();
- break;
- case "InfraredLeft":
- if (lv.Value.ToString() == "2")
- {
- mwm.frontInfraredRayState = "0";
- }
- else
- {
- mwm.frontInfraredRayState = lv.Value.ToString();
- }
- break;
- case "InfraredRight":
- if (lv.Value.ToString() == "2")
- {
- mwm.rearInfraredRayState = "0";
- }
- else
- {
- mwm.rearInfraredRayState = lv.Value.ToString();
- }
- break;
- case "ZeroWeightStatus":
- mwm.zeroState = lv.Value.ToString();
- break;
- case "RfidState":
- mwm.rfidState = lv.Value.ToString();
- break;
- }
- }
- }
- RESTfulResult<string> rms = meterWorkMonitor.doUpdateWf(mwm);
- }
- /// <summary>
- /// 新增零点报警的数据
- /// </summary>
- private void doInsertZeroAlarm()
- {
- if (!PbCache.isZeroAlarm)
- {
- PbCache.isZeroAlarm = true;
- MeterWorkZeroAlarm workZeroAlarm = new MeterWorkZeroAlarm();
- workZeroAlarm.zeroWeight = PbCache.collect.weight;
- workZeroAlarm.spotTypeNo = PbCache.sportInfo.spotTypeNo;
- workZeroAlarm.spotTypeName = PbCache.sportInfo.spotTypeName;
- workZeroAlarm.baseSpotNo = PbCache.sportInfo.baseSpotNo;
- workZeroAlarm.baseSpotName = PbCache.sportInfo.baseSpotName;
- workZeroAlarm.scalePointNo = PbCache.collect_no;
- workZeroAlarm.createManNo = PbCache.sportInfo.baseSpotNo;
- workZeroAlarm.createManName = PbCache.sportInfo.baseSpotName;
- RESTfulResult<String> rms = zeroAlarmService.doInsertZeroAlarm(workZeroAlarm);
- if (rms.Succeed)
- {
- l.WriteLog(20, "新增成功:" + workZeroAlarm.baseSpotName + ":" + workZeroAlarm.zeroWeight);
- }
- else
- {
- l.WriteLog(20, "操作失败:" + workZeroAlarm.baseSpotName + ":" + workZeroAlarm.zeroWeight + rms.Data + rms.Message);
- }
- }
- }
- private void button3_Click(object sender, EventArgs e)
- {
- string limsResult = "";
- JGLimsInterface gLimsInterface = new JGLimsInterface();
-
- }
- /// <summary>
- /// 查询重量信息,显示在界面上面
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button4_Click(object sender, EventArgs e)
- {
- try
- {
- string sqls = @"select '毛重:' || t.gross_weight / 1000 || ' T / 皮重:' || t.tare_weight / 1000 || ' T / 净重:' || t.net_weight / 1000 || ' T ' as text
- from meter_work_car_actual t where t.value_flag = '0' and T.Prediction_No = '" + txtPlanNo.Text + @"'";
- PbModelDbService<List<PbModelDb>> pbRelation = new PbModelDbService<List<PbModelDb>>();
- RESTfulResult<List<PbModelDb>> rmRelation = pbRelation.executeSqlDataWf(sqls);
- if (rmRelation.Succeed && rmRelation.Data != null && rmRelation.Data.Count > 0)
- {
- MessageBox.Show(rmRelation.Data[0].text);
- }
- else
- {
- MessageBox.Show("空");
- }
- }
- catch (Exception ex)
- {
-
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- isOpened = false;
- testFlag = true;
- PbCache.isTest= true;
- testWgt = (int)numericUpDown1.Value;
- //CollectModel model = new CollectModel();
- //model.weight = testWgt;
- //PbCache.collect = model;
- testCarNo = textBox1.Text.Trim();
- testPlanNo = txtPlanNo.Text.Trim();
- }
- private void Form1_FormClosing(object sender, FormClosingEventArgs e)
- {
- collection.Stop();
- imageCurlControl.Stop();
- sweepCodeClass.CloseThread();
- timer1.Stop();
- timer1.Dispose();
- }
- private bool SystemUpdate(bool isMessage)
- {
- ReleaseList releaseList = new ReleaseList(Application.StartupPath + @"\" + GlobalVariable.Instance.ReleaseFileName);
- DownloadTools dt = new DownloadTools();
- try
- {
- bool isDownload = dt.IsDownloadFile(GlobalVariable.Instance.LocalPath, GlobalVariable.Instance.ReleaseURL, GlobalVariable.Instance.ReleaseFileName);
- if (!isDownload)
- {
- if (isMessage) MessageBox.Show("无法连接到远程主机!", Application.ProductName);
- return false;
- }
- }
- catch (Exception e)
- {
- MessageBox.Show(e.Message);
- }
- bool flag = this.CheckUpdate(releaseList);
- if (flag)
- {
- MessageBox.Show("有新版本,现在更新");
- string t = dt.DownloadFile(Application.StartupPath, GlobalVariable.Instance.ReleaseURL, GlobalVariable.Instance.ApplicationUpdater);
- this.Close();
- Application.Exit();
- GC.Collect();
- Process.Start(Application.StartupPath + @"\" + GlobalVariable.Instance.ApplicationUpdater);
- return true;
- }
- else
- {
- if (isMessage) MessageBox.Show("你的系统已经是最新版本,不需要更新!", Application.ProductName);
- return false;
- }
- }
- private bool CheckUpdate(ReleaseList localRelease)
- {
- try
- {
- string fileNameAll = Application.StartupPath + "\\" + GlobalVariable.Instance.LocalPath + "\\" + GlobalVariable.Instance.ReleaseFileName;
- ReleaseList remoteRelease = new ReleaseList(fileNameAll);
- return (((localRelease != null) && (remoteRelease != null)) && localRelease.ReleaseDate.CompareTo(remoteRelease.ReleaseDate) < 0);
- }
- catch (Exception exception)
- {
- MessageBox.Show(exception.Message);
- }
- return false;
- }
- }
- }
|