Commit d35479f7 几米阳光

修改名称,删除不需要的文件,增加新的自动料仓的配置

1 个父辈 7cc71f8b
正在显示 128 个修改的文件 包含 752 行增加5422 行删除
......@@ -5,7 +5,7 @@ VisualStudioVersion = 15.0.27130.2024
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACServoDriveTest", "source\ACServoDriveTest\ACServoDriveTest.csproj", "{7FA84E1E-BCDE-49F6-BE42-0BC397AF65B8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACSingleStore", "source\ACSingleStore\ACSingleStore.csproj", "{0D2542F5-DD62-4352-82D0-383D9A045E74}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoInOutStore", "source\ACSingleStore\AutoInOutStore.csproj", "{0D2542F5-DD62-4352-82D0-383D9A045E74}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "source\Common\Common.csproj", "{43CDD09E-FCF3-4960-A01D-3BBFE9933122}"
EndProject
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ACServoDriveTest
{
public class ACCMDManager
{
public static string ServerOn_Addr = "0060";
public static string STB_Addr = "0120";
public static string Stop_Addr = "0124";
public static string SDStop_Addr = "0123";
public static string Clear_Alarm_Addr = "0061";
/// <summary>
/// 目标位置=600B
/// </summary>
public static string TargetPostion = "600B";
/// <summary>
/// 实际位置=600F
/// </summary>
public static string ActualPosition = "600F";
/// <summary>
/// BUSY状态=0140
public static string BUSYStatus = "0140";
/// <summary>
/// HOME-CMP=0141
/// </summary>
public static string HOME_CMP_Status = "0141";
/// <summary>
/// 报警状态=00A1
/// </summary>
public static string Alarm_Status = "00A1";
/// <summary>
/// 指定BlockNo=4414
/// </summary>
public static string BlockNo = "4414";
/// <summary>
/// 读线圈01
/// </summary>
public static byte CMD_ReadCoil= 0x01;
/// <summary>
/// 写线圈 05
/// </summary>
public static byte CMD_WriteCoil = 0x05;
/// <summary>
/// 读寄存器03
/// </summary>
public static byte CMD_ReadRegisters = 0x03;
/// <summary>
/// 写寄存器06
/// </summary>
public static byte CMD_WriteRegisters = 0x06;
/// <summary>
/// 写多个线圈 0f
/// </summary>
public static byte CMD_WriteMCoil = 0x0F;
/// <summary>
/// 写多个寄存器10
/// </summary>
public static byte CMD_WriteMRegisters = 0x10;
public static byte[] buildCheckData(byte[] sendData, int length)
{
ushort pChecksum = 0;
SerialBean.CalculateCRC(sendData, length, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = SerialBean.StringToByte(checkStr);
if (checkByte.Length == 1)
{
sendData[length] = checkByte[0];
sendData[length + 1] = 0x00;
}
else
{
sendData[length + 1] = checkByte[0];
sendData[length] = checkByte[1];
}
return sendData;
}
public static byte[] GetWriteData(int slvAddr, byte cmd, string addr, string dataValue, int length)
{
// ( 2) 读取寄存器( 03h)
if (cmd.Equals(CMD_ReadRegisters))
{
return Get03WriteData(slvAddr, addr,length);
}
else if (cmd.Equals(CMD_WriteRegisters))
{
// ( 4) 写入寄存器( 06h)
return Get06WriteData(slvAddr, addr, dataValue);
}
else if (cmd.Equals(CMD_WriteCoil))
{
return Get05WriteData(slvAddr, addr, dataValue);
}
else if (cmd.Equals(CMD_ReadCoil))
{
return Get01WriteData(slvAddr, addr, length);
}
return null;
}
private static byte[] Get05WriteData(int slvAddr, string addr, string dataValue)
{
byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr;
sendData[1] = CMD_WriteCoil;
byte[] addrByte = SerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1)
{
sendData[2] = 0x00;
sendData[3] = addrByte[0];
}
else if (addrByte.Length == 2)
{
sendData[3] = addrByte[1];
sendData[2] = addrByte[0];
}
byte[] dataByte = SerialBean.StringToByte(dataValue);
if (dataByte.Length == 1)
{
sendData[4] = 0x00;
sendData[5] = dataByte[0];
}
else if (dataByte.Length == 2)
{
sendData[5] = dataByte[1];
sendData[4] = dataByte[0];
}
sendData = buildCheckData(sendData, sendData.Length - 2);
return sendData;
}
private static byte[] Get01WriteData(int slvAddr, string addr, int length)
{
byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr;
sendData[1] = CMD_ReadCoil;
byte[] addrByte = SerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1)
{
sendData[2] = 0x00;
sendData[3] = addrByte[0];
}
else if (addrByte.Length == 2)
{
sendData[3] = addrByte[1];
sendData[2] = addrByte[0];
}
byte[] dataByte = SerialBean.StringToByte(length.ToString());
if (dataByte.Length == 1)
{
sendData[4] = 0x00;
sendData[5] = dataByte[0];
}
else if (dataByte.Length == 2)
{
sendData[4] = dataByte[1];
sendData[5] = dataByte[0];
}
sendData = buildCheckData(sendData, sendData.Length - 2);
return sendData;
}
private static byte[] Get03WriteData(int slvAddr, string addr, int length)
{
// ( 2) 读取寄存器( 03h)
//发送
//从站地址
//03h
//寄存器起始地址 高位
//低位
//寄存器数(N) 高位
//低位
//CRC 低位
//高位
byte[] sendData = new byte[8 ];
sendData[0] = (byte)slvAddr;
sendData[1] = CMD_ReadRegisters;
byte[] addrByte = SerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1)
{
sendData[2] = 0x00;
sendData[3] = addrByte[0];
}
else if (addrByte.Length == 2)
{
sendData[3] = addrByte[1];
sendData[2] = addrByte[0];
}
byte[] dataByte = SerialBean.StringToByte(length.ToString());
if (dataByte.Length == 1)
{
sendData[4] = 0x00;
sendData[5] = dataByte[0];
}
else if (dataByte.Length == 2)
{
sendData[4] = dataByte[1];
sendData[5] = dataByte[0];
}
sendData = buildCheckData(sendData, sendData.Length-2);
return sendData;
}
private static byte[] Get06WriteData(int slvAddr, string addr, string dataValue)
{
// ( 4) 写入寄存器( 06h)
//从站地址
//06h
//地址 高位
//低位
//変更数据 高位
//低位
//CRC 低位
//高位
byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr;
sendData[1] = CMD_WriteRegisters;
byte[] addrByte = SerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1)
{
sendData[2] = 0x00;
sendData[3] = addrByte[0];
}
else if (addrByte.Length == 2)
{
sendData[3] = addrByte[1];
sendData[2] = addrByte[0];
}
byte[] dataByte = SerialBean.StringToByte(dataValue);
if (dataByte.Length == 1)
{
sendData[4] = 0x00;
sendData[5] = dataByte[0];
}
else if (dataByte.Length == 2)
{
sendData[4] = dataByte[1];
sendData[5] = dataByte[0];
}
sendData = buildCheckData(sendData, sendData.Length - 2);
return sendData;
}
}
}
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ACServoDriveTest
{
public class ACServerManager
{
public static RichTextBox richeBox = null;
public static void AddLog(string str)
{
if (richeBox != null)
{
richeBox.AppendText(str);
}
}
private static Dictionary<int, Dictionary<string, RegisterInfo>> LastDataMap = new Dictionary<int, Dictionary<string, RegisterInfo>>();
//private static SerialBean bean = null;
private static string strFromat = "{0:X2}";
private static Dictionary<string, SerialBean> serialBeanMap = new Dictionary<string, SerialBean>();
private static SerialBean GetSerialBean(string portName)
{
if (serialBeanMap.ContainsKey(portName))
{
return serialBeanMap[portName];
}
return null;
}
public static bool OpenPort(string portName)
{
SerialBean bean = new SerialBean(portName, 9600, Parity.Even, 8, StopBits.One);
bool result = bean.openPort();
if (!result)
{
Console.WriteLine("打开串口失败");
//MessageBox.Show("打开串口失败");
return false;
}
bean.DataReceived += DataReceived;
if (serialBeanMap.ContainsKey(portName))
{
serialBeanMap.Remove(portName);
}
serialBeanMap.Add(portName, bean);
return true;
}
public static void InitSlvAddr(string portName,int slvAddr)
{ //写入block
string slvAddrStr = string.Format(strFromat, slvAddr);
//block0=原点返回,正方向
string str0 = slvAddrStr + "104800 000408 00000420 00000000 ffff";
SendStr(portName, str0);
//block1=原点返回,反方向
string str1 = slvAddrStr + "104804 000408 04000420 00000000 ffff";
SendStr(portName, str1);
//block2=绝对位置运动
string str2 = slvAddrStr + "104808 000408 10000211EC78FFFF ffff";
SendStr(portName, str2);
//block3=相对位置运动
string str3 = slvAddrStr + "10480C 000408 10000111EC78FFFF ffff";
SendStr(portName, str3);
//block4=正方向匀速运动
string str4 = slvAddrStr + "104810 000408 10000311 00000000 ffff";
SendStr(portName, str4);
//block5=反方向匀速运动
string str5 = slvAddrStr + "104814 000408 14000311 00000000 ffff";
SendStr(portName, str5);
//block6=减速停止
string str6 = slvAddrStr + "104818 000408 00000500 00000000 ffff";
SendStr(portName, str6);
//block7=紧急停止
string str7 = slvAddrStr + "10481c 000408 00000510 00000000 ffff";
SendStr(portName, str7);
//0106460001009D12
//速度 V1 =100
string v1 = slvAddrStr + "064601 0064 ffff";
SendStr(portName, v1);
//加速度 A1 =30
string a1 = slvAddrStr + "064611 001E ffff";
SendStr(portName, a1);
//减速度 D1=30
string d1 = slvAddrStr + "064621 001E ffff";
SendStr(portName, d1);
//原点返回高速 homeHighSpeed=100
SendStr(portName, slvAddrStr + "06 4637 0064 ffff");
//原点返回抵速 homeLowSpeed=50
SendStr(portName, slvAddrStr + "06 4638 0032 ffff");
//原点返回加速度=30
SendStr(portName, slvAddrStr + "06 4639 001E ffff");
}
public static void RunBlock(string portName,int slvAddr, int index)
{
//运动
byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, "4414", index.ToString(), 2);
SendData(portName, data);
//开始
byte[] data1 = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, ACCMDManager.STB_Addr, "0000", 2);
SendData(portName, data1);
System.Threading.Thread.Sleep(100);
byte[] data2 = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, ACCMDManager.STB_Addr, "ff00", 2);
SendData(portName, data2);
}
public static void SendStr(string portName,string str)
{
byte[] data = SerialBean.StringToByte(str);
data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00;
data = ACCMDManager.buildCheckData(data, data.Length - 2);
SendData(portName, data);
System.Threading.Thread.Sleep(100);
}
public static void DataReceived(string portName, object sender, SerialDataReceivedEventArgs e, byte[] bits)
{
string strSend = "";
for (int i = 0; i < bits.Length; i++)
{
strSend += string.Format("{0:X2} ", bits[i]);
}
Console.WriteLine("收到数据:" + strSend + "\r\n");
AddLog(DateTime.Now.ToLongTimeString() + " 收到数据:" + strSend + "\r\n");
string str = "";
string strFromat = "{0:X2}";
byte slvAddr = bits[0];
int lenth = bits[2];
byte cmd = bits[1];
if (cmd.Equals(ACCMDManager.CMD_ReadRegisters) && bits.Length > 6)
{
if (PreReadAddr.Equals(ACCMDManager.TargetPostion))
{
if (lenth == 4)
{
str = string.Format(strFromat, bits[5]) + string.Format(strFromat, bits[6]) + string.Format(strFromat, bits[3]) + string.Format(strFromat, bits[4]);
int value = Convert.ToInt32(str.Trim().Replace(" ", ""), 16);
SaveData(portName, slvAddr, ACCMDManager.TargetPostion, value);
}
}
else if (PreReadAddr.Equals(ACCMDManager.ActualPosition))
{
if (lenth == 4)
{
str = string.Format(strFromat, bits[5]) + string.Format(strFromat, bits[6]) + string.Format(strFromat, bits[3]) + string.Format(strFromat, bits[4]);
int value = Convert.ToInt32(str.Trim().Replace(" ", ""), 16);
SaveData(portName, slvAddr, ACCMDManager.ActualPosition, value);
}
}
else
{
for (int i = 3; i < 3 + lenth; i++)
{
str += string.Format("{0:X2} ", bits[i]);
}
str = str.Replace(" ", "");
int value = Convert.ToInt32(str, 16);
AddLog("转换后结果:" + value + "\r\n");
//this.richTextBox1.AppendText("转换后结果:" + value + "\r\n");
Console.WriteLine("转换后结果:" + value);
}
//MessageBox.Show("收到数据:"+value);
}
else if (cmd.Equals(ACCMDManager.CMD_ReadCoil) && bits.Length >= 6)
{
if (PreReadCoilAddr.Equals(ACCMDManager.Alarm_Status))
{
if (lenth == 1)
{
str = string.Format(strFromat, bits[3]);
int value = Convert.ToInt32(str.Trim().Replace(" ", ""), 16);
SaveData(portName, slvAddr, ACCMDManager.Alarm_Status, value);
}
}
else if (PreReadCoilAddr.Equals(ACCMDManager.BUSYStatus))
{
if (lenth == 1)
{
str = string.Format(strFromat, bits[3]);
int value = Convert.ToInt32(str.Trim().Replace(" ", ""), 16);
SaveData(portName, slvAddr, ACCMDManager.BUSYStatus, value);
}
}
else if (PreReadCoilAddr.Equals(ACCMDManager.HOME_CMP_Status))
{
if (lenth == 1)
{
str = string.Format(strFromat, bits[3]);
int value = Convert.ToInt32(str.Trim().Replace(" ", ""), 16);
SaveData(portName, slvAddr, ACCMDManager.HOME_CMP_Status, value);
}
}
}
if (strSend.Equals(""))
{
return;
}
}
public static void SaveData(string portName,byte slvAddr, string regAddr, int value)
{
if (LastDataMap.ContainsKey(slvAddr))
{
if (LastDataMap[slvAddr].ContainsKey(regAddr))
{
LastDataMap[slvAddr][regAddr] = new RegisterInfo(slvAddr, regAddr, value);
}
else
{
LastDataMap[slvAddr].Add(regAddr, new RegisterInfo(slvAddr, regAddr, value));
}
}
else
{
Dictionary<string, RegisterInfo> map = new Dictionary<string, RegisterInfo>();
map.Add(regAddr, new RegisterInfo(slvAddr, regAddr, value));
LastDataMap.Add(slvAddr, map);
}
}
public static RegisterInfo GetData(string portName,byte slvAddr, string regAddr)
{
if (LastDataMap.ContainsKey(slvAddr))
{
if (LastDataMap[slvAddr].ContainsKey(regAddr))
{
return LastDataMap[slvAddr][regAddr];
}
} return null;
}
public static void ColsePort(string portName)
{
SerialBean bean = GetSerialBean(portName);
if (bean == null)
{
AddLog("串口【" + portName + "】不存在");
return;
}
bean.closePort();
}
public static void SendData(string portName,byte[] data)
{
if (data == null)
{
return;
}
string strSend = "";
for (int i = 0; i < data.Length; i++)
{
strSend += string.Format("{0:X2} ", data[i]);
}
if (strSend.Equals(""))
{
return;
}
Console.WriteLine(DateTime.Now.ToLongTimeString() + " 写入数据:" + strSend);
AddLog(DateTime.Now.ToLongTimeString() + " 写入数据:" + strSend + "\r\n");
// this.richTextBox1.AppendText("写入数据:" + strSend + "\r\n");
SerialBean bean = GetSerialBean(portName);
if (bean == null)
{
AddLog("串口【" + portName + "】不存在");
return;
}
bean.SendData(data, 0, data.Length);
}
/// <summary>
/// 发送数据并获取返回值
/// </summary>
/// <param name="data">发送的数据</param>
/// <param name="outTime">超时时间</param>
/// <returns>返回值的长度</returns>
public static byte[] SendCommand(string portName,byte[] data, int outTime, int reviceLength)
{
byte[] returnData = null;
try
{
if (data == null)
{
return returnData;
}
string strSend = "";
for (int i = 0; i < data.Length; i++)
{
strSend += string.Format("{0:X2} ", data[i]);
}
if (strSend.Equals(""))
{
return returnData;
}
Console.WriteLine(DateTime.Now.ToLongTimeString() + " 写入数据:" + strSend);
AddLog(DateTime.Now.ToLongTimeString() + " 写入数据:" + strSend + "\r\n");
// this.richTextBox1.AppendText("写入数据:" + strSend + "\r\n");
SerialBean bean = GetSerialBean(portName);
if (bean == null)
{
AddLog("串口【" + portName + "】不存在");
}
else
{
bean.SendCommand(data, ref returnData, outTime, reviceLength);
}
}
catch (Exception ex)
{
AddLog(ex.ToString());
}
return returnData;
}
public static void WriteData(string portName,int slvAddr, string addr, string data, byte cmd, int length)
{
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, cmd, addr, data, length);
SendData(portName,dataArray);
}
public static void RelMove(string portName,int slvAddr, int position)
{
//int position = Convert.ToInt32(txtPosition.Text);
byte[] positionData = SerialBean.StringToByte(position.ToString("X8"));
byte[] data = SerialBean.StringToByte("0110480C 000408 10000111EC78FFFF ffff");
data[0] = (byte)slvAddr;
data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00;
if (positionData.Length == 4)
{
data[11] = positionData[2];
data[12] = positionData[3];
data[13] = positionData[0];
data[14] = positionData[1];
}
else if (positionData.Length == 3)
{
data[11] = positionData[1];
data[12] = positionData[2];
data[13] = 0x00;
data[14] = positionData[0];
}
else if (positionData.Length == 2)
{
data[11] = positionData[0];
data[12] = positionData[1];
data[13] = 0x00;
data[14] = 0x00;
}
else if (positionData.Length == 1)
{
data[11] = 0x00;
data[12] = positionData[0];
data[13] = 0x00;
data[14] = 0x00;
}
data = ACCMDManager.buildCheckData(data, data.Length - 2);
SendData(portName, data);
System.Threading.Thread.Sleep(100);
//运动
data = ACCMDManager.GetWriteData(slvAddr, 06, ACCMDManager.BlockNo, "3", 2);
SendData(portName, data);
Thread.Sleep(100);
OpenSTB(portName, slvAddr);
}
public static void HomeMove(string portName,int slvAddr, int speed)
{
byte[] date = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, "4637", string.Format("{0:X2}", Math.Abs(speed)), 1);
SendData(portName, date);
Thread.Sleep(100);
date = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, "4638", string.Format("{0:X2}", Math.Abs(speed / 2)), 1);
SendData(portName, date);
Thread.Sleep(100);
if (speed > 0)
{
byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, "0", 2);
SendData(portName, data);
}
else
{
byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, "1", 2);
SendData(portName, data);
}
Thread.Sleep(100);
OpenSTB(portName, slvAddr);
}
public static void SpeedMove(string portName,int slvAddr, int speed)
{
byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, "4601", string.Format("{0:X2}", Math.Abs(speed)), 2);
SendData(portName, data);
Thread.Sleep(100);
if (speed > 0)
{
data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, "4", 2);
SendData(portName, data);
}
else
{
data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, "5", 2);
SendData(portName, data);
}
Thread.Sleep(100);
OpenSTB(portName, slvAddr);
}
public static void AbsMove(string portName,int slvAddr, int position)
{
//int position = Convert.ToInt32(txtPosition.Text, 10);
byte[] positionData = SerialBean.StringToByte(position.ToString("X8"));
byte[] data = SerialBean.StringToByte("01104808 000408 10000211 EC78FFFF ffff");
data[0] = (byte)slvAddr;
data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00;
if (positionData.Length == 4)
{
data[11] = positionData[2];
data[12] = positionData[3];
data[13] = positionData[0];
data[14] = positionData[1];
}
else if (positionData.Length == 3)
{
data[11] = positionData[1];
data[12] = positionData[2];
data[13] = 0x00;
data[14] = positionData[0];
}
else if (positionData.Length == 2)
{
data[11] = positionData[0];
data[12] = positionData[1];
data[13] = 0x00;
data[14] = 0x00;
}
else if (positionData.Length == 1)
{
data[11] = 0x00;
data[12] = positionData[0];
data[13] = 0x00;
data[14] = 0x00;
}
data = ACCMDManager.buildCheckData(data, data.Length - 2);
SendData(portName, data);
System.Threading.Thread.Sleep(100);
data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, "2", 2);
SendData(portName, data);
Thread.Sleep(100);
OpenSTB(portName, slvAddr);
}
public static void SendStr(string portName,int slvAddr, string str)
{
//string str = txtSendStr.Text;
byte[] data = SerialBean.StringToByte(str);
data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00;
data = ACCMDManager.buildCheckData(data, data.Length - 2);
SendData(portName, data);
}
public static void Stop(string portName,int slvAddr)
{
//RunBlock(6);
string addr = ACCMDManager.Stop_Addr;
string data = "FF00";
//byte cmd = 0x05;
int length = 2;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, addr, data, length);
SendData(portName,dataArray);
System.Threading.Thread.Sleep(1000);
data = "0000";
dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, addr, data, length);
SendData(portName,dataArray);
}
public static void SuddenStop(string portName,int slvAddr)
{
// RunBlock(7);
string addr = ACCMDManager.SDStop_Addr;
string data = "FF00";
//byte cmd = 0x05;
int length = 2;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, addr, data, length);
SendData(portName,dataArray);
System.Threading.Thread.Sleep(1000);
data = "0000";
dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, addr, data, length);
SendData(portName,dataArray);
}
public static void ServoOn(string portName,int slvAddr)
{
string addr = ACCMDManager.ServerOn_Addr;
string data = "FF00";
//byte cmd = 0x05;
int length = 2;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, addr, data, length);
SendData(portName,dataArray);
}
public static void ServoOff(string portName,int slvAddr)
{
string addr = ACCMDManager.ServerOn_Addr;
string data = "0000";
//byte cmd = 0x05;
int length = 2;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, addr, data, length);
SendData(portName,dataArray);
}
public static void OpenSTB(string portName,int slvAddr)
{
string addr = ACCMDManager.STB_Addr;
string data = "FF00";
//byte cmd = 0x05;
int length = 2;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, addr, data, length);
SendData(portName,dataArray);
System.Threading.Thread.Sleep(1000);
data = "0000";
dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, addr, data, length);
SendData(portName,dataArray);
}
public static void CloseSTB(string portName,int slvAddr)
{
string addr = ACCMDManager.STB_Addr;
string data = "0000";
//byte cmd = 0x05;
int length = 2;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, addr, data, length);
SendData(portName,dataArray);
}
public static void UpdateBlock(string portName, int slvAddr, int blockNum)
{
byte[] data = ACCMDManager.GetWriteData(01, 06, ACCMDManager.BlockNo, blockNum.ToString(), 2);
SendData(portName, data);
}
public static void AlarmClear(string portName,int slvAddr)
{
string addr = ACCMDManager.Clear_Alarm_Addr;
string data = "FF00";
//byte cmd = 0x05;
int length = 2;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, addr, data, length);
SendData(portName,dataArray);
System.Threading.Thread.Sleep(1000);
data = "0000";
dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, addr, data, length);
SendData(portName,dataArray);
}
public static void CloseAlarmClear(string portName,int slvAddr)
{
string addr = ACCMDManager.Clear_Alarm_Addr;
string data = "0000";
//byte cmd = 0x05;
int length = 2;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteCoil, addr, data, length);
SendData(portName, dataArray);
}
private static string PreReadAddr = "";
private static string PreReadCoilAddr = "";
public static int GetRegisterData(string portName,byte[] reviceData, string Address)
{
if (reviceData != null && reviceData.Length > 0)
{
string strSend = "";
for (int i = 0; i < reviceData.Length; i++)
{
strSend += string.Format("{0:X2} ", reviceData[i]);
}
Console.WriteLine("收到数据:" + strSend + "\r\n");
AddLog(DateTime.Now.ToLongTimeString() + " 收到数据:" + strSend + "\r\n");
string strFromat = "{0:X2}";
byte slvAddrR = reviceData[0];
int lenth = reviceData[2];
byte cmd = reviceData[1];
if (cmd.Equals(ACCMDManager.CMD_ReadRegisters) && reviceData.Length > 6 && lenth == 4)
{
string str = string.Format(strFromat, reviceData[5]) + string.Format(strFromat, reviceData[6]) + string.Format(strFromat, reviceData[3]) + string.Format(strFromat, reviceData[4]);
int value = Convert.ToInt32(str.Trim().Replace(" ", ""), 16);
SaveData(portName, slvAddrR, Address, value);
return value;
}
} return -1;
}
public static int GetTargetPosition(string portName,int slvAddr)
{
PreReadAddr = ACCMDManager.TargetPostion;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_ReadRegisters, ACCMDManager.TargetPostion, "0000", 2);
// SendData(portName,dataArray);
byte[] reviceData = SendCommand(portName, dataArray, 100, 9);
return GetRegisterData(portName, reviceData, ACCMDManager.TargetPostion);
}
public static int GetActualtPosition(string portName, int slvAddr)
{
PreReadAddr = ACCMDManager.ActualPosition;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_ReadRegisters, ACCMDManager.ActualPosition, "0000", 2);
// SendData(portName,dataArray);
byte[] reviceData = SendCommand(portName, dataArray, 100, 9);
return GetRegisterData(portName, reviceData, ACCMDManager.ActualPosition);
}
public static int GetCoilData(string portName,byte[] reviceData, string Address)
{
if (reviceData != null && reviceData.Length > 0)
{
string strSend = "";
for (int i = 0; i < reviceData.Length; i++)
{
strSend += string.Format("{0:X2} ", reviceData[i]);
}
Console.WriteLine("收到数据:" + strSend + "\r\n");
AddLog(DateTime.Now.ToLongTimeString() + " 收到数据:" + strSend + "\r\n");
string strFromat = "{0:X2}";
byte slvAddrR = reviceData[0];
int lenth = reviceData[2];
byte cmd = reviceData[1];
if (cmd.Equals(ACCMDManager.CMD_ReadCoil) && reviceData.Length >= 6 && lenth == 1)
{
string str = string.Format(strFromat, reviceData[3]);
int value = Convert.ToInt32(str.Trim().Replace(" ", ""), 16);
SaveData(portName, slvAddrR, Address, value);
return value;
}
} return -1;
}
public static int GetAlarmStatus(string portName, int slvAddr)
{
PreReadCoilAddr = ACCMDManager.Alarm_Status;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_ReadCoil, ACCMDManager.Alarm_Status, "0000", 1);
//SendData(portName,dataArray);
byte[] reviceData = SendCommand(portName, dataArray, 100, 6);
return GetCoilData(portName, reviceData, ACCMDManager.Alarm_Status);
}
public static int GetBusyStatus(string portName,int slvAddr)
{
PreReadCoilAddr = ACCMDManager.BUSYStatus;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_ReadCoil, ACCMDManager.BUSYStatus, "0000", 1);
//SendData(portName,dataArray);
byte[] reviceData = SendCommand(portName, dataArray, 100, 6);
return GetCoilData(portName, reviceData, ACCMDManager.Alarm_Status);
}
public static int GetHomeEndStatus(string portName,int slvAddr)
{
PreReadCoilAddr = ACCMDManager.HOME_CMP_Status;
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_ReadCoil, ACCMDManager.HOME_CMP_Status, "0000", 1);
//SendData(portName,dataArray);
byte[] reviceData = SendCommand(portName, dataArray, 100, 6);
return GetCoilData(portName, reviceData, ACCMDManager.Alarm_Status);
}
}
/// <summary>
/// 记录最后一次获得的寄存器的值
/// </summary>
public class RegisterInfo
{
public RegisterInfo(int slv, string addr, int data)
{
this.SlvAddr = slv;
this.RegisterAddr = addr;
this.LastData = data;
this.LastTime = new DateTime();
}
public int SlvAddr { get; set; }
public string RegisterAddr { get; set; }
public int LastData { get; set; }
public DateTime LastTime { get; set; }
}
}
namespace ACServoDriveTest
{
partial class FrmMoveTest
{
/// <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 Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.label7 = new System.Windows.Forms.Label();
this.txtActualPosition = new System.Windows.Forms.TextBox();
this.btnGetActualPosition = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label();
this.txtTargetPosition = new System.Windows.Forms.TextBox();
this.btnGetTargetPosition = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.btnUpdateBlock = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.txtNo = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.btnServoOff = new System.Windows.Forms.Button();
this.btnServoOn = new System.Windows.Forms.Button();
this.btnSdStop = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
this.btnSend = new System.Windows.Forms.Button();
this.txtSendStr = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.txtLength = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.btnHomeMove = new System.Windows.Forms.Button();
this.btnRelMove = new System.Windows.Forms.Button();
this.btnClear = new System.Windows.Forms.Button();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.txtCmd = new System.Windows.Forms.TextBox();
this.txt = new System.Windows.Forms.Label();
this.btnWrite = new System.Windows.Forms.Button();
this.txtWData = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txtWAddr = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.txtAddr = new System.Windows.Forms.TextBox();
this.label18 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.txtPosition = new System.Windows.Forms.TextBox();
this.btnAbsMove = new System.Windows.Forms.Button();
this.btnClose = new System.Windows.Forms.Button();
this.btnOpen = new System.Windows.Forms.Button();
this.label8 = new System.Windows.Forms.Label();
this.txtSpeed = new System.Windows.Forms.TextBox();
this.btnSpeedMove = new System.Windows.Forms.Button();
this.comboBoxBaudRate = new System.Windows.Forms.ComboBox();
this.label11 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.comboBoxPortName = new System.Windows.Forms.ComboBox();
this.groupBox6.SuspendLayout();
this.SuspendLayout();
//
// groupBox6
//
this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6.Controls.Add(this.label7);
this.groupBox6.Controls.Add(this.txtActualPosition);
this.groupBox6.Controls.Add(this.btnGetActualPosition);
this.groupBox6.Controls.Add(this.label6);
this.groupBox6.Controls.Add(this.txtTargetPosition);
this.groupBox6.Controls.Add(this.btnGetTargetPosition);
this.groupBox6.Controls.Add(this.button4);
this.groupBox6.Controls.Add(this.btnUpdateBlock);
this.groupBox6.Controls.Add(this.label5);
this.groupBox6.Controls.Add(this.txtNo);
this.groupBox6.Controls.Add(this.button1);
this.groupBox6.Controls.Add(this.button2);
this.groupBox6.Controls.Add(this.btnServoOff);
this.groupBox6.Controls.Add(this.btnServoOn);
this.groupBox6.Controls.Add(this.btnSdStop);
this.groupBox6.Controls.Add(this.btnStop);
this.groupBox6.Controls.Add(this.btnSend);
this.groupBox6.Controls.Add(this.txtSendStr);
this.groupBox6.Controls.Add(this.label4);
this.groupBox6.Controls.Add(this.txtLength);
this.groupBox6.Controls.Add(this.label2);
this.groupBox6.Controls.Add(this.btnHomeMove);
this.groupBox6.Controls.Add(this.btnRelMove);
this.groupBox6.Controls.Add(this.btnClear);
this.groupBox6.Controls.Add(this.richTextBox1);
this.groupBox6.Controls.Add(this.txtCmd);
this.groupBox6.Controls.Add(this.txt);
this.groupBox6.Controls.Add(this.btnWrite);
this.groupBox6.Controls.Add(this.txtWData);
this.groupBox6.Controls.Add(this.label3);
this.groupBox6.Controls.Add(this.txtWAddr);
this.groupBox6.Controls.Add(this.label1);
this.groupBox6.Controls.Add(this.txtAddr);
this.groupBox6.Controls.Add(this.label18);
this.groupBox6.Controls.Add(this.label13);
this.groupBox6.Controls.Add(this.txtPosition);
this.groupBox6.Controls.Add(this.btnAbsMove);
this.groupBox6.Controls.Add(this.btnClose);
this.groupBox6.Controls.Add(this.btnOpen);
this.groupBox6.Controls.Add(this.label8);
this.groupBox6.Controls.Add(this.txtSpeed);
this.groupBox6.Controls.Add(this.btnSpeedMove);
this.groupBox6.Controls.Add(this.comboBoxBaudRate);
this.groupBox6.Controls.Add(this.label11);
this.groupBox6.Controls.Add(this.label12);
this.groupBox6.Controls.Add(this.comboBoxPortName);
this.groupBox6.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox6.Location = new System.Drawing.Point(14, 10);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(1019, 540);
this.groupBox6.TabIndex = 250;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "伺服驱动器";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(15, 474);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(65, 12);
this.label7.TabIndex = 271;
this.label7.Text = "实际位置:";
//
// txtActualPosition
//
this.txtActualPosition.Location = new System.Drawing.Point(86, 471);
this.txtActualPosition.Name = "txtActualPosition";
this.txtActualPosition.Size = new System.Drawing.Size(105, 21);
this.txtActualPosition.TabIndex = 270;
this.txtActualPosition.Text = "5000";
//
// btnGetActualPosition
//
this.btnGetActualPosition.Location = new System.Drawing.Point(199, 470);
this.btnGetActualPosition.Name = "btnGetActualPosition";
this.btnGetActualPosition.Size = new System.Drawing.Size(105, 25);
this.btnGetActualPosition.TabIndex = 269;
this.btnGetActualPosition.Text = "读实际位置";
this.btnGetActualPosition.UseVisualStyleBackColor = true;
this.btnGetActualPosition.Click += new System.EventHandler(this.btnGetActualPosition_Click);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(15, 444);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(65, 12);
this.label6.TabIndex = 268;
this.label6.Text = "目标位置:";
//
// txtTargetPosition
//
this.txtTargetPosition.Location = new System.Drawing.Point(86, 441);
this.txtTargetPosition.Name = "txtTargetPosition";
this.txtTargetPosition.Size = new System.Drawing.Size(105, 21);
this.txtTargetPosition.TabIndex = 267;
this.txtTargetPosition.Text = "5000";
//
// btnGetTargetPosition
//
this.btnGetTargetPosition.Location = new System.Drawing.Point(199, 440);
this.btnGetTargetPosition.Name = "btnGetTargetPosition";
this.btnGetTargetPosition.Size = new System.Drawing.Size(105, 25);
this.btnGetTargetPosition.TabIndex = 266;
this.btnGetTargetPosition.Text = "读目标位置";
this.btnGetTargetPosition.UseVisualStyleBackColor = true;
this.btnGetTargetPosition.Click += new System.EventHandler(this.btnReadPosition_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(244, 252);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(105, 25);
this.button4.TabIndex = 265;
this.button4.Text = "清理报警";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// btnUpdateBlock
//
this.btnUpdateBlock.Location = new System.Drawing.Point(199, 339);
this.btnUpdateBlock.Name = "btnUpdateBlock";
this.btnUpdateBlock.Size = new System.Drawing.Size(105, 25);
this.btnUpdateBlock.TabIndex = 264;
this.btnUpdateBlock.Text = "更改Block";
this.btnUpdateBlock.UseVisualStyleBackColor = true;
this.btnUpdateBlock.Click += new System.EventHandler(this.btnUpdateBlock_Click);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(29, 346);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(53, 12);
this.label5.TabIndex = 263;
this.label5.Text = "BlockNo:";
//
// txtNo
//
this.txtNo.Location = new System.Drawing.Point(88, 343);
this.txtNo.Name = "txtNo";
this.txtNo.Size = new System.Drawing.Size(105, 21);
this.txtNo.TabIndex = 262;
this.txtNo.Text = "1";
//
// button1
//
this.button1.Location = new System.Drawing.Point(133, 283);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(105, 25);
this.button1.TabIndex = 261;
this.button1.Text = "关闭STB";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(22, 283);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(105, 25);
this.button2.TabIndex = 260;
this.button2.Text = "打开STB";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// btnServoOff
//
this.btnServoOff.Location = new System.Drawing.Point(133, 252);
this.btnServoOff.Name = "btnServoOff";
this.btnServoOff.Size = new System.Drawing.Size(105, 25);
this.btnServoOff.TabIndex = 259;
this.btnServoOff.Text = "关闭伺服";
this.btnServoOff.UseVisualStyleBackColor = true;
this.btnServoOff.Click += new System.EventHandler(this.btnServoOff_Click);
//
// btnServoOn
//
this.btnServoOn.Location = new System.Drawing.Point(22, 252);
this.btnServoOn.Name = "btnServoOn";
this.btnServoOn.Size = new System.Drawing.Size(105, 25);
this.btnServoOn.TabIndex = 258;
this.btnServoOn.Text = "打开伺服";
this.btnServoOn.UseVisualStyleBackColor = true;
this.btnServoOn.Click += new System.EventHandler(this.btnServoOn_Click);
//
// btnSdStop
//
this.btnSdStop.Location = new System.Drawing.Point(355, 252);
this.btnSdStop.Name = "btnSdStop";
this.btnSdStop.Size = new System.Drawing.Size(84, 56);
this.btnSdStop.TabIndex = 257;
this.btnSdStop.Text = "紧急停止";
this.btnSdStop.UseVisualStyleBackColor = true;
this.btnSdStop.Click += new System.EventHandler(this.btnSdStop_Click);
//
// btnStop
//
this.btnStop.Location = new System.Drawing.Point(244, 283);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(105, 25);
this.btnStop.TabIndex = 256;
this.btnStop.Text = "减速停止";
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// btnSend
//
this.btnSend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSend.Location = new System.Drawing.Point(781, 506);
this.btnSend.Name = "btnSend";
this.btnSend.Size = new System.Drawing.Size(105, 25);
this.btnSend.TabIndex = 255;
this.btnSend.Text = "发送";
this.btnSend.UseVisualStyleBackColor = true;
this.btnSend.Click += new System.EventHandler(this.btnSend_Click);
//
// txtSendStr
//
this.txtSendStr.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtSendStr.Location = new System.Drawing.Point(494, 507);
this.txtSendStr.MaxLength = 300;
this.txtSendStr.Name = "txtSendStr";
this.txtSendStr.Size = new System.Drawing.Size(281, 21);
this.txtSendStr.TabIndex = 254;
//
// label4
//
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(447, 511);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(41, 12);
this.label4.TabIndex = 253;
this.label4.Text = "数据:";
//
// txtLength
//
this.txtLength.Location = new System.Drawing.Point(283, 125);
this.txtLength.MaxLength = 20;
this.txtLength.Name = "txtLength";
this.txtLength.Size = new System.Drawing.Size(103, 21);
this.txtLength.TabIndex = 252;
this.txtLength.Text = "2";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(212, 128);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 251;
this.label2.Text = "寄存器数:";
//
// btnHomeMove
//
this.btnHomeMove.Location = new System.Drawing.Point(310, 374);
this.btnHomeMove.Name = "btnHomeMove";
this.btnHomeMove.Size = new System.Drawing.Size(105, 25);
this.btnHomeMove.TabIndex = 110;
this.btnHomeMove.Text = "原点返回";
this.btnHomeMove.UseVisualStyleBackColor = true;
this.btnHomeMove.Click += new System.EventHandler(this.btnHomeMove_Click);
//
// btnRelMove
//
this.btnRelMove.Location = new System.Drawing.Point(310, 409);
this.btnRelMove.Name = "btnRelMove";
this.btnRelMove.Size = new System.Drawing.Size(105, 25);
this.btnRelMove.TabIndex = 109;
this.btnRelMove.Text = "相对运动";
this.btnRelMove.UseVisualStyleBackColor = true;
this.btnRelMove.Click += new System.EventHandler(this.btnRelMove_Click);
//
// btnClear
//
this.btnClear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnClear.Location = new System.Drawing.Point(892, 506);
this.btnClear.Name = "btnClear";
this.btnClear.Size = new System.Drawing.Size(105, 25);
this.btnClear.TabIndex = 106;
this.btnClear.Text = "清理";
this.btnClear.UseVisualStyleBackColor = true;
this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
//
// richTextBox1
//
this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.richTextBox1.Location = new System.Drawing.Point(445, 20);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(552, 475);
this.richTextBox1.TabIndex = 105;
this.richTextBox1.Text = "";
//
// txtCmd
//
this.txtCmd.Location = new System.Drawing.Point(88, 157);
this.txtCmd.MaxLength = 20;
this.txtCmd.Name = "txtCmd";
this.txtCmd.Size = new System.Drawing.Size(103, 21);
this.txtCmd.TabIndex = 104;
this.txtCmd.Text = "05";
//
// txt
//
this.txt.AutoSize = true;
this.txt.Location = new System.Drawing.Point(29, 160);
this.txt.Name = "txt";
this.txt.Size = new System.Drawing.Size(53, 12);
this.txt.TabIndex = 103;
this.txt.Text = "功能码:";
//
// btnWrite
//
this.btnWrite.Location = new System.Drawing.Point(281, 189);
this.btnWrite.Name = "btnWrite";
this.btnWrite.Size = new System.Drawing.Size(105, 25);
this.btnWrite.TabIndex = 102;
this.btnWrite.Text = "写入";
this.btnWrite.UseVisualStyleBackColor = true;
this.btnWrite.Click += new System.EventHandler(this.btnWrite_Click);
//
// txtWData
//
this.txtWData.Location = new System.Drawing.Point(283, 157);
this.txtWData.MaxLength = 20;
this.txtWData.Name = "txtWData";
this.txtWData.Size = new System.Drawing.Size(103, 21);
this.txtWData.TabIndex = 101;
this.txtWData.Text = "FF00";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(236, 160);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(41, 12);
this.label3.TabIndex = 100;
this.label3.Text = "数据:";
//
// txtWAddr
//
this.txtWAddr.Location = new System.Drawing.Point(88, 125);
this.txtWAddr.MaxLength = 20;
this.txtWAddr.Name = "txtWAddr";
this.txtWAddr.Size = new System.Drawing.Size(103, 21);
this.txtWAddr.TabIndex = 97;
this.txtWAddr.Text = "0060";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(5, 128);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(77, 12);
this.label1.TabIndex = 96;
this.label1.Text = "寄存器地址:";
//
// txtAddr
//
this.txtAddr.Enabled = false;
this.txtAddr.Location = new System.Drawing.Point(88, 189);
this.txtAddr.MaxLength = 20;
this.txtAddr.Name = "txtAddr";
this.txtAddr.Size = new System.Drawing.Size(103, 21);
this.txtAddr.TabIndex = 95;
this.txtAddr.Text = "1";
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(41, 192);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(41, 12);
this.label18.TabIndex = 94;
this.label18.Text = "地址:";
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(39, 414);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(41, 12);
this.label13.TabIndex = 90;
this.label13.Text = "位置:";
//
// txtPosition
//
this.txtPosition.Location = new System.Drawing.Point(86, 409);
this.txtPosition.Name = "txtPosition";
this.txtPosition.Size = new System.Drawing.Size(105, 21);
this.txtPosition.TabIndex = 89;
this.txtPosition.Text = "5000";
//
// btnAbsMove
//
this.btnAbsMove.Location = new System.Drawing.Point(199, 408);
this.btnAbsMove.Name = "btnAbsMove";
this.btnAbsMove.Size = new System.Drawing.Size(105, 25);
this.btnAbsMove.TabIndex = 88;
this.btnAbsMove.Text = "绝对运动";
this.btnAbsMove.UseVisualStyleBackColor = true;
this.btnAbsMove.Click += new System.EventHandler(this.btnAbsMove_Click);
//
// btnClose
//
this.btnClose.Location = new System.Drawing.Point(265, 70);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(105, 25);
this.btnClose.TabIndex = 87;
this.btnClose.Text = "关闭串口";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// btnOpen
//
this.btnOpen.Location = new System.Drawing.Point(265, 36);
this.btnOpen.Name = "btnOpen";
this.btnOpen.Size = new System.Drawing.Size(105, 25);
this.btnOpen.TabIndex = 86;
this.btnOpen.Text = "打开串口";
this.btnOpen.UseVisualStyleBackColor = true;
this.btnOpen.Click += new System.EventHandler(this.btnOpen_Click);
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(39, 380);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(41, 12);
this.label8.TabIndex = 84;
this.label8.Text = "速度:";
//
// txtSpeed
//
this.txtSpeed.Location = new System.Drawing.Point(88, 376);
this.txtSpeed.Name = "txtSpeed";
this.txtSpeed.Size = new System.Drawing.Size(105, 21);
this.txtSpeed.TabIndex = 83;
this.txtSpeed.Text = "100";
//
// btnSpeedMove
//
this.btnSpeedMove.Location = new System.Drawing.Point(199, 373);
this.btnSpeedMove.Name = "btnSpeedMove";
this.btnSpeedMove.Size = new System.Drawing.Size(105, 25);
this.btnSpeedMove.TabIndex = 9;
this.btnSpeedMove.Text = "匀速运动";
this.btnSpeedMove.UseVisualStyleBackColor = true;
this.btnSpeedMove.Click += new System.EventHandler(this.btnSpeedMove_Click);
//
// comboBoxBaudRate
//
this.comboBoxBaudRate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxBaudRate.FormattingEnabled = true;
this.comboBoxBaudRate.Location = new System.Drawing.Point(88, 73);
this.comboBoxBaudRate.Name = "comboBoxBaudRate";
this.comboBoxBaudRate.Size = new System.Drawing.Size(103, 20);
this.comboBoxBaudRate.TabIndex = 3;
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(29, 76);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(53, 12);
this.label11.TabIndex = 2;
this.label11.Text = "波特率:";
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(29, 44);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(53, 12);
this.label12.TabIndex = 1;
this.label12.Text = "端口号:";
//
// comboBoxPortName
//
this.comboBoxPortName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxPortName.FormattingEnabled = true;
this.comboBoxPortName.Location = new System.Drawing.Point(88, 41);
this.comboBoxPortName.Name = "comboBoxPortName";
this.comboBoxPortName.Size = new System.Drawing.Size(103, 20);
this.comboBoxPortName.TabIndex = 0;
//
// FrmMoveTest
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1045, 562);
this.Controls.Add(this.groupBox6);
this.Name = "FrmMoveTest";
this.Text = "AC伺服驱动器";
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.TextBox txtAddr;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox txtPosition;
private System.Windows.Forms.Button btnAbsMove;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button btnOpen;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox txtSpeed;
private System.Windows.Forms.Button btnSpeedMove;
private System.Windows.Forms.ComboBox comboBoxBaudRate;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.ComboBox comboBoxPortName;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtWAddr;
private System.Windows.Forms.TextBox txtWData;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnWrite;
private System.Windows.Forms.TextBox txtCmd;
private System.Windows.Forms.Label txt;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button btnClear;
private System.Windows.Forms.Button btnRelMove;
private System.Windows.Forms.Button btnHomeMove;
private System.Windows.Forms.TextBox txtLength;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnSend;
private System.Windows.Forms.TextBox txtSendStr;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button btnSdStop;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button btnServoOff;
private System.Windows.Forms.Button btnServoOn;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox txtNo;
private System.Windows.Forms.Button btnUpdateBlock;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox txtTargetPosition;
private System.Windows.Forms.Button btnGetTargetPosition;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox txtActualPosition;
private System.Windows.Forms.Button btnGetActualPosition;
}
}

using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ACServoDriveTest
{
public partial class FrmMoveTest : Form
{
public FrmMoveTest()
{
InitializeComponent();
}
private SerialBean bean;
private void btnOpen_Click(object sender, EventArgs e)
{
string portName = comboBoxPortName.Text;
int botelv = Convert.ToInt32(comboBoxBaudRate.Text);
bean = new SerialBean(portName, 9600, Parity.Even, 8, StopBits.One);
bool result = bean.openPort();
if (!result)
{
MessageBox.Show("打开串口失败");
}
else
{
bean.DataReceived += DataReceived;
formStatus(true);
//写入block
//block0=原点返回,正方向
string str0 = "01104800 000408 00000420 00000000 ffff";
SendStr(str0);
//block1=原点返回,反方向
string str1 = "01104804 000408 04000420 00000000 ffff";
SendStr(str1);
//block2=绝对位置运动
string str2 = "01104808 000408 10000211EC78FFFF ffff";
SendStr(str2);
//block3=相对位置运动
string str3 = "0110480C 000408 10000111EC78FFFF ffff";
SendStr(str3);
//block4=正方向匀速运动
string str4 = "01104810 000408 10000311 00000000 ffff";
SendStr(str4);
//block5=反方向匀速运动
string str5 = "01104814 000408 14000311 00000000 ffff";
SendStr(str5);
//block6=减速停止
string str6 = "01104818 000408 00000500 00000000 ffff";
SendStr(str6);
//block7=紧急停止
string str7 = "0110481c 000408 00000510 00000000 ffff";
SendStr(str7);
//0106460001009D12
//速度 V1 =100
string v1 = "01064601 0064 ffff";
SendStr(v1);
//加速度 A1 =30
string a1 = "01064611 001E ffff";
SendStr(a1);
//减速度 D1=30
string d1 = "01064621 001E ffff";
SendStr(d1);
//原点返回高速 homeHighSpeed=100
SendStr("0106 4637 0064 ffff");
//原点返回抵速 homeLowSpeed=50
SendStr("0106 4638 0032 ffff");
//原点返回加速度=30
SendStr("0106 4639 001E ffff");
}
}
private void RunBlock(int index)
{
//运动
byte[] data = ACCMDManager.GetWriteData(01, 06, "4414", index.ToString(), 2);
SendData(data);
//开始
byte[] data1 = ACCMDManager.GetWriteData(01, 05, ACCMDManager.STB_Addr, "0000", 2);
SendData(data1);
System.Threading.Thread.Sleep(100);
byte[] data2 = ACCMDManager.GetWriteData(01, 05, ACCMDManager.STB_Addr, "ff00", 2);
SendData(data2);
}
private void SendStr(string str)
{
byte[] data = SerialBean.StringToByte(str);
data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00;
data = ACCMDManager.buildCheckData(data, data.Length - 2);
SendData(data);
System.Threading.Thread.Sleep(100);
}
private void formStatus(bool p)
{
btnOpen.Enabled = !p;
btnClose.Enabled = p;
btnWrite.Enabled = p;
btnAbsMove.Enabled = p;
btnSpeedMove.Enabled = p;
btnSdStop.Enabled = p;
btnStop.Enabled = p;
btnHomeMove.Enabled = p;
btnRelMove.Enabled = p;
}
private void DataReceived(string portName, object sender, SerialDataReceivedEventArgs e, byte[] bits)
{
string strSend = "";
for (int i = 0; i < bits.Length; i++)
{
strSend += string.Format("{0:X2} ", bits[i]);
}
this.richTextBox1.AppendText("收到数据:" + strSend + "\r\n");
Console.WriteLine("收到数据:" + strSend);
string str = "";
string strFromat = "{0:X2}";
if (bits[1].Equals(0x03) && bits.Length > 3)
{
int lenth = bits[2];
if (PreReadAddr.Equals( ACCMDManager.TargetPostion))
{
if (lenth == 4)
{
str = string.Format(strFromat, bits[5]) + string.Format(strFromat, bits[6]) + string.Format(strFromat, bits[3]) + string.Format(strFromat, bits[4]);
double value = Convert.ToInt32(str.Trim().Replace(" ",""), 16);
this.txtTargetPosition.Text = value.ToString();
}
}
else if (PreReadAddr.Equals(ACCMDManager.ActualPosition))
{
if (lenth == 4)
{
str = string.Format(strFromat, bits[5]) + string.Format(strFromat, bits[6]) + string.Format(strFromat, bits[3]) + string.Format(strFromat, bits[4]);
double value = Convert.ToInt32(str.Trim().Replace(" ", ""), 16);
this.txtActualPosition.Text = value.ToString();
}
}
else
{
for (int i = 3; i < 3 + lenth; i++)
{
str += string.Format("{0:X2} ", bits[i]);
}
str = str.Replace(" ", "");
double value = Convert.ToInt32(str, 16);
this.richTextBox1.AppendText("转换后结果:" + value + "\r\n");
Console.WriteLine("转换后结果:" + value);
}
//MessageBox.Show("收到数据:"+value);
}
if (strSend.Equals(""))
{
return;
}
}
private void btnClose_Click(object sender, EventArgs e)
{
bean.closePort();
formStatus(false);
}
public void SendData(byte[] data)
{
if (data == null)
{
return;
}
string strSend = "";
for (int i = 0; i < data.Length; i++)
{
strSend += string.Format("{0:X2} ", data[i]);
}
if (strSend.Equals(""))
{
return;
}
Console.WriteLine("写入数据:" + strSend);
this.richTextBox1.AppendText("写入数据:" + strSend + "\r\n");
bean.SendData(data, 0, data.Length);
}
private void Form1_Load(object sender, EventArgs e)
{
formStatus(false);
CheckForIllegalCrossThreadCalls = false;
List<string> port = new List<string>(SerialPort.GetPortNames());
comboBoxPortName.DataSource = port;
List<int> boteList = new List<int>();
boteList.Add(300);
boteList.Add(600);
boteList.Add(1200);
boteList.Add(4800);
boteList.Add(9600);
boteList.Add(19200);
boteList.Add(38400);
boteList.Add(57600);
boteList.Add(115200);
boteList.Add(230400);
comboBoxBaudRate.DataSource = boteList;
comboBoxBaudRate.SelectedIndex = boteList.IndexOf(9600);
}
private void btnWrite_Click(object sender, EventArgs e)
{
string addr = (txtWAddr.Text);
string data = (txtWData.Text);
byte cmd = Convert.ToByte(txtCmd.Text);
int slvAddr = Convert.ToInt32(txtAddr.Text);
int length = Convert.ToInt32(txtLength.Text);
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, cmd, addr, data, length);
SendData(dataArray);
}
private void btnClear_Click(object sender, EventArgs e)
{
this.richTextBox1.Text = "";
}
private void btnRelMove_Click(object sender, EventArgs e)
{
int position = Convert.ToInt32(txtPosition.Text);
byte[] positionData = SerialBean.StringToByte(position.ToString("X8"));
byte[] data = SerialBean.StringToByte("0110480C 000408 10000111EC78FFFF ffff");
data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00;
if (positionData.Length == 4)
{
data[11] = positionData[2];
data[12] = positionData[3];
data[13] = positionData[0];
data[14] = positionData[1];
}
else if (positionData.Length == 3)
{
data[11] = positionData[1];
data[12] = positionData[2];
data[13] = 0x00;
data[14] = positionData[0];
}
else if (positionData.Length == 2)
{
data[11] = positionData[0];
data[12] = positionData[1];
data[13] = 0x00;
data[14] = 0x00;
}
else if (positionData.Length == 1)
{
data[11] = 0x00;
data[12] = positionData[0];
data[13] = 0x00;
data[14] = 0x00;
}
data = ACCMDManager.buildCheckData(data, data.Length - 2);
SendData(data);
System.Threading.Thread.Sleep(100);
//运动
data = ACCMDManager.GetWriteData(01, 06, ACCMDManager.BlockNo, "3", 2);
SendData(data);
Thread.Sleep(100);
OpenSTB();
}
private void btnHomeMove_Click(object sender, EventArgs e)
{
int speed = Convert.ToInt32(txtSpeed.Text);
byte[] date = ACCMDManager.GetWriteData(01, 06, "4637", string.Format("{0:X2}", Math.Abs(speed)), 2);
if (speed > 0)
{
byte[] data = ACCMDManager.GetWriteData(01, 06, ACCMDManager.BlockNo, "0", 2);
SendData(data);
}
else
{
byte[] data = ACCMDManager.GetWriteData(01, 06, ACCMDManager.BlockNo, "1", 2);
SendData(data);
}
Thread.Sleep(100);
OpenSTB();
}
private void btnSpeedMove_Click(object sender, EventArgs e)
{
int speed = Convert.ToInt32(txtSpeed.Text);
byte[] data = ACCMDManager.GetWriteData(1, 06, "4601", string.Format("{0:X2}", Math.Abs( speed)) , 2);
if (speed > 0)
{
data = ACCMDManager.GetWriteData(01, 06, ACCMDManager.BlockNo, "4", 2);
SendData(data);
}
else
{
data = ACCMDManager.GetWriteData(01, 06, ACCMDManager.BlockNo, "5", 2);
SendData(data);
}
Thread.Sleep(100);
OpenSTB();
}
private void btnAbsMove_Click(object sender, EventArgs e)
{
int position = Convert.ToInt32(txtPosition.Text, 10);
byte[] positionData = SerialBean.StringToByte(position.ToString("X8"));
byte[] data = SerialBean.StringToByte("01104808 000408 10000211 EC78FFFF ffff");
data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00;
if (positionData.Length == 4)
{
data[11] = positionData[2];
data[12] = positionData[3];
data[13] = positionData[0];
data[14] = positionData[1];
}
else if (positionData.Length == 3)
{
data[11] = positionData[1];
data[12] = positionData[2];
data[13] = 0x00;
data[14] = positionData[0];
}
else if (positionData.Length == 2)
{
data[11] = positionData[0];
data[12] = positionData[1];
data[13] = 0x00;
data[14] = 0x00;
}
else if (positionData.Length == 1)
{
data[11] = 0x00;
data[12] = positionData[0];
data[13] = 0x00;
data[14] = 0x00;
}
data = ACCMDManager.buildCheckData(data, data.Length - 2);
SendData(data);
System.Threading.Thread.Sleep(100);
data = ACCMDManager.GetWriteData(01, 06, ACCMDManager.BlockNo, "2", 2);
SendData(data);
Thread.Sleep(100);
OpenSTB();
}
private void btnSend_Click(object sender, EventArgs e)
{
string str = txtSendStr.Text;
byte[] data = SerialBean.StringToByte(str);
data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00;
data = ACCMDManager.buildCheckData(data, data.Length - 2);
SendData(data);
}
private void btnStop_Click(object sender, EventArgs e)
{
//RunBlock(6);
string addr = ACCMDManager.Stop_Addr;
string data = "FF00";
byte cmd = 0x05;
int slvAddr = Convert.ToInt32(txtAddr.Text);
int length = Convert.ToInt32(txtLength.Text);
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, cmd, addr, data, length);
SendData(dataArray);
System.Threading.Thread.Sleep(1000);
data = "0000";
dataArray = ACCMDManager.GetWriteData(slvAddr, cmd, addr, data, length);
SendData(dataArray);
}
private void btnSdStop_Click(object sender, EventArgs e)
{
// RunBlock(7);
string addr = ACCMDManager.SDStop_Addr;
string data = "FF00";
byte cmd = 0x05;
int slvAddr = Convert.ToInt32(txtAddr.Text);
int length = Convert.ToInt32(txtLength.Text);
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, cmd, addr, data, length);
SendData(dataArray);
System.Threading.Thread.Sleep(1000);
data = "0000";
dataArray = ACCMDManager.GetWriteData(slvAddr, cmd, addr, data, length);
SendData(dataArray);
}
private void btnServoOn_Click(object sender, EventArgs e)
{
string addr = ACCMDManager.ServerOn_Addr;
string data = "FF00";
byte cmd = 0x05;
int slvAddr = Convert.ToInt32(txtAddr.Text);
int length = Convert.ToInt32(txtLength.Text);
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, cmd, addr, data, length);
SendData(dataArray);
}
private void btnServoOff_Click(object sender, EventArgs e)
{
string addr = ACCMDManager.ServerOn_Addr;
string data = "0000";
byte cmd = 0x05;
int slvAddr = Convert.ToInt32(txtAddr.Text);
int length = Convert.ToInt32(txtLength.Text);
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, cmd, addr, data, length);
SendData(dataArray);
}
private void OpenSTB()
{
string addr = ACCMDManager.STB_Addr;
string data = "FF00";
byte cmd = 0x05;
int slvAddr = Convert.ToInt32(txtAddr.Text);
int length = Convert.ToInt32(txtLength.Text);
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, cmd, addr, data, length);
SendData(dataArray);
System.Threading.Thread.Sleep(1000);
data = "0000";
dataArray = ACCMDManager.GetWriteData(slvAddr, cmd, addr, data, length);
SendData(dataArray);
}
private void button2_Click(object sender, EventArgs e)
{
OpenSTB();
}
private void button1_Click(object sender, EventArgs e)
{
string addr = ACCMDManager.STB_Addr;
string data = "0000";
byte cmd = 0x05;
int slvAddr = Convert.ToInt32(txtAddr.Text);
int length = Convert.ToInt32(txtLength.Text);
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, cmd, addr, data, length);
SendData(dataArray);
}
private void btnUpdateBlock_Click(object sender, EventArgs e)
{
int num = Convert.ToInt32(txtNo.Text);
byte[] data = ACCMDManager.GetWriteData(01, 06, ACCMDManager.BlockNo, num.ToString(), 2);
SendData(data);
}
private void button4_Click(object sender, EventArgs e)
{
string addr = ACCMDManager.Clear_Alarm_Addr;
string data = "FF00";
byte cmd = 0x05;
int slvAddr = Convert.ToInt32(txtAddr.Text);
int length = Convert.ToInt32(txtLength.Text);
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, cmd, addr, data, length);
SendData(dataArray);
System.Threading.Thread.Sleep(1000);
data = "0000";
dataArray = ACCMDManager.GetWriteData(slvAddr, cmd, addr, data, length);
SendData(dataArray);
}
private void button3_Click(object sender, EventArgs e)
{
string addr = ACCMDManager.Clear_Alarm_Addr;
string data = "0000";
byte cmd = 0x05;
int slvAddr = Convert.ToInt32(txtAddr.Text);
int length = Convert.ToInt32(txtLength.Text);
byte[] dataArray = ACCMDManager.GetWriteData(slvAddr, cmd, addr, data, length);
SendData(dataArray);
}
private string PreReadAddr = "";
private void btnReadPosition_Click(object sender, EventArgs e)
{
PreReadAddr = ACCMDManager.TargetPostion;
byte[] dataArray = ACCMDManager.GetWriteData(01, 03, ACCMDManager.TargetPostion, "0000", 2);
SendData(dataArray);
}
private void btnGetActualPosition_Click(object sender, EventArgs e)
{
PreReadAddr = ACCMDManager.ActualPosition;
byte[] dataArray = ACCMDManager.GetWriteData(01, 03, ACCMDManager.ActualPosition, "0000", 2);
SendData(dataArray);
}
}
}
<?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
......@@ -6,7 +6,7 @@
<appSettings>
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1" />
<add key="App_Title" value="AC_SA_料仓" />
<add key="App_Title" value="料仓_自动上下料" />
<add key="scanner_start_command" value="S" />
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
<add key="StartBlowValue" value="4" />
......@@ -19,8 +19,8 @@
<!--start one store config-->
<add key="Store_Position_Config" value="\StoreConfig\AC\linePositions.csv" />
<add key="Store_ConfigPath" value="\StoreConfig\AC\StoreConfig.csv" />
<add key="Store_Type" value="RC_AC_SA" />
<add key="Store_CID" value="ldac1" />
<add key="Store_Type" value="AUTO_SA_Config" />
<add key="Store_CID" value="nrAuto1" />
<!--end one store config-->
<!--摄像机名称列表配置,用#分割-->
......@@ -36,7 +36,7 @@
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/LDACStore.log" />
<file value="logs/AutoStore.log" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
......
......@@ -7,8 +7,8 @@
<ProjectGuid>{0D2542F5-DD62-4352-82D0-383D9A045E74}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.ACSingleStore</RootNamespace>
<AssemblyName>LDACSingleStore</AssemblyName>
<RootNamespace>OnlineStore.AutoInOutStore</RootNamespace>
<AssemblyName>AutoInOutStore</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
......@@ -128,79 +128,6 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="Skins\back\DeepCyan.ssk" />
<None Include="Skins\back\DeepGreen.ssk" />
<None Include="Skins\back\DeepOrange.ssk" />
<None Include="Skins\Calmness.ssk" />
<None Include="Skins\CalmnessColor1.ssk" />
<None Include="Skins\CalmnessColor2.ssk" />
<None Include="Skins\DiamondBlue.ssk" />
<None Include="Skins\DiamondGreen.ssk" />
<None Include="Skins\DiamondOlive.ssk" />
<None Include="Skins\DiamondPurple.ssk" />
<None Include="Skins\DiamondRed.ssk" />
<None Include="Skins\Eighteen.ssk" />
<None Include="Skins\EighteenColor1.ssk" />
<None Include="Skins\EighteenColor2.ssk" />
<None Include="Skins\Emerald.ssk" />
<None Include="Skins\EmeraldColor1.ssk" />
<None Include="Skins\EmeraldColor2.ssk" />
<None Include="Skins\EmeraldColor3.ssk" />
<None Include="Skins\GlassBrown.ssk" />
<None Include="Skins\GlassGreen.ssk" />
<None Include="Skins\GlassOrange.ssk" />
<None Include="Skins\Longhorn.ssk" />
<None Include="Skins\MacOS.ssk" />
<None Include="Skins\Midsummer.ssk" />
<None Include="Skins\MidsummerColor1.ssk" />
<None Include="Skins\MidsummerColor2.ssk" />
<None Include="Skins\MidsummerColor3.ssk" />
<None Include="Skins\mp10.ssk" />
<None Include="Skins\mp10green.ssk" />
<None Include="Skins\mp10maroon.ssk" />
<None Include="Skins\mp10mulberry.ssk" />
<None Include="Skins\mp10pink.ssk" />
<None Include="Skins\mp10purple.ssk" />
<None Include="Skins\MSN.ssk" />
<None Include="Skins\office2007.ssk" />
<None Include="Skins\OneBlue.ssk" />
<None Include="Skins\OneCyan.ssk" />
<None Include="Skins\OneGreen.ssk" />
<None Include="Skins\OneOrange.ssk" />
<None Include="Skins\Page.ssk" />
<None Include="Skins\PageColor1.ssk" />
<None Include="Skins\PageColor2.ssk" />
<None Include="Skins\RealOne.ssk" />
<None Include="Skins\Silver.ssk" />
<None Include="Skins\SilverColor1.ssk" />
<None Include="Skins\SilverColor2.ssk" />
<None Include="Skins\SportsBlack.ssk" />
<None Include="Skins\SportsBlue.ssk" />
<None Include="Skins\SportsCyan.ssk" />
<None Include="Skins\SportsGreen.ssk" />
<None Include="Skins\SportsOrange.ssk" />
<None Include="Skins\SteelBlack.ssk" />
<None Include="Skins\SteelBlue.ssk" />
<None Include="Skins\vista1.ssk" />
<None Include="Skins\vista1_green.ssk" />
<None Include="Skins\Vista2_color1.ssk" />
<None Include="Skins\Vista2_color2.ssk" />
<None Include="Skins\Vista2_color3.ssk" />
<None Include="Skins\Vista2_color4.ssk" />
<None Include="Skins\Vista2_color5.ssk" />
<None Include="Skins\Vista2_color6.ssk" />
<None Include="Skins\Vista2_color7.ssk" />
<None Include="Skins\Warm.ssk" />
<None Include="Skins\WarmColor1.ssk" />
<None Include="Skins\WarmColor2.ssk" />
<None Include="Skins\WarmColor3.ssk" />
<None Include="Skins\Wave.ssk" />
<None Include="Skins\WaveColor1.ssk" />
<None Include="Skins\WaveColor2.ssk" />
<None Include="Skins\XPBlue.ssk" />
<None Include="Skins\XPGreen.ssk" />
<None Include="Skins\XPOrange.ssk" />
<None Include="Skins\XPSilver.ssk" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
......
......@@ -8,7 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.ACSingleStore
namespace OnlineStore.AutoInOutStore
{
public class FormManager
{
......
namespace OnlineStore.ACSingleStore
namespace OnlineStore.AutoInOutStore
{
partial class FrmAxisDebug
{
......@@ -54,6 +54,11 @@
this.btnComMove = new System.Windows.Forms.Button();
this.txtComSpeed = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.txtAutoPosition = new System.Windows.Forms.TextBox();
this.btnAutoMovej = new System.Windows.Forms.Button();
this.btnAutoMove = new System.Windows.Forms.Button();
this.txtAutoSpeed = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
......@@ -178,7 +183,7 @@
//
// button1
//
this.button1.Location = new System.Drawing.Point(401, 336);
this.button1.Location = new System.Drawing.Point(406, 401);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(126, 37);
this.button1.TabIndex = 16;
......@@ -232,7 +237,7 @@
//
// txtComPosition
//
this.txtComPosition.Location = new System.Drawing.Point(551, 240);
this.txtComPosition.Location = new System.Drawing.Point(551, 290);
this.txtComPosition.Name = "txtComPosition";
this.txtComPosition.Size = new System.Drawing.Size(108, 23);
this.txtComPosition.TabIndex = 26;
......@@ -240,7 +245,7 @@
// btnComMovej
//
this.btnComMovej.BackColor = System.Drawing.SystemColors.Control;
this.btnComMovej.Location = new System.Drawing.Point(401, 235);
this.btnComMovej.Location = new System.Drawing.Point(401, 285);
this.btnComMovej.Name = "btnComMovej";
this.btnComMovej.Size = new System.Drawing.Size(131, 36);
this.btnComMovej.TabIndex = 25;
......@@ -252,7 +257,7 @@
// btnComMove
//
this.btnComMove.BackColor = System.Drawing.SystemColors.Control;
this.btnComMove.Location = new System.Drawing.Point(266, 235);
this.btnComMove.Location = new System.Drawing.Point(266, 285);
this.btnComMove.Name = "btnComMove";
this.btnComMove.Size = new System.Drawing.Size(131, 36);
this.btnComMove.TabIndex = 24;
......@@ -263,7 +268,7 @@
//
// txtComSpeed
//
this.txtComSpeed.Location = new System.Drawing.Point(150, 240);
this.txtComSpeed.Location = new System.Drawing.Point(150, 290);
this.txtComSpeed.Name = "txtComSpeed";
this.txtComSpeed.Size = new System.Drawing.Size(108, 23);
this.txtComSpeed.TabIndex = 23;
......@@ -271,17 +276,69 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(39, 242);
this.label4.Location = new System.Drawing.Point(39, 292);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(92, 17);
this.label4.TabIndex = 22;
this.label4.Text = "(轴四)压紧轴";
//
// txtAutoPosition
//
this.txtAutoPosition.Location = new System.Drawing.Point(551, 235);
this.txtAutoPosition.Name = "txtAutoPosition";
this.txtAutoPosition.Size = new System.Drawing.Size(108, 23);
this.txtAutoPosition.TabIndex = 31;
//
// btnAutoMovej
//
this.btnAutoMovej.BackColor = System.Drawing.SystemColors.Control;
this.btnAutoMovej.Location = new System.Drawing.Point(401, 230);
this.btnAutoMovej.Name = "btnAutoMovej";
this.btnAutoMovej.Size = new System.Drawing.Size(131, 36);
this.btnAutoMovej.TabIndex = 30;
this.btnAutoMovej.Text = "自动轴-(向下)";
this.btnAutoMovej.UseVisualStyleBackColor = false;
this.btnAutoMovej.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnAutoMovej_MouseDown);
this.btnAutoMovej.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnAutoMovej_MouseUp);
//
// btnAutoMove
//
this.btnAutoMove.BackColor = System.Drawing.SystemColors.Control;
this.btnAutoMove.Location = new System.Drawing.Point(266, 230);
this.btnAutoMove.Name = "btnAutoMove";
this.btnAutoMove.Size = new System.Drawing.Size(131, 36);
this.btnAutoMove.TabIndex = 29;
this.btnAutoMove.Text = "自动轴+(向上)";
this.btnAutoMove.UseVisualStyleBackColor = false;
this.btnAutoMove.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnAutoMove_MouseDown);
this.btnAutoMove.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnAutoMove_MouseUp);
//
// txtAutoSpeed
//
this.txtAutoSpeed.Location = new System.Drawing.Point(150, 235);
this.txtAutoSpeed.Name = "txtAutoSpeed";
this.txtAutoSpeed.Size = new System.Drawing.Size(108, 23);
this.txtAutoSpeed.TabIndex = 28;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(39, 237);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(92, 17);
this.label7.TabIndex = 27;
this.label7.Text = "(轴五)自动轴";
//
// FrmAxisDebug
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(707, 413);
this.ClientSize = new System.Drawing.Size(707, 450);
this.Controls.Add(this.txtAutoPosition);
this.Controls.Add(this.btnAutoMovej);
this.Controls.Add(this.btnAutoMove);
this.Controls.Add(this.txtAutoSpeed);
this.Controls.Add(this.label7);
this.Controls.Add(this.txtComPosition);
this.Controls.Add(this.btnComMovej);
this.Controls.Add(this.btnComMove);
......@@ -343,5 +400,10 @@
private System.Windows.Forms.Button btnComMove;
private System.Windows.Forms.TextBox txtComSpeed;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtAutoPosition;
private System.Windows.Forms.Button btnAutoMovej;
private System.Windows.Forms.Button btnAutoMove;
private System.Windows.Forms.TextBox txtAutoSpeed;
private System.Windows.Forms.Label label7;
}
}
\ No newline at end of file
......@@ -13,7 +13,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.ACSingleStore
namespace OnlineStore.AutoInOutStore
{
public partial class FrmAxisDebug : FrmBase
......@@ -23,6 +23,7 @@ namespace OnlineStore.ACSingleStore
private ConfigMoveAxis updown = null;
//private ConfigMoveAxis compress = null;
private ConfigMoveAxis inout = null;
private ConfigMoveAxis auto = null;
private int compress_Slv = 0;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
......@@ -32,6 +33,7 @@ namespace OnlineStore.ACSingleStore
updown = boxBean.Config.UpDown_Axis;
compress_Slv = boxBean.Config.CompressAxis_Slv;
inout = boxBean.Config.InOut_Axis;
auto = boxBean.Config.Auto_Axis;
InitializeComponent();
txtComSpeed.Text = boxBean.Config.CompressAxis_EndSpeed.ToString();
this.Text = boxBean.StoreName + "_轴点动调试";
......@@ -48,7 +50,8 @@ namespace OnlineStore.ACSingleStore
txtMiddleSpeed.Text = middle.TargetSpeed.ToString();
txtInOutSpeed.Text = inout.TargetSpeed.ToString();
txtUpDownSpeed.Text = updown.TargetSpeed.ToString();
txtComSpeed.Text = ACStoreManager.store.Config.CompressAxis_EndSpeed.ToString();
txtAutoSpeed.Text = auto.TargetSpeed.ToString();
txtComSpeed.Text = AutoStoreManager.Config.CompressAxis_EndSpeed.ToString();
timer1.Start();
}
/// <summary>
......@@ -132,7 +135,7 @@ namespace OnlineStore.ACSingleStore
{
if (this.btnInOutMove.BackColor .Equals(System.Drawing.SystemColors.Control))
{
if (ACStoreManager.store.InOutAxisCanMove().Equals(false))
if (AutoStoreManager.Store.InOutAxisCanMove().Equals(false))
{
MessageBox.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
......@@ -219,7 +222,7 @@ namespace OnlineStore.ACSingleStore
{
if (btnInOutMovej.BackColor.Equals(System.Drawing.SystemColors.Control))
{
if (ACStoreManager.store.InOutAxisCanMove().Equals(false))
if (AutoStoreManager.Store.InOutAxisCanMove().Equals(false))
{
MessageBox.Show("定位气缸不在下降端,不能移动进出轴", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
......@@ -340,5 +343,62 @@ namespace OnlineStore.ACSingleStore
txtInOutPosition.Text = inoutPosition.ToString();
}
}
private void UpdateAutoPosition()
{
int inoutPosition = ACServerManager.GetTargetPosition(inout.DeviceName, inout.GetAxisValue());
if (!txtInOutPosition.Text.Equals(inoutPosition.ToString()))
{
txtInOutPosition.Text = inoutPosition.ToString();
}
}
private void btnAutoMove_MouseDown(object sender, MouseEventArgs e)
{
if (btnAutoMove.BackColor.Equals(System.Drawing.SystemColors.Control))
{
int speed = FormUtil.GetIntValue(txtAutoSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
}
btnAutoMove.BackColor = Color.Green;
AxisMove(auto, speed);
}
}
private void btnAutoMove_MouseUp(object sender, MouseEventArgs e)
{
if (btnAutoMove.BackColor == Color.Green)
{
btnAutoMove.BackColor = System.Drawing.SystemColors.Control;
ACServerManager.SuddenStop(auto.DeviceName, auto.GetAxisValue());
UpdateAutoPosition();
}
}
private void btnAutoMovej_MouseDown(object sender, MouseEventArgs e)
{
if (btnAutoMovej.BackColor.Equals(System.Drawing.SystemColors.Control))
{
int speed = FormUtil.GetIntValue(txtAutoSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
}
btnAutoMovej.BackColor = Color.Green;
AxisMove(auto, -speed);
}
}
private void btnAutoMovej_MouseUp(object sender, MouseEventArgs e)
{
if (btnAutoMovej.BackColor == Color.Green)
{
btnAutoMovej.BackColor = System.Drawing.SystemColors.Control;
ACServerManager.SuddenStop(auto.DeviceName, auto.GetAxisValue());
UpdateAutoPosition();
}
}
}
}
namespace OnlineStore.ACSingleStore
namespace OnlineStore.AutoInOutStore
{
partial class FrmBase
{
......
......@@ -9,7 +9,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.ACSingleStore
namespace OnlineStore.AutoInOutStore
{
public partial class FrmBase : Form
{
......
namespace OnlineStore.ACSingleStore
{
partial class FrmCamera
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.btnCloseCamera = new System.Windows.Forms.Button();
this.btnGetImage = new System.Windows.Forms.Button();
this.btnOpen = new System.Windows.Forms.Button();
this.hWindowControl1 = new HalconDotNet.HWindowControl();
this.btnExit = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// timer1
//
this.timer1.Interval = 5000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// richTextBox1
//
this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.richTextBox1.Location = new System.Drawing.Point(496, 216);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(165, 167);
this.richTextBox1.TabIndex = 4;
this.richTextBox1.Text = "";
//
// btnCloseCamera
//
this.btnCloseCamera.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnCloseCamera.Location = new System.Drawing.Point(523, 90);
this.btnCloseCamera.Name = "btnCloseCamera";
this.btnCloseCamera.Size = new System.Drawing.Size(135, 35);
this.btnCloseCamera.TabIndex = 3;
this.btnCloseCamera.Text = "关闭 ";
this.btnCloseCamera.UseVisualStyleBackColor = true;
this.btnCloseCamera.Click += new System.EventHandler(this.btnCloseCamera_Click);
//
// btnGetImage
//
this.btnGetImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnGetImage.Location = new System.Drawing.Point(523, 51);
this.btnGetImage.Name = "btnGetImage";
this.btnGetImage.Size = new System.Drawing.Size(135, 35);
this.btnGetImage.TabIndex = 2;
this.btnGetImage.Text = "扫码测试";
this.btnGetImage.UseVisualStyleBackColor = true;
this.btnGetImage.Click += new System.EventHandler(this.btnGetImage_Click);
//
// btnOpen
//
this.btnOpen.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnOpen.Location = new System.Drawing.Point(523, 12);
this.btnOpen.Name = "btnOpen";
this.btnOpen.Size = new System.Drawing.Size(135, 35);
this.btnOpen.TabIndex = 1;
this.btnOpen.Text = "打开 ";
this.btnOpen.UseVisualStyleBackColor = true;
this.btnOpen.Click += new System.EventHandler(this.btnOpen_Click);
//
// hWindowControl1
//
this.hWindowControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.hWindowControl1.BackColor = System.Drawing.Color.Black;
this.hWindowControl1.BorderColor = System.Drawing.Color.Black;
this.hWindowControl1.ImagePart = new System.Drawing.Rectangle(0, 0, 640, 480);
this.hWindowControl1.Location = new System.Drawing.Point(12, 12);
this.hWindowControl1.Name = "hWindowControl1";
this.hWindowControl1.Size = new System.Drawing.Size(478, 371);
this.hWindowControl1.TabIndex = 5;
this.hWindowControl1.WindowSize = new System.Drawing.Size(478, 371);
//
// btnExit
//
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.Location = new System.Drawing.Point(523, 168);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(135, 35);
this.btnExit.TabIndex = 6;
this.btnExit.Text = "返回(&B)";
this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// FrmCamera
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(670, 395);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.hWindowControl1);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.btnCloseCamera);
this.Controls.Add(this.btnGetImage);
this.Controls.Add(this.btnOpen);
this.Name = "FrmCamera";
this.Text = "二维码识别测试";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmCamera_FormClosed);
this.Load += new System.EventHandler(this.FrmCamera_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnOpen;
private System.Windows.Forms.Button btnGetImage;
private System.Windows.Forms.Button btnCloseCamera;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Timer timer1;
private HalconDotNet.HWindowControl hWindowControl1;
private System.Windows.Forms.Button btnExit;
}
}
\ No newline at end of file

using HalconDotNet;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace OnlineStore.ACSingleStore
{
public partial class FrmCamera : FrmBase
{
private AC_SA_BoxBean store = null;
public FrmCamera(AC_SA_BoxBean store)
{
this.store = store;
InitializeComponent();
}
private void btnOpen_Click(object sender, EventArgs e)
{
HDevelopExport.CloseAllCamera();
store.KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.HIGH);
HDevelopExport.OpenAllCamera();
FormStatus(true);
}
private void FormStatus(bool open)
{
btnOpen.Enabled = !open;
btnCloseCamera.Enabled = open;
btnGetImage.Enabled = open;
timer1.Enabled = open;
}
private void btnGetImage_Click(object sender, EventArgs e)
{
List<string> allCodeList = new List<string>();
foreach (string cameraName in HDevelopExport.cameraNameList)
{
HObject ho_Image = HDevelopExport.GrabImage(cameraName);
List<string> codeList = HDevelopExport.GetCode(ho_Image);
allCodeList.AddRange(codeList);
}
if (allCodeList != null)
{
this.richTextBox1.Clear();
foreach (string str in allCodeList)
{
this.richTextBox1.AppendText(str);
}
}
}
private void btnCloseCamera_Click(object sender, EventArgs e)
{
store.KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
HDevelopExport.CloseAllCamera();
FormStatus(false);
}
private void FrmCamera_Load(object sender, EventArgs e)
{
FormStatus(false);
}
private void FrmCamera_FormClosed(object sender, FormClosedEventArgs e)
{
if (btnCloseCamera.Enabled.Equals(true))
{
store.KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
HDevelopExport.CloseAllCamera();
FormStatus(false);
}
}
private int preIndex = 0;
int dWidth = 0; int dHeight = 0;
private void timer1_Tick(object sender, EventArgs e)
{
preIndex++;
HObject ho_Image = null;
int index = preIndex % HDevelopExport.cameraNameList.Count;
ho_Image = HDevelopExport.GrabImage(HDevelopExport.cameraNameList[index]);
if (ho_Image != null)
{
if (dWidth <= 0)
{
HTuple width, height;
//int dWidth = 0; int dHeight = 0;
HOperatorSet.GetImageSize(ho_Image, out width, out height);
dWidth = (int)width.D;
dHeight = (int)height.D;
hWindowControl1.HalconWindow.SetPart(0, 0, dHeight, dWidth);
}
HOperatorSet.DispObj(ho_Image, hWindowControl1.HalconWindow);
List<string> codeList = HDevelopExport.GetCode(ho_Image);
if (codeList != null)
{
this.richTextBox1.Clear();
this.richTextBox1.AppendText(DateTime.Now.ToString()+ "读到二维码:" + "\r\n");
LogUtil.info("读取到的二维码列表" + "\r\n");
foreach (string str in codeList)
{
this.richTextBox1.AppendText(str + "\r\n");
LogUtil.info(str + "\r\n");
}
}
}
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
<?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>
<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>
\ No newline at end of file
namespace OnlineStore.ACSingleStore
namespace OnlineStore.AutoInOutStore
{
partial class FrmIOStatus
{
......@@ -48,25 +48,9 @@
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.txtHeight = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.txtAIResult3 = new System.Windows.Forms.TextBox();
this.txtAIResult2 = new System.Windows.Forms.TextBox();
this.txtAIResult1 = new System.Windows.Forms.TextBox();
this.txtAI3 = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.txtAI2 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.txtAI1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.txtSize = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// timer1
......@@ -104,9 +88,9 @@
this.groupBox1.Controls.Add(this.btnCloseDoor);
this.groupBox1.Controls.Add(this.btnOpenDoor);
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(482, 164);
this.groupBox1.Location = new System.Drawing.Point(482, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(332, 358);
this.groupBox1.Size = new System.Drawing.Size(332, 514);
this.groupBox1.TabIndex = 105;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "DO写入";
......@@ -462,196 +446,12 @@
this.tableLayoutPanel1.Size = new System.Drawing.Size(218, 542);
this.tableLayoutPanel1.TabIndex = 102;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.txtSize);
this.groupBox2.Controls.Add(this.label10);
this.groupBox2.Controls.Add(this.txtHeight);
this.groupBox2.Controls.Add(this.label9);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.txtAIResult3);
this.groupBox2.Controls.Add(this.txtAIResult2);
this.groupBox2.Controls.Add(this.txtAIResult1);
this.groupBox2.Controls.Add(this.txtAI3);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.txtAI2);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.txtAI1);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Location = new System.Drawing.Point(482, 8);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(332, 150);
this.groupBox2.TabIndex = 245;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "高度传感器";
//
// txtHeight
//
this.txtHeight.Enabled = false;
this.txtHeight.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtHeight.Location = new System.Drawing.Point(89, 116);
this.txtHeight.MaxLength = 10;
this.txtHeight.Name = "txtHeight";
this.txtHeight.Size = new System.Drawing.Size(71, 23);
this.txtHeight.TabIndex = 254;
this.txtHeight.Text = "0";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label9.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label9.Location = new System.Drawing.Point(15, 119);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(68, 17);
this.label9.TabIndex = 253;
this.label9.Text = "料盘高度:";
this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label8.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label8.Location = new System.Drawing.Point(170, 56);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(22, 17);
this.label8.TabIndex = 252;
this.label8.Text = "->";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtAIResult3
//
this.txtAIResult3.Enabled = false;
this.txtAIResult3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtAIResult3.Location = new System.Drawing.Point(203, 82);
this.txtAIResult3.MaxLength = 10;
this.txtAIResult3.Name = "txtAIResult3";
this.txtAIResult3.Size = new System.Drawing.Size(121, 23);
this.txtAIResult3.TabIndex = 251;
this.txtAIResult3.Text = "0";
//
// txtAIResult2
//
this.txtAIResult2.Enabled = false;
this.txtAIResult2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtAIResult2.Location = new System.Drawing.Point(203, 53);
this.txtAIResult2.MaxLength = 10;
this.txtAIResult2.Name = "txtAIResult2";
this.txtAIResult2.Size = new System.Drawing.Size(121, 23);
this.txtAIResult2.TabIndex = 250;
this.txtAIResult2.Text = "0";
//
// txtAIResult1
//
this.txtAIResult1.Enabled = false;
this.txtAIResult1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtAIResult1.Location = new System.Drawing.Point(203, 24);
this.txtAIResult1.MaxLength = 10;
this.txtAIResult1.Name = "txtAIResult1";
this.txtAIResult1.Size = new System.Drawing.Size(121, 23);
this.txtAIResult1.TabIndex = 249;
this.txtAIResult1.Text = "0";
//
// txtAI3
//
this.txtAI3.Enabled = false;
this.txtAI3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtAI3.Location = new System.Drawing.Point(39, 82);
this.txtAI3.MaxLength = 10;
this.txtAI3.Name = "txtAI3";
this.txtAI3.Size = new System.Drawing.Size(121, 23);
this.txtAI3.TabIndex = 248;
this.txtAI3.Text = "0";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label7.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label7.Location = new System.Drawing.Point(15, 85);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(27, 17);
this.label7.TabIndex = 247;
this.label7.Text = "3:";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtAI2
//
this.txtAI2.Enabled = false;
this.txtAI2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtAI2.Location = new System.Drawing.Point(39, 53);
this.txtAI2.MaxLength = 10;
this.txtAI2.Name = "txtAI2";
this.txtAI2.Size = new System.Drawing.Size(121, 23);
this.txtAI2.TabIndex = 246;
this.txtAI2.Text = "0";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label4.Location = new System.Drawing.Point(15, 56);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(27, 17);
this.label4.TabIndex = 245;
this.label4.Text = "2:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtAI1
//
this.txtAI1.Enabled = false;
this.txtAI1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtAI1.Location = new System.Drawing.Point(39, 24);
this.txtAI1.MaxLength = 10;
this.txtAI1.Name = "txtAI1";
this.txtAI1.Size = new System.Drawing.Size(121, 23);
this.txtAI1.TabIndex = 244;
this.txtAI1.Text = "0";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label1.Location = new System.Drawing.Point(15, 27);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(27, 17);
this.label1.TabIndex = 243;
this.label1.Text = "1:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtSize
//
this.txtSize.Enabled = false;
this.txtSize.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtSize.Location = new System.Drawing.Point(253, 116);
this.txtSize.MaxLength = 10;
this.txtSize.Name = "txtSize";
this.txtSize.Size = new System.Drawing.Size(71, 23);
this.txtSize.TabIndex = 256;
this.txtSize.Text = "0";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label10.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label10.Location = new System.Drawing.Point(179, 119);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(68, 17);
this.label10.TabIndex = 255;
this.label10.Text = "料盘尺寸:";
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// FrmIOStatus
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(829, 580);
this.Controls.Add(this.button1);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox3);
......@@ -667,8 +467,6 @@
this.groupBox1.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
......@@ -708,21 +506,6 @@
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btnCloseLed;
private System.Windows.Forms.Button btnOpenLed;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox txtAI3;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox txtAI2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtAI1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtAIResult3;
private System.Windows.Forms.TextBox txtAIResult2;
private System.Windows.Forms.TextBox txtAIResult1;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox txtHeight;
private System.Windows.Forms.TextBox txtSize;
private System.Windows.Forms.Label label10;
}
}
......@@ -18,7 +18,7 @@ using OnlineStore.LoadCSVLibrary;
using OnlineStore.Common;
namespace OnlineStore.ACSingleStore
namespace OnlineStore.AutoInOutStore
{
public partial class FrmIOStatus : FrmBase
{
......@@ -213,20 +213,6 @@ namespace OnlineStore.ACSingleStore
}
}
double ai1Value = KNDAIManager.GetAIValue(boxBean.Config.AIDevice_IP, 1);
double ai2Value = KNDAIManager.GetAIValue(boxBean.Config.AIDevice_IP, 2);
double ai3Value = KNDAIManager.GetAIValue(boxBean.Config.AIDevice_IP, 3);
txtAI1.Text = ai1Value.ToString();
txtAI2.Text = ai2Value.ToString();
txtAI3.Text = ai3Value.ToString();
txtAIResult1.Text = KNDAIManager.ConvertAI(ai1Value,boxBean.Config.AIDI1_DefaultPosition).ToString();
txtAIResult2.Text = KNDAIManager.ConvertAI(ai2Value, boxBean.Config.AIDI2_DefaultPosition).ToString();
txtAIResult3.Text = KNDAIManager.ConvertAI(ai3Value, boxBean.Config.AIDI3_DefaultPosition).ToString();
txtHeight.Text = boxBean.GetHeight().ToString();
txtSize.Text = boxBean.GetSize().ToString();
}
private void btnReadAllDi_Click(object sender, EventArgs e)
......
namespace OnlineStore.ACSingleStore
namespace OnlineStore.AutoInOutStore
{
partial class FrmPwd
{
......
......@@ -10,7 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.ACSingleStore
namespace OnlineStore.AutoInOutStore
{
public partial class FrmPwd : FrmBase
{
......
namespace OnlineStore.ACSingleStore
namespace OnlineStore.AutoInOutStore
{
partial class FrmStoreBox
{
......@@ -71,9 +71,6 @@
this.label49 = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.axis_1_Alarm = new UserFromControl.IOStatusControl();
this.axis_3_Alarm = new UserFromControl.IOStatusControl();
this.axis_2_Alarm = new UserFromControl.IOStatusControl();
this.label38 = new System.Windows.Forms.Label();
this.txtMiddleTarget = new System.Windows.Forms.TextBox();
this.txtInoutTarget = new System.Windows.Forms.TextBox();
......@@ -196,6 +193,9 @@
this.btnLineAbsMove = new System.Windows.Forms.Button();
this.label25 = new System.Windows.Forms.Label();
this.comboBoxPortName = new System.Windows.Forms.ComboBox();
this.axis_1_Alarm = new UserFromControl.IOStatusControl();
this.axis_3_Alarm = new UserFromControl.IOStatusControl();
this.axis_2_Alarm = new UserFromControl.IOStatusControl();
this.groupBox5.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
......@@ -753,7 +753,7 @@
this.richTextBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.richTextBox1.Location = new System.Drawing.Point(7, 525);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(496, 229);
this.richTextBox1.Size = new System.Drawing.Size(496, 212);
this.richTextBox1.TabIndex = 256;
this.richTextBox1.Text = "";
//
......@@ -788,36 +788,6 @@
this.groupBox1.TabStop = false;
this.groupBox1.Text = "伺服状态";
//
// axis_1_Alarm
//
this.axis_1_Alarm.IOName = "";
this.axis_1_Alarm.IOValue = 0;
this.axis_1_Alarm.isCanClick = false;
this.axis_1_Alarm.Location = new System.Drawing.Point(127, 49);
this.axis_1_Alarm.Name = "axis_1_Alarm";
this.axis_1_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_1_Alarm.TabIndex = 264;
//
// axis_3_Alarm
//
this.axis_3_Alarm.IOName = "";
this.axis_3_Alarm.IOValue = 0;
this.axis_3_Alarm.isCanClick = false;
this.axis_3_Alarm.Location = new System.Drawing.Point(329, 49);
this.axis_3_Alarm.Name = "axis_3_Alarm";
this.axis_3_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_3_Alarm.TabIndex = 266;
//
// axis_2_Alarm
//
this.axis_2_Alarm.IOName = "";
this.axis_2_Alarm.IOValue = 0;
this.axis_2_Alarm.isCanClick = false;
this.axis_2_Alarm.Location = new System.Drawing.Point(224, 49);
this.axis_2_Alarm.Name = "axis_2_Alarm";
this.axis_2_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_2_Alarm.TabIndex = 265;
//
// label38
//
this.label38.AutoSize = true;
......@@ -1829,38 +1799,38 @@
// 轴卡点动ToolStripMenuItem
//
this.轴卡点动ToolStripMenuItem.Name = "轴卡点动ToolStripMenuItem";
this.轴卡点动ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
this.轴卡点动ToolStripMenuItem.Size = new System.Drawing.Size(160, 26);
this.轴卡点动ToolStripMenuItem.Text = "轴卡点动";
this.轴卡点动ToolStripMenuItem.Click += new System.EventHandler(this.轴卡点动ToolStripMenuItem_Click);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(189, 6);
this.toolStripSeparator9.Size = new System.Drawing.Size(157, 6);
//
// 扫码测试ToolStripMenuItem
//
this.扫码测试ToolStripMenuItem.Name = "扫码测试ToolStripMenuItem";
this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(160, 26);
this.扫码测试ToolStripMenuItem.Text = "扫码测试";
this.扫码测试ToolStripMenuItem.Click += new System.EventHandler(this.扫码测试ToolStripMenuItem_Click);
//
// toolStripSeparator10
//
this.toolStripSeparator10.Name = "toolStripSeparator10";
this.toolStripSeparator10.Size = new System.Drawing.Size(189, 6);
this.toolStripSeparator10.Size = new System.Drawing.Size(157, 6);
//
// 摄像机调试ToolStripMenuItem
//
this.摄像机调试ToolStripMenuItem.Name = "摄像机调试ToolStripMenuItem";
this.摄像机调试ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.摄像机调试ToolStripMenuItem.Size = new System.Drawing.Size(160, 26);
this.摄像机调试ToolStripMenuItem.Text = "二维码学习";
this.摄像机调试ToolStripMenuItem.Click += new System.EventHandler(this.摄像机调试ToolStripMenuItem_Click);
//
// toolStripSeparator11
//
this.toolStripSeparator11.Name = "toolStripSeparator11";
this.toolStripSeparator11.Size = new System.Drawing.Size(189, 6);
this.toolStripSeparator11.Size = new System.Drawing.Size(157, 6);
//
// 配置信息ToolStripMenuItem
//
......@@ -2195,6 +2165,36 @@
this.comboBoxPortName.Size = new System.Drawing.Size(103, 25);
this.comboBoxPortName.TabIndex = 0;
//
// axis_1_Alarm
//
this.axis_1_Alarm.IOName = "";
this.axis_1_Alarm.IOValue = 0;
this.axis_1_Alarm.isCanClick = false;
this.axis_1_Alarm.Location = new System.Drawing.Point(127, 49);
this.axis_1_Alarm.Name = "axis_1_Alarm";
this.axis_1_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_1_Alarm.TabIndex = 264;
//
// axis_3_Alarm
//
this.axis_3_Alarm.IOName = "";
this.axis_3_Alarm.IOValue = 0;
this.axis_3_Alarm.isCanClick = false;
this.axis_3_Alarm.Location = new System.Drawing.Point(329, 49);
this.axis_3_Alarm.Name = "axis_3_Alarm";
this.axis_3_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_3_Alarm.TabIndex = 266;
//
// axis_2_Alarm
//
this.axis_2_Alarm.IOName = "";
this.axis_2_Alarm.IOValue = 0;
this.axis_2_Alarm.isCanClick = false;
this.axis_2_Alarm.Location = new System.Drawing.Point(224, 49);
this.axis_2_Alarm.Name = "axis_2_Alarm";
this.axis_2_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_2_Alarm.TabIndex = 265;
//
// FrmStoreBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
......@@ -2211,7 +2211,7 @@
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "FrmStoreBox";
this.Text = "AC_SA_料仓";
this.Text = "料仓_自动上下料";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmTest_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmStoreBox_FormClosed);
......
......@@ -18,7 +18,7 @@ using System.IO.Ports;
using OnlineStore.LoadCSVLibrary;
using CodeLibrary;
namespace OnlineStore.ACSingleStore
namespace OnlineStore.AutoInOutStore
{
public partial class FrmStoreBox : FrmBase
{
......@@ -40,7 +40,7 @@ namespace OnlineStore.ACSingleStore
}
private void InitStoreValue()
{
this.store = ACStoreManager.InitStore();
this.store = AutoStoreManager.InitStore();
if (store == null)
{
LogUtil.error(LOGGER, "找不到对应的料仓");
......@@ -52,12 +52,12 @@ namespace OnlineStore.ACSingleStore
cmbAxisList.ValueMember = "Explain";
cmbAxisList.SelectedIndex = 0;
ACStorePosition ktkPosition = null;
AutoStorePosition ktkPosition = null;
if (store.PositionNumList.Count > 0)
{
cmbPosition.DataSource = store.PositionNumList;
cmbPosition.SelectedIndex = 0;
ktkPosition = CSVPositionReader<ACStorePosition>.GetPositon(cmbPosition.Text);
ktkPosition = CSVPositionReader<AutoStorePosition>.GetPositon(cmbPosition.Text);
//store.PositionNumList = positionNumList;
}
......@@ -228,15 +228,8 @@ namespace OnlineStore.ACSingleStore
if (store.Config.IsHasDoorLimit.Equals(1))
{
//if (store.KNDIOValue(IO_Type.Left_Door_LimitSingle).Equals(IO_VALUE.LOW))
//{
// lblWarnMsg.Text = lblWarnMsg.Text + " 左侧门未关";
//}
//if (store.KNDIOValue(IO_Type.Right_Door_LimitSingle).Equals(IO_VALUE.LOW))
//{
// lblWarnMsg.Text = lblWarnMsg.Text + " 右侧门未关";
//}
if (store.KNDIOValue(IO_Type.Door_LimitSingle).Equals(IO_VALUE.LOW))
if (store.KNDIOValue(IO_Type.DoorColse_Single).Equals(IO_VALUE.LOW))
{
lblWarnMsg.Text = lblWarnMsg.Text + " 前门未关";
}
......@@ -281,17 +274,6 @@ namespace OnlineStore.ACSingleStore
lblWarnMsg.Text = "";
btnStartAuTo.Text = "开始自动出入库";
}
//if (WCFControl.isRun)
//{
// btnOpenWCF.Enabled = false;
// btnCloseWCF.Enabled = true;
//}
//else
//{
// btnOpenWCF.Enabled = true ;
// btnCloseWCF.Enabled = false ;
//}
}
private void ReadPosistion()
......@@ -453,7 +435,7 @@ namespace OnlineStore.ACSingleStore
if (cmbPosition.SelectedIndex >= 0)
{
string selectPositionNum = cmbPosition.Text;
ACStorePosition ktkPosition = CSVPositionReader<ACStorePosition>.GetPositon(selectPositionNum);
AutoStorePosition ktkPosition = CSVPositionReader<AutoStorePosition>.GetPositon(selectPositionNum);
if (ktkPosition != null)
{
......@@ -607,7 +589,7 @@ namespace OnlineStore.ACSingleStore
{
//料仓格子位置保存
string selectPositionNum = cmbPosition.Text;
ACStorePosition ktkPosition = CSVPositionReader<ACStorePosition>.GetPositon(selectPositionNum);
AutoStorePosition ktkPosition = CSVPositionReader<AutoStorePosition>.GetPositon(selectPositionNum);
if (ktkPosition != null)
{
ktkPosition.MiddleAxis_Position_P2 = FormUtil.GetIntValue(txtMiddleP2);
......@@ -635,7 +617,7 @@ namespace OnlineStore.ACSingleStore
{
positionConfigFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config, "_" + store.StoreID.ToString());
}
bool result = CSVPositionReader<ACStorePosition>.SavePostion(positionConfigFile, ktkPosition);
bool result = CSVPositionReader<AutoStorePosition>.SavePostion(positionConfigFile, ktkPosition);
if (!result)
{
MessageBox.Show("保存位置失败!");
......@@ -692,7 +674,7 @@ namespace OnlineStore.ACSingleStore
if (needUpdate)
{
//更新缓存
ACStoreManager.UpdateBoxConfig(store.Config);
AutoStoreManager.UpdateBoxConfig(store.Config);
}
}
......@@ -1271,7 +1253,7 @@ namespace OnlineStore.ACSingleStore
KNDManager.CloseAllDO();
StoreOpenStatus(false);
KNDManager.CloseAllConnection();
KNDAIManager.CloseAllConnection();
//KNDAIManager.CloseAllConnection();
//WCFControl.CloseWCF();
System.Environment.Exit(System.Environment.ExitCode);
}
......@@ -1338,7 +1320,7 @@ namespace OnlineStore.ACSingleStore
}
private void btnOpen_Click(object sender, EventArgs e)
{
if (ACStoreManager.OpenShuoKe(store))
if (AutoStoreManager.OpenShuoKe(store))
{
store.SetShuokeSpeed();
FormComStatus(true);
......
......@@ -5,7 +5,7 @@ using System.Text;
using System.Windows;
using System.Windows.Forms;
namespace OnlineStore.ACSingleStore
namespace OnlineStore.AutoInOutStore
{
public class ManagerUtil
{
......
using log4net;
using log4net.Config;
using OnlineStore.Common;
using OnlineStore.ACSingleStore;
using OnlineStore.AutoInOutStore;
using System;
using System.Collections.Generic;
using System.Diagnostics;
......@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.ACSingleStore
namespace OnlineStore.AutoInOutStore
{
static class Program
{
......
......@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace OnlineStore.ACSingleStore.Properties {
namespace OnlineStore.AutoInOutStore.Properties {
using System;
......@@ -39,7 +39,7 @@ namespace OnlineStore.ACSingleStore.Properties {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OnlineStore.ACSingleStore.Properties.Resources", typeof(Resources).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OnlineStore.AutoInOutStore.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
......
......@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace OnlineStore.ACSingleStore.Properties {
namespace OnlineStore.AutoInOutStore.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
......
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.ServiceModel;
using System.Text;
namespace OnlineStore.ACSingleStore
{
public class WCFControl
{
//public static bool isRun=false;
//public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//private static ServiceHost host = null;
//public static void OpenWCF()
//{
// if (isRun)
// {
// return;
// }
// try
// {
// if (host == null)
// {
// host = new ServiceHost(typeof(AcStoreWCF.CWSMDBox));
// }
// if (host.State != CommunicationState.Opening)
// {
// host.Open();
// }
// isRun = true;
// LogUtil.info("打开WCF服务成功");
// }
// catch (Exception ex)
// {
// LogUtil.error("打开WCF服务出错:" + ex.ToString());
// }
//}
//public static void CloseWCF()
//{
// try
// {
// isRun = false;
// if (host != null)
// {
// host.Close();
// }
// LogUtil.info("关闭WCF服务成功");
// }
// catch (Exception ex)
// {
// LogUtil.error("关闭WCF服务出错:" + ex.ToString());
// }
//}
}
}

120181022新建分支RC26-LDACSingleStore联电料仓
120181022新建分支RC26-LDACSingleStore联电料仓
需要修改内容:
1.使用硕科步进电机作为压紧轴
2.温湿度修改为com通信
......@@ -9,12 +7,10 @@
20181107
1.出库时等待10秒钟,或等待拿走料盘(高度=0)才算出库结束
20181108
20181108
// 机器状态 顶灯显示
// 绿 黄 红
//机器复位中 闪 灭 灭
......@@ -25,10 +21,52 @@
//机器未启动 灭 灭 灭
//机器设备故障(非温湿度)报警 亮 灭 闪
20181115
界面显示增加密码框
旋转轴和升降轴移动时,叉子需要在待机位
20181203
修改名称,删除不需要的文件,增加新的自动料仓的配置
20181123:
1.扫码模块修改,获取相机图片后再使用halcon扫码。
2.联电料仓修改的BUG代码合并:显示界面需要输入密码。光栅功能修改。进出轴不在待机点时旋转轴和升降轴不能运动。
......
......@@ -60,8 +60,6 @@
<Compile Include="acSingleStore\AC_SA_BoxBean_Partial.cs" />
<Compile Include="acSingleStore\ACStoreManager.cs" />
<Compile Include="halcon\CodeManager.cs" />
<Compile Include="KangNaiDe\AITcpClient.cs" />
<Compile Include="KangNaiDe\KNDAIManager.cs" />
<Compile Include="KangNaiDe\KNDManager.cs" />
<Compile Include="KangNaiDe\MasterTcpClient.cs" />
<Compile Include="PanasonicServo\ACCMDManager.cs" />
......@@ -87,7 +85,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="store\KTK_Store.cs" />
<Compile Include="store\StoreManager.cs">
<Compile Include="store\StoreMoveStep.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
......
......@@ -19,22 +19,23 @@ namespace OnlineStore.DeviceLibrary
{
public static ushort DIStartAddress = 200;
public static ushort DoStartAddress = 100;
public static ushort DefualtLength = 16;
//public static ushort DefaultDILength = 16;
//public static ushort DefaultDOLength = 16;
private static byte DefualtSlaveID = 255;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static readonly ILog LOGGER = LogManager.GetLogger("defaultAppender");
public static Dictionary<string, MasterTcpClient> mastMap = new Dictionary<string, MasterTcpClient>();
public static Dictionary<string, List<KNDIO>> DIValueMap = new Dictionary<string, List<KNDIO>>();
public static Dictionary<string, List<KNDIO>> DOValueMap = new Dictionary<string, List<KNDIO>>();
private static object DIMapLock = "";
private static object DOMapLock = "";
public static System.Timers.Timer timer = null;
private static bool isWrite=false;
public static void ConnectionIP(string ioIp, ushort port)
private static ushort port = 502;
public static void ConnectionIP(string ioIp)
{
if (timer == null)
{
timer = new System.Timers.Timer();
timer.Interval = 300;
timer.Interval = 1000;
timer.AutoReset = true;
timer.Elapsed += timer_Elapsed;
timer.Enabled = true;
......@@ -49,13 +50,13 @@ namespace OnlineStore.DeviceLibrary
MBmaster.disconnect();
MBmaster.Dispose();
MBmaster = null;
//lock (DIMapLock)
//{
// if (DIValueMap.ContainsKey(ioIp))
// {
// DIValueMap.Remove(ioIp);
// }
//}
lock (DIMapLock)
{
if (DIValueMap.ContainsKey(ioIp))
{
DIValueMap.Remove(ioIp);
}
}
lock (DOMapLock)
{
......@@ -79,11 +80,12 @@ namespace OnlineStore.DeviceLibrary
Thread.Sleep(10);
//读取所有的DO
ReadMultipleDO(ioIp, DefualtSlaveID, DoStartAddress, DefualtLength);
ReadMultipleDO(ioIp, DefualtSlaveID, DoStartAddress, AutoStoreManager.Config.GetDOLength(ioIp));
}
catch (Exception error)
{
LogUtil.error(LOGGER,"连接IO模块[" + ioIp + "]出错:"+error.ToString());
LogUtil.error(LOGGER, "连接IO模块[" + ioIp + "]出错:" + error.ToString());
}
}
/// <summary>
......@@ -96,6 +98,8 @@ namespace OnlineStore.DeviceLibrary
List<string> list = new List<string>(mastMap.Keys);
foreach (string io in list)
{
if (io.Equals(ip))
{
//判断是否连接,如果没有连接自动重连
MasterTcpClient clinet = mastMap[io];
......@@ -105,10 +109,12 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "出错啦:" + ex.ToString());
} return false;
}
return false;
}
private static void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
......@@ -120,44 +126,40 @@ namespace OnlineStore.DeviceLibrary
{
//判断是否连接,如果没有连接自动重连
MasterTcpClient clinet = mastMap[io];
if (!clinet.ISConnection())
if (clinet.ISConnection())
{
//ReadMultipleDI(io, DefualtSlaveID, DIStartAddress, DefualtLength);
}
else
{
ushort port = 502;
ConnectionIP(io, port);
ConnectionIP(io);
LogUtil.error(LOGGER, io + "当前没有连上,重连" + io);
}
}
//if (DBStoreManager.StoreBoxMap != null && DBStoreManager.StoreBoxMap.Count > 0 && !FileLister.isConnect)
//{
// string RemoteURL = ConfigAppSettings.GetValue(Setting_Init.RemoteURL);
// FileGenerated.StartListerDirectory(RemoteURL, "*.*");
//}
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "出错啦:"+ex.ToString());
LogUtil.error(LOGGER, "出错啦:" + ex.ToString());
}
Thread.Sleep(1);
}
public static void ConnectionKND(List<string> DIONameList)
{
//端口号暂时使用固定的502;
ushort port = 502;
foreach (string ip in DIONameList)
{
ConnectionIP(ip, port);
//if (ip.Equals("192.168.10.10"))
//{
// continue;
//}
ConnectionIP(ip);
}
}
public static void ConnectionKND(string ip)
{
//端口号暂时使用固定的502;
ushort port = 502;
ConnectionIP(ip, port);
}
public static void ReadMultipleDI(string ioIp, byte slaveId, ushort StartAddress, ushort length)
{
isWrite = true;
ushort ID = 2;
MasterTcpClient MBmaster = null;
if (mastMap.ContainsKey(ioIp))
......@@ -169,11 +171,9 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(LOGGER, "ReadSingleDO出错没有连接IO模块:" + ioIp);
}
isWrite = false;
}
public static void ReadMultipleDO(string ioIp, byte slaveId, ushort StartAddress, ushort length)
{
isWrite = true;
ushort ID = 1;
MasterTcpClient MBmaster = null;
if (mastMap.ContainsKey(ioIp))
......@@ -183,33 +183,42 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(LOGGER,"ReadSingleDO出错没有连接IO模块:" + ioIp);
LogUtil.error(LOGGER, "ReadSingleDO出错没有连接IO模块:" + ioIp);
}
isWrite = false;
}
//关闭所有的DO
public static void CloseAllDO()
{
isWrite = true;
foreach (string key in mastMap.Keys)
{
byte[] data = new byte[] { 0,0};
WriteMultipleDO(key, DefualtSlaveID, DoStartAddress, DefualtLength, data);
byte[] data = new byte[] { 0, 0 };
WriteMultipleDO(key, DefualtSlaveID, DoStartAddress, AutoStoreManager.Config.GetDOLength(key), data);
}
isWrite = false;
}
public static void CloseAllConnection()
{
foreach (MasterTcpClient tcp in mastMap.Values)
{
tcp.disconnect();
}
mastMap.Clear();
}
public static void CloseAllDO(string ioIp, byte slaveId)
{
ushort length = AutoStoreManager.Config.GetDOLength(ioIp);
byte[] bytes = new byte[length];
for (int i = 0; i < length; i++)
{
bytes[i] = 0;
}
WriteMultipleDO(ioIp, slaveId, DoStartAddress, length, bytes);
}
public static void WriteMultipleDO(string ioIp, byte slaveId, ushort StartAddress, ushort length, byte[] bytes)
{
isWrite = true;
ushort ID = 6;
MasterTcpClient MBmaster = null;
if (mastMap.ContainsKey(ioIp))
......@@ -221,14 +230,9 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(LOGGER, "ReadSingleDO出错没有连接IO模块:" + ioIp);
}
isWrite = false;
}
public static void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff)
{
isWrite = true;
try
{
ushort ID = 5;
MasterTcpClient MBmaster = null;
if (mastMap.ContainsKey(ioIp))
......@@ -243,16 +247,10 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(LOGGER, "ReadSingleDO出错没有连接IO模块:" + ioIp);
}
}
catch (Exception ex)
{
LOGGER.Error("出错啦:" + ex.ToString());
}
isWrite = false;
}
public static void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff, int mSeconds)
{
isWrite = true;
ushort ID = 5;
MasterTcpClient MBmaster = null;
if (mastMap.ContainsKey(ioIp))
......@@ -277,7 +275,7 @@ namespace OnlineStore.DeviceLibrary
MBmaster.WriteSingleCoils(ID, StartAddress, newValue, slaveId);
KNDIO newIo = new KNDIO(ioIp, slaveId, StartAddress, newValue);
SaveDOValue(newIo, ioIp);
LogUtil.debug(LOGGER, "**********定时回写入 IO【" + ioIp + "," + StartAddress + ",值" + onOff + "】:");
LogUtil.info(LOGGER, "**********定时回写入 IO【" + ioIp + "," + StartAddress + ",值" + onOff + "】:");
}
catch (Exception ex)
{
......@@ -291,7 +289,6 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(LOGGER, "ReadSingleDO出错没有连接IO模块:" + ioIp);
}
isWrite = false;
}
private static void SaveDOValue(KNDIO io, string ioIp)
......@@ -323,7 +320,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(LOGGER,"SaveDOValue出错:"+ex.ToString());
LogUtil.error(LOGGER, "SaveDOValue出错:" + ex.ToString());
}
}
public static IO_VALUE GetDOValue(string ioIP, byte slaveId, ushort StartAddress)
......@@ -356,7 +353,7 @@ namespace OnlineStore.DeviceLibrary
}
return value;
}
public static IO_VALUE GetIOValue(LoadCSVLibrary.ConfigIO configIO)
public static IO_VALUE GetIOValue(ConfigIO configIO)
{
IO_VALUE value = IO_VALUE.LOW;
try
......@@ -366,7 +363,7 @@ namespace OnlineStore.DeviceLibrary
if (DIValueMap.ContainsKey(configIO.DeviceName))
{
List<KNDIO> allIo = new List<KNDIO>(DIValueMap[configIO.DeviceName]);
List<KNDIO> list = (from m in allIo where m.IOAddress.Equals(configIO.GetIOAddr()) select m).ToList<KNDIO>();
List<KNDIO> list = (from m in allIo where m.IOAddress.Equals(configIO.GetIOValue()) select m).ToList<KNDIO>();
if (list.Count > 0)
{
value = list[0].IoValue;
......@@ -378,12 +375,13 @@ namespace OnlineStore.DeviceLibrary
if (DOValueMap.ContainsKey(configIO.DeviceName))
{
List<KNDIO> allIo = new List<KNDIO>(DOValueMap[configIO.DeviceName]);
List<KNDIO> list = (from m in allIo where m.SlaveId.Equals(configIO.SlaveID) && m.IOAddress.Equals(configIO.GetIOAddr()) select m).ToList<KNDIO>();
List<KNDIO> list = (from m in allIo where m.SlaveId.Equals(configIO.SlaveID) && m.IOAddress.Equals(configIO.GetIOValue()) select m).ToList<KNDIO>();
if (list.Count > 0)
{
value = list[0].IoValue;
}
}
}
}
catch (Exception ex)
......@@ -396,14 +394,23 @@ namespace OnlineStore.DeviceLibrary
{
try
{
if (values.Length == 2)
ushort DILength = AutoStoreManager.Config.GetDILength(ioIp);
string finalData = "";
if (values.Length == 2 && DILength.Equals(16))
{
string finalData0 = Convert.ToString(values[0], 2).PadLeft(8, '0');
string finalData1 = Convert.ToString(values[1], 2).PadLeft(8, '0');
string finalData = finalData1 + finalData0;
finalData = finalData1 + finalData0;
}
else if (values.Length == 1 && DILength <= 8)
{
finalData = Convert.ToString(values[0], 2).PadLeft(DILength, '0');
}
LOGGER.Debug("IO模块【" + ioIp + "】收到DI上传:【" + finalData + "】");
if (finalData.Length >= DILength)
{
List<KNDIO> kndList = new List<KNDIO>();
ushort index = (ushort)(DIStartAddress + DefualtLength - 1);
ushort index = (ushort)(DIStartAddress + DILength - 1);
foreach (char str in finalData)
{
KNDIO io = null;
......@@ -437,14 +444,22 @@ namespace OnlineStore.DeviceLibrary
private static void SaveDOData(string ioIp, ushort ID, byte[] values)
{
if (values.Length == 2)
ushort DoLength = AutoStoreManager.Config.GetDOLength(ioIp);
string finalData = "";
if (values.Length == 2 && DoLength.Equals(16))
{
string finalData0 = Convert.ToString(values[0], 2).PadLeft(8, '0');
string finalData1 = Convert.ToString(values[1], 2).PadLeft(8, '0');
string finalData = finalData1 + finalData0;
finalData = finalData1 + finalData0;
}
else if (values.Length == 1 && DoLength <= 8)
{
finalData = Convert.ToString(values[0], 2).PadLeft(DoLength, '0');
}
if (finalData.Length >= DoLength)
{
List<KNDIO> kndList = new List<KNDIO>();
ushort index = (ushort)(DoStartAddress + DefualtLength - 1);
ushort index = (ushort)(DoStartAddress + DoLength - 1);
foreach (char str in finalData)
{
KNDIO io = null;
......@@ -468,6 +483,7 @@ namespace OnlineStore.DeviceLibrary
DOValueMap.Add(ioIp, kndList);
}
}
}
// ------------------------------------------------------------------------
// Event for response data
......@@ -557,7 +573,7 @@ namespace OnlineStore.DeviceLibrary
default:
break;
}
LOGGER.Error("接收数据出错:"+ exc);
LOGGER.Error("接收数据出错:" + exc);
//MessageBox.Show(exc, "Modbus slave exception");
}
}
......
类型,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义,SlaveID,
DI,急停,SuddenStop_BTN,200,192.168.200.10,0,急停,X01,DI-01,0,
DI,复位,Reset_BTN,201,192.168.200.10,0,复位,X02,DI-02,0,
DI,自动,AutoRun_Single,202,192.168.200.10,0,自动,X03,DI-03,0,
DI,气压检测,Airpressure_Check,203,192.168.200.10,0,气压检测,X04,DI-04,0,
DI,料盘检测1(进料口),TrayCheck_Door,204,192.168.200.10,0,料盘检测1(进料口),X05,DI-05,0,
DI,料盘检测2(料叉),TrayCheck_Fixture,205,192.168.200.10,0,料盘检测2(料叉),X06,DI-06,0,
DI,进料口门上升端,Door_Up,206,192.168.200.10,0,进料口门上升端,X07,DI-07,0,
DI,进料口门下降端,Door_Down,207,192.168.200.10,0,进料口门下降端,X08,DI-08,0,
,,,208,192.168.200.10,0,,X09,DI-09,0,
,,,209,192.168.200.10,0,,X10,DI-10,0,
DI,前门限位,Door_LimitSingle,210,192.168.200.10,0,前门限位,X11,DI-11,0,
,,,211,192.168.200.10,0,,X12,DI-12,0,
DI,安全光栅,SafetyLightCurtains,212,192.168.200.10,0,安全光栅,X13,DI-13,0,
,,,213,192.168.200.10,0,,X14,DI-14,0,
,,,214,192.168.200.10,0,,X15,DI-15,0,
,,,215,192.168.200.10,0,,X16,DI-16,0,
DI,自动启动,AutoRun_Single,202,192.168.200.10,0,自动启动,X03,DI-03,0,
DI,安全光栅,SafetyLightCurtains,203,192.168.200.10,0,安全光栅,X04,DI-04,0,
DI,进料口门上升端,Door_Up,204,192.168.200.10,0,进料口门上升端,X05,DI-05,0,
DI,进料口门下降端,Door_Down,205,192.168.200.10,0,进料口门下降端,X06,DI-06,0,
DI,吸盘气缸上升端,SuckingDisc_Up,206,192.168.200.10,0,吸盘气缸上升端,X07,DI-07,0,
DI,吸盘气缸下降端,SuckingDisc_Down,207,192.168.200.10,0,吸盘气缸下降端,X08,DI-08,0,
DI,料盘宽度检测1,WidthCheck1,208,192.168.200.10,0,料盘宽度检测1,X09,DI-09,0,
DI,料盘宽度检测2,WidthCheck2,209,192.168.200.10,0,料盘宽度检测2,X10,DI-10,0,
DI,料盘检测1(上料机构),TrayCheck_LoadMaterial ,210,192.168.200.10,0,料盘检测1(上料机构),X11,DI-11,0,
DI,上料机构出料检测,OutCheck,211,192.168.200.10,0,上料机构出料检测,X12,DI-12,0,
DI,门锁气缸打开端,Door_Open,212,192.168.200.10,0,门锁气缸打开端,X13,DI-13,0,
DI,门锁气缸关闭端,Door_Close,213,192.168.200.10,0,门锁气缸关闭端,X14,DI-14,0,
DI,料盘检测2(料叉机构),TrayCheck_Fixture,214,192.168.200.10,0,料盘检测2(料叉机构),X15,DI-15,0,
DI,压紧机构计量检测,CompressAxis_Check,215,192.168.200.10,0,压紧机构计量检测,X16,DI-16,0,
DO,自动指示灯,AutoRun_HddLed,100,192.168.200.10,0,自动指示灯,Y01,DO-01,0,
DO,故障指示灯,Alarm_HddLed,101,192.168.200.10,0,故障指示灯,Y02,DO-02,0,
DO,待机指示灯,RunSign_HddLed,102,192.168.200.10,0,待机指示灯,Y03,DO-03,0,
DO,吹气SOL ON,StartOrStopBlow,103,192.168.200.10,0,吹气SOL ON,Y04,DO-04,0,
DO,料仓运转ON,Run_Sign,104,192.168.200.10,0,料仓运转ON,Y05,DO-05,0,
DO,轴2刹车电源ON,Axis_Brake,105,192.168.200.10,0,轴2刹车电源ON,Y06,DO-06,0,
DO,进料口门上升SOL,Door_Up,106,192.168.200.10,0,进料口门上升SOL,Y07,DO-07,0,
DO,进料口门下降SOL,Door_Down,107,192.168.200.10,0,进料口门下降SOL,Y08,DO-08,0,
,,,108,192.168.200.10,0,,Y09,DO-09,0,
,,,109,192.168.200.10,0,,Y10,DO-10,0,
DO,相机照明开,CameraLight_Power,110,192.168.200.10,0,相机照明开,Y11,DO-11,0,
,,,111,192.168.200.10,0,,Y12,DO-12,0,
,,,112,192.168.200.10,0,,Y13,DO-13,0,
,,,113,192.168.200.10,0,,Y14,DO-14,0,
DO,相机照明开,CameraLight_Power,106,192.168.200.10,0,相机照明开,Y07,DO-07,0,
DO,吸盘吸料SOL,SuckingDisc_Work,107,192.168.200.10,0,吸盘吸料SOL,Y08,DO-08,0,
DO,进料口门上升SOL,Door_Up,108,192.168.200.10,0,进料口门上升SOL,Y09,DO-09,0,
DO,进料口门下降SOL,Door_Down,109,192.168.200.10,0,进料口门下降SOL,Y10,DO-10,0,
DO,吸盘气缸上升SOL,SuckingDisc_Up,110,192.168.200.10,0,吸盘气缸上升SOL,Y11,DO-11,0,
DO,吸盘气缸下降SOL,SuckingDisc_Down,111,192.168.200.10,0,吸盘气缸下降SOL,Y12,DO-12,0,
DO,门锁气缸打开SOL,Door_Open,112,192.168.200.10,0,门锁气缸打开SOL,Y13,DO-13,0,
DO,门锁气缸关闭SOL,Door_Close,113,192.168.200.10,0,门锁气缸关闭SOL,Y14,DO-14,0,
,,,114,192.168.200.10,0,,Y15,DO-15,0,
,,,115,192.168.200.10,0,,Y16,DO-16,0,
DI,上料机构门关闭,DoorClose_LoadMaterial,200,192.168.200.11,0,上料机构门关闭,X17,DI-21,0,
DI,气压检测,Airpressure_Check,201,192.168.200.11,0,气压检测,X18,DI-22,0,
DI,吸盘压力确认信号,SuckingDisc_Air,202,192.168.200.11,0,吸盘压力确认信号,X19,DI-23,0,
DI,左侧门关闭,DoorColse_Single,203,192.168.200.11,0,左侧门关闭,X20,DI-24,0,
,,,100,192.168.200.11,0,,Y17,DO-21,0,
,,,101,192.168.200.11,0,,Y18,DO-22,0,
,,,102,192.168.200.11,0,,Y19,DO-23,0,
,,,103,192.168.200.11,0,,Y20,DO-24,0,
AXIS,(轴一)旋转轴,Middle_Axis,1,COM4,0,,,,,
AXIS,(轴二)升降轴轴,UpDown_Axis,1,COM5,0,,,,,
AXIS,(轴三)进出轴,InOut_Axis,1,COM6,0,,,,,
,温湿度传感器地址,Temperate_ServerAddress,192.168.200.14,,,,,,,
,扫码枪IP,Scanner_Ip,192.168.200.13,,,,,,,
,扫码枪端口号,Scanner_Port,51236,,,,,,,
AXIS,(轴五)自动上下轴,Auto_Axis,1,COM7,0,,,,,
,,,,,,,,,,
,,,,,,,,,,
PRO,升降轴 进料口取料点 P1,UpDownAxis_DoorOPosition_P1,403000,,,,,,,
PRO,升降轴 进料口出料前点 P2,UpDownAxis_DoorIPosition_P2,415000,,,,,,,
PRO,升降轴 进料口取料缓冲点 P7,UpDownAxis_DoorOBPosition_P7,415000,,,,,,,
......@@ -49,7 +57,7 @@ PRO,是否有左右侧门,IsHasDoorLimit,1,,,,,,,
PRO,是否使用压紧轴(1=使用),IsHasCompress_Axis,1,,,,, ,,
PRO,设备是否处于调试状态(1=调试,0=正常),IsInDebug,0,,,,,,,
PRO,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,,,,,
,温湿度传感器地址,TemperateServer_Port,9001,,,,,,,
,,,,,,,,,,
PRO,预警温度,WarnTemperate,80,,,,,,,
PRO,预警湿度,WarnHumidity,80,,,,,,,
PRO,(轴一)旋转轴目标速度,MiddleAxis_TargetSpeed,2500,,,,,,,
......@@ -76,35 +84,35 @@ PRO,升降轴(轴2)P3速度,UpDownAxis_P3_Speed,2500,,,,,,,
PRO,升降轴(轴2)P4速度,UpDownAxis_P4_Speed,1500,,,,,,,
PRO,升降轴(轴2)P5速度,UpDownAxis_P5_Speed,2500,,,,,,,
PRO,升降轴(轴2)P6速度,UpDownAxis_P6_Speed,1000,,,,,,,
PRO,升降轴(轴2)P7速度,UpDownAxis_P7_Speed,1000,,,,,, ,
PRO,升降轴(轴2)P7速度,UpDownAxis_P7_Speed,1000,,,,,,,
PRO,升降轴(轴2)P8速度,UpDownAxis_P8_Speed,1000,,,,,,,
PRO,旋转轴(轴1)P1速度,MiddleAxis_P1_Speed,1200,,,,,,,
PRO,旋转轴(轴1)P2速度,MiddleAxis_P2_Speed,1200,,,,,,,
PRO,进出轴(轴3)P1速度,InOutAxis_P1_Speed,1000,,,,,,,
PRO,进出轴(轴3)P2速度,InOutAxis_P2_Speed,1000,,,,,,,
PRO,进出轴(轴3)P3速度,InOutAxis_P3_Speed,1000,,,,,,,
PRO,(轴一)旋转轴停止时可误差的脉冲数的最小值,MiddleAxis_ErrorCountMin,10,,,,,,,
PRO,(轴二)升降轴轴停止时可误差的脉冲数的最小值,UpdownAxis_ErrorCountMin,10,,,,,, ,
PRO,(轴一)旋转轴停止时可误差的脉冲数的最小值,MiddleAxis_ErrorCountMin,10,,,,,, ,
PRO,(轴二)升降轴轴停止时可误差的脉冲数的最小值,UpdownAxis_ErrorCountMin,10,,,,,,,
PRO,(轴三)进出轴停止时可误差的脉冲数的最小值,InoutAxis_ErrorCountMin,10,,,,,,,
PRO,(轴一)旋转轴停止时可误差的脉冲数的最大值,MiddleAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴二)升降轴轴停止时可误差的脉冲数的最大值,UpdownAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴三)进出轴停止时可误差的脉冲数的最大值,InoutAxis_ErrorCountMax,1000,,,,,,,
PRO,出入库多少次,会自动重置旋转轴,Box_ResetMCount,1000,,,,,,,
PRO,出入库多少次,会自动重置所有轴操作,Box_ResetACount,100,,,,,,,
PRO,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,,,
PRO,是否使用料盘检测信号,IsUse_Tray_Check,0,,,,,, ,
PRO,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,, ,
PRO,是否使用料盘检测信号,IsUse_Tray_Check,0,,,,,,,
PRO,(轴一)旋转轴最小限位,MiddleAxis_PositionMin,0,,,,,,,
PRO,(轴二)升降轴最小限位,UpdownAxis_PositionMin,0,,,,,,,
PRO,(轴三)进出轴最小限位,InoutAxis_PositionMin,0,,,,,,,
PRO,(轴一)旋转轴最大限位,MiddleAxis_PositionMax,0,,,,,,,
PRO,(轴二)升降轴最大限位,UpdownAxis_PositionMax,0,,,,,,,
PRO,(轴三)进出轴最大限位,InoutAxis_PositionMax,0,,,,,,,
PRO,需要吹气的温度(温度标准),Max_Temperature,0,,,,,,,
PRO,需要吹气的温度(温度标准),Max_Temperature,0,,,,,, ,
PRO,需要吹气的湿度(湿度标准),Max_Humidity,10,,,,,,,
PRO,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,,
PRO,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,,
PRO,温湿度端口号,Humiture_Port,COM1,,,,,,,
,,,,,,,,, ,
,,,,,,,,,,
PRO,硕科步进电机(压紧轴)控制端口号,CompressAxis_PortName,COM3,,,,,,,
PRO,硕科步进电机(压紧轴)控制波特率,CompressAxis_PortBaudrate,9600,,,,,,,
PRO,硕科步进电机(压紧轴)控制奇偶校验,CompressAxis_PortParity,0,,,,,,,
......@@ -115,10 +123,22 @@ PRO,硕科步进电机(压紧轴)控制末速度,CompressAxis_EndSpeed,30000,,,,,,,
PRO,硕科步进电机(压紧轴)控制加速度,CompressAxis_AddSpeed,15000,,,,,,,
PRO,硕科步进电机(压紧轴)控制减速度,CompressAxis_DelSpeed,15000,,,,,,,
PRO,硕科步进电机(压紧轴)控制归零速度(原点返回速度),CompressAxis_HomeSpeed,15000,,,,,,,
PRO,硕科步进电机轴地址(压紧轴),CompressAxis_Slv,1,,,,,,,
,,,,,,,,, ,
PRO,模拟量IO模块的IP地址,AIDevice_IP,192.168.200.11,,,,,,,
PRO,硕科步进电机轴地址(压紧轴),CompressAxis_Slv,1,,,,,, ,
,,,,,,,,,,
PRO,模拟量IO模块的IP地址,AIDevice_IP,192.168.200.12,,,,,,,
PRO,模拟信号1默认高度,AIDI1_DefaultPosition,2500,,,,,,,
PRO,模拟信号2默认高度,AIDI2_DefaultPosition,2500,,,,,,,
PRO,模拟信号3默认高度,AIDI3_DefaultPosition,2500,,,,,,,
,,,,,,,,, ,
PRO,(轴五)自动轴目标速度,AutoAxis_TargetSpeed,1000,,,,,,,
PRO,(轴五)自动轴加速度,AutoAxis_AddSpeed,300,,,,,,,
PRO,(轴五)自动轴减速度,AutoAxis_DelSpeed,300,,,,,,,
PRO,(轴五)自动轴原点低速,AutoAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴五)自动轴原点高速,AutoAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴五)自动轴原点加速度,AutoAxis_HomeAddSpeed,200,,,,,,,
PRO,(轴五)自动轴P1点,AutoAxis_P1,200,,,,,, ,
PRO,(轴五)自动轴停止时可误差的脉冲数的最小值,AutoAxis_ErrorCountMin,10,,,,,,,
PRO,(轴五)自动轴停止时可误差的脉冲数的最大值,AutoAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴五)自动轴最小限位,AutoAxis_PositionMin,0,,,,,,,
PRO,(轴五)自动轴最大限位,AutoAxis_PositionMax,0,,,,,,,
PRO,IO模块对应的DI数量,IO_DILength,192.168.200.10#16;192.168.200.11#4,,,,,, ,
PRO,模块对应的DO数量,IO_DOLength,192.168.200.10#16;192.168.200.11#4,,,,,,,
......@@ -11,13 +11,16 @@ using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary
{
public class ACStoreManager
public class AutoStoreManager
{
private static string api_communication = "service/store/communication"; //流水线状态通信接口
private static string api_nextFeeder = "service/store/nextFeeder"; // 出库站位列表切换接口
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static AC_SA_BoxBean store = null;
public static AC_SA_BoxBean Store = null;
public static AUTO_SA_Config Config = null;
private static bool isInit = false;
public static bool IsConnectServer=!ConfigAppSettings.GetValue(Setting_Init.http_server).Equals("");
public ACStoreManager()
public AutoStoreManager()
{
}
public static bool OpenShuoKe(AC_SA_BoxBean box)
......@@ -77,25 +80,26 @@ namespace OnlineStore.DeviceLibrary
isInit = true;
string storeType = ConfigAppSettings.GetValue(Setting_Init.Store_Type);
LogUtil.info(LOGGER, "配置的料仓 类型=" + storeType + ",开始加载料仓配置");
if (storeType == StoreType.RC_AC_SA)
if (storeType == StoreType.AUTO_SA_Config)
{
string appPath = Application.StartupPath;
string CID = ConfigAppSettings.GetValue(Setting_Init.Store_CID);
string linefilePath = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_ConfigPath);
StoreConfig storeConfig = CSVConfigReader.LoadConfig(1, CID, StoreType.RC_AC_SA, linefilePath);
StoreConfig storeConfig = CSVConfigReader.LoadConfig(1, CID, StoreType.AUTO_SA_Config, linefilePath);
string positionConfigFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config);
if (File.Exists(positionConfigFile))
{
LogUtil.info(LOGGER, "加载位置文件:" + positionConfigFile);
CSVPositionReader<ACStorePosition>.ReloadCSVFile(positionConfigFile);
CSVPositionReader<AutoStorePosition>.ReloadCSVFile(positionConfigFile);
}
AC_SA_BoxBean storeBean = new AC_SA_BoxBean((AC_SA_Config)storeConfig);
Config = (AUTO_SA_Config)storeConfig;
AC_SA_BoxBean storeBean = new AC_SA_BoxBean(Config);
storeBean.CID = CID;
LogUtil.info(LOGGER, "加载料仓完成!");
store = storeBean;
return store;
Store = storeBean;
return Store;
}
}
}
......@@ -105,13 +109,13 @@ namespace OnlineStore.DeviceLibrary
MessageBox.Show(ex.ToString(), "加载配置错误(请检查配置)");
Application.Exit();
}
return store;
return Store;
}
/// <summary>
/// 修改了料仓配置,更新缓存,更新配置文件(只能更新PRO的配置)
/// </summary>
/// <param name="kTK_LA_Store_Config"></param>
public static void UpdateBoxConfig(AC_SA_Config storeConfig)
public static void UpdateBoxConfig(AUTO_SA_Config storeConfig)
{
try
{
......@@ -124,14 +128,45 @@ namespace OnlineStore.DeviceLibrary
{
LOGGER.Error("保存配置文件失败:" + configFile);
}
store.Config = storeConfig;
store.MoveAxisConfig();
Store.Config = storeConfig;
Store.MoveAxisConfig();
}
catch (Exception ex)
{
LOGGER.Error("出错:", ex);
}
}
public static string GetPostApi(string host)
{
if (host == "")
{
host = ConfigAppSettings.GetValue(Setting_Init.http_server);
}
if (!host.StartsWith("http://"))
{
host = "http://" + host;
}
if (!host.EndsWith("/"))
{
host = host + "/";
}
return host + api_communication;
}
public static string GetNextFeederApi(string host)
{
if (host == "")
{
host = ConfigAppSettings.GetValue(Setting_Init.http_server);
}
if (!host.StartsWith("http://"))
{
host = "http://" + host;
}
if (!host.EndsWith("/"))
{
host = host + "/";
}
return host + api_nextFeeder;
}
}
}
......@@ -22,7 +22,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public static bool IsRun = false;
public string CID = "";
public AC_SA_Config Config;
public AUTO_SA_Config Config;
/// <summary>
/// 记录最后一次 出库的posID,出库完成发送给服务器之后清除
/// </summary>
......@@ -44,7 +44,7 @@ namespace OnlineStore.DeviceLibrary
//public ScanSocket scanSocket = new ScanSocket();
private System.Timers.Timer serverConnectTimer = new System.Timers.Timer();
private System.Timers.Timer IoCheckTimer = new System.Timers.Timer();
public AC_SA_BoxBean(AC_SA_Config config)
public AC_SA_BoxBean(AUTO_SA_Config config)
{
Init();
serverConnectTimer = new System.Timers.Timer();
......@@ -72,13 +72,13 @@ namespace OnlineStore.DeviceLibrary
Max_Temperature = config.Max_Temperature;
moveAxisList = new List<ConfigMoveAxis>();
MoveAxisConfig();
List<ACStorePosition> positionList = CSVPositionReader<ACStorePosition>.getPositionList();
List<AutoStorePosition> positionList = CSVPositionReader<AutoStorePosition>.getPositionList();
PositionNumList = new List<string>();
foreach (ACStorePosition position in positionList)
foreach (AutoStorePosition position in positionList)
{
if (position.StoreId.Equals(StoreID))
{
bool result = ACStorePosition.CheckPosition(position, Config);
bool result = AutoStorePosition.CheckPosition(position, Config);
if (result)
{
PositionNumList.Add(position.PositionNum);
......@@ -93,7 +93,7 @@ namespace OnlineStore.DeviceLibrary
//初始化 //连接设备
KNDManager.ConnectionKND(Config.DIODeviceNameList);
KNDAIManager.ConnectionIP(Config.AIDevice_IP);
//KNDAIManager.ConnectionIP(Config.AIDevice_IP);
//scanSocket.OnScanRevice += onCodeReceived;
mainTimer.Enabled = false;
......@@ -139,17 +139,18 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public void MoveAxisConfig()
{
AC_SA_Config.ConfigAxis( Config);
AUTO_SA_Config.ConfigAxis( Config);
moveAxisList = new List<ConfigMoveAxis>();
moveAxisList.Add(Config.Middle_Axis);
moveAxisList.Add(Config.UpDown_Axis);
moveAxisList.Add(Config.InOut_Axis);
moveAxisList.Add(Config.Auto_Axis);
this.AxisAlarmCodeMap = new Dictionary<string , AxisAlarmInfo>();
this.AxisAlarmCodeMap.Add(Config.UpDown_Axis.DeviceName, new AxisAlarmInfo());
this.AxisAlarmCodeMap.Add(Config.InOut_Axis.DeviceName, new AxisAlarmInfo());
this.AxisAlarmCodeMap.Add(this.Config.Middle_Axis.DeviceName, new AxisAlarmInfo());
this.AxisAlarmCodeMap.Add(this.Config.Auto_Axis.DeviceName, new AxisAlarmInfo());
}
/// <summary>
......@@ -161,7 +162,7 @@ namespace OnlineStore.DeviceLibrary
if (IsHasCompress_Axis)
{
if (ShuoKeControls.isRun == false && (!ACStoreManager.OpenShuoKe(this)))
if (ShuoKeControls.isRun == false && (!AutoStoreManager.OpenShuoKe(this)))
{
LogUtil.info(StoreName + "打开驱动器串口失败,启动失败!");
return false;
......@@ -1385,7 +1386,7 @@ namespace OnlineStore.DeviceLibrary
operation.op = 1;
operation.data = new Dictionary<string, string>() { { "code", message }, { "boxId", StoreID.ToString() } };
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false);
Operation resultOperation = HttpHelper.Post(AutoStoreManager.GetPostApi(server), operation, false);
if (resultOperation == null)
{
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
......@@ -1420,7 +1421,7 @@ namespace OnlineStore.DeviceLibrary
int storeId = int.Parse(posArray[0]);
//根据发送的posId获取位置列表
ACStorePosition position = CSVPositionReader<ACStorePosition>.GetPositon(posId);
AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(posId);
if (position == null)
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 ";
......@@ -1546,88 +1547,28 @@ namespace OnlineStore.DeviceLibrary
{
int result = 0;
double ai1Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, 1), Config.AIDI1_DefaultPosition);
double ai2Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, 2), Config.AIDI2_DefaultPosition);
double ai3Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, 3), Config.AIDI3_DefaultPosition);
double Value = Math.Round((ai1Value + ai2Value + ai3Value) / 3, 1);
if (Value > 14)
{
result = 16;
}
else if (Value >= 10)
{
result = 12;
}
else if (Value >= 4)
{
result = 8;
}
else
{
result = 0;
}
return result;
//List<double> list = new List<double>() { ai1Value,ai2Value,ai3Value};
//double pingjValue = (ai3Value + ai2Value + ai1Value) / 3;
//// ,8-11为第0区间,11-14 为第1区间,14-15为第2区间,>=15为第3区间
//List<int> qujianList = new List<int>() {0,0,0,0,0,0 };
//foreach (double d in list)
//double ai1Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, 1), Config.AIDI1_DefaultPosition);
//double ai2Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, 2), Config.AIDI2_DefaultPosition);
//double ai3Value = KNDAIManager.ConvertAI(KNDAIManager.GetAIValue(Config.AIDevice_IP, 3), Config.AIDI3_DefaultPosition);
//double Value = Math.Round((ai1Value + ai2Value + ai3Value) / 3, 1);
//if (Value > 14)
//{
// if (d < 11)
// {
// qujianList[0]++;
// } else if (d <= 14)
// {
// qujianList[1]++;
// } else if (d <= 15)
// {
// qujianList[2]++;
// } else
// {
// qujianList[3]++;
// }
// result = 16;
//}
//if (qujianList[0] >= 2)
//else if (Value >= 10)
//{
// result = 0;
// result = 12;
//}
//else if (qujianList[1].Equals(3))
//else if (Value >= 4)
//{
// result = 8;
//}
//else if (qujianList[1] >= 1 && (qujianList[1] + qujianList[2] + qujianList[3] >= 3))
//{
// result = 12;
//}
//else
//{
// if (pingjValue < 10)
// {
// result = 0;
// }
// else if (pingjValue > 18)
// {
// result = 16;
// }
// else
// {
// result = 12;
// }
//}
//return result;
//int radValue =(int) ( Value / 4);
//double mValue = (Value % 4);
//if (mValue > 1)
//{
// result = radValue * 4 + 4;
//}
//else
//{
// result = radValue * 4;
//}
return result;
}
#endregion
......@@ -1766,7 +1707,7 @@ namespace OnlineStore.DeviceLibrary
//HumitureServer.RandomData(Config.GetTempAddrList());
isInProcess = true;
if (ACStoreManager.IsConnectServer)
if (AutoStoreManager.IsConnectServer)
{
try
{
......@@ -1871,7 +1812,7 @@ namespace OnlineStore.DeviceLibrary
Operation lineOperation = getLineBoxStatus();
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), lineOperation, false);
Operation resultOperation = HttpHelper.Post(AutoStoreManager.GetPostApi(server), lineOperation, false);
//发送状态信息到服务器
if (resultOperation == null || (resultOperation.op != 2))
{
......@@ -1908,7 +1849,7 @@ namespace OnlineStore.DeviceLibrary
int storeId = int.Parse(posArray[0]);
//根据发送的posId获取位置列表
ACStorePosition position = CSVPositionReader<ACStorePosition>.GetPositon(posId);
AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(posId);
if (position == null)
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
......
......@@ -44,7 +44,7 @@ namespace OnlineStore.DeviceLibrary
if (param.MoveP == null)
{
LineMoveP p = new LineMoveP();
ACStorePosition position = param.GetACPosition();
AutoStorePosition position = param.GetACPosition();
if (position == null)
{
LogUtil.error(LOGGER, StoreName + "出入库时发现param中取到的Position=null,没有库位不能执行出入库");
......@@ -646,6 +646,7 @@ namespace OnlineStore.DeviceLibrary
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//此处需要等待box门口没有盘
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitHeight(0));
//打开舱门
OpenDoorAndWait();
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_2, IO_VALUE.LOW));
......@@ -702,9 +703,8 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep == StoreMoveStep.SO_13_GoBack)
{
StoreMove.NextMoveStep(StoreMoveStep.SO_14_WaitTake);
OutStoreLog("出库:SO_14_WaitTake 等待拿走物品,最多等待600000");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(600000));
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.LOW));
OutStoreLog("出库:SO_14_WaitTake 等待拿走物品,最多等待10000");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(10000));
StoreMove.WaitList.Add(WaitResultInfo.WaitHeight(0));
StoreMove.OneWaitCanEndStep = true;
}
......@@ -735,7 +735,7 @@ namespace OnlineStore.DeviceLibrary
}
public bool InOutAxisCanMove()
{
if (ACStoreManager.store.Config.IsHasLocationCylinder.Equals(0))
if (AutoStoreManager.Store.Config.IsHasLocationCylinder.Equals(0))
{
return true;
}
......
......@@ -65,7 +65,7 @@ namespace OnlineStore.DeviceLibrary
MoveP = linePosition;
IsSolderPaste = false;
}
public InOutStoreParam(string wareNo, string posId, ACStorePosition movep)
public InOutStoreParam(string wareNo, string posId, AutoStorePosition movep)
{
ACStoreP = movep;
WareNumber = wareNo;
......@@ -74,15 +74,15 @@ namespace OnlineStore.DeviceLibrary
IsSolderPaste = false;
}
private ACStorePosition ACStoreP = null;
private AutoStorePosition ACStoreP = null;
public ACStorePosition GetACPosition()
public AutoStorePosition GetACPosition()
{
try
{
if (ACStoreP == null)
{
ACStoreP = CSVPositionReader<ACStorePosition>.GetPositon(PositionNum);
ACStoreP = CSVPositionReader<AutoStorePosition>.GetPositon(PositionNum);
}
}
catch (Exception ex)
......
......@@ -85,6 +85,7 @@ namespace OnlineStore.DeviceLibrary
/// 定时处理,监听信号,监听IO
/// </summary>
protected abstract void timersTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e);
#region 出库
/// <summary>
/// 开始出库运动
......
......@@ -16,97 +16,6 @@ using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 料仓管理类(加载料仓配置)
/// </summary>
public class StoreManager
{
private static string api_communication = "service/store/communication"; //流水线状态通信接口
private static string api_nextFeeder = "service/store/nextFeeder"; // 出库站位列表切换接口
private static Color storeMoveColor = Color.Blue;
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static Dictionary<int, StoreConfig> storeConfigMap = new Dictionary<int, StoreConfig>();
//private static Dictionary<int, object> storeMap = new Dictionary<int, object>();
private static bool isInit = false;
public StoreManager()
{
}
public static void CheckEnum(Type type)
{
if (type.IsEnum)
{
List<int> valueList = new List<int>();
foreach (int item in Enum.GetValues(type))
{
if (valueList.Contains(item))
{
LogUtil.error(LOGGER, type.Name+"枚举值:"+item +"重复存在,请检查代码!");
Application.Exit();
break;
}
valueList.Add(item);
}
}
}
public static string GetPostApi(string host)
{
if (host == "")
{
host = ConfigAppSettings.GetValue(Setting_Init.http_server);
}
if (!host.StartsWith("http://"))
{
host = "http://" + host;
}
if (!host.EndsWith("/"))
{
host = host + "/";
}
return host + api_communication;
}
public static string GetNextFeederApi(string host)
{
if (host == "")
{
host = ConfigAppSettings.GetValue(Setting_Init.http_server);
}
if (!host.StartsWith("http://"))
{
host = "http://" + host;
}
if (!host.EndsWith("/"))
{
host = host + "/";
}
return host + api_nextFeeder;
}
public static void UpdateConfig(AC_SA_Config lineConfig)
{
try
{
//位置配置到文件中
string appPath = Application.StartupPath;
string configFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_ConfigPath);
bool result = CSVConfigReader.SaveBoxPosition(configFile, lineConfig);
if (!result)
{
LOGGER.Error("保存配置文件失败:" + configFile);
}
}
catch (Exception ex)
{
LOGGER.Error("出错:", ex);
}
}
}
/// <summary>
/// 等待启动/已经停止,初始化完成, 正常运行中,可以进行新的处理,忙碌,重置
/// </summary>
public enum StoreRunStatus
......@@ -399,456 +308,9 @@ namespace OnlineStore.DeviceLibrary
#endregion
#region 手动料仓出入库步骤
/// <summary>
/// 手动料仓,已经写入开门IO
/// </summary>
M_Begin_OpenDoor = 1000,
/// <summary>
/// 手动料仓,已经收到开门信号
/// </summary>
M_End_OpenDoor = 1001,
/// <summary>
/// 手动料仓,已经收到关门信号
/// </summary>
M_CloseDoor = 1002,
#endregion
#region 移栽装置原点返回和重置步骤
/// <summary>
/// 料仓移栽装置,,上下气缸上升端
/// </summary>
H_UpDownCylinder_Up = 2001,
/// <summary>
/// 料仓移载装置,其他气缸运行到初始状态( 顶升气缸下降端,前后气缸后退端,夹料气缸放松端,阻挡气缸输入=0 )
/// </summary>
H_OtherCylinder_Back = 2002,
#endregion
#region 流水线入仓操作
/// <summary>
/// 流水线入仓,开始扫码 扫描枪触发,数据处理
/// </summary>
LI_Scannering = 10001,
/// <summary>
/// 流水线入仓,料仓号及库位号发送, 夹具号编码记忆(X5,X6.X7)数据接收
/// </summary>
LI_WaitServerResult = 10002,
/// <summary>
/// 等待100毫秒后再放行
/// </summary>
LI_00_Wait100 = 10003,
/// <summary>
/// 阻挡气缸0-2下降
/// </summary>
LI_01_StopCylinder2Down = 10004,
/// <summary>
/// 检测夹具检测1=0 ) 开始
/// </summary>
LI_02_FixtureCheck = 10005,
/// <summary>
/// 阻挡气缸0-2上升
/// </summary>
LI_03_StopCylinder2Up = 10006,
/// <summary>
/// 阻挡气缸0-1下降
/// </summary>
LI_04_StopCylinder1Down = 10007,
#endregion
#region 流水线出库操作
/// <summary>
/// 流水线出库,等待100毫秒之后在放行
/// </summary>
LO_00_Wait100 = 11000,
/// <summary>
/// 流水线出库,阻挡气缸0-2下降
/// </summary>
LO_01_StopCylinder2Down = 11001,
/// <summary>
/// 流水线出库, 检测夹具检测1=0
/// </summary>
LO_02_FixtureCheck = 11002,
/// <summary>
/// 流水线出库,阻挡气缸0-2上升( Y13=0)
/// </summary>
LO_03_StopCylinder2Up = 11003,
/// <summary>
/// 阻挡气缸0-1下降(Y12=1)
/// </summary>
LO_04_StopCylinder1Up = 11004,
#endregion
#region 移栽装置出入库共同模块
/// <summary>
///移载(流水线)装置出入库处理,, 阻挡气缸1-1下降( Y14=1)
/// </summary>
MIO_01_StopCylinder1Down = 3081,
/// <summary>
///移载(流水线)装置出入库处理,,夹具检测1-4=1
/// </summary>
MIO_02_FixtureCheck = 3082,
/// <summary>
///移载(流水线)装置出入库处理,,阻挡气缸1-1上升( Y14=0)
/// </summary>
MIO_03_StopCylinder2Down = 3083,
/// <summary>
/// 检测夹具检测IO1=1
/// </summary>
MIO_04_Check1High = 3084,
/// <summary>
/// 等待一秒钟
/// </summary>
MIO_05_WaitTime = 3085,
/// <summary>
///移载(流水线)装置出入库处理,,顶 升 气缸 上 升 (Y17 =0/Y1 16 =1 )检测X17=0X16=1
/// </summary>
MIO_06_TopCylinderUp = 3086,
/// <summary>
/// 此处 顶升气缸上升时等待一秒钟,再下降,现在看起来没有升到位就下降
/// </summary>
MIO_07_TopCylinderUpWait = 3087,
/// <summary>
/// 等待StoreMove完成当前操作开始入库
/// </summary>
MIO_08_WaitInStore=3088,
/// <summary>
/// 等待StoreMove移走料盘开始放托盘通过
/// </summary>
MIO_09_WaitLetFixtureGo=3089,
#endregion
#region 移栽装置出库处理
/// <summary>
/// 移载(流水线)装置出库处理, 检测夹具编码并记忆,托盘 是空盘,并且BOX在出库等待中,开始移栽料盘
/// </summary>
MO_05_CodeRember = 3105,
/// <summary>
/// 移载(流水线)装置出库处理,, ,顶升气缸1下降(Y16=0/Y17=1)
/// </summary>
MO_09_TopCylinder_Down = 3109,
/// <summary>
/// 移载(流水线)装置出库处理,, 阻挡气缸1-2下降( Y15=1)
/// </summary>
MO_10_StopCylinder2_Down = 3110,
/// <summary>
/// 移载(流水线)装置出库处理,, 夹具检测1-4=0,
/// </summary>
MO_11_Tray_Check = 3111,
/// <summary>
/// 移载(流水线)装置出库处理,,阻挡气缸1-1下降( Y14=1)阻挡气缸1-2上升( Y15=0)
/// </summary>
MO_12_StopCylinder_Back = 3112,
/// <summary>
/// 移栽装置出库处理。。前后气缸1前进
/// </summary>
MO_51_BeforeAfterCylinderBefore = 3151,
/// <summary>
/// 移栽装置出库处理。。 上下气缸1下降(Y22=0/Y23=1)
/// </summary>
MO_52_UpDownCylinderDown = 3152,
/// <summary>
/// 移栽装置出库处理。。 上下气缸1下降后,等待0.3秒再夹紧,防止没有下降到位就夹紧操作
/// </summary>
MO_53_UpDownCylinderDownWait = 3153,
/// <summary>
/// 移栽装置出库处理。 夹料气缸1夹紧( Y25=0/Y24=1)
/// </summary>
MO_54_ClampCylinderSlack = 3154,
/// <summary>
/// 移栽装置出库处理。。 上下气缸1上升(Y22=1/Y23=0)
/// </summary>
MO_55_UpDownCylinderUp = 3155,
/// <summary>
/// 移栽装置出库处理。。 前后气缸1后退( Y20=0/Y21=1)
/// </summary>
MO_56_BeforeAfterCylinderAfter = 3156,
/// <summary>
/// 移载(流水线)装置出库处理,,, 上下气缸1下降(Y22=0/Y23=1)
/// </summary>
MO_58_UpDownCylinderDown = 3158,
/// <summary>
/// 移载(流水线)装置出库处理,, 夹料气缸1放松( Y25=1/Y24=0)
/// </summary>
MO_59_ClampCylinderTighten = 3159,
/// <summary>
/// 移载(流水线)装置出库处理,, ,上下气缸1上升(Y22=1/Y23=0)
/// </summary>
MO_60_UpDownCylinderUp = 3160,
#endregion
#region 移载装置入库处理
/// <summary>
///移载装置入库处理,,检测 夹具编码( X1 3,X14,X15)
/// </summary>
MI_05_CodeCheck = 3005,
/// <summary>
/// 移载装置入库处理,,等待box等待状态才能继续操作
/// </summary>
MI_10_WaitBox=3006,
/// <summary>
///移载装置入库处理,,编码与仓位一致,,上下气缸1下降(Y22=0/Y23=1)
/// </summary>
MI_07_UpDownCylinderDown = 3007,
/// <summary>
///移载装置入库处理,,编码与仓位一致,,上下气缸1下降后,等待0.3秒,防止没有 下降到位就夹紧
/// </summary>
MI_07_UpDownCylinderDownWait = 3024,
/// <summary>
///移载装置入库处理,, 夹料气缸1夹紧( Y25=0/Y24=1)
/// </summary>
MI_08_ClampCylinderSlack = 3008,
/// <summary>
///移载装置入库处理,, 上下气缸1上升(Y22=1/Y23=0)
/// </summary>
MI_09_UpDownCylinderUp = 3009,
/// <summary>
///移载装置入库处理,, ,前后气缸1前进( Y20=1/Y21=0)
/// </summary>
MI_10_BeforeAfterCylinderBefore = 3010,
/// <summary>
///移载装置入库处理,, 上下气缸1下降(Y22=0/Y23=1)
/// </summary>
MI_11_UpDownCylinderDown = 3011,
/// <summary>
///移载装置入库处理,, ,夹料气缸1放松( Y25=1/Y24=0)
/// </summary>
MI_12_ClampCylinderTighten = 3012,
/// <summary>
///移载装置入库处理,, 上下气缸1上升(Y22=1/Y23=0)
/// </summary>
MI_13_UpdownCylinderUp = 3013,
/// <summary>
///移载装置入库处理,, ,前后气缸1后退( Y20=0/Y21=1)
/// </summary>
MI_14_BeforeAfterCylinderAfter = 3014,
/// <summary>
///移载装置入库处理,, 检测到X102-1=1送料流程完成
/// </summary>
MI_15_SendEnd = 3015,
/// <summary>
///移载装置入库处理,,编码不一致,,顶升气缸1下降(Y16=0/Y17=1)
/// </summary>
MI_20_TopCylinderDown = 3020,
/// <summary>
///移载装置入库处理,,阻挡气缸1-2下降( Y15=1),
/// </summary>
MI_21_StopCylinderDown = 3021,
/// <summary>
///移载装置入库处理,检测Check4=0,
/// </summary>
MI_22_FixtureCheck_Low = 3022,
/// <summary>
///移载装置入库处理,,,阻挡气缸1-2 上升( Y15=0),等待200毫秒
/// </summary>
MI_23_StopCylinderReset = 3023,
#endregion
//后面的是双层料仓的类型 值从20000开始
#region 双层流水线调宽和处理
/// <summary>
/// 双层料仓流水线模块 。检测到板子进入,打开流水线
/// </summary>
LINEIN_OpenLine = 20000,
/// <summary>
/// 双层料仓流水线模块 。等待下位机要料信号=High
/// </summary>
LINEIN_WaitOutSingle = 20001,
/// <summary>
/// 双层料仓流水线模块 。检测到出料口信号=Low
/// </summary>
LINEIN_WaitOutSingleLow = 20002,
/// <summary>
/// 关闭皮带
/// </summary>
LINEIN_CloseLine=20003,
/// <summary>
/// 等待下位机要料信号
/// </summary>
LINEIN_WatiMachineSingle=20004,
/// <summary>
/// 双层料仓流水线模块 。线体调宽回原点
/// </summary>
LINECW_LineReturnHome = 20010,
/// <summary>
/// 双层料仓流水线模块 。线体调宽回原点
/// </summary>
LINECW_LineChangeWidth = 20011,
/// <summary>
/// 流水线原点返回,设置速度
/// </summary>
LINEH_SetSpeed_001 = 20020,
/// <summary>
/// 流水线原点返回,反反向走到20000
/// </summary>
LINEH_RevertMove_002 = 20021,
/// <summary>
/// 流水线原点返回,开始原点返回
/// </summary>
LINEH_LineHome_003= 20022,
#endregion
#region 在线料仓入库处理
/// <summary>
///在线双层料仓:入仓: 等待料盘进入
/// </summary>
DB_SI_00_WaitIO = 20100,
/// <summary>
///在线双层料仓:入仓:扫描二维码中
/// </summary>
DB_SI_01_Scanning = 20101,
/// <summary>
/// 在线双层料仓:入仓:根据二维码从服务器获取仓位号
/// </summary>
DB_SI_02_GetBoxNum = 20102,
/// <summary>
///在线双层料仓: 同时动作
/// 电缸运行到入料口下方的位置 , 料仓旋转到对应的位置
/// </summary>
DB_SI_03_InStoreReadyMove = 20103,
/// <summary>
/// 在线双层料仓:入仓:(取料叉子进入料口)、
/// </summary>
DB_SI_04_TakeDeviceToDoor = 20104,
/// <summary>
/// 在线双层料仓:入仓:(电缸稍微移动到料口上端位置),
/// </summary>
DB_SI_05_ModbusUpToDoor = 20105,
/// <summary>
///在线双层料仓: 取出料盘
/// </summary>
DB_SI_06_TakeSITray = 20106,
/// <summary>
/// 在线双层料仓:入仓(电缸运行到对应仓位的下方,,旋转电机2正转)
/// </summary>
DB_SI_07_MoveToRoom = 20107,
/// <summary>
/// 在线双层料仓:入仓(取料叉子进入仓位)
/// </summary>
DB_SI_08_TakeDeviceToRoom = 20108,
/// <summary>
///在线双层料仓: 入仓(电缸微动至对应料仓的下端位置)
/// </summary>
DB_SI_09_PutToRoom = 20109,
/// <summary>
/// 在线双层料仓:从仓位出来
/// </summary>
DB_SI_10_SIFromRoom = 20110,
/// <summary>
///在线双层料仓: 旋转电机2反转,回到中间等待位置
/// </summary>
DB_SI_11_MoveSIFromRoom = 20111,
/// <summary>
/// 在线双层料仓:关闭仓门
/// </summary>
DB_SI_12_CloseDoor = 20112,
#endregion
#region 在线料仓出库处理
/// <summary>
///在线双层料仓:: 出库处理:等待执行出库
/// </summary>
DB_SO_00_WaitStart = 20200,
/// <summary>
///在线双层料仓:
/// </summary>
DB_SO_01_Scanning = 20201,
/// <summary>
/// 在线双层料仓:
/// </summary>
DB_SO_02_GetBoxNum = 20202,
/// <summary>
///在线双层料仓:出库执行 同时动作
/// 电缸运行到入料口下方的位置 ,料仓旋转到对应的位置,旋转电机2正传
/// </summary>
DB_SO_03_ReadyMove = 20203,
/// <summary>
/// 在线双层料仓: 出仓:(取料叉子进入料仓)叉子前进
/// </summary>
DB_SO_04_TakeDeviceToDoor = 20204,
/// <summary>
/// 在线双层料仓: 出仓:(电缸稍微移动到料仓上端位置)
/// </summary>
DB_SO_05_ModbusUpToDoor = 20205,
/// <summary>
///在线双层料仓: 取出料盘,叉子后退
/// </summary>
DB_SO_06_TakeOutTray = 20206,
/// <summary>
/// 在线双层料仓: 出库执行(电缸移动至入料口的上端位置 旋转电机2正转)
/// </summary>
DB_SO_07_MoveToRoom = 20207,
/// <summary>
/// 在线双层料仓:出库执行 (叉子前进)
/// </summary>
DB_SO_08_TakeDeviceToRoom = 20208,
/// <summary>
///在线双层料仓: 出库执行 (电缸微动至对应料口的下端位置)
/// </summary>
DB_SO_09_PutToRoom = 20209,
/// <summary>
/// 在线双层料仓:出库执行 叉子后退
/// </summary>
DB_SO_10_OutFromRoom = 20210,
/// <summary>
/// 在线双层料仓:等待物料到达
/// </summary>
DB_SO_11_WaitTrayToDoor= 20211,
/// <summary>
/// 在线双层料仓:等待拿走料盘
/// </summary>
DB_SO_12_WaitTrayLeave = 20212,
///// <summary>
/////在线双层料仓:出库执行 旋转电机2反转,回到中间等待位置
///// </summary>
//DB_SO_11_MoveOutFromRoom = 20211,
///// <summary>
///// 在线双层料仓:出库执行(关闭仓门
///// </summary>
//DB_SO_CloseDoor = 20213,
#endregion
/// <summary>
/// 在线双层料仓:回原点:叉子退回
/// </summary>
DB_H_01_ForkBack = 20301,
/// <summary>
/// 在线双层料仓:回原点:同时动作:转盘低速旋转 , 电缸回到原位 ,( I/O点控制) 旋转气缸旋回
/// </summary>
DB_H_02_BackHome= 20302,
/// <summary>
/// 在线双层料仓:回原点:旋回完成
/// </summary>
DB_H_03_BackEnd = 20303,
/// <summary>
/// 在线双层料仓:回原点:原点开关点亮,原点开关点亮,旋回端开关点亮,,转盘停止 ,电缸停止, 清理电钢和转盘的位置信息
/// </summary>
DB_H_04_ClearPosition = 20304,
}
public enum StoreAlarmType
......
......@@ -331,6 +331,11 @@ namespace OnlineStore.DeviceLibrary
/// 高度
/// </summary>
public int HeightValue { get; set; }
internal static WaitResultInfo WaitIO(object trayCheck_Door, IO_VALUE hIGH)
{
throw new NotImplementedException();
}
}
public enum StoreMoveType
{
......
......@@ -47,10 +47,10 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CSVExection.cs" />
<Compile Include="position\ACSAStorePosition.cs" />
<Compile Include="position\AutoStorePosition.cs" />
<Compile Include="storeConfig\ConfigItemBase.cs" />
<Compile Include="storeConfig\ConfigProAttribute.cs" />
<Compile Include="storeConfig\config\AC_SA_Config.cs" />
<Compile Include="storeConfig\config\AUTO_SA_Config.cs" />
<Compile Include="storeConfig\config\StoreType.cs" />
<Compile Include="storeConfig\config\Store_IO_Type.cs" />
<Compile Include="CSVAttribute.cs" />
......
......@@ -7,10 +7,7 @@ using System.Text;
namespace OnlineStore.LoadCSVLibrary
{
/// <summary>
/// 松下伺服485控制,单台料仓
/// </summary>
public class ACStorePosition : StorePostionBase
public class AutoStorePosition : StorePostionBase
{ /// <summary>
/// 对应的料仓ID(流水线料仓需要用此字段区分哪个BOX)
/// </summary>
......@@ -67,7 +64,7 @@ namespace OnlineStore.LoadCSVLibrary
[CSVAttribute("进出轴进料口取料点P2")]
public int InOutAxis_DoorPosition_P2 { get; set; }
public static bool CheckPosition(ACStorePosition position, AC_SA_Config Config)
public static bool CheckPosition(AutoStorePosition position, AUTO_SA_Config Config)
{
try
{
......@@ -129,17 +126,6 @@ namespace OnlineStore.LoadCSVLibrary
return true;
}
///// <summary>
///// 升降轴进料口出料前点P2
///// </summary>
//[CSVAttribute("升降轴进料口出料前点P2")]
//public int UpDownAxis_P2 { get; set; }
///// <summary>
///// 升降轴进料口取料缓冲点P7
///// </summary>
//[CSVAttribute("升降轴进料口取料缓冲点P7")]
//public int UpDownAxis_P7 { get; set; }
}
}
......@@ -136,9 +136,9 @@ namespace OnlineStore.LoadCSVLibrary
public static StoreConfig LoadConfig(int storeId, string cid, string storeType, string filePath)
{
StoreConfig config = null;
if (storeType.Equals(StoreType.RC_AC_SA))
if (storeType.Equals(StoreType.AUTO_SA_Config))
{
config = new AC_SA_Config(storeId, cid, storeType, filePath);
config = new AUTO_SA_Config(storeId, cid, storeType, filePath);
}
else
{
......
......@@ -93,12 +93,12 @@ namespace OnlineStore.LoadCSVLibrary
/// 加速度
/// </summary>
//[CSVAttribute("加速时间")]
public short AddSpeed { get; set; }
public int AddSpeed { get; set; }
/// <summary>
/// 减速度
/// </summary>
//[CSVAttribute("减速时间")]
public short DelSpeed { get; set; }
public int DelSpeed { get; set; }
public int HomeLowSpeed { get; set; }
public int HomeHighSpeed { get; set; }
......
......@@ -6,27 +6,17 @@ using System.Text;
namespace OnlineStore.LoadCSVLibrary
{
public class AC_SA_Config : StoreConfig
public class AUTO_SA_Config : StoreConfig
{
public AC_SA_Config()
public AUTO_SA_Config()
: base()
{
}
public AC_SA_Config(int id, string cid, string type, string filepath)
public AUTO_SA_Config(int id, string cid, string type, string filepath)
: base(id, cid, type, filepath)
{
}
///// <summary>
///// 温湿度传感器地址/COM口配置
///// </summary>
//[ConfigProAttribute("TemperateServer_Port")]
//public int TemperateServer_Port { get; set; }
///// <summary>
///// 温湿度 传感器地址
///// </summary>
//[ConfigProAttribute("Temperate_ServerAddress")]
//public string Temperate_Serveraddress { get; set; }
/// <summary>
/// 预警温度
/// </summary>
......@@ -57,16 +47,7 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
[ConfigProAttribute("IsHasDoorLimit")]
public int IsHasDoorLimit { get; set; }
/// <summary>
/// PRO 扫码枪IP Scanner_Ip 192.168.200.13
/// </summary>
[ConfigProAttribute("Scanner_Ip",false)]
public string Scanner_Ip { get; set; }
/// <summary>
/// PRO 扫码枪端口号 Scanner_Port 51236
/// </summary>
[ConfigProAttribute("Scanner_Port",false)]
public int Scanner_Port { get; set; }
/// <summary>
/// PRO (轴一)旋转轴原点目标速度 MiddleAxis_TargetSpeed 30000
/// </summary>
......@@ -77,12 +58,12 @@ namespace OnlineStore.LoadCSVLibrary
/// PRO (轴一)旋转轴加速度 MiddleAxis_AddSpeed 500
/// </summary>
[ConfigProAttribute("MiddleAxis_AddSpeed")]
public short MiddleAxis_AddSpeed { get; set; }
public int MiddleAxis_AddSpeed { get; set; }
/// <summary>
/// PRO (轴一)旋转轴减速度 MiddleAxis_DelSpeed 500
/// </summary>
[ConfigProAttribute("MiddleAxis_DelSpeed")]
public short MiddleAxis_DelSpeed { get; set; }
public int MiddleAxis_DelSpeed { get; set; }
/// <summary>
/// PRO (轴二)升降轴轴原点目标速度 UpdownAxis_TargetSpeed 120000
/// </summary>
......@@ -93,12 +74,12 @@ namespace OnlineStore.LoadCSVLibrary
/// PRO (轴二)升降轴轴加速度 UpdownAxis_AddSpeed 200
/// </summary>
[ConfigProAttribute("UpdownAxis_AddSpeed")]
public short UpdownAxis_AddSpeed { get; set; }
public int UpdownAxis_AddSpeed { get; set; }
/// <summary>
/// PRO (轴二)升降轴轴减速度 UpdownAxis_DelSpeed 200
/// </summary>
[ConfigProAttribute("UpdownAxis_DelSpeed")]
public short UpdownAxis_DelSpeed { get; set; }
public int UpdownAxis_DelSpeed { get; set; }
/// <summary>
/// PRO (轴三)进出轴原点目标速度 InoutAxis_TargetSpeed 12000
/// </summary>
......@@ -109,29 +90,29 @@ namespace OnlineStore.LoadCSVLibrary
/// PRO (轴三)进出轴加速度 InoutAxis_AddSpeed 200
/// </summary>
[ConfigProAttribute("InoutAxis_AddSpeed")]
public short InoutAxis_AddSpeed { get; set; }
public int InoutAxis_AddSpeed { get; set; }
/// <summary>
/// PRO (轴三)进出轴减速度 InoutAxis_DelSpeed 200
/// </summary>
[ConfigProAttribute("InoutAxis_DelSpeed")]
public short InoutAxis_DelSpeed { get; set; }
public int InoutAxis_DelSpeed { get; set; }
/// <summary>
/// PRO (轴一)旋转轴原点低速度 MiddleAxis_HomeLowSpeed 50
/// </summary>
[ConfigProAttribute("MiddleAxis_HomeLowSpeed")]
public short MiddleAxis_HomeLowSpeed { get; set; }
public int MiddleAxis_HomeLowSpeed { get; set; }
/// <summary>
/// PRO (轴一)旋转轴原点高速 MiddleAxis_HomeHighSpeed 100
/// </summary>
[ConfigProAttribute("MiddleAxis_HomeHighSpeed")]
public short MiddleAxis_HomeHighSpeed { get; set; }
public int MiddleAxis_HomeHighSpeed { get; set; }
/// <summary>
/// PRO (轴一)旋转轴原点加速度 MiddleAxis_HomeAddSpeed 30
/// </summary>
[ConfigProAttribute("MiddleAxis_HomeAddSpeed")]
public short MiddleAxis_HomeAddSpeed { get; set; }
public int MiddleAxis_HomeAddSpeed { get; set; }
......@@ -139,19 +120,19 @@ namespace OnlineStore.LoadCSVLibrary
/// PRO (轴二)升降轴轴原点低速度 UpdownAxis_HomeLowSpeed 50
/// </summary>
[ConfigProAttribute("UpdownAxis_HomeLowSpeed")]
public short UpdownAxis_HomeLowSpeed { get; set; }
public int UpdownAxis_HomeLowSpeed { get; set; }
/// <summary>
/// PRO (轴二)升降轴轴原点高速 UpdownAxis_HomeHighSpeed 100
/// </summary>
[ConfigProAttribute("UpdownAxis_HomeHighSpeed")]
public short UpdownAxis_HomeHighSpeed { get; set; }
public int UpdownAxis_HomeHighSpeed { get; set; }
/// <summary>
/// PRO (轴二)升降轴轴原点加速度 UpdownAxis_HomeAddSpeed 30
/// </summary>
[ConfigProAttribute("UpdownAxis_HomeAddSpeed")]
public short UpdownAxis_HomeAddSpeed { get; set; }
public int UpdownAxis_HomeAddSpeed { get; set; }
......@@ -159,17 +140,17 @@ namespace OnlineStore.LoadCSVLibrary
/// PRO (轴三)进出轴原点低速 InoutAxis_HomeLowSpeed 50
/// </summary>
[ConfigProAttribute("InoutAxis_HomeLowSpeed")]
public short InoutAxis_HomeLowSpeed { get; set; }
public int InoutAxis_HomeLowSpeed { get; set; }
/// <summary>
/// PRO (轴三)进出轴原点高速 InoutAxis_HomeHighSpeed 100
/// </summary>
[ConfigProAttribute("InoutAxis_HomeHighSpeed")]
public short InoutAxis_HomeHighSpeed { get; set; }
public int InoutAxis_HomeHighSpeed { get; set; }
/// <summary>
/// PRO (轴三)进出轴原点加速度 InoutAxis_HomeAddSpeed 30
/// </summary>
[ConfigProAttribute("InoutAxis_HomeAddSpeed")]
public short InoutAxis_HomeAddSpeed { get; set; }
public int InoutAxis_HomeAddSpeed { get; set; }
/// <summary>
......@@ -370,6 +351,11 @@ namespace OnlineStore.LoadCSVLibrary
public ConfigMoveAxis InOut_Axis { get; set; }
/// <summary>
///AXIS (轴五)自动上下轴 Auto_Axis
/// </summary>
[ConfigProAttribute("Auto_Axis")]
public ConfigMoveAxis Auto_Axis { get; set; }
/// <summary>
/// PRO 硕科步进电机(压紧轴)控制端口号 CompressAxis_PortName COM4
/// </summary>
[ConfigProAttribute("CompressAxis_PortName")]
......@@ -508,71 +494,187 @@ namespace OnlineStore.LoadCSVLibrary
public double AIDI3_DefaultPosition { get; set; }
//private List<string> TempAddrList = null;
//public static char TempAddrSpilt = '#';
///// <summary>
///// 温湿度地址列表
///// </summary>
//public List<string> GetTempAddrList()
//{
// if (TempAddrList == null)
// {
// TempAddrList = new List<string>();
// string[] array = Temperate_Serveraddress.Split(TempAddrSpilt);
// if (array.Length > 0)
// {
// foreach (string str in array)
// {
// if (!str.Equals(""))
// {
// TempAddrList.Add(str);
// }
// }
// }
// }
// return TempAddrList;
//}
/// <summary>
/// PRO (轴五)自动轴目标速度 AutoAxis_TargetSpeed 1000
/// </summary>
[ConfigProAttribute("AutoAxis_TargetSpeed", true)]
public int AutoAxis_TargetSpeed { get; set; }
/// <summary>
/// PRO (轴五)自动轴加速度 AutoAxis_AddSpeed 300
/// </summary>
[ConfigProAttribute("AutoAxis_AddSpeed", true)]
public int AutoAxis_AddSpeed { get; set; }
/// <summary>
/// PRO (轴五)自动轴减速度 AutoAxis_DelSpeed 300
/// </summary>
[ConfigProAttribute("AutoAxis_DelSpeed", true)]
public int AutoAxis_DelSpeed { get; set; }
/// <summary>
/// PRO (轴五)自动轴原点低速 AutoAxis_HomeLowSpeed 20
/// </summary>
[ConfigProAttribute("AutoAxis_HomeLowSpeed", true)]
public int AutoAxis_HomeLowSpeed { get; set; }
/// <summary>
/// PRO (轴五)自动轴原点高速 AutoAxis_HomeHighSpeed 60
/// </summary>
[ConfigProAttribute("AutoAxis_HomeHighSpeed", true)]
public int AutoAxis_HomeHighSpeed { get; set; }
/// <summary>
///PRO (轴五)自动轴P1点 AutoAxis_P1 200
/// </summary>
[ConfigProAttribute("AutoAxis_P1", true)]
public int AutoAxis_P1 { get; set; }
/// <summary>
/// PRO (轴五)自动轴原点加速度 AutoAxis_HomeAddSpeed 200
/// </summary>
[ConfigProAttribute("AutoAxis_HomeAddSpeed", true)]
public int AutoAxis_HomeAddSpeed { get; set; }
/// <summary>
/// PRO (轴五)自动轴最小限位 AutoAxis_PositionMin 0
/// </summary>
[ConfigProAttribute("AutoAxis_PositionMin", true)]
public int AutoAxis_PositionMin { get; set; }
/// <summary>
/// PRO (轴五)自动轴最大限位 AutoAxis_PositionMax 0
/// </summary>
[ConfigProAttribute("AutoAxis_PositionMax", true)]
public int AutoAxis_PositionMax { get; set; }
/// <summary>
/// PRO (轴五)自动轴停止时可误差的脉冲数的最小值 AutoAxis_ErrorCountMin
/// </summary>
[ConfigProAttribute("AutoAxis_ErrorCountMin", true)]
public int AutoAxis_ErrorCountMin { get; set; }
/// <summary>
/// PRO (轴五)自动轴停止时可误差的脉冲数的最大值 AutoAxis_ErrorCountMax
/// </summary>
[ConfigProAttribute("AutoAxis_ErrorCountMax", true)]
public int AutoAxis_ErrorCountMax { get; set; }
/// <summary>
/// PRO IO模块对应的DI数量 IO_DILength 192.168.200.10#16;192.168.200.11#4
/// </summary>
[ConfigProAttribute("IO_DILength")]
public string IO_DILength { get; set; }
/// <summary>
/// PRO 模块对应的DO数量 IO_DOLength 192.168.200.10#16;192.168.200.11#4
/// </summary>
[ConfigProAttribute("IO_DOLength")]
public string IO_DOLength { get; set; }
private Dictionary<string, ushort> DILengthMap = null;
private Dictionary<string, ushort> DOLengthMap = null;
public ushort GetDILength(string ip)
{
try
{
if (DILengthMap == null)
{
DILengthMap = new Dictionary<string, ushort>();
string[] arrayList = IO_DILength.Split(';');
foreach (string str in arrayList)
{
string[] arrStr = str.Split('#');
if (arrStr.Length == 2)
{
string ioip = arrStr[0];
ushort length = Convert.ToUInt16(arrStr[1]);
DILengthMap.Add(ioip, length);
}
}
}
}
catch (Exception ex)
{
}
if (DILengthMap.ContainsKey(ip))
{
return DILengthMap[ip];
}
return 16;
}
public ushort GetDOLength(string ip)
{
try
{
if (DOLengthMap == null)
{
DOLengthMap = new Dictionary<string, ushort>();
string[] arrayList = IO_DOLength.Split(';');
foreach (string str in arrayList)
{
string[] arrStr = str.Split('#');
if (arrStr.Length == 2)
{
string ioip = arrStr[0];
ushort length = Convert.ToUInt16(arrStr[1]);
DOLengthMap.Add(ioip, length);
}
}
}
}
catch (Exception ex)
{
}
if (DOLengthMap.ContainsKey(ip))
{
return DOLengthMap[ip];
}
return 16;
}
protected override void initMustHavePro()
{
MustHaveDIList = new List<string>();
MustHaveDOList = new List<string>();
MustHaveDIList.Add(IO_Type.SuddenStop_BTN);
MustHaveDIList.Add(IO_Type.Reset_BTN);
MustHaveDIList.Add(IO_Type.AutoRun_Single);
MustHaveDIList.Add(IO_Type.Airpressure_Check);
MustHaveDIList.Add(IO_Type.TrayCheck_Door);
MustHaveDIList.Add(IO_Type.TrayCheck_Fixture);
MustHaveDIList.Add(IO_Type.SafetyLightCurtains);
MustHaveDIList.Add(IO_Type.Door_Up);
MustHaveDIList.Add(IO_Type.Door_Down);
MustHaveDIList.Add(IO_Type.Door_LimitSingle);
MustHaveDIList.Add(IO_Type.SafetyLightCurtains);
//MustHaveDIList.Add(IO_Type.LocationCylinder_Down);
//MustHaveDIList.Add(IO_Type.LocationCylinder_Up);
//MustHaveDIList.Add(IO_Type.LocationCylinder2_Down);
//MustHaveDIList.Add(IO_Type.LocationCylinder2_Up);
//MustHaveDIList.Add(IO_Type.Left_Door_LimitSingle);
//MustHaveDIList.Add(IO_Type.Right_Door_LimitSingle);
//MustHaveDIList.Add(IO_Type.TrayCheck_3);
//MustHaveDIList.Add(IO_Type.TrayCheck_4);
//MustHaveDIList.Add(IO_Type.LocationCylinder2_Down);
//MustHaveDIList.Add(IO_Type.LocationCylinder2_Up);
MustHaveDIList.Add(IO_Type.SuckingDisc_Up);
MustHaveDIList.Add(IO_Type.SuckingDisc_Down);
MustHaveDIList.Add(IO_Type.WidthCheck1);
MustHaveDIList.Add(IO_Type.WidthCheck2);
MustHaveDIList.Add(IO_Type.TrayCheck_LoadMaterial);
MustHaveDIList.Add(IO_Type.OutCheck);
MustHaveDIList.Add(IO_Type.Door_Open);
MustHaveDIList.Add(IO_Type.Door_Close);
MustHaveDIList.Add(IO_Type.TrayCheck_Fixture);
MustHaveDIList.Add(IO_Type.CompressAxis_Check);
MustHaveDIList.Add(IO_Type.DoorClose_LoadMaterial);
MustHaveDIList.Add(IO_Type.Airpressure_Check);
MustHaveDIList.Add(IO_Type.SuckingDisc_Air);
MustHaveDIList.Add(IO_Type.DoorColse_Single);
MustHaveDOList.Add(IO_Type.AutoRun_HddLed);
MustHaveDOList.Add(IO_Type.Alarm_HddLed);
MustHaveDOList.Add(IO_Type.RunSign_HddLed);
MustHaveDOList.Add(IO_Type.StartOrStopBlow);
MustHaveDOList.Add(IO_Type.Run_Sign);
MustHaveDOList.Add(IO_Type.Door_Up);
MustHaveDOList.Add(IO_Type.Door_Down);
//MustHaveDOList.Add(IO_Type.LocationCylinder_Down);
//MustHaveDOList.Add(IO_Type.LocationCylinder_Up);
MustHaveDOList.Add(IO_Type.Axis_Brake);
MustHaveDOList.Add(IO_Type.CameraLight_Power);
MustHaveDOList.Add(IO_Type.SuckingDisc_Work);
MustHaveDOList.Add(IO_Type.Door_Up);
MustHaveDOList.Add(IO_Type.Door_Down);
MustHaveDOList.Add(IO_Type.SuckingDisc_Up);
MustHaveDOList.Add(IO_Type.SuckingDisc_Down);
MustHaveDOList.Add(IO_Type.Door_Open);
MustHaveDOList.Add(IO_Type.Door_Close);
}
public static void ConfigAxis(AC_SA_Config Config)
public static void ConfigAxis(AUTO_SA_Config Config)
{
Config.Middle_Axis.TargetSpeed = Config.MiddleAxis_TargetSpeed;
Config.Middle_Axis.AddSpeed = Config.MiddleAxis_AddSpeed;
......@@ -595,6 +697,8 @@ namespace OnlineStore.LoadCSVLibrary
Config.UpDown_Axis.HomeHighSpeed = Config.UpdownAxis_HomeHighSpeed;
Config.UpDown_Axis.HomeLowSpeed = Config.UpdownAxis_HomeLowSpeed;
Config.Middle_Axis.CanErrorCountMin = Config.MiddleAxis_ErrorCountMin;
Config.InOut_Axis.CanErrorCountMin = Config.InoutAxis_ErrorCountMin;
Config.UpDown_Axis.CanErrorCountMin = Config.UpdownAxis_ErrorCountMin;
......@@ -609,10 +713,17 @@ namespace OnlineStore.LoadCSVLibrary
Config.UpDown_Axis.PositionMin = Config.UpdownAxis_PositionMin;
Config.UpDown_Axis.PositionMax = Config.UpdownAxis_PositionMax;
//Config.InOut_Axis.ResolveSpeed = Config.InoutAxis_ResolveSpeed;
//Config.UpDown_Axis.ResolveSpeed = Config.UpdownAxis_ResolveSpeed;
//Config.Middle_Axis.ResolveSpeed = Config.MiddleAxis_ResolveSpeed;
Config.Auto_Axis.TargetSpeed = Config.AutoAxis_TargetSpeed;
Config.Auto_Axis.AddSpeed = Config.AutoAxis_AddSpeed;
Config.Auto_Axis.DelSpeed = Config.AutoAxis_DelSpeed;
Config.Auto_Axis.HomeAddSpeed = Config.AutoAxis_HomeAddSpeed;
Config.Auto_Axis.HomeHighSpeed = Config.AutoAxis_HomeHighSpeed;
Config.Auto_Axis.HomeLowSpeed = Config.AutoAxis_HomeLowSpeed;
Config.Auto_Axis.CanErrorCountMin = Config.AutoAxis_ErrorCountMin;
Config.Auto_Axis.CanErrorCountMax = Config.AutoAxis_ErrorCountMax;
Config.Auto_Axis.PositionMin = Config.AutoAxis_PositionMin;
Config.Auto_Axis.PositionMax = Config.AutoAxis_PositionMax;
Config.Auto_Axis.DefaultPosition = Config.AutoAxis_P1;
Config.Middle_Axis.DefaultPosition = Config.MiddleAxis_P1_Position;
Config.InOut_Axis.DefaultPosition = Config.InOutAxis_P1_Position;
......
......@@ -8,36 +8,9 @@ namespace OnlineStore.LoadCSVLibrary
{
public class StoreType
{
///// <summary>
///// 双层在线料仓(电钢,康泰克板子,康奈德IO模块)料仓总配置
///// </summary>
//public static string RC_DB_LINE = "RC_DB_LINE";
///// <summary>
///// 双层在线料仓(电钢,康泰克板子,康奈德IO模块)单个料仓配置
///// </summary>
//public static string RC_DB_LA = "RC_DB_LA";
///// <summary>
///// 单台自动料仓 锁孔板PLC
///// </summary>
//public static string RC_PLC_SM = "RC_PLC_SM";
///// <summary>
///// 康泰克流水线料仓_子料仓
///// </summary>
//public static string RC_KTK_LA = "RC_KTK_LA";
///// <summary>
///// 康泰克流水线料仓_流水线
///// </summary>
//public static string RC_KTK_LINE = "RC_KTK_LINE";
///// <summary>
///// 康泰克单台料仓
///// </summary>
//public static string RC_KTK_SA = "RC_KTK_SA";
/// <summary>
/// 松下伺服485通信单台料仓
/// 松下伺服485通信单台料仓-自动上下料料仓
/// </summary>
public static string RC_AC_SA = "RC_AC_SA";
public static string AUTO_SA_Config = "AUTO_SA_Config";
}
}
......@@ -27,74 +27,18 @@ namespace OnlineStore.LoadCSVLibrary
}
/// <summary>
/// 进料装置DI。夹具检测1-1 Fixture_Check_1
/// </summary>
public static string Fixture_Check_1 = "Fixture_Check_1";
/// <summary>
/// 进料装置IO。夹具检测1-2 Fixture_Check_2
/// </summary>
public static string Fixture_Check_2 = "Fixture_Check_2";
/// <summary>
/// 进料装置IO。夹具检测1-3 Fixture_Check_3
/// </summary>
public static string Fixture_Check_3 = "Fixture_Check_3";
/// <summary>
/// 进料装置IO。夹具检测1-4 Fixture_Check_4
/// </summary>
public static string Fixture_Check_4 = "Fixture_Check_4";
/// <summary>
///进料装置IO。 顶升气缸上升端 TopCylinder_UP
/// </summary>
public static string TopCylinder_UP = "TopCylinder_UP";
/// <summary>
/// 进料装置IO。顶升气缸下降端 TopCylinder_Down
/// </summary>
public static string TopCylinder_Down = "TopCylinder_Down";
/// <summary>
/// 进料装置IO。前后气缸前进端 BeforeAfterCylinder_Before
/// </summary>
public static string BeforeAfterCylinder_Before = "BeforeAfterCylinder_Before";
/// <summary>
/// 进料装置IO。前后气缸后退端 BeforeAfterCylinder_After
/// </summary>
public static string BeforeAfterCylinder_After = "BeforeAfterCylinder_After";
/// <summary>
/// 进料装置IO。上下气缸上升端 UpDownCylinder_Up
/// </summary>
public static string UpDownCylinder_Up = "UpDownCylinder_Up";
/// <summary>
/// 进料装置IO。上下气缸下降端 UpDownCylinder_Down
/// </summary>
public static string UpDownCylinder_Down = "UpDownCylinder_Down";
/// <summary>
/// 进料装置IO。夹料气缸夹紧端 ClampCylinder_Slack
/// </summary>
public static string ClampCylinder_Slack = "ClampCylinder_Slack";
/// <summary>
/// 进料装置IO。夹料气缸放松端 ClampCylinder_Tighten
/// </summary>
public static string ClampCylinder_Tighten = "ClampCylinder_Tighten";
/// <summary>
/// 进料装置DO。 阻挡气缸 1上升SOL StopCylinder_1(气缸上升=0,气缸下降=1)
/// 料仓,流水线 DI。急停(料仓) SuddenStop_BTN
/// </summary>
public static string StopCylinder_1 = "StopCylinder_1";
public static string SuddenStop_BTN = "SuddenStop_BTN";
/// <summary>
/// 进料装置DO。 阻挡气缸 2上升SOL StopCylinder_2(气缸上升=0,气缸下降=1)
/// 流水线 DI。复位 Reset_BTN
/// </summary>
public static string StopCylinder_2 = "StopCylinder_2";
public static string Reset_BTN = "Reset_BTN";
/// <summary>
///料仓DI。 手动调试(料仓) Test_Debug
/// </summary>
public static string Test_Debug = "Test_Debug";
/// <summary>
/// 料仓,流水线DI。料盘检测(料仓) Tray_Check
/// 流水线 DO。流水线上的绿灯,自动状态(指示灯) AutoRun_HddLed
/// </summary>
public static string Tray_Check = "Tray_Check";
public static string AutoRun_HddLed = "AutoRun_HddLed";
/// <summary>
/// 料仓DI。气压检测(料仓) Airpressure_Check
/// </summary>
......@@ -116,33 +60,6 @@ namespace OnlineStore.LoadCSVLibrary
///料仓IO。 定位气缸下降端(料仓) LocationCylinder2_Down
/// </summary>
public static string LocationCylinder2_Down = "LocationCylinder2_Down";
/// <summary>
/// 料仓DO 。料仓运转ON Run_Sign
/// </summary>
public static string Run_Sign = "Run_Sign";
/// <summary>
/// 料仓DO 。料仓轴2刹车ON Axis_Brake
/// </summary>
public static string Axis_Brake = "Axis_Brake";
/// <summary>
/// 料仓DO 。料仓吹气SOL ON StartOrStopBlow
/// </summary>
public static string StartOrStopBlow = "StartOrStopBlow";
/// <summary>
/// 料仓,流水线 DI。急停(料仓) SuddenStop_BTN
/// </summary>
public static string SuddenStop_BTN = "SuddenStop_BTN";
/// <summary>
/// 流水线 DI。复位 Reset_BTN
/// </summary>
public static string Reset_BTN = "Reset_BTN";
/// <summary>
/// 流水线 DO。流水线上的绿灯,自动状态(指示灯) AutoRun_HddLed
/// </summary>
public static string AutoRun_HddLed = "AutoRun_HddLed";
/// <summary>
/// 流水线 DO。流水线上的黄灯, 运行状态(指示灯) RunSign_HddLed
......@@ -150,166 +67,93 @@ namespace OnlineStore.LoadCSVLibrary
public static string RunSign_HddLed = "RunSign_HddLed";
/// <summary>
/// 自动运行 AutoRun_Single
/// </summary>
public static string AutoRun_Single = "AutoRun_Single";
/// <summary>
///流水线 DO。流水线上的红灯, 故障状态(指示灯) Alarm_HddLed
/// </summary>
public static string Alarm_HddLed = "Alarm_HddLed";
/// <summary>
/// 流水线 DO。驱动电机1正转 DriveMotor1_Forward
/// 料仓DO 。料仓运转ON Run_Sign
/// </summary>
public static string DriveMotor1_Forward = "DriveMotor1_Forward";
public static string Run_Sign = "Run_Sign";
/// <summary>
/// 流水线 DO。驱动电机1反转 DriveMotor1_Back
/// 料仓DO 。料仓轴2刹车ON Axis_Brake
/// </summary>
public static string DriveMotor1_Back = "DriveMotor1_Back";
public static string Axis_Brake = "Axis_Brake";
/// <summary>
///流水线 DO。 驱动电机2正转 DriveMotor2_Forward
/// 料仓DO 。料仓吹气SOL ON StartOrStopBlow
/// </summary>
public static string DriveMotor2_Forward = "DriveMotor2_Forward";
/// <summary>
/// 流水线 DO。驱动电机2反转 DriveMotor2_Back
/// </summary>
public static string DriveMotor2_Back = "DriveMotor2_Back";
///// <summary>
///// 入/出库选择,=0表示出库,=1表示入库
///// </summary>
//public static string InOutStoreType = "InOutStoreType";
///// <summary>
///// 流水线DI,脚踏开关 FootPedal_BTN
///// </summary>
//public static string FootPedal_BTN = "FootPedal_BTN";
public static string StartOrStopBlow = "StartOrStopBlow";
/// <summary>
/// 出料口 第一个阻挡气缸的料盘信号
/// </summary>
public static string OutStore_TrayCheck = "OutStore_TrayCheck";
/// <summary>
/// 出料口,第一个阻挡气缸的托盘信号(夹具检测)
/// </summary>
public static string OutStore_FixtureCheck = "OutStore_FixtureCheck";
/// <summary>
/// DI信号,=1时皮带才在转动中 ,=0表示不正常
/// </summary>
public static string DriveMotor_StopS = "DriveMotor_StopS";
/// <summary>
/// DI信号 ,切换到下一个工单出库信号,此信号数据改变时,直接发给服务器处理
/// </summary>
public static string Out_NextFeeder = "Out_NextFeeder";
/// <summary>
/// 自动运行 AutoRun_Single
/// 进出料口门上升端 Door_Up
/// </summary>
public static string AutoRun_Single = "AutoRun_Single";
//线体2调宽反转 Line2_Width_Back
public static string Door_Up = "Door_Up";
/// <summary>
/// 吹气SOL Blow_Single
/// 进出料口门下降端 Door_Down
/// </summary>
public static string Blow_Single = "Blow_Single";
public static string Door_Down = "Door_Down";
/// <summary>
/// 流水线 原点 Line_Home
/// </summary>
public static string Line_Home = "Line_Home";
/// <summary>
/// 线体 进料口确认 Line_InDoor_Single
/// DI 上料机构门关闭 DoorClose_LoadMaterial X17 DI-21
/// </summary>
public static string Line_InDoor_Single = "Line_InDoor_Single";
public static string DoorClose_LoadMaterial = "DoorClose_LoadMaterial";
/// <summary>
/// 线体 出料口确认 Line_OutDoor_Single
/// 吸盘压力确认信号 SuckingDisc_Air 202 192.168.200.11 0 吸盘压力确认信号 X19 DI-23
/// </summary>
public static string Line_OutDoor_Single = "Line_OutDoor_Single";
public static string SuckingDisc_Air = "SuckingDisc_Air";
/// <summary>
/// 仓位 料盘检测 Store_TrayCheck
/// 左侧门关闭 DoorColse_Single X20 DI-24
/// </summary>
public static string Store_TrayCheck = "Store_TrayCheck";
/// <summary>
/// SMEMA(上位机要料信号) 要料请求 SMEMA_Up
/// </summary>
public static string SMEMA_Up = "SMEMA_Up";
/// <summary>
/// SMEMA(下位) 下位机送料信号 SMEMA_Down
/// </summary>
public static string SMEMA_Down = "SMEMA_Down";
/// <summary>
/// 线体 正转 Line_Foward
/// </summary>
public static string Line_Foward = "Line_Foward";
public static string DoorColse_Single = "DoorColse_Single";
/// <summary>
/// 线体 反转 Line_Back
/// 吸盘气缸上升端 SuckingDisc_Up X07 DI-07
/// </summary>
public static string Line_Back = "Line_Back";
public static string SuckingDisc_Up = "SuckingDisc_Up";
/// <summary>
/// 线体 调宽反转 Line_Width_Back
/// 吸盘气缸下降端 SuckingDisc_Down X08 DI-08
/// </summary>
public static string Line_Width_Back = "Line_Width_Back";
public static string SuckingDisc_Down = "SuckingDisc_Down";
/// <summary>
/// 线体 调宽正转 Line_Width_Foward
/// 料盘宽度检测1 WidthCheck1 208 X09 DI-09
/// </summary>
public static string Line_Width_Foward = "Line_Width_Foward";
public static string WidthCheck1 = "WidthCheck1";
/// <summary>
/// 取料前进端 Fork_Forward
/// 料盘宽度检测2 WidthCheck2 209 X10 DI-10
/// </summary>
public static string Fork_Forward = "Fork_Forward";
public static string WidthCheck2 = "WidthCheck2";
/// <summary>
/// 取料后退端 Fork_Back
/// 料盘检测1(上料机构) TrayCheck_LoadMaterial X11 DI-11
/// </summary>
public static string Fork_Back = "Fork_Back";
public static string TrayCheck_LoadMaterial = "TrayCheck_LoadMaterial";
/// <summary>
/// 取料旋转端 Fork_Rotate
/// 上料机构出料检测 OutCheck X12 DI-12
/// </summary>
public static string Fork_Rotate = "Fork_Rotate";
public static string OutCheck = "OutCheck";
/// <summary>
/// 取料旋回端 Fork_Return
/// 门锁气缸打开端 Door_Open X13 DI-13
/// </summary>
public static string Fork_Return = "Fork_Return";
public static string Door_Open = "Door_Open";
/// <summary>
/// 料仓门口料盘检测 TrayCheck_1
/// 门锁气缸关闭端 Door_Close X14 DI-14
/// </summary>
public static string TrayCheck_Door = "TrayCheck_Door";
public static string Door_Close = "Door_Close";
/// <summary>
/// 叉子料盘检测 TrayCheck_Fixture
/// 料盘检测2(料叉机构) TrayCheck_Fixture X15 DI-15
/// </summary>
public static string TrayCheck_Fixture = "TrayCheck_Fixture";
/// <summary>
/// 进出料口门上升端 Door_Up
/// </summary>
public static string Door_Up = "Door_Up";
/// <summary>
/// 进出料口门下降端 Door_Down
/// 压紧机构计量检测 CompressAxis_Check X16 DI-16
/// </summary>
public static string Door_Down = "Door_Down";
public static string CompressAxis_Check = "CompressAxis_Check";
/// <summary>
/// 下位机要料信号 PreMachine_Send
/// </summary>
public static string PreMachine_Send = "PreMachine_Send";
/// <summary>
/// 暂时不用 NextMachine_End
/// </summary>
public static string NextMachine_End = "NextMachine_End";
/// <summary>
/// DI 流水线急停 LINE_Suddown 203
/// </summary>
public static string LINE_Suddown = "LINE_Suddown";
/// <summary>
/// 左侧门限位
/// </summary>
public static string Left_Door_LimitSingle = "Left_Door_LimitSingle";
/// <summary>
/// 右侧门限位
/// </summary>
public static string Right_Door_LimitSingle = "Right_Door_LimitSingle";
/// <summary>
/// 前门限位
/// </summary>
public static string Door_LimitSingle = "Door_LimitSingle";
/// <summary>
/// 安全光栅
/// </summary>
public static string SafetyLightCurtains = "SafetyLightCurtains";
......@@ -318,7 +162,12 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
public static string CameraLight_Power = "CameraLight_Power";
public static string TrayCheck_3 = "TrayCheck_3";
public static string TrayCheck_4 = "TrayCheck_4";
/// <summary>
/// DO 吸盘吸料SOL SuckingDisc_Work 107 192.168.200.10 0 吸盘吸料SOL Y08 DO-08
/// </summary>
public static string SuckingDisc_Work = "SuckingDisc_Work";
public static string TrayCheck_Door = "TrayCheck_Door";
}
}
namespace UserFromControl
{
partial class AxisShowControl
{
/// <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.txtErrorPosition = new System.Windows.Forms.TextBox();
this.label29 = new System.Windows.Forms.Label();
this.txtIoStatus = new System.Windows.Forms.TextBox();
this.txtMontion = new System.Windows.Forms.TextBox();
this.txtPosition = new System.Windows.Forms.TextBox();
this.txtCommand = new System.Windows.Forms.TextBox();
this._Label4_0 = new System.Windows.Forms.Label();
this._Label3_0 = new System.Windows.Forms.Label();
this._Label2_0 = new System.Windows.Forms.Label();
this._Label1_0 = new System.Windows.Forms.Label();
this.box = new System.Windows.Forms.GroupBox();
this.txtTargetPosition = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.box.SuspendLayout();
this.SuspendLayout();
//
// txtErrorPosition
//
this.txtErrorPosition.AcceptsReturn = true;
this.txtErrorPosition.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
this.txtErrorPosition.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtErrorPosition.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtErrorPosition.ForeColor = System.Drawing.Color.GreenYellow;
this.txtErrorPosition.Location = new System.Drawing.Point(10, 155);
this.txtErrorPosition.MaxLength = 0;
this.txtErrorPosition.Name = "txtErrorPosition";
this.txtErrorPosition.ReadOnly = true;
this.txtErrorPosition.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtErrorPosition.Size = new System.Drawing.Size(197, 23);
this.txtErrorPosition.TabIndex = 11;
this.txtErrorPosition.Text = "0";
this.txtErrorPosition.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label29
//
this.label29.AutoSize = true;
this.label29.Location = new System.Drawing.Point(11, 149);
this.label29.Name = "label29";
this.label29.Size = new System.Drawing.Size(47, 12);
this.label29.TabIndex = 10;
this.label29.Text = "error P";
this.label29.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.label29.Visible = false;
//
// txtIoStatus
//
this.txtIoStatus.AcceptsReturn = true;
this.txtIoStatus.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
this.txtIoStatus.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtIoStatus.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtIoStatus.ForeColor = System.Drawing.Color.GreenYellow;
this.txtIoStatus.Location = new System.Drawing.Point(10, 120);
this.txtIoStatus.MaxLength = 0;
this.txtIoStatus.Name = "txtIoStatus";
this.txtIoStatus.ReadOnly = true;
this.txtIoStatus.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtIoStatus.Size = new System.Drawing.Size(197, 23);
this.txtIoStatus.TabIndex = 9;
this.txtIoStatus.Text = "0";
this.txtIoStatus.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// txtMontion
//
this.txtMontion.AcceptsReturn = true;
this.txtMontion.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
this.txtMontion.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtMontion.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtMontion.ForeColor = System.Drawing.Color.GreenYellow;
this.txtMontion.Location = new System.Drawing.Point(10, 85);
this.txtMontion.MaxLength = 0;
this.txtMontion.Name = "txtMontion";
this.txtMontion.ReadOnly = true;
this.txtMontion.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtMontion.Size = new System.Drawing.Size(197, 23);
this.txtMontion.TabIndex = 7;
this.txtMontion.Text = "0";
this.txtMontion.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// txtPosition
//
this.txtPosition.AcceptsReturn = true;
this.txtPosition.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
this.txtPosition.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtPosition.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtPosition.ForeColor = System.Drawing.Color.GreenYellow;
this.txtPosition.Location = new System.Drawing.Point(10, 50);
this.txtPosition.MaxLength = 0;
this.txtPosition.Name = "txtPosition";
this.txtPosition.ReadOnly = true;
this.txtPosition.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtPosition.Size = new System.Drawing.Size(197, 23);
this.txtPosition.TabIndex = 5;
this.txtPosition.Text = "0";
this.txtPosition.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// txtCommand
//
this.txtCommand.AcceptsReturn = true;
this.txtCommand.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
this.txtCommand.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtCommand.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtCommand.ForeColor = System.Drawing.Color.GreenYellow;
this.txtCommand.Location = new System.Drawing.Point(10, 15);
this.txtCommand.MaxLength = 0;
this.txtCommand.Name = "txtCommand";
this.txtCommand.ReadOnly = true;
this.txtCommand.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtCommand.Size = new System.Drawing.Size(197, 23);
this.txtCommand.TabIndex = 3;
this.txtCommand.Text = "0";
this.txtCommand.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// _Label4_0
//
this._Label4_0.BackColor = System.Drawing.SystemColors.Control;
this._Label4_0.Cursor = System.Windows.Forms.Cursors.Default;
this._Label4_0.ForeColor = System.Drawing.SystemColors.ControlText;
this._Label4_0.Location = new System.Drawing.Point(-10, 117);
this._Label4_0.Name = "_Label4_0";
this._Label4_0.RightToLeft = System.Windows.Forms.RightToLeft.No;
this._Label4_0.Size = new System.Drawing.Size(68, 23);
this._Label4_0.TabIndex = 8;
this._Label4_0.Text = "IO Status";
this._Label4_0.TextAlign = System.Drawing.ContentAlignment.TopRight;
this._Label4_0.Visible = false;
//
// _Label3_0
//
this._Label3_0.BackColor = System.Drawing.SystemColors.Control;
this._Label3_0.Cursor = System.Windows.Forms.Cursors.Default;
this._Label3_0.ForeColor = System.Drawing.SystemColors.ControlText;
this._Label3_0.Location = new System.Drawing.Point(5, 85);
this._Label3_0.Name = "_Label3_0";
this._Label3_0.RightToLeft = System.Windows.Forms.RightToLeft.No;
this._Label3_0.Size = new System.Drawing.Size(53, 12);
this._Label3_0.TabIndex = 6;
this._Label3_0.Text = "Motion Status";
this._Label3_0.TextAlign = System.Drawing.ContentAlignment.TopRight;
this._Label3_0.Visible = false;
//
// _Label2_0
//
this._Label2_0.BackColor = System.Drawing.SystemColors.Control;
this._Label2_0.Cursor = System.Windows.Forms.Cursors.Default;
this._Label2_0.ForeColor = System.Drawing.SystemColors.ControlText;
this._Label2_0.Location = new System.Drawing.Point(5, 53);
this._Label2_0.Name = "_Label2_0";
this._Label2_0.RightToLeft = System.Windows.Forms.RightToLeft.No;
this._Label2_0.Size = new System.Drawing.Size(53, 12);
this._Label2_0.TabIndex = 4;
this._Label2_0.Text = "Position";
this._Label2_0.TextAlign = System.Drawing.ContentAlignment.TopRight;
this._Label2_0.Visible = false;
//
// _Label1_0
//
this._Label1_0.BackColor = System.Drawing.SystemColors.Control;
this._Label1_0.Cursor = System.Windows.Forms.Cursors.Default;
this._Label1_0.ForeColor = System.Drawing.SystemColors.ControlText;
this._Label1_0.Location = new System.Drawing.Point(5, 21);
this._Label1_0.Name = "_Label1_0";
this._Label1_0.RightToLeft = System.Windows.Forms.RightToLeft.No;
this._Label1_0.Size = new System.Drawing.Size(53, 12);
this._Label1_0.TabIndex = 2;
this._Label1_0.Text = "Command";
this._Label1_0.TextAlign = System.Drawing.ContentAlignment.TopRight;
this._Label1_0.Visible = false;
//
// box
//
this.box.BackColor = System.Drawing.SystemColors.Control;
this.box.Controls.Add(this.txtTargetPosition);
this.box.Controls.Add(this.label1);
this.box.Controls.Add(this.txtErrorPosition);
this.box.Controls.Add(this.label29);
this.box.Controls.Add(this.txtIoStatus);
this.box.Controls.Add(this.txtMontion);
this.box.Controls.Add(this.txtPosition);
this.box.Controls.Add(this.txtCommand);
this.box.Controls.Add(this._Label4_0);
this.box.Controls.Add(this._Label3_0);
this.box.Controls.Add(this._Label2_0);
this.box.Controls.Add(this._Label1_0);
this.box.ForeColor = System.Drawing.SystemColors.ControlText;
this.box.Location = new System.Drawing.Point(3, 1);
this.box.Name = "box";
this.box.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.box.Size = new System.Drawing.Size(214, 223);
this.box.TabIndex = 2;
this.box.TabStop = false;
this.box.Text = "Axis 0";
//
// txtTargetPosition
//
this.txtTargetPosition.AcceptsReturn = true;
this.txtTargetPosition.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
this.txtTargetPosition.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtTargetPosition.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtTargetPosition.ForeColor = System.Drawing.Color.GreenYellow;
this.txtTargetPosition.Location = new System.Drawing.Point(10, 190);
this.txtTargetPosition.MaxLength = 0;
this.txtTargetPosition.Name = "txtTargetPosition";
this.txtTargetPosition.ReadOnly = true;
this.txtTargetPosition.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtTargetPosition.Size = new System.Drawing.Size(197, 23);
this.txtTargetPosition.TabIndex = 13;
this.txtTargetPosition.Text = "0";
this.txtTargetPosition.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(5, 181);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 12;
this.label1.Text = "target P";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.label1.Visible = false;
//
// AxisShowControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.box);
this.MaximumSize = new System.Drawing.Size(10000, 10000);
this.MinimumSize = new System.Drawing.Size(10, 10);
this.Name = "AxisShowControl";
this.Size = new System.Drawing.Size(220, 227);
this.Load += new System.EventHandler(this.AxisShowControl_Load);
this.box.ResumeLayout(false);
this.box.PerformLayout();
this.ResumeLayout(false);
}
#endregion
public System.Windows.Forms.TextBox txtErrorPosition;
private System.Windows.Forms.Label label29;
public System.Windows.Forms.TextBox txtIoStatus;
public System.Windows.Forms.TextBox txtMontion;
public System.Windows.Forms.TextBox txtPosition;
public System.Windows.Forms.TextBox txtCommand;
public System.Windows.Forms.Label _Label4_0;
public System.Windows.Forms.Label _Label3_0;
public System.Windows.Forms.Label _Label2_0;
public System.Windows.Forms.Label _Label1_0;
public System.Windows.Forms.GroupBox box;
public System.Windows.Forms.TextBox txtTargetPosition;
private System.Windows.Forms.Label label1;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace UserFromControl
{
public partial class AxisShowControl : UserControl
{
public int AxisNo { get; set; }
public int CommandValue { get; set; }
public int PositionValue { get; set; }
public int MontionValue { get; set; }
public int IoStatusValue { get; set; }
public int ErrorPosition { get; set; }
public int TargetPosition { get; set; }
List<IOStatusControl> ioStatusList = new List<IOStatusControl>();
public void BingData(int axisNO, int command, int position, int io, int montion, int errorPositon,int targetPosition)
{
this.AxisNo = axisNO;
this.CommandValue = command;
this.PositionValue = position;
this.MontionValue = montion;
this.IoStatusValue = io;
this.ErrorPosition = errorPositon;
this.TargetPosition = targetPosition;
}
public void ShowData()
{
box.Text = "Axis " + AxisNo;
txtCommand.Text = CommandValue.ToString();
txtErrorPosition.Text = ErrorPosition.ToString();
string ioStatus = Convert.ToString(IoStatusValue, 2).PadLeft(9, '0');
txtIoStatus.Text = ioStatus;
String monIoStr = Convert.ToString(MontionValue, 2).PadLeft(9, '0');
txtMontion.Text = monIoStr;
txtPosition.Text = PositionValue.ToString();
txtTargetPosition.Text = TargetPosition.ToString();
////循环io状态
//for (int i = 0; i < ioStatusList.Count(); i++)
//{
// string value = ioStatus.Substring(i, 1);
// ioStatusList[i].IOValue = Convert.ToInt32(value);
// ioStatusList[i].ShowData();
//}
}
public AxisShowControl()
{
InitializeComponent();
}
private void AxisShowControl_Load(object sender, EventArgs e)
{
//ioStatusList.Add(ioStatusControl9);
//ioStatusList.Add(ioStatusControl4);
//ioStatusList.Add(ioStatusControl3);
//ioStatusList.Add(ioStatusControl2);
//ioStatusList.Add(ioStatusControl1);
//ioStatusList.Add(ioStatusControl5);
//ioStatusList.Add(ioStatusControl6);
//ioStatusList.Add(ioStatusControl7);
//ioStatusList.Add(ioStatusControl8);
}
}
}
<?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
namespace UserFromControl
{
partial class AxisShowSControl
{
/// <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.txtIoStatus = new System.Windows.Forms.TextBox();
this.txtMontion = new System.Windows.Forms.TextBox();
this.txtPosition = new System.Windows.Forms.TextBox();
this.txtCommand = new System.Windows.Forms.TextBox();
this._Label3_0 = new System.Windows.Forms.Label();
this._Label1_0 = new System.Windows.Forms.Label();
this.box = new System.Windows.Forms.GroupBox();
this.box.SuspendLayout();
this.SuspendLayout();
//
// txtIoStatus
//
this.txtIoStatus.AcceptsReturn = true;
this.txtIoStatus.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
this.txtIoStatus.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtIoStatus.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtIoStatus.ForeColor = System.Drawing.Color.GreenYellow;
this.txtIoStatus.Location = new System.Drawing.Point(10, 120);
this.txtIoStatus.MaxLength = 0;
this.txtIoStatus.Name = "txtIoStatus";
this.txtIoStatus.ReadOnly = true;
this.txtIoStatus.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtIoStatus.Size = new System.Drawing.Size(160, 23);
this.txtIoStatus.TabIndex = 9;
this.txtIoStatus.Text = "0";
this.txtIoStatus.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// txtMontion
//
this.txtMontion.AcceptsReturn = true;
this.txtMontion.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
this.txtMontion.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtMontion.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtMontion.ForeColor = System.Drawing.Color.GreenYellow;
this.txtMontion.Location = new System.Drawing.Point(10, 85);
this.txtMontion.MaxLength = 0;
this.txtMontion.Name = "txtMontion";
this.txtMontion.ReadOnly = true;
this.txtMontion.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtMontion.Size = new System.Drawing.Size(160, 23);
this.txtMontion.TabIndex = 7;
this.txtMontion.Text = "0";
this.txtMontion.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// txtPosition
//
this.txtPosition.AcceptsReturn = true;
this.txtPosition.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
this.txtPosition.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtPosition.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtPosition.ForeColor = System.Drawing.Color.GreenYellow;
this.txtPosition.Location = new System.Drawing.Point(10, 50);
this.txtPosition.MaxLength = 0;
this.txtPosition.Name = "txtPosition";
this.txtPosition.ReadOnly = true;
this.txtPosition.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtPosition.Size = new System.Drawing.Size(160, 23);
this.txtPosition.TabIndex = 5;
this.txtPosition.Text = "0";
this.txtPosition.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// txtCommand
//
this.txtCommand.AcceptsReturn = true;
this.txtCommand.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
this.txtCommand.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtCommand.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtCommand.ForeColor = System.Drawing.Color.GreenYellow;
this.txtCommand.Location = new System.Drawing.Point(10, 15);
this.txtCommand.MaxLength = 0;
this.txtCommand.Name = "txtCommand";
this.txtCommand.ReadOnly = true;
this.txtCommand.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtCommand.Size = new System.Drawing.Size(160, 23);
this.txtCommand.TabIndex = 3;
this.txtCommand.Text = "0";
this.txtCommand.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// _Label3_0
//
this._Label3_0.BackColor = System.Drawing.SystemColors.Control;
this._Label3_0.Cursor = System.Windows.Forms.Cursors.Default;
this._Label3_0.ForeColor = System.Drawing.SystemColors.ControlText;
this._Label3_0.Location = new System.Drawing.Point(5, 85);
this._Label3_0.Name = "_Label3_0";
this._Label3_0.RightToLeft = System.Windows.Forms.RightToLeft.No;
this._Label3_0.Size = new System.Drawing.Size(53, 12);
this._Label3_0.TabIndex = 6;
this._Label3_0.Text = "Motion Status";
this._Label3_0.TextAlign = System.Drawing.ContentAlignment.TopRight;
this._Label3_0.Visible = false;
//
// _Label1_0
//
this._Label1_0.BackColor = System.Drawing.SystemColors.Control;
this._Label1_0.Cursor = System.Windows.Forms.Cursors.Default;
this._Label1_0.ForeColor = System.Drawing.SystemColors.ControlText;
this._Label1_0.Location = new System.Drawing.Point(5, 21);
this._Label1_0.Name = "_Label1_0";
this._Label1_0.RightToLeft = System.Windows.Forms.RightToLeft.No;
this._Label1_0.Size = new System.Drawing.Size(53, 12);
this._Label1_0.TabIndex = 2;
this._Label1_0.Text = "Command";
this._Label1_0.TextAlign = System.Drawing.ContentAlignment.TopRight;
this._Label1_0.Visible = false;
//
// box
//
this.box.BackColor = System.Drawing.SystemColors.Control;
this.box.Controls.Add(this.txtIoStatus);
this.box.Controls.Add(this.txtMontion);
this.box.Controls.Add(this.txtPosition);
this.box.Controls.Add(this.txtCommand);
this.box.Controls.Add(this._Label3_0);
this.box.Controls.Add(this._Label1_0);
this.box.ForeColor = System.Drawing.SystemColors.ControlText;
this.box.Location = new System.Drawing.Point(3, 1);
this.box.Name = "box";
this.box.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.box.Size = new System.Drawing.Size(178, 152);
this.box.TabIndex = 2;
this.box.TabStop = false;
this.box.Text = "Axis 0";
//
// AxisShowSControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.box);
this.MaximumSize = new System.Drawing.Size(10000, 10000);
this.MinimumSize = new System.Drawing.Size(10, 10);
this.Name = "AxisShowSControl";
this.Size = new System.Drawing.Size(188, 158);
this.Load += new System.EventHandler(this.AxisShowControl_Load);
this.box.ResumeLayout(false);
this.box.PerformLayout();
this.ResumeLayout(false);
}
#endregion
public System.Windows.Forms.TextBox txtIoStatus;
public System.Windows.Forms.TextBox txtMontion;
public System.Windows.Forms.TextBox txtPosition;
public System.Windows.Forms.TextBox txtCommand;
public System.Windows.Forms.Label _Label3_0;
public System.Windows.Forms.Label _Label1_0;
public System.Windows.Forms.GroupBox box;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace UserFromControl
{
public partial class AxisShowSControl : UserControl
{
public int AxisNo { get; set; }
public int CommandValue { get; set; }
public int PositionValue { get; set; }
public int MontionValue { get; set; }
public int IoStatusValue { get; set; }
public void BingData(int axisNO, int command, int position, int io, int montion )
{
this.AxisNo = axisNO;
this.CommandValue = command;
this.PositionValue = position;
this.MontionValue = montion;
this.IoStatusValue = io;
}
public void ShowData()
{
box.Text = "Axis " + AxisNo;
txtCommand.Text = CommandValue.ToString();
string ioStatus = Convert.ToString(IoStatusValue, 2).PadLeft(9, '0');
txtIoStatus.Text = ioStatus;
String monIoStr = Convert.ToString(MontionValue, 2).PadLeft(9, '0');
txtMontion.Text = monIoStr;
txtPosition.Text = PositionValue.ToString();
}
public AxisShowSControl()
{
InitializeComponent();
}
private void AxisShowControl_Load(object sender, EventArgs e)
{
}
}
}
<?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
namespace UserFromControl
{
partial class ModbusStatusControl
{
/// <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.label13 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.txtErrorCode = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.txtAlarmCode = new System.Windows.Forms.TextBox();
this.txtReadActalPosition = new System.Windows.Forms.TextBox();
this.txtReadCommandPosition = new System.Windows.Forms.TextBox();
this.label19 = new System.Windows.Forms.Label();
this.label18 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label13
//
this.label13.AutoSize = true;
this.label13.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label13.Location = new System.Drawing.Point(156, 53);
this.label13.Margin = new System.Windows.Forms.Padding(20, 10, 3, 0);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(71, 17);
this.label13.TabIndex = 48;
this.label13.Text = "[0表示正常]";
//
// label12
//
this.label12.AutoSize = true;
this.label12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label12.Location = new System.Drawing.Point(156, 78);
this.label12.Margin = new System.Windows.Forms.Padding(20, 10, 3, 0);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(71, 17);
this.label12.TabIndex = 47;
this.label12.Text = "[1表示正常]";
//
// txtErrorCode
//
this.txtErrorCode.BackColor = System.Drawing.SystemColors.Control;
this.txtErrorCode.Font = new System.Drawing.Font("黑体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtErrorCode.ForeColor = System.Drawing.Color.Black;
this.txtErrorCode.Location = new System.Drawing.Point(67, 78);
this.txtErrorCode.Name = "txtErrorCode";
this.txtErrorCode.ReadOnly = true;
this.txtErrorCode.Size = new System.Drawing.Size(82, 21);
this.txtErrorCode.TabIndex = 45;
this.txtErrorCode.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label7.Location = new System.Drawing.Point(7, 78);
this.label7.Margin = new System.Windows.Forms.Padding(20, 10, 3, 0);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(65, 12);
this.label7.TabIndex = 46;
this.label7.Text = "错误代码:";
//
// txtAlarmCode
//
this.txtAlarmCode.BackColor = System.Drawing.SystemColors.Control;
this.txtAlarmCode.Font = new System.Drawing.Font("黑体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtAlarmCode.ForeColor = System.Drawing.Color.Black;
this.txtAlarmCode.Location = new System.Drawing.Point(67, 53);
this.txtAlarmCode.Name = "txtAlarmCode";
this.txtAlarmCode.ReadOnly = true;
this.txtAlarmCode.Size = new System.Drawing.Size(82, 21);
this.txtAlarmCode.TabIndex = 37;
this.txtAlarmCode.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// txtReadActalPosition
//
this.txtReadActalPosition.Font = new System.Drawing.Font("黑体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtReadActalPosition.Location = new System.Drawing.Point(67, 28);
this.txtReadActalPosition.Name = "txtReadActalPosition";
this.txtReadActalPosition.ReadOnly = true;
this.txtReadActalPosition.Size = new System.Drawing.Size(83, 21);
this.txtReadActalPosition.TabIndex = 43;
this.txtReadActalPosition.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// txtReadCommandPosition
//
this.txtReadCommandPosition.Font = new System.Drawing.Font("黑体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtReadCommandPosition.Location = new System.Drawing.Point(67, 3);
this.txtReadCommandPosition.Name = "txtReadCommandPosition";
this.txtReadCommandPosition.ReadOnly = true;
this.txtReadCommandPosition.Size = new System.Drawing.Size(83, 21);
this.txtReadCommandPosition.TabIndex = 44;
this.txtReadCommandPosition.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label19
//
this.label19.AutoSize = true;
this.label19.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label19.Location = new System.Drawing.Point(7, 53);
this.label19.Margin = new System.Windows.Forms.Padding(20, 10, 3, 0);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(65, 12);
this.label19.TabIndex = 38;
this.label19.Text = "警报代码:";
//
// label18
//
this.label18.AutoSize = true;
this.label18.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label18.Location = new System.Drawing.Point(7, 29);
this.label18.Margin = new System.Windows.Forms.Padding(20, 10, 3, 0);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(65, 12);
this.label18.TabIndex = 39;
this.label18.Text = "实际位置:";
//
// label15
//
this.label15.AutoSize = true;
this.label15.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label15.Location = new System.Drawing.Point(7, 8);
this.label15.Margin = new System.Windows.Forms.Padding(20, 10, 3, 0);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(65, 12);
this.label15.TabIndex = 40;
this.label15.Text = "指令位置:";
//
// label16
//
this.label16.AutoSize = true;
this.label16.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label16.Location = new System.Drawing.Point(156, 28);
this.label16.Margin = new System.Windows.Forms.Padding(20, 10, 3, 0);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(47, 17);
this.label16.TabIndex = 41;
this.label16.Text = "[pulse]";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label9.Location = new System.Drawing.Point(156, 3);
this.label9.Margin = new System.Windows.Forms.Padding(20, 10, 3, 0);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(47, 17);
this.label9.TabIndex = 42;
this.label9.Text = "[pulse]";
//
// ModbusStatusControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label13);
this.Controls.Add(this.label12);
this.Controls.Add(this.txtErrorCode);
this.Controls.Add(this.label7);
this.Controls.Add(this.txtAlarmCode);
this.Controls.Add(this.txtReadActalPosition);
this.Controls.Add(this.txtReadCommandPosition);
this.Controls.Add(this.label19);
this.Controls.Add(this.label18);
this.Controls.Add(this.label15);
this.Controls.Add(this.label16);
this.Controls.Add(this.label9);
this.Name = "ModbusStatusControl";
this.Size = new System.Drawing.Size(226, 104);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.Label label9;
public System.Windows.Forms.TextBox txtErrorCode;
public System.Windows.Forms.TextBox txtAlarmCode;
public System.Windows.Forms.TextBox txtReadActalPosition;
public System.Windows.Forms.TextBox txtReadCommandPosition;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace UserFromControl
{
public partial class ModbusStatusControl : UserControl
{
public ModbusStatusControl()
{
InitializeComponent();
}
public void clearData()
{
txtAlarmCode.Text = "";
this.txtErrorCode.Text = "";
this.txtReadActalPosition.Text = "";
this.txtReadCommandPosition.Text = "";
}
public void ShowData(string posi,string cmdPosi,string errorCode,string alarmCode)
{
txtReadActalPosition.Text = posi.ToString();
txtReadCommandPosition.Text = cmdPosi.ToString();
txtErrorCode.Text = errorCode.ToString();
txtAlarmCode.Text = alarmCode.ToString();
}
}
}
<?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
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!