KWD 4 months ago
parent
commit
820995e309
2 changed files with 35 additions and 24 deletions
  1. 33 22
      TeamAAS-VM/Core/Management.cs
  2. 2 2
      TeamAAS-VM/Properties/AssemblyInfo.cs

+ 33 - 22
TeamAAS-VM/Core/Management.cs

@@ -1214,7 +1214,7 @@ namespace TeamAAS_VP.Core
                 monitorNodeIds.Add(string.Format(addressConfig.In_MesCheck.Address, i));
             }
             //订阅PLC地址变化
-            plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger,OpcUaSubscriptionMode.CustomPolling);
+            plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger, OpcUaSubscriptionMode.CustomPolling);
         }
 
         /// <summary>
@@ -1907,7 +1907,8 @@ namespace TeamAAS_VP.Core
                             //位置编号
                             Int16 positionIndex = plc.ReadNode<Int16>(addressConfig.In_ProductNum.Address);
                             SendTaskMessage(string.Format(Lang.编号0, positionIndex), MessageLevel.Info);
-                            // 开始采集压力值
+                            // 开始采集压力值,ProductMainSN[i]
+                            //StartPressureCollection(currentProduct.Name, _productService.CurrentProductCode, 0);
                             StartPressureCollection(currentProduct.Name, _productService.CurrentProductCode, 0);
                         }
                         else
@@ -2418,7 +2419,7 @@ namespace TeamAAS_VP.Core
                                     {
                                         code = outputCollection["QR"].Value as string;
                                         code = code.ToUpper();
-                                        if (!string.IsNullOrEmpty(code)&&code.Length>5)
+                                        if (!string.IsNullOrEmpty(code) && code.Length > 5)
                                         {
                                             if (systemConfig.IsBasePartCodeChooseScrew)//是否基于零件码,判断是不是当站要打的螺丝
                                             {
@@ -2426,19 +2427,23 @@ namespace TeamAAS_VP.Core
                                                 if (val)
                                                 {
                                                     SendTaskMessage($"是当站螺丝:{code}", MessageLevel.Info);
+                                                    await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)1);
                                                 }
                                                 else
                                                 {
                                                     SendTaskMessage($"不是当站螺丝:{code}", MessageLevel.Info);
+                                                    await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
                                                     await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
                                                     return;
                                                 }
                                             }
                                             SendTaskMessage($"二维码扫码成功:{code}", MessageLevel.Info);
+                                            await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)1);
                                         }
                                         else
                                         {
                                             SendTaskMessage("二维码扫码失败", MessageLevel.Alarm);
+                                            await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
                                             await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
                                             return;
                                         }
@@ -2447,6 +2452,7 @@ namespace TeamAAS_VP.Core
                                     {
                                         code = "";
                                         SendTaskMessage("二维码扫码失败", MessageLevel.Alarm);
+                                        await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
                                         await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
                                         return;
                                     }
@@ -2466,7 +2472,7 @@ namespace TeamAAS_VP.Core
                                     //获取过站时间
                                     _LastMesCheckTime[i] = (await _mesService.GetServerTimeAsync(i, code, 2)).Now;
                                     if (_configService.GetDeviceInfo().EnableMES)
-                                    {                                              
+                                    {
                                         LogHelper.WriteLogMes($"【mes开始QUERY】");
                                         SendTaskMessage($"mes开始QUERY", MessageLevel.Info);
                                         //dataToMes.Clear();
@@ -2503,7 +2509,10 @@ namespace TeamAAS_VP.Core
                                                     if (snItem != null)
                                                     {
                                                         ProductMainSN[i] = snItem.Replace("sn=", "").Trim();
-                                                        _productService.CurrentProductCode = ProductMainSN[i];
+                                                        if (i == 0)
+                                                        {
+                                                            _productService.CurrentProductCode = ProductMainSN[i];
+                                                        }
                                                         //_eventAggregator.GetEvent<DelaySaveImageNotification>().Publish(true);//通知界面延迟保存图片,等待MES查询结果返回,避免图片和数据不同步
                                                         SendTaskMessage($"产品主sn:{ProductMainSN[i]}", MessageLevel.Info);
                                                     }
@@ -2626,7 +2635,7 @@ namespace TeamAAS_VP.Core
                                                         if (i == 0)
                                                         {
                                                             _productService.CurrentProductCode = ProductMainSN[i];
-                                                        }                                                       
+                                                        }
                                                         SendTaskMessage($"产品主sn:{ProductMainSN[i]}", MessageLevel.Info);
                                                     }
                                                     string woItem = item.FirstOrDefault(f => f.Contains("wo="));
@@ -2748,10 +2757,10 @@ namespace TeamAAS_VP.Core
                                 }
                                 // 上传本站数据
                                 else if (state == 2)
-                                {                                
+                                {
                                     DFC.Clear();//CTQ数据集合
-
-                                    //获取当前工位的配置
+                                                // string productccode = ProductMainSN[i];
+                                                //获取当前工位的配置
                                     var stationConfig = _configService.GetDeviceInfo(i);
                                     var sysConfig = _configService.GetSystemConfiguration();
                                     SendTaskMessage($"收到{i}:{stationConfig.DeviceName}上传本站数据请求...", MessageLevel.Debug);
@@ -2893,36 +2902,38 @@ namespace TeamAAS_VP.Core
                                                 PD_ATTR_03 = "NA",
                                                 PD_ATTR_04 = productSn,
                                                 PD_ATTR_05 = "NA",
-                                            });                                            
+                                            });
                                         }
                                         if (systemConfig.IsBasePartOpenLightKB)
                                         {
                                             string midValue = "999", saveppid = "NA";
                                             double upvlalue = 0, doenvlaue = 0;
                                             if (stationConfig.SaveCsvPPID) saveppid = ppid[i];
-                                            bool pressureRes=true;                                            
+                                            bool pressureRes = true;
                                             foreach (var item in mes_cc)
                                             {
-                                                switch(item.Key)
+                                                switch (item.Key)
                                                 {
                                                     case "1":
                                                         upvlalue = Convert.ToDouble(currentProduct.GlobalParamEx.CC1DownLimit.ToString("F3"));
                                                         doenvlaue = Convert.ToDouble(currentProduct.GlobalParamEx.CC1UpLimit.ToString("F3"));
                                                         midValue = ((currentProduct.GlobalParamEx.CC1DownLimit + currentProduct.GlobalParamEx.CC1UpLimit) / 2).ToString("F3");
+                                                        if (Convert.ToDouble(item.Value) < upvlalue || Convert.ToDouble(item.Value) > doenvlaue)
+                                                        {
+                                                            resultToMes.Add($"CC{item.Key}_Fail");
+                                                            SendTaskMessage($"CC{item.Key}:超限", MessageLevel.Error);
+                                                        }
                                                         break;
                                                     case "2":
                                                         upvlalue = Convert.ToDouble(currentProduct.GlobalParamEx.CC2DownLimit.ToString("F3"));
                                                         doenvlaue = Convert.ToDouble(currentProduct.GlobalParamEx.CC2UpLimit.ToString("F3"));
                                                         midValue = ((currentProduct.GlobalParamEx.CC2DownLimit + currentProduct.GlobalParamEx.CC2UpLimit) / 2).ToString("F3");
-                                                        break;                                                   
-                                                }
-                                                if (doenvlaue<= currentProduct.GlobalParamEx.CC1DownLimit|| doenvlaue >= currentProduct.GlobalParamEx.CC1UpLimit)
-                                                {
-                                                    pressureRes = false;
-                                                }
-                                                if (doenvlaue <= currentProduct.GlobalParamEx.CC2DownLimit|| doenvlaue >= currentProduct.GlobalParamEx.CC2UpLimit)
-                                                {
-                                                    pressureRes = false;
+                                                        if (Convert.ToDouble(item.Value) < upvlalue || Convert.ToDouble(item.Value) > doenvlaue)
+                                                        {
+                                                            resultToMes.Add($"CC{item.Key}_Fail");
+                                                            SendTaskMessage($"CC{item.Key}:超限", MessageLevel.Error);
+                                                        }
+                                                        break;
                                                 }
                                                 dataToMes.Add($"CC{item.Key}", $"{item.Value}");
                                                 DFC.Add(new DataFormCtq
@@ -3101,7 +3112,7 @@ namespace TeamAAS_VP.Core
                                     WriteProductLog(lockResultsAll, ProductMainSN[i], CTtime);
                                     mes_cc.Clear();
                                     LogHelper.WriteLogMes($"【mes结束ADD】");
-                                    SendTaskMessage($"mes结束ADD", MessageLevel.Info);                                 
+                                    SendTaskMessage($"mes结束ADD", MessageLevel.Info);
                                 }
                                 else
                                 {

+ 2 - 2
TeamAAS-VM/Properties/AssemblyInfo.cs

@@ -51,5 +51,5 @@ using System.Windows;
 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
 //通过使用 "*",如下所示:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.3.0.2")]
-[assembly: AssemblyFileVersion("1.3.0.2")]
+[assembly: AssemblyVersion("1.3.0.3")]
+[assembly: AssemblyFileVersion("1.3.0.3")]