Commit 5dd81603 LN

1

1 个父辈 c0f53016
......@@ -173,12 +173,13 @@ namespace DeviceLibrary
[HandleProcessCorruptedStateExceptions]
public static List<CodeInfo> CameraScan(List<string> cameraNameList)
{
{
HashSet<string> codestr = new HashSet<string>();
List<CodeInfo> codeList = new List<CodeInfo>();
string bitmapfilename = "";
if (cameraNameList == null || cameraNameList.Count <= 0)
{
return codeList;
throw new Exception("CameraScan方法没有传入相机名称.");
}
......
......@@ -37,7 +37,7 @@ namespace OnlineStore.DeviceLibrary.IO
return HCBoardManager.OpenCard();
}
}
return false;
return true;
}
public IO_VALUE GetDIValue(string deviceName, byte slaveID, ushort index)
......
......@@ -107,6 +107,10 @@ namespace DeviceLibrary
}
public bool ShelfValid()
{
if (CurrShelf == null)
{
return false;
}
//料架是否有效可放料
if (CurrShelf.realRFID != "" && CurrShelf.IsNeedLeave == false)
{
......
......@@ -28,7 +28,10 @@ namespace DeviceLibrary
InitializeComponent();
crc.OpenResourceLog = true;
crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
crc.CurrLanguage = Setting_Init.Device_Default_Language;
if (Setting_Init.Device_Default_Language != null)
{
crc.CurrLanguage = Setting_Init.Device_Default_Language;
}
}
private void Crc_LanguageChangeEvent(object sender, EventArgs e)
......@@ -38,6 +41,10 @@ namespace DeviceLibrary
public void LoadData(List<AxisBean> axisList, bool isHc = true)
{
if (axisList == null)
{
return;
}
//this.boxBean = equipBase;
this.axisList = axisList;
//axisList = new List<ConfigMoveAxis>(equipBase.Config.moveAxisList);
......
......@@ -66,15 +66,15 @@ DO,0,出料口4定位下降,U4_Location_Down,20,HC,Y20,,,,,,,,,,
PRO,50,IO信号超时时间(秒),IOSingle_TimerOut,5,,,,,,,,,,,,
PRO,0,气压检测超时,AirCheckSeconds,5,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,15,旋转轴待机点P1,Middle_P1,168460,,,50000,,,,,,,,,
PRO,10,旋转轴待机点P1,Middle_P1,168460,,,50000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,16,升降轴待机点P1,UpDown_P1,1006626,,,500000,,,,,,,,,
PRO,11,升降轴待机点P1,UpDown_P1,1006626,,,500000,,,,,,,,,
,16,升降轴每毫米脉冲,UpDown_PoToMM,1000,,,,,,,,,,,,
PRO,16,升降轴低速,UpDown_S1_Speed,1006626,,,,,,,,,,,,
PRO,11,升降轴低速,UpDown_S1_Speed,1006626,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,17,进出轴待机点P1,InOut_P1,0,,,500000,,,,,,,,,
PRO,12,进出轴待机点P1,InOut_P1,0,,,500000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,18,压紧轴待机点P1,Comp_P1,0,,,500000,,,,,,,,,
PRO,18,压紧轴8mm压紧点P2,Comp_P2,0,,,500000,,,,,,,,,
PRO,18,压紧轴库位高点偏移毫米,Comp_PH_MM,10,,,,,,,,,,,,
PRO,18,压紧轴每毫米脉冲,Comp_PoToMM,1000,,,,,,,,,,,,
PRO,13,压紧轴待机点P1,Comp_P1,0,,,500000,,,,,,,,,
PRO,13,压紧轴8mm压紧点P2,Comp_P2,0,,,500000,,,,,,,,,
PRO,13,压紧轴库位高点偏移毫米,Comp_PH_MM,10,,,,,,,,,,,,
PRO,50,压紧轴每毫米脉冲,Comp_PoToMM,1000,,,,,,,,,,,,
......@@ -16,23 +16,23 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// 中轴位置(旋转轴库位点)P2
/// </summary>
[CSVAttribute("旋转轴位置P2"), Editable("Middle_Axis")]
[CSVAttribute("旋转轴位置P2"), Editable("0")]
public int XAxis_Position_P2 { get; set; }
/// <summary>
/// 升降轴(库位入料前点)P3
/// </summary>
[CSVAttribute("升降轴库位入料高点P3"), Editable("UpDown_Axis")]
[CSVAttribute("升降轴库位入料高点P3"), Editable("1")]
public int UpDownAxis_IHPosition_P3 { get; set; }
/// <summary>
/// 升降轴(库位入料缓冲点)P4
/// </summary>
[CSVAttribute("升降轴库位入料低点P4"), Editable("UpDown_Axis")]
[CSVAttribute("升降轴库位入料低点P4"), Editable("1")]
public int UpDownAxis_ILPosition_P4 { get; set; }
/// <summary>
/// 进出轴(库位点取料点)P3
/// </summary>
[CSVAttribute("进出轴库位点取料点P3"), Editable("InOut_Axis")]
[CSVAttribute("进出轴库位点取料点P3"), Editable("2")]
public int InOutAxis_Position_P3 { get; set; }
/// <summary>
/// 备注
......
......@@ -31,6 +31,14 @@ namespace OnlineStore.LoadCSVLibrary
public static Dictionary<String, ConfigIO> AllDOlist { get; set; }
public static Dictionary<String, ConfigIO> AllDOEleclist { get; set; }
public void clearList()
{
this.DIList.Clear();
this.DOList.Clear();
this.moveAxisList.Clear();
this.configList.Clear();
}
public DeviceConfig()
{
......@@ -259,7 +267,6 @@ namespace OnlineStore.LoadCSVLibrary
}
return null;
}
}
public class DeviceType
{
......
......@@ -60,7 +60,7 @@ namespace TheMachine
this.configControl1.Location = new System.Drawing.Point(568, 3);
this.configControl1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.configControl1.Name = "configControl1";
this.configControl1.Size = new System.Drawing.Size(647, 627);
this.configControl1.Size = new System.Drawing.Size(647, 550);
this.configControl1.TabIndex = 1;
this.configControl1.Tag = "not";
//
......
......@@ -370,8 +370,9 @@ namespace TheMachine
private void MainMachine_ButtenEvent(object sender, ErrInfo e)
{
LogUtil.info("UI " + e.ToString());
if (e == ErrInfo.RunBtn || e == ErrInfo.ResetBtn)
{
if (e == ErrInfo.RunBtn )
//if (e == ErrInfo.RunBtn || e == ErrInfo.ResetBtn)
{
Task.Run(() => {
if (!RobotManage.isRunning)
......
......@@ -115,7 +115,7 @@ namespace TheMachine
button.Anchor = (AnchorStyles)(AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom);
button.Name = configBase.ProName;
button.Text = crc.GetString(configBase.ProName, configBase.Explain);
button.AutoSize = false;
button.AutoSize = true;
button.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
button.ForeColor = color;
tableLayoutPanel1.Controls.Add(button, c, r);
......@@ -229,8 +229,10 @@ namespace TheMachine
var targetSpeed = int.Parse(speed[0].Text);
var AddSpeed = configMoveAxis.AddSpeed > 0 ? configMoveAxis.AddSpeed : targetSpeed * 4;
var DelSpeed = configMoveAxis.DelSpeed > 0 ? configMoveAxis.DelSpeed : targetSpeed * 4;
LogUtil.info($"手动点击:{((Button)sender).Text},pos:{targetpos}");
AxisManager.AbsMove("", configMoveAxis.GetAxisValue(), targetpos, targetSpeed, AddSpeed, DelSpeed);//, configMoveAxis.AddSpeed, configMoveAxis.DelSpeed);
LogUtil.info($"手动点击:{((Button)sender).Text},pos:{targetpos}");
AxisManager.AbsMove("", configMoveAxis.GetAxisValue(), targetpos, targetSpeed, AddSpeed, DelSpeed);//, configMoveAxis.AddSpeed, configMoveAxis.DelSpeed);
}
AxisBean getConfigMoveAxis(int Axisid)
......@@ -284,9 +286,11 @@ namespace TheMachine
pi.SetValue(Config, textBox.Text);
}
}
CSVConfigReader.SaveConfig(Config.ConfigFilePath, Config);
CSVConfigReader.SaveConfig(Config.ConfigFilePath, Config);
Config.DIList.Clear();
Config.DOList.Clear();
Config.moveAxisList.Clear();
Config.configList.Clear();
Config = (Robot_Config)CSVConfigReader.LoadConfig(Config);
}
}
......
using DeviceLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
......@@ -187,7 +188,8 @@ namespace TheMachine
var cc = tableLayoutPanel1.Controls.Find(((Button)sender).Name, false);
var speed = tableLayoutPanel1.Controls.Find(((Button)sender).Name+ "_speed", false);
var axis = getConfigMoveAxis((int)((Button)sender).Tag);
string tag =(string) ((Button)sender).Tag;
var axis = getConfigMoveAxisByname(tag);
ConfigMoveAxis configMoveAxis = axis.Config;
var targetpos = int.Parse(cc[1].Text);
if (!axis.IsSafe(targetpos, out string msg))
......@@ -199,6 +201,7 @@ namespace TheMachine
var AddSpeed = configMoveAxis.AddSpeed > 0 ? configMoveAxis.AddSpeed : targetSpeed * 4;
var DelSpeed = configMoveAxis.DelSpeed > 0 ? configMoveAxis.DelSpeed : targetSpeed * 4;
AxisManager.AbsMove("", configMoveAxis.GetAxisValue(), int.Parse(cc[1].Text), targetSpeed, AddSpeed, DelSpeed);//, configMoveAxis.AddSpeed, configMoveAxis.DelSpeed);
LogUtil.info("Button_Click "+configMoveAxis.GetNameStr()+"【"+ configMoveAxis.GetAxisValue() + "】 【"+ int.Parse(cc[1].Text) + "】 【"+ targetSpeed + "】 ");
}
void setAxisPopup(Control c, string title, ConfigMoveAxis configMoveAxis)
{
......@@ -227,15 +230,24 @@ namespace TheMachine
{
//foreach (ConfigMoveAxis configMoveAxis in Config.moveAxisList)
//{
// if (configMoveAxis.GetAxisValue() == Axisid)
// if (configMoveAxis.GetAxisValue().ToString() == Axisid)
// return configMoveAxis;
//}
foreach (AxisBean configMoveAxis in AxisBean.List)
{
{
if (configMoveAxis.Config.ProName == Axisid)
return configMoveAxis;
}
return null;
foreach (AxisBean configMoveAxis in AxisBean.List)
{
if (configMoveAxis.Config.GetAxisValue().ToString() == Axisid)
{
return configMoveAxis;
}
}
return null;
}
private void ConfigControl_Load(object sender, EventArgs e)
{
......@@ -250,33 +262,50 @@ namespace TheMachine
private void btnSavePos_Click(object sender, EventArgs e)
{
for (int i = 0; i < tableLayoutPanel1.Controls.Count; i++)
try
{
if (tableLayoutPanel1.Controls[i].GetType().Name != "TextBox")
continue;
TextBox textBox = (TextBox)tableLayoutPanel1.Controls[i];
PropertyInfo pi = _aCStorePosition.GetType().GetProperty(textBox.Name);
if (pi != null)
for (int i = 0; i < tableLayoutPanel1.Controls.Count; i++)
{
//var cc = Config.configList.Find(new Predicate<ConfigBase>((c) => { return c.ProName == textBox.Name; }));
//if (cc != null)
// cc.ProValue = textBox.Text;
if (pi.PropertyType.Name == "Int32")
pi.SetValue(_aCStorePosition, int.Parse(textBox.Text));
else if (pi.PropertyType.Name == "Double")
pi.SetValue(_aCStorePosition, double.Parse(textBox.Text));
else
pi.SetValue(_aCStorePosition, textBox.Text);
if (tableLayoutPanel1.Controls[i].GetType().Name != "TextBox")
continue;
TextBox textBox = (TextBox)tableLayoutPanel1.Controls[i];
PropertyInfo pi = _aCStorePosition.GetType().GetProperty(textBox.Name);
if (pi != null)
{
//var cc = Config.configList.Find(new Predicate<ConfigBase>((c) => { return c.ProName == textBox.Name; }));
//if (cc != null)
// cc.ProValue = textBox.Text;
if (pi.PropertyType.Name == "Int32")
pi.SetValue(_aCStorePosition, int.Parse(textBox.Text));
else if (pi.PropertyType.Name == "Double")
pi.SetValue(_aCStorePosition, double.Parse(textBox.Text));
else
pi.SetValue(_aCStorePosition, textBox.Text);
}
}
}
var positionConfigFile = Path.Combine(Application.StartupPath, "config\\Magzine.csv");
var positionConfigFile1 = Path.Combine(Application.StartupPath, "config\\Orther.csv");
var positionConfigFile = Path.Combine(Application.StartupPath, "StoreConfig\\linePositions.csv");
var positionConfigFile1 = Path.Combine(Application.StartupPath, "StoreConfig\\fixPositions.csv");
bool result = CSVPositionReader<ACStorePosition>.SavePostion(positionConfigFile, _aCStorePosition);
result = CSVPositionReader<ACStorePosition>.SavePostion(positionConfigFile1, _aCStorePosition);
if (result)
{
MessageBox.Show("保存成功!");
}
else
{
bool result = CSVPositionReader<ACStorePosition>.SavePostion(positionConfigFile, _aCStorePosition);
result = CSVPositionReader<ACStorePosition>.SavePostion(positionConfigFile1, _aCStorePosition);
MessageBox.Show("保存失败!");
}
}
catch (Exception ex)
{
LogUtil.error("保存失败:" + ex.ToString());
MessageBox.Show("保存失败!" + ex.ToString());
}
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!