Commit c21bf5fd 张东亮

出入库运行ok

1 个父辈 517829cb
正在显示 91 个修改的文件 包含 1877 行增加445 行删除
......@@ -11,7 +11,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "source\Lo
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarriageClient", "source\CarriageClient\CarriageClient.csproj", "{0D2542F5-DD62-4352-82D0-383D9A045E74}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JAKA", "..\..\..\..\Projects\CSharp-Workspace\Dolen\JAKA\JAKA.csproj", "{B702AB04-BB76-491F-812A-603298D08FBF}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dolen", "..\..\..\..\Projects\CSharp-Workspace\Dolen\Dolen\Dolen.csproj", "{1D8684A2-5358-4F9C-9B42-9794F8F4B6B6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JAKA", "source\JAKA\JAKA.csproj", "{B702AB04-BB76-491F-812A-603298D08FBF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -35,6 +37,10 @@ Global
{0D2542F5-DD62-4352-82D0-383D9A045E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D2542F5-DD62-4352-82D0-383D9A045E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D2542F5-DD62-4352-82D0-383D9A045E74}.Release|Any CPU.Build.0 = Release|Any CPU
{1D8684A2-5358-4F9C-9B42-9794F8F4B6B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D8684A2-5358-4F9C-9B42-9794F8F4B6B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D8684A2-5358-4F9C-9B42-9794F8F4B6B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D8684A2-5358-4F9C-9B42-9794F8F4B6B6}.Release|Any CPU.Build.0 = Release|Any CPU
{B702AB04-BB76-491F-812A-603298D08FBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B702AB04-BB76-491F-812A-603298D08FBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B702AB04-BB76-491F-812A-603298D08FBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
......
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
......@@ -8,7 +8,7 @@
<add key="App_AutoRun" value="0" />
<add key="App_Title" value="运输客户端" />
<!--Server address-->
<add key="http.server" value="http://192.168.1.123:8800/" />
<add key="http.server" value="http://localhost/smf-core/" />
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
<add key="StartBlowValue" value="4" />
<!-- 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)-->
......@@ -21,7 +21,7 @@
<add key="ImagePath" value="\Images\" />
<add key="UseBuzzer" value="0" />
<!--获取库位的料仓cid列表;多个用,分割-->
<add key="Line_CID" value="01,02,03,04,05,06" />
<add key="Line_CID" value="T01-1,T01-2,T01-3,T01-4,T01-5,T01-6" />
<!--end one store config-->
<!--二维码类型列表配置,用#分割,一维码=Barcode 二维码: QR Code#Data Matrix ECC 200#Micro QR Code-->
<add key="CodeType" value="Data Matrix ECC 200#QR Code" />
......@@ -66,12 +66,14 @@
<add key="TrayInOutletInfo" value="" />
<!--入料口上的料盘信息-->
<add key="TrayInInletInfo" value="" />
<!--料盘厚度检测范围:分别对应三种厚度的最小值和最大值:5812。-->
<add key="ReelHeightRange" value="5,10#10,16#16,20" />
<!--夹爪夹紧时忽略的料号列表,多个用#分割-->
<add key="PNList" value="3402021720#3402021721#3402021100#3402021101#3402021102#3402021103#3402021104#3402021105#3402021106#3402021107#3402021108#3402021109#3402021112#3402021122" />
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/CarriageClient.log" />
<file value="logs/Client/CarriageClient.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
......
......@@ -260,10 +260,6 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\..\Projects\CSharp-Workspace\Dolen\JAKA\JAKA.csproj">
<Project>{B702AB04-BB76-491F-812A-603298D08FBF}</Project>
<Name>JAKA</Name>
</ProjectReference>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{43cdd09e-fcf3-4960-a01d-3bbfe9933122}</Project>
<Name>Common</Name>
......@@ -272,6 +268,10 @@
<Project>{513bc1c9-800d-43a6-9499-3700baec3554}</Project>
<Name>DeviceLibrary</Name>
</ProjectReference>
<ProjectReference Include="..\JAKA\JAKA.csproj">
<Project>{b702ab04-bb76-491f-812a-603298d08fbf}</Project>
<Name>JAKA</Name>
</ProjectReference>
<ProjectReference Include="..\LoadCVSLibrary\LoadCSVLibrary.csproj">
<Project>{064bebf5-8faa-4ea2-a5f3-a06e6e7d9251}</Project>
<Name>LoadCSVLibrary</Name>
......
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
partial class FrmAbout
{
......
......@@ -10,7 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
internal partial class FrmAbout : FrmBase
{
......
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
internal partial class FrmBase
{
......
......@@ -9,7 +9,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
internal partial class FrmBase : Form
{
......@@ -45,7 +45,7 @@ namespace OnlineStore.XLRStore
}
return str;
}
internal static string GetCodeNum(string codeName = "SO908-XLRStore")
internal static string GetCodeNum(string codeName = "SO1049-CarriageClient")
{
byte[] byteArray = System.Text.Encoding.ASCII.GetBytes(codeName);
string result = "";
......
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
partial class FrmClient
{
......@@ -36,13 +36,13 @@
this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.robotDataControl = new OnlineStore.XLRStore.ReelDataControl();
this.robotControl = new OnlineStore.XLRStore.EquipControl();
this.inletControl = new OnlineStore.XLRStore.EquipControl();
this.outletControl = new OnlineStore.XLRStore.EquipControl();
this.outletDataControl = new OnlineStore.XLRStore.ReelDataControl();
this.inletDataControl = new OnlineStore.XLRStore.ReelDataControl();
this.ngboxDataControl = new OnlineStore.XLRStore.ReelDataControl();
this.robotDataControl = new OnlineStore.CarriageClient.ReelDataControl();
this.robotControl = new OnlineStore.CarriageClient.EquipControl();
this.inletControl = new OnlineStore.CarriageClient.EquipControl();
this.outletControl = new OnlineStore.CarriageClient.EquipControl();
this.outletDataControl = new OnlineStore.CarriageClient.ReelDataControl();
this.inletDataControl = new OnlineStore.CarriageClient.ReelDataControl();
this.ngboxDataControl = new OnlineStore.CarriageClient.ReelDataControl();
this.lblStatus = new System.Windows.Forms.Label();
this.lblWarnMsg = new System.Windows.Forms.Label();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
......@@ -295,7 +295,7 @@
//
this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1;
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
this.notifyIcon1.Text = "流水线料仓";
this.notifyIcon1.Text = "运输客户端";
this.notifyIcon1.Visible = true;
this.notifyIcon1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseDoubleClick);
//
......
......@@ -16,7 +16,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
internal partial class FrmClient : FrmBase
{
......@@ -204,27 +204,27 @@ namespace OnlineStore.XLRStore
}
if (BufferDataManager.TrayInInletInfo == null)
{
ngboxDataControl.ShowData("入料口物料信息", BufferDataManager.TrayInInletInfo, IO_VALUE.LOW);
inletDataControl.ShowData("入料口物料信息", BufferDataManager.TrayInInletInfo, IO_VALUE.LOW);
}
else
{
ngboxDataControl.ShowData("入料口物料信息", BufferDataManager.TrayInInletInfo, IO_VALUE.HIGH);
inletDataControl.ShowData("入料口物料信息", BufferDataManager.TrayInInletInfo, IO_VALUE.HIGH);
}
if (BufferDataManager.TrayInOutletInfo == null)
{
ngboxDataControl.ShowData("出料口物料信息", BufferDataManager.TrayInOutletInfo, IO_VALUE.LOW);
outletDataControl.ShowData("出料口物料信息", BufferDataManager.TrayInOutletInfo, IO_VALUE.LOW);
}
else
{
ngboxDataControl.ShowData("出料口物料信息", BufferDataManager.TrayInOutletInfo, IO_VALUE.HIGH);
outletDataControl.ShowData("出料口物料信息", BufferDataManager.TrayInOutletInfo, IO_VALUE.HIGH);
}
if (BufferDataManager.TrayInRobotInfo == null)
{
ngboxDataControl.ShowData("机器人夹爪物料信息", BufferDataManager.TrayInRobotInfo, IO_VALUE.LOW);
robotDataControl.ShowData("机器人夹爪物料信息", BufferDataManager.TrayInRobotInfo, IO_VALUE.LOW);
}
else
{
ngboxDataControl.ShowData("机器人夹爪物料信息", BufferDataManager.TrayInRobotInfo, IO_VALUE.HIGH);
robotDataControl.ShowData("机器人夹爪物料信息", BufferDataManager.TrayInRobotInfo, IO_VALUE.HIGH);
}
}
......@@ -337,6 +337,7 @@ namespace OnlineStore.XLRStore
AxisManager.instance.CloseAllPort();
AxisManager.instance.CloseCard();
RFIDManager.Close();
StoreBean.robotEquip.StopRobotService();
if (Camera._cam != null)
{
Camera._cam.CloseAll();
......@@ -419,7 +420,7 @@ namespace OnlineStore.XLRStore
{
if (StoreBean.runStatus.Equals(RunStatus.Wait))
{
MessageBox.Show(StoreBean.Name + "流水线未启动,不需要停止", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
MessageBox.Show(StoreBean.Name + "客户端未启动,不需要停止", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
LogUtil.info(StoreBean.Name + "点击:停止");
......@@ -435,7 +436,7 @@ namespace OnlineStore.XLRStore
{
if (StoreBean.runStatus.Equals(RunStatus.Wait))
{
MessageBox.Show(StoreBean.Name + "流水线未启动,无法复位", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
MessageBox.Show(StoreBean.Name + "客户端未启动,无法复位", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
LogUtil.info(StoreBean.Name + "点击:复位");
......
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
partial class FrmCrispTray
{
......
......@@ -15,7 +15,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
internal partial class FrmCrispTray : FrmBase
{
......
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
partial class FrmPwd
{
......
......@@ -10,7 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
internal partial class FrmPwd : FrmBase
{
......
......@@ -7,7 +7,7 @@ using System.Text;
using System.Windows;
using System.Windows.Forms;
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
public class ManagerUtil
{
......
using log4net;
using log4net.Config;
using OnlineStore.Common;
using OnlineStore.XLRStore;
using OnlineStore.CarriageClient;
using System;
using System.Collections.Generic;
using System.Diagnostics;
......@@ -11,7 +11,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using OnlineStore.DeviceLibrary;
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
static class Program
{
......
......@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("XLRStore")]
[assembly: AssemblyTitle("CarriageClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("XLRStore")]
[assembly: AssemblyProduct("CarriageClient")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......
......@@ -17,7 +17,7 @@ using UserFromControl;
using OnlineStore.LoadCSVLibrary;
using OnlineStore.Common;
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
internal partial class FrmInletEquip : FrmBase
{
......@@ -30,6 +30,7 @@ namespace OnlineStore.XLRStore
Control.CheckForIllegalCrossThreadCalls = false;
InitializeComponent();
LoadIOList();
LoadAdInfo();
}
protected Dictionary<string, IOTextControl> DIControlList = new Dictionary<string, IOTextControl>();
protected Dictionary<string, IOTextControl> DOControlList = new Dictionary<string, IOTextControl>();
......@@ -111,7 +112,17 @@ namespace OnlineStore.XLRStore
MessageBox.Show(inputEquip.Name + "请先启动设备", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
private void LoadAdInfo()
{
txtAd1BaseVal.Text = inputEquip.Config.BaseVal_Height_Ad1.ToString();
txtAd1Coeff.Text = inputEquip.Config.Coeff_Height_Ad1.ToString();
txtAd2BaseVal.Text = inputEquip.Config.BaseVal_Height_Ad2.ToString();
txtAd2Coeff.Text = inputEquip.Config.Coeff_Height_Ad2.ToString();
txtAd3BaseVal.Text = inputEquip.Config.BaseVal_Height_Ad3.ToString();
txtAd3Coeff.Text = inputEquip.Config.Coeff_Height_Ad3.ToString();
txtAd4BaseVal.Text = inputEquip.Config.BaseVal_Height_Ad4.ToString();
txtAd4Coeff.Text = inputEquip.Config.Coeff_Height_Ad4.ToString();
}
private void LoadIOList()
{
int maxCount = 20;
......@@ -297,6 +308,7 @@ namespace OnlineStore.XLRStore
private void FrmInputEquip_Load(object sender, EventArgs e)
{
chbMoveStop.Checked = inputEquip.MoveStop;
chbDebug.Checked = inputEquip.IsDebug;
LoadPoint();
IsLoad = true;
}
......@@ -355,7 +367,7 @@ namespace OnlineStore.XLRStore
{
if (inputEquip.runStatus.Equals(RunStatus.Wait))
{
LogUtil.info(inputEquip.Name + "点击:启用调试");
LogUtil.info(inputEquip.Name + "点击:启");
StartDebug();
}
else
......@@ -374,7 +386,7 @@ namespace OnlineStore.XLRStore
}
else
{
btnStart.Text = "启动调试";
btnStart.Text = "启动";
}
//btnReset.Enabled = isStart;
}
......@@ -478,6 +490,114 @@ namespace OnlineStore.XLRStore
IOManager.IOMove(IO_Type.Inlet_7InchJackUp, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.Inlet_7InchJackDown, IO_VALUE.HIGH);
}
private void button1_Click(object sender, EventArgs e)
{
try
{
inputEquip.Config.Coeff_Height_Ad1 = double.Parse(txtAd1Coeff.Text);
inputEquip.Config.Coeff_Height_Ad2 = double.Parse(txtAd2Coeff.Text);
inputEquip.Config.BaseVal_Height_Ad1 = int.Parse(txtAd1BaseVal.Text);
inputEquip.Config.BaseVal_Height_Ad2 = int.Parse(txtAd2BaseVal.Text);
inputEquip.Config.Coeff_Height_Ad3 = double.Parse(txtAd3Coeff.Text);
inputEquip.Config.BaseVal_Height_Ad3 = int.Parse(txtAd3BaseVal.Text);
inputEquip.Config.Coeff_Height_Ad4 = double.Parse(txtAd4Coeff.Text);
inputEquip.Config.BaseVal_Height_Ad4 = int.Parse(txtAd4BaseVal.Text);
StoreManager.SaveClientConfig(inputEquip.Config);
MessageBox.Show("保存测量系数成功");
}
catch (Exception ex)
{
LogUtil.error("保存测量系数失败", ex);
}
}
/// <summary>
/// 获取7寸计算值
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnGetData_Click(object sender, EventArgs e)
{
try
{
float.TryParse(txtAd1Coeff.Text, out float ad1Coeff);
int.TryParse(txtAd1BaseVal.Text, out int ad1BaseVal);
float.TryParse(txtAd2Coeff.Text, out float ad2Coeff);
int.TryParse(txtAd2BaseVal.Text, out int ad2BaseVal);
double val1 = inputEquip.GetCalValue(0, ad1Coeff, ad1BaseVal);
double val2 = inputEquip.GetCalValue(1, ad2Coeff, ad2BaseVal);
txtAd1Result.Text = val1.ToString("f3");
txtAd2Result.Text = val2.ToString("f3");
float.TryParse(txtAd3Coeff.Text, out float ad3Coeff);
float.TryParse(txtAd4Coeff.Text, out float ad4Coeff);
int.TryParse(txtAd3BaseVal.Text, out int ad3BaseVal);
int.TryParse(txtAd4BaseVal.Text, out int ad4BaseVal);
double val3 = inputEquip.GetCalValue(2, ad3Coeff, ad3BaseVal);
double val4 = inputEquip.GetCalValue(3, ad4Coeff, ad4BaseVal);
txtAd3Result.Text = val3.ToString("f3");
txtAd4Result.Text = val4.ToString("f3");
getSize(val3, val4);
}
catch
{
txtAd1Result.Text = "null";
txtAd2Result.Text = "null";
lblheightwidth.Text = "0*0";
txtAd3Result.Text = "null";
txtAd4Result.Text = "null";
}
}
private void getSize(double val3,double val4)
{
float.TryParse(txtAd3Coeff.Text, out float ad3Coeff);
float.TryParse(txtAd4Coeff.Text, out float ad4Coeff);
int.TryParse(txtAd3BaseVal.Text, out int ad3BaseVal);
int.TryParse(txtAd4BaseVal.Text, out int ad4BaseVal);
float.TryParse(txtAd1Coeff.Text, out float ad1Coeff);
int.TryParse(txtAd1BaseVal.Text, out int ad1BaseVal);
float.TryParse(txtAd2Coeff.Text, out float ad2Coeff);
int.TryParse(txtAd2BaseVal.Text, out int ad2BaseVal);
lblheightwidth.Text = $"{inputEquip.GetWidth(val3,val4)}*" +
$"{inputEquip.GetHeight(new double[] { ad1Coeff, ad2Coeff, ad3Coeff, ad4Coeff }, new int[] { ad1BaseVal, ad2BaseVal, ad3BaseVal, ad4BaseVal })}";
}
private void chbDebug_CheckedChanged(object sender, EventArgs e)
{
if (!IsLoad)
{
return;
}
if (chbDebug.Checked)
{
if (!inputEquip.IsDebug)
{
DialogResult result = MessageBox.Show("是否切换到调试状态?", "是否确认切换", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result.Equals(DialogResult.Yes))
{
inputEquip.IsDebug = true;
inputEquip.ChangeDebug(true);
LogUtil.info(inputEquip.Name + "用户切换到调试状态 ");
}
}
}
else
{
if (inputEquip.IsDebug)
{
DialogResult result = MessageBox.Show("是否切换到正常工作状态?", "是否确认切换", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result.Equals(DialogResult.Yes))
{
inputEquip.IsDebug = false;
inputEquip.ChangeDebug(false);
LogUtil.info(inputEquip.Name + "用户切换到正常工作状态 ");
}
}
}
}
}
}
......
using OnlineStore.XLRStore.useControl;
using OnlineStore.CarriageClient.useControl;
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
partial class FrmOutletEquip
{
......@@ -53,6 +53,7 @@ namespace OnlineStore.XLRStore
this.lblMoveInfo = new System.Windows.Forms.Label();
this.lblThisSta = new System.Windows.Forms.Label();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.chbDebug = new System.Windows.Forms.CheckBox();
this.tabPage1.SuspendLayout();
this.groupDO.SuspendLayout();
this.groupBox1.SuspendLayout();
......@@ -362,6 +363,7 @@ namespace OnlineStore.XLRStore
this.panBase.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panBase.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panBase.Controls.Add(this.chbDebug);
this.panBase.Controls.Add(this.chbMoveStop);
this.panBase.Controls.Add(this.lblName);
this.panBase.Controls.Add(this.lblStoreStatus);
......@@ -501,6 +503,18 @@ namespace OnlineStore.XLRStore
this.tabControl1.TabIndex = 257;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// chbDebug
//
this.chbDebug.AutoSize = true;
this.chbDebug.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbDebug.Location = new System.Drawing.Point(364, 9);
this.chbDebug.Name = "chbDebug";
this.chbDebug.Size = new System.Drawing.Size(84, 24);
this.chbDebug.TabIndex = 263;
this.chbDebug.Text = "调试状态";
this.chbDebug.UseVisualStyleBackColor = true;
this.chbDebug.CheckedChanged += new System.EventHandler(this.chbDebug_CheckedChanged);
//
// FrmOutletEquip
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
......@@ -568,6 +582,7 @@ namespace OnlineStore.XLRStore
private System.Windows.Forms.Button Inlet_LineStart;
private System.Windows.Forms.Button Inlet_StopUp;
private System.Windows.Forms.Button Inlet_LineStop;
protected System.Windows.Forms.CheckBox chbDebug;
}
}
......@@ -17,7 +17,7 @@ using UserFromControl;
using OnlineStore.LoadCSVLibrary;
using OnlineStore.Common;
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
internal partial class FrmOutletEquip : FrmBase
{
......@@ -297,6 +297,7 @@ namespace OnlineStore.XLRStore
private void FrmoutletEquip_Load(object sender, EventArgs e)
{
chbMoveStop.Checked = outletEquip.MoveStop;
chbDebug.Checked = outletEquip.IsDebug;
LoadPoint();
IsLoad = true;
}
......@@ -355,7 +356,7 @@ namespace OnlineStore.XLRStore
{
if (outletEquip.runStatus.Equals(RunStatus.Wait))
{
LogUtil.info(outletEquip.Name + "点击:启用调试");
LogUtil.info(outletEquip.Name + "点击:启");
StartDebug();
}
else
......@@ -374,7 +375,7 @@ namespace OnlineStore.XLRStore
}
else
{
btnStart.Text = "启动调试";
btnStart.Text = "启动";
}
//btnReset.Enabled = isStart;
}
......@@ -463,6 +464,41 @@ namespace OnlineStore.XLRStore
LogUtil.info(outletEquip.Name + "点击:" + Inlet_LineStop.Text);
IOManager.IOMove(IO_Type.Outlet_Run, IO_VALUE.LOW);
}
private void chbDebug_CheckedChanged(object sender, EventArgs e)
{
if (!IsLoad)
{
return;
}
if (chbDebug.Checked)
{
if (!outletEquip.IsDebug)
{
DialogResult result = MessageBox.Show("是否切换到调试状态?", "是否确认切换", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result.Equals(DialogResult.Yes))
{
outletEquip.IsDebug = true;
outletEquip.ChangeDebug(true);
LogUtil.info(outletEquip.Name + "用户切换到调试状态 ");
}
}
}
else
{
if (outletEquip.IsDebug)
{
DialogResult result = MessageBox.Show("是否切换到正常工作状态?", "是否确认切换", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result.Equals(DialogResult.Yes))
{
outletEquip.IsDebug = false;
outletEquip.ChangeDebug(false);
LogUtil.info(outletEquip.Name + "用户切换到正常工作状态 ");
}
}
}
}
}
}
......
......@@ -18,7 +18,7 @@ using OnlineStore.LoadCSVLibrary;
using OnlineStore.Common;
using JAKA;
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
internal partial class FrmRobotEquip : FrmBase
{
......@@ -33,7 +33,6 @@ namespace OnlineStore.XLRStore
axisMoveControl1.LoadData(robotEquip, robotEquip.axisArray);
LoadPointData();
PointEdit(false);
cmbBoxAd.SelectedIndex = 0;
robotEquip.JAKAServer.AssociateControl(ucRobot1, robotEquip.JAKAServer.GetJAKABean(robotEquip.Config.Robot_IP));
}
private void FrmStoreIOStatus_Load(object sender, EventArgs e)
......@@ -241,7 +240,7 @@ namespace OnlineStore.XLRStore
{
lblInoutInfo.Text = "";
}
lblrobotTaskInfo.Text = SServerManager.RobotTaskInfo;
lblrobotTaskInfo.Text =$"{SServerManager.RobotTaskInfo}\r\n{SServerManager.BoxDoorStatus}" ;
lblMoveInfo.Text = robotEquip.GetMoveStr();//+ "料仓类型:" + (boxBean.Config.IsBigTray.Equals(1) ? "大料盘" : "小料盘");
//string canOut = boxBean.CanOutStore(boxBean.DeviceID) ? "可出库" : "不可出库";
lblStoreStatus.Text = DeviceBase.GetRunStr(robotEquip.runStatus);// + "(" + canOut + ")";
......@@ -572,56 +571,6 @@ namespace OnlineStore.XLRStore
{
ManualRobot(chkManualRobot.Checked);
}
private void cmbBoxAd_SelectedIndexChanged(object sender, EventArgs e)
{
switch (cmbBoxAd.SelectedItem.ToString())
{
case "测高":
textBox1.Text= robotEquip.Config.Coeff_Height.ToString();
break;
case "测宽":
textBox1.Text = robotEquip.Config.Coeff_Width.ToString();
break;
}
}
private void btnGetData_Click(object sender, EventArgs e)
{
double val;
try
{
val = IOManager.GetADVal(cmbBoxAd.SelectedIndex) * double.Parse(textBox1.Text);
lblValue.Text = $"{val.ToString("f3")}";
}
catch
{
lblValue.Text = "0";
}
}
private void button1_Click(object sender, EventArgs e)
{
try
{
double val = double.Parse(textBox1.Text);
switch (cmbBoxAd.SelectedItem.ToString())
{
case "测高":
robotEquip.Config.Coeff_Height = val;
break;
case "测宽":
robotEquip.Config.Coeff_Width = val;
break;
}
StoreManager.SaveClientConfig(robotEquip.Config);
MessageBox.Show("保存测量系数成功");
}
catch(Exception ex)
{
LogUtil.error("保存测量系数失败",ex);
}
}
}
}
......
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
partial class AxisMoveControl
{
......
......@@ -14,7 +14,7 @@ using OnlineStore.LoadCSVLibrary;
using HuichuanLibrary;
using System.Net.Sockets;
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
public partial class AxisMoveControl : UserControl
{
......@@ -151,45 +151,12 @@ namespace OnlineStore.XLRStore
switch (cmbAxis.Items[cmbAxis.SelectedIndex].ToString())
{
case "行走机构":
btnAddMove.Text = "点动+(前进)";
btnDelMove.Text = "点动-(后退)";
btnAddMove.Text = "点动+(出料方向)";
btnDelMove.Text = "点动-(入料方向)";
break;
case "料斗拉取进出轴":
btnAddMove.Text = "点动+(左移A侧)";
btnDelMove.Text = "点动-(右移B侧)";
break;
case "移栽升降轴":
case "料斗拉取升降轴":
btnAddMove.Text = "点动+(上升)";
btnDelMove.Text = "点动-(下降)";
break;
case "A面移栽X轴":
case "B面移栽X轴":
btnAddMove.Text = "点动+(后退)";
btnDelMove.Text = "点动-(前进)";
break;
case "A面移栽旋转轴":
case "B面移栽旋转轴":
btnAddMove.Text = "点动+(叉子水平)";
btnDelMove.Text = "点动-(叉子垂直)";
break;
case "A面移栽压紧轴":
case "B面移栽压紧轴":
btnAddMove.Text = "点动+(放松)";
btnDelMove.Text = "点动-(夹紧)";
break;
case "取料旋转轴":
btnAddMove.Text = "点动+(向左)";
btnDelMove.Text = "点动-(向右)";
break;
case "取料升降轴":
btnAddMove.Text = "点动+(下降)";
btnDelMove.Text = "点动-(上升)";
break;
case "A料口提升轴":
case "B料口提升轴":
btnAddMove.Text = "点动+(上升)";
btnDelMove.Text = "点动-(下降)";
case "压紧轴":
btnAddMove.Text = "点动+(压紧)";
btnDelMove.Text = "点动-(放松)";
break;
default:
btnAddMove.Text = "点动+";
......

namespace OnlineStore.XLRStore.useControl
namespace OnlineStore.CarriageClient.useControl
{
partial class AxisMoveRectControl
{
......
......@@ -8,7 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.XLRStore.useControl
namespace OnlineStore.CarriageClient.useControl
{
public partial class AxisMoveRectControl : AxisMoveControl
{
......

namespace OnlineStore.XLRStore.useControl
namespace OnlineStore.CarriageClient.useControl
{
partial class AxisPointControl
{
......
......@@ -10,7 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.XLRStore.useControl
namespace OnlineStore.CarriageClient.useControl
{
public partial class AxisPointControl : UserControl
{
......

namespace OnlineStore.XLRStore.useControl
namespace OnlineStore.CarriageClient.useControl
{
partial class ClampJawControl
{
......
......@@ -10,7 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.XLRStore.useControl
namespace OnlineStore.CarriageClient.useControl
{
public partial class ClampJawControl : UserControl
{
......
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
partial class EquipControl
{
......
......@@ -8,7 +8,7 @@ using System.Text;
using System.Windows.Forms;
using OnlineStore.DeviceLibrary;
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
public partial class EquipControl : UserControl
{
......
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
partial class ReelDataControl
{
......
......@@ -9,7 +9,7 @@ using System.Windows.Forms;
using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary;
namespace OnlineStore.XLRStore
namespace OnlineStore.CarriageClient
{
public partial class ReelDataControl : UserControl
{
......
 库位号格式:
例:05AA03040102
05:第1和第2位表示料仓编号,01 - 08
AA:第3和第4位存储机构A面或B面,AA或者BB
03:第5和第6位表示抽屉在第几行
04:第7和第8位表示抽屉在第几列
01:第9和第10位表示在抽屉中的第几行
02:第11和第12位表示在抽屉中的第几列
批量轴回原点
如果旋转轴在暂存区,且在下暂存区,升降轴先到高位
旋转轴回待机点P1
升降轴回P1
点击复位按钮自动启动。
20211208
旋转轴增加反向间隙补偿功能,
Config_InputEquip.csv 配置文件需要增加一行配置:
PRO,0,取料旋转轴_反向间隙补偿值,MiddleAxis_Reverse_Offset,300,,,,,,,,,,,,

......@@ -112,5 +112,6 @@ namespace OnlineStore.Common
public static string ValidityPeriod = "ValidityPeriod";
public static string ValidityCnt = "ValidityCnt";
public static string ReelHeightRange = "ReelHeightRange";
}
}
......@@ -30,7 +30,7 @@ namespace OnlineStore.Common
public string msg = "";
public string pos = "";
public string barcode = "";
public string taskId = "";
//以下为出库参数
public string posId = "";
public string plateW = "";
......@@ -262,7 +262,7 @@ namespace OnlineStore.Common
public static string rfidLoc = "rfidLoc";
public static string barcode = "barcode";
public static string taskId = "taskId";
/// <summary>
/// 上次入库的库位号
/// </summary>
......
......@@ -7,8 +7,14 @@ PRO,0,当多久没操作时流水线休眠(秒),Sleep_MSeconds,600,,,,,,,,,,
PRO,0,气压检测信号关闭需要持续的时间,Airpressure_CheckSeconds,600,,,,,,,,,,,,,,
PRO,0,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,,,,
PRO,0,机器人IP,Robot_IP,192.168.102.21,,,,,,,,,,,,,,
PRO,0,料盘高度转换系数,Coeff_Height,0.5,,,,,,,,,,,,,,
PRO,0,料盘宽度转换系数,Coeff_Width,0.5,,,,,,,,,,,,,,
PRO,0,Ad1高度转换系数,Coeff_Height_Ad1,0.5,,,,,,,,,,,,,,
PRO,0,Ad1高度基数,BaseVal_Height_Ad1,1,,,,,,,,,,,,,,
PRO,0,Ad2高度转换系数,Coeff_Height_Ad2,0.5,,,,,,,,,,,,,,
PRO,0,Ad2高度基数,BaseVal_Height_Ad2,1,,,,,,,,,,,,,,
PRO,0,Ad3高度转换系数,Coeff_Height_Ad3,0.5,,,,,,,,,,,,,,
PRO,0,Ad3高度基数,BaseVal_Height_Ad3,1,,,,,,,,,,,,,,
PRO,0,Ad4高度转换系数,Coeff_Height_Ad4,0.5,,,,,,,,,,,,,,
PRO,0,Ad4高度基数,BaseVal_Height_Ad4,1,,,,,,,,,,,,,,
PRO,0,扫码的相机名称(多个用#分隔),ScanCodeCamera,GigE:MV-CE200-10GC (00E70964538)#GigE:MV-CE200-10GC (00E70964539),,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,0,行走机构_待机点,MoveAxis_P1,0,,,,,,,,,,,,
......
......@@ -84,7 +84,6 @@
<Compile Include="clientEquip\outletEquip\OutletEquip.cs" />
<Compile Include="clientEquip\outletEquip\OutletEquip_OutStore.cs" />
<Compile Include="clientEquip\robotEquip\RobotEquip_Camera.cs" />
<Compile Include="clientEquip\robotEquip\NGBox.cs" />
<Compile Include="clientEquip\robotEquip\RobotEquip-NGBox.cs" />
<Compile Include="manager\agvClient\AgvClient.cs" />
<Compile Include="manager\BufferDataManager.cs" />
......@@ -176,14 +175,14 @@
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\..\Projects\CSharp-Workspace\Dolen\JAKA\JAKA.csproj">
<Project>{b702ab04-bb76-491f-812a-603298d08fbf}</Project>
<Name>JAKA</Name>
</ProjectReference>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{43cdd09e-fcf3-4960-a01d-3bbfe9933122}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\JAKA\JAKA.csproj">
<Project>{b702ab04-bb76-491f-812a-603298d08fbf}</Project>
<Name>JAKA</Name>
</ProjectReference>
<ProjectReference Include="..\LoadCVSLibrary\LoadCSVLibrary.csproj">
<Project>{064bebf5-8faa-4ea2-a5f3-a06e6e7d9251}</Project>
<Name>LoadCSVLibrary</Name>
......
......@@ -71,7 +71,7 @@ namespace OnlineStore.DeviceLibrary
canStart = true;
AgvClient.Init();
}
#endregion
public string CanStart()
......@@ -113,7 +113,7 @@ namespace OnlineStore.DeviceLibrary
mainTimer.Enabled = false;
isInSuddenDown = false;
isNoAirpressure_Check = false;
SetWarnMsg("");
ClearWarnMsg();
MoveInfo.NewMove(MoveType.Reset);
MoveInfo.NextMoveStep(StepEnum.Wait);
......@@ -151,7 +151,7 @@ namespace OnlineStore.DeviceLibrary
public override bool Reset()
{
{
bool isNeedAllReset = false;
if (isInSuddenDown || isNoAirpressure_Check)
{
......@@ -161,7 +161,7 @@ namespace OnlineStore.DeviceLibrary
}
else if ((runStatus == RunStatus.HomeMoving || runStatus == RunStatus.Reset) && NoAlarm())
{
LogUtil.error(Name + "收到复位信号,已经在复位或原点返回中,且当前无报警,不处理复位");
LogUtil.error(Name + "收到复位信号,已经在复位或原点返回中,且当前无报警,不处理复位");
return false;
}
......@@ -172,12 +172,12 @@ namespace OnlineStore.DeviceLibrary
//重置通用处理
mainTimer.Interval = 1000;
// maxSeconds = 10;
// maxSeconds = 10;
alarmType = AlarmType.None;
mainTimer.Enabled = false;
isInSuddenDown = false;
isNoAirpressure_Check = false;
SetWarnMsg("");
ClearWarnMsg();
MoveInfo.NewMove(MoveType.Reset);
MoveInfo.NextMoveStep(StepEnum.Wait);
......@@ -238,7 +238,7 @@ namespace OnlineStore.DeviceLibrary
isOk = false;
break;
}
}
}
......@@ -258,7 +258,7 @@ namespace OnlineStore.DeviceLibrary
Alarm(AlarmType.IoSingleTimeOut);
}
}
}
}
#endregion
private bool busyPro = false;
......@@ -297,11 +297,12 @@ namespace OnlineStore.DeviceLibrary
inletEquip.AutoStartProcess();
outletEquip.AutoStartProcess();
robotEquip.AutoStartProcess();
}
catch (Exception ex)
{
LogUtil.error(Name + "LineTimerPro 出错:", ex);
}
}
busyPro = false;
}
catch (Exception ex)
......@@ -310,7 +311,7 @@ namespace OnlineStore.DeviceLibrary
}
Thread.Sleep(1);
}
#region 停止运动
......@@ -360,7 +361,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 ");
alarmType = AlarmType.None;
SetWarnMsg("");
ClearWarnMsg();
}
}
}
......@@ -413,7 +414,7 @@ namespace OnlineStore.DeviceLibrary
ConfigIO io = baseConfig.getWaitIO(wait.IoType);
WarnMsg = Name + "[" + checkWaitInfo.MoveStep + "]等待" + NotOkMsg + " 超时";
Alarm(AlarmType.IoSingleTimeOut);
LogUtil.error( WarnMsg, checkWaitInfo.ErrorLogType);
LogUtil.error(WarnMsg, checkWaitInfo.ErrorLogType);
}
//超过报警时长
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < StoreManager.Config.IOSingle_TimerOut * 2)
......@@ -486,8 +487,8 @@ namespace OnlineStore.DeviceLibrary
#endregion
#region 忙碌处理
public override bool StartInstore(InOutParam param)
{
return true;
......@@ -538,6 +539,6 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
\ No newline at end of file
......@@ -133,7 +133,7 @@ namespace OnlineStore.DeviceLibrary
isInPro = false;
}
}
int auto = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun);
internal void AutoStartProcess()
{
DateTime time = DateTime.Now;
......@@ -141,19 +141,27 @@ namespace OnlineStore.DeviceLibrary
{
//取新的Io状态
IO_VALUE fuweiValue = IOValue(IO_Type.Reset_BTN);
IO_VALUE autoValue = IOValue(IO_Type.AutoMode_BTN);
if (DILastValueMap.ContainsKey(IO_Type.Reset_BTN))
{
IO_VALUE lastFuwei = DILastValueMap[IO_Type.Reset_BTN];
bool isAutoStart = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun) == 1;
bool isAutoStart = auto == 1;
//收到复位信号后启动
if (isAutoStart && fuweiValue.Equals(IO_VALUE.HIGH) && lastFuwei.Equals(IO_VALUE.LOW))
{
//没有启动时收到启动按钮
LogUtil.info(Name + "没有启动时收到启动按钮,开始调用启动方法!");
bool isOk = StartRun();
if (!isOk)
if (autoValue.Equals(IO_VALUE.HIGH))
{
//没有启动时收到启动按钮
LogUtil.info(Name + "没有启动时收到启动按钮,开始调用启动方法!");
bool isOk = StartRun();
if (!isOk)
{
LogUtil.error(Name+"启动失败,等待下次启动");
}
}
else
{
LogUtil.error("启动失败,等待下次启动");
LogUtil.error($"未切到自动模式,{Name}无法使用复位按钮!");
}
}
}
......@@ -184,14 +192,14 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 ");
alarmType = AlarmType.None;
SetWarnMsg("");
ClearWarnMsg();
}
}
else if (runStatus.Equals(RunStatus.Runing) && alarmType.Equals(AlarmType.None))
{
//设备处于空闲时且无异常,清空异常缓存
if (WarnMsg != "")
SetWarnMsg("");
ClearWarnMsg();
}
}
catch (Exception ex)
......@@ -669,6 +677,7 @@ namespace OnlineStore.DeviceLibrary
//取新的Io状态
IO_VALUE fuweiValue = IOValue(IO_Type.Reset_BTN);
IO_VALUE suddenBtn = IOValue(IO_Type.SuddenStop_BTN);
IO_VALUE autoBtn = IOValue(IO_Type.AutoMode_BTN);
addLastDI(IO_Type.SuddenStop_BTN, suddenBtn);
IO_VALUE airValue = IO_VALUE.HIGH;
......@@ -697,7 +706,7 @@ namespace OnlineStore.DeviceLibrary
Thread.Sleep(200);
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
SetWarnMsg("收到急停信号,报警急停");
SetWarnMsg(Name+"收到急停信号,报警急停");
Alarm(AlarmType.SuddenStop);
}
//});
......@@ -707,11 +716,15 @@ namespace OnlineStore.DeviceLibrary
{
if (suddenBtn.Equals(IO_VALUE.LOW))
{
SetWarnMsg("收到复位信号但急停未开,不处理复位");
SetWarnMsg(Name+"收到复位信号但急停未开,不处理复位");
}
else if (airValue.Equals(IO_VALUE.LOW))
{
SetWarnMsg("收到复位信号但未检测到气压信号,不处理复位");
SetWarnMsg(Name+"收到复位信号但未检测到气压信号,不处理复位");
}
else if (autoBtn.Equals(IO_VALUE.LOW))
{
SetWarnMsg(Name + "收到复位信号但为切到未切到自动模式,不处理复位");
}
else
{
......@@ -746,7 +759,7 @@ namespace OnlineStore.DeviceLibrary
{
if (WarnMsg.Contains(msg))
{
SetWarnMsg("");
ClearWarnMsg();
}
}
protected void ClearTimeoutAlarm(string msg)
......@@ -759,7 +772,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 ");
alarmType = AlarmType.None;
SetWarnMsg("");
ClearWarnMsg();
}
}
public Color GetShowColor()
......
......@@ -109,7 +109,7 @@ namespace OnlineStore.DeviceLibrary
{
//复位时不允许进料
AllowFeedIn(false);
SetWarnMsg("");
ClearWarnMsg();
alarmType = AlarmType.None;
isInSuddenDown = false;
isNoAirpressure_Check = false;
......@@ -150,16 +150,18 @@ namespace OnlineStore.DeviceLibrary
LogInfo($"复位 {MoveInfo.SLog}:检测到料盘,皮带停止");
InletRun(false);
}
else if (MoveInfo.IsTimeOut(30))
else if (MoveInfo.IsTimeOut(15))
{
MoveInfo.NextMoveStep(StepEnum.Inlet_Reset_04_Finish);
LogInfo($"复位 {MoveInfo.SLog}:未检测到料盘,30秒超时,皮带停止");
LogInfo($"复位 {MoveInfo.SLog}:未检测到料盘,15秒超时,皮带停止");
InletRun(false);
}
}
else if (MoveInfo.IsStep(StepEnum.Inlet_Reset_04_Finish))
{
MoveInfo.EndMove();
runStatus = RunStatus.Runing;
StartInstore(new InOutParam());
}
}
......@@ -167,7 +169,8 @@ namespace OnlineStore.DeviceLibrary
{
//StopMove时设置状态为none
AllowFeedIn(false);
Inch7JackUp(false);
Inch13JackUp(false);
MoveInfo.EndMove();
}
......@@ -194,13 +197,13 @@ namespace OnlineStore.DeviceLibrary
if (!MoveStop)
{
if (MoveInfo.MoveType.Equals(MoveType.None) && NoErrorAlarm())
{
if (!TrayIsInPosition() && BufferDataManager.TrayInInletInfo == null)
{
StartInstore(new InOutParam());
}
}
//if (MoveInfo.MoveType.Equals(MoveType.None) && NoErrorAlarm())
//{
// if (TrayIsInPosition() && BufferDataManager.TrayInInletInfo == null)
// {
// StartInstore(new InOutParam());
// }
//}
}
......@@ -413,6 +416,11 @@ namespace OnlineStore.DeviceLibrary
{
return IOValue(IO_Type.Inlet_TrayCheck).Equals(IO_VALUE.HIGH);
}
public bool UpdownIsUp()
{
return IOValue(IO_Type.Inlet_13InchJackUpSig).Equals(IO_VALUE.HIGH)
|| IOValue(IO_Type.Inlet_7InchJackUpSig).Equals(IO_VALUE.HIGH);
}
void AddWaitTrayInPosition(bool inposition)
{
if (inposition)
......
......@@ -29,19 +29,15 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = true;
}
}
else if (wait.WaitType.Equals(WaitEnum.W201_RobotMove))
else if (wait.WaitType.Equals(WaitEnum.W202_RobotInSafe))
{
if (StoreManager.Client.robotEquip.RobotMoveEnd(curcmd))
if (StoreManager.Client.robotEquip.RobotInSafeAtInlet())
{
wait.IsEnd = true;
}
}
return wait.IsEnd;
}
/// <summary>
/// 当前命令
/// </summary>
private string curcmd = "";
private List<string> LastCodeList = new List<string>();
#region 自动入料
private DateTime startInTime = DateTime.Now;
......@@ -111,7 +107,7 @@ namespace OnlineStore.DeviceLibrary
{
NextMoveStep(StepEnum.Inlet_04_TrayInPosition, "料盘到位,拒绝料盘进入,链条停止");
AllowFeedIn(false);
InletRun(false);
IOMove(IO_Type.Inlet_Run, IO_VALUE.HIGH,5000);
}
else if (MoveInfo.IsStep(StepEnum.Inlet_04_TrayInPosition))
......@@ -131,9 +127,10 @@ namespace OnlineStore.DeviceLibrary
{
if (MoveInfo.MoveParam.PosInfo.IsNG)
{
NextMoveStep(StepEnum.Inlet_08_WaitTrayLeave, "条码NG,等待料盘离开");
NextMoveStep(StepEnum.Inlet_08_WaitTrayLeave, "条码NG,等待机器人到安全位置");
AddWaitTrayInPosition(false);
SetCurCmd(RobotEquip.GetCmd_InletUp());
BufferDataManager.TrayInInletInfo = MoveInfo.MoveParam.PosInfo.ToCopy();
AddWaitRobotInSafe();
}
else
{
......@@ -157,7 +154,7 @@ namespace OnlineStore.DeviceLibrary
NextMoveStep(StepEnum.Inlet_08_WaitTrayLeave, $"获取目标仓位成功【{MoveInfo.MoveParam.PosInfo.ToStr()}】,等待料盘离开");
BufferDataManager.TrayInInletInfo = MoveInfo.MoveParam.PosInfo.ToCopy();
AddWaitTrayInPosition(false);
SetCurCmd(RobotEquip.GetCmd_InletUp());
AddWaitRobotInSafe();
}
else if (MoveInfo.IsTimeOut(15))
{
......@@ -167,9 +164,9 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.Inlet_08_WaitTrayLeave))
{
NextMoveStep(StepEnum.Inlet_09_WaitRobotInSafe, "料盘离开入料口,等待机器人到安全位置");
SetCurCmd(RobotEquip.GetCmd_Standby());
AddWaitRobotInSafe();
AddWaitTime(10000);
MoveInfo.OneWaitCanEndStep=true;
MoveInfo.OneWaitCanEndStep = true;
}
else if (MoveInfo.IsStep(StepEnum.Inlet_09_WaitRobotInSafe))
{
......@@ -178,17 +175,17 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StepEnum.Inlet_10_JackDown))
{
curcmd = "";
MoveInfo.EndMove();
//MoveInfo.EndMove();
//runStatus = RunStatus.Runing;
MoveInfo.NextMoveStep(StepEnum.Inlet_01_Wait);
MoveInfo.MoveParam.PosInfo = new InOutPosInfo();
}
}
#endregion
private void SetCurCmd(string cmd)
private void AddWaitRobotInSafe()
{
curcmd = cmd;
MoveInfo.WaitList.Add(WaitResultInfo.WaitRobotMove());
MoveInfo.WaitList.Add(WaitResultInfo.WaitRobotInSafe());
}
private void Inlet_05_GetTrayInfo()
{
......@@ -204,6 +201,7 @@ namespace OnlineStore.DeviceLibrary
try
{
IOMove(IO_Type.Inlet_CamLed, IO_VALUE.HIGH);
Thread.Sleep(1000);
LastCodeList = CodeManager.CameraScan(Config.ScanCodeCamera, Name);
if (LastCodeList.Count <= 0)
{
......@@ -230,7 +228,6 @@ namespace OnlineStore.DeviceLibrary
}
//获取料盘宽度
MoveInfo.MoveParam.PosInfo.PlateW = GetWidth();
//获取厚度
MoveInfo.MoveParam.PosInfo.PlateH = GetHeight();
//扫码
......@@ -241,17 +238,126 @@ namespace OnlineStore.DeviceLibrary
private int GetWidth()
{
int width = 7;
double val = IOManager.GetADVal(0) * Config.Coeff_Width;
if (Math.Abs(val - 7) < Math.Abs(val - 13))
return width;
else
return 13;
int idx_ad_7cun_1 = 0;
double coef_ad_7cun_1 = Config.Coeff_Height_Ad1;
int base_ad_7cun_1 = Config.BaseVal_Height_Ad1;
int idx_ad_7cun_2 = 1;
double coef_ad_7cun_2 = Config.Coeff_Height_Ad2;
int base_ad_7cun_2 = Config.BaseVal_Height_Ad2;
int idx_ad_13cun_1 = 2;
double coef_ad_13cun_1 = Config.Coeff_Height_Ad3;
int base_ad_13cun_1 = Config.BaseVal_Height_Ad3;
int idx_ad_13cun_2 = 3;
double coef_ad_13cun_2 = Config.Coeff_Height_Ad4;
int base_ad_13cun_2 = Config.BaseVal_Height_Ad4;
double val1 = GetCalValue(idx_ad_7cun_1, coef_ad_7cun_1, base_ad_7cun_1);
double val2 = GetCalValue(idx_ad_7cun_2, coef_ad_7cun_2, base_ad_7cun_2);
double val3 = GetCalValue(idx_ad_13cun_1, coef_ad_13cun_1, base_ad_13cun_1);
double val4 = GetCalValue(idx_ad_13cun_2, coef_ad_13cun_2, base_ad_13cun_2);
width = GetWidth(val3, val4);
LogUtil.info($"获取宽度【{width}】:7寸宽度计算值1:{val1.ToString("f3")};7寸宽度计算值2:{val2.ToString("f3")};13寸宽度计算值1:{val3.ToString("f3")};13寸宽度计算值2:{val4.ToString("f3")};");
return width;
}
/// <summary>
/// 获取高度
/// </summary>
/// <returns></returns>
private int GetHeight()
{
int height = 8;
int idx_ad_7cun_1 = 0;
double coef_ad_7cun_1 = Config.Coeff_Height_Ad1;
int base_ad_7cun_1 = Config.BaseVal_Height_Ad1;
int idx_ad_7cun_2 = 1;
double coef_ad_7cun_2 = Config.Coeff_Height_Ad2;
int base_ad_7cun_2 = Config.BaseVal_Height_Ad2;
int idx_ad_13cun_1 = 2;
double coef_ad_13cun_1 = Config.Coeff_Height_Ad3;
int base_ad_13cun_1 = Config.BaseVal_Height_Ad3;
int idx_ad_13cun_2 = 3;
double coef_ad_13cun_2 = Config.Coeff_Height_Ad4;
int base_ad_13cun_2 = Config.BaseVal_Height_Ad4;
double val1 = GetCalValue(idx_ad_7cun_1, coef_ad_7cun_1, base_ad_7cun_1);
double val2 = GetCalValue(idx_ad_7cun_2, coef_ad_7cun_2, base_ad_7cun_2);
double val3 = GetCalValue(idx_ad_13cun_1, coef_ad_13cun_1, base_ad_13cun_1);
double val4 = GetCalValue(idx_ad_13cun_2, coef_ad_13cun_2, base_ad_13cun_2);
double max = getMax(val1, val2, val3, val4);
height = getHeight(max);
LogUtil.info($"获取高度【{height}】:最大计算值为{max.ToString("f3")}");
return height;
}
double getMax(params double[] vals)
{
return vals.Max();
}
string heightRange = ConfigAppSettings.GetValue(Setting_Init.ReelHeightRange);
private int getHeight(double max)
{
string[] range = heightRange.Split('#');
string[] h5 = range[0].Split(',');
string[] h8 = range[1].Split(',');
string[] h12 = range[2].Split(',');
int.TryParse(h5[0], out int low_5);
int.TryParse(h5[1], out int high_5);
int.TryParse(h8[0], out int low_8);
int.TryParse(h8[1], out int high_8);
int.TryParse(h12[0], out int low_12);
int.TryParse(h12[1], out int high_12);
int height = 5;
if (max >= low_5 && max <= high_5)
height = 5;
else if (max >= low_8 && max <= high_8)
height = 8;
else if (max > low_12 && max <= high_12)
{
height = 12;
}
else
height = 12;
return height;
}
public int GetHeight(double[] coefs, int[] baseVals)
{
int height = 0;
double val1 = GetCalValue(0, coefs[0], baseVals[0]);
double val2 = GetCalValue(1, coefs[1], baseVals[1]);
double val3 = GetCalValue(2, coefs[2], baseVals[2]);
double val4 = GetCalValue(3, coefs[3], baseVals[3]);
double max = getMax(val1, val2, val3, val4);
//高度有5,8,12
//各加4毫米
height = getHeight(max);
return height;
}
public int GetWidth(double calVal3, double calVal4)
{
if (calVal3 > 5 || calVal4 > 5)
return 13;
else
return 7;
}
/// <summary>
/// 计算模拟量的值
/// </summary>
/// <param name="adIdx"></param>
/// <param name="coeff"></param>
/// <param name="baseVal"></param>
/// <returns></returns>
public double GetCalValue(int adIdx, double coeff, int baseVal)
{
double val = IOManager.GetADVal(adIdx);
return (val - baseVal) / coeff;
}
private int LastResult = 0;
private string getPosIdMsg = "";
private void GetTargetInfo()
......
......@@ -109,11 +109,11 @@ namespace OnlineStore.DeviceLibrary
private void StartReset()
{
SetWarnMsg("");
ClearWarnMsg();
alarmType = AlarmType.None;
isInSuddenDown = false;
isNoAirpressure_Check = false;
MoveInfo.NextMoveStep(StepEnum.Inlet_Reset_01_Wait);
MoveInfo.NextMoveStep(StepEnum.Outlet_Reset_01_Wait);
LogInfo($"复位 {MoveInfo.SLog}");
}
......@@ -149,10 +149,10 @@ namespace OnlineStore.DeviceLibrary
LogInfo($"复位 {MoveInfo.SLog}:检测到料盘,皮带停止");
OutletRun(false);
}
else if (MoveInfo.IsTimeOut(30))
else if (MoveInfo.IsTimeOut(15))
{
MoveInfo.NextMoveStep(StepEnum.Outlet_Reset_04_Finish);
LogInfo($"复位 {MoveInfo.SLog}:未检测到料盘,30秒超时,皮带停止,顶升抬起");
LogInfo($"复位 {MoveInfo.SLog}:未检测到料盘,15秒超时,皮带停止,顶升抬起");
OutletRun(false);
JackUp(true);
}
......@@ -165,14 +165,18 @@ namespace OnlineStore.DeviceLibrary
StartOutstore(new InOutParam());
}
else
{
BufferDataManager.TrayInOutletInfo = null;
MoveInfo.EndMove();
runStatus = RunStatus.Runing;
}
}
}
internal override void StopMove()
{
//StopMove时设置状态为none
JackUp(false);
MoveInfo.EndMove();
}
......@@ -201,7 +205,7 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveType.Equals(MoveType.None) && NoErrorAlarm())
{
if (TrayInPosition() && BufferDataManager.TrayInOutletInfo != null)
if (IsJackUp() && BufferDataManager.TrayInOutletInfo != null)
{
StartOutstore(new InOutParam(BufferDataManager.TrayInOutletInfo));
}
......@@ -214,9 +218,9 @@ namespace OnlineStore.DeviceLibrary
//CheckAxisAlarm();
}
}
bool TrayInPosition()
bool IsJackUp()
{
return IOValue(IO_Type.Outlet_TrayCheck1).Equals(IO_VALUE.HIGH);
return IOValue(IO_Type.Outlet_JackUpSig).Equals(IO_VALUE.HIGH);
}
internal bool CanStartWork()
{
......
......@@ -24,17 +24,13 @@ namespace OnlineStore.DeviceLibrary
{
if (wait.WaitType.Equals(WaitEnum.W201_RobotMove))
{
if (StoreManager.Client.robotEquip.RobotMoveEnd(curcmd))
if (StoreManager.Client.robotEquip.RobotInSafeAtOutlet())
{
wait.IsEnd = true;
}
}
return wait.IsEnd;
}
/// <summary>
/// 当前命令
/// </summary>
private string curcmd = "";
#region 自动出料
private DateTime startInTime = DateTime.Now;
......@@ -58,17 +54,17 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.IsStep(StepEnum.Outlet_01_Wait))
{
NextMoveStep(StepEnum.Outlet_02_CheckTray, "检查是否有料盘");
SetCurCmd(RobotEquip.GetCmd_Standby());
AddWaitTime(10000);
MoveInfo.OneWaitCanEndStep=true;
JackUp(false);
AddWaitTime(2000);
}
else if (MoveInfo.IsStep(StepEnum.Outlet_02_CheckTray))
{
if (TrayCheck())
{
NextMoveStep(StepEnum.Outlet_03_CheckAllowFeedOut, "有料盘,顶升下降,准备送走");
JackUp(false);
NextMoveStep(StepEnum.Outlet_03_CheckAllowFeedOut, "有料盘,准备送走");
AddWaitAllowFeedOut();
AddWaitTime(5000);
MoveInfo.OneWaitCanEndStep = true;
}
else//无料盘
{
......@@ -95,15 +91,10 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StepEnum.Outlet_05_JackUp))
{
curcmd = "";
MoveInfo.EndMove();
runStatus = RunStatus.Runing;
}
}
private void SetCurCmd(string cmd)
{
curcmd = cmd;
MoveInfo.WaitList.Add(WaitResultInfo.WaitRobotMove());
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
internal class NGBox
{
private int trayCnt = 0;
private string checkTray = "";
/// <summary>
/// NG箱
/// </summary>
/// <param name="checkTray">料盘检测信号</param>
public NGBox(string checkTray)
{
this.checkTray = checkTray;
}
/// <summary>
/// 料盘数量
/// </summary>
public int TrayCnt { get => trayCnt; set => trayCnt = value; }
}
}
......@@ -54,21 +54,36 @@ namespace OnlineStore.DeviceLibrary
}
public void StartRobotService()
{
JAKAServer.Start();
PowerOn(true);
System.Threading.Thread.Sleep(1000);
EnableRobot(true);
System.Threading.Thread.Sleep(1000);
StartProg(true);
Task.Factory.StartNew(delegate
{
JAKAServer.Start();
PowerOn(true);
System.Threading.Thread.Sleep(2000);
EnableRobot(true);
System.Threading.Thread.Sleep(2000);
StartProg(true);
});
}
public void StopRobotService()
{
StartProg(false);
System.Threading.Thread.Sleep(1000);
EnableRobot(false);
System.Threading.Thread.Sleep(1000);
PowerOn(false);
JAKAServer.Stop();
try
{
Task.Factory.StartNew(delegate
{
StartProg(false);
System.Threading.Thread.Sleep(2000);
EnableRobot(false);
System.Threading.Thread.Sleep(2000);
PowerOn(false);
JAKAServer.Stop();
});
}
catch (Exception e)
{
LogUtil.error("StopRobotService 出错", e);
}
}
internal void InitAllAxis()
{
......@@ -98,7 +113,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.EndMove();
SetBoxStatus(DeviceStatus.ResetMove, RunStatus.HomeMoving);
MoveInfo.NewMove(MoveType.RHome);
LogInfo("开始 原点返回: ");
LogInfo("开始 原点返回:");
StartReset();
SetConnectServerTimer(true);
SetAllTimer(true);
......@@ -131,13 +146,12 @@ namespace OnlineStore.DeviceLibrary
private void StartReset()
{
SetWarnMsg("");
ClearWarnMsg();
alarmType = AlarmType.None;
isInSuddenDown = false;
isNoAirpressure_Check = false;
MoveInfo.NextMoveStep(StepEnum.Robot_Reset_01_Wait);
LogInfo($"复位 {MoveInfo.SLog} :轴开始复位");
isInPro = false;
}
......@@ -173,11 +187,11 @@ namespace OnlineStore.DeviceLibrary
switch (MoveInfo.MoveStep)
{
case StepEnum.Robot_Reset_01_Wait:
NextMoveStep(StepEnum.Robot_Reset_02_CheckArmState, "检查机器人是否在待机点");
NextMoveStep(StepEnum.Robot_Reset_02_CheckArmState, "检查机器人是否在点");
break;
case StepEnum.Robot_Reset_02_CheckArmState:
NextMoveStep(StepEnum.Robot_Reset_03_ArmToP1, "机器人回待机点");
SendCmd(GetCmd_Standby());
NextMoveStep(StepEnum.Robot_Reset_03_ArmToP1, "机器人回点");
SendCmd(GetCmd_Home());
break;
case StepEnum.Robot_Reset_03_ArmToP1:
NextMoveStep(StepEnum.Robot_Reset_04_CheckTray, "检查机械臂是否有料盘");
......@@ -202,22 +216,21 @@ namespace OnlineStore.DeviceLibrary
NextMoveStep(StepEnum.Robot_Reset_07_ClearCompress, "将压紧轴上的料盘送到指定位置");
break;
case StepEnum.Robot_Reset_07_ClearCompress:
MoveInfo.NewMove(MoveType.None);
if (BufferDataManager.TrayInRobotInfo.IsNG)//入库盘
{
StartInstore(new InOutParam(BufferDataManager.TrayInRobotInfo));
}
else if (BufferDataManager.TrayInRobotInfo.IsNG)//出库盘
if (BufferDataManager.TrayInRobotInfo != null)
{
StartOutstore(new InOutParam(BufferDataManager.TrayInRobotInfo));
MoveInfo.EndMove();
runStatus = RunStatus.Runing;
BufferDataManager.TrayInRobotInfo=null;
}
else//默认到NG箱
else
{
StartInstore(new InOutParam(BufferDataManager.TrayInRobotInfo));
NextMoveStep(StepEnum.Robot_Reset_08_Finish, "复位完成");
}
break;
case StepEnum.Robot_Reset_08_Finish:
MoveInfo.EndMove();
runStatus = RunStatus.Runing;
break;
}
}
......@@ -257,10 +270,10 @@ namespace OnlineStore.DeviceLibrary
}
private void CheckInStoreProcess()
{
if (StoreManager.Client.inletEquip.TrayIsInPosition() && BufferDataManager.TrayInInletInfo != null)
if (StoreManager.Client.inletEquip.UpdownIsUp() && BufferDataManager.TrayInInletInfo != null)
{
LogInfo("机器人执行入库【" + BufferDataManager.TrayInInletInfo.ToStr() + "】");
StartExecuctOut(new InOutParam(BufferDataManager.TrayInInletInfo));
StartInstore(new InOutParam(BufferDataManager.TrayInInletInfo));
}
}
private void ExecuteOutListProcess()
......@@ -295,10 +308,11 @@ namespace OnlineStore.DeviceLibrary
NGBoxProcess();
if (runStatus.Equals(RunStatus.Runing))
{
ExecuteOutListProcess();
}
if (runStatus.Equals(RunStatus.Runing))
{
////ExecuteOutListProcess();
if (StoreManager.IsConnectServer)
{
GetRobotTask();
}
CheckInStoreProcess();
}
BusyMoveProcess();
......@@ -326,7 +340,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 ");
alarmType = AlarmType.None;
SetWarnMsg("");
ClearWarnMsg();
}
}
}
......@@ -354,8 +368,6 @@ namespace OnlineStore.DeviceLibrary
SetAllTimer(false);
StopMove();
SetBoxStatus(DeviceStatus.None, RunStatus.Wait);
StopRobotService();
//StopCamera();
}
public override string GetMoveStr()
......@@ -441,7 +453,7 @@ namespace OnlineStore.DeviceLibrary
curNgSig = IOValue(IO_Type.NGBox_TrayCheck).Equals(IO_VALUE.HIGH);
if (curNgSig == true && preNgSig == false)
{
BufferDataManager.AddTrayInNGBox(new InOutPosInfo());
//BufferDataManager.AddTrayInNGBox(new InOutPosInfo());
}
if (NGBoxAlarm())
{
......@@ -449,7 +461,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
ClearSpecifiedAlarm($"NG箱中的料盘需要处理,数量大于{validityCnt}或者料盘放置时间大于{validityPeriod}分钟");
ClearSpecifiedAlarm($"NG箱中的料盘需要处理,数量大于");
}
}
#endregion
......
......@@ -54,10 +54,11 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if (StoreManager.IsConnectServer)
{
GetRobotTask();
}
//if (StoreManager.IsConnectServer)
//{
// GetRobotTask();
//}
}
}
catch (Exception ex)
......@@ -286,6 +287,7 @@ namespace OnlineStore.DeviceLibrary
// return false;
//}
//public string LastVisualRfid = "";
string lastdataStr = "";
private void ReviceOutStoreProcess(TaskData resultOperation)
{
DateTime time = DateTime.Now;
......@@ -301,6 +303,7 @@ namespace OnlineStore.DeviceLibrary
string[] plateHArray = data[ParamDefine.plateH].Split(splitChar);
string barcode = data.ContainsKey(ParamDefine.barcode) ? data[ParamDefine.barcode] : "";
string taskid = data.ContainsKey(ParamDefine.taskId) ? data[ParamDefine.taskId] : "";
string dataStr = JsonHelper.SerializeObject(data);
int type = int.Parse(data[ParamDefine.type]);
if (type == 1)
......@@ -308,7 +311,11 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error($"收到服务器出库消息类型异常;{dataStr}");
return;
}
LogUtil.info("收到服务器出库消息:【" + dataStr + "】");
if(!lastdataStr.Equals(dataStr))
{
LogUtil.info("收到服务器出库消息:【" + dataStr + "】");
lastdataStr=dataStr;
}
int index = -1;
foreach (string cid in cids)
......@@ -319,6 +326,7 @@ namespace OnlineStore.DeviceLibrary
string posId = posIdArray[index];
InOutParam inoutParam = new InOutParam(new InOutPosInfo(barcode, posId, plateW, plateH));
inoutParam.PosInfo.Cid = cid;
inoutParam.PosInfo.taskId = taskid;
//根据发送的cid
string[] existCids = ConfigAppSettings.GetValue(Setting_Init.Line_CID).Split(',');
bool hasCid = existCids.Contains(cid);
......@@ -334,19 +342,19 @@ namespace OnlineStore.DeviceLibrary
//判断是否接收过此料仓的出库信息
if (MoveInfo.MoveType.Equals(MoveType.OutStore) && (MoveInfo.MoveParam.PosInfo.Cid.Equals(cid)))
{
LogUtil.error(Name + " 出库命令【" + inoutParam.PosInfo.ToStr() + "】重复,正在【" + cid + "】出库中");
//LogUtil.error(Name + " 出库命令【" + inoutParam.PosInfo.ToStr() + "】重复,正在【" + cid + "】出库中");
continue;
}
//判断排队列表中是否已存在
List<InOutParam> reviceList = new List<InOutParam>();
reviceList.AddRange(waitOutStoreList);
reviceList = (from m in reviceList where m.PosInfo.Cid.Equals(cid) select m).ToList<InOutParam>();
if (reviceList.Count > 0)
{
LogUtil.error(Name + " 出库命令【" + inoutParam.PosInfo.ToStr() + "】重复,排队列表中已存在【" + reviceList[0].PosInfo.ToStr() + "】");
continue;
}
//List<InOutParam> reviceList = new List<InOutParam>();
//reviceList.AddRange(waitOutStoreList);
//reviceList = (from m in reviceList where m.PosInfo.Cid.Equals(cid) select m).ToList<InOutParam>();
//if (reviceList.Count > 0)
//{
// //LogUtil.error(Name + " 出库命令【" + inoutParam.PosInfo.ToStr() + "】重复,排队列表中已存在【" + reviceList[0].PosInfo.ToStr() + "】");
// continue;
//}
}
catch (Exception ex)
......
......@@ -36,8 +36,8 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.InStore_04_CheckInletState:
if (InStore_04_CheckInletState())
{
NextMoveStep(StepEnum.InStore_05_ArmToTrayLow, "机械臂去入料口的取料低点");
InStore_05_ArmToTrayLow();
NextMoveStep(StepEnum.InStore_05_ArmToTrayLow, $"机械臂去入料口的{MoveInfo.MoveParam.PosInfo.PlateW}寸料盘取料低点");
InStore_05_ArmToTrayLow(MoveInfo.MoveParam.PosInfo.PlateW);
}
break;
case StepEnum.InStore_05_ArmToTrayLow:
......@@ -45,18 +45,24 @@ namespace OnlineStore.DeviceLibrary
InStore_06_CompressTray();
break;
case StepEnum.InStore_06_CompressTray:
NextMoveStep(StepEnum.InStore_07_ArmBackToP1, "在入料口取料完成,清除入料口缓存,机械臂回待机点");
NextMoveStep(StepEnum.InStore_07_ArmBackToP1, "在入料口取料完成,机械臂回待机点");
InStore_07_ArmBackToP1();
BufferDataManager.TrayInRobotInfo = MoveInfo.MoveParam.PosInfo.ToCopy();
break;
case StepEnum.InStore_07_ArmBackToP1:
if (CheckInstoreTrayTarget())
{
NextMoveStep(StepEnum.InStore_08_MoveAxisToStore, "行走机构去目标仓位");
NextMoveStep(StepEnum.InStore_08_MoveAxisToStore, "清除入料口缓存,行走机构去目标仓位");
//在入料口取料完成
BufferDataManager.TrayInInletInfo = null;
UpdateLocInfo(MoveInfo.MoveParam.PosInfo, TaskStatus.INROBOT);
InStore_08_MoveAxisToStore();
}
else
{
NextMoveStep(StepEnum.InStore_12_MoveAxisToNGBox, "行走机构去NG箱");
//在入料口取料完成
BufferDataManager.TrayInInletInfo = null;
InStore_12_MoveAxisToNGBox();
}
break;
......@@ -64,7 +70,7 @@ namespace OnlineStore.DeviceLibrary
NextMoveStep(StepEnum.InStore_09_CheckStoreState, "行走机构到达指定仓,检查其状态");
break;
case StepEnum.InStore_09_CheckStoreState:
if (InStore_09_CheckStoreState())
if (InStore_09_CheckStoreState(MoveInfo.MoveParam.PosInfo.Cid))
{
NextMoveStep(StepEnum.InStore_10_ArmToStoreDoorHigh, "当前仓门口可放料,机械臂到仓放料高点");
InStore_10_ArmToStoreDoorHigh();
......@@ -78,7 +84,6 @@ namespace OnlineStore.DeviceLibrary
NextMoveStep(StepEnum.InStore_16_ArmBackToP1, "在仓门口放料完成,清除机器人料叉缓存,机械臂回待机点");
//在料仓口口放料完成
BufferDataManager.TrayInRobotInfo = null;
UpdateLocInfo(MoveInfo.MoveParam.PosInfo.barcode, TaskStatus.BOXDOOR);
InStore_16_ArmBackToP1();
break;
#region NG
......@@ -89,7 +94,8 @@ namespace OnlineStore.DeviceLibrary
if (InStore_13_CheckNGBoxState())
{
NextMoveStep(StepEnum.InStore_14_ArmToNGBoxHigh, "NG箱可放料,机械臂去NG箱放料高点");
ClearSpecifiedAlarm($"NG箱中已存在{TrayCntInNGBox}个料盘,机器人无法放料,需要清空NG箱");
BufferDataManager.AddTrayInNGBox(BufferDataManager.TrayInRobotInfo.ToCopy());
ClearSpecifiedAlarm($"NG箱中已存在");
InStore_14_ArmToNGBoxHigh();
}
else
......@@ -112,9 +118,11 @@ namespace OnlineStore.DeviceLibrary
case StepEnum.InStore_16_ArmBackToP1:
NextMoveStep(StepEnum.InStore_17_Finish, "入库结束");
UpdateLocInfo(MoveInfo.MoveParam.PosInfo, TaskStatus.BOXDOOR);
InStore_17_Finish();
break;
case StepEnum.InStore_17_Finish:
runStatus = RunStatus.Runing;
MoveInfo.EndMove();
break;
}
......@@ -137,13 +145,17 @@ namespace OnlineStore.DeviceLibrary
}
private bool InStore_04_CheckInletState()
{
if (IOValue(IO_Type.Inlet_TrayCheck).Equals(IO_VALUE.HIGH))
if (MoveInfo.MoveParam.PosInfo!=null)
return true;
return false;
}
private void InStore_05_ArmToTrayLow()
private void InStore_05_ArmToTrayLow(int width=7)
{
SendCmd(GetCmd_InletLow());
if (width == 7 || width == 13)
SendCmd(GetCmd_InletLow(width));
else
SendCmd(GetCmd_InletLow(7));
}
private void InStore_06_CompressTray()
{
......@@ -152,10 +164,6 @@ namespace OnlineStore.DeviceLibrary
}
private void InStore_07_ArmBackToP1()
{
//在入料口取料完成
BufferDataManager.TrayInInletInfo = null;
BufferDataManager.TrayInRobotInfo = MoveInfo.MoveParam.PosInfo.ToCopy();
UpdateLocInfo(MoveInfo.MoveParam.PosInfo.barcode, TaskStatus.INROBOT);
SendCmd(GetCmd_Standby());
}
private void InStore_08_MoveAxisToStore()
......@@ -166,9 +174,9 @@ namespace OnlineStore.DeviceLibrary
/// 检查当前仓门口是否可用
/// </summary>
/// <returns></returns>
private bool InStore_09_CheckStoreState()
private bool InStore_09_CheckStoreState(string cid)
{
return true;
return SServerManager.GetBoxDoorStatus(cid);
}
private void InStore_10_ArmToStoreDoorHigh()
{
......@@ -210,14 +218,14 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 机器人更新任务状态
/// </summary>
/// <param name="barcode"></param>
/// <param name="posinfo"></param>
/// <param name="status"></param>
private void UpdateLocInfo(string barcode,string status)
private void UpdateLocInfo(InOutPosInfo posinfo,string status)
{
string result=SServerManager.UpdateTrayLoc(barcode, status);
string result=SServerManager.UpdateTrayLoc(posinfo.barcode, status, posinfo.PosId,posinfo.taskId);
if(!result.Equals(""))
{
SServerManager.UpdateTrayLoc(barcode, status);
SServerManager.UpdateTrayLoc(posinfo.barcode, status, posinfo.PosId,posinfo.taskId);
}
}
}
......
......@@ -75,6 +75,7 @@ namespace OnlineStore.DeviceLibrary
break;
case StepEnum.OutStore_13_Finish:
MoveInfo.EndMove();
runStatus = RunStatus.Runing;
break;
}
}
......@@ -103,7 +104,7 @@ namespace OnlineStore.DeviceLibrary
{
//添加机器人缓存,并上报任务状态
BufferDataManager.TrayInRobotInfo = MoveInfo.MoveParam.PosInfo.ToCopy();
UpdateLocInfo(MoveInfo.MoveParam.PosInfo.barcode, TaskStatus.INROBOT);
UpdateLocInfo(MoveInfo.MoveParam.PosInfo, TaskStatus.INROBOT);
SendCmd(GetCmd_Standby());
}
......@@ -133,7 +134,7 @@ namespace OnlineStore.DeviceLibrary
//上报任务状态
BufferDataManager.TrayInRobotInfo = null;
BufferDataManager.TrayInOutletInfo = MoveInfo.MoveParam.PosInfo.ToCopy();
UpdateLocInfo(MoveInfo.MoveParam.PosInfo.barcode, TaskStatus.FINISHED);
UpdateLocInfo(MoveInfo.MoveParam.PosInfo, TaskStatus.FINISHED);
SendCmd(GetCmd_Standby());
}
#endregion
......
......@@ -316,21 +316,23 @@ namespace OnlineStore.DeviceLibrary
//640104 * 3331001202 * 210417624 * 600 * 0011
//分号分割后长度=4,L,E,B,R
//TJM211030000146 & 10446500228 & 15000 & 2021 - 06 - 28 & 59K0646169 && 10446 && R02472021102600281
// RI & PN & QTY & 4 & BATCH & 5 & 6 & 7 & 8
// RI & PN & QTY & 4 & BATCH & 5 & 6 & 7 & 8
// RI & PN & QTY & PRODATEyyyy - MM - dd & 5 & 6 & 7 & 8 & 9
//长电 RI,PN,QTY,4
//000NU209HBZ.0U015.030,Z23500H2087D001,8000,9D22092209A
try
{
foreach (string code in codes)
{
string[] strarray = code.Split('&');
if (strarray.Length >=5)
string[] strarray = code.Split(',');
if (strarray.Length >=4)
{
try
{
if (strarray[0].StartsWith("TJM"))
{
return true;
}
//if (strarray[0].StartsWith("TJM"))
//{
// return true;
//}
int QTY = Convert.ToInt32(strarray[2].Trim());
if (QTY > 0)
......
......@@ -114,9 +114,9 @@ namespace OnlineStore.DeviceLibrary
//判断是否不连接服务器
if (string.IsNullOrEmpty(serverAddr))
{
LogUtil.error(deviceName + "GetPosId[" + codeStr + "][" + height + "][" + width + "]:未找到服务器地址 ");
LogUtil.error(deviceName + "GetPosId[" + codeStr + "][" + width + "][" + height + "]:未找到服务器地址 ");
result.Msg = "未找到服务器地址";
result.Param = InOutPosInfo.NewNgPos(codeStr, "", height, width, "");
result.Param = InOutPosInfo.NewNgPos(codeStr, "", width, height, "未找到服务器地址");
return result;
}
......@@ -147,7 +147,7 @@ namespace OnlineStore.DeviceLibrary
{
result.Msg = deviceName + " 【" + codeStr + "】结果:没有收到服务器反馈 ";
//cancelPutInTask(deviceName, codeStr);
result.Param = InOutPosInfo.NewNgPos(codeStr, "", height, width, "没有收到服务器反馈");
result.Param = InOutPosInfo.NewNgPos(codeStr, "", width, height, "没有收到服务器反馈");
result.Param.rfid = rfid;
result.Param.IsNG = true;
return result;
......@@ -167,7 +167,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(deviceName + " 【" + codeStr + "】结果入库NG:已有出库信息: " + result.Param.ToStr() + " ");
result.Msg = "已有出库信息["+ serverResult.barcode + "][" + serverResult.pos + "] ";
result.Param = InOutPosInfo.NewNgPos(codeStr, "", height, width, "已有出库信息[" + serverResult.barcode + "][" + serverResult.pos + "]");
result.Param = InOutPosInfo.NewNgPos(codeStr, "", width, height, "已有出库信息[" + serverResult.barcode + "][" + serverResult.pos + "]");
result.Param.rfid = rfid;
result.Param.IsNG = true;
return result;
......@@ -177,7 +177,7 @@ namespace OnlineStore.DeviceLibrary
result.Result = serverResult.result;
//result.Msg = deviceName + " 【" + codeStr + "】结果:" + serverResult.msg;
result.Msg = "查找空库位失败";
result.Param = InOutPosInfo.NewNgPos(codeStr, "", height, width, serverResult.msg);
result.Param = InOutPosInfo.NewNgPos(codeStr, "", width, height, serverResult.msg);
return result;
}
else if (serverResult.result.Equals(0))
......@@ -185,8 +185,9 @@ namespace OnlineStore.DeviceLibrary
result.Result = serverResult.result;
//result.Msg = deviceName + " 【" + codeStr + "】结果:" + serverResult.msg;
result.Msg = serverResult.msg;
result.Param = new InOutPosInfo(codeStr,serverResult.pos,width,height);
result.Param = new InOutPosInfo(serverResult.barcode, serverResult.pos,width,height);
result.Param.Cid = serverResult.cid;
result.Param.taskId = serverResult.taskId;
return result;
}
else if(serverResult.result.Equals(99).Equals(false)&& serverResult.result.Equals(100).Equals(false))
......@@ -194,7 +195,7 @@ namespace OnlineStore.DeviceLibrary
result.Result = serverResult.result;
//result.Msg = deviceName + " 【" + codeStr + "】结果:" + serverResult.msg;
result.Msg = serverResult.msg;
result.Param = InOutPosInfo.NewNgPos(codeStr, "", height, width, serverResult.msg);
result.Param = InOutPosInfo.NewNgPos(codeStr, "", width, height, serverResult.msg);
return result;
}
result.Result = serverResult.result;
......@@ -224,7 +225,6 @@ namespace OnlineStore.DeviceLibrary
// 返回: {"code":0,"data":{"type":"2","posId":"004-07-200","plateH":"1","barcode":"RI12313","cid":"4","plateW":"1"},
// "msg":"ok","msgKey":"smfcore.ok","okResult":true,"params":[]}
serverResult = JsonHelper.DeserializeJsonToObject<TaskData>(resultStr);
RobotTaskInfo = $"【{server}】【{resultStr}】";
if (serverResult == null)
{
msg = "GetRobotTask 没有收到服务器反馈";
......@@ -232,12 +232,13 @@ namespace OnlineStore.DeviceLibrary
else if (serverResult.code.Equals(0).Equals(false))
{
// code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = "GetRobotTask" + " :" + "[" + serverResult.code + "]" + serverResult.msg;
msg = $"【{server}】【{resultStr}】";
}
if (!msg.Equals(""))
if (!msg.Equals("") && !msg.Equals(RobotTaskInfo))
{
LogUtil.error(msg);
}
RobotTaskInfo = $"【{server}】【{resultStr}】";
}
catch (Exception ex)
{
......@@ -254,7 +255,7 @@ namespace OnlineStore.DeviceLibrary
/// <param name="status">任务状态</param>
/// <param name="locInfo">位置信息</param>
/// <returns></returns>
public static string UpdateTrayLoc( string barcode, string status, string locInfo="")
public static string UpdateTrayLoc( string barcode, string status, string locInfo,string taskId)
{
string msg = "";
try
......@@ -273,6 +274,7 @@ namespace OnlineStore.DeviceLibrary
paramMap.Add("barcode", barcode);//barcode = 料盘的条码
paramMap.Add("status", status); // status = 状态信息, 移栽 = MOVING, 流水线 = INLINE, 皮带线 = INBELT
paramMap.Add("locInfo", locInfo); // locInfo = 位置信息,移栽时为移栽编号,流水线时为托盘号,皮带线时为皮带线编号,机器人时为机器人编号
paramMap.Add("taskId", taskId);
string server = GetAddr(Addr_updateLocInfo, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
......@@ -300,7 +302,45 @@ namespace OnlineStore.DeviceLibrary
return msg;
}
private static string Addr_getBoxDoorStatus = "/service/store/robotBox/getBoxDoorStatus";
public static string BoxDoorStatus = "";
public static bool GetBoxDoorStatus(string cid)
{
string msg = "";
TaskData serverResult = null;
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("cid", cid);
string server = GetAddr(Addr_getBoxDoorStatus, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
// 返回: {"code":0,"data":{"type":"2","posId":"004-07-200","plateH":"1","barcode":"RI12313","cid":"4","plateW":"1"},
// "msg":"ok","msgKey":"smfcore.ok","okResult":true,"params":[]}
serverResult = JsonHelper.DeserializeJsonToObject<TaskData>(resultStr);
if (serverResult == null)
{
msg = "GetBoxDoorStatus 没有收到服务器反馈";
}
else if (serverResult.code.Equals(0).Equals(false))
{
// code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = $"【{server}】【{resultStr}】";
}
if (!msg.Equals("") && !msg.Equals(BoxDoorStatus))
{
LogUtil.error(msg);
}
BoxDoorStatus = $"【{server}】【{resultStr}】";
if (serverResult != null && serverResult.code.Equals(0))
return true;
}
catch (Exception ex)
{
LogUtil.error("GetBoxDoorStatus", ex);
}
return false;
}
//14.异常看板
// > 地址:
......@@ -429,7 +469,8 @@ namespace OnlineStore.DeviceLibrary
public string msg { get; set; }
public string msgKey { get; set; }
public bool okResult { get; set; }
}
public string taskId{ get; set; }
}
public class CancelData
{
//{"code":0,"msg":"ok","data":"7"}
......
using log4net;
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
......@@ -222,6 +222,10 @@ namespace OnlineStore.DeviceLibrary
public abstract bool StartOutstore(InOutParam param);
protected abstract void OutstoreProcess();
public void ClearWarnMsg()
{
WarnMsg = "";
}
public void SetWarnMsg(string msg = "")
{
if (String.IsNullOrEmpty(msg).Equals(false))
......@@ -248,10 +252,10 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(Name + msg);
}
}
}
WarnMsg = msg;
}
public string GetRunStr( )
public string GetRunStr()
{
string sta = "运行中";
string aa = "";
......@@ -273,16 +277,17 @@ namespace OnlineStore.DeviceLibrary
sta = "等待启动";
break;
}
if (isInSuddenDown)
{
aa = "急停中";
}else if (isNoAirpressure_Check)
{
aa = "无气压信号";
}
if (isInSuddenDown)
{
aa = "急停中";
}
else if (isNoAirpressure_Check)
{
aa = "无气压信号";
}
if (!aa.Equals(""))
{
return sta + "_" + aa;
......@@ -318,29 +323,30 @@ namespace OnlineStore.DeviceLibrary
}
public bool CylinderIsOk(string IoLowType, string IoHighType)
{
if (IOManager.DIValue(IoLowType,DeviceID).Equals(IO_VALUE.LOW) && IOManager.DIValue(IoHighType, DeviceID).Equals(IO_VALUE.HIGH)){
if (IOManager.DIValue(IoLowType, DeviceID).Equals(IO_VALUE.LOW) && IOManager.DIValue(IoHighType, DeviceID).Equals(IO_VALUE.HIGH))
{
return true;
}
return false;
}
}
public void CylinderMove(DeviceMoveInfo moveInfo, string IoLowType, string IoHighType, bool isCheckMove = false)
{
{
try
{
if (!baseConfig.DOList.ContainsKey(IoLowType))
{
return;
}
if (!baseConfig.DOList.ContainsKey(IoHighType))
{
return;
}
if (!baseConfig.DOList.ContainsKey(IoLowType))
{
return;
}
if (!baseConfig.DOList.ContainsKey(IoHighType))
{
return;
}
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoLowType, IO_VALUE.LOW));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoHighType, IO_VALUE.HIGH));
}
if (isCheckMove)
{
......@@ -352,11 +358,12 @@ namespace OnlineStore.DeviceLibrary
IOMove(IoLowType, IO_VALUE.LOW);
IOMove(IoHighType, IO_VALUE.HIGH);
}
}catch(Exception ex)
}
catch (Exception ex)
{
LogUtil.error(Name + "CylinderMove ["+moveInfo.Name+"] ["+IoLowType+"] ["+IoHighType+"] ["+isCheckMove+"] 出错:"+ex.ToString());
LogUtil.error(Name + "CylinderMove [" + moveInfo.Name + "] [" + IoLowType + "] [" + IoHighType + "] [" + isCheckMove + "] 出错:" + ex.ToString());
}
}
public void CheckAndMove(string IoType, IO_VALUE value)
{
......@@ -378,7 +385,7 @@ namespace OnlineStore.DeviceLibrary
IOManager.IOMove(IoType, value, baseConfig.Id);
Thread.Sleep(msTime);
IO_VALUE tValue = value.Equals(IO_VALUE.HIGH) ? IO_VALUE.LOW : IO_VALUE.HIGH;
IOManager.IOMove(IoType, tValue, baseConfig.Id);
});
}
......@@ -400,11 +407,9 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(Name + logInfo);
}
protected void MoveLog(string msg)
{
//string posId = (MoveInfo.MoveParam != null && MoveInfo.MoveParam.PosInfo != null) ? " [" + MoveInfo.MoveParam.PosInfo.PosId + "]" : "";
string posId = (MoveInfo.MoveParam != null && MoveInfo.MoveParam.PosInfo != null) ? " [" + MoveInfo.MoveParam.PosInfo.PosId + "][" + MoveInfo.MoveParam.PosInfo.barcode + "]" : "";
LogUtil.info(Name + " " + posId + msg);
{
string posId = (MoveInfo.MoveParam != null && MoveInfo.MoveParam.PosInfo != null) ? " 【" + MoveInfo.MoveParam.PosInfo.PosId + "】【" + MoveInfo.MoveParam.PosInfo.barcode + "】" : "";
LogUtil.info(Name + " " + msg + posId);
}
/// <summary>
/// 阻塞等待IO信号,等到返回true,未等到返回false
......@@ -498,4 +503,4 @@ namespace OnlineStore.DeviceLibrary
}
}
}
......@@ -318,10 +318,17 @@ namespace OnlineStore.DeviceLibrary
wait.WaitType = WaitEnum.W102_FeedScanCode;
return wait;
}
public static WaitResultInfo WaitRobotMove()
public static WaitResultInfo WaitRobotMove(string cmd)
{
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W201_RobotMove;
wait.RobotCmd = cmd;
return wait;
}
public static WaitResultInfo WaitRobotInSafe()
{
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W202_RobotInSafe;
return wait;
}
public string ToStr()
......@@ -368,7 +375,11 @@ namespace OnlineStore.DeviceLibrary
}
else if (WaitType.Equals(WaitEnum.W201_RobotMove))
{
return "机器人移动";
return $"机器人移动【{RobotCmd}】完成";
}
else if (WaitType.Equals(WaitEnum.W202_RobotInSafe))
{
return "机器人在安全位置";
}
else
{
......@@ -424,7 +435,7 @@ namespace OnlineStore.DeviceLibrary
/// 高度
/// </summary>
public int HeightValue { get; set; }
public string RobotCmd { get; set; } = "";
}
internal class WaitEnum
......@@ -468,6 +479,10 @@ namespace OnlineStore.DeviceLibrary
/// 机器人移动完成
/// </summary>
internal static int W201_RobotMove = 201;
/// <summary>
/// 机器人在安全位置
/// </summary>
internal static int W202_RobotInSafe = 202;
}
public enum MoveType
{
......
......@@ -84,7 +84,7 @@ namespace OnlineStore.DeviceLibrary
inOut.CreateTime = DateTime.Now;
return inOut;
}
public string Cid { get; set; }
public string Cid { get; set; } = "";
/// <summary>
/// 创建时间
/// </summary>
......@@ -105,11 +105,11 @@ namespace OnlineStore.DeviceLibrary
/// 料盘高
/// </summary>
public int PlateH { get; set; }
/// <summary>
/// urgentReel: true 表示紧急料,
/// </summary>
public bool urgentReel { get; set; }
public string taskId { get; set; }
/// <summary>
/// urgentReel: true 表示紧急料,
/// </summary>
public bool urgentReel { get; set; }
/// <summary>
/// cutReel: true 表示分盘料,
/// </summary>
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B702AB04-BB76-491F-812A-603298D08FBF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>JAKA</RootNamespace>
<AssemblyName>JAKA</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="JAKABean-Functions.cs" />
<Compile Include="JAKAServer.cs" />
<Compile Include="RtnCode.cs" />
<Compile Include="jakaAPI.cs" />
<Compile Include="JAKABean.cs" />
<Compile Include="JAKATYPE.cs" />
<Compile Include="RobotData.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UCJoint.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UCJoint.Designer.cs">
<DependentUpon>UCJoint.cs</DependentUpon>
</Compile>
<Compile Include="UCRobot.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UCRobot.Designer.cs">
<DependentUpon>UCRobot.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="UCJoint.resx">
<DependentUpon>UCJoint.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UCRobot.resx">
<DependentUpon>UCRobot.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="jaka_files\JAKA_ERROR_CODE.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="jaka_files\x64\jakaAPI.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="jaka_files\x64\zlib.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="jaka_files\x86\jakaAPI.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="jaka_files\x86\zlib.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\..\Projects\CSharp-Workspace\Dolen\Dolen\Dolen.csproj">
<Project>{1D8684A2-5358-4F9C-9B42-9794F8F4B6B6}</Project>
<Name>Dolen</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using log4net;
using System;
using static JAKA.JKTYPE;
namespace JAKA
{
public partial class JAKABean
{
private static ILog log;
/// <summary>
/// 机器人句柄
/// </summary>
private int _handle = 0;
public string IP { get; private set; }
public string RemoteEndPoint { get; set; } = "";
/// <summary>
/// 机器人数据
/// </summary>
public RobotData RobotData;
bool initok = false;
public JAKABean(string robotIp, string logname = "jaka")
{
IP = robotIp;
log = LogManager.GetLogger(logname);
RobotData = new RobotData();
initok = CreateHandler(robotIp);
}
public void Start()
{
if (initok)
{
updateThread = new System.Threading.Thread(UpdateData);
updateThread.IsBackground = true;
updateThread.Start();
}
}
~JAKABean()
{
DestroyHandler();
}
#region 更新数据信息
System.Threading.Thread updateThread;
public delegate void UpdateEventHandler(RobotData robotData);
event UpdateEventHandler UpdateDataEvent;
/// <summary>
/// 刷新频率
/// </summary>
public int ScanRate = 300;
RobotData robotData = new RobotData();
private void UpdateData()
{
try
{
while (true)
{
JKTYPE.ErrorCode error = new JKTYPE.ErrorCode();
if (GetRobotStatus(out robotData.RobotStatus))//GetRobotState(out RobotData.RobotState) &&
{
if (robotData.RobotStatus.errcode != 0)
{
if (GetLastError(ref error))
{
robotData.Errorinfo = $"运行异常:{string.Join("", error.message)}[{error.code}]";
}
else
{
robotData.Errorinfo = $"运行异常:{robotData.RobotStatus.errcode}";
}
}
else
robotData.Errorinfo = "运行正常";
GetProgramState(out robotData.ProgramState);
if (!RobotData.Equals(robotData))
{
RobotData.RobotStatus = robotData.RobotStatus;
RobotData.Errorinfo = robotData.Errorinfo;
RobotData.ProgramState = robotData.ProgramState;
robotData.Online = RobotData.Online;
robotData.CurCmd = RobotData.CurCmd;
robotData.RecvMsg = RobotData.RecvMsg;
UpdateDataEvent?.Invoke(robotData);
}
}
System.Threading.Thread.Sleep(ScanRate);
}
}
catch (Exception ex)
{
log.Error("UpdateData", ex);
}
}
public void RegisterUpdataEvent(UpdateEventHandler eventHandler)
{
UpdateDataEvent += eventHandler;
}
#endregion
#region 日志打印
private void DebugLog(string txt)
{
log.Debug($"[{IP}][{_handle}] {txt}]");
}
private void ErrorLog(string txt, Exception exception = null)
{
log.Error($"[{IP}][{_handle}] {txt}]", exception);
}
private void InfoLog(string txt)
{
log.Info($"[{IP}][{_handle}] {txt}]");
}
#endregion
}
}
using Dolen.Communication.TCP;
using System;
using System.Collections.Generic;
namespace JAKA
{
public class JAKAServer
{
Dictionary<string, JAKABean> JAKAs;
TCPServer TCPServer;
public JAKAServer(string[] clientips, string serverIp = "0.0.0.0", int port = 5000)
{
JAKAs = new Dictionary<string, JAKABean>();
TCPServer = new TCPServer(serverIp,port);
TCPServer.RecvMsgEvent += TCPServer_RecvMsgEvent;
TCPServer.ClientChangedEvent += TCPServer_ClientChangedEvent;
foreach (string ip in clientips)
{
JAKAs.Add(ip, new JAKABean(ip));
}
}
private void TCPServer_ClientChangedEvent(List<Client> clientKey)
{
foreach (string ip in JAKAs.Keys)
{
Client client = clientKey.Find(s => s.IP.Equals(ip));
if (client!=null)
{
JAKAs[ip].RemoteEndPoint = client.EndPoint;
JAKAs[ip].RobotData.Online = true;
}
else
{
JAKAs[ip].RemoteEndPoint = "";
JAKAs[ip].RobotData.Online = false;
}
}
}
private void TCPServer_RecvMsgEvent(string clientKey, string msg)
{
string ip = clientKey.Split(':')[0];
JAKABean jAKA = JAKAs[ip];
if(jAKA != null)
{
jAKA.RobotData.RecvMsg = msg;
}
}
public void Start()
{
TCPServer.Start();
foreach (JAKABean item in JAKAs.Values)
{
item.Start();
}
}
public void Stop()
{
TCPServer.Stop();
}
public void AssociateControl(UCRobot uCRobot, JAKABean jAKABean)
{
uCRobot.Regidter(jAKABean, this);
}
public JAKABean GetJAKABean(string ip)
{
return JAKAs[ip];
}
public void SendCmd(string endpoint, string cmd)
{
string ip=endpoint.Split(':')[0];
if(JAKAs.ContainsKey(ip))
{
JAKAs[ip].RobotData.RecvMsg = "";
JAKAs[ip].RobotData.CurCmd = cmd;
TCPServer.SendMsg(endpoint, cmd);
}
}
}
}
此文件的差异被折叠, 点击展开。
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("JAKA")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JAKA")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b702ab04-bb76-491f-812a-603298d08fbf")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using System.Text;
using static JAKA.JKTYPE;
namespace JAKA
{
public class RobotData
{
/// <summary>
/// 机器人状态数据
/// </summary>
// public RobotState RobotState;
/// <summary>
/// 机器人状态检测数据类型
/// </summary>
public RobotStatus RobotStatus;
/// <summary>
/// 异常消息
/// </summary>
public string Errorinfo="";
/// <summary>
/// 程序运行状态
/// </summary>
public ProgramState ProgramState;
/// <summary>
/// 当前命令
/// </summary>
public string CurCmd = "";
public string RecvMsg = "";
public bool Online = false;
public RobotData()
{
}
public override bool Equals(object obj)
{
RobotData other = obj as RobotData;
if (other == null)
return false;
if (CurCmd.Equals(other.CurCmd) && RecvMsg.Equals(other.RecvMsg) && Online.Equals(other.Online) &&
Errorinfo.Equals(other.Errorinfo)&& RobotStatus.emergency_stop.Equals(other.RobotStatus.emergency_stop)&&
RobotStatus.powered_on.Equals(other.RobotStatus.powered_on)&&RobotStatus.enabled.Equals(other.RobotStatus.enabled)&&
RobotStatus.inpos.Equals(other.RobotStatus.inpos)&& RobotStatus.protective_stop.Equals(other.RobotStatus.protective_stop)&&
RobotStatus.on_soft_limit.Equals(other.RobotStatus.on_soft_limit)&& RobotStatus.is_socket_connect.Equals(other.RobotStatus.is_socket_connect)&&
RobotStatus.drag_status.Equals(other.RobotStatus.drag_status)&& RobotStatus.rapidrate.Equals(other.RobotStatus.rapidrate)&&
ProgramState.Equals(other.ProgramState))
return true;
return false;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JAKA
{
/// <summary>
/// 接口调用返回值
/// </summary>
internal class RtnCode
{
/// <summary>
/// 调用成功
/// </summary>
public const int ERR_SUCC = 0;
/// <summary>
/// 异常调用,调用接口异常,控制器不支持
/// </summary>
public const int ERR_FUCTION_CALL_ERROR = 2;
/// <summary>
/// 无效的控制句柄
/// </summary>
public const int ERR_INVALID_HANDLER = -1;
/// <summary>
/// 无效的参数
/// </summary>
public const int ERR_INVALID_PARAMETER = -2;
/// <summary>
/// 通信连接错误
/// </summary>
public const int ERR_COMMUNICATION_ERR = -3;
/// <summary>
/// 逆解失败
/// </summary>
public const int ERR_KINE_INVERSE_ERR = -4;
/// <summary>
/// 急停开关被按下
/// </summary>
public const int ERR_EMERGENCY_PRESSED = -5;
/// <summary>
/// 机器人未上电
/// </summary>
public const int ERR_NOT_POWERED = -6;
/// <summary>
/// 机器人未使能
/// </summary>
public const int ERR_NOT_ENABLED = -7;
/// <summary>
/// 机器人没有进入 servo 模式
/// </summary>
public const int ERR_DISABLE_SERVOMODE = -8;
/// <summary>
/// 机器人没有关闭使能
/// </summary>
public const int ERR_NOT_OFF_ENABLE = -9;
/// <summary>
/// 程序正在运行,不允许操作
/// </summary>
public const int ERR_PROGRAM_IS_RUNNING = -10;
/// <summary>
/// 无法打开文件,文件不存在
/// </summary>
public const int ERR_CANNOT_OPEN_FILE = -11;
/// <summary>
/// 获取编码含义
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public static string GetStrByCode(int code)
{
string str = "";
switch (code)
{
case ERR_SUCC:
str = "调用成功";
break;
case ERR_FUCTION_CALL_ERROR:
str = "调用接口异常,控制器不支持";
break;
case ERR_INVALID_HANDLER:
str = "无效的控制句柄";
break;
case ERR_INVALID_PARAMETER:
str = "无效的参数";
break;
case ERR_COMMUNICATION_ERR:
str = "通信连接错误";
break;
case ERR_KINE_INVERSE_ERR:
str = "逆解失败";
break;
case ERR_EMERGENCY_PRESSED:
str = "急停开关被按下";
break;
case ERR_NOT_POWERED:
str = "机器人未上电";
break;
case ERR_NOT_ENABLED:
str = "机器人未使能";
break;
case ERR_DISABLE_SERVOMODE:
str = "机器人没有进入 servo 模式";
break;
case ERR_NOT_OFF_ENABLE:
str = "机器人没有关闭使能";
break;
case ERR_PROGRAM_IS_RUNNING:
str = "程序正在运行,不允许操作";
break;
case ERR_CANNOT_OPEN_FILE:
str = "无法打开文件,文件不存在";
break;
default:
str = $"不存在的接口调用返回值:{code}";
break;
}
return str;
}
}
}
namespace JAKA
{
partial class UCJoint
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.lblName = new System.Windows.Forms.Label();
this.lblSerial = new System.Windows.Forms.Label();
this.lblEnable = new System.Windows.Forms.Label();
this.lblErrorState = new System.Windows.Forms.Label();
this.lblCollision = new System.Windows.Forms.Label();
this.lblPosition = new System.Windows.Forms.Label();
this.lblForce = new System.Windows.Forms.Label();
this.lblVolt = new System.Windows.Forms.Label();
this.lblCurrent = new System.Windows.Forms.Label();
this.lblSpeed = new System.Windows.Forms.Label();
this.lblTempture = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblName
//
this.lblName.AutoSize = true;
this.lblName.BackColor = System.Drawing.SystemColors.GradientActiveCaption;
this.lblName.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblName.Location = new System.Drawing.Point(102, 12);
this.lblName.Name = "lblName";
this.lblName.Size = new System.Drawing.Size(49, 14);
this.lblName.TabIndex = 0;
this.lblName.Text = "关节名";
//
// lblSerial
//
this.lblSerial.AutoSize = true;
this.lblSerial.Location = new System.Drawing.Point(4, 44);
this.lblSerial.Name = "lblSerial";
this.lblSerial.Size = new System.Drawing.Size(53, 12);
this.lblSerial.TabIndex = 1;
this.lblSerial.Text = "错误码:";
//
// lblEnable
//
this.lblEnable.AutoSize = true;
this.lblEnable.Location = new System.Drawing.Point(131, 44);
this.lblEnable.Name = "lblEnable";
this.lblEnable.Size = new System.Drawing.Size(41, 12);
this.lblEnable.TabIndex = 2;
this.lblEnable.Text = "使能:";
//
// lblErrorState
//
this.lblErrorState.AutoSize = true;
this.lblErrorState.Location = new System.Drawing.Point(4, 61);
this.lblErrorState.Name = "lblErrorState";
this.lblErrorState.Size = new System.Drawing.Size(41, 12);
this.lblErrorState.TabIndex = 3;
this.lblErrorState.Tag = "";
this.lblErrorState.Text = "错误:";
//
// lblCollision
//
this.lblCollision.AutoSize = true;
this.lblCollision.Location = new System.Drawing.Point(131, 61);
this.lblCollision.Name = "lblCollision";
this.lblCollision.Size = new System.Drawing.Size(41, 12);
this.lblCollision.TabIndex = 4;
this.lblCollision.Text = "碰撞:";
//
// lblPosition
//
this.lblPosition.AutoSize = true;
this.lblPosition.Location = new System.Drawing.Point(3, 78);
this.lblPosition.Name = "lblPosition";
this.lblPosition.Size = new System.Drawing.Size(41, 12);
this.lblPosition.TabIndex = 5;
this.lblPosition.Text = "位置:";
//
// lblForce
//
this.lblForce.AutoSize = true;
this.lblForce.Location = new System.Drawing.Point(3, 112);
this.lblForce.Name = "lblForce";
this.lblForce.Size = new System.Drawing.Size(41, 12);
this.lblForce.TabIndex = 6;
this.lblForce.Text = "力矩:";
//
// lblVolt
//
this.lblVolt.AutoSize = true;
this.lblVolt.Location = new System.Drawing.Point(3, 95);
this.lblVolt.Name = "lblVolt";
this.lblVolt.Size = new System.Drawing.Size(41, 12);
this.lblVolt.TabIndex = 7;
this.lblVolt.Text = "电压:";
//
// lblCurrent
//
this.lblCurrent.AutoSize = true;
this.lblCurrent.Location = new System.Drawing.Point(131, 95);
this.lblCurrent.Name = "lblCurrent";
this.lblCurrent.Size = new System.Drawing.Size(41, 12);
this.lblCurrent.TabIndex = 8;
this.lblCurrent.Text = "电流:";
//
// lblSpeed
//
this.lblSpeed.AutoSize = true;
this.lblSpeed.Location = new System.Drawing.Point(131, 78);
this.lblSpeed.Name = "lblSpeed";
this.lblSpeed.Size = new System.Drawing.Size(41, 12);
this.lblSpeed.TabIndex = 9;
this.lblSpeed.Text = "速度:";
//
// lblTempture
//
this.lblTempture.AutoSize = true;
this.lblTempture.Location = new System.Drawing.Point(131, 112);
this.lblTempture.Name = "lblTempture";
this.lblTempture.Size = new System.Drawing.Size(41, 12);
this.lblTempture.TabIndex = 10;
this.lblTempture.Text = "温度:";
//
// UCJoint
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Controls.Add(this.lblTempture);
this.Controls.Add(this.lblSpeed);
this.Controls.Add(this.lblCurrent);
this.Controls.Add(this.lblVolt);
this.Controls.Add(this.lblForce);
this.Controls.Add(this.lblPosition);
this.Controls.Add(this.lblCollision);
this.Controls.Add(this.lblErrorState);
this.Controls.Add(this.lblEnable);
this.Controls.Add(this.lblSerial);
this.Controls.Add(this.lblName);
this.Name = "UCJoint";
this.Size = new System.Drawing.Size(242, 134);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblName;
private System.Windows.Forms.Label lblSerial;
private System.Windows.Forms.Label lblEnable;
private System.Windows.Forms.Label lblErrorState;
private System.Windows.Forms.Label lblCollision;
private System.Windows.Forms.Label lblPosition;
private System.Windows.Forms.Label lblForce;
private System.Windows.Forms.Label lblVolt;
private System.Windows.Forms.Label lblCurrent;
private System.Windows.Forms.Label lblSpeed;
private System.Windows.Forms.Label lblTempture;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace JAKA
{
public partial class UCJoint : UserControl
{
public UCJoint()
{
InitializeComponent();
}
/// <summary>
/// 设置数据
/// </summary>
/// <param name="name">关节名称</param>
/// <param name="num">关节序列号</param>
/// <param name="enable">关节使能</param>
/// <param name="error">关节错误</param>
/// <param name="collision">关节碰撞</param>
/// <param name="position">关节位置</param>
/// <param name="speed">关节速度</param>
/// <param name="volt">关节伺服电压</param>
/// <param name="current">关节伺服电流</param>
/// <param name="force">关节力矩</param>
/// <param name="tempture">关节温度</param>
public void Set(string name, int num, int enable,int error,int collision,
float position,float speed,int volt,float current,float force,int tempture)
{
this.Invoke(new Action(() => {
lblName.Text = name;
lblSerial.Text = $"错误码:{num}";
if (enable == 1)
{
lblEnable.Text = "使能";
lblEnable.BackColor = Color.GreenYellow;
}
else
{
lblEnable.Text = "使能";
lblEnable.BackColor = Color.Red;
}
if (error == 1)
{
lblErrorState.Text = "错误";
lblErrorState.BackColor = Color.Red;
}
else
{
lblErrorState.Text = "错误";
lblErrorState.BackColor = Color.GreenYellow;
}
if (collision == 1)
{
lblCollision.Text = "碰撞";
lblCollision.BackColor = Color.Red;
}
else
{
lblCollision.Text = "碰撞";
lblCollision.BackColor = Color.GreenYellow;
}
lblPosition.Text = $"位置:{position.ToString("f3")}°";
lblSpeed.Text = $"速度:{speed.ToString("f3")}°/s";
lblVolt.Text = $"电压:{volt}V";
lblCurrent.Text = $"电流:{current.ToString("f3")}A";
lblForce.Text = $"力矩:{force.ToString("f3")}Nm";
lblTempture.Text = $"温度:{tempture}℃";
}));
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static JAKA.JKTYPE;
namespace JAKA
{
public partial class UCRobot : UserControl
{
public UCRobot()
{
Control.CheckForIllegalCrossThreadCalls = false;
InitializeComponent();
comboBox1.SelectedIndex = 0;
}
private JAKABean jakaBean;
private JAKAServer server;
public void Regidter(JAKABean jakabean,JAKAServer jAKAServer)
{
this.jakaBean = jakabean;
groupBox1.Text = $"[{jakabean.IP}]";
server = jAKAServer;
jakabean.RegisterUpdataEvent(Update);
}
private void Update(RobotData robotData)
{
if (!this.IsHandleCreated)
return;
this.Invoke((Action)(() =>
{
lblestop.BackColor = robotData.RobotStatus.emergency_stop == 0 ? Color.YellowGreen : Color.Red;
lblpoweredon.BackColor = robotData.RobotStatus.powered_on == 0 ? Color.Red : Color.YellowGreen;
lblservoenabled.BackColor = robotData.RobotStatus.enabled == 0 ? Color.Red : Color.YellowGreen;
lblinpos.BackColor = robotData.RobotStatus.inpos == 0 ? Color.Red : Color.YellowGreen;
lblprotectivestop.BackColor = robotData.RobotStatus.protective_stop == 0 ? Color.YellowGreen : Color.Red;
lblonsoftlimit.BackColor = robotData.RobotStatus.on_soft_limit == 0 ? Color.YellowGreen : Color.Red;
lblsdkconnect.BackColor = robotData.RobotStatus.is_socket_connect == 0 ? Color.Red : Color.YellowGreen;
lbldragstatus.BackColor = robotData.RobotStatus.drag_status == 0 ? Color.Red : Color.YellowGreen;
lblrapidrate.Text = $"运动倍率:{robotData.RobotStatus.rapidrate.ToString("f3")}";
lblerrorcode.Text = robotData.Errorinfo;
lblresponse.Text = robotData.RecvMsg;
if (robotData.ProgramState.Equals(ProgramState.PROGRAM_IDLE))
{
lblProgramstate.BackColor = Color.Red;
}
else if(robotData.ProgramState.Equals(ProgramState.PROGRAM_PAUSED))
{
lblProgramstate.BackColor = Color.Yellow;
}
else if (robotData.ProgramState.Equals(ProgramState.PROGRAM_RUNNING))
{
lblProgramstate.BackColor = Color.YellowGreen;
}
lblCmd.Text = robotData.CurCmd;
if(robotData.Online)
{
groupBox1.Text = $"[{jakaBean.IP}][在线]";
}
else
{
groupBox1.Text = $"[{jakaBean.IP}][离线]";
}
}));
}
private void btnPowerOn_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(() => { jakaBean.PowerOn(); });
}
private void btnPowerOff_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(() => { jakaBean.PowerOff(); });
}
private void btnEnable_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(() => { jakaBean.EnableRobot(); });
}
private void btnDisable_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(() => { jakaBean.DisableRobot(); });
}
private void btnStart_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(() => { jakaBean.Run(); });
}
private void btnStop_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(() => { jakaBean.Abort(); });
}
private void btnSend_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(() => {
if (groupBox1.Text.Contains("在线"))
{
string cmd = comboBox1.SelectedItem.ToString();//textBox1.Text;
server.SendCmd(jakaBean.RemoteEndPoint, cmd);
}
});
}
private void btnRun_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(() => {
jakaBean.PowerOn();
System.Threading.Thread.Sleep(2000);
jakaBean.EnableRobot();
System.Threading.Thread.Sleep(2000);
jakaBean.Run();
});
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
此文件类型无法预览
文件属性发生变化
文件属性发生变化
此文件的差异被折叠, 点击展开。
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.14" targetFramework="net48" />
</packages>
\ No newline at end of file
......@@ -236,13 +236,26 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// PRO,0,料盘高度转换系数,Coeff_Height,0.5,,,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Coeff_Height")]
public double Coeff_Height { get; set; }
[ConfigProAttribute("Coeff_Height_Ad1")]
public double Coeff_Height_Ad1 { get; set; }
/// <summary>
/// PRO,0,料盘宽度转换系数,Coeff_Width,0.5,,,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Coeff_Width")]
public double Coeff_Width { get; set; }
[ConfigProAttribute("Coeff_Height_Ad2")]
public double Coeff_Height_Ad2 { get; set; }
[ConfigProAttribute("Coeff_Height_Ad3")]
public double Coeff_Height_Ad3 { get; set; }
[ConfigProAttribute("Coeff_Height_Ad4")]
public double Coeff_Height_Ad4 { get; set; }
[ConfigProAttribute("BaseVal_Height_Ad1")]
public int BaseVal_Height_Ad1 { get; set; }
[ConfigProAttribute("BaseVal_Height_Ad2")]
public int BaseVal_Height_Ad2 { get; set; }
[ConfigProAttribute("BaseVal_Height_Ad3")]
public int BaseVal_Height_Ad3 { get; set; }
[ConfigProAttribute("BaseVal_Height_Ad4")]
public int BaseVal_Height_Ad4 { get; set; }
#endregion
protected override void initMustHavePro()
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!