Commit 8ea5ab94 刘韬

1

1 个父辈 76aa78aa
......@@ -134,6 +134,7 @@
<Compile Include="DeviceLibrary\IOManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="theMachine\sub\IDevice.cs" />
<Compile Include="theMachine\sub\CI.cs" />
<Compile Include="theMachine\sub\MI.cs" />
<Compile Include="theMachine\sub\TrayStop.cs" />
<Compile Include="theMachine\sub\TransplantMove.cs" />
......
......@@ -26,6 +26,7 @@ namespace DeviceLibrary
public string AxisName;
public bool ForceSafeCheck = false;
public string DeviceGroupName;
public bool Disable=false;
public AxisBean(ConfigMoveAxis axisConfig, string deviceGroupName)
{
DeviceGroupName = deviceGroupName;
......
......@@ -26,7 +26,7 @@ namespace DeviceLibrary
//_serialPort.RtsEnable = true; //自动请求
//_serialPort.ReadTimeout = 100;//超时
_serialPort.Open();
LogUtil.error("VJCounter: 串口连接成功");
LogUtil.info("VJCounter: 串口连接成功");
return true;
}catch (Exception ex)
{
......@@ -53,6 +53,7 @@ namespace DeviceLibrary
public static void SendBarcode(string barcode) {
var b = Encoding.ASCII.GetBytes(barcode + "\n");
_serialPort.Write(b, 0, b.Length);
LogUtil.info("VJCounter: 串口发送:"+ barcode);
}
}
}
......@@ -157,13 +157,13 @@ namespace DeviceLibrary
else if (RTStoreStatus == RTStoreStatus.LockToOutStore)
{
VLog.Error($"出库超时出错,没有检测到出库信息,RTStoreStatus={RTStoreStatus}:" + CurrentTerminalReelID);
CurrentTowerStatusText = "出库错误,没有执行出库过程";
Msg.add($"TerminalError:" + "出库超时", MsgLevel.alarm);
CurrentTowerStatusText = crc.GetString("Res0112.e6c4624b","出库错误,没有执行出库过程");
Msg.add($"TerminalError:" + crc.GetString("Res0113.71e5a53a","出库超时"), MsgLevel.alarm);
}
else
{
VLog.Error($"未知状态超时,RTStoreStatus={RTStoreStatus}:" + InStoreJobInfo?.ToStr());
Msg.add($"TerminalError:" + "料仓状态异常", MsgLevel.warning);
Msg.add($"TerminalError:" + crc.GetString("Res0114.d3023f35","料仓状态异常"), MsgLevel.warning);
}
}
......@@ -245,18 +245,17 @@ namespace DeviceLibrary
}
else if (ti.StatusCode >= 310000)
{
if (RTStoreStatus != RTStoreStatus.InStoreError)
{
LastProcessErrorTime = DateTime.Now.AddSeconds(10);
LastProcessErrorTimes = 0;
}
LastProcessErrorTimes++;
//if (RTStoreStatus != RTStoreStatus.InStoreError)
//{
// LastProcessErrorTime = DateTime.Now.AddSeconds(10);
// LastProcessErrorTimes = 0;
//}
//LastProcessErrorTimes++;
Msg.add($"StatusCode:{ti.StatusCode},StatusText:{ti.StatusText},OnlineStatus:{ti.OnlineStatus}", MsgLevel.warning);
RTStoreStatus = RTStoreStatus.InStoreError;
ServerCM.storeStatus = StoreStatus.InStoreFaild;
//RTStoreStatus = RTStoreStatus.InStoreError;
//ServerCM.storeStatus = StoreStatus.InStoreFaild;
//CurrentTowerStatusText = $"{ti.StatusText}-{ti.OnlineStatus}";
//InStoreJobInfo = null;
}
else if (ti.StatusCode < 10000)
{
......@@ -287,7 +286,7 @@ namespace DeviceLibrary
1031 loading material
1032 material put into Terminal from outside
1040 出库执行中
1041 unloading material 物料已到舱门口
1041 unloading material 物料已到舱门口 Remove Component Reel
1042 material unloaded to Terminal from Tower 物料已取走
6015 Reel already loaded.
3068 初始化中
......@@ -350,7 +349,7 @@ namespace DeviceLibrary
return crc.GetString("Res0067", "等待入库信息");
if (RTStoreStatus == RTStoreStatus.LockToOutStore)
return "等待出库";
return crc.GetString("Res0115.44b81dd3","等待出库");
if (RTStoreStatus == RTStoreStatus.InStoreExecute || RTStoreStatus == RTStoreStatus.InStoreReady)
return crc.GetString("Res0068", "入库中") + " Barcode:" + InStoreJobInfo?.WareNum;
......
......@@ -19,6 +19,16 @@ namespace DeviceLibrary
if (IOValue(IO_Type.Airpressure_Check).Equals(IO_VALUE.LOW) && !G.simulate) {
Msg.add(crc.GetString("Res0166","未检测到气压信号."), MsgLevel.warning);
}
var errorTray = TrayManager.Traylist.ToList().Where(x => x.Value.IsLoadError).ToList();
if (errorTray.Count > 0) {
foreach (var error in errorTray)
{
if (error.Value.HasLoad)
Msg.add(crc.GetString("Form1_tabc_tab_tmc_Text","托盘") + ":" + error.Key + " " + crc.GetString("Res0109.28f408e5","有物料托盘, 但未检测到物料"), MsgLevel.alarm);
else
Msg.add(crc.GetString("Form1_tabc_tab_tmc_Text","托盘") + ":" + error.Key + " " + crc.GetString("Res0110.ca6543cd","空托盘, 但检测到物料"), MsgLevel.alarm);
}
}
}
}
}
\ No newline at end of file
......@@ -287,7 +287,10 @@ namespace DeviceLibrary
if (span.TotalSeconds > 2)
{
checkAlarmTime = DateTime.Now;
AxisBean.List.ToList().ForEach((x) => { x.Value.ForEach(y => {
AxisBean.List.ToList().ForEach((x) => { x.Value.ForEach(y => {
if (y.Disable)
return;
AxisManager.AlarmClear(y.Config.DeviceName, y.Config.GetAxisValue());
if (AxisManager.GetAlarmStatus(y.Config.DeviceName, y.Config.GetAxisValue()) == 1)
{
......
......@@ -170,7 +170,7 @@ namespace DeviceLibrary
catch(Exception ex) {
LogUtil.error($"等待{GroupName}反馈超时 seq:" + seq +" 出错:"+ex);
return RemoteResult.Timeout;
}
}
}
static void SendResult(string deviceGroupName, bool result,long Seq)
{
......
......@@ -95,7 +95,7 @@ namespace DeviceLibrary
if (!VJCounter.Connect(Setting_Init.VJCounter_COMPORT, out string msgs)) {
IsLoadOk = false;
msg += "VJ点料机连接失败" + "\n";
msg += crc.GetString("Res0111.43f91cee","VJ点料机连接失败") + "\n";
LogUtil.error(msg + "," + msgs);
}
......
using ConfigHelper;
using Newtonsoft.Json;
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using RemoteSheardObject;
using Robot.UR;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class CI : DeviceBase, IDevice
{
public static Dictionary<string, CI> DeviceList = new Dictionary<string, CI>();
public static void Init(Robot_Config config, Dictionary<string, DeviceGroup> devices,out string msg) {
msg = "";
CI sideMove = new CI(devices["CI"], out string m);
DeviceList.Add(devices["CI"].GroupName, sideMove);
msg += m;
}
DeviceGroup DeviceGroup;
public MoveInfo MoveInfo;
MoveInfo RoboMoveInfo;
//CylinderManger Location;
public AxisBean Comp;
//public AxisBean Rotate;
URRobotControl Robot;
public RobotHelper robotHelper;
BufferSlotsManger BufferSlotsManger;
string POS_Start = "CI";
string robotname = "";
public bool ManualCount = false;
public CI(DeviceGroup device,out string msg) : base()
{
msg = "";
Name = device.Name+"("+ device.GroupName + ")";
DeviceGroup = device;
GroupName = DeviceGroup.GroupName;
Msg = new MsgService(GroupName+"-T");
MoveInfo = new MoveInfo(GroupName + "-T");
RoboMoveInfo = new MoveInfo(GroupName + "-Robo");
if (device.GroupName == "CI")
{
Robot = RobotManage.Robot_CI;
robotname = "R3";
}
Robot.Name = robotname;
robotHelper = new RobotHelper(Robot, robotname);
Comp = AxisBean.List[DeviceGroup.GroupName][0];
//Rotate = AxisBean.List[DeviceGroup.GroupName][1];
BufferSlotsManger = new BufferSlotsManger(POS_Start);
}
public DeviceStateE DeviceState { get; set; }
public void Start()
{
OpenAllServo();
//robotHelper.Start();
DeviceState = DeviceStateE.HomeReset;
MoveInfo.NewMove(MoveStep.H01_HomeReset);
MoveInfo.log("开始回原");
}
public void Stop()
{
//robotHelper.Stop();
//Robot.StopRobot();
DeviceState = DeviceStateE.Stop;
MoveInfo.log("停止运行");
}
public void Process()
{
try
{
LogUtil.OutputDebugString($"{GroupName} DeviceState:" + DeviceState.ToString());
if (!DeviceCheck())
{
return;
}
MsgService.MSList[GroupName + "-T"].clear();
if (DeviceState == DeviceStateE.HomeReset)
ResetProcess();
else if (DeviceState == DeviceStateE.Run)
{
OneWayProcess();
RobotMoveProcess();
}
}
finally {
MsgService.MSList[GroupName + "-T"].Show();
}
}
public void Reset()
{
Robot.SendMoveCmd(1, Setting_Init.URRobot_CI_Speed_Rate, false, RobotHelper.LoadRateParam[robotHelper.lastWeight]);
Config.Set("RuntimeRobot_" + robotname + "_MoveStep", "Wait");
Config.Set("RuntimeRobot_" + robotname + "_Arm_MoveStep", "Wait");
}
private bool DeviceCheck()
{
return true; // 没有机器人暂时屏蔽
if (!robotHelper.RobotStatus) {
Msg.add(POS_Start + crc.GetString("Res0058","机器人当前不可用"), MsgLevel.alarm);
return false;
}
return true;
}
int isalivetrytimes = 0;
int StopBufDelayMS = 500;
int StopDelayMS = 1500;
RobotPosition FromPos;
RobotPosition ToPos;
VStore CurrentVStore;
JobInfo CurrentJobInfo;
VStore CurrntOutReadyStore;
public void OneWayProcess()
{
//Config.Set("RuntimeRobot_MoveStep", MoveInfo.MoveStep.ToString());
if (CheckWait(MoveInfo))
return;
switch (MoveInfo.MoveStep)
{
case MoveStep.Wait:
var hasoutjob = false;
if (hasoutjob)
{
MoveInfo.log("查询到出库任务,开始优先出库");
MoveInfo.NextMoveStep(MoveStep.MI_50);
}
//判断入库任务
LogUtil.OutputDebugString("InStoreJobList:" + InStoreJobList.Count.ToString());
if (InStoreJob != null)
{
CurrentJobInfo = InStoreJob.Clone();
InStoreJob = null;
MoveInfo.log("收到物料点料任务:" + CurrentJobInfo.ToStr());
MoveInfo.MoveParam.WareCode = CurrentJobInfo.WareNum;
MoveInfo.MoveParam.PosID = CurrentJobInfo.PosId;
MoveInfo.MoveParam.PlateW = CurrentJobInfo.plateW;
MoveInfo.MoveParam.PlateH = CurrentJobInfo.plateH;
MoveInfo.MoveParam.cid = CurrentJobInfo.CID;
MoveInfo.NextMoveStep(MoveStep.MI_01);
//FromPos = GetMIPosition(GroupName, POS_Start + "_MT");
//var cid = MoveInfo.MoveParam.PosID;//.Split('_')[0];
//ToPos = GetMIPosition(GroupName, TowerList.List[cid].PosID);
Config.Set("Runtime_Robot_" + robotname + "_ReelInfo" , JsonConvert.SerializeObject(MoveInfo.MoveParam));
//Config.Set("Runtime_Robot_" + robotname + "_FromPos" , FromPos.PositionNum);
//Config.Set("Runtime_Robot_" + robotname + "_ToPos" , ToPos.PositionNum);
//MoveInfo.log($"开始转移物料:{FromPos.PositionNum}=>{ToPos.PositionNum}");
MoveInfo.log($"开始点料");
}
break;
case MoveStep.MI_01:
MoveInfo.NextMoveStep(MoveStep.MI_02);
RoboMoveInfo.MoveParam = MoveInfo.MoveParam.clone();
RoboMoveInfo.NextMoveStep(MoveStep.MI_01);
MoveInfo.log("机器人开始取料");
break;
case MoveStep.MI_02:
if (RoboMoveInfo.MoveStep >= MoveStep.MI_08)
{
MoveInfo.NextMoveStep(MoveStep.MI_03);
if (FromPos.PositionNum.EndsWith("MT"))
{
RemoteLoad remoteLoad = new RemoteLoad();
remoteLoad.Action = "";
remoteLoad.GroupName = GroupName;
remoteLoad.RequestLoadInfo = new RequestLoadInfo();
remoteLoad.RequestLoadInfo.DeviceGroupName = GroupName;
remoteLoad.RequestLoadInfo.IsEmpty = true;
remoteLoad.RequestLoadInfo.LoadParam = RoboMoveInfo.MoveParam.clone();
TrayManager.TrayRelease(remoteLoad);
TrayStop.DeviceList[GroupName].TrayRelease();
RoboMoveInfo.log("取料完成托盘放行");
TheLine.UpdateLocInfo("", remoteLoad.RequestLoadInfo.LoadParam.WareCode, TheLine.LineStatusE.INROBOT, GroupName);
}
else
RoboMoveInfo.log("取料完成");
}
break;
case MoveStep.MI_03:
if (RoboMoveInfo.MoveStep == MoveStep.MI_ReelTacked)
{
MoveInfo.NextMoveStep(MoveStep.MI_04);
}
break;
case MoveStep.MI_04:
if (CurrentVStore.RTStoreStatus == RTStoreStatus.Ready || CurrentVStore.RTStoreStatus == RTStoreStatus.LockToInStore)
{
MoveInfo.NextMoveStep(MoveStep.MI_05);
RoboMoveInfo.NextMoveStep(MoveStep.MI_40);
MoveInfo.log("机器人开始放料");
CurrentVStore.RequestInStore(new JobInfo(RoboMoveInfo.MoveParam.WareCode, "", RoboMoveInfo.MoveParam.PlateW, RoboMoveInfo.MoveParam.PlateH));
}
else
{
MoveInfo.log("机器人放料时发现舱门口有料");
}
break;
case MoveStep.MI_05:
if (RoboMoveInfo.MoveStep == MoveStep.Wait)
{
MoveInfo.log("放入料仓口完成:"+ RoboMoveInfo.MoveParam.ToStr());
MoveInfo.NewMove(MoveStep.Wait);
}
break;
case MoveStep.MI_50:
//var InStoreError = VStoreCollection.VStoreList.Values.Where(vs => vs.TowerInfo.DeviceGroupName == GroupName).ToList().Find(vs => DateTime.Now > vs.LastProcessErrorTime && vs.LastProcessErrorTimes < 4 && (vs.RTStoreStatus == RTStoreStatus.InStoreError || vs.RTStoreStatus == RTStoreStatus.InStoreDataTimeOut || vs.TerminalError));
var InStoreError = VStoreCollection.VStoreList.Values.Where(vs => vs.TowerInfo.DeviceGroupName == GroupName).ToList().Find(vs => (vs.RTStoreStatus == RTStoreStatus.InStoreError || vs.RTStoreStatus == RTStoreStatus.InStoreDataTimeOut || vs.TerminalError));
if (InStoreError != null)
{
var result = TheLine.GetReelSize<ResultData>(InStoreError.CurrentTerminalReelID);
if (result != null && result.code == 0)
{
CurrntOutReadyStore = InStoreError;
//InStoreError.ServerCM.cancelPutInTask(CurrntOutReadyStore.CurrentTerminalReelID);
CurrentJobInfo = new JobInfo(InStoreError.CurrentTerminalReelID, "", int.Parse(result.data["plateW"]), int.Parse(result.data["plateH"]));
InStoreError.InStoreJobInfo = null;
MoveInfo.log("从服务器检索到物料数据:" + CurrentJobInfo.ToStr());
CurrentJobInfo.isNG = true;
CurrentJobInfo.NgMsg = InStoreError.CID + "-" + InStoreError.CurrentTowerStatusText;
MoveInfo.log("检测到有料仓入库NG:" + MoveInfo.MoveParam.NgMsg);
}
else
{
if (result != null)
MoveInfo.log(JsonConvert.SerializeObject(result));
MoveInfo.log($"没有找到,在等待出库的料仓 CID:{InStoreError.CID} SN:"+ InStoreError.CurrentTerminalReelID);
MoveInfo.NextMoveStep(MoveStep.Wait);
TrayStop.DeviceList[GroupName].TrayRelease();
return;
}
}
else {
var random = new Random(DateTime.Now.Millisecond);
CurrntOutReadyStore = VStoreCollection.VStoreList.Values.Where(vs => vs.TowerInfo.DeviceGroupName == GroupName).ToList().FindAll(vs => vs.RTStoreStatus == RTStoreStatus.OutStoreReady).OrderBy(x => random.Next()).FirstOrDefault();
if (CurrntOutReadyStore != null)
{
if (string.IsNullOrEmpty(CurrntOutReadyStore.CurrentTerminalReelID))
{
MoveInfo.log("当前出库料仓:" + CurrntOutReadyStore.CID + "已是出库完成状态,但是还没有读到物料完成通知");
return;
}
if (!VStoreCollection.OutStoreReelInfo.ContainsKey(CurrntOutReadyStore.CurrentTerminalReelID))
{
MoveInfo.log("当前出库料仓:" + CurrntOutReadyStore.CID + ",没有找到料盘信息:" + CurrntOutReadyStore.CurrentTerminalReelID);
var result = TheLine.GetReelSize<ResultData>(CurrntOutReadyStore.CurrentTerminalReelID);
if (result != null && result.code == 0)
{
CurrentJobInfo = new JobInfo(CurrntOutReadyStore.CurrentTerminalReelID, "", int.Parse(result.data["plateW"]), int.Parse(result.data["plateH"]));
MoveInfo.log("从服务器检索到物料数据:" + CurrentJobInfo.ToStr());
}
else
return;
}
else
{
var job = VStoreCollection.OutStoreReelInfo[CurrntOutReadyStore.CurrentTerminalReelID];
CurrentJobInfo = job.Clone();
}
}
else
{
MoveInfo.log("没有找到,在等待出库的料仓");
MoveInfo.NextMoveStep(MoveStep.Wait);
TrayStop.DeviceList[GroupName].TrayRelease();
return;
}
}
CurrntOutReadyStore.LastProcessErrorTime = DateTime.Now.AddSeconds(15);
MoveInfo.log("收到物料出库任务:" + CurrentJobInfo.ToStr());
MoveInfo.MoveParam.WareCode = CurrentJobInfo.WareNum;
MoveInfo.MoveParam.PosID = CurrentJobInfo.PosId;
MoveInfo.MoveParam.PlateW = CurrentJobInfo.plateW;
MoveInfo.MoveParam.PlateH = CurrentJobInfo.plateH;
MoveInfo.MoveParam.IsNg = CurrentJobInfo.isNG;
MoveInfo.MoveParam.NgMsg = CurrentJobInfo.NgMsg;
MoveInfo.MoveParam.cid = CurrntOutReadyStore.CID;
FromPos = GetMIPosition(GroupName, TowerList.List[MoveInfo.MoveParam.cid].PosID);
ToPos = GetMIPosition(GroupName, POS_Start + "_MT");
Config.Set("Runtime_Robot_" + robotname + "_ReelInfo",JsonConvert.SerializeObject(MoveInfo.MoveParam));
Config.Set("Runtime_Robot_" + robotname + "_FromPos" , FromPos.PositionNum);
Config.Set("Runtime_Robot_" + robotname + "_ToPos", ToPos.PositionNum);
MoveInfo.NextMoveStep(MoveStep.MI_51);
MoveInfo.log($"开始转移物料:{FromPos.PositionNum}=>{ToPos.PositionNum}");
break;
case MoveStep.MI_51:
MoveInfo.NextMoveStep(MoveStep.MI_52);
RoboMoveInfo.MoveParam = MoveInfo.MoveParam.clone();
RoboMoveInfo.NextMoveStep(MoveStep.MI_01);
MoveInfo.log("机器人开始取料");
break;
case MoveStep.MI_52:
if (RoboMoveInfo.MoveStep == MoveStep.MI_ReelTacked)
{
lock (VStoreCollection.OutStoreReelInfo)
{
VStoreCollection.OutStoreReelInfo.Remove(MoveInfo.MoveParam.WareCode);
}
TheLine.UpdateLocInfo("", MoveInfo.MoveParam.WareCode, TheLine.LineStatusE.INROBOT, GroupName);
MoveInfo.log("机器人已取到料");
if (CurrntOutReadyStore.TerminalError) {
MoveInfo.log($"当前出库料仓[{CurrntOutReadyStore.CID}]存在状态错误:" + CurrntOutReadyStore.RTStoreStatus);
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 (IOValue(IO_Type.MI_Robot_Reel_Check).Equals(IO_VALUE.LOW)
&& IOValue(IO_Type.MI_Robot_Clamp_Check).Equals(IO_VALUE.LOW))
{
if (MoveInfo.MoveParam.IsNg || CurrntOutReadyStore.TerminalError)
{
MoveInfo.log("机器人抓取NG料后发现夹爪上没有料,流程结束处理");
}else
MoveInfo.log("机器人抓取正常出库物料后发现夹爪上没有料,流程结束处理");
CurrntOutReadyStore.TerminalError = false;
RoboMoveInfo.NextMoveStep(MoveStep.Wait);
MoveInfo.NextMoveStep(MoveStep.Wait);
if (!TrayStop.DeviceList[GroupName].IsFree())
{
RemoteLoad remoteLoad = new RemoteLoad();
remoteLoad.Action = "SetTrayRequest";
remoteLoad.GroupName = GroupName;
remoteLoad.RequestLoadInfo = new RequestLoadInfo();
remoteLoad.RequestLoadInfo.TrayType = TrayTypeE.MTP1.ToString();
remoteLoad.RequestLoadInfo.IsEmpty = true;
remoteLoad.RequestLoadInfo.DeviceGroupName = GroupName;
TrayManager.SetTrayRequest(remoteLoad);
}
TheLine.emptyOut(CurrentJobInfo.WareNum);
TheLine.UpdateLocInfo("", CurrentJobInfo.WareNum, TheLine.LineStatusE.BOXDOOR_NOREEL, CurrntOutReadyStore.CID);
MoveInfo.log("检测到夹爪空抓 reelid:" + CurrentJobInfo.WareNum);
return;
}
if (!MoveInfo.MoveParam.IsNg && IOValue(IO_Type.MI_Robot_Reel_Check).Equals(IO_VALUE.LOW)
&& IOValue(IO_Type.MI_Robot_Clamp_Check).Equals(IO_VALUE.LOW))
{
return;
}
else if (MoveInfo.MoveParam.IsNg)
{
CurrntOutReadyStore.ServerCM.cancelPutInTask(CurrntOutReadyStore.CurrentTerminalReelID);
MoveInfo.log("物料NG取消入库:" + CurrntOutReadyStore.CurrentTerminalReelID);
}
MoveInfo.NextMoveStep(MoveStep.MI_53);
}
break;
case MoveStep.MI_53:
if (!TrayStop.DeviceList[GroupName].IsFree())
{
MoveInfo.NextMoveStep(MoveStep.MI_54);
RoboMoveInfo.NextMoveStep(MoveStep.MI_40);
MoveInfo.log("机器人开始放料");
}
else {
RemoteLoad remoteLoad = new RemoteLoad();
remoteLoad.Action = "SetTrayRequest";
remoteLoad.GroupName = GroupName;
remoteLoad.RequestLoadInfo = new RequestLoadInfo();
remoteLoad.RequestLoadInfo.TrayType = TrayTypeE.MTP1.ToString();
remoteLoad.RequestLoadInfo.IsEmpty = true;
remoteLoad.RequestLoadInfo.DeviceGroupName = GroupName;
TrayManager.SetTrayRequest(remoteLoad);
Msg.add(crc.GetString("Res0097.b5a12101","等待空托盘"), MsgLevel.info);
}
break;
case MoveStep.MI_54:
if (RoboMoveInfo.MoveStep >= MoveStep.MI_44)
{
MoveInfo.log("机器人完成放料");
RemoteLoad remoteLoad = new RemoteLoad();
remoteLoad.GroupName = GroupName;
remoteLoad.RequestLoadInfo = new RequestLoadInfo();
remoteLoad.RequestLoadInfo.DeviceGroupName = "AMH-ML5-2";
remoteLoad.RequestLoadInfo.IsEmpty = false;
remoteLoad.RequestLoadInfo.TrayType = TrayTypeE.MTP1.ToString();
remoteLoad.RequestLoadInfo.LoadParam = MoveInfo.MoveParam.clone();// 填充料盘信息
TrayManager.TrayRelease(remoteLoad); //这条会自动放行托盘并且写入托盘目的地
TheLine.UpdateLocInfo("", MoveInfo.MoveParam.WareCode, TheLine.LineStatusE.INLINE, CurrrentRFID);
TrayManager.ClearTrayRequest(GroupName);
MoveInfo.NextMoveStep(MoveStep.MI_55);
}
break;
case MoveStep.MI_55:
if (RoboMoveInfo.MoveStep == MoveStep.Wait)
{
MoveInfo.log("机器人任务结束");
MoveInfo.NewMove(MoveStep.Wait);
}
break;
}
}
public void RobotMoveProcess()
{
Config.Set("RuntimeRobot_Arm_MoveStep", RoboMoveInfo.MoveStep.ToString());
if (CheckWait(RoboMoveInfo))
return;
switch (RoboMoveInfo.MoveStep)
{
case MoveStep.Wait:
break;
//机器人取料
case MoveStep.MI_01:
RoboMoveInfo.NextMoveStep(MoveStep.MI_02);
CompTOP1(RoboMoveInfo);
RoboMoveInfo.log("压紧轴到待机点");
robotHelper.lastWeight = GetWeight(RoboMoveInfo.MoveParam);
break;
case MoveStep.MI_02:
RoboMoveInfo.NextMoveStep(MoveStep.MI_03);
robotHelper.Move(RoboMoveInfo, FromPos.Take_P5,1);
RoboMoveInfo.log("机器人到Take_P5");
break;
case MoveStep.MI_03:
RoboMoveInfo.NextMoveStep(MoveStep.MI_04);
TrayStop.DeviceList[GroupName].Location.ToLow(MoveInfo);
CompTOCompression(RoboMoveInfo);
RoboMoveInfo.log("压紧轴都下压");
break;
case MoveStep.MI_04:
if (!Comp.IsBusy)
{
RoboMoveInfo.NextMoveStep(MoveStep.MI_05);
robotHelper.Move(RoboMoveInfo, FromPos.Take_P6,1);
RoboMoveInfo.log("压紧轴到位");
RoboMoveInfo.log("机器人到Take_P6");
}
break;
case MoveStep.MI_05:
RoboMoveInfo.NextMoveStep(MoveStep.MI_06);
CompTOCompression(RoboMoveInfo);
RoboMoveInfo.log("压紧轴都下压");
break;
case MoveStep.MI_06:
if (!Comp.IsBusy)
{
RoboMoveInfo.log("压紧轴到位脉冲值:" + Comp.GetAclPosition());
RoboMoveInfo.NextMoveStep(MoveStep.MI_07);
robotHelper.Move(RoboMoveInfo, FromPos.Take_P7, robotHelper.lastWeight);
RoboMoveInfo.log("机器人到Take_P7");
}
break;
case MoveStep.MI_07:
RoboMoveInfo.NextMoveStep(MoveStep.MI_08);
robotHelper.Move(RoboMoveInfo, FromPos.P1, robotHelper.lastWeight);
RoboMoveInfo.log("机器人到P1");
break;
case MoveStep.MI_08:
RoboMoveInfo.NextMoveStep(MoveStep.MI_ReelTacked);
RoboMoveInfo.log("机器人取料完成");
break;
//机器人放料
case MoveStep.MI_40:
RoboMoveInfo.NextMoveStep(MoveStep.MI_41);
robotHelper.Move(RoboMoveInfo, ToPos.Put_P2, robotHelper.lastWeight);
RoboMoveInfo.log("机器人到Put_P2");
break;
case MoveStep.MI_41:
RoboMoveInfo.NextMoveStep(MoveStep.MI_42);
//Comp.AbsMove(RoboMoveInfo, RobotManage.Config.AMH_RoboMI1_Comp_P1, RobotManage.Config.AMH_RoboMI1_Comp_P1_speed);
CompTOP1(RoboMoveInfo);
robotHelper.Move(RoboMoveInfo, ToPos.Put_P3, robotHelper.lastWeight);
RoboMoveInfo.log("压紧轴释放");
RoboMoveInfo.log("机器人到Put_P3");
break;
case MoveStep.MI_42:
RoboMoveInfo.NextMoveStep(MoveStep.MI_43);
robotHelper.Move(RoboMoveInfo, ToPos.Put_P4,1);
RoboMoveInfo.log("机器人到Put_P4");
break;
case MoveStep.MI_43:
RoboMoveInfo.NextMoveStep(MoveStep.MI_44);
robotHelper.Move(RoboMoveInfo, ToPos.P1, 1);
RoboMoveInfo.log("机器人到P1");
break;
case MoveStep.MI_44:
RoboMoveInfo.NextMoveStep(MoveStep.Wait);
RoboMoveInfo.log("放料完成");
break;
}
}
StoreJobList InStoreJobList = new StoreJobList(crc.GetString("Res0013","入库"));
volatile JobInfo InStoreJob;
StoreJobList OutStoreJobList = new StoreJobList(crc.GetString("Res0015","出库"));
internal void StartInStore(ReelParam trayParam)
{
//PosID== 料仓CID
InStoreJob = new JobInfo(trayParam.WareCode, trayParam.PosID, trayParam.PlateW, trayParam.PlateH);
InStoreJob.CID = trayParam.PosID;
InStoreJobList.Enqueue(new JobInfo(trayParam.WareCode, trayParam.PosID, trayParam.PlateW, trayParam.PlateH));
MoveInfo.log("写入点料队列:" + trayParam.ToStr());
}
internal void EnqueueOutStore(JobInfo trayParam)
{
OutStoreJobList.Enqueue(trayParam.Clone());
MoveInfo.log("写入出库队列:" + trayParam.ToStr());
}
internal void StartOutStore()
{
if (MoveInfo.MoveStep >= MoveStep.MI_50)
{
MoveInfo.log("机器人正在等待托盘");
}
else
{
MoveInfo.NewMove(MoveStep.MI_50);
MoveInfo.log("开始出库");
}
}
/// <summary>
/// 释放托盘
/// </summary>
public void TrayRelease() {
//MoveInfo.log("释放托盘");
// MoveInfo.NextMoveStep(MoveStep.TrayStop_LoadProcessed);
}
void CompTOP1(MoveInfo MoveInfo)
{
if (Comp.HasHome())
Comp.AbsMove(MoveInfo, RobotManage.Config.AMH_RoboMI1_Comp_P1, RobotManage.Config.AMH_RoboMI1_Comp_P1_speed);
else
Comp.HomeMove(MoveInfo);
}
void CompTOCompression(MoveInfo MoveInfo)
{
if (!Comp.HasHome())
return;
Comp.AbsMove(null, DeviceGroup.p3, RobotManage.Config.AMH_RoboMI1_Comp_P2_speed);
Comp.BatchAxisStartCheck(IO_Type.MI_Robot_Clamp_Check, IO_VALUE.HIGH);
}
bool compdetereel = false;
int lastCmd = 0;
int lastStep = 0;
int lastPrefix = 0;
public void ResetProcess()
{
if (CheckWait(MoveInfo))
return;
switch (MoveInfo.MoveStep)
{
case MoveStep.Wait:
//MoveInfo.NextMoveStep(MoveStep.H01_HomeReset);
break;
case MoveStep.H01_HomeReset:
MoveInfo.EndMove();
DeviceState = DeviceStateE.Run;
return;
if (!Enum.TryParse<MoveStep>(Config.Get("RuntimeRobot_" + robotname + "_MoveStep", MoveStep.Wait.ToString()), out MoveStep m1step))
m1step = MoveStep.Wait;
if (!Enum.TryParse<MoveStep>(Config.Get("RuntimeRobot_" + robotname + "_Arm_MoveStep", MoveStep.Wait.ToString()), out MoveStep m2step))
m2step = MoveStep.Wait;
//var m1step = (MoveStep)Enum.Parse(typeof(MoveStep), Config.Get("RuntimeRobot_" + robotname + "_MoveStep", MoveStep.Wait.ToString()));
//var m2step = (MoveStep)Enum.Parse(typeof(MoveStep), Config.Get("RuntimeRobot_" + robotname + "_Arm_MoveStep", MoveStep.Wait.ToString()));
if (IOValue(IO_Type.MI_Robot_Clamp_Check).Equals(IO_VALUE.LOW)
&& IOValue(IO_Type.MI_Robot_Reel_Check).Equals(IO_VALUE.LOW)
&& m1step == MoveStep.Wait)
{
MoveInfo.NextMoveStep(MoveStep.H09_HomeReset);
Robot.SendMoveCmd(1, Setting_Init.URRobot_MI1_Speed_Rate, false, RobotHelper.LoadRateParam[robotHelper.lastWeight]);
MoveInfo.log("没有最后的动作, 机器人回待机点");
}
else
{
MoveInfo.MoveParam = JsonConvert.DeserializeObject<ReelParam>(Config.Get("Runtime_Robot_"+robotname+"_ReelInfo"));
RoboMoveInfo.MoveParam = MoveInfo.MoveParam.clone();
FromPos = GetMIPosition(GroupName, Config.Get("Runtime_Robot_" + robotname + "_FromPos"));
ToPos = GetMIPosition(GroupName, Config.Get("Runtime_Robot_" + robotname + "_ToPos"));
CurrentVStore = VStoreCollection.VStoreList[MoveInfo.MoveParam.cid];
MoveInfo.NextMoveStep(m1step);
RoboMoveInfo.NextMoveStep(m2step);
DeviceState = DeviceStateE.Run;
}
break;
case MoveStep.H02_HomeReset:
if (!Robot.StartRobot()) {
MoveInfo.CanWhileCount--;
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitMsg(POS_Start + crc.GetString("Res0016","机器人连接失败"), MoveInfo.CanWhileCount<=0 ? MsgLevel.alarm: MsgLevel.warning));
}else
MoveInfo.NextMoveStep(MoveStep.H03_HomeReset);
break;
case MoveStep.H03_HomeReset:
if (Robot.IsRun)
{
MoveInfo.NextMoveStep(MoveStep.H04_HomeReset);
Robot.PlayProgram();
MoveInfo.log("Robot.ProgramState:" + Robot.ProgramState);
MoveInfo.log("Robot.ClientIsConnected:" + Robot.ClientIsConnected);
MoveInfo.log("Robot.IsRun:" + Robot.IsRun);
MoveInfo.log("Robot.IsStartConnect:" + Robot.IsStartConnect);
MoveInfo.log("Robot.CurCmdReponse:" + Robot.CurCmdReponse);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
} else if (MoveInfo.IsTimeOut(30)) {
MoveInfo.NextMoveStep(MoveStep.H02_HomeReset);
}
MoveInfo.WaitList.Add(WaitResultInfo.WaitMsg(POS_Start + crc.GetString("Res0017", "机器人启动失败"), MoveInfo.CanWhileCount <= 0 ? MsgLevel.alarm : MsgLevel.warning));
break;
case MoveStep.H04_HomeReset:
if (Robot.ClientIsConnected && Robot.CurCmdReponse.Contains("Start Program"))
{
MoveInfo.NextMoveStep(MoveStep.H05_HomeReset);
}
else if (MoveInfo.IsTimeOut(10))
{
MoveInfo.NextMoveStep(MoveStep.H10_HomeReset);
}
MoveInfo.WaitList.Add(WaitResultInfo.WaitMsg(POS_Start + crc.GetString("Res0018", "机器人未连接MT"), MoveInfo.CanWhileCount <= 0 ? MsgLevel.alarm : MsgLevel.warning));
break;
case MoveStep.H05_HomeReset:
MoveInfo.NextMoveStep(MoveStep.H09_HomeReset);
return;
case MoveStep.H06_HomeReset:
if (Robot.MoveCmdOk())
{
//如果上一步是回到待机点,并且料叉上无物料
if (lastStep==1 && !compdetereel && !IOValue(IO_Type.MI_Robot_Reel_Check).Equals(IO_VALUE.HIGH))
{
//回原结束
return;
}
RoboMoveInfo.MoveParam = MoveInfo.MoveParam.clone();
robotHelper.lastWeight = GetWeight(RoboMoveInfo.MoveParam);
//如果上一步是回待机点,但料叉上有物料
if (lastStep == 1)
{
MoveInfo.NextMoveStep(MoveStep.MI_02);
RoboMoveInfo.NextMoveStep(MoveStep.MI_07);
}
else if (lastStep == 0)//P5 取料低点
{
MoveInfo.NextMoveStep(MoveStep.MI_02);
RoboMoveInfo.NextMoveStep(MoveStep.MI_02);
}
else if (lastStep == 2)//P6 取料高点
{
MoveInfo.NextMoveStep(MoveStep.MI_02);
RoboMoveInfo.NextMoveStep(MoveStep.MI_04);
}
else if (lastStep == 5)//P7 取料退出过度点
{
MoveInfo.NextMoveStep(MoveStep.MI_02);
RoboMoveInfo.NextMoveStep(MoveStep.MI_06);
}
else if (lastStep == 1)//P2 放料高点P2
{
MoveInfo.NextMoveStep(MoveStep.MI_02);
RoboMoveInfo.NextMoveStep(MoveStep.MI_40);
}
}
break;
case MoveStep.H09_HomeReset:
if (Robot.MoveCmdOk())
{
MoveInfo.EndMove();
DeviceState = DeviceStateE.Run;
}
break;
//尝试解除安全保护
case MoveStep.H10_HomeReset:
MoveInfo.NextMoveStep(MoveStep.H11_HomeReset);
Robot.SendCMD("safetymode", 0);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
break;
case MoveStep.H11_HomeReset:
MoveInfo.log("机器人反馈安全模式为:" + Robot.CurDashboardReponse);
if (Robot.CurDashboardReponse.Contains("PROTECTIVE_STOP"))
{
MoveInfo.NextMoveStep(MoveStep.H12_HomeReset);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(5000));
}
else if (Robot.CurDashboardReponse.Contains("NORMAL")) {
MoveInfo.NextMoveStep(MoveStep.H02_HomeReset);
}
else if (Robot.CurDashboardReponse.Contains("Starting program"))
{
MoveInfo.NextMoveStep(MoveStep.H02_HomeReset);
}
else {
Msg.add(crc.GetString("Res0059","机器人状态异常:") + Robot.CurDashboardReponse, MsgLevel.alarm);
}
break;
case MoveStep.H12_HomeReset:
MoveInfo.NextMoveStep(MoveStep.H13_HomeReset);
MoveInfo.log("机器人反馈安全模式为:"+Robot.CurCmdReponse);
Robot.SendCMD("unlock protective stop", 0);
MoveInfo.log("尝试解除机器人保护");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
break;
case MoveStep.H13_HomeReset:
if (Robot.CurCmdReponse.Contains("Protective stop releasing")) {
MoveInfo.log("机器人成功解除保护");
Robot.StopProgram();
MoveInfo.NextMoveStep(MoveStep.H02_HomeReset);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else if (MoveInfo.IsTimeOut(5))
{
MoveInfo.NextMoveStep(MoveStep.H10_HomeReset);
}
break;
}
}
/// <summary>
/// 设备是否有任务
/// </summary>
/// <param name="reelParam"></param>
/// <returns></returns>
public bool HasJob(ReelParam reelParam)
{
if (DeviceState != DeviceStateE.Run)
return false;
if (reelParam==null && MoveInfo.MoveStep >= MoveStep.MI_53)//正在出库中
return true;
if (MoveInfo.MoveStep != MoveStep.Wait)
return false;
if (reelParam == null)
{
//空托盘,判断有没有出库任务
var sc = VStoreCollection.VStoreList.Values.Where(vs => vs.TowerInfo.DeviceGroupName == GroupName).ToList().Find(vs=>vs.RTStoreStatus==RTStoreStatus.OutStoreReady || vs.RTStoreStatus == RTStoreStatus.InStoreError|| vs.RTStoreStatus == RTStoreStatus.InStoreDataTimeOut || vs.TerminalError);
return (sc != null);
}
if (string.IsNullOrEmpty(reelParam.SubCID)) {
MoveInfo.log("SubCID为空");
return false;
}
if (!VStoreCollection.VStoreList.ContainsKey(reelParam.SubCID)) {
MoveInfo.log("RT料仓CID不存在:"+ reelParam.SubCID);
return false;
}
//有料托盘,判断目的地料仓是否空闲
if (VStoreCollection.VStoreList[reelParam.SubCID].RTStoreStatus == RTStoreStatus.Ready)
{
//料仓空闲, 锁定料仓准备入库
VStoreCollection.VStoreList[reelParam.SubCID].RTStoreStatus = RTStoreStatus.LockToInStore;
return true;
}
MoveInfo.log("RT料仓当前状态:" + VStoreCollection.VStoreList[reelParam.SubCID].RTStoreStatus);
return false;
}
int bufferstoresindex = 0;
string[] bufferstores = new string[] { "B01", "B02", "B03", "B04", "B05", "B06", "B07", "B08" };
string GetNextBufferStore() {
if (bufferstoresindex >= bufferstores.Length)
bufferstoresindex = 0;
var c = POS_Start + "_"+bufferstores[bufferstoresindex];
bufferstoresindex++;
return c;
}
public bool FrontCheck(int curaddr)
{
throw new NotImplementedException();
}
public bool IsFree()
{
throw new NotImplementedException();
}
public RobotPosition GetMIPosition(string device, string pos) {
if (device == "AMH-MI1")
return RobotManage.MI1Postion[pos];
else if (device == "AMH-MI2")
return RobotManage.MI2Postion[pos];
else
return RobotManage.CIPostion[pos];
}
int GetWeight(ReelParam reelParam) {
int w = 0;
if (reelParam == null)
w = 1;
else if (reelParam.PlateW==7)
w= 2;
else if (reelParam.PlateW == 13 && reelParam.PlateH==8)
w= 2;
else if(reelParam.PlateW == 13)
w= 3;
else if(reelParam.PlateW == 15)
w= 3;
else
w= 2;
RoboMoveInfo.log($"机器人负载设定: {reelParam?.PlateW}x{reelParam?.PlateH}={w}");
return w;
}
public void FrontStopProcess()
{
//throw new NotImplementedException();
}
}
}
\ No newline at end of file
......@@ -160,7 +160,8 @@ namespace DeviceLibrary
return;
}
//判断有无出库任务
var testInStoreError = VStoreCollection.VStoreList.Values.Where(vs => vs.TowerInfo.DeviceGroupName == GroupName).ToList().Find(vs => DateTime.Now > vs.LastProcessErrorTime && vs.LastProcessErrorTimes<4 && (vs.RTStoreStatus == RTStoreStatus.InStoreError || vs.RTStoreStatus == RTStoreStatus.InStoreDataTimeOut || vs.TerminalError));
//var testInStoreError = VStoreCollection.VStoreList.Values.Where(vs => vs.TowerInfo.DeviceGroupName == GroupName).ToList().Find(vs => DateTime.Now > vs.LastProcessErrorTime && vs.LastProcessErrorTimes<4 && (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;
if (testInStoreError != null)
hasoutjob = true;
......@@ -254,7 +255,8 @@ namespace DeviceLibrary
}
break;
case MoveStep.MI_50:
var InStoreError = VStoreCollection.VStoreList.Values.Where(vs => vs.TowerInfo.DeviceGroupName == GroupName).ToList().Find(vs => DateTime.Now > vs.LastProcessErrorTime && vs.LastProcessErrorTimes < 4 && (vs.RTStoreStatus == RTStoreStatus.InStoreError || vs.RTStoreStatus == RTStoreStatus.InStoreDataTimeOut || vs.TerminalError));
//var InStoreError = VStoreCollection.VStoreList.Values.Where(vs => vs.TowerInfo.DeviceGroupName == GroupName).ToList().Find(vs => DateTime.Now > vs.LastProcessErrorTime && vs.LastProcessErrorTimes < 4 && (vs.RTStoreStatus == RTStoreStatus.InStoreError || vs.RTStoreStatus == RTStoreStatus.InStoreDataTimeOut || vs.TerminalError));
var InStoreError = VStoreCollection.VStoreList.Values.Where(vs => vs.TowerInfo.DeviceGroupName == GroupName).ToList().Find(vs => (vs.RTStoreStatus == RTStoreStatus.InStoreError || vs.RTStoreStatus == RTStoreStatus.InStoreDataTimeOut || vs.TerminalError));
if (InStoreError != null)
{
var result = TheLine.GetReelSize<ResultData>(InStoreError.CurrentTerminalReelID);
......
......@@ -34,6 +34,8 @@ namespace DeviceLibrary
AxisBean axis;
CylinderManger Location;
CylinderManger Transplant;
public bool Disable { get; set; }=false;
public DeviceStateE DeviceState { get ; set ; }
public TransplantMove(DeviceGroup device, Robot_Config config, out string msg) : base()
......@@ -60,7 +62,16 @@ namespace DeviceLibrary
}
public void Start()
{
OpenAllServo();
axis.Disable = Disable;
if (Disable)
{
MoveInfo.log("移栽设备已禁用");
}
else
{
OpenAllServo();
}
DeviceState = DeviceStateE.HomeReset;
MoveInfo.NewMove(MoveStep.H01_HomeReset);
MoveInfo.log("开始回原");
......@@ -127,9 +138,18 @@ namespace DeviceLibrary
IOMove(IO_Type.AMH_Front_Stop, IO_VALUE.LOW);
if (IOValue(IO_Type.AMH_In_Check).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(MoveStep.TransplantMove_03);
if (Disable)
{
MoveInfo.NextMoveStep(MoveStep.TransplantMove_04);
MoveInfo.log("移栽设备禁用,直接通过");
Location.ToLow(MoveInfo);
}
else
MoveInfo.NextMoveStep(MoveStep.TransplantMove_03);
MoveInfo.CanWhileCount = 3;
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//Location.ToHigh(MoveInfo);
}
else if (MoveInfo.IsTimeOut(10)) {
......@@ -551,16 +571,18 @@ namespace DeviceLibrary
break;
case MoveStep.H01_HomeReset:
MoveInfo.NextMoveStep(MoveStep.H02_HomeReset);
axis.HomeMove(MoveInfo);
if (!Disable)
axis.HomeMove(MoveInfo);
break;
case MoveStep.H02_HomeReset:
MoveInfo.NextMoveStep(MoveStep.H03_HomeReset);
Location.ToLow(MoveInfo);
Transplant.ToLow(MoveInfo);
if (!Disable)
Transplant.ToLow(MoveInfo);
break;
case MoveStep.H03_HomeReset:
MoveInfo.NextMoveStep(MoveStep.H04_HomeReset);
if (ConfigHelper.Config.Get($"Runtime_{GroupName}_IsSucker",false))
if (ConfigHelper.Config.Get($"Runtime_{GroupName}_IsSucker",false) && !Disable)
{
if (string.IsNullOrEmpty(CurrrentRFID))
CurrrentRFID = ConfigHelper.Config.Get($"Runtime_{GroupName}_CurrrentRFID");
......
......@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
......@@ -150,7 +151,7 @@ namespace DeviceLibrary
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}");
#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)
{
/*
* 请求一个空托盘
......@@ -185,7 +186,8 @@ namespace DeviceLibrary
MoveInfo.log("检测到机器人急停,托盘放行处理");
MoveInfo.NextMoveStep(MoveStep.TrayStop_04);
return;
}else
}
else
if (!trayInfo.HasLoad && IOValue(IO_Type.MI_Reel_Check).Equals(IO_VALUE.LOW))
{
MoveInfo.NextMoveStep(MoveStep.TrayStop_07);
......@@ -201,7 +203,8 @@ namespace DeviceLibrary
}
else if (trayInfo.DestinationAddr == DeviceGroup.addr_1 && trayInfo.HasLoad)
{
if (IOValue(IO_Type.MI_Reel_Check).Equals(IO_VALUE.LOW)) {
if (IOValue(IO_Type.MI_Reel_Check).Equals(IO_VALUE.LOW))
{
TrayManager.SetTrayError(CurrrentRFID);
Msg.add(crc.GetString("Res0034", "托盘没有检测到物料"), MsgLevel.alarm);
MoveInfo.log("托盘没有检测到物料");
......@@ -212,11 +215,11 @@ namespace DeviceLibrary
if (VStoreCollection.VStoreList[cid].RTStoreStatus == RTStoreStatus.Offline)
{
MoveInfo.log($"当前需求设备CID:{cid}已离线");
var rm= TheLine.Regetposid(trayInfo.TrayParam, trayInfo.TrayType.ToString(), out string msg);
var rm = TheLine.Regetposid(trayInfo.TrayParam, trayInfo.TrayType.ToString(), out string msg);
MoveInfo.log($"重新获取库位 msg:{msg},\t {rm.ToStr()}");
RequestLoadInfo RequestLoadInfo = new RequestLoadInfo();
RequestLoadInfo.LoadParam = rm.clone();
RequestLoadInfo.DeviceGroupName= rm.cid;
RequestLoadInfo.DeviceGroupName = rm.cid;
RequestLoadInfo.TrayType = trayInfo.TrayType.ToString();
RequestLoadInfo.IsEmpty = false;
TrayManager.SetTrayLoadInfo(CurrrentRFID, RequestLoadInfo);
......@@ -242,6 +245,37 @@ namespace DeviceLibrary
MoveInfo.NextMoveStep(MoveStep.TrayStop_04);
return;
}
else if (GroupName == "CI" && trayInfo.TrayType == TrayTypeE.MTP1) {
var device = CI.DeviceList[GroupName];
if (!device.ManualCount)
{
MoveInfo.log($"点料机当前不可用,NG处理");
RequestLoadInfo RequestLoadInfo = new RequestLoadInfo();
RequestLoadInfo.LoadParam = trayInfo.TrayParam.clone();
RequestLoadInfo.LoadParam.IsNg=true;
RequestLoadInfo.LoadParam.NgMsg="XRay not enable";
RequestLoadInfo.DeviceGroupName = "AMH-MI2";
RequestLoadInfo.TrayType = trayInfo.TrayType.ToString();
RequestLoadInfo.IsEmpty = false;
TrayManager.SetTrayLoadInfo(CurrrentRFID, RequestLoadInfo);
//查询新库位, 检查料仓状态
MoveInfo.NextMoveStep(MoveStep.TrayStop_03);
return;
}
else
{
MoveInfo.NextMoveStep(MoveStep.TrayStop_07);
//抵达了一个有物料的托盘等待处理
if (!device.HasJob(trayInfo.TrayParam))
MoveInfo.NextMoveStep(MoveStep.TrayStop_04);
else
{
MoveInfo.NextMoveStep(MoveStep.TrayStop_07);
device.StartInStore(trayInfo.TrayParam);
}
}
}
#endregion
if (stop && !trayInfo.HasLoad && IOValue(IO_Type.MI_Reel_Check).Equals(IO_VALUE.LOW))
{
......
......@@ -103,5 +103,11 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{43CDD09E-FCF3-4960-A01D-3BBFE9933122}</Project>
<Name>Common</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using ConfigHelper;
using Newtonsoft.Json;
using OnlineStore;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
......@@ -298,7 +299,7 @@ namespace RemoteSheardObject
if (mid == "AMH-MI1" || mid == "AMH-MI2")
{
var micode = $"P{reelParam.PN}#S{reelParam.RI}#{reelParam.QTY}#{reelParam.DC}";
msg += "送往MI物料重组2dcode:" + micode;
msg += $"送往MI物料重组2dcode:" + micode;
reelParam.SubCID = result.cid;
reelParam.WareCode = micode;
......
......@@ -34,12 +34,13 @@
this.txt_barcode = new System.Windows.Forms.TextBox();
this.label_barcode = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.cb_manualcount = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// label_status
//
this.label_status.AutoSize = true;
this.label_status.Location = new System.Drawing.Point(60, 86);
this.label_status.Location = new System.Drawing.Point(60, 128);
this.label_status.Name = "label_status";
this.label_status.Size = new System.Drawing.Size(41, 12);
this.label_status.TabIndex = 0;
......@@ -47,7 +48,7 @@
//
// btn_start
//
this.btn_start.Location = new System.Drawing.Point(325, 86);
this.btn_start.Location = new System.Drawing.Point(325, 128);
this.btn_start.Name = "btn_start";
this.btn_start.Size = new System.Drawing.Size(135, 23);
this.btn_start.TabIndex = 1;
......@@ -57,7 +58,7 @@
//
// txt_barcode
//
this.txt_barcode.Location = new System.Drawing.Point(123, 34);
this.txt_barcode.Location = new System.Drawing.Point(123, 76);
this.txt_barcode.Name = "txt_barcode";
this.txt_barcode.Size = new System.Drawing.Size(337, 21);
this.txt_barcode.TabIndex = 2;
......@@ -66,7 +67,7 @@
// label_barcode
//
this.label_barcode.AutoSize = true;
this.label_barcode.Location = new System.Drawing.Point(60, 37);
this.label_barcode.Location = new System.Drawing.Point(60, 79);
this.label_barcode.Name = "label_barcode";
this.label_barcode.Size = new System.Drawing.Size(53, 12);
this.label_barcode.TabIndex = 0;
......@@ -78,10 +79,22 @@
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// cb_manualcount
//
this.cb_manualcount.AutoSize = true;
this.cb_manualcount.Location = new System.Drawing.Point(32, 27);
this.cb_manualcount.Name = "cb_manualcount";
this.cb_manualcount.Size = new System.Drawing.Size(96, 16);
this.cb_manualcount.TabIndex = 3;
this.cb_manualcount.Text = "手动拦截点料";
this.cb_manualcount.UseVisualStyleBackColor = true;
this.cb_manualcount.CheckedChanged += new System.EventHandler(this.cb_manualcount_CheckedChanged);
//
// CIDebugControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.cb_manualcount);
this.Controls.Add(this.txt_barcode);
this.Controls.Add(this.btn_start);
this.Controls.Add(this.label_barcode);
......@@ -100,5 +113,6 @@
private System.Windows.Forms.TextBox txt_barcode;
private System.Windows.Forms.Label label_barcode;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.CheckBox cb_manualcount;
}
}
using DeviceLibrary;
using OnlineStore;
using DeviceLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
......@@ -50,13 +51,18 @@ namespace TheMachine.device
LogUtil.info("手动点击开始点料");
}
else {
MessageBox.Show("未成功连接VJ点料机");
MessageBox.Show(crc.GetString("Res0117.c9f109fe","未成功连接VJ点料机"));
}
}
else
{
MessageBox.Show("点料机没有准备好,不能启动.");
MessageBox.Show(crc.GetString("Res0118.f955ef4e","点料机没有准备好,不能启动."));
}
}
private void cb_manualcount_CheckedChanged(object sender, EventArgs e)
{
CI.DeviceList["CI"].ManualCount = cb_manualcount.Checked;
}
}
}
}
\ No newline at end of file
......@@ -43,9 +43,10 @@ namespace TheMachine
this.cylinderButton1 = new TheMachine.CylinderButton();
this.ioControl1 = new TheMachine.IOControl();
this.panel1 = new System.Windows.Forms.Panel();
this.btn_Reset = new System.Windows.Forms.Button();
this.btn_sucker_release = new System.Windows.Forms.Button();
this.rfidControl1 = new TheMachine.UC.RfidControl();
this.btn_Reset = new System.Windows.Forms.Button();
this.cb_disabledevice = new System.Windows.Forms.CheckBox();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
......@@ -59,7 +60,7 @@ namespace TheMachine
//
// button_save
//
this.button_save.Location = new System.Drawing.Point(755, 623);
this.button_save.Location = new System.Drawing.Point(762, 640);
this.button_save.Name = "button_save";
this.button_save.Size = new System.Drawing.Size(100, 23);
this.button_save.TabIndex = 7;
......@@ -69,21 +70,21 @@ namespace TheMachine
//
// textBox_p2
//
this.textBox_p2.Location = new System.Drawing.Point(758, 544);
this.textBox_p2.Location = new System.Drawing.Point(765, 570);
this.textBox_p2.Name = "textBox_p2";
this.textBox_p2.Size = new System.Drawing.Size(100, 21);
this.textBox_p2.TabIndex = 8;
//
// textBox_p3
//
this.textBox_p3.Location = new System.Drawing.Point(755, 587);
this.textBox_p3.Location = new System.Drawing.Point(762, 613);
this.textBox_p3.Name = "textBox_p3";
this.textBox_p3.Size = new System.Drawing.Size(100, 21);
this.textBox_p3.TabIndex = 8;
//
// button_p2
//
this.button_p2.Location = new System.Drawing.Point(581, 542);
this.button_p2.Location = new System.Drawing.Point(588, 568);
this.button_p2.Name = "button_p2";
this.button_p2.Size = new System.Drawing.Size(162, 23);
this.button_p2.TabIndex = 9;
......@@ -93,7 +94,7 @@ namespace TheMachine
//
// button_p3
//
this.button_p3.Location = new System.Drawing.Point(578, 585);
this.button_p3.Location = new System.Drawing.Point(585, 611);
this.button_p3.Name = "button_p3";
this.button_p3.Size = new System.Drawing.Size(162, 23);
this.button_p3.TabIndex = 9;
......@@ -103,7 +104,7 @@ namespace TheMachine
//
// button_p1
//
this.button_p1.Location = new System.Drawing.Point(581, 513);
this.button_p1.Location = new System.Drawing.Point(588, 539);
this.button_p1.Name = "button_p1";
this.button_p1.Size = new System.Drawing.Size(162, 23);
this.button_p1.TabIndex = 9;
......@@ -118,7 +119,7 @@ namespace TheMachine
this.cylinderButton8.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton8.IO_HIGH = "AMH_Front_Stop";
this.cylinderButton8.IO_LOW = "";
this.cylinderButton8.Location = new System.Drawing.Point(618, 378);
this.cylinderButton8.Location = new System.Drawing.Point(625, 404);
this.cylinderButton8.Name = "cylinderButton8";
this.cylinderButton8.Size = new System.Drawing.Size(181, 38);
this.cylinderButton8.TabIndex = 2;
......@@ -133,7 +134,7 @@ namespace TheMachine
this.cylinderButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton2.IO_HIGH = "AMH_Tray_Stop";
this.cylinderButton2.IO_LOW = "";
this.cylinderButton2.Location = new System.Drawing.Point(618, 422);
this.cylinderButton2.Location = new System.Drawing.Point(625, 448);
this.cylinderButton2.Name = "cylinderButton2";
this.cylinderButton2.Size = new System.Drawing.Size(181, 38);
this.cylinderButton2.TabIndex = 3;
......@@ -148,7 +149,7 @@ namespace TheMachine
this.cylinderButton7.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton7.IO_HIGH = "AMH_Sucker";
this.cylinderButton7.IO_LOW = "";
this.cylinderButton7.Location = new System.Drawing.Point(618, 337);
this.cylinderButton7.Location = new System.Drawing.Point(625, 363);
this.cylinderButton7.Name = "cylinderButton7";
this.cylinderButton7.Size = new System.Drawing.Size(181, 38);
this.cylinderButton7.TabIndex = 3;
......@@ -163,7 +164,7 @@ namespace TheMachine
this.cylinderButton6.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton6.IO_HIGH = "AMH_Trans_Fwd";
this.cylinderButton6.IO_LOW = "AMH_Trans_Bwd";
this.cylinderButton6.Location = new System.Drawing.Point(618, 293);
this.cylinderButton6.Location = new System.Drawing.Point(625, 319);
this.cylinderButton6.Name = "cylinderButton6";
this.cylinderButton6.Size = new System.Drawing.Size(181, 38);
this.cylinderButton6.TabIndex = 4;
......@@ -178,7 +179,7 @@ namespace TheMachine
this.cylinderButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cylinderButton1.IO_HIGH = "AMH_Location_Up";
this.cylinderButton1.IO_LOW = "AMH_Location_Down";
this.cylinderButton1.Location = new System.Drawing.Point(618, 249);
this.cylinderButton1.Location = new System.Drawing.Point(625, 275);
this.cylinderButton1.Name = "cylinderButton1";
this.cylinderButton1.Size = new System.Drawing.Size(181, 38);
this.cylinderButton1.TabIndex = 5;
......@@ -197,6 +198,7 @@ namespace TheMachine
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.cb_disabledevice);
this.panel1.Controls.Add(this.btn_Reset);
this.panel1.Controls.Add(this.btn_sucker_release);
this.panel1.Controls.Add(this.rfidControl1);
......@@ -219,11 +221,21 @@ namespace TheMachine
this.panel1.Size = new System.Drawing.Size(1021, 741);
this.panel1.TabIndex = 10;
//
// btn_Reset
//
this.btn_Reset.Location = new System.Drawing.Point(770, 140);
this.btn_Reset.Name = "btn_Reset";
this.btn_Reset.Size = new System.Drawing.Size(100, 69);
this.btn_Reset.TabIndex = 12;
this.btn_Reset.Text = "Reset";
this.btn_Reset.UseVisualStyleBackColor = true;
this.btn_Reset.Click += new System.EventHandler(this.btn_Reset_Click);
//
// btn_sucker_release
//
this.btn_sucker_release.BackColor = System.Drawing.Color.White;
this.btn_sucker_release.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_sucker_release.Location = new System.Drawing.Point(618, 469);
this.btn_sucker_release.Location = new System.Drawing.Point(625, 495);
this.btn_sucker_release.Name = "btn_sucker_release";
this.btn_sucker_release.Size = new System.Drawing.Size(181, 38);
this.btn_sucker_release.TabIndex = 11;
......@@ -240,15 +252,16 @@ namespace TheMachine
this.rfidControl1.TabIndex = 10;
this.rfidControl1.Visible = false;
//
// btn_Reset
// cb_disabledevice
//
this.btn_Reset.Location = new System.Drawing.Point(770, 140);
this.btn_Reset.Name = "btn_Reset";
this.btn_Reset.Size = new System.Drawing.Size(100, 69);
this.btn_Reset.TabIndex = 12;
this.btn_Reset.Text = "Reset";
this.btn_Reset.UseVisualStyleBackColor = true;
this.btn_Reset.Click += new System.EventHandler(this.btn_Reset_Click);
this.cb_disabledevice.AutoSize = true;
this.cb_disabledevice.Location = new System.Drawing.Point(588, 245);
this.cb_disabledevice.Name = "cb_disabledevice";
this.cb_disabledevice.Size = new System.Drawing.Size(108, 16);
this.cb_disabledevice.TabIndex = 13;
this.cb_disabledevice.Text = "Disable device";
this.cb_disabledevice.UseVisualStyleBackColor = true;
this.cb_disabledevice.CheckedChanged += new System.EventHandler(this.cb_disabledevice_CheckedChanged);
//
// TransplantControl
//
......@@ -282,5 +295,6 @@ namespace TheMachine
private UC.RfidControl rfidControl1;
private System.Windows.Forms.Button btn_sucker_release;
private System.Windows.Forms.Button btn_Reset;
private System.Windows.Forms.CheckBox cb_disabledevice;
}
}
......@@ -96,5 +96,10 @@ namespace TheMachine
{
TransplantMove.DeviceList[DeviceGroupName].ResetStatus();
}
private void cb_disabledevice_CheckedChanged(object sender, EventArgs e)
{
TransplantMove.DeviceList[DeviceGroupName].Disable = cb_disabledevice.Checked;
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!