Commit 84a6bac7 LN

增加工位禁用功能

1 个父辈 76c33b41
......@@ -92,9 +92,9 @@ namespace OnlineStore.DeviceLibrary
AgvClient.NodeList.Add(config.AgvName2);
AgvClient.NodeList.Add(config.AgvName3);
StationMap = new Dictionary<int, WorkStation>();
StationMap.Add(1, new WorkStation("S1_", config.AgvName1,config.RFID_IP1));
StationMap.Add(2, new WorkStation("S2_", config.AgvName2,config.RFID_IP2));
StationMap.Add(3, new WorkStation("S3_", config.AgvName3,config.RFID_IP3));
StationMap.Add(1, new WorkStation(1,"S1_", config.AgvName1,config.RFID_IP1));
StationMap.Add(2, new WorkStation(2,"S2_", config.AgvName2,config.RFID_IP2));
StationMap.Add(3, new WorkStation(3,"S3_", config.AgvName3,config.RFID_IP3));
HCBoardManager.InitConfig();
IOManager.Init();
......@@ -790,6 +790,7 @@ namespace OnlineStore.DeviceLibrary
}
if (LineConnect.DoorPosInfo.IsNg || LineConnect.DoorPosInfo.barcode.Equals(""))
{
LineConnect.DoorPosInfo.IsNg = true;
StartMove();
return;
}
......@@ -803,7 +804,7 @@ namespace OnlineStore.DeviceLibrary
ClearWarnMsg("暂无可用料架");
//获取库位号
string outMsg = "";
CurrTray = HttpServer.GetLocation(1, shelfRfid, out outMsg);
CurrTray = HttpServer.GetLocation(LineConnect.DoorPosInfo.barcode, shelfRfid, out outMsg);
//需要取放料,且料架已准备好
if (String.IsNullOrEmpty(CurrTray.getP).Equals(false) && outMsg.Equals(""))
{
......@@ -862,7 +863,7 @@ namespace OnlineStore.DeviceLibrary
{
if (shelf.IsReady())
{
str += shelf.CurrShelf.RealShelf + ";";
str += shelf.CurrShelf.RealShelf + ",";
}
}
return str;
......@@ -980,7 +981,14 @@ namespace OnlineStore.DeviceLibrary
foreach (WorkStation shelf in StationMap.Values)
{
msg += shelf.Name + ": " + shelf.CurrShelf.ToStr()+"\r\n";
if (shelf.IsDis())
{
msg += shelf.Name + ": 已禁用\r\n";
}
else
{
msg += shelf.Name + ": " + shelf.CurrShelf.ToStr() + "\r\n";
}
}
if (alarmType.Equals(StoreAlarmType.None))
{
......
......@@ -21,6 +21,9 @@ namespace OnlineStore.DeviceLibrary
public static EquipConfig Config = null;
private static bool isInit = false;
public static bool IsConnectServer = !ConfigAppSettings.GetValue(Setting_Init.http_server).Equals("");
public static List<int> DisStationList = new List<int>();
public EquipManager()
{
}
......
......@@ -20,14 +20,14 @@ namespace OnlineStore.DeviceLibrary
internal string AgvName = "";
private string rfidIp = "";
public ShelfInfo CurrShelf = new ShelfInfo();
public WorkStation(string name,string agvName,string rfidip)
public int StationId = 0;
public WorkStation(int id,string name,string agvName,string rfidip)
{
this.rfidIp = rfidip;
MoveInfo = new StoreMoveInfo(1);
this.Name = "" + name;
this.AgvName = agvName;
this.StationId = id;
DI_FrontCheck = name+ DI_FrontCheck;
DI_InCheck = name+ DI_InCheck;
DI_LocationCylinder_Up1 = name+ DI_LocationCylinder_Up1;
......@@ -43,6 +43,10 @@ namespace OnlineStore.DeviceLibrary
internal bool IsReady()
{
if (IsDis())
{
return false;
}
if (CheckShelf(IO_VALUE.HIGH))
{
if (!CurrShelf.IsNeedLeave && (!String.IsNullOrEmpty(CurrShelf.RealShelf)) && LocationIsUp())
......@@ -55,6 +59,10 @@ namespace OnlineStore.DeviceLibrary
}
internal bool CheckNeedLeave(bool IsReset = true )
{
if (IsDis())
{
return false;
}
CurrShelf.TaskInfo = HttpServer.ShelfFinish(CurrShelf.RealShelf);
string log = "";
......@@ -87,6 +95,10 @@ namespace OnlineStore.DeviceLibrary
public void Reset()
{
if (IsDis())
{
return;
}
if (CurrShelf.IsBusy)
{
LogUtil.error(Name + "复位失败,料架忙碌中");
......@@ -201,8 +213,20 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000));
LogUtil.info(Name + "复位: 线体转动5秒 ");
}
public bool IsDis()
{
if (EquipManager.DisStationList.Contains(StationId))
{
return true ;
}
return false;
}
public void TimerProcess()
{
if (IsDis())
{
return;
}
if (MoveInfo.MoveType.Equals(StoreMoveType.StoreReset))
{
ResetProcess();
......@@ -233,6 +257,10 @@ namespace OnlineStore.DeviceLibrary
internal bool IsRightShelf(TrayInfo CurrTray, out string ShelfPosId)
{
ShelfPosId = "";
if (IsDis())
{
return false;
}
if (IsReady())
{
if (CurrShelf.RealShelf.Equals(CurrTray.realRFID))
......
......@@ -173,16 +173,17 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 获取定位机构上的料盘信息
/// </summary>
/// <param name="robot">ABB机器人索引号</param>
/// <param name="barcode">条码信息</param>
/// <param name="currRFID">当前工位的RFID</param>
public static TrayInfo GetLocation(int robot, string currRFID, out string msg)
public static TrayInfo GetLocation(string barcode, string currRFID, out string msg)
{
//getLocation这个接口传入barcode和rfid列表会分配料架
TrayInfo tray = new TrayInfo();
string api = "getLocation";
msg = "";
try
{
string url = httpAddr + api + "?robotIndex=" + robot + "&rfid=" + currRFID;
string url = httpAddr + api + "?barcode=" + barcode + "&rfid=" + currRFID;
string logName = "http :URL:" + url + " , ";
DateTime startTime = DateTime.Now;
......@@ -200,7 +201,7 @@ namespace OnlineStore.DeviceLibrary
if (obj.TryGetValue("msg", out value))
{
msg = value.ToString();
LogUtil.error(logName + ": " + value.ToString(), 500 + robot);
LogUtil.error(logName + ": " + value.ToString(), 500 );
}
return tray;
}
......@@ -212,16 +213,16 @@ namespace OnlineStore.DeviceLibrary
return tray;
}
if (dict.TryGetValue("w", out value))
{
switch (value)
{
case "7": tray.getP = "p1"; break;
case "11": tray.getP = "p2"; break;
case "13": tray.getP = "p3"; break;
case "15": tray.getP = "p4"; break;
}
}
//if (dict.TryGetValue("w", out value))
//{
// switch (value)
// {
// case "7": tray.getP = "p1"; break;
// case "11": tray.getP = "p2"; break;
// case "13": tray.getP = "p3"; break;
// case "15": tray.getP = "p4"; break;
// }
//}
if (dict.TryGetValue("rfidLoc", out value))
int.TryParse(value.ToString(), out tray.shelfP);
if (dict.TryGetValue("rfid", out value))
......@@ -238,7 +239,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error("http error : " + ex.ToString());
}
tray.robotNum = robot;
//tray.robotNum = robot;
return tray;
}
......@@ -246,7 +247,7 @@ namespace OnlineStore.DeviceLibrary
}
public class TrayInfo
{
public int robotNum = 0;
//public int robotNum = 0;
public string getP = "";
public int shelfP = 0;
public string rfid = "";
......@@ -255,7 +256,7 @@ namespace OnlineStore.DeviceLibrary
public string usedRfidList = "";
public string ToStr()
{
return "[" + robotNum + "] [" + barcode + "] [" + getP + "] [" + shelfP + "] [" + rfid + "] [" + realRFID + "] [" + usedRfidList + "] [" + updateTime.ToLongTimeString() + "]";
return " [" + barcode + "] [" + getP + "] [" + shelfP + "] [" + rfid + "] [" + realRFID + "] [" + usedRfidList + "] [" + updateTime.ToLongTimeString() + "]";
}
public DateTime updateTime = DateTime.Now;
......
......@@ -28,6 +28,9 @@
this.panel2 = new System.Windows.Forms.Panel();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.checkBox3 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.lblMoveEquipInfo = new System.Windows.Forms.Label();
this.btnS3Reset = new System.Windows.Forms.Button();
this.btnS2Reset = new System.Windows.Forms.Button();
......@@ -172,6 +175,9 @@
//
// tabPage2
//
this.tabPage2.Controls.Add(this.checkBox3);
this.tabPage2.Controls.Add(this.checkBox2);
this.tabPage2.Controls.Add(this.checkBox1);
this.tabPage2.Controls.Add(this.lblMoveEquipInfo);
this.tabPage2.Controls.Add(this.btnS3Reset);
this.tabPage2.Controls.Add(this.btnS2Reset);
......@@ -190,13 +196,52 @@
this.tabPage2.Text = " 设备状态 ";
this.tabPage2.UseVisualStyleBackColor = true;
//
// checkBox3
//
this.checkBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.checkBox3.AutoSize = true;
this.checkBox3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.checkBox3.Location = new System.Drawing.Point(886, 116);
this.checkBox3.Name = "checkBox3";
this.checkBox3.Size = new System.Drawing.Size(89, 21);
this.checkBox3.TabIndex = 286;
this.checkBox3.Text = "禁用工位S3";
this.checkBox3.UseVisualStyleBackColor = true;
this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
//
// checkBox2
//
this.checkBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.checkBox2.AutoSize = true;
this.checkBox2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.checkBox2.Location = new System.Drawing.Point(886, 82);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(89, 21);
this.checkBox2.TabIndex = 285;
this.checkBox2.Text = "禁用工位S2";
this.checkBox2.UseVisualStyleBackColor = true;
this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
//
// checkBox1
//
this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.checkBox1.AutoSize = true;
this.checkBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.checkBox1.Location = new System.Drawing.Point(886, 48);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(89, 21);
this.checkBox1.TabIndex = 284;
this.checkBox1.Text = "禁用工位S1";
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// lblMoveEquipInfo
//
this.lblMoveEquipInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.lblMoveEquipInfo.AutoSize = true;
this.lblMoveEquipInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMoveEquipInfo.ForeColor = System.Drawing.Color.Green;
this.lblMoveEquipInfo.Location = new System.Drawing.Point(714, 11);
this.lblMoveEquipInfo.Location = new System.Drawing.Point(717, 15);
this.lblMoveEquipInfo.Name = "lblMoveEquipInfo";
this.lblMoveEquipInfo.Size = new System.Drawing.Size(107, 17);
this.lblMoveEquipInfo.TabIndex = 283;
......@@ -262,7 +307,7 @@
this.logBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.logBox.Location = new System.Drawing.Point(4, 195);
this.logBox.Name = "logBox";
this.logBox.Size = new System.Drawing.Size(978, 386);
this.logBox.Size = new System.Drawing.Size(978, 380);
this.logBox.TabIndex = 278;
this.logBox.Text = "";
this.logBox.VisibleChanged += new System.EventHandler(this.logBox_VisibleChanged);
......@@ -288,7 +333,7 @@
this.groupBox2.Controls.Add(this.button6);
this.groupBox2.Controls.Add(this.button3);
this.groupBox2.Controls.Add(this.button5);
this.groupBox2.Location = new System.Drawing.Point(6, 454);
this.groupBox2.Location = new System.Drawing.Point(6, 448);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(972, 78);
this.groupBox2.TabIndex = 276;
......@@ -372,7 +417,7 @@
this.chbDebug.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chbDebug.AutoSize = true;
this.chbDebug.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbDebug.Location = new System.Drawing.Point(899, 7);
this.chbDebug.Location = new System.Drawing.Point(886, 11);
this.chbDebug.Name = "chbDebug";
this.chbDebug.Size = new System.Drawing.Size(84, 24);
this.chbDebug.TabIndex = 271;
......@@ -388,7 +433,7 @@
this.lblWarnMsg.ForeColor = System.Drawing.Color.Red;
this.lblWarnMsg.Location = new System.Drawing.Point(356, 46);
this.lblWarnMsg.Name = "lblWarnMsg";
this.lblWarnMsg.Size = new System.Drawing.Size(625, 59);
this.lblWarnMsg.Size = new System.Drawing.Size(534, 92);
this.lblWarnMsg.TabIndex = 224;
this.lblWarnMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
......@@ -1605,6 +1650,9 @@
private System.Windows.Forms.Button btnS1Reset;
private System.Windows.Forms.Button btnClearDoor;
private System.Windows.Forms.Label lblMoveEquipInfo;
private System.Windows.Forms.CheckBox checkBox3;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.CheckBox checkBox1;
}
}
......@@ -1175,5 +1175,47 @@ namespace OnlineStore.ACSingleStore
}
equip.StationMap[3].Reset();
}
private void DisS(int num,CheckBox chebox)
{
if (!LoadOk)
{
return;
}
if (chebox.Checked)
{
if (!EquipManager.DisStationList.Contains(num))
{
EquipManager.DisStationList.Add(num);
LogUtil.info(equip.Name + "用户勾选禁用工位S" + num);
}
}
else
{
if (EquipManager.DisStationList.Contains(num))
{
EquipManager.DisStationList.Remove(num);
LogUtil.info(equip.Name + "用户取消禁用工位S" + num);
}
}
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
int num = 1;
DisS(num, checkBox1);
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
int num = 2;
DisS(num, checkBox2);
}
private void checkBox3_CheckedChanged(object sender, EventArgs e)
{
int num = 3;
DisS(num, checkBox3);
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!