Commit b933db27 LN

1

1 个父辈 5744dc8a
...@@ -44,29 +44,27 @@ namespace OnlineStore.AssemblyLine ...@@ -44,29 +44,27 @@ namespace OnlineStore.AssemblyLine
FrmIOStatus ioStatus = new FrmIOStatus(); FrmIOStatus ioStatus = new FrmIOStatus();
AddForm(" 流水线IO状态 ", ioStatus); AddForm(" 流水线IO状态 ", ioStatus);
List<MoveEquip> moveEquipList = new List<MoveEquip>(lineBean.MoveEquipMap.Values);
for (int i = 0; i < moveEquipList.Count; i++)
{
MoveEquip store = moveEquipList[i];
FrmMoveEquip test = new FrmMoveEquip(store);
AddForm(" " + store.Name, test);
}
List<FeedingEquip> feeds = new List<FeedingEquip>(lineBean.FeedingEquipMap.Values); List<FeedingEquip> feeds = new List<FeedingEquip>(lineBean.FeedingEquipMap.Values);
for (int i = 0; i < feeds.Count; i++) for (int i = 0; i < feeds.Count; i++)
{ {
FeedingEquip feed = feeds[i]; FeedingEquip feed = feeds[i];
FrmFeedingEquip test = new FrmFeedingEquip(feed); FrmFeedingEquip test = new FrmFeedingEquip(feed);
AddForm(" " + feed.Name, test); AddForm(" " + feed.Name+" ", test);
} }
List<ProvidingEquip> provids = new List<ProvidingEquip>(lineBean.ProvidingEquipMap.Values); List<ProvidingEquip> provids = new List<ProvidingEquip>(lineBean.ProvidingEquipMap.Values);
for (int i = 0; i < provids.Count; i++) for (int i = 0; i < provids.Count; i++)
{ {
ProvidingEquip provid = provids[i]; ProvidingEquip provid = provids[i];
FrmProvidingEquip test = new FrmProvidingEquip(provid); FrmProvidingEquip test = new FrmProvidingEquip(provid);
AddForm(" " + provid.Name, test); AddForm(" " + provid.Name + " ", test);
}
List<MoveEquip> moveEquipList = new List<MoveEquip>(lineBean.MoveEquipMap.Values);
for (int i = 0; i < moveEquipList.Count; i++)
{
MoveEquip store = moveEquipList[i];
FrmMoveEquip test = new FrmMoveEquip(store);
AddForm(" " + store.Name, test);
} }
lblCID.Text = ConfigAppSettings.GetValue(Setting_Init.Line_CID); lblCID.Text = ConfigAppSettings.GetValue(Setting_Init.Line_CID);
chbLineDebug.Checked = TrayManager.LineRunTest; chbLineDebug.Checked = TrayManager.LineRunTest;
...@@ -109,14 +107,14 @@ namespace OnlineStore.AssemblyLine ...@@ -109,14 +107,14 @@ namespace OnlineStore.AssemblyLine
private void LoadListView() private void LoadListView()
{ {
this.listView1.Columns.Clear(); this.listView1.Columns.Clear();
AddHealder("设备名称", 140); AddHealder("设备名称", 100);
AddHealder("移栽报警", 80); AddHealder("报警", 100);
// AddHealder("设备状态", 100); // AddHealder("设备状态", 100);
AddHealder("移栽状态", 150); AddHealder("状态", 100);
AddHealder("BOX_CID", 80); AddHealder("BOX_CID", 80);
AddHealder("BOX报警", 100); AddHealder("BOX报警", 100);
AddHealder("更新时间", 80); AddHealder("更新时间", 80);
AddHealder("BOX状态", listView1.Size.Width - 100 - 80 - 80 - 150 - 80 - 140 - 8); AddHealder("BOX状态", listView1.Size.Width - 100 - 80 - 80 - 100 - 100 - 100 - 8);
foreach (MoveEquip move in lineBean.MoveEquipMap.Values) foreach (MoveEquip move in lineBean.MoveEquipMap.Values)
{ {
ListViewItem lvi = new ListViewItem(); ListViewItem lvi = new ListViewItem();
...@@ -141,7 +139,28 @@ namespace OnlineStore.AssemblyLine ...@@ -141,7 +139,28 @@ namespace OnlineStore.AssemblyLine
} }
this.listView1.Items.Add(lvi); this.listView1.Items.Add(lvi);
} }
ListViewItem emptyView = new ListViewItem();
this.listView1.Items.Add(emptyView);
foreach (FeedingEquip equip in lineBean.FeedingEquipMap.Values)
{
ListViewItem lvi = new ListViewItem();
lvi.Text = equip.Name;
lvi.SubItems.Add(equip.alarmType.ToString());
// lvi.SubItems.Add(move.lineStatus.ToString());
lvi.SubItems.Add(KTK_Store.GetRunStr(equip.lineStatus, equip.runStatus));
this.listView1.Items.Add(lvi);
}
this.listView1.Items.Add((ListViewItem)emptyView.Clone());
foreach (ProvidingEquip equip in lineBean.ProvidingEquipMap.Values)
{
ListViewItem lvi = new ListViewItem();
lvi.Text = equip.Name;
lvi.SubItems.Add(equip.alarmType.ToString());
// lvi.SubItems.Add(move.lineStatus.ToString());
lvi.SubItems.Add(KTK_Store.GetRunStr(equip.lineStatus, equip.runStatus));
this.listView1.Items.Add(lvi);
}
cmbBoxIndex.Items.Clear(); cmbBoxIndex.Items.Clear();
foreach(int key in lineBean.MoveEquipMap.Keys) foreach(int key in lineBean.MoveEquipMap.Keys)
{ {
...@@ -381,8 +400,6 @@ namespace OnlineStore.AssemblyLine ...@@ -381,8 +400,6 @@ namespace OnlineStore.AssemblyLine
ListViewItem lvi = new ListViewItem(); ListViewItem lvi = new ListViewItem();
lvi.Text = move.Name; lvi.Text = move.Name;
SetItemText(i, 1, move.alarmType.ToString()); SetItemText(i, 1, move.alarmType.ToString());
// this.listView1.Items[i].SubItems[2].Text = move.lineStatus.ToString();
SetItemText(i, 2, KTK_Store.GetRunStr(move.lineStatus, move.runStatus)); SetItemText(i, 2, KTK_Store.GetRunStr(move.lineStatus, move.runStatus));
BoxInfo box = LineServer.GetBoxInfo(move.DeviceID); BoxInfo box = LineServer.GetBoxInfo(move.DeviceID);
if (box != null) if (box != null)
...@@ -391,28 +408,26 @@ namespace OnlineStore.AssemblyLine ...@@ -391,28 +408,26 @@ namespace OnlineStore.AssemblyLine
SetItemText(i, 4, box.SAlarmType.ToString()); SetItemText(i, 4, box.SAlarmType.ToString());
SetItemText(i, 5, box.LastMsgTime.ToLongTimeString()); SetItemText(i, 5, box.LastMsgTime.ToLongTimeString());
SetItemText(i, 6, box.ToShowStr()); SetItemText(i, 6, box.ToShowStr());
} }
if (move.runStatus.Equals(LineRunStatus.Wait)) SetItemColor(i,move.runStatus);
{ i++;
SetItemColor(i, Color.White);
//listView1.Items[i].BackColor = Color.White;
}
else if (move.runStatus.Equals(LineRunStatus.HomeMoving) || move.runStatus.Equals(LineRunStatus.Reset))
{
SetItemColor(i, Color.Orange);
} }
else if (move.runStatus.Equals(LineRunStatus.Busy)) i++;
foreach (FeedingEquip equip in lineBean.FeedingEquipMap.Values)
{ {
SetItemColor(i, Color.Green); SetItemText(i, 1, equip.alarmType.ToString());
SetItemText(i, 2, KTK_Store.GetRunStr(equip.lineStatus, equip.runStatus));
SetItemColor(i, equip.runStatus);
i++;
} }
if (move.runStatus.Equals(LineRunStatus.Runing)) i++;
foreach (ProvidingEquip equip in lineBean.ProvidingEquipMap.Values)
{ {
SetItemColor(i, Color.LightBlue); SetItemText(i, 1, equip.alarmType.ToString());
} SetItemText(i, 2, KTK_Store.GetRunStr(equip.lineStatus, equip.runStatus));
SetItemColor(i, equip.runStatus);
i++; i++;
} }
if (lineBean.runStatus > LineRunStatus.Wait) if (lineBean.runStatus > LineRunStatus.Wait)
{ {
if (启动AToolStripMenuItem.Enabled.Equals(true)) if (启动AToolStripMenuItem.Enabled.Equals(true))
...@@ -436,6 +451,28 @@ namespace OnlineStore.AssemblyLine ...@@ -436,6 +451,28 @@ namespace OnlineStore.AssemblyLine
SetMenuS(停止TToolStripMenuItem, false); SetMenuS(停止TToolStripMenuItem, false);
} }
} }
private void SetItemColor(int i, LineRunStatus runStatus)
{
if (runStatus.Equals(LineRunStatus.Wait))
{
SetItemColor(i, Color.White);
//listView1.Items[i].BackColor = Color.White;
}
else if (runStatus.Equals(LineRunStatus.HomeMoving) || runStatus.Equals(LineRunStatus.Reset))
{
SetItemColor(i, Color.Orange);
}
else if (runStatus.Equals(LineRunStatus.Busy))
{
SetItemColor(i, Color.Green);
}
if (runStatus.Equals(LineRunStatus.Runing))
{
SetItemColor(i, Color.LightBlue);
}
}
private void SetMenuS(ToolStripMenuItem toolMenu,bool isEn) private void SetMenuS(ToolStripMenuItem toolMenu,bool isEn)
{ {
if (!toolMenu.Enabled.Equals(isEn)) if (!toolMenu.Enabled.Equals(isEn))
......
类型,分类编号,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义 类型,分类编号,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义
PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,, PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
PRO,0,阻挡气缸控制信号(1-4分别对应夹具检测1-4),StopCylinderIOType,1,,,,, ,,,,,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,0,,,,, PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,0,,,,,
PRO,0,移栽上下移动料盘高度对应的上升位置,UpDownPositions,12=1000;16=1300;20=2000;24=2000;36=3000;,,,,,, PRO,0,移栽上下移动料盘高度对应的上升位置,UpDownPositions,12=1000;16=1300;20=2000;24=2000;36=3000;,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,2,COM1,0,,, AXIS,0,移栽上下轴,UpDown_Axis,2,COM1,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,, PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,, PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
...@@ -11,3 +11,5 @@ PRO,0,移栽上下轴减速度,UpdownAxis_DelSpeed,400,,,,, ...@@ -11,3 +11,5 @@ PRO,0,移栽上下轴减速度,UpdownAxis_DelSpeed,400,,,,,
PRO,0,移栽上下轴原点低速度,UpdownAxis_HomeLowSpeed,100,,,,, PRO,0,移栽上下轴原点低速度,UpdownAxis_HomeLowSpeed,100,,,,,
PRO,0,移栽上下轴原点高速,UpdownAxis_HomeHighSpeed,200,,,,, PRO,0,移栽上下轴原点高速,UpdownAxis_HomeHighSpeed,200,,,,,
PRO,0,移栽上下轴原点加速度,UpdownAxis_HomeAddSpeed,200,,,,, PRO,0,移栽上下轴原点加速度,UpdownAxis_HomeAddSpeed,200,,,,,
,,,,,,,,,
PRO,0,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,,
...@@ -21,10 +21,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -21,10 +21,6 @@ namespace OnlineStore.DeviceLibrary
public AxisAlarmInfo AxisAlarm = new AxisAlarmInfo(); public AxisAlarmInfo AxisAlarm = new AxisAlarmInfo();
public FeedingEquip_Config Config; public FeedingEquip_Config Config;
/// <summary>
///入料装置后面分为两条移动线
/// </summary>
public LineMoveInfo SecondMoveInfo = null;
// public List<InOutParam> waitOutStoreList = new List<InOutParam>(); // public List<InOutParam> waitOutStoreList = new List<InOutParam>();
public List<InOutParam> waitInStoreList = new List<InOutParam>(); public List<InOutParam> waitInStoreList = new List<InOutParam>();
...@@ -47,7 +43,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -47,7 +43,6 @@ namespace OnlineStore.DeviceLibrary
//this.Box = box; //this.Box = box;
MoveInfo = new LineMoveInfo(DeviceID,"入料-"+DeviceID+"-MoveInfo"); MoveInfo = new LineMoveInfo(DeviceID,"入料-"+DeviceID+"-MoveInfo");
SecondMoveInfo = new LineMoveInfo(DeviceID, "入料-" + DeviceID + "-SecondMoveInfo");
IsDebug = config.IsDebug.Equals(1); IsDebug = config.IsDebug.Equals(1);
UpdownUseAxis = config.UpDownUseAxis.Equals(1); UpdownUseAxis = config.UpDownUseAxis.Equals(1);
if (UpdownUseAxis) if (UpdownUseAxis)
...@@ -71,7 +66,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -71,7 +66,6 @@ namespace OnlineStore.DeviceLibrary
{ {
mainTimer.Enabled = false; mainTimer.Enabled = false;
MoveInfo.EndMove(); MoveInfo.EndMove();
SecondMoveInfo.EndMove();
lineStatus = LineStatus.StoreOnline; lineStatus = LineStatus.StoreOnline;
//TODO 调试时暂时注释 //TODO 调试时暂时注释
runStatus = LineRunStatus.HomeMoving; runStatus = LineRunStatus.HomeMoving;
...@@ -82,7 +76,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -82,7 +76,6 @@ namespace OnlineStore.DeviceLibrary
{ {
mainTimer.Enabled = false; mainTimer.Enabled = false;
MoveInfo.EndMove(); MoveInfo.EndMove();
SecondMoveInfo.EndMove();
lineStatus = LineStatus.StoreOnline; lineStatus = LineStatus.StoreOnline;
//TODO 调试时暂时注释 //TODO 调试时暂时注释
runStatus = LineRunStatus.HomeMoving; runStatus = LineRunStatus.HomeMoving;
...@@ -141,11 +134,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -141,11 +134,11 @@ namespace OnlineStore.DeviceLibrary
// break; // break;
default: break; default: break;
} }
if (MoveInfo.MoveType == LineMoveType.InStore || this.SecondMoveInfo.MoveType == LineMoveType.InStore) if (MoveInfo.MoveType == LineMoveType.InStore )
{ {
InStoreProcess(); InStoreProcess();
} }
else if (MoveInfo.MoveType == LineMoveType.OutStore || SecondMoveInfo.MoveType == LineMoveType.OutStore) else if (MoveInfo.MoveType == LineMoveType.OutStore )
{ {
OutStoreProcess(); OutStoreProcess();
} }
...@@ -161,11 +154,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -161,11 +154,6 @@ namespace OnlineStore.DeviceLibrary
{ {
StopMoveProcess(); StopMoveProcess();
} }
if (SecondMoveInfo.MoveType .Equals( LineMoveType.CheckFixture))
{
//CheckFixtureProcess();
}
} }
...@@ -191,7 +179,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -191,7 +179,7 @@ namespace OnlineStore.DeviceLibrary
BusyMoveProcess(); BusyMoveProcess();
//判断流水线打开了才可以运行 //判断流水线打开了才可以运行
if (SecondMoveInfo.MoveType.Equals(LineMoveType.None)) if (MoveInfo.MoveType.Equals(LineMoveType.None))
{ {
LineBean lineBean = LineManager.Line; LineBean lineBean = LineManager.Line;
if (lineBean.isCanProcessLine() && IOManager.IOValue(IO_Type.DriveMotor_Run,0).Equals(IO_VALUE.HIGH) && lineBean.runStatus >= LineRunStatus.Runing && lineBean.IsSleep.Equals(false)) if (lineBean.isCanProcessLine() && IOManager.IOValue(IO_Type.DriveMotor_Run,0).Equals(IO_VALUE.HIGH) && lineBean.runStatus >= LineRunStatus.Runing && lineBean.IsSleep.Equals(false))
...@@ -226,7 +214,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -226,7 +214,7 @@ namespace OnlineStore.DeviceLibrary
} }
//若BOX和入料都没有在等待Io的过程中则此Io超时异常可能已经处理过 //若BOX和入料都没有在等待Io的过程中则此Io超时异常可能已经处理过
if (MoveInfo.IsInWait .Equals(false)&&SecondMoveInfo.IsInWait.Equals(false)) if (MoveInfo.IsInWait .Equals(false))
{ {
LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 "); LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 ");
alarmType = LineAlarmType.None; alarmType = LineAlarmType.None;
...@@ -295,7 +283,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -295,7 +283,6 @@ namespace OnlineStore.DeviceLibrary
// currMoveTrayNum = 0; // currMoveTrayNum = 0;
LogInfo( "开始重置:清零上一个托盘号,(上下气缸回原点,阻挡气缸输入=0 )开始;"); LogInfo( "开始重置:清零上一个托盘号,(上下气缸回原点,阻挡气缸输入=0 )开始;");
runStatus = LineRunStatus.Reset; runStatus = LineRunStatus.Reset;
SecondMoveInfo.EndMove();
MoveInfo.NewMove(LineMoveType.Reset); MoveInfo.NewMove(LineMoveType.Reset);
UpdownHomeMove(); UpdownHomeMove();
...@@ -323,11 +310,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -323,11 +310,8 @@ namespace OnlineStore.DeviceLibrary
{ {
CheckWait(MoveInfo); CheckWait(MoveInfo);
} }
else if (SecondMoveInfo.IsInWait)
{ if (!MoveInfo.IsInWait )
CheckWait(SecondMoveInfo);
}
if (!MoveInfo.IsInWait && !SecondMoveInfo.IsInWait)
{ {
//流水线各装置复原位,夹料气缸状态不变 //流水线各装置复原位,夹料气缸状态不变
//阻挡气缸全部=0 //阻挡气缸全部=0
...@@ -351,11 +335,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -351,11 +335,9 @@ namespace OnlineStore.DeviceLibrary
break; break;
case LineMoveStep.MH_OtherCylinder_Back: case LineMoveStep.MH_OtherCylinder_Back:
LogInfo( "重置完成!"); LogInfo( "重置完成!");
runStatus = LineRunStatus.Runing; runStatus = LineRunStatus.Runing;
MoveInfo.EndMove(); MoveInfo.EndMove();
SecondMoveInfo.EndMove();
break; break;
//TODO 需要继续之前的的出入库处理 //TODO 需要继续之前的的出入库处理
//ContinueInOutStore(); //ContinueInOutStore();
...@@ -373,11 +355,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -373,11 +355,7 @@ namespace OnlineStore.DeviceLibrary
{ {
CheckWait(MoveInfo); CheckWait(MoveInfo);
} }
if (SecondMoveInfo.IsInWait) if (!MoveInfo.IsInWait )
{
CheckWait(SecondMoveInfo);
}
if (!MoveInfo.IsInWait && !SecondMoveInfo.IsInWait)
{ {
switch (MoveInfo.MoveStep) switch (MoveInfo.MoveStep)
{ {
...@@ -398,7 +376,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -398,7 +376,6 @@ namespace OnlineStore.DeviceLibrary
case LineMoveStep.MH_OtherCylinder_Back: case LineMoveStep.MH_OtherCylinder_Back:
MoveInfo.EndMove(); MoveInfo.EndMove();
SecondMoveInfo.EndMove();
LogInfo( "原点返回完成!"); LogInfo( "原点返回完成!");
runStatus = LineRunStatus.Runing; runStatus = LineRunStatus.Runing;
//如果是调试模式,入料装置两个阻挡气缸落下,并且不再移动 //如果是调试模式,入料装置两个阻挡气缸落下,并且不再移动
...@@ -423,11 +400,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -423,11 +400,8 @@ namespace OnlineStore.DeviceLibrary
{ {
CheckWait(MoveInfo); CheckWait(MoveInfo);
} }
if (SecondMoveInfo.IsInWait)
{ if (!MoveInfo.IsInWait )
CheckWait(SecondMoveInfo);
}
if (!MoveInfo.IsInWait && !SecondMoveInfo.IsInWait)
{ {
switch (MoveInfo.MoveStep) switch (MoveInfo.MoveStep)
{ {
...@@ -474,7 +448,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -474,7 +448,6 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.EndMove(); MoveInfo.EndMove();
} }
runStatus = LineRunStatus.Busy; runStatus = LineRunStatus.Busy;
SecondMoveInfo.EndMove();
LogInfo( "停止运动:(上下气缸上升端,阻挡气缸输入=0 )开始 "); LogInfo( "停止运动:(上下气缸上升端,阻挡气缸输入=0 )开始 ");
......
...@@ -120,7 +120,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -120,7 +120,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
string msg = Name + " 出现托盘顺序错乱,上个托盘号【" + preTrayNum + "】当前托盘号【" + trayNum + "(有料盘)】"; string msg = Name + " 托盘顺序错乱,上个托盘号【" + preTrayNum + "】当前有料托盘【" + trayNum + "】最大盘号【"+TrayManager.MaxTrayNum+"】";
TrayManager.UpdateTrayNumError(0, msg); TrayManager.UpdateTrayNumError(0, msg);
LogUtil.error(msg); LogUtil.error(msg);
} }
...@@ -169,7 +169,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -169,7 +169,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
string msg = Name + " 出现托盘顺序错乱,上个托盘号【" + preTrayNum + "】当前托盘号【" + trayNum + "(空盘)】"; string msg = Name + " 托盘顺序错乱,上个托盘号【" + preTrayNum + "】当前空托盘【" + trayNum + "】最大盘号【" + TrayManager.MaxTrayNum + "】";
TrayManager.UpdateTrayNumError(0, msg); TrayManager.UpdateTrayNumError(0, msg);
LogUtil.error(msg); LogUtil.error(msg);
} }
...@@ -181,7 +181,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -181,7 +181,7 @@ namespace OnlineStore.DeviceLibrary
{ {
IsWaitToScan = false; IsWaitToScan = false;
IsWaitEmptyGo = false; IsWaitEmptyGo = false;
LogUtil.error(Name + Config.StopCylinderIOType + "检测到Fixture_Check_4亮,但是托盘号为0,不处理托盘~"); LogUtil.debug(Name + Config.StopCylinderIOType + "检测到Fixture_Check_4亮,但是托盘号为0,不处理托盘~");
} }
} }
...@@ -305,6 +305,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -305,6 +305,16 @@ namespace OnlineStore.DeviceLibrary
else if (wait.WaitType == 3) else if (wait.WaitType == 3)
{ {
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds); wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
}else if (wait.WaitType == 8)
{
string posId = checkWaitInfo.MoveParam.PosId;
int id = checkWaitInfo.MoveParam.GetStoreId();
wait.IsEnd = LineServer.RightInPosId(id, posId);
}
else if (wait.WaitType.Equals(9))
{
int storeId = checkWaitInfo.MoveParam.GetStoreId();
wait.IsEnd = LineServer.BoxCanReviceTray(storeId);
} }
if (wait.IsEnd && checkWaitInfo.OneWaitCanEndStep) if (wait.IsEnd && checkWaitInfo.OneWaitCanEndStep)
{ {
...@@ -404,9 +414,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -404,9 +414,14 @@ namespace OnlineStore.DeviceLibrary
InOutLog("开始入库忙碌中[BUSY]"); InOutLog("开始入库忙碌中[BUSY]");
MoveInfo.NewMove(LineMoveType.InStore); MoveInfo.NewMove(LineMoveType.InStore);
MoveInfo.NextMoveStep(LineMoveStep.LI_00_Wait100); MoveInfo.NextMoveStep(LineMoveStep.LI_00_Wait100);
MoveInfo.MoveParam = param;
preTrayNum = param.TrayNumber; preTrayNum = param.TrayNumber;
//InOutLog("入库处理:(LI_00_Wait100 ,等待300毫秒后再放行 ) 开始");
//StoreMove.WaitList.Add(WaitResultInfo.WaitTime(300)); //等待料仓验证成功,最多等待10秒,若验证不成功,直接失败
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitCanInstore());
MoveInfo.OneWaitCanEndStep = true;
} }
protected override void InStoreProcess() protected override void InStoreProcess()
{ {
...@@ -425,10 +440,33 @@ namespace OnlineStore.DeviceLibrary ...@@ -425,10 +440,33 @@ namespace OnlineStore.DeviceLibrary
switch (MoveInfo.MoveStep) switch (MoveInfo.MoveStep)
{ {
case LineMoveStep.LI_00_Wait100: case LineMoveStep.LI_00_Wait100:
//判断是否可以入库
string posId = MoveInfo.MoveParam.PosId;
int id = MoveInfo.MoveParam.GetStoreId();
bool result= LineServer.RightInPosId(id, posId);
MoveEquip moveEquip = null;
MoveEquipMap.TryGetValue(id, out moveEquip);
if (!result || moveEquip == null)
{
LogUtil.error("入库处理:入库验证失败【" + id + "】【" + posId + "】,结束入库");
IsScanCode = false;
MoveInfo.EndMove();
runStatus = LineRunStatus.Runing;
lineStatus = LineStatus.StoreOnline;
}
else
{
lock (moveEquip.waitInListLock)
{
//如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil.info(moveEquip.Name + " 入库命令: " + MoveInfo.MoveParam.ToStr() + "已验证完成 ,写入排队列表中等待!");
moveEquip.waitInStoreList.Add(MoveInfo.MoveParam);
}
MoveInfo.NextMoveStep(LineMoveStep.LI_01_StopCylinder2Down); MoveInfo.NextMoveStep(LineMoveStep.LI_01_StopCylinder2Down);
InOutLog("入库处理:(LI_01_StopCylinder2Down ,阻挡气缸0-1上升,阻挡气缸0-2下降 ) 开始"); InOutLog("入库处理:(LI_01_StopCylinder2Down ,阻挡气缸0-1上升,阻挡气缸0-2下降 ) 开始");
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH); IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
}
break; break;
case LineMoveStep.LI_01_StopCylinder2Down: case LineMoveStep.LI_01_StopCylinder2Down:
MoveInfo.NextMoveStep(LineMoveStep.LI_02_FixtureCheck); MoveInfo.NextMoveStep(LineMoveStep.LI_02_FixtureCheck);
......
...@@ -33,7 +33,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -33,7 +33,6 @@ namespace OnlineStore.DeviceLibrary
public MoveEquip(string cid, MoveEquip_Config config) public MoveEquip(string cid, MoveEquip_Config config)
{ {
baseConfig = config;
this.DeviceID = config.Id; this.DeviceID = config.Id;
this.Config = config; this.Config = config;
Name = (" " + "_移栽_" + DeviceID + " ").ToUpper(); Name = (" " + "_移栽_" + DeviceID + " ").ToUpper();
......
...@@ -131,6 +131,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -131,6 +131,17 @@ namespace OnlineStore.DeviceLibrary
{ {
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds); wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
} }
else if (wait.WaitType == 8)
{
string posId = moveInfo.MoveParam.PosId;
int id = moveInfo.MoveParam.GetStoreId();
wait.IsEnd = LineServer.RightInPosId(id, posId);
}
else if (wait.WaitType.Equals(9))
{
int storeId = moveInfo.MoveParam.GetStoreId();
wait.IsEnd = LineServer.BoxCanReviceTray(storeId);
}
if (wait.IsEnd && moveInfo.OneWaitCanEndStep) if (wait.IsEnd && moveInfo.OneWaitCanEndStep)
{ {
isOk = true; isOk = true;
...@@ -408,11 +419,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -408,11 +419,12 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_09_UpDownCylinderUp)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_09_UpDownCylinderUp))
{ {
InStoreLog("入库:(MI_10_BeforeAfterCylinderBefore,前后气缸1前进)"); int num = MoveInfo.MoveParam.TrayNumber;
InStoreLog("入库:(MI_10_BeforeAfterCylinderBefore,前后气缸1前进),更新盘号【" + num + "】为空盘");
MoveInfo.NextMoveStep(LineMoveStep.MI_10_BeforeAfterCylinderBefore); MoveInfo.NextMoveStep(LineMoveStep.MI_10_BeforeAfterCylinderBefore);
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before); CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before);
int num = TrayManager.GetNum(DeviceID); // int num = TrayManager.GetNum(DeviceID);
LogInfo("入库【" + posId + "】处理: 物品已移走,重新读取并更新盘号【" + num + "】为空盘"); //LogInfo("入库【" + posId + "】处理: 物品已移走,重新读取并更新盘号【" + num + "】为空盘");
TrayManager.UpdateFixtureValue(num, false, 0); TrayManager.UpdateFixtureValue(num, false, 0);
//阻挡气缸移动 //阻挡气缸移动
...@@ -423,9 +435,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -423,9 +435,9 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_10_BeforeAfterCylinderBefore)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_10_BeforeAfterCylinderBefore))
{ {
LogInfo("入库【" + posId + "】处理(等待移栽):(判断box门口没有盘之后,才能把料盘放下"); LogInfo("入库【" + posId + "】处理(等待移栽):(判断box门口没有盘, 且可以入库,才能把料盘放下)");
//此处需要等待box门口没有盘 //此处需要等待box门口没有盘
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitBoxCanReviceTray());
MoveInfo.NextMoveStep(LineMoveStep.MI_10_WaitBox); MoveInfo.NextMoveStep(LineMoveStep.MI_10_WaitBox);
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_10_WaitBox)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_10_WaitBox))
...@@ -669,7 +681,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -669,7 +681,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
string msg = Name + " 出现托盘顺序错乱,上一个托盘号【" + preTrayNum + "】当前托盘号 【" + currMoveTrayNum + "】"; string msg = Name + " 托盘顺序错乱,上个托盘号【" + preTrayNum + "】当前托盘号 【" + currMoveTrayNum + "】最大盘号【"+TrayManager.MaxTrayNum+"】";
TrayManager.UpdateTrayNumError(DeviceID, msg); TrayManager.UpdateTrayNumError(DeviceID, msg);
LogUtil.error(msg); LogUtil.error(msg);
return; return;
...@@ -682,7 +694,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -682,7 +694,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogInfo(SecondMoveInfo.MoveNum + "***************上一个托盘号【" + preTrayNum + "】,当前托盘号【(isFull=" + isFull + "):" + currMoveTrayNum + "】没有匹配的出入库任务,放盘通过~"); LogInfo(SecondMoveInfo.MoveNum + "***************上个托盘号【" + preTrayNum + "】,当前" + (isFull ? "有料托盘" : "空托盘") + "【" + currMoveTrayNum + "】没有出入库任务,放盘通过~");
// preTrayNum = currMoveTrayNum; // preTrayNum = currMoveTrayNum;
if (TrayManager.ErrorStoreId.Equals(DeviceID)) if (TrayManager.ErrorStoreId.Equals(DeviceID))
{ {
...@@ -817,6 +829,28 @@ namespace OnlineStore.DeviceLibrary ...@@ -817,6 +829,28 @@ namespace OnlineStore.DeviceLibrary
} }
public void CylinderMove(LineMoveInfo moveInfo, string IoLowType, string IoHighType)
{
IOMove(IoLowType, IO_VALUE.LOW);
IOMove(IoHighType, IO_VALUE.HIGH);
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoLowType, IO_VALUE.LOW));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoHighType, IO_VALUE.HIGH));
}
}
public void IOMove(string IoType, IO_VALUE value)
{
IOManager.IOMove(IoType, value, Config.Id);
}
public IO_VALUE IOValue(string IoType)
{
return IOManager.IOValue(IoType, Config.Id);
}
public void LogInfo(string logInfo)
{
LogUtil.info( Name + logInfo);
}
} }
} }
...@@ -159,31 +159,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -159,31 +159,19 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
/// <summary>
/// 验证托盘号是否正确
/// </summary>
public static bool RightTrayCode(int trayNum, int preTrayNum, bool isCanUpdateMax) public static bool RightTrayCode(int trayNum, int preTrayNum, bool isCanUpdateMax)
{ {
if (preTrayNum == 0) int defNext = preTrayNum + 1;
{ if (preTrayNum.Equals(0) || MaxTrayNum.Equals(0) || trayNum.Equals(defNext))
return true;
}
else if (trayNum == preTrayNum + 1)
{
return true;
}
else if (MaxTrayNum > 0 && trayNum == 1 && preTrayNum == MaxTrayNum)
{ {
return true; if (isCanUpdateMax && trayNum > MaxTrayNum)
}
if (trayNum == 1 && MaxTrayNum == 0 && isCanUpdateMax)
{ {
MaxTrayNum = preTrayNum; MaxTrayNum = trayNum;
LogUtil.info("更新MaxTrayNum=" + preTrayNum); LogUtil.info("更新MaxTrayNum=" + preTrayNum);
}
return true; return true;
} }
else if (isCanUpdateMax == false && MaxTrayNum == 0) else if (trayNum.Equals(1) && preTrayNum >= MaxTrayNum)
{ {
return true; return true;
} }
......
...@@ -520,10 +520,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -520,10 +520,10 @@ namespace OnlineStore.DeviceLibrary
return value; return value;
} }
private Box_Addr GetAddr(ushort StartAddress) //private Box_Addr GetAddr(ushort StartAddress)
{ //{
return (Box_Addr)(StartAddress); // return (Box_Addr)(StartAddress);
} //}
private Box_Sta GetBox_Sta(IO_VALUE onOff) private Box_Sta GetBox_Sta(IO_VALUE onOff)
{ {
if (onOff.Equals(IO_VALUE.HIGH)) if (onOff.Equals(IO_VALUE.HIGH))
......
...@@ -244,6 +244,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -244,6 +244,18 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = false; wait.IsEnd = false;
return wait; return wait;
} }
public static WaitResultInfo WaitCanInstore()
{
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = 8;
return wait;
}
public static WaitResultInfo WaitBoxCanReviceTray( )
{
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = 9;
return wait;
}
public string ToStr() public string ToStr()
{ {
if (WaitType == 1) if (WaitType == 1)
...@@ -279,6 +291,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -279,6 +291,13 @@ namespace OnlineStore.DeviceLibrary
}else if (WaitType == 7) }else if (WaitType == 7)
{ {
return "料盘高度【" + HeightValue + "】 "; return "料盘高度【" + HeightValue + "】 ";
}else if (WaitType == 8)
{
return "入库库位验证完成";
}
else if (WaitType == 9)
{
return "入库BOX可以开始入库";
} }
else else
{ {
...@@ -334,6 +353,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -334,6 +353,8 @@ namespace OnlineStore.DeviceLibrary
/// 高度 /// 高度
/// </summary> /// </summary>
public int HeightValue { get; set; } public int HeightValue { get; set; }
} }
public enum LineMoveType public enum LineMoveType
{ {
......
using System; using System;
using System.Collections.Generic;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
...@@ -13,10 +14,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -13,10 +14,10 @@ namespace OnlineStore.DeviceLibrary
SRunStatus = (int)LineRunStatus.Wait; SRunStatus = (int)LineRunStatus.Wait;
SAlarmType = LineAlarmType.None; SAlarmType = LineAlarmType.None;
HasTray = 0; HasTray = 0;
WaitInStoreList = new List<string>();
} }
public BoxInfo(int id,string cid,int seq,int ss,int runs,int hasTray,int alarmType) public BoxInfo(int id,string cid,int seq,int ss,int runs,int hasTray,int alarmType,List<string> inList)
{ {
this.ID = id; this.ID = id;
CId = cid; CId = cid;
...@@ -26,6 +27,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -26,6 +27,7 @@ namespace OnlineStore.DeviceLibrary
SAlarmType = (LineAlarmType)alarmType; SAlarmType = (LineAlarmType)alarmType;
LastMsgTime = DateTime.Now; LastMsgTime = DateTime.Now;
this.HasTray = hasTray; this.HasTray = hasTray;
this.WaitInStoreList = inList;
} }
public string ToShowStr() public string ToShowStr()
...@@ -69,5 +71,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -69,5 +71,6 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public int HasTray { get; set; } public int HasTray { get; set; }
public List<string> WaitInStoreList = new List<string>();
} }
} }
...@@ -71,7 +71,25 @@ namespace OnlineStore.DeviceLibrary ...@@ -71,7 +71,25 @@ namespace OnlineStore.DeviceLibrary
} }
return false; return false;
} }
/// <summary>
/// 判断库位是否验证成功
/// </summary>
public static bool RightInPosId(int id,string posId)
{
BoxInfo box = GetBoxInfo(id);
if (box != null)
{
TimeSpan span = DateTime.Now - box.LastMsgTime;
if (span.TotalSeconds < ClientKeepSecond )
{
if (box.WaitInStoreList != null && box.WaitInStoreList.Contains(posId))
{
return true;
}
}
}
return false;
}
/// <summary> /// <summary>
/// 移栽装置送盘到料仓门口时,需要判断是否可以将盘送入 /// 移栽装置送盘到料仓门口时,需要判断是否可以将盘送入
/// </summary> /// </summary>
...@@ -83,7 +101,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -83,7 +101,7 @@ namespace OnlineStore.DeviceLibrary
if (box != null) if (box != null)
{ {
TimeSpan span = DateTime.Now - box.LastMsgTime; TimeSpan span = DateTime.Now - box.LastMsgTime;
if (span.TotalSeconds < ClientKeepSecond&&box.HasTray.Equals(0)&&box.SAlarmType.Equals(LineAlarmType.None)) if (span.TotalSeconds < ClientKeepSecond&&box.HasTray.Equals(0)&&box.SAlarmType.Equals(LineAlarmType.None) )
{ {
LineRunStatus runs = (LineRunStatus)box.SRunStatus; LineRunStatus runs = (LineRunStatus)box.SRunStatus;
...@@ -91,14 +109,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -91,14 +109,6 @@ namespace OnlineStore.DeviceLibrary
{ {
return true; return true;
} }
else if (runs.Equals(LineRunStatus.Busy))
{
LineStatus status = (LineStatus)box.SStatus;
if (status.Equals(LineStatus.StoreOnline) || status.Equals(LineStatus.InStoreEnd) || status.Equals(LineStatus.InStoreExecute))
{
return true;
}
}
} }
} }
return false; return false;
...@@ -240,6 +250,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -240,6 +250,10 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.error("CheckInStorePos【" + id + "】【" + msg + "】失败"); LogUtil.error("CheckInStorePos【" + id + "】【" + msg + "】失败");
} }
else
{
// LogUtil.info("CheckInStorePos【" + id + "】【" + msg + "】发送成功");
}
} }
}catch(Exception ex) }catch(Exception ex)
{ {
...@@ -321,7 +335,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -321,7 +335,7 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
int id = storeSMsg.StoreId; int id = storeSMsg.StoreId;
BoxInfo box = new BoxInfo(storeSMsg.StoreId,storeSMsg.Cid,storeSMsg.Seq,storeSMsg.SStatus,storeSMsg.SRunStatus,storeSMsg.DoorHasTray,storeSMsg.AlarmType); BoxInfo box = new BoxInfo(storeSMsg.StoreId,storeSMsg.Cid,storeSMsg.Seq,storeSMsg.SStatus,storeSMsg.SRunStatus,storeSMsg.DoorHasTray,storeSMsg.AlarmType,storeSMsg.WaitInStoreList);
SaveBoxClient(id, box, client); SaveBoxClient(id, box, client);
string cmd = storeSMsg.Cmd; string cmd = storeSMsg.Cmd;
...@@ -405,6 +419,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -405,6 +419,8 @@ namespace OnlineStore.DeviceLibrary
public string PosId = ""; public string PosId = "";
public string PlateH = "0"; public string PlateH = "0";
public string PlateW = "0"; public string PlateW = "0";
public List<string> WaitInStoreList = new List<string>();
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!