Commit 39cbccd1 刘韬

优化超声波高度检测

1 个父辈 0399105c
...@@ -85,6 +85,7 @@ ...@@ -85,6 +85,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ResourceCulture.cs" />
<Compile Include="useControl\AxisTipControl.cs"> <Compile Include="useControl\AxisTipControl.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
...@@ -149,7 +150,6 @@ ...@@ -149,7 +150,6 @@
</Compile> </Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResourceCulture.cs" />
<Compile Include="useControl\AxisMoveControl.cs"> <Compile Include="useControl\AxisMoveControl.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
......
...@@ -241,7 +241,7 @@ namespace OnlineStore.ACSingleStore ...@@ -241,7 +241,7 @@ namespace OnlineStore.ACSingleStore
public static double ConvertAI(double aiValue, double defaultValue) public static double ConvertAI(double aiValue, double defaultValue)
{ {
double xishu = (double)StoreManager.Config.AI_ConvertPosition; double xishu = (double)StoreManager.Config.AI_ConvertPosition;
double result = Math.Round((aiValue - defaultValue) / xishu, 2); double result = Math.Round(Math.Abs(aiValue - defaultValue) / xishu, 2);
return result; return result;
} }
private void btnOpenDoor_Click(object sender, EventArgs e) private void btnOpenDoor_Click(object sender, EventArgs e)
......
...@@ -9,7 +9,7 @@ using System.Runtime.InteropServices; ...@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SO951-HC-ACSingleStore 413b0ee4261e11a49b88fd1c49b2cd7507d75209")] [assembly: AssemblyProduct("SO951-HC-ACSingleStore 0399105cb374afe8fabf1f8f43f3d8f5ff67b31e")]
[assembly: AssemblyCopyright("Copyright ? 2017")] [assembly: AssemblyCopyright("Copyright ? 2017")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
this.groupAxis = new System.Windows.Forms.GroupBox(); this.groupAxis = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.lblAlarmcode = new System.Windows.Forms.Label(); this.lblAlarmcode = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label(); this.label54 = new System.Windows.Forms.Label();
this.lblhomeSts = new System.Windows.Forms.Label(); this.lblhomeSts = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.lblAxEncAcc = new System.Windows.Forms.Label(); this.lblAxEncAcc = new System.Windows.Forms.Label();
...@@ -119,17 +119,22 @@ ...@@ -119,17 +119,22 @@
this.groupAxis.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.groupAxis.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupAxis.Location = new System.Drawing.Point(4, 3); this.groupAxis.Location = new System.Drawing.Point(4, 3);
this.groupAxis.Name = "groupAxis"; this.groupAxis.Name = "groupAxis";
this.groupAxis.Size = new System.Drawing.Size(692, 395); this.groupAxis.Size = new System.Drawing.Size(692, 419);
this.groupAxis.TabIndex = 218; this.groupAxis.TabIndex = 218;
this.groupAxis.TabStop = false; this.groupAxis.TabStop = false;
this.groupAxis.Text = "伺服运动"; this.groupAxis.Text = "伺服运动";
// //
// groupBox2 // groupBox2
// //
this.groupBox2.Controls.Add(this.label54);
this.groupBox2.Controls.Add(this.label50);
this.groupBox2.Controls.Add(this.label53);
this.groupBox2.Controls.Add(this.label56);
this.groupBox2.Controls.Add(this.label55);
this.groupBox2.Controls.Add(this.label52);
this.groupBox2.Controls.Add(this.lblAlarmcode); this.groupBox2.Controls.Add(this.lblAlarmcode);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.lblhomeSts);
this.groupBox2.Controls.Add(this.label2); this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.lblhomeSts);
this.groupBox2.Controls.Add(this.lblAxEncAcc); this.groupBox2.Controls.Add(this.lblAxEncAcc);
this.groupBox2.Controls.Add(this.lblINP); this.groupBox2.Controls.Add(this.lblINP);
this.groupBox2.Controls.Add(this.lblBUSY); this.groupBox2.Controls.Add(this.lblBUSY);
...@@ -140,21 +145,16 @@ ...@@ -140,21 +145,16 @@
this.groupBox2.Controls.Add(this.lblEMG); this.groupBox2.Controls.Add(this.lblEMG);
this.groupBox2.Controls.Add(this.lblWARN); this.groupBox2.Controls.Add(this.lblWARN);
this.groupBox2.Controls.Add(this.lblALM); this.groupBox2.Controls.Add(this.lblALM);
this.groupBox2.Controls.Add(this.label53);
this.groupBox2.Controls.Add(this.label56);
this.groupBox2.Controls.Add(this.label55);
this.groupBox2.Controls.Add(this.label52);
this.groupBox2.Controls.Add(this.lblAxEncVel); this.groupBox2.Controls.Add(this.lblAxEncVel);
this.groupBox2.Controls.Add(this.lblAxPrfVel); this.groupBox2.Controls.Add(this.lblAxPrfVel);
this.groupBox2.Controls.Add(this.lblAxEncPos); this.groupBox2.Controls.Add(this.lblAxEncPos);
this.groupBox2.Controls.Add(this.lblAxPrfPos); this.groupBox2.Controls.Add(this.lblAxPrfPos);
this.groupBox2.Controls.Add(this.lblAxisPrfMode); this.groupBox2.Controls.Add(this.lblAxisPrfMode);
this.groupBox2.Controls.Add(this.label50);
this.groupBox2.Location = new System.Drawing.Point(7, 270); this.groupBox2.Location = new System.Drawing.Point(7, 270);
this.groupBox2.Margin = new System.Windows.Forms.Padding(2); this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(2); this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
this.groupBox2.Size = new System.Drawing.Size(540, 118); this.groupBox2.Size = new System.Drawing.Size(540, 144);
this.groupBox2.TabIndex = 303; this.groupBox2.TabIndex = 303;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "轴状态监控"; this.groupBox2.Text = "轴状态监控";
...@@ -170,20 +170,20 @@ ...@@ -170,20 +170,20 @@
this.lblAlarmcode.Text = "错误码:160"; this.lblAlarmcode.Text = "错误码:160";
this.lblAlarmcode.Visible = false; this.lblAlarmcode.Visible = false;
// //
// label4 // label54
// //
this.label4.AutoSize = true; this.label54.AutoSize = true;
this.label4.Location = new System.Drawing.Point(267, 90); this.label54.Location = new System.Drawing.Point(267, 104);
this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label54.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label4.Name = "label4"; this.label54.Name = "label54";
this.label4.Size = new System.Drawing.Size(59, 17); this.label54.Size = new System.Drawing.Size(59, 17);
this.label4.TabIndex = 18; this.label54.TabIndex = 18;
this.label4.Text = "回原状态:"; this.label54.Text = "回原状态:";
// //
// lblhomeSts // lblhomeSts
// //
this.lblhomeSts.AutoSize = true; this.lblhomeSts.AutoSize = true;
this.lblhomeSts.Location = new System.Drawing.Point(332, 90); this.lblhomeSts.Location = new System.Drawing.Point(275, 121);
this.lblhomeSts.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblhomeSts.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblhomeSts.Name = "lblhomeSts"; this.lblhomeSts.Name = "lblhomeSts";
this.lblhomeSts.Size = new System.Drawing.Size(17, 17); this.lblhomeSts.Size = new System.Drawing.Size(17, 17);
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(433, 90); this.label2.Location = new System.Drawing.Point(433, 104);
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(71, 17); this.label2.Size = new System.Drawing.Size(71, 17);
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
// lblAxEncAcc // lblAxEncAcc
// //
this.lblAxEncAcc.AutoSize = true; this.lblAxEncAcc.AutoSize = true;
this.lblAxEncAcc.Location = new System.Drawing.Point(510, 90); this.lblAxEncAcc.Location = new System.Drawing.Point(442, 121);
this.lblAxEncAcc.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblAxEncAcc.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblAxEncAcc.Name = "lblAxEncAcc"; this.lblAxEncAcc.Name = "lblAxEncAcc";
this.lblAxEncAcc.Size = new System.Drawing.Size(17, 17); this.lblAxEncAcc.Size = new System.Drawing.Size(17, 17);
...@@ -305,7 +305,7 @@ ...@@ -305,7 +305,7 @@
// label53 // label53
// //
this.label53.AutoSize = true; this.label53.AutoSize = true;
this.label53.Location = new System.Drawing.Point(134, 90); this.label53.Location = new System.Drawing.Point(134, 104);
this.label53.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label53.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label53.Name = "label53"; this.label53.Name = "label53";
this.label53.Size = new System.Drawing.Size(59, 17); this.label53.Size = new System.Drawing.Size(59, 17);
...@@ -315,7 +315,7 @@ ...@@ -315,7 +315,7 @@
// label56 // label56
// //
this.label56.AutoSize = true; this.label56.AutoSize = true;
this.label56.Location = new System.Drawing.Point(10, 90); this.label56.Location = new System.Drawing.Point(10, 104);
this.label56.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label56.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label56.Name = "label56"; this.label56.Name = "label56";
this.label56.Size = new System.Drawing.Size(59, 17); this.label56.Size = new System.Drawing.Size(59, 17);
...@@ -345,7 +345,7 @@ ...@@ -345,7 +345,7 @@
// lblAxEncVel // lblAxEncVel
// //
this.lblAxEncVel.AutoSize = true; this.lblAxEncVel.AutoSize = true;
this.lblAxEncVel.Location = new System.Drawing.Point(73, 90); this.lblAxEncVel.Location = new System.Drawing.Point(16, 121);
this.lblAxEncVel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblAxEncVel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblAxEncVel.Name = "lblAxEncVel"; this.lblAxEncVel.Name = "lblAxEncVel";
this.lblAxEncVel.Size = new System.Drawing.Size(17, 17); this.lblAxEncVel.Size = new System.Drawing.Size(17, 17);
...@@ -355,7 +355,7 @@ ...@@ -355,7 +355,7 @@
// lblAxPrfVel // lblAxPrfVel
// //
this.lblAxPrfVel.AutoSize = true; this.lblAxPrfVel.AutoSize = true;
this.lblAxPrfVel.Location = new System.Drawing.Point(199, 90); this.lblAxPrfVel.Location = new System.Drawing.Point(142, 121);
this.lblAxPrfVel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblAxPrfVel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblAxPrfVel.Name = "lblAxPrfVel"; this.lblAxPrfVel.Name = "lblAxPrfVel";
this.lblAxPrfVel.Size = new System.Drawing.Size(17, 17); this.lblAxPrfVel.Size = new System.Drawing.Size(17, 17);
...@@ -365,7 +365,7 @@ ...@@ -365,7 +365,7 @@
// lblAxEncPos // lblAxEncPos
// //
this.lblAxEncPos.AutoSize = true; this.lblAxEncPos.AutoSize = true;
this.lblAxEncPos.Location = new System.Drawing.Point(73, 65); this.lblAxEncPos.Location = new System.Drawing.Point(16, 82);
this.lblAxEncPos.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblAxEncPos.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblAxEncPos.Name = "lblAxEncPos"; this.lblAxEncPos.Name = "lblAxEncPos";
this.lblAxEncPos.Size = new System.Drawing.Size(17, 17); this.lblAxEncPos.Size = new System.Drawing.Size(17, 17);
...@@ -375,7 +375,7 @@ ...@@ -375,7 +375,7 @@
// lblAxPrfPos // lblAxPrfPos
// //
this.lblAxPrfPos.AutoSize = true; this.lblAxPrfPos.AutoSize = true;
this.lblAxPrfPos.Location = new System.Drawing.Point(199, 65); this.lblAxPrfPos.Location = new System.Drawing.Point(142, 82);
this.lblAxPrfPos.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblAxPrfPos.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblAxPrfPos.Name = "lblAxPrfPos"; this.lblAxPrfPos.Name = "lblAxPrfPos";
this.lblAxPrfPos.Size = new System.Drawing.Size(17, 17); this.lblAxPrfPos.Size = new System.Drawing.Size(17, 17);
...@@ -385,11 +385,12 @@ ...@@ -385,11 +385,12 @@
// lblAxisPrfMode // lblAxisPrfMode
// //
this.lblAxisPrfMode.AutoSize = true; this.lblAxisPrfMode.AutoSize = true;
this.lblAxisPrfMode.Location = new System.Drawing.Point(332, 65); this.lblAxisPrfMode.Location = new System.Drawing.Point(275, 82);
this.lblAxisPrfMode.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblAxisPrfMode.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblAxisPrfMode.Name = "lblAxisPrfMode"; this.lblAxisPrfMode.Name = "lblAxisPrfMode";
this.lblAxisPrfMode.Size = new System.Drawing.Size(17, 17); this.lblAxisPrfMode.Size = new System.Drawing.Size(17, 17);
this.lblAxisPrfMode.TabIndex = 1; this.lblAxisPrfMode.TabIndex = 1;
this.lblAxisPrfMode.Tag = "not";
this.lblAxisPrfMode.Text = "..."; this.lblAxisPrfMode.Text = "...";
// //
// label50 // label50
...@@ -746,7 +747,7 @@ ...@@ -746,7 +747,7 @@
// //
// label_speed // label_speed
// //
this.label_speed.Location = new System.Drawing.Point(3, 217); this.label_speed.Location = new System.Drawing.Point(-1, 218);
this.label_speed.Name = "label_speed"; this.label_speed.Name = "label_speed";
this.label_speed.Size = new System.Drawing.Size(100, 17); this.label_speed.Size = new System.Drawing.Size(100, 17);
this.label_speed.TabIndex = 329; this.label_speed.TabIndex = 329;
...@@ -954,7 +955,7 @@ ...@@ -954,7 +955,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.groupAxis); this.Controls.Add(this.groupAxis);
this.Name = "AxisMoveControl"; this.Name = "AxisMoveControl";
this.Size = new System.Drawing.Size(699, 402); this.Size = new System.Drawing.Size(699, 426);
this.groupAxis.ResumeLayout(false); this.groupAxis.ResumeLayout(false);
this.groupAxis.PerformLayout(); this.groupAxis.PerformLayout();
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
...@@ -1015,7 +1016,7 @@ ...@@ -1015,7 +1016,7 @@
private System.Windows.Forms.ComboBox comjSpeed; private System.Windows.Forms.ComboBox comjSpeed;
private System.Windows.Forms.LinkLabel linkLabel1; private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label54;
private System.Windows.Forms.Label lblhomeSts; private System.Windows.Forms.Label lblhomeSts;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label lblAxEncAcc; private System.Windows.Forms.Label lblAxEncAcc;
......
...@@ -233,7 +233,7 @@ namespace OnlineStore.ACSingleStore.useControl ...@@ -233,7 +233,7 @@ namespace OnlineStore.ACSingleStore.useControl
//store.PositionNumList.Reverse(); //store.PositionNumList.Reverse();
string[] posstr = store.PositionNumList[store.PositionNumList.Count-1].Split('_'); string[] posstr = store.PositionNumList[store.PositionNumList.Count-1].Split('_');
int colcount = int.Parse(Regex.Replace(posstr[1], @"[^\d]*", "")) + 1; int colcount = int.Parse(Regex.Replace(posstr[1], @"[^\d]*", "")[0].ToString()) + 1;
for (int i = 0; i < colcount; i++) for (int i = 0; i < colcount; i++)
{ {
dataGridView1.Columns.Add("Col" + i + "_A", "Col" + i + "_A"); dataGridView1.Columns.Add("Col" + i + "_A", "Col" + i + "_A");
...@@ -257,10 +257,12 @@ namespace OnlineStore.ACSingleStore.useControl ...@@ -257,10 +257,12 @@ namespace OnlineStore.ACSingleStore.useControl
if (posname.StartsWith("fix")) if (posname.StartsWith("fix"))
continue; continue;
string[] _posstr = posname.Split('_'); string[] _posstr = posname.Split('_');
int col = int.Parse(Regex.Replace(_posstr[1], @"[^\d]*", "")); int col = int.Parse(Regex.Replace(_posstr[1], @"[^\d]*", "")[0].ToString());
string ab = "A"; string ab = "A";
if (_posstr[2].Length>1) if (_posstr[2].Length>1)
ab= _posstr[2][1].ToString(); ab= _posstr[2][1].ToString();
else if (_posstr[1].Length > 1)
ab = _posstr[1][1].ToString();
if (ab != "A" && ab != "B") if (ab != "A" && ab != "B")
{ {
if (ab == "1") if (ab == "1")
......
...@@ -10,7 +10,7 @@ using System.Threading.Tasks; ...@@ -10,7 +10,7 @@ using System.Threading.Tasks;
public class DauxiKS107Controller public class DauxiKS107Controller
{ {
private static int baudRate =9600;//波特率 private static int baudRate = 9600;//波特率
private static Parity parity = Parity.None;//校验位 private static Parity parity = Parity.None;//校验位
private static int dataBits = 8;//数据位 private static int dataBits = 8;//数据位
private static StopBits stopBits = StopBits.One; //停止位 private static StopBits stopBits = StopBits.One; //停止位
......
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Asa.Camera.VisionLib, Version=1.3.7927.28975, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Asa.Camera.VisionLib, Version=1.3.8398.28384, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\ACSingleStore\bin\Debug\Asa.Camera.VisionLib.dll</HintPath> <HintPath>..\..\..\Camera\CameraVisionLibSetting\bin\Debug\Asa.Camera.VisionLib.dll</HintPath>
</Reference> </Reference>
<Reference Include="Asa.IOModule.AIOBOX"> <Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath> <HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
......
...@@ -52,7 +52,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -52,7 +52,7 @@ namespace OnlineStore.DeviceLibrary
private System.Timers.Timer IoCheckTimer = new System.Timers.Timer(); private System.Timers.Timer IoCheckTimer = new System.Timers.Timer();
private int OutStoreWaitSeconds = ConfigAppSettings.GetIntValue(Setting_Init.OutStoreWaitSeconds); private int OutStoreWaitSeconds = ConfigAppSettings.GetIntValue(Setting_Init.OutStoreWaitSeconds);
public static DauxiKS107Controller Ultrasonic1 = new DauxiKS107Controller(300); public static DauxiKS107Controller Ultrasonic1 = null;
public AC_SA_BoxBean(AC_SA_Config config) public AC_SA_BoxBean(AC_SA_Config config)
{ {
...@@ -115,11 +115,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -115,11 +115,14 @@ namespace OnlineStore.DeviceLibrary
return; return;
} }
LogUtil.info(StoreName + "Ultrasonic1_Port:"+ Config.Ultrasonic1_Port); LogUtil.info(StoreName + "Ultrasonic1_Port:"+ Config.Ultrasonic1_Port);
if (!string.IsNullOrWhiteSpace(Config.Ultrasonic1_Port) && !Ultrasonic1.OpenPort(Config.Ultrasonic1_Port, out string errmsg)){ if (!string.IsNullOrWhiteSpace(Config.Ultrasonic1_Port)){
Ultrasonic1 = new DauxiKS107Controller(300);
if (!Ultrasonic1.OpenPort(Config.Ultrasonic1_Port, out string errmsg)) {
SetWarnMsg(ResourceControl.CustAlarm, errmsg); SetWarnMsg(ResourceControl.CustAlarm, errmsg);
LogUtil.error(StoreName + errmsg); LogUtil.error(StoreName + errmsg);
return; return;
} }
}
...@@ -567,7 +570,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -567,7 +570,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_OtherAxisBack_04); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_OtherAxisBack_04);
LogUtil.info(LOGGER, StoreName + " 舱门口无盘, 执行往舱门口放盘"); LogUtil.info(LOGGER, StoreName + " 舱门口无盘, 执行往舱门口放盘");
} }
else else if (StoreMove.IsTimeOut(out _, 3))
{ {
SetWarnMsg("舱门口有盘无法完成回原,请取走"); SetWarnMsg("舱门口有盘无法完成回原,请取走");
//StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1); //StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1);
...@@ -589,7 +592,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -589,7 +592,7 @@ namespace OnlineStore.DeviceLibrary
var InOutAxis_DoorPosition_P2 = CSVPositionReader<ACStorePosition>.allPositionMap.First().Value.InOutAxis_DoorPosition_P2; var InOutAxis_DoorPosition_P2 = CSVPositionReader<ACStorePosition>.allPositionMap.First().Value.InOutAxis_DoorPosition_P2;
ACAxisMove(Config.InOut_Axis, InOutAxis_DoorPosition_P2, Config.InOutAxis_P2_Speed); ACAxisMove(Config.InOut_Axis, InOutAxis_DoorPosition_P2, Config.InOutAxis_P2_Speed);
} }
else else if (StoreMove.IsTimeOut(out _, 5))
{ {
SetWarnMsg("舱门口有盘无法完成回原,请取走"); SetWarnMsg("舱门口有盘无法完成回原,请取走");
//StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1); //StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1);
...@@ -1789,6 +1792,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -1789,6 +1792,11 @@ namespace OnlineStore.DeviceLibrary
{ {
if (CodeManager.IsServerAccess()) if (CodeManager.IsServerAccess())
return 0; return 0;
if (Ultrasonic1!=null) {
return CalHeight(ConvertAI(StoreManager.Store.GetADIO(1), Config.AIDI1_DefaultPosition));
}
if (Config.Default_TrayWidth.Equals(Width_7)) if (Config.Default_TrayWidth.Equals(Width_7))
{ {
return GetSmallHeight(); return GetSmallHeight();
...@@ -1918,7 +1926,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1918,7 +1926,7 @@ namespace OnlineStore.DeviceLibrary
public static double ConvertAI(double aiValue, double defaultValue) public static double ConvertAI(double aiValue, double defaultValue)
{ {
double xishu = (double)StoreManager.Config.AI_ConvertPosition; double xishu = (double)StoreManager.Config.AI_ConvertPosition;
double result = Math.Round((aiValue - defaultValue) / xishu, 2); double result = Math.Round(Math.Abs(aiValue - defaultValue) / xishu, 2);
return result; return result;
} }
#endregion #endregion
......
using OnlineStore.LoadCSVLibrary; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -13,31 +14,76 @@ namespace OnlineStore.DeviceLibrary ...@@ -13,31 +14,76 @@ namespace OnlineStore.DeviceLibrary
switch (index) switch (index)
{ {
case 1: case 1:
if (Ultrasonic1.IsRunning) if (Ultrasonic1!= null)
return Ultrasonic1.Distance; return Ultrasonic1.Distance;
else else
if (StoreManager.Config.AIDI1_Addr>=0)
return IOManager.GetADIOValue(StoreManager.Config.AIDI1_Addr); return IOManager.GetADIOValue(StoreManager.Config.AIDI1_Addr);
break;
case 2: case 2:
if (StoreManager.Config.AIDI2_Addr >= 0)
return IOManager.GetADIOValue(StoreManager.Config.AIDI2_Addr); return IOManager.GetADIOValue(StoreManager.Config.AIDI2_Addr);
break;
case 3: case 3:
if (StoreManager.Config.AIDI3_Addr >= 0)
return IOManager.GetADIOValue(StoreManager.Config.AIDI3_Addr); return IOManager.GetADIOValue(StoreManager.Config.AIDI3_Addr);
break;
case 4: case 4:
if (StoreManager.Config.AIDI4_Addr >= 0)
return IOManager.GetADIOValue(StoreManager.Config.AIDI4_Addr); return IOManager.GetADIOValue(StoreManager.Config.AIDI4_Addr);
break;
default: default:
return -1; return -1;
} }
return -1;
} }
DebounceFilter TrayCheck_DoorFilter = new DebounceFilter(10);
IO_VALUE TrayCheck_Door IO_VALUE TrayCheck_Door
{ {
get get
{ {
if (Ultrasonic1.IsRunning) if (Ultrasonic1 != null)
return Ultrasonic1.Distance > 5 ? IO_VALUE.HIGH : IO_VALUE.LOW; {
var xx = Math.Abs(Ultrasonic1.Distance - Config.AIDI1_DefaultPosition);
var vv = xx >= 5 ? IO_VALUE.HIGH : IO_VALUE.LOW;
var Filter = TrayCheck_DoorFilter.Filter(vv);
LogUtil.info("Ultrasonic1.Distance:" + Ultrasonic1.Distance + "," + xx + "," + vv + ",Filter=" + Filter);
return Filter;
}
else else
return IOManager.IOValue(IO_Type.TrayCheck_Door); return IOManager.IOValue(IO_Type.TrayCheck_Door);
} }
} }
} }
public class DebounceFilter
{
private IO_VALUE _lastValue;
private int _counter;
private readonly int _threshold;
public DebounceFilter(int threshold)
{
_threshold = threshold;
}
public IO_VALUE Filter(IO_VALUE value)
{
if (value == _lastValue)
{
_counter = 0;
return value;
}
_counter++;
if (_counter >= _threshold)
{
_lastValue = value;
_counter = 0;
return value;
}
return _lastValue;
}
}
} }
...@@ -404,21 +404,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -404,21 +404,20 @@ namespace OnlineStore.DeviceLibrary
{ {
NeedCheckSafetyLight = 0; NeedCheckSafetyLight = 0;
HIKCamera.Current.CameraGrabOne(HIKCamera.Current.GetFixtureStateFilename(StoreMove.MoveParam, StoreMove.MoveType, FixtureState.DoorIn)); HIKCamera.Current.CameraGrabOne(HIKCamera.Current.GetFixtureStateFilename(StoreMove.MoveParam, StoreMove.MoveType, FixtureState.DoorIn));
if (TrayCheck_Door.Equals(IO_VALUE.LOW)) if (TrayCheck_Door.Equals(IO_VALUE.HIGH))
{
InStoreLog("入库:SI_06 未检测到料盘,任务取消 ");
StoreMove.NextMoveStep(StoreMoveStep.SI_14_CheckTray);
ACAxisMove(Config.InOut_Axis, StoreMove.MoveParam.MoveP.InOut_P1, Config.InOutAxis_P1_Speed);
HttpHelper.cancelPutInTask(Name, StoreMove.MoveParam.WareNumber);
}
else
{ {
InStoreLog("入库:SI_06 拿物品,压紧轴至P2(压紧点)) 升降轴至P7(进料口取料缓冲点) "); InStoreLog("入库:SI_06 拿物品,压紧轴至P2(压紧点)) 升降轴至P7(进料口取料缓冲点) ");
StoreMove.NextMoveStep(StoreMoveStep.SI_06_DoorWarToDevice); StoreMove.NextMoveStep(StoreMoveStep.SI_06_DoorWarToDevice);
ComMoveToPosition(moveP.ComPress_P2, Config.CompAxis_P2_Speed); ComMoveToPosition(moveP.ComPress_P2, Config.CompAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P7, Config.UpDownAxis_P7_Speed); ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P7, Config.UpDownAxis_P7_Speed);
} }
else if (StoreMove.IsTimeOut(out _, 5))
{
InStoreLog("入库:SI_06 未检测到料盘,任务取消 ");
StoreMove.NextMoveStep(StoreMoveStep.SI_14_CheckTray);
ACAxisMove(Config.InOut_Axis, StoreMove.MoveParam.MoveP.InOut_P1, Config.InOutAxis_P1_Speed);
HttpHelper.cancelPutInTask(Name, StoreMove.MoveParam.WareNumber);
}
} }
else if (StoreMove.MoveStep == StoreMoveStep.SI_06_DoorWarToDevice) else if (StoreMove.MoveStep == StoreMoveStep.SI_06_DoorWarToDevice)
...@@ -838,7 +837,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -838,7 +837,7 @@ namespace OnlineStore.DeviceLibrary
storeStatus = StoreStatus.OutStorEnd; storeStatus = StoreStatus.OutStorEnd;
SendLineStatus(); SendLineStatus();
} }
else else if (StoreMove.IsTimeOut(out _,5))
{ {
lastPosIdStatus = StoreStatus.OutStoreError; lastPosIdStatus = StoreStatus.OutStoreError;
...@@ -934,7 +933,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -934,7 +933,7 @@ namespace OnlineStore.DeviceLibrary
private void SO_091_WaitNoTray() private void SO_091_WaitNoTray()
{ {
if (IOManager.IOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.HIGH) && if (IOManager.IOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.HIGH) &&
IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.LOW)) TrayCheck_Door.Equals(IO_VALUE.LOW))
{ {
StoreMove.NextMoveStep(StoreMoveStep.SO_091_WaitNoTray); StoreMove.NextMoveStep(StoreMoveStep.SO_091_WaitNoTray);
OutStoreLog("出库:SO_091 打开仓门,等待门口无料盘 "); OutStoreLog("出库:SO_091 打开仓门,等待门口无料盘 ");
...@@ -943,7 +942,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -943,7 +942,7 @@ namespace OnlineStore.DeviceLibrary
OpenDoor(); OpenDoor();
} }
else if (StoreMove.IsTimeOut(out double timeout)) { else if (StoreMove.IsTimeOut(out double timeout)) {
if (IOManager.IOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH)) if (TrayCheck_Door.Equals(IO_VALUE.HIGH))
{ {
SetWarnMsg(ResourceControl.MoveTimeOut, StoreMove.MoveStep + "", IO_Type.TrayCheck_Door.ToString() + "=LOW", timeout.ToString("f1")+"s"); //1085 SetWarnMsg(ResourceControl.MoveTimeOut, StoreMove.MoveStep + "", IO_Type.TrayCheck_Door.ToString() + "=LOW", timeout.ToString("f1")+"s"); //1085
LogUtil.error(LOGGER, WarnObj.WarnMsg, 100); LogUtil.error(LOGGER, WarnObj.WarnMsg, 100);
...@@ -1040,7 +1039,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -1040,7 +1039,8 @@ namespace OnlineStore.DeviceLibrary
/// PosId, InOut,isSuccess /// PosId, InOut,isSuccess
/// </summary> /// </summary>
public event Action<string,StoreMoveType,bool> InOutEndProcessEvent; public event Action<string,StoreMoveType,bool> InOutEndProcessEvent;
private string AutoOut { get => ResourceControl.GetString("自动出库:"); }
private string AutoIn { get => ResourceControl.GetString("自动入库:"); }
public bool Alternate = true; public bool Alternate = true;
private void InOutEndProcess(StoreMoveType storeMoveType,string current_posid) private void InOutEndProcess(StoreMoveType storeMoveType,string current_posid)
{ {
...@@ -1088,13 +1088,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -1088,13 +1088,13 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.info(LOGGER, StoreName + $"自动进入下一个出库:{autoPositionIndex} posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把出库信息存入排队列表中"); LogUtil.info(LOGGER, StoreName + $"自动进入下一个出库:{autoPositionIndex} posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把出库信息存入排队列表中");
Reset(false); Reset(false);
autoMsg = "自动出库:" + posid; autoMsg = AutoOut + posid;
AddWaitOutInfo(new FixtureCodeInfo(0, "", posid)); AddWaitOutInfo(new FixtureCodeInfo(0, "", posid));
} }
else else
{ {
LogUtil.info(LOGGER, StoreName + $"自动进入下一个出库:{autoPositionIndex} posid=" + posid); LogUtil.info(LOGGER, StoreName + $"自动进入下一个出库:{autoPositionIndex} posid=" + posid);
autoMsg = "自动出库:" + posid; autoMsg = AutoOut + posid;
StartOutStoreMove(new InOutStoreParam("", posid)); StartOutStoreMove(new InOutStoreParam("", posid));
} }
} }
...@@ -1124,13 +1124,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -1124,13 +1124,13 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.info(LOGGER, StoreName + $"自动进入下一个入库:{autoPositionIndex} posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把入库信息存入排队列表中"); LogUtil.info(LOGGER, StoreName + $"自动进入下一个入库:{autoPositionIndex} posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把入库信息存入排队列表中");
Reset(false); Reset(false);
autoMsg = "自动入库:" + posid; autoMsg = AutoIn + posid;
AddWaitOutInfo(new FixtureCodeInfo(0, "AAAA", posid)); AddWaitOutInfo(new FixtureCodeInfo(0, "AAAA", posid));
} }
else else
{ {
LogUtil.info(LOGGER, StoreName + $"自动进入下一个入库:{autoPositionIndex} posid=" + posid); LogUtil.info(LOGGER, StoreName + $"自动进入下一个入库:{autoPositionIndex} posid=" + posid);
autoMsg = "自动入库:" + posid; autoMsg = AutoIn + posid;
StartInStoreMove(new InOutStoreParam("AAAA", posid)); StartInStoreMove(new InOutStoreParam("AAAA", posid));
} }
} }
......
...@@ -11,6 +11,8 @@ using System.Text; ...@@ -11,6 +11,8 @@ using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
namespace OnlineStore namespace OnlineStore
{ {
...@@ -53,6 +55,8 @@ namespace OnlineStore ...@@ -53,6 +55,8 @@ namespace OnlineStore
LogUtil.error(Name + "加载监控相机配置文件失败:"+ e.ToString()); LogUtil.error(Name + "加载监控相机配置文件失败:"+ e.ToString());
return; return;
} }
PictureBox p1 = new PictureBox();
camera.PreviewImage(DeviceName, p1.Handle);
camera.Open(DeviceName); camera.Open(DeviceName);
Bitmap bmp = camera.GetImage(DeviceName); Bitmap bmp = camera.GetImage(DeviceName);
if (bmp == null) if (bmp == null)
...@@ -125,6 +129,7 @@ namespace OnlineStore ...@@ -125,6 +129,7 @@ namespace OnlineStore
{ {
LogUtil.error(Name + e.ToString()); LogUtil.error(Name + e.ToString());
} }
LogUtil.info(Name + " 保存完毕:" + filename);
} }
public string GetFixtureStateFilename(InOutStoreParam inOutParam,StoreMoveType storeMoveType, FixtureState fixtureState) public string GetFixtureStateFilename(InOutStoreParam inOutParam,StoreMoveType storeMoveType, FixtureState fixtureState)
{ {
......
...@@ -558,7 +558,8 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -558,7 +558,8 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("MiddleAxis_Reverse_Offset")] [ConfigProAttribute("MiddleAxis_Reverse_Offset")]
public int MiddleAxis_Reverse_Offset { get; set; } public int MiddleAxis_Reverse_Offset { get; set; }
/// <summary> /// <summary>
/// PRO 超声波测距1端口 Ultrasonic1_Port /// PRO
/// 测距1端口 Ultrasonic1_Port
/// </summary> /// </summary>
[ConfigProAttribute("Ultrasonic1_Port")] [ConfigProAttribute("Ultrasonic1_Port")]
public string Ultrasonic1_Port { get; set; } public string Ultrasonic1_Port { get; set; }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!