فهرست منبع

动轨程序优化

BourneCao 3 سال پیش
والد
کامیت
14cf8f85d0

+ 95 - 21
CarMeterSystem/frmMain.cs

@@ -13,6 +13,7 @@ using System.Data;
 using System.Diagnostics;
 using System.Drawing;
 using System.Linq;
+using System.Threading;
 using System.Windows.Forms;
 using SystemOffLine;
 
@@ -103,8 +104,10 @@ namespace CarMeterSystem
             try
             {
                 this.Hide();
-                
+               
                 LoginCls lg = new LoginCls();
+                // 计量页
+                fcc = new frmOneYardToEnd();
                 timer1.Start();
 
                 //2021年6月21日 杨秀东添加
@@ -184,6 +187,9 @@ namespace CarMeterSystem
 
                         collection.EventDataCollectionArgs += new EventDataCollection(EventData);//数据采集及扫码信息
                         collection.Start(PbCache.sportInfo.baseSpotNo, PbCache.sportInfo.baseSpotName);
+                        StartWriteMonitor(0);//启动更新监控表线程
+                        // 数据提交线程
+
 
                         imageCurlControl.Start(); //图片上传线程
                         //新扫码线程
@@ -196,8 +202,7 @@ namespace CarMeterSystem
                             sweepCodeClass2.StartThreadSweep(AppConfigCache._comPara2); //扫码线程
                         }
 
-                        // 计量页
-                        fcc = new frmOneYardToEnd();
+                        
                     }
                     else
                     {
@@ -216,34 +221,60 @@ namespace CarMeterSystem
             //*/
         }
 
-        /// <summary>
-        /// 直接打开扫码计量界面
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
         private void timer1_Tick(object sender, EventArgs e)
         {
-            if (!isOpened && PbCache.collect?.weight > 500)
+            //timer1.Stop();
+            try
             {
-                l.WriteLog(31, "frmOneYardToEnd页面打开(timer1_Tick:frmMain),车号:" + PbCache.resultCarNo + "||" + (PbCache.collect == null ? "" : PbCache.collect.carno));
-                isOpened = true;
-                PbCache.bussinessTypeName = "";
-                PbCache.bussinessTypeCode = "";
-
-                try
+                if ( PbCache.collect?.weight > 500)
                 {
-                    if(fcc.Visible == false)
+                    PbCache.bussinessTypeName = "";
+                    PbCache.bussinessTypeCode = "";
+                    if (fcc.Visible == false)
                     {
                         fcc.Visible = true;
                         fcc.init();
                     }
                 }
-                catch
-                {
-                }
+                timer1.Interval = 1000;
+            }
+            catch (Exception ee)
+            {
+                //GlobalInstanceController.Instance.LastCallMessage = ee.Message;
+                timer1.Interval = 1000;
             }
+            //timer1.Start();
         }
 
+        /// <summary>
+        /// 直接打开扫码计量界面
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        //private void timer1_Tick(object sender, EventArgs e)
+        //{
+        //    if (!isOpened && PbCache.collect?.weight > 500)
+        //    {
+        //        l.WriteLog(31, "frmOneYardToEnd页面打开(timer1_Tick:frmMain),车号:" + PbCache.resultCarNo + "||" + (PbCache.collect == null ? "" : PbCache.collect.carno));
+        //        isOpened = true;
+        //        PbCache.bussinessTypeName = "";
+        //        PbCache.bussinessTypeCode = "";
+
+        //        try
+        //        {
+        //            if(fcc.Visible == false)
+        //            {
+        //                fcc.Visible = true;
+        //                fcc.init();
+        //            }
+        //        }
+        //        catch(Exception exp)
+        //        {
+
+        //        }
+        //    }
+        //}
+
         #region
         //*
 
@@ -573,7 +604,7 @@ namespace CarMeterSystem
                 //*/
 
                 // 更新监控表
-                doLive();
+                //doLive();
 
                 //重量大于500的情况下
                 if (e.weight > 500)
@@ -843,6 +874,8 @@ namespace CarMeterSystem
                 }
                 else
                 {
+                    isOpened = false; //下次上秤直接打开主界面
+
                     if (e.weight > 10 && e.weight < 500)
                     {
                         //重量小于500,大于10
@@ -859,7 +892,6 @@ namespace CarMeterSystem
                     {
                         PbCache.isZeroAlarm = false;
                     }
-                    isOpened = false; //下次上秤直接打开主界面
                     editCarNo = "";
                     firstCode = ""; //历史的扫码枪的值
                     preCarNo = "";
@@ -1024,6 +1056,7 @@ namespace CarMeterSystem
         /// </summary>
         private void doLive()
         {
+
             if (PbCache.collect_no == null)
             {
                 return;
@@ -1157,6 +1190,7 @@ namespace CarMeterSystem
         /// <param name="e"></param>
         private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
         {
+            StopWriteMonitor();//结束更新监控表线程
             collection.Stop();
             imageCurlControl.Stop();
             sweepCodeClass.CloseThread();
@@ -1247,5 +1281,45 @@ namespace CarMeterSystem
             }
             l.WriteLog(12, "测试扫码值" + rmsSweepCodeClass.Data);
         }
+
+        #region 更新监控表线程
+        //rxh add
+        private Thread thWriteMonitor;//更新监控表线程
+        private int writeMonitorInterval;//时间间隔
+        private void WriteMonitorInTime()
+        {
+            while (true)
+            {
+                try
+                {
+                    doLive();//更新监控表!!!!!!!!!!!
+                    writeMonitorInterval = 1000;
+                }
+                catch (Exception ee)
+                {
+                    //GlobalInstanceController.Instance.LastCallMessage = ee.Message;
+                    writeMonitorInterval = 5000;
+                }
+                Thread.Sleep(writeMonitorInterval);
+            }
+        }
+        private void StopWriteMonitor()
+        {
+            if (thWriteMonitor != null)
+            {
+                thWriteMonitor.Abort();
+                thWriteMonitor = null;
+            }
+        }
+        private void StartWriteMonitor(int interval)
+        {
+            writeMonitorInterval = (interval == 0 ? 1000 : interval);
+            if (thWriteMonitor == null)
+            {
+                thWriteMonitor = new Thread(WriteMonitorInTime);
+            }
+            thWriteMonitor.Start();
+        }
+        #endregion 更新监控表线程
     }
 }

+ 17 - 16
CarMeterSystem/frmOneYardToEnd.Designer.cs

@@ -54,9 +54,9 @@
             this.label9 = new System.Windows.Forms.Label();
             this.ucWeightT1 = new MeterModuleLibrary.ucWeightT();
             this.panelShowWeightJGNoUsed = new System.Windows.Forms.Panel();
+            this.btnSelPreType = new System.Windows.Forms.Button();
             this.ucCarFormButtomJXJG1 = new MeterModuleLibrary.uc.ucCarFormButtomJXJG();
             this.ucCarFormTop_Jisco1 = new MeterModuleLibrary.uc.ucCarFormTop_Jisco();
-            this.btnSelPreType = new System.Windows.Forms.Button();
             this.panelCarFormCentered.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.txtCarNo)).BeginInit();
             this.tableLayoutPanelPromptMsg.SuspendLayout();
@@ -349,6 +349,21 @@
             this.panelShowWeightJGNoUsed.TabIndex = 645;
             this.panelShowWeightJGNoUsed.Visible = false;
             // 
+            // btnSelPreType
+            // 
+            this.btnSelPreType.BackColor = System.Drawing.Color.DodgerBlue;
+            this.btnSelPreType.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+            this.btnSelPreType.Font = new System.Drawing.Font("楷体", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)), true);
+            this.btnSelPreType.ForeColor = System.Drawing.Color.White;
+            this.btnSelPreType.Location = new System.Drawing.Point(919, 687);
+            this.btnSelPreType.Name = "btnSelPreType";
+            this.btnSelPreType.Size = new System.Drawing.Size(234, 70);
+            this.btnSelPreType.TabIndex = 641;
+            this.btnSelPreType.Text = "选择计量类型";
+            this.btnSelPreType.UseVisualStyleBackColor = false;
+            this.btnSelPreType.Visible = false;
+            this.btnSelPreType.Click += new System.EventHandler(this.btnSelPreType_Click);
+            // 
             // ucCarFormButtomJXJG1
             // 
             this.ucCarFormButtomJXJG1.Dock = System.Windows.Forms.DockStyle.Bottom;
@@ -368,21 +383,6 @@
             this.ucCarFormTop_Jisco1.Size = new System.Drawing.Size(1280, 95);
             this.ucCarFormTop_Jisco1.TabIndex = 595;
             // 
-            // btnSelPreType
-            // 
-            this.btnSelPreType.BackColor = System.Drawing.Color.DodgerBlue;
-            this.btnSelPreType.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.btnSelPreType.Font = new System.Drawing.Font("楷体", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)), true);
-            this.btnSelPreType.ForeColor = System.Drawing.Color.White;
-            this.btnSelPreType.Location = new System.Drawing.Point(919, 687);
-            this.btnSelPreType.Name = "btnSelPreType";
-            this.btnSelPreType.Size = new System.Drawing.Size(234, 70);
-            this.btnSelPreType.TabIndex = 641;
-            this.btnSelPreType.Text = "选择计量类型";
-            this.btnSelPreType.UseVisualStyleBackColor = false;
-            this.btnSelPreType.Visible = false;
-            this.btnSelPreType.Click += new System.EventHandler(this.btnSelPreType_Click);
-            // 
             // frmOneYardToEnd
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -403,6 +403,7 @@
             this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmOneYardToEnd_FormClosing);
             this.Load += new System.EventHandler(this.frmOneYardToEnd_Load);
+            this.VisibleChanged += new System.EventHandler(this.frmOneYardToEnd_VisibleChanged);
             this.panelCarFormCentered.ResumeLayout(false);
             this.panelCarFormCentered.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.txtCarNo)).EndInit();

+ 298 - 98
CarMeterSystem/frmOneYardToEnd.cs

@@ -98,6 +98,7 @@ namespace CarMeterSystem
                 wgt = 0;
                 temporaryResult = "";
                 temporaryCarNo = "";
+                NewMessageArrived += new HandleMessageDelegate(OnMessageArrived);//rxh add
                 if (!string.IsNullOrEmpty(PbCache.sportInfo.ledIp) && PbCache.monitor.isTakeOver != "1" && PbCache.monitor.isTakeOver != "2")
                 {
                     led_controler = new LED_Control(PbCache.sportInfo.ledIp);
@@ -114,7 +115,8 @@ namespace CarMeterSystem
                     btnFH.Visible = true;
                 }
                 btnTare.Visible = false;
-                timer1.Start();
+                //timer1.Start();//rxh delete
+                //StartRefreshData(0);//rxh add
                 lbPointName.Text = PbCache.sportInfo.baseSpotName;
                 ucCarMeterInfoJisco1.setMeterType(PbCache.bussinessTypeName);
                 tableLayoutPanelPromptMsg.CellBorderStyle = (TableLayoutPanelCellBorderStyle)BorderStyle.FixedSingle;
@@ -132,9 +134,10 @@ namespace CarMeterSystem
 
         public void init()
         {
+            isMeasureSuccess = false;
 
             PbCache.mwPreFirst = meterWorkCarActualFirst;
-            
+
             PbCache.isPre = false;
 
             //不显示重量
@@ -147,7 +150,8 @@ namespace CarMeterSystem
             btnTare.Visible = false;
 
             btnSave.Enabled = true;
-            timer1.Start();
+            //timer1.Start();//rxh detele
+            StartRefreshData(0);//rxh add
             lbPointName.Text = PbCache.sportInfo.baseSpotName;
             ucCarMeterInfoJisco1.setMeterType(PbCache.bussinessTypeName);
             tableLayoutPanelPromptMsg.CellBorderStyle = (TableLayoutPanelCellBorderStyle)BorderStyle.FixedSingle;
@@ -175,7 +179,7 @@ namespace CarMeterSystem
                     }
                 }
 
-                if (PbCache.collect != null &&  PbCache.collect.weightStatus != 0)
+                if (PbCache.collect != null && PbCache.collect.weightStatus != 0)
                 {
                     return;
                 }
@@ -231,13 +235,14 @@ namespace CarMeterSystem
                 #endregion 红外对射及量程验证
 
                 //仪表重量验证
-                if (!dataValidity.ValidMethod(PbCache.lockWgt)) {
+                if (!dataValidity.ValidMethod(PbCache.lockWgt))
+                {
                     PbCache.isLockFrm = false;
                     btnSave.Enabled = true;
                     setMsg(PbCache.ResultMessage);
                     return;
                 }
- 
+
                 //物资名称验证与类型类型的关系验证;业务类型验证
                 if (!validMatterName.ValidMethod(preTrack))
                 {
@@ -650,7 +655,7 @@ namespace CarMeterSystem
 
                                     if (strRm.Data.result) //说明:标识当前跑了一个场景成功了;场景完成后则返回,不再进行下一个场景的执行操作;
                                     {
-                                        PbCache.ResultMessage = strRm.Data.resultInfo; 
+                                        PbCache.ResultMessage = strRm.Data.resultInfo;
                                         setMsg(PbCache.ResultMessage);
                                         Monitor(strRm.Data);
                                         if (!string.IsNullOrEmpty(PbCache.LEDResultMessage))
@@ -696,48 +701,48 @@ namespace CarMeterSystem
                             }
                             //else
                             //{
-                                //ExecuteMethod em = new ExecuteMethod();
-                                //try
-                                //{
-                                //    btnSave.Enabled = false;
-                                //    strRm = em.GetAndExecuteMethod<rtInfo>("MeterSceneLibrary", "OuterCarJISCO", "MeterMethod", new object[] { new PreTrackScale { } });
-                                //    if (!string.IsNullOrEmpty(strRm.ResultMessage))
-                                //    {
-                                //        setMsg(strRm.ResultMessage);
-                                //        strMsg = strRm.ResultMessage;
-                                //        PbCache.ResultMessage = strRm.ResultMessage;
-                                //    }
-                                //    else
-                                //    {
-                                //        setMsg(strRm.Data.resultInfo);
-                                //        strMsg = strRm.Data.resultInfo;
-                                //        PbCache.ResultMessage = strRm.Data.resultInfo;
-                                //    }
-                                //    if (!string.IsNullOrEmpty(PbCache.LEDResultMessage))
-                                //    {
-                                //        led_controler.setStaticLineMsg(PbCache.sportInfo.ledIp, PbCache.LEDResultMessage);
-                                //    }
-                                //    RESTfulResult<string> rms = monitor.doUpdateWf(new MeterWorkMonitor { pointNo = PbCache.sportInfo.baseSpotNo, ferroalloyResult = "1" });
-                                //    if (!rms.Succeed)
-                                //    {
-                                //        lg.WriteLog(3, PbCache.lockCarNo + "求助写入失败");
-                                //    }
-                                //    isStop = false;
-                                //}
-                                //catch (Exception exp)
-                                //{
-                                //    PbCache.ResultMessage = "获取计量场景信息失败,请点击语音求助";
-                                //    //这里是未找到方法的情况
-                                //    lg.WriteLog(3, "获取场景失败!" + strRm.ResultMessage);
-                                //    setMsg(PbCache.ResultMessage);
-                                //    if (!string.IsNullOrEmpty(PbCache.LEDResultMessage))
-                                //    {
-                                //        led_controler.setStaticLineMsg(PbCache.sportInfo.ledIp, PbCache.LEDResultMessage);
-                                //    }
-                                //    //break;
-                                //    isStop = false;
-                                //    return;
-                                //}
+                            //ExecuteMethod em = new ExecuteMethod();
+                            //try
+                            //{
+                            //    btnSave.Enabled = false;
+                            //    strRm = em.GetAndExecuteMethod<rtInfo>("MeterSceneLibrary", "OuterCarJISCO", "MeterMethod", new object[] { new PreTrackScale { } });
+                            //    if (!string.IsNullOrEmpty(strRm.ResultMessage))
+                            //    {
+                            //        setMsg(strRm.ResultMessage);
+                            //        strMsg = strRm.ResultMessage;
+                            //        PbCache.ResultMessage = strRm.ResultMessage;
+                            //    }
+                            //    else
+                            //    {
+                            //        setMsg(strRm.Data.resultInfo);
+                            //        strMsg = strRm.Data.resultInfo;
+                            //        PbCache.ResultMessage = strRm.Data.resultInfo;
+                            //    }
+                            //    if (!string.IsNullOrEmpty(PbCache.LEDResultMessage))
+                            //    {
+                            //        led_controler.setStaticLineMsg(PbCache.sportInfo.ledIp, PbCache.LEDResultMessage);
+                            //    }
+                            //    RESTfulResult<string> rms = monitor.doUpdateWf(new MeterWorkMonitor { pointNo = PbCache.sportInfo.baseSpotNo, ferroalloyResult = "1" });
+                            //    if (!rms.Succeed)
+                            //    {
+                            //        lg.WriteLog(3, PbCache.lockCarNo + "求助写入失败");
+                            //    }
+                            //    isStop = false;
+                            //}
+                            //catch (Exception exp)
+                            //{
+                            //    PbCache.ResultMessage = "获取计量场景信息失败,请点击语音求助";
+                            //    //这里是未找到方法的情况
+                            //    lg.WriteLog(3, "获取场景失败!" + strRm.ResultMessage);
+                            //    setMsg(PbCache.ResultMessage);
+                            //    if (!string.IsNullOrEmpty(PbCache.LEDResultMessage))
+                            //    {
+                            //        led_controler.setStaticLineMsg(PbCache.sportInfo.ledIp, PbCache.LEDResultMessage);
+                            //    }
+                            //    //break;
+                            //    isStop = false;
+                            //    return;
+                            //}
                             //}
                         }
                     }
@@ -783,10 +788,10 @@ namespace CarMeterSystem
                     _ = BeginInvoke(new Action(() => { shotImageScreen(); }));
 
                     string sPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "imgShort\\";
-                    
+
                     //获取正式目录文件中,本次tempID相关图片
                     ArrayList files = imageCurlControl.GetFiles(sPath + "formalImg", ".jpg");
-                    foreach(string filename in files)
+                    foreach (string filename in files)
                     {
                         // 将原图片重命名为正式图片名称
                         if (File.Exists(filename) && filename.Contains(PbCache.tempImgId))
@@ -804,7 +809,7 @@ namespace CarMeterSystem
                     temporaryResult = PbCache.ResultMessage;
                     temporaryCarNo = PbCache.collect.carno;
 
-                    
+
                     //提示信息,
                     //txtMsgInfo.Text = PbCache.ResultMessage;
                     lblog = string.IsNullOrEmpty(PbCache.ResultMessage) ? strMsg : PbCache.ResultMessage;//偶尔出现ResultMessage为空的情况
@@ -868,7 +873,7 @@ namespace CarMeterSystem
                             else
                                 ucWeightCarTJXJG1.setWeightType("毛重");
                         }
-                        
+
                     }));
                 }
                 catch (Exception ex)
@@ -882,11 +887,21 @@ namespace CarMeterSystem
                     lg.WriteLog(3, PbCache.lockCarNo + "称重保存失败:" + ex.Message);
                     PbCache.isLockFrm = false;
                     btnSave.Enabled = true;
+                    isStop = false;
                 }
             }
             catch (Exception ex)
             {
-                lg.WriteLog(13, PbCache.lockCarNo + "保存事件异常:" + ex.Message);
+                //语音播报
+                //vicPlayClass.GetVoicePlay("称重数据保存失败", PbCache.lockCarNo);
+                //提示信息,
+                //txtMsgInfo.Text = "称重数据保存失败";
+                lblog = "称重数据保存失败!" + ex.Message;
+                DoShowlbLog(lblog);
+                lg.WriteLog(3, PbCache.lockCarNo + "称重保存失败:" + ex.Message);
+                PbCache.isLockFrm = false;
+                btnSave.Enabled = true;
+                isStop = false;
             }
         }
 
@@ -903,9 +918,9 @@ namespace CarMeterSystem
 
                 PbModelDbService<string> pbp = new PbModelDbService<string>();
                 RESTfulResult<string> rmT = pbp.executeSqlDataWf(sqls);
-                if (rmT.Succeed && rmT.Data != null && rmT.Data.Length>10)
+                if (rmT.Succeed && rmT.Data != null && rmT.Data.Length > 10)
                 {
-                    
+
                 }
             }
             catch (Exception ex)
@@ -925,7 +940,8 @@ namespace CarMeterSystem
         /// <summary>
         /// 终端截图
         /// </summary>
-        public void shotImage() {
+        public void shotImage()
+        {
             try
             {
                 #region 截取图片信息
@@ -967,7 +983,7 @@ namespace CarMeterSystem
                 CameraShotCls cameraShot = new CameraShotCls();
                 cameraShot.CapMethod(tempID);
 
-                lg.WriteLog(35, "完成全部拍照    成功标识:" + PbCache.shotSuccess.ToString() +"车号:" + PbCache.lockCarNo + ";重量:" + PbCache.lockWgt + ";时间:" + DateTime.Now.ToLongTimeString());
+                lg.WriteLog(35, "完成全部拍照    成功标识:" + PbCache.shotSuccess.ToString() + "车号:" + PbCache.lockCarNo + ";重量:" + PbCache.lockWgt + ";时间:" + DateTime.Now.ToLongTimeString());
 
                 //*/
 
@@ -1029,12 +1045,12 @@ namespace CarMeterSystem
 
         //验证校秤数据
         private validCalibration vCalib = new validCalibration();
-        
+
         //验证对射
         private validParkStatus valid = new validParkStatus();
         //是否已经播放不验证对射语音
         bool isPlayCalibVoice = false;
-        
+
         //是否已经播放停留超时语音
         bool isPlayOvertimeVoice = false;
 
@@ -1078,6 +1094,10 @@ namespace CarMeterSystem
         MeterBaseCar resgiterCarTimer = new MeterBaseCar();
         frmMatMsgInfo frmMatMsgInfo = new frmMatMsgInfo();
         private void timer1_Tick(object sender, EventArgs e)
+        {
+            DualWeight();//rxh modify
+        }
+        private void DualWeight()
         {
             if (!isStop)
             {
@@ -1088,7 +1108,7 @@ namespace CarMeterSystem
                 }
                 try
                 {
-                    
+
 
                     if (PbCache.collect.weight < 500)
                     {
@@ -1097,8 +1117,9 @@ namespace CarMeterSystem
                         ucWeightCarTJXJG1.setWgtBackColor(false);
                         isCalibration = true;
                         PbCache.addWgt = 0;
-                        this.Hide();
-                        hidWindow();
+                        InRuning = false;//rxh add
+                                         //this.Hide();//rxh detele
+                                         //hidWindow();//rxh detele
                         return;
                     }
                     else
@@ -1189,7 +1210,7 @@ namespace CarMeterSystem
                             if (!string.IsNullOrEmpty(PbCache.monitor.isOverWgt) && PbCache.monitor.isTakeOver == "2" && !isOverSound) //&& !PbCache.isLockFrm)
                             {
                                 ucWeightCarTJXJG1.setWgtBackColor(true);//称重完成后,显示颜色;
-                                //txtMsgInfo.Text = "计量完成";
+                                                                        //txtMsgInfo.Text = "计量完成";
                                 setMsg("计量完成");
                                 vicPlayClass.GetVoicePlay("计量完成,请离开秤台", PbCache.collect.carno);
                                 PbCache.voiceType = 1;
@@ -1416,7 +1437,7 @@ namespace CarMeterSystem
                                 carService.addCar(new MeterBaseCar { carNo = PbCache.collect.carno, carTypeNo = AppConfigCache.carTypeNo, carTypeName = AppConfigCache.carTypeName });
                                 registerCar = true;
                             }
-                            
+
                         }
                     }
 
@@ -1438,9 +1459,9 @@ namespace CarMeterSystem
                             led_controler.setStaticLineMsg(PbCache.sportInfo.ledIp, "车号未识别,请联系处理");
                             return;
                         }
-                        
 
-                        resCarListScaleTimer = carService.doQueryCarList(new MeterBaseCar { carNo = PbCache.collect.carno, validFlag = "0" }); 
+
+                        resCarListScaleTimer = carService.doQueryCarList(new MeterBaseCar { carNo = PbCache.collect.carno, validFlag = "0" });
                         if (resCarListScaleTimer.Succeed)
                         {
                             if (resCarListScaleTimer.Data != null && resCarListScaleTimer.Data.Count == 1)
@@ -1449,7 +1470,8 @@ namespace CarMeterSystem
                                 //厂内车辆
                                 if (carScaleTimer.carTypeNo == "001004003")
                                 {
-                                    btnSelPreType.Visible = true;
+                                    //btnSelPreType.Visible = true;
+                                    setMsgInfo(btnSelPreType, "true", "2");//rxh add
                                     preTrackScaleCarTimer.carNo = PbCache.collect.carno;
                                     preTrackScaleCarTimer.lineDesc = "1";
                                     rmScaleListCarTimer = PreTrackScaleService.doQueryByFlag(preTrackScaleCarTimer);
@@ -1556,7 +1578,8 @@ namespace CarMeterSystem
                                     }
 
                                     PbCache.isLockFrm = false;
-                                    btnSave.Enabled = true;
+                                    //btnSave.Enabled = true;//rxh add
+                                    setMsgInfo(btnSave, "true", "2");//rxh add
 
                                     rtInfo rt = new rtInfo();
                                     rt.isWarn = true;
@@ -1565,7 +1588,7 @@ namespace CarMeterSystem
 
                                     if (!string.IsNullOrEmpty(PbCache.collect.carno))
                                     {
-                                        
+
                                         resgiterCarTimer.carNo = PbCache.collect.carno;
                                         resgiterCarTimer.carTypeNo = AppConfigCache.carTypeNo;
                                         resgiterCarTimer.carTypeName = AppConfigCache.carTypeName;
@@ -1585,11 +1608,11 @@ namespace CarMeterSystem
                         PbCache.lockWgt = PbCache.collect.weight;
 
                         //2021年3月15日 期限皮重显示按钮的显示方法修改 isShowBtnTare   ValidMethod
-                        if (termTareCar.isShowBtnTare(TrackCarNo))
-                        {
-                            lg.WriteLog(3, string.Format("9车辆[{0}进入期限皮重显示按钮的显示判断", TrackCarNo));
-                            btnTare.Visible = true;
-                        }
+                        //if (termTareCar.isShowBtnTare(TrackCarNo))
+                        //{
+                        //  lg.WriteLog(3, string.Format("9车辆[{0}进入期限皮重显示按钮的显示判断", TrackCarNo));
+                        //  btnTare.Visible = true;
+                        //}
                         //
 
                         #endregion 查一次是否可留期限皮,可以则显示按钮
@@ -1607,15 +1630,23 @@ namespace CarMeterSystem
                             //2021年5月10日界面显示单位,调整为T
                             if (PbCache.collect.weight > firstWgt)
                             {
-                                txtGroess.Text = Math.Round((double)PbCache.collect.weight / 1000, 2) + "";
-                                txtTare.Text = Math.Round(firstWgt / 1000, 2) + "";
+                                //txtGroess.Text = Math.Round((double)PbCache.collect.weight / 1000, 2) + "";
+                                //txtTare.Text = Math.Round(firstWgt / 1000, 2) + "";
+                                //rxh modify
+                                setMsgInfo(txtGroess, Math.Round((double)PbCache.collect.weight / 1000, 2) + "", "0");
+                                setMsgInfo(txtTare, Math.Round(firstWgt / 1000, 2) + "", "0");
                             }
                             else
                             {
-                                txtTare.Text = Math.Round((double)PbCache.collect.weight / 1000, 2) + "";
-                                txtGroess.Text = Math.Round(firstWgt / 1000, 2) + "";
+                                //txtTare.Text = Math.Round((double)PbCache.collect.weight / 1000, 2) + "";
+                                //txtGroess.Text = Math.Round(firstWgt / 1000, 2) + "";
+                                //rxh modify
+                                setMsgInfo(txtTare, Math.Round((double)PbCache.collect.weight / 1000, 2) + "", "0");
+                                setMsgInfo(txtGroess, Math.Round(firstWgt / 1000, 2) + "", "0");
                             }
-                            txtNet.Text = Math.Round(Math.Abs(PbCache.collect.weight - firstWgt) / 1000, 2) + "";
+                            //txtNet.Text = Math.Round(Math.Abs(PbCache.collect.weight - firstWgt) / 1000, 2) + "";
+                            //rxh modify
+                            setMsgInfo(txtNet, Math.Round(Math.Abs(PbCache.collect.weight - firstWgt) / 1000, 2) + "", "0");
                         }
                     }
 
@@ -1631,7 +1662,8 @@ namespace CarMeterSystem
                         {
                             if (!btnSave.Visible)//PbCache.isLockFrm
                             {
-                                btnSave.Visible = true;
+                                //btnSave.Visible = true;//rxh delete
+                                setMsgInfo(btnSave, "true", "2");//rxh add
                             }
                             if (!isVoiceDownCar)
                             {
@@ -1651,7 +1683,8 @@ namespace CarMeterSystem
                                 lg.WriteLog(25, PbCache.lockCarNo + "Sleep后点击保存按钮");
                                 if (PbCache.collect.weight > 500)
                                 {
-                                    this.btnSave.PerformClick();
+                                    //this.btnSave.PerformClick();//rxh deleted
+                                    setMsgInfo(btnSave, "true", "7");//rxh add
                                 }
                                 lg.WriteLog(25, PbCache.lockCarNo + "PerformClick后保存按钮");
                             }
@@ -1662,7 +1695,8 @@ namespace CarMeterSystem
                             if (!btnSave.Enabled)
                             {
                                 PbCache.isLockFrm = false;
-                                btnSave.Enabled = true;
+                                //btnSave.Enabled = true;//rxh delete
+                                setMsgInfo(btnSave, "true", "2");//rxh add
                             }
                         }
 
@@ -1686,7 +1720,8 @@ namespace CarMeterSystem
 
                         if (btnSave.Visible && !PbCache.isLockFrm)
                         {
-                            btnSave.Visible = false;
+                            //btnSave.Visible = false;//rxh delete
+                            setMsgInfo(btnSave, "false", "2");//rxh add
                             lg.WriteLog(14, "车号:" + PbCache.collect.carno + ";对射没对准【" + PbCache.monitorResult.valid_park_status + "】" +
                                 "||重量不是绿色【" + ucWeightT1.isGreenWgt + "】" +
                                 "||重量不稳定 0:重量稳定; 1:重量不稳定;  2:空磅【" + PbCache.collect.weightStatus + "】" +
@@ -1706,15 +1741,61 @@ namespace CarMeterSystem
                 }
             }
         }
+        #region 信息提示框
+        //rxh add
+        public void setMsgInfo(Control control, string ResultMessage, string sType)
+        {
+            setMsgMsg(control, ResultMessage, sType);
+        }
+        private void setMsgMsg(Control control, string ResultMessage, string sType)
+        {
+            if (control.InvokeRequired)
+            {
+                Action<Control, string, string> action = new Action<Control, string, string>(setMsgInfo);
+                Invoke(action, new object[] { control, ResultMessage, sType });
+            }
+            else
+            {
+                switch (sType)
+                {
+                    case "0":
+                        control.Text = ResultMessage;
+                        ; break;
+                    case "1":
+                        control.Enabled = ResultMessage == "true" ? true : false;
+                        ; break;
+                    case "2":
+                        control.Visible = ResultMessage == "true" ? true : false;
+                        ; break;
+                    case "3":
+                        ((RadioButton)control).Checked = ResultMessage == "true" ? true : false;
+                        break;
+                    case "4":
+                        ((ComboBox)control).SelectedValue = ResultMessage;
+                        break;
+                    case "5":
+                        ((RadioButton)control).Visible = ResultMessage == "true" ? true : false;
+                        break;
+                    case "6":
+                        ((CheckBox)control).Checked = ResultMessage == "true" ? true : false;
+                        break;
+                    case "7":
+                        ((Button)control).PerformClick();
+                        break;
+                    default: break;
+                }
+            }
+        }
 
+        #endregion 信息提示框
         /// <summary>
         /// 是否是联达物料 0否1是
         /// </summary>
         /// <param name="matterNo"></param>
         /// <returns></returns>
-        private bool setLianDaMat(string matterNo) 
+        private bool setLianDaMat(string matterNo)
         {
-            if (lianDaQuery == null) 
+            if (lianDaQuery == null)
             {
                 RESTfulResult<MeterBaseMatterInfo> result = matterInfoService.doQueryId(matterNo);
                 if (result.Succeed)
@@ -1868,7 +1949,7 @@ namespace CarMeterSystem
                 //lg.WriteLog(1, "打印第一个sql:" + sql);
 
                 if (rm.Succeed)
-                {                  
+                {
                     if (rm.Data != null && rm.Data.Count > 0)
                     {
                         //2021年6月26日 对一车联运的进行处理;用一次计量编号查二次计量数据,
@@ -2196,7 +2277,7 @@ namespace CarMeterSystem
                     btnTare.Enabled = true;
                     return;
                 }
-               
+
                 //若存在有效的一次计量数据,则不允许进行期限皮重保存
                 if (!termTareCar.ValidActualFirst(preTrack))
                 {
@@ -2240,13 +2321,13 @@ namespace CarMeterSystem
 
                 //期限皮重数据保存
                 RESTfulResult<string> RESTfulResult = termTareDate.doSaveWf(mbttd, monitorNote);
-                if (RESTfulResult.Succeed && RESTfulResult.Code !="500")
+                if (RESTfulResult.Succeed && RESTfulResult.Code != "500")
                 {
                     PbCache.isLockFrm = true;
                     PbCache.actualFirstNo = RESTfulResult.Data;
                     //称重完成后,显示颜色;
                     _ = BeginInvoke(new Action(() => { ucWeightCarTJXJG1.setWgtBackColor(true); }));
-                    
+
                     //称重完成后,显示重量类型为皮重;
                     _ = BeginInvoke(new Action(() => { ucWeightCarTJXJG1.setWeightType("皮重"); }));
 
@@ -2373,7 +2454,7 @@ namespace CarMeterSystem
             }
             if (!string.IsNullOrEmpty(ResultMessage) && PbCache.collect != null)
             {
-                lg.WriteLog(9, "[" + PbCache.collect.carno + "||"+PbCache.lockCarNo+"]" + ResultMessage);
+                lg.WriteLog(9, "[" + PbCache.collect.carno + "||" + PbCache.lockCarNo + "]" + ResultMessage);
             }
 
             #region 记录从上秤到下秤的所有的提示信息
@@ -2439,12 +2520,13 @@ namespace CarMeterSystem
                 PbCache.monitor.isOverWgt = "";
                 bRailwayActual = true; //为true时会重新查询一次计量数据
                 isShowRecover = true;//是否去查询“复磅”按钮的显示与否
-                isMeasureSuccess = false;
+                
                 PbCache.Load();
                 //关闭一些线程及定时任务
-                timer1.Stop();
-                timer1.Enabled = false;
-                //timer1.Dispose();
+                // timer1.Stop();//rxh delete
+                //timer1.Enabled = false;//rxh delete
+               
+                                  //timer1.Dispose();
 
                 // 销毁对象
                 CleanObjectData();
@@ -2538,7 +2620,7 @@ namespace CarMeterSystem
                 {
                     meterWorkMonitor.validIsPre = "1";
                 }
-                if(rt.WarnContent == "validWgt")
+                if (rt.WarnContent == "validWgt")
                 {
                     meterWorkMonitor.wgtErr = "1";
                 }
@@ -2658,7 +2740,7 @@ namespace CarMeterSystem
                     break;
             }
 
-            if(PbCache.collect.weight > 500 && PbCache.voiceType != 0)
+            if (PbCache.collect.weight > 500 && PbCache.voiceType != 0)
             {
                 vicPlayClass.GetVoicePlay(voiceContent, PbCache.lockCarNo);
             }
@@ -2781,7 +2863,7 @@ namespace CarMeterSystem
             PbCache.mwPreFirst.theoryAmount = null;
             PbCache.mwPreFirst.measureBatchCount = null;
 
-    }
+        }
         #endregion
 
         private void btnSelPreType_Click(object sender, EventArgs e)
@@ -2796,5 +2878,123 @@ namespace CarMeterSystem
                 MessageBox.Show("车号为空");
             }
         }
+        #region 刷新刷新站点状态信息线程
+        //rxh add
+        private Thread thRefreshData;//刷新刷新站点状态信息线程
+        private int refreshDataInterval;
+        private void RefreshDataInTime()
+        {
+            while (InRuning)
+            {
+                try
+                {
+                    DualWeight();
+                    refreshDataInterval = 1000;
+                }
+                catch (Exception ee)
+                {
+                    //GlobalInstanceController.Instance.LastCallMessage = ee.Message;
+                    refreshDataInterval = 1000;
+                }
+                Thread.Sleep(refreshDataInterval);
+            }
+        }
+        private void StopRefreshData()
+        {
+            if (thRefreshData != null)
+            {
+                thRefreshData.Abort();
+                thRefreshData = null;
+            }
+        }
+        private void StartRefreshData(int interval)
+        {
+            refreshDataInterval = (interval == 0 ? 1000 : interval);
+            StopRefreshData();
+            if (thRefreshData == null)
+            {              
+                thRefreshData = new Thread(RefreshDataInTime);   
+            }
+            InRuning = true;
+            thRefreshData.Start();
+
+        }
+        #endregion 刷新刷新站点状态信息线程
+        #region 消息
+        //rxh add
+        public delegate void HandleMessageDelegate(object sender, object args);
+        public event HandleMessageDelegate NewMessageArrived;
+
+        private bool inRuning;
+        public bool InRuning
+        {
+            get { return this.inRuning; }
+            set
+            {
+                this.inRuning = value;
+                this.SafeInvokeMessagedEvent(NewMessageArrived, this.inRuning);
+            }
+        }
+
+        private void SafeInvokeMessagedEvent(HandleMessageDelegate eventName, object args)
+        {
+            if (eventName != null)
+            {
+                HandleMessageDelegate mh = null;
+
+                foreach (Delegate del in eventName.GetInvocationList())
+                {
+                    try
+                    {
+                        mh = (HandleMessageDelegate)del;
+                        mh(this, args);
+                    }
+                    catch (Exception e)
+                    {
+                        lg.WriteLog(13,"线程错误");
+                        //NewMessageArrived -= mh;
+                    }
+                }
+            }
+        }
+        /// <summary>
+        /// 任务栏显示消息事件
+        /// </summary>
+        private void OnMessageArrived(object sender, object args)
+        {
+            if (this.InvokeRequired)
+                this.Invoke(new HandleMessageDelegate(this.OnMessageArrived), new object[] { sender, args });
+            else
+            {
+                if (args.ToString().Equals("False"))
+                {
+                    //Thread.Sleep(1000);//不能用,会和close冲突
+                    //this.Close();
+
+                    try
+                    {                      
+                        this.hidWindow();
+                        this.Hide();
+                        //this.StopRefreshData();
+                    }
+                    catch (Exception ee)
+                    {
+                        lg.WriteLog(13, "页面关闭事件exp:"+ee.Message.ToString());
+                    }
+
+                }
+            }
+        }
+        #endregion 消息
+
+        private void frmOneYardToEnd_VisibleChanged(object sender, EventArgs e)
+        {
+            if (this.Visible == false)
+
+            {
+                //Thread.Sleep(1000);
+                //this.StopRefreshData();
+            }
+        }
     }
 }

+ 6 - 0
Common/cacheCls/PbCache.cs

@@ -4,6 +4,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using Newtonsoft.Json.Linq;
 
 namespace Common
 {
@@ -382,6 +383,11 @@ namespace Common
         /// </summary>
         public static bool shotSuccess { get; set; }
 
+        /// <summary>
+        /// 数采实时库返回结果
+        /// </summary>
+        public static JArray jArray { get; set; }
+
 
         #region 扫码器相关
         /// <summary>

+ 2 - 2
Common/database/MemoryTableDataSocket.cs

@@ -155,9 +155,9 @@ namespace Common
         {
             try
             {
-                Log.GetInstance().WriteLog(36, "开始读取数采实时库    车号:" + PbCache.lockCarNo + ";重量:" + PbCache.lockWgt + ";时间:" + DateTime.Now.ToLongTimeString());
+                Log.GetInstance().WriteLog(36, "开始读取数采实时库    车号:" + PbCache.lockCarNo + ";重量:" + PbCache.collect.weight + ";时间:" + DateTime.Now.ToLongTimeString());
                 List<Track> arr = (List<Track>)cln.CallRpc<Track>("Track.Table:select", new object[] { PointIdKey });//读
-                Log.GetInstance().WriteLog(36, "完成读取数采实时库    车号:" + PbCache.lockCarNo + ";重量:" + PbCache.lockWgt + ";时间:" + DateTime.Now.ToLongTimeString());
+                Log.GetInstance().WriteLog(36, "完成读取数采实时库    车号:" + PbCache.lockCarNo + ";重量:" + PbCache.collect.weight + ";时间:" + DateTime.Now.ToLongTimeString());
 
                 if (arr != null && arr.Count > 0)
                 {

+ 61 - 6
MeterModuleLibrary/uc/ucCarMeterInfoJisco.cs

@@ -60,12 +60,20 @@ namespace MeterModuleLibrary
                     predictionTypeName = "混装";
                     break;
             }
-            txtMETER_TYPE.Text = first.meterTypeName;
-            txtPREDICTION_NO.Text = first.predictionNo;
-            txtMATTER_NAME.Text = first.matterName;
-            txtFORWARDING_UNIT_NAME.Text = first.forwardingUnitName;
-            txtRECEIVING_UINT_NAME.Text = first.receivingUintName;
-            txtCONTRACT_NO.Text = predictionTypeName;
+            //txtMETER_TYPE.Text = first.meterTypeName;
+            //txtPREDICTION_NO.Text = first.predictionNo;
+            //txtMATTER_NAME.Text = first.matterName;
+            //txtFORWARDING_UNIT_NAME.Text = first.forwardingUnitName;
+            //txtRECEIVING_UINT_NAME.Text = first.receivingUintName;
+            //txtCONTRACT_NO.Text = predictionTypeName;
+
+            setMsgInfo(txtMETER_TYPE, first.meterTypeName, "0");
+            setMsgInfo(txtPREDICTION_NO, first.predictionNo, "0");
+            setMsgInfo(txtMATTER_NAME, first.matterName, "0");
+            setMsgInfo(txtFORWARDING_UNIT_NAME, first.forwardingUnitName, "0");
+            setMsgInfo(txtRECEIVING_UINT_NAME, first.receivingUintName, "0");
+            setMsgInfo(txtCONTRACT_NO, predictionTypeName, "0");
+
             //txtSHIPMENT_WEIGHT.Text = "毛/净:" + first.shipmentGrossWeight / 1000 + " T / " + first.shipmentNetWeight / 1000 + " T"; //预报毛重
             //txtLOAD_POINT_NAME.Text = first.loadPointName;
             string strMemo = first.memo;
@@ -166,5 +174,52 @@ namespace MeterModuleLibrary
                 }
             }
         }
+
+        #region 信息提示框
+        public void setMsgInfo(Control control, string ResultMessage, string sType)
+        {
+            setMsgMsg(control, ResultMessage, sType);
+        }
+        private void setMsgMsg(Control control, string ResultMessage, string sType)
+        {
+            if (control.InvokeRequired)
+            {
+                Action<Control, string, string> action = new Action<Control, string, string>(setMsgInfo);
+                Invoke(action, new object[] { control, ResultMessage, sType });
+            }
+            else
+            {
+                switch (sType)
+                {
+                    case "0":
+                        control.Text = ResultMessage;
+                        ; break;
+                    case "1":
+                        control.Enabled = ResultMessage == "true" ? true : false;
+                        ; break;
+                    case "2":
+                        control.Visible = ResultMessage == "true" ? true : false;
+                        ; break;
+                    case "3":
+                        ((RadioButton)control).Checked = ResultMessage == "true" ? true : false;
+                        break;
+                    case "4":
+                        ((ComboBox)control).SelectedValue = ResultMessage;
+                        break;
+                    case "5":
+                        ((RadioButton)control).Visible = ResultMessage == "true" ? true : false;
+                        break;
+                    case "6":
+                        ((CheckBox)control).Checked = ResultMessage == "true" ? true : false;
+                        break;
+                    case "7":
+                        ((Button)control).PerformClick();
+                        break;
+                    default: break;
+                }
+            }
+        }
+
+        #endregion 信息提示框
     }
 }

+ 3 - 0
MeterPlugInLibrary/实时库数据采集/DataCollectionControl.cs

@@ -135,6 +135,9 @@ namespace MeterPlugInLibrary
                     //if (icount > 4)
                     {
                         icount = 0;
+                        // 将数据提交移出数据采集线程
+                        // 避免HTTP数据提交影响到数据采集的刷新
+                        // By BourneCao 20220811
                         EventDataCollectionArgs(this, arg);
                     }
                 }

+ 3 - 1
MeterSceneLibrary/JISCO/InnerCarJISCO.cs

@@ -113,7 +113,8 @@ namespace MeterSceneLibrary
                 else if (list == null || list.Count == 1)
                 {
                     // 历史皮重验证
-                    rt = saveMethod.validHisTare(list[0].weightTypeNo);
+                    // 001033002:皮重
+                    rt = saveMethod.validHisTare2(list[0].weightTypeNo);
                     if (list[0].weightTypeNo == "001033002" && PbCache.monitorResult.valid_wgt == false && listMonitor.Data[0].validWgt == "1")
                     {
                         
@@ -126,6 +127,7 @@ namespace MeterSceneLibrary
                         rt.WarnContent = "validWgt";
                         return rt;
                     }
+                    // 001033001:毛重
                     if (list[0].weightTypeNo == "001033001" && PbCache.monitorResult.valid_wgt == true && listMonitor.Data[0].validWgt == "1")
                     {
                         

+ 82 - 1
MeterSceneLibrary/JISCO/private/SaveMethod.cs

@@ -796,7 +796,7 @@ namespace MeterSceneLibrary.JISCO
                     else
                     {
                         PbCache.monitorResult.valid_wgt = false;
-                        PbCache.ResultMessage = "当前皮重【" + PbCache.lockWgt / 1000 + "T 】在皮重配置范围,历史皮重为【" + Convert.ToDouble(meterWeight) / 1000 + "T】,偏差最大允许重量为【" + hisTareCount.fixedWeightValue.Value + "kg】";
+                        PbCache.ResultMessage = "当前皮重【" + PbCache.lockWgt / 1000 + "T 】在皮重配置范围,历史皮重为【" + Convert.ToDouble(meterWeight) / 1000 + "T】,偏差最大允许重量为【" + hisTareCount.fixedWeightValue.Value + "kg】";
                     }
                 }
                 else if (hisTareCount.countTypeNo == "001011002") //比例 当前重量>=历史皮重-历史皮重*比例   当前重量<=历史皮重+历史皮重*比例
@@ -835,6 +835,87 @@ namespace MeterSceneLibrary.JISCO
             return rt;
         }
 
+        /// <summary>
+        /// 验证历史皮重,只计算不报警
+        /// </summary>
+        /// <param name="WeightType"></param>
+        /// <returns></returns>
+        public rtInfo validHisTare2(string WeightType = "001033001")
+        {
+            // 查询当前秤点是否启用历史皮重判断(暂时不考虑此限制)By BourneCao
+            //String spotNo = PbCache.sportInfo.baseSpotNo;
+
+            /* 判断当前重量是否满足历史皮重相应限制 */
+            // 读取车辆历史皮重信息
+            List<MeterBaseHisTareData> validHis = getHisTare(PbCache.lockCarNo);
+
+            // 读取历史皮重计算配置
+            MeterBaseHisTareCount hisTareCount = PbCache.tareCount;
+
+            // 没有历史皮重记录,相关操作都可跳过
+            if (validHis.Count >= 1)
+            {
+                double maxWgt = 0, minWgt = 0, wgt = PbCache.lockWgt;
+
+                if (hisTareCount.countTypeNo == "001011001") //固重 当前重量>=历史皮重-固重   当前重量<=历史皮重+固重
+                {
+                    long meterWeight = (PbCache.tareCount.contrastTypeNo == "001012001" ? validHis[0].upWeight.Value : validHis[0].meterWeight.Value);
+
+                    maxWgt = meterWeight + hisTareCount.fixedWeightValue.Value;
+                    minWgt = meterWeight - hisTareCount.fixedWeightValue.Value;
+
+                    if (PbCache.lockWgt >= minWgt && PbCache.lockWgt <= maxWgt)
+                    {
+                        PbCache.monitorResult.valid_wgt = true;
+                    }
+                    else
+                    {
+                        PbCache.monitorResult.valid_wgt = false;
+                        //PbCache.ResultMessage = "当前皮重【" + PbCache.lockWgt / 1000 + "T 】不在皮重配置范围,历史皮重为【" + Convert.ToDouble(meterWeight) / 1000 + "T】,偏差最大允许重量为【" + hisTareCount.fixedWeightValue.Value + "kg】";
+                    }
+                }
+                else if (hisTareCount.countTypeNo == "001011002") //比例 当前重量>=历史皮重-历史皮重*比例   当前重量<=历史皮重+历史皮重*比例
+                {
+                    long meterWeight = (PbCache.tareCount.contrastTypeNo == "001012001" ? validHis[0].upWeight.Value : validHis[0].meterWeight.Value);
+
+                    maxWgt = meterWeight + meterWeight * (hisTareCount.rateValue.Value / 100); //历史皮重+历史皮重*比例
+                    minWgt = meterWeight - meterWeight * (hisTareCount.rateValue.Value / 100); //历史皮重-历史皮重*比例
+
+                    if (PbCache.lockWgt >= minWgt && PbCache.lockWgt <= maxWgt)
+                    {
+                        PbCache.monitorResult.valid_wgt = true;
+                    }
+                    else
+                    {
+                        PbCache.monitorResult.valid_wgt = false;
+                        //PbCache.ResultMessage = "当前皮重【" + PbCache.lockWgt / 1000 + "T 】不在皮重配置范围,历史皮重为【" + (double)Convert.ToDouble(meterWeight) / 1000 + "T】,偏差最大允许比例值为【" + hisTareCount.fixedWeightValue.Value + "%】";
+                    }
+                }
+                else
+                {
+                    PbCache.monitorResult.valid_wgt = false;
+                    //PbCache.ResultMessage = string.Format("未找到历史皮重计算类型{0}配置数据", hisTareCount.countTypeNo);
+                }
+            }
+            else
+            {
+                // 皮重
+                if (WeightType == "001033002")
+                {
+                    PbCache.monitorResult.valid_wgt = true;
+                }
+                // 毛重
+                else
+                {
+                    PbCache.monitorResult.valid_wgt = false;
+                }
+                //PbCache.monitorResult.valid_wgt = true;
+                //PbCache.ResultMessage = "0";
+            }
+
+            return rt;
+        }
+
         public List<MeterBaseHisTareData> getHisTare(string carNo)
         {
             List<MeterBaseHisTareData> lmhtd = new List<MeterBaseHisTareData>();