Commit 615e6b79 几米阳光

调试修改

1 个父辈 16cc676d
......@@ -6,7 +6,6 @@
<appSettings>
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1" />
<add key ="CodeRun" value ="0"/>
<add key="App_Title" value="料仓_批量上下料" />
<add key="scanner_start_command" value="S" />
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
......@@ -25,7 +24,7 @@
<!--end one store config-->
<!--摄像机名称列表配置,用#分割-->
<add key="CameraName" value="codeCamera" />
<add key="CameraName" value="GigE:MV-CE100-30GC (00C69898477)" />
<!--二维码类型列表配置,用#分割-->
<add key="CodeType" value="Data Matrix ECC 200" />
<!--<add key="CodeType" value="Data Matrix ECC 200"/>-->
......@@ -33,11 +32,12 @@
<add key="CodeParamPath" value="\CodeParam\" />
<add key ="InOutDefaultPosition" value ="3000"/>
<add key ="Config_Pwd" value ="123456"/>
<add key ="AxisChangeValue" value ="100"/>
<!--5000脉冲对应1mm-->
<add key ="AxisChangeValue" value ="5000"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/AutoStore.log" />
<file value="logs/AutoStore1.log" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
......
......@@ -136,11 +136,11 @@ namespace OnlineStore.AutoInOutStore
btnOutStore.Enabled = isOpen;
btnInStore.Enabled = isOpen;
btnAxisAMove.Enabled = isOpen;
//btnAxisAMove.Enabled = isOpen;
btnAxisReturnHome.Enabled = isOpen;
btnAxisRMove.Enabled = isOpen;
btnAxisVMove.Enabled = isOpen;
//btnAxisReturnHome.Enabled = isOpen;
//btnAxisRMove.Enabled = isOpen;
//btnAxisVMove.Enabled = isOpen;
启动ToolStripMenuItem.Enabled = !isOpen;
停止ToolStripMenuItem.Enabled = isOpen;
......@@ -155,6 +155,7 @@ namespace OnlineStore.AutoInOutStore
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
HideForm();
initValue();
txtTempPort.Text = store.Config.Humiture_Port;
LoadOk = true;
cmbHomeType.SelectedIndex = 1;
timer1.Start();
......@@ -327,6 +328,19 @@ namespace OnlineStore.AutoInOutStore
}
}
if (HumitureController.IsRun)
{
btnSelTemp.Enabled = true;
btnTempClose.Enabled = true;
btnTempInit.Enabled = false;
}
else
{
btnSelTemp.Enabled = false ;
btnTempClose.Enabled = false ;
btnTempInit.Enabled = true ;
}
}
private void UpdateFormDoorStats(bool dooIsOpen)
......@@ -495,6 +509,7 @@ namespace OnlineStore.AutoInOutStore
ktk.UpDown_P6 = FormUtil.GetIntValue(txtUpDownP6);
//ktk.UpDown_P7 = FormUtil.GetIntValue(txtUpDownP7);
//ktk.UpDown_P8 = FormUtil.GetIntValue(txtUpDownP8);
return ktk;
}
private void btnComAlarmClear_Click(object sender, EventArgs e)
......@@ -1111,13 +1126,13 @@ namespace OnlineStore.AutoInOutStore
{
SetSkin(this);
this.btnUpDownP1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
this.btnUpDownP2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
//this.btnUpDownP2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
this.btnUpDownP3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
this.btnUpDownP4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
this.btnUpDownP5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
this.btnUpDownP6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
this.btnUpDownP7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
this.btnUpDownP8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
//this.btnUpDownP7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
//this.btnUpDownP8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
//this.lblWarnMsg.ForeColor = System.Drawing.Color.Red;
//this.lblThisSta.ForeColor = System.Drawing.Color.Red;
......@@ -1462,70 +1477,7 @@ namespace OnlineStore.AutoInOutStore
}
}
private void btnBatchInStore_Click(object sender, EventArgs e)
{
if (store.storeRunStatus.Equals(StoreRunStatus.Runing) && AutomaticBaiting.AutoBaitingStatus.Equals(StoreRunStatus.Runing))
{
AutomaticBaiting.BatchDoorOpen(false);
}
else
{
MessageBox.Show("当前忙碌中,无法进行此操作");
}
}
private void btnStartBatchInStore_Click(object sender, EventArgs e)
{
if (!AutomaticBaiting.DoorStatus.Equals(1))
{
return;
}
if (AutomaticBaiting.DoorIsClose())
{
AutomaticBaiting.BatchDoorClose(false);
AutomaticBaiting.Reset();
}
else
{
MessageBox.Show("请先关闭批量上下料门");
}
}
private void btnGetOutTray_Click(object sender, EventArgs e)
{
if (store.storeRunStatus.Equals(StoreRunStatus.Runing) && AutomaticBaiting.AutoBaitingStatus.Equals(StoreRunStatus.Runing))
{
if (AutomaticBaiting.BatchOutStoreCount > 0 && AutomaticBaiting.BatchOutStoreHeight > 0)
{
AutomaticBaiting.BatchDoorOpen(false);
}
else
{
MessageBox.Show("未出库,无料盘可取");
}
}
else
{
MessageBox.Show("当前忙碌中,无法进行此操作");
}
}
private void btnBatchOutEnd_Click(object sender, EventArgs e)
{
if (!AutomaticBaiting.DoorStatus.Equals(1))
{
return;
}
if (AutomaticBaiting.DoorIsClose())
{
AutomaticBaiting.BatchDoorClose(false);
bool result = AutomaticBaiting.Reset();
}
else
{
MessageBox.Show("请先关闭批量上下料门");
}
}
private void button3_Click(object sender, EventArgs e)
{
......@@ -1600,5 +1552,117 @@ namespace OnlineStore.AutoInOutStore
AxisABSMove(store.Config.UpDown_Axis, value, store.Config.UpDownAxis_Door_Speed);
}
}
private void chbIsUseBatch_CheckedChanged(object sender, EventArgs e)
{
store.UseBatchInout = chbIsUseBatch.Checked;
LogUtil.info("切换是否使用批量上下料:" + store.UseBatchInout);
}
private void BtnOpenDoor_Click(object sender, EventArgs e)
{
if (store.storeRunStatus.Equals(StoreRunStatus.Runing) && AutomaticBaiting.AutoBaitingStatus.Equals(StoreRunStatus.Runing))
{
AutomaticBaiting.BatchDoorOpen(false);
AutomaticBaiting.IsNeedStartInout = false ;
}
else
{
MessageBox.Show("当前忙碌中,无法进行此操作");
}
}
private void btnBatchInStore_Click(object sender, EventArgs e)
{
if (!AutomaticBaiting.DoorStatus.Equals(1))
{
return;
}
if (AutomaticBaiting.DoorIsClose())
{
AutomaticBaiting.IsNeedStartInout = true;
AutomaticBaiting.BatchDoorClose(false);
AutomaticBaiting.Reset();
}
else
{
MessageBox.Show("请先关闭批量上下料门");
}
}
private void btnStartBatchInStore_Click(object sender, EventArgs e)
{
if (!AutomaticBaiting.DoorStatus.Equals(1))
{
return;
}
if (AutomaticBaiting.DoorIsClose())
{
AutomaticBaiting.BatchDoorClose(false);
AutomaticBaiting.Reset();
}
else
{
MessageBox.Show("请先关闭批量上下料门");
}
}
private void btnGetOutTray_Click(object sender, EventArgs e)
{
if (store.storeRunStatus.Equals(StoreRunStatus.Runing) && AutomaticBaiting.AutoBaitingStatus.Equals(StoreRunStatus.Runing))
{
if (AutomaticBaiting.BatchOutStoreCount > 0 && AutomaticBaiting.BatchOutStoreHeight > 0)
{
AutomaticBaiting.BatchDoorOpen(false);
}
else
{
MessageBox.Show("未出库,无料盘可取");
}
}
else
{
MessageBox.Show("当前忙碌中,无法进行此操作");
}
}
private void btnBatchOutEnd_Click(object sender, EventArgs e)
{
if (!AutomaticBaiting.DoorStatus.Equals(1))
{
return;
}
if (AutomaticBaiting.DoorIsClose())
{
AutomaticBaiting.BatchDoorClose(false);
bool result = AutomaticBaiting.Reset();
}
else
{
MessageBox.Show("请先关闭批量上下料门");
}
}
private void btnTempInit_Click(object sender, EventArgs e)
{
string port = txtTempPort.Text.ToString();
if (HumitureController.IsRun)
{
HumitureController.Release();
}
HumitureController.Init(port);
}
private void btnTempClose_Click(object sender, EventArgs e)
{
HumitureController.Release();
}
private void btnSelTemp_Click(object sender, EventArgs e)
{
ASTemperateParam param = HumitureController.QueryData();
txtTemp.Text = param.Temperate.ToString();
txtHum.Text = param.Humidity.ToString();
}
}
}
......@@ -73,7 +73,7 @@ namespace OnlineStore.Common
}
}
private static List<string> lasErrorLogList = new List<string>();
//private static List<string> lasErrorLogList = new List<string>();
private static int errCount = 5;
public static void error(ILog log, string errorMsg,int type)
......@@ -100,7 +100,7 @@ namespace OnlineStore.Common
}
public static void error(ILog log, string errorMsg)
{
if (!lasErrorLogList.Contains(errorMsg))
//if (!lasErrorLogList.Contains(errorMsg))
{
log.Error(log.Logger.Name + " - " + errorMsg);
if (logBox == null)
......@@ -109,17 +109,17 @@ namespace OnlineStore.Common
}
AddToBox(errorMsg, Color.Red);
}
lasErrorLogList.Add(errorMsg);
if (lasErrorLogList.Count > errCount)
{
lasErrorLogList.RemoveAt(0);
}
//lasErrorLogList.Add(errorMsg);
//if (lasErrorLogList.Count > errCount)
//{
// lasErrorLogList.RemoveAt(0);
//}
}
private static void AddToBox(string msg, Color color)
{
try
{
ShowLogPro(msg, color);
ShowLogPro(msg);
}
catch (Exception ex)
{
......@@ -127,7 +127,7 @@ namespace OnlineStore.Common
}
}
private static int count = 0;
private static void ShowLogPro(string msg, Color color)
private static void ShowLogPro(string msg )
{
try
{
......
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.IO.Ports;
......@@ -422,6 +423,10 @@ namespace OnlineStore.DeviceLibrary
return GetRegisterData(portName, reviceData, ACCMDManager.TargetPostion);
}
public static int GetActualtPosition(ConfigMoveAxis axis)
{
return GetActualtPosition(axis.DeviceName, axis.GetAxisValue());
}
public static int GetActualtPosition(string portName, int slvAddr)
{
PreReadAddr = ACCMDManager.ActualPosition;
......@@ -506,6 +511,20 @@ namespace OnlineStore.DeviceLibrary
return GetCoilData(portName, reviceData, ACCMDManager.Home_Single);
}
/// <summary>
/// 负极限
/// </summary>
public static int GetLimitNegativeSingle(ConfigMoveAxis axis)
{
return GetLimitNegativeSingle(axis);
}
/// <summary>
/// 正极限
/// </summary>
public static int GetLimitPositiveSingle(ConfigMoveAxis axis)
{
return GetLimitPositiveSingle(axis);
}
/// <summary>
/// 正极限
/// </summary>
public static int GetLimitPositiveSingle(string portName, int slvAddr)
......
......@@ -9,7 +9,7 @@ DI,吸盘气缸上升端,SuckingDisc_Up,206,192.168.200.11,0,吸盘气缸上升端,X07,DI-07,0
DI,吸盘气缸下降端,SuckingDisc_Down,207,192.168.200.11,0,吸盘气缸下降端,X08,DI-08,0,
DI,料盘宽度检测1,WidthCheck1,208,192.168.200.11,0,料盘宽度检测1,X09,DI-09,0,
DI,料盘宽度检测2,WidthCheck2,209,192.168.200.11,0,料盘宽度检测2,X10,DI-10,0,
DI,料盘检测1(上料机构),TrayCheck_LoadMaterial,210,192.168.200.11,0,料盘检测1(上料机构),X11,DI-11,0,
DI,料盘检测1(上料机构),TrayCheck_LoadMaterial,210,192.168.200.11,0,料盘检测1(上料机构),X11,DI-11,0,
DI,上料机构出料检测,OutCheck,211,192.168.200.11,0,上料机构出料检测,X12,DI-12,0,
DI,门锁气缸打开端,BatchDoor_Open,212,192.168.200.11,0,门锁气缸打开端,X13,DI-13,0,
DI,门锁气缸关闭端,BatchDoor_Close,213,192.168.200.11,0,门锁气缸关闭端,X14,DI-14,0,
......@@ -27,8 +27,8 @@ DO,进料口门上升SOL,Door_Up,108,192.168.200.11,0,进料口门上升SOL,Y09,DO-09,0,
DO,进料口门下降SOL,Door_Down,109,192.168.200.11,0,进料口门下降SOL,Y10,DO-10,0,
DO,吸盘气缸上升SOL,SuckingDisc_Up,110,192.168.200.11,0,吸盘气缸上升SOL,Y11,DO-11,0,
DO,吸盘气缸下降SOL,SuckingDisc_Down,111,192.168.200.11,0,吸盘气缸下降SOL,Y12,DO-12,0,
DO,门锁气缸打开SOL,AutoDoor_Open,112,192.168.200.11,0,门锁气缸打开SOL,Y13,DO-13,0,
DO,门锁气缸关闭SOL,AutoDoor_Close,113,192.168.200.11,0,门锁气缸关闭SOL,Y14,DO-14,0,
DO,门锁气缸打开SOL,BatchDoor_Open,112,192.168.200.11,0,门锁气缸打开SOL,Y13,DO-13,0,
DO,门锁气缸关闭SOL,BatchDoor_Close,113,192.168.200.11,0,门锁气缸关闭SOL,Y14,DO-14,0,
,,,114,192.168.200.11,0,,Y15,DO-15,0,
,,,115,192.168.200.11,0,,Y16,DO-16,0,
DI,上料机构门关闭,DoorClose_LoadMaterial,200,192.168.200.12,0,上料机构门关闭,X21,DI-21,0,
......@@ -45,15 +45,15 @@ AXIS,(轴三)进出轴,InOut_Axis,1,COM5,0,,,,,
AXIS,(轴五)批量上下料轴,Batch_Axis,1,COM6,0,,,,,
,,,,,,,,,,
,,,,,,,,,,
PRO,升降轴 进料口仓门位置,UpDownAxis_DoorPosition,403000,,,,,,,
PRO,升降轴 进料口仓门位置,UpDownAxis_DoorPosition,355000,,,,,,,
,升降轴 进料口取料点 P1,UpDownAxis_DoorOPosition_P1,403000,,,,,,,
,升降轴 进料口出料前点 P2,UpDownAxis_DoorIPosition_P2,415000,,,,,,,
,升降轴 进料口取料缓冲点 P7,UpDownAxis_DoorOBPosition_P7,415000,,,,,,,
,升降轴 进料口出料缓冲点 P8,UpDownAxis_DoorIBPosition_P8,403000,,,,,,,
PRO,升降轴 出入料待机点P1集合,UpDownAxis_P1_List,8#20000;12#22000,,,,,,,
PRO,旋转轴(轴一)P1 待机原位点,MiddleAxis_P1_Position,268093,,,,,,,
PRO,升降轴 出入料待机点P1集合,UpDownAxis_P1_List,8#355000;12#350000;,,,,,,,
PRO,旋转轴(轴一)P1 待机原位点,MiddleAxis_P1_Position,260000,,,,,,,
PRO,进出轴(轴三)P1待机原位点,InOutAxis_P1_Position,1000,,,,,,,
PRO,压紧轴(轴4)P1待机原位点,CompressAxis_P1_Position,-75000,,,,,,,
PRO,压紧轴(轴4)P1待机原位点,CompressAxis_P1_Position,-40000,,,,,,,
PRO,是否使用定位气缸,IsHasLocationCylinder,0,,,,,,,
PRO,是否有左右侧门,IsHasDoorLimit,1,,,,,,,
PRO,是否使用压紧轴(1=使用),IsHasCompress_Axis,1,,,,, ,,
......@@ -62,7 +62,7 @@ PRO,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,,,,,
,,,,,,,,,,
PRO,预警温度,WarnTemperate,80,,,,,,,
PRO,预警湿度,WarnHumidity,80,,,,,,,
PRO,(轴一)旋转轴目标速度,MiddleAxis_TargetSpeed,250,,,,,,,
PRO,(轴一)旋转轴目标速度,MiddleAxis_TargetSpeed,100,,,,,,,
PRO,(轴一)旋转轴加速度,MiddleAxis_AddSpeed,80,,,,,,,
PRO,(轴一)旋转轴减速度,MiddleAxis_DelSpeed,80,,,,,,,
PRO,(轴一)旋转轴原点低速度,MiddleAxis_HomeLowSpeed,80,,,,,,,
......@@ -128,18 +128,18 @@ PRO,硕科步进电机(压紧轴)控制减速度,CompressAxis_DelSpeed,15000,,,,,,,
PRO,硕科步进电机(压紧轴)原点返回速度,CompressAxis_HomeSpeed,15000,,,,,,,
PRO,硕科步进电机轴地址(压紧轴),CompressAxis_Slv,1,,,,,, ,
,,,,,,,,,,
PRO,(轴五)上料轴目标速度,BatchAxis_TargetSpeed,50,,,,,,,
PRO,(轴五)上料轴目标速度,BatchAxis_TargetSpeed,200,,,,,,,
PRO,(轴五)上料轴加速度,BatchAxis_AddSpeed,300,,,,,,,
PRO,(轴五)上料轴减速度,BatchAxis_DelSpeed,300,,,,,,,
PRO,(轴五)上料轴原点低速,BatchAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴五)上料轴原点高速,BatchAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴五)上料轴原点加速度,BatchAxis_HomeAddSpeed,200,,,,,,,
PRO,(轴五)上料轴P1点(出库时接料盘的位置),BatchAxis_P1,200,,,,,, ,
PRO,(轴五)上料轴P1点(出库时接料盘的位置),BatchAxis_P1,1730000,,,,,, ,
PRO,(轴五)上料轴最小误差脉冲值,BatchAxis_ErrorCountMin,10,,,,,,,
PRO,(轴五)上料轴最大误差脉冲值,BatchAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴五)上料轴最小限位,BatchAxis_PositionMin,0,,,,,,,
PRO,(轴五)上料轴最大限位,BatchAxis_PositionMax,0,,,,,,,
PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,50,,,,,,,
PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,200,,,,,,,
,,,,,,,,,,
,,,,,,,,,,
PRO,IO模块对应的DI数量,IO_DILength,192.168.200.11#16;192.168.200.12#4,,,,,, ,
......
位置,优先级,高度,宽度,料仓ID,中轴位置P2,升降轴库位出料前点P5,升降轴库位出料缓冲点P6,升降轴库位入料前点P3,升降轴库位入料缓冲点P4,进出轴库位点取料点P3,压紧轴压紧点P2,压紧轴压紧前点P3,进出轴仓门取料点P2,进出轴吸盘取料点P2
1#AC1_1_1_4,774,8,7,1,211783,51884,55245,55245,51884,68000,-110000,-75000,81000,81000
1#AC1_1_1_5,773,12,7,1,211783,67807,71168,71168,67807,68000,-110000,-75000,81000,81000
1#AC1_1_1_4,774,8,7,1,211783,51884,55245,55245,51884,68000,-110000,-75000,5000,5000
1#AC1_1_1_5,773,12,7,1,211783,67807,71168,71168,67807,68000,-110000,-75000,5000,5000
1#AC1_1_1_6,772,8,7,,211783,83730,87091,87091,83730,68000,-110000,-75000,81000,81000
1#AC1_1_1_7,771,8,7,,211783,99653,103014,103014,99653,68000,-110000,-75000,81000,81000
1#AC1_1_1_8,770,8,7,,211783,115576,118937,118937,115576,68000,-110000,-75000,81000,81000
......
......@@ -16,8 +16,8 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public partial class AC_SA_BoxBean : AC_Store
{
private static bool IsIntSlvBlock = false;
private bool IsIntSlvBlock = false;
public bool UseBatchInout = true;
public string CID = "";
public AUTO_SA_Config Config;
/// <summary>
......@@ -136,7 +136,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public override bool StartRun()
{
runTimeWatch.Reset();
runTimeWatch.Restart();
LogUtil.info(LOGGER, StoreName + "开始启动,启动时间:" + DateTime.Now.ToLongTimeString());
if (IsHasCompress_Axis)
......@@ -147,12 +147,15 @@ namespace OnlineStore.DeviceLibrary
return false;
}
}
if (UseBatchInout)
{
string canStart = AutomaticBaiting.CanStart();
if (!canStart.Equals(""))
{
LogUtil.info(StoreName + canStart);
return false;
}
}
autoNext = false;
mainTimer.Enabled = false;
alarmType = StoreAlarmType.None;
......@@ -170,8 +173,10 @@ namespace OnlineStore.DeviceLibrary
{
return false;
}
if (UseBatchInout)
{
AutomaticBaiting.Reset();
}
//TODO 启动时先所有轴远点返回,测试暂时关闭
storeRunStatus = StoreRunStatus.HomeMoving;
HumitureController.Init(Config.Humiture_Port);
......@@ -698,11 +703,12 @@ namespace OnlineStore.DeviceLibrary
//private DateTime preProcessTime = DateTime.Now;
private bool IsChongfu = false;
private Stopwatch stopwatch = new Stopwatch();
private object TimerLock = "";
protected override void timersTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (InProcess)
{
//TimeSpan span = DateTime.Now - preProcessTime;
if (stopwatch.Elapsed.TotalMinutes < 1)
{
return;
......@@ -711,13 +717,16 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error("主定时器:InProcess已等待" + stopwatch.Elapsed.ToString() + "重新处理");
IsChongfu = true;
Monitor.Exit(TimerLock);
}
}
try
{
InProcess = true;
//preProcessTime = DateTime.Now;
stopwatch.Restart();
if (Monitor.TryEnter(TimerLock))
{
try
{
IoCheckProcess();
ShowTimeLog("IoCheckProcess");
TimerProcess();
......@@ -729,12 +738,25 @@ namespace OnlineStore.DeviceLibrary
CheckAxisAlarm();
ShowTimeLog("轴报警检测完成");
}
if (UseBatchInout)
{
AutomaticBaiting.TimerProcess();
}
}
catch (Exception ex)
{
LOGGER.Error(StoreName + "定时处理出错:" + ex.ToString());
}
finally
{
Monitor.Exit(TimerLock);
}
}
else
{
LOGGER.Error(StoreName + "定时处理未得到锁");
}
IsChongfu = false;
InProcess = false;
}
......@@ -923,37 +945,37 @@ namespace OnlineStore.DeviceLibrary
//遮挡光栅信号
if (KND.IOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.LOW))
{
if (NeedCheckSafetyLight.Equals(1))
{
if (StoreMove.MoveType.Equals(StoreMoveType.OutStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SO_10_DeviceToDoor))
{
NeedCheckSafetyLight = 2;
LOGGER.Info("出库SO_10_DeviceToDoor运动中,光栅被遮挡,停止进出轴运动");
ACServerManager.SuddenStop(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue());
}
else if (StoreMove.MoveType.Equals(StoreMoveType.InStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SI_05_DeviceToDoor))
{
NeedCheckSafetyLight = 2;
LOGGER.Info("入库SI_05_DeviceToDoor运动中,光栅被遮挡,停止进出轴运动");
ACServerManager.SuddenStop(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue());
}
}
//if (NeedCheckSafetyLight.Equals(1))
//{
// if (StoreMove.MoveType.Equals(StoreMoveType.OutStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SO_10_DeviceToDoor))
// {
// NeedCheckSafetyLight = 2;
// LOGGER.Info("出库SO_10_DeviceToDoor运动中,光栅被遮挡,停止进出轴运动");
// ACServerManager.SuddenStop(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue());
// }
// else if (StoreMove.MoveType.Equals(StoreMoveType.InStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SI_05_DeviceToDoor))
// {
// NeedCheckSafetyLight = 2;
// LOGGER.Info("入库SI_05_DeviceToDoor运动中,光栅被遮挡,停止进出轴运动");
// ACServerManager.SuddenStop(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue());
// }
//}
}
else
{
if (NeedCheckSafetyLight.Equals(2))
{
if (StoreMove.MoveType.Equals(StoreMoveType.OutStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SO_10_DeviceToDoor))
{
LOGGER.Info("出库SO_10_DeviceToDoor运动中,光栅已恢复,继续进出轴运动");
SO_10_DeviceToDoorPro();
}
else if (StoreMove.MoveType.Equals(StoreMoveType.InStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SI_05_DeviceToDoor))
{
LOGGER.Info("入库SI_05_DeviceToDoor运动中,光栅已恢复,继续进出轴运动");
SI_05_DeviceToDoor();
}
}
//if (NeedCheckSafetyLight.Equals(2))
//{
// if (StoreMove.MoveType.Equals(StoreMoveType.OutStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SO_10_DeviceToDoor))
// {
// LOGGER.Info("出库SO_10_DeviceToDoor运动中,光栅已恢复,继续进出轴运动");
// SO_10_DeviceToDoorPro();
// }
// else if (StoreMove.MoveType.Equals(StoreMoveType.InStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SI_05_DeviceToDoor))
// {
// LOGGER.Info("入库SI_05_DeviceToDoor运动中,光栅已恢复,继续进出轴运动");
// SI_05_DeviceToDoor();
// }
//}
}
}
catch (Exception ex)
......@@ -1232,7 +1254,10 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, StoreName + "StopMove");
KND.IOMove(IO_Type.Door_Down, IO_VALUE.LOW);
KND.IOMove(IO_Type.Door_Up, IO_VALUE.LOW);
if (UseBatchInout)
{
AutomaticBaiting.StopMove();
}
//HDevelopExport.CloseAllCamera();
isInPro = false;
}
......@@ -1502,8 +1527,9 @@ namespace OnlineStore.DeviceLibrary
LOGGER.Error("定时给服务器发送消息出错:", ex);
}
}
HumitureController.QueryData();
HumidityProcess();
//温湿度暂时注释
//HumitureController.QueryData();
//HumidityProcess();
LedProcess();
isInProcess = false;
}
......
......@@ -29,6 +29,7 @@ namespace OnlineStore.DeviceLibrary
public static StoreMoveInfo StoreMove = null;
public static StoreRunStatus AutoBaitingStatus = StoreRunStatus.Wait;
public static bool IsNeedStartInout = false;
//记录没开门状态下,已经出库的数量
public static int BatchOutStoreCount = 0;
......@@ -46,6 +47,8 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public static void TimerProcess()
{
try
{
if (AutoBaitingStatus >= StoreRunStatus.Wait)
{
if (StoreMove.MoveType.Equals(StoreMoveType.StoreReset))
......@@ -61,6 +64,10 @@ namespace OnlineStore.DeviceLibrary
//OutStoreProcess();
}
}
}catch(Exception ex)
{
LogUtil.error(Name+"出错:"+ex.StackTrace);
}
}
/// <summary>
......@@ -115,6 +122,7 @@ namespace OnlineStore.DeviceLibrary
//关闭门,轴回原点,检测
BatchDoorClose(true);
KND.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.LOW);
CylinderMove(IO_Type.SuckingDisc_Up, IO_Type.SuckingDisc_Down,true);
LogUtil.info(Name + "复位中:关闭门锁");
return true;
}
......@@ -136,19 +144,33 @@ namespace OnlineStore.DeviceLibrary
case StoreMoveStep.AUTO_R01_CloseDoor:
StoreMove.NextMoveStep(StoreMoveStep.AUTO_R02_AutoAxisHome);
LogUtil.info(Name + "复位中:批量上下料轴原点返回");
StoreMove.TimeOutSeconds = 120;
ACAxisHomeMove(StoreManager.Config.Batch_Axis);
break;
case StoreMoveStep.AUTO_R02_AutoAxisHome:
if (IsNeedStartInout)
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_R03_AutoAxisHome);
LogUtil.info(Name + "复位中:匀速向上运动,检测 是否有料盘");
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.Batch_Axis.TargetSpeed);
}
else
{
LogUtil.info(Name + "复位完成");
StoreMove.EndMove();
AutoBaitingStatus = StoreRunStatus.Runing;
WarnMsg = "";
IsNeedStartInout = false;
}
break;
case StoreMoveStep.AUTO_R03_AutoAxisHome:
if (KND.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.LOW))
//if (KND.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.LOW))
if (ACServerManager.GetLimitPositiveSingle(StoreManager.Config.Batch_Axis).Equals(1))
{
LogUtil.info(Name + "复位中: 没有料盘,不需要上料,上料轴回0点");
StoreMove.NextMoveStep(StoreMoveStep.AUTO_R04_AutoBack);
StoreMove.TimeOutSeconds = 120;
ACAxisHomeMove(StoreManager.Config.Batch_Axis);
}
else
......@@ -165,6 +187,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.EndMove();
AutoBaitingStatus = StoreRunStatus.Runing;
WarnMsg = "";
IsNeedStartInout = false;
break;
default: break;
}
......@@ -343,7 +366,8 @@ namespace OnlineStore.DeviceLibrary
LastSize = 0;
LastPosId = "";
SuckingDisc_WorkCount = 0;
if (KND.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH))
if (ACServerManager.GetLimitPositiveSingle(StoreManager.Config.Batch_Axis).Equals(0))
//if (KND.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I01_ScanCode);
LogUtil.info(Name + "入料: 开始扫码 ");
......
......@@ -72,6 +72,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.EndStepWait();
return;
}
try {
//当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - StoreMove.LastSetpTime;
string NotOkMsg = "";
......@@ -119,12 +120,12 @@ namespace OnlineStore.DeviceLibrary
}
else if (wait.WaitType == 8)
{
IO_VALUE value = (IO_VALUE)ACServerManager.GetLimitNegativeSingle(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
IO_VALUE value = (IO_VALUE)ACServerManager.GetLimitNegativeSingle(wait.AxisInfo);
wait.IsEnd = wait.IoValue.Equals(value);
}
else if (wait.WaitType == 9)
{
IO_VALUE value = (IO_VALUE)ACServerManager.GetLimitPositiveSingle(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
IO_VALUE value = (IO_VALUE)ACServerManager.GetLimitPositiveSingle(wait.AxisInfo);
wait.IsEnd = wait.IoValue.Equals(value);
}
else if (wait.WaitType == 10)
......@@ -176,6 +177,11 @@ namespace OnlineStore.DeviceLibrary
StoreManager.Store.Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType);
}
}
catch (Exception ex)
{
LogUtil.error(Name + "CheckWait出错:" + ex.StackTrace);
}
}
/// <summary>
/// 判断AC伺服电机轴是否运动完成
/// </summary>
......@@ -218,16 +224,16 @@ namespace OnlineStore.DeviceLibrary
{
wait.IsEnd = ACAxisMoveIsEnd(wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
}
if (!wait.IsEnd)
{
IO_VALUE value = (IO_VALUE)ACServerManager.GetHomeSingle(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
if (value.Equals(IO_VALUE.HIGH))
{
ACServerManager.SuddenStop(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
LogUtil.error(Name + wait.ToStr() + "原点返回过程中到达 负限位,直接停止运动");
StoreManager.Store.Alarm(StoreAlarmType.AxisMoveError, StoreManager.Store.GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType);
}
}
//if (!wait.IsEnd)
//{
// IO_VALUE value = (IO_VALUE)ACServerManager.GetLimitNegativeSingle(wait.AxisInfo);
// if (value.Equals(IO_VALUE.HIGH))
// {
// ACServerManager.SuddenStop(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
// LogUtil.error(Name + wait.ToStr() + "原点返回过程中到达 负限位,直接停止运动");
// StoreManager.Store.Alarm(StoreAlarmType.AxisMoveError, StoreManager.Store.GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType);
// }
//}
if (!msg.Equals(""))
{
WarnMsg = msg;
......@@ -288,6 +294,10 @@ namespace OnlineStore.DeviceLibrary
if (codeList.Count <= 0)
{
codeList = CodeManager.CameraScan();
}else if(StoreManager.Store.IsDebug)
{
codeList = new List<string>() { "NoCode"};
LogUtil.info(Name+"未扫到二维码,默认为NoCode");
}
foreach (string str in codeList)
{
......@@ -356,6 +366,31 @@ namespace OnlineStore.DeviceLibrary
IsScanCode = false;
return;
}
if (StoreManager.Store.IsDebug)
{
string posId = "1#AC1_1_1_4";
LogUtil.info(Name + "调试模式,不需要连接服务器,直接模拟库位号【" + posId + "】");
string plateH = "8";
string plateW = "7";
if (StoreManager.Store.CanStarInOut())
{
LastPosId = posId;
IsScanCode = false;
InOutStoreParam param = new InOutStoreParam(message, posId, plateH, plateW, 0);
StoreManager.Store.StartInStoreMove(param, true);
//如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil.info(Name + " 入库调试模拟:库位号【" + posId + "】二维码【" + message + "】 开始入库!");
}
else
{
LogUtil.info(Name + " 入库调试模拟:库位号【" + posId + "】二维码【" + message + "】 正在忙碌中,无法入库!");
IsScanCode = false;
}
return;
}
// CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
LogUtil.info(Name + "收到二维码【 " + message + "】,发送给服务器获取入库PosID");
//发送扫码内容到服务器进行入库操作
......
......@@ -371,7 +371,6 @@ namespace OnlineStore.DeviceLibrary
short axisNo = moveAxis.GetAxisValue();
//如果是进出轴,并且光栅被遮挡,直接返回false
if (NeedCheckSafetyLight.Equals(2))
{
if (StoreMove.MoveStep.Equals(StoreMoveStep.SO_10_DeviceToDoor) ||
......@@ -401,7 +400,6 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(LOGGER, moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount +
"],误差过大,重新开始运动,剩余[" + StoreMove.CanWhileCount + "]次");
//LogUtil.error(LOGGER, StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]重新开始运动");
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
StoreMove.CanWhileCount--;
return false;
......
......@@ -243,20 +243,20 @@ namespace OnlineStore.DeviceLibrary
// wait.IsEnd = false;
// return wait;
//}
/// <summary>
///8= 等待轴的反限位为指定值
/// </summary>
public static WaitResultInfo WaitAxistNegativeLimit(ConfigMoveAxis moveAxis ,IO_VALUE ioValue)
{
WaitResultInfo wait = new WaitResultInfo();
wait.CanWhileMoveCount = 0;
wait.WaitType = 8;
wait.AxisInfo = moveAxis;
wait.IsHomeMove = true;
wait.IoValue = ioValue;
wait.IsEnd = false;
return wait;
}
///// <summary>
/////8= 等待轴的反限位为指定值
///// </summary>
//public static WaitResultInfo WaitAxistNegativeLimit(ConfigMoveAxis moveAxis ,IO_VALUE ioValue)
//{
// WaitResultInfo wait = new WaitResultInfo();
// wait.CanWhileMoveCount = 0;
// wait.WaitType = 8;
// wait.AxisInfo = moveAxis;
// wait.IsHomeMove = true;
// wait.IoValue = ioValue;
// wait.IsEnd = false;
// return wait;
//}
/// <summary>
///9= 等待轴的正限位为指定值
/// </summary>
......
......@@ -150,11 +150,11 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// 门锁气缸打开端 Door_Open X13 DI-13
/// </summary>
public static string BatchDoor_Open = "Door_Open";
public static string BatchDoor_Open = "BatchDoor_Open";
/// <summary>
/// 门锁气缸关闭端 Door_Close X14 DI-14
/// </summary>
public static string BatchDoor_Close = "Door_Close";
public static string BatchDoor_Close = "BatchDoor_Close";
/// <summary>
/// 料盘检测2(料叉机构) TrayCheck_Fixture X15 DI-15
/// </summary>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!