Commit efb5e928 张东亮

逻辑基本完成,出入料口待对接

1 个父辈 c21bf5fd
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<conversionPattern value="[%date][%t]%-5p %m%n" /> <conversionPattern value="[%date][%t]%-5p %m%n" />
</layout> </layout>
</appender> </appender>
<appender name="Jaka" type="log4net.Appender.RollingFileAppender"> <appender name="jaka" type="log4net.Appender.RollingFileAppender">
<param name="File" value="logs\\Jaka\\jaka.log" /> <param name="File" value="logs\\Jaka\\jaka.log" />
<param name="Encoding" value="UTF-8" /> <param name="Encoding" value="UTF-8" />
<param name="AppendToFile" value="true" /> <param name="AppendToFile" value="true" />
...@@ -114,9 +114,9 @@ ...@@ -114,9 +114,9 @@
<param name="ConversionPattern" value="[%d][%t][%c:%L]%-5p %m%n" /> <param name="ConversionPattern" value="[%d][%t][%c:%L]%-5p %m%n" />
</layout> </layout>
</appender> </appender>
<logger name="Jaka"> <logger name="jaka">
<level value="info" /> <level value="info" />
<appender-ref ref="Jaka" /> <appender-ref ref="jaka" />
</logger> </logger>
<logger name="RollingLogFileAppender"> <logger name="RollingLogFileAppender">
<level value="Info" /> <level value="Info" />
......
...@@ -337,7 +337,7 @@ namespace OnlineStore.CarriageClient ...@@ -337,7 +337,7 @@ namespace OnlineStore.CarriageClient
AxisManager.instance.CloseAllPort(); AxisManager.instance.CloseAllPort();
AxisManager.instance.CloseCard(); AxisManager.instance.CloseCard();
RFIDManager.Close(); RFIDManager.Close();
StoreBean.robotEquip.StopRobotService(); //StoreBean.robotEquip.StopRobotService();
if (Camera._cam != null) if (Camera._cam != null)
{ {
Camera._cam.CloseAll(); Camera._cam.CloseAll();
......
...@@ -667,7 +667,7 @@ ...@@ -667,7 +667,7 @@
// //
this.chkManualRobot.AutoSize = true; this.chkManualRobot.AutoSize = true;
this.chkManualRobot.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.chkManualRobot.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chkManualRobot.Location = new System.Drawing.Point(512, 191); this.chkManualRobot.Location = new System.Drawing.Point(758, 160);
this.chkManualRobot.Name = "chkManualRobot"; this.chkManualRobot.Name = "chkManualRobot";
this.chkManualRobot.Size = new System.Drawing.Size(141, 26); this.chkManualRobot.Size = new System.Drawing.Size(141, 26);
this.chkManualRobot.TabIndex = 3; this.chkManualRobot.TabIndex = 3;
...@@ -678,7 +678,7 @@ ...@@ -678,7 +678,7 @@
// btnColseRobotService // btnColseRobotService
// //
this.btnColseRobotService.BackColor = System.Drawing.Color.Red; this.btnColseRobotService.BackColor = System.Drawing.Color.Red;
this.btnColseRobotService.Location = new System.Drawing.Point(511, 97); this.btnColseRobotService.Location = new System.Drawing.Point(758, 241);
this.btnColseRobotService.Name = "btnColseRobotService"; this.btnColseRobotService.Name = "btnColseRobotService";
this.btnColseRobotService.Size = new System.Drawing.Size(123, 48); this.btnColseRobotService.Size = new System.Drawing.Size(123, 48);
this.btnColseRobotService.TabIndex = 2; this.btnColseRobotService.TabIndex = 2;
...@@ -689,7 +689,7 @@ ...@@ -689,7 +689,7 @@
// btnOpenRobotService // btnOpenRobotService
// //
this.btnOpenRobotService.BackColor = System.Drawing.Color.YellowGreen; this.btnOpenRobotService.BackColor = System.Drawing.Color.YellowGreen;
this.btnOpenRobotService.Location = new System.Drawing.Point(511, 25); this.btnOpenRobotService.Location = new System.Drawing.Point(758, 52);
this.btnOpenRobotService.Name = "btnOpenRobotService"; this.btnOpenRobotService.Name = "btnOpenRobotService";
this.btnOpenRobotService.Size = new System.Drawing.Size(123, 48); this.btnOpenRobotService.Size = new System.Drawing.Size(123, 48);
this.btnOpenRobotService.TabIndex = 1; this.btnOpenRobotService.TabIndex = 1;
...@@ -702,7 +702,7 @@ ...@@ -702,7 +702,7 @@
this.ucRobot1.Location = new System.Drawing.Point(4, 13); this.ucRobot1.Location = new System.Drawing.Point(4, 13);
this.ucRobot1.Margin = new System.Windows.Forms.Padding(4); this.ucRobot1.Margin = new System.Windows.Forms.Padding(4);
this.ucRobot1.Name = "ucRobot1"; this.ucRobot1.Name = "ucRobot1";
this.ucRobot1.Size = new System.Drawing.Size(500, 428); this.ucRobot1.Size = new System.Drawing.Size(550, 428);
this.ucRobot1.TabIndex = 0; this.ucRobot1.TabIndex = 0;
// //
// panBase // panBase
......
...@@ -570,6 +570,18 @@ namespace OnlineStore.CarriageClient ...@@ -570,6 +570,18 @@ namespace OnlineStore.CarriageClient
private void chkManualRobot_CheckedChanged(object sender, EventArgs e) private void chkManualRobot_CheckedChanged(object sender, EventArgs e)
{ {
ManualRobot(chkManualRobot.Checked); ManualRobot(chkManualRobot.Checked);
try
{
if (robotEquip.GetRobotInfo(out JAKABean jAKABean))
{
ucRobot1.Update(jAKABean.RobotData);
}
}
catch(Exception ex)
{
LogUtil.error("chkManualRobot_CheckedChanged",ex);
}
} }
} }
......
...@@ -71,23 +71,39 @@ namespace OnlineStore.Common ...@@ -71,23 +71,39 @@ namespace OnlineStore.Common
{ {
Int32.TryParse(config.AppSettings.Settings[key].Value, out a); Int32.TryParse(config.AppSettings.Settings[key].Value, out a);
} }
} return a; }
return a;
} }
public static string GetValue(string key) public static string GetValue(string key)
{ {
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); if (Monitor.TryEnter(configloc, 500))
if (config.AppSettings.Settings[key] == null)
{ {
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!"); try
return ""; {
} System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
else if (config.AppSettings.Settings[key] == null)
{ {
return config.AppSettings.Settings[key].Value; LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return "";
}
else
{
return config.AppSettings.Settings[key].Value;
}
}
catch (Exception ex)
{
LogUtil.error("获取【" + key + "】的值失败!", ex);
}
finally
{
Monitor.Exit(configloc);
}
} }
return "";
} }
public static decimal GetNumValue(string key) static decimal GetNumValue(string key)
{ {
decimal a = 0; decimal a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
...@@ -107,54 +123,52 @@ namespace OnlineStore.Common ...@@ -107,54 +123,52 @@ namespace OnlineStore.Common
public static int GetIntValue(string key) public static int GetIntValue(string key)
{ {
int a = 0; int a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); string val = GetValue(key);
if (config.AppSettings.Settings[key] == null) Int32.TryParse(val, out a);
{ return a;
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
{
{
Int32.TryParse(config.AppSettings.Settings[key].Value, out a);
}
} return a;
} }
public static void SaveValue(string key, int value) public static void SaveValue(string key, int value)
{ {
SaveValue(key, value.ToString()); SaveValue(key, value.ToString());
} }
static object configloc = new object();
public static void SaveValue(string key, string value) public static void SaveValue(string key, string value)
{ {
try if (Monitor.TryEnter(configloc, 500))
{ {
if (key.Equals("")) try
//if (key.Equals("") || value.Equals(""))
{ {
return; if (key.Equals(""))
//if (key.Equals("") || value.Equals(""))
{
return;
}
//增加的内容写在appSettings段下 <add key="RegCode" value="0"/>
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
SetValue(key, value);
}
else
{
UpdateConfig(key, value);
}
} }
//增加的内容写在appSettings段下 <add key="RegCode" value="0"/> catch (Exception ex)
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{ {
SetValue(key, value); LogUtil.error("SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + ",", ex);
} }
else finally
{ {
UpdateConfig(key, value); Monitor.Exit(configloc);
} }
} }
catch (Exception ex) else
{ {
LogUtil.error( "SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + ",",ex); LogUtil.error("SaveValue保存配置失败,未得到锁:AppKey=" + key + ",AppValue=" + value);
} }
} }
public static string GetValue(object debugDeviceId)
{
throw new NotImplementedException();
}
/// <summary> /// <summary>
/// 更新配置文件信息 /// 更新配置文件信息
/// </summary> /// </summary>
...@@ -173,10 +187,10 @@ namespace OnlineStore.Common ...@@ -173,10 +187,10 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error( "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + ",",ex); LogUtil.error("UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + ",", ex);
} }
} }
///<summary> ///<summary>
///向.config文件的appKey结写入信息AppValue 保存设置 ///向.config文件的appKey结写入信息AppValue 保存设置
...@@ -207,7 +221,7 @@ namespace OnlineStore.Common ...@@ -207,7 +221,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error( "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + ",",ex); LogUtil.error("SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + ",", ex);
} }
} }
} }
......
...@@ -147,8 +147,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -147,8 +147,8 @@ namespace OnlineStore.DeviceLibrary
if (TrayIsInPosition()) if (TrayIsInPosition())
{ {
MoveInfo.NextMoveStep(StepEnum.Inlet_Reset_04_Finish); MoveInfo.NextMoveStep(StepEnum.Inlet_Reset_04_Finish);
LogInfo($"复位 {MoveInfo.SLog}:检测到料盘,皮带停止"); LogInfo($"复位 {MoveInfo.SLog}:检测到料盘,5秒后皮带停止");
InletRun(false); IOMove(IO_Type.Inlet_Run, IO_VALUE.HIGH,5000);
} }
else if (MoveInfo.IsTimeOut(15)) else if (MoveInfo.IsTimeOut(15))
{ {
...@@ -171,6 +171,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -171,6 +171,7 @@ namespace OnlineStore.DeviceLibrary
AllowFeedIn(false); AllowFeedIn(false);
Inch7JackUp(false); Inch7JackUp(false);
Inch13JackUp(false); Inch13JackUp(false);
InletRun(false);
MoveInfo.EndMove(); MoveInfo.EndMove();
} }
...@@ -354,6 +355,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -354,6 +355,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_7InchJackDown, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_7InchJackDown, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_7InchJackUp, IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_7InchJackUp, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_7InchJackUpSig, IO_VALUE.HIGH));
} }
} }
else else
...@@ -364,6 +366,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -364,6 +366,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_7InchJackUp, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_7InchJackUp, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_7InchJackDown, IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_7InchJackDown, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_7InchJackDownSig, IO_VALUE.HIGH));
} }
} }
} }
...@@ -381,6 +384,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -381,6 +384,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_13InchJackDown, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_13InchJackDown, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_13InchJackUp, IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_13InchJackUp, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_13InchJackUpSig, IO_VALUE.HIGH));
} }
} }
else else
...@@ -391,6 +395,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -391,6 +395,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_13InchJackUp, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_13InchJackUp, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_13InchJackDown, IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_13InchJackDown, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Inlet_13InchJackDownSig, IO_VALUE.HIGH));
} }
} }
} }
......
...@@ -333,9 +333,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -333,9 +333,14 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 送料允许 /// 送料允许
/// </summary> /// </summary>
private void AddWaitAllowFeedOut() private void AddWaitAllowFeedOut(bool on)
{ {
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Outlet_AllowFeedSig, IO_VALUE.HIGH)); if (on)
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Outlet_AllowFeedSig, IO_VALUE.HIGH));
else
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Outlet_AllowFeedSig, IO_VALUE.LOW));
}
} }
/// <summary> /// <summary>
...@@ -352,6 +357,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -352,6 +357,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Outlet_JackDown, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Outlet_JackDown, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Outlet_JackUp, IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Outlet_JackUp, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Outlet_JackUpSig, IO_VALUE.HIGH));
} }
} }
else else
...@@ -362,6 +368,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -362,6 +368,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Outlet_JackUp, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Outlet_JackUp, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Outlet_JackDown, IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Outlet_JackDown, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Outlet_JackDownSig, IO_VALUE.HIGH));
} }
} }
} }
......
...@@ -55,22 +55,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -55,22 +55,22 @@ namespace OnlineStore.DeviceLibrary
{ {
NextMoveStep(StepEnum.Outlet_02_CheckTray, "检查是否有料盘"); NextMoveStep(StepEnum.Outlet_02_CheckTray, "检查是否有料盘");
JackUp(false); JackUp(false);
AddWaitTime(2000);
} }
else if (MoveInfo.IsStep(StepEnum.Outlet_02_CheckTray)) else if (MoveInfo.IsStep(StepEnum.Outlet_02_CheckTray))
{ {
if (TrayCheck()) if (TrayCheck())
{ {
NextMoveStep(StepEnum.Outlet_03_CheckAllowFeedOut, "有料盘,准备送走"); NextMoveStep(StepEnum.Outlet_03_CheckAllowFeedOut, "有料盘,准备送走");
AddWaitAllowFeedOut(); AddWaitAllowFeedOut(true);
AddWaitTime(5000); AddWaitTime(2000);
MoveInfo.OneWaitCanEndStep = true; MoveInfo.OneWaitCanEndStep = true;
} }
else//无料盘 else//无料盘
{ {
NextMoveStep(StepEnum.Outlet_05_JackUp, "无料盘,顶升抬起,准备料盘放入"); NextMoveStep(StepEnum.Outlet_05_JackUp, "无料盘,顶升抬起,准备料盘放入");
JackUp(true); JackUp(true);
AddWaitTime(5000); if (BufferDataManager.TrayInOutletInfo != null)
BufferDataManager.TrayInOutletInfo = null;
} }
} }
else if (MoveInfo.IsStep(StepEnum.Outlet_03_CheckAllowFeedOut)) else if (MoveInfo.IsStep(StepEnum.Outlet_03_CheckAllowFeedOut))
...@@ -78,12 +78,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -78,12 +78,12 @@ namespace OnlineStore.DeviceLibrary
NextMoveStep(StepEnum.Outlet_04_WaitTrayLeave, "允许料盘离开,链条运行"); NextMoveStep(StepEnum.Outlet_04_WaitTrayLeave, "允许料盘离开,链条运行");
OutletRun(true); OutletRun(true);
AddWaitTrayCheck1(false); AddWaitTrayCheck1(false);
AddWaitTrayCheck2(true);
AddWaitTrayCheck2(false); AddWaitTrayCheck2(false);
//AddWaitAllowFeedOut(false);
} }
else if (MoveInfo.IsStep(StepEnum.Outlet_04_WaitTrayLeave)) else if (MoveInfo.IsStep(StepEnum.Outlet_04_WaitTrayLeave))
{ {
NextMoveStep(StepEnum.Outlet_05_JackUp, "料盘离开完成,清除出料口缓存,链条停止,顶升抬起"); NextMoveStep(StepEnum.Outlet_05_JackUp, "料盘离开完成,链条停止,顶升抬起");
BufferDataManager.TrayInOutletInfo = null; BufferDataManager.TrayInOutletInfo = null;
OutletRun(false); OutletRun(false);
JackUp(true); JackUp(true);
......
...@@ -61,7 +61,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -61,7 +61,6 @@ namespace OnlineStore.DeviceLibrary
System.Threading.Thread.Sleep(2000); System.Threading.Thread.Sleep(2000);
EnableRobot(true); EnableRobot(true);
System.Threading.Thread.Sleep(2000); System.Threading.Thread.Sleep(2000);
StartProg(true);
}); });
} }
...@@ -71,8 +70,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -71,8 +70,6 @@ namespace OnlineStore.DeviceLibrary
{ {
Task.Factory.StartNew(delegate Task.Factory.StartNew(delegate
{ {
StartProg(false);
System.Threading.Thread.Sleep(2000);
EnableRobot(false); EnableRobot(false);
System.Threading.Thread.Sleep(2000); System.Threading.Thread.Sleep(2000);
PowerOn(false); PowerOn(false);
...@@ -152,6 +149,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -152,6 +149,9 @@ namespace OnlineStore.DeviceLibrary
isNoAirpressure_Check = false; isNoAirpressure_Check = false;
MoveInfo.NextMoveStep(StepEnum.Robot_Reset_01_Wait); MoveInfo.NextMoveStep(StepEnum.Robot_Reset_01_Wait);
LogInfo($"复位 {MoveInfo.SLog} :轴开始复位"); LogInfo($"复位 {MoveInfo.SLog} :轴开始复位");
StartProg(true);
curcmd = "";
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
isInPro = false; isInPro = false;
} }
...@@ -161,19 +161,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -161,19 +161,12 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveResetPro(); MoveResetPro();
} }
//else if(MoveInfo.MoveType.Equals(MoveType.RHome))
//{
// MoveHomePro();
//}
} }
static int axisDiff = 20000; static int axisDiff = 20000;
private bool CheckTongsPos() private bool CheckTongsPos()
{ {
return false; return false;
} }
//Bitmap resetBitMap = null;
bool resetRtnA = false;
bool resetRtnB = false;
private void MoveResetPro() private void MoveResetPro()
{ {
if (MoveInfo.IsInWait) if (MoveInfo.IsInWait)
...@@ -352,14 +345,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -352,14 +345,12 @@ namespace OnlineStore.DeviceLibrary
internal override void StopMove() internal override void StopMove()
{ {
MoveInfo.EndMove(); MoveInfo.EndMove();
MoveAxis.SuddenStop(); MoveAxis.SuddenStop();
CompressAxis.SuddenStop(); CompressAxis.SuddenStop();
StartProg(false);
CloseAllAxis(); CloseAllAxis();
curcmd = "";
} }
public override void StopRun() public override void StopRun()
......
...@@ -73,89 +73,89 @@ namespace OnlineStore.DeviceLibrary ...@@ -73,89 +73,89 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 获取整个料仓的状态 /// 获取整个料仓的状态
/// </summary> /// </summary>
//public Operation getLineBoxStatus() public Operation getLineBoxStatus()
//{ {
// //构建发送给服务器的对象 //构建发送给服务器的对象
// Operation lineOperation = new Operation(); Operation lineOperation = new Operation();
// lineOperation.msg = ""; lineOperation.msg = "";
// lineOperation.alarmList = new List<AlarmInfo>(); lineOperation.alarmList = new List<AlarmInfo>();
// lineOperation.cid = CID; lineOperation.cid = CID;
// lineOperation.seq = ConfigAppSettings.nextSeq(); lineOperation.seq = ConfigAppSettings.nextSeq();
// lineOperation.status = 1; lineOperation.status = 1;
// if (WarnMsg != "") if (WarnMsg != "")
// { {
// lineOperation.status = (int)DeviceStatus.Warning; lineOperation.status = (int)DeviceStatus.Warning;
// lineOperation.msg = WarnMsg; lineOperation.msg = WarnMsg;
// } }
// lineOperation.status = (int)DeviceStatus.StoreOnline; lineOperation.status = (int)DeviceStatus.StoreOnline;
// BoxStatus boxStatus = new BoxStatus(); BoxStatus boxStatus = new BoxStatus();
// boxStatus.boxId = 1; boxStatus.boxId = 1;
// boxStatus.msg = WarnMsg; boxStatus.msg = WarnMsg;
// lineOperation.msg = WarnMsg; lineOperation.msg = WarnMsg;
// if (WarnMsg.Equals("")) if (WarnMsg.Equals(""))
// { {
// boxStatus.msg = CodeMsg; boxStatus.msg = CodeMsg;
// lineOperation.msg = CodeMsg; lineOperation.msg = CodeMsg;
// } }
// CodeMsg = ""; CodeMsg = "";
// //WarnMsg = ""; //WarnMsg = "";
// //状态 //状态
// boxStatus.status = (int)deviceStatus; boxStatus.status = (int)deviceStatus;
// if (IsDebug) if (IsDebug)
// { {
// boxStatus.status = (int)DeviceStatus.Debugging; boxStatus.status = (int)DeviceStatus.Debugging;
// } }
// else if (runStatus.Equals(DeviceStatus.OutStoreBoxEnd) || runStatus.Equals(DeviceStatus.InStoreEnd)) //else if (runStatus.Equals(DeviceStatus.OutStoreBoxEnd) || runStatus.Equals(DeviceStatus.InStoreEnd))
// { //{
// boxStatus.data.Add(ParamDefine.posId, lastPosId); // boxStatus.data.Add(ParamDefine.posId, lastPosId);
// boxStatus.data.Add(ParamDefine.barcode,lastBarcode); // boxStatus.data.Add(ParamDefine.barcode, lastBarcode);
// boxStatus.data.Add(ParamDefine.executeTime, executeTime); // boxStatus.data.Add(ParamDefine.executeTime, executeTime);
// } //}
// else if (!lastPosId.Equals("")) //else if (!lastPosId.Equals(""))
// { //{
// boxStatus.data.Add(ParamDefine.posId, lastPosId); // boxStatus.data.Add(ParamDefine.posId, lastPosId);
// boxStatus.data.Add(ParamDefine.barcode, lastBarcode); // boxStatus.data.Add(ParamDefine.barcode, lastBarcode);
// boxStatus.data.Add(ParamDefine.executeTime,executeTime); // boxStatus.data.Add(ParamDefine.executeTime, executeTime);
// boxStatus.status = (int)deviceStatus; // boxStatus.status = (int)deviceStatus;
// if (lastPosId != "") // if (lastPosId != "")
// { // {
// LogUtil.info("给服务器发送出入库消息:" + Name + ",status【" + deviceStatus + "】posId【" + lastPosId + "】barcode【"+lastBarcode+"】"); // LogUtil.info("给服务器发送出入库消息:" + Name + ",status【" + deviceStatus + "】posId【" + lastPosId + "】barcode【" + lastBarcode + "】");
// } // }
// lastPosId = ""; // lastPosId = "";
// lastBarcode = ""; // lastBarcode = "";
// } //}
// if (MoveInfo.MoveType.Equals(MoveType.InStore)||MoveInfo.MoveType.Equals(MoveType.OutStore)) if (MoveInfo.MoveType.Equals(MoveType.InStore) || MoveInfo.MoveType.Equals(MoveType.OutStore))
// { {
// if ((MoveInfo.MoveParam != null)&&( MoveInfo.MoveParam.PosInfo!=null)) if ((MoveInfo.MoveParam != null) && (MoveInfo.MoveParam.PosInfo != null))
// { {
// if (!boxStatus.data.ContainsKey(ParamDefine.posId)) if (!boxStatus.data.ContainsKey(ParamDefine.posId))
// { {
// boxStatus.data.Add(ParamDefine.posId, MoveInfo.MoveParam.PosInfo.PosId); boxStatus.data.Add(ParamDefine.posId, MoveInfo.MoveParam.PosInfo.PosId);
// } }
// boxStatus.data.Add(ParamDefine.code, MoveInfo.MoveParam.PosInfo.barcode); boxStatus.data.Add(ParamDefine.code, MoveInfo.MoveParam.PosInfo.barcode);
// } }
// } }
// //温湿度 //温湿度
// //ASTemperateParam param = HumitureServer.GetTemperateParam(Config.Temperate_Serveraddress); //ASTemperateParam param = HumitureServer.GetTemperateParam(Config.Temperate_Serveraddress);
// HumitureParam param = humBean.LastData; //HumitureParam param = humBean.LastData;
// if (param != null) //if (param != null)
// { //{
// boxStatus.humidity = param.Humidity.ToString(); // boxStatus.humidity = param.Humidity.ToString();
// boxStatus.temperature = param.Temperate.ToString(); // boxStatus.temperature = param.Temperate.ToString();
// } //}
// lineOperation.boxStatus.Add(1, boxStatus); lineOperation.boxStatus.Add(1, boxStatus);
// if (!alarmType.Equals(AlarmType.None)) if (!alarmType.Equals(AlarmType.None))
// { {
// lineOperation.alarmList.Add(alarmInfo); lineOperation.alarmList.Add(alarmInfo);
// } }
// return lineOperation; return lineOperation;
//} }
//public void SendLineStatus() //public void SendLineStatus()
//{ //{
...@@ -230,63 +230,63 @@ namespace OnlineStore.DeviceLibrary ...@@ -230,63 +230,63 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(Name + "执行TimerProcess 共处理了【" + span.TotalMilliseconds + "】毫秒"); LogUtil.info(Name + "执行TimerProcess 共处理了【" + span.TotalMilliseconds + "】毫秒");
} }
} }
//public bool ReviceInStoreCMD(string posId, int plateH, int plateW, string message) public bool ReviceInStoreCMD(string posId, int plateH, int plateW, string code)
//{ {
// string logName = "入库库位验证【 " + message + "】【" + posId + "】:"; string logName = "入库库位验证【 " + code + "】【" + posId + "】:";
// try try
// { {
// if (runStatus.Equals(RunStatus.Wait)) if (runStatus.Equals(RunStatus.Wait))
// { {
// LogUtil.info(logName + " 设备未启动,验证失败"); LogUtil.info(logName + " 设备未启动,验证失败");
// return false; return false;
// } }
// //发送扫码内容到服务器进行入库操作 //发送扫码内容到服务器进行入库操作
// Operation operation = getLineBoxStatus(); Operation operation = getLineBoxStatus();
// operation.op = 1; operation.op = 1;
// operation.data = new Dictionary<string, string>() { { "code", message }, { "boxId", this.DeviceID.ToString() } }; operation.data = new Dictionary<string, string>() { { "code", code }, { "boxId", this.DeviceID.ToString() } };
// operation.data.Add("inPos", posId); operation.data.Add("inPos", posId);
// string server = ConfigAppSettings.GetValue(Setting_Init.http_server); string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
// for (int i = 1; i <= 3; i++) for (int i = 1; i <= 3; i++)
// { {
// bool timeOut = false; bool timeOut = false;
// Operation resultOperation = HttpHelper.PostOperation(SServerManager.GetPostApi(server), operation); Operation resultOperation = HttpHelper.PostOperation(SServerManager.GetPostApi(server), operation);
// if (timeOut) if (timeOut)
// { {
// LogUtil.info(logName + " 第" + i + "次发送超时 "); LogUtil.info(logName + " 第" + i + "次发送超时 ");
// continue; continue;
// } }
// if (resultOperation == null) if (resultOperation == null)
// { {
// // CodeMsg = "二维码【" + message + "】没有收到服务器反馈"; // CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
// LogUtil.info(logName + " 没有收到服务器反馈 "); LogUtil.info(logName + " 没有收到服务器反馈 ");
// } }
// else if (!string.IsNullOrEmpty(resultOperation.msg)) else if (!string.IsNullOrEmpty(resultOperation.msg))
// { {
// //如果有提示消息,直接显示提示 //如果有提示消息,直接显示提示
// LogUtil.info(logName + "服务器反馈 :" + resultOperation.msg); LogUtil.info(logName + "服务器反馈 :" + resultOperation.msg);
// } }
// else if (resultOperation.op.Equals(1)) else if (resultOperation.op.Equals(1))
// { {
// LogUtil.info(logName + " 成功"); LogUtil.info(logName + " 成功");
// return true; return true;
// } }
// else else
// { {
// LogUtil.info(logName + "服务器反馈 :" + JsonHelper.SerializeObject(resultOperation)); LogUtil.info(logName + "服务器反馈 :" + JsonHelper.SerializeObject(resultOperation));
// } }
// break; break;
// } }
// } }
// catch (Exception ex) catch (Exception ex)
// { {
// LogUtil.info(logName + " 出错:" + ex.ToString()); LogUtil.info(logName + " 出错:" + ex.ToString());
// } }
// return false; return false;
//} }
//public string LastVisualRfid = ""; public string LastVisualRfid = "";
string lastdataStr = ""; string lastdataStr = "";
private void ReviceOutStoreProcess(TaskData resultOperation) private void ReviceOutStoreProcess(TaskData resultOperation)
{ {
......
...@@ -111,14 +111,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -111,14 +111,15 @@ namespace OnlineStore.DeviceLibrary
NextMoveStep(StepEnum.InStore_16_ArmBackToP1, "在NG箱放料完成,清除机器人料叉缓存,机械臂回待机点"); NextMoveStep(StepEnum.InStore_16_ArmBackToP1, "在NG箱放料完成,清除机器人料叉缓存,机械臂回待机点");
//在料仓口口放料完成 //在料仓口口放料完成
BufferDataManager.TrayInRobotInfo = null; BufferDataManager.TrayInRobotInfo = null;
// UpdateLocInfo(MoveInfo.MoveParam.PosInfo.barcode, TaskStatus.BOXDOOR); // UpdateLocInfo(MoveInfo.MoveParam.PosInfo.barcode, TaskStatus.BOXDOOR);
InStore_16_ArmBackToP1(); InStore_16_ArmBackToP1();
break; break;
#endregion #endregion
case StepEnum.InStore_16_ArmBackToP1: case StepEnum.InStore_16_ArmBackToP1:
NextMoveStep(StepEnum.InStore_17_Finish, "入库结束"); NextMoveStep(StepEnum.InStore_17_Finish, "入库结束");
UpdateLocInfo(MoveInfo.MoveParam.PosInfo, TaskStatus.BOXDOOR); if (CheckInstoreTrayTarget())
UpdateLocInfo(MoveInfo.MoveParam.PosInfo, TaskStatus.BOXDOOR);
InStore_17_Finish(); InStore_17_Finish();
break; break;
case StepEnum.InStore_17_Finish: case StepEnum.InStore_17_Finish:
...@@ -145,11 +146,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -145,11 +146,11 @@ namespace OnlineStore.DeviceLibrary
} }
private bool InStore_04_CheckInletState() private bool InStore_04_CheckInletState()
{ {
if (MoveInfo.MoveParam.PosInfo!=null) if (MoveInfo.MoveParam.PosInfo != null)
return true; return true;
return false; return false;
} }
private void InStore_05_ArmToTrayLow(int width=7) private void InStore_05_ArmToTrayLow(int width = 7)
{ {
if (width == 7 || width == 13) if (width == 7 || width == 13)
SendCmd(GetCmd_InletLow(width)); SendCmd(GetCmd_InletLow(width));
...@@ -220,12 +221,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -220,12 +221,12 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
/// <param name="posinfo"></param> /// <param name="posinfo"></param>
/// <param name="status"></param> /// <param name="status"></param>
private void UpdateLocInfo(InOutPosInfo posinfo,string status) private void UpdateLocInfo(InOutPosInfo posinfo, string status)
{ {
string result=SServerManager.UpdateTrayLoc(posinfo.barcode, status, posinfo.PosId,posinfo.taskId); string result = SServerManager.UpdateTrayLoc(posinfo.barcode, status, posinfo.PosId, posinfo.taskId);
if(!result.Equals("")) if (!result.Equals(""))
{ {
SServerManager.UpdateTrayLoc(posinfo.barcode, status, posinfo.PosId,posinfo.taskId); SServerManager.UpdateTrayLoc(posinfo.barcode, status, posinfo.PosId, posinfo.taskId);
} }
} }
} }
......
...@@ -49,7 +49,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -49,7 +49,8 @@ namespace OnlineStore.DeviceLibrary
OutStore_07_ArmBackToP1(); OutStore_07_ArmBackToP1();
break; break;
case StepEnum.OutStore_07_ArmBackToP1: case StepEnum.OutStore_07_ArmBackToP1:
NextMoveStep(StepEnum.OutStore_08_MoveAxisToOutlet, "行走机构到出料口"); NextMoveStep(StepEnum.OutStore_08_MoveAxisToOutlet, "机械臂到待机点,上报状态,行走机构到出料口");
UpdateLocInfo(MoveInfo.MoveParam.PosInfo, TaskStatus.INROBOT);
OutStore_08_MoveAxisToOutlet(); OutStore_08_MoveAxisToOutlet();
break; break;
case StepEnum.OutStore_08_MoveAxisToOutlet: case StepEnum.OutStore_08_MoveAxisToOutlet:
...@@ -104,7 +105,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -104,7 +105,6 @@ namespace OnlineStore.DeviceLibrary
{ {
//添加机器人缓存,并上报任务状态 //添加机器人缓存,并上报任务状态
BufferDataManager.TrayInRobotInfo = MoveInfo.MoveParam.PosInfo.ToCopy(); BufferDataManager.TrayInRobotInfo = MoveInfo.MoveParam.PosInfo.ToCopy();
UpdateLocInfo(MoveInfo.MoveParam.PosInfo, TaskStatus.INROBOT);
SendCmd(GetCmd_Standby()); SendCmd(GetCmd_Standby());
} }
......
...@@ -68,6 +68,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -68,6 +68,7 @@ namespace OnlineStore.DeviceLibrary
return sb.ToString(); return sb.ToString();
} }
string cmdResponse = ""; string cmdResponse = "";
bool robotOnline = true;
/// <summary> /// <summary>
/// 机器人移动成功 /// 机器人移动成功
/// </summary> /// </summary>
...@@ -83,6 +84,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -83,6 +84,7 @@ namespace OnlineStore.DeviceLibrary
if (!bean.RobotData.Online) if (!bean.RobotData.Online)
{ {
SetWarnMsg("无法读取机器人状态,因机器人离线"); SetWarnMsg("无法读取机器人状态,因机器人离线");
robotOnline = false;
return false; return false;
} }
else else
...@@ -91,6 +93,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -91,6 +93,17 @@ namespace OnlineStore.DeviceLibrary
} }
try try
{ {
if (robotOnline && bean.RobotData.RecvMsg.Equals("") && (DateTime.Now - sendTime).TotalSeconds > 10)
{
SendCmd(curcmd);
LogUtil.info($"机器人命令10秒内未收到反馈,重发命令:【{curcmd}】");
}
if (!robotOnline && bean.RobotData.RecvMsg.Contains("home") && bean.RobotData.RecvMsg.Contains("done"))
{
SendCmd(curcmd);
LogUtil.info($"重发机器人离线前的命令:【{curcmd}】");
robotOnline = true;
}
if (!cmdResponse.Equals(bean.RobotData.RecvMsg) && !bean.RobotData.RecvMsg.Equals("")) if (!cmdResponse.Equals(bean.RobotData.RecvMsg) && !bean.RobotData.RecvMsg.Equals(""))
{ {
cmdResponse = bean.RobotData.RecvMsg; cmdResponse = bean.RobotData.RecvMsg;
...@@ -137,6 +150,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -137,6 +150,7 @@ namespace OnlineStore.DeviceLibrary
return insafeAtOutlet; return insafeAtOutlet;
} }
public string curcmd = ""; public string curcmd = "";
DateTime sendTime = DateTime.Now;
/// <summary> /// <summary>
/// 发送命令 /// 发送命令
/// </summary> /// </summary>
...@@ -160,6 +174,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -160,6 +174,7 @@ namespace OnlineStore.DeviceLibrary
ClearSpecifiedAlarm("无法发送命令,因机器人离线"); ClearSpecifiedAlarm("无法发送命令,因机器人离线");
} }
JAKAServer.SendCmd(bean.RemoteEndPoint, cmd); JAKAServer.SendCmd(bean.RemoteEndPoint, cmd);
sendTime = DateTime.Now;
LogUtil.info($"Send RobotMove Cmd:【{cmd}】"); LogUtil.info($"Send RobotMove Cmd:【{cmd}】");
} }
/// <summary> /// <summary>
...@@ -263,9 +278,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -263,9 +278,15 @@ namespace OnlineStore.DeviceLibrary
if (GetRobotInfo(out JAKA.JAKABean bean)) if (GetRobotInfo(out JAKA.JAKABean bean))
{ {
if (on) if (on)
bean.PowerOn(); {
if (bean.RobotData.RobotStatus.powered_on == 0)
bean.PowerOn();
}
else else
bean.PowerOff(); {
if (bean.RobotData.RobotStatus.powered_on == 1)
bean.PowerOff();
}
} }
} }
/// <summary> /// <summary>
...@@ -277,9 +298,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -277,9 +298,16 @@ namespace OnlineStore.DeviceLibrary
if (GetRobotInfo(out JAKA.JAKABean bean)) if (GetRobotInfo(out JAKA.JAKABean bean))
{ {
if (enable) if (enable)
bean.EnableRobot(); {
if (bean.RobotData.RobotStatus.enabled == 0)
bean.EnableRobot();
}
else else
bean.DisableRobot(); {
if (bean.RobotData.RobotStatus.enabled == 1)
bean.DisableRobot();
}
} }
} }
...@@ -292,7 +320,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -292,7 +320,10 @@ namespace OnlineStore.DeviceLibrary
if (GetRobotInfo(out JAKA.JAKABean bean)) if (GetRobotInfo(out JAKA.JAKABean bean))
{ {
if (start) if (start)
{
bean.Run(); bean.Run();
}
else else
bean.Abort(); bean.Abort();
} }
......
...@@ -15,7 +15,7 @@ namespace JAKA ...@@ -15,7 +15,7 @@ namespace JAKA
int rtn = jakaAPI.create_handler(ip.ToCharArray(),ref _handle); int rtn = jakaAPI.create_handler(ip.ToCharArray(),ref _handle);
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"CreateHandler OK"); InfoLog($"CreateHandler OK");
//SetErrorHandler(); //SetErrorHandler();
SetErrorCodeFilePath(Application.StartupPath+ @"\jaka_files\JAKA_ERROR_CODE.csv"); SetErrorCodeFilePath(Application.StartupPath+ @"\jaka_files\JAKA_ERROR_CODE.csv");
return true; return true;
...@@ -35,7 +35,7 @@ namespace JAKA ...@@ -35,7 +35,7 @@ namespace JAKA
int rtn = jakaAPI.set_error_handler(ref _handle, user_error_handle); int rtn = jakaAPI.set_error_handler(ref _handle, user_error_handle);
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"SetErrorHandler OK"); InfoLog($"SetErrorHandler OK");
return true; return true;
} }
else else
...@@ -53,7 +53,7 @@ namespace JAKA ...@@ -53,7 +53,7 @@ namespace JAKA
int rtn = jakaAPI.destory_handler(ref _handle); int rtn = jakaAPI.destory_handler(ref _handle);
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"DestroyHandler OK"); InfoLog($"DestroyHandler OK");
return true; return true;
} }
else else
...@@ -71,7 +71,7 @@ namespace JAKA ...@@ -71,7 +71,7 @@ namespace JAKA
int rtn = jakaAPI.power_on(ref _handle); int rtn = jakaAPI.power_on(ref _handle);
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"PowerOn OK"); InfoLog($"PowerOn OK");
return true; return true;
} }
else else
...@@ -88,7 +88,7 @@ namespace JAKA ...@@ -88,7 +88,7 @@ namespace JAKA
int rtn = jakaAPI.power_off(ref _handle); int rtn = jakaAPI.power_off(ref _handle);
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"PowerOff OK"); InfoLog($"PowerOff OK");
return true; return true;
} }
else else
...@@ -105,7 +105,7 @@ namespace JAKA ...@@ -105,7 +105,7 @@ namespace JAKA
int rtn = jakaAPI.shut_down(ref _handle); int rtn = jakaAPI.shut_down(ref _handle);
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"ShutDown OK"); InfoLog($"ShutDown OK");
return true; return true;
} }
else else
...@@ -122,7 +122,7 @@ namespace JAKA ...@@ -122,7 +122,7 @@ namespace JAKA
int rtn = jakaAPI.enable_robot(ref _handle); int rtn = jakaAPI.enable_robot(ref _handle);
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"EnableRobot OK"); InfoLog($"EnableRobot OK");
return true; return true;
} }
else else
...@@ -139,7 +139,7 @@ namespace JAKA ...@@ -139,7 +139,7 @@ namespace JAKA
int rtn = jakaAPI.disable_robot(ref _handle); int rtn = jakaAPI.disable_robot(ref _handle);
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"DisableRobot OK"); InfoLog($"DisableRobot OK");
return true; return true;
} }
else else
...@@ -388,7 +388,7 @@ namespace JAKA ...@@ -388,7 +388,7 @@ namespace JAKA
/// <param name="index">DI 索引(从 0 开始)</param> /// <param name="index">DI 索引(从 0 开始)</param>
/// <param name="value">DI 状态查询结果</param> /// <param name="value">DI 状态查询结果</param>
/// <returns></returns> /// <returns></returns>
bool GetDigitalInput(JKTYPE.IOType iOType, int index,out bool result) public bool GetDigitalInput(JKTYPE.IOType iOType, int index,out bool result)
{ {
result = false; result = false;
int rtn = jakaAPI.get_digital_input(ref _handle, iOType, index,ref result); int rtn = jakaAPI.get_digital_input(ref _handle, iOType, index,ref result);
...@@ -410,7 +410,7 @@ namespace JAKA ...@@ -410,7 +410,7 @@ namespace JAKA
/// <param name="index">DO 索引(从 0 开始)</param> /// <param name="index">DO 索引(从 0 开始)</param>
/// <param name="value">DO 状态查询结果</param> /// <param name="value">DO 状态查询结果</param>
/// <returns></returns> /// <returns></returns>
bool GetDigitalOutput(JKTYPE.IOType iOType, int index, out bool result) public bool GetDigitalOutput(JKTYPE.IOType iOType, int index, out bool result)
{ {
result = false; result = false;
int rtn = jakaAPI.get_digital_output(ref _handle, iOType, index, ref result); int rtn = jakaAPI.get_digital_output(ref _handle, iOType, index, ref result);
...@@ -433,7 +433,7 @@ namespace JAKA ...@@ -433,7 +433,7 @@ namespace JAKA
int rtn = jakaAPI.program_run(ref _handle); int rtn = jakaAPI.program_run(ref _handle);
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"Run OK"); InfoLog($"Run OK");
return false; return false;
} }
else else
...@@ -450,7 +450,7 @@ namespace JAKA ...@@ -450,7 +450,7 @@ namespace JAKA
int rtn = jakaAPI.program_pause(ref _handle); int rtn = jakaAPI.program_pause(ref _handle);
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"Pause OK"); InfoLog($"Pause OK");
return false; return false;
} }
else else
...@@ -467,7 +467,7 @@ namespace JAKA ...@@ -467,7 +467,7 @@ namespace JAKA
int rtn = jakaAPI.program_resume(ref _handle); int rtn = jakaAPI.program_resume(ref _handle);
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"Resume OK"); InfoLog($"Resume OK");
return false; return false;
} }
else else
...@@ -485,7 +485,7 @@ namespace JAKA ...@@ -485,7 +485,7 @@ namespace JAKA
int rtn = jakaAPI.program_abort(ref _handle); int rtn = jakaAPI.program_abort(ref _handle);
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"Abort OK"); InfoLog($"Abort OK");
return true; return true;
} }
else else
...@@ -504,7 +504,7 @@ namespace JAKA ...@@ -504,7 +504,7 @@ namespace JAKA
int rtn = jakaAPI.program_load(ref _handle,file.ToCharArray()); int rtn = jakaAPI.program_load(ref _handle,file.ToCharArray());
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"Load OK"); InfoLog($"Load OK");
return true; return true;
} }
else else
...@@ -696,7 +696,7 @@ namespace JAKA ...@@ -696,7 +696,7 @@ namespace JAKA
int rtn = jakaAPI.is_in_pos(ref _handle, ref inPos); int rtn = jakaAPI.is_in_pos(ref _handle, ref inPos);
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"IsInPos OK"); InfoLog($"IsInPos OK");
return true; return true;
} }
else else
...@@ -930,7 +930,7 @@ namespace JAKA ...@@ -930,7 +930,7 @@ namespace JAKA
int rtn = jakaAPI.clear_error(ref _handle); int rtn = jakaAPI.clear_error(ref _handle);
if (rtn == RtnCode.ERR_SUCC) if (rtn == RtnCode.ERR_SUCC)
{ {
DebugLog($"ClearError OK"); InfoLog($"ClearError OK");
return true; return true;
} }
else else
......
...@@ -47,6 +47,7 @@ namespace JAKA ...@@ -47,6 +47,7 @@ namespace JAKA
/// </summary> /// </summary>
public int ScanRate = 300; public int ScanRate = 300;
RobotData robotData = new RobotData(); RobotData robotData = new RobotData();
string err = "";
private void UpdateData() private void UpdateData()
{ {
try try
...@@ -61,7 +62,12 @@ namespace JAKA ...@@ -61,7 +62,12 @@ namespace JAKA
{ {
if (GetLastError(ref error)) if (GetLastError(ref error))
{ {
robotData.Errorinfo = $"运行异常:{string.Join("", error.message)}[{error.code}]"; robotData.Errorinfo = $"运行异常:【{error.code}】【{string.Join("", error.message)}】";
if(!err.Equals(robotData.Errorinfo))
{
err = robotData.Errorinfo;
log.Error(err);
}
} }
else else
{ {
...@@ -79,6 +85,7 @@ namespace JAKA ...@@ -79,6 +85,7 @@ namespace JAKA
robotData.Online = RobotData.Online; robotData.Online = RobotData.Online;
robotData.CurCmd = RobotData.CurCmd; robotData.CurCmd = RobotData.CurCmd;
robotData.RecvMsg = RobotData.RecvMsg; robotData.RecvMsg = RobotData.RecvMsg;
log.Info($"Update Robot Data:【{RobotData.CurCmd}】【{RobotData.RecvMsg}】【{RobotData.Errorinfo}】");
UpdateDataEvent?.Invoke(robotData); UpdateDataEvent?.Invoke(robotData);
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
this.lblestop = new System.Windows.Forms.Label(); this.lblestop = new System.Windows.Forms.Label();
this.lblpoweredon = new System.Windows.Forms.Label(); this.lblpoweredon = new System.Windows.Forms.Label();
this.lblservoenabled = new System.Windows.Forms.Label(); this.lblservoenabled = new System.Windows.Forms.Label();
...@@ -38,19 +39,21 @@ ...@@ -38,19 +39,21 @@
this.lblonsoftlimit = new System.Windows.Forms.Label(); this.lblonsoftlimit = new System.Windows.Forms.Label();
this.lbldragstatus = new System.Windows.Forms.Label(); this.lbldragstatus = new System.Windows.Forms.Label();
this.lblsdkconnect = new System.Windows.Forms.Label(); this.lblsdkconnect = new System.Windows.Forms.Label();
this.btnPowerOn = new System.Windows.Forms.Button();
this.btnPowerOff = new System.Windows.Forms.Button();
this.btnDisable = new System.Windows.Forms.Button();
this.btnEnable = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button(); this.btnStop = new System.Windows.Forms.Button();
this.btnStart = new System.Windows.Forms.Button(); this.btnStart = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button();
this.lblSafe = new System.Windows.Forms.Label();
this.btnRun = new System.Windows.Forms.Button(); this.btnRun = new System.Windows.Forms.Button();
this.lblresponse = new System.Windows.Forms.Label(); this.lblresponse = new System.Windows.Forms.Label();
this.btnSend = new System.Windows.Forms.Button(); this.btnSend = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox(); this.comboBox1 = new System.Windows.Forms.ComboBox();
this.lblCmd = new System.Windows.Forms.Label(); this.lblCmd = new System.Windows.Forms.Label();
this.lblProgramstate = new System.Windows.Forms.Label(); this.lblProgramstate = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -87,7 +90,7 @@ ...@@ -87,7 +90,7 @@
// lblerrorcode // lblerrorcode
// //
this.lblerrorcode.AutoSize = true; this.lblerrorcode.AutoSize = true;
this.lblerrorcode.Location = new System.Drawing.Point(242, 92); this.lblerrorcode.Location = new System.Drawing.Point(14, 119);
this.lblerrorcode.Name = "lblerrorcode"; this.lblerrorcode.Name = "lblerrorcode";
this.lblerrorcode.Size = new System.Drawing.Size(41, 12); this.lblerrorcode.Size = new System.Drawing.Size(41, 12);
this.lblerrorcode.TabIndex = 3; this.lblerrorcode.TabIndex = 3;
...@@ -106,7 +109,7 @@ ...@@ -106,7 +109,7 @@
// lblrapidrate // lblrapidrate
// //
this.lblrapidrate.AutoSize = true; this.lblrapidrate.AutoSize = true;
this.lblrapidrate.Location = new System.Drawing.Point(291, 59); this.lblrapidrate.Location = new System.Drawing.Point(313, 59);
this.lblrapidrate.Name = "lblrapidrate"; this.lblrapidrate.Name = "lblrapidrate";
this.lblrapidrate.Size = new System.Drawing.Size(53, 12); this.lblrapidrate.Size = new System.Drawing.Size(53, 12);
this.lblrapidrate.TabIndex = 5; this.lblrapidrate.TabIndex = 5;
...@@ -152,56 +155,12 @@ ...@@ -152,56 +155,12 @@
this.lblsdkconnect.TabIndex = 9; this.lblsdkconnect.TabIndex = 9;
this.lblsdkconnect.Text = "SDK与控制器连接"; this.lblsdkconnect.Text = "SDK与控制器连接";
// //
// btnPowerOn
//
this.btnPowerOn.BackColor = System.Drawing.Color.GreenYellow;
this.btnPowerOn.Location = new System.Drawing.Point(16, 123);
this.btnPowerOn.Name = "btnPowerOn";
this.btnPowerOn.Size = new System.Drawing.Size(99, 43);
this.btnPowerOn.TabIndex = 10;
this.btnPowerOn.Text = "打开本体电源";
this.btnPowerOn.UseVisualStyleBackColor = false;
this.btnPowerOn.Click += new System.EventHandler(this.btnPowerOn_Click);
//
// btnPowerOff
//
this.btnPowerOff.BackColor = System.Drawing.Color.DeepPink;
this.btnPowerOff.Location = new System.Drawing.Point(16, 172);
this.btnPowerOff.Name = "btnPowerOff";
this.btnPowerOff.Size = new System.Drawing.Size(99, 43);
this.btnPowerOff.TabIndex = 11;
this.btnPowerOff.Text = "关闭本体电源";
this.btnPowerOff.UseVisualStyleBackColor = false;
this.btnPowerOff.Click += new System.EventHandler(this.btnPowerOff_Click);
//
// btnDisable
//
this.btnDisable.BackColor = System.Drawing.Color.DeepPink;
this.btnDisable.Location = new System.Drawing.Point(125, 172);
this.btnDisable.Name = "btnDisable";
this.btnDisable.Size = new System.Drawing.Size(99, 43);
this.btnDisable.TabIndex = 13;
this.btnDisable.Text = "关闭使能";
this.btnDisable.UseVisualStyleBackColor = false;
this.btnDisable.Click += new System.EventHandler(this.btnDisable_Click);
//
// btnEnable
//
this.btnEnable.BackColor = System.Drawing.Color.GreenYellow;
this.btnEnable.Location = new System.Drawing.Point(125, 123);
this.btnEnable.Name = "btnEnable";
this.btnEnable.Size = new System.Drawing.Size(99, 43);
this.btnEnable.TabIndex = 12;
this.btnEnable.Text = "打开使能";
this.btnEnable.UseVisualStyleBackColor = false;
this.btnEnable.Click += new System.EventHandler(this.btnEnable_Click);
//
// btnStop // btnStop
// //
this.btnStop.BackColor = System.Drawing.Color.DeepPink; this.btnStop.BackColor = System.Drawing.Color.DeepPink;
this.btnStop.Location = new System.Drawing.Point(230, 172); this.btnStop.Location = new System.Drawing.Point(102, 195);
this.btnStop.Name = "btnStop"; this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(99, 43); this.btnStop.Size = new System.Drawing.Size(73, 43);
this.btnStop.TabIndex = 15; this.btnStop.TabIndex = 15;
this.btnStop.Text = "停止程序"; this.btnStop.Text = "停止程序";
this.btnStop.UseVisualStyleBackColor = false; this.btnStop.UseVisualStyleBackColor = false;
...@@ -210,9 +169,9 @@ ...@@ -210,9 +169,9 @@
// btnStart // btnStart
// //
this.btnStart.BackColor = System.Drawing.Color.GreenYellow; this.btnStart.BackColor = System.Drawing.Color.GreenYellow;
this.btnStart.Location = new System.Drawing.Point(230, 123); this.btnStart.Location = new System.Drawing.Point(102, 146);
this.btnStart.Name = "btnStart"; this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(99, 43); this.btnStart.Size = new System.Drawing.Size(73, 43);
this.btnStart.TabIndex = 14; this.btnStart.TabIndex = 14;
this.btnStart.Text = "运行程序"; this.btnStart.Text = "运行程序";
this.btnStart.UseVisualStyleBackColor = false; this.btnStart.UseVisualStyleBackColor = false;
...@@ -220,22 +179,23 @@ ...@@ -220,22 +179,23 @@
// //
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.button4);
this.groupBox1.Controls.Add(this.button3);
this.groupBox1.Controls.Add(this.button2);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.lblSafe);
this.groupBox1.Controls.Add(this.btnRun); this.groupBox1.Controls.Add(this.btnRun);
this.groupBox1.Controls.Add(this.lblresponse); this.groupBox1.Controls.Add(this.lblresponse);
this.groupBox1.Controls.Add(this.btnSend); this.groupBox1.Controls.Add(this.btnSend);
this.groupBox1.Controls.Add(this.comboBox1); this.groupBox1.Controls.Add(this.comboBox1);
this.groupBox1.Controls.Add(this.lblCmd); this.groupBox1.Controls.Add(this.lblCmd);
this.groupBox1.Controls.Add(this.lblProgramstate); this.groupBox1.Controls.Add(this.lblProgramstate);
this.groupBox1.Controls.Add(this.btnPowerOn);
this.groupBox1.Controls.Add(this.btnStop); this.groupBox1.Controls.Add(this.btnStop);
this.groupBox1.Controls.Add(this.lblestop); this.groupBox1.Controls.Add(this.lblestop);
this.groupBox1.Controls.Add(this.btnStart); this.groupBox1.Controls.Add(this.btnStart);
this.groupBox1.Controls.Add(this.lblpoweredon); this.groupBox1.Controls.Add(this.lblpoweredon);
this.groupBox1.Controls.Add(this.btnDisable);
this.groupBox1.Controls.Add(this.lblservoenabled); this.groupBox1.Controls.Add(this.lblservoenabled);
this.groupBox1.Controls.Add(this.btnEnable);
this.groupBox1.Controls.Add(this.lblerrorcode); this.groupBox1.Controls.Add(this.lblerrorcode);
this.groupBox1.Controls.Add(this.btnPowerOff);
this.groupBox1.Controls.Add(this.lblinpos); this.groupBox1.Controls.Add(this.lblinpos);
this.groupBox1.Controls.Add(this.lblrapidrate); this.groupBox1.Controls.Add(this.lblrapidrate);
this.groupBox1.Controls.Add(this.lblsdkconnect); this.groupBox1.Controls.Add(this.lblsdkconnect);
...@@ -244,25 +204,46 @@ ...@@ -244,25 +204,46 @@
this.groupBox1.Controls.Add(this.lblonsoftlimit); this.groupBox1.Controls.Add(this.lblonsoftlimit);
this.groupBox1.Location = new System.Drawing.Point(3, 3); this.groupBox1.Location = new System.Drawing.Point(3, 3);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(418, 292); this.groupBox1.Size = new System.Drawing.Size(451, 260);
this.groupBox1.TabIndex = 16; this.groupBox1.TabIndex = 16;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
// //
// button1
//
this.button1.BackColor = System.Drawing.Color.SandyBrown;
this.button1.Location = new System.Drawing.Point(340, 146);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(71, 43);
this.button1.TabIndex = 24;
this.button1.Text = "清除错误";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// lblSafe
//
this.lblSafe.AutoSize = true;
this.lblSafe.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblSafe.Location = new System.Drawing.Point(252, 59);
this.lblSafe.Name = "lblSafe";
this.lblSafe.Size = new System.Drawing.Size(55, 14);
this.lblSafe.TabIndex = 23;
this.lblSafe.Text = "安全位置";
//
// btnRun // btnRun
// //
this.btnRun.BackColor = System.Drawing.Color.GreenYellow; this.btnRun.BackColor = System.Drawing.Color.GreenYellow;
this.btnRun.Location = new System.Drawing.Point(335, 140); this.btnRun.Location = new System.Drawing.Point(14, 146);
this.btnRun.Name = "btnRun"; this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(69, 59); this.btnRun.Size = new System.Drawing.Size(82, 43);
this.btnRun.TabIndex = 21; this.btnRun.TabIndex = 21;
this.btnRun.Text = "一键启动"; this.btnRun.Text = "上电使能";
this.btnRun.UseVisualStyleBackColor = false; this.btnRun.UseVisualStyleBackColor = false;
this.btnRun.Click += new System.EventHandler(this.btnRun_Click); this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
// //
// lblresponse // lblresponse
// //
this.lblresponse.AutoSize = true; this.lblresponse.AutoSize = true;
this.lblresponse.Location = new System.Drawing.Point(114, 92); this.lblresponse.Location = new System.Drawing.Point(213, 92);
this.lblresponse.Name = "lblresponse"; this.lblresponse.Name = "lblresponse";
this.lblresponse.Size = new System.Drawing.Size(53, 12); this.lblresponse.Size = new System.Drawing.Size(53, 12);
this.lblresponse.TabIndex = 20; this.lblresponse.TabIndex = 20;
...@@ -270,9 +251,9 @@ ...@@ -270,9 +251,9 @@
// //
// btnSend // btnSend
// //
this.btnSend.Location = new System.Drawing.Point(215, 235); this.btnSend.Location = new System.Drawing.Point(340, 200);
this.btnSend.Name = "btnSend"; this.btnSend.Name = "btnSend";
this.btnSend.Size = new System.Drawing.Size(99, 43); this.btnSend.Size = new System.Drawing.Size(71, 38);
this.btnSend.TabIndex = 19; this.btnSend.TabIndex = 19;
this.btnSend.Text = "发送命令"; this.btnSend.Text = "发送命令";
this.btnSend.UseVisualStyleBackColor = true; this.btnSend.UseVisualStyleBackColor = true;
...@@ -280,10 +261,9 @@ ...@@ -280,10 +261,9 @@
// //
// comboBox1 // comboBox1
// //
this.comboBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comboBox1.FormattingEnabled = true; this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] { this.comboBox1.Items.AddRange(new object[] {
"home",
"standby",
"store1-high", "store1-high",
"store1-low", "store1-low",
"store2-high", "store2-high",
...@@ -305,9 +285,9 @@ ...@@ -305,9 +285,9 @@
"inlet-up", "inlet-up",
"outlet-down", "outlet-down",
"ngbox-down"}); "ngbox-down"});
this.comboBox1.Location = new System.Drawing.Point(16, 247); this.comboBox1.Location = new System.Drawing.Point(200, 214);
this.comboBox1.Name = "comboBox1"; this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(137, 20); this.comboBox1.Size = new System.Drawing.Size(116, 24);
this.comboBox1.TabIndex = 18; this.comboBox1.TabIndex = 18;
// //
// lblCmd // lblCmd
...@@ -323,19 +303,58 @@ ...@@ -323,19 +303,58 @@
// //
this.lblProgramstate.AutoSize = true; this.lblProgramstate.AutoSize = true;
this.lblProgramstate.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.lblProgramstate.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblProgramstate.Location = new System.Drawing.Point(200, 59); this.lblProgramstate.Location = new System.Drawing.Point(191, 59);
this.lblProgramstate.Name = "lblProgramstate"; this.lblProgramstate.Name = "lblProgramstate";
this.lblProgramstate.Size = new System.Drawing.Size(55, 14); this.lblProgramstate.Size = new System.Drawing.Size(55, 14);
this.lblProgramstate.TabIndex = 16; this.lblProgramstate.TabIndex = 16;
this.lblProgramstate.Text = "程序运行"; this.lblProgramstate.Text = "程序运行";
// //
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// button2
//
this.button2.BackColor = System.Drawing.Color.PaleGoldenrod;
this.button2.Location = new System.Drawing.Point(181, 146);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(71, 43);
this.button2.TabIndex = 25;
this.button2.Text = "回零";
this.button2.UseVisualStyleBackColor = false;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.BackColor = System.Drawing.Color.Turquoise;
this.button3.Location = new System.Drawing.Point(262, 146);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(71, 43);
this.button3.TabIndex = 26;
this.button3.Text = "回待机点";
this.button3.UseVisualStyleBackColor = false;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.BackColor = System.Drawing.Color.DeepPink;
this.button4.Location = new System.Drawing.Point(16, 195);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(80, 43);
this.button4.TabIndex = 27;
this.button4.Text = "下电下使能";
this.button4.UseVisualStyleBackColor = false;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// UCRobot // UCRobot
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Name = "UCRobot"; this.Name = "UCRobot";
this.Size = new System.Drawing.Size(425, 298); this.Size = new System.Drawing.Size(457, 272);
this.Load += new System.EventHandler(this.UCRobot_Load);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
...@@ -353,10 +372,6 @@ ...@@ -353,10 +372,6 @@
private System.Windows.Forms.Label lblonsoftlimit; private System.Windows.Forms.Label lblonsoftlimit;
private System.Windows.Forms.Label lbldragstatus; private System.Windows.Forms.Label lbldragstatus;
private System.Windows.Forms.Label lblsdkconnect; private System.Windows.Forms.Label lblsdkconnect;
private System.Windows.Forms.Button btnPowerOn;
private System.Windows.Forms.Button btnPowerOff;
private System.Windows.Forms.Button btnDisable;
private System.Windows.Forms.Button btnEnable;
private System.Windows.Forms.Button btnStop; private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button btnStart; private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
...@@ -366,5 +381,11 @@ ...@@ -366,5 +381,11 @@
private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label lblresponse; private System.Windows.Forms.Label lblresponse;
private System.Windows.Forms.Button btnRun; private System.Windows.Forms.Button btnRun;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label lblSafe;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button4;
} }
} }
...@@ -21,14 +21,14 @@ namespace JAKA ...@@ -21,14 +21,14 @@ namespace JAKA
} }
private JAKABean jakaBean; private JAKABean jakaBean;
private JAKAServer server; private JAKAServer server;
public void Regidter(JAKABean jakabean,JAKAServer jAKAServer) public void Regidter(JAKABean jakabean, JAKAServer jAKAServer)
{ {
this.jakaBean = jakabean; this.jakaBean = jakabean;
groupBox1.Text = $"[{jakabean.IP}]"; groupBox1.Text = $"[{jakabean.IP}]";
server = jAKAServer; server = jAKAServer;
jakabean.RegisterUpdataEvent(Update); jakabean.RegisterUpdataEvent(Update);
} }
private void Update(RobotData robotData) public void Update(RobotData robotData)
{ {
if (!this.IsHandleCreated) if (!this.IsHandleCreated)
return; return;
...@@ -49,7 +49,7 @@ namespace JAKA ...@@ -49,7 +49,7 @@ namespace JAKA
{ {
lblProgramstate.BackColor = Color.Red; lblProgramstate.BackColor = Color.Red;
} }
else if(robotData.ProgramState.Equals(ProgramState.PROGRAM_PAUSED)) else if (robotData.ProgramState.Equals(ProgramState.PROGRAM_PAUSED))
{ {
lblProgramstate.BackColor = Color.Yellow; lblProgramstate.BackColor = Color.Yellow;
} }
...@@ -58,7 +58,7 @@ namespace JAKA ...@@ -58,7 +58,7 @@ namespace JAKA
lblProgramstate.BackColor = Color.YellowGreen; lblProgramstate.BackColor = Color.YellowGreen;
} }
lblCmd.Text = robotData.CurCmd; lblCmd.Text = robotData.CurCmd;
if(robotData.Online) if (robotData.Online)
{ {
groupBox1.Text = $"[{jakaBean.IP}][在线]"; groupBox1.Text = $"[{jakaBean.IP}][在线]";
} }
...@@ -108,7 +108,8 @@ namespace JAKA ...@@ -108,7 +108,8 @@ namespace JAKA
private void btnSend_Click(object sender, EventArgs e) private void btnSend_Click(object sender, EventArgs e)
{ {
Task.Factory.StartNew(() => { Task.Factory.StartNew(() =>
{
if (groupBox1.Text.Contains("在线")) if (groupBox1.Text.Contains("在线"))
{ {
string cmd = comboBox1.SelectedItem.ToString();//textBox1.Text; string cmd = comboBox1.SelectedItem.ToString();//textBox1.Text;
...@@ -121,12 +122,67 @@ namespace JAKA ...@@ -121,12 +122,67 @@ namespace JAKA
private void btnRun_Click(object sender, EventArgs e) private void btnRun_Click(object sender, EventArgs e)
{ {
Task.Factory.StartNew(() => { Task.Factory.StartNew(() =>
jakaBean.PowerOn(); {
System.Threading.Thread.Sleep(2000); if (jakaBean.PowerOn())
jakaBean.EnableRobot(); jakaBean.EnableRobot();
System.Threading.Thread.Sleep(2000); });
jakaBean.Run(); }
private void timer1_Tick(object sender, EventArgs e)
{
try
{
if (jakaBean.GetDigitalOutput(IOType.IO_CABINET, 0, out bool insafe))
{
lblSafe.BackColor = insafe ? Color.YellowGreen : Color.Red;
}
}
catch
{
}
}
private void UCRobot_Load(object sender, EventArgs e)
{
timer1.Start();
}
private void button1_Click(object sender, EventArgs e)
{
jakaBean.ClearError();
}
private void button2_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(() =>
{
if (groupBox1.Text.Contains("在线"))
{
server.SendCmd(jakaBean.RemoteEndPoint, "home");
}
});
}
private void button3_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(() =>
{
if (groupBox1.Text.Contains("在线"))
{
server.SendCmd(jakaBean.RemoteEndPoint, "standby");
}
});
}
private void button4_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(() =>
{
if (jakaBean.DisableRobot())
jakaBean.PowerOff();
}); });
} }
} }
......
...@@ -117,4 +117,7 @@ ...@@ -117,4 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!