Commit 4be59287 LN

修改名称

1 个父辈 62061a75
正在显示 39 个修改的文件 包含 497 行增加1213 行删除
...@@ -69,9 +69,6 @@ ...@@ -69,9 +69,6 @@
<Compile Include="util\TcpServer.cs" /> <Compile Include="util\TcpServer.cs" />
<Compile Include="util\UdpServer.cs" /> <Compile Include="util\UdpServer.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
......
...@@ -11,6 +11,10 @@ namespace OnlineStore.Common ...@@ -11,6 +11,10 @@ namespace OnlineStore.Common
/// </summary> /// </summary>
public class Setting_Init public class Setting_Init
{ {
public static readonly string DefaultDeviceIP= "DefaultDeviceIP";
public static readonly string ColorRuleConfig= "ColorRuleConfig";
public static readonly string DeviceLedType= "DeviceLedType";
public static readonly string StatusLedDmx= "StatusLedDmx";
public static string Server_Log_Open = "Server_Log_Open"; public static string Server_Log_Open = "Server_Log_Open";
/// <summary> /// <summary>
/// 系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要 /// 系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要
......
...@@ -66,14 +66,13 @@ ...@@ -66,14 +66,13 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="acVerticalStore\VerticalStoreBean.cs" /> <Compile Include="acVerticalStore\VerticalStoreBean.cs" />
<Compile Include="acVerticalStore\VerticalStoreBean_Partial.cs" />
<Compile Include="acVerticalStore\VerticalStoreBean_InOut.cs" /> <Compile Include="acVerticalStore\VerticalStoreBean_InOut.cs" />
<Compile Include="acVerticalStore\StoreManager.cs" /> <Compile Include="acVerticalStore\StoreManager.cs" />
<Compile Include="device\halcon\CodeManager.cs" /> <Compile Include="device\halcon\CodeManager.cs" />
<Compile Include="device\IO\AIOBOX\AIOBOXManager.cs" /> <Compile Include="device\IO\AIOBOX\AIOBOXManager.cs" />
<Compile Include="device\IO\IOManager.cs" /> <Compile Include="device\IO\IOManager.cs" />
<Compile Include="device\weights\OKLE.cs" /> <Compile Include="device\led\BaseLedManager.cs" />
<Compile Include="device\weights\OKLEController.cs" /> <Compile Include="device\led\LEDColorArtNet.cs" />
<Compile Include="store\StoreMoveP.cs" /> <Compile Include="store\StoreMoveP.cs" />
<Compile Include="store\StoreAlarm.cs"> <Compile Include="store\StoreAlarm.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
......
位置,库位类型,优先级,高度,宽度,料仓ID,旋转轴位置P2,升降轴库位出料前点P5,升降轴库位出料缓冲点P6,升降轴库位入料前点P3,升降轴库位入料缓冲点P4,进出轴库位点取料点P3,回温区旋转轴库位点P2,冷藏区旋转轴库位点P2 貫零,욋貫잚謹,膽邱섬,죕분욱똑,죕분멕똑,죕꾑ID,좋됐乞多,죕떱旗瘻菉貫零P2
1#AC1_1_1_4,1,1,50,50,1,211783,51884,55245,55245,51884,68000,20000,10000 P_1_1,1,1,210,300,1,1,10000
1#AC1_1_1_5,1,2,50,50,1,211783,67807,71168,71168,67807,68000,20000,10000 P_1_2,1,2,210,300,1,2,10000
1#AC1_1_1_6,1,3,50,50,1,211783,83730,87091,87091,83730,68000,20000,10000 P_1_3,1,3,210,300,1,3,10000
1#AC1_1_1_7,1,4,50,50,1,211783,99653,103014,103014,99653,68000,20000,10000 P_1_4,1,4,210,300,1,4,10000
1#AC1_1_1_8,1,5,50,50,1,211783,115576,118937,118937,115576,68000,20000,10000 P_1_5,1,5,210,300,1,5,10000
1#AC1_1_1_9,1,6,50,50,1,211783,131499,134860,134860,131499,68000,20000,10000 P_1_6,1,6,210,300,1,6,10000
1#AC1_1_1_10,1,7,50,50,1,211783,147422,150783,150783,147422,68000,20000,10000 P_1_7,1,7,210,300,1,7,10000
1#AC1_1_2_3,1,8,50,50,1,211783,385700,389433,389433,385700,68000,20000,10000 P_1_8,1,8,210,300,1,8,10000
1#AC1_1_2_4,2,9,50,50,1,211783,403000,405356,405356,403000,68000,20000,10000 P_1_9,1,9,210,300,1,9,10000
1#AC1_1_2_5,2,10,50,50,1,211783,418345,421279,421279,418345,68000,20000,10000 P_1_10,1,10,210,300,1,10,10000
1#AC1_1_2_6,2,11,50,50,1,211783,434000,437202,437202,434000,68000,20000,10000 P_2_1,1,11,210,300,1,11,50000
1#AC1_1_2_7,2,12,50,50,1,211783,450000,453125,453125,450000,68000,20000,10000 P_2_2,1,12,210,300,1,12,50000
1#AC1_1_2_8,2,13,50,50,1,211783,465900,469048,469048,465900,68000,20000,10000 P_2_3,1,13,210,300,1,13,50000
1#AC1_1_2_9,2,14,50,50,1,211783,481800,484971,484971,481800,68000,20000,10000 P_2_4,1,14,210,300,1,14,50000
1#AC1_1_3_1,2,15,50,50,1,211400,706257,709866,709866,706257,68000,20000,10000 P_2_5,1,15,210,300,1,15,50000
1#AC1_1_3_2,2,16,50,50,1,211400,722180,725789,725789,722180,68000,20000,10000 P_2_6,1,16,210,300,1,16,50000
1#AC1_1_3_3,2,17,50,50,1,211400,738103,741712,741712,738103,68000,20000,10000 P_2_7,1,17,210,300,1,17,50000
1#AC1_1_3_4,2,18,50,50,1,211400,753026,757635,757635,753026,68000,20000,10000 P_2_8,1,18,210,300,1,18,50000
1#AC1_1_3_5,2,19,50,50,1,211400,767949,773558,773558,767949,68000,20000,10000 P_2_9,1,19,210,300,1,19,50000
1#AC1_1_3_6,2,20,50,50,1,211400,783872,789481,789481,783872,68000,20000,10000 P_2_10,1,20,210,300,1,20,50000
1#AC1_1_3_7,2,21,50,50,1,211400,799795,805404,805404,799795,68000,20000,10000 P_3_1,2,21,400,300,1,21;22,90000
1#AC1_1_3_8,2,22,50,50,1,211800,814218,819327,819327,814218,68000,20000,10000 P_3_2,2,22,400,300,1,23;24,90000
1#AC1_1_3_9,2,23,50,50,1,211800,832141,835250,835250,832141,68000,20000,10000 P_3_3,2,23,400,300,1,25;26,90000
1#AC1_1_3_10,2,24,50,50,1,211800,848064,851173,851173,848064,68000,20000,10000 P_3_4,2,24,400,300,1,21;23,90000
1#AC1_1_3_11,2,25,50,50,1,212000,861987,867096,867096,861987,68000,20000,10000 P_3_5,2,25,400,300,1,23;25,90000
1#AC1_1_3_12,2,26,50,50,1,212000,877910,883019,883019,877910,68000,20000,10000 P_4_1,2,26,400,300,1,25;27,130000
1#AC1_2_1_1,2,27,50,50,1,169650,5600,9900,9900,5600,68000,20000,10000 P_4_2,2,27,400,300,1,21;24,130000
1#AC1_2_1_2,2,28,50,50,1,169650,21365,25665,25665,21365,68000,20000,10000 P_4_3,2,28,400,300,1,23;26,130000
1#AC1_2_1_3,2,29,50,50,1,169650,37130,41430,41430,37130,68000,20000,10000 P_4_4,2,29,400,300,1,25;28,130000
1#AC1_2_1_4,2,30,50,50,1,169650,52895,57195,57195,52895,68000,20000,10000 P_4_5,2,30,400,300,1,21;25,130000
1#AC1_2_1_5,2,31,50,50,1,169650,68660,72960,72960,68660,68000,20000,10000
1#AC1_2_1_6,2,32,50,50,1,169650,84425,88725,88725,84425,68000,20000,10000
1#AC1_2_1_7,2,33,50,50,1,169650,100190,104490,104490,100190,68000,20000,10000
1#AC1_2_1_8,2,34,50,50,1,169650,115955,120255,120255,115955,68000,20000,10000
1#AC1_2_1_9,2,35,50,50,1,169650,131720,136020,136020,131720,68000,20000,10000
1#AC1_2_1_10,2,36,50,50,1,169650,147485,151785,151785,147485,68000,20000,10000
1#AC1_2_1_11,2,37,50,50,1,169650,163250,167550,167550,163250,68000,20000,10000
1#AC1_2_2_1,2,38,50,50,1,169650,354811,358235,358235,354811,68000,20000,10000
1#AC1_2_2_2,2,39,50,100,1,169650,370576,374000,374000,370576,68000,20000,10000
1#AC1_2_2_3,2,40,50,100,1,169650,386341,389765,389765,386341,68000,20000,10000
1#AC1_2_2_4,2,41,50,100,1,169650,402106,405530,405530,402106,68000,20000,10000
1#AC1_2_2_5,2,42,50,100,1,169650,417871,421295,421295,417871,68000,20000,10000
1#AC1_2_2_6,2,43,50,100,1,169650,433636,437060,437060,433636,68000,20000,10000
1#AC1_2_2_7,2,44,50,100,1,169650,449401,452825,452825,449401,68000,20000,10000
1#AC1_2_2_8,100,45,50,50,1,169650,465166,468590,468590,465166,68000,20000,10000
1#AC1_2_2_9,200,46,50,50,1,169650,480931,484355,484355,480931,68000,20000,10000
1#AC1_2_2_10,300,47,50,50,1,169650,496696,500120,500120,496696,68000,20000,10000
1#AC1_2_2_11,400,48,50,50,1,169650,512461,515885,515885,512461,68000,20000,10000
1#AC1_2_2_12,500,49,50,50,1,169650,528226,531650,531650,528226,68000,20000,10000
...@@ -72,7 +72,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -72,7 +72,7 @@ namespace OnlineStore.DeviceLibrary
if (File.Exists(positionConfigFile)) if (File.Exists(positionConfigFile))
{ {
LogUtil.info( "加载位置文件:" + positionConfigFile); LogUtil.info( "加载位置文件:" + positionConfigFile);
CSVPositionReader<VerticalStorePosition>.ReloadCSVFile(positionConfigFile); CSVPositionReader<VerticalPosition>.ReloadCSVFile(positionConfigFile);
} }
Config = (VerticalStoreConfig)storeConfig; Config = (VerticalStoreConfig)storeConfig;
Store = new VerticalStoreBean(Config); Store = new VerticalStoreBean(Config);
......
...@@ -15,8 +15,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -15,8 +15,6 @@ namespace OnlineStore.DeviceLibrary
{ {
public class AIOBOXManager : IOManager public class AIOBOXManager : IOManager
{ {
//public static uint DefaultDICount = 16;
//public static uint DefaultDOCount = 16;
public readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public Dictionary<string, AIOBOX> AIOMap = new Dictionary<string, AIOBOX>(); public Dictionary<string, AIOBOX> AIOMap = new Dictionary<string, AIOBOX>();
......

using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class LEDManager
{
public static Dictionary<string, LEDBaseModule> deviceMap = new Dictionary<string, LEDBaseModule>();
public static byte DefaultLight = 100;
public static int DeviceLedType = ConfigAppSettings.GetIntValue(Setting_Init.DeviceLedType);
public static string ColorRule = ConfigAppSettings.GetValue(Setting_Init.ColorRuleConfig).ToUpper();
public static string DefaultIP = ConfigAppSettings.GetValue(Setting_Init.DefaultDeviceIP);
public static LEDBaseModule GetLedModule(string ip)
{
LEDBaseModule led = null;
if (deviceMap.ContainsKey(ip))
{
led = deviceMap[ip];
}
else
{
led = LEDBaseModule.GetModule(ip);
deviceMap.Add(ip, led);
}
return led;
}
public static void Init()
{
ColorRule = ConfigAppSettings.GetValue(Setting_Init.ColorRuleConfig).ToUpper();
if (ColorRule.Length == 3 && ColorRule.Contains("R") && ColorRule.Contains("G") && ColorRule.Contains("B"))
{
}
else
{
LEDManager.ColorRule = "RGB";
ConfigAppSettings.SaveValue(Setting_Init.ColorRuleConfig, LEDManager.ColorRule);
}
LoadStatusDMX();
}
public static void LoadStatusDMX()
{
StatusLedDmx = new List<int>();
string str = ConfigAppSettings.GetValue(Setting_Init.StatusLedDmx);
if (String.IsNullOrEmpty(str))
{
str = "0";
ConfigAppSettings.SaveValue(Setting_Init.StatusLedDmx, str);
}
string[] array = str.Split(';');
foreach (string s in array)
{
try
{
int a = Convert.ToInt32(s);
StatusLedDmx.Add(a);
}
catch (Exception ex)
{
}
}
}
/// <summary>
/// 1=绿灯,2=黄灯
/// </summary>
public static int CurrLedStatus = -1;
private static List<int> StatusLedDmx = new List<int>();
/// <summary>
/// 打开状态灯
/// </summary>
public static void OpenStatusLights(string color = "green")
{
CloseStatusLights("");
foreach (LEDBaseModule module in deviceMap.Values)
{
List<Light> sLed = new List<Light>();
foreach (int dmx in StatusLedDmx)
{
for (int index = 0; index < module.Max_Light; index++)
{
if ("green".Equals(color))
{
CurrLedStatus = 1;
sLed.Add(Light.GreenLight(dmx, index));
}
else if ("yellow".Equals(color))
{
CurrLedStatus = 2;
sLed.Add(Light.BlueLight(dmx, index));
}
}
}
module.LightOn(sLed.ToArray());
}
}
/// <summary>
/// 关闭状态灯
/// </summary>
/// <param name="color"></param>
public static void CloseStatusLights(string color = "")
{
CurrLedStatus = 0;
foreach (LEDBaseModule module in deviceMap.Values)
{
foreach (int dmx in StatusLedDmx)
{
module.AllLightOff(dmx);
}
}
}
}
public abstract class LEDBaseModule
{
protected ushort Max_DMX = 16;
public int Max_Light = 170;
public string ModuleIP = "";
public static LEDBaseModule GetModule(string ip)
{
//if (LEDManager.DeviceLedType.Equals(1))
//{
// LEDColorModule module = new LEDColorModule(ip);
// return module;
//}
//else if (LEDManager.DeviceLedType.Equals(2))
//{
LEDColorArtNet module = new LEDColorArtNet(ip);
return module;
//}
//else
//{
// LEDSingleModule module = new LEDSingleModule(ip);
// return module;
//}
}
internal LEDBaseModule(string ip)
{
ModuleIP = ip;
}
public abstract void AllLightOff(int dmx = -1);
public abstract void AllLightOn(int dmx = -1);
public abstract void AllLightOn(Light light);
public abstract void OnlyLightOn(params Light[] lights);
public abstract void LightOn(params Light[] lights);
public abstract void LightOff(int dmx, params int[] lightIndexs);
public abstract void LightOff(params Light[] lights);
/// <summary>
/// 打包方法,可以将十六制字符串转成byte[] ,字符串没有空格
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
protected byte[] StringToByte(string s)
{
string temps = s.Replace(" ", "").Replace(":", "");
if (temps.Length % 2 != 0)
{
temps = "0" + temps;
}
byte[] tempb = new byte[temps.Length / 2];
int j = 0;
for (int i = 0; i < temps.Length; i = i + 2, j++)
{
tempb[j] = Convert.ToByte(temps.Substring(i, 2), 16);
}
byte[] send = new byte[j];
Array.Copy(tempb, send, j);
return send;
}
}
public class Light
{
public static string defaultColor = "green";
public static byte defaultR = 0;
public static byte defaultG = 50;
public static byte defaultB = 0;
public static Light DefaultLight(int dmxId, int index)
{
return new Light(dmxId, index, defaultR, defaultG, defaultB, 200);
}
public static Light GetLight(int dmxId, int index, string color = "green")
{
return GetLight(dmxId, index, color, 50);
}
public static Light[] GetLights(int dmxId, string color, params int[] indexes)
{
List<Light> lights = new List<Light>();
foreach (int index in indexes)
{
lights.Add(GetLight(dmxId, index, color));
}
return lights.ToArray();
}
public static Light GetLight(int dmxId, int index, string color, byte bright)
{
color = color.ToLower();
switch (color)
{
case "green":
return GreenLight(dmxId, index, bright);
case "red":
return RedLight(dmxId, index, bright);
case "yellow":
return YellowLight(dmxId, index, bright);
case "blue":
return BlueLight(dmxId, index, bright);
}
return DefaultLight(dmxId, index);
}
public static Light RedLight(int dmxId, int index, byte bright = 50)
{
return new Light(dmxId, index, bright, 0, 0);
}
public static Light YellowLight(int dmxId, int index, byte bright = 50)
{
return new Light(dmxId, index, bright, bright, 0);
}
public static Light BlueLight(int dmxId, int index, byte bright = 50)
{
return new Light(dmxId, index, 0, 0, bright);
}
public static Light GreenLight(int dmxId, int index, byte bright = 50)
{
return new Light(dmxId, index, 0, bright, 0);
}
public static Light CyanLight(int dmxId, int index)
{
return new Light(dmxId, index, 0, 255, 255);
}
public static Light ChocolateLight(int dmxId, int index)
{
return new Light(dmxId, index, 210, 105, 30);
}
public Light(int dmxId, int index, byte Red, byte Green, byte Blue, byte lightValue = 200)
{
this.dmx = dmxId;
this.index = index;
this.Red = Red;
this.Green = Green;
this.Blue = Blue;
this.lightValue = lightValue;
}
public int index { get; set; }
public byte Red { get; set; }
public byte Green { get; set; }
public byte Blue { get; set; }
/// <summary>
/// 单色灯
/// </summary>
public static Light[] GetLights(int dmx, List<int> leds, byte light = 200)
{
Light[] lights = new Light[leds.Count];
int i = 0;
foreach (int led in leds)
{
lights[i] = new Light(dmx, led, light);
i++;
}
return lights;
}
/// <summary>
/// 单色灯
/// </summary>
/// <param name="dmx">区域ID</param>
/// <param name="index">索引号</param>
/// <param name="lightValue">亮度</param>
public Light(int dmx, int index, byte lightValue)
{
this.index = index;
this.dmx = dmx;
this.lightValue = lightValue;
}
public int dmx = -1;
public byte lightValue = LEDManager.DefaultLight;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class OKLE
{
private byte[] buffer;
private bool receive;
private System.IO.Ports.SerialPort port;
public OKLE()
{
port = new System.IO.Ports.SerialPort
{
BaudRate = 9600, //设备支持4800,9600,19200,38400,57600,115200
DataBits = 8,
StopBits = System.IO.Ports.StopBits.One,
Parity = System.IO.Ports.Parity.None
};
port.DataReceived += Port_DataReceived;
}
/// <summary>
/// 打开或关闭状态
/// </summary>
public bool IsOpen { get { return port.IsOpen; } }
/// <summary>
/// 打开串口
/// </summary>
/// <param name="comName">串口名</param>
public void Open(string comName)
{
port.PortName = comName;
try
{
port.Open();
}
catch (Exception ex)
{
}
}
/// <summary>
/// 关闭串口
/// </summary>
public void Close()
{
port.Close();
}
/// <summary>
/// 读取数据
/// </summary>
/// <param name="addr">起始地址</param>
/// <returns></returns>
public int Read(short addr)
{
if (!IsOpen) return 0;
byte[] cmd = ReadCmd(addr, 1);
receive = false;
port.Write(cmd, 0, cmd.Length);
bool rtn = WaitReceive();
if (rtn) rtn = SameReturn(cmd);
if (rtn)
{
int num = buffer[3] * 256 + buffer[4];
return num;
}
else
{
return 0;
}
}
/// <summary>
/// 读取数据
/// </summary>
/// <param name="addr">起始地址</param>
/// <param name="count">寄存器数量</param>
/// <returns></returns>
public int[] Read(short addr, short count)
{
if (!IsOpen) return null;
byte[] cmd = ReadCmd(addr, count);
receive = false;
port.Write(cmd, 0, cmd.Length);
bool rtn = WaitReceive();
if (rtn) rtn = SameReturn(cmd);
if (rtn)
{
int len = buffer[2]; //字节数
int[] num = new int[len / 2];
for (int i = 0; i < num.Length; i++)
{
int idx = 3 + i * 2;
num[i] = buffer[idx] * 256 + buffer[idx + 1];
}
return num;
}
else
{
return null;
}
}
/// <summary>
/// 等待数据接收
/// </summary>
/// <returns></returns>
private bool WaitReceive()
{
int sum = 0;
while (true)
{
System.Threading.Thread.Sleep(50);
sum += 50;
if (receive) return true;
if (!IsOpen) return false;
if (sum >= 3000) return false;
}
}
/// <summary>
/// 串口数据接收
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Port_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
System.Threading.Thread.Sleep(50);
byte[] buff = new byte[port.ReadBufferSize];
int len = port.Read(buff, 0, buff.Length);
Array.Copy(buff, buffer, len);
receive = true;
}
/// <summary>
/// CRC16冗余校验
/// </summary>
/// <param name="buff"></param>
/// <param name="count"></param>
/// <param name="high"></param>
/// <param name="low"></param>
private void CRC16(byte[] buff, int count, out byte high, out byte low)
{
int crc = 0xFFFF;
int bit;
for (int i = 0; i < count; i++)
{
crc ^= buff[i];
for (int j = 0; j < 8; j++)
{
bit = crc & 1;
crc >>= 1;
if (bit == 0)
{
//crc >>= 1;
}
else
crc ^= 0xA001;
}
}
low = Convert.ToByte(crc & 255);
high = Convert.ToByte((crc >> 8) & 255);
}
/// <summary>
/// 读取命令,功能码03
/// </summary>
/// <param name="addr"></param>
/// <param name="count"></param>
/// <returns></returns>
private byte[] ReadCmd(short addr, short count)
{
byte[] addrArr = BitConverter.GetBytes(addr);
byte[] countArr = BitConverter.GetBytes(count);
byte[] cmd = new byte[8];
cmd[0] = 0x01; //模块地址
cmd[1] = 0x03; //功能码
cmd[2] = addrArr[1]; //高8位
cmd[3] = addrArr[0]; //低8位
cmd[4] = countArr[1]; //高8位
cmd[5] = countArr[0]; //低8位
//CRC16校验
CRC16(cmd, 6, out byte high, out byte low);
cmd[6] = low;
cmd[7] = high;
return cmd;
}
/// <summary>
/// 判断是同一条命令的返回值
/// </summary>
/// <param name="cmd"></param>
/// <returns></returns>
private bool SameReturn(byte[] cmd)
{
//同一个功能码应答
if (cmd[0] == buffer[0] && cmd[1] == buffer[1])
{
//CRC校验是否相同
int len = cmd.Length - 2;
CRC16(cmd, len, out byte high, out byte low);
return cmd[len] == low && cmd[len + 1] == high;
}
else
{
return false;
}
}
}
}
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class OKLEController
{
private static int bautRate = 9600;//波特率
private static Parity parity = Parity.None;//校验位
private static int dataBits = 8;//数据位
private static StopBits stopBits = StopBits.One; //停止位
private static Dictionary<string, AcSerialBean> SerialMap = new Dictionary<string, AcSerialBean>();
private static string LogName = "";
private static AcSerialBean GetSerialBean(string port)
{
if (SerialMap.ContainsKey(port))
{
return SerialMap[port];
}
return null;
}
public static void OpenAll(string[] ports)
{
foreach (string port in ports)
{
Init(port);
}
}
public static bool Init(string port)
{
if (SerialMap.ContainsKey(port))
{
return true;
}
LogName = "[OKLE_" + port + "]";
AcSerialBean sb = new AcSerialBean(port, bautRate, parity, dataBits, stopBits);
try
{
if (sb.openPort())
{
if (SerialMap.ContainsKey(port))
{
SerialMap.Remove(port);
}
SerialMap.Add(port, sb);
return true;
}
else
{
LogUtil.error(LogName + "串口打开失败!");
return false;
}
}
catch (Exception ex)
{
LogUtil.error(LogName + "打开出错:" + ex.ToString());
}
return true;
}
public static bool IsRun(string port)
{
if (GetSerialBean(port) != null)
{
return true;
}
return false;
}
/// <summary>
/// 释放资源
/// </summary>
public static void Release(params string[] ports)
{
if (ports.Length <= 0)
{
ports = (new List<string>(SerialMap.Keys)).ToArray();
}
foreach (string port in ports)
{
try
{
AcSerialBean sb = GetSerialBean(port);
if (sb != null)
{
sb.closePort();
}
//IsRun = false;
SerialMap.Remove(port);
}
catch (Exception ex)
{
LogUtil.error("Release OKLE port [" + port + "] error :" + ex.ToString());
}
}
}
public static bool Reset(string port)
{
AcSerialBean sb = GetSerialBean(port);
if (sb == null)
{
return false;
}
LogName = "[OKLE_" + port + "]";
//12.1.4执行手动置零
//指令格式:01 10 00 5E 00 01 02 00 01 6A EE
byte[] sendData = new byte[11];
sendData[0] = 0x01;
sendData[1] = 0x10;
sendData[2] = 0x00;
sendData[3] = 0x5E;
sendData[4] = 0x00;
sendData[5] = 0x01;
sendData[6] = 0x02;
sendData[7] = 0x00;
sendData[8] = 0x01;
sendData[9] = 0x00;
sendData[10] = 0x00;
sendData = buildCheckData(sendData, sendData.Length - 2);
string str = AcSerialBean.byteToHexStr(sendData);
LogUtil.debug(LogName + "发送数据:" + str);
byte[] reviceData = new byte[9];
bool isOk = false;
sb.SendCommand(sendData, ref reviceData, 100, out isOk);
return isOk;
}
public static double queryData(string port)
{
double weight = 0d;
AcSerialBean sb = GetSerialBean(port);
if (sb == null)
{
return weight;
}
LogName = "[OKLE_" + port + "]";
//12..1.2读取力值(毛重)指令,指令格式:01 03 00 50 00 02 C4 1A
byte[] sendData = new byte[8];
sendData[0] = 0x01;
sendData[1] = 0x03;
sendData[2] = 0x00;
sendData[3] = 0x50;
sendData[4] = 0x00;
sendData[5] = 0x02;
sendData[6] = 0x00;
sendData[7] = 0x00;
sendData = buildCheckData(sendData, sendData.Length - 2);
string str = AcSerialBean.byteToHexStr(sendData);
LogUtil.debug(LogName + "发送数据:" + str);
byte[] reviceData = new byte[9];
bool isOk = false;
sb.SendCommand(sendData, ref reviceData, 100, out isOk);
return getReviceData(reviceData);
}
private static double getReviceData(byte[] dataArray)
{
double value = 0d;
try
{
if (dataArray.Length >= 9)
{
//返回格式:01 03 04 FF FF C1 F0 AB C3(数据根据实际情况变化)
//地址 功能码 字节数 第一组寄存器数据 第二组寄存器数据 CRC16校验
//01 03 04 FF FF C1 F0 AB C3
string highV = String.Format("{0:X2}", dataArray[3]) + String.Format("{0:X2}", dataArray[4]);
string lowV = String.Format("{0:X2}", dataArray[5]) + String.Format("{0:X2}", dataArray[6]);
value = (double)Convert.ToInt32(highV + lowV, 16) / 10000;
}
}
catch (Exception ex)
{
LogUtil.info(LogName + "转换出错:" + ex.ToString());
}
return value;
}
private static byte[] buildCheckData(byte[] sendData, int length)
{
ushort pChecksum = 0;
AcSerialBean.CalculateCRC(sendData, length, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = AcSerialBean.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;
}
}
}
...@@ -9,8 +9,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -9,8 +9,7 @@ namespace OnlineStore.DeviceLibrary
public class InOutParam public class InOutParam
{ {
public MoveType paramType = MoveType.None; public MoveType paramType = MoveType.None;
public InOutParam(MoveType type, string posId, string code = "", int plateH = 0, int plateW = 0,int weight=0, public InOutParam(MoveType type, string posId, string code = "", int plateH = 0, int plateW = 0)
string targetPosId="",string targetCode="",int targetWeight=0,int stirSeconds=0)
{ {
position = null; position = null;
PosCode = code; PosCode = code;
...@@ -19,10 +18,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -19,10 +18,6 @@ namespace OnlineStore.DeviceLibrary
this.PlateW = plateW; this.PlateW = plateW;
this.PlateH = plateH; this.PlateH = plateH;
this.paramType = type; this.paramType = type;
this.TarPosId = targetPosId;
this.TarPosCode = targetCode;
this.TarWeight = targetWeight;
this.StirSecsond = stirSeconds;
} }
public InOutParam(MoveType paramType, string posId, StoreMoveP linePosition, string wareNo = "") public InOutParam(MoveType paramType, string posId, StoreMoveP linePosition, string wareNo = "")
...@@ -33,58 +28,29 @@ namespace OnlineStore.DeviceLibrary ...@@ -33,58 +28,29 @@ namespace OnlineStore.DeviceLibrary
MoveP = linePosition; MoveP = linePosition;
this.paramType = paramType; this.paramType = paramType;
} }
public static InOutParam NewMovePosParam(string posId,string code,int weight, string targetPosId,string tcode,int tweight)
{
InOutParam p = new InOutParam(MoveType.MovePos, posId,code,0,0,weight,targetPosId, tcode, tweight);
return p;
}
public static InOutParam NewStirParam(string posId1, string code1, int weight1, string targetPosId2, string tcode2, int tweight2,int stirSeconds)
{
InOutParam p = new InOutParam(MoveType.MovePos, posId1,code1,0,0,weight1,targetPosId2,tcode2,tweight2, stirSeconds);
return p;
}
public string ToStr() public string ToStr()
{ {
string doorT = "中间夹具"; if (paramType.Equals(MoveType.InStore))
if (DoorPosType.Equals(1))
{
doorT = "左侧锡膏";
}
else if (DoorPosType.Equals(1))
{ {
doorT = "右侧锡膏"; return "【入库:" + PosId + " ,[" + PosCode + "][" + PlateW + "X" + PlateH + "]】";
}
if (paramType.Equals(MoveType.MovePos))
{
return "【回温移库:" + PosId + " -> " + TarPosId + ",[" + PosCode + "][" + PlateW + "X" + PlateH + "]】";
}
else if (paramType.Equals(MoveType.Stirring))
{
return "【搅拌:" + PosId + "([" + Weight + "][" + PosCode + "]) -> " + TarPosId + "([" + TarWeight + "][" + TarPosCode + "]) 】";
}
else if (paramType.Equals(MoveType.InStore))
{
return "【入库:" + doorT + " -> " + PosId + ",[" + PosCode + "][" + PlateW + "X" + PlateH + "]】";
} }
else if (paramType.Equals(MoveType.OutStore)) else if (paramType.Equals(MoveType.OutStore))
{ {
return "【出库:" + PosId + " -> " + doorT + ",[" + PosCode + "][" + PlateW + "X" + PlateH + "]】"; return "【出库:" + PosId + ",[" + PosCode + "][" + PlateW + "X" + PlateH + "]】";
} }
return "[" + PosId + "][" + PosCode + "][" + PlateW + "X" + PlateH + "]"; return "[" + PosId + "][" + PosCode + "][" + PlateW + "X" + PlateH + "]";
} }
private VerticalStorePosition position = null; private VerticalPosition position = null;
public VerticalStorePosition Position public VerticalPosition Position
{ {
get get
{ {
if (position == null) if (position == null)
{ {
position = CSVPositionReader<VerticalStorePosition>.GetPositon(PosId); position = CSVPositionReader<VerticalPosition>.GetPositon(PosId);
} }
return position; return position;
} }
...@@ -98,10 +64,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -98,10 +64,7 @@ namespace OnlineStore.DeviceLibrary
/// 位置坐标名(对应配置表的位置) /// 位置坐标名(对应配置表的位置)
/// </summary> /// </summary>
public string PosId = ""; public string PosId = "";
/// <summary>
/// 门类型,0=中间夹具,1=左侧锡膏,2=右侧锡膏
/// </summary>
public int DoorPosType = 0;
public StoreMoveP MoveP { get; set; } public StoreMoveP MoveP { get; set; }
/// <summary> /// <summary>
...@@ -113,47 +76,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -113,47 +76,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public int PlateW = 0; public int PlateW = 0;
/// <summary>
/// 重量 单位 g
/// </summary>
public int Weight = 0;
/// <summary>
/// 搅拌时间,秒
/// </summary>
public int StirSecsond = 600;
/// <summary>
/// 目标库位号,回温移库时表示回温区库位
/// </summary>
public string TarPosId = "";
public string TarPosCode = "";
public int TarWeight = 0;
private VerticalStorePosition tarPosition = null;
public VerticalStorePosition TarPosition
{
get
{
if (tarPosition == null)
{
tarPosition = CSVPositionReader<VerticalStorePosition>.GetPositon(TarPosId);
}
return tarPosition;
}
}
public string GetDoorTinCheck()
{
if (DoorPosType.Equals(1))
{
return IO_Type.TinCheck_DoorLeft;
}
else
{
return IO_Type.TinCheck_DoorRight;
}
}
internal bool LoadParam(VerticalStoreConfig Config) internal bool LoadParam(VerticalStoreConfig Config)
{ {
...@@ -162,50 +85,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -162,50 +85,14 @@ namespace OnlineStore.DeviceLibrary
if (MoveP == null) if (MoveP == null)
{ {
StoreMoveP p = new StoreMoveP(); StoreMoveP p = new StoreMoveP();
VerticalStorePosition position = Position; VerticalPosition position = Position;
if (position == null) if (position == null)
{ {
LogUtil.error("出入库时发现param中取到的Position=null,没有库位不能执行出入库"); LogUtil.error("出入库时发现param中取到的Position=null,没有库位不能执行出入库");
return false; return false;
} }
p.InOut_P1 = Config.InOutAxis_P1;
p.Middle_P1 = Config.MiddleAxis_P1;
p.InOut_P2 = Config.InOutAxis_P20;
p.UpDown_P1 = Config.UpDownAxis_OL_P1;
p.UpDown_P8 = Config.UpDownAxis_IL_P8;
p.UpDown_P2 = Config.UpDownAxis_IH_P2;
p.UpDown_P7 = Config.UpDownAxis_OH_P7;
if (this.DoorPosType.Equals(1) || this.DoorPosType.Equals(2))
{
p.UpDown_P1 = Config.UpDownAxis_OL_P11;
p.UpDown_P8 = Config.UpDownAxis_IL_P81;
p.UpDown_P2 = Config.UpDownAxis_IH_P21;
p.UpDown_P7 = Config.UpDownAxis_OH_P71;
}
if (this.DoorPosType.Equals(1))
{
p.Middle_P1 = Config.MiddleAxis_P11;
p.InOut_P2 = Config.InOutAxis_P21;
}
else if (this.DoorPosType.Equals(2))
{
p.Middle_P1 = Config.MiddleAxis_P12;
p.InOut_P2 = Config.InOutAxis_P22;
}
p.Warm_P2 = position.WarmAxis_P2;
p.Cold_P2 = position.ColdAxis_P2;
p.InOut_P3 = position.InOutAxis_P3;
p.Middle_P2 = position.MiddleAxis_P2; p.Middle_P2 = position.MiddleAxis_P2;
p.UpDown_P3 = position.UpDownAxis_IH_P3;
p.UpDown_P4 = position.UpDownAxis_IL_P4;
p.UpDown_P5 = position.UpDownAxis_OH_P5;
p.UpDown_P6 = position.UpDownAxis_OL_P6;
this.MoveP = p; this.MoveP = p;
return true; return true;
} }
...@@ -216,31 +103,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -216,31 +103,14 @@ namespace OnlineStore.DeviceLibrary
{ {
get get
{ {
string doorT = "中间夹具";
if (DoorPosType.Equals(1))
{
doorT = "左侧锡膏";
}
else if (DoorPosType.Equals(1))
{
doorT = "右侧锡膏";
}
if (paramType.Equals(MoveType.MovePos)) if (paramType.Equals(MoveType.InStore))
{
return "【回温移库:" + PosId + " -> " + TarPosId + "】";
}
else if (paramType.Equals(MoveType.Stirring))
{
return "【搅拌:" + PosId + " -> " + TarPosId + "】";
}
else if (paramType.Equals(MoveType.InStore))
{ {
return "【入库:" + doorT + " -> " + PosId + "】"; return "【入库:" + PosId + "】";
} }
else if (paramType.Equals(MoveType.OutStore)) else if (paramType.Equals(MoveType.OutStore))
{ {
return "【出库:" + PosId + " -> " + doorT + "】"; return "【出库:" + PosId + "】";
} }
else else
{ {
......
...@@ -128,15 +128,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -128,15 +128,7 @@ namespace OnlineStore.DeviceLibrary
isInPro = false; isInPro = false;
break; break;
case MoveType.MovePos:
MovementProcess();
isInPro = false;
break;
case MoveType.Stirring:
StirringProcess();
isInPro = false;
break;
default: break; default: break;
} }
} }
...@@ -215,8 +207,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -215,8 +207,6 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
protected abstract void ResetProcess(); protected abstract void ResetProcess();
protected abstract void StirringProcess();
protected abstract void MovementProcess();
/// <summary> /// <summary>
/// 松下伺服轴原点返回运动,等待收到反馈后才会返回 /// 松下伺服轴原点返回运动,等待收到反馈后才会返回
/// </summary> /// </summary>
......
...@@ -9,120 +9,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -9,120 +9,9 @@ namespace OnlineStore.DeviceLibrary
public class StoreMoveP public class StoreMoveP
{ {
/// <summary> /// <summary>
/// 轴3进出轴 待机原位点P1
/// </summary>
public int InOut_P1 = 0;
#region 仓门口位置
/// <summary>
/// 轴2( 升降轴) 进料口取料点 P1
/// </summary>
public int UpDown_P1 = 0;
/// <summary>
/// 轴2( 升降轴) 进料口出料前点P2
/// </summary>
public int UpDown_P2 = 0;
/// <summary>
/// 轴2( 升降轴) 进料口取料缓冲点P7
/// </summary>
public int UpDown_P7 = 0;
/// <summary>
/// 轴2( 升降轴) 进料口出料缓冲点P8
/// </summary>
public int UpDown_P8 = 0;
/// <summary>
/// 轴1旋转轴 待机原位点 P1
/// </summary>
public int Middle_P1 = 0;
/// <summary>
/// 轴3进出轴 进料口取料点P2
/// </summary>
public int InOut_P2 = 0;
#endregion
#region 库位点
/// <summary>
/// 轴2( 升降轴) 库位入料前点P3
/// </summary>
public int UpDown_P3 = 0;
/// <summary>
/// 轴2( 升降轴) 库位入料缓冲点P4
/// </summary>
public int UpDown_P4 = 0;
/// <summary>
/// 轴2( 升降轴) 库位出料前点P5
/// </summary>
public int UpDown_P5 = 0;
/// <summary>
/// 轴2( 升降轴) 库位出料缓冲点P6
/// </summary>
public int UpDown_P6 = 0;
/// <summary>
/// 轴1旋转轴 库位点 P2 /// 轴1旋转轴 库位点 P2
/// </summary> /// </summary>
public int Middle_P2 = 0; public int Middle_P2 = 0;
/// <summary>
/// 轴3进出轴 库位点取料点P3
/// </summary>
public int InOut_P3 = 0;
#endregion
#region 目标库位点
/// <summary>
/// 轴2( 升降轴) 库位入料前点P3
/// </summary>
public int T_UpDown_P3 = 0;
/// <summary>
/// 轴2( 升降轴) 库位入料缓冲点P4
/// </summary>
public int T_UpDown_P4 = 0;
/// <summary>
/// 轴2( 升降轴) 库位出料前点P5
/// </summary>
public int T_UpDown_P5 = 0;
/// <summary>
/// 轴2( 升降轴) 库位出料缓冲点P6
/// </summary>
public int T_UpDown_P6 = 0;
/// <summary>
/// 轴1旋转轴 库位点 P2
/// </summary>
public int T_Middle_P2 = 0;
/// <summary>
/// 轴3进出轴 库位点取料点P3
/// </summary>
public int T_InOut_P3 = 0;
#endregion
/// <summary>
/// (轴四)回温区旋转轴库位点P2
/// </summary>
public int Warm_P2 = 0;
/// <summary>
///(轴五)冷藏区旋转轴库位点P2
/// </summary>
public int Cold_P2 = 0;
/// <summary>
///(轴六)搅拌旋转轴 搅拌点
/// </summary>
public int StirAxis_P = 0;
} }
} }
...@@ -340,13 +340,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -340,13 +340,6 @@ namespace OnlineStore.DeviceLibrary
/// 出库 /// 出库
/// </summary> /// </summary>
OutStore = 6, OutStore = 6,
/// <summary>
/// 回温移库
/// </summary>
MovePos = 7,
/// <summary>
/// 搅拌
/// </summary>
Stirring = 8,
} }
} }
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="CSVExection.cs" /> <Compile Include="CSVExection.cs" />
<Compile Include="position\VerticalStorePosition.cs" /> <Compile Include="position\VerticalPosition.cs" />
<Compile Include="storeConfig\ConfigItemBase.cs" /> <Compile Include="storeConfig\ConfigItemBase.cs" />
<Compile Include="storeConfig\ConfigProAttribute.cs" /> <Compile Include="storeConfig\ConfigProAttribute.cs" />
<Compile Include="storeConfig\config\VerticalStoreConfig.cs" /> <Compile Include="storeConfig\config\VerticalStoreConfig.cs" />
......
...@@ -21,12 +21,12 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -21,12 +21,12 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary> /// <summary>
/// 高 /// 高
/// </summary> /// </summary>
[CSVAttribute("高度")] [CSVAttribute("料盒高度")]
public int BagHigh { get; set; } public int BagHigh { get; set; }
/// <summary> /// <summary>
/// 宽 /// 宽
/// </summary> /// </summary>
[CSVAttribute("宽度")] [CSVAttribute("料盒宽度")]
public int BagWidth { get; set; } public int BagWidth { get; set; }
} }
} }
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.LoadCSVLibrary
{
/// <summary>
/// 松下伺服485控制,单台料仓
/// </summary>
public class VerticalPosition : PostionBase
{
/// <summary>
/// 对应的料仓ID(流水线料仓需要用此字段区分哪个BOX)
/// </summary>
[CSVAttribute("料仓ID")]
public int StoreId { get; set; }
/// <summary>
/// 库位类型 ,1=小料盒,2=大料盒
/// </summary>
[CSVAttribute("库位类型")]
public int PosType { get; set; }
/// <summary>
/// 料斗旋转轴位置P2
/// </summary>
[CSVAttribute("料斗旋转轴位置P2")]
public int MiddleAxis_P2 { get; set; }
/// <summary>
/// 亮灯索引
/// </summary>
[CSVAttribute("亮灯索引")]
public string Led_Index { get; set; }
public static bool CheckPosition(VerticalPosition position, VerticalStoreConfig Config)
{
try
{
if (Config.Middle_Axis.PositionIsHasLimit())
{
int mMin = Config.Middle_Axis.PositionMin;
int mMax = Config.Middle_Axis.PositionMax;
if (mMin > position.MiddleAxis_P2 || mMax < position.MiddleAxis_P2)
{
LogUtil.error(position.PositionNum + " MiddleAxis_Position_P2位置超出" + Config.Middle_Axis.Explain + "上下限(" + mMin + "-" + mMax + ")");
return false;
}
}
}
catch (Exception ex)
{
LogUtil.error("验证" + position.PositionNum + "的位置范围出错:" + ex.ToString());
}
return true;
}
public string PosTypeStr()
{
if (PosType.Equals(1))
{
return "小料盒";
}
else
{
return "大料盒";
}
}
}
}
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.LoadCSVLibrary
{
/// <summary>
/// 松下伺服485控制,单台料仓
/// </summary>
public class VerticalStorePosition : PostionBase
{
/// <summary>
/// 对应的料仓ID(流水线料仓需要用此字段区分哪个BOX)
/// </summary>
[CSVAttribute("料仓ID")]
public int StoreId { get; set; }
/// <summary>
/// 库位类型 (1=冷藏区库位,2=回温区库位,>=100的为砝码区)
/// </summary>
[CSVAttribute("库位类型")]
public int PosType { get; set; }
/// <summary>
/// 中轴位置(旋转轴库位点)P2
/// </summary>
[CSVAttribute("旋转轴位置P2")]
public int MiddleAxis_P2 { get; set; }
/// <summary>
/// 升降轴(库位出料前点)P5
/// </summary>
[CSVAttribute("升降轴库位出料前点P5")]
public int UpDownAxis_OH_P5 { get; set; }
/// <summary>
/// 升降轴(库位出料缓冲点)P6
/// </summary>
[CSVAttribute("升降轴库位出料缓冲点P6")]
public int UpDownAxis_OL_P6 { get; set; }
/// <summary>
/// 升降轴(库位入料前点)P3
/// </summary>
[CSVAttribute("升降轴库位入料前点P3")]
public int UpDownAxis_IH_P3 { get; set; }
/// <summary>
/// 升降轴(库位入料缓冲点)P4
/// </summary>
[CSVAttribute("升降轴库位入料缓冲点P4")]
public int UpDownAxis_IL_P4 { get; set; }
/// <summary>
/// 进出轴(库位点取料点)P3
/// </summary>
[CSVAttribute("进出轴库位点取料点P3")]
public int InOutAxis_P3 { get; set; }
/// <summary>
/// 回温区旋转轴库位点P2
/// </summary>
[CSVAttribute("回温区旋转轴库位点P2")]
public int WarmAxis_P2 { get; set; }
/// <summary>
/// 冷藏区旋转轴P2
/// </summary>
[CSVAttribute("冷藏区旋转轴库位点P2")]
public int ColdAxis_P2 { get; set; }
public static bool CheckPosition(VerticalStorePosition position, VerticalStoreConfig Config)
{
try
{
if (Config.Middle_Axis.PositionIsHasLimit())
{
int mMin = Config.Middle_Axis.PositionMin;
int mMax = Config.Middle_Axis.PositionMax;
if (mMin > position.MiddleAxis_P2 || mMax < position.MiddleAxis_P2)
{
LogUtil.error(position.PositionNum + " MiddleAxis_Position_P2位置超出" + Config.Middle_Axis.Explain + "上下限(" + mMin + "-" + mMax + ")");
return false;
}
}
if (Config.InOut_Axis.PositionIsHasLimit())
{
int iMin = Config.InOut_Axis.PositionMin;
int iMax = Config.InOut_Axis.PositionMax;
//if (iMin > position.InOutAxis_DoorPosition_P2 || iMax < position.InOutAxis_DoorPosition_P2)
//{
// LogUtil.error(position.PositionNum + " InOutAxis_DoorPosition_P2位置超出" + Config.InOut_Axis.Explain + "上下限(" + iMin + "-" + iMax + ")");
// return false;
//}
if (iMin > position.InOutAxis_P3 || iMax < position.InOutAxis_P3)
{
LogUtil.error(position.PositionNum + " InOutAxis_P3 位置超出" + Config.InOut_Axis.Explain + "上下限(" + iMin + "-" + iMax + ")");
return false;
}
}
if (Config.UpDown_Axis.PositionIsHasLimit())
{
int uMin = Config.UpDown_Axis.PositionMin;
int uMax = Config.UpDown_Axis.PositionMax;
if (uMin > position.UpDownAxis_IH_P3 || uMax < position.UpDownAxis_IH_P3)
{
LogUtil.error(position.PositionNum + " UpDownAxis_IH_P3 位置超出" + Config.UpDown_Axis.Explain + "上下限(" + uMin + "-" + uMax + ")");
return false;
}
if (uMin > position.UpDownAxis_IL_P4 || uMax < position.UpDownAxis_IL_P4)
{
LogUtil.error(position.PositionNum + " UpDownAxis_IL_P4 位置超出" + Config.UpDown_Axis.Explain + "上下限(" + uMin + "-" + uMax + ")");
return false;
}
if (uMin > position.UpDownAxis_OH_P5 || uMax < position.UpDownAxis_OH_P5)
{
LogUtil.error(position.PositionNum + " UpDownAxis_OH_P5 位置超出" + Config.UpDown_Axis.Explain + "上下限(" + uMin + "-" + uMax + ")");
return false;
}
if (uMin > position.UpDownAxis_OL_P6 || uMax < position.UpDownAxis_OL_P6)
{
LogUtil.error(position.PositionNum + " UpDownAxis_OL_P6 位置超出" + Config.UpDown_Axis.Explain + "上下限(" + uMin + "-" + uMax + ")");
return false;
}
}
}
catch (Exception ex)
{
LogUtil.error("验证" + position.PositionNum + "的位置范围出错:" + ex.ToString());
}
return true;
}
public string PosTypeStr()
{
if (PosType.Equals(1))
{
return "冷藏区库位";
}
else if (PosType.Equals(2))
{
return "回温区库位";
}
else
{
return "砝码" + PosType + "g库位";
}
}
/// <summary>
/// 是否是锡膏库位
/// </summary>
/// <returns></returns>
public bool IsTieBag()
{
if (BagWidth.Equals(50) && BagHigh.Equals(50))
{
return true;
}
return false;
}
}
}
...@@ -26,130 +26,68 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -26,130 +26,68 @@ namespace OnlineStore.LoadCSVLibrary
return TypeList; return TypeList;
} }
/// <summary> /// <summary>
/// DI,急停,SuddenStop_BTN,0,192.168.200.21,0,急停,X01,X01,0, /// DI,急停,SuddenStop_BTN,0,192.168.200.21,急停,X01,X01,,,,,,,,,,
/// </summary> /// </summary>
public static string SuddenStop_BTN = "SuddenStop_BTN"; public static string SuddenStop_BTN = "SuddenStop_BTN";
/// <summary> /// <summary>
/// DI,复位,Reset_BTN,1,192.168.200.21,0,复位,X02,X02,0, /// DI,复位,Reset_BTN,1,192.168.200.21,复位,X02,X02,,,,,,,,,,
/// </summary> /// </summary>
public static string Reset_BTN = "Reset_BTN"; public static string Reset_BTN = "Reset_BTN";
/// <summary> /// <summary>
/// DI,自动启动,AutoRun_Signal,2,192.168.200.21,0,自动启动,X03,X03,0, /// DI,安全光栅,SafetyLightCurtains,2,192.168.200.21,安全光栅,X03,X03,,,,,,,,,,
/// </summary>
public static string AutoRun_Signal = "AutoRun_Signal";
/// <summary>
/// DI,气压检测,Airpressure_Check,3,192.168.200.21,0,气压检测,X04,X04,0,
/// </summary>
public static string Airpressure_Check = "Airpressure_Check";
/// <summary>
/// DI,安全光栅,SafetyLightCurtains,4,192.168.200.21,0,安全光栅,X05,X05,0,
/// </summary> /// </summary>
public static string SafetyLightCurtains = "SafetyLightCurtains"; public static string SafetyLightCurtains = "SafetyLightCurtains";
/// <summary> /// <summary>
/// DI,左侧门禁信号,Door_LeftLimit,5,192.168.200.21,0,左侧门禁信号,X06,X06,0, /// DI,升降门上升端,Door_Up,3,192.168.200.21,升降门上升端,X04,X04,,,,,,,,,,
/// </summary>
public static string Door_LeftLimit = "Door_LeftLimit";
/// <summary>
/// DI,右侧门禁信号,Door_RightLimit,6,192.168.200.21,0,右侧门禁信号,X07,X07,0,
/// </summary>
public static string Door_RightLimit = "Door_RightLimit";
/// <summary>
/// DI,左侧锡膏检测,TinCheck_DoorLeft,7,192.168.200.21,0,左侧锡膏检测,X08,X08,0,
/// </summary>
public static string TinCheck_DoorLeft = "TinCheck_DoorLeft";
/// <summary>
/// DI,右侧锡膏检测,TinCheck_DoorRight,8,192.168.200.21,0,右侧锡膏检测,X09,X09,0,
/// </summary>
public static string TinCheck_DoorRight = "TinCheck_DoorRight";
/// <summary>
/// DI,夹具检测,TinCheck_Fixture,9,192.168.200.21,0,夹具检测,X10,X10,0,
/// </summary>
public static string TinCheck_Fixture = "TinCheck_Fixture";
/// <summary>
/// DI,搅拌区锡膏检测,TinCheck_Stir,10,192.168.200.21,0,搅拌区锡膏检测,X11,X11,0,
/// </summary>
public static string TinCheck_Stir = "TinCheck_Stir";
/// <summary>
/// DI,进料口门上升端,Door_Up,11,192.168.200.21,0,进料口门上升端,X12,X12,0,
/// </summary> /// </summary>
public static string Door_Up = "Door_Up"; public static string Door_Up = "Door_Up";
/// <summary> /// <summary>
/// DI,进料口门下降端,Door_Down,12,192.168.200.21,0,进料口门下降端,X13,X13,0, /// DI,升降门下降端,Door_Down,4,192.168.200.21,升降门下降端,X05,X05,,,,,,,,,,
/// </summary> /// </summary>
public static string Door_Down = "Door_Down"; public static string Door_Down = "Door_Down";
/// <summary> /// <summary>
/// DI,夹爪气缸夹紧端,Clamping_Tighten,13,192.168.200.21,0,夹爪气缸夹紧端,X14,X14,0, /// DO,自动指示灯,AutoRun_HddLed,0,192.168.200.21,自动指示灯,Y01,Y01,,,,,,,,,,
/// </summary>
public static string Clamping_Tighten = "Clamping_Tighten";
/// <summary>
/// DI,夹爪气缸放松端,Clamping_Relax,14,192.168.200.21,0,夹爪气缸放松端,X15,X15,0,
/// </summary>
public static string Clamping_Relax = "Clamping_Relax";
/// <summary>
/// DI,夹爪锡膏检测,TinCheck_Clamping,15,192.168.200.21,0,夹爪锡膏检测,X16,X16,0,
/// </summary>
public static string TinCheck_Clamping = "TinCheck_Clamping";
/// <summary>
/// DO,自动指示灯,AutoRun_HddLed,0,192.168.200.21,0,自动指示灯,Y01,Y01,0,
/// </summary> /// </summary>
public static string AutoRun_HddLed = "AutoRun_HddLed"; public static string AutoRun_HddLed = "AutoRun_HddLed";
/// <summary> /// <summary>
/// DO,故障指示灯,Alarm_HddLed,1,192.168.200.21,0,故障指示灯,Y02,Y02,0, /// DO,故障指示灯,Alarm_HddLed,1,192.168.200.21,故障指示灯,Y02,Y02,,,,,,,,,,
/// </summary> /// </summary>
public static string Alarm_HddLed = "Alarm_HddLed"; public static string Alarm_HddLed = "Alarm_HddLed";
/// <summary> /// <summary>
/// DO,待机指示灯,RunSign_HddLed,2,192.168.200.21,0,待机指示灯,Y03,Y03,0, /// DO,待机指示灯,RunSign_HddLed,2,192.168.200.21,待机指示灯,Y03,Y03,,,,,,,,,,
/// </summary> /// </summary>
public static string RunSign_HddLed = "RunSign_HddLed"; public static string RunSign_HddLed = "RunSign_HddLed";
/// <summary> /// <summary>
/// DO,报警蜂鸣器,Alarm_Buzzer,3,192.168.200.21,0,报警蜂鸣器,Y04,Y04,0, /// DO,报警蜂鸣器,Alarm_Buzzer,3,192.168.200.21,报警蜂鸣器,Y04,Y04,,,,,,,,,,
/// </summary> /// </summary>
public static string Alarm_Buzzer = "Alarm_Buzzer"; public static string Alarm_Buzzer = "Alarm_Buzzer";
/// <summary> /// <summary>
/// DO,料仓运转ON,Run_Signal,4,192.168.200.21,0,料仓运转ON,Y05,Y05,0, /// DO,设备运转ON,Run_Signal,4,192.168.200.21,设备运转ON,Y05,Y05,,,,,,,,,,
/// </summary> /// </summary>
public static string Run_Signal = "Run_Signal"; public static string Run_Signal = "Run_Signal";
/// <summary> /// <summary>
/// DO,取料机构刹车电源ON,Axis_Brake,5,192.168.200.21,0,取料机构刹车电源ON,Y06,Y06,0, /// DO,料斗伺服刹车ON,Axis_Brake,5,192.168.200.21,料斗伺服刹车ON,Y06,Y06,,,,,,,,,,
/// </summary> /// </summary>
public static string Axis_Brake = "Axis_Brake"; public static string Axis_Brake = "Axis_Brake";
/// <summary> /// <summary>
/// DO,相机照明开,Camera_Led,6,192.168.200.21,0,相机照明开,Y07,Y07,0, /// DO,升降门刹车ON,Camera_Led,6,192.168.200.21,升降门刹车ON,Y07,Y07,,,,,,,,,,
/// </summary> /// </summary>
public static string Camera_Led = "Camera_Led"; public static string Camera_Led = "Camera_Led";
/// <summary> ///// <summary>
/// DO,门禁功能屏蔽,Door_Limit,7,192.168.200.21,0,门禁功能屏蔽,Y08,Y08,0, ///// DO,升降门电机上升,Door_Up,7,192.168.200.21,升降门电机上升,Y08,Y08,,,,,,,,,,
/// </summary> ///// </summary>
public static string Door_Limit = "Door_Limit"; //public static string Door_Up = "Door_Up";
/// <summary> ///// <summary>
/// DO,冷气机启动,Colding_Start,8,192.168.200.21,0,冷气机启动,Y09,Y09,0, ///// DO,升降门电机下降,Door_Down,8,192.168.200.21,升降门电机下降,Y09,Y09,,,,,,,,,,
/// </summary> ///// </summary>
public static string Colding_Start = "Colding_Start"; //public static string Door_Down = "Door_Down";
/// <summary> /// <summary>
/// DO,回温区风机启动,Warming_Start,9,192.168.200.21,0,回温区风机启动,Y10,Y10,0, /// DO,设备照明ON,Device_Led,9,192.168.200.21,设备照明ON,Y10,Y10,,,,,,,,,,
/// </summary> /// </summary>
public static string Warming_Start = "Warming_Start"; public static string Device_Led = "Device_Led";
/// <summary>
/// DO,搅拌定位气缸上升SOL,StirLocation_Up,14,192.168.200.21,0,搅拌定位气缸上升SOL,Y15,Y15,0,
/// </summary>
public static string StirLocation_Up = "StirLocation_Up";
/// <summary>
/// DO,搅拌定位气缸下降SOL,StirLocation_Down,15,192.168.200.21,0,搅拌定位气缸下降SOL,Y16,Y16,0,
/// </summary>
public static string StirLocation_Down = "StirLocation_Down";
/// <summary>
/// DI,冷藏区门关闭端,ColdDoor_Close,2,192.168.200.22,,冷藏区门关闭端,X23,X23,,
/// </summary>
public static string ColdDoor_Close = "ColdDoor_Close";
/// <summary>
/// DI,冷藏区门打开端,ColdDoor_Open,3,192.168.200.22,,冷藏区门打开端,X24,X24,,
/// </summary>
public static string ColdDoor_Open = "ColdDoor_Open";
// public static string StartOrStopBlow = "StartOrStopBlow";
} }
public enum IO_VALUE public enum IO_VALUE
......
...@@ -161,7 +161,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -161,7 +161,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
if (String.IsNullOrEmpty(builder.ToString()).Equals(false) && builder.ToString().Equals("\r\n").Equals(false)) if (String.IsNullOrEmpty(builder.ToString()).Equals(false) && builder.ToString().Equals("\r\n").Equals(false))
{ {
// LOGGER.Error(builder.ToString()); LOGGER.Error(builder.ToString());
} }
if (checkProList.Count >= 0) if (checkProList.Count >= 0)
{ {
......
...@@ -67,54 +67,27 @@ namespace OnlineStore.TinPasteStore ...@@ -67,54 +67,27 @@ namespace OnlineStore.TinPasteStore
return returnList; return returnList;
} }
//private static FrmAxisDebug debug = null;
//public static void ShowAxisDebug(VerticalStoreBean store)
//public static FrmAxisMoveConfig FrmAxisConfig = null;
//public static void ShowAxisConfig(AC_SA_BoxBean boxBean)
//{ //{
// if (FormManager.FrmAxisConfig == null) // if (debug == null)
// { // {
// FormManager.FrmAxisConfig = new FrmAxisMoveConfig(boxBean); // debug = new FrmAxisDebug(store);
// FormManager.FrmAxisConfig.Show(); // debug.Show();
// } // }
// else // else
// { // {
// if (debug.IsDisposed)
// //FormManager.FrmAxisConfig.ShowDialog();
// if (FormManager.FrmAxisConfig.IsDisposed)
// { // {
// FormManager.FrmAxisConfig = new FrmAxisMoveConfig(boxBean); // debug = new FrmAxisDebug(store);
// FormManager.FrmAxisConfig.Show(); // debug.Show();
// } // }
// else // else
// { // {
// FormManager.FrmAxisConfig.Activate(); // debug.Activate();
// } // }
// } // }
//} //}
private static FrmAxisDebug debug = null;
public static void ShowAxisDebug(VerticalStoreBean store)
{
if (debug == null)
{
debug = new FrmAxisDebug(store);
debug.Show();
}
else
{
if (debug.IsDisposed)
{
debug = new FrmAxisDebug(store);
debug.Show();
}
else
{
debug.Activate();
}
}
}
private static FrmIOStatus frmIo = null; private static FrmIOStatus frmIo = null;
public static void ShowIOShow(VerticalStoreBean store) public static void ShowIOShow(VerticalStoreBean store)
{ {
......
...@@ -44,7 +44,7 @@ namespace OnlineStore.TinPasteStore ...@@ -44,7 +44,7 @@ namespace OnlineStore.TinPasteStore
} }
return str; return str;
} }
internal static string GetCodeNum(string codeName = "TinPasteStore") internal static string GetCodeNum(string codeName = "VerticalStoreClient")
{ {
byte[] byteArray = System.Text.Encoding.ASCII.GetBytes(codeName); byte[] byteArray = System.Text.Encoding.ASCII.GetBytes(codeName);
string result = ""; string result = "";
......
...@@ -30,14 +30,10 @@ namespace OnlineStore.TinPasteStore ...@@ -30,14 +30,10 @@ namespace OnlineStore.TinPasteStore
Control.CheckForIllegalCrossThreadCalls = false; Control.CheckForIllegalCrossThreadCalls = false;
InitializeComponent(); InitializeComponent();
} }
public FrmIOStatus(VerticalStoreBean store) public void SetStore(VerticalStoreBean store)
{ {
Control.CheckForIllegalCrossThreadCalls = false;
InitializeComponent();
this.boxBean = store; this.boxBean = store;
this.StoreId = store.StoreID; this.StoreId = store.StoreID;
LoadIOList();
} }
Dictionary<string, IOTextControl> DIControlList = new Dictionary<string, IOTextControl>(); Dictionary<string, IOTextControl> DIControlList = new Dictionary<string, IOTextControl>();
...@@ -146,6 +142,7 @@ namespace OnlineStore.TinPasteStore ...@@ -146,6 +142,7 @@ namespace OnlineStore.TinPasteStore
private void FrmStoreIOStatus_Load(object sender, EventArgs e) private void FrmStoreIOStatus_Load(object sender, EventArgs e)
{ {
LoadIOList();
} }
private void cmbWriteIO_DrawItem(object sender, DrawItemEventArgs e) private void cmbWriteIO_DrawItem(object sender, DrawItemEventArgs e)
...@@ -192,18 +189,6 @@ namespace OnlineStore.TinPasteStore ...@@ -192,18 +189,6 @@ namespace OnlineStore.TinPasteStore
} }
} }
private void btnOpenDoor_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Door_Up, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.LOW);
}
private void btnCloseDoor_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.Door_Up, IO_VALUE.LOW);
}
private void FrmIOStatus_Shown(object sender, EventArgs e) private void FrmIOStatus_Shown(object sender, EventArgs e)
{ {
timer1.Start(); timer1.Start();
...@@ -259,57 +244,6 @@ namespace OnlineStore.TinPasteStore ...@@ -259,57 +244,6 @@ namespace OnlineStore.TinPasteStore
WriteDO(IO_VALUE.LOW); WriteDO(IO_VALUE.LOW);
} }
private void btn_Colding_Start_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Colding_Start, IO_VALUE.HIGH);
}
private void btn_Colding_Stop_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Colding_Start, IO_VALUE.LOW);
}
private void btn_Warming_Start_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Warming_Start, IO_VALUE.HIGH);
}
private void btn_Warming_Stop_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Warming_Start, IO_VALUE.LOW);
}
private void btn_Clamping_Tighten_Click(object sender, EventArgs e)
{
StoreManager.Store.CylinderMove(null, IO_Type.Clamping_Relax, IO_Type.Clamping_Tighten);
}
private void btn_Clamping_Relax_Click(object sender, EventArgs e)
{
StoreManager.Store.CylinderMove(null, IO_Type.Clamping_Tighten, IO_Type.Clamping_Relax);
}
private void btn_StirLocation_Up_Click(object sender, EventArgs e)
{
StoreManager.Store.CylinderMove(null, IO_Type.StirLocation_Down, IO_Type.StirLocation_Up);
}
private void btn_StirLocation_Down_Click(object sender, EventArgs e)
{
StoreManager.Store.CylinderMove(null, IO_Type.StirLocation_Up, IO_Type.StirLocation_Down);
}
private void btn_ColdDoor_Close_Click(object sender, EventArgs e)
{
StoreManager.Store.CylinderMove(null, IO_Type.ColdDoor_Open, IO_Type.ColdDoor_Close);
}
private void btn_ColdDoor_Open_Click(object sender, EventArgs e)
{
StoreManager.Store.CylinderMove(null, IO_Type.ColdDoor_Close, IO_Type.ColdDoor_Open);
}
} }
} }
...@@ -83,25 +83,12 @@ ...@@ -83,25 +83,12 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="FormManager.cs" />
<Compile Include="FrmAxisDebug.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmAxisDebug.Designer.cs">
<DependentUpon>FrmAxisDebug.cs</DependentUpon>
</Compile>
<Compile Include="FrmBase.cs"> <Compile Include="FrmBase.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="FrmBase.Designer.cs"> <Compile Include="FrmBase.Designer.cs">
<DependentUpon>FrmBase.cs</DependentUpon> <DependentUpon>FrmBase.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="FrmDeviceDebug.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmDeviceDebug.Designer.cs">
<DependentUpon>FrmDeviceDebug.cs</DependentUpon>
</Compile>
<Compile Include="FrmIOStatus.cs"> <Compile Include="FrmIOStatus.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
...@@ -147,15 +134,9 @@ ...@@ -147,15 +134,9 @@
<Compile Include="useControl\AxisJogControl.Designer.cs"> <Compile Include="useControl\AxisJogControl.Designer.cs">
<DependentUpon>AxisJogControl.cs</DependentUpon> <DependentUpon>AxisJogControl.cs</DependentUpon>
</Compile> </Compile>
<EmbeddedResource Include="FrmAxisDebug.resx">
<DependentUpon>FrmAxisDebug.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmBase.resx"> <EmbeddedResource Include="FrmBase.resx">
<DependentUpon>FrmBase.cs</DependentUpon> <DependentUpon>FrmBase.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="FrmDeviceDebug.resx">
<DependentUpon>FrmDeviceDebug.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmIOStatus.resx"> <EmbeddedResource Include="FrmIOStatus.resx">
<DependentUpon>FrmIOStatus.cs</DependentUpon> <DependentUpon>FrmIOStatus.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
...@@ -63,20 +63,8 @@ namespace OnlineStore.TinPasteStore.useControl ...@@ -63,20 +63,8 @@ namespace OnlineStore.TinPasteStore.useControl
/// </summary> /// </summary>
private bool InOutIsIsP1() private bool InOutIsIsP1()
{ {
int InOutDefaultPosition = ConfigAppSettings.GetIntValue(Setting_Init.InOutDefaultPosition);
//if (InOutDefaultPosition > 3000 || InOutDefaultPosition.Equals(0))
//{
// InOutDefaultPosition = 3000;
//}
ConfigMoveAxis inout = StoreManager.Store.Config.InOut_Axis;
int currValue = ACServerManager.GetActualtPosition(inout.DeviceName, inout.GetAxisValue());
if (currValue <= InOutDefaultPosition)
{
return true; return true;
} }
MessageBox.Show("进出轴不在待机位,请先将进出轴退回待机位(" + InOutDefaultPosition + ")", "警告(进出轴在待机位时,才能移动其他轴) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
private void AxisMove(int speed) private void AxisMove(int speed)
{ {
LogUtil.debug("点动:[" + AxisInfo.DeviceName + "_" + AxisInfo.GetAxisValue() + "],speed=" + speed); LogUtil.debug("点动:[" + AxisInfo.DeviceName + "_" + AxisInfo.GetAxisValue() + "],speed=" + speed);
......
...@@ -65,25 +65,18 @@ namespace OnlineStore.ACPackingStore ...@@ -65,25 +65,18 @@ namespace OnlineStore.ACPackingStore
private bool AxisCanMove() private bool AxisCanMove()
{ {
if (BoxBean.Config.Middle_Axis.IsSameAxis(PortName, SlvAddr) || BoxBean.Config.UpDown_Axis.IsSameAxis(PortName, SlvAddr)) //if (BoxBean.Config.Middle_Axis.IsSameAxis(PortName, SlvAddr) || BoxBean.Config.UpDown_Axis.IsSameAxis(PortName, SlvAddr))
{ //{
int InOutDefaultPosition = ConfigAppSettings.GetIntValue(Setting_Init.InOutDefaultPosition); // int InOutDefaultPosition = ConfigAppSettings.GetIntValue(Setting_Init.InOutDefaultPosition);
int currValue = ACServerManager.GetActualtPosition(BoxBean.Config.InOut_Axis.DeviceName, BoxBean.Config.InOut_Axis.GetAxisValue()); // int currValue = ACServerManager.GetActualtPosition(BoxBean.Config.InOut_Axis.DeviceName, BoxBean.Config.InOut_Axis.GetAxisValue());
//旋转轴和升降轴运动时,叉子必须在待机位 // //旋转轴和升降轴运动时,叉子必须在待机位
if (currValue > InOutDefaultPosition) // if (currValue > InOutDefaultPosition)
{ // {
MessageBox.Show("叉子不在待机位,请先将叉子退回待机位(" + InOutDefaultPosition + ")", "警告(叉子在待机位时,才能移动升降轴和旋转轴) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // MessageBox.Show("叉子不在待机位,请先将叉子退回待机位(" + InOutDefaultPosition + ")", "警告(叉子在待机位时,才能移动升降轴和旋转轴) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false; // return false;
} // }
} //}
if (BoxBean.Config.Stir_Axis.IsSameAxis(PortName, SlvAddr))
{
if (!StoreManager.Store.StirAxisCanMove())
{
MessageBox.Show("搅拌气缸不在上升端,清先上升搅拌气缸", "警告(搅拌气缸上升时,搅拌轴才能动作) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
}
return true; return true;
} }
private void btnAxisAMove_Click(object sender, EventArgs e) private void btnAxisAMove_Click(object sender, EventArgs e)
...@@ -217,26 +210,7 @@ namespace OnlineStore.ACPackingStore ...@@ -217,26 +210,7 @@ namespace OnlineStore.ACPackingStore
{ {
color = Color.Red; color = Color.Red;
} }
else if (BoxBean.Config.UpDown_Axis.IsSameAxis(axis.DeviceName, axis.GetAxisValue()))
{
color = Color.Blue;
}
else if (BoxBean.Config.InOut_Axis.IsSameAxis(axis.DeviceName, axis.GetAxisValue()))
{
color = Color.Green;
}
else if (BoxBean.Config.Warming_Axis.IsSameAxis(axis.DeviceName, axis.GetAxisValue()))
{
color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); ;
}
else if (BoxBean.Config.Colding_Axis.IsSameAxis(axis.DeviceName, axis.GetAxisValue()))
{
color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
}
else if (BoxBean.Config.Stir_Axis.IsSameAxis(axis.DeviceName, axis.GetAxisValue()))
{
color = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
}
btnOpenAxis.ForeColor = color; btnOpenAxis.ForeColor = color;
btnCloseAxis.ForeColor = color; btnCloseAxis.ForeColor = color;
btnAxisAMove.ForeColor = color; btnAxisAMove.ForeColor = color;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!