Commit e5817e1c 刘韬

1

1 个父辈 1d786b63
...@@ -44,17 +44,24 @@ namespace OnlineStore.Common ...@@ -44,17 +44,24 @@ namespace OnlineStore.Common
[MyConfigComment("URRobot_MI1_IP")] [MyConfigComment("URRobot_MI1_IP")]
public static MyConfig<string> URRobot_MI1_IP; public static MyConfig<string> URRobot_MI1_IP;
[MyConfigComment("URRobot_MI1_监听端口")]
public static MyConfig<int> URRobot_MI1_ListenPort = 21;
[MyConfigComment("URRobot_MI1_速度倍率")] [MyConfigComment("URRobot_MI1_速度倍率")]
public static MyConfig<int> URRobot_MI1_Speed_Rate = 50; public static MyConfig<int> URRobot_MI1_Speed_Rate = 50;
[MyConfigComment("URRobot_MI2_IP")] [MyConfigComment("URRobot_MI2_IP")]
public static MyConfig<string> URRobot_MI2_IP; public static MyConfig<string> URRobot_MI2_IP;
[MyConfigComment("URRobot_MI2_监听端口")]
public static MyConfig<int> URRobot_MI2_ListenPort = 41;
[MyConfigComment("URRobot_MI2_速度倍率")] [MyConfigComment("URRobot_MI2_速度倍率")]
public static MyConfig<int> URRobot_MI2_Speed_Rate = 50; public static MyConfig<int> URRobot_MI2_Speed_Rate = 50;
[MyConfigComment("URRobot_CI_IP")] [MyConfigComment("URRobot_CI_IP")]
public static MyConfig<string> URRobot_CI_IP; public static MyConfig<string> URRobot_CI_IP;
[MyConfigComment("URRobot_CI_速度倍率")] [MyConfigComment("URRobot_CI_速度倍率")]
public static MyConfig<int> URRobot_CI_Speed_Rate = 50; public static MyConfig<int> URRobot_CI_Speed_Rate = 50;
[MyConfigComment("URRobot_CI_监听端口")]
public static MyConfig<int> URRobot_CI_ListenPort = 31;
......
...@@ -45,7 +45,7 @@ namespace DeviceLibrary ...@@ -45,7 +45,7 @@ namespace DeviceLibrary
{ {
robot.SendCMD("unlock protective stop", 0); robot.SendCMD("unlock protective stop", 0);
lastWeight = lastWeight + 1; lastWeight = lastWeight + 1;
if (lastWeight > 4) if (lastWeight > 3)
lastWeight = 1; lastWeight = 1;
robot.log("触发保护性停止,调节负载重量:" + lastWeight); robot.log("触发保护性停止,调节负载重量:" + lastWeight);
return; return;
...@@ -110,19 +110,20 @@ namespace DeviceLibrary ...@@ -110,19 +110,20 @@ namespace DeviceLibrary
} }
public bool IsMoveOk(WaitResultInfo waitResultInfo) { public bool IsMoveOk(WaitResultInfo waitResultInfo) {
if (robot.CurCmdReponse.Contains($"{lastMoveCmd},done")) //if (robot.CurCmdReponse.Contains($"{lastMoveCmd},done"))
if (robot.CurCmdReponse.StartsWith(lastMoveCmd.ToString()) && robot.CurCmdReponse.EndsWith("done"))
return true; return true;
else if (robot.CurCmdReponse.Contains($"done") || retrytime>1) else if (robot.CurCmdReponse.Contains($"done") || retrytime>1)
{ {
retrytime = 0; retrytime = 0;
LogUtil.error($"机器人没有移动到位,重新移动:{lastMoveCmd},{lastWeight}"); robot.log($"机器人没有移动到位,重新移动:{lastMoveCmd},{lastWeight},{robot.CurCmdReponse}");
robot.SendMoveCmd(lastMoveCmd, lastSpeedRate, false, LoadRateParam[lastWeight]); robot.SendMoveCmd(lastMoveCmd, lastSpeedRate, false, LoadRateParam[lastWeight]);
return false; return false;
} }
else if ((DateTime.Now - LastMoveTime).TotalSeconds>30) { else if ((DateTime.Now - LastMoveTime).TotalSeconds>30) {
retrytime++; retrytime++;
LastMoveTime = DateTime.Now; LastMoveTime = DateTime.Now;
LogUtil.error($"机器人超过30秒没有反馈,停止程序重试"); robot.log($"机器人超过30秒没有反馈,停止程序重试");
robot.StopProgram(); robot.StopProgram();
return false; return false;
} }
...@@ -141,12 +142,12 @@ namespace DeviceLibrary ...@@ -141,12 +142,12 @@ namespace DeviceLibrary
/// key=load kg, value = load lb,x,y,z /// key=load kg, value = load lb,x,y,z
/// </summary> /// </summary>
public static Dictionary<int, float[]> LoadRateParam = new Dictionary<int, float[]>() { public static Dictionary<int, float[]> LoadRateParam = new Dictionary<int, float[]>() {
{ 0, new float[] { 4.5f, 0, 37 / 100f, 100 / 100f } }, { 0, new float[] { 4.5f, 0, 37 / 1000f, 100 / 1000f } },
{ 1, new float[] { 5.5f, 0, 37 / 100f, 146 / 100f } }, { 1, new float[] { 5.5f, 0, 37 / 1000f, 146 / 1000f } },
{ 2, new float[] { 6.5f, 0, 37 / 100f, 174 / 100f } }, { 2, new float[] { 6.5f, 0, 37 / 1000f, 174 / 1000f } },
{ 3, new float[] { 7.5f, 0, 37 / 100f, 204 / 100f } }, { 3, new float[] { 7.5f, 0, 37 / 1000f, 204 / 1000f } },
{ 4, new float[] { 8.5f, 0, 37 / 100f, 212 / 100f } }, { 4, new float[] { 8.5f, 0, 37 / 1000f, 212 / 1000f } },
{ 5, new float[] { 9.5f, 0, 37 / 100f, 224 / 100f } } { 5, new float[] { 9.5f, 0, 37 / 1000f, 224 / 1000f } }
}; };
//public static Dictionary<int, float[]> LoadRateParam = new Dictionary<int, float[]>() { //public static Dictionary<int, float[]> LoadRateParam = new Dictionary<int, float[]>() {
......
...@@ -344,6 +344,15 @@ namespace DeviceLibrary ...@@ -344,6 +344,15 @@ namespace DeviceLibrary
public Dictionary<string, string> data { get; set; } public Dictionary<string, string> data { get; set; }
} }
public class ResultData2
{
//{"code":0,"msg":"ok","data":"7"}
public int code { get; set; }
public string msg { get; set; }
public object data { get; set; }
}
/// <summary> /// <summary>
///1=设备联机(正常就绪)(入库后,BOX恢复原始状态)(出库后,移载装置恢复原始状态), ///1=设备联机(正常就绪)(入库后,BOX恢复原始状态)(出库后,移载装置恢复原始状态),
///2=急停,3=故障,4=警告,5=调试 ///2=急停,3=故障,4=警告,5=调试
......
...@@ -424,7 +424,17 @@ namespace DeviceLibrary ...@@ -424,7 +424,17 @@ namespace DeviceLibrary
} }
else else
{ {
var ngReel = false;
var ngMsg = "";
if (data.ContainsKey("ngReel") && data["ngReel"].ToLower() == "true")
{
ngReel = true;
data.TryGetValue("ngMsg", out ngMsg);
}
JobInfo jobInfo = new JobInfo(code, posIdStr, plateW, plateH); JobInfo jobInfo = new JobInfo(code, posIdStr, plateW, plateH);
jobInfo.isNG = ngReel;
jobInfo.NgMsg = ngMsg;
OutStoreEvent?.Invoke(crc.GetString("Res0064","服务器"), jobInfo); OutStoreEvent?.Invoke(crc.GetString("Res0064","服务器"), jobInfo);
} }
...@@ -455,7 +465,7 @@ namespace DeviceLibrary ...@@ -455,7 +465,7 @@ namespace DeviceLibrary
string resultStr = HttpHelper.Post(server, ""); string resultStr = HttpHelper.Post(server, "");
VLog.Info("cancelPutInTask " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】"); VLog.Info("cancelPutInTask " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
ResultData data = JsonHelper.DeserializeJsonToObject<ResultData>(resultStr); ResultData2 data = JsonHelper.DeserializeJsonToObject<ResultData2>(resultStr);
if (data == null) if (data == null)
{ {
...@@ -546,6 +556,8 @@ namespace DeviceLibrary ...@@ -546,6 +556,8 @@ namespace DeviceLibrary
lock (VStoreCollection.OutStoreReelInfo) lock (VStoreCollection.OutStoreReelInfo)
{ {
VStoreCollection.OutStoreReelInfo[jobInfo.WareNum] = new JobInfo(jobInfo.WareNum, "", reelinfo.Diameter, reelinfo.Height); VStoreCollection.OutStoreReelInfo[jobInfo.WareNum] = new JobInfo(jobInfo.WareNum, "", reelinfo.Diameter, reelinfo.Height);
VStoreCollection.OutStoreReelInfo[jobInfo.WareNum].isNG = jobInfo.isNG;
VStoreCollection.OutStoreReelInfo[jobInfo.WareNum].NgMsg = jobInfo.NgMsg;
Setting_Init.Runtime_OutStoreReelInfo = JsonConvert.SerializeObject(VStoreCollection.OutStoreReelInfo); Setting_Init.Runtime_OutStoreReelInfo = JsonConvert.SerializeObject(VStoreCollection.OutStoreReelInfo);
} }
vLog.Info("出库时获取到料盘数据:" + VStoreCollection.OutStoreReelInfo[jobInfo.WareNum].ToStr()); vLog.Info("出库时获取到料盘数据:" + VStoreCollection.OutStoreReelInfo[jobInfo.WareNum].ToStr());
...@@ -562,22 +574,25 @@ namespace DeviceLibrary ...@@ -562,22 +574,25 @@ namespace DeviceLibrary
} }
return true; return true;
} }
public bool BeginInStore(string towerid, JobInfo jobInfo, VLog vLog) public bool BeginInStore(string towerid, JobInfo jobInfo)
{ {
if (!SendCommand(VCmd.SimulateStartButton, true, out string data, towerid, jobInfo.WareNum)) if (!SendCommand(VCmd.SimulateStartButton, true, out string data, towerid, jobInfo.WareNum))
{ {
vLog.Error(data); VLog.Error(data);
return false; return false;
} }
var result = XmlCommandSerializer.DeserializeResult(data); var result = XmlCommandSerializer.DeserializeResult(data);
if (result.Errorcode != 0) if (result.Errorcode != 0)
{ {
vLog.Error(data); VLog.Error(data);
return false; return false;
} }
return true; return true;
} }
MydataWcfServiceTest.ServiceReference2.TowerAppWSClient towerAppWSClient; MydataWcfServiceTest.ServiceReference2.TowerAppWSClient towerAppWSClient;
/// <summary>
/// 存储MyCronic料仓的剩余容量 7X8=1000;7X12=345;13X32=100;
/// </summary>
internal string capacity; internal string capacity;
public bool SendCommand(string command, bool needlog, out string msg, params string[] arg) public bool SendCommand(string command, bool needlog, out string msg, params string[] arg)
......
...@@ -59,6 +59,7 @@ namespace DeviceLibrary ...@@ -59,6 +59,7 @@ namespace DeviceLibrary
ServerCM.storeStatus = StoreStatus.None; ServerCM.storeStatus = StoreStatus.None;
CurrentTowerStatusText = "Disable"; CurrentTowerStatusText = "Disable";
RTStoreStatus = RTStoreStatus.Offline; RTStoreStatus = RTStoreStatus.Offline;
TerminalError=false;
return; return;
} }
...@@ -161,7 +162,7 @@ namespace DeviceLibrary ...@@ -161,7 +162,7 @@ namespace DeviceLibrary
VLog.Info("物料已在舱口"); VLog.Info("物料已在舱口");
RTStoreStatus = RTStoreStatus.InStoreReady; RTStoreStatus = RTStoreStatus.InStoreReady;
if (!ServerCM.BeginInStore(CID, InStoreJobInfo, VLog)) if (!ServerCM.BeginInStore(CID, InStoreJobInfo))
{ {
RTStoreStatus = RTStoreStatus.LockToInStore; RTStoreStatus = RTStoreStatus.LockToInStore;
//Msg.add(CID + crc.GetString("Res0051", "无法入库"), MsgLevel.alarm); //Msg.add(CID + crc.GetString("Res0051", "无法入库"), MsgLevel.alarm);
...@@ -179,14 +180,13 @@ namespace DeviceLibrary ...@@ -179,14 +180,13 @@ namespace DeviceLibrary
VLog.Info("出库执行中"); VLog.Info("出库执行中");
RTStoreStatus = RTStoreStatus.OutMoveExecute; RTStoreStatus = RTStoreStatus.OutMoveExecute;
} }
else if (ti.StatusCode == 1041) else if (ti.StatusCode == 1041) //出库到舱门口
{ {
if (InStoreJobInfo == null) if (InStoreJobInfo == null) //没有入库信息,判断是正常出库
{ {
if (RTStoreStatus != RTStoreStatus.OutStoreReady) if (RTStoreStatus != RTStoreStatus.OutStoreReady)
{ {
VLog.Info("出库物料已到舱门口:" + CurrentTerminalReelID); VLog.Info("出库物料已到舱门口:" + CurrentTerminalReelID);
InStoreJobInfo = null;
OutStoreEnd(CurrentTerminalReelID, CID); OutStoreEnd(CurrentTerminalReelID, CID);
} }
...@@ -319,7 +319,9 @@ namespace DeviceLibrary ...@@ -319,7 +319,9 @@ namespace DeviceLibrary
return crc.GetString("Res0070","空闲中"); return crc.GetString("Res0070","空闲中");
} }
/// <summary>
/// 当前入库任务信息
/// </summary>
public volatile JobInfo InStoreJobInfo; public volatile JobInfo InStoreJobInfo;
StoreJobList OutStoreJobList; StoreJobList OutStoreJobList;
public void RequestInStore(JobInfo jobInfo) { public void RequestInStore(JobInfo jobInfo) {
......
...@@ -84,6 +84,9 @@ namespace DeviceLibrary ...@@ -84,6 +84,9 @@ namespace DeviceLibrary
public int plateH { get; set; } public int plateH { get; set; }
public string CID { get; set; } public string CID { get; set; }
public bool isNG { get; set; }
public string NgMsg { get; set; }
public string ToStr() public string ToStr()
{ {
return "TrayCode【" + TrayCode + "】,WareNum=【" + WareNum + "】,PosId=【" + PosId + "】,plateW=【" + plateW + "】,plateH=【" + plateH + "】,CID=【" + CID + "】"; return "TrayCode【" + TrayCode + "】,WareNum=【" + WareNum + "】,PosId=【" + PosId + "】,plateW=【" + plateW + "】,plateH=【" + plateH + "】,CID=【" + CID + "】";
......
...@@ -67,13 +67,13 @@ namespace DeviceLibrary ...@@ -67,13 +67,13 @@ namespace DeviceLibrary
MI2Postion = CSVPositionReader<RobotPosition>.LoadCSVFile(MI2PostionFile); MI2Postion = CSVPositionReader<RobotPosition>.LoadCSVFile(MI2PostionFile);
CIPostion = CSVPositionReader<RobotPosition>.LoadCSVFile(CIPostionFile); CIPostion = CSVPositionReader<RobotPosition>.LoadCSVFile(CIPostionFile);
Robot_MI1 = new URRobotControl(Setting_Init.URRobot_MI1_IP, "Robot-R1"); Robot_MI1 = new URRobotControl(Setting_Init.URRobot_MI1_IP, "Robot-R1", Setting_Init.URRobot_MI1_ListenPort);
Robot_MI1.Name = "R1"; Robot_MI1.Name = "R1";
Robot_MI1.SetSpeedRate(Setting_Init.URRobot_MI1_Speed_Rate); Robot_MI1.SetSpeedRate(Setting_Init.URRobot_MI1_Speed_Rate);
Robot_MI2 = new URRobotControl(Setting_Init.URRobot_MI2_IP, "Robot-R2"); Robot_MI2 = new URRobotControl(Setting_Init.URRobot_MI2_IP, "Robot-R2", Setting_Init.URRobot_MI2_ListenPort);
Robot_MI2.Name = "R2"; Robot_MI2.Name = "R2";
Robot_MI2.SetSpeedRate(Setting_Init.URRobot_MI2_Speed_Rate); Robot_MI2.SetSpeedRate(Setting_Init.URRobot_MI2_Speed_Rate);
Robot_CI = new URRobotControl(Setting_Init.URRobot_CI_IP, "Robot-CI"); Robot_CI = new URRobotControl(Setting_Init.URRobot_CI_IP, "Robot-CI", Setting_Init.URRobot_CI_ListenPort);
Robot_CI.SetSpeedRate(Setting_Init.URRobot_CI_Speed_Rate); Robot_CI.SetSpeedRate(Setting_Init.URRobot_CI_Speed_Rate);
VStoreCollection = new VStoreCollection(); VStoreCollection = new VStoreCollection();
......
...@@ -142,14 +142,6 @@ namespace DeviceLibrary ...@@ -142,14 +142,6 @@ namespace DeviceLibrary
public static bool CalcNeedTrans(int curaddr1, int destaddr1, bool hasload,TrayTypeE trayType) { public static bool CalcNeedTrans(int curaddr1, int destaddr1, bool hasload,TrayTypeE trayType) {
if (!hasload) if (!hasload)
{ {
if (curaddr1 == 19 && RobotManage.mainMachine.ServerCM.OutMaterialTaskCount > Setting_Init.Device_LS3_MTP2_OutTaskMaxCount && trayType== TrayTypeE.MTP2)
{
return true;
}
if (curaddr1 == 19 && RobotManage.mainMachine.ServerCM.OutReelTaskCount > Setting_Init.Device_LS3_MTP1_OutTaskMaxCount && trayType == TrayTypeE.MTP1)
{
return true;
}
var addrs = TrayRequest.Values.Where(x=>x.TrayType==trayType.ToString()).Select(x => new { TaryType = x.GetTrayType, Addr = GetAddrByGroupName(x.DeviceGroupName) }).ToList(); var addrs = TrayRequest.Values.Where(x=>x.TrayType==trayType.ToString()).Select(x => new { TaryType = x.GetTrayType, Addr = GetAddrByGroupName(x.DeviceGroupName) }).ToList();
foreach (var a in addrs) foreach (var a in addrs)
{ {
...@@ -168,7 +160,15 @@ namespace DeviceLibrary ...@@ -168,7 +160,15 @@ namespace DeviceLibrary
var ts = dis(a.Addr, ttt); var ts = dis(a.Addr, ttt);
return !(trayaddrs.Where(t1 => dis(a.Addr, t1) < ts).Count() > 0); return !(trayaddrs.Where(t1 => dis(a.Addr, t1) < ts).Count() > 0);
}; };
//ls3处判断,出库任务数量大于值时治具托盘全部从LS3转移走
if (curaddr1 == 19 && RobotManage.mainMachine?.ServerCM.OutMaterialTaskCount > Setting_Init.Device_LS3_MTP2_OutTaskMaxCount && trayType == TrayTypeE.MTP2)
{
return true;
}
if (curaddr1 == 19 && RobotManage.mainMachine?.ServerCM.OutReelTaskCount > Setting_Init.Device_LS3_MTP1_OutTaskMaxCount && trayType == TrayTypeE.MTP1)
{
return true;
}
return false; return false;
} }
else else
...@@ -453,9 +453,15 @@ namespace DeviceLibrary ...@@ -453,9 +453,15 @@ namespace DeviceLibrary
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static int GetAddrByGroupName(string groupname) { public static int GetAddrByGroupName(string groupname) {
var addr = AddrDesc.Where(a => a.Value == groupname).First(); try
{
return addr.Key; var addr = AddrDesc.Where(a => a.Value == groupname).First();
return addr.Key;
}
catch (Exception ex) {
LogUtil.error($"GetAddrByGroupName: " + groupname + "," + ex);
return -1;
}
} }
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -154,6 +154,11 @@ namespace DeviceLibrary ...@@ -154,6 +154,11 @@ namespace DeviceLibrary
switch (MoveInfo.MoveStep) switch (MoveInfo.MoveStep)
{ {
case MoveStep.Wait: case MoveStep.Wait:
if (IOValue(IO_Type.MI_Robot_Reel_Check).Equals(IO_VALUE.HIGH)) {
Msg.add(crc.GetString("Res0106.217fe7b7","待机时机械手上检测到物料,请检查"), MsgLevel.alarm);
MoveInfo.log("待机时机械手上检测到物料,请检查");
return;
}
//判断有无出库任务 //判断有无出库任务
var testInStoreError = VStoreCollection.VStoreList.Values.Where(vs=>vs.TowerInfo.DeviceGroupName==GroupName).ToList().Find(vs => vs.RTStoreStatus == RTStoreStatus.InStoreError || vs.RTStoreStatus == RTStoreStatus.InStoreDataTimeOut || vs.TerminalError); var testInStoreError = VStoreCollection.VStoreList.Values.Where(vs=>vs.TowerInfo.DeviceGroupName==GroupName).ToList().Find(vs => vs.RTStoreStatus == RTStoreStatus.InStoreError || vs.RTStoreStatus == RTStoreStatus.InStoreDataTimeOut || vs.TerminalError);
var hasoutjob = false; var hasoutjob = false;
...@@ -260,8 +265,8 @@ namespace DeviceLibrary ...@@ -260,8 +265,8 @@ namespace DeviceLibrary
CurrentJobInfo = new JobInfo(InStoreError.CurrentTerminalReelID, "", int.Parse(result.data["plateW"]), int.Parse(result.data["plateH"])); CurrentJobInfo = new JobInfo(InStoreError.CurrentTerminalReelID, "", int.Parse(result.data["plateW"]), int.Parse(result.data["plateH"]));
InStoreError.InStoreJobInfo = null; InStoreError.InStoreJobInfo = null;
MoveInfo.log("从服务器检索到物料数据:" + CurrentJobInfo.ToStr()); MoveInfo.log("从服务器检索到物料数据:" + CurrentJobInfo.ToStr());
MoveInfo.MoveParam.IsNg = true; CurrentJobInfo.isNG = true;
MoveInfo.MoveParam.NgMsg = InStoreError.CID + "-" + InStoreError.CurrentTowerStatusText; CurrentJobInfo.NgMsg = InStoreError.CID + "-" + InStoreError.CurrentTowerStatusText;
MoveInfo.log("检测到有料仓入库NG:" + MoveInfo.MoveParam.NgMsg); MoveInfo.log("检测到有料仓入库NG:" + MoveInfo.MoveParam.NgMsg);
} }
...@@ -318,6 +323,8 @@ namespace DeviceLibrary ...@@ -318,6 +323,8 @@ namespace DeviceLibrary
MoveInfo.MoveParam.PosID = CurrentJobInfo.PosId; MoveInfo.MoveParam.PosID = CurrentJobInfo.PosId;
MoveInfo.MoveParam.PlateW = CurrentJobInfo.plateW; MoveInfo.MoveParam.PlateW = CurrentJobInfo.plateW;
MoveInfo.MoveParam.PlateH = CurrentJobInfo.plateH; MoveInfo.MoveParam.PlateH = CurrentJobInfo.plateH;
MoveInfo.MoveParam.IsNg = CurrentJobInfo.isNG;
MoveInfo.MoveParam.NgMsg = CurrentJobInfo.NgMsg;
MoveInfo.MoveParam.cid = CurrntOutReadyStore.CID; MoveInfo.MoveParam.cid = CurrntOutReadyStore.CID;
FromPos = GetMIPosition(GroupName, TowerList.List[MoveInfo.MoveParam.cid].PosID); FromPos = GetMIPosition(GroupName, TowerList.List[MoveInfo.MoveParam.cid].PosID);
ToPos = GetMIPosition(GroupName, POS_Start + "_MT"); ToPos = GetMIPosition(GroupName, POS_Start + "_MT");
...@@ -348,6 +355,7 @@ namespace DeviceLibrary ...@@ -348,6 +355,7 @@ namespace DeviceLibrary
MoveInfo.log($"当前出库料仓[{CurrntOutReadyStore.CID}]存在状态错误:" + CurrntOutReadyStore.RTStoreStatus); MoveInfo.log($"当前出库料仓[{CurrntOutReadyStore.CID}]存在状态错误:" + CurrntOutReadyStore.RTStoreStatus);
CurrntOutReadyStore.RTStoreStatus = RTStoreStatus.Busy; CurrntOutReadyStore.RTStoreStatus = RTStoreStatus.Busy;
} }
MoveInfo.log($"机器人抓取状态:MI_Robot_Reel_Check:{IOValue(IO_Type.MI_Robot_Reel_Check)}, MI_Robot_Clamp_Check:{IOValue(IO_Type.MI_Robot_Clamp_Check)}");
if ((MoveInfo.MoveParam.IsNg || CurrntOutReadyStore.TerminalError) && IOValue(IO_Type.MI_Robot_Reel_Check).Equals(IO_VALUE.LOW) if ((MoveInfo.MoveParam.IsNg || CurrntOutReadyStore.TerminalError) && IOValue(IO_Type.MI_Robot_Reel_Check).Equals(IO_VALUE.LOW)
&& IOValue(IO_Type.MI_Robot_Clamp_Check).Equals(IO_VALUE.LOW)) && IOValue(IO_Type.MI_Robot_Clamp_Check).Equals(IO_VALUE.LOW))
{ {
...@@ -364,20 +372,21 @@ namespace DeviceLibrary ...@@ -364,20 +372,21 @@ namespace DeviceLibrary
} }
break; break;
case MoveStep.MI_53: case MoveStep.MI_53:
if (!TrayStop.DeviceList["AMH-" + POS_Start].IsFree()) if (!TrayStop.DeviceList[GroupName].IsFree())
{ {
MoveInfo.NextMoveStep(MoveStep.MI_54); MoveInfo.NextMoveStep(MoveStep.MI_54);
RoboMoveInfo.NextMoveStep(MoveStep.MI_40); RoboMoveInfo.NextMoveStep(MoveStep.MI_40);
MoveInfo.log("机器人开始放料"); MoveInfo.log("机器人开始放料");
} }
else { else {
//RemoteLoad remoteLoad = new RemoteLoad(); RemoteLoad remoteLoad = new RemoteLoad();
//remoteLoad.Action = "SetTrayRequest"; remoteLoad.Action = "SetTrayRequest";
//remoteLoad.GroupName= "AMH-" + POS_Start; remoteLoad.GroupName = GroupName;
//remoteLoad.RequestLoadInfo = new RequestLoadInfo(); remoteLoad.RequestLoadInfo = new RequestLoadInfo();
//remoteLoad.RequestLoadInfo.TrayType = TrayTypeE.MTP1.ToString(); remoteLoad.RequestLoadInfo.TrayType = TrayTypeE.MTP1.ToString();
//remoteLoad.RequestLoadInfo.IsEmpty = true; remoteLoad.RequestLoadInfo.IsEmpty = true;
//TrayManager.SetTrayRequest(remoteLoad); remoteLoad.RequestLoadInfo.DeviceGroupName = GroupName;
TrayManager.SetTrayRequest(remoteLoad);
Msg.add(crc.GetString("Res0097.b5a12101","等待空托盘"), MsgLevel.info); Msg.add(crc.GetString("Res0097.b5a12101","等待空托盘"), MsgLevel.info);
} }
break; break;
...@@ -386,7 +395,7 @@ namespace DeviceLibrary ...@@ -386,7 +395,7 @@ namespace DeviceLibrary
{ {
MoveInfo.log("机器人完成放料"); MoveInfo.log("机器人完成放料");
RemoteLoad remoteLoad = new RemoteLoad(); RemoteLoad remoteLoad = new RemoteLoad();
remoteLoad.GroupName = "AMH-" + POS_Start; remoteLoad.GroupName = GroupName;
remoteLoad.RequestLoadInfo = new RequestLoadInfo(); remoteLoad.RequestLoadInfo = new RequestLoadInfo();
remoteLoad.RequestLoadInfo.DeviceGroupName = "AMH-ML5-2"; remoteLoad.RequestLoadInfo.DeviceGroupName = "AMH-ML5-2";
remoteLoad.RequestLoadInfo.IsEmpty = false; remoteLoad.RequestLoadInfo.IsEmpty = false;
...@@ -394,7 +403,7 @@ namespace DeviceLibrary ...@@ -394,7 +403,7 @@ namespace DeviceLibrary
remoteLoad.RequestLoadInfo.LoadParam = MoveInfo.MoveParam.clone();// 填充料盘信息 remoteLoad.RequestLoadInfo.LoadParam = MoveInfo.MoveParam.clone();// 填充料盘信息
TrayManager.TrayRelease(remoteLoad); //这条会自动放行托盘并且写入托盘目的地 TrayManager.TrayRelease(remoteLoad); //这条会自动放行托盘并且写入托盘目的地
TheLine.UpdateLocInfo("", MoveInfo.MoveParam.WareCode, TheLine.LineStatusE.INLINE, CurrrentRFID); TheLine.UpdateLocInfo("", MoveInfo.MoveParam.WareCode, TheLine.LineStatusE.INLINE, CurrrentRFID);
TrayManager.ClearTrayRequest(GroupName);
MoveInfo.NextMoveStep(MoveStep.MI_55); MoveInfo.NextMoveStep(MoveStep.MI_55);
} }
break; break;
...@@ -429,7 +438,7 @@ namespace DeviceLibrary ...@@ -429,7 +438,7 @@ namespace DeviceLibrary
break; break;
case MoveStep.MI_02: case MoveStep.MI_02:
RoboMoveInfo.NextMoveStep(MoveStep.MI_03); RoboMoveInfo.NextMoveStep(MoveStep.MI_03);
robotHelper.Move(RoboMoveInfo, FromPos.Take_P5,0); robotHelper.Move(RoboMoveInfo, FromPos.Take_P5,1);
RoboMoveInfo.log("机器人到Take_P5"); RoboMoveInfo.log("机器人到Take_P5");
break; break;
case MoveStep.MI_03: case MoveStep.MI_03:
...@@ -442,7 +451,7 @@ namespace DeviceLibrary ...@@ -442,7 +451,7 @@ namespace DeviceLibrary
if (!Comp.IsBusy) if (!Comp.IsBusy)
{ {
RoboMoveInfo.NextMoveStep(MoveStep.MI_05); RoboMoveInfo.NextMoveStep(MoveStep.MI_05);
robotHelper.Move(RoboMoveInfo, FromPos.Take_P6,0); robotHelper.Move(RoboMoveInfo, FromPos.Take_P6,1);
RoboMoveInfo.log("压紧轴到位"); RoboMoveInfo.log("压紧轴到位");
RoboMoveInfo.log("机器人到Take_P6"); RoboMoveInfo.log("机器人到Take_P6");
} }
...@@ -487,12 +496,12 @@ namespace DeviceLibrary ...@@ -487,12 +496,12 @@ namespace DeviceLibrary
break; break;
case MoveStep.MI_42: case MoveStep.MI_42:
RoboMoveInfo.NextMoveStep(MoveStep.MI_43); RoboMoveInfo.NextMoveStep(MoveStep.MI_43);
robotHelper.Move(RoboMoveInfo, ToPos.Put_P4,0); robotHelper.Move(RoboMoveInfo, ToPos.Put_P4,1);
RoboMoveInfo.log("机器人到Put_P4"); RoboMoveInfo.log("机器人到Put_P4");
break; break;
case MoveStep.MI_43: case MoveStep.MI_43:
RoboMoveInfo.NextMoveStep(MoveStep.MI_44); RoboMoveInfo.NextMoveStep(MoveStep.MI_44);
robotHelper.Move(RoboMoveInfo, ToPos.P1, 0); robotHelper.Move(RoboMoveInfo, ToPos.P1, 1);
RoboMoveInfo.log("机器人到P1"); RoboMoveInfo.log("机器人到P1");
break; break;
case MoveStep.MI_44: case MoveStep.MI_44:
...@@ -807,9 +816,9 @@ namespace DeviceLibrary ...@@ -807,9 +816,9 @@ namespace DeviceLibrary
int GetWeight(ReelParam reelParam) { int GetWeight(ReelParam reelParam) {
int w = 0; int w = 0;
if (reelParam == null) if (reelParam == null)
w = 0; w = 1;
else if (reelParam.PlateW==7) else if (reelParam.PlateW==7)
w= 1; w= 2;
else if (reelParam.PlateW == 13 && reelParam.PlateH==8) else if (reelParam.PlateW == 13 && reelParam.PlateH==8)
w= 2; w= 2;
else if(reelParam.PlateW == 13) else if(reelParam.PlateW == 13)
......
...@@ -179,7 +179,7 @@ namespace DeviceLibrary ...@@ -179,7 +179,7 @@ namespace DeviceLibrary
} }
else else
{ {
Msg.add(crc.GetString("Res0034","托盘没有检测到物料"), MsgLevel.warning); Msg.add(crc.GetString("Res0034","托盘没有检测到物料"), MsgLevel.alarm);
return; return;
} }
......
...@@ -149,7 +149,7 @@ namespace DeviceLibrary ...@@ -149,7 +149,7 @@ namespace DeviceLibrary
TrayManager.Process(MoveInfo, CurrrentRFID, DeviceGroup.addr_1, IOValue(IO_Type.MI_Reel_Check).Equals(IO_VALUE.HIGH)?1:0, out TrayInfo trayInfo); TrayManager.Process(MoveInfo, CurrrentRFID, DeviceGroup.addr_1, IOValue(IO_Type.MI_Reel_Check).Equals(IO_VALUE.HIGH)?1:0, out TrayInfo trayInfo);
var stop = TrayManager.TryGetTrayRequest(GroupName, CurrrentRFID, out _); var stop = TrayManager.TryGetTrayRequest(GroupName, CurrrentRFID, out _);
MoveInfo.log($"CurrrentRFID:{CurrrentRFID},HasLoad:{trayInfo.HasLoad},MI_Reel_Check:{IOValue(IO_Type.MI_Reel_Check)},NeedStop:{stop}"); MoveInfo.log($"CurrrentRFID:{CurrrentRFID},HasLoad:{trayInfo.HasLoad},MI_Reel_Check:{IOValue(IO_Type.MI_Reel_Check)},NeedStop:{stop}");
#region #region MI1,Mi2的情况判断
if ((GroupName == "AMH-MI1" || GroupName == "AMH-MI2") && trayInfo.TrayType== TrayTypeE.MTP1) if ((GroupName == "AMH-MI1" || GroupName == "AMH-MI2") && trayInfo.TrayType== TrayTypeE.MTP1)
{ {
/* /*
...@@ -192,8 +192,12 @@ namespace DeviceLibrary ...@@ -192,8 +192,12 @@ namespace DeviceLibrary
device.StartOutStore(); device.StartOutStore();
} }
} }
else if (trayInfo.DestinationAddr == DeviceGroup.addr_1 && trayInfo.HasLoad && IOValue(IO_Type.MI_Reel_Check).Equals(IO_VALUE.HIGH)) else if (trayInfo.DestinationAddr == DeviceGroup.addr_1 && trayInfo.HasLoad)
{ {
if (IOValue(IO_Type.MI_Reel_Check).Equals(IO_VALUE.LOW)) {
Msg.add(crc.GetString("Res0034", "托盘没有检测到物料"), MsgLevel.alarm);
return;
}
MoveInfo.NextMoveStep(MoveStep.TrayStop_07); MoveInfo.NextMoveStep(MoveStep.TrayStop_07);
//抵达了一个有物料的托盘等待处理 //抵达了一个有物料的托盘等待处理
var device = MI.DeviceList[GroupName]; var device = MI.DeviceList[GroupName];
...@@ -227,8 +231,13 @@ namespace DeviceLibrary ...@@ -227,8 +231,13 @@ namespace DeviceLibrary
SRec.info(crc.GetString("Res0042","托盘挡停"), GroupName, crc.GetString("Res0030","空托盘"), crc.GetString("Res0043","准备接料"), CurrrentRFID); SRec.info(crc.GetString("Res0042","托盘挡停"), GroupName, crc.GetString("Res0030","空托盘"), crc.GetString("Res0043","准备接料"), CurrrentRFID);
return; return;
} }
else if (trayInfo.DestinationAddr == DeviceGroup.addr_1 && trayInfo.HasLoad && IOValue(IO_Type.MI_Reel_Check).Equals(IO_VALUE.HIGH)) else if (trayInfo.DestinationAddr == DeviceGroup.addr_1 && trayInfo.HasLoad)
{ {
if (IOValue(IO_Type.MI_Reel_Check).Equals(IO_VALUE.LOW))
{
Msg.add(crc.GetString("Res0034", "托盘没有检测到物料"), MsgLevel.alarm);
return;
}
//有物料 //有物料
MoveInfo.NextMoveStep(MoveStep.TrayStop_07); MoveInfo.NextMoveStep(MoveStep.TrayStop_07);
RemoteLoad remoteLoad = new RemoteLoad(); RemoteLoad remoteLoad = new RemoteLoad();
......
此文件类型无法预览
using ConfigHelper; using ConfigHelper;
using DeviceLibrary;
using log4net.Config; using log4net.Config;
using Microsoft.Win32.TaskScheduler; using Microsoft.Win32.TaskScheduler;
using OnlineStore.Common; using OnlineStore.Common;
...@@ -23,6 +24,8 @@ namespace TheMachine ...@@ -23,6 +24,8 @@ namespace TheMachine
[STAThread] [STAThread]
static void Main(string[] args) static void Main(string[] args)
{ {
if (args.ToList().FindIndex(a=>a.Contains("simulate"))>=0) if (args.ToList().FindIndex(a=>a.Contains("simulate"))>=0)
OnlineStore.G.simulate = true; OnlineStore.G.simulate = true;
...@@ -59,6 +62,15 @@ namespace TheMachine ...@@ -59,6 +62,15 @@ namespace TheMachine
} }
AddOrUpdateStartupTask(); AddOrUpdateStartupTask();
Config.LoadMyConfig(new Setting_Init().GetType()); Config.LoadMyConfig(new Setting_Init().GetType());
//RemoteLoad remoteLoad = new RemoteLoad();
//remoteLoad.Action = "SetTrayRequest";
//remoteLoad.GroupName = "AMH-MI2";
//remoteLoad.RequestLoadInfo = new RequestLoadInfo();
//remoteLoad.RequestLoadInfo.TrayType = TrayTypeE.MTP1.ToString();
//remoteLoad.RequestLoadInfo.IsEmpty = true;
//remoteLoad.RequestLoadInfo.DeviceGroupName = "AMH-MI2";
//TrayManager.SetTrayRequest(remoteLoad);
//TrayManager.CalcNeedTrans(19, 20, false, TrayTypeE.MTP1);
Application.ThreadException += Application_ThreadException; Application.ThreadException += Application_ThreadException;
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
......
...@@ -37,6 +37,7 @@ namespace TheMachine ...@@ -37,6 +37,7 @@ namespace TheMachine
crc.LanguageChangeEvent += Crc_LanguageChangeEvent; crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
tableLayoutPanel1.GetType().GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic) tableLayoutPanel1.GetType().GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
.SetValue(tableLayoutPanel1, true, null); .SetValue(tableLayoutPanel1, true, null);
cb_loadweight.SelectedIndex = 0;
} }
private void Crc_LanguageChangeEvent(object sender, EventArgs e) private void Crc_LanguageChangeEvent(object sender, EventArgs e)
...@@ -190,8 +191,8 @@ namespace TheMachine ...@@ -190,8 +191,8 @@ namespace TheMachine
var axis = getConfigMoveAxis((int)((Button)sender).Tag); var axis = getConfigMoveAxis((int)((Button)sender).Tag);
var targetpos = int.Parse(cc[1].Text); var targetpos = int.Parse(cc[1].Text);
axis.SendMoveCmd(targetpos, axis.SpeedRate,false, RobotHelper.LoadRateParam[1]); axis.SendMoveCmd(targetpos, axis.SpeedRate,false, RobotHelper.LoadRateParam[cb_loadweight.SelectedIndex]);
LogUtil.info("手动点击机器人移动命令:" + axis.RobotIp + " - " + targetpos); LogUtil.info("手动点击机器人移动命令:" + axis.RobotIp + " - " + targetpos+ "-"+ cb_loadweight.SelectedIndex);
} }
URRobotControl getConfigMoveAxis(int Axisid) URRobotControl getConfigMoveAxis(int Axisid)
{ {
......
...@@ -32,6 +32,8 @@ namespace TheMachine ...@@ -32,6 +32,8 @@ namespace TheMachine
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.btnSavePos = new System.Windows.Forms.Button(); this.btnSavePos = new System.Windows.Forms.Button();
this.cb_loadweight = new System.Windows.Forms.ComboBox();
this.label_loadweight = new System.Windows.Forms.Label();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -81,19 +83,48 @@ namespace TheMachine ...@@ -81,19 +83,48 @@ namespace TheMachine
this.btnSavePos.UseVisualStyleBackColor = true; this.btnSavePos.UseVisualStyleBackColor = true;
this.btnSavePos.Click += new System.EventHandler(this.btnSavePos_Click); this.btnSavePos.Click += new System.EventHandler(this.btnSavePos_Click);
// //
// StorePosControl // cb_loadweight
//
this.cb_loadweight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cb_loadweight.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cb_loadweight.FormattingEnabled = true;
this.cb_loadweight.Items.AddRange(new object[] {
"0",
"1",
"2",
"3",
"4"});
this.cb_loadweight.Location = new System.Drawing.Point(104, 308);
this.cb_loadweight.Name = "cb_loadweight";
this.cb_loadweight.Size = new System.Drawing.Size(73, 20);
this.cb_loadweight.TabIndex = 110;
//
// label_loadweight
//
this.label_loadweight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label_loadweight.AutoSize = true;
this.label_loadweight.Location = new System.Drawing.Point(8, 311);
this.label_loadweight.Name = "label_loadweight";
this.label_loadweight.Size = new System.Drawing.Size(77, 12);
this.label_loadweight.TabIndex = 111;
this.label_loadweight.Text = "Load weight:";
//
// RobotPosControl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label_loadweight);
this.Controls.Add(this.cb_loadweight);
this.Controls.Add(this.btnSavePos); this.Controls.Add(this.btnSavePos);
this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox3);
this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Margin = new System.Windows.Forms.Padding(4); this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "StorePosControl"; this.Name = "RobotPosControl";
this.Size = new System.Drawing.Size(598, 346); this.Size = new System.Drawing.Size(598, 346);
this.Load += new System.EventHandler(this.ConfigControl_Load); this.Load += new System.EventHandler(this.ConfigControl_Load);
this.groupBox3.ResumeLayout(false); this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
...@@ -102,5 +133,7 @@ namespace TheMachine ...@@ -102,5 +133,7 @@ namespace TheMachine
private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Button btnSavePos; private System.Windows.Forms.Button btnSavePos;
private System.Windows.Forms.ComboBox cb_loadweight;
private System.Windows.Forms.Label label_loadweight;
} }
} }
...@@ -119,7 +119,7 @@ namespace URRobot ...@@ -119,7 +119,7 @@ namespace URRobot
public void SendMoveCmd(int CmdIdx,int rate=50) public void SendMoveCmd(int CmdIdx,int rate=50)
{ {
robotControl?.SendMoveCmd(CmdIdx, rate, true,RobotHelper.LoadRateParam[1]); robotControl?.SendMoveCmd(CmdIdx, rate, true,RobotHelper.LoadRateParam[0]);
} }
public bool IsSendCmdOk(int cmdIdx) public bool IsSendCmdOk(int cmdIdx)
{ {
......
...@@ -65,7 +65,7 @@ namespace TheMachine.device.Other ...@@ -65,7 +65,7 @@ namespace TheMachine.device.Other
CheckBox checkBox = new CheckBox(); CheckBox checkBox = new CheckBox();
checkBox.Text = tower.TowerName; checkBox.Text = tower.TowerName;
checkBox.Checked = tower.Enable; checkBox.Checked = tower.Enable;
checkBox.Width = 150;
// 添加一个 Tag 属性,用于保存对应的 TowerInfo 对象 // 添加一个 Tag 属性,用于保存对应的 TowerInfo 对象
checkBox.Tag = tower; checkBox.Tag = tower;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!