zly 1 month ago
parent
commit
a033d8169f

+ 1 - 1
TeamAAS-VM/Core/ImageHelper.cs

@@ -20,7 +20,7 @@ namespace TeamAAS_VP.Core
         /// <param name="bitmap"></param>
         /// <param name="path">目标图像存储路径JPEG</param>
         /// <param name="quality">压缩等级,0到100,0 最差质量,100 最佳</param>
-        public static void CompressImage(Bitmap bitmap, string path, long quality = 100)
+        public static void CompressImage(Bitmap bitmap, string path, long quality = 20)
         {
             ImageCodecInfo codecInfo = GetEncoderInfo("image/jpeg");
             System.Drawing.Imaging.Encoder encoder = System.Drawing.Imaging.Encoder.Quality;

+ 213 - 71
TeamAAS-VM/Core/Management.cs

@@ -1163,6 +1163,19 @@ namespace TeamAAS_VP.Core
             }
             //订阅PLC地址变化
             plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger);
+            // 2. 监听重连事件,重连成功后自动重新订阅
+            plc.ConnectChangedEvent -= Plc_ConnectChanged; // 防止重复注册
+            plc.ConnectChangedEvent += Plc_ConnectChanged;
+
+            // 定义重连处理方法(写在同一个类里即可)
+            void Plc_ConnectChanged(object sender, bool isConnected)
+            {
+                if (isConnected)
+                {
+                    // 重连成功后,重新订阅节点
+                    plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger);
+                }
+            }
         }
 
         /// <summary>
@@ -1237,14 +1250,41 @@ namespace TeamAAS_VP.Core
                 {
                     await item.WriteToPlcAddress(addressConfig.Out_RemovePos, plc);
                 }
+                await plc.WriteNodeAsync(addressConfig.Out_RemoveNum.Address, (Int16)current.RemovePoints.Count);
+            }
+            else
+            {
+                await plc.WriteNodeAsync(addressConfig.Out_RemoveNum.Address, (Int16)0);
+            }
+            //if (current.PressurePlacePoints != null && current.PressurePlacePoints.Count > 0)
+            //{
+            //    foreach (var item in current.PressurePlacePoints)
+            //    {
+            //        await item.WriteToPlcAddress(addressConfig.Out_PressurePlace, plc);
+            //    }
+            //}
+            if (current.CameraCodePlcPoints != null && current.CameraCodePlcPoints.Count > 0)
+            {
+                foreach (var item in current.CameraCodePlcPoints)
+                {
+                    await item.WriteToPlcAddress(addressConfig.Out_Photo_Positipn, plc);
+                }
             }
-            if (current.PressurePlacePoints != null && current.PressurePlacePoints.Count > 0)
+            if (current.ProductPlacePoints != null && current.ProductPlacePoints.Count > 0)
             {
-                foreach (var item in current.PressurePlacePoints)
+                foreach (var item in current.ProductPlacePoints)
                 {
-                    await item.WriteToPlcAddress(addressConfig.Out_PressurePlace, plc);
+                    await item.WriteToPlcAddress(addressConfig.Out_ProductPlace_Positipn, plc);
                 }
             }
+            if (current.GunPressurePoints != null && current.GunPressurePoints.Count > 0)
+            {
+                foreach (var item in current.GunPressurePoints)
+                {
+                    await item.WriteToPlcAddress(addressConfig.Out_GunPressure_Positipn, plc);
+                }
+                await plc.WriteNodeAsync(addressConfig.Out_GunYaNum.Address, (Int16)current.GunPressurePoints.Count);
+            }
         }
 
         /// <summary>
@@ -1341,6 +1381,8 @@ namespace TeamAAS_VP.Core
         string[] color = new string[10];//产品color
         string[] ppid = new string[10];//产品ppid
         string[] revision { get; set; } = new string[10];//产品revision
+
+        List<string> resultToMes { get; set; }=new List<string>();
         /// <summary>
         /// 二次定位相机的工具坐标
         /// </summary>
@@ -1513,6 +1555,8 @@ namespace TeamAAS_VP.Core
                                     {
                                         float toolX = (float)(visionResults[0].X + visionResults[1].X) / 2;
                                         float toolY = (float)(visionResults[0].Y + visionResults[1].Y) / 2;
+                                        SendTaskMessage($"流程1相机拍照结果: {visionResults[0].X:F3},{visionResults[0].Y:F3}", MessageLevel.Info);
+                                        SendTaskMessage($"流程2相机拍照结果: {visionResults[1].X:F3},{visionResults[1].Y:F3}", MessageLevel.Info);
                                         _FixedUpCameraAngle = Common.CalculateAngleBetweenPointsDegrees(new PointF((float)visionResults[0].X, (float)visionResults[0].Y), new PointF((float)visionResults[1].X, (float)visionResults[1].Y));
                                         DowmCameraResults[cameraIndex] = new OpenCvSharp.Point3f(toolX, toolY, (float)_FixedUpCameraAngle);
                                         DownTool = new PointF(toolX, toolY);
@@ -2226,6 +2270,7 @@ namespace TeamAAS_VP.Core
                                 upCameraX = (UpCameraPutResults[1].X + UpCameraPutResults[2].X) / 2;
                                 upCameraY = (UpCameraPutResults[1].Y + UpCameraPutResults[2].Y) / 2;
                                 upCameraU = Common.CalculateAngleBetweenPointsDegrees(new PointF((float)UpCameraPutResults[1].X, (float)UpCameraPutResults[1].Y), new PointF((float)UpCameraPutResults[2].X, (float)UpCameraPutResults[2].Y));
+                                SendTaskMessage($"移动相机拍照壳体中心结果: {upCameraX:F3},{upCameraY:F3},{upCameraU:F3}", MessageLevel.Info);
                             }
 
                             var point = currentProduct.ScrewPoints[0].Clone();
@@ -2472,11 +2517,65 @@ namespace TeamAAS_VP.Core
                                 {
                                     return;
                                 }
-                                var code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
+
+
+                                //var code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
+                                var code = "";
                                 string comp = "";
                                 //过站请求
                                 if (state == 1)
                                 {
+                                    if (state == 1)
+                                    {
+                                        SendTaskMessage("收到PLC二维码拍照请求", MessageLevel.Debug);
+                                        // 四、几个非常重要的细节(工程级)
+                                        //1.Reset() 一定在发送命令前
+                                        //_scanDoneEvent.Reset();      
+                                        //否则:                            
+                                        //上一次扫码的 Set() 还在
+                                        //本次 Wait() 会直接通过(严重 bug)
+                                        // 2.Wait() 不要直接在 UI 线程
+                                        //你这里是 async,用:
+                                        //await Task.Run(() => _scanDoneEvent.Wait(3000));
+                                        ScanValue = "";
+                                        _scanDoneEvent.Reset(); // 重要:先关门
+
+                                        await Scan_Client.SendAsync("T");
+
+                                        // 等待扫码结果,最多 3 秒
+                                        bool scanOk = await Task.Run(() => _scanDoneEvent.Wait(3000));
+
+                                        if (scanOk && !ScanValue.IsNullOrWhiteSpace()&& ScanValue.Length>5)
+                                        {
+                                            PartSN = ScanValue;
+                                            code = PartSN;
+                                            //await plc.WriteNodeAsync(addressConfig.Out_PartCode.Address, PartSN);
+                                            SendTaskMessage($"二维码拍照成功,接收到值:{ScanValue}", MessageLevel.Info);
+                                            await plc.WriteNodeAsync(string.Format(addressConfig.Out_PartCode.Address), PartSN);
+                                            //var stationConfig2 = _configService.GetDeviceInfo(0);
+                                            //if (stationConfig2.EnableMES)
+                                            //{
+                                            //    (bool isSuccess, string response) = await _mesService.StationGetExAsync(0, PartSN, "", 2);//询问零件码,是否可以使用
+                                            //    if (!isSuccess)//如果二维码已使用,则返回false
+                                            //    {
+                                            //        //await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
+                                            //        await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
+                                            //        return;
+                                            //    }
+                                            //}
+                                        }
+                                        else
+                                        {
+                                            SendTaskMessage($"二维码拍照失败或超时:{ScanValue}", MessageLevel.Alarm);
+                                            await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
+                                            //await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (short)2);
+                                        }
+                                    }
+                                    else
+                                    {
+                                         code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
+                                    }
+
                                     //获取过站时间
                                     _LastMesCheckTime[i] = (await _mesService.GetServerTimeAsync(i, code, 2)).Now;
 
@@ -2589,7 +2688,7 @@ namespace TeamAAS_VP.Core
 
                                                 //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
                                                 await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
-                                                await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
+                                                await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
                                             }
                                         }
                                         else
@@ -2599,7 +2698,7 @@ namespace TeamAAS_VP.Core
 
                                             //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
                                             await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
-                                            await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
+                                            await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
                                         }
                                         LogHelper.WriteLogMes($"【mes结束QUERY】");
                                         SendTaskMessage($"mes结束QUERY", MessageLevel.Info);
@@ -2695,7 +2794,7 @@ namespace TeamAAS_VP.Core
                                             SendTaskMessage($"询问mes失败:{response}", MessageLevel.Error);
                                             //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
                                             await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
-                                            await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
+                                            await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
                                         }
                                         LogHelper.WriteLogMes($"【mes结束QUERY】");
                                         SendTaskMessage($"mes结束QUERY", MessageLevel.Info);
@@ -2736,6 +2835,7 @@ namespace TeamAAS_VP.Core
 
                                     //读取产品结果
                                     Int16 resultIndex = plc.ReadNode<Int16>(string.Format(addressConfig.In_Result.Address, i));
+                                    SendTaskMessage($"读取PLC结果为{resultIndex}",MessageLevel.Debug);
                                     //读取压力值
                                     float pressure = plc.ReadNode<float>(string.Format(addressConfig.In_PressureValue.Address, i));
 
@@ -2796,66 +2896,106 @@ namespace TeamAAS_VP.Core
                                     //data.Add("CC1", mes_cc["2"]);
                                     //SendTaskMessage($"CC1:{mes_cc["1"]},CC2:{mes_cc["2"]}", MessageLevel.Info);
                                     assypress = currentPressure[i].ToString("F2");
+                                    
                                     SendTaskMessage($"cc:{cc},组装压力:{assypress}", MessageLevel.Debug);
+
                                     #region CSV数据
                                     DFC.Clear();
                                     bool assyPress = resultIndex == 1 ? true : false;
+                                    bool cc1result = true; bool cc2result = true;
                                     string midValue = "NA", saveppid = "NA";
-                                    midValue = ((currentProduct.GlobalParamEx.CC1DownLimit + currentProduct.GlobalParamEx.CC1UpLimit) / 2).ToString("F3");
+
+                                   // midValue = ((currentProduct.GlobalParamEx.CC1DownLimit + currentProduct.GlobalParamEx.CC1UpLimit) / 2).ToString("F3");
                                     if (stationConfig.SaveCsvPPID) saveppid = ppid[i];
-                                    DFC.Add(new DataFormCtq
-                                    {
-                                        PPID = saveppid,
-                                        PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
-                                        PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
-                                        CTQ_NAME = "CC1",
-                                        CTQ_VALUE = mes_cc["1"],
-                                        CTQ_LSL = currentProduct.GlobalParamEx.CC1DownLimit.ToString("F3"),
-                                        CTQ_USL = currentProduct.GlobalParamEx.CC1UpLimit.ToString("F3"),
-                                        PROCESS_END_TIME = serverTimeResult.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
-                                        SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
-                                        COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
-                                        REVISION = stationConfig.DataInfo.REVISION+"_"+ revision[i],
-                                        WO = wo[i],
-                                        MFG_LOT = stationConfig.DataInfo.MFG_LOT,
-                                        MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
-                                        PROCESS_OUTCOME = assyPress ? "Pass" : "Fail",
-                                        PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
-                                        CTQ_UNIT_OF_MEASURE = "mm",
-                                        ERROR_MESSAGE = assyPress ? "NA" : "CC OOS",
-                                        PD_ATTR_01 = ProductMainSN[i],
-                                        PD_ATTR_02 = midValue,
-                                        PD_ATTR_03 = PartSN,
-                                        PD_ATTR_04 = code,
-                                        PD_ATTR_05 = "NA",
-                                    });
-                                    midValue = ((currentProduct.GlobalParamEx.CC2DownLimit + currentProduct.GlobalParamEx.CC2UpLimit) / 2).ToString("F3");
-                                    DFC.Add(new DataFormCtq
+                                    //if (mes_cc.Keys.Contains("1"))
+                                    //{
+                                    //    if (Convert.ToDouble(mes_cc["1"]) < Convert.ToDouble(currentProduct.GlobalParamEx.CC1DownLimit.ToString("F3")) || Convert.ToDouble(mes_cc["1"]) > Convert.ToDouble(currentProduct.GlobalParamEx.CC1UpLimit.ToString("F3")))
+                                    //    {
+                                    //        if (!resultToMes.Contains("CC1_Fail"))
+                                    //        {
+                                    //            resultToMes.Add($"CC1_Fail");
+                                    //        }
+                                    //        cc1result = false;
+                                    //    }
+                                    //}
+                                    //if (mes_cc.Keys.Contains("2"))
+                                    //{
+                                    //    if (Convert.ToDouble(mes_cc["2"]) < Convert.ToDouble(currentProduct.GlobalParamEx.CC2DownLimit.ToString("F3")) || Convert.ToDouble(mes_cc["2"]) > Convert.ToDouble(currentProduct.GlobalParamEx.CC2UpLimit.ToString("F3")))
+                                    //    {
+                                    //        if (!resultToMes.Contains("CC2_Fail"))
+                                    //        {
+                                    //            resultToMes.Add($"CC2_Fail");
+                                    //        }
+                                    //        cc2result = false;
+                                    //    }
+                                    //}                                   
+                                    if (Convert.ToDouble(Math.Round(double.Parse(assypress), 3).ToString())<Convert.ToDouble(currentProduct.GlobalParamEx.DownPressure.PressureDownLimit.ToString("F3"))|| Convert.ToDouble(Math.Round(double.Parse(assypress), 3).ToString())>Convert.ToDouble(currentProduct.GlobalParamEx.DownPressure.PressureUpLimit.ToString("F3")))
                                     {
-                                        PPID = saveppid,
-                                        PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
-                                        PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
-                                        CTQ_NAME = "CC2",
-                                        CTQ_VALUE = mes_cc["2"],
-                                        CTQ_LSL = currentProduct.GlobalParamEx.CC2DownLimit.ToString("F3"),
-                                        CTQ_USL = currentProduct.GlobalParamEx.CC2UpLimit.ToString("F3"),
-                                        PROCESS_END_TIME = serverTimeResult.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
-                                        SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
-                                        COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
-                                        REVISION = stationConfig.DataInfo.REVISION + "_" + revision[i],
-                                        WO = wo[i],
-                                        MFG_LOT = stationConfig.DataInfo.MFG_LOT,
-                                        MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
-                                        PROCESS_OUTCOME = assyPress ? "Pass" : "Fail",
-                                        PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
-                                        CTQ_UNIT_OF_MEASURE = "mm",
-                                        ERROR_MESSAGE = assyPress ? "NA" : "CC OOS",
-                                        PD_ATTR_01 = ProductMainSN[i],
-                                        PD_ATTR_02 = midValue,
-                                        PD_ATTR_03 = PartSN,
-                                        PD_ATTR_04 = code,
-                                        PD_ATTR_05 = "NA",
-                                    });
+                                        if (!resultToMes.Contains("Assy_Pressure_Fail"))
+                                        {
+                                            resultToMes.Add($"Assy_Pressure_Fail");
+                                        }
+                                        //assyPress = false;
+                                    }
+                                    //if (mes_cc.Keys.Contains("1"))
+                                    //{
+                                    //    DFC.Add(new DataFormCtq
+                                    //    {
+                                    //        PPID = saveppid,
+                                    //        PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
+                                    //        PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
+                                    //        CTQ_NAME = "CC1",
+                                    //        CTQ_VALUE = mes_cc["1"],
+                                    //        CTQ_LSL = currentProduct.GlobalParamEx.CC1DownLimit.ToString("F3"),
+                                    //        CTQ_USL = currentProduct.GlobalParamEx.CC1UpLimit.ToString("F3"),
+                                    //        PROCESS_END_TIME = serverTimeResult.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
+                                    //        SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
+                                    //        COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
+                                    //        REVISION = stationConfig.DataInfo.REVISION + "_" + revision[i],
+                                    //        WO = wo[i],
+                                    //        MFG_LOT = stationConfig.DataInfo.MFG_LOT,
+                                    //        MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
+                                    //        PROCESS_OUTCOME = cc1result ? "Pass" : "Fail",
+                                    //        PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
+                                    //        CTQ_UNIT_OF_MEASURE = "mm",
+                                    //        ERROR_MESSAGE = cc1result ? "NA" : "CC1 OOS",
+                                    //        PD_ATTR_01 = ProductMainSN[i],
+                                    //        PD_ATTR_02 = midValue,
+                                    //        PD_ATTR_03 = PartSN,
+                                    //        PD_ATTR_04 = code,
+                                    //        PD_ATTR_05 = "NA",
+                                    //    });
+                                    //}
+                                    //if (mes_cc.Keys.Contains("2"))
+                                    //{
+                                    //    midValue = ((currentProduct.GlobalParamEx.CC2DownLimit + currentProduct.GlobalParamEx.CC2UpLimit) / 2).ToString("F3");
+                                    //    DFC.Add(new DataFormCtq
+                                    //    {
+                                    //        PPID = saveppid,
+                                    //        PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
+                                    //        PROCESS_START_TIME = _LastMesCheckTime[i].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
+                                    //        CTQ_NAME = "CC2",
+                                    //        CTQ_VALUE = mes_cc["2"],
+                                    //        CTQ_LSL = currentProduct.GlobalParamEx.CC2DownLimit.ToString("F3"),
+                                    //        CTQ_USL = currentProduct.GlobalParamEx.CC2UpLimit.ToString("F3"),
+                                    //        PROCESS_END_TIME = serverTimeResult.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
+                                    //        SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
+                                    //        COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
+                                    //        REVISION = stationConfig.DataInfo.REVISION + "_" + revision[i],
+                                    //        WO = wo[i],
+                                    //        MFG_LOT = stationConfig.DataInfo.MFG_LOT,
+                                    //        MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
+                                    //        PROCESS_OUTCOME = cc2result ? "Pass" : "Fail",
+                                    //        PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
+                                    //        CTQ_UNIT_OF_MEASURE = "mm",
+                                    //        ERROR_MESSAGE = cc2result ? "NA" : "CC2 OOS",
+                                    //        PD_ATTR_01 = ProductMainSN[i],
+                                    //        PD_ATTR_02 = midValue,
+                                    //        PD_ATTR_03 = PartSN,
+                                    //        PD_ATTR_04 = code,
+                                    //        PD_ATTR_05 = "NA",
+                                    //    });
+                                    //}
                                     midValue = ((currentProduct.GlobalParamEx.DownPressure.PressureDownLimit + currentProduct.GlobalParamEx.DownPressure.PressureUpLimit) / 2).ToString("F3");
                                     DFC.Add(new DataFormCtq
                                     {
@@ -2885,7 +3025,7 @@ namespace TeamAAS_VP.Core
                                     });
                                     #endregion
                                     //cc-复检cc,assypress-组装站压力
-                                    (bool isSuccess, string response) = await _mesService.SubmitGetAsync(i, ProductMainSN[i], comp, cc, assypress, resultIndex == 1 ? true : false, _LastMesCheckTime[i], serverTimeResult.Now);
+                                    (bool isSuccess, string response) = await _mesService.SubmitGetAsync(i, ProductMainSN[i], comp, resultToMes, cc, assypress, resultIndex == 1 ? true : false, _LastMesCheckTime[i], serverTimeResult.Now);
                                     if (!stationConfig.EnableMES || isSuccess)
                                     {
                                         LogHelper.WriteLogMes($"上传mes成功");
@@ -2896,8 +3036,8 @@ namespace TeamAAS_VP.Core
                                         LogHelper.WriteLogMes($"上传mes失败");
                                         SendTaskMessage($"上传mes失败", MessageLevel.Error);
                                     }
+                                    await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
 
-                                    
 
                                     //是否保存当前的产品记录至CSV?
                                     if (stationConfig.SaveCsv)
@@ -2920,11 +3060,10 @@ namespace TeamAAS_VP.Core
                                                         var device = _configService.GetDeviceInfo(i);
                                                         var systemConfig = _configService.GetSystemConfiguration();
                                                         var pressureSensorConfig = systemConfig.PressureSensorConfig.FirstOrDefault();
-                                                        (bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN[i], filename);
-                                                        if (isSuc)
+                                                        //(bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN[i], filename);
+                                                        if (true)
                                                         {
-                                                            LogHelper.WriteLogMes($"上传数据成功");
-                                                            SendTaskMessage($"上传数据成功", MessageLevel.Debug);
+                                                           
                                                             string filePath = $"D:\\image\\Recored\\{dt.ToString("yyyy-MM")}\\{dt.ToString("MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
                                                             string source_csv2 = $"{stationConfig.SaveCsvPath}\\{dt.ToString("yyyy-MM")}\\{i}_{stationConfig.DeviceName}_{dt.ToString("yyyy-MM-dd")}";
                                                             if (!Directory.Exists(filePath))
@@ -2952,7 +3091,7 @@ namespace TeamAAS_VP.Core
                                                                     {
                                                                         string target_Torque = target_Directory + item.Replace(source_Torque_Image, "");
                                                                         File.Copy(item, target_Torque, true);
-                                                                        SendTaskMessage($"曲线图{i}保存成功", MessageLevel.Error);
+                                                                        SendTaskMessage($"曲线图{i}保存成功", MessageLevel.Debug);
                                                                     }
                                                                 }
                                                                 catch (Exception)
@@ -2962,6 +3101,8 @@ namespace TeamAAS_VP.Core
                                                             }
 
                                                             CompressionImage(filePath, filename, device.Station, device.FixtureId);
+                                                            LogHelper.WriteLogMes($"上传数据成功");
+                                                            SendTaskMessage($"上传数据成功", MessageLevel.Debug);
 
                                                             //上传csv
                                                             bool isAfter20 = dt.Hour >= 20;
@@ -2985,8 +3126,8 @@ namespace TeamAAS_VP.Core
                                                         }
                                                         else
                                                         {
-                                                            LogHelper.WriteLogMes($"上传数据失败");
-                                                            SendTaskMessage($"上传数据失败", MessageLevel.Error);
+                                                           // LogHelper.WriteLogMes($"上传数据失败");
+                                                            //SendTaskMessage($"上传数据失败", MessageLevel.Error);
                                                         }
                                                     }
                                                     else
@@ -3015,10 +3156,10 @@ namespace TeamAAS_VP.Core
                                     {
                                         SendTaskMessage($"{i}:{stationConfig.DeviceName}工位未配置保存产品记录", MessageLevel.Debug);
                                     }
-                                    await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
                                     LogHelper.WriteLogMes($"【mes结束ADD】");
                                     SendTaskMessage($"mes结束ADD", MessageLevel.Info);
                                     mes_cc.Clear();
+                                    resultToMes.Clear();
                                     return;
                                 }
                                 else
@@ -3075,6 +3216,7 @@ namespace TeamAAS_VP.Core
                                 }
                                 if (state == 1)
                                 {
+                                    
                                     SendTaskMessage($"收到停止压力信号[{i}]...", MessageLevel.Debug);
                                     //获取当前锁付点
                                     //var screwPoint = currentProduct.ScrewPoints.FirstOrDefault(p => p.Number == positionIndex);
@@ -3233,7 +3375,7 @@ namespace TeamAAS_VP.Core
                     {
                         try
                         {
-                            float pressure = plc.ReadNode<float>(string.Format(addressConfig.In_CurPressureValue.Address, Index));
+                            float pressure = plc.ReadNode<float>(string.Format(addressConfig.In_CurPressureValue.Address, Index+1));
                             lock (_pressureSamples[Index])
                             {
                                 _pressureSamples[Index].Add((DateTime.Now, pressure));

+ 1 - 0
TeamAAS-VM/Core/Robots/XYZU_Robot.cs

@@ -268,6 +268,7 @@ namespace TeamAAS_VP.Core.Robots
             get { return _SafeZ; }
             set { SetProperty(ref _SafeZ, value); }
         }
+
         #endregion
 
         #region Á¬½Ó

+ 2 - 2
TeamAAS-VM/Interfaces/IMesService.cs

@@ -81,7 +81,7 @@ namespace TeamAAS_VP.Interfaces
         /// - 若 <paramref name="start_time"/> 晚于 <paramref name="stop_time"/>,实现应记录并视情况返回失败或抛出异常。
         /// - 实现应尊重 <paramref name="cancellationToken"/>,并在取消时尽早中止请求。
         /// </remarks>
-        Task<(bool IsSuccess, string Response)> SubmitGetAsync(int deviceNo, string sn, string comp, string cc, string assypress, bool isSuccess, DateTime start_time, DateTime stop_time, CancellationToken cancellationToken = default);
+        Task<(bool IsSuccess, string Response)> SubmitGetAsync(int deviceNo, string sn, string comp, List<string> results, string cc, string assypress, bool isSuccess, DateTime start_time, DateTime stop_time, CancellationToken cancellationToken = default);
 
         /// <summary>
         /// 使用配置的提交(Submit)URL 发起 GET 请求,提交过站结果及时间信息,并使用指定的超时时间(秒)。
@@ -100,7 +100,7 @@ namespace TeamAAS_VP.Interfaces
         /// - 此重载用于在不传入 <see cref="CancellationToken"/> 的场景中指定超时时间。
         /// - 实现应确保对时间参数与布尔参数进行适当的 URL 编码或格式化。
         /// </remarks>
-        Task<(bool IsSuccess, string Response)> SubmitGetAsync(int deviceNo, string sn, string comp, string cc, string assypress, bool isSuccess, DateTime start_time, DateTime stop_time, double timeoutInSeconds);
+        Task<(bool IsSuccess, string Response)> SubmitGetAsync(int deviceNo, string sn, string comp, List<string> results, string cc, string assypress, bool isSuccess, DateTime start_time, DateTime stop_time, double timeoutInSeconds);
 
         /// <summary>
         /// 获取服务器当前时间

+ 155 - 21
TeamAAS-VM/Models/PLC/PlcAddressConfig.cs

@@ -150,6 +150,26 @@ namespace TeamAAS_VP.Models.PLC
             set { SetProperty(ref _WorkNum, value); }
         }
 
+        private PlcAddress _RemoveNum = new PlcAddress();
+        /// <summary>
+        /// 锁撕膜点位数量
+        /// </summary>
+        public PlcAddress Out_RemoveNum
+        {
+            get { return _RemoveNum; }
+            set { SetProperty(ref _RemoveNum, value); }
+        }
+
+        private PlcAddress _GunYaNum = new PlcAddress();
+        /// <summary>
+        /// 锁附/组装数量
+        /// </summary>
+        public PlcAddress Out_GunYaNum
+        {
+            get { return _GunYaNum; }
+            set { SetProperty(ref _GunYaNum, value); }
+        }
+
         private PlcAddress _DownCameraStatus = new PlcAddress();
         /// <summary>
         /// 下相机拍照结果 =1 拍照OK =2 拍照NG =3 取图拍照OK
@@ -320,6 +340,37 @@ namespace TeamAAS_VP.Models.PLC
             set { SetProperty(ref _Out_PressurePlace, value); }
         }
 
+        private PlcPointAddress _Out_Photo_Positipn = new PlcPointAddress();
+        /// <summary>
+        /// 扫码点位参数
+        /// </summary>
+        public PlcPointAddress Out_Photo_Positipn
+        {
+            get { return _Out_Photo_Positipn; }
+            set { SetProperty(ref _Out_Photo_Positipn, value); }
+        }
+
+        private PlcPointAddress _Out_ProductPlace_Positipn = new PlcPointAddress();
+        /// <summary>
+        /// 产品升降取料位参数
+        /// </summary>
+        public PlcPointAddress Out_ProductPlace_Positipn
+        {
+            get { return _Out_ProductPlace_Positipn; }
+            set { SetProperty(ref _Out_ProductPlace_Positipn, value); }
+        }
+
+        private PlcPointAddress _Out_GunPressure_Positipn = new PlcPointAddress();
+        /// <summary>
+        /// 滚压点位参数
+        /// </summary>
+        public PlcPointAddress Out_GunPressure_Positipn
+        {
+            get { return _Out_GunPressure_Positipn; }
+            set { SetProperty(ref _Out_GunPressure_Positipn, value); }
+        }
+
+
         private PlcAddress _Out_ScrewTeachNum;
         /// <summary>
         /// 披头矫正的模式,1:初始化时矫正,2:每个产品矫正一次,3:每颗螺丝矫正一次
@@ -379,7 +430,15 @@ namespace TeamAAS_VP.Models.PLC
             set { SetProperty(ref _Down_WetOut_Num_max, value); }
         }
 
-
+        private PlcAddress _Out_PartCode;
+        /// <summary>
+        /// 零件的扫码编号写入到PLC
+        /// </summary>
+        public PlcAddress Out_PartCode
+        {
+            get { return _Out_PartCode; }
+            set { SetProperty(ref _Out_PartCode, value); }
+        }
 
         #endregion
 
@@ -835,6 +894,18 @@ namespace TeamAAS_VP.Models.PLC
             Out_WorkNum.DataType = "int16";
             Out_WorkNum.Description = "锁附/组装数量";
 
+            Out_RemoveNum = Ensure(Out_RemoveNum);
+            Out_RemoveNum.Address = "ns=4;s=DB_Communication|FromPC.RemoveNum";
+            Out_RemoveNum.DataType = "int16";
+            Out_RemoveNum.Description = "撕膜点位数量";
+
+            //Out_GunYaNum
+            Out_GunYaNum = Ensure(Out_GunYaNum);
+            Out_GunYaNum.Address = "ns=4;s=DB_Communication|FromPC.GunYaNum";
+            Out_GunYaNum.DataType = "int16";
+            Out_GunYaNum.Description = "滚压点位数量";
+
+
             Out_DownCameraStatus = Ensure(Out_DownCameraStatus);
             Out_DownCameraStatus.Address = "ns=4;s=DB_Communication|FromPC.DownCameraStatus";
             Out_DownCameraStatus.DataType = "int16";
@@ -1013,24 +1084,82 @@ namespace TeamAAS_VP.Models.PLC
             Out_RemovePos.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].Feeder";
             Out_RemovePos.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].ScrewProNum";
 
-            //压力组装点位
-            Out_PressurePlace = EnsurePoint(Out_PressurePlace);
-            Out_PressurePlace.Description = "压力组装点位参数";
-            Out_PressurePlace.X_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].X_Position";
-            Out_PressurePlace.X_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].X_Velocity";
-            Out_PressurePlace.Y_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Y_Position";
-            Out_PressurePlace.Y_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Y_Velocity";
-            Out_PressurePlace.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Z_Position_Start";
-            Out_PressurePlace.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Z_Velocity_Start";
-            Out_PressurePlace.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Z_Position_Stop";
-            Out_PressurePlace.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Z_Velocity_Stop";
-            Out_PressurePlace.U_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].U_Position";
-            Out_PressurePlace.U_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].U_Velocity";
-            Out_PressurePlace.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].R_Position";
-            Out_PressurePlace.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].R_Velocity";
-            Out_PressurePlace.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Torque";
-            Out_PressurePlace.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Feeder";
-            Out_PressurePlace.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].ScrewProNum";
+
+            //扫码点位
+            Out_Photo_Positipn = EnsurePoint(Out_Photo_Positipn);
+            Out_Photo_Positipn.Description = "扫码点位参数";
+            Out_Photo_Positipn.X_Position.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].X_Position";
+            Out_Photo_Positipn.X_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].X_Velocity";
+            Out_Photo_Positipn.Y_Position.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].Y_Position";
+            Out_Photo_Positipn.Y_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].Y_Velocity";
+            Out_Photo_Positipn.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].Z_Position_Start";
+            Out_Photo_Positipn.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].Z_Velocity_Start";
+            Out_Photo_Positipn.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].Z_Position_Stop";
+            Out_Photo_Positipn.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].Z_Velocity_Stop";
+            Out_Photo_Positipn.U_Position.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].U_Position";
+            Out_Photo_Positipn.U_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].U_Velocity";
+            Out_Photo_Positipn.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].R_Position";
+            Out_Photo_Positipn.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].R_Velocity";
+            Out_Photo_Positipn.Torque.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].Torque";
+            Out_Photo_Positipn.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].Feeder";
+            Out_Photo_Positipn.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Photo_Positipn[{0}].ScrewProNum";
+
+            // 产品升降取料位参数
+            Out_ProductPlace_Positipn = EnsurePoint(Out_ProductPlace_Positipn);
+            Out_ProductPlace_Positipn.Description = "产品升降取料位参数";
+            Out_ProductPlace_Positipn.X_Position.Address = "ns=4;s=DB_Communication|";
+            Out_ProductPlace_Positipn.X_Velocity.Address = "ns=4;s=DB_Communication|";
+            Out_ProductPlace_Positipn.Y_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Move[{0}].Y_Position";//取料移栽Y轴
+            Out_ProductPlace_Positipn.Y_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Move[{0}].Y_Velocity";
+            Out_ProductPlace_Positipn.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Move[{0}].Z_Position_Start";//取料升降Z轴
+            Out_ProductPlace_Positipn.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Move[{0}].Z_Velocity_Start";
+            Out_ProductPlace_Positipn.Z_Position_Stop.Address = "ns=4;s=DB_Communication|";
+            Out_ProductPlace_Positipn.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|";
+            Out_ProductPlace_Positipn.U_Position.Address = "ns=4;s=DB_Communication|";
+            Out_ProductPlace_Positipn.U_Velocity.Address = "ns=4;s=DB_Communication|";
+            Out_ProductPlace_Positipn.R_Position.Address = "ns=4;s=DB_Communication|";
+            Out_ProductPlace_Positipn.R_Velocity.Address = "ns=4;s=DB_Communication|";
+            Out_ProductPlace_Positipn.Torque.Address = "ns=4;s=DB_Communication|";
+            Out_ProductPlace_Positipn.Feeder.Address = "ns=4;s=DB_Communication|";
+            Out_ProductPlace_Positipn.ScrewProNum.Address = "ns=4;s=DB_Communication|";
+
+            // 滚压点位参数
+            Out_GunPressure_Positipn = EnsurePoint(Out_GunPressure_Positipn);
+            Out_GunPressure_Positipn.Description = "滚压点位参数";
+            Out_GunPressure_Positipn.X_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_gunya[{0}].X_Position";
+            Out_GunPressure_Positipn.X_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_gunya[{0}].X_Velocity";
+            Out_GunPressure_Positipn.Y_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_gunya[{0}].Y_Position";
+            Out_GunPressure_Positipn.Y_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_gunya[{0}].Y_Velocity";
+            Out_GunPressure_Positipn.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_gunya[{0}].Z_Position_Start";//滚压升降Z轴
+            Out_GunPressure_Positipn.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_gunya[{0}].Z_Velocity_Start";
+            Out_GunPressure_Positipn.Z_Position_Stop.Address = "ns=4;s=DB_Communication|";
+            Out_GunPressure_Positipn.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|";
+            Out_GunPressure_Positipn.U_Position.Address = "ns=4;s=DB_Communication|";
+            Out_GunPressure_Positipn.U_Velocity.Address = "ns=4;s=DB_Communication|";
+            Out_GunPressure_Positipn.R_Position.Address = "ns=4;s=DB_Communication|";
+            Out_GunPressure_Positipn.R_Velocity.Address = "ns=4;s=DB_Communication|";
+            Out_GunPressure_Positipn.Torque.Address = "ns=4;s=DB_Communication|";
+            Out_GunPressure_Positipn.Feeder.Address = "ns=4;s=DB_Communication|";
+            Out_GunPressure_Positipn.ScrewProNum.Address = "ns=4;s=DB_Communication|";
+
+            ////压力组装点位
+            //Out_PressurePlace = EnsurePoint(Out_PressurePlace);
+            //Out_PressurePlace.Description = "压力组装点位参数";
+            //Out_PressurePlace.X_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].X_Position";
+            //Out_PressurePlace.X_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].X_Velocity";
+            //Out_PressurePlace.Y_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Y_Position";
+            //Out_PressurePlace.Y_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Y_Velocity";
+            //Out_PressurePlace.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Z_Position_Start";
+            //Out_PressurePlace.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Z_Velocity_Start";
+            //Out_PressurePlace.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Z_Position_Stop";
+            //Out_PressurePlace.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Z_Velocity_Stop";
+            //Out_PressurePlace.U_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].U_Position";
+            //Out_PressurePlace.U_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].U_Velocity";
+            //Out_PressurePlace.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].R_Position";
+            //Out_PressurePlace.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].R_Velocity";
+            //Out_PressurePlace.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Torque";
+            //Out_PressurePlace.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].Feeder";
+            //Out_PressurePlace.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_Wetout[{0}].ScrewProNum";
 
             // Out_CheckCamera(附加轴点位)初始化并赋地址,
 
@@ -1048,7 +1177,12 @@ namespace TeamAAS_VP.Models.PLC
             Out_ScrewFeederIsChanged.Address = "ns=4;s=DB_Communication|FromPC.PickNumChange";
             Out_ScrewFeederIsChanged.DataType = "int16";
             Out_ScrewFeederIsChanged.Description = "供料器发生改变";
-            
+
+            Out_PartCode = Ensure(Out_PartCode);
+            Out_PartCode.Address = "ns=4;s=DB_Communication|FromPC.Code";
+            Out_PartCode.DataType = "string";
+            Out_PartCode.Description = "零件的扫码编号写入到PLC";
+
 
 
             // 4. In_* 默认(假定从 PLC 读到 PC,使用 ToPC 前缀)
@@ -1163,7 +1297,7 @@ namespace TeamAAS_VP.Models.PLC
             In_PressureValue.Description = "压力值";
 
             In_CurPressureValue = Ensure(In_CurPressureValue);
-            In_CurPressureValue.Address = "ns=4;s=DB_DriveControl|AICtrl[{0}].Status.UserData"; ;// "ns=4;s=DB_DriveControl|AICtrl[{0}].Status.UserData";
+            In_CurPressureValue.Address = "ns=4;s=DB_DriveControl|AICtrl[{0}].Status.UserData2"; ;// "ns=4;s=DB_DriveControl|AICtrl[{0}].Status.UserData";
             In_CurPressureValue.DataType = "float";
             In_CurPressureValue.Description = "实时压力值";
 

+ 44 - 15
TeamAAS-VM/Models/PLC/PlcPoint.cs

@@ -343,21 +343,50 @@ namespace TeamAAS_VP.Models.PLC
         public async Task<bool> WriteToPlcAddress(PlcPointAddress plcAddress, OpcUaClientPLC pLC)
         {
             Dictionary<string, object> nodeValues = new Dictionary<string, object>();
-            nodeValues.Add(string.Format(plcAddress.X_Position.Address, Number), X_Position + X_Offset);
-            nodeValues.Add(string.Format(plcAddress.X_Velocity.Address, Number), X_Velocity);
-            nodeValues.Add(string.Format(plcAddress.Y_Position.Address, Number), Y_Position + Y_Offset);
-            nodeValues.Add(string.Format(plcAddress.Y_Velocity.Address, Number), Y_Velocity);
-            nodeValues.Add(string.Format(plcAddress.Z_Position_Start.Address, Number), Z_Position_Start + Z_Start_Offset);
-            nodeValues.Add(string.Format(plcAddress.Z_Velocity_Start.Address, Number), Z_Velocity_Start);
-            nodeValues.Add(string.Format(plcAddress.Z_Position_Stop.Address, Number), Z_Position_Stop + Z_Stop_Offset);
-            nodeValues.Add(string.Format(plcAddress.Z_Velocity_Stop.Address, Number), Z_Velocity_Stop);
-            nodeValues.Add(string.Format(plcAddress.U_Position.Address, Number), U_Position + U_Offset);
-            nodeValues.Add(string.Format(plcAddress.U_Velocity.Address, Number), U_Velocity);
-            nodeValues.Add(string.Format(plcAddress.R_Position.Address, Number), R_Position + R_Offset);
-            nodeValues.Add(string.Format(plcAddress.R_Velocity.Address, Number), R_Velocity);
-            nodeValues.Add(string.Format(plcAddress.Torque.Address, Number), Torque);
-            nodeValues.Add(string.Format(plcAddress.Feeder.Address, Number), Feeder);
-            nodeValues.Add(string.Format(plcAddress.ScrewProNum.Address, Number), ScrewProNum);
+
+            try
+            {
+                if (plcAddress != null && plcAddress.Description == "产品升降取料位参数")//只写入PLC用得到的点位参数
+                {
+                    nodeValues.Add(string.Format(plcAddress.Y_Position.Address, Number), Y_Position);
+                    nodeValues.Add(string.Format(plcAddress.Y_Velocity.Address, Number), Y_Velocity);
+                    nodeValues.Add(string.Format(plcAddress.Z_Position_Start.Address, Number), Z_Position_Start);
+                    nodeValues.Add(string.Format(plcAddress.Z_Velocity_Start.Address, Number), Z_Velocity_Start);
+                }
+                else if (plcAddress != null && plcAddress.Description == "滚压点位参数")
+                {
+                    nodeValues.Add(string.Format(plcAddress.X_Position.Address, Number), X_Position);
+                    nodeValues.Add(string.Format(plcAddress.X_Velocity.Address, Number), X_Velocity);
+                    nodeValues.Add(string.Format(plcAddress.Y_Position.Address, Number), Y_Position);
+                    nodeValues.Add(string.Format(plcAddress.Y_Velocity.Address, Number), Y_Velocity);
+                    nodeValues.Add(string.Format(plcAddress.Z_Position_Start.Address, Number), Z_Position_Start);
+                    nodeValues.Add(string.Format(plcAddress.Z_Velocity_Start.Address, Number), Z_Velocity_Start);
+                }
+                else
+                {
+                    nodeValues.Add(string.Format(plcAddress.X_Position.Address, Number), X_Position + X_Offset);
+                    nodeValues.Add(string.Format(plcAddress.X_Velocity.Address, Number), X_Velocity);
+                    nodeValues.Add(string.Format(plcAddress.Y_Position.Address, Number), Y_Position + Y_Offset);
+                    nodeValues.Add(string.Format(plcAddress.Y_Velocity.Address, Number), Y_Velocity);
+                    nodeValues.Add(string.Format(plcAddress.Z_Position_Start.Address, Number), Z_Position_Start + Z_Start_Offset);
+                    nodeValues.Add(string.Format(plcAddress.Z_Velocity_Start.Address, Number), Z_Velocity_Start);
+                    nodeValues.Add(string.Format(plcAddress.Z_Position_Stop.Address, Number), Z_Position_Stop + Z_Stop_Offset);
+                    nodeValues.Add(string.Format(plcAddress.Z_Velocity_Stop.Address, Number), Z_Velocity_Stop);
+                    nodeValues.Add(string.Format(plcAddress.U_Position.Address, Number), U_Position + U_Offset);
+                    nodeValues.Add(string.Format(plcAddress.U_Velocity.Address, Number), U_Velocity);
+                    nodeValues.Add(string.Format(plcAddress.R_Position.Address, Number), R_Position + R_Offset);
+                    nodeValues.Add(string.Format(plcAddress.R_Velocity.Address, Number), R_Velocity);
+                    nodeValues.Add(string.Format(plcAddress.Torque.Address, Number), Torque);
+                    nodeValues.Add(string.Format(plcAddress.Feeder.Address, Number), Feeder);
+                    nodeValues.Add(string.Format(plcAddress.ScrewProNum.Address, Number), ScrewProNum);
+                }
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine(ex.ToString());
+                
+            }
+            
             return await pLC.WriteNodesAsync(nodeValues);
         }
 

+ 2 - 2
TeamAAS-VM/Models/PLC/PlcPointAddress.cs

@@ -25,7 +25,7 @@ namespace TeamAAS_VP.Models.PLC
         public PlcAddress Torque { get; set; }
         public PlcAddress Feeder { get; set; }
         public PlcAddress ScrewProNum { get; set; }
-
+        
         public PlcPointAddress()
         {
             Description = "点位地址";
@@ -43,7 +43,7 @@ namespace TeamAAS_VP.Models.PLC
             R_Velocity = new PlcAddress() { Description = "R轴速度地址", DataType = "float" };
             Torque = new PlcAddress() { Description = "扭矩地址", DataType = "float" };
             Feeder = new PlcAddress() { Description = "送料器地址", DataType = "int16" };
-            ScrewProNum = new PlcAddress() { Description = "螺杆程序号地址", DataType = "int16" };
+            ScrewProNum = new PlcAddress() { Description = "螺杆程序号地址", DataType = "int16" };           
         }
     }
 }

+ 38 - 6
TeamAAS-VM/Models/Product/ProductModel.cs

@@ -376,16 +376,45 @@ namespace TeamAAS_VP.Models
             set { SetProperty(ref _RemovePoints, value); }
         }
 
-        private ObservableCollection<PlcPoint> _PressurePlacePoints = new ObservableCollection<PlcPoint>();
+        //private ObservableCollection<PlcPoint> _PressurePlacePoints = new ObservableCollection<PlcPoint>();
+        ///// <summary>
+        ///// 压力组装点位参数集合
+        ///// </summary>
+        //public ObservableCollection<PlcPoint> PressurePlacePoints
+        //{
+        //    get { return _PressurePlacePoints; }
+        //    set { SetProperty(ref _PressurePlacePoints, value); }
+        //}
+
+        private ObservableCollection<PlcPoint> _CameraCodePlcPoints = new ObservableCollection<PlcPoint>();
+        /// <summary>
+        /// 相机扫码点位参数集合
+        /// </summary>
+        public ObservableCollection<PlcPoint> CameraCodePlcPoints
+        {
+            get { return _CameraCodePlcPoints; }
+            set { SetProperty(ref _CameraCodePlcPoints, value); }
+        }
+
+        private ObservableCollection<PlcPoint> _ProductPlacePoints = new ObservableCollection<PlcPoint>();
         /// <summary>
-        /// 压力组装点位参数集合
+        /// 产品升降取料点位参数集合
         /// </summary>
-        public ObservableCollection<PlcPoint> PressurePlacePoints
+        public ObservableCollection<PlcPoint> ProductPlacePoints
         {
-            get { return _PressurePlacePoints; }
-            set { SetProperty(ref _PressurePlacePoints, value); }
+            get { return _ProductPlacePoints; }
+            set { SetProperty(ref _ProductPlacePoints, value); }
         }
 
+        private ObservableCollection<PlcPoint> _GunPressurePoints = new ObservableCollection<PlcPoint>();
+        /// <summary>
+        /// 滚压点位参数集合
+        /// </summary>
+        public ObservableCollection<PlcPoint> GunPressurePoints
+        {
+            get { return _GunPressurePoints; }
+            set { SetProperty(ref _GunPressurePoints, value); }
+        }
         private bool _IsLoad;
         /// <summary>
         /// 是否已加载
@@ -501,7 +530,10 @@ namespace TeamAAS_VP.Models
                 ScrewPoints = this.ScrewPoints,
                 CheckCameraPoints = this.CheckCameraPoints,
                 RemovePoints = this.RemovePoints,
-                PressurePlacePoints = this.PressurePlacePoints,
+                //PressurePlacePoints = this.PressurePlacePoints,
+                CameraCodePlcPoints = this.CameraCodePlcPoints,
+                ProductPlacePoints = this.ProductPlacePoints,
+                GunPressurePoints = this.GunPressurePoints,
                 IsLoad = this.IsLoad,
                 IsCreate = this.IsCreate,
                 ScrewCameraLocalPos1 = this.ScrewCameraLocalPos1,

+ 11 - 0
TeamAAS-VM/Models/SystemConfiguration.cs

@@ -197,6 +197,17 @@ namespace TeamAAS_VP.Models
             set => SetProperty(ref _ScrewTeachNum, value);
         }
 
+        private float _GunyaSafeZ = 0;
+        /// <summary>
+        /// 附加滚压Z轴安全高度
+        /// </summary>
+        public float GunyaSafeZ
+        {
+            get => _GunyaSafeZ;
+            set => SetProperty(ref _GunyaSafeZ, value);
+        }
+
+
         private ObservableCollection<PressureSensorSettings> _PressureSensorConfig;
         /// <summary>
         /// 压力传感器配置列表

+ 22 - 2
TeamAAS-VM/Resources/Languages/Lang.Designer.cs

@@ -19,7 +19,7 @@ namespace TeamAAS_VP.Resources.Languages {
     // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
     // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
     // (以 /str 作为命令选项),或重新生成 VS 项目。
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     public class Lang {
@@ -5711,7 +5711,18 @@ namespace TeamAAS_VP.Resources.Languages {
                 return ResourceManager.GetString("正在初始化PLC", resourceCulture);
             }
         }
-        
+
+        /// <summary>
+        ///   查找类似 正在初始化PLC 的本地化字符串。
+        /// </summary>
+        public static string 正在初始化扫码枪
+        {
+            get
+            {
+                return ResourceManager.GetString("正在初始化扫码枪", resourceCulture);
+            }
+        }
+
         /// <summary>
         ///   查找类似 正在初始化光源控制器 的本地化字符串。
         /// </summary>
@@ -6504,6 +6515,15 @@ namespace TeamAAS_VP.Resources.Languages {
             }
         }
         
+        /// <summary>
+        ///   查找类似 相机扫码点位 的本地化字符串。
+        /// </summary>
+        public static string 相机扫码点位 {
+            get {
+                return ResourceManager.GetString("相机扫码点位", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   查找类似 相机曝光时间 的本地化字符串。
         /// </summary>

+ 21 - 18
TeamAAS-VM/Resources/Languages/Lang.en.resx

@@ -2019,6 +2019,24 @@
   <data name="请选择要启用的光源通道" xml:space="preserve">
     <value>Please select a light channel to enable</value>
   </data>
+  <data name="是否控制光源通道亮灭" xml:space="preserve">
+    <value>Control light source channel on/off</value>
+  </data>
+  <data name="CameraBrand_opt" xml:space="preserve">
+    <value>OPT (OPT Camera Viewer)</value>
+  </data>
+  <data name="相机焦距评价" xml:space="preserve">
+    <value>Camera Focus Evaluation</value>
+  </data>
+  <data name="螺丝供料器" xml:space="preserve">
+    <value>Screw Feeder</value>
+  </data>
+  <data name="通过移动至下相机拍照位置拍照计算P0" xml:space="preserve">
+    <value>Move to the lower camera shooting position, take a photo to obtain P0, then return to the original position</value>
+  </data>
+  <data name="视觉静态精度分析" xml:space="preserve">
+    <value>Visual Static Precision Analysis</value>
+  </data>
   <data name="ProcedureSaveImagePathModel_Month_Day_Formula_ProductSN_Time" xml:space="preserve">
     <value>Year/Month/Day/Recipe Name/Product SN/Product SN + Time</value>
   </data>
@@ -3126,25 +3144,10 @@
   <data name="相机增益设置失败" xml:space="preserve">
     <value>Camera gain setting failed!</value>
   </data>
-  <data name="是否控制光源通道亮灭" xml:space="preserve">
-    <value>Control light source channel on/off</value>
-  </data>
-  <data name="CameraBrand_opt" xml:space="preserve">
-    <value>OPT (OPT Camera Viewer)</value>
-  </data>
-  <data name="相机焦距评价" xml:space="preserve">
-    <value>Camera Focus Evaluation</value>
-  </data>
-  <data name="螺丝供料器" xml:space="preserve">
-    <value>Screw Feeder</value>
-  </data>
-  <data name="通过移动至下相机拍照位置拍照计算P0" xml:space="preserve">
-    <value>Move to the lower camera shooting position, take a photo to obtain P0, then return to the original position</value>
-  </data>
-  <data name="视觉静态精度分析" xml:space="preserve">
-    <value>Visual Static Precision Analysis</value>
-  </data>
   <data name="SettingView_Language_Vietnamese" xml:space="preserve">
     <value>Vietnamese</value>
   </data>
+  <data name="相机扫码点位" xml:space="preserve">
+    <value>相机扫码点位</value>
+  </data>
 </root>

+ 21 - 18
TeamAAS-VM/Resources/Languages/Lang.ja-JP.resx

@@ -2019,6 +2019,24 @@
   <data name="请选择要启用的光源通道" xml:space="preserve">
     <value>有効にするライトチャンネルを選択してください</value>
   </data>
+  <data name="是否控制光源通道亮灭" xml:space="preserve">
+    <value>光源チャンネルの点灯・消灯を制御しますか</value>
+  </data>
+  <data name="CameraBrand_opt" xml:space="preserve">
+    <value>オプト(OPT Camera Viewer)</value>
+  </data>
+  <data name="相机焦距评价" xml:space="preserve">
+    <value>カメラ焦点評価</value>
+  </data>
+  <data name="螺丝供料器" xml:space="preserve">
+    <value>ネジ供給機</value>
+  </data>
+  <data name="通过移动至下相机拍照位置拍照计算P0" xml:space="preserve">
+    <value>下カメラ撮影位置まで移動して撮影し P0 を取得し、元の位置に戻します</value>
+  </data>
+  <data name="视觉静态精度分析" xml:space="preserve">
+    <value>視覚静的精度解析</value>
+  </data>
   <data name="ProcedureSaveImagePathModel_Month_Day_Formula_ProductSN_Time" xml:space="preserve">
     <value>年月 / 日 / レシピ名 / 製品 SN / 製品 SN+時間</value>
   </data>
@@ -3126,25 +3144,10 @@
   <data name="相机增益设置失败" xml:space="preserve">
     <value>カメラゲイン設定に失敗しました!</value>
   </data>
-  <data name="是否控制光源通道亮灭" xml:space="preserve">
-    <value>光源チャンネルの点灯・消灯を制御しますか</value>
-  </data>
-  <data name="CameraBrand_opt" xml:space="preserve">
-    <value>オプト(OPT Camera Viewer)</value>
-  </data>
-  <data name="相机焦距评价" xml:space="preserve">
-    <value>カメラ焦点評価</value>
-  </data>
-  <data name="螺丝供料器" xml:space="preserve">
-    <value>ネジ供給機</value>
-  </data>
-  <data name="通过移动至下相机拍照位置拍照计算P0" xml:space="preserve">
-    <value>下カメラ撮影位置まで移動して撮影し P0 を取得し、元の位置に戻します</value>
-  </data>
-  <data name="视觉静态精度分析" xml:space="preserve">
-    <value>視覚静的精度解析</value>
-  </data>
   <data name="SettingView_Language_Vietnamese" xml:space="preserve">
     <value>ベトナム語</value>
   </data>
+  <data name="相机扫码点位" xml:space="preserve">
+    <value>相机扫码点位</value>
+  </data>
 </root>

+ 4 - 0
TeamAAS-VM/Resources/Languages/Lang.resx

@@ -3244,4 +3244,8 @@
     <value>越南语</value>
     <comment>SettingView</comment>
   </data>
+  <data name="相机扫码点位" xml:space="preserve">
+    <value>相机扫码点位</value>
+    <comment>相机扫码点位</comment>
+  </data>
 </root>

+ 3 - 0
TeamAAS-VM/Resources/Languages/Lang.vi.resx

@@ -3147,4 +3147,7 @@
   <data name="SettingView_Language_Vietnamese" xml:space="preserve">
     <value>Tiếng Việt</value>
   </data>
+  <data name="相机扫码点位" xml:space="preserve">
+    <value>相机扫码点位</value>
+  </data>
 </root>

+ 21 - 18
TeamAAS-VM/Resources/Languages/Lang.zh-TW.resx

@@ -2019,6 +2019,24 @@
   <data name="请选择要启用的光源通道" xml:space="preserve">
     <value>請選擇要啟用的光源通道</value>
   </data>
+  <data name="是否控制光源通道亮灭" xml:space="preserve">
+    <value>是否控制光源通道亮滅</value>
+  </data>
+  <data name="CameraBrand_opt" xml:space="preserve">
+    <value>奧普特(OPT Camera Viewer)</value>
+  </data>
+  <data name="相机焦距评价" xml:space="preserve">
+    <value>相機焦距評價</value>
+  </data>
+  <data name="螺丝供料器" xml:space="preserve">
+    <value>螺絲供料器</value>
+  </data>
+  <data name="通过移动至下相机拍照位置拍照计算P0" xml:space="preserve">
+    <value>移動至下相機拍照位置,拍照取得 P0,然後放回原位</value>
+  </data>
+  <data name="视觉静态精度分析" xml:space="preserve">
+    <value>視覺靜態精度分析</value>
+  </data>
   <data name="ProcedureSaveImagePathModel_Month_Day_Formula_ProductSN_Time" xml:space="preserve">
     <value>年月 / 日 / 配方名 / 產品 SN / 產品 SN + 時間</value>
   </data>
@@ -3126,25 +3144,10 @@
   <data name="相机增益设置失败" xml:space="preserve">
     <value>相機增益設定失敗!</value>
   </data>
-  <data name="是否控制光源通道亮灭" xml:space="preserve">
-    <value>是否控制光源通道亮滅</value>
-  </data>
-  <data name="CameraBrand_opt" xml:space="preserve">
-    <value>奧普特(OPT Camera Viewer)</value>
-  </data>
-  <data name="相机焦距评价" xml:space="preserve">
-    <value>相機焦距評價</value>
-  </data>
-  <data name="螺丝供料器" xml:space="preserve">
-    <value>螺絲供料器</value>
-  </data>
-  <data name="通过移动至下相机拍照位置拍照计算P0" xml:space="preserve">
-    <value>移動至下相機拍照位置,拍照取得 P0,然後放回原位</value>
-  </data>
-  <data name="视觉静态精度分析" xml:space="preserve">
-    <value>視覺靜態精度分析</value>
-  </data>
   <data name="SettingView_Language_Vietnamese" xml:space="preserve">
     <value>越南語</value>
   </data>
+  <data name="相机扫码点位" xml:space="preserve">
+    <value>相机扫码点位</value>
+  </data>
 </root>

+ 20 - 6
TeamAAS-VM/Services/MesService.cs

@@ -357,7 +357,7 @@ namespace TeamAAS_VP.Services
         /// - 捕获 <see cref="OperationCanceledException"/> 返回 "Canceled",捕获其它异常则返回异常消息。
         /// - 若实例已被释放则抛出 <see cref="ObjectDisposedException"/>。
         /// </remarks>
-        public async Task<(bool IsSuccess, string Response)> SubmitGetAsync(int deviceNo, string sn, string comp, string cc, string assypress, bool isSuccess, DateTime start_time, DateTime stop_time, CancellationToken cancellationToken = default)
+        public async Task<(bool IsSuccess, string Response)> SubmitGetAsync(int deviceNo, string sn, string comp, List<string> results, string cc, string assypress, bool isSuccess, DateTime start_time, DateTime stop_time, CancellationToken cancellationToken = default)
         {
             // 如果已经释放,则抛出异常,防止在已释放资源上继续操作。
             if (_disposed) throw new ObjectDisposedException(nameof(MesService));
@@ -378,19 +378,33 @@ namespace TeamAAS_VP.Services
                     return (false, "PTL模式下comp不能为空");
                 }
             }
-
+            
             string res = isSuccess ? "Pass" : "Fail";
+            if (res == "Fail")
+            {
+                if (results.Count > 0)
+                {
+                    res = string.Join(",", results);
+                }
+                    
+            }       
             string url = "";
             string[] strcc = cc.Split(',');
+            ////if (cc.Length < 1)
+            ////{
+
+            ////}
             if (device.F == "PTL")
             {
+                //url = $"{device.MesUrl}?c=ADD_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&f=PTL&comp={device.comp}:{comp}" +
+                //    $"&CC1={strcc[0]}&CC2={strcc[1]}&AssyPressure1={assypress}&result={res}&start_time={start_time.ToString("yyyy-MM-dd HH:mm:ss")}&stop_time={stop_time.ToString("yyyy-MM-dd HH:mm:ss")}";
                 url = $"{device.MesUrl}?c=ADD_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&f=PTL&comp={device.comp}:{comp}" +
-                    $"&CC1={strcc[0]}&CC2={strcc[1]}&AssyPressure1={assypress}&result={res}&start_time={start_time.ToString("yyyy-MM-dd HH:mm:ss")}&stop_time={stop_time.ToString("yyyy-MM-dd HH:mm:ss")}";
+                    $"&AssyPressure1={assypress}&result={res}&start_time={start_time.ToString("yyyy-MM-dd HH:mm:ss")}&stop_time={stop_time.ToString("yyyy-MM-dd HH:mm:ss")}";
             }
             else
             {
                 url = $"{device.MesUrl}?c=ADD_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&f=PQC" +
-                    $"&CC1={strcc[0]}&CC2={strcc[1]}&AssyPressure1={assypress}&result={res}&start_time={start_time.ToString("yyyy-MM-dd HH:mm:ss")}&stop_time={stop_time.ToString("yyyy-MM-dd HH:mm:ss")}";
+                    $"&AssyPressure1={assypress}&result={res}&start_time={start_time.ToString("yyyy-MM-dd HH:mm:ss")}&stop_time={stop_time.ToString("yyyy-MM-dd HH:mm:ss")}";
             }
             LogHelper.WriteLogMes($"【上传URL】{url}");
             SendTaskMessage($"【上传URL】{url}", MessageLevel.Info);
@@ -439,11 +453,11 @@ namespace TeamAAS_VP.Services
         /// <param name="stop_time">结束时间。</param>
         /// <param name="timeoutInSeconds">请求超时,单位为秒。</param>
         /// <returns>与 <see cref="SubmitGetAsync(string, bool, DateTime, DateTime, CancellationToken)"/> 相同的返回语义。</returns>
-        public async Task<(bool IsSuccess, string Response)> SubmitGetAsync(int deviceNo, string sn, string comp, string cc, string assypress, bool isSuccess, DateTime start_time, DateTime stop_time, double timeoutInSeconds)
+        public async Task<(bool IsSuccess, string Response)> SubmitGetAsync(int deviceNo, string sn, string comp, List<string> results, string cc, string assypress, bool isSuccess, DateTime start_time, DateTime stop_time, double timeoutInSeconds)
         {
             using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutInSeconds)))
             {
-                return await SubmitGetAsync(deviceNo, sn, comp, cc, assypress, isSuccess, start_time, stop_time, cts.Token);
+                return await SubmitGetAsync(deviceNo, sn, comp,results,cc, assypress, isSuccess, start_time, stop_time, cts.Token);
             }
         }
 

+ 8 - 0
TeamAAS-VM/ViewModels/MainWindowViewModel.cs

@@ -292,6 +292,14 @@ namespace TeamAAS_VP.ViewModels
             }));
             await management.InitLightControllers();
 
+            //-------------------SETP 5: 初始化扫码枪-----------------------------------------------------------------------
+            curvalue += 1;
+            _ = App.Current.Dispatcher.BeginInvoke(new Action(() =>
+            {
+                _eventAggregator.GetEvent<ProgressNotification>().Publish(new UProgressBar.ProgressParameter { Maximum = max, Minimum = 0, SubTitle = $"{Lang.初始化中}...", Message = $"{Lang.正在初始化扫码枪}...", Value = curvalue });
+            }));
+            await management.InitScan();
+
             //-------------------SETP 7: 初始化电批-----------------------------------------------------------------------
             //curvalue += 1;
             //_ = App.Current.Dispatcher.BeginInvoke(new Action(() =>

+ 139 - 17
TeamAAS-VM/ViewModels/Product/PlcPointParamsViewModel.cs

@@ -352,6 +352,9 @@ namespace TeamAAS_VP.ViewModels.Product
             public List<PlcPoint> CheckCameraPoints { get; set; }
             public List<PlcPoint> RemovePoints { get; set; }
             public List<PlcPoint> PressurePlacePoints { get; set; }
+            public List<PlcPoint> CameraCodePlcPoints { get; set; }
+            public List<PlcPoint> GunPressurePoints { get; set; }
+            public List<PlcPoint> ProductPlacePoints { get; set; }
         }
         #endregion
 
@@ -645,18 +648,58 @@ namespace TeamAAS_VP.ViewModels.Product
                     return;
                 }
 
-                //Robot.Timeout = 6000000;
-                switch (motionCmd)
+                //if (SelectedIndex == 7)//产品升降取料位(附加轴1,2)
+                //{
+                //    //await Robot.AdditionalAxisMoveAsync(Robot.AdditionalAxisList[0].Name, SelectedPoint.Z_Position_Start);//取料升降Z轴
+                //    await Robot.AdditionalAxisMoveAsync(Robot.AdditionalAxisList[1].Name, SelectedPoint.Y_Position);//取料移栽Y轴
+
+                //}
+
+                if (SelectedIndex == 8)//产品升降取料位(附加轴1,2)//plc说上位机控会有撞机问题,直接不控
                 {
-                    case MotionCommand.Go:
-                        await Robot.GoAsync(point);
-                        break;
-                    case MotionCommand.Jump:
-                        await Robot.JumpAsync(point, 0);
-                        break;
-                    case MotionCommand.Move:
-                        await Robot.MoveAsync(point);
-                        break;
+                    //await Robot.AdditionalAxisMoveAsync(Robot.AdditionalAxisList[0].Name, SelectedPoint.Z_Position_Start);//取料升降Z轴
+                    //await Robot.AdditionalAxisMoveAsync(Robot.AdditionalAxisList[1].Name, SelectedPoint.Y_Position);//取料移栽Y轴
+
+                }
+                else if(SelectedIndex == 9)//滚压点位(X,Y和附加轴3)
+                {
+                    var curpos1 = await Robot.GetRobotPosAsync();
+                    float safeZ= _configService.GetSystemConfiguration().GunyaSafeZ;
+                    //double safeZ = Robot.SafeZ;
+                    await Robot.AdditionalAxisMoveAsync(Robot.AdditionalAxisList[2].Name, safeZ);//滚压Z轴
+                    point.Z = curpos1.Z;//其它轴运动到当前位置
+                    point.U = curpos1.W;
+                    point.V = curpos1.V;
+                    switch (motionCmd)
+                    {
+                        case MotionCommand.Go:
+                            await Robot.GoAsync(point);
+                            break;
+                        case MotionCommand.Jump:
+                            await Robot.JumpAsync(point, 0);
+                            break;
+                        case MotionCommand.Move:
+                            await Robot.MoveAsync(point);
+                            break;
+                    }
+
+                    await Robot.AdditionalAxisMoveAsync(Robot.AdditionalAxisList[2].Name, SelectedPoint.Z_Position_Start);//滚压Z轴
+                }
+                else
+                {
+                    //Robot.Timeout = 6000000;
+                    switch (motionCmd)
+                    {
+                        case MotionCommand.Go:
+                            await Robot.GoAsync(point);
+                            break;
+                        case MotionCommand.Jump:
+                            await Robot.JumpAsync(point, 0);
+                            break;
+                        case MotionCommand.Move:
+                            await Robot.MoveAsync(point);
+                            break;
+                    }
                 }
 
                 _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
@@ -708,6 +751,58 @@ namespace TeamAAS_VP.ViewModels.Product
                     _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
                     return;
                 }
+                else if (SelectedIndex == 7)
+                {
+                    //弹窗用户是否确认要示教该点位
+                    if (MessageBox.Show(string.Format(Lang.确认要示教点位0吗, SelectedPoint.Number), Lang.示教点位, MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
+                    {
+                        return;
+                    }
+                    var curpos = await Robot.GetRobotPosAsync();
+                    //var Z = await Robot.GetAdditionalAxisCurrentPosAsync(Robot.AdditionalAxisList[0].Name);//附加取料升降Z轴
+                    var Y = await Robot.GetAdditionalAxisCurrentPosAsync(Robot.AdditionalAxisList[1].Name);//附加移栽Y轴
+                    SelectedPoint.X_Position = curpos.X;
+                    SelectedPoint.Y_Position = Y;
+                    SelectedPoint.Z_Position_Start = curpos.Z;
+                    //SelectedPoint.U_Position = 0;
+                    //SelectedPoint.R_Position = 0;
+                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
+                    return;
+                }
+                else if(SelectedIndex == 8)
+                {
+                    //弹窗用户是否确认要示教该点位
+                    if (MessageBox.Show(string.Format(Lang.确认要示教点位0吗, SelectedPoint.Number), Lang.示教点位, MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
+                    {
+                        return;
+                    }
+                    var Z = await Robot.GetAdditionalAxisCurrentPosAsync(Robot.AdditionalAxisList[0].Name);//附加取料升降Z轴
+                    var Y= await Robot.GetAdditionalAxisCurrentPosAsync(Robot.AdditionalAxisList[1].Name);//附加移栽Y轴
+                    SelectedPoint.X_Position = 0;
+                    SelectedPoint.Y_Position = Y;
+                    SelectedPoint.Z_Position_Start = Z;
+                    //SelectedPoint.U_Position = 0;
+                    //SelectedPoint.R_Position = 0;
+                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
+                    return;
+                }
+                else if (SelectedIndex == 9)
+                {
+                    //弹窗用户是否确认要示教该点位
+                    if (MessageBox.Show(string.Format(Lang.确认要示教点位0吗, SelectedPoint.Number), Lang.示教点位, MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
+                    {
+                        return;
+                    }
+                    var curpos = await Robot.GetRobotPosAsync();
+                    var Z = await Robot.GetAdditionalAxisCurrentPosAsync(Robot.AdditionalAxisList[2].Name);//滚压升降Z轴
+                    SelectedPoint.X_Position = curpos.X;
+                    SelectedPoint.Y_Position = curpos.Y;
+                    SelectedPoint.Z_Position_Start = Z;
+                    //SelectedPoint.U_Position = 0;
+                    //SelectedPoint.R_Position = 0;
+                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
+                    return;
+                }
                 else
                 {
                     //弹窗用户是否确认要示教该点位
@@ -872,7 +967,13 @@ namespace TeamAAS_VP.ViewModels.Product
                     Points = SelectProduct.RemovePoints;
                     break;
                 case 7:
-                    Points = SelectProduct.PressurePlacePoints;
+                    Points = SelectProduct.CameraCodePlcPoints;
+                    break;
+                case 8:
+                    Points = SelectProduct.ProductPlacePoints;
+                    break;
+                case 9:
+                    Points = SelectProduct.GunPressurePoints;
                     break;
                 default:
                     break;
@@ -1896,7 +1997,10 @@ namespace TeamAAS_VP.ViewModels.Product
                     ScrewPoints = SelectProduct.ScrewPoints?.Select(p => p.Clone()).ToList() ?? new List<PlcPoint>(),
                     CheckCameraPoints = SelectProduct.CheckCameraPoints?.Select(p => p.Clone()).ToList() ?? new List<PlcPoint>(),
                     RemovePoints = SelectProduct.RemovePoints?.Select(p => p.Clone()).ToList() ?? new List<PlcPoint>(),
-                    PressurePlacePoints = SelectProduct.PressurePlacePoints?.Select(p => p.Clone()).ToList() ?? new List<PlcPoint>(),
+                   // PressurePlacePoints = SelectProduct.PressurePlacePoints?.Select(p => p.Clone()).ToList() ?? new List<PlcPoint>(),
+                    CameraCodePlcPoints = SelectProduct.CameraCodePlcPoints?.Select(p => p.Clone()).ToList() ?? new List<PlcPoint>(),
+                    GunPressurePoints = SelectProduct.GunPressurePoints?.Select(p => p.Clone()).ToList() ?? new List<PlcPoint>(),
+                    ProductPlacePoints = SelectProduct.ProductPlacePoints?.Select(p => p.Clone()).ToList() ?? new List<PlcPoint>(),
                 };
 
                 var serializer = new XmlSerializer(typeof(ProductPointsExport));
@@ -1965,7 +2069,10 @@ namespace TeamAAS_VP.ViewModels.Product
                 SelectProduct.ScrewPoints = new ObservableCollection<PlcPoint>(import.ScrewPoints ?? new List<PlcPoint>());
                 SelectProduct.CheckCameraPoints = new ObservableCollection<PlcPoint>(import.CheckCameraPoints ?? new List<PlcPoint>());
                 SelectProduct.RemovePoints = new ObservableCollection<PlcPoint>(import.RemovePoints ?? new List<PlcPoint>());
-                SelectProduct.PressurePlacePoints = new ObservableCollection<PlcPoint>(import.PressurePlacePoints ?? new List<PlcPoint>());
+                //SelectProduct.PressurePlacePoints = new ObservableCollection<PlcPoint>(import.PressurePlacePoints ?? new List<PlcPoint>());
+                SelectProduct.CameraCodePlcPoints = new ObservableCollection<PlcPoint>(import.CameraCodePlcPoints ?? new List<PlcPoint>());
+                SelectProduct.ProductPlacePoints = new ObservableCollection<PlcPoint>(import.ProductPlacePoints ?? new List<PlcPoint>());
+                SelectProduct.GunPressurePoints = new ObservableCollection<PlcPoint>(import.GunPressurePoints ?? new List<PlcPoint>());
 
                 // 重新编号每个集合
                 Action<ObservableCollection<PlcPoint>> renumber = (col) =>
@@ -1979,7 +2086,10 @@ namespace TeamAAS_VP.ViewModels.Product
                 renumber(SelectProduct.ScrewPoints);
                 renumber(SelectProduct.CheckCameraPoints);
                 renumber(SelectProduct.RemovePoints);
-                renumber(SelectProduct.PressurePlacePoints);
+                renumber(SelectProduct.CameraCodePlcPoints);
+                //renumber(SelectProduct.PressurePlacePoints);
+                renumber(SelectProduct.ProductPlacePoints);
+                renumber(SelectProduct.GunPressurePoints);
 
                 // 根据当前 SelectedIndex 切换 Points 绑定到对应集合
                 ExecuteSelectionChangedCommand();
@@ -2080,9 +2190,21 @@ namespace TeamAAS_VP.ViewModels.Product
                 {
                     SelectProduct.RemovePoints = new ObservableCollection<PlcPoint>();
                 }
-                if (SelectProduct.PressurePlacePoints == null)
+                //if (SelectProduct.PressurePlacePoints == null)
+                //{
+                //    SelectProduct.PressurePlacePoints = new ObservableCollection<PlcPoint>();
+                //}
+                if (SelectProduct.CameraCodePlcPoints == null)
+                {
+                    SelectProduct.CameraCodePlcPoints = new ObservableCollection<PlcPoint>();
+                }
+                if (SelectProduct.ProductPlacePoints == null)
+                {
+                    SelectProduct.ProductPlacePoints = new ObservableCollection<PlcPoint>();
+                }
+                if (SelectProduct.GunPressurePoints == null)
                 {
-                    SelectProduct.PressurePlacePoints = new ObservableCollection<PlcPoint>();
+                    SelectProduct.GunPressurePoints = new ObservableCollection<PlcPoint>();
                 }
 
             }

+ 4 - 1
TeamAAS-VM/ViewModels/Product/ProductHomeViewModel.cs

@@ -206,7 +206,10 @@ namespace TeamAAS_VP.ViewModels.Product
                         ScrewPoints=new ObservableCollection<Models.PLC.PlcPoint>(),
                         CheckCameraPoints=new ObservableCollection<Models.PLC.PlcPoint>(),
                         RemovePoints = new ObservableCollection<Models.PLC.PlcPoint>(),
-                        PressurePlacePoints = new ObservableCollection<Models.PLC.PlcPoint>(),
+                        //PressurePlacePoints = new ObservableCollection<Models.PLC.PlcPoint>(),
+                        CameraCodePlcPoints = new ObservableCollection<Models.PLC.PlcPoint>(),
+                        ProductPlacePoints = new ObservableCollection<Models.PLC.PlcPoint>(),
+                        GunPressurePoints = new ObservableCollection<Models.PLC.PlcPoint>(),
                     };
 
                     var cameras = _configService.GetAllCameras();

+ 9 - 0
TeamAAS-VM/ViewModels/Statistics/ProductionStatementViewModel.cs

@@ -26,6 +26,14 @@ namespace TeamAAS_VP.ViewModels.Statistics
         IProductService _productService;
 
         #region 属性
+        private Management _management;
+
+        public Management management
+        {
+            get { return _management; }
+            set { SetProperty(ref _management, value); }
+        }
+
         private Int64 _TotalCount;
         /// <summary>
         /// 总产能
@@ -124,6 +132,7 @@ namespace TeamAAS_VP.ViewModels.Statistics
             _container= container;
             _systemDatabaseService = systemDatabaseService;
             _productService = productService;
+            management = _container.Resolve<Management>();
         }
 
         #region 方法

+ 2 - 2
TeamAAS-VM/Views/Home/ShowVisionRender.xaml.cs

@@ -526,7 +526,7 @@ namespace TeamAAS_VP.Views.Home
 
                         if (isCompress)
                         {
-                            ImageHelper.CompressImage(reimage, Recordedpath, 100);
+                            ImageHelper.CompressImage(reimage, Recordedpath, 20);
                         }
                         else
                         {
@@ -608,7 +608,7 @@ namespace TeamAAS_VP.Views.Home
 
                         if (isCompress)
                         {
-                            ImageHelper.CompressImage(reimage, Recordedpath, 100);
+                            ImageHelper.CompressImage(reimage, Recordedpath, 20);
                         }
                         else
                         {

+ 3 - 3
TeamAAS-VM/Views/HomeView.xaml

@@ -222,7 +222,7 @@
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="*" />
                         <ColumnDefinition Width="*" />
-                        <ColumnDefinition Width="*" />
+                        <!--<ColumnDefinition Width="*" />-->
                     </Grid.ColumnDefinitions>
                     <!--加载产品-->
                     <materialDesign:Card Grid.Row="0"
@@ -371,7 +371,7 @@
                         </Grid>
                     </materialDesign:Card>
                     <!--生产数量2-->
-                    <materialDesign:Card Grid.Row="0"
+                    <!--<materialDesign:Card Grid.Row="0"
            Grid.Column="2"
            UniformCornerRadius="10"
            BorderBrush="LightGray"
@@ -444,7 +444,7 @@ VerticalAlignment="Center">
          Grid.Column="1"
          Text="{Binding management.Yield,StringFormat={}{0:F2}%}" />
                         </Grid>
-                    </materialDesign:Card>
+                    </materialDesign:Card>-->
                 </Grid>
 
 

+ 30 - 4
TeamAAS-VM/Views/Product/PlcPointParams.xaml

@@ -303,8 +303,21 @@
                                 </ListBoxItem.Style>
                                 <TextBlock Text="{lex:Loc 撕膜点位}" />
                             </ListBoxItem>
-                            <!--压力组装点位-->
-                            <!--<ListBoxItem>
+                            <!--相机扫码点位-->
+                            <ListBoxItem>
+                                <ListBoxItem.Style>
+                                    <Style TargetType="ListBoxItem"
+                                           BasedOn="{StaticResource MaterialDesign3.NavigationBarPrimaryListBoxItem}">
+                                        <Setter Property="materialDesign:NavigationBarAssist.SelectedIcon"
+                                                Value="Circle" />
+                                        <Setter Property="materialDesign:NavigationBarAssist.UnselectedIcon"
+                                                Value="CircleOutline" />
+                                    </Style>
+                                </ListBoxItem.Style>
+                                <TextBlock Text="{lex:Loc 相机扫码点位}" />
+                            </ListBoxItem>
+                            <!--产品升降取料位-->
+                            <ListBoxItem>
                                 <ListBoxItem.Style>
                                     <Style TargetType="ListBoxItem"
                                            BasedOn="{StaticResource MaterialDesign3.NavigationBarPrimaryListBoxItem}">
@@ -314,8 +327,21 @@
                                                 Value="CircleOutline" />
                                     </Style>
                                 </ListBoxItem.Style>
-                                <TextBlock Text="压力组装点位" />
-                            </ListBoxItem>-->
+                                <TextBlock Text="产品升降取料位" />
+                            </ListBoxItem>
+                            <!--滚压点位-->
+                            <ListBoxItem>
+                                <ListBoxItem.Style>
+                                    <Style TargetType="ListBoxItem"
+                                           BasedOn="{StaticResource MaterialDesign3.NavigationBarPrimaryListBoxItem}">
+                                        <Setter Property="materialDesign:NavigationBarAssist.SelectedIcon"
+                                                Value="Circle" />
+                                        <Setter Property="materialDesign:NavigationBarAssist.UnselectedIcon"
+                                                Value="CircleOutline" />
+                                    </Style>
+                                </ListBoxItem.Style>
+                                <TextBlock Text="滚压点位" />
+                            </ListBoxItem>
                         </ListBox>
                         <!--点位列表操作按钮面板-->
                         <StackPanel DockPanel.Dock="Bottom"

+ 39 - 0
TeamAAS-VM/Views/Statistics/ProductionStatement.xaml

@@ -47,6 +47,9 @@
                     <RowDefinition Height="auto" />
                     <RowDefinition Height="auto" />
                     <RowDefinition Height="auto" />
+                    <RowDefinition Height="auto" />
+                    <RowDefinition Height="auto" />
+                    <RowDefinition Height="auto" />
                 </Grid.RowDefinitions>
                 <oxy:PlotView Grid.Row="0"
                               Grid.Column="0"
@@ -103,6 +106,42 @@
                          TextAlignment="Center"
                          BorderThickness="1"
                          Margin="5" />
+                <TextBlock Grid.Row="5"
+                           Text="抛料数"
+                           VerticalAlignment="Center"
+                           Margin="5" />
+                <TextBox Grid.Row="5"
+                         Grid.Column="1"
+                         Text="{Binding management.ThrowNumber}"
+                         IsReadOnly="True"
+                         BorderBrush="Gray"
+                         TextAlignment="Center"
+                         BorderThickness="1"
+                         Margin="5" />
+                <TextBlock Grid.Row="6"
+                           Text="NG数量"
+                           VerticalAlignment="Center"
+                           Margin="5" />
+                <TextBox Grid.Row="6"
+                         Grid.Column="1"
+                         Text="{Binding management.NgNumber}"
+                         IsReadOnly="True"
+                         BorderBrush="Gray"
+                         TextAlignment="Center"
+                         BorderThickness="1"
+                         Margin="5" />
+                <TextBlock Grid.Row="7"
+                           Text="良率"
+                           VerticalAlignment="Center"
+                           Margin="5" />
+                <TextBox Grid.Row="7"
+                         Grid.Column="1"
+                         Text="{Binding management.Yield,StringFormat={}{0:F2}%}"
+                         IsReadOnly="True"
+                         BorderBrush="Gray"
+                         TextAlignment="Center"
+                         BorderThickness="1"
+                         Margin="5" />
             </Grid>
             <Button Content="{lex:Loc 生成报表}"
                     Margin="10"