You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

176 lines
4.7 KiB

using System.Collections.Generic;
using System.Linq;
namespace Gumming.Execute
{
public class Robot
{
public Dictionary<string, int> RobotSleepTime { get; set; }
public List<RobotHand> Hands { get; set; }
public Dictionary<string, List<string>> RobotCommand { get; set; }
public readonly object _lock = new object();
//获取空闲手臂
public RobotHand GetFreeHand(int limitCount)
{
lock (_lock)
{
var robotHands = Hands.Where(i => i.IsFree).ToList();
if (robotHands.Count < limitCount)
{
return null;
}
var robotHand = robotHands[0];
robotHand.IsFree = false;
return robotHand;
}
}
public void ReleaseFreeHand(RobotHand hand)
{
lock (_lock)
{
hand.CurrentWafer = null;
hand.IsFree = true;
}
}
public Robot()
{
Hands = new List<RobotHand>();
Hands.Add(new RobotHand()
{
Name = "R",
CurrentWafer = null,
IsFree = true
});
Hands.Add(new RobotHand()
{
Name = "W",
CurrentWafer = null,
IsFree = true
});
RobotSleepTime = new Dictionary<string, int>
{
{ Context.CA, 4 },
{ Context.COT, 5 },
{ Context.HP, 10 },
{ Context.CP, 3 },
{ Context.CS, 8 }
};
RobotCommand = new Dictionary<string, List<string>>()
{
{
Context.CS+"0", new List<string>()
{
"A", "A", "B", "B"
}
},
{
Context.CA + "0", new List<string>()
{
"I", "I", "J", "J"
}
},
{
Context.COT + "0", new List<string>()
{
"AA", "AA", "AB", "AB"
}
},
{
Context.COT + "1", new List<string>()
{
"AC", "AC", "AD", "AD"
}
},
{
Context.COT + "2", new List<string>()
{
"AE", "AE", "AF", "AF"
}
},
{
Context.COT + "3", new List<string>()
{
"AG", "AG", "AH", "AH"
}
},
{
Context.HP + "0", new List<string>()
{
"BA", "BA", "BB", "BB"
}
},
{
Context.HP + "1", new List<string>()
{
"BC", "BC", "BD", "BD"
}
},
{
Context.HP + "2", new List<string>()
{
"BE", "BE", "BF", "BF"
}
},
{
Context.HP + "3", new List<string>()
{
"BG", "BG", "BH", "BH"
}
},
{
Context.CP + "0", new List<string>()
{
"CA", "CA", "CB", "CB"
}
},
{
Context.CP + "1", new List<string>()
{
"CC", "CC", "CD", "CD"
}
},
{
Context.CP + "2", new List<string>()
{
"CE", "CE", "CF", "CF"
}
},
{
Context.CP + "3", new List<string>()
{
"CG", "CG", "CH", "CH"
}
},
{
Context.CP + "4", new List<string>()
{
"CI", "CI", "CJ", "CJ"
}
},
{
Context.CP + "5", new List<string>()
{
"CK", "CK", "CL", "CL"
}
},
};
}
}
}