Commit 1587d8a9 刘韬

稳定版本

1 个父辈 04115036
...@@ -73,5 +73,7 @@ namespace OnlineStore.Common ...@@ -73,5 +73,7 @@ namespace OnlineStore.Common
public static MyConfig<string> Runtime_Robot_ReelInfo; public static MyConfig<string> Runtime_Robot_ReelInfo;
public static MyConfig<string> Runtime_Robot_FromPos; public static MyConfig<string> Runtime_Robot_FromPos;
public static MyConfig<string> Runtime_Robot_ToPos; public static MyConfig<string> Runtime_Robot_ToPos;
public static MyConfig<string> RuntimeRobot_Arm_MoveStep;
public static MyConfig<string> RuntimeRobot_MoveStep;
} }
} }
...@@ -107,6 +107,7 @@ ...@@ -107,6 +107,7 @@
<Compile Include="DeviceLibrary\LineRunMonitor.cs" /> <Compile Include="DeviceLibrary\LineRunMonitor.cs" />
<Compile Include="DeviceLibrary\C8WeightSensor.cs" /> <Compile Include="DeviceLibrary\C8WeightSensor.cs" />
<Compile Include="DeviceLibrary\OKLEController.cs" /> <Compile Include="DeviceLibrary\OKLEController.cs" />
<Compile Include="DeviceLibrary\RobotMoveHelper.cs" />
<Compile Include="DeviceLibrary\ServerCommunication.cs" /> <Compile Include="DeviceLibrary\ServerCommunication.cs" />
<Compile Include="DeviceLibrary\AxisBean.cs" /> <Compile Include="DeviceLibrary\AxisBean.cs" />
<Compile Include="theMachine\Common.cs" /> <Compile Include="theMachine\Common.cs" />
......
...@@ -119,6 +119,9 @@ namespace DeviceLibrary ...@@ -119,6 +119,9 @@ namespace DeviceLibrary
LogUtil.info("ServoOff【" + AxisName + "】"); LogUtil.info("ServoOff【" + AxisName + "】");
AxisManager.ServoOff(Config.DeviceName, Config.GetAxisValue()); AxisManager.ServoOff(Config.DeviceName, Config.GetAxisValue());
} }
public bool HasHome() {
return AxisManager.GetHomeEndStatus(Config.DeviceName, (short)Config.GetAxisValue()) == 3;
}
public void HomeMove(MoveInfo MoveInfo,bool force=true) public void HomeMove(MoveInfo MoveInfo,bool force=true)
{ {
if (!force && AxisManager.GetHomeEndStatus(Config.DeviceName, (short)Config.GetAxisValue()) == 3) if (!force && AxisManager.GetHomeEndStatus(Config.DeviceName, (short)Config.GetAxisValue()) == 3)
......
...@@ -26,8 +26,8 @@ namespace DeviceLibrary ...@@ -26,8 +26,8 @@ namespace DeviceLibrary
currentIOvalue = IO_VALUE.HIGH; currentIOvalue = IO_VALUE.HIGH;
if (moveInfo != null) if (moveInfo != null)
{ {
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(Low, IO_VALUE.LOW)); moveInfo.WaitList.Add(WaitResultInfo.WaitIO(Low, IO_VALUE.LOW, true));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(High, IO_VALUE.HIGH)); moveInfo.WaitList.Add(WaitResultInfo.WaitIO(High, IO_VALUE.HIGH, true));
} }
Resume(false); Resume(false);
if (moveInfo!=null) if (moveInfo!=null)
...@@ -40,8 +40,8 @@ namespace DeviceLibrary ...@@ -40,8 +40,8 @@ namespace DeviceLibrary
currentIOvalue = IO_VALUE.LOW; currentIOvalue = IO_VALUE.LOW;
if (moveInfo != null) if (moveInfo != null)
{ {
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(Low, IO_VALUE.HIGH)); moveInfo.WaitList.Add(WaitResultInfo.WaitIO(Low, IO_VALUE.HIGH, true));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(High, IO_VALUE.LOW)); moveInfo.WaitList.Add(WaitResultInfo.WaitIO(High, IO_VALUE.LOW, true));
} }
Resume(false); Resume(false);
if (moveInfo != null) if (moveInfo != null)
......
using OnlineStore.Common;
using Robot.UR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DeviceLibrary
{
class RobotHelper
{
int lastMoveCmd = 0;
URRobotControl robot;
System.Timers.Timer RobotCheck;
public RobotHelper(URRobotControl _robot) {
robot = _robot;
RobotCheck = new System.Timers.Timer(5000);
RobotCheck.Elapsed += RobotCheck_Elapsed;
}
public volatile bool RobotStatus = false;
private void RobotCheck_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (!robot.IsRun)
{
robot.StartRobot();
RobotStatus = false;
}
robot.SendCMD("safetymode", 0);
Thread.Sleep(100);
if (!robot.CurDashboardReponse.Contains("NORMAL"))
{
RobotStatus = false;
//Msg.add(POS_Start + "机器人状态异常:" + Robot.CurDashboardReponse, MsgLevel.alarm);
if (robot.CurDashboardReponse.Contains("PROTECTIVE_STOP"))
{
robot.SendCMD("unlock protective stop", 0);
}
}
robot.SendCMD("programState", 0);
Thread.Sleep(300);
if (!robot.CurDashboardReponse.Contains("PLAYING"))
{
RobotStatus = false;
//Msg.add(POS_Start + "机器人状态异常:" + Robot.CurDashboardReponse, MsgLevel.alarm);
robot.PlayProgram();
}
else if (!robot.ClientIsConnected) {
RobotStatus = false;
robot.StopProgram();
}
else
RobotStatus = true;
}
public void Move(MoveInfo moveInfo, int movecmd) {
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(IsMoveOk), "等待" + $"[{robot.Name}]" + "移动到位"));
}
lastMoveCmd = movecmd;
robot.SendMoveCmd(movecmd, Setting_Init.URRobot_MI1_Speed_Rate);
}
internal void Start()
{
RobotCheck.Enabled = true;
}
public bool IsMoveOk(WaitResultInfo waitResultInfo) {
if (robot.CurCmdReponse.Contains($"{lastMoveCmd},done"))
return true;
else if (robot.CurCmdReponse.Contains($"done"))
{
LogUtil.error($"机器人没有移动到位,重新移动:{lastMoveCmd}");
robot.SendMoveCmd(lastMoveCmd);
return false;
}
else
return false;
}
internal void Stop()
{
RobotCheck.Enabled = false;
}
}
}
...@@ -78,8 +78,11 @@ namespace DeviceLibrary ...@@ -78,8 +78,11 @@ namespace DeviceLibrary
{ {
VLog.Info("入库成功:" + InStoreJobInfo.ToStr()); VLog.Info("入库成功:" + InStoreJobInfo.ToStr());
string[] substrings = InStoreJobInfo.WareNum.Split('#'); string[] substrings = InStoreJobInfo.WareNum.Split('#');
string secondSubstring = substrings[1].Substring(1); if (substrings.Length > 2)
InStoreEnd(secondSubstring); {
string secondSubstring = substrings[1].Substring(1);
InStoreEnd(secondSubstring);
}
InStoreJobInfo = null; InStoreJobInfo = null;
} }
} }
......
using OnlineStore; using OnlineStore;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using RemoteSheardObject;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -18,6 +19,32 @@ namespace DeviceLibrary ...@@ -18,6 +19,32 @@ namespace DeviceLibrary
public MsgService Msg { get; set; } public MsgService Msg { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string GroupName { get; set; } public string GroupName { get; set; }
System.Timers.Timer timer;
public DeviceBase() {
timer = new System.Timers.Timer(5000);
timer.Elapsed += Timer_Elapsed;
timer.Enabled = true;
}
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
EquipMsgData equipMsg = new EquipMsgData();
equipMsg.msgList = new List<EquipMessage>();
equipMsg.status = 0;
Msg.msg.ForEach(ml =>
{
equipMsg.msgList.Add(new EquipMessage()
{
msg = ml.msgtxt,
status = ml.msgLevel == MsgLevel.alarm ? 1 : 0
});
if (ml.msgLevel == MsgLevel.alarm)
equipMsg.status = 1;
});
equipMsg.equipName = GroupName;
TheLine.UploadStatus(equipMsg);
}
public static bool FwdFree(int curaddr) { public static bool FwdFree(int curaddr) {
int nextaddr = curaddr + 1; int nextaddr = curaddr + 1;
...@@ -32,7 +59,7 @@ namespace DeviceLibrary ...@@ -32,7 +59,7 @@ namespace DeviceLibrary
public void StopMove(bool ServoOff = false) public void StopMove(bool ServoOff = false)
{ {
//runStatus = RunStatus.Stop; //runStatus = RunStatus.Stop;
MoveInfo.List.ForEach((m) => { m.EndMove(); }); //MoveInfo.List.ForEach((m) => { m.EndMove(); });
if (AxisBean.List.ContainsKey(GroupName)) if (AxisBean.List.ContainsKey(GroupName))
AxisBean.StopMultiAxis(AxisBean.List[GroupName]); AxisBean.StopMultiAxis(AxisBean.List[GroupName]);
...@@ -69,8 +96,7 @@ namespace DeviceLibrary ...@@ -69,8 +96,7 @@ namespace DeviceLibrary
{ {
isOk = false; isOk = false;
} }
MoveInfo.WaitList.ToList().ForEach((w) => {
MoveInfo.WaitList.ForEach((w) => {
if (w.WaitType.Equals(WaitEnum.W014_Msg)) { if (w.WaitType.Equals(WaitEnum.W014_Msg)) {
w.IsEnd = true; w.IsEnd = true;
Msg.add(w.ActionMsg, w.Data); Msg.add(w.ActionMsg, w.Data);
...@@ -122,7 +148,10 @@ namespace DeviceLibrary ...@@ -122,7 +148,10 @@ namespace DeviceLibrary
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] " + crc.GetString("Res0157", "等待") + "(" + io.DisplayStr + "=" + wait.IoValue + $")" + crc.GetString("Res0158", "超时"); WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] " + crc.GetString("Res0157", "等待") + "(" + io.DisplayStr + "=" + wait.IoValue + $")" + crc.GetString("Res0158", "超时");
Msg.add(WarnMsg, MsgLevel.alarm); Msg.add(WarnMsg, wait.NeedAlarm?MsgLevel.alarm: MsgLevel.warning);
if (wait.NeedAlarm)
RobotManage.UserPause(WarnMsg);
if (NoAlarm()) if (NoAlarm())
{ {
//Alarm(AlarmType.IoSingleTimeOut, WarnMsg); //Alarm(AlarmType.IoSingleTimeOut, WarnMsg);
...@@ -254,8 +283,8 @@ namespace DeviceLibrary ...@@ -254,8 +283,8 @@ namespace DeviceLibrary
IOMove(IoHighType, IO_VALUE.HIGH); IOMove(IoHighType, IO_VALUE.HIGH);
if (moveInfo != null) if (moveInfo != null)
{ {
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoLowType, IO_VALUE.LOW)); moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoLowType, IO_VALUE.LOW, true));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoHighType, IO_VALUE.HIGH)); moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoHighType, IO_VALUE.HIGH, true));
} }
} }
public IO_VALUE IOValue(string ioType) => IOManager.IOValue(ioType, GroupName); public IO_VALUE IOValue(string ioType) => IOManager.IOValue(ioType, GroupName);
......
...@@ -55,7 +55,7 @@ namespace DeviceLibrary ...@@ -55,7 +55,7 @@ namespace DeviceLibrary
}); });
//ProcessMoveinfoEvent?.Invoke(MoveInfo.List); //ProcessMoveinfoEvent?.Invoke(MoveInfo.List);
if (!RobotManage.mainMachine.UserPause) if (!RobotManage.mainMachine.UserPause && RobotManage.mainMachine.mstart)
{ {
DevicesList.ForEach(x => DevicesList.ForEach(x =>
{ {
......
...@@ -42,13 +42,20 @@ namespace DeviceLibrary ...@@ -42,13 +42,20 @@ namespace DeviceLibrary
RobotManage.UserPause("Reset_BTN", false); RobotManage.UserPause("Reset_BTN", false);
} }
} }
bool isfirstrun = true;
void Run_BTN() { void Run_BTN() {
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.HIGH))
{ {
if (!RobotManage.isRunning) if (!RobotManage.isRunning)
Msg.add(crc.GetString("Res0163","检测到自动运行状态,开始启动."), MsgLevel.info, ErrInfo.RunBtn); {
if (isfirstrun)
{
isfirstrun = false;
Msg.add(crc.GetString("Res0163", "检测到自动运行状态,开始启动."), MsgLevel.info, ErrInfo.RunBtn);
}
}
else else
Msg.add( crc.GetString("Res0164","系统正在运行."), MsgLevel.info); Msg.add(crc.GetString("Res0164", "系统正在运行."), MsgLevel.info);
} }
else else
{ {
......
...@@ -138,7 +138,7 @@ namespace DeviceLibrary ...@@ -138,7 +138,7 @@ namespace DeviceLibrary
currnetstoreStatus = isInSuddenDown ? StoreStatus.SuddenStop : StoreStatus.Warning; currnetstoreStatus = isInSuddenDown ? StoreStatus.SuddenStop : StoreStatus.Warning;
} }
//ProcessMoveinfoEvent?.Invoke(MoveInfo.List); //ProcessMoveinfoEvent?.Invoke(MoveInfo.List);
if (!UserPause) if (!UserPause && mstart)
Msg.clear(); Msg.clear();
else else
currnetstoreStatus = StoreStatus.Debugging; currnetstoreStatus = StoreStatus.Debugging;
...@@ -150,6 +150,7 @@ namespace DeviceLibrary ...@@ -150,6 +150,7 @@ namespace DeviceLibrary
LogUtil.info("主线程已退出."); LogUtil.info("主线程已退出.");
} }
public void Start() { public void Start() {
MoveInfo.List.ForEach((m) => { m.EndMove(); });
Run(); Run();
} }
public void Stop() { public void Stop() {
......
...@@ -47,6 +47,7 @@ namespace DeviceLibrary ...@@ -47,6 +47,7 @@ namespace DeviceLibrary
public bool IsInWait { get; set; } public bool IsInWait { get; set; }
MoveStep preMoveStep;
MoveStep moveStep; MoveStep moveStep;
public int CanWhileCount = 0; public int CanWhileCount = 0;
...@@ -66,7 +67,10 @@ namespace DeviceLibrary ...@@ -66,7 +67,10 @@ namespace DeviceLibrary
{ {
get { return moveStep; } get { return moveStep; }
} }
public MoveStep PreMoveStep
{
get { return preMoveStep; }
}
public void NewMove(MoveStep step) public void NewMove(MoveStep step)
{ {
this.MoveParam = new ReelParam(); this.MoveParam = new ReelParam();
...@@ -74,7 +78,7 @@ namespace DeviceLibrary ...@@ -74,7 +78,7 @@ namespace DeviceLibrary
} }
public void NextMoveStep(MoveStep step) public void NextMoveStep(MoveStep step)
{ {
// PreMoveStep = moveStep; preMoveStep = moveStep;
moveStep = step; moveStep = step;
LastSetpTime = DateTime.Now; LastSetpTime = DateTime.Now;
IsInWait = true; IsInWait = true;
...@@ -169,12 +173,13 @@ namespace DeviceLibrary ...@@ -169,12 +173,13 @@ namespace DeviceLibrary
CanWhileMoveCount = 0; CanWhileMoveCount = 0;
} }
public static WaitResultInfo WaitIO(string ioType, IO_VALUE ioValue) public static WaitResultInfo WaitIO(string ioType, IO_VALUE ioValue,bool needAlarm=false)
{ {
WaitResultInfo wait = new WaitResultInfo(); WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W002_IOValue; wait.WaitType = WaitEnum.W002_IOValue;
wait.IoType = ioType; wait.IoType = ioType;
wait.IoValue = ioValue; wait.IoValue = ioValue;
wait.NeedAlarm = needAlarm;
//wait.Devicegroup = devicegroup; //wait.Devicegroup = devicegroup;
return wait; return wait;
} }
...@@ -350,6 +355,7 @@ namespace DeviceLibrary ...@@ -350,6 +355,7 @@ namespace DeviceLibrary
public Func<WaitResultInfo, bool> Action { get; set; } public Func<WaitResultInfo, bool> Action { get; set; }
public string ActionMsg { get; set; } public string ActionMsg { get; set; }
public dynamic Data { get; set; } public dynamic Data { get; set; }
public bool NeedAlarm { get; set; }
} }
internal class WaitEnum internal class WaitEnum
......
...@@ -24,7 +24,7 @@ namespace DeviceLibrary ...@@ -24,7 +24,7 @@ namespace DeviceLibrary
/// <param name="addr"></param> /// <param name="addr"></param>
/// <param name="trayInfo"></param> /// <param name="trayInfo"></param>
/// <returns>是否放行 放行true, 拦截false</returns> /// <returns>是否放行 放行true, 拦截false</returns>
public static bool Process(MoveInfo moveInfo,string rfid, int addr, out TrayInfo trayInfo) { public static bool Process(MoveInfo moveInfo,string rfid, int addr,int reelcheck, out TrayInfo trayInfo) {
lock (Traylist) lock (Traylist)
{ {
moveInfo.log($"处理RFID:{rfid},地址{addr},设备:{(AddrDesc.ContainsKey(addr)? AddrDesc[addr]:"")}"); moveInfo.log($"处理RFID:{rfid},地址{addr},设备:{(AddrDesc.ContainsKey(addr)? AddrDesc[addr]:"")}");
...@@ -37,6 +37,10 @@ namespace DeviceLibrary ...@@ -37,6 +37,10 @@ namespace DeviceLibrary
Traylist[rfid].LastAddr = addr; Traylist[rfid].LastAddr = addr;
Traylist[rfid].Destination = TrayManager.AddrDesc[Traylist[rfid].DestinationAddr]; Traylist[rfid].Destination = TrayManager.AddrDesc[Traylist[rfid].DestinationAddr];
Traylist[rfid].LastPosition = TrayManager.AddrDesc[Traylist[rfid].LastAddr]; Traylist[rfid].LastPosition = TrayManager.AddrDesc[Traylist[rfid].LastAddr];
if (reelcheck == 0)
Traylist[rfid].HasLoadCheck--;
else if (reelcheck == 1)
Traylist[rfid].HasLoadCheck = 1;
trayInfo = Traylist[rfid]; trayInfo = Traylist[rfid];
//Statistics(); //Statistics();
} }
...@@ -61,6 +65,7 @@ namespace DeviceLibrary ...@@ -61,6 +65,7 @@ namespace DeviceLibrary
Traylist[rfid].LoadType = (TrayTypeE)Enum.Parse(typeof(TrayTypeE), requestLoadInfo.TrayType); Traylist[rfid].LoadType = (TrayTypeE)Enum.Parse(typeof(TrayTypeE), requestLoadInfo.TrayType);
Traylist[rfid].TrayParam = requestLoadInfo.LoadParam.clone(); Traylist[rfid].TrayParam = requestLoadInfo.LoadParam.clone();
Traylist[rfid].DestinationAddr = GetAddrByGroupName(requestLoadInfo.DeviceGroupName); Traylist[rfid].DestinationAddr = GetAddrByGroupName(requestLoadInfo.DeviceGroupName);
Traylist[rfid].HasLoadCheck = 1;
LogUtil.info("设置托盘信息:" + Traylist[rfid].LoadType + "," + Traylist[rfid].TrayParam.ToStr() + "," + requestLoadInfo.DeviceGroupName); LogUtil.info("设置托盘信息:" + Traylist[rfid].LoadType + "," + Traylist[rfid].TrayParam.ToStr() + "," + requestLoadInfo.DeviceGroupName);
} }
SaveTrayInfo(); SaveTrayInfo();
...@@ -315,7 +320,7 @@ namespace DeviceLibrary ...@@ -315,7 +320,7 @@ namespace DeviceLibrary
public TrayTypeE TrayType; public TrayTypeE TrayType;
public DateTime LastUpdateTime; public DateTime LastUpdateTime;
public ReelParam TrayParam; public ReelParam TrayParam;
public bool SenSorStatus = false; public int HasLoadCheck = 0;
public DirectionE Direction { get => (Destination ==StoreCID.AMH_ML5_1 || Destination == StoreCID.AMH_ML5_2) ? DirectionE.Out : DirectionE.In; } public DirectionE Direction { get => (Destination ==StoreCID.AMH_ML5_1 || Destination == StoreCID.AMH_ML5_2) ? DirectionE.Out : DirectionE.In; }
public bool isOnline = true; public bool isOnline = true;
public void SetToEmpty() { public void SetToEmpty() {
...@@ -323,7 +328,7 @@ namespace DeviceLibrary ...@@ -323,7 +328,7 @@ namespace DeviceLibrary
LoadType = TrayTypeE.None; LoadType = TrayTypeE.None;
DestinationAddr = -1; DestinationAddr = -1;
TrayParam = new ReelParam(); TrayParam = new ReelParam();
SenSorStatus = false; HasLoadCheck = 0;
} }
} }
......
...@@ -34,7 +34,8 @@ namespace DeviceLibrary ...@@ -34,7 +34,8 @@ namespace DeviceLibrary
public PuYueRFID_C2S RFID_2 = null; public PuYueRFID_C2S RFID_2 = null;
public LineRunMonitor Line; public LineRunMonitor Line;
LS_TypeE LS_Type = LS_TypeE.NoRfid; LS_TypeE LS_Type = LS_TypeE.NoRfid;
public SideMove(DeviceGroup device,out string msg) { public SideMove(DeviceGroup device,out string msg) : base()
{
msg = ""; msg = "";
Name = device.Name+"("+ device.GroupName + ")"; Name = device.Name+"("+ device.GroupName + ")";
DeviceGroup = device; DeviceGroup = device;
...@@ -143,8 +144,7 @@ namespace DeviceLibrary ...@@ -143,8 +144,7 @@ namespace DeviceLibrary
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_02); LSAMoveInfo.NextMoveStep(MoveStep.SideMove_02);
Location_A.ToLow(LSAMoveInfo); Location_A.ToLow(LSAMoveInfo);
//Location_B.ToLow(LSAMoveInfo); //Location_B.ToLow(LSAMoveInfo);
if (!Forcetry)
IOMove(IO_Type.Ls_A_BufStop_Fwd, IO_VALUE.HIGH, StopBufDelayMS);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500)); LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
} }
...@@ -166,6 +166,7 @@ namespace DeviceLibrary ...@@ -166,6 +166,7 @@ namespace DeviceLibrary
} }
if (IOValue(IO_Type.Ls_A_Tray_Check).Equals(IO_VALUE.HIGH)) { if (IOValue(IO_Type.Ls_A_Tray_Check).Equals(IO_VALUE.HIGH)) {
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_04); LSAMoveInfo.NextMoveStep(MoveStep.SideMove_04);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
LastGoInFail = false; LastGoInFail = false;
} }
else if (LSAMoveInfo.IsTimeOut(10)) else if (LSAMoveInfo.IsTimeOut(10))
...@@ -213,6 +214,7 @@ namespace DeviceLibrary ...@@ -213,6 +214,7 @@ namespace DeviceLibrary
Line.LineStop("n"); Line.LineStop("n");
Location_A.ToLow(LSAMoveInfo); Location_A.ToLow(LSAMoveInfo);
Location_B.ToLow(LSAMoveInfo); Location_B.ToLow(LSAMoveInfo);
IOMove(IO_Type.Ls_A_BufStop_Fwd, IO_VALUE.HIGH, StopBufDelayMS);
break; break;
case MoveStep.SideMove_10: case MoveStep.SideMove_10:
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_01); LSAMoveInfo.NextMoveStep(MoveStep.SideMove_01);
...@@ -322,7 +324,7 @@ namespace DeviceLibrary ...@@ -322,7 +324,7 @@ namespace DeviceLibrary
Minfo.NextMoveStep(MoveStep.SideMove_04); Minfo.NextMoveStep(MoveStep.SideMove_04);
Minfo.log($"检测到进入的托盘"); Minfo.log($"检测到进入的托盘");
Minfo.CanWhileCount = 3; Minfo.CanWhileCount = 3;
//Minfo.WaitList.Add(WaitResultInfo.WaitTime(500)); Minfo.WaitList.Add(WaitResultInfo.WaitTime(500));
} }
else if (Minfo.IsTimeOut(10)) else if (Minfo.IsTimeOut(10))
{ {
...@@ -344,13 +346,14 @@ namespace DeviceLibrary ...@@ -344,13 +346,14 @@ namespace DeviceLibrary
Location_a.ToLow(Minfo); Location_a.ToLow(Minfo);
return; return;
} }
Minfo.CanWhileCount = 3;
//Location_a.ToHigh(Minfo); //Location_a.ToHigh(Minfo);
break; break;
case MoveStep.SideMove_05: case MoveStep.SideMove_05:
if (RFID.ReadByte(0x20,16,out byte[] data, out string errmsg)) if (RFID.ReadByte(0x20,16,out byte[] data, out string errmsg))
{ {
var rfid = Common.RfidFilter(data); var rfid = Common.RfidFilter(data);
TrayManager.Process(Minfo,rfid, addr, out TrayInfo trayInfo); TrayManager.Process(Minfo,rfid, addr,-1, out TrayInfo trayInfo);
if (TrayManager.CalcNeedTrans(addr, trayInfo.DestinationAddr, trayInfo.HasLoad)) if (TrayManager.CalcNeedTrans(addr, trayInfo.DestinationAddr, trayInfo.HasLoad))
Minfo.NextMoveStep(MoveStep.SideMove_10); Minfo.NextMoveStep(MoveStep.SideMove_10);
......
...@@ -35,7 +35,8 @@ namespace DeviceLibrary ...@@ -35,7 +35,8 @@ namespace DeviceLibrary
CylinderManger Transplant; CylinderManger Transplant;
public DeviceStateE DeviceState { get ; set ; } public DeviceStateE DeviceState { get ; set ; }
public TransplantMove(DeviceGroup device, Robot_Config config, out string msg) { public TransplantMove(DeviceGroup device, Robot_Config config, out string msg) : base()
{
msg = ""; msg = "";
Name = device.Name+"("+ device.GroupName + ")"; Name = device.Name+"("+ device.GroupName + ")";
Config = config; Config = config;
...@@ -98,17 +99,19 @@ namespace DeviceLibrary ...@@ -98,17 +99,19 @@ namespace DeviceLibrary
} }
else if (IOValue(IO_Type.AMH_Front_Check).Equals(IO_VALUE.HIGH)) else if (IOValue(IO_Type.AMH_Front_Check).Equals(IO_VALUE.HIGH))
{ {
if (GroupName == "AMH-SBSH2" && !canpass()) //SBSH2 等待前面空闲再放行
return;
MoveInfo.NextMoveStep(MoveStep.TransplantMove_01); MoveInfo.NextMoveStep(MoveStep.TransplantMove_01);
Location.ToLow(MoveInfo); Location.ToLow(MoveInfo);
} }
else else
{ {
//Msg.add(crc.GetString("Res0184", "空闲中"), MsgLevel.info); //Msg.add(crc.GetString("Res0184", "空闲中"), MsgLevel.info);
} }
if (TrayManager.TestTrayRequest(GroupName)) { //if (TrayManager.TestTrayRequest(GroupName)) {
Transplant.ToHigh(null); // Transplant.ToHigh(null);
} //}
break; break;
case MoveStep.TransplantMove_01: case MoveStep.TransplantMove_01:
MoveInfo.NextMoveStep(MoveStep.TransplantMove_02); MoveInfo.NextMoveStep(MoveStep.TransplantMove_02);
...@@ -123,7 +126,7 @@ namespace DeviceLibrary ...@@ -123,7 +126,7 @@ namespace DeviceLibrary
{ {
MoveInfo.NextMoveStep(MoveStep.TransplantMove_03); MoveInfo.NextMoveStep(MoveStep.TransplantMove_03);
MoveInfo.CanWhileCount = 3; MoveInfo.CanWhileCount = 3;
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//Location.ToHigh(MoveInfo); //Location.ToHigh(MoveInfo);
} }
else if (MoveInfo.IsTimeOut(10)) { else if (MoveInfo.IsTimeOut(10)) {
...@@ -136,7 +139,7 @@ namespace DeviceLibrary ...@@ -136,7 +139,7 @@ namespace DeviceLibrary
{ {
CurrrentRFID = Common.RfidFilter(data); CurrrentRFID = Common.RfidFilter(data);
MoveInfo.MoveParam.RFID = CurrrentRFID; MoveInfo.MoveParam.RFID = CurrrentRFID;
var through = TrayManager.Process(MoveInfo,CurrrentRFID, DeviceGroup.addr_1, out TrayInfo trayInfo); var through = TrayManager.Process(MoveInfo,CurrrentRFID, DeviceGroup.addr_1, IOValue(IO_Type.AMH_Reel_Check).Equals(IO_VALUE.HIGH)?1:0, out TrayInfo trayInfo);
MoveInfo.log($"rfid:{CurrrentRFID},TrayManager.Process:{trayInfo.DestinationAddr},{DeviceGroup.addr_1},AMH_Reel_Check:{IOValue(IO_Type.AMH_Reel_Check)},HasLoad:{trayInfo.HasLoad}"); MoveInfo.log($"rfid:{CurrrentRFID},TrayManager.Process:{trayInfo.DestinationAddr},{DeviceGroup.addr_1},AMH_Reel_Check:{IOValue(IO_Type.AMH_Reel_Check)},HasLoad:{trayInfo.HasLoad}");
//入库判断 //入库判断
if (trayInfo.DestinationAddr == DeviceGroup.addr_1 && trayInfo.HasLoad) if (trayInfo.DestinationAddr == DeviceGroup.addr_1 && trayInfo.HasLoad)
...@@ -244,7 +247,8 @@ namespace DeviceLibrary ...@@ -244,7 +247,8 @@ namespace DeviceLibrary
{ {
IOMove(IO_Type.AMH_Tray_Stop, IO_VALUE.LOW); IOMove(IO_Type.AMH_Tray_Stop, IO_VALUE.LOW);
MoveInfo.NextMoveStep(MoveStep.Wait); MoveInfo.NextMoveStep(MoveStep.Wait);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500)); if (GroupName == "AMH-SBSH2")
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
MoveInfo.log("托盘已放行"); MoveInfo.log("托盘已放行");
} else if (MoveInfo.IsTimeOut(10)) { } else if (MoveInfo.IsTimeOut(10)) {
MoveInfo.log("托盘放行失败,重新放行"); MoveInfo.log("托盘放行失败,重新放行");
...@@ -328,7 +332,9 @@ namespace DeviceLibrary ...@@ -328,7 +332,9 @@ namespace DeviceLibrary
IOMove(IO_Type.AMH_Tray_Stop, IO_VALUE.LOW); IOMove(IO_Type.AMH_Tray_Stop, IO_VALUE.LOW);
MoveInfo.log("托盘放行结束"); MoveInfo.log("托盘放行结束");
SRec.info(crc.GetString("Res0024","物料横移"), GroupName, crc.GetString("Res0030","空托盘"), crc.GetString("Res0037","物料已取走")); SRec.info(crc.GetString("Res0024","物料横移"), GroupName, crc.GetString("Res0030","空托盘"), crc.GetString("Res0037","物料已取走"));
MoveInfo.NewMove(MoveStep.Wait); MoveInfo.NewMove(MoveStep.Wait);
if (GroupName == "AMH-SBSH2")
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
break; break;
//从料仓=>线体 //从料仓=>线体
case MoveStep.TransplantMove_20: case MoveStep.TransplantMove_20:
...@@ -442,7 +448,9 @@ namespace DeviceLibrary ...@@ -442,7 +448,9 @@ namespace DeviceLibrary
case MoveStep.TransplantMove_30: case MoveStep.TransplantMove_30:
MoveInfo.NextMoveStep(MoveStep.TransplantMove_31); MoveInfo.NextMoveStep(MoveStep.TransplantMove_31);
IOMove(IO_Type.AMH_Tray_Stop, IO_VALUE.LOW); IOMove(IO_Type.AMH_Tray_Stop, IO_VALUE.LOW);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.NewMove(MoveStep.Wait);
if (GroupName == "AMH-SBSH2")
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
break; break;
case MoveStep.TransplantMove_31: case MoveStep.TransplantMove_31:
SRec.error(crc.GetString("Res0024","物料横移"), GroupName, crc.GetString("Res0025","载物托盘"), crc.GetString("Res0038","物料已到托盘"), CurrrentRFID, MoveInfo.MoveParam.ToStr()); SRec.error(crc.GetString("Res0024","物料横移"), GroupName, crc.GetString("Res0025","载物托盘"), crc.GetString("Res0038","物料已到托盘"), CurrrentRFID, MoveInfo.MoveParam.ToStr());
...@@ -530,7 +538,7 @@ namespace DeviceLibrary ...@@ -530,7 +538,7 @@ namespace DeviceLibrary
{ {
if (string.IsNullOrEmpty(CurrrentRFID)) if (string.IsNullOrEmpty(CurrrentRFID))
CurrrentRFID = ConfigHelper.Config.Get($"Runtime_{GroupName}_CurrrentRFID"); CurrrentRFID = ConfigHelper.Config.Get($"Runtime_{GroupName}_CurrrentRFID");
TrayManager.Process(MoveInfo, CurrrentRFID, DeviceGroup.addr_1, out _); TrayManager.Process(MoveInfo, CurrrentRFID, DeviceGroup.addr_1,-1, out _);
MoveInfo.log("检测到上次已打开吸盘,CurrrentRFID:"+ CurrrentRFID); MoveInfo.log("检测到上次已打开吸盘,CurrrentRFID:"+ CurrrentRFID);
//入库过程 //入库过程
if (ConfigHelper.Config.Get($"Runtime_{GroupName}_IsInStore", false) && IOValue(IO_Type.AMH_Reel_Check).Equals(IO_VALUE.LOW)) if (ConfigHelper.Config.Get($"Runtime_{GroupName}_IsInStore", false) && IOValue(IO_Type.AMH_Reel_Check).Equals(IO_VALUE.LOW))
...@@ -576,7 +584,7 @@ namespace DeviceLibrary ...@@ -576,7 +584,7 @@ namespace DeviceLibrary
{ {
if (IOManager.IOValue(IO_Type.Ls_B_Front_Check, "LS2").Equals(IO_VALUE.HIGH)) if (IOManager.IOValue(IO_Type.Ls_B_Front_Check, "LS2").Equals(IO_VALUE.HIGH))
{ {
Msg.add(crc.GetString("Res0039","LS2-2 堵塞中,暂缓放行"), MsgLevel.warning); Msg.add(crc.GetString("Res0039","LS2-2 堵塞中,暂缓放行"), MsgLevel.info);
return false; return false;
} }
} }
...@@ -584,7 +592,7 @@ namespace DeviceLibrary ...@@ -584,7 +592,7 @@ namespace DeviceLibrary
{ {
if (IOManager.IOValue(IO_Type.Ls_A_Front_Check, "LS2").Equals(IO_VALUE.HIGH)) if (IOManager.IOValue(IO_Type.Ls_A_Front_Check, "LS2").Equals(IO_VALUE.HIGH))
{ {
Msg.add(crc.GetString("Res0040","LS2-1 堵塞中,暂缓放行"), MsgLevel.warning); Msg.add(crc.GetString("Res0040","LS2-1 堵塞中,暂缓放行"), MsgLevel.info);
return false; return false;
} }
} }
......
...@@ -34,9 +34,10 @@ namespace DeviceLibrary ...@@ -34,9 +34,10 @@ namespace DeviceLibrary
public AxisBean axis; public AxisBean axis;
public AxisBean axis2; public AxisBean axis2;
public TrayStop(DeviceGroup device,out string msg) { public TrayStop(DeviceGroup device, out string msg) : base()
{
msg = ""; msg = "";
Name = device.Name+"("+ device.GroupName + ")"; Name = device.Name + "(" + device.GroupName + ")";
DeviceGroup = device; DeviceGroup = device;
GroupName = DeviceGroup.GroupName; GroupName = DeviceGroup.GroupName;
Msg = new MsgService(GroupName); Msg = new MsgService(GroupName);
...@@ -44,15 +45,16 @@ namespace DeviceLibrary ...@@ -44,15 +45,16 @@ namespace DeviceLibrary
if (!string.IsNullOrEmpty(DeviceGroup.RFID_1)) if (!string.IsNullOrEmpty(DeviceGroup.RFID_1))
{ {
RFID_1 = new PuYueRFID_C2S(DeviceGroup.RFID_1); RFID_1 = new PuYueRFID_C2S(DeviceGroup.RFID_1);
if (!RFID_1.Open()) { if (!RFID_1.Open())
msg += DeviceGroup.GroupName + " RFID 1:" + DeviceGroup.RFID_1 +","+crc.GetString("Res0183","打开失败")+ "\r\n"; {
msg += DeviceGroup.GroupName + " RFID 1:" + DeviceGroup.RFID_1 + "," + crc.GetString("Res0183", "打开失败") + "\r\n";
} }
} }
Location = new CylinderManger($"托盘顶升", GroupName, IO_Type.MI_Location_Up, IO_Type.MI_Location_Down); Location = new CylinderManger($"托盘顶升", GroupName, IO_Type.MI_Location_Up, IO_Type.MI_Location_Down);
var axisc = RobotManage.Config.moveAxisList.Find(ma => ma.GetAxisValue() == RobotManage.DeviceGroup[GroupName].AxisID); var axisc = RobotManage.Config.moveAxisList.Find(ma => ma.GetAxisValue() == RobotManage.DeviceGroup[GroupName].AxisID);
if (axisc != null) if (axisc != null)
axis = new AxisBean(axisc, GroupName); axis = new AxisBean(axisc, GroupName);
axisc = RobotManage.Config.moveAxisList.Find(ma => ma.GetAxisValue() == RobotManage.DeviceGroup[GroupName].Axis2ID); axisc = RobotManage.Config.moveAxisList.Find(ma => ma.GetAxisValue() == RobotManage.DeviceGroup[GroupName].Axis2ID);
if (axisc != null) if (axisc != null)
axis2 = new AxisBean(axisc, GroupName); axis2 = new AxisBean(axisc, GroupName);
...@@ -80,7 +82,6 @@ namespace DeviceLibrary ...@@ -80,7 +82,6 @@ namespace DeviceLibrary
OneWayProcess(); OneWayProcess();
} }
} }
int isalivetrytimes = 0;
int StopBufDelayMS = 500; int StopBufDelayMS = 500;
int StopDelayMS = 1500; int StopDelayMS = 1500;
public void OneWayProcess() public void OneWayProcess()
...@@ -142,7 +143,7 @@ namespace DeviceLibrary ...@@ -142,7 +143,7 @@ namespace DeviceLibrary
if (RFID_1.ReadByte(0x20, 16, out byte[] data, out string errmsg)) if (RFID_1.ReadByte(0x20, 16, out byte[] data, out string errmsg))
{ {
CurrrentRFID = Common.RfidFilter(data); CurrrentRFID = Common.RfidFilter(data);
TrayManager.Process(MoveInfo, CurrrentRFID, DeviceGroup.addr_1, 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 张东亮处理
...@@ -332,7 +333,7 @@ namespace DeviceLibrary ...@@ -332,7 +333,7 @@ namespace DeviceLibrary
case MoveStep.TrayStop_07: case MoveStep.TrayStop_07:
MoveInfo.NextMoveStep(MoveStep.TrayStop_WaitLoadProcess); MoveInfo.NextMoveStep(MoveStep.TrayStop_WaitLoadProcess);
Location.ToHigh(MoveInfo); Location.ToHigh(MoveInfo);
isalivetrytimes = 0; MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
break; break;
case MoveStep.TrayStop_WaitLoadProcess: case MoveStep.TrayStop_WaitLoadProcess:
Msg.add(crc.GetString("Res0046","等待处理物料"),MsgLevel.info); Msg.add(crc.GetString("Res0046","等待处理物料"),MsgLevel.info);
...@@ -360,9 +361,17 @@ namespace DeviceLibrary ...@@ -360,9 +361,17 @@ namespace DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitMsg(crc.GetString("Res0046","等待处理物料"), MsgLevel.info)); MoveInfo.WaitList.Add(WaitResultInfo.WaitMsg(crc.GetString("Res0046","等待处理物料"), MsgLevel.info));
} }
} }
break; break;
case MoveStep.TrayStop_LoadProcessed: case MoveStep.TrayStop_LoadProcessed:
if (TrayManager.Traylist.ContainsKey(CurrrentRFID) && TrayManager.Traylist[CurrrentRFID].HasLoad)
{
if (IOValue(IO_Type.MI_Reel_Check).Equals(IO_VALUE.LOW))
{
Msg.add("托盘放料后没有检测到物料", MsgLevel.alarm);
return;
}
}
MoveInfo.NextMoveStep(MoveStep.TrayStop_04); MoveInfo.NextMoveStep(MoveStep.TrayStop_04);
Location.ToLow(MoveInfo); Location.ToLow(MoveInfo);
MoveInfo.log("物料离开, 顶升下降"); MoveInfo.log("物料离开, 顶升下降");
...@@ -428,15 +437,32 @@ namespace DeviceLibrary ...@@ -428,15 +437,32 @@ namespace DeviceLibrary
switch (MoveInfo.MoveStep) switch (MoveInfo.MoveStep)
{ {
case MoveStep.Wait: case MoveStep.Wait:
if ((GroupName == "AMH-ML5-1" || GroupName == "AMH-ML5-2") && RobotManage.mainMachine.IOValue(IO_Type.ML5_DoorSafeCheck).Equals(IO_VALUE.LOW))
{
Msg.add(crc.GetString("Res0041","ML5料口门光栅被遮挡"), MsgLevel.warning);
break;
}
MoveInfo.NextMoveStep(MoveStep.H01_HomeReset); MoveInfo.NextMoveStep(MoveStep.H01_HomeReset);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
break; break;
case MoveStep.H01_HomeReset: case MoveStep.H01_HomeReset:
if ((GroupName == "AMH-ML5-1" || GroupName == "AMH-ML5-2") && RobotManage.mainMachine.IOValue(IO_Type.ML5_DoorSafeCheck).Equals(IO_VALUE.LOW))
{
Msg.add(crc.GetString("Res0041", "ML5料口门光栅被遮挡"), MsgLevel.warning);
break;
}
var dl = new string[] { "AMH-MI1" };//, "AMH-MI2" };
foreach (var d in dl)
{
if (GroupName == d && MI.DeviceList[d].DeviceState != DeviceStateE.Run
&& MI.DeviceList[d].MoveInfo.MoveStep != MoveStep.Wait)
{
Msg.add("等待" + d + "完成复位", MsgLevel.warning);
}
else if (GroupName == d && MI.DeviceList[d].DeviceState == DeviceStateE.Run
&& MI.DeviceList[d].MoveInfo.MoveStep != MoveStep.Wait)
{
MoveInfo.NextMoveStep(MoveStep.TrayStop_WaitLoadProcess);
DeviceState = DeviceStateE.Run;
return;
}
}
MoveInfo.NextMoveStep(MoveStep.H02_HomeReset); MoveInfo.NextMoveStep(MoveStep.H02_HomeReset);
Location.ToLow(MoveInfo); Location.ToLow(MoveInfo);
break; break;
......
...@@ -33,50 +33,30 @@ namespace RemoteSheardObject ...@@ -33,50 +33,30 @@ namespace RemoteSheardObject
return !string.IsNullOrEmpty(SubmitPostData("/service/store/robotBox/updateLocInfo", postData)); return !string.IsNullOrEmpty(SubmitPostData("/service/store/robotBox/updateLocInfo", postData));
} }
public static string SubmitPostData(string url, Dictionary<string, string> postData) public static Dictionary<string,int> GetTaskCount()
{ {
url = CombineUrl(Config.Get("Device_Server_Address"), url); //pizzaBox,pcb,tray,reel
//创建WebClient对象 var postData = new Dictionary<string, string>()
using (var client = new WebClient())
{ {
//设置提交数据的方式为"application/x-www-form-urlencoded" };
client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; Dictionary<string, int> taskdata = new Dictionary<string, int>();
taskdata["pizzaBox"] = 0;
try taskdata["pcb"] = 0;
{ taskdata["tray"] = 0;
//将POST请求参数字典转换为参数字符串 taskdata["reel"] = 0;
var postDataString = new StringBuilder();
foreach (var item in postData)
{
if (!string.IsNullOrEmpty(item.Value))
{
postDataString.AppendFormat("{0}={1}&", item.Key, Uri.EscapeDataString(item.Value));
}
}
//去掉最后一个"&"符号
postDataString.Length--;
//将POST请求参数转换为字节数组
byte[] bytes = Encoding.UTF8.GetBytes(postDataString.ToString());
//提交POST请求并获取响应
byte[] response = client.UploadData(url, "POST", bytes);
//将响应转换为字符串并输出 var result= JsonConvert.DeserializeObject<ResultData>(SubmitPostData("/rest/micron/device/getTaskCount", postData));
return Encoding.UTF8.GetString(response); if (result.code != 0)
return taskdata;
} foreach (var k in taskdata.Keys)
catch (Exception ex) {
{ if (result.data.ContainsKey(k))
// 捕获任何网络异常,并输出错误信息 taskdata[k] = int.Parse(result.data[k]);
Console.WriteLine("提交POST请求时发生错误:" + ex.Message);
// 请求失败,返回false
return "";
}
} }
return taskdata;
} }
public static string CombineUrl(string baseUrl, string relativeUrl) public static string CombineUrl(string baseUrl, string relativeUrl)
{ {
if (string.IsNullOrEmpty(baseUrl)) if (string.IsNullOrEmpty(baseUrl))
...@@ -112,6 +92,12 @@ namespace RemoteSheardObject ...@@ -112,6 +92,12 @@ namespace RemoteSheardObject
return default; return default;
} }
public static void UploadStatus(EquipMsgData equipMsgData)
{
string url = CombineUrl(Config.Get("Device_Server_Address"), "/rest/micron/device/updateStatus");
var resultStr = HttpHelper.Post<EquipMsgData, ResultData>(url, equipMsgData);
}
public class ResultData public class ResultData
{ {
//{"code":0,"msg":"ok","data":"7"} //{"code":0,"msg":"ok","data":"7"}
...@@ -121,5 +107,49 @@ namespace RemoteSheardObject ...@@ -121,5 +107,49 @@ namespace RemoteSheardObject
public Dictionary<string, string> data { get; set; } public Dictionary<string, string> data { get; set; }
} }
public static string SubmitPostData(string url, Dictionary<string, string> postData)
{
url = CombineUrl(Config.Get("Device_Server_Address"), url);
//创建WebClient对象
using (var client = new WebClient())
{
//设置提交数据的方式为"application/x-www-form-urlencoded"
client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
try
{
//将POST请求参数字典转换为参数字符串
var postDataString = new StringBuilder();
foreach (var item in postData)
{
if (!string.IsNullOrEmpty(item.Value))
{
postDataString.AppendFormat("{0}={1}&", item.Key, Uri.EscapeDataString(item.Value));
}
}
//去掉最后一个"&"符号
postDataString.Length--;
//将POST请求参数转换为字节数组
byte[] bytes = Encoding.UTF8.GetBytes(postDataString.ToString());
//提交POST请求并获取响应
byte[] response = client.UploadData(url, "POST", bytes);
//将响应转换为字符串并输出
return Encoding.UTF8.GetString(response);
}
catch (Exception ex)
{
// 捕获任何网络异常,并输出错误信息
Console.WriteLine("提交POST请求时发生错误:" + ex.Message);
// 请求失败,返回false
return "";
}
}
}
} }
} }
...@@ -367,6 +367,7 @@ namespace TheMachine ...@@ -367,6 +367,7 @@ namespace TheMachine
// RobotManage.mainMachine.Msg.Show(); // RobotManage.mainMachine.Msg.Show();
// //return; // //return;
//} //}
LogUtil.info("用户按下启动:"+ sender.ToString());
RobotManage.Start(); RobotManage.Start();
userpause = false; userpause = false;
if (RobotManage.isRunning) if (RobotManage.isRunning)
...@@ -375,7 +376,7 @@ namespace TheMachine ...@@ -375,7 +376,7 @@ namespace TheMachine
RobotManage_UserPauseSet(this, false); RobotManage_UserPauseSet(this, false);
//(sender as Button).Text = "暂停运行"; //(sender as Button).Text = "暂停运行";
} }
LogUtil.info("用户按下启动");
} }
else if (!userpause) else if (!userpause)
{ {
......
...@@ -46,7 +46,7 @@ namespace TheMachine ...@@ -46,7 +46,7 @@ namespace TheMachine
} }
} }
} }
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true).SetValue(Application.ProductName, Application.ExecutablePath); Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true).SetValue(Application.ProductName, Application.ExecutablePath);
Config.LoadMyConfig(new Setting_Init().GetType()); Config.LoadMyConfig(new Setting_Init().GetType());
Application.ThreadException += Application_ThreadException; Application.ThreadException += Application_ThreadException;
......
...@@ -145,6 +145,9 @@ namespace TheMachine ...@@ -145,6 +145,9 @@ namespace TheMachine
listView1.Items[ti.RFID].ForeColor = Color.DarkGray; listView1.Items[ti.RFID].ForeColor = Color.DarkGray;
else else
listView1.Items[ti.RFID].ForeColor = Color.Black; listView1.Items[ti.RFID].ForeColor = Color.Black;
if (ti.HasLoad && ti.HasLoadCheck<0)
listView1.Items[ti.RFID].ForeColor = Color.Red;
} }
ListView2.Items.Clear(); ListView2.Items.Clear();
foreach (var tivk in TrayManager.TrayRequest.ToArray()) foreach (var tivk in TrayManager.TrayRequest.ToArray())
......
...@@ -80,5 +80,16 @@ namespace TheMachine.device.Other ...@@ -80,5 +80,16 @@ namespace TheMachine.device.Other
stateView.Items.Add(lvi); stateView.Items.Add(lvi);
} }
} }
private void btn_ResetRobot_Click(object sender, EventArgs e)
{
if (RobotManage.isRunning)
{
MessageBox.Show("请先停止系统运行");
return;
}
MI.DeviceList["AMH-MI1"].
}
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!