Commit 1358d0b3 LN

1

1 个父辈 6e37d6f1
此文件类型无法预览
此文件类型无法预览
......@@ -20,7 +20,7 @@ namespace OnlineStore.Common
public static System.Windows.Forms.RichTextBox logBox = null;
public static int showCount = 10;
public static int showCount = 20;
public static bool debug_opened = false;
......@@ -32,20 +32,20 @@ namespace OnlineStore.Common
return;
}
log.Info(log.Logger.Name + " - " + msg);
log.Info( " - " + msg);
AddToBox(msg, Color.Black);
//clear();
}
public static void info(ILog log,string msg, Color color)
{
log.Info(log.Logger.Name + " - " + msg);
log.Info( " - " + msg);
AddToBox(msg, color);
}
public static void debug(ILog log, string msg, Color color)
{
log.Debug(log.Logger.Name + " - " + msg);
log.Debug( " - " + msg);
if (debug_opened)
{
AddToBox(msg, color);
......@@ -53,7 +53,7 @@ namespace OnlineStore.Common
}
public static void debug(ILog log, string msg)
{
log.Debug(log.Logger.Name + " - " + msg);
log.Debug( " - " + msg);
if (debug_opened)
{
AddToBox(msg, Color.Gray);
......
......@@ -52,9 +52,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath>
</Reference>
<Reference Include="RFIDLibrary">
<HintPath>..\..\dll\RFID\RFIDLibrary.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
......@@ -78,7 +75,9 @@
<Compile Include="bean\StoreStep.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="RFID\RFID.cs" />
<Compile Include="RFID\RFIDManager.cs" />
<Compile Include="RFID\RFIDReader.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
......
......@@ -30,7 +30,13 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("没有DO=" + ioType);
}
}
public static void CIOMove(string ioType,IO_VALUE ioValue)
{
if (!IOValue(ioType).Equals(ioValue))
{
IOMove(ioType, ioValues);
}
}
public static IO_VALUE IOValue(string ioType)
{
IO_VALUE ioValue = IO_VALUE.LOW;
......
......@@ -36,7 +36,7 @@ DO,出料线阻挡2下降,OutL_OutStopDown,8,PRO_AOI_IP_1,0,出料线阻挡2下降,Y729,DO-01,
,,,14,PRO_AOI_IP_1,0,,Y735,DO-07,0,
,,,15,PRO_AOI_IP_1,0,,Y736,DO-08,0,
PRO,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,,,
PRO,出空料架流水线AGV节点名称,OutL_AgvName,A1,,,,,,,
PRO,出空料架流水线AGV节点名称,OutL_AgvName,A2,,,,,,,
PRO,入料架流水线AGV节点名称,InL_AgvName,A1,,,,,,,
PRO,入料架流水线入口RFIDIP,InL_In_RFIDIP,192.168.103.107,,,,,, ,
PRO,入料架流水线出口RFIDIP,InL_Out_RFIDIP,192.168.103.108,,,,,, ,
using log4net;
using OnlineStore.Common;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -239,7 +238,7 @@ namespace Asa.RFID
else if (ErrCode == 14 && IsConnect)
{
LOGGER.Error(IP + " Receive Code: " + ErrCode + " 进行重连");
LogUtil.error(IP + " Receive Code: " + ErrCode + " 进行重连");
// LogUtil.error(IP + " Receive Code: " + ErrCode + " 进行重连");
StopAutoScan();
StartAutoScan(this.Received);
break;
......@@ -293,45 +292,4 @@ namespace Asa.RFID
return s;
}
}
public class RFIDData
{
/// <summary>
/// RFID类型,区分是料架还是托盘,托盘E=69,包装料料架A=65,料串=B
/// </summary>
public char RFType = 'E';
/// <summary>
/// 托盘编号,从1-32
/// </summary>
public int Num = 0;
public RFIDData(int num, int t)
{
this.RFType = (char)t;
this.Num = num;
}
public RFIDData(byte[] data)
{
try
{
if (data != null && data.Length > 2)
{
RFType = (char)data[1];
Num = (int)(data[2]);
}
}
catch (Exception ex)
{
LogUtil.error("RFIP 数据【" + data + "】 获取编码失败");
}
}
public byte[] ToData()
{
return new byte[] { (byte)RFType, (byte)Num };
}
public string NumStr()
{
return "" + RFType + "" + Num.ToString().PadLeft(2, '0') + "";
}
}
}
......@@ -14,8 +14,14 @@ namespace OnlineStore.DeviceLibrary
public class RFIDManager
{
public static void Open(string[] iparray)
{
RFIDReader.Open(null ,iparray);
{
try
{
RFIDReader.Open(null, iparray);
}catch(Exception ex)
{
LogUtil.error("Open 出错:" + ex.ToString());
}
}
public static RFIDData ReadRFID(string ip, bool isClear = false)
......
......@@ -81,40 +81,8 @@ namespace OnlineStore.DeviceLibrary
return VMILine;
}
private static string api_communication = "service/store/communication"; //流水线状态通信接口
private static string api_nextFeeder = "service/store/nextFeeder"; // 出库站位列表切换接口
public static string GetPostApi(string host)
{
if (host == "")
{
host = ConfigAppSettings.GetValue(Setting_Init.http_server);
}
if (!host.StartsWith("http://"))
{
host = "http://" + host;
}
if (!host.EndsWith("/"))
{
host = host + "/";
}
return host + api_communication;
}
public static string GetNextFeederApi(string host)
{
if (host == "")
{
host = ConfigAppSettings.GetValue(Setting_Init.http_server);
}
if (!host.StartsWith("http://"))
{
host = "http://" + host;
}
if (!host.EndsWith("/"))
{
host = host + "/";
}
return host + api_nextFeeder;
}
public static bool checkWatch(Stopwatch watch, int targetMs, bool isStop = true)
{
if (!watch.IsRunning)
......
......@@ -270,10 +270,9 @@ namespace OnlineStore.DeviceLibrary
else if (span.TotalMilliseconds > StopDownMS)
{
ol_noshelfWatch.Stop();
if (IOManager.IOValue(IO_Type.OutL_OutStopDown).Equals(IO_VALUE.HIGH))
{
IOManager.IOMove(IO_Type.OutL_OutStopDown, IO_VALUE.LOW);
}
IOManager.CIOMove(IO_Type.OutL_OutStopDown, IO_VALUE.LOW);
}
}
private DateTime il_lastCallAgvTime = DateTime.Now;
......@@ -450,6 +449,17 @@ namespace OnlineStore.DeviceLibrary
{
LedProcess();
RFIDData rfidData = RFIDManager.ReadRFID(Config.InL_In_RFIDIP);
bool result = SendVmiRfid(rfidData.NumStr());
if (result)
{
IOManager.CIOMove(IO_Type.InL_InStopDown, IO_VALUE.HIGH);
}
else
{
IOManager.CIOMove(IO_Type.InL_InStopDown, IO_VALUE.LOW);
}
}
catch (Exception ex)
{
......@@ -458,6 +468,33 @@ namespace OnlineStore.DeviceLibrary
isInProcess = false;
}
#endregion
private string http_server = ConfigAppSettings.GetValue(Setting_Init.http_server);
private string api_communication = "service/store/qisda/vmiRfid?rfid="; //流水线状态通信接口
public bool SendVmiRfid(string rfid)
{
try
{
if (http_server.EndsWith("/"))
{
http_server = http_server.Substring(0, http_server.Length - 1);
}
string addr = http_server + api_communication + rfid;
string resultStr = HttpHelper.Post(addr, "");
if (resultStr.Equals("move"))
{
LogUtil.info("vmiRfid 【" + addr + "】【" + resultStr + "】");
return true;
}
}
catch (Exception ex)
{
LogUtil.error(Name + " " + ex.ToString());
}
return false;
}
#endregion
}
}
\ No newline at end of file
......@@ -16,23 +16,25 @@ namespace OnlineStore.DeviceLibrary
private static Asa.Client agvClient;
public static Dictionary<string, string> actionMap = new Dictionary<string, string>();
public static List<string> NodeList = new List<string>();
private static bool isInit = false;
public static void Init()
{
try
{
if (agvClient == null)
if (!isInit)
{
isInit = true;
agvClient = new Asa.Client(ServerIp);
agvClient.Log += AgvClient_Log;
agvClient.Arrive += AgvClient_Arrive;
agvClient.CanEnter += AgvClient_CanEnter;
agvClient.Ready += AgvClient_Ready;
}
actionMap = new Dictionary<string, string>();
foreach (string key in NodeList)
{
actionMap.Add(key, AGVAction.None);
}
agvClient.Log += AgvClient_Log;
agvClient.Arrive += AgvClient_Arrive;
agvClient.CanEnter += AgvClient_CanEnter;
agvClient.Ready += AgvClient_Ready;
agvClient.Connect();
agvClient.SetNodeID(NodeList.ToArray());
......@@ -47,7 +49,7 @@ namespace OnlineStore.DeviceLibrary
{
RFIDData data = new RFIDData(content);
LogUtil.info("收到 AgvClient_Ready [" + id + "] [" + data.ToData() + "] 未找到对应的设备 ");
MayEnter("C2");
}
private static void AgvClient_CanEnter(string id, byte[] content)
......@@ -104,7 +106,11 @@ namespace OnlineStore.DeviceLibrary
}
public static void IsEnter(string NodeName, bool result)
{
agvClient.IsEnter(NodeName, result);
if (result)
{
agvClient.IsEnter(NodeName);
}
}
private static void AgvClient_Log(string s)
{
......
......@@ -14,10 +14,13 @@
<add key="store_count" value="1" />
<!--start one store config-->
<add key="Line_Config" value="\LineConfig\VMILineConfig.csv" />
<add key="Config_Pwd" value="123456" />
<add key="Config_Pwd" value="123456" />
<!--IO配置-->
<add key="UseAIOBOX" value="1" />
<add key ="DIMS" value ="60"/>
<add key ="DOMS" value ="300"/>
<!--AGV调度服务器地址-->
<add key="AgvServerIp" value="localhost" />
<add key="AgvServerIp" value="192.168.103.12" />
<!--是否调试状态-->
<add key="IsInDebug" value="1" />
......
......@@ -29,8 +29,8 @@
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.lblThisSta = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.lblInfo = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.lblInfo = new System.Windows.Forms.Label();
this.btnVmiExit = new System.Windows.Forms.Button();
this.btnVmiStart = new System.Windows.Forms.Button();
this.chbDebug = new System.Windows.Forms.CheckBox();
......@@ -64,6 +64,7 @@
this.btnNeedLeave = new System.Windows.Forms.Button();
this.btnDis = new System.Windows.Forms.Button();
this.btnInit = new System.Windows.Forms.Button();
this.txtname = new System.Windows.Forms.TextBox();
this.groupBox3.SuspendLayout();
this.panel1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
......@@ -126,16 +127,6 @@
this.groupBox3.TabStop = false;
this.groupBox3.Text = "设备状态";
//
// lblInfo
//
this.lblInfo.AutoSize = true;
this.lblInfo.Location = new System.Drawing.Point(593, 14);
this.lblInfo.Name = "lblInfo";
this.lblInfo.Size = new System.Drawing.Size(56, 17);
this.lblInfo.TabIndex = 273;
this.lblInfo.Text = "运行信息";
this.lblInfo.Visible = false;
//
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
......@@ -152,6 +143,16 @@
this.panel1.Size = new System.Drawing.Size(1121, 45);
this.panel1.TabIndex = 273;
//
// lblInfo
//
this.lblInfo.AutoSize = true;
this.lblInfo.Location = new System.Drawing.Point(593, 14);
this.lblInfo.Name = "lblInfo";
this.lblInfo.Size = new System.Drawing.Size(56, 17);
this.lblInfo.TabIndex = 273;
this.lblInfo.Text = "运行信息";
this.lblInfo.Visible = false;
//
// btnVmiExit
//
this.btnVmiExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
......@@ -488,6 +489,7 @@
//
this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox5.Controls.Add(this.txtname);
this.groupBox5.Controls.Add(this.btnNeedEntry);
this.groupBox5.Controls.Add(this.btnNeedLeave);
this.groupBox5.Controls.Add(this.btnDis);
......@@ -502,7 +504,7 @@
// btnNeedEntry
//
this.btnNeedEntry.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNeedEntry.Location = new System.Drawing.Point(437, 22);
this.btnNeedEntry.Location = new System.Drawing.Point(498, 22);
this.btnNeedEntry.Name = "btnNeedEntry";
this.btnNeedEntry.Size = new System.Drawing.Size(132, 39);
this.btnNeedEntry.TabIndex = 4;
......@@ -513,7 +515,7 @@
// btnNeedLeave
//
this.btnNeedLeave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNeedLeave.Location = new System.Drawing.Point(299, 22);
this.btnNeedLeave.Location = new System.Drawing.Point(360, 22);
this.btnNeedLeave.Name = "btnNeedLeave";
this.btnNeedLeave.Size = new System.Drawing.Size(132, 39);
this.btnNeedLeave.TabIndex = 3;
......@@ -543,6 +545,16 @@
this.btnInit.UseVisualStyleBackColor = true;
this.btnInit.Click += new System.EventHandler(this.btnInit_Click);
//
// txtname
//
this.txtname.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtname.Location = new System.Drawing.Point(299, 29);
this.txtname.MaxLength = 4;
this.txtname.Name = "txtname";
this.txtname.Size = new System.Drawing.Size(53, 26);
this.txtname.TabIndex = 5;
this.txtname.Text = "C2";
//
// FrmVMIClient
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
......@@ -571,6 +583,7 @@
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.ResumeLayout(false);
}
......@@ -617,6 +630,7 @@
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.Button btnStopTDown;
private System.Windows.Forms.ComboBox cmbStopList;
private System.Windows.Forms.TextBox txtname;
}
}
......@@ -120,7 +120,7 @@ namespace OnlineStore.ACSingleStore
if (!this.Visible)
{
return;
}
}
ReadIOList();
lblWarnMsg.Text = vmiLine.WarnMsg;
lblThisSta.Text = LineManager.GetRunStr(vmiLine.runStatus);
......@@ -359,20 +359,25 @@ namespace OnlineStore.ACSingleStore
{
vmiLine.StopMove();
}
string agvName = "C2";
private void btnNeedLeave_Click(object sender, EventArgs e)
{
AgvClient.NeedLeave(vmiLine.Config.InL_AgvName);
AgvClient.NeedLeave(agvName);
}
private void btnNeedEntry_Click(object sender, EventArgs e)
{
AgvClient.NeedEnter(vmiLine.Config.OutL_AgvName);
AgvClient.NeedEnter(agvName);
}
private void btnInit_Click(object sender, EventArgs e)
{
agvName = txtname.Text.Trim();
if (AgvClient.NodeList.Contains(agvName).Equals(false))
{
AgvClient.NodeList.Add(agvName);
}
AgvClient.Init();
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!