Commit 2411414f LN

流水线优化

1 个父辈 6e3c379e
此文件类型无法预览
......@@ -242,7 +242,12 @@
</member>
<member name="E:Asa.Client2.CloseDoor">
<summary>
关门
关门,仅包装料仓
</summary>
</member>
<member name="E:Asa.Client2.EnterShelf">
<summary>
准备进入料架不能出料,仅包装料仓
</summary>
</member>
<member name="E:Asa.Client2.Log">
......@@ -431,6 +436,11 @@
小车已准备,已对接上流水线
</summary>
</member>
<member name="F:Asa.ClientAction.EnterShelf">
<summary>
包装料仓只能入料不能出料
</summary>
</member>
<member name="T:Asa.ClientLevel">
<summary>
客户端的优先级
......
......@@ -32,7 +32,7 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmLineStore));
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.chbAGV = new System.Windows.Forms.CheckBox();
this.logBox = new System.Windows.Forms.RichTextBox();
this.lblCID = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
......@@ -126,7 +126,7 @@
//
// tabPage1
//
this.tabPage1.Controls.Add(this.checkBox1);
this.tabPage1.Controls.Add(this.chbAGV);
this.tabPage1.Controls.Add(this.logBox);
this.tabPage1.Controls.Add(this.lblCID);
this.tabPage1.Controls.Add(this.groupBox3);
......@@ -141,17 +141,19 @@
this.tabPage1.Text = "状态信息";
this.tabPage1.UseVisualStyleBackColor = true;
//
// checkBox1
// chbAGV
//
this.checkBox1.AutoSize = true;
this.checkBox1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.checkBox1.Location = new System.Drawing.Point(478, 137);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(119, 24);
this.checkBox1.TabIndex = 198;
this.checkBox1.Text = "启用agvClient";
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
this.chbAGV.AutoSize = true;
this.chbAGV.Checked = true;
this.chbAGV.CheckState = System.Windows.Forms.CheckState.Checked;
this.chbAGV.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbAGV.Location = new System.Drawing.Point(478, 137);
this.chbAGV.Name = "chbAGV";
this.chbAGV.Size = new System.Drawing.Size(138, 24);
this.chbAGV.TabIndex = 198;
this.chbAGV.Text = "AGV cancelState";
this.chbAGV.UseVisualStyleBackColor = true;
this.chbAGV.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// logBox
//
......@@ -869,7 +871,7 @@
private System.Windows.Forms.ToolStripMenuItem 清空托盘信息ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator13;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.CheckBox chbAGV;
}
}
......@@ -566,7 +566,11 @@ namespace OnlineStore.AssemblyLine
SetMenuS(启动AToolStripMenuItem, true);
SetMenuS(复位RToolStripMenuItem, false);
SetMenuS(停止TToolStripMenuItem, false);
}
}
if (!chbAGV.Checked.Equals(AgvClient.CurrCancelState))
{
chbAGV.Checked = AgvClient.CurrCancelState;
}
}
private void SetItemColor(int i, LineRunStatus runStatus)
......@@ -891,7 +895,17 @@ namespace OnlineStore.AssemblyLine
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
lineBean.UseAgvClient = checkBox1.Checked;
if (!LoadOk)
{
return;
}
if (chbAGV.Checked.Equals(AgvClient.CurrCancelState))
{
return;
}
bool result = chbAGV.Checked;
AgvClient.SetCancelState(result);
LogUtil.info("勾选:AgvClient.SetCancelState =" + result);
}
}
}
......@@ -149,7 +149,11 @@ agv客户端启动时需要设置状态为none
2.皮带线456信号修改。
20200224
增加agv的cancelState的修改功能。
扫码入库时,发送给服务器的cid顺序修改。
料串进入紧急出料模块后,停在两个信号中间的问题。
横移机构优化,上一个托盘准备离开时,下一个托盘就可以进入。
......
......@@ -11,6 +11,7 @@ namespace OnlineStore.DeviceLibrary
{
public class AgvClient
{
public static bool CurrCancelState = true;
private static string ServerIp = ConfigAppSettings.GetValue(Setting_Init.AgvServerIp);
private static Asa.Client2 agvClient;
public static Dictionary<string, Asa.ClientAction> actionMap = new Dictionary<string, Asa.ClientAction>();
......@@ -27,7 +28,7 @@ namespace OnlineStore.DeviceLibrary
agvClient = new Asa.Client2(ServerIp);
agvClient.CancelState = true;
agvClient.Log += AgvClient_Log;
agvClient.Arrive += AgvClient_Arrive;
agvClient.Arrive += AgvClient_Arrive;
agvClient.Ready += AgvClient_Ready;
agvClient.CloseDoor += AgvClient_CloseDoor;
}
......@@ -36,22 +37,21 @@ namespace OnlineStore.DeviceLibrary
//{
// actionMap.Add(key, Asa.ClientAction.None);
//}
if (!LineManager.Line.UseAgvClient)
{
LogUtil.info("LineManager.Line.UseAgvClient 未启用,直接返回");
return;
}
else
{
//if (!LineManager.Line.UseAgvClient)
//{
// LogUtil.info("LineManager.Line.UseAgvClient 未启用,直接返回");
// return;
//}
//else
//{
LogUtil.info(" 开始 agvClient.Connect");
}
LogUtil.info(" 开始 agvClient.Connect");
//}
agvClient.Connect();
foreach (string str in NodeList)
{
SetStatus(str);
}
}
}
catch (Exception ex)
{
......@@ -61,6 +61,7 @@ namespace OnlineStore.DeviceLibrary
public static void SetCancelState(bool isCancel)
{
CurrCancelState = isCancel;
agvClient.CancelState = isCancel;
}
public static void SetStatus(string id, string shelfId = "", ClientAction action = ClientAction.None, ClientLevel level = ClientLevel.Low,bool isMust=false)
......
......@@ -736,7 +736,7 @@ namespace OnlineStore.DeviceLibrary
{
if (IOValue(IO_Type.SL_Entry_Check).Equals(IO_VALUE.LOW))
{
LogUtil.info(logName+ " 开始");
LogUtil.info(logName + " 开始");
//AgvClient.SetStatus(Config.AgvInName,"",ClientAction.MayEnter,ClientLevel.High);
ProcessShelfEnter = true;
////进料阻挡上升
......@@ -750,7 +750,17 @@ namespace OnlineStore.DeviceLibrary
if (!result)
{
LogUtil.info(logName +" 等待 SL_Stop_Check=High 超时,等待3000后停止转动,发送 FinishEnter");
LogUtil.info(logName + " 等待 SL_Entry_Check=High 超时, 等待 SL_Stop_Check 信号");
}
else
{
LogUtil.info(logName + "已收到 SL_Entry_Check=High , 等待 SL_Stop_Check 信号");
}
result = WaitIo(IO_Type.SL_Stop_Check, IO_VALUE.HIGH, 60000);
if (!result)
{
LogUtil.info(logName + " 等待 SL_Stop_Check=High 超时,等待3000后停止转动,发送 FinishEnter");
}
else
{
......@@ -760,14 +770,14 @@ namespace OnlineStore.DeviceLibrary
Thread.Sleep(3000);
IOMove(IO_Type.SL_Line_Run, IO_VALUE.LOW);
//料架可离开
AgvClient.SetStatus(Config.AgvInName,"",ClientAction.FinishEnter, ClientLevel.High, true);
AgvClient.SetStatus(Config.AgvInName, "", ClientAction.FinishEnter, ClientLevel.High, true);
Task.Factory.StartNew(delegate
{
Thread.Sleep(10000);
AgvClient.SetStatus(Config.AgvInName, "", ClientAction.None, ClientLevel.High, true);
});
ProcessShelfEnter = false;
LogUtil.info(logName + " 结束");
LogUtil.info(logName + " 结束");
}
}
catch (TimeoutException te)
......
......@@ -20,7 +20,7 @@ namespace OnlineStore.DeviceLibrary
public partial class LineBean : KTK_Store
{
public bool IsDebug = false;
public bool UseAgvClient = false;
// public bool UseAgvClient = false;
/// <summary>
/// 灯闪烁定时器
/// </summary>
......@@ -263,7 +263,7 @@ namespace OnlineStore.DeviceLibrary
RFIDManager.Open();
Thread.Sleep(5);
AgvClient.SetCancelState(false);
// AgvClient.SetCancelState(false);
LineServer.StartServer(ConfigAppSettings.GetIntValue(Setting_Init.TCPServerPort));
RHomeOp();
......
......@@ -272,32 +272,64 @@ namespace OnlineStore.DeviceLibrary
}
/// <summary>
/// 横移无处理
/// 横移无处理,上料机构和出料机构判断使用
/// </summary>
internal bool SwNoProcess(int sidesWayNum)
{
if (LineManager.Line.runStatus <= LineRunStatus.Wait || sidesWayNum <= 0)
{
return true;
}
if (sidesWayNum.Equals(2))
{
if (SW23_MoveInfo.MoveType.Equals(LineMoveType.None) && FeedingEquipMap[104].SecondMoveInfo.MoveType.Equals(LineMoveType.None))
{ return true; }
}
else if (sidesWayNum.Equals(3) && runStatus <= LineRunStatus.Wait)
try
{
return true;
}
if (LineManager.Line.runStatus <= LineRunStatus.Wait || sidesWayNum <= 0)
{
return true;
}
if (sidesWayNum.Equals(2))
{
if (SW23_MoveInfo.MoveType.Equals(LineMoveType.None))
{
LineMoveInfo moveInfo = FeedingEquipMap[104].SecondMoveInfo;
if (moveInfo.MoveType.Equals(LineMoveType.None))
{
return true;
}
else if (moveInfo.MoveType.Equals(LineMoveType.CheckFixture) &&
moveInfo.MoveStep >= LineMoveStep.MO_15_WaitCanGo &&
moveInfo.MoveStep <= LineMoveStep.MO_18_StopCylinder_Back)
{
return true;
}
}
}
else if (sidesWayNum.Equals(3) && runStatus <= LineRunStatus.Wait)
{
return true;
}
if (sidesWayNum.Equals(4))
{
if (SW41_MoveInfo.MoveType.Equals(LineMoveType.None) && FeedingEquipMap[101].SecondMoveInfo.MoveType.Equals(LineMoveType.None))
{ return true; }
if (sidesWayNum.Equals(4))
{
if (SW41_MoveInfo.MoveType.Equals(LineMoveType.None))
{
LineMoveInfo moveInfo = FeedingEquipMap[101].SecondMoveInfo;
if (moveInfo.MoveType.Equals(LineMoveType.None))
{
return true;
}
else if (moveInfo.MoveType.Equals(LineMoveType.CheckFixture) &&
moveInfo.MoveStep >= LineMoveStep.MO_15_WaitCanGo &&
moveInfo.MoveStep <= LineMoveStep.MO_18_StopCylinder_Back)
{
return true;
}
}
}
else if (sidesWayNum.Equals(3) && runStatus <= LineRunStatus.Wait)
{
return true;
}
}
else if (sidesWayNum.Equals(3) && runStatus <= LineRunStatus.Wait)
catch (Exception ex)
{
return true;
LogUtil.error("SwNoProcess [" + sidesWayNum + "] error :" + ex.ToString());
}
return false;
}
......@@ -362,7 +394,7 @@ namespace OnlineStore.DeviceLibrary
IOValue(IO_Type.SW4_StopDown).Equals(IO_VALUE.LOW) &&
IOValue(IO_Type.SW4_TrayCheck).Equals(IO_VALUE.LOW) &&
IOValue(IO_Type.SW1_TrayCheck).Equals(IO_VALUE.LOW) &&
(DateTime.Now - lastSw4StopDownTime).TotalSeconds > 4 &&
(DateTime.Now - lastSw4StopDownTime).TotalSeconds > 2 &&
TrayManager.LineCanMoveSW(4) && TrayManager.LineCanMoveSW(1))
{
if (TrayManager.checkWatch(sw41WaitWatch, TrayManager.SwTrayWaitTime, true))
......@@ -410,7 +442,7 @@ namespace OnlineStore.DeviceLibrary
IOValue(IO_Type.SW2_StopDown).Equals(IO_VALUE.LOW) &&
IOValue(IO_Type.SW2_TrayCheck).Equals(IO_VALUE.LOW) &&
IOValue(IO_Type.SW3_TrayCheck).Equals(IO_VALUE.LOW) &&
(DateTime.Now - lastSw2StopDownTime).TotalSeconds > 4 &&
(DateTime.Now - lastSw2StopDownTime).TotalSeconds > 2 &&
TrayManager.LineCanMoveSW(2) && TrayManager.LineCanMoveSW(3))
{
if (TrayManager.checkWatch(sw23WaitWatch, TrayManager.SwTrayWaitTime, true))
......
......@@ -47,7 +47,7 @@ namespace OnlineStore.DeviceLibrary
}
//##
private static string spiltStr = "##";
public static string CodeReceived(string deviceName, int trayNum, List<string> codeList, int height, int width,string rfid)
public static string CodeReceived(string deviceName, int trayNum, List<string> codeList, int height, int width,string rfid,int feedEquipId=1)
{
string msg = "";
try
......@@ -74,7 +74,7 @@ namespace OnlineStore.DeviceLibrary
// 参数:cids: 多个 cid
//code: 条码内容
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("cids", LineServer.GetAllCID());
paramMap.Add("cids", LineServer.GetAllCID(feedEquipId));
paramMap.Add("code", codeStr);
paramMap.Add(ParamDefine.rfid, rfid);
......
......@@ -139,20 +139,57 @@ namespace OnlineStore.DeviceLibrary
/// 获取所有在线的CID
/// </summary>
/// <returns></returns>
public static string GetAllCID()
public static string GetAllCID(int equipId)
{
int num = equipId % 100;
string result = "";
foreach (BoxInfo box in BoxMap.Values)
List<int> IdList = new List<int>();
if (equipId.Equals(2))
{
TimeSpan span = DateTime.Now - box.LastMsgTime;
if (span.TotalSeconds < ClientKeepSecond)
for (int i = 7; i <= 18; i++)
{
IdList.Add(i);
}
for (int i = 1; i <= 6; i++)
{
IdList.Add(i);
}
}
else if (equipId.Equals(3))
{
for (int i = 11; i <= 18; i++)
{
IdList.Add(i);
}
for (int i = 1; i <= 11; i++)
{
IdList.Add(i);
}
}
else
{
for (int i = 1; i <= 18; i++)
{
if (LineManager.Line.CanIntore(box.ID))
IdList.Add(i);
}
}
foreach (int id in IdList)
{
// foreach (BoxInfo box in BoxMap.Values)
//{
BoxInfo box = GetBoxInfo(id);
if (box != null)
{
TimeSpan span = DateTime.Now - box.LastMsgTime;
if (span.TotalSeconds < ClientKeepSecond)
{
result += box.CId + ",";
if (LineManager.Line.CanIntore(box.ID))
{
result += box.CId + ",";
}
}
}
}
}
if (result.EndsWith(","))
{
result = result.Substring(0, result.Length - 1);
......@@ -235,22 +272,22 @@ namespace OnlineStore.DeviceLibrary
}
return false;
}
/// <summary>
/// 获取整个料仓的状态
/// </summary>
public static Operation GetInStoreOperation(string message)
{
//构建发送给服务器的对象
Operation lineOperation = new Operation();
lineOperation.status = 1;
lineOperation.seq = ConfigAppSettings.nextSeq();
lineOperation.boxStatus = new Dictionary<int, BoxStatus>();
lineOperation.alarmList = new List<AlarmInfo>();
lineOperation.cid = LineServer.GetAllCID();
lineOperation.op = 1;
lineOperation.data = new Dictionary<string, string>() { { "code", message } };
return lineOperation;
}
///// <summary>
///// 获取整个料仓的状态
///// </summary>
//public static Operation GetInStoreOperation(string message)
//{
// //构建发送给服务器的对象
// Operation lineOperation = new Operation();
// lineOperation.status = 1;
// lineOperation.seq = ConfigAppSettings.nextSeq();
// lineOperation.boxStatus = new Dictionary<int, BoxStatus>();
// lineOperation.alarmList = new List<AlarmInfo>();
// lineOperation.cid = LineServer.GetAllCID();
// lineOperation.op = 1;
// lineOperation.data = new Dictionary<string, string>() { { "code", message } };
// return lineOperation;
//}
public static bool CheckInStorePos(int id, InOutParam param)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!