Kaynağa Gözat

提交代码

BourneCao 3 yıl önce
ebeveyn
işleme
3ff15b17e1

+ 65 - 18
CarMeterSystem/Form1.cs

@@ -443,39 +443,85 @@ namespace CarMeterSystem
                 //}
 
                 // 司机扫码为空,取工控机二维码
-                if (string.IsNullOrEmpty(sweepCodeClass2.StrCode))
+                if (PbCache.sportInfo.scanRequireValid == "1")
                 {
-                    if (string.IsNullOrEmpty(sweepCodeClass.StrCode))
+                    if (PbCache.monitor.isValidScan == "0")
                     {
-                        if (string.IsNullOrEmpty(PbCache.strCode))
+                        if (string.IsNullOrEmpty(sweepCodeClass2.StrCode))
                         {
-                            codeFlag = false;
-                            firstCode = "";
-                            PbCache.strCode = "";
-                            //l.WriteLog(12, "主线程扫码值为空时清空;sweepCodeClass.StrCode值为" + sweepCodeClass.StrCode + " ;PbCache.strCode值为:" + PbCache.strCode);
-                        }
-                    }
-                    else
-                    {
-                        if (sweepCodeClass.StrCode.Substring(0, 3) == "TWB")
-                        {
-                            DecodeQRCodeYMT(sweepCodeClass.StrCode);
+                            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
+                            {
+                                if (sweepCodeClass.StrCode.Substring(0, 3) == "TWB")
+                                {
+                                    DecodeQRCodeYMT(sweepCodeClass.StrCode);
+                                }
+                                else
+                                {
+                                    DecodeQRCode(sweepCodeClass.StrCode);
+                                }
+                            }
                         }
                         else
                         {
-                            DecodeQRCode(sweepCodeClass.StrCode);
+                            if (sweepCodeClass2.StrCode.Substring(0, 3) == "TWB")
+                            {
+                                DecodeQRCodeYMT(sweepCodeClass2.StrCode);
+                            }
+                            else
+                            {
+                                DecodeQRCode(sweepCodeClass2.StrCode);
+                            }
+
                         }
                     }
                 }
                 else
                 {
-                    if (sweepCodeClass2.StrCode.Substring(0, 3) == "TWB")
+                    if (string.IsNullOrEmpty(sweepCodeClass2.StrCode))
                     {
-                        DecodeQRCodeYMT(sweepCodeClass2.StrCode);
+                        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
+                        {
+                            if (sweepCodeClass.StrCode.Substring(0, 3) == "TWB")
+                            {
+                                DecodeQRCodeYMT(sweepCodeClass.StrCode);
+                            }
+                            else
+                            {
+                                DecodeQRCode(sweepCodeClass.StrCode);
+                            }
+                        }
                     }
                     else
                     {
-                        DecodeQRCode(sweepCodeClass2.StrCode);
+                        if (sweepCodeClass2.StrCode.Substring(0, 3) == "TWB")
+                        {
+                            DecodeQRCodeYMT(sweepCodeClass2.StrCode);
+                        }
+                        else
+                        {
+                            DecodeQRCode(sweepCodeClass2.StrCode);
+                        }
+
                     }
                 }
                 #endregion
@@ -933,6 +979,7 @@ namespace CarMeterSystem
                     meterWorkMonitorEventDataI.validLianda = "1";
                     meterWorkMonitorEventDataI.validMatClick = "1";
                     meterWorkMonitorEventDataI.setCar = "";
+                    meterWorkMonitorEventDataI.isValidScan = "1";
                     meterWorkMonitorEventDataI.rfidCar = "";
                     meterWorkMonitorEventDataI.photoCar = "";
                     meterWorkMonitorEventDataI.scanCar = "";

+ 101 - 21
CarMeterSystem/frmMain.cs

@@ -398,6 +398,8 @@ namespace CarMeterSystem
         private int iCountPark = 0;
         private string editCarNo = "";
 
+        private bool isCarSource = false;
+
         private bool isResFlag = true;
         private string RFIDCarNo = "";
         private string isWriteRFID = AppConfigCache.isWriteRFID;
@@ -468,6 +470,10 @@ namespace CarMeterSystem
             //这里每隔0.5秒执行一次
             try
             {
+                if (PbCache.carNoSource == 0)
+                {
+                    PbCache.carNoSource = 1;
+                }
                 if (e.carno == "nown")
                 {
                     e.carno = "";
@@ -514,41 +520,86 @@ namespace CarMeterSystem
                 //}
 
                 // 司机扫码为空,取工控机二维码
-                if (string.IsNullOrEmpty(sweepCodeClass2.StrCode))
+                if (PbCache.sportInfo.scanRequireValid == "1")
                 {
-                    if (string.IsNullOrEmpty(sweepCodeClass.StrCode))
+                    if (PbCache.monitor.isValidScan == "0")
                     {
-                        if (string.IsNullOrEmpty(PbCache.strCode))
+                        if (string.IsNullOrEmpty(sweepCodeClass2.StrCode))
                         {
-                            codeFlag = false;
-                            firstCode = "";
-                            PbCache.strCode = "";
-                            //l.WriteLog(12, "主线程扫码值为空时清空;sweepCodeClass.StrCode值为" + sweepCodeClass.StrCode + " ;PbCache.strCode值为:" + PbCache.strCode);
-                        }
-                    }
-                    else
-                    {
-                        if (sweepCodeClass.StrCode.Substring(0,3) == "TWB")
-                        {
-                            DecodeQRCodeYMT(sweepCodeClass.StrCode);
+                            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
+                            {
+                                if (sweepCodeClass.StrCode.Substring(0, 3) == "TWB")
+                                {
+                                    DecodeQRCodeYMT(sweepCodeClass.StrCode);
+                                }
+                                else
+                                {
+                                    DecodeQRCode(sweepCodeClass.StrCode);
+                                }
+                            }
                         }
                         else
                         {
-                            DecodeQRCode(sweepCodeClass.StrCode);
+                            if (sweepCodeClass2.StrCode.Substring(0, 3) == "TWB")
+                            {
+                                DecodeQRCodeYMT(sweepCodeClass2.StrCode);
+                            }
+                            else
+                            {
+                                DecodeQRCode(sweepCodeClass2.StrCode);
+                            }
+
                         }
                     }
                 }
                 else
                 {
-                    if (sweepCodeClass2.StrCode.Substring(0, 3) == "TWB")
+                    if (string.IsNullOrEmpty(sweepCodeClass2.StrCode))
                     {
-                        DecodeQRCodeYMT(sweepCodeClass2.StrCode);
+                        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
+                        {
+                            if (sweepCodeClass.StrCode.Substring(0, 3) == "TWB")
+                            {
+                                DecodeQRCodeYMT(sweepCodeClass.StrCode);
+                            }
+                            else
+                            {
+                                DecodeQRCode(sweepCodeClass.StrCode);
+                            }
+                        }
                     }
                     else
                     {
-                        DecodeQRCode(sweepCodeClass2.StrCode);
+                        if (sweepCodeClass2.StrCode.Substring(0, 3) == "TWB")
+                        {
+                            DecodeQRCodeYMT(sweepCodeClass2.StrCode);
+                        }
+                        else
+                        {
+                            DecodeQRCode(sweepCodeClass2.StrCode);
+                        }
+
                     }
-                    
                 }
                 #endregion
 
@@ -605,6 +656,7 @@ namespace CarMeterSystem
                     PbCache.collect.parkStatus = e.parkStatus;
                     PbCache.collect.datetime = e.datetime;
                     PbCache.collect.licType = e.licType;
+                    PbCache.collect.carno = e.carno;
                 }
 
                 if (PbCache.collect != null && PbCache.collect.weightStatus == 0)
@@ -632,7 +684,7 @@ namespace CarMeterSystem
                 if (e.weight > 500)
                 {
                     isResFlag = true;
-
+                    isCarSource = true;
                     if (PbCache.dtStartTime == null)
                         PbCache.dtStartTime = DateTime.Now;
                     isLedWrite = true;
@@ -798,6 +850,10 @@ namespace CarMeterSystem
                             { }
                             else
                             {
+                                if (PbCache.carNoSource == 1)
+                                {
+                                    PbCache.carNoSource = 2;
+                                }
                                 mwUpdate.rfidCar = rmTRFIDEventData.Data[0].text;
                                 sCarNo = rmTRFIDEventData.Data[0].text;
                                 RFIDCarNo = rmTRFIDEventData.Data[0].text;
@@ -808,6 +864,7 @@ namespace CarMeterSystem
                         #region 计量员修改的车号信息
                         if (PbCache.monitor != null && !string.IsNullOrEmpty(PbCache.monitor.setCar))
                         {
+                            PbCache.carNoSource = 4;
                             sCarNo = PbCache.monitor.setCar;
                             bEditCar = true;
                             flagCarMonit = true;
@@ -962,6 +1019,20 @@ namespace CarMeterSystem
                         RFIDCarNo = "";
                     }
 
+                    //车号来源记录
+                    if (isCarSource)
+                    {
+                        meterWorkScheduledHelp1.baseSpotNo = PbCache.sportInfo.baseSpotNo;
+                        meterWorkScheduledHelp1.baseSpotName = PbCache.sportInfo.baseSpotName;
+                        meterWorkScheduledHelp1.carNo = string.IsNullOrEmpty(PbCache.collect.carno) ? PbCache.resultCarNo : PbCache.collect.carno;
+                        meterWorkScheduledHelp1.helpContent = PbCache.carNoSource.ToString();
+                        meterWorkScheduledHelp1.warmType = "8";
+                        meterWorkScheduledHelp1.warmTypeName = "车号来源记录";
+                        meterWorkScheduledHelpService.add(meterWorkScheduledHelp1);
+                        isCarSource = false;
+                        PbCache.carNoSource = 0;
+                    }
+
                     PbCache.isOvertimeAlarm = false; //是否超时报警
                     PbCache.strCode = "";
                     PbCache.strState = "";
@@ -1008,6 +1079,7 @@ namespace CarMeterSystem
                     meterWorkMonitorEventDataI.validLianda = "1";
                     meterWorkMonitorEventDataI.validMatClick = "1";
                     meterWorkMonitorEventDataI.setCar = "";
+                    meterWorkMonitorEventDataI.isValidScan = "1";
                     meterWorkMonitorEventDataI.rfidCar = "";
                     meterWorkMonitorEventDataI.photoCar = "";
                     meterWorkMonitorEventDataI.scanCar = "";
@@ -1319,6 +1391,11 @@ namespace CarMeterSystem
         {
             try
             {
+                //进行扫码,判断
+                if (PbCache.carNoSource == 1 || PbCache.carNoSource == 2)
+                {
+                    PbCache.carNoSource = 3;
+                }
                 codeFlag = true;
                 string token = httpRequest.GetToken();
                 string carNo = httpRequest.getCarNo(strCode, token);
@@ -1333,7 +1410,10 @@ namespace CarMeterSystem
 
         private void DecodeQRCode(string strCode)
         {
-            
+            if (PbCache.carNoSource == 1 || PbCache.carNoSource == 2)
+            {
+                PbCache.carNoSource = 3;
+            }
             codeFlag = true;
             //frmOneYardToEnd frmOneYardToEnd = new frmOneYardToEnd();
             Hashtable hashTable = new Hashtable();

+ 4 - 4
CarMeterSystem/frmOneYardToEnd.cs

@@ -312,12 +312,12 @@ namespace CarMeterSystem
                 //判断区域是否正确
                 if (!areaInfo.ValidMethod(PbCache.sportInfo, txtCarNo.Text) && PbCache.monitor.validArea == "1" && !isCompare)
                 {
-                    vicPlayClass.GetVoicePlay("计量失败,异地洁净,请联系计量大厅", PbCache.collect.carno);
-                    PbCache.ResultMessage = "计量失败:异地结净,请联系计量大厅"; //btnSave_Click
-                    led_controler.setStaticLineMsg(PbCache.sportInfo.ledIp, "计量失败:异地结净,请联系计量大厅");
+                    vicPlayClass.GetVoicePlay("计量失败,禁止毛皮在不同磅点计量,请联系计量大厅", PbCache.collect.carno);
+                    PbCache.ResultMessage = "计量失败,禁止毛皮在不同磅点计量,请联系计量大厅"; //btnSave_Click
+                    led_controler.setStaticLineMsg(PbCache.sportInfo.ledIp, "计量失败,禁止毛皮在不同磅点计量,请联系计量大厅");
                     PbCache.isLockFrm = false;
                     btnSave.Enabled = true;
-                    setMsg("计量失败:异地结净,请联系计量大厅");
+                    setMsg("计量失败,禁止毛皮在不同磅点计量,请联系计量大厅");
                     return;
                 }
 

+ 2 - 2
Common/cacheCls/PbCache.cs

@@ -58,9 +58,9 @@ namespace Common
         public static bool isTareWgt { get; set; }
 
         /// <summary>
-        /// 车号数据来源(1-正常,2-扫码,3-rfid,4-车号重置)
+        /// 车号数据来源(1-正常,2-rfid,3-扫码,4-车号重置)
         /// </summary>
-        public static int carNoSource { get; set; }
+        public static int carNoSource = 0;
 
         /// <summary>
         /// 是否打开手动选择毛皮

+ 5 - 0
Common/vo/base/MeterBaseSpotInfo.cs

@@ -175,5 +175,10 @@ namespace Common
 		/// <summary>
 		public string plcIp { get; set; }
 
+		/// <summary>
+		///  扫码是否需要验证(0:不需要;1:需要)
+		/// <summary>
+		public string scanRequireValid { get; set; }
+
 	}
 }