Commit 75d50573 刘韬

1

1 个父辈 233ceb77
正在显示 49 个修改的文件 包含 981 行增加130 行删除
......@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "DeviceLibr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TheMachine", "TheMachine\TheMachine.csproj", "{61FDFF14-8BB7-439A-85A0-592E3011F4C4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteSheardObject", "RemoteSheardObject\RemoteSheardObject.csproj", "{49004F82-8AEE-46DA-BB14-BD02AC990CE2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -33,6 +35,10 @@ Global
{61FDFF14-8BB7-439A-85A0-592E3011F4C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61FDFF14-8BB7-439A-85A0-592E3011F4C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61FDFF14-8BB7-439A-85A0-592E3011F4C4}.Release|Any CPU.Build.0 = Release|Any CPU
{49004F82-8AEE-46DA-BB14-BD02AC990CE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{49004F82-8AEE-46DA-BB14-BD02AC990CE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{49004F82-8AEE-46DA-BB14-BD02AC990CE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{49004F82-8AEE-46DA-BB14-BD02AC990CE2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -180,7 +180,8 @@ namespace OnlineStore
if ((strCurLanguage == null || strCurLanguage.Equals("")) && (!defaultStr.Equals("")))
{
strCurLanguage = defaultStr;
NoIdLog(id, defaultStr);
if (HasChinese(defaultStr))
NoIdLog(id, defaultStr);
}
}
catch (Exception ex)
......@@ -305,7 +306,7 @@ namespace OnlineStore
if (Con_GetTxt(con, out txt))
{
if (HasChinese(txt))
//if (HasChinese(txt))
{
newStr = GetString(GetTextIdStr(className, con.Name), txt);
if (!newStr.Equals(""))
......
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Net;
......@@ -104,13 +105,41 @@ namespace OnlineStore.Common
}
catch (Exception e)
{
LogUtil.error("POST ERROR:" + e.ToString()+"\r\n"+ url, 101);
LogUtil.error("POST ERROR:" + e.ToString() + "\r\n" + url, 101);
}
return result;
}
public static string Post(string url, NameValueCollection paramData, int timeOut = 10000)
{
string result = "";
if (url.ToLower().IndexOf("https", System.StringComparison.Ordinal) > -1)
{
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback((sender, certificate, chain, errors) => { return true; });
}
try
{
using (var wc = new MyWebClient(timeOut))
{
byte[] buf = wc.UploadValues(url, "POST", paramData);
result = Encoding.UTF8.GetString(buf);
}
//LogUtil.info(result);
}
catch (Exception e)
{
LogUtil.error("POST ERROR:" + e.ToString() + "\r\n" + url, 101);
}
return result;
}
static object lockpost = new object();
public static Operation Post(string url, Operation operation,int timeout=5000, bool printlog=false)
public static Operation Post(string url, Operation operation, int timeout = 5000, bool printlog = false)
{
try
{
......
......@@ -47,6 +47,9 @@
<Reference Include="ConfigHelper">
<HintPath>..\..\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="Fleck, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Fleck.1.2.0\lib\net45\Fleck.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<HintPath>..\..\RC1271-DUOStore\dll\halcondotnet.dll</HintPath>
</Reference>
......@@ -91,7 +94,6 @@
<Compile Include="DeviceLibrary\AxisBean.cs" />
<Compile Include="theMachine\Common.cs" />
<Compile Include="theMachine\JobList.cs" />
<Compile Include="theMachine\LabelParam.cs" />
<Compile Include="theMachine\DeviceRunControl.cs" />
<Compile Include="theMachine\MainMachine _BtnProcess.cs" />
<Compile Include="theMachine\DeviceBase.cs" />
......@@ -102,6 +104,7 @@
<Compile Include="theMachine\MoveStep.cs" />
<Compile Include="DeviceLibrary\AlarmBuzzer.cs" />
<Compile Include="DeviceLibrary\CodeManager.cs" />
<Compile Include="theMachine\RemoteService.cs" />
<Compile Include="theMachine\RobotManage.cs" />
<Compile Include="theMachine\IRobot.cs" />
<Compile Include="DeviceLibrary\IAxisManager.cs" />
......@@ -155,6 +158,10 @@
<Project>{064bebf5-8faa-4ea2-a5f3-a06e6e7d9251}</Project>
<Name>LoadCSVLibrary</Name>
</ProjectReference>
<ProjectReference Include="..\RemoteSheardObject\RemoteSheardObject.csproj">
<Project>{49004f82-8aee-46da-bb14-bd02ac990ce2}</Project>
<Name>RemoteSheardObject</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Config\general.config">
......
......@@ -29,7 +29,7 @@ namespace DeviceLibrary
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(Low, IO_VALUE.LOW));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(High, IO_VALUE.HIGH));
}
Resume();
Resume(false);
LogUtil.info($"{Name},设置{High}=High");
}
public void ToLow(MoveInfo moveInfo)
......@@ -40,7 +40,7 @@ namespace DeviceLibrary
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(Low, IO_VALUE.HIGH));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(High, IO_VALUE.LOW));
}
Resume();
Resume(false);
LogUtil.info($"{Name},设置{High}=Low");
}
......@@ -51,11 +51,11 @@ namespace DeviceLibrary
LogUtil.info($"{Name},没有在运行");
return;
}
else if (currentIOvalue == IO_VALUE.HIGH && IOManager.IOValue(High).Equals(IO_VALUE.HIGH))
else if (currentIOvalue == IO_VALUE.HIGH && IOManager.IOValue(High, DeviceGroup).Equals(IO_VALUE.HIGH))
{
LogUtil.info($"{Name},currentIOvalue:{currentIOvalue},暂停是IO已到位");
return;
}else if (currentIOvalue == IO_VALUE.LOW && IOManager.IOValue(Low).Equals(IO_VALUE.HIGH))
}else if (currentIOvalue == IO_VALUE.LOW && IOManager.IOValue(Low, DeviceGroup).Equals(IO_VALUE.HIGH))
{
LogUtil.info($"{Name},currentIOvalue:{currentIOvalue},暂停是IO已到位");
return;
......@@ -65,13 +65,14 @@ namespace DeviceLibrary
IOManager.IOMove(High, IO_VALUE.LOW, DeviceGroup);
}
public void Resume()
public void Resume(bool islog=true)
{
if (currentIOvalue == IO_VALUE.None)
return;
IOManager.IOMove(Low, currentIOvalue == IO_VALUE.LOW ? IO_VALUE.HIGH : IO_VALUE.LOW, DeviceGroup);
IOManager.IOMove(High, currentIOvalue == IO_VALUE.HIGH ? IO_VALUE.HIGH : IO_VALUE.LOW, DeviceGroup);
LogUtil.info($"{Name},恢复运行");
if (islog)
LogUtil.info($"{Name},恢复运行");
}
}
......
......@@ -22,7 +22,7 @@ namespace DeviceLibrary
public static void IOMove(string ioType, IO_VALUE ioValue,string device="root")
{
if (StoreManager.Config.DOList.ContainsKey(ioType))
if (StoreManager.Config.DOList[device].ContainsKey(ioType))
{
ConfigIO configIo = StoreManager.Config.DOList[device][ioType];
instance.WriteSingleDO(configIo.DeviceName, configIo.SlaveID, configIo.GetIOAddr(), ioValue);
......@@ -30,7 +30,7 @@ namespace DeviceLibrary
}
else
{
LogUtil.error("没有DO=" + ioType);
LogUtil.error("没有DO="+ device + ":" + ioType);
}
}
......@@ -43,14 +43,14 @@ namespace DeviceLibrary
ioValue = instance.GetDIValue(configIo.DeviceName, configIo.SlaveID, configIo.GetIOAddr());
//UpdateDoValue(ioType, ioValue);
}
else if (StoreManager.Config.DOList.ContainsKey(ioType))
else if (StoreManager.Config.DOList[device].ContainsKey(ioType))
{
ConfigIO configIo = StoreManager.Config.DOList[device][ioType];
ioValue = instance.GetDOValue(configIo.DeviceName, configIo.SlaveID, configIo.GetIOAddr());
}
else
{
LogUtil.error("没有DO=" + ioType);
LogUtil.error("没有DO="+ device + ":" + ioType);
}
return ioValue;
}
......
......@@ -9,7 +9,7 @@ namespace DeviceLibrary
interface ISafetyDevice
{
void Pause();
void Resume();
void Resume(bool islog);
}
class SafetyDevice
......@@ -23,7 +23,7 @@ namespace DeviceLibrary
List.ForEach(x => x.Pause());
}
public static void ResumeAll() {
List.ForEach(x => x.Resume());
List.ForEach(x => x.Resume(true));
}
......
......@@ -69,7 +69,7 @@ namespace DeviceLibrary
LogUtil.info(Name + $" 线体管理器 暂停线体.");
}
}
public void Resume() {
public void Resume(bool islog=true) {
if (pauseTime != DateTime.MinValue)
{
......@@ -87,7 +87,7 @@ namespace DeviceLibrary
}
pauseTime = DateTime.MinValue;
lineTimer.Enabled = true;
if (linrunlist.Count > 0)
if (linrunlist.Count > 0 && islog)
LogUtil.info(Name + $" 线体管理器 恢复运行线体.");
}
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Fleck" version="1.2.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
</packages>
\ No newline at end of file
......@@ -15,6 +15,16 @@ namespace DeviceLibrary
{
public class Common
{
public static string RfidFilter(byte[] data) {
var rfid = Encoding.ASCII.GetString(data).Trim();
if (rfid.StartsWith("Z")) {
rfid=rfid.Substring(1);
}
rfid = rfid.Trim();
return rfid.Trim('\x00');
}
/**获取角度*/
// 求3点形成的夹角
public static float getAngle2(Point pt1, Point pt2, Point pt0)
......
......@@ -12,14 +12,16 @@ namespace DeviceLibrary
{
public class DeviceBase
{
public string CurrrentRFID = "";
public TrayInfo CurrrentTrayInfo { get => TrayManager.Traylist[CurrrentRFID]; }
public MsgService Msg { get; set; }
public string Name { get; set; }
public string GroupName { get; set; }
public void StopMove(bool ServoOff=false)
public void StopMove(bool ServoOff = false)
{
//runStatus = RunStatus.Stop;
MoveInfo.List.ForEach((m)=> { m.EndMove(); });
MoveInfo.List.ForEach((m) => { m.EndMove(); });
if (AxisBean.List.ContainsKey(GroupName))
AxisBean.StopMultiAxis(AxisBean.List[GroupName]);
......@@ -31,12 +33,18 @@ namespace DeviceLibrary
}
public void OpenAllServo()
{
AxisBean.RunMultiAxis(true, out _, AxisBean.List[GroupName]);
if (AxisBean.List.ContainsKey(GroupName))
AxisBean.RunMultiAxis(true, out _, AxisBean.List[GroupName]);
else
LogUtil.info($"{GroupName},没有伺服");
}
int logType = 1000;
string WarnMsg = "";
public bool CheckWait(MoveInfo MoveInfo)
{
if (Msg == null) {
LogUtil.info("msg为空");
}
//当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - MoveInfo.LastSetpTime;
string NotOkMsg = "";
......@@ -61,11 +69,11 @@ namespace DeviceLibrary
{
if (wait.IsEnd)
{
if(!wait.WaitType.Equals(WaitEnum.W002_IOValue))
if (!wait.WaitType.Equals(WaitEnum.W002_IOValue))
{
continue;
}
}
NotOkMsg = wait.ToStr();
if (wait.WaitType.Equals(WaitEnum.W001_AxisMove))
......@@ -91,15 +99,17 @@ namespace DeviceLibrary
else if (wait.WaitType.Equals(WaitEnum.W002_IOValue))
{
ConfigIO io = RobotManage.Config.GetWaitIO(wait.IoType, GroupName);
NotOkMsg = MoveInfo.Name + crc.GetString("Res0157","等待")+"【" + io.DisplayStr + "】=【" + wait.IoValue + "】";
wait.IsEnd = IOManager.IOValue(wait.IoType).Equals(wait.IoValue);
if (io == null)
throw new Exception($"找不到io:{wait.IoType},{GroupName}");
NotOkMsg = MoveInfo.Name + crc.GetString("Res0157", "等待") + "【" + io.DisplayStr + "】=【" + wait.IoValue + "】";
wait.IsEnd = IOManager.IOValue(wait.IoType, GroupName).Equals(wait.IoValue);
if (!wait.IsEnd)
{
int timeOutMs = RobotManage.Config.IOSingle_TimerOut * 1000;
if (span.TotalMilliseconds > timeOutMs && NoAlarm())
{
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);
if (NoAlarm())
......@@ -125,7 +135,7 @@ namespace DeviceLibrary
wait.IsEnd = wait.Action.Invoke(wait);
LogUtil.info($"{Name} 自定义等待 IsEnd={wait.IsEnd},Type={wait.Action.GetType()}");
}
if (wait.IsEnd)
{
......@@ -151,7 +161,7 @@ namespace DeviceLibrary
}
else if (span.TotalSeconds > MoveInfo.TimeOutSeconds)
{
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "]"+crc.GetString("Res0157","等待") + NotOkMsg + crc.GetString("Res0158","超时");
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "]" + crc.GetString("Res0157", "等待") + NotOkMsg + crc.GetString("Res0158", "超时");
int second = (int)(MoveInfo.TimeOutSeconds / span.TotalSeconds) * 10;
if (second > 120)
......@@ -237,7 +247,7 @@ namespace DeviceLibrary
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoHighType, IO_VALUE.HIGH));
}
}
public IO_VALUE IOValue(string ioType) => IOManager.IOValue(ioType,GroupName);
public IO_VALUE IOValue(string ioType) => IOManager.IOValue(ioType, GroupName);
public void IOMove(string IoType, IO_VALUE value, int msTime = 0)
{
if (msTime <= 0)
......@@ -246,7 +256,7 @@ namespace DeviceLibrary
}
else
{
Task.Run(()=>
Task.Run(() =>
{
IOManager.IOMove(IoType, value, GroupName);
Thread.Sleep(msTime);
......@@ -259,21 +269,5 @@ namespace DeviceLibrary
}
}
public enum StringStateE
{
None=0,
InStore,
OutStore,
Full,
ManualOut
}
public enum StringTypeE
{
None=0,
In,
Out
}
}
}
\ No newline at end of file
......@@ -55,6 +55,7 @@ namespace DeviceLibrary
msg += m;
TrayStop.Init(Config, DeviceGroup, out m);
msg += m;
TrayManager.Init(DeviceGroup);
#region 初始化led
RunningLed = new Led(Config.DOList["root"][IO_Type.Run_Led].GetIOAddr(), LedColor.green);
StandbyLed = new Led(Config.DOList["root"][IO_Type.Standby_Led].GetIOAddr(), LedColor.yellow);
......@@ -147,9 +148,10 @@ namespace DeviceLibrary
public void Start() {
Run();
}
public void Stop() {
public void Stop() {
mstart = false;
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
ResetEvent.Set();
Alarm(AlarmType.None);
StopMove(true);
LedProcess(null);
......@@ -164,6 +166,8 @@ namespace DeviceLibrary
Alarm(AlarmType.None);
runStatus = RunStatus.HomeReset;
SideMove.DeviceList.Values.ToList().ForEach(s => s.Start());
TransplantMove.DeviceList.Values.ToList().ForEach(s => s.Start());
TrayStop.DeviceList.Values.ToList().ForEach(s => s.Start());
}
......@@ -173,6 +177,7 @@ namespace DeviceLibrary
bool ok = true;
if (!lastSafeCheckStatus && ok)
{
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
SafetyDevice.ResumeAll();
}
lastSafeCheckStatus = ok;
......
......@@ -155,6 +155,7 @@ namespace DeviceLibrary
wait.WaitType = WaitEnum.W002_IOValue;
wait.IoType = ioType;
wait.IoValue = ioValue;
//wait.Devicegroup = devicegroup;
return wait;
}
public static WaitResultInfo WaitAxis(ConfigMoveAxis axis, int targetPosition, int targetSpeed)
......@@ -295,7 +296,8 @@ namespace DeviceLibrary
/// <summary>
/// IO类型
/// </summary>
public String IoType { get; set; }
public string IoType { get; set; }
public string Devicegroup { get; set; }
/// <summary>
/// IO值
/// </summary>
......
......@@ -42,6 +42,7 @@ namespace DeviceLibrary
SideMove_11,
SideMove_12,
SideMove_13,
SideMove_13_2,
SideMove_14,
SideMove_15,
SideMove_16,
......@@ -55,8 +56,8 @@ namespace DeviceLibrary
TrayStop_05,
TrayStop_06,
TrayStop_07,
TrayStop_WaitLoadLeave,
TrayStop_LoadLeaved,
TrayStop_WaitLoadProcess,
TrayStop_LoadProcessed,
TransplantMove_01,
TransplantMove_02,
......@@ -76,7 +77,16 @@ namespace DeviceLibrary
TransplantMove_16,
TransplantMove_17,
TransplantMove_18,
TransplantMove_19,
TransplantMove_20,
TransplantMove_21,
TransplantMove_22,
TransplantMove_23,
TransplantMove_24,
TransplantMove_25,
TransplantMove_26,
TransplantMove_27,
TransplantMove_28,
TransplantMove_29,
TransplantMove_30,
TransplantMove_31,
TransplantMove_32,
......
using Fleck;
using Newtonsoft.Json;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public static class RemoteService
{
/// <summary>
/// deviceGroupName
/// </summary>
static Dictionary<string,IWebSocketConnection> allClients;
static WebSocketServer server;
public static void Init() {
FleckLog.Level = LogLevel.Debug;
allClients = new Dictionary<string, IWebSocketConnection>();
server = new WebSocketServer("ws://0.0.0.0:26901");
server.Start(client =>
{
client.OnOpen = () =>
{
var deviceGroupName = client.ConnectionInfo.Path.Substring(1);
LogUtil.info($"客户端OnOpen:{deviceGroupName}");
lock (allClients)
{
if (allClients.ContainsKey(deviceGroupName))
allClients.Add(deviceGroupName, client);
else
allClients.Add(deviceGroupName,client);
}
};
client.OnClose = () =>
{
var deviceGroupName = client.ConnectionInfo.Path.Substring(1);
LogUtil.info($"客户端OnClose:{deviceGroupName}");
lock (allClients)
{
allClients.Remove(deviceGroupName);
}
};
client.OnMessage = message =>
{
var deviceGroupName = client.ConnectionInfo.Path.Substring(1);
//SetINCall(deviceGroupName, JsonConvert.DeserializeObject<RemoteLoad>(message));
ProcessMessage(deviceGroupName,message);
};
});
}
static volatile RemoteResult lastresult = RemoteResult.None;
static void ProcessMessage(string deviceGroupName, string message) {
bool isok = true;
try
{
lastresult = RemoteResult.None;
var remoteLoad = JsonConvert.DeserializeObject<RemoteLoad>(message);
switch (remoteLoad.Action)
{
case "SetTrayRequest":
TrayManager.SetTrayRequest(remoteLoad);
break;
case "TrayRelease":
TrayManager.TrayRelease(remoteLoad);
break;
case "OK":
case "FAIL":
lastresult = remoteLoad.Action == "OK" ? RemoteResult.True : RemoteResult.False;
LogUtil.info("Revice Command Callback:" + remoteLoad.GroupName + " - " + remoteLoad.Action);
return;
default:
break;
}
}
catch(Exception e) {
isok = false;
LogUtil.info("Remote process error:"+e.ToString());
}
SendResult(deviceGroupName, isok);
}
public static void SendMessage(string deviceGroupName,RemoteLoad message) {
if (!allClients.ContainsKey(deviceGroupName))
{
LogUtil.info($"设备:{deviceGroupName} 不在线");
return;
}
try
{
allClients[deviceGroupName].Send(JsonConvert.SerializeObject(message));
}
catch (Exception ex){
LogUtil.info($"设备:{deviceGroupName} 消息发送出错:"+ex.ToString());
}
}
public static RemoteResult SendAndWait(string GroupName, RemoteLoad remoteLoad, int waittime = 3000)
{
remoteLoad.GroupName = GroupName;
if (remoteLoad.RequestLoadInfo != null && string.IsNullOrEmpty(remoteLoad.RequestLoadInfo.DeviceGroupName))
remoteLoad.RequestLoadInfo.DeviceGroupName = GroupName;
LogUtil.info($"{GroupName},发送:{remoteLoad.Action}");
SendMessage(GroupName, remoteLoad);
return WaitResult(waittime);
}
static RemoteResult WaitResult(int waittime = 3000)
{
while (lastresult == RemoteResult.None && waittime > 0)
{
System.Threading.Thread.Sleep(50);
waittime = waittime - 50;
}
if (lastresult == RemoteResult.None)
{
LogUtil.info("等待远程反馈超时");
lastresult = RemoteResult.Timeout;
}
return lastresult;
}
public static void SendResult(string deviceGroupName, bool result)
{
RemoteLoad remoteLoad = new RemoteLoad();
remoteLoad.Action = result?"OK":"FAIL";
remoteLoad.GroupName = deviceGroupName;
SendMessage(deviceGroupName, remoteLoad);
}
}
}
......@@ -48,6 +48,7 @@ namespace DeviceLibrary
IsLoadOk = false;
msg += crc.GetString("Res0180","找不到库位配置文件")+ "\n";
}
RemoteService.Init();
mainMachine = new MainMachine(out string m);
if (!string.IsNullOrWhiteSpace(m)) {
IsLoadOk = false;
......
......@@ -14,6 +14,7 @@ namespace DeviceLibrary
DeviceStateE DeviceState { get; set; }
void Start();
void Stop();
void TrayRelease();
}
public enum DeviceStateE
......
......@@ -215,8 +215,7 @@ namespace DeviceLibrary
//
// FixtureSizeConfigControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.groupBox_add);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.button2);
......
......@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
......@@ -19,7 +20,7 @@ namespace DeviceLibrary
public FixtureSizeConfigControl()
{
InitializeComponent();
if (DesignMode)
if (Process.GetCurrentProcess().ProcessName == "devenv")
return;
this.Tag = "not";
crc.OpenResourceLog = true;
......@@ -29,6 +30,8 @@ namespace DeviceLibrary
private void FixtureSizeConfigControl_Load(object sender, EventArgs e)
{
if (Process.GetCurrentProcess().ProcessName == "devenv")
return;
RefreshList();
}
void RefreshList() {
......
......@@ -4,11 +4,13 @@ AXIS,0,AMH-SBDH2-1伺服移栽,AMH_SBDH2_1_Axis,1,HC,,20000,0,0,0,40000,0,10,700,0,0
AXIS,0,AMH-SBDH2-2伺服移栽,AMH_SBDH2_2_Axis,2,HC,,60000,0,0,0,10000,0,10,700,0,0
AXIS,0,AMH-SBSH1伺服移栽,AMH_SBSH1_Axis,3,HC,,20000,0,0,0,40000,0,10,700,0,0
AXIS,0,MI1压紧伺服,MI1_Axis,4,HC,,60000,0,0,0,10000,0,10,700,0,0
AXIS,0,AMH-SBDH3-1伺服移栽,AMH_SBDH3_1_Axis,5,HC,,20000,0,0,0,40000,0,10,700,0,0
AXIS,0,AMH-SBDH3-2伺服移栽,AMH_SBDH3_2_Axis,6,HC,,60000,0,0,0,10000,0,10,700,0,0
AXIS,0,AMH-SBDH1-1伺服移栽,AMH_SBDH1_1_Axis,7,HC,,20000,0,0,0,40000,0,10,700,0,0
AXIS,0,AMH-SBDH1-2伺服移栽,AMH_SBDH1_2_Axis,8,HC,,60000,0,0,0,10000,0,10,700,0,0
AXIS,0,MI2压紧伺服,MI2_Axis,9,HC,,20000,0,0,0,40000,0,10,700,0,0
AXIS,0,MI1定位伺服,MI1_Rotate_Axis,5,HC,,60000,0,0,0,10000,0,10,700,0,0
AXIS,0,AMH-SBDH3-1伺服移栽,AMH_SBDH3_1_Axis,6,HC,,20000,0,0,0,40000,0,10,700,0,0
AXIS,0,AMH-SBDH3-2伺服移栽,AMH_SBDH3_2_Axis,7,HC,,60000,0,0,0,10000,0,10,700,0,0
AXIS,0,AMH-SBDH1-1伺服移栽,AMH_SBDH1_1_Axis,8,HC,,20000,0,0,0,40000,0,10,700,0,0
AXIS,0,AMH-SBDH1-2伺服移栽,AMH_SBDH1_2_Axis,9,HC,,60000,0,0,0,10000,0,10,700,0,0
AXIS,0,MI2压紧伺服,MI2_Axis,10,HC,,20000,0,0,0,40000,0,10,700,0,0
AXIS,0,MI1定位伺服,MI2_Rotate_Axis,11,HC,,60000,0,0,0,10000,0,10,700,0,0
,,,,,,,,,,,,,,,,
PRO,50,IO信号超时时间(秒),IOSingle_TimerOut,5,,,,,,,,,,,,
PRO,0,气压检测超时,AirCheckSeconds,5,,,,,,,,,,,,
......@@ -222,7 +224,7 @@ DO,0,LS2-1托盘前阻挡下降,Ls_A_Front_Stop,37,LS2,Y37,,,,,,,,,,
DO,0,LS2-1托盘阻挡下降,Ls_A_Stop,38,LS2,Y38,,,,,,,,,,
DO,0,LS2-2顶升上升,Ls_B_Location_Up,39,LS2,Y39,,,,,,,,,,
DO,0,LS2-2顶升下降,Ls_B_Location_Down,40,LS2,Y40,,,,,,,,,,
DO,0,LS2-2托盘前阻挡下降,Ls_B_Stop,41,LS2,Y41,,,,,,,,,,
DO,0,LS2-2托盘前阻挡下降,Ls_B_Front_Stop,41,LS2,Y41,,,,,,,,,,
DO,0,LS2-2托盘缓冲阻挡前进,Ls_B_BufStop_Fwd,42,LS2,Y42,,,,,,,,,,
DO,0,LS2-2托盘缓冲阻挡后退,Ls_B_BufStop_Rwd,43,LS2,Y43,,,,,,,,,,
,,,,,,,,,,,,,,,,
......
设备组,名称,设备类型,RFID-1,RFID-2,伺服轴号,伺服轴号2,地址号-1,地址号-2,设备侧8mm放料点,料仓侧8mm放料点,位置,优先级,高度,宽度
LS1,横移,LS,,,,,11,12,,,,,,
LS2,横移,LS,192.168.103.115,,,,9,15,,,,,,
LS2,横移,LS,192.168.103.115,,,,8,15,,,,,,
LS3,横移,LS,192.168.103.110,192.168.103.106,,,4,19,,,,,,
LS4,横移,LS,,,,,0,1,,,,,,
,,,,,,,,,,,,,,
AMH-MI1,定位,RT,192.168.103.103,,4,4,16,,,345,,,,
AMH-MI2,定位,RT,192.168.103.107,,9,9,20,,,345,,,,
AMH-MI1,定位,RT,192.168.103.103,,4,9,16,,,345,,,,
AMH-MI2,定位,RT,192.168.103.107,,10,11,20,,,345,,,,
,,,,,,,,,,,,,,
AMH-ML5-1,定位,RT,192.168.103.108,,-1,,2,,,,,,,
AMH-ML5-2,定位,RT,192.168.103.109,,-1,,3,,,,,,,
......@@ -16,7 +16,7 @@ AMH-SBSH2,移栽,SISO,192.168.103.116,,0,,10,,123,234,,,,
AMH-SBDH2-1,移栽,SISO,192.168.103.101,,1,,13,,123,234,,,,
AMH-SBDH2-2,移栽,SISO,192.168.103.102,,2,,14,,123,234,,,,
AMH-SBSH1,移栽,SISO,192.168.103.114,,3,,8,,123,234,,,,
AMH-SBDH3-1,移栽,SISO,192.168.103.112,,5,,6,,123,234,,,,
AMH-SBDH3-2,移栽,SISO,192.168.103.113,,6,,7,,123,234,,,,
AMH-SBDH1-1,移栽,SISO,192.168.103.104,,7,,17,,123,234,,,,
AMH-SBDH1-2,移栽,SISO,192.168.103.105,,8,,18,,123,234,,,,
AMH-SBDH3-1,移栽,SISO,192.168.103.112,,6,,6,,123,234,,,,
AMH-SBDH3-2,移栽,SISO,192.168.103.113,,7,,7,,123,234,,,,
AMH-SBDH1-1,移栽,SISO,192.168.103.104,,8,,17,,123,234,,,,
AMH-SBDH1-2,移栽,SISO,192.168.103.105,,9,,18,,123,234,,,,
......@@ -73,6 +73,18 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("MI2_Axis")]
public ConfigMoveAxis MI2_Axis { get; set; }
/// <summary>
/// AXIS,0,MI1定位伺服,MI1_Rotate_Axis,5,HC,,60000,0,0,0,10000,0,10,700,0,0
/// </summary>
[ConfigProAttribute("MI1_Rotate_Axis")]
public ConfigMoveAxis MI1_Rotate_Axis { get; set; }
/// <summary>
/// AXIS,0,MI1定位伺服,MI2_Rotate_Axis,11,HC,,60000,0,0,0,10000,0,10,700,0,0
/// </summary>
[ConfigProAttribute("MI2_Rotate_Axis")]
public ConfigMoveAxis MI2_Rotate_Axis { get; set; }
/// <summary>
/// PRO,50,IO信号超时时间(秒),IOSingle_TimerOut,5,,,,,,,,,,,,
......
using CodeLibrary;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
[Serializable]
public class RemoteLoad
{
public string Action;
public int Seq;
public string GroupName;
public RequestLoadInfo RequestLoadInfo;
}
[Serializable]
public class RequestLoadInfo
{
public string DeviceGroupName;
public string TrayType;
public bool IsEmpty;
public ReelParam LoadParam;
//public DoorStatusE DoorStatus;
[Newtonsoft.Json.JsonIgnore]
public TrayTypeE GetTrayType
{
get
{
try
{
return (TrayTypeE)Enum.Parse(typeof(TrayTypeE), TrayType);
}
catch {
return TrayTypeE.None;
}
}
}
}
public enum RobotStatusE
{
INROBOT, BOXDOOR, FINISHED
}
public enum TrayTypeE
{
None,
MTP1, //流水线治具托盘
MTP2, //流水线料盘托盘
S007, //料串
M03, //Tray料格
M02, //PCB料格
M01, //PizzaBOX料格
M04, //ShoeBOX料格
}
[Serializable]
public class ReelParam
{
/// <summary>
/// 创建新出入库信息
/// </summary>
/// <param name="wareNo">二维码内容</param>
/// <param name="platew">宽度</param>
/// <param name="plateh">高度</param>
/// <param name="IsNg">是否是入库NG料</param>
/// <param name="ngMsg">NG消息</param>
public ReelParam(string wareNo = "", int platew = 0, int plateh = 0, bool _IsNg = false, string ngMsg = "")
{
WareCode = wareNo;
PlateW = platew;
PlateH = plateh;
IsNg = _IsNg;
NgMsg = ngMsg;
}
/// <summary>
/// 物品二维码信息
/// </summary>
public string WareCode { get; set; }
/// <summary>
/// 库位号
/// </summary>
public string PosID { get; set; }
public string bitmapfilename = "";
public List<CodeInfo> codeInfos { get; set; }
/// <summary>
/// 料盘高度
/// </summary>
public int PlateH { get; set; }
/// <summary>
/// 料盘宽度
/// </summary>
public int PlateW { get; set; }
/// <summary>
/// 是否是入料NG料
/// </summary>
public bool IsNg = false;
/// <summary>
/// 入料NG消息
/// </summary>
public string NgMsg = "";
/// <summary>
/// 物料编码
/// </summary>
public string PN { get; set; }
/// <summary>
/// 数量
/// </summary>
public int QTY { get; set; } = 0;
/// <summary>
/// 厂家代码
/// </summary>
public string FC { get; set; }
/// <summary>
/// 唯一序列号
/// </summary>
public string RI { get; set; }
/// <summary>
/// 批次号
/// </summary>
public string Batch { get; set; }
public string cid { get; set; }
public bool ReelOnFixture { get; set; } = false;
public int HeightPos = 0;
public string RFID = "";
public ReelParam clone()
{
ReelParam dstobject;
using (MemoryStream mStream = new MemoryStream())
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(mStream, this);
mStream.Seek(0, SeekOrigin.Begin);//指定当前流的位置为流的开头。
dstobject = (ReelParam)bf.Deserialize(mStream);
mStream.Close();
}
return dstobject;
}
public string ToStr()
{
if (IsNg)
{
return $":{NgMsg}[{WareCode}][{RFID}]";
}
else
{
return $":[{PosID}][{WareCode}][{RFID}] ";
}
}
}
public enum DoorStatusE {
Busy,
Free,
CanInStore,
CanOutStore,
CanInOut,
}
public enum RemoteResult
{
None,
Timeout,
False,
True
}
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("RemoteSheardObject")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RemoteSheardObject")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("49004f82-8aee-46da-bb14-bd02ac990ce2")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using log4net;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
public class RemoteClient
{
public string GroupName;
public string Serveraddr;
WebSocket4Net.WebSocket webSocket;
readonly ILog LOGGER = LogManager.GetLogger("RollingLogFileAppender");
System.Timers.Timer timer;
public RemoteClient( string groupName, string serveraddr)
{
GroupName = groupName;
Serveraddr = serveraddr;
timer = new System.Timers.Timer(2000);
timer.Enabled = false;
timer.AutoReset = true;
timer.Elapsed += Timer_Elapsed;
webSocket = new WebSocket4Net.WebSocket(Serveraddr + GroupName);
LOGGER.Info("webSocket:" + serveraddr + GroupName);
webSocket.MessageReceived += WebSocket_MessageReceived;
webSocket.Closed += WebSocket_Closed;
webSocket.Opened += WebSocket_Opened;
//webSocket.AutoSendPingInterval = 2;
//webSocket.EnableAutoSendPing = true;
LOGGER.Info("webSocket open");
webSocket.Open();
timer.Start();
}
private void WebSocket_Opened(object sender, EventArgs e)
{
LOGGER.Info($"Remote:{GroupName} 连接成功");
LastState = webSocket.State;
}
private void WebSocket_Closed(object sender, EventArgs e)
{
if (LastState != webSocket.State)
{
LOGGER.Info($"Remote:{GroupName} 掉线了");
}
LastState = webSocket.State;
}
WebSocket4Net.WebSocketState LastState = WebSocket4Net.WebSocketState.None;
public bool IsOnline { get => webSocket.State == WebSocket4Net.WebSocketState.Open; }
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
{
if (webSocket.State == WebSocket4Net.WebSocketState.Closed)
{
try
{
LOGGER.Info($"Remote:{GroupName} 重新连接");
//webSocket.Close();
//webSocket.Dispose();
//webSocket = new WebSocket4Net.WebSocket(Serveraddr + GroupName);
//LOGGER.Info("webSocket:" + Serveraddr + GroupName);
//webSocket.MessageReceived += WebSocket_MessageReceived;
//webSocket.Closed += WebSocket_Closed;
//webSocket.Opened += WebSocket_Opened;
webSocket.Open();
}
catch { }
}
}
volatile RemoteResult lastresult = RemoteResult.None;
private void WebSocket_MessageReceived(object sender, WebSocket4Net.MessageReceivedEventArgs e)
{
bool isok = false;
lastresult = RemoteResult.None;
RemoteLoad remoteLoad;
try
{
remoteLoad = JsonConvert.DeserializeObject<RemoteLoad>(e.Message);
}
catch
{
LOGGER.Info("Cant Deserialize remote command:" + e.Message);
return;
}
switch (remoteLoad.Action)
{
case "OK":
case "FAIL":
lastresult = remoteLoad.Action == "OK" ? RemoteResult.True : RemoteResult.False;
LOGGER.Info("Revice Command Callback" + remoteLoad.GroupName + "-" + remoteLoad.Action);
return;
default:
if (actionlist.ContainsKey(remoteLoad.Action)) {
isok= actionlist[remoteLoad.Action].Invoke(remoteLoad.RequestLoadInfo);
}
else
LOGGER.Info("unknow remote command:" + remoteLoad.Action);
break;
}
SendResult(isok);
}
Dictionary<string, Func<RequestLoadInfo, bool>> actionlist = new Dictionary<string, Func<RequestLoadInfo, bool>>();
public void AddAction(string actionName, Func<RequestLoadInfo, bool> action)
{
actionlist[actionName] = action;
}
RemoteResult WaitResult(int waittime=3000)
{
while (lastresult == RemoteResult.None && waittime > 0)
{
System.Threading.Thread.Sleep(50);
waittime = waittime - 50;
}
if (lastresult == RemoteResult.None)
{
LOGGER.Info("等待远程反馈超时");
lastresult = RemoteResult.Timeout;
}
return lastresult;
}
public RemoteResult SendAndWait(RemoteLoad remoteLoad, int waittime= 3000) {
remoteLoad.GroupName = GroupName;
if (remoteLoad.RequestLoadInfo != null)
{
if (string.IsNullOrEmpty(remoteLoad.RequestLoadInfo.DeviceGroupName))
remoteLoad.RequestLoadInfo.DeviceGroupName = GroupName;
}
webSocket.Send(JsonConvert.SerializeObject(remoteLoad));
return WaitResult(waittime);
}
void SendResult(bool result)
{
RemoteLoad remoteLoad = new RemoteLoad();
remoteLoad.Action = result ? "OK" : "FAIL";
remoteLoad.GroupName = GroupName;
webSocket.Send(JsonConvert.SerializeObject(remoteLoad));
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{49004F82-8AEE-46DA-BB14-BD02AC990CE2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RemoteSheardObject</RootNamespace>
<AssemblyName>RemoteSheardObject</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="CodeLibrary">
<HintPath>..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SuperSocket.ClientEngine, Version=0.10.0.0, Culture=neutral, PublicKeyToken=ee9af13f57f00acc, processorArchitecture=MSIL">
<HintPath>..\packages\SuperSocket.ClientEngine.Core.0.10.0\lib\net45\SuperSocket.ClientEngine.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections.Specialized, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Specialized.4.3.0\lib\net46\System.Collections.Specialized.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Net.NameResolution, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.NameResolution.4.3.0\lib\net46\System.Net.NameResolution.dll</HintPath>
</Reference>
<Reference Include="System.Net.Security, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Security.4.3.0\lib\net46\System.Net.Security.dll</HintPath>
</Reference>
<Reference Include="System.Net.Sockets, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WebSocket4Net, Version=0.15.2.11, Culture=neutral, PublicKeyToken=eb4e154b696bf72a, processorArchitecture=MSIL">
<HintPath>..\packages\WebSocket4Net.0.15.2\lib\net45\WebSocket4Net.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RemoteClient.cs" />
<Compile Include="SLog.cs" />
<Compile Include="StoreCID.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class SRec
{
static readonly ILog LOGGER = LogManager.GetLogger("SLog");
public SRec() { }
static string lastmsg = "";
public static void info(params string[] logtxts) {
var msg = string.Join("\t", logtxts);
if (msg == lastmsg)
return;
LOGGER.Info(msg);
lastmsg = msg;
}
public static void error(params string[] logtxts)
{
var msg = string.Join("\t", logtxts);
if (msg == lastmsg)
return;
LOGGER.Error(msg);
lastmsg = msg;
}
}
\ No newline at end of file

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class StoreCID
{
/// <summary>
/// 治具出入库口
/// </summary>
public const string AMH_ML5_1 = "AMH-ML5-1";
/// <summary>
/// 料串出入库口
/// </summary>
public const string AMH_ML5_2 = "AMH-ML5-2";
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
<package id="SuperSocket.ClientEngine.Core" version="0.10.0" targetFramework="net461" />
<package id="System.Collections.Specialized" version="4.3.0" targetFramework="net461" />
<package id="System.Linq" version="4.3.0" targetFramework="net461" />
<package id="System.Net.NameResolution" version="4.3.0" targetFramework="net461" />
<package id="System.Net.Security" version="4.3.0" targetFramework="net461" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net461" />
<package id="System.Threading" version="4.3.0" targetFramework="net461" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net461" />
<package id="WebSocket4Net" version="0.15.2" targetFramework="net461" />
</packages>
\ No newline at end of file
......@@ -29,6 +29,16 @@
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="SLog" type="log4net.Appender.RollingFileAppender">
<file value="logs/SLog.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="LngResource" type="log4net.Appender.RollingFileAppender">
<file value="logs/LngResource.log"/>
<param name="Encoding" value="UTF-8"/>
......@@ -51,6 +61,10 @@
<level value="ALL"/>
<appender-ref ref="LngResource"/>
</logger>
<logger name="SLog" additivity="false">
<level value="ALL"/>
<appender-ref ref="SLog"/>
</logger>
<!--<root>
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
......
......@@ -58,7 +58,7 @@ namespace TheMachine
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(594, 489);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "信息";
this.tabPage2.Text = "状态";
this.tabPage2.UseVisualStyleBackColor = true;
//
// groupBox1
......
......@@ -30,12 +30,18 @@ namespace TheMachine
List<T1> hYControls = new List<T1>();
List<MoveInfo> MoveInfos = new List<MoveInfo>();
public string DeviceName = "";
public void Init(string devicegroup) {
public void Init(string devicegroup,string prefixfilter="") {
//tabControl1.TabPages.Clear();
foreach (var dg in RobotManage.DeviceGroup.Values) {
if (dg.DeviceType != devicegroup)
continue;
if (!string.IsNullOrEmpty(prefixfilter))
{
if (!dg.GroupName.StartsWith(prefixfilter))
continue;
}
if (string.IsNullOrEmpty(DeviceName))
DeviceName = dg.Name;
......
......@@ -65,7 +65,9 @@ namespace TheMachine
TrayManagerControl tmc = new TrayManagerControl();
DeviceControl<HYControl> hy = new DeviceControl<HYControl>();
DeviceControl<TransplantControl> yz = new DeviceControl<TransplantControl>();
DeviceControl<TrayStopControl> ts = new DeviceControl<TrayStopControl>();
DeviceControl<TrayStopControl> ml = new DeviceControl<TrayStopControl>();
DeviceControl<TrayStopControl> mi = new DeviceControl<TrayStopControl>();
DeviceControl<TrayStopControl> ci = new DeviceControl<TrayStopControl>();
AxisControl ac = new AxisControl();
SettingControl sc = new SettingControl();
......@@ -105,17 +107,13 @@ namespace TheMachine
listView1.Columns.Add(timecol);
listView1.Columns.Add(devicecol);
listView1.Columns.Add(msgcol);
listView1.ColumnWidthChanging += listView_ColumnWidthChanging;
//listView1.ColumnWidthChanging += listView_ColumnWidthChanging;
#endregion
LogUtil.info("开始初始化");
cb_EnableBuzzer.Checked = Setting_Init.Device_EnableBuzzer;
AlarmBuzzer.BuzzerStateChange += AlarmBuzzer_BuzzerStateChange;
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
//if (!Setting_Init.Device_DisableLogWindow)
// AddForm("tab_log", crc.GetString(L.tab_log, "日志"), lc);
RobotManage.UserPauseSet += RobotManage_UserPauseSet;
......@@ -148,12 +146,14 @@ namespace TheMachine
}
const int tabpagecount = 5;
void addTablePage() {
AddForm("tab_io","I/O", ioc);
AddForm("tab_io","MT", ioc);
AddForm("tab_tmc",crc.GetString("Form1_tabc_tab_tmc_Text","托盘"), tmc);
AddForm("tab_sidemove", hy.DeviceName, hy);
AddForm("tab_transmove", yz.DeviceName, yz);
AddForm("tab_traystop", ts.DeviceName, ts);
AddForm("tab_setting", crc.GetString("Form1_tabc_tab_setting_Text","相关设置"), sc);
AddForm("tab_traystopML", "ML", ml);
AddForm("tab_traystopMI", "MI", mi);
AddForm("tab_traystopCI", "CI", ci);
AddForm("tab_traysetting", crc.GetString("Form1_tabc_tab_setting__SettingControl_tabControl1_tabPage1_Text","治具设置"), sc);
crc.LanguageProcess(this);
}
......@@ -241,7 +241,6 @@ namespace TheMachine
return;
}
pnl.Enabled = true;
if (state)
{
......@@ -250,10 +249,11 @@ namespace TheMachine
MsgService.ShowMsg += MsgService_ShowMsg;
}
hy.Init("LS");
yz.Init("SISO");
ts.Init("RT");
ml.Init("RT", "AMH-ML");
mi.Init("RT", "AMH-MI");
ci.Init("RT", "CI");
ioc.Config = RobotManage.Config;
tmc.Config = RobotManage.Config;
addTablePage();
......@@ -398,15 +398,14 @@ namespace TheMachine
if (e)
{
userpause = true;
(btn_run as Button).Text = crc.GetString("Res0203","恢复运行");
(btn_run as Button).BackColor = Color.LightGreen;
(btn_run as ToolStripMenuItem).Text = crc.GetString("Res0203","恢复运行");
(btn_run as ToolStripMenuItem).BackColor = Color.LightGreen;
}
else
{
userpause = false;
(btn_run as Button).Text = crc.GetString("Res0204","暂停运行");
(btn_run as Button).BackColor = Color.Yellow;
(btn_run as ToolStripMenuItem).Text = crc.GetString("Res0204","暂停运行");
(btn_run as ToolStripMenuItem).BackColor = Color.Yellow;
}
......@@ -522,9 +521,9 @@ namespace TheMachine
if (RobotManage.isRunning)
{
if (userpause)
(btn_run as Button).Text = crc.GetString("Res0203","恢复运行");
(btn_run as ToolStripMenuItem).Text = crc.GetString("Res0203","恢复运行");
else
(btn_run as Button).Text = crc.GetString("Res0204","暂停运行");
(btn_run as ToolStripMenuItem).Text = crc.GetString("Res0204","暂停运行");
}
}
......@@ -539,5 +538,18 @@ namespace TheMachine
Setting_Init.Device_Default_Language = "en-US";
crc.LanguageChange();
}
private void button1_Click(object sender, EventArgs e)
{
RequestLoadInfo requestLoadInfo = new RequestLoadInfo();
requestLoadInfo.DeviceGroupName = "AMH-SBDH1-1";
requestLoadInfo.IsEmpty = false;
requestLoadInfo.TrayType = "MTP1";
requestLoadInfo.LoadParam = new ReelParam();
requestLoadInfo.LoadParam.WareCode = "C001-0002";
requestLoadInfo.LoadParam.PosID = "SO1053S05_4_3_1";
requestLoadInfo.LoadParam.PlateH = 70;
TrayManager.SetTrayLoadInfo("MTP1-0012", requestLoadInfo);
}
}
}
\ No newline at end of file
此文件类型无法预览
......@@ -35,13 +35,12 @@ namespace TheMachine
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage_set = new System.Windows.Forms.TabPage();
this.tabPage_ledtower = new System.Windows.Forms.TabPage();
this.uC_LedConfig1 = new TheMachine.UC.UC_LedConfig();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.fixtureSizeConfigControl1 = new DeviceLibrary.FixtureSizeConfigControl();
this.uC_LedConfig1 = new TheMachine.UC.UC_LedConfig();
this.tabControl1.SuspendLayout();
this.tabPage_set.SuspendLayout();
this.tabPage_ledtower.SuspendLayout();
this.tabPage1.SuspendLayout();
this.SuspendLayout();
//
// chbAutoRun
......@@ -50,7 +49,7 @@ namespace TheMachine
this.chbAutoRun.Location = new System.Drawing.Point(24, 29);
this.chbAutoRun.Margin = new System.Windows.Forms.Padding(10);
this.chbAutoRun.Name = "chbAutoRun";
this.chbAutoRun.Size = new System.Drawing.Size(84, 16);
this.chbAutoRun.Size = new System.Drawing.Size(96, 18);
this.chbAutoRun.TabIndex = 1;
this.chbAutoRun.Text = "开机自启动";
this.chbAutoRun.UseVisualStyleBackColor = true;
......@@ -65,20 +64,20 @@ namespace TheMachine
this.tabControl1.Controls.Add(this.tabPage_set);
this.tabControl1.Controls.Add(this.tabPage_ledtower);
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Location = new System.Drawing.Point(840, 152);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1024, 740);
this.tabControl1.TabIndex = 8;
this.tabControl1.Visible = false;
//
// tabPage_set
//
this.tabPage_set.Controls.Add(this.chbAutoRun);
this.tabPage_set.Location = new System.Drawing.Point(4, 22);
this.tabPage_set.Location = new System.Drawing.Point(4, 24);
this.tabPage_set.Name = "tabPage_set";
this.tabPage_set.Padding = new System.Windows.Forms.Padding(3);
this.tabPage_set.Size = new System.Drawing.Size(1016, 714);
this.tabPage_set.Size = new System.Drawing.Size(1016, 712);
this.tabPage_set.TabIndex = 0;
this.tabPage_set.Text = "常规设置";
this.tabPage_set.UseVisualStyleBackColor = true;
......@@ -94,9 +93,17 @@ namespace TheMachine
this.tabPage_ledtower.Text = "灯塔设置";
this.tabPage_ledtower.UseVisualStyleBackColor = true;
//
// uC_LedConfig1
//
this.uC_LedConfig1.Config = null;
this.uC_LedConfig1.Location = new System.Drawing.Point(6, 6);
this.uC_LedConfig1.Name = "uC_LedConfig1";
this.uC_LedConfig1.Size = new System.Drawing.Size(859, 498);
this.uC_LedConfig1.TabIndex = 0;
this.uC_LedConfig1.Tag = "not";
//
// tabPage1
//
this.tabPage1.Controls.Add(this.fixtureSizeConfigControl1);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
......@@ -107,24 +114,17 @@ namespace TheMachine
//
// fixtureSizeConfigControl1
//
this.fixtureSizeConfigControl1.Location = new System.Drawing.Point(6, 6);
this.fixtureSizeConfigControl1.Location = new System.Drawing.Point(0, 3);
this.fixtureSizeConfigControl1.Name = "fixtureSizeConfigControl1";
this.fixtureSizeConfigControl1.Size = new System.Drawing.Size(602, 489);
this.fixtureSizeConfigControl1.Size = new System.Drawing.Size(623, 591);
this.fixtureSizeConfigControl1.TabIndex = 0;
//
// uC_LedConfig1
//
this.uC_LedConfig1.Config = null;
this.uC_LedConfig1.Location = new System.Drawing.Point(6, 6);
this.uC_LedConfig1.Name = "uC_LedConfig1";
this.uC_LedConfig1.Size = new System.Drawing.Size(859, 498);
this.uC_LedConfig1.TabIndex = 0;
this.uC_LedConfig1.Tag = "not";
//
// SettingControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.fixtureSizeConfigControl1);
this.Controls.Add(this.tabControl1);
this.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "SettingControl";
this.Size = new System.Drawing.Size(1024, 740);
this.Load += new System.EventHandler(this.SettingControl_Load);
......@@ -132,7 +132,6 @@ namespace TheMachine
this.tabPage_set.ResumeLayout(false);
this.tabPage_set.PerformLayout();
this.tabPage_ledtower.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.ResumeLayout(false);
}
......
......@@ -35,7 +35,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
<ApplicationIcon>MT.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
......@@ -261,9 +261,14 @@
<Project>{064bebf5-8faa-4ea2-a5f3-a06e6e7d9251}</Project>
<Name>LoadCSVLibrary</Name>
</ProjectReference>
<ProjectReference Include="..\RemoteSheardObject\RemoteSheardObject.csproj">
<Project>{49004F82-8AEE-46DA-BB14-BD02AC990CE2}</Project>
<Name>RemoteSheardObject</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="icon.ico" />
<Content Include="MT.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
......
......@@ -33,6 +33,7 @@ namespace TheMachine
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.listView1 = new TheMachine.DoubleBufferListView();
this.label_Statistics = new System.Windows.Forms.Label();
this.ListView2 = new TheMachine.DoubleBufferListView();
this.SuspendLayout();
//
// timer1
......@@ -42,32 +43,40 @@ namespace TheMachine
//
// listView1
//
this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.listView1.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(0, 0);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(574, 446);
this.listView1.Size = new System.Drawing.Size(671, 355);
this.listView1.TabIndex = 0;
this.listView1.UseCompatibleStateImageBehavior = false;
//
// label_Statistics
//
this.label_Statistics.AutoSize = true;
this.label_Statistics.Location = new System.Drawing.Point(629, 16);
this.label_Statistics.Location = new System.Drawing.Point(754, 18);
this.label_Statistics.Name = "label_Statistics";
this.label_Statistics.Size = new System.Drawing.Size(56, 16);
this.label_Statistics.TabIndex = 1;
this.label_Statistics.Text = "label1";
//
// ListView2
//
this.ListView2.HideSelection = false;
this.ListView2.Location = new System.Drawing.Point(0, 379);
this.ListView2.Name = "ListView2";
this.ListView2.Size = new System.Drawing.Size(671, 244);
this.ListView2.TabIndex = 0;
this.ListView2.UseCompatibleStateImageBehavior = false;
//
// TrayManagerControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.label_Statistics);
this.Controls.Add(this.ListView2);
this.Controls.Add(this.listView1);
this.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "TrayManagerControl";
this.Size = new System.Drawing.Size(846, 449);
this.Size = new System.Drawing.Size(1007, 642);
this.Load += new System.EventHandler(this.TrayManagerControl_Load);
this.ResumeLayout(false);
this.PerformLayout();
......@@ -79,5 +88,6 @@ namespace TheMachine
private DoubleBufferListView listView1;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label label_Statistics;
private DoubleBufferListView ListView2;
}
}
......@@ -28,6 +28,12 @@ namespace TheMachine
public TrayManagerControl()
{
InitializeComponent();
crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
}
private void Crc_LanguageChangeEvent(object sender, EventArgs e)
{
Init();
}
private void TrayManagerControl_Load(object sender, EventArgs e)
......@@ -35,20 +41,43 @@ namespace TheMachine
}
void Init() {
timer1.Stop();
#region listview初始化
var ColList = new string[] { "RFID", crc.GetString("Res0019", "上次地址"), crc.GetString("Res0020", "更新时间"), crc.GetString("Res0021", "托盘类型"), crc.GetString("Res0022", "载荷"), crc.GetString("Res0023", "目的地") };
listView1.Columns.Clear();
var ColList = new string[] { "RFID", crc.GetString("Res0019", "上次地址"), crc.GetString("Res0020", "更新时间"), crc.GetString("Res0021", "托盘类型"), crc.GetString("Res0022", "载荷"), crc.GetString("Res0023", "目的地"),"ID" };
listView1.View = View.Details;
foreach (var coltxt in ColList)
{
ColumnHeader col1 = new ColumnHeader();
col1.Text = coltxt;
col1.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
col1.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
col1.Width = 100;
listView1.Columns.Add(col1);
}
listView1.ColumnClick += ListView1_ColumnClick;
#endregion
#region listview2初始化
ListView2.Columns.Clear();
var ColList2 = new string[] { "设备", crc.GetString("Res0021", "托盘类型"), "备注" };
ListView2.View = View.Details;
foreach (var coltxt in ColList2)
{
ColumnHeader col1 = new ColumnHeader();
col1.Text = coltxt;
col1.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
col1.Width = 100;
ListView2.Columns.Add(col1);
}
//ListView2.ColumnClick += ListView1_ColumnClick;
#endregion
timer1.Start();
}
int sortCol = 0;
private void ListView1_ColumnClick(object sender, ColumnClickEventArgs e)
{
sortCol = e.Column;
}
private void timer1_Tick(object sender, EventArgs e)
{
......@@ -56,6 +85,28 @@ namespace TheMachine
return;
var traylist = TrayManager.Traylist.Values.ToList();
traylist.Sort((a, b) => {
switch (sortCol)
{
case 0:
return string.Compare(a.RFID, b.RFID);
case 1:
return a.LastAddr- b.LastAddr;
case 2:
return (int)(a.LastUpdateTime-b.LastUpdateTime).TotalSeconds;
case 3:
return string.Compare(a.LoadType.ToString(), b.LoadType.ToString());
case 4:
return string.Compare(a.LoadType.ToString(), b.LoadType.ToString());
case 5:
return a.DestinationAddr- b.DestinationAddr;
default:
return string.Compare(a.RFID, b.RFID);
}
});
listView1.Items.Clear();
foreach (var ti in traylist) {
var timego = (DateTime.Now - ti.LastUpdateTime);
var lasttime = timego.Seconds + crc.GetString("Res0024","秒前");
......@@ -64,24 +115,44 @@ namespace TheMachine
if (timego.Hours > 0)
lasttime = timego.Hours + crc.GetString("Res0026","时 ") + lasttime;
var traydesc = TrayManager.TrayTypeDesc[ti.TrayType];
var loaddesc = TrayManager.LoadTypeDesc[ti.LoadType];
var loaddesc = TrayManager.TrayTypeDesc[ti.LoadType];
var lastaddrdesc = TrayManager.AddrDesc[ti.LastAddr];
var toaddrdesc = TrayManager.AddrDesc[ti.DestinationAddr];
var items = new string[] { ti.RFID, lastaddrdesc.ToString(), lasttime, traydesc, loaddesc, toaddrdesc };
var reelid = "";
reelid = ti.TrayParam?.WareCode;
var items = new string[] {lastaddrdesc.ToString(), lasttime, traydesc, loaddesc, toaddrdesc, reelid };
var listviewitem = new ListViewItem();
if (timego.TotalSeconds < 10)
listviewitem.BackColor = Color.DarkGreen;
if (timego.TotalSeconds < 15)
listviewitem.ForeColor = Color.DarkGreen;
else if (timego.TotalSeconds > 30)
listviewitem.BackColor = Color.DarkGray;
listviewitem.ForeColor = Color.DarkGray;
else
listviewitem.BackColor = Color.Black;
listviewitem.ForeColor = Color.Black;
listviewitem.UseItemStyleForSubItems = true;
listviewitem.Text = ti.RFID;
listviewitem.SubItems.AddRange(items);
listView1.Items.Add(listviewitem);
}
ListView2.Items.Clear();
foreach (var tivk in TrayManager.TrayRequest.ToArray())
{
var ti = tivk.Value;
var traydesc = TrayManager.TrayTypeDesc[ti.GetTrayType];
var desc = ti.IsEmpty ? "空托盘" :"";
var items = new string[] { traydesc, desc };
var listviewitem = new ListViewItem();
listviewitem.UseItemStyleForSubItems = true;
listviewitem.Text = tivk.Key;
listviewitem.SubItems.AddRange(items);
ListView2.Items.Add(listviewitem);
}
TrayManager.Statistics();
//listView1.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.ColumnContent);
label_Statistics.Text = crc.GetString("Res0027","托盘统计")+":" + "\n"
+ crc.GetString("Res0028","离线总数") + ": " + TrayManager.OfflineCount + "\n"
+ crc.GetString("Res0029","在线总数") + ": " + TrayManager.TotalCount + "\n"
+ crc.GetString("Res0029","在线总数") + ": " + (TrayManager.TotalCount- TrayManager.OfflineCount) + "\n"
+ crc.GetString("Res0030","空托盘") + ": " + TrayManager.EmptyCount + "\n"
+ crc.GetString("Res0031","入库托盘") + ": " + TrayManager.InStoreCount + "\n"
+ crc.GetString("Res0032","出库托盘") + ": " + TrayManager.OutStoreCount + "\n";
......
......@@ -43,7 +43,8 @@ namespace TheMachine
{
if (Config == null)
return;
LoadPosList();
crc.LanguageProcess(this);LoadPosList();
}
void LoadPosList()
......
......@@ -193,7 +193,7 @@ namespace TheMachine
private ConfigIO GetSelectDO()
{
string text = cmbWriteIO.SelectedValue.ToString();
if (Config.DOList.ContainsKey(text))
if (Config.DOList[DeviceKey].ContainsKey(text))
{
ConfigIO io = Config.DOList[DeviceKey][text];
return io;
......
using DeviceLibrary;
using OnlineStore;
using System;
using System.Collections.Generic;
......@@ -28,7 +29,8 @@ namespace TheMachine.UC
private void button_read_Click(object sender, EventArgs e)
{
if (rFID_C2S1.ReadByte(0x20, 16, out byte[] data)) {
textBox_rfidlabel.Text = Encoding.ASCII.GetString(data).Trim();
var rfid = Common.RfidFilter(data);
textBox_rfidlabel.Text = rfid;
} else {
textBox_rfidlabel.Text = crc.GetString("Res0033","读取失败");
}
......
......@@ -85,7 +85,7 @@ namespace TheMachine
this.button_p2.Name = "button_p2";
this.button_p2.Size = new System.Drawing.Size(162, 23);
this.button_p2.TabIndex = 9;
this.button_p2.Text = "移栽流水线放料点P2-8mm";
this.button_p2.Text = "移栽流水线放料点P2-70mm";
this.button_p2.UseVisualStyleBackColor = true;
this.button_p2.Click += new System.EventHandler(this.button_p2_Click);
//
......@@ -95,7 +95,7 @@ namespace TheMachine
this.button_p3.Name = "button_p3";
this.button_p3.Size = new System.Drawing.Size(162, 23);
this.button_p3.TabIndex = 9;
this.button_p3.Text = "移栽料仓放料点P3-8mm";
this.button_p3.Text = "移栽料仓放料点P3-70mm";
this.button_p3.UseVisualStyleBackColor = true;
this.button_p3.Click += new System.EventHandler(this.button_p3_Click);
//
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!