Commit 9895791e 几米阳光

1.测高AI模块BUG修改。

2.出库增加缓存功能,若出库失败也放入缓存。
1 个父辈 082ccb10
......@@ -68,11 +68,11 @@ namespace OnlineStore.DeviceLibrary
MBmaster.OnException += new AITcpClient.ExceptionData(MBmaster_OnException);
MBmaster.autoConnectOfBreak = false;
mastMap.Add(ioIp, MBmaster);
LogUtil.info(LOGGER, "连接AI模块[" + ioIp + "]成功");
Thread.Sleep(10);
WriteAIScope(ioIp, 1);
Thread.Sleep(10);
ReadAll(ioIp);
LogUtil.info(LOGGER, "连接AI模块[" + ioIp + "]成功");
}
catch (Exception error)
{
......@@ -157,8 +157,8 @@ namespace OnlineStore.DeviceLibrary
Thread.Sleep(2);
isProcess = false;
}
private static void WriteAIScope(string ioIp,int value)
private static void WriteAIScope(string ioIp, int value)
{
// 0 表示 0 - 10V, 1 表示 0 - 5V
WriteAIScope(ioIp, DefualtSlaveID, "03EA", value);
......@@ -202,17 +202,17 @@ namespace OnlineStore.DeviceLibrary
}
mastMap.Clear();
}
public static double ConvertAI(double aiValue,double defaultValue )
public static double ConvertAI(double aiValue, double defaultValue)
{
double xishu =(double) ConfigAppSettings.GetNumValue(Setting_Init.AI_ConvertPosition);
double result= Math.Round((aiValue-defaultValue)/xishu,2);
double xishu = (double)ConfigAppSettings.GetNumValue(Setting_Init.AI_ConvertPosition);
double result = Math.Round((aiValue - defaultValue) / xishu, 2);
return result;
}
public static double GetAIValue(string ioiP, int index)
{
double aiValue = GetAIValue(ioiP, DefualtSlaveID, index-1);
return Math.Round(aiValue,2);
double aiValue = GetAIValue(ioiP, DefualtSlaveID, index - 1);
return Math.Round(aiValue, 2);
}
public static double GetAIValue(string ioIP, byte slaveId, int index)
......@@ -284,7 +284,7 @@ namespace OnlineStore.DeviceLibrary
}
try
{
if (StoreManager.Store.KNDIOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH))
if (StoreManager.Store != null && StoreManager.Store.KNDIOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH))
{
if (StoreManager.Config.AIDI1_Addr > 0 && StoreManager.Config.AIDI2_Addr > 0)
{ //每次上传后验证下
......@@ -298,7 +298,7 @@ namespace OnlineStore.DeviceLibrary
// ConnectionIP(ioIp);
}
}
else if(StoreManager.Config.AIDI3_Addr > 0 && StoreManager.Config.AIDI4_Addr > 0)
else if (StoreManager.Config.AIDI3_Addr > 0 && StoreManager.Config.AIDI4_Addr > 0)
{ //每次上传后验证下
int v1 = (int)GetAIValue(ioIp, StoreManager.Config.AIDI3_Addr);
int v2 = (int)GetAIValue(ioIp, StoreManager.Config.AIDI4_Addr);
......@@ -311,6 +311,7 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
catch (Exception ex)
{
......@@ -349,7 +350,7 @@ namespace OnlineStore.DeviceLibrary
break;
}
}
// LOGGER.Info ("Read data:【" + reviceMsg + "】 ");
// LOGGER.Info ("Read data:【" + reviceMsg + "】 ");
if (ID == 0xFF)
{
return;
......@@ -392,9 +393,9 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "处理接受数据出错:" + ex.ToString());
LogUtil.error(LOGGER, "处理接受数据出错:" + ex.ToString());
}
}
}
private static void MBmaster_OnException(string ioIp, ushort id, byte function, byte exception, byte[] reviceData)
{
string exc = "Modbus says error: ";
......@@ -413,7 +414,7 @@ namespace OnlineStore.DeviceLibrary
default:
break;
}
LOGGER.Error("接收数据出错:" + exc);
LOGGER.Error("接收数据出错:" + exc);
}
}
......
......@@ -1225,7 +1225,12 @@ namespace OnlineStore.DeviceLibrary
if (currInOutFixture.WareNum.Equals(""))
{
LogUtil.info(LOGGER, StoreName + "开始执行排队中的出库【" + currInOutFixture.ToStr() + "】");
StartOutStoreMove(new InOutStoreParam("", currInOutFixture.PosId, currInOutFixture.plateH, currInOutFixture.plateW));
bool result = StartOutStoreMove(new InOutStoreParam("", currInOutFixture.PosId, currInOutFixture.plateH, currInOutFixture.plateW));
if (!result)
{
LogUtil.info(LOGGER, StoreName + " 执行排队中的出库【" + currInOutFixture.ToStr() + "】失败,重新加入等待队列");
AddWaitOutInfo(currInOutFixture);
}
}
}
}
......@@ -1950,13 +1955,20 @@ namespace OnlineStore.DeviceLibrary
}
else
{
FixtureCodeInfo currInOutFixture = new FixtureCodeInfo(0, "", posId, plateW, plateH);
if (CanStarInOut())
{
StartOutStoreMove(new InOutStoreParam("", posId, position));
bool result = StartOutStoreMove(new InOutStoreParam("", posId, position));
if (!result)
{
LogUtil.info(LOGGER, StoreName + " 执行出库【" + currInOutFixture.ToStr() + "】失败,加入等待队列");
AddWaitOutInfo(currInOutFixture);
}
}
else
{
LogUtil.error(LOGGER, "收到服务器出库命令:出库【" + posId + "】失败,当前在忙碌中");
LogUtil.error(LOGGER, "执行出库【" + currInOutFixture.ToStr() + "】失败,当前在忙碌中,加入等待队列");
AddWaitOutInfo(currInOutFixture);
}
}
......
......@@ -517,7 +517,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始出库运动
/// </summary>
public override void StartOutStoreMove(InOutStoreParam param)
public override bool StartOutStoreMove(InOutStoreParam param)
{
startOutStoreTime = DateTime.Now;
string posId = param != null ? param.PositionNum : "";
......@@ -526,12 +526,12 @@ namespace OnlineStore.DeviceLibrary
if (!LoadParamPosition(param))
{
LogUtil.error(LOGGER, StoreName + " 启动出库【" + posId + "】出错,找不到库位信息");
return;
return false ;
}
if (KNDIOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{
LogUtil.error(LOGGER, StoreName + " 启动出库【" + posId + "】出错,叉子料盘检测有料");
return;
return false ;
}
storeStatus = StoreStatus.OutStoreExecute;
LogUtil.info(LOGGER, StoreName + "启动出库【" + posId + "】 ", storeMoveColor);
......@@ -552,11 +552,13 @@ namespace OnlineStore.DeviceLibrary
OutStoreLog("出库:SO_01 定位气缸下降");
LocationDownAndWait();
}
return true;
}
else
{
LogUtil.error(LOGGER, StoreName + " 启动出库出错,当前状态,storeStatus=" + storeRunStatus);
}
return false;
}
protected override void OutStoreProcess()
{
......
......@@ -89,7 +89,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始出库运动
/// </summary>
public abstract void StartOutStoreMove(InOutStoreParam param);
public abstract bool StartOutStoreMove(InOutStoreParam param);
protected abstract void OutStoreProcess();
#endregion
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!