Parcourir la source

优化AS400接口解析方式

Ge mingyu il y a 1 an
Parent
commit
c89ba78656

+ 0 - 1
ProjectBase.Util/SysEnvironment.cs

@@ -68,7 +68,6 @@ namespace ProjectBase.Util
 
         public static string UserOperateState = "UserOperateState";//用户操作状态
 
-        public static string redis_ScannerBlock = "redis_ScannerBlock";
         #endregion
 
         #region 系统级属性 

+ 128 - 29
SIMDP.BLL/GetAS400DataJob.cs

@@ -13,15 +13,11 @@ namespace SIMDP.BLL
     {
         public async Task Execute(IJobExecutionContext context)
         {
-          //  if (!SysEnvironment.sign_OnlineMode) return;
+            //  if (!SysEnvironment.sign_OnlineMode) return;
             if (BLLFactory<BlMtocData>.Instance.GetRecordCount() > 1500) return;
             await Task.Run(() => GetAS400());
         }
 
-        /// <summary>
-        /// 正式接口
-        /// </summary>
-        /// <returns></returns>
         public bool GetAS400(string specifyVIN = "")
         {
             if (string.IsNullOrEmpty(specifyVIN) && string.IsNullOrEmpty(SysEnvironment.shareUp_PI_NO)) return true;
@@ -35,42 +31,40 @@ namespace SIMDP.BLL
 
                 AS400Service.mainResult mainRes = ws.main(mainInput);
                 string[] strs = mainRes.PI_LIST;
-                // string[] strs = new string[] { "LHGCV1679N8081023  NTVGHB600 NH904M    A 2022/02/1608:38:03" };
+                //string[] strs = new string[] { "LHGCV1679N8081023  NTVGHB600 NH904M    A 2022/02/1608:38:03" };
+                //string[] strs = new string[] { "LHGRV8886P8000183  63F4HA500 B508M     L1202211112807:51:31" };
                 if (!CheckPostResult(strs))
                 {
                     LogHelper.log.Info($"无法在AS400中查到车号 {mainInput.PI_NO} 或格式异常");
                     return false;
                 }
-                string sVin = "";
-                int iPLCCode = 0;
-                int iPaintLine = 0;
-                char[] chs = { ' ', '\t' };
                 LogHelper.log.Debug("【接收数据start】");
                 foreach (string s in strs)
                 {
                     LogHelper.log.Debug($"接收数据行:{s}");
-                    string[] resSplit = s.Split(chs, StringSplitOptions.RemoveEmptyEntries);
 
-                    //获取VIN
-                    sVin = resSplit[0];
-                    if (sVin.Length != 17)
-                    {
-                        LogHelper.log.Error($"车号字段长度错误!{resSplit[0]}");
-                        SysEnvironment.warn_AS400 = true;
-                        return false;
-                    }
-                    //根据VIN替重
+                    int iPLCCode = 0;
+                    int iPaintLine = 0;
+                    char[] chs = { ' ', '\t' };
+
+                    string sVin = s.Substring(0, 19).Trim();
+                    string smodel = sVin.Substring(3, 2);
+                    string[] smtoc = s.Substring(19, 22).Split(chs, StringSplitOptions.RemoveEmptyEntries);
+                    string scolor = smtoc[1];
+
                     if (CheckArrayContain(SysEnvironment.LastPostResult, s))
                     {
-                        LogHelper.log.Debug($"查询到重复!{sVin}");
+                        LogHelper.log.Debug($"查询到重复AS400数据车号 {sVin}");
                         continue;
                     }
 
                     //获取车型
-                    iPLCCode = BLLFactory<BlModelContrast>.Instance.GetPLCCodebyModelCode(sVin.Substring(3, 2));
+                    iPLCCode = BLLFactory<BlModelContrast>.Instance.GetPLCCodebyModelCode(smodel);
+                    if (iPLCCode <= 0) LogHelper.log.Error($"接收车型异常  smodel= {smodel}");
                     //获取颜色
-                    iPaintLine = BLLFactory<BlColorContrast>.Instance.GetPaintLinebyColorCard(resSplit[2]);
-                    //存如MTOC表
+                    iPaintLine = BLLFactory<BlColorContrast>.Instance.GetPaintLinebyColorCard(scolor);
+                    if (iPaintLine <= 0) LogHelper.log.Error($"接收颜色异常  scolor= {scolor}");
+                    //存入MTOC表
                     MoMtocData model = new MoMtocData();
                     model.Vin = sVin;
                     model.Model = iPLCCode;
@@ -86,6 +80,7 @@ namespace SIMDP.BLL
                         }
                         catch (Exception ex)
                         {
+                            SysEnvironment.warn_AS400 = true;
                             trans.Rollback();
                             LogHelper.log.Error($"存入数据库MTOC表异常:{ex.Message}");
                             LogHelper.log.Error($"当前缓存的POST结果:");
@@ -104,21 +99,125 @@ namespace SIMDP.BLL
             catch (Exception ex)
             {
                 SysEnvironment.warn_AS400 = true;
+                LogHelper.log.Error($"获取AS400数据出错:{ex.Message}");
                 throw ex;
-                //LogHelper.log.Error($"获取AS400数据出错:{ex.Message}");
                 //return false;
             }
         }
 
+        /// <summary>
+        /// 正式接口
+        /// </summary>
+        ///// <returns></returns>
+        //public bool GetAS400(string specifyVIN = "")
+        //{
+        //    if (string.IsNullOrEmpty(specifyVIN) && string.IsNullOrEmpty(SysEnvironment.shareUp_PI_NO)) return true;
+        //    try
+        //    {
+        //        AS400Service.GETMAINR ws = new AS400Service.GETMAINR();
+        //        AS400Service.mainInput mainInput = new AS400Service.mainInput();
+        //        mainInput.PI_LINE = "02";
+        //        mainInput.PI_TYPE = "PAOFF";
+        //        mainInput.PI_NO = !string.IsNullOrEmpty(specifyVIN) ? specifyVIN : SysEnvironment.shareUp_PI_NO;
+
+        //        AS400Service.mainResult mainRes = ws.main(mainInput);
+        //        string[] strs = mainRes.PI_LIST;
+        //        // string[] strs = new string[] { "LHGCV1679N8081023  NTVGHB600 NH904M    A 2022/02/1608:38:03" };
+        //        if (!CheckPostResult(strs))
+        //        {
+        //            LogHelper.log.Info($"无法在AS400中查到车号 {mainInput.PI_NO} 或格式异常");
+        //            return false;
+        //        }
+        //        string sVin = "";
+        //        int iPLCCode = 0;
+        //        int iPaintLine = 0;
+        //        char[] chs = { ' ', '\t' };
+        //        LogHelper.log.Debug("【接收数据start】");
+        //        foreach (string s in strs)
+        //        {
+        //            LogHelper.log.Debug($"接收数据行:{s}");
+        //            string[] resSplit = s.Split(chs, StringSplitOptions.RemoveEmptyEntries);
+
+        //            //获取VIN
+        //            sVin = resSplit[0];
+        //            if (sVin.Length != 17)
+        //            {
+        //                LogHelper.log.Error($"车号字段长度错误!{resSplit[0]}");
+        //                SysEnvironment.warn_AS400 = true;
+        //                return false;
+        //            }
+        //            //根据VIN替重
+        //            if (CheckArrayContain(SysEnvironment.LastPostResult, s))
+        //            {
+        //                LogHelper.log.Debug($"查询到重复!{sVin}");
+        //                continue;
+        //            }
+
+        //            //获取车型
+        //            iPLCCode = BLLFactory<BlModelContrast>.Instance.GetPLCCodebyModelCode(sVin.Substring(3, 2));
+        //            //获取颜色
+        //            iPaintLine = BLLFactory<BlColorContrast>.Instance.GetPaintLinebyColorCard(resSplit[2]);
+        //            //存如MTOC表
+        //            MoMtocData model = new MoMtocData();
+        //            model.Vin = sVin;
+        //            model.Model = iPLCCode;
+        //            model.Color = iPaintLine;
+        //            model.Fetch_Time = DateTime.Now;
+
+        //            using (DbTransaction trans = BLLFactory<BlMtocData>.Instance.CreateTransaction())
+        //            {
+        //                try
+        //                {
+        //                    BLLFactory<BlMtocData>.Instance.Insert(model, trans);
+        //                    trans.Commit();
+        //                }
+        //                catch (Exception ex)
+        //                {
+        //                    trans.Rollback();
+        //                    LogHelper.log.Error($"存入数据库MTOC表异常:{ex.Message}");
+        //                    LogHelper.log.Error($"当前缓存的POST结果:");
+        //                    foreach (string str in SysEnvironment.LastPostResult)
+        //                    {
+        //                        LogHelper.log.Error($"缓存: {str}");
+        //                    }
+        //                }
+        //            }
+        //        }
+        //        SysEnvironment.shareUp_PI_NO = strs[strs.Length - 1].Substring(0, 17);//更新下次查询起始车号
+        //        SysEnvironment.LastPostResult = null;
+        //        SysEnvironment.LastPostResult = (string[])strs.Clone(); //更新本次post结果, 不是车号!
+        //        return true;
+        //    }
+        //    catch (Exception ex)
+        //    {
+        //        SysEnvironment.warn_AS400 = true;
+        //        throw ex;
+        //        //LogHelper.log.Error($"获取AS400数据出错:{ex.Message}");
+        //        //return false;
+        //    }
+        //}
+
+        //private bool CheckPostResult(string[] strs)
+        //{
+        //    //长度不足1
+        //    //所有元素都是空字符串/每个元素解析出的字段少于5个
+        //    if (strs.Length < 1) return false;
+        //    char[] chs = { ' ', '\t' };
+        //    foreach (string ss in strs)
+        //    {
+        //        if (ss.Split(chs, StringSplitOptions.RemoveEmptyEntries).Length < 5)
+        //            return false;
+        //    }
+        //    return true;
+        //}
+
+
         private bool CheckPostResult(string[] strs)
         {
-            //长度不足1
-            //所有元素都是空字符串/每个元素解析出的字段少于5个
             if (strs.Length < 1) return false;
-            char[] chs = { ' ', '\t' };
             foreach (string ss in strs)
             {
-                if (ss.Split(chs, StringSplitOptions.RemoveEmptyEntries).Length < 5)
+                if (ss.Length != 59)
                     return false;
             }
             return true;

+ 2 - 1
SIMDP.BLL/SmProject.cs

@@ -25,7 +25,8 @@ namespace SIMDP.BLL
             ColorList.Clear();
             foreach (MoColorContrast moColorContrast in ListColorContrast)
             {
-                ColorList.Add(moColorContrast.Paint_Line, moColorContrast.Chinese_Name_H);
+                if (!ColorList.ContainsKey(moColorContrast.Paint_Line))
+                    ColorList.Add(moColorContrast.Paint_Line, moColorContrast.Color_Card+'_'+moColorContrast.Chinese_Name_H);
             }
         }
 

+ 2 - 2
SIMDP.Project/App.config

@@ -10,7 +10,7 @@
 		<add key="ComponentDbType" value="sqlserver" />
 		<!--默认登陆的用户ID-->
 		<add key="DefaultUser" value="123" />
-		<add key="Version" value="1.7.3" />
+		<add key="Version" value="1.7.5" />
 		<add key="ClientSettingsProvider.ServiceUri" value="" />
 	</appSettings>
 	<connectionStrings>
@@ -49,7 +49,7 @@
 			</filter>
 		</appender>
 		<root name="loginfo">
-			<level value="info" />
+			<level value="debug" />
 			<appender-ref ref="ColoredConsoleAppender" />
 			<appender-ref ref="RollingLogFileAppender" />
 		</root>

+ 3 - 1
SIMDP.Project/Form/FormColorContrast.Designer.cs

@@ -91,6 +91,8 @@ namespace SIMDP.Project
             this.gridView.OptionsView.ShowPreviewRowLines = DevExpress.Utils.DefaultBoolean.True;
             this.gridView.OptionsView.ShowVerticalLines = DevExpress.Utils.DefaultBoolean.True;
             this.gridView.CustomDrawRowIndicator += gridView_CustomDrawRowIndicator;
+            this.gridView.SortInfo.AddRange(new DevExpress.XtraGrid.Columns.GridColumnSortInfo[] {
+            new DevExpress.XtraGrid.Columns.GridColumnSortInfo(this.gridColumn2, DevExpress.Data.ColumnSortOrder.Ascending)});
             // 
             // gridColumn1
             // 
@@ -104,7 +106,7 @@ namespace SIMDP.Project
             // 
             this.gridColumn2.AppearanceCell.Options.UseTextOptions = true;
             this.gridColumn2.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
-            this.gridColumn2.Caption = "色漆管道";
+            this.gridColumn2.Caption = "色漆管道(PLC交互值)";
             this.gridColumn2.FieldName = "Paint_Line";
             this.gridColumn2.Name = "gridColumn2";
             this.gridColumn2.Visible = true;

+ 2 - 0
SIMDP.Project/Form/FormColorContrast.cs

@@ -59,6 +59,8 @@ namespace SIMDP.Project
             SmProject.ListColorContrast = BLLFactory<BlColorContrast>.Instance.GetAll();
             gridControl.DataSource = SmProject.ListColorContrast;
             label_PageInfo.Text = string.Format("共 {0} 条记录", SmProject.ListColorContrast.Count);
+
+            SmProject.InitColorList();
         }
 
         private void btn_Add_Click(object sender, EventArgs e)

+ 31 - 70
SIMDP.Project/Form/FormCurrentTask.Designer.cs

@@ -77,8 +77,6 @@ namespace SIMDP.Project
             this.labelControl7 = new DevExpress.XtraEditors.LabelControl();
             this.lbl_TightingModel = new DevExpress.XtraEditors.LabelControl();
             this.lbl_TightingColor = new DevExpress.XtraEditors.LabelControl();
-            this.btn_ReleaseEmpty = new DevExpress.XtraEditors.SimpleButton();
-            this.lbl_ScannerBlock = new DevExpress.XtraEditors.LabelControl();
             ((System.ComponentModel.ISupportInitialize)(this.gridControl_Mtoc)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.gridView_Mtoc)).BeginInit();
             this.panel1.SuspendLayout();
@@ -399,7 +397,7 @@ namespace SIMDP.Project
             this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
             this.groupBox2.Controls.Add(this.coTableLayoutPanel4);
-            this.groupBox2.Location = new System.Drawing.Point(6, 80);
+            this.groupBox2.Location = new System.Drawing.Point(3, 80);
             this.groupBox2.Name = "groupBox2";
             this.groupBox2.Size = new System.Drawing.Size(1563, 186);
             this.groupBox2.TabIndex = 29;
@@ -409,14 +407,14 @@ namespace SIMDP.Project
             // coTableLayoutPanel4
             // 
             this.coTableLayoutPanel4.ColumnCount = 8;
-            this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.84391F));
+            this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 7.000642F));
+            this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 18.43288F));
+            this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.807964F));
+            this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 18.49711F));
+            this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.807964F));
             this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 18.57633F));
-            this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.84391F));
-            this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 18.57633F));
-            this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.84391F));
-            this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 18.57633F));
-            this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.90909F));
-            this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 12.83019F));
+            this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.85421F));
+            this.coTableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 13.61593F));
             this.coTableLayoutPanel4.Controls.Add(this.lbl_FEMScanner, 4, 0);
             this.coTableLayoutPanel4.Controls.Add(this.labelControl8, 0, 0);
             this.coTableLayoutPanel4.Controls.Add(this.lbl_Scanning_Pointer, 1, 0);
@@ -442,7 +440,7 @@ namespace SIMDP.Project
             this.lbl_FEMScanner.Anchor = System.Windows.Forms.AnchorStyles.Right;
             this.lbl_FEMScanner.Appearance.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.lbl_FEMScanner.Appearance.Options.UseFont = true;
-            this.lbl_FEMScanner.Location = new System.Drawing.Point(823, 17);
+            this.lbl_FEMScanner.Location = new System.Drawing.Point(816, 17);
             this.lbl_FEMScanner.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.lbl_FEMScanner.Name = "lbl_FEMScanner";
             this.lbl_FEMScanner.Size = new System.Drawing.Size(70, 20);
@@ -455,7 +453,7 @@ namespace SIMDP.Project
             this.labelControl8.Anchor = System.Windows.Forms.AnchorStyles.Right;
             this.labelControl8.Appearance.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.labelControl8.Appearance.Options.UseFont = true;
-            this.labelControl8.Location = new System.Drawing.Point(43, 17);
+            this.labelControl8.Location = new System.Drawing.Point(45, 17);
             this.labelControl8.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.labelControl8.Name = "labelControl8";
             this.labelControl8.Size = new System.Drawing.Size(60, 20);
@@ -470,7 +468,7 @@ namespace SIMDP.Project
             this.lbl_Scanning_Pointer.Appearance.Options.UseTextOptions = true;
             this.lbl_Scanning_Pointer.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
             this.lbl_Scanning_Pointer.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.Horizontal;
-            this.lbl_Scanning_Pointer.Location = new System.Drawing.Point(109, 15);
+            this.lbl_Scanning_Pointer.Location = new System.Drawing.Point(111, 15);
             this.lbl_Scanning_Pointer.Name = "lbl_Scanning_Pointer";
             this.lbl_Scanning_Pointer.Size = new System.Drawing.Size(35, 24);
             this.lbl_Scanning_Pointer.TabIndex = 24;
@@ -482,7 +480,7 @@ namespace SIMDP.Project
             this.lbl_HeadScanner.Anchor = System.Windows.Forms.AnchorStyles.Right;
             this.lbl_HeadScanner.Appearance.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.lbl_HeadScanner.Appearance.Options.UseFont = true;
-            this.lbl_HeadScanner.Location = new System.Drawing.Point(418, 17);
+            this.lbl_HeadScanner.Location = new System.Drawing.Point(415, 17);
             this.lbl_HeadScanner.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.lbl_HeadScanner.Name = "lbl_HeadScanner";
             this.lbl_HeadScanner.Size = new System.Drawing.Size(80, 20);
@@ -498,7 +496,7 @@ namespace SIMDP.Project
             this.lbl_Scanning_MatchRes.Appearance.Options.UseTextOptions = true;
             this.lbl_Scanning_MatchRes.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
             this.lbl_Scanning_MatchRes.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.Horizontal;
-            this.lbl_Scanning_MatchRes.Location = new System.Drawing.Point(1188, 15);
+            this.lbl_Scanning_MatchRes.Location = new System.Drawing.Point(1179, 15);
             this.lbl_Scanning_MatchRes.Name = "lbl_Scanning_MatchRes";
             this.lbl_Scanning_MatchRes.Size = new System.Drawing.Size(45, 24);
             this.lbl_Scanning_MatchRes.TabIndex = 24;
@@ -511,7 +509,7 @@ namespace SIMDP.Project
             this.btn_ForceMatch.Appearance.Options.UseFont = true;
             this.btn_ForceMatch.AutoSize = true;
             this.btn_ForceMatch.ImageOptions.ImageUri.Uri = "Recurrence;Office2013";
-            this.btn_ForceMatch.Location = new System.Drawing.Point(1402, 12);
+            this.btn_ForceMatch.Location = new System.Drawing.Point(1397, 12);
             this.btn_ForceMatch.Margin = new System.Windows.Forms.Padding(10, 3, 10, 3);
             this.btn_ForceMatch.MaximumSize = new System.Drawing.Size(135, 30);
             this.btn_ForceMatch.Name = "btn_ForceMatch";
@@ -524,11 +522,11 @@ namespace SIMDP.Project
             // 
             this.gridControl_Head.Dock = System.Windows.Forms.DockStyle.Fill;
             this.gridControl_Head.Font = new System.Drawing.Font("宋体", 15F);
-            this.gridControl_Head.Location = new System.Drawing.Point(504, 58);
+            this.gridControl_Head.Location = new System.Drawing.Point(501, 58);
             this.gridControl_Head.MainView = this.gridView_Head;
             this.gridControl_Head.Name = "gridControl_Head";
             this.coTableLayoutPanel4.SetRowSpan(this.gridControl_Head, 2);
-            this.gridControl_Head.Size = new System.Drawing.Size(283, 104);
+            this.gridControl_Head.Size = new System.Drawing.Size(280, 104);
             this.gridControl_Head.TabIndex = 27;
             this.gridControl_Head.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
             this.gridView_Head});
@@ -565,7 +563,7 @@ namespace SIMDP.Project
             this.lbl_Scanning_HeadCode.Appearance.Options.UseTextOptions = true;
             this.lbl_Scanning_HeadCode.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
             this.lbl_Scanning_HeadCode.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.Horizontal;
-            this.lbl_Scanning_HeadCode.Location = new System.Drawing.Point(504, 15);
+            this.lbl_Scanning_HeadCode.Location = new System.Drawing.Point(501, 15);
             this.lbl_Scanning_HeadCode.Name = "lbl_Scanning_HeadCode";
             this.lbl_Scanning_HeadCode.Size = new System.Drawing.Size(35, 24);
             this.lbl_Scanning_HeadCode.TabIndex = 24;
@@ -580,7 +578,7 @@ namespace SIMDP.Project
             this.lbl_ScanningFEMCode.Appearance.Options.UseTextOptions = true;
             this.lbl_ScanningFEMCode.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
             this.lbl_ScanningFEMCode.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.Horizontal;
-            this.lbl_ScanningFEMCode.Location = new System.Drawing.Point(899, 15);
+            this.lbl_ScanningFEMCode.Location = new System.Drawing.Point(892, 15);
             this.lbl_ScanningFEMCode.Name = "lbl_ScanningFEMCode";
             this.lbl_ScanningFEMCode.Size = new System.Drawing.Size(35, 24);
             this.lbl_ScanningFEMCode.TabIndex = 24;
@@ -591,11 +589,11 @@ namespace SIMDP.Project
             // 
             this.gridControl_FEM.Dock = System.Windows.Forms.DockStyle.Fill;
             this.gridControl_FEM.Font = new System.Drawing.Font("宋体", 15F);
-            this.gridControl_FEM.Location = new System.Drawing.Point(899, 58);
+            this.gridControl_FEM.Location = new System.Drawing.Point(892, 58);
             this.gridControl_FEM.MainView = this.gridView_FEM;
             this.gridControl_FEM.Name = "gridControl_FEM";
             this.coTableLayoutPanel4.SetRowSpan(this.gridControl_FEM, 2);
-            this.gridControl_FEM.Size = new System.Drawing.Size(283, 104);
+            this.gridControl_FEM.Size = new System.Drawing.Size(281, 104);
             this.gridControl_FEM.TabIndex = 27;
             this.gridControl_FEM.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
             this.gridView_FEM});
@@ -641,12 +639,12 @@ namespace SIMDP.Project
             this.coTableLayoutPanel1.ColumnCount = 8;
             this.coTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 7.19332F));
             this.coTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 18.43288F));
-            this.coTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.807964F));
-            this.coTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 18.49711F));
+            this.coTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.55106F));
+            this.coTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 18.30443F));
             this.coTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.743738F));
-            this.coTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 18.68979F));
-            this.coTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.5973F));
-            this.coTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 12.97367F));
+            this.coTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 18.62556F));
+            this.coTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10.78998F));
+            this.coTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 13.2948F));
             this.coTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
             this.coTableLayoutPanel1.Controls.Add(this.lbl_Tighting_Pointer, 1, 0);
             this.coTableLayoutPanel1.Controls.Add(this.labelControl2, 2, 0);
@@ -654,8 +652,6 @@ namespace SIMDP.Project
             this.coTableLayoutPanel1.Controls.Add(this.labelControl7, 0, 0);
             this.coTableLayoutPanel1.Controls.Add(this.lbl_TightingModel, 3, 0);
             this.coTableLayoutPanel1.Controls.Add(this.lbl_TightingColor, 5, 0);
-            this.coTableLayoutPanel1.Controls.Add(this.btn_ReleaseEmpty, 7, 0);
-            this.coTableLayoutPanel1.Controls.Add(this.lbl_ScannerBlock, 6, 0);
             this.coTableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.coTableLayoutPanel1.Location = new System.Drawing.Point(3, 18);
             this.coTableLayoutPanel1.Name = "coTableLayoutPanel1";
@@ -684,7 +680,7 @@ namespace SIMDP.Project
             this.labelControl2.Anchor = System.Windows.Forms.AnchorStyles.Right;
             this.labelControl2.Appearance.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.labelControl2.Appearance.Options.UseFont = true;
-            this.labelControl2.Location = new System.Drawing.Point(442, 15);
+            this.labelControl2.Location = new System.Drawing.Point(438, 15);
             this.labelControl2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.labelControl2.Name = "labelControl2";
             this.labelControl2.Size = new System.Drawing.Size(60, 20);
@@ -696,12 +692,12 @@ namespace SIMDP.Project
             this.labelControl4.Anchor = System.Windows.Forms.AnchorStyles.Right;
             this.labelControl4.Appearance.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.labelControl4.Appearance.Options.UseFont = true;
-            this.labelControl4.Location = new System.Drawing.Point(845, 15);
+            this.labelControl4.Location = new System.Drawing.Point(828, 15);
             this.labelControl4.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.labelControl4.Name = "labelControl4";
-            this.labelControl4.Size = new System.Drawing.Size(50, 20);
+            this.labelControl4.Size = new System.Drawing.Size(60, 20);
             this.labelControl4.TabIndex = 4;
-            this.labelControl4.Text = "颜色:";
+            this.labelControl4.Text = "颜色";
             // 
             // labelControl7
             // 
@@ -723,7 +719,7 @@ namespace SIMDP.Project
             this.lbl_TightingModel.Appearance.Options.UseTextOptions = true;
             this.lbl_TightingModel.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
             this.lbl_TightingModel.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.Horizontal;
-            this.lbl_TightingModel.Location = new System.Drawing.Point(508, 13);
+            this.lbl_TightingModel.Location = new System.Drawing.Point(504, 13);
             this.lbl_TightingModel.Name = "lbl_TightingModel";
             this.lbl_TightingModel.Size = new System.Drawing.Size(35, 24);
             this.lbl_TightingModel.TabIndex = 24;
@@ -737,45 +733,12 @@ namespace SIMDP.Project
             this.lbl_TightingColor.Appearance.Options.UseTextOptions = true;
             this.lbl_TightingColor.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
             this.lbl_TightingColor.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.Horizontal;
-            this.lbl_TightingColor.Location = new System.Drawing.Point(901, 13);
+            this.lbl_TightingColor.Location = new System.Drawing.Point(894, 13);
             this.lbl_TightingColor.Name = "lbl_TightingColor";
             this.lbl_TightingColor.Size = new System.Drawing.Size(35, 24);
             this.lbl_TightingColor.TabIndex = 24;
             this.lbl_TightingColor.Text = "-----";
             // 
-            // btn_ReleaseEmpty
-            // 
-            this.btn_ReleaseEmpty.Anchor = System.Windows.Forms.AnchorStyles.None;
-            this.btn_ReleaseEmpty.Appearance.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.btn_ReleaseEmpty.Appearance.Options.UseFont = true;
-            this.btn_ReleaseEmpty.AutoSize = true;
-            this.btn_ReleaseEmpty.Enabled = false;
-            this.btn_ReleaseEmpty.ImageOptions.ImageUri.Uri = "DoubleNext;Office2013";
-            this.btn_ReleaseEmpty.Location = new System.Drawing.Point(1402, 10);
-            this.btn_ReleaseEmpty.Margin = new System.Windows.Forms.Padding(10, 3, 10, 3);
-            this.btn_ReleaseEmpty.MaximumSize = new System.Drawing.Size(135, 30);
-            this.btn_ReleaseEmpty.Name = "btn_ReleaseEmpty";
-            this.btn_ReleaseEmpty.Size = new System.Drawing.Size(106, 30);
-            this.btn_ReleaseEmpty.TabIndex = 26;
-            this.btn_ReleaseEmpty.Text = "强制放行";
-            this.btn_ReleaseEmpty.Visible = false;
-            this.btn_ReleaseEmpty.Click += new System.EventHandler(this.btn_ReleaseEmpty_Click);
-            // 
-            // lbl_ScannerBlock
-            // 
-            this.lbl_ScannerBlock.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
-            this.lbl_ScannerBlock.Appearance.Font = new System.Drawing.Font("Tahoma", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
-            this.lbl_ScannerBlock.Appearance.Options.UseFont = true;
-            this.lbl_ScannerBlock.Appearance.Options.UseTextOptions = true;
-            this.lbl_ScannerBlock.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
-            this.lbl_ScannerBlock.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.Horizontal;
-            this.lbl_ScannerBlock.Location = new System.Drawing.Point(1192, 13);
-            this.lbl_ScannerBlock.Name = "lbl_ScannerBlock";
-            this.lbl_ScannerBlock.Size = new System.Drawing.Size(45, 24);
-            this.lbl_ScannerBlock.TabIndex = 24;
-            this.lbl_ScannerBlock.Text = "-----";
-            this.lbl_ScannerBlock.Visible = false;
-            // 
             // FormCurrentTask
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
@@ -842,7 +805,6 @@ namespace SIMDP.Project
         private System.Windows.Forms.GroupBox groupBox3;
         private CoTableLayoutPanel coTableLayoutPanel3;
         private DevExpress.XtraEditors.LabelControl lbl_Scanning_Pointer;
-        private DevExpress.XtraEditors.SimpleButton btn_ReleaseEmpty;
         private DevExpress.XtraEditors.LabelControl labelControl1;
         private DevExpress.XtraEditors.TextEdit txt_ModelInput;
         private DevExpress.XtraEditors.LabelControl labelControl7;
@@ -852,7 +814,6 @@ namespace SIMDP.Project
         private DevExpress.XtraEditors.LabelControl lbl_TightingModel;
         private DevExpress.XtraEditors.LabelControl lbl_TightingColor;
         private DevExpress.XtraEditors.LookUpEdit lookUp_Color;
-        private DevExpress.XtraEditors.LabelControl lbl_ScannerBlock;
         private DevExpress.XtraGrid.GridControl gridControl_Head;
         private DevExpress.XtraGrid.Views.Grid.GridView gridView_Head;
         private DevExpress.XtraGrid.Columns.GridColumn gridColumn2;

+ 18 - 44
SIMDP.Project/Form/FormCurrentTask.cs

@@ -127,17 +127,10 @@ namespace SIMDP.Project
 
         private void BindData()
         {
-
             List<MoMtocData> list = BLLFactory<BlMtocData>.Instance.GetAll();
             gridControl_Mtoc.DataSource = list;
             label_PageInfo.Text = string.Format("共 {0} 条记录", list.Count);
 
-
-            gridControl_Head.DataSource = MXComponent_FEM02.SuperQueueScanner.HeadCodeList;
-            gridControl_Head.RefreshDataSource();
-            gridControl_FEM.DataSource = MXComponent_FEM02.SuperQueueScanner.FEMCodeList;
-            gridControl_FEM.RefreshDataSource();
-
         }
 
         private void BindData_SetPointer(string vinInput)
@@ -170,7 +163,12 @@ namespace SIMDP.Project
             ScanningHeadcodeChange("", SysEnvironment.Global_Head_Pointer);
             ScanningFEMCodeChange("", SysEnvironment.Global_FEM_Pointer);
             ShowMatchResult("", MXComponent_FEM02.SuperQueueScanner.Scanning_Match_Result);
-            
+
+            gridControl_Head.DataSource = MXComponent_FEM02.SuperQueueScanner.HeadCodeList;
+            gridControl_Head.RefreshDataSource();
+            gridControl_FEM.DataSource = MXComponent_FEM02.SuperQueueScanner.FEMCodeList;
+            gridControl_FEM.RefreshDataSource();
+
         }
 
         private void SubScribeEnent()
@@ -192,8 +190,6 @@ namespace SIMDP.Project
 
             redis.Subscribe(SysEnvironment.redis_Tighting_Color, new Action<RedisChannel, RedisValue>(TightingColorChange));
 
-            redis.Subscribe(SysEnvironment.redis_ScannerBlock, new Action<RedisChannel, RedisValue>(ScannerBlockChange));
-
             //  redis.Subscribe(SysEnvironment.redis_Tighting_HeadCode, new Action<RedisChannel, RedisValue>(TightingHeadCodeChange));
 
             //  redis.Subscribe(SysEnvironment.redis_Tighting_FEMCode, new Action<RedisChannel, RedisValue>(TightingFEMCodeChange));
@@ -376,30 +372,6 @@ namespace SIMDP.Project
             }
         }
 
-        private void ScannerBlockChange(RedisChannel channel, RedisValue message)
-        {
-            try
-            {
-                if (InvokeRequired)
-                {
-                    BeginInvoke(new Action(() =>
-                    {
-                        ScannerBlockChange(channel, message);
-                    }));
-                    return;
-                }
-                if (bool.Parse(message.ToString()))
-                    lbl_ScannerBlock.Text = "扫码阻塞";
-                else
-                    lbl_ScannerBlock.Text = "";
-
-            }
-            catch (Exception ex)
-            {
-                LogHelper.log.Error($"标签值订阅异常:{ex.Message}");
-            }
-        }
-
         private void GridView_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
         {
 
@@ -620,20 +592,21 @@ namespace SIMDP.Project
                 if (!CheckIdentify()) return;
                 if (MXComponent_FEM02.SkipHeadScan)
                 {
-                    if (DevExpress.XtraEditors.XtraMessageBox.Show($"启车头扫码", "操作确认", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
+                    if (DevExpress.XtraEditors.XtraMessageBox.Show($"启车头扫码结果?", "操作确认", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
                         return;
                 }
                 else
                 {
-                    if (DevExpress.XtraEditors.XtraMessageBox.Show($"关闭车头扫码", "操作确认", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
+                    if (DevExpress.XtraEditors.XtraMessageBox.Show($"屏蔽车头扫码结果?", "操作确认", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
                         return;
                 }
 
                 MXComponent_FEM02.SkipHeadScan = !MXComponent_FEM02.SkipHeadScan;
-                SetHeadScannerlabel();
+                if (MXComponent_FEM02.SkipHeadScan) SysEnvironment.Global_Head_Pointer = "";
 
-                string message = MXComponent_FEM02.SkipHeadScan ? "关闭" : "开启";
-                DevExpress.XtraEditors.XtraMessageBox.Show($"车头扫码已{message}", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                SetHeadScannerlabel();
+                string message = MXComponent_FEM02.SkipHeadScan ? "屏蔽" : "启用";
+                DevExpress.XtraEditors.XtraMessageBox.Show($"车头扫码结果已{message}", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
 
@@ -644,20 +617,21 @@ namespace SIMDP.Project
                 if (!CheckIdentify()) return;
                 if (MXComponent_FEM02.SkipFEMScan)
                 {
-                    if (DevExpress.XtraEditors.XtraMessageBox.Show($"启FEM扫码", "操作确认", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
+                    if (DevExpress.XtraEditors.XtraMessageBox.Show($"启FEM扫码结果?", "操作确认", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
                         return;
                 }
                 else
                 {
-                    if (DevExpress.XtraEditors.XtraMessageBox.Show($"关闭FEM扫码", "操作确认", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
+                    if (DevExpress.XtraEditors.XtraMessageBox.Show($"屏蔽FEM扫码结果?", "操作确认", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
                         return;
                 }
 
                 MXComponent_FEM02.SkipFEMScan = !MXComponent_FEM02.SkipFEMScan;
-                SetFEMScannerlabel();
+                if (MXComponent_FEM02.SkipFEMScan) SysEnvironment.Global_FEM_Pointer = "";
 
-                string message = MXComponent_FEM02.SkipFEMScan ? "关闭" : "开启";
-                DevExpress.XtraEditors.XtraMessageBox.Show($"FEM扫码已{message}", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                SetFEMScannerlabel();
+                string message = MXComponent_FEM02.SkipFEMScan ? "屏蔽" : "启用";
+                DevExpress.XtraEditors.XtraMessageBox.Show($"FEM扫码结果已{message}", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
 

+ 2 - 0
SIMDP.Project/Form/FormModelContrast.Designer.cs

@@ -195,6 +195,8 @@ namespace SIMDP.Project
             this.gridView.OptionsView.ShowGroupPanel = false;
             this.gridView.OptionsView.ShowPreviewRowLines = DevExpress.Utils.DefaultBoolean.True;
             this.gridView.OptionsView.ShowVerticalLines = DevExpress.Utils.DefaultBoolean.True;
+            this.gridView.SortInfo.AddRange(new DevExpress.XtraGrid.Columns.GridColumnSortInfo[] {
+            new DevExpress.XtraGrid.Columns.GridColumnSortInfo(this.gridColumn2, DevExpress.Data.ColumnSortOrder.Ascending)});
             this.gridView.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(this.gridView_CustomDrawRowIndicator);
             // 
             // gridColumn1