Commit 50de5b93 LN

出库逻辑修改

1 个父辈 37cc5182
......@@ -75,11 +75,12 @@
错误信息
</summary>
</member>
<member name="M:Asa.IOModule.AIOBOX.LogPath(System.String)">
<member name="M:Asa.IOModule.AIOBOX.LogPath(System.String,Asa.IOModule.LogType)">
<summary>
日志路径,连接前设置路径会自动保存日志
</summary>
<param name="path">文件夹路径</param>
<param name="type">输出类型</param>
</member>
<member name="M:Asa.IOModule.AIOBOX.SetInput(Asa.IOModule.Box_Type,System.Int32)">
<summary>
......@@ -113,7 +114,6 @@
<summary>
连接
</summary>
<returns></returns>
</member>
<member name="M:Asa.IOModule.AIOBOX.Close">
<summary>
......@@ -326,6 +326,21 @@
闭合,打开,高电平
</summary>
</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>
日志操作类
......@@ -336,7 +351,7 @@
日志
</summary>
<param name="path">文件夹路径</param>
<param name="args"></param>
<param name="ip"></param>
</member>
<member name="M:Asa.IOModule.LogFile.Close">
<summary>
......
......@@ -203,6 +203,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="box.ico" />
<Content Include="resources\resources.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="记录.txt" />
</ItemGroup>
<ItemGroup>
......
......@@ -49,7 +49,7 @@
<add key="AIOAutoUpload" value="0" />
<!--AGV调度服务器地址-->
<add key="AgvServerIp" value="10.85.160.20" />
<add key="CodeCount" value="2" />
<add key="CodeCount" value="3" />
<add key="Tool_P3_Offset" value="7000" />
<add key="Tool_P4_Offset" value="-2000" />
<add key="Tool_P5_Offset" value="-2000" />
......@@ -57,7 +57,7 @@
<add key="Tool_TargetSpeed" value="20" />
<add key="Tool_TargetPosition" value="1835000" />
<!--是否启用入料口移门,1=启用,0=禁用-->
<add key="UseDoor" value="0" />
<add key="UseDoor" value="1" />
<add key="Agv_Log_Open" value="1" />
<add key="AutoShelfInstore" value="1" />
</appSettings>
......
......@@ -151,6 +151,7 @@ namespace OnlineStore.ACPackingStore
LoadOk = true;
}
lblTemp.Text = BoxBean.humBean.currTempStr;
lblWarnMsg.Text = BoxBean.GetWarnMsg();
lblMoveInfo.Text = BoxBean.GetMoveStr();
if (BoxBean.MoveInfo.MoveType.Equals(StoreMoveType.OutStore) || BoxBean.MoveInfo.MoveType.Equals(StoreMoveType.InStore))
......@@ -802,7 +803,7 @@ namespace OnlineStore.ACPackingStore
private void btnScanTest_Click(object sender, EventArgs e)
{
BoxBean. IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
List<string> codes = CodeManager.CameraScan(BoxBean.Config.GetCameraList());
List<string> codes = CodeManager.CameraScan(BoxBean.Config.GetCameraList(),BoxBean.Name);
BoxBean.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
string result = "";
if (codes.Count > 0)
......
......@@ -37,6 +37,8 @@ namespace OnlineStore.ACPackingStore
private void FrmMain_Load(object sender, EventArgs e)
{
// ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>("{\"code\":0,\"msg\":\"ok\",\"data\":{\"taskCount\":\"2\"}}");
FrmBase.GetVersion();
store = StoreManager.InitStore();
if (store == null)
......
FrmCodeDecode_Text,二维码识别,Qr code recognition
FrmCodeDecode_label4_Text,参数路径,Parameters of the path
FrmCodeDecode_chbUseParam_Text,使用参数,operation parameter
FrmCodeDecode_btnAn_Text,变暗,darken
FrmCodeDecode_btnLight_Text,提亮,brighten
FrmCodeDecode_label3_Text,条码类型:,Bar code type:
FrmCodeDecode_label2_Text,相机列表:,Camera list:
FrmCodeDecode_btnExit_Text,退出,Exit
FrmCodeDecode_btnCameraImage_Text,相机获取图片,camera image
FrmCodeDecode_lblCount_Text,条码数量:,Barcode number:
FrmCodeDecode_btnClearLog_Text,清理日志,Clear log
FrmCodeDecode_btnDCode_Text,二维码识别,Qr code recognition
FrmCodeDecode_btnLearn_Text,学习,learn
FrmCodeDecode_btnbarCode_Text,一维码识别,One dimensional code recognition
FrmCodeDecode_btnGray_Text,图像转灰,Turning grey
FrmCodeDecode_btnErZhi_Text,二值化,binaryzation 
FrmCodeDecode_btnSelImage_Text,打开本地图片,Open local image
FrmCodeDecode_label1_Text,图片路径,Image path
FrmCodeLearn_Text,条码参数学习,Bar code parameter learning
FrmCodeLearn_chbHalcon_Text,Halcon获取图片,Halcon Get photo
FrmCodeLearn_label4_Text,图片路径,Image path
FrmCodeLearn_btnDelOld_Text,删除旧参数,Delete old parameter
FrmCodeLearn_chbUseCamera_Text,相机获取实时图片,camera image
FrmCodeLearn_btnSelImage_Text,打开本地图片,Open local image
FrmCodeLearn_chbTest_Text,学习结束自动识别测试,Automatic identification test
FrmCodeLearn_btnClearLog_Text,清理日志,Clear log
FrmCodeLearn_lblCount_Text,条码数量:,Barcode number:
FrmCodeLearn_label3_Text,参数路径,Parameters of the path
FrmCodeLearn_label2_Text,类型:,Type:
FrmCodeLearn_label1_Text,相机:,camera:
FrmCodeLearn_btnExit_Text,退出,Exit
FrmCodeLearn_btnStop_Text,结束学习,End of learning
FrmCodeLearn_btnOpen_Text,开始学习,start to learn
selCamera,请先选择相机,Please select camera
selImage,请先选择图片,Please select picture
title,提示,Notice
imageIsNull,获取二维码图片为空,Get the two-dimensional code picture is empty
sureDelete,确定删除文件:,Make sure to delete the file:
\ No newline at end of file
......@@ -89,6 +89,8 @@ httpPost方法增加验证,若ping不同则不再发送。
20200307
shelfLoc问题修改。
20200308
扫码问题优化。
......
......@@ -14,7 +14,7 @@ namespace OnlineStore.Common
public static readonly ILog AIOLog = LogManager.GetLogger("AIOBOXLog");
private static LogUtil instance = new LogUtil();
public delegate void ShowLog(string msg, Color color);
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static readonly ILog LOGGER = LogManager.GetLogger("RollingLogFileAppender");
public static Dictionary<int, DateTime> lastErrorLogTime = new Dictionary<int, DateTime>();
......
......@@ -195,7 +195,11 @@ namespace OnlineStore.DeviceLibrary
public string GetWarnMsg()
{
string msg= WarnMsg;
string msg = WarnMsg;
if (alarmType.Equals(StoreAlarmType.None).Equals(false))
{
msg= LastAlarmTime.ToLongTimeString() + " " + WarnMsg + " ";
}
//if (IOValue(IO_Type.DoorLimit).Equals(IO_VALUE.LOW))
//{
// msg = msg + " 无门禁信号";
......@@ -470,9 +474,13 @@ namespace OnlineStore.DeviceLibrary
TimeSpan span = DateTime.Now - StartTime;
LogInfo(",停止运行,总运行时间:" + span.ToString());
}
public DateTime LastAlarmTime = DateTime.Now;
public override void Alarm(StoreAlarmType alarmType, string alarmDetial, string alarmMsg, StoreMoveType storeMoveType)
{
if (alarmType.Equals(StoreAlarmType.None).Equals(false))
{
LastAlarmTime = DateTime.Now;
}
SaveAlarmInfo(alarmType, alarmDetial, alarmMsg, storeMoveType);
AutoInout.StopAuto();
......
......@@ -62,7 +62,7 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = IOValue(wait.IoType).Equals(wait.IoValue);
int timeOutMs = Config.IOSingle_TimerOut;
if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_07_WaitInLineSingle)||
if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_08_WaitInLineSingle)||
MoveInfo.MoveStep.Equals(StoreMoveStep.BI_04_WaitTakeSingle))
{
timeOutMs = 30000;
......@@ -73,9 +73,9 @@ namespace OnlineStore.DeviceLibrary
if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs && NoAlarm())
{
ConfigIO io = Config.getWaitIO(wait.IoType);
WarnMsg = Name + " 等待信号" + io.DisplayStr + "=" + wait.IoValue + "超时!";
WarnMsg = Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "] 等待(" + io.DisplayStr + "=" + wait.IoValue + ") 超时";
Alarm(StoreAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, MoveInfo.MoveType);
LogUtil.error(Name + wait.IoType + "等待信号(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", logType+14);
LogUtil.error(Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "] 等待(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", logType+14);
isOk = false;
break;
}
......@@ -176,9 +176,20 @@ namespace OnlineStore.DeviceLibrary
}
else if (span.TotalSeconds > MoveInfo.TimeOutSeconds)
{
WarnMsg = Name + "【" + MoveInfo.MoveType + "】【" + MoveInfo.MoveStep + "】等待超时 [" + NotOkMsg
+ "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, logType+100);
WarnMsg = Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待" + NotOkMsg
+ "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
int second = 10;
second = (int)(MoveInfo.TimeOutSeconds / span.TotalSeconds) * 10;
if (second > 120)
{
second = 120;
}
else if (second < 10)
{
second = 10;
}
LogUtil.error(WarnMsg, logType+100,second);
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, MoveInfo.MoveType);
}
}
......@@ -472,12 +483,17 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StoreMoveStep.BI_25_ScanCode);
InOutStoreLog("扫码 " + MoveInfo.SLog + ":料盘识别 [" + io1 + "] [" + io2 + "] [" + io3 + "] [" + io4 + "] ,宽度【" + LastWidth + "】,开始扫码");
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(6000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(12000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitCode());
Task.Factory.StartNew(delegate
{
IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LastScanCodes = CodeManager.CameraScan(Config.GetCameraList());
LastScanCodes = CodeManager.CameraScan(Config.GetCameraList(),Name);
if (LastScanCodes.Count <= 0)
{
Thread.Sleep(1);
LastScanCodes = CodeManager.CameraScan(Config.GetCameraList(), Name);
}
IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
});
}
......@@ -984,7 +1000,7 @@ namespace OnlineStore.DeviceLibrary
isNeedSend = true;
}
}
else if (MoveInfo.MoveParam.taskCount <= 1)
else if (MoveInfo.MoveParam.taskCount <=0)
{
InOutStoreLog("出库完成,料架【" + CurrShelfID + "】没有出库任务,taskCount=" + MoveInfo.MoveParam.taskCount + " 送出料架");
isNeedSend = true;
......
......@@ -173,16 +173,16 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveType.Equals(StoreMoveType.OutStore))
{
string mark = GetMarkInfo();
InOutStoreLog("送出出库料架:顶升气缸下降,调用 NeedLeave[" + mark + "][" + CurrShelfID + "],清空料架clearPutInRfid[" + CurrShelfID + "]");
InOutStoreLog("送出出库料架:顶升气缸下降,调用 NeedLeave[" + mark + "][" + CurrShelfID + "] ");
AgvClient.NeedLeave(Config.AgvNodeName, mark, CurrShelfID);
}
else
{
InOutStoreLog("送出空料架:顶升气缸下降,调用 NeedLeave[0][" + CurrShelfID + "],清空料架clearPutInRfid[" + CurrShelfID + "]");
AgvClient.NeedLeave(Config.AgvNodeName,"0", CurrShelfID);
StoreManager.clearPutInRfid(Name, CurrShelfID);
}
CylinderMove(MoveInfo, IO_Type.TopCylinder_Up, IO_Type.TopCylinder_Down);
StoreManager.clearPutInRfid(Name, CurrShelfID);
}
private string GetMarkInfo()
{
......@@ -261,12 +261,12 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_03_WaitArrive);
MoveInfo.TimeOutSeconds = 600;
// MoveInfo.OneWaitCanEndStep = true;
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(600000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
InOutStoreLog(moveName + MoveInfo.SLog + ":再次调用 NeedLeave["+mark+"][" + CurrShelfID + "],等待Agv " + Config.AgvNodeName + " Arrive ,最多等待1200秒");
AgvClient.SetStatus(Config.AgvNodeName, mark, CurrShelfID, ClientAction.NeedLeave, ClientLevel.Low, true);
//等待agv到达
MoveInfo.WaitList.Add(WaitResultInfo.WaitAgvAction((int)ClientAction.Arrive));
MoveInfo.OneWaitCanEndStep = true;
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_03_WaitArrive))
{
......@@ -280,11 +280,21 @@ namespace OnlineStore.DeviceLibrary
}
else
{
//如果料架已被拉出,也算结束
if (IOValue(IO_Type.LineIn_Check).Equals(IO_VALUE.LOW) && IOValue(IO_Type.LineTake_Check).Equals(IO_VALUE.LOW))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_06_LineBackRun);
//如果agv未到达,直接结束
MoveEndToRuningStatus();
//EmprtShelfList = new ConcurrentQueue<string>();
InOutStoreLog(moveName + MoveInfo.SLog + ":等待Agv " + Config.AgvNodeName + " Arrive超时,直接结束");
InOutStoreLog(moveName + MoveInfo.SLog + ":等待Agv " + Config.AgvNodeName + " Arrive超时,检测不到料架信号,认为料架已手动离开");
}
else
{
TimeSpan span = DateTime.Now - MoveInfo.LastSetpTime;
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime((int)span.TotalMilliseconds+ 30000));
InOutStoreLog(moveName + MoveInfo.SLog + ":等待Agv " + Config.AgvNodeName + " Arrive超时,再等待30秒");
}
}
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_04_DoorOpen))
......@@ -306,23 +316,29 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_06_LineBackRun))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_07_WaitInLineSingle);
InOutStoreLog(moveName + MoveInfo.SLog + ":等待取料工位无信号,入料口有信号");
MoveInfo.NextMoveStep(StoreMoveStep.BS_07_WaitShelfOut);
InOutStoreLog(moveName + MoveInfo.SLog + ":等待取料工位无信号 ");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineTake_Check, IO_VALUE.LOW));
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineIn_Check, IO_VALUE.HIGH));
}else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_07_WaitShelfOut))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_08_WaitInLineSingle);
InOutStoreLog(moveName + MoveInfo.SLog + ":等待 入料口有信号,最多等待30秒");
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineTake_Check, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineIn_Check, IO_VALUE.HIGH));
MoveInfo.OneWaitCanEndStep = true;
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_07_WaitInLineSingle))
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_08_WaitInLineSingle))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_08_WaitTime);
MoveInfo.NextMoveStep(StoreMoveStep.BS_09_WaitTime);
InOutStoreLog(moveName + MoveInfo.SLog + ":再转动1000 , 等待入料口无信号");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LineIn_Check, IO_VALUE.LOW));
//等到agv离开
//MoveInfo.WaitList.Add(WaitResultInfo.WaitAgvAction(AGVAction.FinishOut));
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_08_WaitTime))
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_09_WaitTime))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_09_WaitAGVLeave);
MoveInfo.NextMoveStep(StoreMoveStep.BS_10_WaitAGVLeave);
MoveInfo.TimeOutSeconds = 180;
InOutStoreLog(moveName + MoveInfo.SLog + ":等待DoorClose事件,最多等待180000 ");
MoveInfo.OneWaitCanEndStep = true;
......@@ -331,16 +347,16 @@ namespace OnlineStore.DeviceLibrary
//MoveInfo.WaitList.Add(WaitResultInfo.WaitAgvAction(action.FinishOut));
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_09_WaitAGVLeave))
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_10_WaitAGVLeave))
{
MoveInfo.NextMoveStep(StoreMoveStep.BS_10_CloseDoor);
MoveInfo.NextMoveStep(StoreMoveStep.BS_11_CloseDoor);
InOutStoreLog(moveName + MoveInfo.SLog + ":停止线体转动,关闭仓门 ,发送FinishLeave ,等待最少5000");
AgvClient.SetStatus(Config.AgvNodeName, mark, CurrShelfID, ClientAction.FinishLeave, ClientLevel.High, true);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000));
LineStop();
DoorBean.StartClose(MoveInfo);
}
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_10_CloseDoor))
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_11_CloseDoor))
{
//结束
MoveEndToRuningStatus();
......
......@@ -329,7 +329,7 @@ namespace OnlineStore.DeviceLibrary
/// 地址: /rest/api/qisda/device/updateLocInfo
/// </summary>
private static string Addr_updateLocInfo = "/rest/api/qisda/device/updateLocInfo";
public static string UpdateTrayLoc(string deviceName, string barcode, string locInfo,out int taskCount)
public static string UpdateTrayLoc(string deviceName, string barcode, string locInfo, out int taskCount)
{
taskCount = 0;
string msg = "";
......@@ -339,34 +339,39 @@ namespace OnlineStore.DeviceLibrary
{
return msg;
}
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("barcode", barcode);//barcode = 料盘的条码
paramMap.Add("status", "INSHELF"); // status = 状态信息, 移栽 = MOVING, 流水线 = INLINE, 皮带线 = INBELT
paramMap.Add("locInfo", locInfo); // locInfo = 位置信息,移栽时为移栽编号,流水线时为托盘号,皮带线时为皮带线编号,机器人时为机器人编号
string server = GetAddr(Addr_updateLocInfo, paramMap);
string resultStr = HttpHelper.Post(server, "");
LogUtil.info(deviceName+ " ["+locInfo+"] UpdateTrayLoc 【" + server + "】【" + resultStr + "】");
LogUtil.info(deviceName + " [" + locInfo + "] UpdateTrayLoc 【" + server + "】【" + resultStr + "】");
// 返回: { "code": 0, "msg":"ok", "data":""}
//[A04@1] UpdateTrayLoc 【http://10.85.160.25/myproject/rest/api/qisda/device/updateLocInfo?barcode=R006982020013134910&status=INSHELF&locInfo=A04%401】【{"code":0,"msg":"ok","data":{"taskCount":"2"}}】
ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr);
if (serverResult == null)
{
msg = deviceName + "UpdateTrayLoc【 " + barcode + "】【" + "INSHELF" + "】【" + locInfo + "】没有收到服务器反馈";
}
else if (serverResult.code.Equals(0).Equals(false))
else if (serverResult.code.Equals(0))
{
if (serverResult.data != null && (String.IsNullOrEmpty(serverResult.data.taskCount).Equals(false)))
{
try
{
taskCount = Convert.ToInt32(serverResult.data.taskCount);
}catch(Exception ex)
}
catch (Exception ex)
{
}
}
}
else
{
// code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = deviceName + " UpdateTrayLoc【 " + barcode + "】【" + "INSHELF" + "】【" + locInfo + "】 :" + "[" + serverResult.code + "]" + serverResult.msg+ ",taskCount="+ taskCount;
msg = deviceName + " UpdateTrayLoc【 " + barcode + "】【" + "INSHELF" + "】【" + locInfo + "】 :" + "[" + serverResult.code + "]" + serverResult.msg + ",taskCount=" + taskCount;
}
if (!msg.Equals(""))
{
......
位置,优先级,高度,宽度,料仓ID,旋转轴位置P101,升降轴低点P101,升降轴高点P102,进出轴位置P101
198,2,8,7,1,309100,90000,108000,140000
197,3,8,7,1,309100,146000,163000,140000
196,4,8,7,1,309100,203000,220000,140000
195,5,8,7,1,309100,261000,278000,140000
194,6,8,7,1,309100,317000,334000,140000
193,7,8,7,1,309100,374000,392000,140000
192,8,8,7,1,309100,432000,448000,140000
191,9,8,7,1,309100,490000,507000,140000
191,8,8,7,1,309100,490000,507000,140000
192,7,8,7,1,309100,432000,448000,140000
193,6,8,7,1,309100,374000,392000,140000
194,5,8,7,1,309100,317000,334000,140000
195,4,8,7,1,309100,261000,278000,140000
196,3,8,7,1,309100,203000,220000,140000
197,2,8,7,1,309100,146000,163000,140000
198,1,8,7,1,309100,90000,108000,140000
\ No newline at end of file
位置,优先级,高度,宽度,料仓ID,旋转轴位置P101,升降轴低点P101,升降轴高点P102,进出轴位置P101
208,2,8,7,2,308300,90000,107000,140000
207,3,8,7,2,308300,146000,163000,140000
206,4,8,7,2,308300,204000,219000,140000
205,5,8,7,2,308300,260000,276000,140000
204,6,8,7,2,308300,316000,333000,140000
203,7,8,7,2,308300,374000,389000,140000
202,8,8,7,2,308300,431500,450000,140000
201,9,8,7,2,308300,487000,506000,140000
201,8,8,7,2,308300,487000,506000,140000
202,7,8,7,2,308300,431500,450000,140000
203,6,8,7,2,308300,374000,389000,140000
204,5,8,7,2,308300,316000,333000,140000
205,4,8,7,2,308300,260000,276000,140000
206,3,8,7,2,308300,204000,219000,140000
207,2,8,7,2,308300,146000,163000,140000
208,1,8,7,2,308300,90000,107000,140000
\ No newline at end of file
......@@ -9,6 +9,7 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System.Threading.Tasks;
using Asa.IOModule;
using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary
{
......@@ -34,78 +35,77 @@ namespace OnlineStore.DeviceLibrary
public override void ConnectionIOList(List<string> DIONameList)
{
if (conTimer == null)
{
conTimer = new System.Timers.Timer();
conTimer.AutoReset = true;
conTimer.Interval = 10000;
conTimer.Elapsed += ConTimer_Elapsed;
}
conTimer.Enabled = false;
IoIPLIst = new List<string>(DIONameList);
conCount = 3;
//if (conTimer == null)
//{
// conTimer = new System.Timers.Timer();
// conTimer.AutoReset = true;
// conTimer.Interval = 10000;
// conTimer.Elapsed += ConTimer_Elapsed;
//}
//conTimer.Enabled = false;
// IoIPLIst = new List<string>(DIONameList);
// conCount = 3;
foreach (string ip in DIONameList)
{
ConnectionIP(ip);
}
if (IoIPLIst.Count > 0)
{
//启动定时器,1一分钟重连一次
conTimer.Start();
}
//if (IoIPLIst.Count > 0)
//{
// //启动定时器,1一分钟重连一次
// conTimer.Start();
//}
}
private bool isProcess = false;
private DateTime lastTime = DateTime.Now;
private void ConTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
TimeSpan span = DateTime.Now - lastTime;
if (span.TotalMinutes < IoIPLIst.Count && isProcess)
{
return;
}
isProcess = true;
lastTime = DateTime.Now;
try
{
//判断是否还在连接
foreach (AIOBOX box in AIOMap.Values)
{
if (!box.IsConn)
{
if (IoIPLIst.Contains(box.IP).Equals(false))
{
LogUtil.info("IO模块【" + box.IP + "】已断开,加入集合等待重连");
IoIPLIst.Add(box.IP);
}
}
}
}
catch (Exception ex)
{
LogUtil.error("AOI 判断是否需要重连 出错" + ex.ToString());
}
try
{
List<string> list = new List<string>(IoIPLIst);
if (list.Count > 0)
{
LogUtil.info("开始重连IO模块 ------------");
conCount = 1;
foreach (string ip in list)
{
ConnectionIP(ip);
}
LogUtil.info("结束重连IO模块 ------------");
}
GC.Collect();
}
catch (Exception ex)
{
LogUtil.error("AOI ConTimer_Elapsed 出错: " + ex.ToString());
}
isProcess = false;
}
private int conCount = 3;
//private void ConTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
//{
// TimeSpan span = DateTime.Now - lastTime;
// if (span.TotalMinutes < IoIPLIst.Count && isProcess)
// {
// return;
// }
// isProcess = true;
// lastTime = DateTime.Now;
// try
// {
// //判断是否还在连接
// foreach (AIOBOX box in AIOMap.Values)
// {
// if (!box.IsConn)
// {
// if (IoIPLIst.Contains(box.IP).Equals(false))
// {
// LogUtil.info("IO模块【" + box.IP + "】已断开,加入集合等待重连");
// IoIPLIst.Add(box.IP);
// }
// }
// }
// }
// catch (Exception ex)
// {
// LogUtil.error("AOI 判断是否需要重连 出错" + ex.ToString());
// }
// try
// {
// List<string> list = new List<string>(IoIPLIst);
// if (list.Count > 0)
// {
// LogUtil.info("开始重连IO模块 ------------");
// conCount = 1;
// foreach (string ip in list)
// {
// ConnectionIP(ip);
// }
// LogUtil.info("结束重连IO模块 ------------");
// }
// GC.Collect();
// }
// catch (Exception ex)
// {
// LogUtil.error("AOI ConTimer_Elapsed 出错: " + ex.ToString());
// }
// isProcess = false;
//}
public void ConnectionIP(string ioIp)
{
AIOBOX aioBox = null;
......@@ -122,7 +122,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error("关闭Io模块【" + ioIp + "】出错:" + ex);
LogUtil.error("关闭Io模块【" + ioIp + "】出错:"+ ex.ToString());
}
AIOMap.Remove(ioIp);
}
......@@ -151,7 +151,8 @@ namespace OnlineStore.DeviceLibrary
{
// Create new modbus master and add event functions
aioBox = new AIOBOX();
// aioBox.LogPath( Application.StartupPath+@"\logs\aio\");
aioBox.LogPath(Application.StartupPath + @"\logs\aio\", LogType.OnlyError);
aioBox.IP = ioIp;
// bool rtn = aioBox.AutoIP(ioIp);
......@@ -159,41 +160,44 @@ namespace OnlineStore.DeviceLibrary
aioBox.SetInput(Asa.IOModule.Box_Type.DI, DILength);
aioBox.SetOutput(Asa.IOModule.Box_Type.DO, DOLength);
//DI主动上传
aioBox.AutoReadInput(true, DIMS);
aioBox.AutoReadInput(true);
aioBox.AutoReadOutput(false, DOMS);
aioBox.DI_Changed_Event += AioBox_DI_Changed_Event; ;
aioBox.DO_Changed_Event += AioBox_DO_Changed_Event;
// aioBox.Log_Out_Event += AioBox_Log_Out_Event;
//aioBox.Log_RxTx_Event += AioBox_Log_RxTx_Event;
LogUtil.debug("开始连接" + logName + ",尝试重连3次");
for (int i = 1; i <= conCount; i++)
{
bool result = aioBox.Connect();
if (result)
{
LogUtil.info("第【" + i + "】次连接 " + logName + " 成功:" + aioBox.ErrInfo);
if (IoIPLIst.Contains(ioIp))
{
IoIPLIst.Remove(ioIp);
}
// LogUtil.debug("开始连接" + logName + ",尝试重连3次");
// for (int i = 1; i <= conCount; i++)
//{
LogUtil.info("开始连接:" + logName + ":" + aioBox.ErrInfo);
aioBox.Connect();
//bool result = aioBox.Connect();
//if (result)
//{
// LogUtil.info("第【" + i + "】次连接 " + logName + " 成功:" + aioBox.ErrInfo);
//if (IoIPLIst.Contains(ioIp))
//{
// IoIPLIst.Remove(ioIp);
//}
AIOMap.Add(ioIp, aioBox);
Thread.Sleep(10);
Thread.Sleep(5);
//读取所有的DO
ReadAllDI(ioIp, 0);
break;
}
else
{
LogUtil.error("第【" + i + "】次连接 " + logName + " 失败:" + aioBox.ErrInfo + "");
}
// break;
//}
//else
//{
// LogUtil.error("第【" + i + "】次连接 " + logName + " 失败:" + aioBox.ErrInfo + "");
//}
Thread.Sleep(5);
GC.Collect();
}
// }
}
catch (Exception error)
{
......@@ -201,17 +205,17 @@ namespace OnlineStore.DeviceLibrary
}
}
private void AioBox_Reconnect_Event(AIOBOX box, int times, ref bool conn, Dictionary<string, string> dict)
{
conn = true;
string msg = "重连AIO块【" + box.IP + "】次数:" + times + "【" + box.ErrInfo + "】,连接信息如下\r\n";
foreach (string key in dict.Keys)
{
msg = msg + "\t" + "[" + key + "]=[" + dict[key] + "],";
}
LogUtil.error(msg);
//private void AioBox_Reconnect_Event(AIOBOX box, int times, ref bool conn, Dictionary<string, string> dict)
//{
// conn = true;
// string msg = "重连AIO块【" + box.IP + "】次数:" + times + "【" + box.ErrInfo + "】,连接信息如下\r\n";
// foreach (string key in dict.Keys)
// {
// msg = msg + "\t" + "[" + key + "]=[" + dict[key] + "],";
// }
// LogUtil.error(msg);
}
//}
private DateTime lastLogTime = DateTime.Now;
......
......@@ -119,7 +119,7 @@ namespace OnlineStore.DeviceLibrary
if (balserNameList.Contains(cameraName))
{
bool result = BaslerCamera.Instance.Open(cameraName);
// LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
LogUtil.info("相机【" + cameraName + "】打开:" + result + "");
if (result)
{
BaslerCamera.Instance.GrabOne();
......@@ -165,7 +165,7 @@ namespace OnlineStore.DeviceLibrary
}
private static int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount);
[HandleProcessCorruptedStateExceptions]
public static List<string> CameraScan(List<string> cameraList = null)
public static List<string> CameraScan(List<string> cameraList, string deviceName)
{
if (codeCount < 1)
{
......@@ -185,20 +185,23 @@ namespace OnlineStore.DeviceLibrary
{
continue;
}
LogUtil.info(deviceName + " 【" + cameraName + "】开始打开相机获取图片");
using (Bitmap bitmap = GetCamerImage(cameraName))
{
if (bitmap == null)
{
LogUtil.error(" 摄像机【" + cameraName + "】获取图片失败,关闭相机");
LogUtil.error(deviceName + " 【" + cameraName + "】获取图片失败,关闭相机");
CloseCamera();
continue;
}
LogUtil.debug(" 摄像机【" + cameraName + "】获取图片完成");
LogUtil.info(deviceName + " 【" + cameraName + "】获取图片完成,开始转换图片,并扫码");
System.Threading.Thread.Sleep(1);
//转换托盘大概100-150ms,不打印日志
HalconDotNet.HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bitmap);
LogUtil.debug(" 摄像机【" + cameraName + "】转换图片完成,开始扫码");
// LogUtil.info(" 相机【" + cameraName + "】转换图片完成,开始扫码");
List<CodeInfo> cc = new List<CodeInfo>();
string r = "";
foreach (string codeType in codeTypeList)
{
//判断是否是一维码
......@@ -210,19 +213,16 @@ namespace OnlineStore.DeviceLibrary
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeCount, GetCodeParamFilePath(codeType), codeType);
}
//if (cc.Count > 0)
//{
string r = "";
foreach (CodeInfo c in cc)
{
string str = CodeManager.ReplaceCode(c.CodeStr);
codeList.Add(str);
r = r + "##" + str;
}
LogUtil.info(" 【" + cameraName + "】【" + codeType + "】扫码完成:" + r);
//}
// LogUtil.debug(" 相机【" + cameraName + "】【" + codeType + "】扫码完成:" + r);
}
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成:" + r);
ho_Image.Dispose();
bitmap.Dispose();
}
......@@ -230,12 +230,12 @@ namespace OnlineStore.DeviceLibrary
}
catch (AccessViolationException e)
{
LogUtil.error("扫码出现AccessViolationException异常:" + e.ToString());
LogUtil.error(deviceName + " 扫码出现AccessViolationException异常:" + e.ToString());
GC.Collect();
}
catch (Exception ex)
{
LogUtil.error("扫码出错:" + ex.ToString());
LogUtil.error(deviceName + " 扫码出错:"+ex.ToString());
}
return codeList;
}
......
......@@ -443,21 +443,25 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
BS_06_LineBackRun = 4006,
/// <summary>
/// 送出空料架:等待取料工位无信号
/// </summary>
BS_07_WaitShelfOut=4007,
/// <summary>
/// 送出空料架:等待取料工位无信号,入料口有信号
/// </summary>
BS_07_WaitInLineSingle = 4007,
BS_08_WaitInLineSingle = 4008,
/// <summary>
/// 送出空料架:再转动3000时间
/// </summary>
BS_08_WaitTime = 4008,
BS_09_WaitTime = 4009,
/// <summary>
/// 送出空料架:等待AGV离开后关闭仓门
/// </summary>
BS_09_WaitAGVLeave = 4009,
BS_10_WaitAGVLeave = 4010,
/// <summary>
/// 送出空料架:关闭仓门
/// </summary>
BS_10_CloseDoor = 4010,
BS_11_CloseDoor = 4011,
#endregion
}
......
......@@ -105,14 +105,14 @@ namespace OnlineStore.LoadCSVLibrary
/// DI L侧顶升装置下降端 TopCylinder_Down 13 X34 DI-34
/// </summary>
public static string TopCylinder_Down = "TopCylinder_Down";
///// <summary>
///// DI L侧定位装置上升端 LocationCylinder_Up 14 X35 DI-35
///// </summary>
//public static string LocationCylinder_Up = "LocationCylinder_Up";
///// <summary>
///// DI L侧定位装置下降端 LocationCylinder_Down 15 X36 DI-36
///// </summary>
//public static string LocationCylinder_Down = "LocationCylinder_Down";
/// <summary>
/// DI L侧定位装置上升端 LocationCylinder_Up 14 X35 DI-35
/// </summary>
public static string LocationCylinder_Up = "LocationCylinder_Up";
/// <summary>
/// DI L侧定位装置下降端 LocationCylinder_Down 15 X36 DI-36
/// </summary>
public static string LocationCylinder_Down = "LocationCylinder_Down";
/// <summary>
/// DO 自动指示灯 AutoRun_HddLed 0 Y01 DO-01
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!