Commit 25fc7d60 LN

1

1 个父辈 b9e9823f
正在显示 119 个修改的文件 包含 2935 行增加782 行删除
......@@ -69,6 +69,7 @@
<Compile Include="util\TcpClient.cs" />
<Compile Include="util\TcpServer.cs" />
<Compile Include="util\UdpServer.cs" />
<Compile Include="util\WaitUtil.cs" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
......
......@@ -31,6 +31,6 @@ using System.Runtime.InteropServices;
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
......@@ -11,6 +11,7 @@ namespace OnlineStore.Common
/// </summary>
public class Setting_Init
{
public static string Agv_Log_Open = "Agv_Log_Open";
public static string Server_Log_Open = "Server_Log_Open";
/// <summary>
/// 系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要
......@@ -20,10 +21,7 @@ namespace OnlineStore.Common
/// 系统主界面标题
/// </summary>
public static string App_Title = "App_Title";
/// <summary>
/// 扫码枪开始命令发送给socket的消息
/// </summary>
public static string scanner_start_command = "scanner_start_command";
public static string http_server = "http.server";
public static string Store_CID = "Store_CID";
......@@ -37,7 +35,7 @@ namespace OnlineStore.Common
/// </summary>
public static string Store_Type = "Store_Type";
public static string Store_ConfigPath = "Store_ConfigPath";
public static string BOX_ConfigPath = "BOX_ConfigPath";
public static string Store_Position_Config = "Store_Position_Config";
/// <summary>
/// 摄像机名称,多个中间使用#分割
......@@ -69,41 +67,28 @@ namespace OnlineStore.Common
public static string Config_Pwd = "Config_Pwd";
/// <summary>
/// 上料轴转换系数,plus/mm
/// 出库等待料盘拿走的时间,秒
/// </summary>
public static string AxisChangeValue = "AxisChangeValue";
/// <summary>
/// 是否是代码运行,不需要连接设备
/// </summary>
public static string CodeRun = "CodeRun";
public static string ComAxisChangeValue = "ComAxisChangeValue";
public static string OutStoreWaitSeconds = "OutStoreWaitSeconds";
public static string DebugPosId = "DebugPosId";
public static string HasDisableDoorControl = "HasDisableDoorControl";
/// <summary>
/// 伺服波特率,默认9600
/// 温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪
/// </summary>
public static string ACBaudRate = "ACBaudRate";
public static string Default_Language = "Default_Language";
public static string HumitureControllerType = "HumitureControllerType";
public static string UseAIOBOX = "UseAIOBOX";
/// <summary>
/// 单盘入库默认PosID
/// </summary>
public static string SinglePosId = "SinglePosId";
public static string DeCodeType = "DeCodeType";
public static string LineServerIp = "LineServerIp";
public static string LineServerPort = "LineServerPort";
public static string LibNameType = "LibNameType";
public static string DefaultPWD = "DefaultPWD";
public static string LOC = "LOC";
public static string QRCodeCount = "QRCodeCount";
public static string OpenCycleOut = "OpenCycleOut";
public static string AIOAutoUpload = "AIOAutoUpload";
public static string ACBaudRate = "ACBaudRate";
public static string Store_ConfigPath = "Store_ConfigPath";
public static string UseBuzzer = "UseBuzzer";
public static string Shelf_Position_Config = "Shelf_Position_Config";
public static string Tool_P3_Offset = "Tool_P3_Offset";
......@@ -114,6 +99,9 @@ namespace OnlineStore.Common
public static string Tool_TargetSpeed = "Tool_TargetSpeed";
public static string Tool_TargetPosition = "Tool_TargetPosition";
public static string AgvServerIp = "AgvServerIp";
public static string CodeCount = "CodeCount";
public static string AutoShelfInstore = "AutoShelfInstore";
public static string UseDoor = "UseDoor";
}
}
......@@ -64,19 +64,6 @@ namespace OnlineStore.Common
/// </summary>
public string msg { get; set; }
/// <summary>
///提示消息类型
/// </summary>
public string msgCode { get; set; }
/// <summary>
/// 消息参数
/// </summary>
public string[] msgParam { get; set; }
/// <summary>
/// 中文: zh 英文: en 日语: jp
/// msgData中key为zh, value为对应语言的消息内容
/// </summary>
public Dictionary<string,string> msgData { get; set; }
/// <summary>
/// 包含的多个 BOX 的状态信息
/// </summary>
public Dictionary<int, BoxStatus> boxStatus = new Dictionary<int, BoxStatus>();
......@@ -84,7 +71,6 @@ namespace OnlineStore.Common
/// 报警集合
/// </summary>
public List<AlarmInfo> alarmList = new List<AlarmInfo>();
}
/// <summary>
......@@ -111,14 +97,6 @@ namespace OnlineStore.Common
/// </summary>
public string msg { get; set; }
/// <summary>
///提示消息类型
/// </summary>
public string msgCode { get; set; }
/// <summary>
/// 消息参数
/// </summary>
public string[] msgParam { get; set; }
/// <summary>
/// 温度
/// </summary>
public string temperature { get; set; }
......@@ -137,13 +115,6 @@ namespace OnlineStore.Common
get { return _data; }
set { _data = value; }
}
public void SetMsg(string msg,string type,params string[] param)
{
this.msg = msg;
this.msgCode = type;
this.msgParam = param;
}
}
public class AlarmInfo
{
......@@ -229,60 +200,41 @@ namespace OnlineStore.Common
/// 温度报警值
/// </summary>
public static string maxTemperature = "temp";
/// <summary>
/// 是否是单个出库,true表示单个出库,其他都是批量出库
/// </summary>
public static string singleOut = "singleOut";
/// <summary>
/// 打开门锁动作
/// urgentReel: true 表示紧急料,需要出到料串上
/// </summary>
public static string openLock = "openLock";
public static string urgentReel = "urgentReel";
/// <summary>
/// 批量出入库动作
/// cutReel: true 表示分盘料,需要出到料串上
/// </summary>
public static string startBatchIn = "startBatchIn";
public static string cutReel = "cutReel";
/// <summary>
/// 关闭门锁
/// smallReel: true 小料(7x8),放置到小料架上
/// </summary>
public static string closeLock = "closeLock";
public static string smallReel = "smallReel";
/// <summary>
/// 取出出库料盘动作
/// rfid: 分配的料架RFID
/// </summary>
public static string takeOutReel = "takeOutReel";
public static string rfid = "rfid";
/// <summary>
/// 门口料盘已取出
/// rfidLoc: 料架的架位,值为 - 1时,可以自由分配皮带线, 小料时,架位为1 - 46优先走1 / 2号皮带线,47 - 92优先走3 / 4号皮带线,
/// 70,71,72时只能分配到3 / 4号皮带线; 大料时,架位1 - 6优先走1 / 2号皮带线, 7 - 12优先走3 / 4号皮带线
/// </summary>
public static string confirmReelOut = "confirmReelOut";
/// <summary>
/// 单盘入库按钮
/// </summary>
public static string singleReelIn = "singleReelIn";
public static string doorStatus = "doorStatus";
public static string rfidLoc = "rfidLoc";
public static string doit = "doit";
public static string enable = "enable";
public static string barcode = "barcode";
public static string disable = "disable";
/// <summary>
/// 升降轴
/// </summary>
public static string updownAxis = "device_updownAxis";
/// <summary>
/// 旋转轴
/// 剩余任务数量,当剩余任务 《=1时,出库完成需要送出料架
/// 剩余任务数为0, 或者料架已放满,或者料架rfid与上一个任务不同,料架就要放出去
/// 剩余任务数为1时, 当前的料放完就可以把料架放出去了
///当前料放完,料架已满,也把料架放出去
/// </summary>
public static string middleAxis = "device_middleAxis";
public static string taskCount = "taskCount";
/// <summary>
/// 进出轴
/// 真实料架号,可能为空
/// </summary>
public static string inoutAxis = "device_inoutAxis";
/// <summary>
/// 批量上下料轴
/// </summary>
public static string batchAxis = "device_batchAxis";
public static string inPos = "inPos";
public static string realRfid = "realRfid";
}
}
......@@ -12,7 +12,7 @@ namespace OnlineStore.Common
public class AcSerialBean
{
#region 全部变量
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private SerialPort _serialPort = null;
private object lockObj = new object();
......@@ -53,34 +53,6 @@ namespace OnlineStore.Common
}
#endregion
#region 默认构造函数
///// <summary>
///// 默认构造函数,操作COM1,速度为9600,没有奇偶校验,8位字节,停止位为1 "COM1", 9600, Parity.None, 8, StopBits.One
///// </summary>
//public SerialBean()
//{
// _serialPort = new SerialPort();
//}
#endregion
#region 构造函数
///// <summary>
///// 构造函数,
///// </summary>
///// <param name="comPortName"></param>
//public SerialBean(string comPortName)
//{
// _serialPort = new SerialPort(comPortName);
// _serialPort.BaudRate = 9600;
// _serialPort.Parity = Parity.Even;
// _serialPort.DataBits = 8;
// _serialPort.StopBits = StopBits.One;
// _serialPort.Handshake = Handshake.None;
// _serialPort.RtsEnable = true;
// _serialPort.ReadTimeout = 2000;
// setSerialPort();
//}
#endregion
#region 构造函数,可以自定义串口的初始化参数
/// <summary>
......@@ -177,7 +149,7 @@ namespace OnlineStore.Common
}
catch (Exception Ex)
{
LogUtil.error(LOGGER, Ex.ToString());
LogUtil.error( Ex.ToString());
//throw Ex;
}
return ok;
......@@ -225,55 +197,6 @@ namespace OnlineStore.Common
#endregion
#region 发送数据string类型
//public void SendData(string data)
//{ //发送数据
// if (_serialPort.IsOpen)
// {
// lock (lockObj)
// {
// _serialPort.Write(data);
// System.Threading.Thread.Sleep(10);
// }
// }
//}
#endregion
#region 发送数据byte类型
///// <summary>
///// 数据发送
///// </summary>
///// <param name="data">要发送的数据字节</param>
//public void SendData(byte[] data, int offset, int count)
//{
// string strSend = "";
// for (int i = 0; i < data.Length; i++)
// {
// strSend += string.Format("{0:X2} ", data[i]);
// }
// LOGGER.Debug("【" + _serialPort.PortName + "】发送数据【" + strSend + "】");
// lock (lockObj)
// {
// try
// {
// if (_serialPort.IsOpen)
// {
// _serialPort.DiscardInBuffer();//清空接收缓冲区
// _serialPort.Write(data, offset, count);
// System.Threading.Thread.Sleep(10);
// }
// }
// catch (Exception ex)
// {
// _serialPort.DiscardOutBuffer();
// LogUtil.error(LOGGER, "SendData ERROR:" + ex.ToString(), 21);
// }
// }
//}
#endregion
#region 发送命令
/// <summary>
/// 发送命令
......@@ -358,8 +281,9 @@ namespace OnlineStore.Common
if (_serialPort.IsOpen)
{
if (Monitor.TryEnter(lockObj, 200))
if (Monitor.TryEnter(lockObj, 10))
{
//Monitor.Enter(lockObj);
try
{
_serialPort.DiscardInBuffer(); //清空接收缓冲区
......@@ -372,7 +296,7 @@ namespace OnlineStore.Common
}
while (num++ < Overtime)
{
if (_serialPort.BytesToRead >= ReceiveLength)
if (_serialPort.BytesToRead >= ReceiveData.Length)
break;
System.Threading.Thread.Sleep(1);
}
......@@ -380,10 +304,10 @@ namespace OnlineStore.Common
{
LogUtil.error(PortName + " 发送数据" + ByteToString(SendData) + "等待接受数据超时");
}
if (_serialPort.BytesToRead >= ReceiveLength)
if (_serialPort.BytesToRead >= ReceiveData.Length)
{
ret = _serialPort.Read(ReceiveData, 0, ReceiveLength);
ret = _serialPort.Read(ReceiveData, 0, ReceiveData.Length);
}
else
{
......@@ -413,31 +337,8 @@ namespace OnlineStore.Common
#endregion
#region 获取串口
/// <summary>
/// 获取所有已连接短信猫设备的串口
/// </summary>
/// <returns></returns>
public string[] serialsIsConnected()
{
List<string> lists = new List<string>();
string[] seriallist = getSerials();
foreach (string s in seriallist)
{
}
return lists.ToArray();
}
#endregion
#region 获取当前全部串口资源
/// <summary>
/// 获得当前电脑上的所有串口资源
/// </summary>
/// <returns></returns>
public string[] getSerials()
{
return SerialPort.GetPortNames();
}
#endregion
#region 字节型转换16
/// <summary>
/// 把字节型转换成十六进制字符串
......@@ -511,18 +412,6 @@ namespace OnlineStore.Common
}
return returnStr;
}
public static string byteToHexStr(byte[] bytes,string spilChar)
{
string returnStr = "";
if (bytes != null)
{
for (int i = 0; i < bytes.Length; i++)
{
returnStr += bytes[i].ToString("X2")+ spilChar;
}
}
return returnStr;
}
#endregion
#region 计算校验码
......
......@@ -12,7 +12,7 @@ namespace OnlineStore.Common
{
public class ConfigAppSettings
{
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static int seq = 1;
......@@ -20,65 +20,18 @@ namespace OnlineStore.Common
{
if (seq.Equals(Int32.MaxValue))
{
LOGGER.Info("seq当前值:" + seq + ",重置seq=0");
LogUtil.info("seq当前值:" + seq + ",重置seq=0");
seq = 0;
}
Interlocked.Increment(ref seq);
return seq;
}
public static string GetValue(string keyStr, string storeStr)
{
string key = keyStr + storeStr;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
return GetValue(keyStr);
}
else
{
return config.AppSettings.Settings[key].Value;
}
}
public static decimal GetNumValue(string keyStr, string storeStr)
{
string key = keyStr + storeStr;
decimal a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
return GetNumValue(keyStr);
}
else
{
{
Decimal.TryParse(config.AppSettings.Settings[key].Value, out a);
}
}
return a;
}
public static int GetIntValue(string keyStr, string storeStr)
{
string key = keyStr + storeStr;
int a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
return GetIntValue(keyStr);
}
else
{
{
Int32.TryParse(config.AppSettings.Settings[key].Value, out a);
}
} return a;
}
public static string GetValue(string key)
{
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LOGGER.Error("未找到配置:" + key + ",请检查配置是否完整!");
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return "";
}
else
......@@ -93,7 +46,7 @@ namespace OnlineStore.Common
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LOGGER.Error("未找到配置:" + key + ",请检查配置是否完整!");
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
......@@ -110,7 +63,7 @@ namespace OnlineStore.Common
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LOGGER.Error("未找到配置:" + key + ",请检查配置是否完整!");
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
......@@ -145,7 +98,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + "," + ex.StackTrace);
LogUtil.error( "SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + "," + ex.StackTrace);
}
}
......@@ -167,7 +120,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + "," + ex.StackTrace);
LogUtil.error( "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + "," + ex.StackTrace);
}
}
///<summary>
......@@ -199,18 +152,8 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + "," + ex.StackTrace);
}
LogUtil.error( "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + "," + ex.StackTrace);
}
public static string GetValue(object debugPosId)
{
throw new NotImplementedException();
}
public static void SaveValue(object default_Language, string str)
{
throw new NotImplementedException();
}
}
}
......@@ -80,7 +80,7 @@ namespace OnlineStore.Common
public static string GetSpanStr(TimeSpan span)
{
//return Convert.ToDateTime(span.ToString()).ToString("HH:mm:ss");
string seconds = Math.Round(span.TotalSeconds % 60).ToString();
string seconds = Math.Round(span.TotalSeconds % 60, 1).ToString();
if (seconds.IndexOf(".") >= 0)
{
seconds = seconds.ToString().PadLeft(4, '0');
......@@ -91,5 +91,36 @@ namespace OnlineStore.Common
}
return span.Hours.ToString().PadLeft(2, '0') + ":" + span.Minutes.ToString().PadLeft(2, '0') + ":" + seconds;
}
public static bool GetBoolData(Dictionary<string, string> data, string key, bool defaultValue = false)
{
if (data.ContainsKey(key))
{
try
{
return Convert.ToBoolean(data[key]);
}
catch (Exception ex)
{
}
}
return defaultValue;
}
public static int GetIntData(Dictionary<string, string> data, string key, int defaultValue = 0)
{
if (data.ContainsKey(key))
{
try
{
return Convert.ToInt32(data[key]);
}
catch (Exception ex)
{
}
}
return defaultValue;
}
}
}
......@@ -12,16 +12,39 @@ using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Reflection;
using log4net;
using System.Net.NetworkInformation;
namespace OnlineStore.Common
{
public class HttpHelper
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static string Post(string url, string paramData)
{
return Post(url, paramData, Encoding.UTF8);
}
//public static bool PingURLIP(string url, int ms=100)
//{
// string[] urlArray = url.Split('/');
// if (urlArray.Length > 3)
// {
// string ip = urlArray[2];
// Ping pingSender = new Ping();
// PingReply reply = pingSender.Send(ip, ms);//第一个参数为ip地址,第二个参数为ping的时间
// if (reply.Status == IPStatus.Success)
// {
// //通
// return true;
// }
// else
// {
// //不通
// return false;
// }
// }
// return true;
//}
/// <summary>
///
......@@ -34,6 +57,15 @@ namespace OnlineStore.Common
{
try
{
////如果Op=0或者Op=5,先拼Ip,不通不发送
//if (operation.op < 0 || operation.op.Equals(5))
//{
// if (PingURLIP(url, 100).Equals(false))
// {
// return null;
// }
//}
if (simulate)
{//模拟服务器返回
operation.status = 200;
......@@ -45,7 +77,7 @@ namespace OnlineStore.Common
{//入库或出库
string json = JsonHelper.SerializeObject(operation);
LogUtil.error(LOGGER, "模拟HTTP服务器返回出库入库信息:" + json);
LogUtil.error("模拟HTTP服务器返回出库入库信息:" + json);
return operation;
}
}
......@@ -58,7 +90,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LOGGER.Error("JsonHelper.SerializeObject(operation) 出错【operation.op=" + operation.op + "】" + ex);
LogUtil.error("JsonHelper.SerializeObject(operation) 出错【operation.op=" + operation.op + "】" + ex);
}
string result = Post(url, json);
if (!string.IsNullOrEmpty(result))
......@@ -69,27 +101,29 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LOGGER.Error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex);
LogUtil.error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex);
}
}
}
}
catch (Exception ex)
{
LOGGER.Error("Post 出错【operation.op=" + operation.op + "】:" + ex);
LogUtil.error("Post 出错【operation.op=" + operation.op + "】:" + ex);
}
return null;
}
public static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
public static string Post(string url, string paramData="", Encoding encoding=null)
{
if (encoding == null)
private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
public static string LastServerMsg = "";
public static string Post(string url, string paramData, Encoding encoding)
{
encoding = Encoding.UTF8;
}
//if (PingURLIP(url, 100).Equals(false))
//{
// return null;
//}
if (isLog == 1)
{
LOGGER.Info("给服务器发送数据【" + paramData + "】 ");
LogUtil.info("给服务器发送数据【" + paramData + "】 ");
}
if (paramData != "null" && paramData != null)
{
......@@ -110,13 +144,12 @@ namespace OnlineStore.Common
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
wc.Encoding = encoding;
//paramData = Uri.EscapeDataString(paramData);
result = wc.UploadString(url, "POST", paramData);
//LogUtil.info(result);
}
catch (Exception e)
{
LogUtil.error( "POST【"+ paramData + "】 ERROR:" + e.StackTrace, 1);
LogUtil.error("POST ERROR:" + e.ToString(), 1);
}
if (!result.Contains("null") && result.Length != 0)
{
......@@ -124,8 +157,13 @@ namespace OnlineStore.Common
}
if (isLog == 1)
{
LOGGER.Info("收到服务器数据【" + result + "】");
LogUtil.info("收到服务器数据【" + result + "】");
}
LastServerMsg = DateTime.Now.ToLongTimeString() + " URL:" + url + "\r\n"
+ "发送:" + paramData + "\r\n"
+ "接收:" + result + "\r\n"
;
return result;
}
......@@ -138,19 +176,19 @@ namespace OnlineStore.Common
{
try
{
LogUtil.debug(LOGGER, "HTTP GET FROM: " + url);
LogUtil.info("HTTP GET FROM: " + url);
var wc = new WebClient { Encoding = encoding };
var readStream = wc.OpenRead(url);
using (var sr = new StreamReader(readStream, encoding))
{
var result = sr.ReadToEnd();
LogUtil.debug(LOGGER, "receive << " + result);
LogUtil.info("receive << " + result);
return result;
}
}
catch (Exception e)
{
LogUtil.error( "HTTP GET ERROR:" + e.Message, 2);
LogUtil.error("HTTP GET ERROR:" + e.Message, 2);
}
return "";
}
......
......@@ -15,33 +15,33 @@ namespace OnlineStore.Common
/// </summary>
public class HumitureServer
{
private static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// 最后一次接受到的温度信息,key=温湿度传感器IP地址
/// </summary>
public static Dictionary<string, ASTemperateParam> TemperateParamMap = new Dictionary<string, ASTemperateParam>();
public static Dictionary<string, HumitureParam> TemperateParamMap = new Dictionary<string, HumitureParam>();
/// <summary>
/// 根据IP 地址获得最后一次取到的温湿度
/// </summary>
public static ASTemperateParam GetTemperateParam(string ipAddr)
public static HumitureParam GetTemperateParam(string ipAddr)
{
ASTemperateParam temperate = null;
HumitureParam temperate = null;
TemperateParamMap.TryGetValue(ipAddr, out temperate);
return temperate;
}
/// <summary>
/// 显示用的温湿度信息(改为计算平均温湿度)
/// </summary>
public static ASTemperateParam GetTemperateParam(List<string> ipAddrList)
public static HumitureParam GetTemperateParam(List<string> ipAddrList)
{
ASTemperateParam temperate = null;
HumitureParam temperate = null;
int allCount = 0;
double wenDu = 0;
double shiDu = 0;
foreach (string addr in ipAddrList)
{
ASTemperateParam param = GetTemperateParam(addr);
HumitureParam param = GetTemperateParam(addr);
if (param != null && param.IsValid())
{
allCount++;
......@@ -53,7 +53,7 @@ namespace OnlineStore.Common
{
double avgWendu = Math.Round(wenDu / allCount, 1);
double avgShidu = Math.Round(shiDu / allCount, 1);
temperate = new ASTemperateParam(avgWendu, avgShidu);
temperate = new HumitureParam(avgWendu, avgShidu);
}
return temperate;
}
......@@ -62,7 +62,7 @@ namespace OnlineStore.Common
double maxValue = 0;
foreach (string addr in ipAddrList)
{
ASTemperateParam param = GetTemperateParam(addr);
HumitureParam param = GetTemperateParam(addr);
if (param != null && param.IsValid())
{
if (param.Humidity > maxValue)
......@@ -92,7 +92,7 @@ namespace OnlineStore.Common
}
TemperateIsStart = true;
temperateTcpServer.Start(port);
LogUtil.info(LOGGER, "温湿度已开始在端口[" + port + "]监听!");
LogUtil.info( "温湿度已开始在端口[" + port + "]监听!");
temperateTcpServer.ReviceMsgEvent += tcp_ReviceMsgEvent;
}
}
......@@ -111,7 +111,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "关闭温湿度监听出错:" + ex.ToString());
LogUtil.error( "关闭温湿度监听出错:" + ex.ToString());
}
}
......@@ -132,16 +132,16 @@ namespace OnlineStore.Common
string deviceId = strList[10];
string pwd = strList[11];
LogUtil.debug(LOGGER, "address=" + add + ",收到:温度=" + wendu + ",湿度=" + shidu + ",设备ID=" + deviceId + ",密码:" + pwd);
LogUtil.debug( "address=" + add + ",收到:温度=" + wendu + ",湿度=" + shidu + ",设备ID=" + deviceId + ",密码:" + pwd);
if (shidu <= 0)
{
//湿度小于0不处理
LogUtil.info(LOGGER, "address=" + add + ",收到:温度=" + wendu + ",湿度=" + shidu + ",设备ID=" + deviceId + ",密码:" + pwd + ",湿度小于0不处理");
LogUtil.info( "address=" + add + ",收到:温度=" + wendu + ",湿度=" + shidu + ",设备ID=" + deviceId + ",密码:" + pwd + ",湿度小于0不处理");
}
else
{
double newShiDu = GetRandomSD();
ASTemperateParam ast = new ASTemperateParam(add, deviceId, pwd, wendu, newShiDu, DateTime.Now);
HumitureParam ast = new HumitureParam(add, deviceId, pwd, wendu, newShiDu, DateTime.Now);
if (TemperateParamMap.ContainsKey(add))
{
TemperateParamMap.Remove(add);
......@@ -152,7 +152,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LogUtil.error(LOGGER, ex.ToString());
LogUtil.error( ex.ToString());
}
}
private static double PreShiDu = 7;
......@@ -165,13 +165,13 @@ namespace OnlineStore.Common
{
double newShiDu = GetRandomSD();
double newWenDu = GetRandomWD();
ASTemperateParam ast = new ASTemperateParam(IP, "", "", newWenDu, newShiDu, DateTime.Now);
HumitureParam ast = new HumitureParam(IP, "", "", newWenDu, newShiDu, DateTime.Now);
if (TemperateParamMap.ContainsKey(IP))
{
TemperateParamMap.Remove(IP);
}
TemperateParamMap.Add(IP, ast);
//LogUtil.info(LOGGER, "address=" + IP + ",收到:温度=" + newWenDu + ",湿度=" + newShiDu + " ");
//LogUtil.info( "address=" + IP + ",收到:温度=" + newWenDu + ",湿度=" + newShiDu + " ");
}
}catch(Exception ex)
{
......@@ -213,9 +213,9 @@ namespace OnlineStore.Common
/// <summary>
/// 奥松温湿度上传参数
/// </summary>
public class ASTemperateParam
public class HumitureParam
{
public ASTemperateParam(string clientipe, string add, string pwd, double wendu, double shidu, DateTime updateTime)
public HumitureParam(string clientipe, string add, string pwd, double wendu, double shidu, DateTime updateTime)
{
this.IpAddress = clientipe;
this.DeviceAddress = add;
......@@ -225,31 +225,13 @@ namespace OnlineStore.Common
this.UpdateTime = updateTime;
}
//获取平均值时使用此 参数,只做显示用
public ASTemperateParam(double wendu, double shidu)
public HumitureParam(double wendu, double shidu)
{
this.IpAddress = "";
this.DeviceAddress = "";
this.Password = "";
//if (shidu > 5)
//{
// double nowShidu = shidu-7;
// if (nowShidu < 3)
// {
// int abs = (int)Math.Round(nowShidu, 0);
// if (abs < 0)
// {
// abs -= 1;
// }
// nowShidu = (4 - abs) + nowShidu;
// }
// this.Humidity = nowShidu;
//}
//else
//{
// this.Humidity = shidu;
//}
this.Humidity = shidu;
this.Temperate = wendu;
this.Humidity = shidu;
this.UpdateTime = DateTime.Now;
}
/// <summary>
......
......@@ -11,72 +11,55 @@ namespace OnlineStore.Common
{
public class LogUtil
{
public static readonly ILog AIOLog = LogManager.GetLogger("AIOBOXLog");
private static LogUtil instance = new LogUtil();
public delegate void ShowLog(string msg, Color color);
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// public static readonly ILog AIOLog = LogManager.GetLogger("AIOBOX");
public static readonly ILog LOGGER = LogManager.GetLogger("RollingLogFileAppender");
public static Dictionary<int, DateTime> lastErrorLogTime = new Dictionary<int, DateTime>();
public static System.Windows.Forms.RichTextBox logBox = null;
public static int showCount = 100;
public static int showCount = 20;
public static bool debug_opened = false;
public static void info(ILog log,string msg )
{
if (log == null)
{
return;
}
log.Info( " - " + msg);
if (logBox == null)
public static void info(ILog log, string msg)
{
return;
}
log.Info(" - " + msg);
AddToBox(msg, Color.Black);
//clear();
}
public static void info(ILog log,string msg, Color color)
public static void info(ILog log, string msg, Color color)
{
log.Info( " - " + msg);
if (logBox == null)
{
return;
}
log.Info(" - " + msg);
AddToBox(msg, color);
}
public static void debug(ILog log, string msg, Color color)
{
log.Debug( " - " + msg);
log.Debug(" - " + msg);
if (debug_opened)
{
if (logBox == null)
{
return;
}
AddToBox(msg, color);
}
}
public static void debug(ILog log, string msg)
{
log.Debug( " - " + msg);
log.Debug(" - " + msg);
if (debug_opened)
{
if (logBox == null)
{
return;
}
AddToBox(msg, Color.Gray);
}
}
public static void error( string errorMsg,int type)
private static List<string> lasErrorLogList = new List<string>();
public static void error(string errorMsg, int type, int spanSeconds = 10)
{
try
{
if (lastErrorLogTime.ContainsKey(type))
{
TimeSpan span = DateTime.Now - lastErrorLogTime[type];
if (span.TotalSeconds < 10)
if (span.TotalSeconds < spanSeconds)
{
return;
}
......@@ -84,86 +67,134 @@ namespace OnlineStore.Common
{
lastErrorLogTime.Remove(type);
lastErrorLogTime.Add(type, DateTime.Now);
error( errorMsg);
error(LOGGER, errorMsg);
}
}
else
{
lastErrorLogTime.Add(type, DateTime.Now);
error( errorMsg);
error(LOGGER, errorMsg);
}
}
public static void error(ILog log, string errorMsg)
{
//if (!lasErrorLogList.Contains(errorMsg))
{
log.Error( " - " + errorMsg);
if (logBox == null)
catch (Exception ex)
{
return;
LOGGER.Error(" 打印日志【" + type + "-" + errorMsg + "】出错:" + ex.ToString());
}
AddToBox(errorMsg, Color.Red);
}
//lasErrorLogList.Add(errorMsg);
//if (lasErrorLogList.Count > errCount)
//{
// lasErrorLogList.RemoveAt(0);
//}
public static void error(ILog log, string errorMsg)
{
log.Error(" - " + errorMsg);
AddToBox(errorMsg, Color.Red);
}
private static void AddToBox(string msg, Color color)
{
try
{
ShowLogPro(msg);
ShowLogPro(msg, color);
}
catch (Exception ex)
{
LOGGER.Error("出错:" + ex.StackTrace);
}
}
private static int count = 0;
private static void ShowLogPro(string msg )
private static List<string> logList = new List<string>();
public static string LastText = "";
private static void ShowLogPro(string msg, Color color)
{
try
{
//clear();
if (count > showCount)
if (logList.Count > 0)
{
// logList.RemoveAt(0);
}
if (logList.Count >= showCount)
{
count = 0;
logBox.Clear();
logList.RemoveAt(0);
}
string text = "";
foreach (string str in logList)
{
text += str;
}
//logBox.SelectionColor = color;
System.DateTime now = System.DateTime.Now;
logBox.AppendText(now.ToLongTimeString() + " " + msg + Environment.NewLine);
count++;
logList.Add(now.ToLongTimeString() + " " + msg + Environment.NewLine);
if (logBox == null)
{
return;
}
LastText = text;
if (logBox.Visible)
{
logBox.Text = text;
// logBox.Focus(); //使文本框获取焦点
logBox.AppendText(now.ToLongTimeString() + " " + msg + Environment.NewLine); //增加文本
TimeSpan span = DateTime.Now - lastTime;
if (span.TotalSeconds > 3000000)
{
lastTime = DateTime.Now;
logBox.Select(logBox.Text.Length, 0); //设置光标的位置到文本尾
logBox.ScrollToCaret(); //滚动到控件光标处
}
}
}
catch (Exception ex)
{
LOGGER.Error("出错:" + ex.ToString());
}
}
public static void debug(string msg)
private static DateTime lastTime = DateTime.Now;
public static void UpdateLogbox()
{
debug(LOGGER, msg);
try
{
if (logBox != null && logBox.Visible)
{
logBox.Text = LastText;
TimeSpan span = DateTime.Now - lastTime;
if (span.TotalSeconds > 3000000)
{
lastTime = DateTime.Now;
logBox.Select(logBox.Text.Length, 0); //设置光标的位置到文本尾
logBox.ScrollToCaret(); //滚动到控件光标处
}
public static void error(string errorMsg)
}
}
catch (Exception ex)
{
error( LOGGER,errorMsg);
LOGGER.Error("出错:" + ex.ToString());
}
}
public static void ClearLog()
{
if (logBox != null)
{
LastText = "";
logList.Clear();
logBox.Text = "";
count = 0;
}
}
public static void debug(string msg)
{
debug(LOGGER, msg);
}
public static void error(string errorMsg, Exception ex = null)
{
if (ex == null)
{
error(LOGGER, errorMsg);
}
else
{
error(LOGGER, errorMsg + ex.ToString());
}
}
public static void info(string msg)
{
info(LOGGER,msg );
info(LOGGER, msg);
}
}
......
......@@ -6,12 +6,13 @@ using System.Net;
using System.IO;
using log4net;
using System.Text;
using OnlineStore.Common;
namespace OnlineStore
{
public class NetTCPServer
{
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// TCP服务端监听
......@@ -118,13 +119,13 @@ namespace OnlineStore
NetworkStream ns = client.tcpClient.GetStream();
StreamReader sr = new StreamReader(ns);
string str = sr.ReadLine();
LOGGER.Info("读取到数据:"+str);
LogUtil.info("读取到数据:"+str);
byte[] recdata = new byte[ns.EndRead(ar)];
if (recdata.Length > 0)
{
//Array.Copy(client.Buffer, recdata, recdata.Length);
LOGGER.Info("读取到数据1111:" + Encoding.ASCII.GetString(recdata));
LogUtil.info("读取到数据1111:" + Encoding.ASCII.GetString(recdata));
//ns.BeginRead(client.Buffer, 0, client.Buffer.Length, new AsyncCallback(TCPCallBack), client);
}
else
......
......@@ -13,7 +13,7 @@ namespace OnlineStore.Common
/// </summary>
public class ScanCodeManager
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// 处理接收后的二维码
/// </summary>
......
......@@ -12,7 +12,11 @@ namespace OnlineStore.Common
{
public class TcpClient
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static string ServerIp = "";
private static int ServerPort = 0;
private System.Timers.Timer ReConnectTimer = null;
// public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public delegate void HandleMessage(string message);
private Socket m_clientSocket;
......@@ -77,13 +81,30 @@ namespace OnlineStore.Common
#endregion
}
/// <summary>
/// 是否在运行中
/// </summary>
/// <returns></returns>
public bool IsRun()
{
return ReConnectTimer.Enabled;
}
/// <summary>
/// 连接服务器
/// </summary>
public bool connect(string serverIP, int serverPort, HandleMessage HandleMessage)
public bool StartConnect(string serverIP, int serverPort, HandleMessage HandleMessage,int ReConnectMs=0)
{
m_clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Parse(serverIP), serverPort);
onReceived = HandleMessage;
ServerIp = serverIP;
ServerPort = serverPort;
ReConnectTimer = new System.Timers.Timer();
ReConnectTimer.Interval = ReConnectMs;
if (ReConnectMs > 0)
{
ReConnectTimer.AutoReset = true;
ReConnectTimer.Elapsed += ReConnectTimer_Elapsed;
}
try
{
m_clientSocket.Connect(remoteEndPoint);
......@@ -91,12 +112,13 @@ namespace OnlineStore.Common
{
m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null);
onReceived = HandleMessage;
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " success!");
LogUtil.info( "Connect to " + serverIP + ":" + serverPort + " success!");
ReConnectTimer.Start();
return true;
}
else
{
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " fail!");
LogUtil.info( "Connect to " + serverIP + ":" + serverPort + " fail!");
}
}
catch (Exception ex)
......@@ -104,22 +126,74 @@ namespace OnlineStore.Common
LogUtil.error("Connect to " + serverIP + ":" + serverPort + " fail!" + ex.ToString(),3);
m_clientSocket = null;
}
ReConnectTimer.Start();
return false;
}
private bool isInProcess = false;
private void ReConnectTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
try
{
if (isInProcess)
{
return;
}
isInProcess = true;
if (m_clientSocket != null)
{
if (m_clientSocket.Connected)
{
isInProcess = false;
return;
}
}
try
{
if (m_clientSocket != null)
{
m_clientSocket.Close();
LogUtil.debug( "Socket closed!");
}
}catch(Exception ex)
{
LogUtil.error("m_clientSocket.Close Error"+ex.ToString());
}
m_clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Parse(ServerIp), ServerPort);
m_clientSocket.Connect(remoteEndPoint);
if (m_clientSocket.Connected)
{
m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null);
LogUtil.info( "Connect to " + ServerIp + ":" + ServerPort + " success!");
}
isInProcess = false;
}
catch (Exception ex)
{
isInProcess = false;
LogUtil.error( "重连处理出错:" + ex.ToString(),9,180);
}
}
/// <summary>
/// 断开连接
/// </summary>
public void close()
{
ReConnectTimer.Stop();
if (m_clientSocket != null)
{
m_clientSocket.Close();
LogUtil.info(LOGGER,"Socket closed!");
LogUtil.info("Socket closed!");
}
else
{
LogUtil.error(LOGGER,"No socket is running!");
LogUtil.error("No socket is running!");
}
}
......@@ -135,7 +209,7 @@ namespace OnlineStore.Common
{
m_clientSocket.Send(sendBuffer);
LogUtil.debug(LOGGER,"Send >> " + strSendData);
LogUtil.debug("Send >> " + strSendData);
}
}
......
......@@ -12,17 +12,17 @@ namespace OnlineStore.Common
{
public class TcpServer
{
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private Thread m_serverThread;
private Socket m_serverSocket;
public delegate void ReviceMsg(Client client, string Msg);
public delegate void ReviceMsg(SocketClient client, string Msg);
/// <summary>
/// 接受到数据事件
/// </summary>
public event ReviceMsg ReviceMsgEvent;
private delegate void ReceiveMessageDelegate(Client client);
private delegate void ReceiveMessageDelegate(SocketClient client);
ReceiveMessageDelegate receiveMessageDelegate;
private bool isRun = true;
private void logLocalIp()
......@@ -39,7 +39,7 @@ namespace OnlineStore.Common
}
}
}
LogUtil.info(LOGGER, iplist + "]");
LogUtil.info( iplist + "]");
}
/// <summary>
......@@ -59,7 +59,7 @@ namespace OnlineStore.Common
m_serverThread = new Thread(new ThreadStart(ReceiveAccept));
m_serverThread.Start();
LogUtil.info(LOGGER, " Server start listen : " + m_serverPort);
LogUtil.info( " Server start listen : " + m_serverPort);
logLocalIp();
//this.AddRunningInfo(">> " + DateTime.Now.ToString() + " Server started.");
......@@ -95,20 +95,20 @@ namespace OnlineStore.Common
{
while (isRun)
{
Client client = new Client();
SocketClient client = new SocketClient();
try
{
client.ClientSocket = m_serverSocket.Accept();
IPEndPoint clientipe = (IPEndPoint)client.ClientSocket.RemoteEndPoint;
client.ipAdd = clientipe.Address;
LogUtil.info(LOGGER, "有新的客户端链接上:" + client.ipAdd.ToString());
LogUtil.info( "有新的客户端链接上:" + client.ipAdd.ToString());
receiveMessageDelegate = new ReceiveMessageDelegate(ReceiveMessages);
receiveMessageDelegate.BeginInvoke(client, ReceiveMessagesCallback, "");
}
catch (Exception ex)
{
LogUtil.error(LOGGER, ex.Message);
LogUtil.error( ex.Message);
//throw new Exception(ex.Message);
}
}
......@@ -116,7 +116,7 @@ namespace OnlineStore.Common
private StringBuilder sb = new StringBuilder(); //这个是用来保存:接收到了的,但是还没有结束的消息
private int receiveBufferSize = 1024;
private string terminateString = "\r";
public void ReceiveMessages(Client client) //这个函数会被以线程方式运行
public void ReceiveMessages(SocketClient client) //这个函数会被以线程方式运行
{
try
{
......@@ -198,7 +198,7 @@ namespace OnlineStore.Common
// }
// catch (Exception ex)
// {
// LOGGER.Error(ex.ToString());
// LogUtil.error(ex.ToString());
// }
//}
......@@ -210,7 +210,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LOGGER.Error(ex.ToString());
LogUtil.error(ex.ToString());
}
}
......@@ -243,11 +243,11 @@ namespace OnlineStore.Common
/// <summary>
/// 客户端会话信息类
/// </summary>
public class Client
public class SocketClient
{
Socket m_clientSocket;
public Client() { }
public SocketClient() { }
public IPAddress ipAdd { get; set; }
public Socket ClientSocket
{
......
......@@ -12,7 +12,7 @@ namespace OnlineStore.Common
public class UdpServer
{
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private Thread m_serverThread;
private Socket udpServer;
......@@ -37,7 +37,7 @@ namespace OnlineStore.Common
}
}
}
LogUtil.info(LOGGER, iplist + "]");
LogUtil.info( iplist + "]");
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace OnlineStore.Common
{
public class WaitUtil
{
public delegate bool IsOk();
/// <summary>
/// 使用异步委托检测超时,防止isOk方法不返回结果导致卡死的问题
/// </summary>
/// <param name="waitName"></param>
/// <param name="timeout"></param>
/// <param name="isOk"></param>
public static bool Wait(int timeout, IsOk isOk, string waitName = "")
{
DateTime startTime = System.DateTime.Now;
TimeSpan timoutSpan = TimeSpan.FromMilliseconds(timeout);
TimeSpan waitSpan = TimeSpan.FromMilliseconds(0);
int sleepTime = 10;
while (true)
{
TimeSpan remainTimes = timoutSpan.Subtract(waitSpan);
if (remainTimes.TotalMilliseconds < 0)
{
//已经超时
throw new TimeoutException(waitName + "超时");
}
try
{
IAsyncResult re = isOk.BeginInvoke(null, null);
var waitResult = re.AsyncWaitHandle.WaitOne(remainTimes);
if (waitResult)
{
bool okResult = isOk.EndInvoke(re);
if (okResult)
{
return true;
}
}
}
catch (Exception ex)
{
LogUtil.error("同步等待出现异常:" + ex.Message);
}
Thread.Sleep(sleepTime);
waitSpan = System.DateTime.Now.Subtract(startTime);
}
}
}
}
......@@ -6,64 +6,64 @@
<appSettings>
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1" />
<add key="App_Title" value="料仓_批量上下料" />
<add key="Server_Log_Open" value="0" />
<add key="scanner_start_command" value="S" />
<add key="App_Title" value="包装料料仓" />
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
<add key="StartBlowValue" value="0.5" />
<add key="StartBlowValue" value="4" />
<!-- 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)-->
<add key="StopBlowValue" value="1" />
<add key="StopBlowValue" value="4" />
<!--Server address-->
<!--<add key="http.server" value="" />-->
<add key="http.server" value="http://localhost/myproject/" />
<add key="http.server" value="http://10.85.160.25/myproject/" />
<!--storeType-->
<add key="store_count" value="1" />
<add key="store_count" value="2" />
<add key="Store_ConfigPath" value="\StoreConfig\StoreConfig.csv" />
<!--start one store config-->
<add key="Store_Position_Config" value="\StoreConfig\AC\linePositions.csv" />
<add key="Store_ConfigPath" value="\StoreConfig\AC\StoreConfig.csv" />
<add key="Store_Type" value="AUTO_SA_Config" />
<add key="Store_CID" value="rc1252-auto1" />
<add key="Shelf_Position_Config" value="\StoreConfig\shelfPosition.csv" />
<add key="Store_Position_Config" value="\StoreConfig\linePositions.csv" />
<add key="BOX_ConfigPath" value="\StoreConfig\BoxConfig.csv" />
<add key="Store_Type" value="RC_AC_PA" />
<add key="Store_CID" value="packing-store" />
<add key="Store_CID_1" value="packing-19" />
<add key="Store_CID_2" value="packing-20" />
<!--end one store config-->
<!--摄像机名称列表配置,用#分割-->
<add key="CameraName" value="GigE:acA3800-10gc (23124327)#GigE:acA3800-10gc (23172285)" />
<!--二维码类型列表配置,用#分割-->
<add key="CodeType" value="QR Code" />
<add key="CodeType" value="Data Matrix ECC 200#QR Code" />
<add key="ACBaudRate" value="115200" />
<add key="InOutDefaultPosition" value="52000" />
<add key="Config_Pwd" value="123456" />
<!--二维码类型列表配置,用#分割,一维码=Barcode 二维码: QR Code#Data Matrix ECC 200#Micro QR Code-->
<add key="CodeType" value="QR Code#Data Matrix ECC 200" />
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="\CodeParam\" />
<add key="InOutDefaultPosition" value="50000000" />
<add key="Config_Pwd" value="123456" />
<!--5000脉冲对应1mm-->
<add key="AxisChangeValue" value="4020" />
<!--压紧轴计量检测信号亮1次的脉冲值-->
<add key="ComAxisChangeValue" value="150000" />
<add key="DebugPosId" value="1#AC1_11_3_20" />
<!--是否有门禁屏蔽功能,=1表示有此功能-->
<add key="HasDisableDoorControl" value="1" />
<add key="ACBaudRate" value="115200" />
<add key="Default_Language" value="zh-CN" />
<!--出库等待料盘拿走的时间,秒-->
<add key="OutStoreWaitSeconds" value="1" />
<!--温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪-->
<add key="HumitureControllerType" value="0" />
<add key="UseAIOBOX" value="1" />
<add key="DIMS" value="20" />
<add key="DOMS" value="200" />
<add key="SinglePosId" value="1#AC2_1_1_6" />
<!--配置文件的表头格式,0=中文,1=英文-->
<add key="LibNameType" value="0" />
<add key="DefaultPWD" value="123456" />
<!--自动出入库时使用-->
<add key="LOC" value="1" />
<!--最多识别多少个二维码-->
<add key="QRCodeCount" value="1" />
<add key="OpenCycleOut" value="0" />
<add key="Tool_P3_Offset" value="6000" />
<add key="Tool_P4_Offset" value="-6000" />
<add key="Tool_P5_Offset" value="-6000" />
<add key="Tool_P6_Offset" value="6000" />
<add key="DIMS" value="60" />
<add key="DOMS" value="300" />
<!--流水线地址和端口配置-->
<add key="LineServerIp" value="192.168.101.11" />
<add key="LineServerPort" value="5246" />
<!--是否调试状态-->
<add key="IsInDebug" value="1" />
<add key="UseBuzzer" value="0" />
<!--IO模块是否主动上传-->
<add key="AIOAutoUpload" value="0" />
<!--AGV调度服务器地址-->
<add key="AgvServerIp" value="10.85.160.20" />
<add key="CodeCount" value="3" />
<add key="Tool_P3_Offset" value="7000" />
<add key="Tool_P4_Offset" value="-2000" />
<add key="Tool_P5_Offset" value="-2000" />
<add key="Tool_P6_Offset" value="7000" />
<add key="Tool_TargetSpeed" value="20" />
<add key="Tool_TargetPosition" value="6000" />
<add key="Tool_TargetPosition" value="1835000" />
<!--是否启用入料口移门,1=启用,0=禁用-->
<add key="UseDoor" value="1" />
<add key="Agv_Log_Open" value="1" />
<add key="AutoShelfInstore" value="1" />
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/AutoStore1.log" />
<file value="logs/Packing-store-19-20.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
......@@ -71,67 +71,31 @@
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="INFO" />
<levelMax value="ERROR" />
</filter>
</appender>
<appender name="AIOBOX" type="log4net.Appender.RollingFileAppender">
<file value="logs/aio/AIOBOX.log" />
<appender name="TheRFID" type="log4net.Appender.RollingFileAppender">
<file value="logs/TheRFID.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] %m%n" />
<conversionPattern value="[%date][%t]%-5p %m%n" />
</layout>
</appender>
<logger name="RollingLogFileAppender">
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<logger name="AIOBOX">
<level value="Info" />
<appender-ref ref="AIOBOX" />
<logger name="TheRFID">
<level value="Debug" />
<appender-ref ref="TheRFID" />
</logger>
<root>
<level value="INFO" />
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</root>
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<!-- 部署服务库项目时,必须将配置文件的内容添加到
主机的 app.config 文件中。System.Configuration 不支持库的配置文件。 -->
<system.serviceModel>
<services>
<service name="AcStoreWCF.CWSMDBox">
<endpoint address="" binding="basicHttpBinding" contract="AcStoreWCF.ICWSMDBox">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/AcStoreWCF/CWSMDBox/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- 为避免泄漏元数据信息,
请在部署前将以下值设置为 false -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
<!-- 要接收故障异常详细信息以进行调试,
请将以下值设置为 true。在部署前设置为 false
以避免泄漏异常信息 -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
\ No newline at end of file
......@@ -7,8 +7,8 @@
<ProjectGuid>{0D2542F5-DD62-4352-82D0-383D9A045E74}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.AutoInOutStore</RootNamespace>
<AssemblyName>AutoInOutStore</AssemblyName>
<RootNamespace>OnlineStore.DUOStore</RootNamespace>
<AssemblyName>DUOStore</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
......@@ -64,6 +64,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="FormManager.cs" />
<Compile Include="FrmAbout.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmAbout.Designer.cs">
<DependentUpon>FrmAbout.cs</DependentUpon>
</Compile>
<Compile Include="FrmAxisDebug.cs">
<SubType>Form</SubType>
</Compile>
......@@ -76,6 +82,12 @@
<Compile Include="FrmBase.Designer.cs">
<DependentUpon>FrmBase.cs</DependentUpon>
</Compile>
<Compile Include="FrmStore.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmStore.Designer.cs">
<DependentUpon>FrmStore.cs</DependentUpon>
</Compile>
<Compile Include="FrmIOStatus.cs">
<SubType>Form</SubType>
</Compile>
......@@ -88,11 +100,11 @@
<Compile Include="FrmPwd.Designer.cs">
<DependentUpon>FrmPwd.cs</DependentUpon>
</Compile>
<Compile Include="FrmStoreBox.cs">
<Compile Include="FrmBox.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmStoreBox.Designer.cs">
<DependentUpon>FrmStoreBox.cs</DependentUpon>
<Compile Include="FrmBox.Designer.cs">
<DependentUpon>FrmBox.cs</DependentUpon>
</Compile>
<Compile Include="ManagerUtil.cs" />
<Compile Include="positionTool\FrmPositionTool.cs">
......@@ -103,21 +115,32 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResourceCulture.cs" />
<Compile Include="useControl\AxisMoveControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="useControl\AxisMoveControl.Designer.cs">
<DependentUpon>AxisMoveControl.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="FrmAbout.resx">
<DependentUpon>FrmAbout.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmAxisDebug.resx">
<DependentUpon>FrmAxisDebug.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmBase.resx">
<DependentUpon>FrmBase.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmStore.resx">
<DependentUpon>FrmStore.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmIOStatus.resx">
<DependentUpon>FrmIOStatus.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmPwd.resx">
<DependentUpon>FrmPwd.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmStoreBox.resx">
<DependentUpon>FrmStoreBox.cs</DependentUpon>
<EmbeddedResource Include="FrmBox.resx">
<DependentUpon>FrmBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="positionTool\FrmPositionTool.resx">
<DependentUpon>FrmPositionTool.cs</DependentUpon>
......@@ -142,6 +165,9 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="useControl\AxisMoveControl.resx">
<DependentUpon>AxisMoveControl.cs</DependentUpon>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
......
......@@ -8,94 +8,27 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.AutoInOutStore
namespace OnlineStore.ACPackingStore
{
public class FormManager
{
//#03A9F4
public static Color buttonColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
//public static Color buttonColor = System.Drawing.SystemColors.ActiveCaption;
//public static Color buttonColor = System.Drawing.Color.FromArgb(((int)((0x00))), ((int)((0x66))), ((int)(0xFF)));
//private static string skinFileName = Application.StartupPath + @"\Skins\Wave.ssk";
private static string skinFileName = Application.StartupPath + @"\Skins\DiamondBlue.ssk";
public static string SkinFileName
{
set
{
}
get
{
if (SkinsList.Count <= 0)
{
SkinsList = GetSkinList();
}
if (SkinsList.Count > 0 && index >= 0)
{
return SkinsList[index];
}
return skinFileName;
}
}
private static int index = -1;
public static void DefaultSkin()
{
index = -1;
}
public static void NextSkin()
private static FrmAxisDebug debug = null;
public static void CloseAxisDebug()
{
index++;
if (index >= SkinsList.Count)
if (debug != null && debug.IsDisposed.Equals(false))
{
index = 0;
debug.Close();
}
}
public static List<string> SkinsList = new List<string>();
private static List<string> GetSkinList()
public static void CloseIoStatus()
{
List<string> returnList = new System.Collections.Generic.List<string>();
string[] fileList = Directory.GetFiles(Application.StartupPath + @"\Skins");
foreach (string sr in fileList)
if (frmIo != null && frmIo.IsDisposed.Equals(false))
{
if (sr.Contains(".ssk"))
{
returnList.Add(sr);
}
frmIo.Close();
}
return returnList;
}
//public static FrmAxisMoveConfig FrmAxisConfig = null;
//public static void ShowAxisConfig(AC_SA_BoxBean boxBean)
//{
// if (FormManager.FrmAxisConfig == null)
// {
// FormManager.FrmAxisConfig = new FrmAxisMoveConfig(boxBean);
// FormManager.FrmAxisConfig.Show();
// }
// else
// {
// //FormManager.FrmAxisConfig.ShowDialog();
// if (FormManager.FrmAxisConfig.IsDisposed)
// {
// FormManager.FrmAxisConfig = new FrmAxisMoveConfig(boxBean);
// FormManager.FrmAxisConfig.Show();
// }
// else
// {
// FormManager.FrmAxisConfig.Activate();
// }
// }
//}
private static FrmAxisDebug debug = null;
public static void ShowAxisDebug(AC_SA_BoxBean store)
public static void ShowAxisDebug(BoxBean store)
{
if (debug == null)
{
......@@ -116,7 +49,7 @@ namespace OnlineStore.AutoInOutStore
}
}
private static FrmIOStatus frmIo = null;
public static void ShowIOShow(AC_SA_BoxBean store)
public static void ShowIOShow(BoxBean store)
{
if (frmIo == null)
{
......
namespace OnlineStore.ACPackingStore
{
partial class FrmAbout
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnNext = new System.Windows.Forms.Button();
this.lblVersion = new System.Windows.Forms.Label();
this.lblTime = new System.Windows.Forms.Label();
this.lblCodeName = new System.Windows.Forms.Label();
this.btnCopy = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnNext
//
this.btnNext.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNext.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNext.Location = new System.Drawing.Point(210, 140);
this.btnNext.Name = "btnNext";
this.btnNext.Size = new System.Drawing.Size(120, 45);
this.btnNext.TabIndex = 275;
this.btnNext.Text = "确定";
this.btnNext.UseVisualStyleBackColor = false;
this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
//
// lblVersion
//
this.lblVersion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblVersion.Location = new System.Drawing.Point(12, 36);
this.lblVersion.Name = "lblVersion";
this.lblVersion.Size = new System.Drawing.Size(529, 23);
this.lblVersion.TabIndex = 276;
this.lblVersion.Text = "版本号:1.1.0000.0000";
this.lblVersion.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblTime
//
this.lblTime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblTime.Location = new System.Drawing.Point(81, 66);
this.lblTime.Name = "lblTime";
this.lblTime.Size = new System.Drawing.Size(379, 23);
this.lblTime.TabIndex = 277;
this.lblTime.Text = "更新时间:0000-00-00 00:00:00";
this.lblTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblCodeName
//
this.lblCodeName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblCodeName.Location = new System.Drawing.Point(12, 100);
this.lblCodeName.Name = "lblCodeName";
this.lblCodeName.Size = new System.Drawing.Size(529, 23);
this.lblCodeName.TabIndex = 278;
this.lblCodeName.Text = "软件编号:????";
this.lblCodeName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnCopy
//
this.btnCopy.Location = new System.Drawing.Point(466, 64);
this.btnCopy.Name = "btnCopy";
this.btnCopy.Size = new System.Drawing.Size(75, 25);
this.btnCopy.TabIndex = 279;
this.btnCopy.Text = "复制";
this.btnCopy.UseVisualStyleBackColor = true;
this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click);
//
// FrmAbout
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(553, 222);
this.Controls.Add(this.btnCopy);
this.Controls.Add(this.lblCodeName);
this.Controls.Add(this.lblTime);
this.Controls.Add(this.lblVersion);
this.Controls.Add(this.btnNext);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmAbout";
this.Text = "软件信息";
this.Load += new System.EventHandler(this.FrmPwd_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnNext;
private System.Windows.Forms.Label lblVersion;
private System.Windows.Forms.Label lblTime;
private System.Windows.Forms.Label lblCodeName;
private System.Windows.Forms.Button btnCopy;
}
}
\ No newline at end of file

using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.ACPackingStore
{
public partial class FrmAbout : FrmBase
{
public FrmAbout()
{
InitializeComponent();
}
private void FrmPwd_Load(object sender, EventArgs e)
{
this.DialogResult = DialogResult.None;
lblTime.Text = "更新时间:" + GetVersion();
lblVersion.Text = "版本号:" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
lblCodeName.Text = "软件编号:" + GetCodeNum();
}
private void btnNext_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnCopy_Click(object sender, EventArgs e)
{
Clipboard.SetDataObject(GetCodeNum(), true);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
namespace OnlineStore.AutoInOutStore
namespace OnlineStore.ACPackingStore
{
partial class FrmBase
{
......@@ -42,7 +42,6 @@
this.Name = "FrmBase";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "FrmBase";
this.VisibleChanged += new System.EventHandler(this.FrmBase_VisibleChanged);
this.ResumeLayout(false);
}
......
......@@ -9,29 +9,19 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.AutoInOutStore
namespace OnlineStore.ACPackingStore
{
public partial class FrmBase : Form
{
public string CurrLanguage = "";
public string ClassName
{
get
{
return this.GetType().Name;
}
set
{
}
}
public static string GetVersion()
internal static string GetVersion(bool isShow=false)
{
string str = "";
string version = "";
DateTime newData = DateTime.Parse("2000-01-01");
try
{
version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
System.Reflection.AssemblyName assemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName();
version = assemblyName.Version.ToString();
string[] strArray = version.Split('.');
if (strArray.Length.Equals(4))
{
......@@ -40,7 +30,7 @@ namespace OnlineStore.AutoInOutStore
DateTime d1 = DateTime.Parse("2000-01-01");
newData = d1.AddDays(days);
newData = newData.AddSeconds(seconds * 2);
str = newData.ToString("yyyy-MM-dd HH:mm:ss");
str = newData.ToString("yyyy-MM-dd HH:mm");
}
}
catch (Exception ex)
......@@ -48,10 +38,13 @@ namespace OnlineStore.AutoInOutStore
str = version;
LogUtil.error("解析版本号【" + str + "】出错:" + ex.ToString());
}
if (isShow)
{
LogUtil.info("版本号[" + version + "][" + str + "][" + GetCodeNum() + "]");
}
return str;
}
internal static string GetCodeNum(string codeName = "RC1252-AutoInOutStore")
internal static string GetCodeNum(string codeName = "DUOStore")
{
byte[] byteArray = System.Text.Encoding.ASCII.GetBytes(codeName);
string result = "";
......@@ -63,71 +56,6 @@ namespace OnlineStore.AutoInOutStore
InitializeComponent();
//skinEngine1.SkinAllForm = false;
}
public void SetSkin(FrmBase preCon)
{
//skinEngine1.SkinFile = FormManager.SkinFileName;
//LogUtil.info("当前皮肤:" + skinEngine1.SkinFile);
}
public void LanguageProcess()
{
if (CurrLanguage.Equals(ResourceCulture.CurrLanguage))
{
return;
}
string className = this.ClassName;
CurrLanguage = ResourceCulture.CurrLanguage;
this.Text = ResourceCulture.GetString(ResourceCulture.GetTextIdStr(className), this.Text);
foreach (Control con in this.Controls)
{
if (con is Label || con is Button || con is RadioButton || con is CheckBox)
{
string newStr = ResourceCulture.GetString(ResourceCulture.GetTextIdStr(className, con.Name), con.Text);
con.Text = newStr;
con.Tag = newStr;
}
else if (con.Controls.Count > 0)
{
PreControlLanaguage(con);
}
}
if (this is FrmStoreBox)
{
((FrmStoreBox)this).processMenu();
}
}
private void PreControlLanaguage(Control partentControl)
{
if (partentControl is UserFromControl.IOTextControl && this is FrmIOStatus)
{
return;
}
string className = this.ClassName;
partentControl.Text = ResourceCulture.GetString(ResourceCulture.GetTextIdStr(className, partentControl.Name), partentControl.Text);
foreach (Control con in partentControl.Controls)
{
if (con is Label || con is Button || con is RadioButton || con is CheckBox)
{
string newStr = ResourceCulture.GetString(ResourceCulture.GetTextIdStr(className, con.Name), con.Text);
con.Text = newStr;
}
else if (con.Controls.Count > 0)
{
PreControlLanaguage(con);
}
}
}
private void FrmBase_VisibleChanged(object sender, EventArgs e)
{
if (this.Visible.Equals(true))
{
LanguageProcess();
}
}
}
}
此文件的差异太大,无法显示。
namespace OnlineStore.AutoInOutStore
namespace OnlineStore.ACPackingStore
{
partial class FrmPwd
{
......
......@@ -10,7 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.AutoInOutStore
namespace OnlineStore.ACPackingStore
{
public partial class FrmPwd : FrmBase
{
......@@ -26,7 +26,6 @@ namespace OnlineStore.AutoInOutStore
private void FrmPwd_Load(object sender, EventArgs e)
{
this.DialogResult = DialogResult.None;
txtPwd.Text = ConfigAppSettings.GetValue(Setting_Init.DefaultPWD);
}
private void btnNext_Click(object sender, EventArgs e)
......@@ -64,7 +63,7 @@ namespace OnlineStore.AutoInOutStore
else
{
// this.DialogResult = DialogResult.No;
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.PWPwd,"请输入正确的密码"));
MessageBox.Show("请输入正确的密码");
txtPwd.Focus();
}
}
......
namespace OnlineStore.ACPackingStore
{
partial class FrmRFIPEdit
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRFIPEdit));
this.label1 = new System.Windows.Forms.Label();
this.btnBack = new System.Windows.Forms.Button();
this.txtIP = new System.Windows.Forms.TextBox();
this.comboxType = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.lblResult = new System.Windows.Forms.Label();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label1.Location = new System.Drawing.Point(83, 46);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(107, 20);
this.label1.TabIndex = 0;
this.label1.Text = "请选择读卡器:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnBack
//
this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBack.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(259, 183);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(120, 45);
this.btnBack.TabIndex = 274;
this.btnBack.Text = "退出";
this.btnBack.UseVisualStyleBackColor = false;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// txtIP
//
this.txtIP.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtIP.Location = new System.Drawing.Point(195, 88);
this.txtIP.Name = "txtIP";
this.txtIP.Size = new System.Drawing.Size(233, 26);
this.txtIP.TabIndex = 276;
//
// comboxType
//
this.comboxType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboxType.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comboxType.FormattingEnabled = true;
this.comboxType.Location = new System.Drawing.Point(195, 43);
this.comboxType.Name = "comboxType";
this.comboxType.Size = new System.Drawing.Size(233, 28);
this.comboxType.TabIndex = 277;
this.comboxType.SelectedIndexChanged += new System.EventHandler(this.comboxType_SelectedIndexChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label2.Location = new System.Drawing.Point(111, 90);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(78, 20);
this.label2.TabIndex = 278;
this.label2.Text = "读卡器IP:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// button1
//
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(115, 183);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(120, 45);
this.button1.TabIndex = 281;
this.button1.Text = "读取测试";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.lblResult);
this.groupBox2.Controls.Add(this.comboxType);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.button1);
this.groupBox2.Controls.Add(this.txtIP);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.btnBack);
this.groupBox2.Location = new System.Drawing.Point(22, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(505, 249);
this.groupBox2.TabIndex = 291;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "读取RFID";
//
// lblResult
//
this.lblResult.AutoSize = true;
this.lblResult.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblResult.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblResult.Location = new System.Drawing.Point(195, 131);
this.lblResult.Name = "lblResult";
this.lblResult.Size = new System.Drawing.Size(79, 20);
this.lblResult.TabIndex = 284;
this.lblResult.Text = "读取到数据";
this.lblResult.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// FrmRFIPEdit
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(560, 285);
this.Controls.Add(this.groupBox2);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmRFIPEdit";
this.Text = "托盘编码";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmRFIPEdit_FormClosed);
this.Load += new System.EventHandler(this.FrmPwd_Load);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.TextBox txtIP;
private System.Windows.Forms.ComboBox comboxType;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label lblResult;
}
}
\ No newline at end of file

using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.ACPackingStore
{
internal partial class FrmRFIPEdit : FrmBase
{
internal FrmRFIPEdit()
{
InitializeComponent();
}
private Dictionary<string, string> rfMap = new Dictionary<string, string>();
private void FrmPwd_Load(object sender, EventArgs e)
{
comboxType.Items.Clear();
foreach (AC_BOX_Bean b in StoreManager.Store.BoxMap.Values)
{
string key = b.Name + "-托盘RF";
string value = b.Config.RFID_IP;
rfMap.Add(key, value);
comboxType.Items.Add(key);
}
comboxType.SelectedIndex = 0;
//comType.SelectedIndex = 0;
List<string> List = new List<string>();
List = new List<string>(rfMap.Values);
if (StoreManager.Store.storeRunStatus <= StoreRunStatus.Wait)
{
RFIDManager.Open(List.ToArray());
}
}
private void btnBack_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
string ip = txtIP.Text;
RFIDData data = RFIDManager.ReadRFID(ip);
string resul = "";
if (data != null)
{
resul = data.NumStr();
//numNum.Value = data.Num;
//int selIndex = data.RFType - 64;
//if (selIndex >= 0 && selIndex <= comboxType.Items.Count)
//{
// comboxType.SelectedIndex = selIndex;
//}
}
lblResult.Text = resul;
MessageBox.Show("读取到数据:" + resul);
}
private void comboxType_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboxType.SelectedIndex >= 0)
{
string V = rfMap[comboxType.Text];
if (!txtIP.Text.Equals(V))
{
txtIP.Text = V;
}
}
}
private void FrmRFIPEdit_FormClosed(object sender, FormClosedEventArgs e)
{
if (StoreManager.Store.storeRunStatus <= StoreRunStatus.Wait)
{
// RFIDManager.Close();
}
}
}
}
此文件的差异太大,无法显示。
......@@ -117,14 +117,14 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 16</value>
</metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>227, 16</value>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="notifyIcon1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>392, 16</value>
<value>137, 17</value>
</metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>255, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="notifyIcon1.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
......@@ -1259,11 +1259,8 @@
AD//////////////////AB////////////8=
</value>
</data>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 16</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>78</value>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>420, 17</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
......
此文件的差异太大,无法显示。
......@@ -5,7 +5,7 @@ using System.Text;
using System.Windows;
using System.Windows.Forms;
namespace OnlineStore.AutoInOutStore
namespace OnlineStore.ACPackingStore
{
public class ManagerUtil
{
......
using log4net;
using log4net.Config;
using OnlineStore.Common;
using OnlineStore.AutoInOutStore;
using OnlineStore.ACPackingStore;
using System;
using System.Collections.Generic;
using System.Diagnostics;
......@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.AutoInOutStore
namespace OnlineStore.ACPackingStore
{
static class Program
{
......@@ -43,7 +43,7 @@ namespace OnlineStore.AutoInOutStore
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
public const int SW_RESTORE = 9;
public static IntPtr formhwnd;
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
......@@ -96,21 +96,7 @@ namespace OnlineStore.AutoInOutStore
XmlConfigurator.Configure();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
#if PositionTool
{
string PortName = "COM3";
int slvAddr = 4;
string ioIP = "192.168.200.13";
int ioIndex = 0;
Application.Run(new FrmPositionTool(PortName,slvAddr,ioIP,ioIndex));
}
#else
{
Application.Run(new FrmStoreBox());
}
#endif
Application.Run(new FrmStore());
}
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
......@@ -126,7 +112,7 @@ namespace OnlineStore.AutoInOutStore
static void LogUnhandledException(object exceptionobj)
{
//这里可以进一步地写日志
LOGGER.Error(exceptionobj.ToString());
LogUtil.error("LogUnhandledException:"+exceptionobj.ToString());
}
}
}
......@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ACSingleStore")]
[assembly: AssemblyTitle("ACPackingStore")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ACSingleStore")]
[assembly: AssemblyProduct("ACPackingStore")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......
......@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace OnlineStore.AutoInOutStore.Properties {
namespace OnlineStore.DUOStore.Properties {
using System;
......@@ -39,7 +39,7 @@ namespace OnlineStore.AutoInOutStore.Properties {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OnlineStore.AutoInOutStore.Properties.Resources", typeof(Resources).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OnlineStore.DUOStore.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
......
......@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace OnlineStore.AutoInOutStore.Properties {
namespace OnlineStore.DUOStore.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
......
namespace OnlineStore.AutoInOutStore
namespace OnlineStore.ACPackingStore
{
partial class FrmPositionTool
{
......
......@@ -16,7 +16,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.AutoInOutStore
namespace OnlineStore.ACPackingStore
{
public partial class FrmPositionTool : FrmBase
{
......@@ -26,38 +26,41 @@ namespace OnlineStore.AutoInOutStore
private string IoIp = "";
private int IoIndex = 0;
public string Axis_Brake = IO_Type.Axis_Brake;
private int subType = 0;
private System.Timers.Timer toolTimer = new System.Timers.Timer();
public FrmPositionTool(string protName, int slvAddr,string ioIp, int ioIndex)
private string boxName = "";
public FrmPositionTool(string protName, int slvAddr, string ioIp, int ioIndex, string text,int ioSubType)
{
InitializeComponent();
this.PortName = protName;
this.SlvAddr = slvAddr;
this.IoIp = ioIp;
this.IoIndex = ioIndex;
this.subType = ioSubType;
boxName = text.Trim().Replace("料仓", "");
this.Text = boxName + "_升降轴位置调试";
LogName = boxName + "_升降轴调试:";
toolTimer.Enabled = false;
toolTimer.Interval = 100;
toolTimer.AutoReset = true;
toolTimer.Elapsed += ToolTimer_Elapsed;
FrmPositionTool.CheckForIllegalCrossThreadCalls = false;
}
private void Form1_Load(object sender, EventArgs e)
{
ACServerManager.IsShowMsg = false;
if (ResourceCulture.CurrLanguage.Equals(ResourceCulture.China))
{
LogUtil.logBox = this.richTextBox1;
}
//ACServerManager.richeBox = this.richTextBox1;
CheckForIllegalCrossThreadCalls = false;
txtPortName.Text = PortName;
txtAddr.Text = SlvAddr.ToString();
txtIOIndex .Text= IoIndex.ToString();
txtIOIndex.Text = IoIndex.ToString();
txtIoIp.Text = IoIp.ToString();
txtFileName.Text = boxName + "_position.csv";
if (IOManager.instance == null)
{
IOManager.Init();
......@@ -91,17 +94,7 @@ namespace OnlineStore.AutoInOutStore
bool isOn = ACServerManager.ServerOnStatus(PortName, SlvAddr);
formStatus(isOn);
timer1.Start();
ioStatusControl1.IOName =ResourceCulture.GetString( "检测信号");
}
private void SaveConfig(int speed, int position)
{
//保存配置
ConfigAppSettings.SaveValue(Setting_Init.Tool_P3_Offset, P3Offset);
ConfigAppSettings.SaveValue(Setting_Init.Tool_P4_Offset, P4Offset);
ConfigAppSettings.SaveValue(Setting_Init.Tool_P5_Offset, P5Offset);
ConfigAppSettings.SaveValue(Setting_Init.Tool_P6_Offset, P6Offset);
ConfigAppSettings.SaveValue(Setting_Init.Tool_TargetSpeed, speed);
ConfigAppSettings.SaveValue(Setting_Init.Tool_TargetPosition, position);
ioStatusControl1.IOName = ResourceCulture.GetString("检测信号");
}
private void btnServoOn_Click(object sender, EventArgs e)
{
......@@ -132,7 +125,7 @@ namespace OnlineStore.AutoInOutStore
try
{
IOManager.IOMove(Axis_Brake, IO_VALUE.HIGH);
IOManager.IOMove(Axis_Brake, IO_VALUE.HIGH,subType);
}catch(Exception ex)
{
......@@ -148,7 +141,7 @@ namespace OnlineStore.AutoInOutStore
Thread.Sleep(100);
try
{
IOManager.IOMove(Axis_Brake, IO_VALUE.LOW);
IOManager.IOMove(Axis_Brake, IO_VALUE.LOW,subType);
}
catch (Exception ex)
{
......@@ -203,6 +196,16 @@ namespace OnlineStore.AutoInOutStore
txtActualPosition.Text = value.ToString();
}
private void SaveConfig(int speed, int position)
{
//保存配置
ConfigAppSettings.SaveValue(Setting_Init.Tool_P3_Offset, P3Offset);
ConfigAppSettings.SaveValue(Setting_Init.Tool_P4_Offset, P4Offset);
ConfigAppSettings.SaveValue(Setting_Init.Tool_P5_Offset, P5Offset);
ConfigAppSettings.SaveValue(Setting_Init.Tool_P6_Offset, P6Offset);
ConfigAppSettings.SaveValue(Setting_Init.Tool_TargetSpeed, speed);
ConfigAppSettings.SaveValue(Setting_Init.Tool_TargetPosition, position);
}
private void btnAbsMove_Click(object sender, EventArgs e)
{
int speed = Convert.ToInt32(txtSpeed.Text);
......@@ -219,15 +222,17 @@ namespace OnlineStore.AutoInOutStore
P4Offset = FormUtil.GetIntValue(txtP4Offset);
P5Offset = FormUtil.GetIntValue(txtP5Offset);
P6Offset = FormUtil.GetIntValue(txtP6Offset);
LastValue = IO_VALUE.LOW;
SaveConfig(speed, position);
LastValue = IO_VALUE.LOW;
string fileName = txtFileName.Text;
string filePath = Application.StartupPath + @"\logs\" + fileName;
if (File.Exists(filePath))
{
string msg = ResourceCulture.GetString("文件【{0}】已存在,是否确定覆盖?", "文件【{0}】已存在,是否确定覆盖?", fileName);
string msg = "文件【{0}】已存在,是否确定覆盖?";
DialogResult result = MessageBox.Show(msg, "", MessageBoxButtons.OKCancel,MessageBoxIcon.Question);
if (!result.Equals(DialogResult.OK))
{
......@@ -395,4 +400,11 @@ namespace OnlineStore.AutoInOutStore
this.Close();
}
}
public class ResourceCulture
{
internal static string GetString(string str)
{
return str;
}
}
}
FrmCodeDecode_Text,二维码识别,Qr code recognition
FrmCodeDecode_label4_Text,参数路径,Parameters of the path
FrmCodeDecode_chbUseParam_Text,使用参数,operation parameter
FrmCodeDecode_btnAn_Text,变暗,darken
FrmCodeDecode_btnLight_Text,提亮,brighten
FrmCodeDecode_label3_Text,条码类型:,Bar code type:
FrmCodeDecode_label2_Text,相机列表:,Camera list:
FrmCodeDecode_btnExit_Text,退出,Exit
FrmCodeDecode_btnCameraImage_Text,相机获取图片,camera image
FrmCodeDecode_lblCount_Text,条码数量:,Barcode number:
FrmCodeDecode_btnClearLog_Text,清理日志,Clear log
FrmCodeDecode_btnDCode_Text,二维码识别,Qr code recognition
FrmCodeDecode_btnLearn_Text,学习,learn
FrmCodeDecode_btnbarCode_Text,一维码识别,One dimensional code recognition
FrmCodeDecode_btnGray_Text,图像转灰,Turning grey
FrmCodeDecode_btnErZhi_Text,二值化,binaryzation 
FrmCodeDecode_btnSelImage_Text,打开本地图片,Open local image
FrmCodeDecode_label1_Text,图片路径,Image path
FrmCodeLearn_Text,条码参数学习,Bar code parameter learning
FrmCodeLearn_chbHalcon_Text,Halcon获取图片,Halcon Get photo
FrmCodeLearn_label4_Text,图片路径,Image path
FrmCodeLearn_btnDelOld_Text,删除旧参数,Delete old parameter
FrmCodeLearn_chbUseCamera_Text,相机获取实时图片,camera image
FrmCodeLearn_btnSelImage_Text,打开本地图片,Open local image
FrmCodeLearn_chbTest_Text,学习结束自动识别测试,Automatic identification test
FrmCodeLearn_btnClearLog_Text,清理日志,Clear log
FrmCodeLearn_lblCount_Text,条码数量:,Barcode number:
FrmCodeLearn_label3_Text,参数路径,Parameters of the path
FrmCodeLearn_label2_Text,类型:,Type:
FrmCodeLearn_label1_Text,相机:,camera:
FrmCodeLearn_btnExit_Text,退出,Exit
FrmCodeLearn_btnStop_Text,结束学习,End of learning
FrmCodeLearn_btnOpen_Text,开始学习,start to learn
selCamera,请先选择相机,Please select camera
selImage,请先选择图片,Please select picture
title,提示,Notice
imageIsNull,获取二维码图片为空,Get the two-dimensional code picture is empty
sureDelete,确定删除文件:,Make sure to delete the file:
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
......@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
......@@ -36,19 +36,29 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Asa.IOModule.AIOBOX, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference>
<Reference Include="Asa.RFID">
<HintPath>..\..\dll\Asa.RFID.dll</HintPath>
</Reference>
<Reference Include="Client, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\Client.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="DeviceLib">
<Reference Include="DeviceLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\DeviceLib.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
</Reference>
<Reference Include="HFReader9CSharp">
<HintPath>..\..\dll\RFID\HFReader9CSharp.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath>
......@@ -56,6 +66,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......@@ -63,34 +74,33 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="acSingleStore\AC_SA_BoxBean.cs" />
<Compile Include="acSingleStore\AC_SA_BoxBean_Partial.cs" />
<Compile Include="acSingleStore\AutomaticBaiting_Partial.cs" />
<Compile Include="acSingleStore\StoreManager.cs" />
<Compile Include="acSingleStore\AutomaticBaiting.cs" />
<Compile Include="DeviceLibrary\halcon\CodeManager.cs" />
<Compile Include="DeviceLibrary\IO\AIOBOX\AIOBOXManager.cs" />
<Compile Include="DeviceLibrary\IO\IOManager.cs" />
<Compile Include="DeviceLibrary\IO\KangNaiDe\KNDManager.cs" />
<Compile Include="DeviceLibrary\IO\KangNaiDe\MasterTcpClient.cs" />
<Compile Include="DeviceLibrary\PanasonicServo\BatchAxisController.cs" />
<Compile Include="ResourceControl.cs" />
<Compile Include="duoStore\AxisBean.cs" />
<Compile Include="duoStore\BoxBean.cs" />
<Compile Include="duoStore\BoxBean_Partial.cs" />
<Compile Include="duoStore\BoxBean_Shelf.cs" />
<Compile Include="duoStore\EnteryDoorBean.cs" />
<Compile Include="duoStore\HumitureBean.cs" />
<Compile Include="duoStore\DUOStoreBean.cs" />
<Compile Include="duoStore\StoreManager.cs" />
<Compile Include="device\halcon\CodeManager.cs" />
<Compile Include="device\IO\AIOBOX\AIOBOXManager.cs" />
<Compile Include="device\IO\IOManager.cs" />
<Compile Include="device\RFIDManager.cs" />
<Compile Include="store\AutoInoutInfo.cs" />
<Compile Include="store\LineMoveP.cs" />
<Compile Include="store\LineAlarm.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="store\model\AxisAlarmInfo.cs" />
<Compile Include="store\model\FixtureCodeInfo.cs" />
<Compile Include="store\InOrOutStoreParam.cs">
<Compile Include="store\InOutParam.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="store\model\FixtureInfo.cs" />
<Compile Include="store\model\StoreMoveInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="store\AC_Store.cs" />
<Compile Include="store\StoreMoveStep.cs">
<Compile Include="store\KTK_Store.cs" />
<Compile Include="store\StoreStep.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
......@@ -111,10 +121,25 @@
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="StoreConfig\AC\linePositions.csv">
<None Include="StoreConfig\linePositions_2.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="StoreConfig\linePositions_1.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="StoreConfig\shelfPosition_1.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="StoreConfig\shelfPosition_2.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="StoreConfig\StoreConfig.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="StoreConfig\BoxConfig_2.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="StoreConfig\AC\StoreConfig.csv">
<None Include="StoreConfig\BoxConfig_1.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
......
......@@ -31,6 +31,6 @@ using System.Runtime.InteropServices;
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
类型,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义,SlaveID,
DI,急停,SuddenStop_BTN,0,PRO_AOI_IP_1,0,急停,X01,DI-01,0,
DI,复位,Reset_BTN,1,PRO_AOI_IP_1,0,复位,X02,DI-02,0,
DI,气压检测,Airpressure_Check,2,PRO_AOI_IP_1,0,门禁,X03,DI-03,0,
DI,L侧门禁,DoorLimit,3,PRO_AOI_IP_1,0,料盘检测1(进料口),X04,DI-04,0,
DO,NG料线体电机运转,NGLine_Run,4,PRO_AOI_IP_1,0,NG料线体电机运转,Y05,DO-05,0,
,,,,,,,,,,
DI,L侧料盘检测1(识别区),TrayCheck_1,0,PRO_AOI_IP_2,0,L侧料盘检测1(识别区),X21,DI-21,0,
DI,L侧料盘检测2(识别区),TrayCheck_2,1,PRO_AOI_IP_2,0,L侧料盘检测2(识别区),X22,DI-22,0,
DI,L侧料盘检测3(识别区),TrayCheck_3,2,PRO_AOI_IP_2,0,L侧料盘检测3(识别区),X23,DI-23,0,
DI,L侧料盘检测4(识别区),TrayCheck_4,3,PRO_AOI_IP_2,0,L侧料盘检测4(识别区),X24,DI-24,0,
DI,L侧入料口移门关闭端,EntranceDoor_Close,4,PRO_AOI_IP_2,0,L侧入料口移门关闭端,X25,DI-25,0,
DI,L侧入料口移门打开端,EntranceDoor_Open,5,PRO_AOI_IP_2,0,L侧入料口移门打开端,X26,DI-26,0,
DI,L侧线体入料口检测,LineIn_Check,6,PRO_AOI_IP_2,0,L侧线体入料口检测,X27,DI-27,0,
DI,L侧线体取料位检测,LineTake_Check,7,PRO_AOI_IP_2,0,L侧线体取料位检测,X28,DI-28,0,
DI,L侧料叉压紧确认检测,Compress_Check,8,PRO_AOI_IP_2,0,L侧料叉压紧确认检测,X29,DI-29,0,
DI,L侧NG料口料盘检测,NGTrayCheck,9,PRO_AOI_IP_2,0,L侧NG料口料盘检测,X30,DI-30,0,
DI,L侧NG料口升降门上升端,NGDoowCylinder_Up,10,PRO_AOI_IP_2,0,L侧NG料口升降门上升端,X31,DI-31,0,
DI,L侧NG料口升降门下降端,NGDoorCylinder_Down,11,PRO_AOI_IP_2,0,L侧NG料口升降门下降端,X32,DI-32,0,
DI,L侧顶升装置上升端,TopCylinder_Up,12,PRO_AOI_IP_2,0,L侧顶升装置上升端,X33,DI-33,0,
DI,L侧顶升装置下降端,TopCylinder_Down,13,PRO_AOI_IP_2,0,L侧顶升装置下降端,X34,DI-34,0,
DI,L侧定位装置上升端,LocationCylinder_Up,14,PRO_AOI_IP_2,0,L侧定位装置上升端,X35,DI-35,0,
DI,L侧定位装置下降端,LocationCylinder_Down,15,PRO_AOI_IP_2,0,L侧定位装置下降端,X36,DI-36,0,
,,,,,,,,,,
DO,L侧料仓运转ON,Run_Signal,0,PRO_AOI_IP_2,0,L侧料仓运转ON,Y21,DO-21,0,
DO,L侧轴2刹车电源ON,Axis_Brake,1,PRO_AOI_IP_2,0,L侧轴2刹车电源ON,Y22,DO-22,0,
DO,L侧相机光源ON,Camera_Led,2,PRO_AOI_IP_2,0,L侧相机光源ON,Y23,DO-23,0,
DO,L侧入料口移门关闭,EntranceDoor_Close,3,PRO_AOI_IP_2,0,L侧入料口移门关闭,Y24,DO-24,0,
DO,L侧入料口移门打开,EntranceDoor_Open,4,PRO_AOI_IP_2,0,L侧入料口移门打开,Y25,DO-25,0,
DO,L侧线体正转,Line_Run,5,PRO_AOI_IP_2,0,L侧线体正转,Y26,DO-26,0,
DO,L侧线体反转,Line_BackRun,6,PRO_AOI_IP_2,0,L侧线体反转,Y27,DO-27,0,
DO,L侧料仓吹气SOL,StartOrStopBlow,7,PRO_AOI_IP_2,0,L侧料仓吹气SOL,Y28,DO-28,0,
DO,L侧NG料口升降门上升SOL,NGDoowCylinder_Up,8,PRO_AOI_IP_2,0,L侧NG料口升降门上升SOL,Y29,DO-29,0,
DO,L侧NG料口升降门下降SOL,NGDoorCylinder_Down,9,PRO_AOI_IP_2,0,L侧NG料口升降门下降SOL,Y30,DO-30,0,
DO,L侧顶升装置上升SOL,TopCylinder_Up,10,PRO_AOI_IP_2,0,L侧顶升装置上升SOL,Y31,DO-31,0,
DO,L侧顶升装置下降SOL,TopCylinder_Down,11,PRO_AOI_IP_2,0,L侧顶升装置下降SOL,Y32,DO-32,0,
DO,L侧定位装置上升SOL,LocationCylinder_Up,12,PRO_AOI_IP_2,0,L侧定位装置上升SOL,Y33,DO-33,0,
DO,L侧定位装置下降SOL,LocationCylinder_Down,13,PRO_AOI_IP_2,0,L侧定位装置下降SOL,Y34,DO-34,0,
,,,14,PRO_AOI_IP_2,0,,Y35,DO-35,0,
,,,15,PRO_AOI_IP_2,0,,Y36,DO-36,0,
,,,,,,,,,,
AXIS,(轴一)旋转轴,Middle_Axis,1,COM3,0,,,,,
AXIS,(轴二)升降轴轴,UpDown_Axis,2,COM3,0,,,,,
AXIS,(轴三)进出轴,InOut_Axis,3,COM3,0,,,,,
AXIS,(轴四)压紧轴,Comp_Axis,4,COM3,0,,,,,
,,,,,,,,,,
,,,,,,,,,,
PRO,升降轴(轴2)P11-NG放料低点,UpDownAxis_P11,1000000,,,,,,,
PRO,升降轴(轴2)P12-NG放料高点缓冲点,UpDownAxis_P12,1023000,,,,,,,
PRO,旋转轴(轴1)P11-NG放料点,MiddleAxis_P11,306900,,,,,,,
PRO,进出轴(轴3)P2-扫码放料点,InOutAxis_P2_Position,140800,,,,,,,
PRO,进出轴(轴3)P11-NG放料点,InOutAxis_P11_Position,148000,,,,,,,
,,,,,,,,,,
PRO,升降轴(轴2)P1待机点/扫码放料低点,UpDownAxis_P1,585000,,,,,,,
PRO,升降轴(轴2)P2扫码放料高点缓冲点,UpDownAxis_P2,604500,,,,,,,
PRO,旋转轴(轴1)P1待机点/扫码放料点,MiddleAxis_P1,307200,,,,,,,
PRO,进出轴(轴3)P1待机点,InOutAxis_P1_Position,1000,,,,,,,
PRO,压紧轴(轴4)P1待机点,CompAxis_P1_Position,140000,,,,,,,
PRO,压紧轴(轴4)P3最大压紧前点,CompAxis_Max_P3,180000,,,,,,,
PRO,压紧轴(轴4)P4目标压紧点,CompAxis_P4_Position,315000,,,,,,,
PRO,压紧轴(轴4)非七寸盘压紧前点相对压紧点的位置,CompAxis_P3_P2_Value,-90000,,,,,,,
PRO,压紧轴(轴4)七寸盘压紧前点相对压紧点的位置,CompAxis7_P3_P2_Value,-50000,,,,,,,
PRO,压紧轴(轴4)压紧确认信号收到之后下降的位置,CompAxis_Down_Position,77500,,,,,,,
PRO,压紧轴(轴4)P2压紧点范围对应值(8=1000;2000#),CompAxis_P2_List,8=385001;424000#12=383001;385000#16=379001;383000#24=360001;368000#32=315001;330000#48=200000;231560#20=368001;379000#28=330001;360000#36=298001;315000#40=256101;298000#44=231561;256100#,,,,,,,
,,,,,,,,,,
PRO,(轴一)旋转轴目标速度,MiddleAxis_TargetSpeed,250,,,,,,,
PRO,(轴一)旋转轴加速度,MiddleAxis_AddSpeed,1000,,,,,,,
PRO,(轴一)旋转轴减速度,MiddleAxis_DelSpeed,1000,,,,,,,
PRO,(轴一)旋转轴原点低速度,MiddleAxis_HomeLowSpeed,80,,,,,,,
PRO,(轴一)旋转轴原点高速,MiddleAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴一)旋转轴原点加速度,MiddleAxis_HomeAddSpeed,50,,,,,,,
PRO,(轴二)升降轴轴目标速度,UpdownAxis_TargetSpeed,300,,,,,,,
PRO,(轴二)升降轴轴加速度,UpdownAxis_AddSpeed,400,,,,,,,
PRO,(轴二)升降轴轴减速度,UpdownAxis_DelSpeed,400,,,,,,,
PRO,(轴二)升降轴轴原点低速度,UpdownAxis_HomeLowSpeed,400,,,,,,,
PRO,(轴二)升降轴轴原点高速,UpdownAxis_HomeHighSpeed,400,,,,,,,
PRO,(轴二)升降轴轴原点加速度,UpdownAxis_HomeAddSpeed,400,,,,,,,
PRO,(轴三)进出轴目标速度,InoutAxis_TargetSpeed,100,,,,,,,
PRO,(轴三)进出轴加速度,InoutAxis_AddSpeed,300,,,,,,,
PRO,(轴三)进出轴减速度,InoutAxis_DelSpeed,300,,,,,,,
PRO,(轴三)进出轴原点低速,InoutAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴三)进出轴原点高速,InoutAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴三)进出轴原点加速度,InoutAxis_HomeAddSpeed,200,,,,,,,
PRO,(轴四)压紧轴目标速度,CompAxis_TargetSpeed,100,,,,,,,
PRO,(轴四)压紧轴加速度,CompAxis_AddSpeed,300,,,,,,,
PRO,(轴四)压紧轴减速度,CompAxis_DelSpeed,300,,,,,,,
PRO,(轴四)压紧轴原点低速,CompAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴四)压紧轴原点高速,CompAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴四)压紧轴原点加速度,CompAxis_HomeAddSpeed,200,,,,,,,
,,,,,,,,,,
PRO,升降轴(轴2)P1速度,UpDownAxis_P1_Speed,600,,,,,,,
PRO,升降轴(轴2)P2速度,UpDownAxis_P2_Speed,600,,,,,,,
PRO,升降轴(轴2)P3速度,UpDownAxis_P3_Speed,1000,,,,,,,
PRO,升降轴(轴2)P4速度,UpDownAxis_P4_Speed,200,,,,,,,
PRO,升降轴(轴2)P5速度,UpDownAxis_P5_Speed,1000,,,,,,,
PRO,升降轴(轴2)P6速度,UpDownAxis_P6_Speed,200,,,,,,,
PRO,升降轴(轴2)P7速度,UpDownAxis_P7_Speed,600,,,,,, ,
PRO,升降轴(轴2)P8速度,UpDownAxis_P8_Speed,600,,,,,,,
PRO,旋转轴(轴1)P1速度,MiddleAxis_P1_Speed,300,,,,,,,
PRO,旋转轴(轴1)P2速度,MiddleAxis_P2_Speed,300,,,,,,,
PRO,进出轴(轴3)P1速度,InOutAxis_P1_Speed,300,,,,,,,
PRO,进出轴(轴3)P2速度,InOutAxis_P2_Speed,300,,,,,,,
PRO,进出轴(轴3)P3速度,InOutAxis_P3_Speed,300,,,,,,,
PRO,压紧轴(轴4)P1速度,CompAxis_P1_Speed,400,,,,,,,
PRO,压紧轴(轴4)P2速度,CompAxis_P2_Speed,400,,,,,,,
PRO,压紧轴(轴4)P3速度,CompAxis_P3_Speed,400,,,,,,,
,,,,,,,,,,
PRO,升降轴(轴2)P101速度,UpDownAxis_P101_Speed,600,,,,,, ,
PRO,升降轴(轴2)P102速度,UpDownAxis_P102_Speed,600,,,,,,,
PRO,进出轴(轴3)P101速度,InOutAxis_P101_Speed,300,,,,,,,
PRO,旋转轴(轴1)P101速度,MiddleAxis_P101_Speed,300,,,,,,,
PRO,压紧轴(轴4)P4速度,CompAxis_P4_Speed,300,,,,,,,
,,,,,,,,,,
PRO,(轴一)旋转轴停止时可误差的脉冲数的最小值,MiddleAxis_ErrorCountMin,10,,,,,,,
PRO,(轴二)升降轴轴停止时可误差的脉冲数的最小值,UpdownAxis_ErrorCountMin,10,,,,,, ,
PRO,(轴三)进出轴停止时可误差的脉冲数的最小值,InoutAxis_ErrorCountMin,10,,,,,,,
PRO,(轴一)旋转轴停止时可误差的脉冲数的最大值,MiddleAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴二)升降轴轴停止时可误差的脉冲数的最大值,UpdownAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴三)进出轴停止时可误差的脉冲数的最大值,InoutAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴一)旋转轴最小限位,MiddleAxis_PositionMin,0,,,,,,,
PRO,(轴二)升降轴最小限位,UpdownAxis_PositionMin,0,,,,,,,
PRO,(轴三)进出轴最小限位,InoutAxis_PositionMin,0,,,,,,,
PRO,(轴一)旋转轴最大限位,MiddleAxis_PositionMax,0,,,,,,,
PRO,(轴二)升降轴最大限位,UpdownAxis_PositionMax,0,,,,,,,
PRO,(轴三)进出轴最大限位,InoutAxis_PositionMax,0,,,,,,,
,,,,,,,,,,
PRO,AGV小车站号名称,AgvNodeName,B1,,,,,,,
,,,,,,,,,,
PRO,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,,,,,
PRO,预警温度,WarnTemperate,80,,,,,, ,
PRO,预警湿度,WarnHumidity,80,,,,,, ,
PRO,出入库多少次,会自动重置旋转轴,Box_ResetMCount,1000,,,,,,,
PRO,出入库多少次,会自动重置所有轴操作,Box_ResetACount,100,,,,,,,
PRO,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,,,
PRO,需要吹气的温度(温度标准),Max_Temperature,0,,,,,,,
PRO,需要吹气的湿度(湿度标准),Max_Humidity,10,,,,,,,
PRO,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,,
PRO,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,,
,,,,,,,,,,
PRO,温湿度端口号,Humiture_Port,COM5,,,,,,,
PRO,扫码的相机名称(多个用#分隔),CameraNameList,GigE:MV-CE200-10GC (00D76546875),,,,,,,
PRO,RFID读卡器IP,RFID_IP,192.168.104.101,,,,,,,
PRO,是否是调试状态,IsInDebug,0,,,,,,,
PRO,所有料仓的CID(用#号分隔),All_CIDs,packing-1#packing-2#packing-3#packing-4#packing-5#packing-6#packing-7#packing-8,,,,,,,
类型,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义,SlaveID,
DI,急停,SuddenStop_BTN,0,PRO_AOI_IP_1,0,急停,X01,DI-01,0,
DI,复位,Reset_BTN,1,PRO_AOI_IP_1,0,复位,X02,DI-02,0,
DI,气压检测,Airpressure_Check,2,PRO_AOI_IP_1,0,门禁,X03,DI-03,0,
DI,R侧门禁,DoorLimit,4,PRO_AOI_IP_1,0,料盘检测2(料叉),X05,DI-05,0,
DO,NG料线体电机运转,NGLine_Run,4,PRO_AOI_IP_1,0,NG料线体电机运转,Y05,DO-05,0,
,,,,,,,,,,
DI,R侧料盘检测1(识别区),TrayCheck_1,0,PRO_AOI_IP_3,0,R侧料盘检测1(识别区),X41,DI-41,0,
DI,R侧料盘检测2(识别区),TrayCheck_2,1,PRO_AOI_IP_3,0,R侧料盘检测2(识别区),X42,DI-42,0,
DI,R侧料盘检测3(识别区),TrayCheck_3,2,PRO_AOI_IP_3,0,R侧料盘检测3(识别区),X43,DI-43,0,
DI,R侧料盘检测4(识别区),TrayCheck_4,3,PRO_AOI_IP_3,0,R侧料盘检测4(识别区),X44,DI-44,0,
DI,R侧入料口移门关闭端,EntranceDoor_Close,4,PRO_AOI_IP_3,0,R侧入料口移门关闭端,X45,DI-45,0,
DI,R侧入料口移门打开端,EntranceDoor_Open,5,PRO_AOI_IP_3,0,R侧入料口移门打开端,X46,DI-46,0,
DI,R侧线体入料口检测,LineIn_Check,6,PRO_AOI_IP_3,0,R侧线体入料口检测,X47,DI-47,0,
DI,R侧线体取料位检测,LineTake_Check,7,PRO_AOI_IP_3,0,R侧线体取料位检测,X48,DI-48,0,
DI,R侧料叉压紧确认检测,Compress_Check,8,PRO_AOI_IP_3,0,R侧料叉压紧确认检测,X49,DI-49,0,
DI,R侧NG料口料盘检测,NGTrayCheck,9,PRO_AOI_IP_3,0,R侧NG料口料盘检测,X50,DI-50,0,
DI,R侧NG料口升降门上升端,NGDoowCylinder_Up,10,PRO_AOI_IP_3,0,R侧NG料口升降门上升端,X51,DI-51,0,
DI,R侧NG料口升降门下降端,NGDoorCylinder_Down,11,PRO_AOI_IP_3,0,R侧NG料口升降门下降端,X52,DI-52,0,
DI,R侧顶升装置上升端,TopCylinder_Up,12,PRO_AOI_IP_3,0,R侧顶升装置上升端,X53,DI-53,0,
DI,R侧顶升装置下降端,TopCylinder_Down,13,PRO_AOI_IP_3,0,R侧顶升装置下降端,X54,DI-54,0,
DI,R侧定位装置上升端,LocationCylinder_Up,14,PRO_AOI_IP_3,0,R侧定位装置上升端,X55,DI-55,0,
DI,R侧定位装置下降端,LocationCylinder_Down,15,PRO_AOI_IP_3,0,R侧定位装置下降端,X56,DI-56,0,
,,,,,,,,,,
DO,R侧料仓运转ON,Run_Signal,0,PRO_AOI_IP_3,0,R侧料仓运转ON,Y41,DO-41,0,
DO,R侧轴2刹车电源ON,Axis_Brake,1,PRO_AOI_IP_3,0,R侧轴2刹车电源ON,Y42,DO-42,0,
DO,R侧相机光源ON,Camera_Led,2,PRO_AOI_IP_3,0,R侧相机光源ON,Y43,DO-43,0,
DO,R侧入料口移门关闭,EntranceDoor_Close,3,PRO_AOI_IP_3,0,R侧入料口移门关闭,Y44,DO-44,0,
DO,R侧入料口移门打开,EntranceDoor_Open,4,PRO_AOI_IP_3,0,R侧入料口移门打开,Y45,DO-45,0,
DO,R侧线体正转,Line_Run,5,PRO_AOI_IP_3,0,R侧线体正转,Y46,DO-46,0,
DO,R侧线体反转,Line_BackRun,6,PRO_AOI_IP_3,0,R侧线体反转,Y47,DO-47,0,
DO,R侧料仓吹气SOL,StartOrStopBlow,7,PRO_AOI_IP_3,0,R侧料仓吹气SOL,Y48,DO-48,0,
DO,R侧NG料口升降门上升SOL,NGDoowCylinder_Up,8,PRO_AOI_IP_3,0,R侧NG料口升降门上升SOL,Y49,DO-49,0,
DO,R侧NG料口升降门下降SOL,NGDoorCylinder_Down,9,PRO_AOI_IP_3,0,R侧NG料口升降门下降SOL,Y50,DO-50,0,
DO,R侧顶升装置上升SOL,TopCylinder_Up,10,PRO_AOI_IP_3,0,R侧顶升装置上升SOL,Y51,DO-51,0,
DO,R侧顶升装置下降SOL,TopCylinder_Down,11,PRO_AOI_IP_3,0,R侧顶升装置下降SOL,Y52,DO-52,0,
DO,R侧定位装置上升SOL,LocationCylinder_Up,12,PRO_AOI_IP_3,0,R侧定位装置上升SOL,Y53,DO-53,0,
DO,R侧定位装置下降SOL,LocationCylinder_Down,13,PRO_AOI_IP_3,0,R侧定位装置下降SOL,Y54,DO-54,0,
,,,14,PRO_AOI_IP_3,0,,Y55,DO-55,0,
,,,15,PRO_AOI_IP_3,0,,Y56,DO-56,0,
,,,,,,,,,,
AXIS,(轴一)旋转轴,Middle_Axis,1,COM4,0,,,,,
AXIS,(轴二)升降轴轴,UpDown_Axis,2,COM4,0,,,,,
AXIS,(轴三)进出轴,InOut_Axis,3,COM4,0,,,,,
AXIS,(轴四)压紧轴,Comp_Axis,4,COM4,0,,,,,
,,,,,,,,,,
PRO,升降轴(轴2)P11-NG放料低点,UpDownAxis_P11,1000000,,,,,,,
PRO,升降轴(轴2)P12-NG放料高点缓冲点,UpDownAxis_P12,1019000,,,,,,,
PRO,旋转轴(轴1)P11-NG放料点,MiddleAxis_P11,307300,,,,,,,
PRO,进出轴(轴3)P2-扫码放料点,InOutAxis_P2_Position,140000,,,,,,,
PRO,进出轴(轴3)P11-NG放料点,InOutAxis_P11_Position,148000,,,,,,,
,,,,,,,,,,
PRO,升降轴(轴2)P1待机点/扫码放料低点,UpDownAxis_P1,583000,,,,,,,
PRO,升降轴(轴2)P2扫码放料高点缓冲点,UpDownAxis_P2,604500,,,,,,,
PRO,旋转轴(轴1)P1待机点/扫码放料点,MiddleAxis_P1,307600,,,,,,,
PRO,进出轴(轴3)P1待机点,InOutAxis_P1_Position,1000,,,,,,,
PRO,压紧轴(轴4)P1待机点,CompAxis_P1_Position,140000,,,,,,,
PRO,压紧轴(轴4)P3最大压紧前点,CompAxis_Max_P3,180000,,,,,,,
PRO,压紧轴(轴4)P4目标压紧点,CompAxis_P4_Position,317000,,,,,,,
PRO,压紧轴(轴4)非七寸盘压紧前点相对压紧点的位置,CompAxis_P3_P2_Value,-100000,,,,,,,
PRO,压紧轴(轴4)七寸盘压紧前点相对压紧点的位置,CompAxis7_P3_P2_Value,-50000,,,,,,,
PRO,压紧轴(轴4)压紧确认信号收到之后下降的位置,CompAxis_Down_Position,81000,,,,,,,
PRO,压紧轴(轴4)P2压紧点范围对应值(8=1000;2000#),CompAxis_P2_List,8=419201;421200#12=384501;419200#16=379501;384500#24=358001;366000#32=308001;318000#48=200000;234000#44=234001;274000#40=274001;287500#36=287501;308000#28=318001;358000#20=366001;379500#,,,,,,,
,,,,,,,,,,
PRO,(轴一)旋转轴目标速度,MiddleAxis_TargetSpeed,250,,,,,,,
PRO,(轴一)旋转轴加速度,MiddleAxis_AddSpeed,1000,,,,,,,
PRO,(轴一)旋转轴减速度,MiddleAxis_DelSpeed,1000,,,,,,,
PRO,(轴一)旋转轴原点低速度,MiddleAxis_HomeLowSpeed,80,,,,,,,
PRO,(轴一)旋转轴原点高速,MiddleAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴一)旋转轴原点加速度,MiddleAxis_HomeAddSpeed,50,,,,,,,
PRO,(轴二)升降轴轴目标速度,UpdownAxis_TargetSpeed,300,,,,,,,
PRO,(轴二)升降轴轴加速度,UpdownAxis_AddSpeed,400,,,,,,,
PRO,(轴二)升降轴轴减速度,UpdownAxis_DelSpeed,400,,,,,,,
PRO,(轴二)升降轴轴原点低速度,UpdownAxis_HomeLowSpeed,400,,,,,,,
PRO,(轴二)升降轴轴原点高速,UpdownAxis_HomeHighSpeed,400,,,,,,,
PRO,(轴二)升降轴轴原点加速度,UpdownAxis_HomeAddSpeed,400,,,,,,,
PRO,(轴三)进出轴目标速度,InoutAxis_TargetSpeed,100,,,,,,,
PRO,(轴三)进出轴加速度,InoutAxis_AddSpeed,300,,,,,,,
PRO,(轴三)进出轴减速度,InoutAxis_DelSpeed,300,,,,,,,
PRO,(轴三)进出轴原点低速,InoutAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴三)进出轴原点高速,InoutAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴三)进出轴原点加速度,InoutAxis_HomeAddSpeed,200,,,,,,,
PRO,(轴四)压紧轴目标速度,CompAxis_TargetSpeed,100,,,,,,,
PRO,(轴四)压紧轴加速度,CompAxis_AddSpeed,300,,,,,,,
PRO,(轴四)压紧轴减速度,CompAxis_DelSpeed,300,,,,,,,
PRO,(轴四)压紧轴原点低速,CompAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴四)压紧轴原点高速,CompAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴四)压紧轴原点加速度,CompAxis_HomeAddSpeed,200,,,,,,,
,,,,,,,,,,
PRO,升降轴(轴2)P1速度,UpDownAxis_P1_Speed,600,,,,,,,
PRO,升降轴(轴2)P2速度,UpDownAxis_P2_Speed,600,,,,,,,
PRO,升降轴(轴2)P3速度,UpDownAxis_P3_Speed,1000,,,,,,,
PRO,升降轴(轴2)P4速度,UpDownAxis_P4_Speed,200,,,,,,,
PRO,升降轴(轴2)P5速度,UpDownAxis_P5_Speed,1000,,,,,,,
PRO,升降轴(轴2)P6速度,UpDownAxis_P6_Speed,200,,,,,,,
PRO,升降轴(轴2)P7速度,UpDownAxis_P7_Speed,600,,,,,, ,
PRO,升降轴(轴2)P8速度,UpDownAxis_P8_Speed,600,,,,,,,
PRO,旋转轴(轴1)P1速度,MiddleAxis_P1_Speed,200,,,,,,,
PRO,旋转轴(轴1)P2速度,MiddleAxis_P2_Speed,200,,,,,,,
PRO,进出轴(轴3)P1速度,InOutAxis_P1_Speed,300,,,,,,,
PRO,进出轴(轴3)P2速度,InOutAxis_P2_Speed,300,,,,,,,
PRO,进出轴(轴3)P3速度,InOutAxis_P3_Speed,300,,,,,,,
PRO,压紧轴(轴4)P1速度,CompAxis_P1_Speed,300,,,,,,,
PRO,压紧轴(轴4)P2速度,CompAxis_P2_Speed,300,,,,,,,
PRO,压紧轴(轴4)P3速度,CompAxis_P3_Speed,300,,,,,,,
,,,,,,,,,,
PRO,升降轴(轴2)P101速度,UpDownAxis_P101_Speed,800,,,,,, ,
PRO,升降轴(轴2)P102速度,UpDownAxis_P102_Speed,800,,,,,,,
PRO,进出轴(轴3)P101速度,InOutAxis_P101_Speed,300,,,,,,,
PRO,旋转轴(轴1)P101速度,MiddleAxis_P101_Speed,180,,,,,,,
PRO,压紧轴(轴4)P4速度,CompAxis_P4_Speed,300,,,,,,,
,,,,,,,,,,
PRO,(轴一)旋转轴停止时可误差的脉冲数的最小值,MiddleAxis_ErrorCountMin,10,,,,,,,
PRO,(轴二)升降轴轴停止时可误差的脉冲数的最小值,UpdownAxis_ErrorCountMin,10,,,,,, ,
PRO,(轴三)进出轴停止时可误差的脉冲数的最小值,InoutAxis_ErrorCountMin,10,,,,,,,
PRO,(轴一)旋转轴停止时可误差的脉冲数的最大值,MiddleAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴二)升降轴轴停止时可误差的脉冲数的最大值,UpdownAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴三)进出轴停止时可误差的脉冲数的最大值,InoutAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴一)旋转轴最小限位,MiddleAxis_PositionMin,0,,,,,,,
PRO,(轴二)升降轴最小限位,UpdownAxis_PositionMin,0,,,,,,,
PRO,(轴三)进出轴最小限位,InoutAxis_PositionMin,0,,,,,,,
PRO,(轴一)旋转轴最大限位,MiddleAxis_PositionMax,0,,,,,,,
PRO,(轴二)升降轴最大限位,UpdownAxis_PositionMax,0,,,,,,,
PRO,(轴三)进出轴最大限位,InoutAxis_PositionMax,0,,,,,,,
,,,,,,,,, ,
PRO,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,,,,,
,,,,,,,,,,
PRO,AGV小车站号名称,AgvNodeName,B2,,,,,,,
,,,,,,,,,,
PRO,预警温度,WarnTemperate,80,,,,,, ,
PRO,预警湿度,WarnHumidity,80,,,,,, ,
PRO,出入库多少次,会自动重置旋转轴,Box_ResetMCount,1000,,,,,,,
PRO,出入库多少次,会自动重置所有轴操作,Box_ResetACount,100,,,,,,,
PRO,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,,,
PRO,需要吹气的温度(温度标准),Max_Temperature,0,,,,,,,
PRO,需要吹气的湿度(湿度标准),Max_Humidity,10,,,,,,,
PRO,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,,
PRO,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,,
PRO,温湿度端口号,Humiture_Port,COM5,,,,,,,
,,,,,,,,,,
PRO,扫码的相机名称(多个用#分隔),CameraNameList,GigE:MV-CE200-10GC (00D76546940),,,,,,,
PRO,RFID读卡器IP,RFID_IP,192.168.104.102,,,,,,,
PRO,是否是调试状态,IsInDebug,0,,,,,,,
PRO,所有料仓的CID(用#号分隔),All_CIDs,packing-2#packing-3#packing-4#packing-5#packing-6#packing-7#packing-8#packing-1,,,,,,,
\ No newline at end of file
类型,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义,SlaveID,
PRO,IO模块对应的DI数量,IO_DILength,192.168.104.21#16;192.168.104.22#16;192.168.104.23#16,,,,,
PRO,IO模块对应的DO数量,IO_DOLength,192.168.104.21#16;192.168.104.22#16;192.168.104.23#16,,,,,
PRO,第一块IO模块IP,PRO_AOI_IP_1,192.168.104.21,,,,,,,
PRO,第二块IO模块IP,PRO_AOI_IP_2,192.168.104.22,,,,,,,
PRO,第三块IO模块IP,PRO_AOI_IP_3,192.168.104.23,,,,,,,
,,,,,,,,,,
,,,,,,,,,,
DI,急停,SuddenStop_BTN,0,PRO_AOI_IP_1,0,急停,X01,DI-01,0,
DI,复位,Reset_BTN,1,PRO_AOI_IP_1,0,复位,X02,DI-02,0,
DI,气压检测,Airpressure_Check,2,PRO_AOI_IP_1,0,门禁,X03,DI-03,0,
DI,L侧门禁,DoorLimit_L,3,PRO_AOI_IP_1,0,料盘检测1(进料口),X04,DI-04,0,
DI,R侧门禁,DoorLimit_R,4,PRO_AOI_IP_1,0,料盘检测2(料叉),X05,DI-05,0,
,,,5,PRO_AOI_IP_1,0,气压检测,X06,DI-06,0,
,,,6,PRO_AOI_IP_1,0,进料口门上升端,X07,DI-07,0,
,,,7,PRO_AOI_IP_1,0,进料口门下降端,X08,DI-08,0,
,,,8,PRO_AOI_IP_1,0,,X09,DI-09,0,
,,,9,PRO_AOI_IP_1,0,,X10,DI-10,0,
,,,10,PRO_AOI_IP_1,0,,X11,DI-11,0,
,,,11,PRO_AOI_IP_1,0,,X12,DI-12,0,
,,,12,PRO_AOI_IP_1,0,,X13,DI-13,0,
,,,13,PRO_AOI_IP_1,0,,X14,DI-14,0,
,,,14,PRO_AOI_IP_1,0,,X15,DI-15,0,
,,,15,PRO_AOI_IP_1,0,,X16,DI-16,0,
,,,,,,,,,,
DO,自动指示灯,AutoRun_HddLed,0,PRO_AOI_IP_1,0,自动指示灯,Y01,DO-01,0,
DO,故障指示灯,Alarm_HddLed,1,PRO_AOI_IP_1,0,故障指示灯,Y02,DO-02,0,
DO,待机指示灯,RunSign_HddLed,2,PRO_AOI_IP_1,0,待机指示灯,Y03,DO-03,0,
DO,报警蜂鸣器,Alarm_Buzzer,3,PRO_AOI_IP_1,0,报警蜂鸣器,Y04,DO-04,0,
DO,NG料线体电机运转,NGLine_Run,4,PRO_AOI_IP_1,0,NG料线体电机运转,Y05,DO-05,0,
,,,5,PRO_AOI_IP_1,0,,Y06,DO-06,0,
,,,6,PRO_AOI_IP_1,0,,Y07,DO-07,0,
,,,7,PRO_AOI_IP_1,0,,Y08,DO-08,0,
,,,8,PRO_AOI_IP_1,0,,Y09,DO-09,0,
,,,9,PRO_AOI_IP_1,0,,Y10,DO-10,0,
,,,10,PRO_AOI_IP_1,0,,Y11,DO-11,0,
,,,11,PRO_AOI_IP_1,0,,Y12,DO-12,0,
,,,12,PRO_AOI_IP_1,0,,Y13,DO-13,0,
,,,13,PRO_AOI_IP_1,0,,Y14,DO-14,0,
,,,14,PRO_AOI_IP_1,0,,Y15,DO-15,0,
,,,15,PRO_AOI_IP_1,0,,Y16,DO-16,0,
,,,,,,,,,,
,,,,,,,,,,
PRO,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,,,,,
位置,优先级,高度,宽度,料仓ID,旋转轴位置P101,升降轴低点P101,升降轴高点P102,进出轴位置P101
191,8,8,7,1,309100,490000,507000,140000
192,7,8,7,1,309100,432000,448000,140000
193,6,8,7,1,309100,374000,392000,140000
194,5,8,7,1,309100,317000,334000,140000
195,4,8,7,1,309100,261000,278000,140000
196,3,8,7,1,309100,203000,220000,140000
197,2,8,7,1,309100,146000,163000,140000
198,1,8,7,1,309100,90000,108000,140000
\ No newline at end of file
位置,优先级,高度,宽度,料仓ID,旋转轴位置P101,升降轴低点P101,升降轴高点P102,进出轴位置P101
201,8,8,7,2,308300,487000,506000,140000
202,7,8,7,2,308300,431500,450000,140000
203,6,8,7,2,308300,374000,389000,140000
204,5,8,7,2,308300,316000,333000,140000
205,4,8,7,2,308300,260000,276000,140000
206,3,8,7,2,308300,204000,219000,140000
207,2,8,7,2,308300,146000,163000,140000
208,1,8,7,2,308300,90000,107000,140000
\ No newline at end of file
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace OnlineStore.DeviceLibrary
{
public abstract class IOManager
{
public static IOManager instance = null;
public abstract void ConnectionIOList(List<string> dIODeviceNameList);
#region KNDIO
public static void IOMove(string ioType, IO_VALUE ioValue, int subType = 0)
{
ConfigIO configIo = GetDO(ioType, subType);
if (configIo != null)
{
instance.WriteSingleDO(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr(), ioValue);
Thread.Sleep(1);
}
else
{
LogUtil.error("未找到DO,[" + ioType + "][" + subType + "]");
}
}
public static IO_VALUE IOValue(string ioType, int subType)
{
IO_VALUE ioValue = IO_VALUE.LOW;
ConfigIO configIo = GetDI(ioType, subType);
if (configIo == null)
{
configIo = GetDO(ioType, subType);
}
if (configIo != null)
{
if (configIo.ProType.Equals(ConfigItemType.DI))
{
ioValue = instance.GetDIValue(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr());
}
else
{
ioValue = instance.GetDOValue(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr());
}
}
else
{
LogUtil.error("未找到IO[" + ioType + "][" + subType + "]");
}
return ioValue;
}
public static IO_VALUE DOValue(string ioType, int subType = 0)
{
IO_VALUE ioValue = IO_VALUE.LOW;
ConfigIO configIo = GetDO(ioType, subType);
if (configIo != null)
{
ioValue = instance.GetDOValue(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr());
}
else
{
LogUtil.error("没有DO=" + ioType);
}
return ioValue;
}
private static ConfigIO GetDI(string ioType, int subType)
{
ConfigIO configIo = null;
if (subType <= 0)
{
if (StoreManager.Config.DIList.ContainsKey(ioType))
{
return StoreManager.Config.DIList[ioType];
}
}
else
{
if (StoreManager.AllConfigMap.ContainsKey(subType))
{
string newType = ioType.Replace("SW1_", "SW_").Replace("SW2_", "SW_").Replace("SW3_", "SW_").Replace("SW4_", "SW_");
if (StoreManager.AllConfigMap[subType].DIList.ContainsKey(newType))
{
return StoreManager.AllConfigMap[subType].DIList[newType];
}
}
}
return configIo;
}
private static ConfigIO GetDO(string ioType, int subType)
{
ConfigIO configIo = null;
if (subType <= 0)
{
if (StoreManager.Config.DOList.ContainsKey(ioType))
{
return StoreManager.Config.DOList[ioType];
}
}
else
{
if (StoreManager.AllConfigMap.ContainsKey(subType))
{
string newType = ioType.Replace("SW1_", "SW_").Replace("SW2_", "SW_").Replace("SW3_", "SW_").Replace("SW4_", "SW_");
if (StoreManager.AllConfigMap[subType].DOList.ContainsKey(newType))
{
return StoreManager.AllConfigMap[subType].DOList[newType];
}
}
}
return configIo;
}
public static void CloseDeviceDO(List<ConfigIO> DoList)
{
foreach (ConfigIO io in DoList)
{
instance.WriteSingleDO(io.IO_IP, io.SlaveID, io.GetIOAddr(), IO_VALUE.LOW);
Thread.Sleep(60);
}
}
public static void CloseDeviceDO(int subType)
{
List<ConfigIO> DoList = new List<ConfigIO>();
if (subType <= 0)
{
DoList = new List<ConfigIO>(StoreManager.Config.DOList.Values);
}
else
{
if (StoreManager.AllConfigMap.ContainsKey(subType))
{
DoList = new List<ConfigIO>(StoreManager.AllConfigMap[subType].DOList.Values);
}
}
CloseDeviceDO(DoList);
}
#endregion
public static void Init()
{
// bool isAIOBox = ConfigAppSettings.GetIntValue(Setting_Init.UseAIOBOX).Equals(1);
// if (isAIOBox)
// {
instance = new AIOBOXManager();
//}
//else
//{
// instance = new KNDManager();
//}
}
public abstract void ReadAllDI(string deviceName, byte slaveId);
public abstract void ReadAllDO(string deviceName, byte slaveId);
public abstract void WriteSingleDO(string deviceName, byte slaveId, ushort index, IO_VALUE value, int time);
public abstract void WriteSingleDO(string deviceName, byte slaveId, ushort index, IO_VALUE value);
public abstract IO_VALUE GetDIValue(string deviceName, byte slaveID, ushort v);
public abstract IO_VALUE GetDOValue(string deviceName, byte slaveID, ushort v);
public abstract IO_VALUE GetIOValue(ConfigIO configIO);
public abstract void CloseAllDO();
public abstract void CloseAllConnection();
public abstract bool IsConnect(string ip);
}
}
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Asa.RFID.RFIDAuto;
namespace Asa.RFID
{
public class RFIDAutoReader
{
public static readonly ILog LOGGER = LogManager.GetLogger("TheRFID");
private static Dictionary<string, RFIDAuto> rfidMap = new Dictionary<string, RFIDAuto>();
/// <summary>
/// 打开所有
/// </summary>
/// <param name="ipArr"></param>
/// <param name="OnReceive"></param>
/// <param name="ip"></param>
public static void Open(Received_Event OnReceive, params string[] ipArr)
{
foreach (var ip in ipArr)
{
if (rfidMap.ContainsKey(ip))
{
rfidMap[ip].StartAutoScan(OnReceive);
}
else
{
RFIDAuto rfid = new RFIDAuto(ip);
rfid.StartAutoScan(OnReceive);
rfidMap.Add(ip, rfid);
}
}
}
/// <summary>
/// 获取最后读到的标签并清理
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
public static byte[] ReadAndClear(string ip)
{
if (rfidMap.ContainsKey(ip))
{
return rfidMap[ip].ReadAndClear();
}
return null;
}
/// <summary>
/// 获取最后读到的标签
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
public static byte[] Read(string ip)
{
if (rfidMap.ContainsKey(ip))
{
return rfidMap[ip].Read();
}
return null;
}
/// <summary>
/// 关闭所有
/// </summary>
public static void CloseAll()
{
foreach (var rfid in rfidMap.Values)
{
rfid.StopAutoScan();
}
}
}
}

using Asa.RFID;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary
{
public class RFIDManager
{
private static bool IsOpen = false;
public static void Open(string[] iparray)
{
if (IsOpen)
{
LogUtil.info("RFIDManager.Open , IsOpen = true , return ");
return;
}
Task.Factory.StartNew(delegate
{
LogUtil.info("RFIDManager.Open , set IsOpen = true");
IsOpen = true;
try
{
RFIDAutoReader.Open(null, iparray);
}
catch (Exception ex)
{
LogUtil.error("Open 出错:" + ex.ToString());
}
});
}
public static RFIDData ReadRFID(string ip, bool isClear = false)
{
try
{
if (String.IsNullOrEmpty(ip).Equals(false))
{
byte[] bdata = null;
if (isClear)
{
bdata = RFIDAutoReader.ReadAndClear(ip);
}
else
{
bdata = RFIDAutoReader.Read(ip);
}
if (bdata == null)
{
LogUtil.error("RFID [ " + ip + " ] 读到数据=null");
}
RFIDData data = new RFIDData(bdata);
return data;
}
}
catch (Exception ex)
{
//LogUtil.error("ReadRFID["+ip+"]出错:" + ex.ToString());
}
return new RFIDData();
}
public static void Close()
{
Task.Factory.StartNew(delegate
{
IsOpen = false;
LogUtil.info("RFIDManager.Close ,set IsOpen= false");
try
{
RFIDAutoReader.CloseAll();
}
catch (Exception ex)
{
LogUtil.error("关闭RFID出错:" + ex.ToString());
}
});
}
}
public class RFIDData
{
/// <summary>
/// RFID类型,区分是料架还是托盘,托盘E=69,包装料料架A=65,料串=B
/// </summary>
public char RFType = '0';
public int Num = 0;
public RFIDData(int num = 0, int t = 0)
{
if (t < 65)
{
RFType = '0';
}
else
{
this.RFType = (char)t;
}
this.Num = num;
}
public RFIDData(byte[] data)
{
try
{
if (data != null && data.Length > 2)
{
if (data[1] < 65)
{
RFType = '0';
}
else
{
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() + "";
}
}
}
using Asa.RFID;
using OnlineStore.Common;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class RFIDManager
{
private static ReadAll readAll = new ReadAll("TheRFID");
private static bool IsOpen = false;
private static ConcurrentDictionary<string, string> LastRfidMap = new ConcurrentDictionary<string, string>();
public static void Open(string[] iparray)
{
if (IsOpen)
{
return;
}
try
{
// readAll.Received += ReadAll_Received;
// readAll.Log += ReadAll_Log;
readAll.Start();
IsOpen = true;
}
catch (Exception ex)
{
LogUtil.error("Open 出错:" + ex.ToString());
}
}
private static void ReadAll_Log(string ip, string log)
{
LogUtil.LOGGER.Info("RFID : [" + ip + "] " + log);
}
public static RFIDData ReadRFID(string ip, bool isClear = false)
{
try
{
if (String.IsNullOrEmpty(ip).Equals(false))
{
string outValue = readAll.Read(ip);
if (isClear)
{
readAll.Clear(ip);
}
if (outValue.Equals("000"))
{
// LogUtil.error("ReadRFID[" + ip + "]=" + outValue);
}
RFIDData data = new RFIDData(outValue);
return data;
}
}
catch (Exception ex)
{
LogUtil.error("ReadRFID[" + ip + "] [" + isClear + "] 出错:" + ex.ToString());
}
return new RFIDData();
}
public static void Close()
{
try
{
readAll.Stop();
}
catch (Exception ex)
{
LogUtil.error("关闭RFID出错:" + ex.ToString());
}
}
}
public class RFIDData
{
public string StrData = "";
public RFIDData(string data = "00")
{
if (String.IsNullOrEmpty(data))
{
data = "00";
}
this.StrData = data;
}
public string NumStr()
{
return StrData;
}
internal static bool IsRealRfid(string shelfRfid)
{
//判断料架号是否是真实的料架号
if (shelfRfid.StartsWith("C") || shelfRfid.StartsWith("D"))
{
int num = -1;
try
{
num = Convert.ToInt32(shelfRfid.Substring(1, shelfRfid.Length - 1));
}
catch (Exception ex)
{
}
if (num > 0)
{
return true;
}
}
return false;
}
}
}
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class EnteryDoorBean
{
public bool IsRun = false;
private string LastMoveDO = "";
private string LastCheckDI = "";
private int subType = 0;
internal DateTime LastEndTime = DateTime.Now;
public EnteryDoorBean(int subType)
{
this.subType = subType;
}
public void Stop()
{
if (IsRun)
{
IsRun = false;
}
}
private bool Start(string moveDO, string checkDI, int timeOutMS = 30000)
{
if (IsRun)
{
LogUtil.error("启动[" + moveDO + "] [" + checkDI + "] 失败");
return false;
}
IsRun = true;
Task.Factory.StartNew(delegate
{
WriteAndWait(moveDO, checkDI, timeOutMS);
});
return true;
}
private string WriteAndWait(string moveDO, string checkDI, int timeOutMS = 30000)
{
LastMoveDO = moveDO;
LastCheckDI = checkDI;
LogUtil.debug("写入信号:" + moveDO + ",等待信号:" + checkDI + "");
if (moveDO.Equals(IO_Type.EntranceDoor_Open))
{
IOManager.IOMove(IO_Type.EntranceDoor_Close, IO_VALUE.LOW, subType);
}
else
{
IOManager.IOMove(IO_Type.EntranceDoor_Open, IO_VALUE.LOW, subType);
}
IOManager.IOMove(moveDO, IO_VALUE.HIGH, subType);
Thread.Sleep(50);
IsRun = true;
DateTime startTime = DateTime.Now;
string result = "";
bool isStop = false;
while (true)
{
Thread.Sleep(50);
TimeSpan span = DateTime.Now - startTime;
if (!IsRun)
{
isStop = true;
result = "手动停止";
}
else if (span.TotalMilliseconds > timeOutMS)
{
isStop = true;
result = "转动超时";
}
//判断Buzy及位置是否结束
else if (IOManager.IOValue(checkDI, subType).Equals(IO_VALUE.HIGH))
{
isStop = true;
}
if (isStop)
{
if (result.Equals(""))
{
LogUtil.info("停止运动:" + result + " [" + moveDO + "] [" + checkDI + "] ");
}
else
{
LogUtil.info("[" + moveDO + "] [" + checkDI + "] 停止运动:" + result + " " + moveDO);
}
LastEndTime = DateTime.Now;
IOManager.IOMove(moveDO, IO_VALUE.LOW, subType);
IsRun = false;
return result;
}
}
}
public bool StartOpen(StoreMoveInfo moveInfo)
{
bool UseDoor = ConfigAppSettings.GetIntValue(Setting_Init.UseDoor).Equals(1);
if (!UseDoor)
{
return false;
}
//如果门已打开直接返回
if (IOManager.IOValue(IO_Type.EntranceDoor_Open, subType).Equals(IO_VALUE.HIGH) &&
IOManager.IOValue(IO_Type.EntranceDoor_Close, subType).Equals(IO_VALUE.LOW))
{
return true;
}
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.EntranceDoor_Open, IO_VALUE.HIGH));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.EntranceDoor_Close, IO_VALUE.LOW));
}
return Start(IO_Type.EntranceDoor_Open, IO_Type.EntranceDoor_Open);
}
public bool StartClose(StoreMoveInfo moveInfo)
{
bool UseDoor = ConfigAppSettings.GetIntValue(Setting_Init.UseDoor).Equals(1);
if (!UseDoor)
{
return false;
}
//如果门已关闭直接返回
if (IOManager.IOValue(IO_Type.EntranceDoor_Close, subType).Equals(IO_VALUE.HIGH) &&
IOManager.IOValue(IO_Type.EntranceDoor_Open, subType).Equals(IO_VALUE.LOW))
{
return true;
}
if (moveInfo != null)
{
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.EntranceDoor_Close, IO_VALUE.HIGH));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.EntranceDoor_Open, IO_VALUE.LOW));
}
return Start(IO_Type.EntranceDoor_Close, IO_Type.EntranceDoor_Close);
}
}
}
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class HumitureBean
{
private string PortName = "";
private string Name = "";
public HumitureParam LastData = new HumitureParam(0, 0);
internal HumitureBean(string port,string deviceName)
{
this.Name = deviceName;
this.PortName = port;
}
public HumitureParam QueryData()
{
HumitureParam param = HumitureController.QueryData(PortName);
return param;
}
internal void ProcessHumidityCMD(Operation resultOperation)
{
Dictionary<string, string> data = resultOperation.data;
if (data != null && data.ContainsKey(ParamDefine.maxHumidity) && data.ContainsKey(ParamDefine.maxTemperature))
{
string maxHumidity = data[ParamDefine.maxHumidity];
string maxTemp = data[ParamDefine.maxTemperature];
LogUtil.info( Name+"收到服务器温湿度预警值:maxHumidity=" + maxHumidity + ",maxTemperature=" + maxTemp);
try
{
this.Max_Humidity = (float)Convert.ToDouble(maxHumidity);
this.Max_Temperature = (float)Convert.ToDouble(maxTemp);
LogUtil.info(Name+"保存温湿度预警值:Max_Humidity=" + Max_Humidity + ",Max_Temperature=" + Max_Temperature);
}
catch (Exception ex)
{
LogUtil.error(Name+"转换温湿度失败:" + ex.ToString());
}
}
}
#region 温湿度处理
/// <summary>
/// 湿度标准,超过后需要报警
/// </summary>
private float Max_Humidity = 0;
/// <summary>
/// 温度标准,超过后需要报警
/// </summary>
private float Max_Temperature = 0;
private bool IsInBlowing = false;
private DateTime LastBeginBlowTime = DateTime.Now;
private DateTime LastEndBlowTime = new DateTime(1997, 1, 1);
private DateTime preLogTime = DateTime.Now;
public bool TempOrHumidityIsAlarm = false;
public DateTime TempAlarmTime = DateTime.Now;
private float StartBlowValue = (float)ConfigAppSettings.GetNumValue(Setting_Init.StartBlowValue);
private float StopBlowValue = (float)ConfigAppSettings.GetNumValue(Setting_Init.StopBlowValue);
public string currTempStr = "";
internal void HumidityProcess(BoxBean box)
{
try
{
if ((DateTime.Now - preLogTime).TotalSeconds > 10)
{
preLogTime = DateTime.Now;
//用最大的湿度判断是否需要吹气,开始吹气的值=发过来的值-4
//温湿度
//ASTemperateParam param = HumitureServer.GetTemperateParam(Config.GetTempAddrList());
HumitureParam param = QueryData();
double humidity = 0;
double temp = 0;
if (param != null)
{
humidity = param.Humidity;
temp = param.Temperate;
currTempStr = Name + ("湿度:" + humidity.ToString() + ",温度:" + temp);
}
//double currMaxHumidity = HumitureServer.GetMaxHumidity(Config.GetTempAddrList());
double currMaxHumidity = param.Humidity;
float startBlowHumidity = Max_Humidity - StartBlowValue;
float stopBlowHumidity = Max_Humidity - StopBlowValue;
//判断是否需要吹气
if (startBlowHumidity > 0 && startBlowHumidity < currMaxHumidity && IsInBlowing.Equals(false))
{
//判断是否距离上次结束指定的时间
TimeSpan span = DateTime.Now - LastEndBlowTime;
if (span.TotalMinutes > box.Config.BlowAir_Interval)
{
LogUtil.info(Name + "当前最大湿度:" + currMaxHumidity.ToString() + ",开始吹气湿度:" + startBlowHumidity + ",当前不在吹气中,且间隔超过" + box.Config.BlowAir_Interval + "分钟,开始吹气!");
IsInBlowing = true;
//Thread.Sleep(100);
box.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.HIGH);
LastBeginBlowTime = DateTime.Now;
LastEndBlowTime = DateTime.Now;
}
}
if (IsInBlowing && stopBlowHumidity > currMaxHumidity)
{
LogUtil.info(Name + "当前最大湿度:" + currMaxHumidity.ToString() + ",停止吹气湿度:" + stopBlowHumidity + ",停止吹气!");
IsInBlowing = false;
box.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
LastEndBlowTime = DateTime.Now;
}
if (IsInBlowing)
{
//判断是否需要结束吹气
TimeSpan span = DateTime.Now - LastBeginBlowTime;
if (span.TotalMinutes > box.Config.BlowAir_Time)
{
LogUtil.info(Name + "已经吹气" + span.TotalMinutes + "分钟,超过配置的吹气时间" + box.Config.BlowAir_Time + "分钟,停止吹气!");
IsInBlowing = false;
//Thread.Sleep(100);
box.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
LastEndBlowTime = DateTime.Now;
}
}
bool needAlarm = false;
//如果开始吹气并且当前达到报警值
if (IsInBlowing && humidity > Max_Humidity)
{
needAlarm = true;
}
else if (temp > Max_Temperature && Max_Temperature > 0)
{
LogUtil.info(Name + "当前温度【" + param.Temperate + "】超过最高温度【" + Max_Temperature + "】,开始报警!");
needAlarm = true;
//Thread.Sleep(100);
box.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
}
else if (temp < Max_Temperature)
{
if (IsInBlowing.Equals(false) && TempOrHumidityIsAlarm)
{
LogUtil.info(Name + "不在吹气中,且当前温度【" + param.Temperate + "】低于【" + Max_Temperature + "】,关闭报警!");
TempOrHumidityIsAlarm = false;
//Thread.Sleep(100);
box.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
}
}
else
{
TempOrHumidityIsAlarm = false;
}
if (needAlarm)
{
HTAlarm();
}
}
}
catch (Exception ex)
{
LogUtil.error(Name + "HumidityProcess出错:" + ex.ToString());
}
}
private void HTAlarm()
{
if (TempOrHumidityIsAlarm)
{
return;
}
TempAlarmTime = DateTime.Now;
TempOrHumidityIsAlarm = true;
}
internal bool NeedGetTem()
{
if (Max_Humidity <= 0 || (Max_Temperature <= 0))
{
return true;
}
return false;
}
#endregion
}
}
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class AutoInoutInfo
{
/// <summary>
/// 入库完成后自动出库,出库完成后自动入库
/// </summary>
public bool autoNext = false;
/// <summary>
/// 自动出入库间隔
/// </summary>
private int Jiange = 3;
private int positionIndex = 0;
public string autoMsg = "";
private int startIndex = -1;
private string shelfPosId = "";
#region 出入库参数
/// <summary>
/// 当前出入库的次数,超过配置的数量时,需要自动重置一下,再进行出入库
/// </summary>
internal int CurrInOutCount = 0;
internal int CurrInOutACount = 0;
#endregion
public void StartAuto(int jiange, int currIndex, string shelfPosId)
{
autoNext = true;
Jiange = jiange;
positionIndex = currIndex;
startIndex = currIndex;
this.shelfPosId = shelfPosId;
}
public void StopAuto()
{
autoNext = false;
}
internal void InOutEndProcess(BoxBean boxBean, StoreMoveType storeMoveType)
{
try
{
CurrInOutCount++;
CurrInOutACount++;
//是否自动进入出库状态
if (!autoNext)
{
return;
}
if (storeMoveType.Equals(StoreMoveType.InStore))
{
int newIndex = positionIndex - 1;
if (newIndex < 0)
{
if (startIndex >= 0 && startIndex < boxBean.PositionNumList.Count)
{
newIndex = startIndex;
boxBean.LogInfo("下一个索引不存在,重新开始自动出入库,索引【" + startIndex + "】");
}
else
{
autoNext = false;
autoMsg = "自动出入库结束!";
boxBean.LogInfo("下一个索引不存在,自动 出入库结束!");
}
}
else
{
positionIndex = newIndex;
string posid = boxBean.PositionNumList[positionIndex];
InOutParam param = new InOutParam("AAAA", posid, shelfPosId);
//param.NeedOutShelf = false;
//param.NeedEnterShelf = false;
//判断是否需要重置
if (CurrInOutACount >= boxBean.Config.Box_ResetACount)
{
boxBean.LogInfo("自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把出库信息存入排队列表中");
boxBean.Reset(false);
autoMsg = "自动出库:" + posid;
boxBean.waitOutStoreList.Enqueue(param);
}
else
{
boxBean.LogInfo("自动进入下一个出库:posid=" + posid);
autoMsg = "自动出库:" + posid;
boxBean.StartOutStoreMove(param);
}
}
}
else if (storeMoveType.Equals(StoreMoveType.OutStore))
{
int newIndex = positionIndex - Jiange;
if (newIndex < 0)
{
if (startIndex >= 0 && startIndex < boxBean.PositionNumList.Count)
{
newIndex = startIndex;
boxBean.LogInfo("下一个索引不存在,重新开始自动出入库,索引【" + startIndex + "】");
}
else
{
autoNext = false;
autoMsg = "自动出入库结束!";
boxBean.LogInfo("下一个索引不存在,自动 出入库结束!");
}
}
else
{
string posid = boxBean.PositionNumList[newIndex];
InOutParam param = new InOutParam("AAAA", posid, shelfPosId);
// param.NeedOutShelf = false;
//判断是否需要重置
if (CurrInOutACount >= boxBean.Config.Box_ResetACount)
{
boxBean.LogInfo("自动进入下一个入库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把入库信息存入排队列表中");
boxBean.Reset(false);
autoMsg = "自动入库:" + posid;
boxBean.waitOutStoreList.Enqueue(param);
}
else
{
boxBean.LogInfo("自动进入下一个入库:posid=" + posid);
autoMsg = "自动入库:" + posid;
boxBean.StartInStoreMove(param);
}
}
}
}
catch (Exception ex)
{
LogUtil.error(boxBean.Name + "InOutEndProcess ERROR:" + ex.ToString());
}
}
internal void ClearCount()
{
CurrInOutACount = 0;
CurrInOutCount = 0;
}
}
}
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 出入仓参数(出入库操作时传入的参数类)
/// </summary>
public class InOutParam
{
public InOutParam(string wareNo="", string posId="", string ShelfPosID="", string platew = "", string plateh = "", bool urgentReel = false, bool cutReel = false, bool smallReel = false, string rfid = "", int rfidLoc = 0,int taskCount=0,string realRfid="")
{
this.ShelfPosID = ShelfPosID;
WareCode = wareNo;
PosID = posId;
MoveP = null;
this.PlateW = platew;
this.PlateH = plateh;
this.urgentReel = urgentReel;
this.cutReel = cutReel;
this.smallReel = smallReel;
this.rfid = rfid;
this.rfidLoc = rfidLoc;
this.taskCount = taskCount;
this.realRfid = realRfid;
}
public InOutParam(string wareNo, string posId, string ShelfPosID,LineMoveP linePosition )
{
WareCode = wareNo;
this.ShelfPosID = ShelfPosID;
PosID = posId;
MoveP = linePosition;
//NeedEnterShelf = false;
//NeedOutShelf = false;
this.urgentReel = false ;
this.cutReel = false ;
this.smallReel = false ;
this.rfid = "";
this.rfidLoc = 0;
this.taskCount = 0;
this.realRfid = "";
}
public InOutParam NewParam()
{
InOutParam newp = new InOutParam(WareCode,PosID,ShelfPosID, PlateW, PlateH, urgentReel,cutReel,smallReel,rfid,rfidLoc,taskCount,realRfid);
return newp;
}
/// <summary>
/// 物品二维码信息
/// </summary>
public string WareCode { get; set; }
/// <summary>
/// 位置坐标名(对应配置表的位置)
/// </summary>
public string PosID { get; set; }
/// <summary>
/// 料架对应的库位号
/// </summary>
public string ShelfPosID = "";
public LineMoveP MoveP { get; set; }
/// <summary>
/// 料盘高度
/// </summary>
public string PlateH { get; set; }
/// <summary>
/// 料盘宽度
/// </summary>
public string PlateW { get; set; }
/// <summary>
/// urgentReel: true 表示紧急料,需要出到料串上
/// </summary>
public bool urgentReel { get; set; }
/// <summary>
/// cutReel: true 表示分盘料,需要出到料串上
/// </summary>
public bool cutReel { get; set; }
/// <summary>
/// smallReel: true 小料(7x8),放置到小料架上
/// </summary>
public bool smallReel { get; set; }
/// <summary>
/// rfid: 分配的料架RFID
/// </summary>
public string rfid = "";
/// <summary>
/// rfidLoc: 料架的架位,值为 - 1时,可以自由分配皮带线,
/// 小料时,架位为1 - 46优先走1 / 2号皮带线,47 - 92优先走3 / 4号皮带线,
/// 70,71,72时只能分配到3 / 4号皮带线;
/// 大料时,架位1 - 6优先走1 / 2号皮带线, 7 - 12优先走3/ 4号皮带线
/// </summary>
public int rfidLoc = 0;
/// <summary>
/// 剩余任务数量,当剩余任务 《=1时,出库完成需要送出料架
/// 剩余任务数为0, 或者料架已放满,或者料架rfid与上一个任务不同,料架就要放出去
/// 剩余任务数为1时, 当前的料放完就可以把料架放出去了
///当前料放完,料架已满,也把料架放出去
/// </summary>
public int taskCount = 0;
/// <summary>
/// 真实料架号
/// </summary>
public string realRfid = "";
/// <summary>
/// 根据PosId获取对应的料仓ID,若PosId=="",返回-1
/// </summary>
/// <returns></returns>
public int GetStoreId()
{
return GetPosStoreId(PosID);
}
public static int GetPosStoreId(string posId)
{
if (!posId.Equals(""))
{
try
{
string[] arr = posId.Split('#');
if (arr.Length >= 2)
{
return int.Parse(arr[0]);
}
else
{
return int.Parse(posId.Substring(2, 2));
}
}
catch (Exception ex)
{
}
}
return -1;
}
public string ToStr()
{
return " 库位 [" + PosID + "] [" + ShelfPosID + "], [" + WareCode + "], [" + PlateW + "x" + PlateH + "] ," +
"urgentReel [" + urgentReel + "],cutReel [" + cutReel + "],smallReel [" + smallReel + "],rfid [" + rfid + "],rfidLoc [" + rfidLoc + "],taskCount ["+ taskCount + "]";
}
public string ToShortStr()
{
return "["+rfid+"][" + PosID + "][" + ShelfPosID + "][" + PlateW + "x" + PlateH + "][" + WareCode + "]";
}
internal void UpdateShelfPosId(string pId)
{
this.ShelfPosID = pId;
ShelfPosition sp = CSVPositionReader<ShelfPosition>.GetPositon(ShelfPosID);
if (sp == null)
{
LogUtil.error( "GetPositon[" + ShelfPosID + "]=null,没有库位不能执行出入库");
}
MoveP.InOut_P101 = sp.InoutAxis_P101;
MoveP.UpDown_LP101 = sp.UpDownAxis_LP101;
MoveP.UpDown_HP102 = sp.UpDownAxis_HP102;
MoveP.Middle_P101 = sp.MiddleAxis_P101;
}
internal void UpdatePosId(string message, string posId, string plateW, string plateH,int comP2,int comP3)
{
this.WareCode = message;
this.PosID = posId;
this.PlateH = plateH;
this.PlateW = plateW;
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(posId);
if (position == null)
{
LogUtil.error( "GetPositon[" + posId + "] =null,没有库位不能执行出入库");
}
MoveP.ComPress_P2 = comP2;
MoveP.ComPress_P3 = comP3;
MoveP.InOut_P3 = position.InoutAxis_P3;
MoveP.Middle_P2 = position.MiddleAxis_P2;
MoveP.UpDown_P3 = position.UpdownAxis_IH_P3;
MoveP.UpDown_P4 = position.UpdownAxis_IL_P4;
MoveP.UpDown_P5 = position.UpdownAxis_OH_P5;
MoveP.UpDown_P6 = position.UpdownAxis_OL_P6;
}
internal void UpdatePosIdAndShelfId(string wareNo,string rfid,string posId, string ShelfPosID)
{
WareCode = wareNo;
this.ShelfPosID = ShelfPosID;
this.rfid = rfid;
ShelfPosition sp = CSVPositionReader<ShelfPosition>.GetPositon(ShelfPosID);
if (sp == null)
{
LogUtil.error("GetPositon[" + ShelfPosID + "]=null,没有库位不能执行出入库");
}
MoveP.InOut_P101 = sp.InoutAxis_P101;
MoveP.UpDown_LP101 = sp.UpDownAxis_LP101;
MoveP.UpDown_HP102 = sp.UpDownAxis_HP102;
MoveP.Middle_P101 = sp.MiddleAxis_P101;
PosID = posId;
ACBoxPosition position = CSVPositionReader<ACBoxPosition>.GetPositon(posId);
if (position == null)
{
LogUtil.error("GetPositon[" + posId + "] =null,没有库位不能执行出入库");
}
//MoveP.ComPress_P2 = comP2;
//MoveP.ComPress_P3 = comP3;
MoveP.InOut_P3 = position.InoutAxis_P3;
MoveP.Middle_P2 = position.MiddleAxis_P2;
MoveP.UpDown_P3 = position.UpdownAxis_IH_P3;
MoveP.UpDown_P4 = position.UpdownAxis_IL_P4;
MoveP.UpDown_P5 = position.UpdownAxis_OH_P5;
MoveP.UpDown_P6 = position.UpdownAxis_OL_P6;
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!