Commit 291289f0 刘韬

完成mi对接

1 个父辈 fe9ba0cd
正在显示 41 个修改的文件 包含 1144 行增加189 行删除
......@@ -21,6 +21,8 @@ namespace OnlineStore.Common
[MyConfigComment("服务器地址")]
public static MyConfig<string> Device_Server_Address = "http://192.168.1.243/smf-core";
[MyConfigComment("Mycronic料仓服务器IP")]
public static MyConfig<string> Device_StoreServerURL = "http://192.168.160.29:8585/RtTower.WebService/";
[MyConfigComment("设备界面语言")]
public static MyConfig<string> Device_Default_Language = "zh-CN";
......@@ -65,5 +67,8 @@ namespace OnlineStore.Common
public static MyConfig<int> CameraScan_QRCodeCount = 3;
[MyConfigComment("二维码扫码超时毫秒")]
public static MyConfig<int> CameraScan_CodeTimeOut = 3000;
public static MyConfig<string> Runtime_OutStoreReelInfo;
}
}
......@@ -204,6 +204,7 @@ namespace OnlineStore.Common
/// 库位 ID
/// </summary>
public static string posId = "posId";
public static string cid = "cid";
/// <summary>
/// 料盘宽
/// </summary>
......
......@@ -30,7 +30,7 @@ namespace OnlineStore.Common
return;
}
log.Info(msg);
AddToBox(msg, Color.Black);
//AddToBox(msg, Color.Black);
}
public static void info(ILog log, string msg, Color color)
{
......
......@@ -68,9 +68,23 @@
<Reference Include="Robot.UR">
<HintPath>..\..\..\DllLibrary\第三方\URRobot\Robot.UR\Robot.UR\bin\Debug\Robot.UR.dll</HintPath>
</Reference>
<Reference Include="RtTower.WebService.ComTowerApp.Contract, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\MydataWcfServiceTest\RtTowerClientService\bin\Debug\RtTower.WebService.ComTowerApp.Contract.dll</HintPath>
</Reference>
<Reference Include="RtTower.WebService.SharedModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Reference Include="RtTower.WebService.SharedService, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\MydataWcfServiceTest\RtTowerClientService\bin\Debug\RtTower.WebService.SharedService.dll</HintPath>
</Reference>
<Reference Include="RtTowerClientService">
<HintPath>..\..\MydataWcfServiceTest\RtTowerClientService\bin\Debug\RtTowerClientService.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
</Reference>
......@@ -141,6 +155,14 @@
<Compile Include="userControl\FixtureSizeConfigControl.Designer.cs">
<DependentUpon>FixtureSizeConfigControl.cs</DependentUpon>
</Compile>
<Compile Include="VirtuallyStore\CommandList.cs" />
<Compile Include="VirtuallyStore\Reference.cs" />
<Compile Include="VirtuallyStore\VMsg.cs" />
<Compile Include="VirtuallyStore\VServerComm.cs" />
<Compile Include="VirtuallyStore\TowerList.cs" />
<Compile Include="VirtuallyStore\VLog.cs" />
<Compile Include="VirtuallyStore\VStoreCollection.cs" />
<Compile Include="VirtuallyStore\VStore.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="userControl\AxisMoveControl.resx">
......
......@@ -34,25 +34,48 @@ namespace DeviceLibrary
List.Add(deviceGroupName, new List<AxisBean>());
List[deviceGroupName].Add(this);
}
int openretry=0;
public bool Open(bool isCheck, out string Msg)
{
Msg = "";
string portName = Config.DeviceName;
short slvAddr = Config.GetAxisValue();
AxisManager.AlarmClear(portName, slvAddr);
Thread.Sleep(50);
AxisManager.ServoOn(portName, slvAddr);
Thread.Sleep(50);
//打开所有轴
if (isCheck)
if (AxisManager.IsServeoOn(portName, slvAddr))
{ openretry = 0; return true; }
openretry++;
{
if (!OpenAxis(out Msg))
Msg += string.Format("第{0}次尝试打开轴:{1}", openretry, Config.Explain);
if (AxisManager.GetBusyStatus(portName, slvAddr) == 1)
{
return false;
AxisManager.SuddenStop(portName, slvAddr);
Msg += string.Format("...伺服忙碌,急停{0}次", openretry);
Thread.Sleep(100);
}
//if (AxisManager.GetAlarmStatus(portName, slvAddr) != 0)
//{
// AxisManager.AlarmClear(portName, slvAddr);
// Msg += string.Format("...尝试清除报警第(0)次", openretry);
// Thread.Sleep(100);
//}
AxisManager.ServoOn(portName, slvAddr);
Thread.Sleep(200);
if (AxisManager.IsServeoOn(portName, slvAddr))
{
Msg += "...使能成功";
openretry = 0;
return true;
}
else
Msg += "...尝试使能失败";
Thread.Sleep(1000);
if (openretry < 5)
Msg = "伺服连接中...";
}
return true;
return false;
}
/// <summary>
/// 打开所有轴
......@@ -392,10 +415,9 @@ namespace DeviceLibrary
foreach (AxisBean axis in axisArray)
{
bool result = axis.Open(false, out msg);
if (!result || (!String.IsNullOrEmpty(msg)))
if (!result)
{
//SetWarnMsg(Name + msg);
//Alarm(AlarmType.AxisAlarm);
LogUtil.error(msg);
return false;
}
}
......@@ -418,7 +440,30 @@ namespace DeviceLibrary
Thread.Sleep(10);
}
}
public static bool ClearMultiAlarm(out string msg, List<AxisBean> axisArray)
{
msg = "";
bool isok = true;
foreach (AxisBean axis in axisArray)
{
string portName = axis.Config.DeviceName;
short slvAddr = axis.Config.GetAxisValue();
if (AxisManager.GetAlarmStatus(portName, slvAddr) != 0)
{
AxisManager.AlarmClear(portName, slvAddr);
Thread.Sleep(200);
if (AxisManager.GetAlarmStatus(portName, slvAddr) != 0)
{
msg += string.Format("轴(0)存在报警,清除失败", axis.Config.Explain);
isok = false;
}
else
msg += string.Format("轴(0)存在报警,清除成功", axis.Config.Explain);
}
}
Thread.Sleep(50);
return isok;
}
}
}
......@@ -24,7 +24,7 @@ namespace DeviceLibrary
}
}
static string server = Setting_Init.Device_Server_Address;
static string CID = Setting_Init.Device_CID;
static string CID;
int StoreID = 1;
string StoreName="";
......@@ -32,7 +32,8 @@ namespace DeviceLibrary
private System.Timers.Timer serverConnectTimer = new System.Timers.Timer();
object serverclock = new object();
public ServerCommunication() {
public ServerCommunication(string cid) {
CID = cid;
serverConnectTimer.Interval = 1000;
serverConnectTimer.AutoReset = true;
serverConnectTimer.Enabled = true;
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
class VCmd
{
public static Dictionary<string, string> wslist = new Dictionary<string, string>();
public static Dictionary<string, string> fslist = new Dictionary<string, string>();
public const string GetTowerInformation =@"<XmlCommand>
<Command>GetTowerInformation</Command>
<Parameter>{0}</Parameter>
</XmlCommand>";
public const string SimulateStartButton = @"<XmlCommand>
<Command>SimulateStartButton</Command>
<Parameter>
<LoadMaterialInformation>
<TowerId>{0}</TowerId>
<Barcode>{1}</Barcode>
</LoadMaterialInformation>
</Parameter>
</XmlCommand>";
public const string ProvideItem = @"<XmlCommand>
<Command>ProvideItem</Command>
<Parameter>
<ProvideItem>
<Object>Carrier</Object>
<Name>{0}</Name>
</ProvideItem>
</Parameter>
</XmlCommand>";
public const string UnloadCarrier = @"<XmlCommand>
<Command>UnloadCarrier</Command>
<Parameter>
<CarrierProvideInformation>
<Name>{0}</Name>
</CarrierProvideInformation>
</Parameter>
</XmlCommand>";
public const string GetCarrierInformation = @"<XmlCommand>
<Command>GetCarrierInformation</Command>
<Parameter>{0}</Parameter>
</XmlCommand>";
static VCmd()
{
wslist.Add("GetTowers", @"<XmlCommand>
<Command>GetTowers</Command>
<Parameter/>
</XmlCommand>");
wslist.Add("GetTowerInformation", @"<XmlCommand>
<Command>GetTowerInformation</Command>
<Parameter>000800</Parameter>
</XmlCommand>");
wslist.Add("GetCarrierList", @"<XmlCommand>
<Command>GetProdSites</Command>
<Parameter/>
</XmlCommand>");
wslist.Add("GetProdSites", @"<XmlCommand>
<Command>GetProdSites</Command>
<Parameter></Parameter>
</XmlCommand>");
wslist.Add("GetArticleList", @"<XmlCommand>
<Command>GetArticleList</Command>
<Parameter/>
</XmlCommand>");
wslist.Add("GetArticleInformation", @"<XmlCommand>
<Command>GetArticleInformation</Command>
<Parameter>0402c</Parameter>
</XmlCommand>");
wslist.Add("NewArticle", @"<XmlCommand>
<Command>NewArticle</Command>
<Parameter>
<ArticleInformation>
<ID>0</ID>
<CreateDate>0001-01-01T00:00:00</CreateDate>
<Article>0502c</Article>
<ANote/>
<Cycles>0</Cycles>
<Stock>0</Stock>
<StockMin>0</StockMin>
<StockMax>0</StockMax>
<StockUsed>0</StockUsed>
<Guessed>false</Guessed>
<StockValue>0</StockValue>
<StockVMax>0</StockVMax>
<ReelCount>0</ReelCount>
<ReelMin>0</ReelMin>
<ReelMax>0</ReelMax>
<ReelsUsed>0</ReelsUsed>
<MSL/>
<MSLWatch>false</MSLWatch>
<ACase/>
<AGroup/>
<Poled>false</Poled>
</ArticleInformation>
</Parameter>
</XmlCommand>");
wslist.Add("GetCarrierInformation", @"<XmlCommand>
<Command>GetCarrierInformation</Command>
<Parameter>0014379599</Parameter>
</XmlCommand>");
wslist.Add("NewCarrier", @"<XmlCommand>
<Command>NewCarrier</Command>
<Parameter>
<CarrierInformation>
<ID>0</ID>
<Carrier>672529346529</Carrier>
<CreateDate>0001-01-01T00:00:00</CreateDate>
<Article>0</Article>
<ArticleName>0402c</ArticleName>
<Depot/>
<DepotDate>0001-01-01T00:00:00</DepotDate>
<Stock>0</Stock>
<StockMin>0</StockMin>
<StockNew>0</StockNew>
<StockUsed>0</StockUsed>
<StockTPSys>0</StockTPSys>
<Guessed>false</Guessed>
<Cycles>0</Cycles>
<Outtime>0</Outtime>
</CarrierInformation>
</Parameter>
</XmlCommand>");
wslist.Add("UnloadCarrier", @"<XmlCommand>
<Command>UnloadCarrier</Command>
<Parameter>
<CarrierProvideInformation>
<Name>A003R0004</Name>
<Demand>1</Demand>
<TaskId></TaskId>
</CarrierProvideInformation>
</Parameter>
</XmlCommand>");
wslist.Add("ProvideItem", @"<XmlCommand>
<Command>ProvideItem</Command>
<Parameter>
<ProvideItem>
<Object>Smartbox</Object>
<Name />
<Parts>0</Parts>
<Units>0</Units>
<Size>9</Size>
</ProvideItem>
</Parameter>
</XmlCommand>");
wslist.Add("SimulateStartButton", @"<XmlCommand>
<Command>SimulateStartButton</Command>
<Parameter>
<LoadMaterialInformation>
<TowerId>000800</TowerId>
<Article></Article>
<Barcode></Barcode>
<TaskId></TaskId>
</LoadMaterialInformation>
</Parameter>
</XmlCommand>");
///=====================================================
fslist.Add("Create a New Component", @"[Order]
Action=NEW
Object=ARTICLE
Name=componentname
[Data]
ARTICLE=Component name
");
fslist.Add("Unload a Carrier", @"[Order]
Action=PROVIDE
Object=CARRIER
Name=carriername
Demand=
Target=");
fslist.Add("Create a New Carrier", @"[Order]
Action=NEW
Object=CARRIER
Name=carriername
[Data]
CARRIER=carriername
ARTICLE=Component
");
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace MydataWcfServiceTest.ServiceReference2 {
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="RtTower", ConfigurationName="ServiceReference2.ITowerAppWS")]
public interface ITowerAppWS {
[System.ServiceModel.OperationContractAttribute(Action="RtTower/ITowerAppWS/WebServiceIsConnected", ReplyAction="RtTower/ITowerAppWS/WebServiceIsConnectedResponse")]
bool WebServiceIsConnected();
[System.ServiceModel.OperationContractAttribute(Action="RtTower/ITowerAppWS/WebServiceIsConnected", ReplyAction="RtTower/ITowerAppWS/WebServiceIsConnectedResponse")]
System.Threading.Tasks.Task<bool> WebServiceIsConnectedAsync();
[System.ServiceModel.OperationContractAttribute(Action="RtTower/ITowerAppWS/XmlAction", ReplyAction="RtTower/ITowerAppWS/XmlActionResponse")]
System.Xml.Linq.XElement XmlAction(string xmlData);
[System.ServiceModel.OperationContractAttribute(Action="RtTower/ITowerAppWS/XmlAction", ReplyAction="RtTower/ITowerAppWS/XmlActionResponse")]
System.Threading.Tasks.Task<System.Xml.Linq.XElement> XmlActionAsync(string xmlData);
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface ITowerAppWSChannel : MydataWcfServiceTest.ServiceReference2.ITowerAppWS, System.ServiceModel.IClientChannel {
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class TowerAppWSClient : System.ServiceModel.ClientBase<MydataWcfServiceTest.ServiceReference2.ITowerAppWS>, MydataWcfServiceTest.ServiceReference2.ITowerAppWS {
public TowerAppWSClient() {
}
public TowerAppWSClient(string endpointConfigurationName) :
base(endpointConfigurationName) {
}
public TowerAppWSClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public TowerAppWSClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public TowerAppWSClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress) {
}
public bool WebServiceIsConnected() {
return base.Channel.WebServiceIsConnected();
}
public System.Threading.Tasks.Task<bool> WebServiceIsConnectedAsync() {
return base.Channel.WebServiceIsConnectedAsync();
}
public System.Xml.Linq.XElement XmlAction(string xmlData) {
return base.Channel.XmlAction(xmlData);
}
public System.Threading.Tasks.Task<System.Xml.Linq.XElement> XmlActionAsync(string xmlData) {
return base.Channel.XmlActionAsync(xmlData);
}
}
}
using Newtonsoft.Json;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class TowerList
{
public static Dictionary<string, TowerInfo> List = new Dictionary<string, TowerInfo>();
static TowerList() {
if (File.Exists("Config\\TowerList.json"))
{
try
{
var tl = File.ReadAllText("Config\\TowerList.json");
List = JsonConvert.DeserializeObject<Dictionary<string, TowerInfo>>(tl);
}
catch (Exception ex)
{
LogUtil.error("启动时美光料仓信息加载失败:" + ex);
}
}
}
public static void SaveTowerInfo()
{
try
{
File.WriteAllText("Config\\TowerList.json", JsonConvert.SerializeObject(List));
}
catch (Exception ex)
{
LogUtil.error("美光料仓信息保存失败:" + ex);
}
}
}
[Serializable]
public class TowerInfo
{
/// <summary>
/// 麦康宁料仓ID
/// </summary>
public string TowerID;
public string TowerName;
public string PosID;
public bool Enable=false;
public string DeviceGroupName;
}
}
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class VLog
{
ILog log;
string Prefix="";
public VLog(string prefix="",string logname= "VStore") {
Prefix = prefix;
log = LogManager.GetLogger(logname);
}
public void Info(string txt) {
if (Prefix != "")
txt =$"[{Prefix}] "+ txt;
log.Info(txt);
}
public void Error(string txt)
{
if (Prefix != "")
txt = $"[{Prefix}] " + txt;
log.Error(txt);
}
}
}
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class VMsg
{
public static List<Msg> msg = new List<Msg>();
public string msgtxt;
public MsgLevel msgLevel;
public ErrInfo errInfo;
public DateTime datetime;
public static List<Msg> get()
{
if (_setlogones)
{
_setlogones = false;
foreach (var m in msg)
LogUtil.info(m.msgtxt);
}
List<Msg> mm = new List<Msg>(msg);
return mm;
}
public static void add(string m, MsgLevel ml, ErrInfo errInfo = ErrInfo.Empty)
{
lock (msg)
{
var fm = msg.Find((x) => x.msgtxt == m);
if (fm == null)
msg.Add(new Msg { msgtxt = m, msgLevel = ml, datetime = DateTime.Now, errInfo = errInfo });
}
}
static bool _setlogones = false;
internal static void setlogones()
{
_setlogones = true;
}
public static void clear()
{
msg.Clear();
}
}
}
using OnlineStore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
namespace DeviceLibrary
{
public class VStore
{
VServerComm ServerCM;
public VLog VLog;
VStoreCollection vc;
MsgService Msg;
/// <summary>
/// 当前料仓终端口的物料reelid
/// </summary>
public string CurrentTerminalReelID
{
get => ConfigHelper.Config.Get("Runtime_Tower_" + CID + "_CurrentTerminalReelID");
set => ConfigHelper.Config.Set("Runtime_Tower_" + CID + "_CurrentTerminalReelID", value);
}
public string CID;
public string TowerName;
public VStore(TowerInfo towerInfo, VStoreCollection storeCollection) {
vc = storeCollection;
CID = towerInfo.TowerID;
TowerName = towerInfo.TowerName;
VLog = new VLog(CID, CID);
ServerCM = new VServerComm(CID,VLog);
ServerCM.OutStoreEvent += ServerCM_OutStoreEvent;
ServerCM.storeStatus = StoreStatus.None;
Msg = new MsgService("RT-"+CID);
OutStoreJobList = new StoreJobList(crc.GetString("Res0050","出库任务"));
}
public void ServerCM_OutStoreEvent(object sender, JobInfo e)
{
VLog.Info(sender+"出库指令信息:" + e.ToStr());
OutStoreJobList.Enqueue(e.Clone());
//MI.DeviceList[TowerList.List[CurrentOutJobInfo.CID].DeviceGroupName].EnqueueOutStore(CurrentOutJobInfo);
vc.BeginOutStore(e.Clone(), VLog);
}
public RTStoreStatus RTStoreStatus = RTStoreStatus.Offline;
internal void VTowerProcess() {
var ti = vc.GetTowerDetailInformation(CID);
if (ti != null)
{
ServerCM.Temperature = ti.Temperature;
ServerCM.Humidity = ti.Humidity * 100;
if (ti.StatusCode == 26)
{
ServerCM.storeStatus = StoreStatus.StoreOnline;
if (RTStoreStatus != RTStoreStatus.LockToInStore)
{
if (RTStoreStatus != RTStoreStatus.Ready)
VLog.Info("料仓已空闲");
RTStoreStatus = RTStoreStatus.Ready;
if (InStoreJobInfo != null)
{
VLog.Info("入库成功:" + InStoreJobInfo.ToStr());
InStoreJobInfo = null;
}
}
else {
Msg.add("料仓为入库锁定状态,请检查舱门口料盘状态", MsgLevel.alarm);
}
}
else if (ti.StatusCode == 1031)
{
ServerCM.storeStatus = StoreStatus.InStoreExecute;
if (RTStoreStatus != RTStoreStatus.InStoreExecute)
VLog.Info("入库执行中");
RTStoreStatus = RTStoreStatus.InStoreExecute;
InStoreJobInfo = null;
}
else if (ti.StatusCode == 1032)
{
if (RTStoreStatus != RTStoreStatus.InStoreReady)
VLog.Info("物料已在舱口");
RTStoreStatus = RTStoreStatus.InStoreReady;
if (InStoreJobInfo != null)
{
if (!vc.BeginInStore(CID, InStoreJobInfo,VLog)) {
Msg.add(crc.GetString("Res0051","无法入库"), MsgLevel.alarm);
}
}
}
else if (ti.StatusCode == 1040)
{
ServerCM.storeStatus = StoreStatus.OutMoveExecute;
if (RTStoreStatus != RTStoreStatus.OutMoveExecute)
VLog.Info("出库执行中");
RTStoreStatus = RTStoreStatus.OutMoveExecute;
}
else if (ti.StatusCode == 1041)
{
if (RTStoreStatus != RTStoreStatus.OutStoreReady)
VLog.Info("出库已完成");
RTStoreStatus = RTStoreStatus.OutStoreReady;
OutStoreJobList.ClearLastPosid();
}
else if (ti.StatusCode == 0)
{
RTStoreStatus = RTStoreStatus.Offline;
//ServerCM.storeStatus = StoreStatus.InStoreExecute;
}
else if (ti.StatusCode< 10000)
{
RTStoreStatus = RTStoreStatus.Busy;
VLog.Info($"StatusCode:{ti.StatusCode},StatusText:{ti.StatusText},OnlineStatus:{ti.OnlineStatus}");
}
else
{
VLog.Error($"StatusCode:{ti.StatusCode},StatusText:{ti.StatusText},OnlineStatus:{ti.OnlineStatus}");
ServerCM.storeStatus = StoreStatus.InTrouble;
RTStoreStatus = RTStoreStatus.Error;
}
}
else {
ServerCM.storeStatus = StoreStatus.None;
RTStoreStatus = RTStoreStatus.Offline;
}
/*
26 Ready/Idle
1031 loading material
1032 material put into Terminal from outside
1040 出库执行中
1041 unloading material 物料已到舱门口
1042 material unloaded to Terminal from Tower 物料已取走
3068 初始化中
*/
}
volatile JobInfo InStoreJobInfo;
StoreJobList OutStoreJobList;
public void RequestInStore(JobInfo jobInfo) {
InStoreJobInfo = jobInfo.Clone();
//return vc.BeginInStore(CID, jobInfo);
}
public bool OutStoreEnd(string reelid) {
CurrentTerminalReelID = reelid;
return ServerCM.SendStoreState(reelid, StoreStatus.OutStoreBoxEnd);
}
public bool InStoreEnd(string posid)
{
return ServerCM.SendStoreState(posid, StoreStatus.InStoreEnd);
}
}
public enum RTStoreStatus {
Offline,
Ready,
InStoreReady,
InStoreExecute,
OutStoreReady,
OutMoveExecute,
NGOutReady,
LockToInStore,
Busy,
Error,
}
}
\ No newline at end of file
......@@ -12,12 +12,23 @@ namespace DeviceLibrary
{
public class DeviceBase
{
public static Dictionary<int, IDevice> DeviceListByAddr = new Dictionary<int, IDevice>();
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 static bool FwdFree(int curaddr) {
int nextaddr = curaddr + 1;
if (nextaddr > 20)
nextaddr = 0;
if (!DeviceListByAddr.ContainsKey(nextaddr))
return true;
return DeviceListByAddr[nextaddr].FrontCheck(nextaddr);
}
public void StopMove(bool ServoOff = false)
{
//runStatus = RunStatus.Stop;
......
using OnlineStore.Common;
using Newtonsoft.Json;
using OnlineStore.Common;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
......@@ -20,19 +21,19 @@ namespace DeviceLibrary
{
lock (jobInfos)
{
if (lastoutpos == jobInfo.PosId)
{
LogUtil.info($"[{jobname}] 出库任务正在执行:" + jobInfo.ToStr());
return;
}
var l = jobInfos.ToList().Find((x) => { return x.PosId == jobInfo.PosId; });
if (l == null)
{
//if (lastoutpos == jobInfo.WareNum)
//{
// LogUtil.info($"[{jobname}] 出库任务正在执行:" + jobInfo.ToStr());
// return;
//}
//var l = jobInfos.ToList().Find((x) => { return x.WareNum == jobInfo.WareNum; });
//if (l == null)
//{
jobInfos.Enqueue(jobInfo);
LogUtil.info($"[{jobname}] 库任务加入队列:" + jobInfo.ToStr());
}
else
LogUtil.info($"[{jobname}] 出库任务已存在队列中:" + jobInfo.ToStr());
LogUtil.info($"[{jobname}] 库任务加入队列:" + jobInfo.ToStr());
//}
//else
// LogUtil.info($"[{jobname}] 出库任务已存在队列中:" + jobInfo.ToStr());
}
}
public bool Dequeue(out JobInfo jobInfo)
......@@ -50,7 +51,7 @@ namespace DeviceLibrary
lastoutpos = "";
}
}
[Serializable]
public class JobInfo
{
public JobInfo(string wareNum, string posId, int platew, int plateh)
......@@ -81,10 +82,26 @@ namespace DeviceLibrary
/// 料盘高
/// </summary>
public int plateH { get; set; }
public string CID { get; set; }
public string ToStr()
{
return "TrayCode【" + TrayCode + "】,WareNum=【" + WareNum + "】,PosId=【" + PosId + "】,plateW=【" + plateW + "】,plateH=【" + plateH + "】";
return "TrayCode【" + TrayCode + "】,WareNum=【" + WareNum + "】,PosId=【" + PosId + "】,plateW=【" + plateW + "】,plateH=【" + plateH + "】,CID=【" + CID + "】";
}
public string Serialize() {
return JsonConvert.SerializeObject(this);
}
public static JobInfo Deserialize(string s) {
try
{
return JsonConvert.DeserializeObject<JobInfo>(s);
}
catch {
return null;
}
}
public JobInfo Clone() {
return (JobInfo)MemberwiseClone();
}
}
......
......@@ -21,11 +21,16 @@ namespace DeviceLibrary
void Reset_BTN() {
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.HIGH))
{
foreach (var al in AxisBean.List.Values.ToList())
{
if (!AxisBean.ClearMultiAlarm(out string msg, al))
Msg.add(msg, MsgLevel.warning);
}
Msg.add(crc.GetString("Res0161","按下复位按钮."), MsgLevel.info, ErrInfo.ResetBtn);
}
else
{
Msg.add(crc.GetString("Res0162","急停未解除,按下复位按钮尝试复位安全继电器."), MsgLevel.info, ErrInfo.SuddenStop);
Msg.add(crc.GetString("Res0162","急停未解除,按下复位按钮尝试复位安全继电器."), MsgLevel.info);
}
LogUtil.info("按下复位按钮");
......@@ -41,7 +46,7 @@ namespace DeviceLibrary
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.HIGH))
{
if (!RobotManage.isRunning)
Msg.add(crc.GetString("Res0163","按下启动按钮,开始启动."), MsgLevel.info, ErrInfo.RunBtn);
Msg.add(crc.GetString("Res0163","检测到自动运行状态,开始启动."), MsgLevel.info, ErrInfo.RunBtn);
else
Msg.add( crc.GetString("Res0164","系统正在运行."), MsgLevel.info);
}
......
......@@ -33,7 +33,7 @@ namespace DeviceLibrary
public Dictionary<string, DeviceGroup> DeviceGroup { get=>RobotManage.DeviceGroup; }
public bool UserPause { get; set; } = false;
ServerCommunication ServerCM = new ServerCommunication();
ServerCommunication ServerCM;
public ManualResetEvent ResetEvent = new ManualResetEvent(true);
......@@ -45,6 +45,7 @@ namespace DeviceLibrary
public MainMachine(out string msg) {
GroupName = "root";
msg = "";
ServerCM = new ServerCommunication(Setting_Init.Device_CID);
Config = RobotManage.Config;
Msg = new MsgService("root");
crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
......@@ -158,6 +159,7 @@ namespace DeviceLibrary
Alarm(AlarmType.None);
StopMove(true);
LedProcess(null);
SafetyDevice.PauseAll();
}
public void BeginHomeReset(bool firstRun=false) {
if (!firstRun)
......@@ -236,13 +238,13 @@ namespace DeviceLibrary
}
else if (isInSuddenDown)
{
Alarm(AlarmType.SuddenStop);
//Alarm(AlarmType.SuddenStop);
Msg.add(crc.GetString("Res0176", "急停中"), MsgLevel.alarm);
ok = false;
}
else if (alarmType != AlarmType.None)
{
Msg.add(crc.GetString("Res0177", "系统需要重置"), MsgLevel.alarm, ErrInfo.SuddenStop);
Msg.add(crc.GetString("Res0177", "系统需要重置"), MsgLevel.alarm);
ok = false;
}
if (IOValue(IO_Type.Airpressure_Check).Equals(IO_VALUE.LOW))
......@@ -260,6 +262,15 @@ namespace DeviceLibrary
else {
lastAirCloseTime = DateTime.MinValue;
}
foreach (var al in AxisBean.List.Values.ToList())
{
if (ok && !AxisBean.RunMultiAxis(true, out string msg, al))
{
ok = false;
Msg.add(msg, MsgLevel.warning);
//LogUtil.error(msg);
}
}
if (alarmType!=AlarmType.SuddenStop)
{
TimeSpan span = DateTime.Now - checkAlarmTime;
......
using OnlineStore.Common;
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
......@@ -12,6 +13,7 @@ namespace DeviceLibrary
{
public static List<MoveInfo> List = new List<MoveInfo>();
public int TimeOutSeconds = 60;
ILog LOGGER = null;
public MoveInfo(string name, bool addtolist=true)
{
MoveParam = new ReelParam();
......@@ -20,6 +22,14 @@ namespace DeviceLibrary
this.Name = name;
if(addtolist)
List.Add(this);
if(name.StartsWith("AMH-MI1"))
LOGGER = LogManager.GetLogger("AMH-MI1");
else
if (name.StartsWith("AMH-MI2"))
LOGGER = LogManager.GetLogger("AMH-MI2");
else
LOGGER = LogManager.GetLogger("RollingLogFileAppender");
}
public MoveInfo(object p, string v)
......@@ -118,7 +128,7 @@ namespace DeviceLibrary
if (String.Compare(lastmsg,msg, StringComparison.Ordinal)!=0)
{
lastmsg = msg;
LogUtil.info(msg);
LogUtil.info(LOGGER,msg);
}
}
public void error(string msg) {
......@@ -127,7 +137,7 @@ namespace DeviceLibrary
if (String.Compare(lastmsg,msg, StringComparison.Ordinal)!=0)
{
lastmsg = msg;
LogUtil.error(msg);
LogUtil.error(LOGGER, msg);
}
}
......
......@@ -139,6 +139,13 @@ namespace DeviceLibrary
MI_43,
MI_44,
MI_45,
MI_50,
MI_WaitMT,
MI_51,
MI_52,
MI_53,
MI_54,
MI_55,
}
......
......@@ -29,7 +29,7 @@ namespace DeviceLibrary
lock (allClients)
{
if (allClients.ContainsKey(deviceGroupName))
allClients.Add(deviceGroupName, client);
allClients[deviceGroupName]=client;
else
allClients.Add(deviceGroupName,client);
}
......@@ -51,18 +51,23 @@ namespace DeviceLibrary
};
});
}
static volatile RemoteResult lastresult = RemoteResult.None;
static volatile Dictionary<long, RemoteResult> lastresult = new Dictionary<long, RemoteResult>();
static void ProcessMessage(string deviceGroupName, string message) {
bool isok = true;
long Seq = 1;
try
{
lastresult = RemoteResult.None;
{
var remoteLoad = JsonConvert.DeserializeObject<RemoteLoad>(message);
Seq = remoteLoad.Seq;
lastresult[Seq] = RemoteResult.None;
switch (remoteLoad.Action)
{
case "SetTrayRequest":
TrayManager.SetTrayRequest(remoteLoad);
break;
case "TrayInfo":
TrayManager.TrayInfo(remoteLoad);
break;
case "TrayRelease":
TrayManager.TrayRelease(remoteLoad);
break;
......@@ -71,7 +76,7 @@ namespace DeviceLibrary
break;
case "OK":
case "FAIL":
lastresult = remoteLoad.Action == "OK" ? RemoteResult.True : RemoteResult.False;
lastresult[Seq] = remoteLoad.Action == "OK" ? RemoteResult.True : RemoteResult.False;
LogUtil.info("Revice Command Callback:" + remoteLoad.GroupName + " - " + remoteLoad.Action);
return;
default:
......@@ -82,7 +87,7 @@ namespace DeviceLibrary
isok = false;
LogUtil.info("Remote process error:"+e.ToString());
}
SendResult(deviceGroupName, isok);
SendResult(deviceGroupName, isok, Seq);
}
public static void SendMessage(string deviceGroupName,RemoteLoad message) {
if (!allClients.ContainsKey(deviceGroupName))
......@@ -105,27 +110,35 @@ namespace DeviceLibrary
if (remoteLoad.RequestLoadInfo != null && string.IsNullOrEmpty(remoteLoad.RequestLoadInfo.DeviceGroupName))
remoteLoad.RequestLoadInfo.DeviceGroupName = GroupName;
LogUtil.info($"{GroupName},发送:{remoteLoad.Action},Seq:{remoteLoad.Seq}");
lastresult = RemoteResult.None;
lastresult[remoteLoad.Seq] = RemoteResult.None;
SendMessage(GroupName, remoteLoad);
return WaitResult(waittime);
return WaitResult(GroupName, remoteLoad.Seq,waittime);
}
static RemoteResult WaitResult(int waittime = 3000)
static RemoteResult WaitResult(string GroupName,long seq,int waittime = 3000)
{
while (lastresult == RemoteResult.None && waittime > 0)
if (!lastresult.ContainsKey(seq))
return RemoteResult.Timeout;
while (lastresult[seq] == RemoteResult.None && waittime > 0)
{
System.Threading.Thread.Sleep(50);
waittime = waittime - 50;
}
if (lastresult == RemoteResult.None)
if (lastresult[seq] == RemoteResult.None)
{
LogUtil.info($"等待{GroupName}反馈超时 seq:"+seq);
lastresult[seq] = RemoteResult.Timeout;
}
var result = lastresult[seq];
lock (lastresult)
{
LogUtil.info("等待远程反馈超时");
lastresult = RemoteResult.Timeout;
lastresult.Remove(seq);
}
return lastresult;
return result;
}
public static void SendResult(string deviceGroupName, bool result)
public static void SendResult(string deviceGroupName, bool result,long Seq)
{
RemoteLoad remoteLoad = new RemoteLoad();
remoteLoad.Seq = Seq;
remoteLoad.Action = result?"OK":"FAIL";
remoteLoad.GroupName = deviceGroupName;
SendMessage(deviceGroupName, remoteLoad);
......
......@@ -38,6 +38,7 @@ namespace DeviceLibrary
public static URRobotControl Robot_MI1;
public static URRobotControl Robot_MI2;
public static URRobotControl Robot_CI;
public static VStoreCollection VStoreCollection;
public static void Init() {
string msg = "";
......@@ -72,30 +73,31 @@ namespace DeviceLibrary
Robot_CI = new URRobotControl(Setting_Init.URRobot_CI_IP);
Robot_CI.SetSpeedRate(Setting_Init.URRobot_CI_Speed_Rate);
if (Robot_MI1.StartRobot()) {
LogUtil.info("MI1 UR机器人启动成功,"+ Robot_MI1.GetStatus());
} else {
IsLoadOk = false;
msg += "MI1 UR机器人启动失败" + "\n";
}
if (Robot_MI2.StartRobot())
{
LogUtil.info("MI2 UR机器人启动成功," + Robot_MI2.GetStatus());
}
else
{
IsLoadOk = false;
msg += "MI2 UR机器人启动失败" + "\n";
}
if (Robot_CI.StartRobot())
{
LogUtil.info("CI UR机器人启动成功," + Robot_CI.GetStatus());
}
else
{
IsLoadOk = false;
msg += "CI UR机器人启动失败" + "\n";
}
VStoreCollection = new VStoreCollection();
//if (Robot_MI1.StartRobot()) {
// LogUtil.info("MI1 UR机器人启动成功,"+ Robot_MI1.GetStatus());
//} else {
// IsLoadOk = false;
// msg += "MI1 UR机器人启动失败" + "\n";
//}
//if (Robot_MI2.StartRobot())
//{
// LogUtil.info("MI2 UR机器人启动成功," + Robot_MI2.GetStatus());
//}
//else
//{
// IsLoadOk = false;
// msg += "MI2 UR机器人启动失败" + "\n";
//}
//if (Robot_CI.StartRobot())
//{
// LogUtil.info("CI UR机器人启动成功," + Robot_CI.GetStatus());
//}
//else
//{
// IsLoadOk = false;
// msg += "CI UR机器人启动失败" + "\n";
//}
CodeManager.LoadConfig();
RemoteService.Init();
mainMachine = new MainMachine(out string m);
......@@ -135,6 +137,7 @@ namespace DeviceLibrary
}
mainThread = new Thread(new ThreadStart(mainMachine.Start));
mainThread.Start();
VStoreCollection.Start();
Thread.Sleep(50);
var d1 = new DeviceRunControl("SideMove", SideMove.DeviceList.Values.ToList<IDevice>());
var d2 = new DeviceRunControl("TransplantMove", TransplantMove.DeviceList.Values.ToList<IDevice>());
......@@ -143,19 +146,7 @@ namespace DeviceLibrary
isRunning = true;
GC.KeepAlive(mainThread);
//Task.Run(()=> {
AxisBean.List.ToList().ForEach((x) => { x.Value.ForEach(y => { AxisManager.AlarmClear(y.Config.DeviceName, y.Config.GetAxisValue()); }); });
Task.Delay(100).Wait();
if (mainMachine.DeviceCheck())
{
mainMachine.BeginHomeReset(true);
}
//}).Wait();
mainMachine.BeginHomeReset(true);
d1.Start();
d2.Start();
......@@ -172,12 +163,14 @@ namespace DeviceLibrary
mainMachine.Stop();
mainMachine.UserPause = false;
}
VStoreCollection.Stop();
isRunning = false;
}
public static void ShutDown()
{
LogUtil.info("开始关闭系统.");
IOManager.CloseAllConnection();
VStoreCollection.ShutDown();
Robot_MI1.StopRobot();
Robot_MI2.StopRobot();
Robot_CI.StopRobot();
......@@ -195,6 +188,7 @@ namespace DeviceLibrary
LogUtil.info("用户暂停");
else
LogUtil.info("系统暂停: "+msg);
Thread.Sleep(500);
}
else
LogUtil.info("用户取消暂停:"+ msg);
......
......@@ -69,9 +69,8 @@ namespace DeviceLibrary
try
{
var TL = Traylist.Where(t => t.Value.DestinationAddr >= 0).ToDictionary(a => a.Key, a => a.Value);
File.Delete("Config\\TrayList.temp");
File.WriteAllText("Config\\TrayList.temp~", JsonConvert.SerializeObject(TL));
File.Move("Config\\TrayList.temp~", "Config\\TrayList.temp");
ConfigHelper.Config.FileSave(JsonConvert.SerializeObject(TL), "Config\\TrayList.temp~");
ConfigHelper.Config.FileSave(JsonConvert.SerializeObject(TL), "Config\\TrayList.temp");
}
catch (Exception ex)
{
......@@ -117,7 +116,6 @@ namespace DeviceLibrary
/// <param name="requestLoadInfo"></param>
public static void SetTrayRequest(RemoteLoad remoteLoad)
{
LogUtil.info($"SetTrayRequest:{remoteLoad.GroupName}=>{remoteLoad.RequestLoadInfo.DeviceGroupName},{remoteLoad.RequestLoadInfo.TrayType}");
lock (TrayRequest)
{
......@@ -137,7 +135,6 @@ namespace DeviceLibrary
if (trayaddrs.Count == 0)
return false;
var ttt = 0;
if (curaddr1 == 9)
ttt = 15;
......@@ -148,8 +145,6 @@ namespace DeviceLibrary
//当前托盘到需求距离
var ts = dis(a.Addr, ttt);
return !(trayaddrs.Where(t1 => dis(a.Addr, t1) < ts).Count() > 0);
};
return false;
......@@ -178,8 +173,6 @@ namespace DeviceLibrary
else
return d + 20;
}
}
public static void SetToEmpty(string rfid)
{
......@@ -214,6 +207,23 @@ namespace DeviceLibrary
device.TrayRelease();
}
}
public static void TrayInfo(RemoteLoad remoteLoad)
{
var requestLoadInfo = remoteLoad.RequestLoadInfo;
LogUtil.info($"TrayInfo:{remoteLoad.GroupName},{requestLoadInfo.DeviceGroupName},{requestLoadInfo.IsEmpty},{requestLoadInfo?.LoadParam.ToStr()}");
lock (requestLoadInfo)
{
var device = TrayStop.DeviceList[remoteLoad.GroupName];
if (requestLoadInfo.IsEmpty)
{
SetTrayLoadInfo(device.CurrrentRFID, null);
ServerCommunication.UpdateRobotStatus(requestLoadInfo.LoadParam.WareCode, RobotStatusE.FINISHED, remoteLoad.GroupName);
}
else {
SetTrayLoadInfo(device.CurrrentRFID, requestLoadInfo);
}
}
}
/// <summary>
/// 移栽机构是否已空闲
/// </summary>
......@@ -265,7 +275,7 @@ namespace DeviceLibrary
OfflineCount = 0;
lastrefresh = DateTime.Now;
Traylist.Values.ToList().ForEach(ti=> {
if ((lastrefresh - ti.LastUpdateTime).TotalSeconds > 30)
if ((lastrefresh - ti.LastUpdateTime).TotalSeconds > 60)
{
ti.isOnline = false;
OfflineCount++;
......@@ -281,6 +291,7 @@ namespace DeviceLibrary
});
}
}
public class TrayInfo {
string _rfid;
......@@ -346,14 +357,38 @@ namespace DeviceLibrary
//TrayTypeDesc.Add(TrayTypeE.C04, crc.GetString("Res0013","ShoeBOX治具"));
if (File.Exists("Config\\TrayList.temp"))
{
bool isreadok = false;
try
{
var tl = File.ReadAllText("Config\\TrayList.temp");
Traylist = JsonConvert.DeserializeObject<Dictionary<string, TrayInfo>>(tl);
isreadok = Traylist != null;
if (!isreadok)
LogUtil.error("启动时托盘信息加载失败");
}
catch (Exception ex) {
LogUtil.error("启动时托盘信息加载失败:"+ex);
catch (Exception ex)
{
LogUtil.error("启动时托盘信息加载失败:" + ex);
}
if (isreadok)
return;
try
{
var tl = File.ReadAllText("Config\\TrayList.temp~");
Traylist = JsonConvert.DeserializeObject<Dictionary<string, TrayInfo>>(tl);
if (Traylist == null)
{
LogUtil.error("启动时托盘信息加载失败");
Traylist = new Dictionary<string, TrayInfo>();
}
}
catch (Exception ex)
{
LogUtil.error("启动时托盘备份信息加载失败:" + ex);
Traylist = new Dictionary<string, TrayInfo>();
}
}
}
public static void Init(Dictionary<string, DeviceGroup> deviceGroup) {
......
......@@ -16,6 +16,7 @@ namespace DeviceLibrary
void Stop();
void TrayRelease();
bool IsFree();
bool FrontCheck(int curaddr);
}
public enum DeviceStateE
......
......@@ -21,6 +21,8 @@ namespace DeviceLibrary
DeviceList.Add(devices[key].GroupName, sideMove);
msg += m;
DeviceListByAddr[devices[key].addr_1] = sideMove;
DeviceListByAddr[devices[key].addr_2] = sideMove;
}
}
DeviceGroup DeviceGroup;
......@@ -120,11 +122,20 @@ namespace DeviceLibrary
case MoveStep.SideMove_01:
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_01);
bool Forcetry = false;
if (LastGoInFail && (LastGoInFailTime - DateTime.Now).TotalSeconds > 5)
if (LastGoInFail && (LastGoInFailTime - DateTime.Now).TotalSeconds > 10)
{
Forcetry = true;
LSAMoveInfo.log("上次托盘进入失败本次重试");
}
if (IOValue(IO_Type.Ls_B_Tray_Check).Equals(IO_VALUE.HIGH))
{
break;
}else
if (IOValue(IO_Type.Ls_A_Tray_Check).Equals(IO_VALUE.HIGH))
{
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_04);
LastGoInFail = false;
}else
if (IOValue(IO_Type.Ls_A_Front_Check).Equals(IO_VALUE.HIGH)|| Forcetry)
{
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_02);
......@@ -142,10 +153,15 @@ namespace DeviceLibrary
break;
case MoveStep.SideMove_02:
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_03);
IOMove(IO_Type.Ls_A_Front_Stop, IO_VALUE.HIGH, IO_Type.Ls_A_Front_Check, IO_VALUE.LOW, StopDelayMS);
//IOMove(IO_Type.Ls_A_Front_Stop, IO_VALUE.HIGH, IO_Type.Ls_A_Front_Check, IO_VALUE.LOW, StopDelayMS);
IOMove(IO_Type.Ls_A_Front_Stop, IO_VALUE.HIGH);
//IOMove(IO_Type.Ls_A_BufStop_Fwd, IO_VALUE.HIGH, StopBufDelayMS);
break;
case MoveStep.SideMove_03:
if (IOValue(IO_Type.Ls_A_Front_Check).Equals(IO_VALUE.LOW))
{
IOMove(IO_Type.Ls_A_Front_Stop, IO_VALUE.LOW);
}
if (IOValue(IO_Type.Ls_A_Tray_Check).Equals(IO_VALUE.HIGH)) {
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_04);
LastGoInFail = false;
......@@ -162,11 +178,13 @@ namespace DeviceLibrary
}
break;
case MoveStep.SideMove_04:
if (!FwdFree(DeviceGroup.addr_1))
return;
if (LSBMoveInfo.MoveStep==MoveStep.Wait)
{
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_06);
IOMove(IO_Type.Ls_B_BufStop_Fwd, IO_VALUE.HIGH, 500);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
Location_A.ToHigh(LSAMoveInfo);
Location_B.ToHigh(LSAMoveInfo);
}
......@@ -186,7 +204,7 @@ namespace DeviceLibrary
break;
case MoveStep.SideMove_08:
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_09);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(800));
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1200));
break;
case MoveStep.SideMove_09:
LSAMoveInfo.NextMoveStep(MoveStep.SideMove_10);
......@@ -290,16 +308,20 @@ namespace DeviceLibrary
case MoveStep.SideMove_02:
Minfo.NextMoveStep(MoveStep.SideMove_03);
Minfo.log($"{Ls_A_Front_Stop}下降,{Ls_A_BufStop_Rwd}回退");
IOMove(Ls_A_Front_Stop, IO_VALUE.HIGH, Ls_A_Front_Check, IO_VALUE.LOW, StopDelayMS);
//IOMove(Ls_A_Front_Stop, IO_VALUE.HIGH, Ls_A_Front_Check, IO_VALUE.LOW, StopDelayMS);
IOMove(Ls_A_Front_Stop, IO_VALUE.HIGH);
IOMove(Ls_A_BufStop_Rwd, IO_VALUE.HIGH, StopBufDelayMS);
break;
case MoveStep.SideMove_03:
if (IOValue(Ls_A_Front_Check).Equals(IO_VALUE.LOW))
IOMove(Ls_A_Front_Stop, IO_VALUE.LOW);
if (IOValue(Ls_A_Tray_Check).Equals(IO_VALUE.HIGH))
{
Minfo.NextMoveStep(MoveStep.SideMove_04);
Minfo.log($"检测到进入的托盘");
Minfo.CanWhileCount = 3;
Minfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
//Minfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else if (Minfo.IsTimeOut(10))
{
......@@ -334,7 +356,7 @@ namespace DeviceLibrary
else
Minfo.NextMoveStep(MoveStep.SideMove_06);
Minfo.WaitList.Add(WaitResultInfo.WaitTime(500));
//Minfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else if (Minfo.CanWhileCount > 0)
{
......@@ -352,14 +374,18 @@ namespace DeviceLibrary
break;
///直接穿过流程
case MoveStep.SideMove_06:
if (!FwdFree(addr))
return;
Minfo.NextMoveStep(MoveStep.SideMove_07);
IOMove(Ls_A_Stop, IO_VALUE.HIGH, Ls_A_Tray_Check, IO_VALUE.LOW, StopDelayMS);
//IOMove(Ls_A_Stop, IO_VALUE.HIGH, Ls_A_Tray_Check, IO_VALUE.LOW, StopDelayMS);
IOMove(Ls_A_Stop, IO_VALUE.HIGH);
IOMove(Ls_A_BufStop_Rwd, IO_VALUE.HIGH, StopBufDelayMS);
Minfo.log($"{Ls_A_Stop}阻挡放行");
break;
case MoveStep.SideMove_07:
if (IOValue(Ls_A_Tray_Check).Equals(IO_VALUE.LOW))
{
IOMove(Ls_A_Stop, IO_VALUE.LOW);
Minfo.NextMoveStep(MoveStep.SideMove_08);
}
else if (Minfo.IsTimeOut(5)) {
......@@ -392,6 +418,7 @@ namespace DeviceLibrary
}
break;
case MoveStep.SideMove_11:
Minfo.NextMoveStep(MoveStep.SideMove_12);
Location_a.ToHigh(Minfo);
Location_b.ToHigh(Minfo);
......@@ -419,21 +446,29 @@ namespace DeviceLibrary
break;
case MoveStep.SideMove_51:
Minfo.NextMoveStep(MoveStep.SideMove_52);
Line.LineStop("n");
Location_a.ToLow(Minfo);
Minfo.log($"顶升下降横移线体停止");
Line.LineStop("n");
Minfo.log($"横移线体停止");
break;
case MoveStep.SideMove_52:
if (!FwdFree(addr))
return;
Minfo.NextMoveStep(MoveStep.SideMove_53);
if (LS_Type!= LS_TypeE.NoRfid)
IOMove(Ls_A_Stop, IO_VALUE.HIGH, Ls_A_Tray_Check, IO_VALUE.LOW, StopDelayMS);
Location_a.ToLow(Minfo);
Minfo.log($"顶升下降");
break;
case MoveStep.SideMove_53:
Minfo.NextMoveStep(MoveStep.SideMove_54);
if (LS_Type!= LS_TypeE.NoRfid)
//IOMove(Ls_A_Stop, IO_VALUE.HIGH, Ls_A_Tray_Check, IO_VALUE.LOW, StopDelayMS);
IOMove(Ls_A_Stop, IO_VALUE.HIGH);
break;
case MoveStep.SideMove_54:
Minfo.NextMoveStep(MoveStep.SideMove_17);
Minfo.WaitList.Add(WaitResultInfo.WaitIO(Ls_A_Tray_Check, IO_VALUE.LOW));
break;
case MoveStep.SideMove_17:
Minfo.NextMoveStep(MoveStep.SideMove_18);
IOMove(Ls_A_Stop, IO_VALUE.LOW);
Minfo.WaitList.Add(WaitResultInfo.WaitTime(500));
break;
case MoveStep.SideMove_18:
......@@ -474,6 +509,12 @@ namespace DeviceLibrary
DeviceState = DeviceStateE.Run;
LSAMoveInfo.EndMove();
}
if (trayAstate && trayBstate)
{
LSAMoveInfo.log("托盘上2边都有托盘回原结束");
DeviceState = DeviceStateE.Run;
LSAMoveInfo.EndMove();
}
else if (LS_Type == LS_TypeE.NoRfid)
{
LSAMoveInfo.log($"无Rfid横移");
......@@ -513,6 +554,7 @@ namespace DeviceLibrary
LSAMoveInfo.NextMoveStep(MoveStep.H06_HomeReset);
Location_A.ToLow(LSAMoveInfo);
Location_B.ToLow(LSAMoveInfo);
LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Ls_A_Tray_Check, IO_VALUE.LOW));
LSAMoveInfo.log($"顶升下降");
break;
case MoveStep.H06_HomeReset:
......@@ -544,7 +586,13 @@ namespace DeviceLibrary
{
throw new NotImplementedException();
}
public bool FrontCheck(int curaddr)
{
if (DeviceGroup.addr_1 == curaddr)
return IOValue(IO_Type.Ls_A_Front_Check).Equals(IO_VALUE.LOW);
else
return IOValue(IO_Type.Ls_B_Front_Check).Equals(IO_VALUE.LOW);
}
enum LS_TypeE {
NoRfid,
OneWay,
......
......@@ -28,6 +28,7 @@ DI,0,复位,Reset_BTN,1,,X01,,,,,,,,,,
DI,0,自动模式,AutoRun_Single,2,,X02,,,,,,,,,,
DI,0,气压检测,Airpressure_Check,3,,X03,,,,,,,,,,
DI,0,吸盘进气压力检测,Sucker_suction_detection,4,,X04,,,,,,,,,,
DI,0,ML5出入口安全检测,ML5_DoorSafeCheck,149,,X149,,,,,,,,,,
,,,,,,,,,,,,,,,,
DI,0,LS1-1顶升上升端,Ls_A_Location_Up,5,LS1,X05,,,,,,,,,,
DI,0,LS1-1顶升下降端,Ls_A_Location_Down,6,LS1,X06,,,,,,,,,,
......
......@@ -47,6 +47,10 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
public static string Sucker_suction_detection = "Sucker_suction_detection";
/// <summary>
/// DI,0,ML5出入口安全检测,ML5_DoorSafeCheck,149,,X149,,,,,,,,,,
/// </summary>
public static string ML5_DoorSafeCheck = "ML5_DoorSafeCheck";
/// <summary>
/// DI,0,CI点料完成,CI_Count_Finished,97,,X97,,,,,,,,,,
/// </summary>
public static string CI_Count_Finished = "CI_Count_Finished";
......
......@@ -21,7 +21,7 @@ public class RemoteLoad
/// </summary>
public string GroupName;
/// <summary>
/// 载荷信息
/// 物料信息
/// </summary>
public RequestLoadInfo RequestLoadInfo;
}
......@@ -164,12 +164,18 @@ public class ReelParam
/// 唯一序列号
/// </summary>
public string RI { get; set; }
public string DC { get; set; }
/// <summary>
/// 批次号
/// </summary>
public string Batch { get; set; }
public string cid { get; set; }
public string SubCID{ get; set; }
public bool ReelOnFixture { get; set; } = false;
public bool IsInStore { get; set; }
public int HeightPos = 0;
public string RFID = "";
......
......@@ -52,6 +52,7 @@ public class RemoteClient
}
WebSocket4Net.WebSocketState LastState = WebSocket4Net.WebSocketState.None;
public bool IsOnline { get => webSocket.State == WebSocket4Net.WebSocketState.Open; }
int errstatuscounr = 0;
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
{
if (webSocket.State == WebSocket4Net.WebSocketState.Closed)
......@@ -60,9 +61,19 @@ public class RemoteClient
{
LOGGER.Info($"Remote:{GroupName} 重新连接");
webSocket.Open();
errstatuscounr = 0;
}
catch { }
}
else if (webSocket.State == WebSocket4Net.WebSocketState.Connecting) {
errstatuscounr++;
if (errstatuscounr > 5) {
LOGGER.Info($"Remote:{GroupName} Connecting 超时");
try { webSocket.Close(); } catch { }
webSocket.Open();
errstatuscounr = 0;
}
}
}
volatile RemoteResult lastresult = RemoteResult.None;
private void WebSocket_MessageReceived(object sender, WebSocket4Net.MessageReceivedEventArgs e)
......@@ -84,7 +95,7 @@ public class RemoteClient
case "OK":
case "FAIL":
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 + " ,Seq:" + remoteLoad.Seq);
return;
default:
if (actionlist.ContainsKey(remoteLoad.Action)) {
......@@ -95,7 +106,7 @@ public class RemoteClient
LOGGER.Info("unknow remote command:" + remoteLoad.Action);
break;
}
SendResult(isok);
SendResult(isok, remoteLoad.Seq);
}
Dictionary<string, Func<RequestLoadInfo, bool>> actionlist = new Dictionary<string, Func<RequestLoadInfo, bool>>();
......@@ -103,17 +114,24 @@ public class RemoteClient
{
actionlist[actionName] = action;
}
int timeoutCount = 0;
RemoteResult WaitResult(int waittime=3000)
{
while (lastresult == RemoteResult.None && waittime > 0)
{
System.Threading.Thread.Sleep(50);
waittime = waittime - 50;
waittime = waittime - 50;
}
if (lastresult == RemoteResult.None)
{
LOGGER.Info("等待远程反馈超时");
timeoutCount++;
lastresult = RemoteResult.Timeout;
if (timeoutCount > 3)
webSocket.Close();
}
else {
timeoutCount = 0;
}
return lastresult;
}
......@@ -125,12 +143,14 @@ public class RemoteClient
if (string.IsNullOrEmpty(remoteLoad.RequestLoadInfo.DeviceGroupName))
remoteLoad.RequestLoadInfo.DeviceGroupName = GroupName;
}
lastresult = RemoteResult.None;
webSocket.Send(JsonConvert.SerializeObject(remoteLoad));
return WaitResult(waittime);
}
void SendResult(bool result)
void SendResult(bool result,long Seq)
{
RemoteLoad remoteLoad = new RemoteLoad();
remoteLoad.Seq = Seq;
remoteLoad.Action = result ? "OK" : "FAIL";
remoteLoad.GroupName = GroupName;
webSocket.Send(JsonConvert.SerializeObject(remoteLoad));
......
......@@ -49,6 +49,16 @@
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="VStore" type="log4net.Appender.RollingFileAppender">
<file value="logs/VStore.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"/>
......@@ -79,6 +89,110 @@
<level value="ALL"/>
<appender-ref ref="URROBOTLog"/>
</logger>
<logger name="VStore" additivity="false">
<level value="ALL"/>
<appender-ref ref="VStore"/>
</logger>
<appender name="RtTowerClientService" type="log4net.Appender.RollingFileAppender">
<file value="logs/RtTowerClientService.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>
<logger name="RtTowerClientService" additivity="false">
<level value="ALL"/>
<appender-ref ref="RtTowerClientService"/>
</logger>
<appender name="AMH-MI1" type="log4net.Appender.RollingFileAppender">
<file value="logs/AMH-MI1.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>
<logger name="AMH-MI1" additivity="false">
<level value="ALL"/>
<appender-ref ref="AMH-MI1"/>
</logger>
<appender name="AMH-MI2" type="log4net.Appender.RollingFileAppender">
<file value="logs/AMH-MI2.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>
<logger name="AMH-MI2" additivity="false">
<level value="ALL"/>
<appender-ref ref="AMH-MI2"/>
</logger>
<appender name="003039" type="log4net.Appender.RollingFileAppender">
<file value="logs/RT-003039.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>
<logger name="003039" additivity="false">
<level value="ALL"/>
<appender-ref ref="003039"/>
</logger>
<appender name="003040" type="log4net.Appender.RollingFileAppender">
<file value="logs/RT-003040.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>
<logger name="003040" additivity="false">
<level value="ALL"/>
<appender-ref ref="003040"/>
</logger>
<appender name="003043" type="log4net.Appender.RollingFileAppender">
<file value="logs/RT-003043.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>
<logger name="003043" additivity="false">
<level value="ALL"/>
<appender-ref ref="003043"/>
</logger>
<appender name="003048" type="log4net.Appender.RollingFileAppender">
<file value="logs/RT-003048.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>
<logger name="003048" additivity="false">
<level value="ALL"/>
<appender-ref ref="003048"/>
</logger>
<!--<root>
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
......
......@@ -113,7 +113,6 @@ namespace TheMachine
#endregion
LogUtil.info("开始初始化");
cb_EnableBuzzer.Checked = Setting_Init.Device_EnableBuzzer;
AlarmBuzzer.BuzzerStateChange += AlarmBuzzer_BuzzerStateChange;
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
......@@ -132,6 +131,8 @@ namespace TheMachine
// Application.DoEvents();
//}
pnl.Enabled = false;
禁用蜂鸣器ToolStripMenuItem_Click(this, EventArgs.Empty);
}
private void AlarmBuzzer_BuzzerStateChange(object sender, bool e)
......@@ -156,7 +157,7 @@ namespace TheMachine
AddForm("tab_traystopMI", "MI", mi);
AddForm("tab_traystopCI", "CI", ci);
AddForm("tab_traysetting", crc.GetString("Form1_tabc_tab_setting__SettingControl_tabControl1_tabPage1_Text","治具设置"), sc);
AddForm("tab_other", "周边", mc);
AddForm("tab_other", crc.GetString("Form1_tabc_tab_other_Text","周边"), mc);
crc.LanguageProcess(this);
}
......@@ -354,18 +355,18 @@ namespace TheMachine
{
if (!RobotManage.isRunning)
{
if (RobotManage.mainMachine.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
RobotManage.mainMachine.Msg.add(crc.GetString("Res0017","急停中,无法启动"), MsgLevel.warning);
RobotManage.mainMachine.Msg.Show();
return;
}
if (RobotManage.mainMachine.IOValue(IO_Type.AutoRun_Single).Equals(IO_VALUE.LOW))
{
RobotManage.mainMachine.Msg.add(crc.GetString("Res0018","运行开关没有打开,无法启动"), MsgLevel.warning);
RobotManage.mainMachine.Msg.Show();
return;
}
//if (RobotManage.mainMachine.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
//{
// RobotManage.mainMachine.Msg.add(crc.GetString("Res0017","急停中,无法启动"), MsgLevel.warning);
// RobotManage.mainMachine.Msg.Show();
// //return;
//}
//if (RobotManage.mainMachine.IOValue(IO_Type.AutoRun_Single).Equals(IO_VALUE.LOW))
//{
// RobotManage.mainMachine.Msg.add(crc.GetString("Res0018","运行开关没有打开,无法启动"), MsgLevel.warning);
// RobotManage.mainMachine.Msg.Show();
// //return;
//}
RobotManage.Start();
userpause = false;
if (RobotManage.isRunning)
......@@ -448,13 +449,6 @@ namespace TheMachine
AboutBox1 aboutBox1 = new AboutBox1();
aboutBox1.ShowDialog();
}
private void cb_EnableBuzzer_CheckedChanged(object sender, EventArgs e)
{
Setting_Init.Device_EnableBuzzer= cb_EnableBuzzer.Checked;
AlarmBuzzer.Enable = cb_EnableBuzzer.Checked;
}
private void btn_PauseBuzzer_Click(object sender, EventArgs e)
{
AlarmBuzzer.MuteOnce();
......@@ -554,5 +548,22 @@ namespace TheMachine
requestLoadInfo.LoadParam.PlateH = 70;
TrayManager.SetTrayLoadInfo("MTP1-0012", requestLoadInfo);
}
private void 禁用蜂鸣器ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (e == EventArgs.Empty) {
AlarmBuzzer.Enable = !Setting_Init.Device_EnableBuzzer;
}
AlarmBuzzer.Enable = !AlarmBuzzer.Enable;
if (AlarmBuzzer.Enable)
{
禁用蜂鸣器ToolStripMenuItem.Text = crc.GetString(crc.GetString("Res0056","设备操作ToolStripMenuItem_禁用蜂鸣器ToolStripMenuItem_Text"),"禁用蜂鸣器");
}
else
禁用蜂鸣器ToolStripMenuItem.Text = crc.GetString("Res0052","起用蜂鸣器");
Setting_Init.Device_EnableBuzzer = AlarmBuzzer.Enable;
}
}
}
\ No newline at end of file
......@@ -46,6 +46,7 @@ namespace TheMachine
}
}
}
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true).SetValue(Application.ProductName, Application.ExecutablePath);
Config.LoadMyConfig(new Setting_Init().GetType());
Application.ThreadException += Application_ThreadException;
......
......@@ -48,7 +48,7 @@ namespace TheMachine
// label_Statistics
//
this.label_Statistics.AutoSize = true;
this.label_Statistics.Location = new System.Drawing.Point(754, 18);
this.label_Statistics.Location = new System.Drawing.Point(686, 11);
this.label_Statistics.Name = "label_Statistics";
this.label_Statistics.Size = new System.Drawing.Size(56, 16);
this.label_Statistics.TabIndex = 1;
......@@ -58,9 +58,9 @@ namespace TheMachine
//
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.Location = new System.Drawing.Point(689, 156);
this.gb_trayinfo.Name = "gb_trayinfo";
this.gb_trayinfo.Size = new System.Drawing.Size(240, 170);
this.gb_trayinfo.Size = new System.Drawing.Size(302, 170);
this.gb_trayinfo.TabIndex = 2;
this.gb_trayinfo.TabStop = false;
this.gb_trayinfo.Text = "托盘操作";
......@@ -71,7 +71,7 @@ namespace TheMachine
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.Size = new System.Drawing.Size(296, 30);
this.btn_reset.TabIndex = 1;
this.btn_reset.Text = "清空托盘";
this.btn_reset.UseVisualStyleBackColor = true;
......@@ -82,16 +82,16 @@ namespace TheMachine
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.Size = new System.Drawing.Size(296, 145);
this.lbl_info.TabIndex = 0;
this.lbl_info.Text = "label1";
//
// ListView2
//
this.ListView2.HideSelection = false;
this.ListView2.Location = new System.Drawing.Point(0, 379);
this.ListView2.Location = new System.Drawing.Point(689, 348);
this.ListView2.Name = "ListView2";
this.ListView2.Size = new System.Drawing.Size(671, 244);
this.ListView2.Size = new System.Drawing.Size(302, 276);
this.ListView2.TabIndex = 0;
this.ListView2.UseCompatibleStateImageBehavior = false;
//
......@@ -102,7 +102,7 @@ namespace TheMachine
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.Size = new System.Drawing.Size(671, 624);
this.listView1.TabIndex = 0;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
......
......@@ -45,7 +45,7 @@ namespace TheMachine
timer1.Stop();
#region listview初始化
listView1.Columns.Clear();
var ColList = new string[] { "RFID", crc.GetString("Res0019", "上次地址"), crc.GetString("Res0020", "更新时间"), crc.GetString("Res0021", "托盘类型"), crc.GetString("Res0022", "载荷"), crc.GetString("Res0023", "目的地"),"ID" };
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)
{
......@@ -60,7 +60,7 @@ namespace TheMachine
#region listview2初始化
ListView2.Columns.Clear();
var ColList2 = new string[] { "设备", crc.GetString("Res0021", "托盘类型"), "备注" };
var ColList2 = new string[] { crc.GetString("Res0053","设备"), crc.GetString("Res0021", "托盘类型"), crc.GetString("Res0054","备注") };
ListView2.View = View.Details;
foreach (var coltxt in ColList2)
{
......@@ -151,7 +151,7 @@ namespace TheMachine
{
var ti = tivk.Value;
var traydesc = TrayManager.TrayTypeDesc[ti.GetTrayType];
var desc = ti.IsEmpty ? "空托盘" :"";
var desc = ti.IsEmpty ? crc.GetString("Res0030","空托盘") :"";
var items = new string[] { traydesc, desc };
var listviewitem = new ListViewItem();
......@@ -180,9 +180,9 @@ namespace TheMachine
}
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"+crc.GetString("Res0021","托盘类型") + ": " + listView1.SelectedItems[0].SubItems[2].Text;
txt += "\r\n"+crc.GetString("Res0055","物料") + ": " + listView1.SelectedItems[0].SubItems[3].Text;
txt += "\r\n"+crc.GetString("Res0023","目的地") + ": " + listView1.SelectedItems[0].SubItems[4].Text;
txt += "\r\n"+"Code" + ": " + listView1.SelectedItems[0].SubItems[6].Text;
lbl_info.Text = txt;
......
......@@ -104,7 +104,7 @@ namespace TheMachine
//if (ioValue.SubType.Equals(0))
{
this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 26));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + crc.GetString(ioValue.ProName, ioValue.Explain), ioValue.ProName);
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + crc.GetString(ioValue.ProType + "_" + ioValue.ProName, ioValue.Explain), ioValue.ProName);
this.tableLayoutPanel1.Controls.Add(control, 0, roleindex);
roleindex++;
......@@ -120,7 +120,7 @@ namespace TheMachine
//if (ioValue.SubType.Equals(0))
{
this.tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 28));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + crc.GetString(ioValue.ProName, ioValue.Explain), ioValue.ProName);
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + crc.GetString(ioValue.ProType + "_" + ioValue.ProName, ioValue.Explain), ioValue.ProName);
control.Click += Control_Click;
this.tableLayoutPanel2.Controls.Add(control, 0, roleindex);
roleindex++;
......
......@@ -45,7 +45,8 @@ namespace TheMachine.device.Other
this.uc_boxdebug2 = new TheMachine.uc_boxdebug();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.uc_boxdebug3 = new TheMachine.uc_boxdebug();
this.btn_scancameraadjust = new System.Windows.Forms.Button();
this.txt_reelid = new System.Windows.Forms.TextBox();
this.btn_manualout = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage4.SuspendLayout();
this.panel1.SuspendLayout();
......@@ -73,7 +74,8 @@ namespace TheMachine.device.Other
//
// tabPage4
//
this.tabPage4.Controls.Add(this.btn_scancameraadjust);
this.tabPage4.Controls.Add(this.btn_manualout);
this.tabPage4.Controls.Add(this.txt_reelid);
this.tabPage4.Controls.Add(this.panel1);
this.tabPage4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tabPage4.Location = new System.Drawing.Point(4, 22);
......@@ -174,7 +176,7 @@ namespace TheMachine.device.Other
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(798, 470);
this.tabPage1.Size = new System.Drawing.Size(992, 548);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "MI1 点位";
this.tabPage1.UseVisualStyleBackColor = true;
......@@ -186,7 +188,7 @@ namespace TheMachine.device.Other
this.uc_boxdebug1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uc_boxdebug1.Location = new System.Drawing.Point(3, 3);
this.uc_boxdebug1.Name = "uc_boxdebug1";
this.uc_boxdebug1.Size = new System.Drawing.Size(792, 464);
this.uc_boxdebug1.Size = new System.Drawing.Size(986, 542);
this.uc_boxdebug1.TabIndex = 0;
//
// tabPage2
......@@ -195,7 +197,7 @@ namespace TheMachine.device.Other
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(798, 470);
this.tabPage2.Size = new System.Drawing.Size(992, 548);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "MI2 点位";
this.tabPage2.UseVisualStyleBackColor = true;
......@@ -207,7 +209,7 @@ namespace TheMachine.device.Other
this.uc_boxdebug2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uc_boxdebug2.Location = new System.Drawing.Point(3, 3);
this.uc_boxdebug2.Name = "uc_boxdebug2";
this.uc_boxdebug2.Size = new System.Drawing.Size(792, 464);
this.uc_boxdebug2.Size = new System.Drawing.Size(986, 542);
this.uc_boxdebug2.TabIndex = 0;
//
// tabPage3
......@@ -216,7 +218,7 @@ namespace TheMachine.device.Other
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(798, 470);
this.tabPage3.Size = new System.Drawing.Size(992, 548);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "CI 点位";
this.tabPage3.UseVisualStyleBackColor = true;
......@@ -228,18 +230,25 @@ namespace TheMachine.device.Other
this.uc_boxdebug3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uc_boxdebug3.Location = new System.Drawing.Point(3, 3);
this.uc_boxdebug3.Name = "uc_boxdebug3";
this.uc_boxdebug3.Size = new System.Drawing.Size(792, 464);
this.uc_boxdebug3.Size = new System.Drawing.Size(986, 542);
this.uc_boxdebug3.TabIndex = 0;
//
// btn_scancameraadjust
// txt_reelid
//
this.btn_scancameraadjust.Location = new System.Drawing.Point(19, 242);
this.btn_scancameraadjust.Name = "btn_scancameraadjust";
this.btn_scancameraadjust.Size = new System.Drawing.Size(141, 34);
this.btn_scancameraadjust.TabIndex = 22;
this.btn_scancameraadjust.Text = "相机扫码调试";
this.btn_scancameraadjust.UseVisualStyleBackColor = true;
this.btn_scancameraadjust.Click += new System.EventHandler(this.btn_scancameraadjust_Click);
this.txt_reelid.Location = new System.Drawing.Point(56, 310);
this.txt_reelid.Name = "txt_reelid";
this.txt_reelid.Size = new System.Drawing.Size(192, 21);
this.txt_reelid.TabIndex = 22;
//
// btn_manualout
//
this.btn_manualout.Location = new System.Drawing.Point(254, 300);
this.btn_manualout.Name = "btn_manualout";
this.btn_manualout.Size = new System.Drawing.Size(100, 38);
this.btn_manualout.TabIndex = 23;
this.btn_manualout.Text = "reelid出库";
this.btn_manualout.UseVisualStyleBackColor = true;
this.btn_manualout.Click += new System.EventHandler(this.btn_manualout_Click);
//
// MycronicControl
//
......@@ -250,6 +259,7 @@ namespace TheMachine.device.Other
this.Load += new System.EventHandler(this.MycronicControl_Load);
this.tabControl1.ResumeLayout(false);
this.tabPage4.ResumeLayout(false);
this.tabPage4.PerformLayout();
this.panel1.ResumeLayout(false);
this.flowLayoutPanel1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
......@@ -280,6 +290,7 @@ namespace TheMachine.device.Other
private URRobot.UCURRobot ucurRobot2;
private System.Windows.Forms.GroupBox groupBox4;
private URRobot.UCURRobot ucurRobot3;
private System.Windows.Forms.Button btn_scancameraadjust;
private System.Windows.Forms.Button btn_manualout;
private System.Windows.Forms.TextBox txt_reelid;
}
}
......@@ -35,19 +35,10 @@ namespace TheMachine.device.Other
}
private void btn_scancameraadjust_Click(object sender, EventArgs e)
private void btn_manualout_Click(object sender, EventArgs e)
{
//CodeLibrary.CodeResourceControl.GetLanguageEvent += Crc_GetLanguageEvent;
CodeLibrary.FrmCodeDecode frm = new CodeLibrary.FrmCodeDecode();
//frm.CurrLanguage = Crc_GetLanguageEvent();
frm.chbZxing.Checked = false;
try
{
frm.ShowDialog();
frm.Dispose();
}
catch { }
RobotManage.VStoreCollection.VLog.Info("手动出库:"+ txt_reelid.Text);
RobotManage.VStoreCollection.BeginOutStore(new JobInfo(txt_reelid.Text, "", 0, 0), RobotManage.VStoreCollection.VLog);
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!