Commit 41b47a48 LN

原git更改内容提交

1 个父辈 b9088dc4
...@@ -9,12 +9,6 @@ ...@@ -9,12 +9,6 @@
AIOBOX操作类 AIOBOX操作类
</summary> </summary>
</member> </member>
<member name="F:Asa.IOModule.AIOBOX._unrevdRemote">
<summary>
暂停次数
WriteDO 命令非常多时,暂停一次发送 ReadDI 或 ReadDO
</summary>
</member>
<member name="F:Asa.IOModule.AIOBOX.SEND_SLEEP"> <member name="F:Asa.IOModule.AIOBOX.SEND_SLEEP">
<summary> <summary>
每条命令发送的间隔 每条命令发送的间隔
...@@ -22,13 +16,12 @@ ...@@ -22,13 +16,12 @@
小于30时,会出现接收数据连包的情况 小于30时,会出现接收数据连包的情况
</summary> </summary>
</member> </member>
<member name="F:Asa.IOModule.AIOBOX.LISTEN_SLEEP"> <member name="F:Asa.IOModule.AIOBOX.PORT">
<summary> <summary>
监听网络接收数据的间隔 ModBus端口
必须小于SEND_SLEEP
</summary> </summary>
</member> </member>
<member name="T:Asa.IOModule.AIOBOX.DI_Changed"> <member name="T:Asa.IOModule.AIOBOX.DIO_Changed">
<summary> <summary>
自动读取DI委托 自动读取DI委托
</summary> </summary>
...@@ -40,19 +33,12 @@ ...@@ -40,19 +33,12 @@
自动读取DI事件触发 自动读取DI事件触发
</summary> </summary>
</member> </member>
<member name="T:Asa.IOModule.AIOBOX.DO_Changed">
<summary>
自动读取DO委托
</summary>
<param name="box">AIOBOX</param>
<param name="sta">所有DO状态</param>
</member>
<member name="E:Asa.IOModule.AIOBOX.DO_Changed_Event"> <member name="E:Asa.IOModule.AIOBOX.DO_Changed_Event">
<summary> <summary>
自动读取DO事件触发 自动读取DO事件触发
</summary> </summary>
</member> </member>
<member name="T:Asa.IOModule.AIOBOX.AI_Changed"> <member name="T:Asa.IOModule.AIOBOX.AIO_Changed">
<summary> <summary>
自动读取AI委托 自动读取AI委托
</summary> </summary>
...@@ -64,13 +50,6 @@ ...@@ -64,13 +50,6 @@
自动读取AI事件触发 自动读取AI事件触发
</summary> </summary>
</member> </member>
<member name="T:Asa.IOModule.AIOBOX.AO_Changed">
<summary>
自动读取AO委托
</summary>
<param name="box">AIOBOX</param>
<param name="val">所有AO的值</param>
</member>
<member name="E:Asa.IOModule.AIOBOX.AO_Changed_Event"> <member name="E:Asa.IOModule.AIOBOX.AO_Changed_Event">
<summary> <summary>
自动读取AO事件触发 自动读取AO事件触发
...@@ -86,11 +65,6 @@ ...@@ -86,11 +65,6 @@
IP地址 IP地址
</summary> </summary>
</member> </member>
<member name="P:Asa.IOModule.AIOBOX.Port">
<summary>
ModBus端口
</summary>
</member>
<member name="P:Asa.IOModule.AIOBOX.IsConn"> <member name="P:Asa.IOModule.AIOBOX.IsConn">
<summary> <summary>
是否连接 是否连接
...@@ -101,35 +75,12 @@ ...@@ -101,35 +75,12 @@
错误信息 错误信息
</summary> </summary>
</member> </member>
<member name="P:Asa.IOModule.AIOBOX.LogOutDir"> <member name="M:Asa.IOModule.AIOBOX.LogPath(System.String,Asa.IOModule.LogType)">
<summary>
日志输出目录
</summary>
</member>
<member name="P:Asa.IOModule.AIOBOX.LogOut">
<summary>
错误日志输出,默认true
</summary>
</member>
<member name="P:Asa.IOModule.AIOBOX.InputCount">
<summary>
输入总数
</summary>
</member>
<member name="P:Asa.IOModule.AIOBOX.OutputCount">
<summary>
输出总数
</summary>
</member>
<member name="P:Asa.IOModule.AIOBOX.InputReadSleep">
<summary> <summary>
自动读取DI间隔 日志路径,连接前设置路径会自动保存日志
</summary>
</member>
<member name="P:Asa.IOModule.AIOBOX.OutputReadSleep">
<summary>
自动读取DO间隔
</summary> </summary>
<param name="path">文件夹路径</param>
<param name="type">输出类型</param>
</member> </member>
<member name="M:Asa.IOModule.AIOBOX.SetInput(Asa.IOModule.Box_Type,System.Int32)"> <member name="M:Asa.IOModule.AIOBOX.SetInput(Asa.IOModule.Box_Type,System.Int32)">
<summary> <summary>
...@@ -163,7 +114,6 @@ ...@@ -163,7 +114,6 @@
<summary> <summary>
连接 连接
</summary> </summary>
<returns></returns>
</member> </member>
<member name="M:Asa.IOModule.AIOBOX.Close"> <member name="M:Asa.IOModule.AIOBOX.Close">
<summary> <summary>
...@@ -197,6 +147,12 @@ ...@@ -197,6 +147,12 @@
<param name="sta"></param> <param name="sta"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Asa.IOModule.AIOBOX.ReverseStatus(Asa.IOModule.Box_Sta@)">
<summary>
相反状态(ON/OFF)
</summary>
<param name="sta"></param>
</member>
<member name="M:Asa.IOModule.AIOBOX.ReadDI(System.Int32)"> <member name="M:Asa.IOModule.AIOBOX.ReadDI(System.Int32)">
<summary> <summary>
读取单个DI输入状态(ON/OFF) 读取单个DI输入状态(ON/OFF)
...@@ -292,20 +248,17 @@ ...@@ -292,20 +248,17 @@
读取所有DO状态,功能码1 读取所有DO状态,功能码1
</summary> </summary>
<param name="buff"></param> <param name="buff"></param>
<returns></returns>
</member> </member>
<member name="M:Asa.IOModule.AIOBOX.ReadDI(System.Byte[])"> <member name="M:Asa.IOModule.AIOBOX.ReadDI(System.Byte[])">
<summary> <summary>
读取所有DI状态,功能码2 读取所有DI状态,功能码2
</summary> </summary>
<returns></returns>
</member> </member>
<member name="M:Asa.IOModule.AIOBOX.ReadAI(System.Byte[])"> <member name="M:Asa.IOModule.AIOBOX.ReadAI(System.Byte[])">
<summary> <summary>
读取所有AI的值,功能码4 读取所有AI的值,功能码4
</summary> </summary>
<param name="buff"></param> <param name="buff"></param>
<returns></returns>
</member> </member>
<member name="M:Asa.IOModule.AIOBOX.Command"> <member name="M:Asa.IOModule.AIOBOX.Command">
<summary> <summary>
...@@ -373,5 +326,62 @@ ...@@ -373,5 +326,62 @@
闭合,打开,高电平 闭合,打开,高电平
</summary> </summary>
</member> </member>
<member name="T:Asa.IOModule.LogType">
<summary>
日志类型
</summary>
</member>
<member name="F:Asa.IOModule.LogType.OnlyError">
<summary>
仅错误信息
</summary>
</member>
<member name="F:Asa.IOModule.LogType.All">
<summary>
所有
</summary>
</member>
<member name="T:Asa.IOModule.LogFile">
<summary>
日志操作类
</summary>
</member>
<member name="M:Asa.IOModule.LogFile.#ctor(System.String,System.String)">
<summary>
日志
</summary>
<param name="path">文件夹路径</param>
<param name="ip"></param>
</member>
<member name="M:Asa.IOModule.LogFile.Close">
<summary>
关闭文件
</summary>
</member>
<member name="M:Asa.IOModule.LogFile.OutError(System.String)">
<summary>
输出错误
</summary>
<param name="s"></param>
</member>
<member name="M:Asa.IOModule.LogFile.OutInfo(System.String)">
<summary>
输出信息
</summary>
<param name="s"></param>
</member>
<member name="M:Asa.IOModule.LogFile.OutData(System.String,System.Byte[])">
<summary>
输出数据
</summary>
<param name="tr"></param>
<param name="buff"></param>
</member>
<member name="M:Asa.IOModule.LogFile.OutData(System.String)">
<summary>
输出数据
</summary>
<param name="s"></param>
</member>
</members> </members>
</doc> </doc>
...@@ -41,6 +41,39 @@ namespace OnlineStore.ACSingleStore ...@@ -41,6 +41,39 @@ namespace OnlineStore.ACSingleStore
cmbId.SelectedIndex = StoreId - 1; cmbId.SelectedIndex = StoreId - 1;
} }
chbDebug.Checked = StoreManager.Store.IsDebug; chbDebug.Checked = StoreManager.Store.IsDebug;
LoadPos();
}
private List<string> allList = new List<string>();
private void LoadPos()
{
allList = new List<string>(StoreManager.Store.PositionNumList);
allList.Insert(0, " ---暂无--- ");
LoadLocationCom(7, cmbPosition7, allList);
LoadLocationCom(11, cmbPosition11, allList);
LoadLocationCom(13, cmbPosition13, allList);
LoadLocationCom(15, cmbPosition15, allList);
}
private void LoadLocationCom(int width,ComboBox com,List<string> allList)
{
com.DataSource =new List<string>( allList);
string posId = StoreManager.GetLocationPosId(width);
int index = allList.IndexOf(posId);
if (index >0)
{
com.SelectedIndex = index;
}
else
{
com.SelectedIndex = 0;
}
foreach(string str in allList)
{
com.AutoCompleteCustomSource.Add(str);
}
com.AutoCompleteSource = AutoCompleteSource.CustomSource;
} }
private void btnNext_Click(object sender, EventArgs e) private void btnNext_Click(object sender, EventArgs e)
...@@ -103,7 +136,58 @@ namespace OnlineStore.ACSingleStore ...@@ -103,7 +136,58 @@ namespace OnlineStore.ACSingleStore
private void btnReset_Click(object sender, EventArgs e) private void btnReset_Click(object sender, EventArgs e)
{ {
txthttpAddr.Text = "http://192.168.101.11/myproject/"; txthttpAddr.Text = "http://192.168.101.11/myproject/";
txtLineAddr.Text = "192.168.101.11"; txtLineAddr.Text = "192.168.101.10";
}
private void cmbPosition7_MouseLeave(object sender, EventArgs e)
{
try {
ComboBox box = (ComboBox)sender;
string value = box.Text;
if (allList.Contains(value.Trim())){
}
else
{
box.Text = allList[0];
}
}
catch (Exception ex)
{
LogUtil.error("cmbPosition7_MouseLeave 出错:" + ex.ToString());
}
}
private void btnSavePosID_Click(object sender, EventArgs e)
{
try
{
SaveP(cmbPosition7, 7);
SaveP(cmbPosition11, 11);
SaveP(cmbPosition13, 13);
SaveP(cmbPosition15, 15);
MessageBox.Show("保存定位库位成功");
}catch(Exception ex)
{
LogUtil.error("btnSavePosID_Click 出错:" + ex.ToString());
}
} }
private void SaveP(ComboBox box,int width)
{
string value = box.Text;
if (!allList.Contains(value) )
{
box.Text = allList[0];
value = allList[0];
}
if (value.Equals(allList[0]))
{
value = "";
}
ConfigAppSettings.SaveValue(Setting_Init.Location_PosID_ + width, value);
}
} }
} }
...@@ -101,8 +101,8 @@ namespace OnlineStore.ACSingleStore ...@@ -101,8 +101,8 @@ namespace OnlineStore.ACSingleStore
txtMiddleP2.Text = ktkPosition.MiddleAxis_Position_P2.ToString(); txtMiddleP2.Text = ktkPosition.MiddleAxis_Position_P2.ToString();
txtUpDownP3.Text = ktkPosition.UpDownAxis_IHPosition_P3.ToString(); txtUpDownP3.Text = ktkPosition.UpDownAxis_IHPosition_P3.ToString();
txtUpDownP4.Text = ktkPosition.UpDownAxis_ILPosition_P4.ToString(); txtUpDownP4.Text = ktkPosition.UpDownAxis_ILPosition_P4.ToString();
txtUpDownP5.Text = ktkPosition.UpDownAxis_OHPosition_P5.ToString(); txtUpDownP5.Text = ktkPosition.UpDownAxis_OLPosition_P5.ToString();
txtUpDownP6.Text = ktkPosition.UpDownAxis_OLPosition_P6.ToString(); txtUpDownP6.Text = ktkPosition.UpDownAxis_OHPosition_P6.ToString();
txtComP2.Text = ktkPosition.CompressAxis_Position_P2.ToString(); txtComP2.Text = ktkPosition.CompressAxis_Position_P2.ToString();
txtComP3.Text = ktkPosition.CompressAxis_CPosition_P3.ToString(); txtComP3.Text = ktkPosition.CompressAxis_CPosition_P3.ToString();
txtInOutP3.Text = ktkPosition.InOutAxis_Position_P3.ToString(); txtInOutP3.Text = ktkPosition.InOutAxis_Position_P3.ToString();
...@@ -180,7 +180,7 @@ namespace OnlineStore.ACSingleStore ...@@ -180,7 +180,7 @@ namespace OnlineStore.ACSingleStore
LoadOk = true; LoadOk = true;
} }
lblTemp.Text = store.currTempStr; lblTemp.Text = store.currTempStr;
lblMoveEquipInfo.Text = "移栽状态:"+(LineConnect.CanStartOut() ? "可出库":"不可出库" )+" "+LineConnect.LastUpdateTime.ToLongTimeString() ; lblMoveEquipInfo.Text = "移栽状态:"+(LineConnect.CanStartOut() ? "可出库":"不可出库" )+" "+LineConnect.LastUpdateTime.ToLongTimeString()+"" ;
//忙碌状态不读取状态 //忙碌状态不读取状态
if (!store.storeRunStatus.Equals(StoreRunStatus.Busy)) if (!store.storeRunStatus.Equals(StoreRunStatus.Busy))
{ {
...@@ -438,8 +438,8 @@ namespace OnlineStore.ACSingleStore ...@@ -438,8 +438,8 @@ namespace OnlineStore.ACSingleStore
txtMiddleP2.Text = ktkPosition.MiddleAxis_Position_P2.ToString(); txtMiddleP2.Text = ktkPosition.MiddleAxis_Position_P2.ToString();
txtUpDownP3.Text = ktkPosition.UpDownAxis_IHPosition_P3.ToString(); txtUpDownP3.Text = ktkPosition.UpDownAxis_IHPosition_P3.ToString();
txtUpDownP4.Text = ktkPosition.UpDownAxis_ILPosition_P4.ToString(); txtUpDownP4.Text = ktkPosition.UpDownAxis_ILPosition_P4.ToString();
txtUpDownP5.Text = ktkPosition.UpDownAxis_OHPosition_P5.ToString(); txtUpDownP5.Text = ktkPosition.UpDownAxis_OLPosition_P5.ToString();
txtUpDownP6.Text = ktkPosition.UpDownAxis_OLPosition_P6.ToString(); txtUpDownP6.Text = ktkPosition.UpDownAxis_OHPosition_P6.ToString();
txtComP2.Text = ktkPosition.CompressAxis_Position_P2.ToString(); txtComP2.Text = ktkPosition.CompressAxis_Position_P2.ToString();
txtComP3.Text = ktkPosition.CompressAxis_CPosition_P3.ToString(); txtComP3.Text = ktkPosition.CompressAxis_CPosition_P3.ToString();
txtInOutP3.Text = ktkPosition.InOutAxis_Position_P3.ToString(); txtInOutP3.Text = ktkPosition.InOutAxis_Position_P3.ToString();
...@@ -610,8 +610,8 @@ namespace OnlineStore.ACSingleStore ...@@ -610,8 +610,8 @@ namespace OnlineStore.ACSingleStore
ktkPosition.UpDownAxis_ILPosition_P4 = FormUtil.GetIntValue(txtUpDownP4); ktkPosition.UpDownAxis_ILPosition_P4 = FormUtil.GetIntValue(txtUpDownP4);
ktkPosition.InOutAxis_Position_P3 = FormUtil.GetIntValue(txtInOutP3); ktkPosition.InOutAxis_Position_P3 = FormUtil.GetIntValue(txtInOutP3);
ktkPosition.CompressAxis_CPosition_P3 = FormUtil.GetIntValue(txtComP3); ktkPosition.CompressAxis_CPosition_P3 = FormUtil.GetIntValue(txtComP3);
ktkPosition.UpDownAxis_OHPosition_P5 = FormUtil.GetIntValue(txtUpDownP5); ktkPosition.UpDownAxis_OLPosition_P5 = FormUtil.GetIntValue(txtUpDownP5);
ktkPosition.UpDownAxis_OLPosition_P6 = FormUtil.GetIntValue(txtUpDownP6); ktkPosition.UpDownAxis_OHPosition_P6 = FormUtil.GetIntValue(txtUpDownP6);
ktkPosition.CompressAxis_Position_P2 = FormUtil.GetIntValue(txtComP2); ktkPosition.CompressAxis_Position_P2 = FormUtil.GetIntValue(txtComP2);
ktkPosition.InOutAxis_DoorPosition_P2 = FormUtil.GetIntValue(txtInOutP2); ktkPosition.InOutAxis_DoorPosition_P2 = FormUtil.GetIntValue(txtInOutP2);
//ktkPosition.UpDownAxis_DoorIPosition_P2 = FormUtil.GetIntValue(txtUpDownP2); //ktkPosition.UpDownAxis_DoorIPosition_P2 = FormUtil.GetIntValue(txtUpDownP2);
......
...@@ -27,3 +27,8 @@ ...@@ -27,3 +27,8 @@
第9和第10位表示隔板位置(04) 第9和第10位表示隔板位置(04)
例如: 4D12010124 表示4楼12号料仓第1列第1行架子上的第24个隔板位置 例如: 4D12010124 表示4楼12号料仓第1列第1行架子上的第24个隔板位置
4D19050208 表示4楼19号料仓(包装料仓)第5列第2行架子上的第8个隔板位置 4D19050208 表示4楼19号料仓(包装料仓)第5列第2行架子上的第8个隔板位置
20200408
入库时仓门口必须有料。
...@@ -101,5 +101,8 @@ namespace OnlineStore.Common ...@@ -101,5 +101,8 @@ namespace OnlineStore.Common
public static string Tool_TargetPosition= "Tool_TargetPosition"; public static string Tool_TargetPosition= "Tool_TargetPosition";
public static string Location_PosID_ = "Location_PosID_";
} }
} }
...@@ -12,17 +12,39 @@ using System.Security.Cryptography; ...@@ -12,17 +12,39 @@ using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using System.Net.NetworkInformation;
namespace OnlineStore.Common namespace OnlineStore.Common
{ {
public class HttpHelper public class HttpHelper
{ {
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static string Post(string url, string paramData) public static string Post(string url, string paramData)
{ {
return Post(url, paramData, Encoding.UTF8); return Post(url, paramData, Encoding.UTF8);
} }
//public static bool PingURLIP(string url, int ms = 100)
//{
// string[] urlArray = url.Split('/');
// if (urlArray.Length > 3)
// {
// string ip = urlArray[2];
// Ping pingSender = new Ping();
// PingReply reply = pingSender.Send(ip, ms);//第一个参数为ip地址,第二个参数为ping的时间
// if (reply.Status == IPStatus.Success)
// {
// //通
// return true;
// }
// else
// {
// //不通
// return false;
// }
// }
// return true;
//}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
...@@ -33,7 +55,14 @@ namespace OnlineStore.Common ...@@ -33,7 +55,14 @@ namespace OnlineStore.Common
public static Operation Post(string url, Operation operation, bool simulate) public static Operation Post(string url, Operation operation, bool simulate)
{ {
try try
{ { //如果Op=0或者Op=5,先拼Ip,不通不发送
//if (operation.op < 0 || operation.op.Equals(5))
//{
// if (PingURLIP(url, 100).Equals(false))
// {
// return null;
// }
//}
if (simulate) if (simulate)
{//模拟服务器返回 {//模拟服务器返回
operation.status = 200; operation.status = 200;
...@@ -58,7 +87,7 @@ namespace OnlineStore.Common ...@@ -58,7 +87,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("JsonHelper.SerializeObject(operation) 出错【operation.op=" + operation.op + "】" + ex); LogUtil.error("JsonHelper.SerializeObject(operation) 出错【operation.op=" + operation.op + "】" + ex);
} }
string result = Post(url, json); string result = Post(url, json);
if (!string.IsNullOrEmpty(result)) if (!string.IsNullOrEmpty(result))
...@@ -69,20 +98,24 @@ namespace OnlineStore.Common ...@@ -69,20 +98,24 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex); LogUtil.error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex);
} }
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("Post 出错【operation.op=" + operation.op + "】:" + ex); LogUtil.error("Post 出错【operation.op=" + operation.op + "】:" + ex);
} }
return null; return null;
} }
private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open); private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
public static string Post(string url, string paramData, Encoding encoding) public static string Post(string url, string paramData, Encoding encoding)
{ {
//if (PingURLIP(url, 100).Equals(false))
//{
// return null;
//}
if (isLog == 1) if (isLog == 1)
{ {
LOGGER.Info("给服务器发送数据【" + paramData + "】 "); LOGGER.Info("给服务器发送数据【" + paramData + "】 ");
...@@ -101,7 +134,7 @@ namespace OnlineStore.Common ...@@ -101,7 +134,7 @@ namespace OnlineStore.Common
try try
{ {
var wc = new MyWebClient(5000); var wc = new MyWebClient(10000);
if (string.IsNullOrEmpty(wc.Headers["Content-Type"])) if (string.IsNullOrEmpty(wc.Headers["Content-Type"]))
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8"); wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
wc.Encoding = encoding; wc.Encoding = encoding;
...@@ -111,7 +144,7 @@ namespace OnlineStore.Common ...@@ -111,7 +144,7 @@ namespace OnlineStore.Common
} }
catch (Exception e) catch (Exception e)
{ {
LogUtil.error(LOGGER, "POST ERROR:" + e.StackTrace, 1); LogUtil.error(LOGGER, "POST ERROR:" + e.ToString(), 1);
} }
if (!result.Contains("null") && result.Length != 0) if (!result.Contains("null") && result.Length != 0)
{ {
...@@ -119,7 +152,7 @@ namespace OnlineStore.Common ...@@ -119,7 +152,7 @@ namespace OnlineStore.Common
} }
if (isLog == 1) if (isLog == 1)
{ {
LOGGER.Info("收到服务器数据【" + result + "】"); LogUtil.info("收到服务器数据【" + result + "】");
} }
return result; return result;
} }
......
...@@ -5,7 +5,7 @@ using System.Text; ...@@ -5,7 +5,7 @@ using System.Text;
using log4net; using log4net;
using System.Reflection; using System.Reflection;
using System.Drawing; using System.Drawing;
using System.Runtime.ExceptionServices;
namespace OnlineStore.Common namespace OnlineStore.Common
{ {
...@@ -109,6 +109,8 @@ namespace OnlineStore.Common ...@@ -109,6 +109,8 @@ namespace OnlineStore.Common
} }
private static List<string> logList = new List<string>(); private static List<string> logList = new List<string>();
public static string LastText = ""; public static string LastText = "";
[HandleProcessCorruptedStateExceptions]
private static void ShowLogPro(string msg, Color color) private static void ShowLogPro(string msg, Color color)
{ {
try try
...@@ -149,6 +151,10 @@ namespace OnlineStore.Common ...@@ -149,6 +151,10 @@ namespace OnlineStore.Common
} }
} }
} }
catch (AccessViolationException e)
{
LOGGER.Error( " ShowLogPro 出错:" + e.ToString());
}
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("出错:" + ex.ToString()); LOGGER.Error("出错:" + ex.ToString());
......
...@@ -53,7 +53,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -53,7 +53,7 @@ namespace OnlineStore.DeviceLibrary
serverConnectTimer.Enabled = false; serverConnectTimer.Enabled = false;
serverConnectTimer.Elapsed += server_connect_timer_Tick; serverConnectTimer.Elapsed += server_connect_timer_Tick;
IoCheckTimer = new System.Timers.Timer(); IoCheckTimer = new System.Timers.Timer();
IoCheckTimer.Interval = 200; IoCheckTimer.Interval = 300;
IoCheckTimer.AutoReset = true; IoCheckTimer.AutoReset = true;
IoCheckTimer.Enabled = false; IoCheckTimer.Enabled = false;
IoCheckTimer.Elapsed += IoCheckTimer_Elapsed; IoCheckTimer.Elapsed += IoCheckTimer_Elapsed;
...@@ -71,7 +71,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -71,7 +71,7 @@ namespace OnlineStore.DeviceLibrary
PositionNumList = new List<string>(); PositionNumList = new List<string>();
foreach (ACStorePosition position in positionList) foreach (ACStorePosition position in positionList)
{ {
// if (position.StoreId.Equals(StoreID)) // if (position.StoreId.Equals(StoreID))
{ {
bool result = ACStorePosition.CheckPosition(position, Config); bool result = ACStorePosition.CheckPosition(position, Config);
if (result) if (result)
...@@ -107,17 +107,27 @@ namespace OnlineStore.DeviceLibrary ...@@ -107,17 +107,27 @@ namespace OnlineStore.DeviceLibrary
{ {
if (isInSuddenDown.Equals(false)) if (isInSuddenDown.Equals(false))
{ {
isInSuddenDown = true; LogUtil.error(StoreName + "收到急停信号,等待100后再次验证急停");
LogUtil.error(LOGGER, StoreName + "收到急停信号,报警急停"); Task.Factory.StartNew(delegate
WarnMsg = StoreName + "收到急停信号,报警急停"; {
Thread.Sleep(100);
if (IOManager.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
isInSuddenDown = true;
LogUtil.error(LOGGER, StoreName + "收到急停信号,报警急停");
WarnMsg = StoreName + "收到急停信号,报警急停";
//报警时会关闭所有轴
Alarm(StoreAlarmType.SuddenStop, "1", WarnMsg, StoreMoveType.None);
}
//报警时会关闭所有轴 });
Alarm(StoreAlarmType.SuddenStop, "1", WarnMsg, StoreMoveType.None);
} }
} }
} }
} }
/// <summary> /// <summary>
/// 配置速度,加减速时间 /// 配置速度,加减速时间
/// </summary> /// </summary>
...@@ -1183,7 +1193,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -1183,7 +1193,16 @@ namespace OnlineStore.DeviceLibrary
#region 入库命令处理 #region 入库命令处理
private int StrToInt(string str)
{
try
{
return Convert.ToInt32(str.Trim());
}catch(Exception ex)
{
LogUtil.error(StoreName + "转换["+str+"]出错:" + ex.ToString());
}return 0;
}
private void ReviceInStoreProcess(string message, Operation resultOperation) private void ReviceInStoreProcess(string message, Operation resultOperation)
{ {
Dictionary<string, string> data = resultOperation.data; Dictionary<string, string> data = resultOperation.data;
...@@ -1191,8 +1210,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1191,8 +1210,10 @@ namespace OnlineStore.DeviceLibrary
{ {
//服务器返回时有:posId库位编号,plateW:料盘宽度,plateH:料盘高度, //服务器返回时有:posId库位编号,plateW:料盘宽度,plateH:料盘高度,
string posId = data[ParamDefine.posId]; string posId = data[ParamDefine.posId];
string plateW = data[ParamDefine.plateW]; string plateWStr = data[ParamDefine.plateW];
string plateH = data[ParamDefine.plateH]; string plateHStr = data[ParamDefine.plateH];
int plateW = StrToInt(plateWStr);
int plateH = StrToInt(plateHStr);
InOutPosInfo inoutInfo = new InOutPosInfo(message, posId, plateH, plateW); InOutPosInfo inoutInfo = new InOutPosInfo(message, posId, plateH, plateW);
//根据发送的posId获取位置列表 //根据发送的posId获取位置列表
...@@ -1221,7 +1242,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1221,7 +1242,7 @@ namespace OnlineStore.DeviceLibrary
} }
public bool ReviceLineCheckInStoreCMD(string posId, string plateH, string plateW, string message, string rfid) public bool ReviceLineCheckInStoreCMD(string posId, int plateH, int plateW, string message, string rfid)
{ {
string logName = "入库库位验证【 " + message + "】【" + posId + "】:"; string logName = "入库库位验证【 " + message + "】【" + posId + "】:";
try try
...@@ -1265,7 +1286,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1265,7 +1286,7 @@ namespace OnlineStore.DeviceLibrary
} }
return false; return false;
} }
public void ReviceLineInStoreCMD(string posId, string plateH, string plateW, string message,string rfid) public void ReviceLineInStoreCMD(string posId, int plateH, int plateW, string message,string rfid)
{ {
string logName = "流水线入库命令【 " + message + "】【" + posId + "】:"; string logName = "流水线入库命令【 " + message + "】【" + posId + "】:";
if (!LineConnect.WaitInStoreList.Contains(posId)) if (!LineConnect.WaitInStoreList.Contains(posId))
...@@ -1444,13 +1465,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -1444,13 +1465,19 @@ namespace OnlineStore.DeviceLibrary
private string CodeMsg = ""; private string CodeMsg = "";
private bool isInProcess = false; private bool isInProcess = false;
private DateTime lastConTime = DateTime.Now;
public void server_connect_timer_Tick(object sender, EventArgs e) public void server_connect_timer_Tick(object sender, EventArgs e)
{ {
if (isInProcess) if (isInProcess)
{ {
return; TimeSpan span = DateTime.Now - lastConTime;
} if (span.TotalSeconds < 60)
{
return;
}
}
isInProcess = true; isInProcess = true;
lastConTime = DateTime.Now;
try try
{ {
if (LineConnect.IsConnect()) if (LineConnect.IsConnect())
...@@ -1483,7 +1510,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1483,7 +1510,10 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.error("server_connect_timer_Tick出错:"+ex.ToString()); LogUtil.error("server_connect_timer_Tick出错:"+ex.ToString());
} }
isInProcess = false; finally
{
isInProcess = false;
}
} }
/// <summary> /// <summary>
...@@ -1675,8 +1705,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -1675,8 +1705,11 @@ namespace OnlineStore.DeviceLibrary
foreach (string posId in posIdArray) foreach (string posId in posIdArray)
{ {
index++; index++;
string plateW = plateWArray[index]; string plateWStr = plateWArray[index];
string plateH = plateHArray[index]; string plateHStr = plateHArray[index];
int plateW = StrToInt(plateWStr);
int plateH = StrToInt(plateHStr);
InOutPosInfo intouInfo = new InOutPosInfo(barcode, posId, plateW, plateH, urgentReel, cutReel, smallReel, rfid, rfidLoc); InOutPosInfo intouInfo = new InOutPosInfo(barcode, posId, plateW, plateH, urgentReel, cutReel, smallReel, rfid, rfidLoc);
//根据发送的posId获取位置列表 //根据发送的posId获取位置列表
......
...@@ -98,6 +98,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -98,6 +98,15 @@ namespace OnlineStore.DeviceLibrary
return Store; return Store;
} }
/// <summary> /// <summary>
/// 获取定位库位信息
/// </summary>
public static string GetLocationPosId(int width)
{
string config = ConfigAppSettings.GetValue(Setting_Init.Location_PosID_ + width);
return config;
}
/// <summary>
/// 修改了料仓配置,更新缓存,更新配置文件(只能更新PRO的配置) /// 修改了料仓配置,更新缓存,更新配置文件(只能更新PRO的配置)
/// </summary> /// </summary>
/// <param name="kTK_LA_Store_Config"></param> /// <param name="kTK_LA_Store_Config"></param>
......
...@@ -194,8 +194,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -194,8 +194,8 @@ namespace OnlineStore.DeviceLibrary
public string Cmd = ""; public string Cmd = "";
public int CanOutStore = 0; public int CanOutStore = 0;
public string PosId = ""; public string PosId = "";
public string PlateH = "0"; public int PlateH =0;
public string PlateW = "0"; public int PlateW = 0;
public string WareCode = ""; public string WareCode = "";
public int IsDebug = 0; public int IsDebug = 0;
public string rfid = ""; public string rfid = "";
......
...@@ -49,14 +49,38 @@ namespace OnlineStore.DeviceLibrary ...@@ -49,14 +49,38 @@ namespace OnlineStore.DeviceLibrary
} }
public InOutPosInfo PosInfo { get; set; } public InOutPosInfo PosInfo { get; set; }
public LineMoveP MoveP { get; set; } public LineMoveP MoveP { get; set; }
public ACStorePosition LocationPos = null;
public bool LoadLocationP()
{
if (LocationPos == null)
{
string posId = StoreManager.GetLocationPosId(PosInfo.PlateW);
if (!String.IsNullOrEmpty(posId))
{
LocationPos = CSVPositionReader<ACStorePosition>.GetPositon(posId);
}
}
if (LocationPos == null)
{
LogUtil.info(PosInfo.ToStr() + " 出库 不需要定位 ");
return false;
}
else
{
LogUtil.info(PosInfo.ToStr() + " 出库前 需要定位【" + LocationPos.PositionNum + "】 ");
return true;
}
}
} /// <summary> } /// <summary>
/// 夹具编码信息(保存夹具检测到的IO数值,和对应的料仓位置) /// 夹具编码信息(保存夹具检测到的IO数值,和对应的料仓位置)
/// </summary> /// </summary>
public class InOutPosInfo public class InOutPosInfo
{ {
public InOutPosInfo(string barcode, string posId, string platew = "", string plateh = "", bool urgentReel = false , bool cutReel = false, bool smallReel = false, string rfid = "", int rfidLoc = 0) public InOutPosInfo(string barcode, string posId, int platew =0, int plateh =0, bool urgentReel = false , bool cutReel = false, bool smallReel = false, string rfid = "", int rfidLoc = 0)
{ {
this.barcode = barcode; this.barcode = barcode;
this.PosId = posId; this.PosId = posId;
...@@ -80,11 +104,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -80,11 +104,11 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 料盘宽 /// 料盘宽
/// </summary> /// </summary>
public string PlateW { get; set; } public int PlateW { get; set; }
/// <summary> /// <summary>
/// 料盘高 /// 料盘高
/// </summary> /// </summary>
public string PlateH { get; set; } public int PlateH { get; set; }
/// <summary> /// <summary>
/// urgentReel: true 表示紧急料,需要出到料串上 /// urgentReel: true 表示紧急料,需要出到料串上
...@@ -112,9 +136,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -112,9 +136,8 @@ namespace OnlineStore.DeviceLibrary
public int rfidLoc { get; set; } public int rfidLoc { get; set; }
public string ToStr() public string ToStr()
{ {
return " barcode[" + barcode + "],PosId [" + PosId + "],plateW [" + PlateW + "],plateH [" + PlateH + "],urgentReel [" + urgentReel return " [" + barcode + "] [" + PosId + "] [" + PlateW + "x" + PlateH + "],urgentReel [" + urgentReel
+ "],cutReel [" + cutReel + "],smallReel [" + smallReel + "],rfid [" + rfid + "],rfidLoc [" + rfidLoc + "]"; + "],cutReel [" + cutReel + "],smallReel [" + smallReel + "],rfid [" + rfid + "],rfidLoc [" + rfidLoc + "]";
} }
} }
} }
...@@ -465,7 +465,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -465,7 +465,17 @@ namespace OnlineStore.DeviceLibrary
} }
if (!aa.Equals("")) if (!aa.Equals(""))
{ {
return sta + "_" + aa;
string inout = "";
if (StoreMove.MoveType.Equals(StoreMoveType.InStore)&& StoreMove.MoveParam!=null&& StoreMove.MoveParam.PosInfo!=null)
{
inout = "_入库:"+StoreMove.MoveParam.PosInfo.ToStr();
}
else if (StoreMove.MoveType.Equals(StoreMoveType.OutStore) && StoreMove.MoveParam != null && StoreMove.MoveParam.PosInfo != null)
{
inout = "_出库:" + StoreMove.MoveParam.PosInfo.ToStr();
}
return sta + "_" + aa+inout;
} }
else else
{ {
......
...@@ -24,12 +24,12 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -24,12 +24,12 @@ namespace OnlineStore.LoadCSVLibrary
/// 升降轴(库位出料前点)P5 /// 升降轴(库位出料前点)P5
/// </summary> /// </summary>
[CSVAttribute("升降轴库位出料前点P5")] [CSVAttribute("升降轴库位出料前点P5")]
public int UpDownAxis_OHPosition_P5 { get; set; } public int UpDownAxis_OLPosition_P5 { get; set; }
/// <summary> /// <summary>
/// 升降轴(库位出料缓冲点)P6 /// 升降轴(库位出料缓冲点)P6
/// </summary> /// </summary>
[CSVAttribute("升降轴库位出料缓冲点P6")] [CSVAttribute("升降轴库位出料缓冲点P6")]
public int UpDownAxis_OLPosition_P6 { get; set; } public int UpDownAxis_OHPosition_P6 { get; set; }
/// <summary> /// <summary>
/// 升降轴(库位入料前点)P3 /// 升降轴(库位入料前点)P3
/// </summary> /// </summary>
...@@ -107,12 +107,12 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -107,12 +107,12 @@ namespace OnlineStore.LoadCSVLibrary
LogUtil.error(position.PositionNum + " UpDownAxis_ILPosition_P4位置超出" + Config.UpDown_Axis.Explain + "上下限(" + uMin + "-" + uMax + ")"); LogUtil.error(position.PositionNum + " UpDownAxis_ILPosition_P4位置超出" + Config.UpDown_Axis.Explain + "上下限(" + uMin + "-" + uMax + ")");
return false; return false;
} }
if (uMin > position.UpDownAxis_OHPosition_P5 || uMax < position.UpDownAxis_OHPosition_P5) if (uMin > position.UpDownAxis_OLPosition_P5 || uMax < position.UpDownAxis_OLPosition_P5)
{ {
LogUtil.error(position.PositionNum + " UpDownAxis_OHPosition_P5位置超出" + Config.UpDown_Axis.Explain + "上下限(" + uMin + "-" + uMax + ")"); LogUtil.error(position.PositionNum + " UpDownAxis_OHPosition_P5位置超出" + Config.UpDown_Axis.Explain + "上下限(" + uMin + "-" + uMax + ")");
return false; return false;
} }
if (uMin > position.UpDownAxis_OLPosition_P6 || uMax < position.UpDownAxis_OLPosition_P6) if (uMin > position.UpDownAxis_OHPosition_P6 || uMax < position.UpDownAxis_OHPosition_P6)
{ {
LogUtil.error(position.PositionNum + " UpDownAxis_OLPosition_P6位置超出" + Config.UpDown_Axis.Explain + "上下限(" + uMin + "-" + uMax + ")"); LogUtil.error(position.PositionNum + " UpDownAxis_OLPosition_P6位置超出" + Config.UpDown_Axis.Explain + "上下限(" + uMin + "-" + uMax + ")");
return false; return false;
......
...@@ -178,7 +178,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -178,7 +178,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
else else
{ {
if (array.Length == titleIndex.Count) if (array.Length >= titleIndex.Count)
{ {
if (csvIndex < 0) if (csvIndex < 0)
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!