Преглед изворни кода

修改了开始组装/停止信号接收数组
增加了撕膜和压力组装点位表
修改从PLC读取产品结果进行上传

徐孝锋 пре 7 месеци
родитељ
комит
eae32f2670

+ 155 - 125
TeamAAS-VM/Core/Management.cs

@@ -997,16 +997,18 @@ namespace TeamAAS_VP.Core
                 addressConfig.In_FixedCameraPickExe.Address,
                 addressConfig.In_FixedCameraPutExe.Address,
                 addressConfig.In_FixedCameracheckExe.Address,
-                addressConfig.In_WorkStart.Address,
-                addressConfig.In_WorkDone.Address,
-                //addressConfig.In_MesCheck.Address,
                 addressConfig.In_RequestPosition.Address,
                 addressConfig.In_ScrewTeachExe.Address,
                 addressConfig.In_PickINC.Address,
             };
             for (int i = 0; i < 10; i++)
             {
-                monitorNodeIds.Add(string.Format(addressConfig.In_MesCheck.Address,i));
+                monitorNodeIds.Add(string.Format(addressConfig.In_MesCheck.Address, i));
+            }
+            for (int i = 0; i < 7; i++)
+            {
+                monitorNodeIds.Add(string.Format(addressConfig.In_WorkStart.Address, i));
+                monitorNodeIds.Add(string.Format(addressConfig.In_WorkDone.Address, i));
             }
             //订阅PLC地址变化
             plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger);
@@ -1067,6 +1069,20 @@ namespace TeamAAS_VP.Core
                     await item.WriteToPlcAddress(addressConfig.Out_CheckCamera, plc);
                 }
             }
+            if (current.RemovePoints != null && current.RemovePoints.Count > 0)
+            {
+                foreach (var item in current.RemovePoints)
+                {
+                    await item.WriteToPlcAddress(addressConfig.Out_RemovePos, plc);
+                }
+            }
+            if (current.PressurePlacePoints != null && current.PressurePlacePoints.Count > 0)
+            {
+                foreach (var item in current.PressurePlacePoints)
+                {
+                    await item.WriteToPlcAddress(addressConfig.Out_PressurePlace, plc);
+                }
+            }
         }
 
         /// <summary>
@@ -1077,7 +1093,7 @@ namespace TeamAAS_VP.Core
         /// 移动向下相机拍照结果
         /// </summary>
         OpenCvSharp.Point3f[] UpCameraPutResults = new OpenCvSharp.Point3f[10];
-        
+
         /// <summary>
         /// 二次定位相机的工具坐标
         /// </summary>
@@ -1093,8 +1109,8 @@ namespace TeamAAS_VP.Core
         bool _LastFixedCameraPickExe = false;
         bool _LastFixedCameraPutExe = false;
         bool _LastFixedCameracheckExe = false;
-        Int16 _LastWorkStart = 0;
-        Int16 _LastWorkDone = 0;
+        Int16[] _LastWorkStart = new Int16[7];
+        Int16[] _LastWorkDone = new Int16[7];
         Int16 _LastRequestPosition = 0;
         Int16 _LastPickINC = 0;
         Int16[] _LastMesCheck = new Int16[10];
@@ -1112,7 +1128,7 @@ namespace TeamAAS_VP.Core
                 {
                     return;
                 }
-                
+
                 var addressConfig = _configService.GetPlcAddresses();
                 var plc = _plcService.GetPlcByNumber(addressConfig.PlcNo) as OpcUaClientPLC;
                 if (plc == null || !plc.IsConnected) return;
@@ -1246,7 +1262,7 @@ namespace TeamAAS_VP.Core
                                     {
                                         await plc.WriteNodeAsync(addressConfig.Out_DownCameraStatus.Address, (Int16)2);
                                         return;
-                                        
+
                                     }
 
                                 }
@@ -1573,7 +1589,7 @@ namespace TeamAAS_VP.Core
                             }
                             var currentPosition = robot.GetRobotPos();
 
-                            
+
                             //如果上相机2的流程id为空,则表示只有一个上相机
                             if (currentProduct.MoveDownCamera2LockPhotoProcedureId == Guid.Empty)
                             {
@@ -1647,7 +1663,7 @@ namespace TeamAAS_VP.Core
                                     float centerX = (float)(visionResults[0].X + visionResults[1].X) / 2;
                                     float centerY = (float)(visionResults[0].Y + visionResults[1].Y) / 2;
                                     _MoveCameraAngle = Common.CalculateAngleBetweenPointsDegrees(new PointF((float)visionResults[0].X, (float)visionResults[0].Y), new PointF((float)visionResults[1].X, (float)visionResults[1].Y));
-                                    UpCameraPutResults[cameraIndex] = new OpenCvSharp.Point3f(centerX, centerY,(float)_MoveCameraAngle);
+                                    UpCameraPutResults[cameraIndex] = new OpenCvSharp.Point3f(centerX, centerY, (float)_MoveCameraAngle);
                                     await plc.WriteNodeAsync(addressConfig.Out_UpCameraPutStatus.Address, (Int16)1);
                                     return;
                                 }
@@ -1787,111 +1803,6 @@ namespace TeamAAS_VP.Core
                         }
                     }
                 }
-                // 开始锁付
-                else if (addressConfig.In_WorkStart.Address.Contains(tuple.nodeId))
-                {
-                    if (tuple.value is Int16 state)
-                    {
-                        if (_LastWorkStart != state)
-                        {
-                            _LastWorkStart = state;
-                        }
-                        else
-                        {
-                            return;
-                        }
-
-                        if (state == 1)
-                        {
-                            SendTaskMessage($"收到开始锁付信号...", MessageLevel.Debug);
-                            //位置编号
-                            Int16 positionIndex = plc.ReadNode<Int16>(addressConfig.In_ProductNum.Address);
-                            SendTaskMessage($"编号:{positionIndex}", MessageLevel.Info);
-
-                            var code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, positionIndex));
-                            // 开始采集压力值
-                            StartPressureCollection(currentProduct.Name, code, positionIndex);
-                        }
-                        else
-                        {
-                            SendTaskMessage($"开始锁付信号已关闭", MessageLevel.Alarm);
-                            // 关闭时的处理(如需)可放在这里
-                        }
-                    }
-                }
-                // 停止锁付
-                else if (addressConfig.In_WorkDone.Address.Contains(tuple.nodeId))
-                {
-                    if (tuple.value is Int16 state)
-                    {
-                        if (_LastWorkDone != state)
-                        {
-                            _LastWorkDone = state;
-                        }
-                        else
-                        {
-                            return;
-                        }
-
-                        if (state == 1 || state == 2)
-                        {
-                            SendTaskMessage($"收到停止锁付信号...", MessageLevel.Debug);
-                            //位置编号
-                            Int16 positionIndex = plc.ReadNode<Int16>(addressConfig.In_ProductNum.Address);
-                            SendTaskMessage($"编号:{positionIndex}", MessageLevel.Info);
-                            //获取当前锁付点
-                            //var screwPoint = currentProduct.ScrewPoints.FirstOrDefault(p => p.Number == positionIndex);
-                            ////获取当前的机器人点位
-                            //var robot = _robotService.GetAllRobots().FirstOrDefault();
-                            //var currentPosition = robot.GetRobotPos();
-                            ////读取压力值
-                            //float pressure = plc.ReadNode<float>(addressConfig.In_PressureValue.Address);
-
-
-                            //await Task.Delay(60);
-                            ////获取电批结果
-                            //bool isSucced = ScrewDriver.GetData();
-                            //LockResult lockResult = new LockResult();
-                            //lockResult.ScrewdriverGetDataSucceed = isSucced;
-                            //lockResult.Number = positionIndex;
-                            //lockResult.LockPassed = ScrewDriver.Success;
-                            //lockResult.ProductNumber = _productService.CurrentProductCode;
-                            //lockResult.LockTurns = (float)ScrewDriver.Truns;
-                            //lockResult.LockTorque = (float)ScrewDriver.TorqueValue;
-                            //lockResult.LockDuration = (float)ScrewDriver.FinalTime;
-                            //lockResult.ScrewdriverProgramNumber = ScrewDriver.ProgramNumber;
-                            //lockResult.ResultDetails = ScrewDriver.ErrorInfo;
-                            //lockResult.Pressure = pressure;
-                            //lockResult.TargetTorque = ScrewDriver.TargetTorque;
-                            //lockResult.TargetTurnsUpperLimit = ScrewDriver.TargetTurnsUpperLimit;
-                            //lockResult.TargetTurnsLowerLimit = ScrewDriver.TargetTurnsLowerLimit;
-                            //lockResult.TargetLockSpeed = ScrewDriver.TargetLockSpeed;
-                            //lockResult.StartPositionX = currentPosition.X;
-                            //lockResult.StartPositionY = currentPosition.Y;
-                            //lockResult.StartPositionZ = screwPoint.Z_Position_Start;
-                            //lockResult.EndPositionZ = currentPosition.Z;
-                            //lockResult.LockDescentSpeed = screwPoint.Z_Velocity_Stop;
-                            //lockResult.FeederNumber = screwPoint != null ? screwPoint.Feeder : 0;
-                            //lockResult.NozzleNumber = "";
-                            //lockResult.OperatorName = _systemDatabaseService.GetCurrentUser().UserName;
-                            //lockResult.ProductImagePath = "";
-                            //lockResult.WaveDatas = ScrewDriver.WaveDatas;
-                            //App.Current.Dispatcher.Invoke(() =>
-                            //{
-                            //    _eventAggregator.GetEvent<LockFinishNotification>().Publish(lockResult);
-                            //});
-                            //await _systemDatabaseService.RecordLockResultAsync(lockResult);
-                            await plc.WriteNodeAsync(addressConfig.In_WorkDone.Address, (Int16)0);
-                            var code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, positionIndex));
-                            // 停止采集压力并保存
-                            await StopAndSavePressureCollectionAsync(currentProduct.Name, code, positionIndex);
-                        }
-                        else
-                        {
-                            SendTaskMessage($"停止锁付信号已关闭", MessageLevel.Alarm);
-                        }
-                    }
-                }
                 // 多相机坐标合并
                 else if (addressConfig.In_RequestPosition.Address.Contains(tuple.nodeId))
                 {
@@ -1919,17 +1830,17 @@ namespace TeamAAS_VP.Core
                                 return;
                             }
 
-                            double upCameraX=0, upCameraY=0,upCameraU=0;
+                            double upCameraX = 0, upCameraY = 0, upCameraU = 0;
                             upCameraX = UpCameraPutResults[1].X;
-                            upCameraY= UpCameraPutResults[1].Y;
-                            upCameraU= UpCameraPutResults[1].Z;
+                            upCameraY = UpCameraPutResults[1].Y;
+                            upCameraU = UpCameraPutResults[1].Z;
                             //如果下相机拍照的次数是1,则判断用时拍照的相机是几个
                             int upCameraNum = _configService.GetSystemConfiguration().UpCameraPutNum;
                             if (upCameraNum == 2)
                             {
-                                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));
+                                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));
                             }
 
                             var point = currentProduct.ScrewPoints[0].Clone();
@@ -1956,7 +1867,6 @@ namespace TeamAAS_VP.Core
                         }
                     }
                 }
-                
                 // 螺丝供料器螺丝递减
                 else if (addressConfig.In_PickINC.Address.Contains(tuple.nodeId))
                 {
@@ -1979,9 +1889,9 @@ namespace TeamAAS_VP.Core
 
                     }
                 }
-                // 过站检查
                 else
                 {
+                    // 过站检查
                     for (int i = 0; i < 10; i++)
                     {
                         if (string.Format(addressConfig.In_MesCheck.Address, i).Contains(tuple.nodeId))
@@ -2018,6 +1928,7 @@ namespace TeamAAS_VP.Core
                                         await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
 
                                         await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
+                                        return;
                                     }
                                     else
                                     {
@@ -2025,6 +1936,7 @@ namespace TeamAAS_VP.Core
                                         await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
 
                                         await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)0);
+                                        return;
                                     }
                                 }
                                 // 上传本站数据
@@ -2038,20 +1950,138 @@ namespace TeamAAS_VP.Core
                                         CTtime = DateTime.UtcNow.Subtract(_LastMesCheckTime[i]).TotalSeconds;
                                     }
 
-                                    (bool isSuccess, string response) = await _mesService.SubmitGetAsync(code, true, _LastMesCheckTime[i], DateTime.Now);
+                                    //读取产品结果
+                                    Int16 resultIndex = plc.ReadNode<Int16>(addressConfig.In_Result.Address);
+
+                                    //目前只记录当前站
+                                    if (i == 0)
+                                        await _systemDatabaseService.RecordProductionAsync(new ProductionRecord()
+                                        {
+                                            ProductName = currentProduct.Name,
+                                            ProductCode = code,
+                                            DeviceId = i,
+                                            DeviceName = "",
+                                            Category = resultIndex == 1 ? "OK" : "NG",
+                                            Quantity = 1,
+                                            Remark = $"TotalSeconds:{DateTime.UtcNow.Subtract(_LastMesCheckTime[i]).TotalSeconds.ToString("F2")}",
+                                        });
+
+                                    (bool isSuccess, string response) = await _mesService.SubmitGetAsync(code, resultIndex == 1 ? true : false, _LastMesCheckTime[i], DateTime.UtcNow);
                                     //假设上传成功,这里缺少上传失败的处理
 
                                     await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
+                                    return;
                                 }
                                 else
                                 {
                                     SendTaskMessage($"{i}过站检查信号:state={state},处理为默认状态", MessageLevel.Alarm);
                                     await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)0);
+                                    return;
                                 }
                             }
                         }
                     }
+                    //开始/停止 组装/锁附
+                    for (int i = 0; i < 7; i++)
+                    {
+                        //开始组装
+                        if (string.Format(addressConfig.In_WorkStart.Address, i).Contains(tuple.nodeId))
+                        {
+                            if (tuple.value is Int16 state)
+                            {
+                                if (_LastWorkStart[i] != state)
+                                {
+                                    _LastWorkStart[i] = state;
+                                }
+                                else
+                                {
+                                    return;
+                                }
+                                if (state == 1)
+                                {
+                                    SendTaskMessage($"收到开始组装信号[{i}]...", MessageLevel.Debug);
 
+                                    var code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
+                                    // 开始采集压力值
+                                    StartPressureCollection(currentProduct.Name, code, i);
+                                }
+                                else
+                                {
+                                    SendTaskMessage($"开始锁付信号[{i}]已关闭", MessageLevel.Alarm);
+                                    // 关闭时的处理(如需)可放在这里
+                                }
+                            }
+                        }
+                        //停止组装
+                        else if (string.Format(addressConfig.In_WorkStart.Address, i).Contains(tuple.nodeId))
+                        {
+                            if (tuple.value is Int16 state)
+                            {
+                                if (_LastWorkDone[i] != state)
+                                {
+                                    _LastWorkDone[i] = state;
+                                }
+                                else
+                                {
+                                    return;
+                                }
+                                if (state == 1 || state == 2)
+                                {
+                                    SendTaskMessage($"收到停止锁付信号[{i}]...", MessageLevel.Debug);
+                                    //获取当前锁付点
+                                    //var screwPoint = currentProduct.ScrewPoints.FirstOrDefault(p => p.Number == positionIndex);
+                                    ////获取当前的机器人点位
+                                    //var robot = _robotService.GetAllRobots().FirstOrDefault();
+                                    //var currentPosition = robot.GetRobotPos();
+                                    ////读取压力值
+                                    //float pressure = plc.ReadNode<float>(addressConfig.In_PressureValue.Address);
+
+
+                                    //await Task.Delay(60);
+                                    ////获取电批结果
+                                    //bool isSucced = ScrewDriver.GetData();
+                                    //LockResult lockResult = new LockResult();
+                                    //lockResult.ScrewdriverGetDataSucceed = isSucced;
+                                    //lockResult.Number = positionIndex;
+                                    //lockResult.LockPassed = ScrewDriver.Success;
+                                    //lockResult.ProductNumber = _productService.CurrentProductCode;
+                                    //lockResult.LockTurns = (float)ScrewDriver.Truns;
+                                    //lockResult.LockTorque = (float)ScrewDriver.TorqueValue;
+                                    //lockResult.LockDuration = (float)ScrewDriver.FinalTime;
+                                    //lockResult.ScrewdriverProgramNumber = ScrewDriver.ProgramNumber;
+                                    //lockResult.ResultDetails = ScrewDriver.ErrorInfo;
+                                    //lockResult.Pressure = pressure;
+                                    //lockResult.TargetTorque = ScrewDriver.TargetTorque;
+                                    //lockResult.TargetTurnsUpperLimit = ScrewDriver.TargetTurnsUpperLimit;
+                                    //lockResult.TargetTurnsLowerLimit = ScrewDriver.TargetTurnsLowerLimit;
+                                    //lockResult.TargetLockSpeed = ScrewDriver.TargetLockSpeed;
+                                    //lockResult.StartPositionX = currentPosition.X;
+                                    //lockResult.StartPositionY = currentPosition.Y;
+                                    //lockResult.StartPositionZ = screwPoint.Z_Position_Start;
+                                    //lockResult.EndPositionZ = currentPosition.Z;
+                                    //lockResult.LockDescentSpeed = screwPoint.Z_Velocity_Stop;
+                                    //lockResult.FeederNumber = screwPoint != null ? screwPoint.Feeder : 0;
+                                    //lockResult.NozzleNumber = "";
+                                    //lockResult.OperatorName = _systemDatabaseService.GetCurrentUser().UserName;
+                                    //lockResult.ProductImagePath = "";
+                                    //lockResult.WaveDatas = ScrewDriver.WaveDatas;
+                                    //App.Current.Dispatcher.Invoke(() =>
+                                    //{
+                                    //    _eventAggregator.GetEvent<LockFinishNotification>().Publish(lockResult);
+                                    //});
+                                    //await _systemDatabaseService.RecordLockResultAsync(lockResult);
+                                    await plc.WriteNodeAsync(addressConfig.In_WorkDone.Address, (Int16)0);
+                                    var code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
+                                    // 停止采集压力并保存
+                                    await StopAndSavePressureCollectionAsync(currentProduct.Name, code, i);
+                                }
+                                else
+                                {
+                                    SendTaskMessage($"停止锁付信号[{i}]已关闭", MessageLevel.Alarm);
+                                }
+                            }
+                        }
+                    }
                 }
             }
             catch (Exception ex)

+ 76 - 2
TeamAAS-VM/Models/PLC/PlcAddressConfig.cs

@@ -268,6 +268,26 @@ namespace TeamAAS_VP.Models.PLC
             set { SetProperty(ref _CheckCamera, value); }
         }
 
+        private PlcPointAddress _Out_RemovePos = new PlcPointAddress();
+        /// <summary>
+        /// 撕膜点位参数
+        /// </summary>
+        public PlcPointAddress Out_RemovePos
+        {
+            get { return _Out_RemovePos; }
+            set { SetProperty(ref _Out_RemovePos, value); }
+        }
+
+        private PlcPointAddress _Out_PressurePlace = new PlcPointAddress();
+        /// <summary>
+        /// 压力组装点位参数
+        /// </summary>
+        public PlcPointAddress Out_PressurePlace
+        {
+            get { return _Out_PressurePlace; }
+            set { SetProperty(ref _Out_PressurePlace, value); }
+        }
+
         private PlcAddress _Out_ScrewTeachNum;
         /// <summary>
         /// 披头矫正的模式,1:初始化时矫正,2:每个产品矫正一次,3:每颗螺丝矫正一次
@@ -320,6 +340,17 @@ namespace TeamAAS_VP.Models.PLC
             set { SetProperty(ref _In_MesCheck, value); }
         }
 
+        private PlcAddress _In_Result = new PlcAddress();
+        /// <summary>
+        /// 产品的最终结果
+        /// </summary>
+        public PlcAddress In_Result
+        {
+            get { return _In_Result; }
+            set { SetProperty(ref _In_Result, value); }
+        }
+
+
         private PlcAddress _In_DowmCameraNum = new PlcAddress();
         /// <summary>
         /// 下相机拍照编号
@@ -779,6 +810,44 @@ namespace TeamAAS_VP.Models.PLC
             Out_CheckCamera.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Feeder";
             Out_CheckCamera.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].ScrewProNum";
 
+            //撕膜点位
+            Out_RemovePos = EnsurePoint(Out_RemovePos);
+            Out_RemovePos.Description = "撕膜点位参数";
+            Out_RemovePos.X_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].X_Position";
+            Out_RemovePos.X_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].X_Velocity";
+            Out_RemovePos.Y_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].Y_Position";
+            Out_RemovePos.Y_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].Y_Velocity";
+            Out_RemovePos.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].Z_Position_Start";
+            Out_RemovePos.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].Z_Velocity_Start";
+            Out_RemovePos.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].Z_Position_Stop";
+            Out_RemovePos.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].Z_Velocity_Stop";
+            Out_RemovePos.U_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].U_Position";
+            Out_RemovePos.U_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].U_Velocity";
+            Out_RemovePos.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].R_Position";
+            Out_RemovePos.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].R_Velocity";
+            Out_RemovePos.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_Remove[{0}].Torque";
+            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_CheckCamera(附加轴点位)初始化并赋地址,
 
             Out_ScrewTeachNum = Ensure(Out_ScrewTeachNum);
@@ -809,6 +878,11 @@ namespace TeamAAS_VP.Models.PLC
             In_MesCheck.DataType = "int16";
             In_MesCheck.Description = "Mes交互 =1 获取过站信息当站是否生产,=2 上传本站数据";
 
+            In_Result = Ensure(In_Result);
+            In_Result.Address = "ns=4;s=DB_Communication|ToPC.Mes[0].Product_Status";
+            In_Result.DataType = "int16";
+            In_Result.Description = "产品的最终结果,1:OK; 2:NG";
+
             In_DowmCameraNum = Ensure(In_DowmCameraNum);
             In_DowmCameraNum.Address = "ns=4;s=DB_Communication|ToPC.DowmCameraNum";
             In_DowmCameraNum.DataType = "int16";
@@ -890,12 +964,12 @@ namespace TeamAAS_VP.Models.PLC
             In_RequestPosition.Description = "请求目标位置";
 
             In_WorkStart = Ensure(In_WorkStart);
-            In_WorkStart.Address = "ns=4;s=DB_Communication|ToPC.WorkStart";
+            In_WorkStart.Address = "ns=4;s=DB_Communication|ToPC.WorkStart[{0}]";
             In_WorkStart.DataType = "int16";
             In_WorkStart.Description = "锁附/组装开始 =1";
 
             In_WorkDone = Ensure(In_WorkDone);
-            In_WorkDone.Address = "ns=4;s=DB_Communication|ToPC.WorkDone";
+            In_WorkDone.Address = "ns=4;s=DB_Communication|ToPC.WorkStart[{0}]";
             In_WorkDone.DataType = "int16";
             In_WorkDone.Description = "锁附/组装结束 =1OK =2NG";
 

+ 22 - 0
TeamAAS-VM/Models/Product/ProductModel.cs

@@ -336,6 +336,26 @@ namespace TeamAAS_VP.Models
             set { SetProperty(ref _CheckCameraPoints, value); }
         }
 
+        private ObservableCollection<PlcPoint> _RemovePoints = new ObservableCollection<PlcPoint>();
+        /// <summary>
+        /// 撕膜点位参数集合
+        /// </summary>
+        public ObservableCollection<PlcPoint> RemovePoints
+        {
+            get { return _RemovePoints; }
+            set { SetProperty(ref _RemovePoints, value); }
+        }
+
+        private ObservableCollection<PlcPoint> _PressurePlacePoints = new ObservableCollection<PlcPoint>();
+        /// <summary>
+        /// 压力组装点位参数集合
+        /// </summary>
+        public ObservableCollection<PlcPoint> PressurePlacePoints
+        {
+            get { return _PressurePlacePoints; }
+            set { SetProperty(ref _PressurePlacePoints, value); }
+        }
+
         private bool _IsLoad;
         /// <summary>
         /// 是否已加载
@@ -449,6 +469,8 @@ namespace TeamAAS_VP.Models
                 ScrewCameraPoints = this.ScrewCameraPoints,
                 ScrewPoints = this.ScrewPoints,
                 CheckCameraPoints = this.CheckCameraPoints,
+                RemovePoints = this.RemovePoints,
+                PressurePlacePoints = this.PressurePlacePoints,
                 IsLoad = this.IsLoad,
                 IsCreate = this.IsCreate
             };

+ 23 - 0
TeamAAS-VM/Models/ProductionRecord.cs

@@ -11,6 +11,23 @@ namespace TeamAAS_VP.Models
 
         public string ProductName { get; set; }
 
+        /// <summary>
+        /// 产品编号
+        /// </summary>
+        [SugarColumn(Length = 255, IsNullable = true)]
+        public string ProductCode { get; set; }
+
+        /// <summary>
+        /// 设备ID
+        /// </summary>
+        public int DeviceId { get; set; }
+
+        /// <summary>
+        /// 设备编号
+        /// </summary>
+        [SugarColumn(Length = 255, IsNullable = true)]
+        public string DeviceName { get; set; }
+
         public DateTime Timestamp { get; set; } = DateTime.UtcNow;
         /// <summary>
         /// Category like "OK", "NG", etc.
@@ -26,5 +43,11 @@ namespace TeamAAS_VP.Models
         /// </summary>
         [SugarColumn(Length = 255, IsNullable = true)]
         public string UserName { get; set; }
+
+        /// <summary>
+        /// 备注
+        /// </summary>
+        [SugarColumn(Length = 500, IsNullable = true)]
+        public string Remark { get; set; }
     }
 }

+ 40 - 0
TeamAAS-VM/ViewModels/Product/PlcPointParamsViewModel.cs

@@ -815,6 +815,12 @@ namespace TeamAAS_VP.ViewModels.Product
                 case 5:
                     Points = SelectProduct.CheckCameraPoints;
                     break;
+                case 6:
+                    Points = SelectProduct.RemovePoints;
+                    break;
+                case 7:
+                    Points = SelectProduct.PressurePlacePoints;
+                    break;
                 default:
                     break;
             }
@@ -1857,6 +1863,40 @@ namespace TeamAAS_VP.ViewModels.Product
                     PickP2 = SelectProduct.PickPoints.LastOrDefault().Clone();
                     ColumnNum = SelectProduct.PickPoints.Count;
                 }
+
+                if (SelectProduct.PickCameraPoints == null)
+                {
+                    SelectProduct.PickCameraPoints = new ObservableCollection<PlcPoint>();
+                }
+                if (SelectProduct.PickPoints == null)
+                {
+                    SelectProduct.PickPoints = new ObservableCollection<PlcPoint>();
+                }
+                if (SelectProduct.SecPosCameraPoints == null)
+                {
+                    SelectProduct.SecPosCameraPoints = new ObservableCollection<PlcPoint>();
+                }
+                if (SelectProduct.ScrewCameraPoints == null)
+                {
+                    SelectProduct.ScrewCameraPoints = new ObservableCollection<PlcPoint>();
+                }
+                if (SelectProduct.ScrewPoints == null)
+                {
+                    SelectProduct.ScrewPoints = new ObservableCollection<PlcPoint>();
+                }
+                if (SelectProduct.CheckCameraPoints == null)
+                {
+                    SelectProduct.CheckCameraPoints = new ObservableCollection<PlcPoint>();
+                }
+                if (SelectProduct.RemovePoints == null)
+                {
+                    SelectProduct.RemovePoints = new ObservableCollection<PlcPoint>();
+                }
+                if (SelectProduct.PressurePlacePoints == null)
+                {
+                    SelectProduct.PressurePlacePoints = new ObservableCollection<PlcPoint>();
+                }
+
             }
             catch (Exception ex)
             {

+ 2 - 0
TeamAAS-VM/ViewModels/Product/ProductHomeViewModel.cs

@@ -205,6 +205,8 @@ namespace TeamAAS_VP.ViewModels.Product
                         ScrewCameraPoints=new ObservableCollection<Models.PLC.PlcPoint>(),
                         ScrewPoints=new ObservableCollection<Models.PLC.PlcPoint>(),
                         CheckCameraPoints=new ObservableCollection<Models.PLC.PlcPoint>(),
+                        RemovePoints = new ObservableCollection<Models.PLC.PlcPoint>(),
+                        PressurePlacePoints = new ObservableCollection<Models.PLC.PlcPoint>(),
                     };
 
                     var cameras = _configService.GetAllCameras();

+ 26 - 0
TeamAAS-VM/Views/Product/PlcPointParams.xaml

@@ -290,6 +290,32 @@
                                 </ListBoxItem.Style>
                                 <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>
+                            <!--压力组装点位-->
+                            <!--<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"