Commit 2974d919 LN

增加出料线禁用框

1 个父辈 5b55cc5a
......@@ -75,7 +75,14 @@ namespace OnlineStore.AssemblyLine
{
启用蜂鸣器ToolStripMenuItem.Text = "启用蜂鸣器";
}
if (TrayManager.DisTraySave)
{
自动保存托盘信息ToolStripMenuItem.Text = "自动保存托盘信息";
}
else
{
自动保存托盘信息ToolStripMenuItem.Text = gouStr + "自动保存托盘信息";
}
LogUtil.logBox = this.logBox;
lastLogTime = DateTime.Now.AddMinutes(-10);
this.Opacity = 100;
......@@ -1014,9 +1021,8 @@ namespace OnlineStore.AssemblyLine
}
}
}
#endregion
#endregion
#region ListView显示
......@@ -1243,5 +1249,58 @@ namespace OnlineStore.AssemblyLine
//}
#endregion
private void 自动保存托盘信息ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!LoadOk)
{
return;
}
bool result = 自动保存托盘信息ToolStripMenuItem.Text.Contains(gouStr);
if (result.Equals( TrayManager.DisTraySave))
{
return;
}
TrayManager.DisTraySave = result;
ConfigAppSettings.SaveValue(Setting_Init.DisTraySave, (TrayManager.DisTraySave ? 1 : 0));
if (TrayManager.DisTraySave)
{
自动保存托盘信息ToolStripMenuItem.Text = "自动保存托盘信息";
}
else
{
自动保存托盘信息ToolStripMenuItem.Text = gouStr + " 自动保存托盘信息";
}
LogUtil.info(Name + " 点击:" + 自动保存托盘信息ToolStripMenuItem.Text);
}
private void chbLeftDis_CheckedChanged(object sender, EventArgs e)
{
if (!LoadOk)
{
return;
}
if (LineManager.DisLeftOutLine.Equals(chbLeftDis.Checked))
{
return;
}
LineManager.DisLeftOutLine = chbLeftDis.Checked;
LogUtil.error("用户点击勾选:" + chbLeftDis.Text+"="+ LineManager.DisLeftOutLine);
}
private void chbRightDis_CheckedChanged(object sender, EventArgs e)
{
if (!LoadOk)
{
return;
}
if (LineManager.DisRightOutLine.Equals(chbRightDis.Checked))
{
return;
}
LineManager.DisRightOutLine = chbRightDis.Checked;
LogUtil.error("用户点击勾选:" + chbRightDis.Text + "="+ LineManager.DisRightOutLine);
}
}
}
......@@ -101,5 +101,7 @@ namespace OnlineStore.Common
public static string UseHCBoard = "UseHCBoard";
public static string ConfigPath_TrayList = "ConfigPath_TrayList";
public static string DisTraySave = "DisTraySave";
}
}
......@@ -309,11 +309,11 @@ namespace OnlineStore.DeviceLibrary
TrayManager.TrayErrorMsg = DateTime.Now.ToLongTimeString() + " " + Name + "托盘号出现错乱:上一个托盘[" + preTrayNum + "] 当前托盘 [" + currTrayNum + "],连续两个托盘号一样";
LogUtil.error(Name + "托盘号错乱:上一个托盘[" + preTrayNum + "] 当前托盘 [" + currTrayNum + "],连续两个托盘号一样");
}
else if (!TrayManager.CheckIsRightNum(currTrayNum, preTrayNum))
{
TrayManager.TrayErrorMsg = DateTime.Now.ToLongTimeString() + " " + Name + "托盘号出现错乱:上一个托盘[" + preTrayNum + "] 当前托盘 [" + currTrayNum + "],托盘号不连续";
LogUtil.error(Name + "托盘号错乱:上一个托盘[" + preTrayNum + "] 当前托盘 [" + currTrayNum + "],托盘号不连续");
}
//else if (!TrayManager.CheckIsRightNum(currTrayNum, preTrayNum))
//{
// TrayManager.TrayErrorMsg = DateTime.Now.ToLongTimeString() + " " + Name + "托盘号出现错乱:上一个托盘[" + preTrayNum + "] 当前托盘 [" + currTrayNum + "],托盘号不连续";
// LogUtil.error(Name + "托盘号错乱:上一个托盘[" + preTrayNum + "] 当前托盘 [" + currTrayNum + "],托盘号不连续");
//}
return true;
}
internal void ClearTrayRFID()
......
......@@ -757,6 +757,16 @@ namespace OnlineStore.DeviceLibrary
{
try
{
//判断是否禁用
if(LineManager.DisLeftOutLine&&(DeviceID.Equals(204) || DeviceID.Equals(209)))
{
return false;
}
if(LineManager.DisRightOutLine&& (DeviceID.Equals(213) || DeviceID.Equals(216)))
{
return false;
}
if (Config.IsOutLineIn && trayNum > 0)
{
//测线满时不需要横移
......
......@@ -142,6 +142,7 @@ namespace OnlineStore.DeviceLibrary
private int GetRobotIndex()
{
//机器人索引号
int robotIndex = 1;
if (DeviceID.Equals(212))
{
......
......@@ -746,24 +746,15 @@ namespace OnlineStore.DeviceLibrary
bool isNeed = false;
UpdateTrayNum();
bool isFull = TrayManager.TrayIsFull(currTrayNum);
if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false))
//出库中,需要拦盘
if (CheckIsNeedOutStore())
{
//出库中,需要拦盘
if (CheckIsNeedOutStore())
{
isNeed = true;
}
else if (isFull && IsInStoreNeed())
{
isNeed = true;
}
isNeed = true;
}
else
else if (isFull && IsInStoreNeed())
{
string msg = Name + " 托盘顺序错乱,上个托盘号【" + preTrayNum + "】当前托盘号 【" + currTrayNum + "】最大盘号【" + TrayManager.MaxTrayNum + "】";
TrayManager.UpdateTrayNumError(DeviceID, msg);
LogUtil.error(msg);
return;
isNeed = true;
}
if (isNeed)
{
......@@ -780,9 +771,7 @@ namespace OnlineStore.DeviceLibrary
TrayManager.UpdateTrayNumError(-1, "");
}
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
//CheckLog("托盘放行 " + SecondMoveInfo.SLog + " ,等待 NextStopCheck=0");
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.NextStopCheck, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
}
}
......
......@@ -14,6 +14,10 @@ namespace OnlineStore.DeviceLibrary
{
public class LineManager
{
public static bool DisLeftOutLine = false ;
public static bool DisRightOutLine = false ;
public static bool UseBuzzer = ConfigAppSettings.GetIntValue(Setting_Init.UseBuzzer).Equals(1);
private static bool isInit = false;
public static bool IsConnectServer = !ConfigAppSettings.GetValue(Setting_Init.http_server).Equals("");
......
......@@ -15,15 +15,16 @@ namespace OnlineStore.DeviceLibrary
{
public class TrayManager
{
public static bool DisTraySave = ConfigAppSettings.GetIntValue(Setting_Init.DisTraySave).Equals(1);
/// <summary>
/// 托盘集合,key=托盘编号,value=托盘详细信息
/// </summary>
private static ConcurrentDictionary<int, TrayInfo> TrayInfoMap = new ConcurrentDictionary<int, TrayInfo>();
/// <summary>
/// 最大托盘号,必须按照顺序从1到6走过
/// </summary>
internal static int MaxTrayNum = 0;
///// <summary>
///// 最大托盘号,必须按照顺序从1到6走过
///// </summary>
//internal static int MaxTrayNum = 0;
/// <summary>
/// 托盘错误消息
/// </summary>
......@@ -123,33 +124,33 @@ namespace OnlineStore.DeviceLibrary
}
public static bool NeedCheckTray = ConfigAppSettings.GetIntValue(Setting_Init.NeedCheckTray).Equals(1);
internal static bool CheckIsRightNum(int trayNum, int preTrayNum, bool isCanUpdateMax = true)
{
if (!NeedCheckTray)
{
return true;
}
int defNext = preTrayNum + 1;
if (preTrayNum.Equals(0) || MaxTrayNum.Equals(0) || trayNum.Equals(defNext))
{
if (isCanUpdateMax && trayNum > MaxTrayNum)
{
MaxTrayNum = trayNum;
LogUtil.info("更新MaxTrayNum=" + preTrayNum);
}
return true;
}
else if (trayNum.Equals(1) && preTrayNum >= MaxTrayNum)
{
return true;
}
return false;
}
internal static bool RightTrayCode(int trayNum, int preTrayNum, bool isCanUpdateMax = true)
{
return true;
return CheckIsRightNum(trayNum, preTrayNum, isCanUpdateMax);
}
//internal static bool CheckIsRightNum(int trayNum, int preTrayNum, bool isCanUpdateMax = true)
//{
// if (!NeedCheckTray)
// {
// return true;
// }
// int defNext = preTrayNum + 1;
// if (preTrayNum.Equals(0) || MaxTrayNum.Equals(0) || trayNum.Equals(defNext))
// {
// if (isCanUpdateMax && trayNum > MaxTrayNum)
// {
// MaxTrayNum = trayNum;
// LogUtil.info("更新MaxTrayNum=" + preTrayNum);
// }
// return true;
// }
// else if (trayNum.Equals(1) && preTrayNum >= MaxTrayNum)
// {
// return true;
// }
// return false;
//}
//internal static bool RightTrayCode(int trayNum, int preTrayNum, bool isCanUpdateMax = true)
//{
// return true;
// //return CheckIsRightNum(trayNum, preTrayNum, isCanUpdateMax);
//}
internal static void UpdateTrayNumError(int errorStoreID, string errorMsg)
{
......@@ -174,6 +175,11 @@ namespace OnlineStore.DeviceLibrary
public static void InitFileData()
{
TrayInfoMap = new ConcurrentDictionary<int, TrayInfo>();
if (DisTraySave)
{
LogUtil.error("禁用了托盘保存功能,不需要从文件夹加载托盘");
return;
}
FilePath = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.ConfigPath_TrayList);
if (File.Exists(FilePath))
{
......@@ -186,6 +192,22 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info("加载到缓存托盘:" + tray.ToStr());
TrayInfoMap.TryAdd(tray.TrayNum, tray);
if (tray.InOrOutStore.Equals(1)&&tray.InoutPar.InStoreNg.Equals(false) && (!tray.InoutPar.PosId.Equals("")) && (!tray.InoutPar.WareCode.Equals("")))
{
int storeId = tray.InoutPar.GetStoreId();
if (storeId > 0 && LineManager.Line.MoveEquipMap.ContainsKey(storeId))
{
MoveEquip moveEquip = LineManager.Line.MoveEquipMap[storeId];
lock (moveEquip.waitInListLock)
{
//如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil.info(moveEquip.Name + " 将托盘入库任务["+tray.TrayNum+"]: " + tray.InoutPar.ToStr() + "加入等待列表中!");
moveEquip.waitInStoreList.Add(tray.InoutPar);
}
}
}
}
}
LogUtil.info("托盘加载完成");
......@@ -195,7 +217,7 @@ namespace OnlineStore.DeviceLibrary
public static void SaveMapToFile()
{
try
{
{
List<TrayInfo> trayList = new List<TrayInfo>();
List<string> lineList = new List<string>();
foreach (TrayInfo tray in trayList)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!