Commit 63494615 刘韬

1

1 个父辈 f8d997d6
...@@ -102,7 +102,7 @@ namespace DeviceLibrary ...@@ -102,7 +102,7 @@ namespace DeviceLibrary
return; return;
} }
Config.TargetPosition = 0; Config.TargetPosition = 0;
LogUtil.info(AxisName + "speed[" + Config.HomeHighSpeed + "]开始原点返回"); MoveInfo.log(AxisName + "speed[" + Config.HomeHighSpeed + "]开始原点返回");
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(Config, true)); MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(Config, true));
var HomeLowSpeed = Config.HomeLowSpeed > 0 ? Config.HomeLowSpeed : Config.HomeHighSpeed / 10; var HomeLowSpeed = Config.HomeLowSpeed > 0 ? Config.HomeLowSpeed : Config.HomeHighSpeed / 10;
var HomeAddSpeed = Config.HomeAddSpeed > 0 ? Config.HomeAddSpeed : Config.HomeHighSpeed * 5; var HomeAddSpeed = Config.HomeAddSpeed > 0 ? Config.HomeAddSpeed : Config.HomeHighSpeed * 5;
...@@ -188,7 +188,7 @@ namespace DeviceLibrary ...@@ -188,7 +188,7 @@ namespace DeviceLibrary
AxisManager.SuddenStop(axis.DeviceName, axis.GetAxisValue()); AxisManager.SuddenStop(axis.DeviceName, axis.GetAxisValue());
Thread.Sleep(100); Thread.Sleep(100);
} }
LogUtil.error($"{ MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr}目标位置{targetPosition}当前位置{outCount},误差过大,{clearMsg}重新开始运动,剩余{MoveInfo.CanWhileCount}次"); MoveInfo.error($"{ MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr}目标位置{targetPosition}当前位置{outCount},误差过大,{clearMsg}重新开始运动,剩余{MoveInfo.CanWhileCount}次");
var AddSpeed = axis.AddSpeed > 0 ? axis.AddSpeed : targetSpeed * 4; var AddSpeed = axis.AddSpeed > 0 ? axis.AddSpeed : targetSpeed * 4;
var DelSpeed = axis.DelSpeed > 0 ? axis.DelSpeed : targetSpeed * 4; var DelSpeed = axis.DelSpeed > 0 ? axis.DelSpeed : targetSpeed * 4;
AxisManager.AbsMove(axis.DeviceName, axis.GetAxisValue(), targetPosition, targetSpeed, AddSpeed, DelSpeed);// , axis.AddSpeed, axis.DelSpeed); AxisManager.AbsMove(axis.DeviceName, axis.GetAxisValue(), targetPosition, targetSpeed, AddSpeed, DelSpeed);// , axis.AddSpeed, axis.DelSpeed);
...@@ -198,7 +198,7 @@ namespace DeviceLibrary ...@@ -198,7 +198,7 @@ namespace DeviceLibrary
else else
{ {
msg = $"{MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr},目标位置{targetPosition},当前位置{outCount},误差过大,需要报警"; msg = $"{MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr},目标位置{targetPosition},当前位置{outCount},误差过大,需要报警";
LogUtil.error(msg, 600); MoveInfo.error(msg);
} }
} }
return false; return false;
...@@ -218,7 +218,7 @@ namespace DeviceLibrary ...@@ -218,7 +218,7 @@ namespace DeviceLibrary
//判断是否需要重新运动 //判断是否需要重新运动
if (MoveInfo.CanWhileCount > 0) if (MoveInfo.CanWhileCount > 0)
{ {
LogUtil.error(MoveInfo.Name + axis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],重新回原点,剩余[" + MoveInfo.CanWhileCount + "]次"); MoveInfo.error(MoveInfo.Name + axis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],重新回原点,剩余[" + MoveInfo.CanWhileCount + "]次");
//LogUtil.error( StoreName + moveAxis.DisplayStr + "重新回原点"); //LogUtil.error( StoreName + moveAxis.DisplayStr + "重新回原点");
AxisManager.HomeMove(axis.DeviceName, axis.GetAxisValue(), axis.HomeHighSpeed, axis.HomeLowSpeed, axis.HomeAddSpeed); AxisManager.HomeMove(axis.DeviceName, axis.GetAxisValue(), axis.HomeHighSpeed, axis.HomeLowSpeed, axis.HomeAddSpeed);
MoveInfo.CanWhileCount--; MoveInfo.CanWhileCount--;
...@@ -226,7 +226,7 @@ namespace DeviceLibrary ...@@ -226,7 +226,7 @@ namespace DeviceLibrary
else else
{ {
msg = MoveInfo.Name + " " + MoveInfo.MoveStep + axis.DisplayStr + ",收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警"; msg = MoveInfo.Name + " " + MoveInfo.MoveStep + axis.DisplayStr + ",收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
LogUtil.error(msg); MoveInfo.error(msg);
} }
} }
return false; return false;
......
...@@ -30,7 +30,10 @@ namespace DeviceLibrary ...@@ -30,7 +30,10 @@ namespace DeviceLibrary
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(High, IO_VALUE.HIGH)); moveInfo.WaitList.Add(WaitResultInfo.WaitIO(High, IO_VALUE.HIGH));
} }
Resume(false); Resume(false);
LogUtil.info($"{Name},设置{High}=High"); if (moveInfo!=null)
moveInfo.log($"{Name},设置{High}=High");
else
LogUtil.info($"{Name},设置{High}=High");
} }
public void ToLow(MoveInfo moveInfo) public void ToLow(MoveInfo moveInfo)
{ {
...@@ -41,7 +44,10 @@ namespace DeviceLibrary ...@@ -41,7 +44,10 @@ namespace DeviceLibrary
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(High, IO_VALUE.LOW)); moveInfo.WaitList.Add(WaitResultInfo.WaitIO(High, IO_VALUE.LOW));
} }
Resume(false); Resume(false);
LogUtil.info($"{Name},设置{High}=Low"); if (moveInfo != null)
moveInfo.log($"{Name},设置{High}=Low");
else
LogUtil.info($"{Name},设置{High}=Low");
} }
public void Pause() public void Pause()
......
...@@ -30,7 +30,7 @@ namespace DeviceLibrary ...@@ -30,7 +30,7 @@ namespace DeviceLibrary
} }
else else
{ {
LogUtil.error("没有DO="+ device + ":" + ioType); LogUtil.error($"[{device}] not find DO="+ device + ":" + ioType);
} }
} }
...@@ -50,7 +50,7 @@ namespace DeviceLibrary ...@@ -50,7 +50,7 @@ namespace DeviceLibrary
} }
else else
{ {
LogUtil.error("没有DO="+ device + ":" + ioType); LogUtil.error($"[{device}] not find IO="+ device + ":" + ioType);
} }
return ioValue; return ioValue;
} }
...@@ -64,7 +64,7 @@ namespace DeviceLibrary ...@@ -64,7 +64,7 @@ namespace DeviceLibrary
} }
else else
{ {
LogUtil.error("没有DO=" + ioType); LogUtil.error($"[{device}] not find DO=" + ioType);
} }
return ioValue; return ioValue;
} }
......
...@@ -115,7 +115,7 @@ namespace DeviceLibrary ...@@ -115,7 +115,7 @@ namespace DeviceLibrary
if (NoAlarm()) if (NoAlarm())
{ {
//Alarm(AlarmType.IoSingleTimeOut, WarnMsg); //Alarm(AlarmType.IoSingleTimeOut, WarnMsg);
LogUtil.error(WarnMsg, logType + 14); MoveInfo.error(WarnMsg);
//MoveInfo.errlog(WarnMsg); //MoveInfo.errlog(WarnMsg);
if (!MoveInfo.OneWaitCanEndStep) if (!MoveInfo.OneWaitCanEndStep)
{ {
...@@ -133,7 +133,7 @@ namespace DeviceLibrary ...@@ -133,7 +133,7 @@ namespace DeviceLibrary
else if (wait.WaitType.Equals(WaitEnum.W013_Action)) else if (wait.WaitType.Equals(WaitEnum.W013_Action))
{ {
wait.IsEnd = wait.Action.Invoke(wait); wait.IsEnd = wait.Action.Invoke(wait);
LogUtil.info($"{Name} 自定义等待 IsEnd={wait.IsEnd},Type={wait.Action.GetType()}"); MoveInfo.log($"{Name} 自定义等待 IsEnd={wait.IsEnd},Type={wait.Action.GetType()}");
} }
...@@ -172,7 +172,7 @@ namespace DeviceLibrary ...@@ -172,7 +172,7 @@ namespace DeviceLibrary
{ {
second = 10; second = 10;
} }
LogUtil.error(WarnMsg, logType + 100, second); MoveInfo.error(WarnMsg);
//MoveInfo.errlog(WarnMsg); //MoveInfo.errlog(WarnMsg);
//Alarm(AlarmType.IoSingleTimeOut, WarnMsg); //Alarm(AlarmType.IoSingleTimeOut, WarnMsg);
Msg.add(WarnMsg, MsgLevel.alarm); Msg.add(WarnMsg, MsgLevel.alarm);
...@@ -262,7 +262,7 @@ namespace DeviceLibrary ...@@ -262,7 +262,7 @@ namespace DeviceLibrary
Thread.Sleep(msTime); Thread.Sleep(msTime);
IO_VALUE tValue = value.Equals(IO_VALUE.HIGH) ? IO_VALUE.LOW : IO_VALUE.HIGH; IO_VALUE tValue = value.Equals(IO_VALUE.HIGH) ? IO_VALUE.LOW : IO_VALUE.HIGH;
LogUtil.info(Name + "定时回写IO: [" + IoType + "]=[" + value + "],msTime=" + msTime); //LogUtil.info("[" + GroupName + "]定时回写IO: [" + IoType + "]=[" + value + "],msTime=" + msTime);
IOManager.IOMove(IoType, tValue, GroupName); IOManager.IOMove(IoType, tValue, GroupName);
}); });
......
...@@ -260,13 +260,6 @@ namespace DeviceLibrary ...@@ -260,13 +260,6 @@ namespace DeviceLibrary
{ {
Msg.add(crc.GetString(y.Config.ProName, y.Config.Explain) + $"[{y.Config.GetAxisValue()}]:" + crc.GetString("Res0179", "运动报警"), MsgLevel.alarm, ErrInfo.SuddenStop); Msg.add(crc.GetString(y.Config.ProName, y.Config.Explain) + $"[{y.Config.GetAxisValue()}]:" + crc.GetString("Res0179", "运动报警"), MsgLevel.alarm, ErrInfo.SuddenStop);
ok = false; ok = false;
var errcode = HuichuanLibrary.HCBoardManager.GetAxErrCode(y.Config.GetAxisValue());
var errcodebyte = BitConverter.GetBytes(errcode).ToList();
errcodebyte.Reverse();
HuichuanLibrary.HCBoardManager.GetSdo((ushort)y.Config.GetAxisValue(), 0x203f, 0, out byte[] data, out uint datalen);
var errdatabyte = data.ToList();
errdatabyte.Reverse();
LogUtil.error(y.Config.GetAxisValue() + "," + y.Config.Explain + " errcode " + BitConverter.ToString(errcodebyte.ToArray()) + "," + BitConverter.ToString(errdatabyte.ToArray()));
LogUtil.error(string.Join(",",HuichuanLibrary.HCBoardManager.GetAxisErrorDetail(y.Config.GetAxisValue()))); LogUtil.error(string.Join(",",HuichuanLibrary.HCBoardManager.GetAxisErrorDetail(y.Config.GetAxisValue())));
} }
......
...@@ -120,6 +120,15 @@ namespace DeviceLibrary ...@@ -120,6 +120,15 @@ namespace DeviceLibrary
LogUtil.info(msg); LogUtil.info(msg);
} }
} }
public void error(string msg) {
msg = $"[{Name}][{moveStep}][{MoveParam.PosID}-{MoveParam.WareCode}]{msg}";
if (String.Compare(lastmsg,msg, StringComparison.Ordinal)!=0)
{
lastmsg = msg;
LogUtil.error(msg);
}
}
string lasterrmsg = ""; string lasterrmsg = "";
private object p; private object p;
......
...@@ -66,6 +66,9 @@ namespace DeviceLibrary ...@@ -66,6 +66,9 @@ namespace DeviceLibrary
case "TrayRelease": case "TrayRelease":
TrayManager.TrayRelease(remoteLoad); TrayManager.TrayRelease(remoteLoad);
break; break;
case "IsFree":
isok = TrayManager.IsFree(remoteLoad);
break;
case "OK": case "OK":
case "FAIL": case "FAIL":
lastresult = remoteLoad.Action == "OK" ? RemoteResult.True : RemoteResult.False; lastresult = remoteLoad.Action == "OK" ? RemoteResult.True : RemoteResult.False;
...@@ -101,7 +104,8 @@ namespace DeviceLibrary ...@@ -101,7 +104,8 @@ namespace DeviceLibrary
remoteLoad.GroupName = GroupName; remoteLoad.GroupName = GroupName;
if (remoteLoad.RequestLoadInfo != null && string.IsNullOrEmpty(remoteLoad.RequestLoadInfo.DeviceGroupName)) if (remoteLoad.RequestLoadInfo != null && string.IsNullOrEmpty(remoteLoad.RequestLoadInfo.DeviceGroupName))
remoteLoad.RequestLoadInfo.DeviceGroupName = GroupName; remoteLoad.RequestLoadInfo.DeviceGroupName = GroupName;
LogUtil.info($"{GroupName},发送:{remoteLoad.Action}"); LogUtil.info($"{GroupName},发送:{remoteLoad.Action},Seq:{remoteLoad.Seq}");
lastresult = RemoteResult.None;
SendMessage(GroupName, remoteLoad); SendMessage(GroupName, remoteLoad);
return WaitResult(waittime); return WaitResult(waittime);
} }
......
...@@ -90,19 +90,27 @@ namespace DeviceLibrary ...@@ -90,19 +90,27 @@ namespace DeviceLibrary
var d1 = new DeviceRunControl("SideMove", SideMove.DeviceList.Values.ToList<IDevice>()); var d1 = new DeviceRunControl("SideMove", SideMove.DeviceList.Values.ToList<IDevice>());
var d2 = new DeviceRunControl("TransplantMove", TransplantMove.DeviceList.Values.ToList<IDevice>()); var d2 = new DeviceRunControl("TransplantMove", TransplantMove.DeviceList.Values.ToList<IDevice>());
var d3 = new DeviceRunControl("TrayStop", TrayStop.DeviceList.Values.ToList<IDevice>()); var d3 = new DeviceRunControl("TrayStop", TrayStop.DeviceList.Values.ToList<IDevice>());
d1.Start();
d2.Start();
d3.Start();
isRunning = true; isRunning = true;
GC.KeepAlive(mainThread); GC.KeepAlive(mainThread);
Task.Run(()=> { //Task.Run(()=> {
AxisBean.List.ToList().ForEach((x) => { x.Value.ForEach(y => { AxisManager.AlarmClear(y.Config.DeviceName, y.Config.GetAxisValue()); }); }); AxisBean.List.ToList().ForEach((x) => { x.Value.ForEach(y => { AxisManager.AlarmClear(y.Config.DeviceName, y.Config.GetAxisValue()); }); });
Task.Delay(1000).Wait(); Task.Delay(100).Wait();
if (mainMachine.DeviceCheck()) if (mainMachine.DeviceCheck())
{
mainMachine.BeginHomeReset(true); mainMachine.BeginHomeReset(true);
});
}
//}).Wait();
d1.Start();
d2.Start();
d3.Start();
} }
public static void Stop() public static void Stop()
......
using Newtonsoft.Json;
using OnlineStore; using OnlineStore;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -12,6 +15,7 @@ namespace DeviceLibrary ...@@ -12,6 +15,7 @@ namespace DeviceLibrary
public static partial class TrayManager public static partial class TrayManager
{ {
public static Dictionary<string,TrayInfo> Traylist = new Dictionary<string,TrayInfo>(); public static Dictionary<string,TrayInfo> Traylist = new Dictionary<string,TrayInfo>();
/// <summary> /// <summary>
/// 处理更新托盘信息 /// 处理更新托盘信息
/// </summary> /// </summary>
...@@ -19,10 +23,10 @@ namespace DeviceLibrary ...@@ -19,10 +23,10 @@ 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(string rfid, int addr, out TrayInfo trayInfo) { public static bool Process(MoveInfo moveInfo,string rfid, int addr, out TrayInfo trayInfo) {
lock (Traylist) lock (Traylist)
{ {
LogUtil.info($"处理RFID:{rfid},地址{addr},设备:{(AddrDesc.ContainsKey(addr)? AddrDesc[addr]:"")}"); moveInfo.log($"处理RFID:{rfid},地址{addr},设备:{(AddrDesc.ContainsKey(addr)? AddrDesc[addr]:"")}");
if (!Traylist.ContainsKey(rfid)) if (!Traylist.ContainsKey(rfid))
{ {
Traylist.Add(rfid, new TrayInfo()); Traylist.Add(rfid, new TrayInfo());
...@@ -37,6 +41,11 @@ namespace DeviceLibrary ...@@ -37,6 +41,11 @@ namespace DeviceLibrary
} }
return true; return true;
} }
/// <summary>
/// 设置托盘物料信息
/// </summary>
/// <param name="rfid"></param>
/// <param name="requestLoadInfo"></param>
public static void SetTrayLoadInfo(string rfid, RequestLoadInfo requestLoadInfo) public static void SetTrayLoadInfo(string rfid, RequestLoadInfo requestLoadInfo)
{ {
lock (Traylist) lock (Traylist)
...@@ -52,9 +61,26 @@ namespace DeviceLibrary ...@@ -52,9 +61,26 @@ namespace DeviceLibrary
Traylist[rfid].TrayParam = requestLoadInfo.LoadParam.clone(); Traylist[rfid].TrayParam = requestLoadInfo.LoadParam.clone();
Traylist[rfid].DestinationAddr = GetAddrByGroupName(requestLoadInfo.DeviceGroupName); Traylist[rfid].DestinationAddr = GetAddrByGroupName(requestLoadInfo.DeviceGroupName);
} }
SaveTrayInfo();
} }
} }
static void SaveTrayInfo() {
try
{
var TL = Traylist.Where(t => t.Value.DestinationAddr >= 0).ToDictionary(a => a.Key, a => a.Value);
if (TL.Count > 0)
{
File.Delete("Config\\TrayList.temp");
File.WriteAllText("Config\\TrayList.temp~", JsonConvert.SerializeObject(TL));
File.Move("Config\\TrayList.temp~", "Config\\TrayList.temp");
}
}
catch (Exception ex)
{
LogUtil.error("托盘信息保存失败:" + ex);
}
}
/// <summary> /// <summary>
/// deviceGroupName,RequestLoadInfo /// deviceGroupName,RequestLoadInfo
/// </summary> /// </summary>
...@@ -62,7 +88,7 @@ namespace DeviceLibrary ...@@ -62,7 +88,7 @@ namespace DeviceLibrary
public static bool HasTrayRequest(string deviceGroupName,string rfid,out ReelParam reelParam) public static bool HasTrayRequest(string deviceGroupName,string rfid,out ReelParam reelParam)
{ {
reelParam = null; reelParam = null;
LogUtil.info($"HasTrayRequest:{deviceGroupName},{rfid},{TrayRequest.ContainsKey(deviceGroupName)}"); LogUtil.info($"[{deviceGroupName}] HasTrayRequest:{deviceGroupName},{rfid},{TrayRequest.ContainsKey(deviceGroupName)}");
lock (TrayRequest) lock (TrayRequest)
{ {
if (!TrayRequest.ContainsKey(deviceGroupName)) if (!TrayRequest.ContainsKey(deviceGroupName))
...@@ -160,7 +186,9 @@ namespace DeviceLibrary ...@@ -160,7 +186,9 @@ namespace DeviceLibrary
{ {
LogUtil.info("清空托盘信息 RFID:" + rfid); LogUtil.info("清空托盘信息 RFID:" + rfid);
Traylist[rfid].SetToEmpty(); Traylist[rfid].SetToEmpty();
SaveTrayInfo();
} }
} }
/// <summary> /// <summary>
/// 托盘释放 /// 托盘释放
...@@ -185,6 +213,25 @@ namespace DeviceLibrary ...@@ -185,6 +213,25 @@ namespace DeviceLibrary
device.TrayRelease(); device.TrayRelease();
} }
} }
/// <summary>
/// 移栽机构是否已空闲
/// </summary>
/// <param name="remoteLoad"></param>
/// <returns></returns>
public static bool IsFree(RemoteLoad remoteLoad)
{
var requestLoadInfo = remoteLoad.RequestLoadInfo;
Debug.WriteLine($"IsFree:{remoteLoad.GroupName}{requestLoadInfo.DeviceGroupName}");
lock (requestLoadInfo)
{
if (TransplantMove.DeviceList.ContainsKey(remoteLoad.GroupName))
{
var device = TransplantMove.DeviceList[remoteLoad.GroupName];
return device.IsFree();
}
}
return false;
}
/// <summary> /// <summary>
/// 空托盘数量 /// 空托盘数量
...@@ -212,7 +259,7 @@ namespace DeviceLibrary ...@@ -212,7 +259,7 @@ namespace DeviceLibrary
OfflineCount = 0; OfflineCount = 0;
lastrefresh = DateTime.Now; lastrefresh = DateTime.Now;
Traylist.Values.ToList().ForEach(ti=> { Traylist.Values.ToList().ForEach(ti=> {
if ((lastrefresh - ti.LastUpdateTime).TotalSeconds > 15) if ((lastrefresh - ti.LastUpdateTime).TotalSeconds > 30)
{ {
ti.isOnline = false; ti.isOnline = false;
OfflineCount++; OfflineCount++;
...@@ -290,7 +337,17 @@ namespace DeviceLibrary ...@@ -290,7 +337,17 @@ namespace DeviceLibrary
//TrayTypeDesc.Add(TrayTypeE.C02, crc.GetString("Res0011","Pizza治具")); //TrayTypeDesc.Add(TrayTypeE.C02, crc.GetString("Res0011","Pizza治具"));
//TrayTypeDesc.Add(TrayTypeE.C03, crc.GetString("Res0012","Tray治具")); //TrayTypeDesc.Add(TrayTypeE.C03, crc.GetString("Res0012","Tray治具"));
//TrayTypeDesc.Add(TrayTypeE.C04, crc.GetString("Res0013","ShoeBOX治具")); //TrayTypeDesc.Add(TrayTypeE.C04, crc.GetString("Res0013","ShoeBOX治具"));
if (File.Exists("Config\\TrayList.temp"))
{
try
{
var tl = File.ReadAllText("Config\\TrayList.temp");
Traylist = JsonConvert.DeserializeObject<Dictionary<string, TrayInfo>>(tl);
}
catch (Exception ex) {
LogUtil.error("启动时托盘信息加载失败:"+ex);
}
}
} }
public static void Init(Dictionary<string, DeviceGroup> deviceGroup) { public static void Init(Dictionary<string, DeviceGroup> deviceGroup) {
if (!AddrDesc.ContainsKey(-1)) if (!AddrDesc.ContainsKey(-1))
......
...@@ -15,6 +15,7 @@ namespace DeviceLibrary ...@@ -15,6 +15,7 @@ namespace DeviceLibrary
void Start(); void Start();
void Stop(); void Stop();
void TrayRelease(); void TrayRelease();
bool IsFree();
} }
public enum DeviceStateE public enum DeviceStateE
......
...@@ -126,6 +126,10 @@ namespace DeviceLibrary ...@@ -126,6 +126,10 @@ 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);
IOMove(IO_Type.Ls_A_BufStop_Fwd, IO_VALUE.HIGH, StopBufDelayMS);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
} }
else else
{ {
...@@ -135,7 +139,7 @@ namespace DeviceLibrary ...@@ -135,7 +139,7 @@ namespace DeviceLibrary
case MoveStep.SideMove_02: case MoveStep.SideMove_02:
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_03); LSAMoveInfo.NextMoveStep(MoveStep.SideMove_03);
IOMove(IO_Type.Ls_A_Front_Stop, IO_VALUE.HIGH, StopDelayMS); IOMove(IO_Type.Ls_A_Front_Stop, IO_VALUE.HIGH, StopDelayMS);
IOMove(IO_Type.Ls_A_BufStop_Fwd, IO_VALUE.HIGH, StopBufDelayMS); //IOMove(IO_Type.Ls_A_BufStop_Fwd, IO_VALUE.HIGH, StopBufDelayMS);
break; break;
case MoveStep.SideMove_03: case MoveStep.SideMove_03:
if (IOValue(IO_Type.Ls_A_Tray_Check).Equals(IO_VALUE.HIGH)) { if (IOValue(IO_Type.Ls_A_Tray_Check).Equals(IO_VALUE.HIGH)) {
...@@ -171,7 +175,7 @@ namespace DeviceLibrary ...@@ -171,7 +175,7 @@ namespace DeviceLibrary
break; break;
case MoveStep.SideMove_08: case MoveStep.SideMove_08:
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_09); LSAMoveInfo.NextMoveStep(MoveStep.SideMove_09);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500)); LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break; break;
case MoveStep.SideMove_09: case MoveStep.SideMove_09:
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_10); LSAMoveInfo.NextMoveStep(MoveStep.SideMove_10);
...@@ -298,7 +302,7 @@ namespace DeviceLibrary ...@@ -298,7 +302,7 @@ namespace DeviceLibrary
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(rfid, addr, out TrayInfo trayInfo); TrayManager.Process(Minfo,rfid, addr, 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);
...@@ -349,7 +353,7 @@ namespace DeviceLibrary ...@@ -349,7 +353,7 @@ namespace DeviceLibrary
{ {
Minfo.NextMoveStep(MoveStep.SideMove_11); Minfo.NextMoveStep(MoveStep.SideMove_11);
} }
else if (lsb.MoveStep >= MoveStep.SideMove_11) else if (lsb.MoveStep >= MoveStep.SideMove_10)
{ {
Minfo.NextMoveStep(MoveStep.SideMove_06); Minfo.NextMoveStep(MoveStep.SideMove_06);
Minfo.log($"{sideb}侧也在等待横移,本侧直接穿过"); Minfo.log($"{sideb}侧也在等待横移,本侧直接穿过");
...@@ -426,8 +430,8 @@ namespace DeviceLibrary ...@@ -426,8 +430,8 @@ namespace DeviceLibrary
break; break;
case MoveStep.H02_HomeReset: case MoveStep.H02_HomeReset:
LSAMoveInfo.NextMoveStep(MoveStep.H03_HomeReset); LSAMoveInfo.NextMoveStep(MoveStep.H03_HomeReset);
IOMove(IO_Type.Ls_A_BufStop_Rwd, IO_VALUE.HIGH, StopBufDelayMS); //IOMove(IO_Type.Ls_A_BufStop_Rwd, IO_VALUE.HIGH, StopBufDelayMS);
IOMove(IO_Type.Ls_B_BufStop_Rwd, IO_VALUE.HIGH, StopBufDelayMS); //IOMove(IO_Type.Ls_B_BufStop_Rwd, IO_VALUE.HIGH, StopBufDelayMS);
var loAdown = IOValue(IO_Type.Ls_A_Location_Down).Equals(IO_VALUE.HIGH); var loAdown = IOValue(IO_Type.Ls_A_Location_Down).Equals(IO_VALUE.HIGH);
var loBdown = IOValue(IO_Type.Ls_B_Location_Down).Equals(IO_VALUE.HIGH); var loBdown = IOValue(IO_Type.Ls_B_Location_Down).Equals(IO_VALUE.HIGH);
var trayAstate = IOValue(IO_Type.Ls_A_Tray_Check).Equals(IO_VALUE.HIGH); var trayAstate = IOValue(IO_Type.Ls_A_Tray_Check).Equals(IO_VALUE.HIGH);
...@@ -467,14 +471,14 @@ namespace DeviceLibrary ...@@ -467,14 +471,14 @@ namespace DeviceLibrary
LSAMoveInfo.NextMoveStep(MoveStep.H04_HomeReset); LSAMoveInfo.NextMoveStep(MoveStep.H04_HomeReset);
Location_A.ToHigh(LSAMoveInfo); Location_A.ToHigh(LSAMoveInfo);
Location_B.ToHigh(LSAMoveInfo); Location_B.ToHigh(LSAMoveInfo);
if (LS_Type== LS_TypeE.NoRfid) //if (LS_Type== LS_TypeE.NoRfid)
IOMove(IO_Type.Ls_B_BufStop_Fwd, IO_VALUE.HIGH,StopBufDelayMS); // IOMove(IO_Type.Ls_B_BufStop_Fwd, IO_VALUE.HIGH,StopBufDelayMS);
LSAMoveInfo.log($"顶升顶起"); LSAMoveInfo.log($"顶升顶起");
break; break;
case MoveStep.H04_HomeReset: case MoveStep.H04_HomeReset:
LSAMoveInfo.NextMoveStep(MoveStep.H05_HomeReset); LSAMoveInfo.NextMoveStep(MoveStep.H05_HomeReset);
Line.LineRun("n", false, 10); Line.LineRun("n", false, 10);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000)); LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(4000));
LSAMoveInfo.log($"横移点击运行"); LSAMoveInfo.log($"横移点击运行");
break; break;
case MoveStep.H05_HomeReset: case MoveStep.H05_HomeReset:
...@@ -487,7 +491,7 @@ namespace DeviceLibrary ...@@ -487,7 +491,7 @@ namespace DeviceLibrary
LSAMoveInfo.NextMoveStep(MoveStep.H07_HomeReset); LSAMoveInfo.NextMoveStep(MoveStep.H07_HomeReset);
if (LS_Type!= LS_TypeE.NoRfid) if (LS_Type!= LS_TypeE.NoRfid)
IOMove(IO_Type.Ls_B_Stop, IO_VALUE.HIGH, StopDelayMS); IOMove(IO_Type.Ls_B_Stop, IO_VALUE.HIGH, StopDelayMS);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000)); LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(4000));
LSAMoveInfo.log($"缓冲回退"); LSAMoveInfo.log($"缓冲回退");
break; break;
case MoveStep.H07_HomeReset: case MoveStep.H07_HomeReset:
...@@ -508,6 +512,11 @@ namespace DeviceLibrary ...@@ -508,6 +512,11 @@ namespace DeviceLibrary
{ {
} }
public bool IsFree()
{
throw new NotImplementedException();
}
enum LS_TypeE { enum LS_TypeE {
NoRfid, NoRfid,
OneWay, OneWay,
......
...@@ -32,7 +32,6 @@ namespace DeviceLibrary ...@@ -32,7 +32,6 @@ namespace DeviceLibrary
AxisBean axis2; AxisBean axis2;
public TrayStop(DeviceGroup device,out string msg) { public TrayStop(DeviceGroup device,out string msg) {
msg = ""; msg = "";
Name = device.Name+"("+ device.GroupName + ")"; Name = device.Name+"("+ device.GroupName + ")";
DeviceGroup = device; DeviceGroup = device;
...@@ -114,7 +113,7 @@ namespace DeviceLibrary ...@@ -114,7 +113,7 @@ namespace DeviceLibrary
MoveInfo.NextMoveStep(MoveStep.TrayStop_03); MoveInfo.NextMoveStep(MoveStep.TrayStop_03);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
MoveInfo.CanWhileCount = 3; MoveInfo.CanWhileCount = 3;
Location.ToHigh(MoveInfo); //Location.ToHigh(MoveInfo);
} else if (MoveInfo.IsTimeOut(10)){ } else if (MoveInfo.IsTimeOut(10)){
MoveInfo.log("没有检测到托盘"); MoveInfo.log("没有检测到托盘");
MoveInfo.NextMoveStep(MoveStep.Wait); MoveInfo.NextMoveStep(MoveStep.Wait);
...@@ -124,7 +123,7 @@ namespace DeviceLibrary ...@@ -124,7 +123,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(CurrrentRFID, DeviceGroup.addr_1, out TrayInfo trayInfo); TrayManager.Process(MoveInfo,CurrrentRFID, DeviceGroup.addr_1, out TrayInfo trayInfo);
var stop = TrayManager.HasTrayRequest(GroupName, CurrrentRFID,out _); var stop = TrayManager.HasTrayRequest(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}");
...@@ -142,7 +141,8 @@ namespace DeviceLibrary ...@@ -142,7 +141,8 @@ namespace DeviceLibrary
MoveInfo.NextMoveStep(MoveStep.TrayStop_04); MoveInfo.NextMoveStep(MoveStep.TrayStop_04);
SRec.info("托盘挡停", GroupName, "空托盘","准备接料", CurrrentRFID); SRec.info("托盘挡停", GroupName, "空托盘","准备接料", CurrrentRFID);
ServerCommunication.UpdateRobotStatus(trayInfo.TrayParam.WareCode, RobotStatusE.INROBOT, MoveInfo.MoveParam.RFID); if (trayInfo.TrayParam != null)
ServerCommunication.UpdateRobotStatus(trayInfo.TrayParam.WareCode, RobotStatusE.INROBOT, MoveInfo.MoveParam.RFID);
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 && IOValue(IO_Type.MI_Reel_Check).Equals(IO_VALUE.HIGH))
...@@ -158,7 +158,7 @@ namespace DeviceLibrary ...@@ -158,7 +158,7 @@ namespace DeviceLibrary
if (result != RemoteResult.True) if (result != RemoteResult.True)
{ {
MoveInfo.NextMoveStep(MoveStep.TrayStop_04); MoveInfo.NextMoveStep(MoveStep.TrayStop_04);
MoveInfo.log($"{GroupName} 请求库失败:{result}"); MoveInfo.log($"{GroupName} 请求库失败:{result}");
} }
else else
{ {
...@@ -249,5 +249,10 @@ namespace DeviceLibrary ...@@ -249,5 +249,10 @@ namespace DeviceLibrary
break; break;
} }
} }
public bool IsFree()
{
throw new NotImplementedException();
}
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -11,17 +11,38 @@ using System.Threading.Tasks; ...@@ -11,17 +11,38 @@ using System.Threading.Tasks;
[Serializable] [Serializable]
public class RemoteLoad public class RemoteLoad
{ {
/// <summary>
/// 动作
/// </summary>
public string Action; public string Action;
public int Seq; public long Seq;
/// <summary>
/// 设备名称
/// </summary>
public string GroupName; public string GroupName;
/// <summary>
/// 载荷信息
/// </summary>
public RequestLoadInfo RequestLoadInfo; public RequestLoadInfo RequestLoadInfo;
} }
[Serializable] [Serializable]
public class RequestLoadInfo public class RequestLoadInfo
{ {
/// <summary>
/// 目的地设备名称
/// </summary>
public string DeviceGroupName; public string DeviceGroupName;
/// <summary>
/// 托盘类型
/// </summary>
public string TrayType; public string TrayType;
/// <summary>
/// 是否空托盘
/// </summary>
public bool IsEmpty; public bool IsEmpty;
/// <summary>
/// 料盘数据
/// </summary>
public ReelParam LoadParam; public ReelParam LoadParam;
//public DoorStatusE DoorStatus; //public DoorStatusE DoorStatus;
...@@ -34,28 +55,50 @@ public class RequestLoadInfo ...@@ -34,28 +55,50 @@ public class RequestLoadInfo
{ {
return (TrayTypeE)Enum.Parse(typeof(TrayTypeE), TrayType); return (TrayTypeE)Enum.Parse(typeof(TrayTypeE), TrayType);
} }
catch { catch
{
return TrayTypeE.None; return TrayTypeE.None;
} }
} }
} }
} }
public enum RobotStatusE public enum RobotStatusE
{ {
INROBOT, BOXDOOR, FINISHED INROBOT, BOXDOOR, FINISHED
} }
/// <summary>
/// 治具类型
/// </summary>
public enum TrayTypeE public enum TrayTypeE
{ {
None, None,
/// <summary>
/// 流水线料盘托盘
/// </summary>
MTP1, //流水线料盘托盘 MTP1, //流水线料盘托盘
/// <summary>
/// 流水线治具托盘
/// </summary>
MTP2, //流水线治具托盘 MTP2, //流水线治具托盘
/// <summary>
/// 料串
/// </summary>
S007, //料串 S007, //料串
/// <summary>
/// Tray料格
/// </summary>
M03, //Tray料格 M03, //Tray料格
/// <summary>
/// PCB料格
/// </summary>
M02, //PCB料格 M02, //PCB料格
/// <summary>
/// PizzaBOX料格
/// </summary>
M01, //PizzaBOX料格 M01, //PizzaBOX料格
/// <summary>
/// ShoeBOX料格
/// </summary>
M04, //ShoeBOX料格 M04, //ShoeBOX料格
} }
...@@ -148,12 +191,12 @@ public class ReelParam ...@@ -148,12 +191,12 @@ public class ReelParam
{ {
if (IsNg) if (IsNg)
{ {
return $":{NgMsg}[{WareCode}][{RFID}]"; return $":{NgMsg}[{WareCode}][{RFID}][{PlateW}x{PlateH}]";
} }
else else
{ {
return $":[{PosID}][{WareCode}][{RFID}] "; return $":[{PosID}][{WareCode}][{RFID}][{PlateW}x{PlateH}]";
} }
} }
......
...@@ -91,10 +91,11 @@ public class RemoteClient ...@@ -91,10 +91,11 @@ public class RemoteClient
case "OK": case "OK":
case "FAIL": case "FAIL":
lastresult = remoteLoad.Action == "OK" ? RemoteResult.True : RemoteResult.False; lastresult = remoteLoad.Action == "OK" ? RemoteResult.True : RemoteResult.False;
LOGGER.Info("Revice Command Callback" + remoteLoad.GroupName + "-" + remoteLoad.Action); LOGGER.Info("Revice Command Callback:" + remoteLoad.GroupName + "-" + remoteLoad.Action);
return; return;
default: default:
if (actionlist.ContainsKey(remoteLoad.Action)) { if (actionlist.ContainsKey(remoteLoad.Action)) {
LOGGER.Info("Revice remote command:" + remoteLoad.Action +",Seq:"+ remoteLoad.Seq);
isok= actionlist[remoteLoad.Action].Invoke(remoteLoad.RequestLoadInfo); isok= actionlist[remoteLoad.Action].Invoke(remoteLoad.RequestLoadInfo);
} }
else else
...@@ -124,6 +125,7 @@ public class RemoteClient ...@@ -124,6 +125,7 @@ public class RemoteClient
return lastresult; return lastresult;
} }
public RemoteResult SendAndWait(RemoteLoad remoteLoad, int waittime= 3000) { public RemoteResult SendAndWait(RemoteLoad remoteLoad, int waittime= 3000) {
remoteLoad.Seq = DateTime.Now.Ticks;
remoteLoad.GroupName = GroupName; remoteLoad.GroupName = GroupName;
if (remoteLoad.RequestLoadInfo != null) if (remoteLoad.RequestLoadInfo != null)
{ {
......
...@@ -31,9 +31,13 @@ namespace TheMachine ...@@ -31,9 +31,13 @@ namespace TheMachine
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.listView1 = new TheMachine.DoubleBufferListView();
this.label_Statistics = new System.Windows.Forms.Label(); this.label_Statistics = new System.Windows.Forms.Label();
this.gb_trayinfo = new System.Windows.Forms.GroupBox();
this.btn_reset = new System.Windows.Forms.Button();
this.lbl_info = new System.Windows.Forms.Label();
this.ListView2 = new TheMachine.DoubleBufferListView(); this.ListView2 = new TheMachine.DoubleBufferListView();
this.listView1 = new TheMachine.DoubleBufferListView();
this.gb_trayinfo.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// timer1 // timer1
...@@ -41,15 +45,6 @@ namespace TheMachine ...@@ -41,15 +45,6 @@ namespace TheMachine
this.timer1.Interval = 1000; this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
// //
// listView1
//
this.listView1.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(0, 0);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(671, 355);
this.listView1.TabIndex = 0;
this.listView1.UseCompatibleStateImageBehavior = false;
//
// label_Statistics // label_Statistics
// //
this.label_Statistics.AutoSize = true; this.label_Statistics.AutoSize = true;
...@@ -59,6 +54,38 @@ namespace TheMachine ...@@ -59,6 +54,38 @@ namespace TheMachine
this.label_Statistics.TabIndex = 1; this.label_Statistics.TabIndex = 1;
this.label_Statistics.Text = "label1"; this.label_Statistics.Text = "label1";
// //
// gb_trayinfo
//
this.gb_trayinfo.Controls.Add(this.btn_reset);
this.gb_trayinfo.Controls.Add(this.lbl_info);
this.gb_trayinfo.Location = new System.Drawing.Point(714, 185);
this.gb_trayinfo.Name = "gb_trayinfo";
this.gb_trayinfo.Size = new System.Drawing.Size(240, 170);
this.gb_trayinfo.TabIndex = 2;
this.gb_trayinfo.TabStop = false;
this.gb_trayinfo.Text = "托盘操作";
this.gb_trayinfo.Visible = false;
//
// btn_reset
//
this.btn_reset.Dock = System.Windows.Forms.DockStyle.Bottom;
this.btn_reset.Location = new System.Drawing.Point(3, 137);
this.btn_reset.Name = "btn_reset";
this.btn_reset.Size = new System.Drawing.Size(234, 30);
this.btn_reset.TabIndex = 1;
this.btn_reset.Text = "清空托盘";
this.btn_reset.UseVisualStyleBackColor = true;
this.btn_reset.Click += new System.EventHandler(this.btn_reset_Click);
//
// lbl_info
//
this.lbl_info.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbl_info.Location = new System.Drawing.Point(3, 22);
this.lbl_info.Name = "lbl_info";
this.lbl_info.Size = new System.Drawing.Size(234, 145);
this.lbl_info.TabIndex = 0;
this.lbl_info.Text = "label1";
//
// ListView2 // ListView2
// //
this.ListView2.HideSelection = false; this.ListView2.HideSelection = false;
...@@ -68,9 +95,22 @@ namespace TheMachine ...@@ -68,9 +95,22 @@ namespace TheMachine
this.ListView2.TabIndex = 0; this.ListView2.TabIndex = 0;
this.ListView2.UseCompatibleStateImageBehavior = false; this.ListView2.UseCompatibleStateImageBehavior = false;
// //
// listView1
//
this.listView1.FullRowSelect = true;
this.listView1.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(0, 0);
this.listView1.MultiSelect = false;
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(671, 355);
this.listView1.TabIndex = 0;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
//
// TrayManagerControl // TrayManagerControl
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.gb_trayinfo);
this.Controls.Add(this.label_Statistics); this.Controls.Add(this.label_Statistics);
this.Controls.Add(this.ListView2); this.Controls.Add(this.ListView2);
this.Controls.Add(this.listView1); this.Controls.Add(this.listView1);
...@@ -78,6 +118,7 @@ namespace TheMachine ...@@ -78,6 +118,7 @@ namespace TheMachine
this.Name = "TrayManagerControl"; this.Name = "TrayManagerControl";
this.Size = new System.Drawing.Size(1007, 642); this.Size = new System.Drawing.Size(1007, 642);
this.Load += new System.EventHandler(this.TrayManagerControl_Load); this.Load += new System.EventHandler(this.TrayManagerControl_Load);
this.gb_trayinfo.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
...@@ -89,5 +130,8 @@ namespace TheMachine ...@@ -89,5 +130,8 @@ namespace TheMachine
private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label label_Statistics; private System.Windows.Forms.Label label_Statistics;
private DoubleBufferListView ListView2; private DoubleBufferListView ListView2;
private System.Windows.Forms.GroupBox gb_trayinfo;
private System.Windows.Forms.Label lbl_info;
private System.Windows.Forms.Button btn_reset;
} }
} }
...@@ -10,6 +10,7 @@ using System.Linq; ...@@ -10,6 +10,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using OnlineStore.Common;
namespace TheMachine namespace TheMachine
{ {
...@@ -65,8 +66,8 @@ namespace TheMachine ...@@ -65,8 +66,8 @@ namespace TheMachine
{ {
ColumnHeader col1 = new ColumnHeader(); ColumnHeader col1 = new ColumnHeader();
col1.Text = coltxt; col1.Text = coltxt;
col1.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
col1.Width = 100; col1.Width = 100;
col1.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
ListView2.Columns.Add(col1); ListView2.Columns.Add(col1);
} }
//ListView2.ColumnClick += ListView1_ColumnClick; //ListView2.ColumnClick += ListView1_ColumnClick;
...@@ -106,7 +107,7 @@ namespace TheMachine ...@@ -106,7 +107,7 @@ namespace TheMachine
} }
}); });
listView1.Items.Clear(); //listView1.Items.Clear();
foreach (var ti in traylist) { foreach (var ti in traylist) {
var timego = (DateTime.Now - ti.LastUpdateTime); var timego = (DateTime.Now - ti.LastUpdateTime);
var lasttime = timego.Seconds + crc.GetString("Res0024","秒前"); var lasttime = timego.Seconds + crc.GetString("Res0024","秒前");
...@@ -121,17 +122,29 @@ namespace TheMachine ...@@ -121,17 +122,29 @@ namespace TheMachine
var reelid = ""; var reelid = "";
reelid = ti.TrayParam?.WareCode; reelid = ti.TrayParam?.WareCode;
var items = new string[] {lastaddrdesc.ToString(), lasttime, traydesc, loaddesc, toaddrdesc, reelid }; var items = new string[] {lastaddrdesc.ToString(), lasttime, traydesc, loaddesc, toaddrdesc, reelid };
var listviewitem = new ListViewItem();
if (listView1.Items.ContainsKey(ti.RFID))
{
while (listView1.Items[ti.RFID].SubItems.Count > 1)
{
listView1.Items[ti.RFID].SubItems.RemoveAt(1);
}
listView1.Items[ti.RFID].SubItems.AddRange(items);
}
else
{
var listviewitem = new ListViewItem();
listView1.Items.Add(ti.RFID, ti.RFID,0);
listView1.Items[ti.RFID].SubItems.AddRange(items);
listView1.Items[ti.RFID].UseItemStyleForSubItems = true;
}
if (timego.TotalSeconds < 15) if (timego.TotalSeconds < 15)
listviewitem.ForeColor = Color.DarkGreen; listView1.Items[ti.RFID].ForeColor = Color.DarkGreen;
else if (timego.TotalSeconds > 30) else if (timego.TotalSeconds > 30)
listviewitem.ForeColor = Color.DarkGray; listView1.Items[ti.RFID].ForeColor = Color.DarkGray;
else else
listviewitem.ForeColor = Color.Black; listView1.Items[ti.RFID].ForeColor = Color.Black;
listviewitem.UseItemStyleForSubItems = true;
listviewitem.Text = ti.RFID;
listviewitem.SubItems.AddRange(items);
listView1.Items.Add(listviewitem);
} }
ListView2.Items.Clear(); ListView2.Items.Clear();
foreach (var tivk in TrayManager.TrayRequest.ToArray()) foreach (var tivk in TrayManager.TrayRequest.ToArray())
...@@ -157,5 +170,34 @@ namespace TheMachine ...@@ -157,5 +170,34 @@ namespace TheMachine
+ crc.GetString("Res0031","入库托盘") + ": " + TrayManager.InStoreCount + "\n" + crc.GetString("Res0031","入库托盘") + ": " + TrayManager.InStoreCount + "\n"
+ crc.GetString("Res0032","出库托盘") + ": " + TrayManager.OutStoreCount + "\n"; + crc.GetString("Res0032","出库托盘") + ": " + TrayManager.OutStoreCount + "\n";
} }
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count ==0)
{
gb_trayinfo.Visible = false;
return;
}
string txt = "RFID" + ": " + listView1.SelectedItems[0].Text;
txt += "\r\n"+"托盘类型" + ": " + listView1.SelectedItems[0].SubItems[2].Text;
txt += "\r\n"+"载荷" + ": " + listView1.SelectedItems[0].SubItems[3].Text;
txt += "\r\n"+"目的地" + ": " + listView1.SelectedItems[0].SubItems[4].Text;
txt += "\r\n"+"Code" + ": " + listView1.SelectedItems[0].SubItems[6].Text;
lbl_info.Text = txt;
gb_trayinfo.Visible = true;
}
private void btn_reset_Click(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count != 1)
{
gb_trayinfo.Visible = false;
return;
}
TrayManager.SetToEmpty(listView1.SelectedItems[0].Text);
LogUtil.info("手动清空托盘信息 RFID:" + listView1.SelectedItems[0].Text);
}
} }
} }
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!