diff --git a/HighWayIot.Plc/EndianConvert.cs b/HighWayIot.Plc/EndianConvert.cs
new file mode 100644
index 0000000..82ce8b1
--- /dev/null
+++ b/HighWayIot.Plc/EndianConvert.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HighWayIot.Plc
+{
+ ///
+ /// byte和ushort转换
+ ///
+ public static class EndianConvert
+ {
+ ///
+ /// 将 ushort 转换为 byte[](默认小端序)
+ ///
+ /// 要转换的 ushort 值
+ /// 是否使用大端序(默认false)
+ public static byte[] ToBytes(this ushort value, bool isBigEndian = false)
+ {
+ byte[] bytes = BitConverter.GetBytes(value);
+
+ // 系统是小端序且需要大端序时,反转字节数组
+ if (BitConverter.IsLittleEndian && isBigEndian)
+ {
+ Array.Reverse(bytes);
+ }
+ // 系统是大端序且需要小端序时,反转字节数组
+ else if (!BitConverter.IsLittleEndian && !isBigEndian)
+ {
+ Array.Reverse(bytes);
+ }
+
+ return bytes;
+ }
+
+ ///
+ /// 将 byte[] 转换为 ushort(默认小端序)
+ ///
+ /// 要转换的字节数组(长度必须 >= 2)
+ /// 是否使用大端序(默认false)
+ /// 输入数组长度不足
+ public static ushort FromBytes(this byte[] bytes, bool isBigEndian = false)
+ {
+ if (bytes.Length < 2)
+ {
+ throw new ArgumentException("字节数组长度必须至少为2", nameof(bytes));
+ }
+
+ // 复制前两个字节以避免修改原始数组
+ byte[] tempBytes = new byte[2];
+ Array.Copy(bytes, tempBytes, 2);
+
+ // 根据系统字节序和目标字节序决定是否反转
+ bool systemIsBigEndian = !BitConverter.IsLittleEndian;
+ if (isBigEndian != systemIsBigEndian)
+ {
+ Array.Reverse(tempBytes);
+ }
+
+ return BitConverter.ToUInt16(tempBytes, 0);
+ }
+
+ ///
+ /// 安全版本:从指定偏移量开始转换(不抛异常)
+ ///
+ public static bool TryFromBytes(this byte[] bytes, out ushort result, int startIndex = 0, bool isBigEndian = false)
+ {
+ result = 0;
+ if (bytes == null || bytes.Length < startIndex + 2)
+ {
+ return false;
+ }
+
+ byte[] tempBytes = new byte[2];
+ Array.Copy(bytes, startIndex, tempBytes, 0, 2);
+
+ bool systemIsBigEndian = !BitConverter.IsLittleEndian;
+ if (isBigEndian != systemIsBigEndian)
+ {
+ Array.Reverse(tempBytes);
+ }
+
+ result = BitConverter.ToUInt16(tempBytes, 0);
+ return true;
+ }
+ }
+}
diff --git a/HighWayIot.Plc/HighWayIot.Plc.csproj b/HighWayIot.Plc/HighWayIot.Plc.csproj
index 9354a9f..2da7e8b 100644
--- a/HighWayIot.Plc/HighWayIot.Plc.csproj
+++ b/HighWayIot.Plc/HighWayIot.Plc.csproj
@@ -47,9 +47,11 @@
+
+
@@ -63,6 +65,10 @@
{deabc30c-ec6f-472e-bd67-d65702fdaf74}
HighWayIot.Log4net
+
+ {D0DC3CFB-6748-4D5E-B56A-76FDC72AB4B3}
+ HighWayIot.Repository
+
diff --git a/HighWayIot.Plc/PlcConnect.cs b/HighWayIot.Plc/PlcConnect.cs
index 11bd839..db79169 100644
--- a/HighWayIot.Plc/PlcConnect.cs
+++ b/HighWayIot.Plc/PlcConnect.cs
@@ -52,7 +52,7 @@ namespace HighWayIot.Plc
IsPersistentConnection = true,
};
var reslt = plc.ConnectServer();
- logHelper.Info($"Plc连接 信息:[{reslt.Message}] 是否成功:[{reslt.IsSuccess.ToString()}] 错误代码:[{reslt.ErrorCode}]");
+ logHelper.Info($"Plc连接 信息:[{reslt.Message}] 是否成功:[{(reslt.IsSuccess ? "成功" : "失败")}] 错误代码:[{reslt.ErrorCode}]");
if (!reslt.IsSuccess)
{
logHelper.Info("链接失败:"+reslt.Message);
@@ -74,9 +74,9 @@ namespace HighWayIot.Plc
get
{
if (MelsecInstance1 == null) return false;
- var result = MelsecInstance1.IpAddress;
- logHelper.Info($"PLCIP:[{result}]");
- return !string.IsNullOrEmpty(result);
+ var result = MelsecInstance1.IpAddressPing();
+ logHelper.Info($"PLC[{MelsecInstance1.IpAddress}]连接:[{(result == System.Net.NetworkInformation.IPStatus.Success ? "正常" : "异常")}]");
+ return result == System.Net.NetworkInformation.IPStatus.Success;
}
}
@@ -88,9 +88,9 @@ namespace HighWayIot.Plc
get
{
if (MelsecInstance2 == null) return false;
- var result = MelsecInstance2.IpAddress;
- logHelper.Info($"PLCIP:[{result}]");
- return !string.IsNullOrEmpty(result);
+ var result = MelsecInstance2.IpAddressPing();
+ logHelper.Info($"PLC[{MelsecInstance2.IpAddress}]连接:[{(result == System.Net.NetworkInformation.IPStatus.Success ? "正常" : "异常")}]");
+ return result == System.Net.NetworkInformation.IPStatus.Success;
}
}
@@ -104,6 +104,10 @@ namespace HighWayIot.Plc
public static OperateResult PlcWrite1(string address, object value, DataTypeEnum type)
{
var result = new OperateResult() { IsSuccess = false };
+ if(value == null)
+ {
+ return result;
+ }
try
{
switch (type)
@@ -138,6 +142,9 @@ namespace HighWayIot.Plc
case DataTypeEnum.Double:
result = MelsecInstance1.Write(address, Convert.ToDouble(value));
break;
+ case DataTypeEnum.String:
+ result = MelsecInstance1.Write(address, Convert.ToString(value));
+ break;
default:
throw new ArgumentException($"Unsupported data type: {type}");
}
@@ -165,9 +172,9 @@ namespace HighWayIot.Plc
{
switch (type)
{
- case DataTypeEnum.Bool:
- result = MelsecInstance2.Write(address, Convert.ToBoolean(value));
- break;
+ //case DataTypeEnum.Bool:
+ // result = MelsecInstance2.Write(address, Convert.ToBoolean(value));
+ // break;
//case DataTypeEnum.Byte:
// result = Instance.Write(address, Convert.ToByte(value));
// break;
@@ -195,6 +202,9 @@ namespace HighWayIot.Plc
case DataTypeEnum.Double:
result = MelsecInstance2.Write(address, Convert.ToDouble(value));
break;
+ case DataTypeEnum.String:
+ result = MelsecInstance2.Write(address, Convert.ToString(value));
+ break;
default:
throw new ArgumentException($"Unsupported data type: {type}");
}
@@ -207,6 +217,56 @@ namespace HighWayIot.Plc
return result;
}
+ ///
+ /// 字符串读取1
+ ///
+ ///
+ ///
+ ///
+ public static string ReadString1(string address, ushort length)
+ {
+ OperateResult result = new OperateResult();
+ try
+ {
+ result = MelsecInstance1.ReadString(address, length);
+ }
+ catch (Exception ex)
+ {
+ logHelper.Error($"PLC1读取String发生错误!address:[{address}]", ex);
+ return default;
+ }
+ if (!result.IsSuccess)
+ {
+ return default;
+ }
+ return result.Content;
+ }
+
+ ///
+ /// 字符串读取2
+ ///
+ ///
+ ///
+ ///
+ public static string ReadString2(string address, ushort length)
+ {
+ OperateResult result = new OperateResult();
+ try
+ {
+ result = MelsecInstance2.ReadString(address, length);
+ }
+ catch (Exception ex)
+ {
+ logHelper.Error($"PLC2读取String发生错误!address:[{address}]", ex);
+ return default;
+ }
+ if (!result.IsSuccess)
+ {
+ return default;
+ }
+ return result.Content;
+ }
+
///
/// 读取bool
///
@@ -623,6 +683,7 @@ namespace HighWayIot.Plc
public static double ReadDouble2(string address)
{
OperateResult result = new OperateResult();
+
try
{
result = MelsecInstance2.ReadDouble(address);
diff --git a/HighWayIot.Plc/PlcHelper/RecipeParaHelper.cs b/HighWayIot.Plc/PlcHelper/RecipeParaHelper.cs
new file mode 100644
index 0000000..0e0a752
--- /dev/null
+++ b/HighWayIot.Plc/PlcHelper/RecipeParaHelper.cs
@@ -0,0 +1,268 @@
+using HighWayIot.Repository.domain;
+using HslCommunication;
+using HslCommunication.Profinet.Panasonic.Helper;
+using Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HighWayIot.Plc.PlcHelper
+{
+ public class RecipeParaHelper
+ {
+ ///
+ /// 数据下传到PLC
+ ///
+ ///
+ ///
+ ///
+ public bool UploadToPLC(ZxRecipeParaEntity paraEntity, List positionParaEntity)
+ {
+ //SPEC编号写入
+ try
+ {
+ if (!PlcConnect.PlcWrite1("D206", uint.Parse(paraEntity.SpecCode), DataTypeEnum.UInt32).IsSuccess)
+ return false;
+ }
+ catch
+ {
+ return false;
+ }
+
+ //SPEC名称写入
+ if (!PlcConnect.PlcWrite1("D290", paraEntity.SpecName, DataTypeEnum.String).IsSuccess)
+ return false;
+
+ //工位参数写入
+ foreach (ZxRecipePositionParaEntity e in positionParaEntity)
+ {
+ if (!SelectSetPositionPara(e))
+ return false;
+ }
+
+ //公共参数写入
+ byte[] bitDatas = new byte[2];
+ bitDatas[0] = bitDatas[0].SetBoolByIndex(0, paraEntity.S0 ?? false);
+ bitDatas[0] = bitDatas[0].SetBoolByIndex(1, paraEntity.S1 ?? false);
+ bitDatas[0] = bitDatas[0].SetBoolByIndex(2, paraEntity.S2 ?? false);
+ bitDatas[0] = bitDatas[0].SetBoolByIndex(3, paraEntity.S3 ?? false);
+ bitDatas[0] = bitDatas[0].SetBoolByIndex(4, paraEntity.S4 ?? false);
+ bitDatas[0] = bitDatas[0].SetBoolByIndex(5, paraEntity.S5 ?? false);
+ bitDatas[0] = bitDatas[0].SetBoolByIndex(6, paraEntity.S6 ?? false);
+ bitDatas[0] = bitDatas[0].SetBoolByIndex(7, paraEntity.S7 ?? false);
+ bitDatas[1] = bitDatas[1].SetBoolByIndex(0, paraEntity.S8 ?? false);
+ bitDatas[1] = bitDatas[1].SetBoolByIndex(1, paraEntity.S9 ?? false);
+ ushort bitData = bitDatas.FromBytes();
+
+ if(!PlcConnect.PlcWrite1("D390", bitData, DataTypeEnum.UInt16).IsSuccess) return false;
+
+ if (!PlcConnect.PlcWrite1("D391", paraEntity.RimInch ?? 0, DataTypeEnum.UInt16).IsSuccess)
+ return false;
+ if (!PlcConnect.PlcWrite1("D392", paraEntity.LightWidth ?? 0, DataTypeEnum.UInt16).IsSuccess)
+ return false;
+ if (!PlcConnect.PlcWrite1("D393", paraEntity.SlowDistance ?? 0, DataTypeEnum.UInt16).IsSuccess)
+ return false;
+ if (!PlcConnect.PlcWrite1("D394", paraEntity.StopDistance ?? 0, DataTypeEnum.UInt16).IsSuccess)
+ return false;
+ if (!PlcConnect.PlcWrite1("D398", paraEntity.TireWeight ?? 0, DataTypeEnum.Float).IsSuccess)
+ return false;
+
+ return true;
+ }
+
+ ///
+ /// 分类工位确定点位写入
+ ///
+ ///
+ ///
+ private bool SelectSetPositionPara(ZxRecipePositionParaEntity entity)
+ {
+ if (entity.Position == 1)
+ {
+ if (!SetPositionPara(entity, 310))
+ return false;
+ }
+ else if (entity.Position == 2)
+ {
+ if (!SetPositionPara(entity, 320))
+ return false;
+ }
+ else if (entity.Position == 31)
+ {
+ if (!SetPositionPara(entity, 330))
+ return false;
+ }
+ else if (entity.Position == 32)
+ {
+ if (!SetPositionPara(entity, 340))
+ return false;
+ }
+ else if (entity.Position == 41)
+ {
+ if (!SetPositionPara(entity, 350))
+ return false;
+ }
+ else if (entity.Position == 42)
+ {
+ if (!SetPositionPara(entity, 360))
+ return false;
+ }
+ else if (entity.Position == 51)
+ {
+ if (!SetPositionPara(entity, 370))
+ return false;
+ }
+ else if (entity.Position == 52)
+ {
+ if (!SetPositionPara(entity, 380))
+ return false;
+ }
+ else
+ {
+ return false;
+ }
+ return true;
+ }
+
+ ///
+ /// 工位参数写入PLC
+ ///
+ ///
+ ///
+ ///
+ private bool SetPositionPara(ZxRecipePositionParaEntity entity, int add)
+ {
+ for (int i = 1; i <= 10; i++)
+ {
+ var prop = entity.GetType().GetProperty($"E{i}");
+ // 检查属性是否存在
+ if (prop == null)
+ return false;
+
+ // 获取属性值
+ object value = prop.GetValue(entity);
+
+ // 处理可空类型的null值情况
+ if (value == null)
+ {
+ // 根据业务需求选择:返回false或使用默认值(例如0)
+ if (!PlcConnect.PlcWrite1($"D{add}", 0, DataTypeEnum.UInt16).IsSuccess)
+ return false;
+ }
+
+ // 尝试转换值
+ ushort valueToWrite;
+ try
+ {
+ valueToWrite = Convert.ToUInt16(value);
+ }
+ catch
+ {
+ // 转换失败(如类型不匹配)
+ return false;
+ }
+
+ // 写入PLC并检查结果
+ if (!PlcConnect.PlcWrite1($"D{add}", valueToWrite, DataTypeEnum.UInt16).IsSuccess)
+ return false;
+
+ add++;
+ }
+ return true;
+ }
+
+ ///
+ /// 从PLC中读取数据
+ ///
+ public List DownLoadFormPlc(ref ZxRecipeParaEntity paraEntity)
+ {
+
+ //读取SPEC编号
+ paraEntity.SpecCode = PlcConnect.ReadUInt321("D206").ToString();
+
+ //读取SPEC名称
+ paraEntity.SpecName = PlcConnect.ReadString1("D290", 10).Trim();
+
+ //读取工位参数
+ List positionEntitys = SelectReadPositionPara();
+
+ //公共参数读取
+ ushort bitData = PlcConnect.ReadUInt161($"D390");
+ byte[] bitDatas = bitData.ToBytes();
+ paraEntity.S0 = bitDatas[0].GetBoolByIndex(0);
+ paraEntity.S1 = bitDatas[0].GetBoolByIndex(1);
+ paraEntity.S2 = bitDatas[0].GetBoolByIndex(2);
+ paraEntity.S3 = bitDatas[0].GetBoolByIndex(3);
+ paraEntity.S4 = bitDatas[0].GetBoolByIndex(4);
+ paraEntity.S5 = bitDatas[0].GetBoolByIndex(5);
+ paraEntity.S6 = bitDatas[0].GetBoolByIndex(6);
+ paraEntity.S7 = bitDatas[0].GetBoolByIndex(7);
+ paraEntity.S8 = bitDatas[1].GetBoolByIndex(0);
+ paraEntity.S9 = bitDatas[1].GetBoolByIndex(1);
+
+ paraEntity.RimInch = PlcConnect.ReadInt161("D391");
+ paraEntity.LightWidth = PlcConnect.ReadInt161("D392");
+ paraEntity.SlowDistance = PlcConnect.ReadInt161("D393");
+ paraEntity.StopDistance = PlcConnect.ReadInt161("D394");
+ paraEntity.TireWeight = PlcConnect.ReadFloat1("D398");
+
+ return positionEntitys;
+ }
+
+ ///
+ /// 分类工位循环写入
+ ///
+ ///
+ ///
+ private List SelectReadPositionPara()
+ {
+ List e = new List
+ {
+ ReadPositionPara(310),
+ ReadPositionPara(320),
+ ReadPositionPara(330),
+ ReadPositionPara(340),
+ ReadPositionPara(350),
+ ReadPositionPara(360),
+ ReadPositionPara(370),
+ ReadPositionPara(380)
+ };
+
+
+
+ return e;
+ }
+
+ ///
+ /// 工位参数读取PLC
+ ///
+ ///
+ ///
+ ///
+ private ZxRecipePositionParaEntity ReadPositionPara(int add)
+ {
+ ZxRecipePositionParaEntity entity = new ZxRecipePositionParaEntity();
+
+ if (add == 310) entity.Position = 1;
+ if (add == 320) entity.Position = 2;
+ if (add == 330) entity.Position = 31;
+ if (add == 340) entity.Position = 32;
+ if (add == 350) entity.Position = 41;
+ if (add == 360) entity.Position = 42;
+ if (add == 370) entity.Position = 51;
+ if (add == 380) entity.Position = 52;
+
+ for (int i = 1; i <= 10; i++)
+ {
+ var prop = entity.GetType().GetProperty($"E{i}");
+ prop.SetValue(entity, (int)PlcConnect.ReadUInt161($"D{add}"));
+ add++;
+ }
+
+ return entity;
+ }
+ }
+}
diff --git a/HighWayIot.Repository/domain/ZxRecipeParaEntity.cs b/HighWayIot.Repository/domain/ZxRecipeParaEntity.cs
index c7d0f41..56ee2fa 100644
--- a/HighWayIot.Repository/domain/ZxRecipeParaEntity.cs
+++ b/HighWayIot.Repository/domain/ZxRecipeParaEntity.cs
@@ -58,7 +58,7 @@ namespace Models
/// 默认值:
///
[SugarColumn(ColumnName = "tire_weight")]
- public int? TireWeight { get; set; }
+ public float? TireWeight { get; set; }
///
/// 备 注:规格名
@@ -72,7 +72,7 @@ namespace Models
/// 默认值:
///
[SugarColumn(ColumnName = "spec_code")]
- public int? SpecCode { get; set; }
+ public string SpecCode { get; set; } = string.Empty;
///
/// 备 注:
diff --git a/HighWayIot.Repository/service/ZxRecipeParaService.cs b/HighWayIot.Repository/service/ZxRecipeParaService.cs
index 18579e8..ed19cc4 100644
--- a/HighWayIot.Repository/service/ZxRecipeParaService.cs
+++ b/HighWayIot.Repository/service/ZxRecipeParaService.cs
@@ -43,24 +43,6 @@ namespace HighWayIot.Repository.service
}
}
- ///
- /// 查询配方字段信息
- ///
- ///
- public List GetRecipeParaInfoByRecipeCode()
- {
- try
- {
- List entity = _repository.GetList();
- return entity;
- }
- catch (Exception ex)
- {
- log.Error("配方信息获取异常", ex);
- return null;
- }
- }
-
///
/// 根据配方号查询配方字段信息
///
@@ -91,7 +73,7 @@ namespace HighWayIot.Repository.service
{
return _repository.Update(entity);
}
- catch(Exception ex)
+ catch (Exception ex)
{
log.Error("配方字段信息修改异常", ex);
return false;
@@ -133,5 +115,53 @@ namespace HighWayIot.Repository.service
return false;
}
}
+
+ ///
+ /// 清除脏数据
+ ///
+ ///
+ public bool DeleteDirtyData()
+ {
+ try
+ {
+ var entities = _repository.GetList();
+
+ entities = _repository.GetList().Where(x => x.RecipeCode == null || x.RecipeCode == string.Empty).ToList();
+
+ foreach (var entity in entities)
+ {
+ if (!DeleteRecipeParaInfoById(entity.Id))
+ {
+ return false;
+ }
+ }
+
+ entities = _repository.GetList();
+
+ foreach (var e in entities.GroupBy(x => x.RecipeCode).ToList())
+ {
+ var l = e.ToList();
+ if (l.Count > 1)
+ {
+ l.Remove(l.Where(x => x.Id == l.Min(y => y.Id)).FirstOrDefault());
+ foreach (var entity in l)
+ {
+ if (!DeleteRecipeParaInfoById(entity.Id))
+ {
+ return false;
+ }
+ }
+ }
+ }
+
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ log.Error("工位配方字段信息删除异常", ex);
+ return false;
+ }
+ }
}
}
diff --git a/HighWayIot.Repository/service/ZxRecipePositionParaService.cs b/HighWayIot.Repository/service/ZxRecipePositionParaService.cs
index d4a23ca..c82788d 100644
--- a/HighWayIot.Repository/service/ZxRecipePositionParaService.cs
+++ b/HighWayIot.Repository/service/ZxRecipePositionParaService.cs
@@ -134,5 +134,57 @@ namespace HighWayIot.Repository.service
return false;
}
}
+
+ ///
+ /// 清除脏数据
+ ///
+ ///
+ public bool DeleteDirtyData()
+ {
+ try
+ {
+ var entities = _repository.GetList();
+
+ entities = _repository.GetList().Where(x => x.Position == null || (x.RecipeCode == null || x.RecipeCode == string.Empty)).ToList();
+
+ foreach (var entity in entities)
+ {
+ if (!DeleteRecipePositionParaInfoById(entity.Id))
+ {
+ return false;
+ }
+ }
+
+ entities = _repository.GetList();
+
+ foreach(var e in entities.GroupBy(x => x.RecipeCode).ToList())
+ {
+ foreach(var en in e.GroupBy(x => x.Position).ToList())
+ {
+ var l = en.ToList();
+ if(l.Count > 1)
+ {
+ l.Remove(l.Where(x => x.Id == l.Min(y => y.Id)).FirstOrDefault());
+ foreach (var entity in l)
+ {
+ if (!DeleteRecipePositionParaInfoById(entity.Id))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ }
+
+
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ log.Error("工位配方字段信息删除异常", ex);
+ return false;
+ }
+ }
}
}
diff --git a/HighWayIot.Rfid/HighWayIot.Rfid.csproj b/HighWayIot.Rfid/HighWayIot.Rfid.csproj
index 4d481a3..558330b 100644
--- a/HighWayIot.Rfid/HighWayIot.Rfid.csproj
+++ b/HighWayIot.Rfid/HighWayIot.Rfid.csproj
@@ -61,6 +61,10 @@
{deabc30c-ec6f-472e-bd67-d65702fdaf74}
HighWayIot.Log4net
+
+ {D0DC3CFB-6748-4D5E-B56A-76FDC72AB4B3}
+ HighWayIot.Repository
+
\ No newline at end of file
diff --git a/HighWayIot.TouchSocket/TouchSocketTcpClient.cs b/HighWayIot.TouchSocket/TouchSocketTcpClient.cs
index 84ffc31..4fd5865 100644
--- a/HighWayIot.TouchSocket/TouchSocketTcpClient.cs
+++ b/HighWayIot.TouchSocket/TouchSocketTcpClient.cs
@@ -34,7 +34,7 @@ namespace HighWayIot.TouchSocket
public async Task CreateTcpClient(string ip, string port)
{
TcpClient tcpClient = new TcpClient();
-
+
tcpClient.Connecting = (client, e) =>
{
return EasyTask.CompletedTask;
@@ -75,8 +75,12 @@ namespace HighWayIot.TouchSocket
Result result = Result.Default; //不断尝试重连
do
{
- _logHelper.Info($"连接{ip}:{port}");
- result = await tcpClient.TryConnectAsync();
+ await Task.Run(async () =>
+ {
+ _logHelper.Info($"连接{ip}:{port}");
+ result = await tcpClient.TryConnectAsync();
+ await Task.Delay(2000);
+ });
}
while (!result.IsSuccess);
_logHelper.Info($"{ip}:{port}连接成功");
diff --git a/HighWayIot.Winform/Business/GeneralUtils.cs b/HighWayIot.Winform/Business/GeneralUtils.cs
index ff219da..947af99 100644
--- a/HighWayIot.Winform/Business/GeneralUtils.cs
+++ b/HighWayIot.Winform/Business/GeneralUtils.cs
@@ -116,5 +116,7 @@ namespace HighWayIot.Winform.Business
DescriptionAttribute descriptionAttribute = (DescriptionAttribute)objs[0];
return descriptionAttribute.Description;
}
+
+
}
}
diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.Designer.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.Designer.cs
index 4cf301b..a4cee56 100644
--- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.Designer.cs
+++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.Designer.cs
@@ -66,42 +66,21 @@ namespace HighWayIot.Winform.UserControlPages
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox7 = new System.Windows.Forms.GroupBox();
+ this.CopyAllButton = new System.Windows.Forms.Button();
+ this.PasteAllButton = new System.Windows.Forms.Button();
+ this.ClearDirtyData = new System.Windows.Forms.Button();
this.PastePositionButton = new System.Windows.Forms.Button();
this.CopyPositionButton = new System.Windows.Forms.Button();
- this.label16 = new System.Windows.Forms.Label();
+ this.PositionCopyBoardLabel = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
this.NowCopyLabel = new System.Windows.Forms.Label();
this.label23 = new System.Windows.Forms.Label();
this.PasteParaButton = new System.Windows.Forms.Button();
this.CopyParaButton = new System.Windows.Forms.Button();
this.SaveParaButton = new System.Windows.Forms.Button();
+ this.DownloadFromPlc = new System.Windows.Forms.Button();
+ this.UpLoadToPlc = new System.Windows.Forms.Button();
this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.S2Check = new System.Windows.Forms.CheckBox();
- this.S8Check = new System.Windows.Forms.CheckBox();
- this.S5Check = new System.Windows.Forms.CheckBox();
- this.S1Check = new System.Windows.Forms.CheckBox();
- this.S7Check = new System.Windows.Forms.CheckBox();
- this.S4Check = new System.Windows.Forms.CheckBox();
- this.S0Check = new System.Windows.Forms.CheckBox();
- this.S6Check = new System.Windows.Forms.CheckBox();
- this.S3Check = new System.Windows.Forms.CheckBox();
- this.button2 = new System.Windows.Forms.Button();
- this.button1 = new System.Windows.Forms.Button();
- this.SpecNameLabel = new System.Windows.Forms.Label();
- this.SpecNoLabel = new System.Windows.Forms.Label();
- this.label19 = new System.Windows.Forms.Label();
- this.label18 = new System.Windows.Forms.Label();
- this.label11 = new System.Windows.Forms.Label();
- this.TireWeightTextBox = new System.Windows.Forms.TextBox();
- this.label12 = new System.Windows.Forms.Label();
- this.StopDistanceTextBox = new System.Windows.Forms.TextBox();
- this.label13 = new System.Windows.Forms.Label();
- this.SlowDistanceTextBox = new System.Windows.Forms.TextBox();
- this.label14 = new System.Windows.Forms.Label();
- this.LightWidthTextBox = new System.Windows.Forms.TextBox();
- this.label15 = new System.Windows.Forms.Label();
- this.RimInchTextBox = new System.Windows.Forms.TextBox();
- this.S9Check = new System.Windows.Forms.CheckBox();
this.label6 = new System.Windows.Forms.Label();
this.E10TextBox = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
@@ -131,6 +110,38 @@ namespace HighWayIot.Winform.UserControlPages
this.Position3RadioButton = new System.Windows.Forms.RadioButton();
this.Position2RadioButton = new System.Windows.Forms.RadioButton();
this.Position1RadioButton = new System.Windows.Forms.RadioButton();
+ this.groupbox5 = new System.Windows.Forms.GroupBox();
+ this.label30 = new System.Windows.Forms.Label();
+ this.label31 = new System.Windows.Forms.Label();
+ this.label29 = new System.Windows.Forms.Label();
+ this.label28 = new System.Windows.Forms.Label();
+ this.label22 = new System.Windows.Forms.Label();
+ this.label21 = new System.Windows.Forms.Label();
+ this.label20 = new System.Windows.Forms.Label();
+ this.S2Check = new System.Windows.Forms.CheckBox();
+ this.label11 = new System.Windows.Forms.Label();
+ this.S8Check = new System.Windows.Forms.CheckBox();
+ this.S9Check = new System.Windows.Forms.CheckBox();
+ this.S5Check = new System.Windows.Forms.CheckBox();
+ this.RimInchTextBox = new System.Windows.Forms.TextBox();
+ this.S1Check = new System.Windows.Forms.CheckBox();
+ this.label15 = new System.Windows.Forms.Label();
+ this.S7Check = new System.Windows.Forms.CheckBox();
+ this.LightWidthTextBox = new System.Windows.Forms.TextBox();
+ this.S4Check = new System.Windows.Forms.CheckBox();
+ this.label14 = new System.Windows.Forms.Label();
+ this.S0Check = new System.Windows.Forms.CheckBox();
+ this.SlowDistanceTextBox = new System.Windows.Forms.TextBox();
+ this.S6Check = new System.Windows.Forms.CheckBox();
+ this.label13 = new System.Windows.Forms.Label();
+ this.S3Check = new System.Windows.Forms.CheckBox();
+ this.StopDistanceTextBox = new System.Windows.Forms.TextBox();
+ this.label12 = new System.Windows.Forms.Label();
+ this.TireWeightTextBox = new System.Windows.Forms.TextBox();
+ this.SpecNameLabel = new System.Windows.Forms.Label();
+ this.label18 = new System.Windows.Forms.Label();
+ this.SpecNoLabel = new System.Windows.Forms.Label();
+ this.label19 = new System.Windows.Forms.Label();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.panel1 = new System.Windows.Forms.Panel();
this.label27 = new System.Windows.Forms.Label();
@@ -139,14 +150,10 @@ namespace HighWayIot.Winform.UserControlPages
this.UpdateWeightButton = new System.Windows.Forms.Button();
this.AddWeightButton = new System.Windows.Forms.Button();
this.DeleteWeightButton = new System.Windows.Forms.Button();
- this.groupbox5 = new System.Windows.Forms.GroupBox();
- this.label20 = new System.Windows.Forms.Label();
- this.label21 = new System.Windows.Forms.Label();
- this.label22 = new System.Windows.Forms.Label();
- this.label28 = new System.Windows.Forms.Label();
- this.label29 = new System.Windows.Forms.Label();
- this.label30 = new System.Windows.Forms.Label();
- this.label31 = new System.Windows.Forms.Label();
+ this.PlcSpecNoLabel = new System.Windows.Forms.Label();
+ this.label32 = new System.Windows.Forms.Label();
+ this.PlcSpecNameLabel = new System.Windows.Forms.Label();
+ this.label34 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.WeightDataGridView)).BeginInit();
this.ButtonPanel.SuspendLayout();
this.groupBox1.SuspendLayout();
@@ -159,9 +166,9 @@ namespace HighWayIot.Winform.UserControlPages
this.groupBox4.SuspendLayout();
this.SideRadioButtonPanel.SuspendLayout();
this.PositionRadioButtonPanel.SuspendLayout();
+ this.groupbox5.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.panel1.SuspendLayout();
- this.groupbox5.SuspendLayout();
this.SuspendLayout();
//
// WeightDataGridView
@@ -524,17 +531,20 @@ namespace HighWayIot.Winform.UserControlPages
//
// groupBox7
//
+ this.groupBox7.Controls.Add(this.CopyAllButton);
+ this.groupBox7.Controls.Add(this.PasteAllButton);
+ this.groupBox7.Controls.Add(this.ClearDirtyData);
this.groupBox7.Controls.Add(this.PastePositionButton);
this.groupBox7.Controls.Add(this.CopyPositionButton);
- this.groupBox7.Controls.Add(this.label16);
+ this.groupBox7.Controls.Add(this.PositionCopyBoardLabel);
this.groupBox7.Controls.Add(this.label17);
this.groupBox7.Controls.Add(this.NowCopyLabel);
this.groupBox7.Controls.Add(this.label23);
this.groupBox7.Controls.Add(this.PasteParaButton);
this.groupBox7.Controls.Add(this.CopyParaButton);
this.groupBox7.Controls.Add(this.SaveParaButton);
- this.groupBox7.Controls.Add(this.button1);
- this.groupBox7.Controls.Add(this.button2);
+ this.groupBox7.Controls.Add(this.DownloadFromPlc);
+ this.groupBox7.Controls.Add(this.UpLoadToPlc);
this.groupBox7.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox7.Location = new System.Drawing.Point(0, 0);
this.groupBox7.Margin = new System.Windows.Forms.Padding(0);
@@ -544,39 +554,74 @@ namespace HighWayIot.Winform.UserControlPages
this.groupBox7.TabStop = false;
this.groupBox7.Text = "参数操作";
//
+ // CopyAllButton
+ //
+ this.CopyAllButton.Font = new System.Drawing.Font("宋体", 9F);
+ this.CopyAllButton.Location = new System.Drawing.Point(226, 22);
+ this.CopyAllButton.Name = "CopyAllButton";
+ this.CopyAllButton.Size = new System.Drawing.Size(80, 39);
+ this.CopyAllButton.TabIndex = 49;
+ this.CopyAllButton.Text = "整体复制";
+ this.CopyAllButton.UseVisualStyleBackColor = true;
+ this.CopyAllButton.Click += new System.EventHandler(this.CopyAllButton_Click);
+ //
+ // PasteAllButton
+ //
+ this.PasteAllButton.Font = new System.Drawing.Font("宋体", 9F);
+ this.PasteAllButton.Location = new System.Drawing.Point(226, 70);
+ this.PasteAllButton.Name = "PasteAllButton";
+ this.PasteAllButton.Size = new System.Drawing.Size(80, 39);
+ this.PasteAllButton.TabIndex = 50;
+ this.PasteAllButton.Text = "整体粘贴";
+ this.PasteAllButton.UseVisualStyleBackColor = true;
+ this.PasteAllButton.Click += new System.EventHandler(this.PasteAllButton_Click);
+ //
+ // ClearDirtyData
+ //
+ this.ClearDirtyData.Font = new System.Drawing.Font("宋体", 9F);
+ this.ClearDirtyData.Location = new System.Drawing.Point(226, 117);
+ this.ClearDirtyData.Name = "ClearDirtyData";
+ this.ClearDirtyData.Size = new System.Drawing.Size(80, 39);
+ this.ClearDirtyData.TabIndex = 51;
+ this.ClearDirtyData.Text = "清除脏数据";
+ this.ClearDirtyData.UseVisualStyleBackColor = true;
+ this.ClearDirtyData.Click += new System.EventHandler(this.ClearDirtyData_Click);
+ //
// PastePositionButton
//
- this.PastePositionButton.Font = new System.Drawing.Font("宋体", 12F);
- this.PastePositionButton.Location = new System.Drawing.Point(139, 71);
+ this.PastePositionButton.Font = new System.Drawing.Font("宋体", 9F);
+ this.PastePositionButton.Location = new System.Drawing.Point(117, 70);
this.PastePositionButton.Name = "PastePositionButton";
- this.PastePositionButton.Size = new System.Drawing.Size(122, 43);
+ this.PastePositionButton.Size = new System.Drawing.Size(103, 39);
this.PastePositionButton.TabIndex = 9;
- this.PastePositionButton.Text = "粘贴工位参数";
+ this.PastePositionButton.Text = "粘贴贴合参数";
this.PastePositionButton.UseVisualStyleBackColor = true;
+ this.PastePositionButton.Click += new System.EventHandler(this.PastePositionButton_Click);
//
// CopyPositionButton
//
- this.CopyPositionButton.Font = new System.Drawing.Font("宋体", 12F);
- this.CopyPositionButton.Location = new System.Drawing.Point(138, 22);
+ this.CopyPositionButton.Font = new System.Drawing.Font("宋体", 9F);
+ this.CopyPositionButton.Location = new System.Drawing.Point(117, 22);
this.CopyPositionButton.Name = "CopyPositionButton";
- this.CopyPositionButton.Size = new System.Drawing.Size(122, 43);
+ this.CopyPositionButton.Size = new System.Drawing.Size(103, 39);
this.CopyPositionButton.TabIndex = 8;
- this.CopyPositionButton.Text = "复制工位参数";
+ this.CopyPositionButton.Text = "复制贴合参数";
this.CopyPositionButton.UseVisualStyleBackColor = true;
+ this.CopyPositionButton.Click += new System.EventHandler(this.CopyPositionButton_Click);
//
- // label16
+ // PositionCopyBoardLabel
//
- this.label16.AutoSize = true;
- this.label16.Location = new System.Drawing.Point(144, 142);
- this.label16.Name = "label16";
- this.label16.Size = new System.Drawing.Size(23, 12);
- this.label16.TabIndex = 7;
- this.label16.Text = "N/A";
+ this.PositionCopyBoardLabel.AutoSize = true;
+ this.PositionCopyBoardLabel.Location = new System.Drawing.Point(115, 142);
+ this.PositionCopyBoardLabel.Name = "PositionCopyBoardLabel";
+ this.PositionCopyBoardLabel.Size = new System.Drawing.Size(23, 12);
+ this.PositionCopyBoardLabel.TabIndex = 7;
+ this.PositionCopyBoardLabel.Text = "N/A";
//
// label17
//
this.label17.AutoSize = true;
- this.label17.Location = new System.Drawing.Point(144, 118);
+ this.label17.Location = new System.Drawing.Point(115, 118);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(77, 12);
this.label17.TabIndex = 6;
@@ -585,7 +630,7 @@ namespace HighWayIot.Winform.UserControlPages
// NowCopyLabel
//
this.NowCopyLabel.AutoSize = true;
- this.NowCopyLabel.Location = new System.Drawing.Point(13, 142);
+ this.NowCopyLabel.Location = new System.Drawing.Point(6, 141);
this.NowCopyLabel.Name = "NowCopyLabel";
this.NowCopyLabel.Size = new System.Drawing.Size(23, 12);
this.NowCopyLabel.TabIndex = 5;
@@ -594,7 +639,7 @@ namespace HighWayIot.Winform.UserControlPages
// label23
//
this.label23.AutoSize = true;
- this.label23.Location = new System.Drawing.Point(13, 118);
+ this.label23.Location = new System.Drawing.Point(6, 117);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(77, 12);
this.label23.TabIndex = 4;
@@ -602,37 +647,59 @@ namespace HighWayIot.Winform.UserControlPages
//
// PasteParaButton
//
- this.PasteParaButton.Font = new System.Drawing.Font("宋体", 12F);
+ this.PasteParaButton.Font = new System.Drawing.Font("宋体", 9F);
this.PasteParaButton.Location = new System.Drawing.Point(8, 69);
this.PasteParaButton.Name = "PasteParaButton";
- this.PasteParaButton.Size = new System.Drawing.Size(122, 43);
+ this.PasteParaButton.Size = new System.Drawing.Size(103, 39);
this.PasteParaButton.TabIndex = 2;
- this.PasteParaButton.Text = "粘贴配方参数";
+ this.PasteParaButton.Text = "粘贴公共参数";
this.PasteParaButton.UseVisualStyleBackColor = true;
this.PasteParaButton.Click += new System.EventHandler(this.PasteParaButton_Click);
//
// CopyParaButton
//
- this.CopyParaButton.Font = new System.Drawing.Font("宋体", 12F);
+ this.CopyParaButton.Font = new System.Drawing.Font("宋体", 9F);
this.CopyParaButton.Location = new System.Drawing.Point(8, 22);
this.CopyParaButton.Name = "CopyParaButton";
- this.CopyParaButton.Size = new System.Drawing.Size(122, 43);
+ this.CopyParaButton.Size = new System.Drawing.Size(103, 39);
this.CopyParaButton.TabIndex = 1;
- this.CopyParaButton.Text = "复制配方参数";
+ this.CopyParaButton.Text = "复制公共参数";
this.CopyParaButton.UseVisualStyleBackColor = true;
this.CopyParaButton.Click += new System.EventHandler(this.CopyParaButton_Click);
//
// SaveParaButton
//
- this.SaveParaButton.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.SaveParaButton.Location = new System.Drawing.Point(268, 22);
+ this.SaveParaButton.Font = new System.Drawing.Font("宋体", 9F);
+ this.SaveParaButton.Location = new System.Drawing.Point(312, 22);
this.SaveParaButton.Name = "SaveParaButton";
- this.SaveParaButton.Size = new System.Drawing.Size(122, 43);
+ this.SaveParaButton.Size = new System.Drawing.Size(80, 39);
this.SaveParaButton.TabIndex = 0;
this.SaveParaButton.Text = "保存参数";
this.SaveParaButton.UseVisualStyleBackColor = true;
this.SaveParaButton.Click += new System.EventHandler(this.SaveParaButton_Click);
//
+ // DownloadFromPlc
+ //
+ this.DownloadFromPlc.Font = new System.Drawing.Font("宋体", 9F);
+ this.DownloadFromPlc.Location = new System.Drawing.Point(312, 70);
+ this.DownloadFromPlc.Name = "DownloadFromPlc";
+ this.DownloadFromPlc.Size = new System.Drawing.Size(80, 39);
+ this.DownloadFromPlc.TabIndex = 47;
+ this.DownloadFromPlc.Text = "从PLC读取";
+ this.DownloadFromPlc.UseVisualStyleBackColor = true;
+ this.DownloadFromPlc.Click += new System.EventHandler(this.DownloadFromPlc_Click);
+ //
+ // UpLoadToPlc
+ //
+ this.UpLoadToPlc.Font = new System.Drawing.Font("宋体", 9F);
+ this.UpLoadToPlc.Location = new System.Drawing.Point(312, 117);
+ this.UpLoadToPlc.Name = "UpLoadToPlc";
+ this.UpLoadToPlc.Size = new System.Drawing.Size(80, 39);
+ this.UpLoadToPlc.TabIndex = 48;
+ this.UpLoadToPlc.Text = "下发到PLC";
+ this.UpLoadToPlc.UseVisualStyleBackColor = true;
+ this.UpLoadToPlc.Click += new System.EventHandler(this.UploadToPlc_Click);
+ //
// groupBox4
//
this.groupBox4.Controls.Add(this.label6);
@@ -666,246 +733,6 @@ namespace HighWayIot.Winform.UserControlPages
this.groupBox4.TabStop = false;
this.groupBox4.Text = "贴合参数";
//
- // S2Check
- //
- this.S2Check.AutoSize = true;
- this.S2Check.Location = new System.Drawing.Point(167, 66);
- this.S2Check.Margin = new System.Windows.Forms.Padding(6);
- this.S2Check.Name = "S2Check";
- this.S2Check.Size = new System.Drawing.Size(15, 14);
- this.S2Check.TabIndex = 57;
- this.S2Check.UseVisualStyleBackColor = true;
- //
- // S8Check
- //
- this.S8Check.AutoSize = true;
- this.S8Check.Location = new System.Drawing.Point(167, 118);
- this.S8Check.Margin = new System.Windows.Forms.Padding(6);
- this.S8Check.Name = "S8Check";
- this.S8Check.Size = new System.Drawing.Size(15, 14);
- this.S8Check.TabIndex = 56;
- this.S8Check.UseVisualStyleBackColor = true;
- //
- // S5Check
- //
- this.S5Check.AutoSize = true;
- this.S5Check.Location = new System.Drawing.Point(167, 92);
- this.S5Check.Margin = new System.Windows.Forms.Padding(6);
- this.S5Check.Name = "S5Check";
- this.S5Check.Size = new System.Drawing.Size(15, 14);
- this.S5Check.TabIndex = 55;
- this.S5Check.UseVisualStyleBackColor = true;
- //
- // S1Check
- //
- this.S1Check.AutoSize = true;
- this.S1Check.Location = new System.Drawing.Point(140, 66);
- this.S1Check.Margin = new System.Windows.Forms.Padding(6);
- this.S1Check.Name = "S1Check";
- this.S1Check.Size = new System.Drawing.Size(15, 14);
- this.S1Check.TabIndex = 54;
- this.S1Check.UseVisualStyleBackColor = true;
- //
- // S7Check
- //
- this.S7Check.AutoSize = true;
- this.S7Check.Location = new System.Drawing.Point(140, 118);
- this.S7Check.Margin = new System.Windows.Forms.Padding(6);
- this.S7Check.Name = "S7Check";
- this.S7Check.Size = new System.Drawing.Size(15, 14);
- this.S7Check.TabIndex = 53;
- this.S7Check.UseVisualStyleBackColor = true;
- //
- // S4Check
- //
- this.S4Check.AutoSize = true;
- this.S4Check.Location = new System.Drawing.Point(140, 92);
- this.S4Check.Margin = new System.Windows.Forms.Padding(6);
- this.S4Check.Name = "S4Check";
- this.S4Check.Size = new System.Drawing.Size(15, 14);
- this.S4Check.TabIndex = 52;
- this.S4Check.UseVisualStyleBackColor = true;
- //
- // S0Check
- //
- this.S0Check.AutoSize = true;
- this.S0Check.Location = new System.Drawing.Point(113, 66);
- this.S0Check.Margin = new System.Windows.Forms.Padding(6);
- this.S0Check.Name = "S0Check";
- this.S0Check.Size = new System.Drawing.Size(15, 14);
- this.S0Check.TabIndex = 51;
- this.S0Check.UseVisualStyleBackColor = true;
- //
- // S6Check
- //
- this.S6Check.AutoSize = true;
- this.S6Check.Location = new System.Drawing.Point(113, 118);
- this.S6Check.Margin = new System.Windows.Forms.Padding(6);
- this.S6Check.Name = "S6Check";
- this.S6Check.Size = new System.Drawing.Size(15, 14);
- this.S6Check.TabIndex = 50;
- this.S6Check.UseVisualStyleBackColor = true;
- //
- // S3Check
- //
- this.S3Check.AutoSize = true;
- this.S3Check.Location = new System.Drawing.Point(113, 92);
- this.S3Check.Margin = new System.Windows.Forms.Padding(6);
- this.S3Check.Name = "S3Check";
- this.S3Check.Size = new System.Drawing.Size(15, 14);
- this.S3Check.TabIndex = 49;
- this.S3Check.UseVisualStyleBackColor = true;
- //
- // button2
- //
- this.button2.Font = new System.Drawing.Font("宋体", 12F);
- this.button2.Location = new System.Drawing.Point(268, 120);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(122, 43);
- this.button2.TabIndex = 48;
- this.button2.Text = "下发到PLC";
- this.button2.UseVisualStyleBackColor = true;
- //
- // button1
- //
- this.button1.Font = new System.Drawing.Font("宋体", 12F);
- this.button1.Location = new System.Drawing.Point(268, 71);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(122, 43);
- this.button1.TabIndex = 47;
- this.button1.Text = "从PLC读取";
- this.button1.UseVisualStyleBackColor = true;
- //
- // SpecNameLabel
- //
- this.SpecNameLabel.AutoSize = true;
- this.SpecNameLabel.Font = new System.Drawing.Font("宋体", 13F);
- this.SpecNameLabel.Location = new System.Drawing.Point(400, 125);
- this.SpecNameLabel.Name = "SpecNameLabel";
- this.SpecNameLabel.Size = new System.Drawing.Size(35, 18);
- this.SpecNameLabel.TabIndex = 46;
- this.SpecNameLabel.Text = "N/A";
- //
- // SpecNoLabel
- //
- this.SpecNoLabel.AutoSize = true;
- this.SpecNoLabel.Font = new System.Drawing.Font("宋体", 13F);
- this.SpecNoLabel.Location = new System.Drawing.Point(400, 69);
- this.SpecNoLabel.Name = "SpecNoLabel";
- this.SpecNoLabel.Size = new System.Drawing.Size(35, 18);
- this.SpecNoLabel.TabIndex = 45;
- this.SpecNoLabel.Text = "N/A";
- //
- // label19
- //
- this.label19.AutoSize = true;
- this.label19.Font = new System.Drawing.Font("宋体", 13F);
- this.label19.Location = new System.Drawing.Point(396, 98);
- this.label19.Name = "label19";
- this.label19.Size = new System.Drawing.Size(98, 18);
- this.label19.TabIndex = 44;
- this.label19.Text = "规格名称:";
- //
- // label18
- //
- this.label18.AutoSize = true;
- this.label18.Font = new System.Drawing.Font("宋体", 13F);
- this.label18.Location = new System.Drawing.Point(396, 43);
- this.label18.Name = "label18";
- this.label18.Size = new System.Drawing.Size(80, 18);
- this.label18.TabIndex = 43;
- this.label18.Text = "规格号:";
- //
- // label11
- //
- this.label11.AutoSize = true;
- this.label11.Location = new System.Drawing.Point(215, 139);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(53, 12);
- this.label11.TabIndex = 41;
- this.label11.Text = "胎体重量";
- //
- // TireWeightTextBox
- //
- this.TireWeightTextBox.Location = new System.Drawing.Point(274, 135);
- this.TireWeightTextBox.Name = "TireWeightTextBox";
- this.TireWeightTextBox.Size = new System.Drawing.Size(100, 21);
- this.TireWeightTextBox.TabIndex = 40;
- //
- // label12
- //
- this.label12.AutoSize = true;
- this.label12.Location = new System.Drawing.Point(215, 112);
- this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(53, 12);
- this.label12.TabIndex = 39;
- this.label12.Text = "停止距离";
- //
- // StopDistanceTextBox
- //
- this.StopDistanceTextBox.Location = new System.Drawing.Point(274, 108);
- this.StopDistanceTextBox.Name = "StopDistanceTextBox";
- this.StopDistanceTextBox.Size = new System.Drawing.Size(100, 21);
- this.StopDistanceTextBox.TabIndex = 38;
- //
- // label13
- //
- this.label13.AutoSize = true;
- this.label13.Location = new System.Drawing.Point(215, 86);
- this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(53, 12);
- this.label13.TabIndex = 37;
- this.label13.Text = "减速距离";
- //
- // SlowDistanceTextBox
- //
- this.SlowDistanceTextBox.Location = new System.Drawing.Point(274, 81);
- this.SlowDistanceTextBox.Name = "SlowDistanceTextBox";
- this.SlowDistanceTextBox.Size = new System.Drawing.Size(100, 21);
- this.SlowDistanceTextBox.TabIndex = 36;
- //
- // label14
- //
- this.label14.AutoSize = true;
- this.label14.Location = new System.Drawing.Point(215, 58);
- this.label14.Name = "label14";
- this.label14.Size = new System.Drawing.Size(53, 12);
- this.label14.TabIndex = 35;
- this.label14.Text = "灯标宽度";
- //
- // LightWidthTextBox
- //
- this.LightWidthTextBox.Location = new System.Drawing.Point(274, 54);
- this.LightWidthTextBox.Name = "LightWidthTextBox";
- this.LightWidthTextBox.Size = new System.Drawing.Size(100, 21);
- this.LightWidthTextBox.TabIndex = 34;
- //
- // label15
- //
- this.label15.AutoSize = true;
- this.label15.Location = new System.Drawing.Point(215, 31);
- this.label15.Name = "label15";
- this.label15.Size = new System.Drawing.Size(53, 12);
- this.label15.TabIndex = 33;
- this.label15.Text = "钢圈尺寸";
- //
- // RimInchTextBox
- //
- this.RimInchTextBox.Location = new System.Drawing.Point(274, 27);
- this.RimInchTextBox.Name = "RimInchTextBox";
- this.RimInchTextBox.Size = new System.Drawing.Size(100, 21);
- this.RimInchTextBox.TabIndex = 32;
- //
- // S9Check
- //
- this.S9Check.AutoSize = true;
- this.S9Check.Location = new System.Drawing.Point(86, 92);
- this.S9Check.Margin = new System.Windows.Forms.Padding(6);
- this.S9Check.Name = "S9Check";
- this.S9Check.Size = new System.Drawing.Size(15, 14);
- this.S9Check.TabIndex = 29;
- this.S9Check.UseVisualStyleBackColor = true;
- //
// label6
//
this.label6.AutoSize = true;
@@ -1088,6 +915,7 @@ namespace HighWayIot.Winform.UserControlPages
this.SideRadioButton.Text = "包边";
this.SideRadioButton.UseVisualStyleBackColor = true;
this.SideRadioButton.CheckedChanged += new System.EventHandler(this.PositionRadioBoxChange);
+ this.SideRadioButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionRadioButton_MouseDown);
//
// BodyRadioButton
//
@@ -1103,6 +931,7 @@ namespace HighWayIot.Winform.UserControlPages
this.BodyRadioButton.Text = "胎体";
this.BodyRadioButton.UseVisualStyleBackColor = true;
this.BodyRadioButton.CheckedChanged += new System.EventHandler(this.PositionRadioBoxChange);
+ this.BodyRadioButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionRadioButton_MouseDown);
//
// PositionRadioButtonPanel
//
@@ -1127,6 +956,7 @@ namespace HighWayIot.Winform.UserControlPages
this.Position5RadioButton.Text = "5#工位";
this.Position5RadioButton.UseVisualStyleBackColor = true;
this.Position5RadioButton.CheckedChanged += new System.EventHandler(this.PositionRadioBoxChange);
+ this.Position5RadioButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionRadioButton_MouseDown);
//
// Position4RadioButton
//
@@ -1139,6 +969,7 @@ namespace HighWayIot.Winform.UserControlPages
this.Position4RadioButton.Text = "4#工位";
this.Position4RadioButton.UseVisualStyleBackColor = true;
this.Position4RadioButton.CheckedChanged += new System.EventHandler(this.PositionRadioBoxChange);
+ this.Position4RadioButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionRadioButton_MouseDown);
//
// Position3RadioButton
//
@@ -1151,6 +982,7 @@ namespace HighWayIot.Winform.UserControlPages
this.Position3RadioButton.Text = "3#工位";
this.Position3RadioButton.UseVisualStyleBackColor = true;
this.Position3RadioButton.CheckedChanged += new System.EventHandler(this.PositionRadioBoxChange);
+ this.Position3RadioButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionRadioButton_MouseDown);
//
// Position2RadioButton
//
@@ -1163,6 +995,7 @@ namespace HighWayIot.Winform.UserControlPages
this.Position2RadioButton.Text = "2#工位";
this.Position2RadioButton.UseVisualStyleBackColor = true;
this.Position2RadioButton.CheckedChanged += new System.EventHandler(this.PositionRadioBoxChange);
+ this.Position2RadioButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionRadioButton_MouseDown);
//
// Position1RadioButton
//
@@ -1177,6 +1010,343 @@ namespace HighWayIot.Winform.UserControlPages
this.Position1RadioButton.Text = "1#工位";
this.Position1RadioButton.UseVisualStyleBackColor = true;
this.Position1RadioButton.CheckedChanged += new System.EventHandler(this.PositionRadioBoxChange);
+ this.Position1RadioButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionRadioButton_MouseDown);
+ //
+ // groupbox5
+ //
+ this.groupbox5.Controls.Add(this.PlcSpecNameLabel);
+ this.groupbox5.Controls.Add(this.label34);
+ this.groupbox5.Controls.Add(this.PlcSpecNoLabel);
+ this.groupbox5.Controls.Add(this.label32);
+ this.groupbox5.Controls.Add(this.label30);
+ this.groupbox5.Controls.Add(this.label31);
+ this.groupbox5.Controls.Add(this.label29);
+ this.groupbox5.Controls.Add(this.label28);
+ this.groupbox5.Controls.Add(this.label22);
+ this.groupbox5.Controls.Add(this.label21);
+ this.groupbox5.Controls.Add(this.label20);
+ this.groupbox5.Controls.Add(this.S2Check);
+ this.groupbox5.Controls.Add(this.label11);
+ this.groupbox5.Controls.Add(this.S8Check);
+ this.groupbox5.Controls.Add(this.S9Check);
+ this.groupbox5.Controls.Add(this.S5Check);
+ this.groupbox5.Controls.Add(this.RimInchTextBox);
+ this.groupbox5.Controls.Add(this.S1Check);
+ this.groupbox5.Controls.Add(this.label15);
+ this.groupbox5.Controls.Add(this.S7Check);
+ this.groupbox5.Controls.Add(this.LightWidthTextBox);
+ this.groupbox5.Controls.Add(this.S4Check);
+ this.groupbox5.Controls.Add(this.label14);
+ this.groupbox5.Controls.Add(this.S0Check);
+ this.groupbox5.Controls.Add(this.SlowDistanceTextBox);
+ this.groupbox5.Controls.Add(this.S6Check);
+ this.groupbox5.Controls.Add(this.label13);
+ this.groupbox5.Controls.Add(this.S3Check);
+ this.groupbox5.Controls.Add(this.StopDistanceTextBox);
+ this.groupbox5.Controls.Add(this.label12);
+ this.groupbox5.Controls.Add(this.TireWeightTextBox);
+ this.groupbox5.Controls.Add(this.SpecNameLabel);
+ this.groupbox5.Controls.Add(this.label18);
+ this.groupbox5.Controls.Add(this.SpecNoLabel);
+ this.groupbox5.Controls.Add(this.label19);
+ this.groupbox5.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.groupbox5.Location = new System.Drawing.Point(1058, 0);
+ this.groupbox5.Margin = new System.Windows.Forms.Padding(0);
+ this.groupbox5.Name = "groupbox5";
+ this.groupbox5.Size = new System.Drawing.Size(658, 170);
+ this.groupbox5.TabIndex = 5;
+ this.groupbox5.TabStop = false;
+ this.groupbox5.Text = "公共参数";
+ //
+ // label30
+ //
+ this.label30.AutoSize = true;
+ this.label30.Location = new System.Drawing.Point(165, 42);
+ this.label30.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
+ this.label30.Name = "label30";
+ this.label30.Size = new System.Drawing.Size(17, 12);
+ this.label30.TabIndex = 64;
+ this.label30.Text = "5#";
+ //
+ // label31
+ //
+ this.label31.AutoSize = true;
+ this.label31.Location = new System.Drawing.Point(138, 42);
+ this.label31.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
+ this.label31.Name = "label31";
+ this.label31.Size = new System.Drawing.Size(17, 12);
+ this.label31.TabIndex = 63;
+ this.label31.Text = "4#";
+ //
+ // label29
+ //
+ this.label29.AutoSize = true;
+ this.label29.Location = new System.Drawing.Point(111, 42);
+ this.label29.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
+ this.label29.Name = "label29";
+ this.label29.Size = new System.Drawing.Size(17, 12);
+ this.label29.TabIndex = 62;
+ this.label29.Text = "3#";
+ //
+ // label28
+ //
+ this.label28.AutoSize = true;
+ this.label28.Location = new System.Drawing.Point(84, 42);
+ this.label28.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
+ this.label28.Name = "label28";
+ this.label28.Size = new System.Drawing.Size(17, 12);
+ this.label28.TabIndex = 61;
+ this.label28.Text = "2#";
+ //
+ // label22
+ //
+ this.label22.AutoSize = true;
+ this.label22.Location = new System.Drawing.Point(25, 118);
+ this.label22.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
+ this.label22.Name = "label22";
+ this.label22.Size = new System.Drawing.Size(53, 12);
+ this.label22.TabIndex = 60;
+ this.label22.Text = "称重校准";
+ //
+ // label21
+ //
+ this.label21.AutoSize = true;
+ this.label21.Location = new System.Drawing.Point(25, 92);
+ this.label21.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
+ this.label21.Name = "label21";
+ this.label21.Size = new System.Drawing.Size(53, 12);
+ this.label21.TabIndex = 59;
+ this.label21.Text = "工位使用";
+ //
+ // label20
+ //
+ this.label20.AutoSize = true;
+ this.label20.Location = new System.Drawing.Point(25, 66);
+ this.label20.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
+ this.label20.Name = "label20";
+ this.label20.Size = new System.Drawing.Size(53, 12);
+ this.label20.TabIndex = 58;
+ this.label20.Text = "包边裁切";
+ //
+ // S2Check
+ //
+ this.S2Check.AutoSize = true;
+ this.S2Check.Location = new System.Drawing.Point(167, 66);
+ this.S2Check.Margin = new System.Windows.Forms.Padding(6);
+ this.S2Check.Name = "S2Check";
+ this.S2Check.Size = new System.Drawing.Size(15, 14);
+ this.S2Check.TabIndex = 57;
+ this.S2Check.UseVisualStyleBackColor = true;
+ //
+ // label11
+ //
+ this.label11.AutoSize = true;
+ this.label11.Location = new System.Drawing.Point(215, 139);
+ this.label11.Name = "label11";
+ this.label11.Size = new System.Drawing.Size(53, 12);
+ this.label11.TabIndex = 41;
+ this.label11.Text = "胎体重量";
+ //
+ // S8Check
+ //
+ this.S8Check.AutoSize = true;
+ this.S8Check.Location = new System.Drawing.Point(167, 118);
+ this.S8Check.Margin = new System.Windows.Forms.Padding(6);
+ this.S8Check.Name = "S8Check";
+ this.S8Check.Size = new System.Drawing.Size(15, 14);
+ this.S8Check.TabIndex = 56;
+ this.S8Check.UseVisualStyleBackColor = true;
+ //
+ // S9Check
+ //
+ this.S9Check.AutoSize = true;
+ this.S9Check.Location = new System.Drawing.Point(86, 92);
+ this.S9Check.Margin = new System.Windows.Forms.Padding(6);
+ this.S9Check.Name = "S9Check";
+ this.S9Check.Size = new System.Drawing.Size(15, 14);
+ this.S9Check.TabIndex = 29;
+ this.S9Check.UseVisualStyleBackColor = true;
+ //
+ // S5Check
+ //
+ this.S5Check.AutoSize = true;
+ this.S5Check.Location = new System.Drawing.Point(167, 92);
+ this.S5Check.Margin = new System.Windows.Forms.Padding(6);
+ this.S5Check.Name = "S5Check";
+ this.S5Check.Size = new System.Drawing.Size(15, 14);
+ this.S5Check.TabIndex = 55;
+ this.S5Check.UseVisualStyleBackColor = true;
+ //
+ // RimInchTextBox
+ //
+ this.RimInchTextBox.Location = new System.Drawing.Point(274, 27);
+ this.RimInchTextBox.Name = "RimInchTextBox";
+ this.RimInchTextBox.Size = new System.Drawing.Size(100, 21);
+ this.RimInchTextBox.TabIndex = 32;
+ //
+ // S1Check
+ //
+ this.S1Check.AutoSize = true;
+ this.S1Check.Location = new System.Drawing.Point(140, 66);
+ this.S1Check.Margin = new System.Windows.Forms.Padding(6);
+ this.S1Check.Name = "S1Check";
+ this.S1Check.Size = new System.Drawing.Size(15, 14);
+ this.S1Check.TabIndex = 54;
+ this.S1Check.UseVisualStyleBackColor = true;
+ //
+ // label15
+ //
+ this.label15.AutoSize = true;
+ this.label15.Location = new System.Drawing.Point(215, 31);
+ this.label15.Name = "label15";
+ this.label15.Size = new System.Drawing.Size(53, 12);
+ this.label15.TabIndex = 33;
+ this.label15.Text = "钢圈尺寸";
+ //
+ // S7Check
+ //
+ this.S7Check.AutoSize = true;
+ this.S7Check.Location = new System.Drawing.Point(140, 118);
+ this.S7Check.Margin = new System.Windows.Forms.Padding(6);
+ this.S7Check.Name = "S7Check";
+ this.S7Check.Size = new System.Drawing.Size(15, 14);
+ this.S7Check.TabIndex = 53;
+ this.S7Check.UseVisualStyleBackColor = true;
+ //
+ // LightWidthTextBox
+ //
+ this.LightWidthTextBox.Location = new System.Drawing.Point(274, 54);
+ this.LightWidthTextBox.Name = "LightWidthTextBox";
+ this.LightWidthTextBox.Size = new System.Drawing.Size(100, 21);
+ this.LightWidthTextBox.TabIndex = 34;
+ //
+ // S4Check
+ //
+ this.S4Check.AutoSize = true;
+ this.S4Check.Location = new System.Drawing.Point(140, 92);
+ this.S4Check.Margin = new System.Windows.Forms.Padding(6);
+ this.S4Check.Name = "S4Check";
+ this.S4Check.Size = new System.Drawing.Size(15, 14);
+ this.S4Check.TabIndex = 52;
+ this.S4Check.UseVisualStyleBackColor = true;
+ //
+ // label14
+ //
+ this.label14.AutoSize = true;
+ this.label14.Location = new System.Drawing.Point(215, 58);
+ this.label14.Name = "label14";
+ this.label14.Size = new System.Drawing.Size(53, 12);
+ this.label14.TabIndex = 35;
+ this.label14.Text = "灯标宽度";
+ //
+ // S0Check
+ //
+ this.S0Check.AutoSize = true;
+ this.S0Check.Location = new System.Drawing.Point(113, 66);
+ this.S0Check.Margin = new System.Windows.Forms.Padding(6);
+ this.S0Check.Name = "S0Check";
+ this.S0Check.Size = new System.Drawing.Size(15, 14);
+ this.S0Check.TabIndex = 51;
+ this.S0Check.UseVisualStyleBackColor = true;
+ //
+ // SlowDistanceTextBox
+ //
+ this.SlowDistanceTextBox.Location = new System.Drawing.Point(274, 81);
+ this.SlowDistanceTextBox.Name = "SlowDistanceTextBox";
+ this.SlowDistanceTextBox.Size = new System.Drawing.Size(100, 21);
+ this.SlowDistanceTextBox.TabIndex = 36;
+ //
+ // S6Check
+ //
+ this.S6Check.AutoSize = true;
+ this.S6Check.Location = new System.Drawing.Point(113, 118);
+ this.S6Check.Margin = new System.Windows.Forms.Padding(6);
+ this.S6Check.Name = "S6Check";
+ this.S6Check.Size = new System.Drawing.Size(15, 14);
+ this.S6Check.TabIndex = 50;
+ this.S6Check.UseVisualStyleBackColor = true;
+ //
+ // label13
+ //
+ this.label13.AutoSize = true;
+ this.label13.Location = new System.Drawing.Point(215, 86);
+ this.label13.Name = "label13";
+ this.label13.Size = new System.Drawing.Size(53, 12);
+ this.label13.TabIndex = 37;
+ this.label13.Text = "减速距离";
+ //
+ // S3Check
+ //
+ this.S3Check.AutoSize = true;
+ this.S3Check.Location = new System.Drawing.Point(113, 92);
+ this.S3Check.Margin = new System.Windows.Forms.Padding(6);
+ this.S3Check.Name = "S3Check";
+ this.S3Check.Size = new System.Drawing.Size(15, 14);
+ this.S3Check.TabIndex = 49;
+ this.S3Check.UseVisualStyleBackColor = true;
+ //
+ // StopDistanceTextBox
+ //
+ this.StopDistanceTextBox.Location = new System.Drawing.Point(274, 108);
+ this.StopDistanceTextBox.Name = "StopDistanceTextBox";
+ this.StopDistanceTextBox.Size = new System.Drawing.Size(100, 21);
+ this.StopDistanceTextBox.TabIndex = 38;
+ //
+ // label12
+ //
+ this.label12.AutoSize = true;
+ this.label12.Location = new System.Drawing.Point(215, 112);
+ this.label12.Name = "label12";
+ this.label12.Size = new System.Drawing.Size(53, 12);
+ this.label12.TabIndex = 39;
+ this.label12.Text = "停止距离";
+ //
+ // TireWeightTextBox
+ //
+ this.TireWeightTextBox.Location = new System.Drawing.Point(274, 135);
+ this.TireWeightTextBox.Name = "TireWeightTextBox";
+ this.TireWeightTextBox.Size = new System.Drawing.Size(100, 21);
+ this.TireWeightTextBox.TabIndex = 40;
+ //
+ // SpecNameLabel
+ //
+ this.SpecNameLabel.AutoSize = true;
+ this.SpecNameLabel.Font = new System.Drawing.Font("宋体", 12F);
+ this.SpecNameLabel.Location = new System.Drawing.Point(396, 96);
+ this.SpecNameLabel.Name = "SpecNameLabel";
+ this.SpecNameLabel.Size = new System.Drawing.Size(31, 16);
+ this.SpecNameLabel.TabIndex = 46;
+ this.SpecNameLabel.Text = "N/A";
+ //
+ // label18
+ //
+ this.label18.AutoSize = true;
+ this.label18.Font = new System.Drawing.Font("宋体", 12F);
+ this.label18.Location = new System.Drawing.Point(396, 28);
+ this.label18.Name = "label18";
+ this.label18.Size = new System.Drawing.Size(71, 16);
+ this.label18.TabIndex = 43;
+ this.label18.Text = "规格号:";
+ //
+ // SpecNoLabel
+ //
+ this.SpecNoLabel.AutoSize = true;
+ this.SpecNoLabel.Font = new System.Drawing.Font("宋体", 12F);
+ this.SpecNoLabel.Location = new System.Drawing.Point(396, 50);
+ this.SpecNoLabel.Name = "SpecNoLabel";
+ this.SpecNoLabel.Size = new System.Drawing.Size(31, 16);
+ this.SpecNoLabel.TabIndex = 45;
+ this.SpecNoLabel.Text = "N/A";
+ //
+ // label19
+ //
+ this.label19.AutoSize = true;
+ this.label19.Font = new System.Drawing.Font("宋体", 12F);
+ this.label19.Location = new System.Drawing.Point(396, 74);
+ this.label19.Name = "label19";
+ this.label19.Size = new System.Drawing.Size(87, 16);
+ this.label19.TabIndex = 44;
+ this.label19.Text = "规格名称:";
//
// tableLayoutPanel2
//
@@ -1274,117 +1444,45 @@ namespace HighWayIot.Winform.UserControlPages
this.DeleteWeightButton.UseVisualStyleBackColor = true;
this.DeleteWeightButton.Click += new System.EventHandler(this.DeleteWeightButton_Click);
//
- // groupbox5
+ // PlcSpecNoLabel
//
- this.groupbox5.Controls.Add(this.label30);
- this.groupbox5.Controls.Add(this.label31);
- this.groupbox5.Controls.Add(this.label29);
- this.groupbox5.Controls.Add(this.label28);
- this.groupbox5.Controls.Add(this.label22);
- this.groupbox5.Controls.Add(this.label21);
- this.groupbox5.Controls.Add(this.label20);
- this.groupbox5.Controls.Add(this.S2Check);
- this.groupbox5.Controls.Add(this.label11);
- this.groupbox5.Controls.Add(this.S8Check);
- this.groupbox5.Controls.Add(this.S9Check);
- this.groupbox5.Controls.Add(this.S5Check);
- this.groupbox5.Controls.Add(this.RimInchTextBox);
- this.groupbox5.Controls.Add(this.S1Check);
- this.groupbox5.Controls.Add(this.label15);
- this.groupbox5.Controls.Add(this.S7Check);
- this.groupbox5.Controls.Add(this.LightWidthTextBox);
- this.groupbox5.Controls.Add(this.S4Check);
- this.groupbox5.Controls.Add(this.label14);
- this.groupbox5.Controls.Add(this.S0Check);
- this.groupbox5.Controls.Add(this.SlowDistanceTextBox);
- this.groupbox5.Controls.Add(this.S6Check);
- this.groupbox5.Controls.Add(this.label13);
- this.groupbox5.Controls.Add(this.S3Check);
- this.groupbox5.Controls.Add(this.StopDistanceTextBox);
- this.groupbox5.Controls.Add(this.label12);
- this.groupbox5.Controls.Add(this.TireWeightTextBox);
- this.groupbox5.Controls.Add(this.SpecNameLabel);
- this.groupbox5.Controls.Add(this.label18);
- this.groupbox5.Controls.Add(this.SpecNoLabel);
- this.groupbox5.Controls.Add(this.label19);
- this.groupbox5.Dock = System.Windows.Forms.DockStyle.Fill;
- this.groupbox5.Location = new System.Drawing.Point(1058, 0);
- this.groupbox5.Margin = new System.Windows.Forms.Padding(0);
- this.groupbox5.Name = "groupbox5";
- this.groupbox5.Size = new System.Drawing.Size(658, 170);
- this.groupbox5.TabIndex = 5;
- this.groupbox5.TabStop = false;
- this.groupbox5.Text = "公共参数";
+ this.PlcSpecNoLabel.AutoSize = true;
+ this.PlcSpecNoLabel.Font = new System.Drawing.Font("宋体", 9F);
+ this.PlcSpecNoLabel.Location = new System.Drawing.Point(477, 121);
+ this.PlcSpecNoLabel.Name = "PlcSpecNoLabel";
+ this.PlcSpecNoLabel.Size = new System.Drawing.Size(23, 12);
+ this.PlcSpecNoLabel.TabIndex = 66;
+ this.PlcSpecNoLabel.Text = "N/A";
//
- // label20
+ // label32
//
- this.label20.AutoSize = true;
- this.label20.Location = new System.Drawing.Point(25, 66);
- this.label20.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
- this.label20.Name = "label20";
- this.label20.Size = new System.Drawing.Size(53, 12);
- this.label20.TabIndex = 58;
- this.label20.Text = "包边裁切";
+ this.label32.AutoSize = true;
+ this.label32.Font = new System.Drawing.Font("宋体", 9F);
+ this.label32.Location = new System.Drawing.Point(397, 121);
+ this.label32.Name = "label32";
+ this.label32.Size = new System.Drawing.Size(71, 12);
+ this.label32.TabIndex = 65;
+ this.label32.Text = "PLC规格号:";
//
- // label21
+ // PlcSpecNameLabel
//
- this.label21.AutoSize = true;
- this.label21.Location = new System.Drawing.Point(25, 92);
- this.label21.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
- this.label21.Name = "label21";
- this.label21.Size = new System.Drawing.Size(53, 12);
- this.label21.TabIndex = 59;
- this.label21.Text = "工位使用";
+ this.PlcSpecNameLabel.AutoSize = true;
+ this.PlcSpecNameLabel.Font = new System.Drawing.Font("宋体", 9F);
+ this.PlcSpecNameLabel.Location = new System.Drawing.Point(477, 143);
+ this.PlcSpecNameLabel.Name = "PlcSpecNameLabel";
+ this.PlcSpecNameLabel.Size = new System.Drawing.Size(23, 12);
+ this.PlcSpecNameLabel.TabIndex = 68;
+ this.PlcSpecNameLabel.Text = "N/A";
//
- // label22
+ // label34
//
- this.label22.AutoSize = true;
- this.label22.Location = new System.Drawing.Point(25, 118);
- this.label22.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
- this.label22.Name = "label22";
- this.label22.Size = new System.Drawing.Size(53, 12);
- this.label22.TabIndex = 60;
- this.label22.Text = "称重校准";
- //
- // label28
- //
- this.label28.AutoSize = true;
- this.label28.Location = new System.Drawing.Point(84, 42);
- this.label28.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
- this.label28.Name = "label28";
- this.label28.Size = new System.Drawing.Size(17, 12);
- this.label28.TabIndex = 61;
- this.label28.Text = "2#";
- //
- // label29
- //
- this.label29.AutoSize = true;
- this.label29.Location = new System.Drawing.Point(111, 42);
- this.label29.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
- this.label29.Name = "label29";
- this.label29.Size = new System.Drawing.Size(17, 12);
- this.label29.TabIndex = 62;
- this.label29.Text = "3#";
- //
- // label30
- //
- this.label30.AutoSize = true;
- this.label30.Location = new System.Drawing.Point(165, 42);
- this.label30.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
- this.label30.Name = "label30";
- this.label30.Size = new System.Drawing.Size(17, 12);
- this.label30.TabIndex = 64;
- this.label30.Text = "5#";
- //
- // label31
- //
- this.label31.AutoSize = true;
- this.label31.Location = new System.Drawing.Point(138, 42);
- this.label31.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
- this.label31.Name = "label31";
- this.label31.Size = new System.Drawing.Size(17, 12);
- this.label31.TabIndex = 63;
- this.label31.Text = "4#";
+ this.label34.AutoSize = true;
+ this.label34.Font = new System.Drawing.Font("宋体", 9F);
+ this.label34.Location = new System.Drawing.Point(397, 143);
+ this.label34.Name = "label34";
+ this.label34.Size = new System.Drawing.Size(83, 12);
+ this.label34.TabIndex = 67;
+ this.label34.Text = "PLC规格名称:";
//
// RecipeConfigPage
//
@@ -1414,11 +1512,11 @@ namespace HighWayIot.Winform.UserControlPages
this.SideRadioButtonPanel.PerformLayout();
this.PositionRadioButtonPanel.ResumeLayout(false);
this.PositionRadioButtonPanel.PerformLayout();
+ this.groupbox5.ResumeLayout(false);
+ this.groupbox5.PerformLayout();
this.tableLayoutPanel2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
- this.groupbox5.ResumeLayout(false);
- this.groupbox5.PerformLayout();
this.ResumeLayout(false);
}
@@ -1516,14 +1614,14 @@ namespace HighWayIot.Winform.UserControlPages
private TextBox RimInchTextBox;
private Button PastePositionButton;
private Button CopyPositionButton;
- private Label label16;
+ private Label PositionCopyBoardLabel;
private Label label17;
private Label label19;
private Label label18;
private Label SpecNameLabel;
private Label SpecNoLabel;
- private Button button2;
- private Button button1;
+ private Button UpLoadToPlc;
+ private Button DownloadFromPlc;
private CheckBox S8Check;
private CheckBox S5Check;
private CheckBox S1Check;
@@ -1541,5 +1639,12 @@ namespace HighWayIot.Winform.UserControlPages
private Label label20;
private CheckBox S0Check;
private CheckBox S2Check;
+ private Button CopyAllButton;
+ private Button PasteAllButton;
+ private Button ClearDirtyData;
+ private Label PlcSpecNameLabel;
+ private Label label34;
+ private Label PlcSpecNoLabel;
+ private Label label32;
}
}
diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs
index e82fef5..a7c9d7a 100644
--- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs
+++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs
@@ -1,4 +1,7 @@
-using HighWayIot.Repository.domain;
+using HighWayIot.Log4net;
+using HighWayIot.Plc;
+using HighWayIot.Plc.PlcHelper;
+using HighWayIot.Repository.domain;
using HighWayIot.Repository.service;
using HighWayIot.Winform.Business;
using HighWayIot.Winform.MainForm;
@@ -15,6 +18,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
+using System.Xml.Schema;
namespace HighWayIot.Winform.UserControlPages
{
@@ -53,12 +57,7 @@ namespace HighWayIot.Winform.UserControlPages
///
/// 工位配方字段实例
///
- private ZxRecipePositionParaEntity zxRecipePositionParaEntity = new ZxRecipePositionParaEntity();
-
- ///
- /// 配方字段实例剪切板
- ///
- private ZxRecipeParaEntity zxRecipeParaEntityCut;
+ private List zxRecipePositionParaEntity = new List();
///
/// 称重DataGridView数据源
@@ -80,6 +79,26 @@ namespace HighWayIot.Winform.UserControlPages
///
private string NowRecipeCode;
+ ///
+ /// 配方字段剪切板
+ ///
+ private ZxRecipeParaEntity ParaCopyBoard = new ZxRecipeParaEntity();
+
+ ///
+ /// 工位全部配方字段剪切板
+ ///
+ private List PositionParaCopyBoard = new List();
+
+ ///
+ /// 工位单个配方字段剪切板
+ ///
+ private ZxRecipePositionParaEntity SingalPositionParaCopyBoard;
+
+ ///
+ /// PLC实例
+ ///
+ private RecipeParaHelper recipeParaHelper = new RecipeParaHelper();
+
public RecipeConfigPage()
{
InitializeComponent();
@@ -97,9 +116,17 @@ namespace HighWayIot.Winform.UserControlPages
RecipeDataGridView.DataSource = RecipeLists;
NowRecipeCode = RecipeDataGridView.Rows[0].Cells["RecipeCode"].Value.ToString();
+ InitPositionEntities();
+ //读取SPEC编号
+ PlcSpecNoLabel.Text = PlcConnect.ReadUInt321("D206").ToString();
+
+ //读取SPEC名称
+ PlcSpecNameLabel.Text = PlcConnect.ReadString1("D290", 10).Trim();
}
+ #region 配方信息
+
///
/// 添加配方信息
///
@@ -232,6 +259,10 @@ namespace HighWayIot.Winform.UserControlPages
RecipeDataGridView.DataSource = RecipeLists;
}
+ #endregion
+
+ #region 称量信息
+
///
/// 添加称量信息
///
@@ -371,199 +402,6 @@ namespace HighWayIot.Winform.UserControlPages
WeightDataGridView.DataSource = weightDataSourceEntities;
}
- ///
- /// 参数保存
- ///
- ///
- ///
- private void SaveParaButton_Click(object sender, EventArgs e)
- {
- //if (MessageBox.Show($"确定要保存配方编号为 [{s}] 的配方的参数?", "确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- //{
- // return;
- //}
-
- //获取前端的值
- GetParaValue();
-
- //搜索配方字段
- var paraData = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(NowRecipeCode);
- int flag = GetSelectIndex();
- var positionParaData = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == NowRecipeCode && x.Position == flag);
- //获得对应工位号
- bool isSuccess = false;
- //公共参数
- //没有就插入
- if (paraData.Count == 0)
- {
- if(zxRecipeParaService.InsertRecipeParaInfo(zxRecipeParaEntity))
- {
- isSuccess = true;
- }
- else
- {
- isSuccess = false;
- }
- }
- //有就更改
- else if (paraData.Count == 1)
- {
- zxRecipeParaEntity.Id = paraData[0].Id;
- if (zxRecipeParaService.UpdateRecipeParaInfo(zxRecipeParaEntity))
- {
- isSuccess = true;
- }
- else
- {
- isSuccess = false;
- }
- }
- else
- {
- MessageBox.Show("存在多条未删除的相同公共参数!请检查数据库。");
- return;
- }
-
- //贴合参数
- //没有就插入
- if (positionParaData.Count == 0)
- {
- if (zxRecipePositionParaService.InsertRecipePositionParaInfo(zxRecipePositionParaEntity))
- {
- isSuccess = true;
- }
- else
- {
- isSuccess = false;
- }
- }
- //有就更改
- else if (positionParaData.Count == 1)
- {
- zxRecipePositionParaEntity.Id = positionParaData[0].Id;
- if (zxRecipePositionParaService.UpdateRecipePositionParaInfo(zxRecipePositionParaEntity))
- {
- isSuccess = true;
- }
- else
- {
- isSuccess = false;
- }
- }
- else
- {
- MessageBox.Show("存在多条未删除的相同贴合参数!请检查数据库。");
- return;
- }
-
- if (isSuccess)
- {
- BaseForm.LogRefreshAction.Invoke("保存成功" + DateTime.Now.ToString());
- }
- else
- {
- BaseForm.LogRefreshAction.Invoke("保存失败" + DateTime.Now.ToString());
- }
- }
-
- ///
- /// 参数复制
- ///
- ///
- ///
- private void CopyParaButton_Click(object sender, EventArgs e)
- {
- //zxRecipeParaEntityCut = GetParaValue();
- NowCopyLabel.Text = NowRecipeCode;
- }
-
- ///
- /// 参数粘贴
- ///
- ///
- ///
- private void PasteParaButton_Click(object sender, EventArgs e)
- {
- if (zxRecipeParaEntityCut == null)
- {
- MessageBox.Show("剪切板为空!");
- return;
- }
- //SetParaValue(zxRecipeParaEntityCut);
- }
-
- ///
- /// 参数清空
- ///
- ///
- ///
- private void ClearCutBoradButton_Click(object sender, EventArgs e)
- {
- zxRecipeParaEntityCut = null;
- NowCopyLabel.Text = "N/A";
-
- if (MessageBox.Show("是否要清空前端数据", "", MessageBoxButtons.YesNo) == DialogResult.OK)
- {
- //SetParaValue(new ZxRecipeParaEntity());
- }
- }
-
- ///
- /// 所选配方内容更改事件
- ///
- ///
- ///
- private void RecipeDataGridView_SelectionChanged(object sender, EventArgs e)
- {
- int a = RecipeDataGridView.CurrentRow.Index;
- NowRecipeCode = RecipeDataGridView.Rows[a].Cells["RecipeCode"].Value.ToString();
-
- WeightLists = zxWeightService.GetWeightInfos(NowRecipeCode);
-
- WeightToDataSource();
-
- WeightDataGridView.DataSource = null;
- WeightDataGridView.DataSource = weightDataSourceEntities;
-
- //设置参数
- var paraData = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(NowRecipeCode);
- int flag = GetSelectIndex();
- var positionParaData = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == NowRecipeCode && x.Position == flag);
- //没有就全0
- if (paraData.Count == 0)
- {
- SetPublicParaValue(new ZxRecipeParaEntity());
- }
- //有就显示
- else if (paraData.Count == 1)
- {
- SetPublicParaValue(paraData[0]);
- }
- //有多条设为第一条
- else
- {
- MessageBox.Show("存在多条未删除的相同配方字段信息!将设置为第一条,请检查数据库。");
- SetPublicParaValue(paraData[0]);
- }
-
- //没有就全0
- if (positionParaData.Count == 0)
- {
- SetPrivateParaValue(new ZxRecipePositionParaEntity());
- }
- //有就显示
- else if (positionParaData.Count == 1)
- {
- SetPrivateParaValue(positionParaData[0]);
- }
- //有多条设为第一条
- else
- {
- MessageBox.Show("存在多条未删除的相同配方字段信息!将设置为第一条,请检查数据库。");
- SetPrivateParaValue(positionParaData[0]);
- }
- }
-
///
/// 称重数据关联物料数据
///
@@ -605,6 +443,212 @@ namespace HighWayIot.Winform.UserControlPages
}
}
+ #endregion
+
+ ///
+ /// 所选配方内容更改事件
+ ///
+ ///
+ ///
+ private void RecipeDataGridView_SelectionChanged(object sender, EventArgs e)
+ {
+ int a = RecipeDataGridView.CurrentRow.Index;
+ NowRecipeCode = RecipeDataGridView.Rows[a].Cells["RecipeCode"].Value.ToString();
+ SpecNoLabel.Text = RecipeDataGridView.Rows[a].Cells["RecipeSpecCode"].Value.ToString();
+ SpecNameLabel.Text = RecipeDataGridView.Rows[a].Cells["RecipeSpecName"].Value.ToString();
+
+ //初始化工位参数类
+ InitPositionEntities();
+
+ WeightLists = zxWeightService.GetWeightInfos(NowRecipeCode);
+
+ WeightToDataSource();
+
+ WeightDataGridView.DataSource = null;
+ WeightDataGridView.DataSource = weightDataSourceEntities;
+
+ //设置参数
+ var paraData = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(NowRecipeCode);
+ int flag = GetSelectIndex();
+ var positionParaData = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == NowRecipeCode);
+
+ //没有就全0
+ if (paraData.Count == 0)
+ {
+ SetPublicParaValue(new ZxRecipeParaEntity());
+ zxRecipeParaEntity = new ZxRecipeParaEntity();
+ }
+ //有就显示
+ else if (paraData.Count == 1)
+ {
+ SetPublicParaValue(paraData[0]);
+ zxRecipeParaEntity = paraData[0];
+ }
+ //有多条设为第一条
+ else
+ {
+ MessageBox.Show("存在多条未删除的相同公共配方字段信息!将设置为第一条。点击清除脏数据");
+ SetPublicParaValue(paraData[0]);
+ zxRecipeParaEntity = paraData[0];
+ }
+
+ //没有就全0
+ if (positionParaData.Count == 0)
+ {
+ SetPrivateParaValue(new ZxRecipePositionParaEntity());
+ }
+ else
+ {
+ foreach (var item in positionParaData)
+ {
+ ChangePositionEntities(item);
+ }
+ SetPrivateParaValue(zxRecipePositionParaEntity.Where(x => x.Position == flag).FirstOrDefault());
+ }
+ }
+
+ #region 参数设置
+
+ ///
+ /// 参数保存
+ ///
+ ///
+ ///
+ private void SaveParaButton_Click(object sender, EventArgs e)
+ {
+ if (MessageBox.Show($"确定要保存配方编号为 [{NowRecipeCode}] 的配方的参数?", "确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
+ {
+ return;
+ }
+
+ var index = GetSelectIndex();
+ //从前端更新值
+ GetPublicParaValue();
+ GetPrivateParaValue(index);
+
+ //查重
+ var paraEntity = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(NowRecipeCode);
+ var positionParaEntity = zxRecipePositionParaService.GetRecipePositionParaInfoByRecipeCode(NowRecipeCode);
+
+ zxRecipeParaEntity.RecipeCode = NowRecipeCode;
+ //保存公共参数
+ var flag1 = true;
+ if (paraEntity.Count == 0) //没有就插入
+ {
+ flag1 = zxRecipeParaService.InsertRecipeParaInfo(zxRecipeParaEntity);
+ }
+ else if (paraEntity.Count == 1) //有就更新
+ {
+ zxRecipeParaEntity.Id = paraEntity[0].Id;
+ flag1 = zxRecipeParaService.UpdateRecipeParaInfo(zxRecipeParaEntity);
+ }
+ else //多条更新第一条
+ {
+ zxRecipeParaEntity.Id = paraEntity[0].Id;
+ flag1 = zxRecipeParaService.UpdateRecipeParaInfo(zxRecipeParaEntity);
+ MessageBox.Show("存在多条未删除的相同公共配方字段信息!将设置为第一条。点击清除脏数据");
+ }
+
+
+ //保存贴合参数
+ var flag2 = true;
+ foreach (var item in zxRecipePositionParaEntity)
+ {
+ item.RecipeCode = NowRecipeCode;
+ var count = positionParaEntity.Count(x => x.Position == item.Position);
+ //如果没有
+ if (count == 0)
+ {
+ flag2 = zxRecipePositionParaService.InsertRecipePositionParaInfo(item);
+ }
+ else //有 多条存第一条
+ {
+ item.Id = positionParaEntity.FirstOrDefault(x => x.Position == item.Position).Id;
+ flag2 = zxRecipePositionParaService.UpdateRecipePositionParaInfo(item);
+
+ if (count != 1) //多条提示
+ {
+ MessageBox.Show("存在多条未删除的相同公共配方字段信息!将设置为第一条。点击清除脏数据");
+ }
+ }
+ if (!flag2) break;
+ }
+
+ if (flag1 && flag2)
+ {
+ BaseForm.LogRefreshAction.Invoke("更新成功");
+ }
+ else
+ {
+ BaseForm.LogRefreshAction.Invoke("更新失败");
+ }
+ //保存贴合参数
+ }
+
+ ///
+ /// 初始化工位参数
+ ///
+ private void InitPositionEntities()
+ {
+ zxRecipePositionParaEntity.Clear();
+
+ zxRecipePositionParaEntity.Add(new ZxRecipePositionParaEntity()
+ {
+ Position = 1
+ });
+
+ zxRecipePositionParaEntity.Add(new ZxRecipePositionParaEntity()
+ {
+ Position = 2
+ });
+
+ zxRecipePositionParaEntity.Add(new ZxRecipePositionParaEntity()
+ {
+ Position = 31
+ });
+
+ zxRecipePositionParaEntity.Add(new ZxRecipePositionParaEntity()
+ {
+ Position = 32
+ });
+
+ zxRecipePositionParaEntity.Add(new ZxRecipePositionParaEntity()
+ {
+ Position = 41
+ });
+
+ zxRecipePositionParaEntity.Add(new ZxRecipePositionParaEntity()
+ {
+ Position = 42
+ });
+
+ zxRecipePositionParaEntity.Add(new ZxRecipePositionParaEntity()
+ {
+ Position = 51
+ });
+
+ zxRecipePositionParaEntity.Add(new ZxRecipePositionParaEntity()
+ {
+ Position = 52
+ });
+ }
+
+ ///
+ /// 替换工位信息中的元素
+ ///
+ ///
+ private void ChangePositionEntities(ZxRecipePositionParaEntity entity)
+ {
+ int index = zxRecipePositionParaEntity.FindIndex(x => x.Position == entity.Position);
+ if (index == -1)
+ {
+ BaseForm.LogRefreshAction.Invoke("数据保存失败,请重新启动页面");
+ return;
+ }
+ zxRecipePositionParaEntity[index] = entity;
+ }
+
+
///
/// 设置显示的贴合参数字段值
///
@@ -621,7 +665,6 @@ namespace HighWayIot.Winform.UserControlPages
E8TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E8);
E9TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E9);
E10TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E10);
-
}
///
@@ -645,28 +688,41 @@ namespace HighWayIot.Winform.UserControlPages
LightWidthTextBox.Text = GeneralUtils.IntEmptyOrToString(paraEntity.LightWidth);
SlowDistanceTextBox.Text = GeneralUtils.IntEmptyOrToString(paraEntity.SlowDistance);
StopDistanceTextBox.Text = GeneralUtils.IntEmptyOrToString(paraEntity.StopDistance);
- TireWeightTextBox.Text = GeneralUtils.IntEmptyOrToString(paraEntity.TireWeight);
+ TireWeightTextBox.Text = paraEntity.TireWeight == null ? "0" : paraEntity.TireWeight.ToString();
+ //SpecNoLabel.Text = GeneralUtils.IntEmptyOrToString(paraEntity.SpecCode);
+ //SpecNameLabel.Text = paraEntity.SpecName;
}
///
- /// 获取界面上的配方参数
+ /// 贴合参数获取值 存到实体
///
- /// 获取到的配方参数值
- private void GetParaValue()
+ ///
+ private void GetPrivateParaValue(int flag)
{
- zxRecipePositionParaEntity.E1 = GeneralUtils.StringNullOrToInt(E1TextBox.Text);
- zxRecipePositionParaEntity.E2 = GeneralUtils.StringNullOrToInt(E2TextBox.Text);
- zxRecipePositionParaEntity.E3 = GeneralUtils.StringNullOrToInt(E3TextBox.Text);
- zxRecipePositionParaEntity.E4 = GeneralUtils.StringNullOrToInt(E4TextBox.Text);
- zxRecipePositionParaEntity.E5 = GeneralUtils.StringNullOrToInt(E5TextBox.Text);
- zxRecipePositionParaEntity.E6 = GeneralUtils.StringNullOrToInt(E6TextBox.Text);
- zxRecipePositionParaEntity.E7 = GeneralUtils.StringNullOrToInt(E7TextBox.Text);
- zxRecipePositionParaEntity.E8 = GeneralUtils.StringNullOrToInt(E8TextBox.Text);
- zxRecipePositionParaEntity.E9 = GeneralUtils.StringNullOrToInt(E9TextBox.Text);
- zxRecipePositionParaEntity.E10 = GeneralUtils.StringNullOrToInt(E10TextBox.Text);
- zxRecipePositionParaEntity.Position = GetSelectIndex();
- zxRecipePositionParaEntity.RecipeCode = NowRecipeCode;
+ var e = zxRecipePositionParaEntity.FirstOrDefault(x => x.Position == flag);
+ e.E1 = GeneralUtils.StringNullOrToInt(E1TextBox.Text);
+ e.E2 = GeneralUtils.StringNullOrToInt(E2TextBox.Text);
+ e.E3 = GeneralUtils.StringNullOrToInt(E3TextBox.Text);
+ e.E4 = GeneralUtils.StringNullOrToInt(E4TextBox.Text);
+ e.E5 = GeneralUtils.StringNullOrToInt(E5TextBox.Text);
+ e.E6 = GeneralUtils.StringNullOrToInt(E6TextBox.Text);
+ e.E7 = GeneralUtils.StringNullOrToInt(E7TextBox.Text);
+ e.E8 = GeneralUtils.StringNullOrToInt(E8TextBox.Text);
+ e.E9 = GeneralUtils.StringNullOrToInt(E9TextBox.Text);
+ e.E10 = GeneralUtils.StringNullOrToInt(E10TextBox.Text);
+ e.Position = GetSelectIndex();
+ e.RecipeCode = NowRecipeCode;
+
+ ChangePositionEntities(e);
+ }
+
+ ///
+ /// 公共参数获取值 存到实体
+ ///
+ ///
+ private void GetPublicParaValue()
+ {
zxRecipeParaEntity.S0 = S0Check.Checked;
zxRecipeParaEntity.S1 = S1Check.Checked;
zxRecipeParaEntity.S2 = S2Check.Checked;
@@ -681,12 +737,20 @@ namespace HighWayIot.Winform.UserControlPages
zxRecipeParaEntity.LightWidth = GeneralUtils.StringNullOrToInt(LightWidthTextBox.Text);
zxRecipeParaEntity.SlowDistance = GeneralUtils.StringNullOrToInt(SlowDistanceTextBox.Text);
zxRecipeParaEntity.StopDistance = GeneralUtils.StringNullOrToInt(StopDistanceTextBox.Text);
- zxRecipeParaEntity.TireWeight = GeneralUtils.StringNullOrToInt(TireWeightTextBox.Text);
- zxRecipeParaEntity.RecipeCode = NowRecipeCode;
+ try
+ {
+ zxRecipeParaEntity.TireWeight = float.Parse(TireWeightTextBox.Text == string.Empty ? "0" : TireWeightTextBox.Text);
+ }
+ catch
+ {
+ MessageBox.Show("胎体重量请输入整数或小数");
+ }
+ zxRecipeParaEntity.SpecCode = SpecNoLabel.Text;
+ zxRecipeParaEntity.SpecName = SpecNameLabel.Text;
}
///
- /// 工位改变
+ /// 工位改变 保存现在的,显示换的
///
///
///
@@ -698,8 +762,9 @@ namespace HighWayIot.Winform.UserControlPages
{
int flag = GetSelectIndex();
- SetParaView(flag);
- if(flag < 10)
+ SetPrivateParaValue(zxRecipePositionParaEntity.Where(x => x.Position == flag).FirstOrDefault());
+
+ if (flag < 10)
{
BodyRadioButton.Enabled = false;
SideRadioButton.Enabled = false;
@@ -712,21 +777,6 @@ namespace HighWayIot.Winform.UserControlPages
}
}
- ///
- /// 读取数据库设置贴合参数字段
- ///
- ///
- ///
- private void SetParaView(int flag)
- {
- zxRecipePositionParaEntity = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.Position == flag && x.RecipeCode == NowRecipeCode).FirstOrDefault();
- if (zxRecipePositionParaEntity == null)
- {
- zxRecipePositionParaEntity = new ZxRecipePositionParaEntity();
- }
- SetPrivateParaValue(zxRecipePositionParaEntity);
- }
-
///
/// 获取选择的工位包边
///
@@ -784,5 +834,214 @@ namespace HighWayIot.Winform.UserControlPages
return 0;
}
+
+ ///
+ /// 暂存工位参数
+ ///
+ ///
+ ///
+ private void PositionRadioButton_MouseDown(object sender, MouseEventArgs e)
+ {
+ int index = GetSelectIndex();
+
+ GetPrivateParaValue(index);
+
+ BaseForm.LogRefreshAction.Invoke($"[{index.ToString()}] 工位参数已暂存");
+ }
+
+ ///
+ /// 公共参数复制
+ ///
+ ///
+ ///
+ private void CopyParaButton_Click(object sender, EventArgs e)
+ {
+ ParaCopyBoard = zxRecipeParaEntity;
+ NowCopyLabel.Text = NowRecipeCode;
+ }
+
+ ///
+ /// 公共参数粘贴
+ ///
+ ///
+ ///
+ private void PasteParaButton_Click(object sender, EventArgs e)
+ {
+ if (ParaCopyBoard == null)
+ {
+ MessageBox.Show("剪切板为空!");
+ return;
+ }
+ SetPublicParaValue(ParaCopyBoard);
+ }
+
+ ///
+ /// 贴合参数复制
+ ///
+ ///
+ ///
+ private void CopyPositionButton_Click(object sender, EventArgs e)
+ {
+ var index = GetSelectIndex();
+ GetPrivateParaValue(index);
+ SingalPositionParaCopyBoard = zxRecipePositionParaEntity.FirstOrDefault(x => x.Position == index);
+ PositionCopyBoardLabel.Text = index.ToString() + "|" + NowRecipeCode;
+ }
+
+ ///
+ /// 贴合参数粘贴
+ ///
+ ///
+ ///
+ private void PastePositionButton_Click(object sender, EventArgs e)
+ {
+ if (SingalPositionParaCopyBoard == null)
+ {
+ MessageBox.Show("剪切板为空!");
+ return;
+ }
+ SetPrivateParaValue(SingalPositionParaCopyBoard);
+ }
+
+ ///
+ /// 整体复制
+ ///
+ ///
+ ///
+ private void CopyAllButton_Click(object sender, EventArgs e)
+ {
+ int index = GetSelectIndex();
+ GetPrivateParaValue(index);
+ ParaCopyBoard = new ZxRecipeParaEntity()
+ {
+ S0 = zxRecipeParaEntity.S0 ?? false,
+ S1 = zxRecipeParaEntity.S1 ?? false,
+ S2 = zxRecipeParaEntity.S2 ?? false,
+ S3 = zxRecipeParaEntity.S3 ?? false,
+ S4 = zxRecipeParaEntity.S4 ?? false,
+ S5 = zxRecipeParaEntity.S5 ?? false,
+ S6 = zxRecipeParaEntity.S6 ?? false,
+ S7 = zxRecipeParaEntity.S7 ?? false,
+ S8 = zxRecipeParaEntity.S8 ?? false,
+ S9 = zxRecipeParaEntity.S9 ?? false,
+
+ RimInch = zxRecipeParaEntity.RimInch,
+ LightWidth = zxRecipeParaEntity.LightWidth,
+ SlowDistance = zxRecipeParaEntity.SlowDistance,
+ StopDistance = zxRecipeParaEntity.StopDistance,
+ TireWeight = zxRecipeParaEntity.TireWeight,
+ };
+ PositionParaCopyBoard.Clear();
+ foreach (var entity in zxRecipePositionParaEntity)
+ {
+ var clone = new ZxRecipePositionParaEntity()
+ {
+ E1 = entity.E1,
+ E2 = entity.E2,
+ E3 = entity.E3,
+ E4 = entity.E4,
+ E5 = entity.E5,
+ E6 = entity.E6,
+ E7 = entity.E7,
+ E8 = entity.E8,
+ E9 = entity.E9,
+ E10 = entity.E10,
+ Position = entity.Position,
+ };
+ PositionParaCopyBoard.Add(clone);
+ }
+ //PositionParaCopyBoard = zxRecipePositionParaEntity;
+ NowCopyLabel.Text = NowRecipeCode + " 全复制";
+ PositionCopyBoardLabel.Text = "全复制";
+ }
+
+ ///
+ /// 整体粘贴
+ ///
+ ///
+ ///
+ private void PasteAllButton_Click(object sender, EventArgs e)
+ {
+ if (zxRecipeParaEntity != null && (zxRecipePositionParaEntity != null || zxRecipePositionParaEntity.Count != 8))
+ {
+ zxRecipePositionParaEntity = PositionParaCopyBoard;
+ zxRecipeParaEntity = ParaCopyBoard;
+ }
+ else
+ {
+ MessageBox.Show("粘贴失败,请重新复制数据");
+ }
+
+ SetPublicParaValue(zxRecipeParaEntity);
+ SetPrivateParaValue(zxRecipePositionParaEntity.First(x => x.Position == GetSelectIndex()));
+ }
+
+ ///
+ /// 清除脏数据
+ ///
+ ///
+ ///
+ private void ClearDirtyData_Click(object sender, EventArgs e)
+ {
+ if (MessageBox.Show($"确定要清除脏数据?", "确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
+ {
+ return;
+ }
+
+ if (zxRecipeParaService.DeleteDirtyData() &&
+ zxRecipePositionParaService.DeleteDirtyData())
+ {
+ MessageBox.Show("清除成功");
+ }
+ else
+ {
+ MessageBox.Show("清除失败");
+ }
+ }
+
+ ///
+ /// 上载到plc
+ ///
+ ///
+ ///
+ private void UploadToPlc_Click(object sender, EventArgs e)
+ {
+ if (MessageBox.Show($"是否要将此配方下传到PLC?", "确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
+ {
+ return;
+ }
+ GetPublicParaValue();
+ GetPrivateParaValue(GetSelectIndex());
+ if (recipeParaHelper.UploadToPLC(zxRecipeParaEntity, zxRecipePositionParaEntity))
+ {
+ MessageBox.Show("下发到PLC成功");
+ }
+ else
+ {
+ MessageBox.Show("下发到PLC失败");
+ }
+ PlcSpecNameLabel.Text = zxRecipeParaEntity.SpecName.Trim();
+ PlcSpecNoLabel.Text = zxRecipeParaEntity.SpecCode.Trim();
+ }
+
+ ///
+ /// 从plc读取
+ ///
+ ///
+ ///
+ private void DownloadFromPlc_Click(object sender, EventArgs e)
+ {
+ if (MessageBox.Show($"是否要从PLC读取配方?", "确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
+ {
+ return;
+ }
+ zxRecipePositionParaEntity = recipeParaHelper.DownLoadFormPlc(ref zxRecipeParaEntity);
+ SetPublicParaValue(zxRecipeParaEntity);
+ SetPrivateParaValue(zxRecipePositionParaEntity.First(x => x.Position == GetSelectIndex()));
+ PlcSpecNameLabel.Text = zxRecipeParaEntity.SpecName.Trim();
+ PlcSpecNoLabel.Text = zxRecipeParaEntity.SpecCode.Trim();
+ }
+
+ #endregion
}
}
diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.resx b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.resx
index 2c39e2a..fad953c 100644
--- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.resx
+++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.resx
@@ -150,66 +150,6 @@
True
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
True
diff --git a/HighWayIot.Winform/UserControlPages/TestPage.Designer.cs b/HighWayIot.Winform/UserControlPages/TestPage.Designer.cs
index 502d72c..48fe9fb 100644
--- a/HighWayIot.Winform/UserControlPages/TestPage.Designer.cs
+++ b/HighWayIot.Winform/UserControlPages/TestPage.Designer.cs
@@ -39,6 +39,9 @@
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.PlcShowValue = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.LengthTextBox = new System.Windows.Forms.TextBox();
+ this.button3 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
@@ -57,7 +60,7 @@
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(93, 51);
this.button2.TabIndex = 1;
- this.button2.Text = "测试";
+ this.button2.Text = "测试1连接";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
@@ -140,11 +143,40 @@
this.PlcShowValue.TabIndex = 11;
this.PlcShowValue.Text = "N/A";
//
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(391, 252);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(29, 12);
+ this.label4.TabIndex = 13;
+ this.label4.Text = "长度";
+ //
+ // LengthTextBox
+ //
+ this.LengthTextBox.Location = new System.Drawing.Point(438, 249);
+ this.LengthTextBox.Name = "LengthTextBox";
+ this.LengthTextBox.Size = new System.Drawing.Size(100, 21);
+ this.LengthTextBox.TabIndex = 12;
+ //
+ // button3
+ //
+ this.button3.Location = new System.Drawing.Point(344, 57);
+ this.button3.Name = "button3";
+ this.button3.Size = new System.Drawing.Size(93, 51);
+ this.button3.TabIndex = 14;
+ this.button3.Text = "测试2连接";
+ this.button3.UseVisualStyleBackColor = true;
+ this.button3.Click += new System.EventHandler(this.button3_Click);
+ //
// TestPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLight;
+ this.Controls.Add(this.button3);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.LengthTextBox);
this.Controls.Add(this.PlcShowValue);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
@@ -176,5 +208,8 @@
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label PlcShowValue;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.TextBox LengthTextBox;
+ private System.Windows.Forms.Button button3;
}
}
diff --git a/HighWayIot.Winform/UserControlPages/TestPage.cs b/HighWayIot.Winform/UserControlPages/TestPage.cs
index 7b9007c..1df8098 100644
--- a/HighWayIot.Winform/UserControlPages/TestPage.cs
+++ b/HighWayIot.Winform/UserControlPages/TestPage.cs
@@ -6,6 +6,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net;
+using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
@@ -48,9 +49,13 @@ namespace HighWayIot.Winform.UserControlPages
}
}
- private void button2_Click(object sender, EventArgs e)
+ private async void button2_Click(object sender, EventArgs e)
{
- var res = PlcConnect.IsConnect1;
+ bool res = false;
+ await Task.Run(() =>
+ {
+ res = PlcConnect.IsConnect1;
+ });
PlcShowValue.Text = res.ToString();
}
@@ -94,6 +99,9 @@ namespace HighWayIot.Winform.UserControlPages
case DataTypeEnum.Double:
res = PlcConnect.ReadDouble1(PlcAddress.Text).ToString();
break;
+ case DataTypeEnum.String:
+ res = PlcConnect.ReadString1(PlcAddress.Text, (ushort)(GeneralUtils.StringNullOrToInt(LengthTextBox.Text) ?? 0)).ToString();
+ break;
default:
res = "不对劲儿奥";
break;
@@ -105,17 +113,37 @@ namespace HighWayIot.Winform.UserControlPages
///
/// PLC写入按钮
///
- ///
+ ///
///
private void WriteButton_Click(object sender, EventArgs e)
{
- if(!decimal.TryParse(PlcValue.Text, out decimal value))
+ if ((DataTypeEnum)Convert.ToInt32(PlcType.SelectedValue) != DataTypeEnum.String)
{
- MessageBox.Show("类型转换错误!");
+ if (!decimal.TryParse(PlcValue.Text, out decimal value))
+ {
+ MessageBox.Show("类型转换错误!");
+ }
+ var result = PlcConnect.PlcWrite1(PlcAddress.Text, value, (DataTypeEnum)Convert.ToInt32(PlcType.SelectedValue));
+ bool r = result.IsSuccess;
+ PlcShowValue.Text = r.ToString();
}
- var result = PlcConnect.PlcWrite1(PlcAddress.Text, value, (DataTypeEnum)Convert.ToInt32(PlcType.SelectedValue));
- bool r = result.IsSuccess;
- PlcShowValue.Text = r.ToString();
+ else
+ {
+ string value = PlcValue.Text;
+ var result = PlcConnect.PlcWrite1(PlcAddress.Text, value, (DataTypeEnum)Convert.ToInt32(PlcType.SelectedValue));
+ bool r = result.IsSuccess;
+ PlcShowValue.Text = r.ToString();
+ }
+ }
+
+ private async void button3_Click(object sender, EventArgs e)
+ {
+ bool res = false;
+ await Task.Run(() =>
+ {
+ res = PlcConnect.IsConnect2;
+ });
+ PlcShowValue.Text = res.ToString();
}
}
}