Commit b933db27 LN

1

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