feat - PLC加锁 网络优化 添加日志 添加报表和详表导出EXCEL 配方更改

master
SoulStar 1 month ago
parent 7760abe6d2
commit 6372b3f2ad

@ -5,6 +5,7 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace HighWayIot.Common
@ -212,5 +213,45 @@ namespace HighWayIot.Common
}
return iNegate;
}
/// <summary>
/// 提取字符串中的数字并转换为uint32
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="OverflowException"></exception>
public static uint ExtractUInt32(string input)
{
try
{
if (input == null)
return 0;
// 移除非数字字符(等价于 [^0-9]
string numberStr = Regex.Replace(input, @"\D", "");
if (numberStr.Length == 0)
return 0;
// uint最大值为429496729510位
if (numberStr.Length > 10)
return 0;
// 处理前导零
numberStr = numberStr.TrimStart('0');
// 全零情况
if (numberStr.Length == 0) numberStr = "0";
if (ulong.Parse(numberStr) > uint.MaxValue)
return 0;
return uint.Parse(numberStr);
}
catch (Exception ex)
{
return 0;
}
}
}
}

@ -67,5 +67,10 @@ namespace HighWayIot.Plc
/// </summary>
[Description("String")]
String = 11,
/// <summary>
/// Bytes
/// </summary>
[Description("Bytes")]
Bytes = 12,
}
}

File diff suppressed because it is too large Load Diff

@ -1,4 +1,5 @@
using HighWayIot.Repository.domain;
using HighWayIot.Common;
using HighWayIot.Repository.domain;
using HslCommunication;
using Models;
using System;
@ -12,6 +13,8 @@ namespace HighWayIot.Plc.PlcHelper
{
public class RecipeParaHelper
{
#region 写入
/// <summary>
/// 数据下传到PLC
/// </summary>
@ -24,17 +27,17 @@ namespace HighWayIot.Plc.PlcHelper
//SPEC编号写入
try
{
if (!PlcConnect.MelsecInstance2.Write("D206", uint.Parse(paraEntity.SpecCode)).IsSuccess)
if (!PlcConnect.PlcWrite2("D206", StringChange.ExtractUInt32(paraEntity.SpecCode), DataTypeEnum.UInt32).IsSuccess)
return false;
}
catch
{
return false;
return false;
}
//SPEC名称写入
var specNameBytes = Encoding.ASCII.GetBytes(paraEntity.SpecName);
Array.Copy(specNameBytes, 0, bytes, 0, specNameBytes.Length);
Array.Copy(specNameBytes, 0, bytes, 0, specNameBytes.Length > 20 ? 20 : specNameBytes.Length);
//if (!PlcConnect.PlcWrite2("D290", paraEntity.SpecName, DataTypeEnum.String).IsSuccess)
// return false;
@ -76,14 +79,13 @@ namespace HighWayIot.Plc.PlcHelper
var bytes5 = BitConverter.GetBytes((ushort?)paraEntity.StopDistance ?? 0);
var bytes6 = BitConverter.GetBytes(paraEntity.TireWeight ?? 0);
Array.Copy(bytes1, 0, bytes, (390 - 290) * 2, bytes1.Length);
Array.Copy(bytes2, 0, bytes, (391 - 290) * 2, bytes1.Length);
Array.Copy(bytes3, 0, bytes, (392 - 290) * 2, bytes1.Length);
Array.Copy(bytes4, 0, bytes, (393 - 290) * 2, bytes1.Length);
Array.Copy(bytes5, 0, bytes, (394 - 290) * 2, bytes1.Length);
Array.Copy(bytes6, 0, bytes, (398 - 290) * 2, bytes1.Length);
Array.Copy(bytes2, 0, bytes, (391 - 290) * 2, bytes2.Length);
Array.Copy(bytes3, 0, bytes, (392 - 290) * 2, bytes3.Length);
Array.Copy(bytes4, 0, bytes, (393 - 290) * 2, bytes4.Length);
Array.Copy(bytes5, 0, bytes, (394 - 290) * 2, bytes5.Length);
Array.Copy(bytes6, 0, bytes, (398 - 290) * 2, bytes6.Length);
return PlcConnect.MelsecInstance2.Write("D290", bytes).IsSuccess;
return PlcConnect.PlcWriteBytes2("D290", bytes).IsSuccess;
}
/// <summary>
@ -141,6 +143,8 @@ namespace HighWayIot.Plc.PlcHelper
if (value == null)
{
// 根据业务需求选择返回false或使用默认值例如0
value = 0;
add++;
continue;
//if (PlcConnect.PlcWrite2($"D{add}", 0, DataTypeEnum.UInt16).IsSuccess)
// return false;
@ -159,7 +163,7 @@ namespace HighWayIot.Plc.PlcHelper
}
// 写入PLC并检查结果
var resultbytes = BitConverter.GetBytes(valueToWrite);
byte[] resultbytes = BitConverter.GetBytes(valueToWrite);
Array.Copy(resultbytes, 0, bytes, (add - 290) * 2, resultbytes.Length);
//if (!PlcConnect.PlcWrite2($"D{add}", valueToWrite, DataTypeEnum.UInt16).IsSuccess)
// return false;
@ -169,13 +173,17 @@ namespace HighWayIot.Plc.PlcHelper
return bytes;
}
#endregion
#region 读取
/// <summary>
/// 从PLC中读取数据
/// </summary>
public List<ZxRecipePositionParaEntity> DownLoadFormPlc(ref ZxRecipeParaEntity paraEntity)
{
//一次性读取
OperateResult<byte[]> result = PlcConnect.MelsecInstance2.Read("D290", 120);
OperateResult<byte[]> result = PlcConnect.ReadByte2("D290", 120);
byte[] data;
if (result.IsSuccess)
{
@ -187,7 +195,7 @@ namespace HighWayIot.Plc.PlcHelper
}
//读取SPEC编号
paraEntity.SpecCode = PlcConnect.MelsecInstance2.ReadUInt32("D206").ToString();
paraEntity.SpecCode = PlcConnect.ReadUInt322("D206").Content.ToString();
//读取SPEC名称
paraEntity.SpecName = PlcConnect.MelsecInstance2.ByteTransform.TransString(data, 0, 10, Encoding.ASCII);
@ -217,7 +225,7 @@ namespace HighWayIot.Plc.PlcHelper
}
/// <summary>
/// 分类工位循环写入
/// 分类工位循环读取
/// </summary>
/// <param name=""></param>
/// <returns></returns>
@ -262,5 +270,7 @@ namespace HighWayIot.Plc.PlcHelper
return entity;
}
#endregion
}
}

@ -18,7 +18,7 @@ namespace HighWayIot.Plc.PlcHelper
{
Dictionary<int, bool> result = new Dictionary<int, bool>();
OperateResult<byte[]> operateResult = PlcConnect.MelsecInstance2.Read("B991", 8);
OperateResult<byte[]> operateResult = PlcConnect.ReadByte2("B901", 8);
if (!operateResult.IsSuccess)
{
@ -35,7 +35,7 @@ namespace HighWayIot.Plc.PlcHelper
boolIndex++;
}
for (int i = 0x941 - 0x941; i < 0x97E - 0x941 + 1; i++)
for (int i = 0x941 - 0x901; i < 0x97E - 0x901 + 1; i++)
{
result.Add(boolIndex, bytes[i / 8].GetBoolByIndex(i % 8));
boolIndex++;

@ -9,7 +9,7 @@ using System.Threading.Tasks;
namespace HighWayIot.Plc.PlcHelper
{
/// <summary>
/// 中专信号点位读写
/// 中专信号点位读写(暂时米用)
/// </summary>
public class TransferSingal
{
@ -25,19 +25,19 @@ namespace HighWayIot.Plc.PlcHelper
switch (stationNo)
{
case 1:
result = PlcConnect.MelsecInstance2.Write("B201", true).IsSuccess;
result = PlcConnect.PlcWrite2("B201", true, DataTypeEnum.Bool).IsSuccess;
break;
case 2:
result = PlcConnect.MelsecInstance2.Write("B202", true).IsSuccess;
result = PlcConnect.PlcWrite2("B202", true, DataTypeEnum.Bool).IsSuccess;
break;
case 3:
result = PlcConnect.MelsecInstance2.Write("B203", true).IsSuccess;
result = PlcConnect.PlcWrite2("B203", true, DataTypeEnum.Bool).IsSuccess;
break;
case 4:
result = PlcConnect.MelsecInstance2.Write("B205", true).IsSuccess;
result = PlcConnect.PlcWrite2("B205", true, DataTypeEnum.Bool).IsSuccess;
break;
case 5:
result = PlcConnect.MelsecInstance2.Write("B207", true).IsSuccess;
result = PlcConnect.PlcWrite2("B207", true, DataTypeEnum.Bool).IsSuccess;
break;
default:
break;
@ -59,19 +59,19 @@ namespace HighWayIot.Plc.PlcHelper
switch (stationNo)
{
case 1:
result = PlcConnect.MelsecInstance2.Write("B211", true).IsSuccess;
result = PlcConnect.PlcWrite2("B211", true, DataTypeEnum.Bool).IsSuccess;
break;
case 2:
result = PlcConnect.MelsecInstance2.Write("B212", true).IsSuccess;
result = PlcConnect.PlcWrite2("B212", true, DataTypeEnum.Bool).IsSuccess;
break;
case 3:
result = PlcConnect.MelsecInstance2.Write("B213", true).IsSuccess;
result = PlcConnect.PlcWrite2("B213", true, DataTypeEnum.Bool).IsSuccess;
break;
case 4:
result = PlcConnect.MelsecInstance2.Write("B215", true).IsSuccess;
result = PlcConnect.PlcWrite2("B215", true, DataTypeEnum.Bool).IsSuccess;
break;
case 5:
result = PlcConnect.MelsecInstance2.Write("B217", true).IsSuccess;
result = PlcConnect.PlcWrite2("B217", true, DataTypeEnum.Bool).IsSuccess;
break;
default:
break;
@ -86,7 +86,7 @@ namespace HighWayIot.Plc.PlcHelper
/// <returns>第一个Byte数组是第二个Byte数组是开始横裁信号第三个是结束横裁信号</returns>
public bool[][] ReadDrumReadyAndCountReadySignal()
{
OperateResult<byte[]> operateResult = PlcConnect.MelsecInstance2.Read("B980", 3);
OperateResult<byte[]> operateResult = PlcConnect.ReadByte2("B980", 3);
if (!operateResult.IsSuccess)
{
@ -123,7 +123,7 @@ namespace HighWayIot.Plc.PlcHelper
/// <returns></returns>
public bool[][] ReadMonitorSingal()
{
OperateResult<byte[]> operateResult = PlcConnect.MelsecInstance2.Read("B9B1", 5);
OperateResult<byte[]> operateResult = PlcConnect.ReadByte2("B9B1", 5);
if (!operateResult.IsSuccess)
{
@ -150,7 +150,7 @@ namespace HighWayIot.Plc.PlcHelper
/// <returns></returns>
public List<StationRecipeEntity> ReadStationRecipeInfo()
{
OperateResult<byte[]> operateResult = PlcConnect.MelsecInstance2.Read("W950", 80);
OperateResult<byte[]> operateResult = PlcConnect.ReadByte2("W950", 80);
if (!operateResult.IsSuccess)
{

@ -3,6 +3,7 @@ using HighWayIot.Plc.PlcEntity;
using HslCommunication;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -28,12 +29,14 @@ namespace HighWayIot.Plc.PlcHelper
//选择是小车的哪个点位
point += rgvStationNo - 1;
bool result = PlcConnect.MelsecInstance2.Write($"B{point.ToString("X")}", true).IsSuccess;
if (result)
{
LogHelper.Instance.Info($"B{point.ToString("X")} 点置True");
}
//Stopwatch sw = new Stopwatch();
//sw.Start();
bool result = PlcConnect.PlcWrite2($"B{point.ToString("X")}", true, DataTypeEnum.Bool).IsSuccess;
//sw.Stop();
//if (result)
//{
// LogHelper.Instance.Info($"B{point.ToString("X")} 点置True 点写入耗时[{sw.ElapsedMilliseconds}]");
//}
return result;
}
@ -43,8 +46,11 @@ namespace HighWayIot.Plc.PlcHelper
public bool[] ReadStationSingal()
{
bool[] result = new bool[17];
OperateResult<byte[]> PlcResult = PlcConnect.MelsecInstance2.Read("B230", 2);
//Stopwatch sw = new Stopwatch();
//sw.Start();
OperateResult<byte[]> PlcResult = PlcConnect.ReadByte2("B230", 2);
//sw.Stop();
//LogHelper.Instance.Info($"工位识别 字段读取耗时[{sw.ElapsedMilliseconds}]");
byte[] data = PlcResult.Content;

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -14,116 +15,139 @@ namespace HighWayIot.Repository.domain
/// <summary>
/// 成品代号
/// </summary>
[Description("成品代号")]
public string RecipeCode { get; set; } = string.Empty;
/// <summary>
/// 标称尺度
/// </summary>
[Description("标称尺度")]
public string RecipeName { get; set; } = string.Empty;
/// <summary>
/// SPEC编号
/// </summary>
[Description("SPEC编号")]
public string SpecCode { get; set; } = string.Empty;
/// <summary>
/// SPEC规格
/// SPEC规格
/// </summary>
[Description("SPEC规格")]
public string SpecName { get; set; } = string.Empty;
/// <summary>
/// 开始时间
/// </summary>
[Description("开始时间")]
public string StartTime { get; set; } = string.Empty;
/// <summary>
/// 基部胶胶号
/// </summary>
[Description("基部胶胶号")]
public string BaseRubName { get; set; } = string.Empty;
/// <summary>
/// 基部胶厚度
/// </summary>
/// </summary
[Description("基部胶厚度")]
public string BaseRubThickness { get; set; } = string.Empty;
/// <summary>
/// 基部胶宽度
/// </summary>
/// </summary
[Description("基部胶宽度")]
public string BaseRubWidth { get; set; } = string.Empty;
/// <summary>
/// 基部胶层数
/// </summary>
[Description("基部胶层数")]
public string BaseRubLayer { get; set; } = string.Empty;
/// <summary>
/// 基部胶完成时间
/// </summary>
[Description("基部胶完成时间")]
public string BaseRubFinishTime { get; set; } = string.Empty;
/// <summary>
/// 中层胶胶号
/// </summary>
[Description("中层胶胶号")]
public string MidRubName { get; set; } = string.Empty;
/// <summary>
/// 中层胶厚度
/// </summary>
[Description("中层胶厚度")]
public string MidRubThickness { get; set; } = string.Empty;
/// <summary>
/// 中层胶宽度
/// </summary>
[Description("中层胶宽度")]
public string MidRubWidth { get; set; } = string.Empty;
/// <summary>
/// 中层胶层数
/// </summary>
[Description("中层胶层数")]
public string MidRubLayer { get; set; } = string.Empty;
/// <summary>
/// 中层胶完成时间
/// </summary>
[Description("中层胶完成时间")]
public string MidRubFinishTime { get; set; } = string.Empty;
/// <summary>
/// 胎面胶胶号
/// </summary>
[Description("胎面胶胶号")]
public string FaceRubName { get; set; } = string.Empty;
/// <summary>
/// 胎面胶厚度
/// </summary>
[Description("胎面胶厚度")]
public string FaceRubThickness { get; set; } = string.Empty;
/// <summary>
/// 胎面胶
/// 胎面胶
/// </summary>
public string FaceRubWidth1 { get; set; } = string.Empty;
[Description("胎面胶层数")]
public string FaceRubLayer { get; set; } = string.Empty;
/// <summary>
/// 胎边胶宽度
/// </summary>
public string FaceRubWidth2 { get; set; } = string.Empty;
/// 胎面胶宽度
/// </summary
[Description("胎面胶宽度")]
public string FaceRubWidth { get; set; } = string.Empty;
/// <summary>
/// 生胎完成时间
/// </summary>
[Description("生胎完成时间")]
public string FaceRubFinishTime { get; set; } = string.Empty;
/// <summary>
/// 生胎宽度(胎面胶宽度 +(厚度*2 无中层胶就等于胎面胶宽度
/// </summary>
[Description("生胎宽度")]
public string RawTireWidth { get; set; } = string.Empty;
/// <summary>
/// 生胎重量
/// </summary>
[Description("生胎重量")]
public string RawTireWeight { get; set; } = string.Empty;
/// <summary>
/// 复重重量
/// </summary>
[Description("复重重量")]
public string RepeatWeight { get; set; } = string.Empty;
}
}

@ -110,6 +110,13 @@ namespace HighWayIot.Repository.domain
[SugarColumn(ColumnName = "face_end_time")]
public DateTime? FaceEndTime { get; set; }
/// <summary>
/// 备 注:复重重量
/// 默认值:
/// </summary>
[SugarColumn(ColumnName = "repeat_weight")]
public int? RepeatWeight { get; set; }
/// <summary>
/// 备 注:是否已完成(0未完成 1完成 2中止)
/// 默认值:

@ -67,6 +67,13 @@ namespace Models
///</summary>
[SugarColumn(ColumnName = "set_width_2")]
public decimal? SetWidth2 { get; set; }
/// <summary>
/// 备 注:宽度3
/// 默认值:
///</summary>
[SugarColumn(ColumnName = "set_width_3")]
public decimal? SetWidth3 { get; set; }
/// <summary>
/// 备 注:层数
@ -81,6 +88,13 @@ namespace Models
///</summary>
[SugarColumn(ColumnName = "set_layer_2")]
public int? SetLayer2 { get; set; }
/// <summary>
/// 备 注:层数3
/// 默认值:
///</summary>
[SugarColumn(ColumnName = "set_layer_3")]
public int? SetLayer3 { get; set; }
/// <summary>
/// 备 注:重量

@ -67,5 +67,6 @@ namespace HighWayIot.Repository.service
return false;
}
}
}
}

@ -116,6 +116,24 @@ namespace HighWayIot.Repository.service
}
}
/// <summary>
/// ID删除配方字段信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public bool DeleteRecipeParaInfoByRecipeCode(string recipeCode)
{
try
{
return _repository.Delete(x => x.RecipeCode == recipeCode);
}
catch (Exception ex)
{
log.Error("配方字段信息删除异常", ex);
return false;
}
}
/// <summary>
/// 清除脏数据
/// </summary>

@ -135,6 +135,24 @@ namespace HighWayIot.Repository.service
}
}
/// <summary>
/// ID删除工位配方字段信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public bool DeleteRecipePositionParaInfoByRecipeCode(string recipeCode)
{
try
{
return _repository.Delete(x => x.RecipeCode == recipeCode);
}
catch (Exception ex)
{
log.Error("工位配方字段信息删除异常", ex);
return false;
}
}
/// <summary>
/// 清除脏数据
/// </summary>

@ -82,25 +82,6 @@ namespace HighWayIot.Repository.service
}
}
/// <summary>
/// 根据成品代号查询条配方参数
/// </summary>
/// <param name="recipeName"></param>
/// <returns></returns>
public ZxRecipeEntity GetSingleInfoByRecipeCode(string recipeCode)
{
try
{
ZxRecipeEntity entity = _repository.GetSingle(x => x.RecipeCode == recipeCode && x.IsDeleted == false);
return entity;
}
catch (Exception ex)
{
log.Error("根据一个成品代号查询到多条配方信息", ex);
return null;
}
}
/// <summary>
/// 获取所有配方名称
/// </summary>

@ -25,6 +25,24 @@ namespace HighWayIot.Repository.service
private LogHelper log = LogHelper.Instance;
Repository<ZxWeightEntity> _repository => new Repository<ZxWeightEntity>("sqlserver");
/// <summary>
/// 查询所有称重信息
/// </summary>
/// <returns></returns>
public List<ZxWeightEntity> GetWeightInfos()
{
try
{
List<ZxWeightEntity> entity = _repository.GetList(x => x.IsDeleted == false);
return entity;
}
catch (Exception ex)
{
log.Error("称量信息获取异常", ex);
return null;
}
}
/// <summary>
/// 根据配方编号查询称量信息
/// </summary>

@ -80,9 +80,9 @@ namespace HighWayIot.Rfid
{
Array.Copy(data, index, EPCData.EPC, 0, 12);
}
catch
catch (Exception ex)
{
Log4net.LogHelper.Instance.Error(ex.Message);
return null;
}
index += 12;
@ -124,5 +124,15 @@ namespace HighWayIot.Rfid
uint result = BitConverter.ToUInt32(data, 0);
return result;
}
/// <summary>
/// 发送功率设置包
/// </summary>
/// <param name="power"></param>
/// <returns></returns>
public byte[] Send42H(int power)
{
return new byte[0];
}
}
}

@ -36,22 +36,22 @@
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
<Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
<Reference Include="System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
<Reference Include="System.Numerics.Vectors, Version=4.1.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.0\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.3\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />

@ -16,15 +16,15 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
<bindingRedirect oldVersion="0.0.0.0-4.2.4.0" newVersion="4.2.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0" />
<bindingRedirect oldVersion="0.0.0.0-6.0.3.0" newVersion="6.0.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
<package id="System.Buffers" version="4.6.0" targetFramework="net48" />
<package id="System.Memory" version="4.6.0" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.6.0" targetFramework="net48" />
<package id="System.Buffers" version="4.6.1" targetFramework="net48" />
<package id="System.Memory" version="4.6.3" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.6.3" targetFramework="net48" />
<package id="TouchSocket" version="3.0.12" targetFramework="net48" />
<package id="TouchSocket.Core" version="3.0.12" targetFramework="net48" />
</packages>

@ -15,7 +15,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<!--<dependentAssembly>
<assemblyIdentity name="TouchSocket.Core" publicKeyToken="d6c415a2f58eda72" culture="neutral" />
@ -23,15 +23,19 @@
</dependentAssembly>-->
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
<bindingRedirect oldVersion="0.0.0.0-4.2.4.0" newVersion="4.2.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0" />
<bindingRedirect oldVersion="0.0.0.0-6.0.3.0" newVersion="6.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.6.0" newVersion="4.1.6.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

@ -2,11 +2,13 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace HighWayIot.Winform.Business
@ -125,7 +127,7 @@ namespace HighWayIot.Winform.Business
/// <returns></returns>
public static string DateTimeToString(DateTime? dateTimeStart, DateTime? dateTimeEnd)
{
if(dateTimeEnd == null || dateTimeStart == null)
if (dateTimeEnd == null || dateTimeStart == null)
{
return string.Empty;
}
@ -145,5 +147,6 @@ namespace HighWayIot.Winform.Business
return result;
}
}
}

@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Schema;
using Timer = System.Threading.Timer;
@ -35,7 +36,7 @@ namespace HighWayIot.Winform.Business
public RecipeSendBusiness()
{
//GetSchedulingTimer = new Timer(new System.Threading.TimerCallback(ReadSignal), null, 0, 1000);
GetSchedulingTimer = new Timer(new System.Threading.TimerCallback(ReadSignal), null, 0, 1500);
}
/// <summary>
@ -51,51 +52,72 @@ namespace HighWayIot.Winform.Business
return;
}
foreach (var item in a)
int destinationVulcanizationNo;
var ares = a.Where(x => x.Value == true).ToList();
if (ares.Count == 1)
{
if (item.Value)
destinationVulcanizationNo = ares[0].Key;
}
else
{
if(ares.Count > 1)
{
var schedulingInfo = zxSchedulingService.GetSchedulingInfo();
string recipeNo;
ZxRecipeParaEntity recipeParaInfo;
List<ZxRecipePositionParaEntity> zxRecipePositionParaEntities;
if ((item.Key + 1) <= 62)
{
recipeNo = schedulingInfo.Single(x => x.Id == item.Key + 1).RecipeCode1;
recipeParaInfo = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(recipeNo).FirstOrDefault();
zxRecipePositionParaEntities = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == recipeNo);
if (recipeParaInfo == null)
{
LogHelper.Instance.Error("配方信息获取失败");
return;
}
if (recipeParaHelper.UploadToPLC(recipeParaInfo, zxRecipePositionParaEntities))
{
PlcConnect.MelsecInstance2.Write($"B{(item.Key + 0x901).ToString("X")}", false);
int deviceNo = schedulingInfo.Single(x => x.Id == item.Key + 1).DeviceNo ?? 0;
MonitorInsert(recipeNo, $"{deviceNo}上模");
}
}
else
{
recipeNo = schedulingInfo.Single(x => x.Id == item.Key + 1).RecipeCode2;
recipeParaInfo = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(recipeNo).FirstOrDefault();
zxRecipePositionParaEntities = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == recipeNo);
if (recipeParaInfo == null)
{
LogHelper.Instance.Error("配方信息获取失败");
return;
}
if (recipeParaHelper.UploadToPLC(recipeParaInfo, zxRecipePositionParaEntities))
{
PlcConnect.MelsecInstance2.Write($"B{(item.Key + 0x941).ToString("X")}", false);
int deviceNo = schedulingInfo.Single(x => x.Id == item.Key + 1 - 62).DeviceNo ?? 0;
MonitorInsert(recipeNo, $"{deviceNo}下模");
}
}
LogHelper.Instance.Error($"排程信号True值不唯一 {string.Join(", " , ares.Select(x => x.Key).ToList())}");
}
return;
}
var schedulingInfo = zxSchedulingService.GetSchedulingInfo();
string recipeNo;
ZxRecipeParaEntity recipeParaInfo;
List<ZxRecipePositionParaEntity> zxRecipePositionParaEntities;
if ((destinationVulcanizationNo + 1) <= 62)
{
recipeNo = schedulingInfo.Single(x => x.Id == destinationVulcanizationNo + 1).RecipeCode1;
recipeParaInfo = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(recipeNo).FirstOrDefault();
zxRecipePositionParaEntities = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == recipeNo);
if (recipeParaInfo == null)
{
LogHelper.Instance.Error("配方信息获取失败");
return;
}
if (recipeParaHelper.UploadToPLC(recipeParaInfo, zxRecipePositionParaEntities))
{
PlcConnect.PlcWrite2($"B{(destinationVulcanizationNo + 0x901).ToString("X")}", false, DataTypeEnum.Bool);
int deviceNo = schedulingInfo.Single(x => x.Id == destinationVulcanizationNo + 1).DeviceNo ?? 0;
//MonitorInsert(recipeNo, $"{deviceNo}上模");
LogHelper.Instance.Info($"配方上传成功,配方号:{recipeNo},模具号:{deviceNo}上模");
}
else
{
LogHelper.Instance.Error("配方上传失败");
return;
}
}
else
{
recipeNo = schedulingInfo.Single(x => x.Id == destinationVulcanizationNo + 1 - 62).RecipeCode2;
recipeParaInfo = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(recipeNo).FirstOrDefault();
zxRecipePositionParaEntities = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == recipeNo);
if (recipeParaInfo == null)
{
LogHelper.Instance.Error("配方信息获取失败");
return;
}
if (recipeParaHelper.UploadToPLC(recipeParaInfo, zxRecipePositionParaEntities))
{
PlcConnect.PlcWrite2($"B{(destinationVulcanizationNo - 62 + 0x941).ToString("X")}", false, DataTypeEnum.Bool);
int deviceNo = schedulingInfo.Single(x => x.Id == destinationVulcanizationNo + 1 - 62).DeviceNo ?? 0;
//MonitorInsert(recipeNo, $"{deviceNo}下模");
LogHelper.Instance.Info($"配方上传成功,配方号:{recipeNo},模具号:{deviceNo}下模");
}
else
{
LogHelper.Instance.Error("配方上传失败");
return;
}
}
}
/// <summary>
@ -118,6 +140,7 @@ namespace HighWayIot.Winform.Business
RecipeCode = recipeEntity.RecipeCode,
SpecCode = recipeEntity.RecipeSpecCode,
DeviceNo = RecipeNeededVehicleNo,
RawTireWeight = (int)ZxRecipeParaService.Instance.GetRecipeParaInfoByRecipeCode(recipeCode).FirstOrDefault()?.TireWeight,
IsDone = 0
};

@ -66,6 +66,11 @@ namespace HighWayIot.Winform.Business
/// </summary>
private Timer _heartbeatTimer;
/// <summary>
/// 锁对象
/// </summary>
private static readonly object _heartBeatLocker = new object();
/// <summary>
/// 工位识别历史记录
/// </summary>
@ -84,6 +89,7 @@ namespace HighWayIot.Winform.Business
public void ReciveDataRoute(byte[] bytes, string ip)
{
BaseReciveDataEntity reciveData = BaseRFIDDataAnalyse.BaseReceiveAnalyse(bytes);
if (reciveData == null)
{
return;
@ -158,7 +164,7 @@ namespace HighWayIot.Winform.Business
// return;
// }
//}
///写入对应的PLC信号
//写入对应的PLC信号
if (_workStationHelper.WriteStationSingal(stationNo, vehicleNo))
{
////写入成功后记录,上次已写入了该点位,不继续写入
@ -170,7 +176,7 @@ namespace HighWayIot.Winform.Business
//{
// StationRecord.Add(stationNo, vehicleNo);
//}
LogHelper.Instance.RfidLog($"{workstationNo}工位, {deviceNo}号车 [{DateTime.Now.ToString("yy-MM-dd HH:mm:ss:fff")}]");
LogHelper.Instance.RfidLog($"{workstationNo}工位, {deviceNo}号车 写入成功[{DateTime.Now.ToString("yy-MM-dd HH:mm:ss:fff")}]");
}
else
{

@ -86,6 +86,7 @@ namespace HighWayIot.Winform.Business
{
_touchSocketTcpClient.CreateTcpClient(setting.RfidIp, "20108");
_touchSocketTcpClient.Send(setting.RfidIp, _RfidDataAnalyse.SendBFH(3));
// _touchSocketTcpClient.Send(setting.RfidIp, _RfidDataAnalyse.Send)
});
}

@ -12,6 +12,22 @@
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>D:\WorkCode\DLML-SCADA\publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -30,17 +46,96 @@
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<WarningLevel>2</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>93BA197982FA90C2B1881421690AC335C9DA5029</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>HighWayIot.Winform_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
<HintPath>..\packages\BouncyCastle.Cryptography.2.3.1\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
</Reference>
<Reference Include="Enums.NET, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7ea1c1650d506225, processorArchitecture=MSIL">
<HintPath>..\packages\Enums.NET.4.0.1\lib\net45\Enums.NET.dll</HintPath>
</Reference>
<Reference Include="ExtendedNumerics.BigDecimal, Version=2025.1001.2.129, Culture=neutral, PublicKeyToken=65f1315a45ad8949, processorArchitecture=MSIL">
<HintPath>..\packages\ExtendedNumerics.BigDecimal.2025.1001.2.129\lib\net48\ExtendedNumerics.BigDecimal.dll</HintPath>
</Reference>
<Reference Include="HslCommunication">
<HintPath>..\HighWayIot.Library\HslCommunication.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.4.2.13, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.4.2\lib\netstandard2.0\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="MathNet.Numerics, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cd8b63ad3d691a37, processorArchitecture=MSIL">
<HintPath>..\packages\MathNet.Numerics.Signed.5.0.0\lib\net48\MathNet.Numerics.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IO.RecyclableMemoryStream, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IO.RecyclableMemoryStream.3.0.0\lib\netstandard2.0\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
</Reference>
<Reference Include="NPOI.Core, Version=2.7.3.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\packages\NPOI.2.7.3\lib\net472\NPOI.Core.dll</HintPath>
</Reference>
<Reference Include="NPOI.OOXML, Version=2.7.3.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\packages\NPOI.2.7.3\lib\net472\NPOI.OOXML.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXml4Net, Version=2.7.3.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\packages\NPOI.2.7.3\lib\net472\NPOI.OpenXml4Net.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXmlFormats, Version=2.7.3.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\packages\NPOI.2.7.3\lib\net472\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13, processorArchitecture=MSIL">
<HintPath>..\packages\SixLabors.Fonts.1.0.1\lib\netstandard2.0\SixLabors.Fonts.dll</HintPath>
</Reference>
<Reference Include="SixLabors.ImageSharp, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13, processorArchitecture=MSIL">
<HintPath>..\packages\SixLabors.ImageSharp.2.1.10\lib\net472\SixLabors.ImageSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.Security.Cryptography.Pkcs, Version=8.0.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Pkcs.8.0.1\lib\net462\System.Security.Cryptography.Pkcs.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Xml, Version=8.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Xml.8.0.2\lib\net462\System.Security.Cryptography.Xml.dll</HintPath>
</Reference>
<Reference Include="System.Text.Encoding.CodePages, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encoding.CodePages.5.0.0\lib\net461\System.Text.Encoding.CodePages.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.3\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@ -307,6 +402,8 @@
<EmbeddedResource Include="UserControlPages\SysConfigPages\UserUpDateForm.resx">
<DependentUpon>UserUpDateForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="HighWayIot.Winform_TemporaryKey.pfx" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -373,5 +470,17 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.8 %28x86 和 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -50,8 +50,10 @@ namespace HighWayIot.Winform.MainForm
this.MaterialConfigStripItem = new System.Windows.Forms.ToolStripMenuItem();
this.MaterialTypeConfigStripItem = new System.Windows.Forms.ToolStripMenuItem();
this.RecipeConfigStripItem = new System.Windows.Forms.ToolStripMenuItem();
this.TestMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.rToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.rFIDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.TestMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.UserControlTabs = new System.Windows.Forms.TabControl();
this.ClosePageButton = new System.Windows.Forms.Button();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
@ -62,16 +64,12 @@ namespace HighWayIot.Winform.MainForm
this.SplitLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
this.LogInformationToolStrip = new System.Windows.Forms.ToolStripStatusLabel();
this.SplitLabel3 = new System.Windows.Forms.ToolStripStatusLabel();
this.Label1 = new System.Windows.Forms.ToolStripStatusLabel();
this.OpenMixStateLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.Label2 = new System.Windows.Forms.ToolStripStatusLabel();
this.MolderStateLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.SplitLabel4 = new System.Windows.Forms.ToolStripStatusLabel();
this.StripLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
this.TimeStripLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.TimeDisplayTimer = new System.Windows.Forms.Timer(this.components);
this.rFIDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.MainMenu.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
@ -225,14 +223,6 @@ namespace HighWayIot.Winform.MainForm
this.RecipeConfigStripItem.Text = "配方管理";
this.RecipeConfigStripItem.Click += new System.EventHandler(this.StripMenuItemClick);
//
// TestMenuItem
//
this.TestMenuItem.Image = global::HighWayIot.Winform.Properties.Resources.PLC;
this.TestMenuItem.Name = "TestMenuItem";
this.TestMenuItem.Size = new System.Drawing.Size(105, 22);
this.TestMenuItem.Text = "PLC测试页面";
this.TestMenuItem.Click += new System.EventHandler(this.StripMenuItemClick);
//
// rToolStripMenuItem
//
this.rToolStripMenuItem.Image = global::HighWayIot.Winform.Properties.Resources._03;
@ -241,6 +231,30 @@ namespace HighWayIot.Winform.MainForm
this.rToolStripMenuItem.Text = "硫化排程";
this.rToolStripMenuItem.Click += new System.EventHandler(this.StripMenuItemClick);
//
// rFID参数配置ToolStripMenuItem
//
this.rFIDToolStripMenuItem.Image = global::HighWayIot.Winform.Properties.Resources._165_RFID;
this.rFIDToolStripMenuItem.Name = "rFID参数配置ToolStripMenuItem";
this.rFIDToolStripMenuItem.Size = new System.Drawing.Size(111, 22);
this.rFIDToolStripMenuItem.Text = "RFID参数配置";
this.rFIDToolStripMenuItem.Click += new System.EventHandler(this.StripMenuItemClick);
//
// 机台物料信息绑定ToolStripMenuItem1
//
this.ToolStripMenuItem1.Image = global::HighWayIot.Winform.Properties.Resources.;
this.ToolStripMenuItem1.Name = "机台物料信息绑定ToolStripMenuItem1";
this.ToolStripMenuItem1.Size = new System.Drawing.Size(132, 22);
this.ToolStripMenuItem1.Text = "机台物料信息绑定";
this.ToolStripMenuItem1.Click += new System.EventHandler(this.StripMenuItemClick);
//
// TestMenuItem
//
this.TestMenuItem.Image = global::HighWayIot.Winform.Properties.Resources.PLC;
this.TestMenuItem.Name = "TestMenuItem";
this.TestMenuItem.Size = new System.Drawing.Size(105, 22);
this.TestMenuItem.Text = "PLC测试页面";
this.TestMenuItem.Click += new System.EventHandler(this.StripMenuItemClick);
//
// UserControlTabs
//
this.UserControlTabs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -279,8 +293,6 @@ namespace HighWayIot.Winform.MainForm
this.SplitLabel2,
this.LogInformationToolStrip,
this.SplitLabel3,
this.Label1,
this.OpenMixStateLabel,
this.Label2,
this.MolderStateLabel,
this.SplitLabel4,
@ -325,7 +337,7 @@ namespace HighWayIot.Winform.MainForm
// LogInformationToolStrip
//
this.LogInformationToolStrip.Name = "LogInformationToolStrip";
this.LogInformationToolStrip.Size = new System.Drawing.Size(1280, 17);
this.LogInformationToolStrip.Size = new System.Drawing.Size(1400, 17);
this.LogInformationToolStrip.Spring = true;
this.LogInformationToolStrip.Text = "message";
//
@ -335,18 +347,6 @@ namespace HighWayIot.Winform.MainForm
this.SplitLabel3.Name = "SplitLabel3";
this.SplitLabel3.Size = new System.Drawing.Size(4, 17);
//
// Label1
//
this.Label1.Name = "Label1";
this.Label1.Size = new System.Drawing.Size(89, 17);
this.Label1.Text = "开炼PLC状态";
//
// OpenMixStateLabel
//
this.OpenMixStateLabel.Name = "OpenMixStateLabel";
this.OpenMixStateLabel.Size = new System.Drawing.Size(31, 17);
this.OpenMixStateLabel.Text = "N/A";
//
// Label2
//
this.Label2.Name = "Label2";
@ -382,22 +382,6 @@ namespace HighWayIot.Winform.MainForm
this.TimeDisplayTimer.Interval = 1000;
this.TimeDisplayTimer.Tick += new System.EventHandler(this.TimeDisplayTimer_Tick);
//
// rFID参数配置ToolStripMenuItem
//
this.rFIDToolStripMenuItem.Image = global::HighWayIot.Winform.Properties.Resources._165_RFID;
this.rFIDToolStripMenuItem.Name = "rFID参数配置ToolStripMenuItem";
this.rFIDToolStripMenuItem.Size = new System.Drawing.Size(111, 22);
this.rFIDToolStripMenuItem.Text = "RFID参数配置";
this.rFIDToolStripMenuItem.Click += new System.EventHandler(this.StripMenuItemClick);
//
// 机台物料信息绑定ToolStripMenuItem1
//
this.ToolStripMenuItem1.Image = global::HighWayIot.Winform.Properties.Resources.;
this.ToolStripMenuItem1.Name = "机台物料信息绑定ToolStripMenuItem1";
this.ToolStripMenuItem1.Size = new System.Drawing.Size(132, 22);
this.ToolStripMenuItem1.Text = "机台物料信息绑定";
this.ToolStripMenuItem1.Click += new System.EventHandler(this.StripMenuItemClick);
//
// BaseForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -454,8 +438,6 @@ namespace HighWayIot.Winform.MainForm
private ToolStripStatusLabel SplitLabel2;
private ToolStripStatusLabel SplitLabel3;
private ToolStripStatusLabel SplitLabel4;
private ToolStripStatusLabel Label1;
private ToolStripStatusLabel OpenMixStateLabel;
private ToolStripStatusLabel Label2;
private ToolStripStatusLabel MolderStateLabel;
private ToolStripMenuItem rToolStripMenuItem;

@ -93,6 +93,7 @@ namespace HighWayIot.Winform.MainForm
NowLoginUserName.Text = RoleBusiness.LoginUserName;
UserPanelSwitch(typeof(MonitorMainPage), "监控主页面");
RoleControl();
SqlLogHelper.AddLog($"用户[{RoleBusiness.LoginUserName}]登录成功");
WatchDogTimer = new System.Threading.Timer(WarchDogJudge, null, 0, 2000); // 每2秒执行一次
LogRefreshAction += (log) =>
{

@ -50,7 +50,7 @@ namespace HighWayIot.Winform
}
catch(Exception ex)
{
logger.Error("程序初始化异常", ex);
logger.Error("程序异常", ex);
}
}
}

@ -1,6 +1,7 @@
using HighWayIot.Repository.domain;
using HighWayIot.Repository.service;
using HighWayIot.Winform.Business;
using HighWayIot.Winform.UserControlPages.LogPages;
using System;
using System.Collections;
using System.Collections.Generic;
@ -24,6 +25,8 @@ namespace HighWayIot.Winform.UserControlPages
/// </summary>
private ZxDailyReportService _zxDailyReportService = ZxDailyReportService.Instance;
private List<ZxDailyReportEntity> dailyEntities = new List<ZxDailyReportEntity>();
/// <summary>
/// datagridview 数据源
/// 必须使用BindingList 如果使用LIST无法实现更改添加、删除数据源自动更新datagridview
@ -78,7 +81,8 @@ namespace HighWayIot.Winform.UserControlPages
private void DataRefresh()
{
List<ZxDailyReportEntity> dailyEntities =
dailyEntities.Clear();
this.dailyEntities =
_zxDailyReportService.GetDailyReportInfos(x =>
x.StartTime >= SelectStartTime.Value
&& x.StartTime <= SelectEndTime.Value
@ -114,7 +118,12 @@ namespace HighWayIot.Winform.UserControlPages
/// <param name="e"></param>
private void ExportTableButton_Click(object sender, EventArgs e)
{
ExportPreviewForm exportPreviewForm = new ExportPreviewForm(dailyEntities);
if (exportPreviewForm.ShowDialog() == DialogResult.OK)
{
//MessageBox.Show("导出成功");
}
}
}
}

@ -150,37 +150,4 @@
<metadata name="FaceRubTimeSpan.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="No.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="VulcanizationNo.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="StartTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RecipeCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RecipeName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SpecCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="DeviceNo.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RawTireWeight.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BaseRubTimeSpan.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="MidRubTimeSpan.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="FaceRubTimeSpan.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

@ -28,19 +28,365 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.RecipeCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RecipeName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SpecCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SpecName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.StartTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.BaseRubName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.BaseRubThickness = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.BaseRubWidth = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.BaseRubLayer = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.BaseRubFinishTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MidRubName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MidRubThickness = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MidRubWidth = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MidRubLayer = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MidRubFinishTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.FaceRubName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.FaceRubThickness = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.FaceRubWidth = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.FaceRubLayer = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RawTireWidth = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RawTireFinishTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RawTireWeight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RepeatWeight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ExportButton = new System.Windows.Forms.Button();
this.PathTextBox = new System.Windows.Forms.TextBox();
this.PathSelectButton = new System.Windows.Forms.Button();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
// dataGridView1
//
this.dataGridView1.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.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("新宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.RecipeCode,
this.RecipeName,
this.SpecCode,
this.SpecName,
this.StartTime,
this.BaseRubName,
this.BaseRubThickness,
this.BaseRubWidth,
this.BaseRubLayer,
this.BaseRubFinishTime,
this.MidRubName,
this.MidRubThickness,
this.MidRubWidth,
this.MidRubLayer,
this.MidRubFinishTime,
this.FaceRubName,
this.FaceRubThickness,
this.FaceRubWidth,
this.FaceRubLayer,
this.RawTireWidth,
this.RawTireFinishTime,
this.RawTireWeight,
this.RepeatWeight});
this.dataGridView1.Cursor = System.Windows.Forms.Cursors.IBeam;
this.dataGridView1.EnableHeadersVisualStyles = false;
this.dataGridView1.Location = new System.Drawing.Point(-238, 193);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.RowHeadersVisible = false;
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.Size = new System.Drawing.Size(1904, 985);
this.dataGridView1.TabIndex = 0;
//
// RecipeCode
//
this.RecipeCode.DataPropertyName = "RecipeCode";
this.RecipeCode.HeaderText = "成品代号";
this.RecipeCode.Name = "RecipeCode";
this.RecipeCode.Width = 59;
//
// RecipeName
//
this.RecipeName.DataPropertyName = "RecipeName";
this.RecipeName.FillWeight = 230.1951F;
this.RecipeName.HeaderText = "标称尺度";
this.RecipeName.Name = "RecipeName";
this.RecipeName.Width = 59;
//
// SpecCode
//
this.SpecCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.SpecCode.DataPropertyName = "SpecCode";
this.SpecCode.FillWeight = 244.9275F;
this.SpecCode.HeaderText = "SPEC编号";
this.SpecCode.Name = "SpecCode";
this.SpecCode.Width = 59;
//
// SpecName
//
this.SpecName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.SpecName.DataPropertyName = "SpecName";
this.SpecName.FillWeight = 88.53656F;
this.SpecName.HeaderText = "SPEC规格";
this.SpecName.Name = "SpecName";
this.SpecName.Width = 59;
//
// StartTime
//
this.StartTime.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.StartTime.DataPropertyName = "StartTime";
this.StartTime.FillWeight = 88.53656F;
this.StartTime.HeaderText = "开始时间";
this.StartTime.Name = "StartTime";
this.StartTime.Width = 59;
//
// BaseRubName
//
this.BaseRubName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.BaseRubName.DataPropertyName = "BaseRubName";
this.BaseRubName.FillWeight = 88.53656F;
this.BaseRubName.HeaderText = "基部胶胶号";
this.BaseRubName.Name = "BaseRubName";
this.BaseRubName.Width = 71;
//
// BaseRubThickness
//
this.BaseRubThickness.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.BaseRubThickness.DataPropertyName = "BaseRubThickness";
this.BaseRubThickness.FillWeight = 88.53656F;
this.BaseRubThickness.HeaderText = "基部胶厚度";
this.BaseRubThickness.Name = "BaseRubThickness";
this.BaseRubThickness.Width = 71;
//
// BaseRubWidth
//
this.BaseRubWidth.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.BaseRubWidth.DataPropertyName = "BaseRubWidth";
this.BaseRubWidth.FillWeight = 88.53656F;
this.BaseRubWidth.HeaderText = "基部胶宽度";
this.BaseRubWidth.Name = "BaseRubWidth";
this.BaseRubWidth.Width = 77;
//
// BaseRubLayer
//
this.BaseRubLayer.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.BaseRubLayer.DataPropertyName = "BaseRubLayer";
this.BaseRubLayer.FillWeight = 88.53656F;
this.BaseRubLayer.HeaderText = "基部胶层数";
this.BaseRubLayer.Name = "BaseRubLayer";
this.BaseRubLayer.Width = 77;
//
// BaseRubFinishTime
//
this.BaseRubFinishTime.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.BaseRubFinishTime.DataPropertyName = "BaseRubFinishTime";
this.BaseRubFinishTime.FillWeight = 88.53656F;
this.BaseRubFinishTime.HeaderText = "基部胶完成时间";
this.BaseRubFinishTime.Name = "BaseRubFinishTime";
this.BaseRubFinishTime.Width = 95;
//
// MidRubName
//
this.MidRubName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.MidRubName.DataPropertyName = "MidRubName";
this.MidRubName.FillWeight = 88.53656F;
this.MidRubName.HeaderText = "中层胶胶号";
this.MidRubName.Name = "MidRubName";
this.MidRubName.Width = 71;
//
// MidRubThickness
//
this.MidRubThickness.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.MidRubThickness.DataPropertyName = "MidRubThickness";
this.MidRubThickness.FillWeight = 88.53656F;
this.MidRubThickness.HeaderText = "中层胶厚度";
this.MidRubThickness.Name = "MidRubThickness";
this.MidRubThickness.Width = 71;
//
// MidRubWidth
//
this.MidRubWidth.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.MidRubWidth.DataPropertyName = "MidRubWidth";
this.MidRubWidth.FillWeight = 88.53656F;
this.MidRubWidth.HeaderText = "中层胶宽度";
this.MidRubWidth.Name = "MidRubWidth";
this.MidRubWidth.Width = 71;
//
// MidRubLayer
//
this.MidRubLayer.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.MidRubLayer.DataPropertyName = "MidRubLayer";
this.MidRubLayer.FillWeight = 88.53656F;
this.MidRubLayer.HeaderText = "中层胶层数";
this.MidRubLayer.Name = "MidRubLayer";
this.MidRubLayer.Width = 71;
//
// MidRubFinishTime
//
this.MidRubFinishTime.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.MidRubFinishTime.DataPropertyName = "MidRubFinishTime";
this.MidRubFinishTime.FillWeight = 88.53656F;
this.MidRubFinishTime.HeaderText = "中层胶完成时间";
this.MidRubFinishTime.Name = "MidRubFinishTime";
this.MidRubFinishTime.Width = 95;
//
// FaceRubName
//
this.FaceRubName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.FaceRubName.DataPropertyName = "FaceRubName";
this.FaceRubName.FillWeight = 88.53656F;
this.FaceRubName.HeaderText = "胎面胶胶号";
this.FaceRubName.Name = "FaceRubName";
this.FaceRubName.Width = 71;
//
// FaceRubThickness
//
this.FaceRubThickness.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.FaceRubThickness.DataPropertyName = "FaceRubThickness";
this.FaceRubThickness.FillWeight = 88.53656F;
this.FaceRubThickness.HeaderText = "胎面胶厚度";
this.FaceRubThickness.Name = "FaceRubThickness";
this.FaceRubThickness.Width = 71;
//
// FaceRubWidth
//
this.FaceRubWidth.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.FaceRubWidth.DataPropertyName = "FaceRubWidth";
this.FaceRubWidth.FillWeight = 88.53656F;
this.FaceRubWidth.HeaderText = "胎面胶宽度";
this.FaceRubWidth.Name = "FaceRubWidth";
this.FaceRubWidth.Width = 71;
//
// FaceRubLayer
//
this.FaceRubLayer.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.FaceRubLayer.DataPropertyName = "(无)FaceRubLayer";
this.FaceRubLayer.FillWeight = 88.53656F;
this.FaceRubLayer.HeaderText = "胎面胶层数";
this.FaceRubLayer.Name = "FaceRubLayer";
this.FaceRubLayer.Width = 71;
//
// RawTireWidth
//
this.RawTireWidth.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.RawTireWidth.DataPropertyName = "RawTireWidth";
this.RawTireWidth.FillWeight = 88.53656F;
this.RawTireWidth.HeaderText = "生胎宽度";
this.RawTireWidth.Name = "RawTireWidth";
this.RawTireWidth.Width = 59;
//
// RawTireFinishTime
//
this.RawTireFinishTime.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.RawTireFinishTime.DataPropertyName = "RawTireFinishTime";
this.RawTireFinishTime.FillWeight = 88.53656F;
this.RawTireFinishTime.HeaderText = "生胎完成时间";
this.RawTireFinishTime.Name = "RawTireFinishTime";
this.RawTireFinishTime.Width = 83;
//
// RawTireWeight
//
this.RawTireWeight.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.RawTireWeight.DataPropertyName = "RawTireWeight";
this.RawTireWeight.FillWeight = 88.53656F;
this.RawTireWeight.HeaderText = "生胎重量";
this.RawTireWeight.Name = "RawTireWeight";
this.RawTireWeight.Width = 59;
//
// RepeatWeight
//
this.RepeatWeight.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.RepeatWeight.DataPropertyName = "RepeatWeight";
this.RepeatWeight.FillWeight = 88.53656F;
this.RepeatWeight.HeaderText = "复重重量";
this.RepeatWeight.Name = "RepeatWeight";
this.RepeatWeight.Width = 59;
//
// ExportButton
//
this.ExportButton.Location = new System.Drawing.Point(9, 9);
this.ExportButton.Margin = new System.Windows.Forms.Padding(0);
this.ExportButton.Name = "ExportButton";
this.ExportButton.Size = new System.Drawing.Size(90, 38);
this.ExportButton.TabIndex = 1;
this.ExportButton.Text = "导出为EXCEL";
this.ExportButton.UseVisualStyleBackColor = true;
this.ExportButton.Click += new System.EventHandler(this.ExportButton_Click);
//
// PathTextBox
//
this.PathTextBox.Location = new System.Drawing.Point(102, 19);
this.PathTextBox.Name = "PathTextBox";
this.PathTextBox.Size = new System.Drawing.Size(364, 21);
this.PathTextBox.TabIndex = 2;
//
// PathSelectButton
//
this.PathSelectButton.Location = new System.Drawing.Point(472, 18);
this.PathSelectButton.Name = "PathSelectButton";
this.PathSelectButton.Size = new System.Drawing.Size(86, 23);
this.PathSelectButton.TabIndex = 3;
this.PathSelectButton.Text = "路径选择";
this.PathSelectButton.UseVisualStyleBackColor = true;
this.PathSelectButton.Click += new System.EventHandler(this.PathSelectButton_Click);
//
// ExportPreviewForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1904, 1041);
this.Controls.Add(this.PathSelectButton);
this.Controls.Add(this.PathTextBox);
this.Controls.Add(this.ExportButton);
this.Controls.Add(this.dataGridView1);
this.Name = "ExportPreviewForm";
this.Text = "导出预览";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ExportPreviewForm_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.Button ExportButton;
private System.Windows.Forms.TextBox PathTextBox;
private System.Windows.Forms.Button PathSelectButton;
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
private System.Windows.Forms.DataGridViewTextBoxColumn RecipeCode;
private System.Windows.Forms.DataGridViewTextBoxColumn RecipeName;
private System.Windows.Forms.DataGridViewTextBoxColumn SpecCode;
private System.Windows.Forms.DataGridViewTextBoxColumn SpecName;
private System.Windows.Forms.DataGridViewTextBoxColumn StartTime;
private System.Windows.Forms.DataGridViewTextBoxColumn BaseRubName;
private System.Windows.Forms.DataGridViewTextBoxColumn BaseRubThickness;
private System.Windows.Forms.DataGridViewTextBoxColumn BaseRubWidth;
private System.Windows.Forms.DataGridViewTextBoxColumn BaseRubLayer;
private System.Windows.Forms.DataGridViewTextBoxColumn BaseRubFinishTime;
private System.Windows.Forms.DataGridViewTextBoxColumn MidRubName;
private System.Windows.Forms.DataGridViewTextBoxColumn MidRubThickness;
private System.Windows.Forms.DataGridViewTextBoxColumn MidRubWidth;
private System.Windows.Forms.DataGridViewTextBoxColumn MidRubLayer;
private System.Windows.Forms.DataGridViewTextBoxColumn MidRubFinishTime;
private System.Windows.Forms.DataGridViewTextBoxColumn FaceRubName;
private System.Windows.Forms.DataGridViewTextBoxColumn FaceRubThickness;
private System.Windows.Forms.DataGridViewTextBoxColumn FaceRubWidth;
private System.Windows.Forms.DataGridViewTextBoxColumn FaceRubLayer;
private System.Windows.Forms.DataGridViewTextBoxColumn RawTireWidth;
private System.Windows.Forms.DataGridViewTextBoxColumn RawTireFinishTime;
private System.Windows.Forms.DataGridViewTextBoxColumn RawTireWeight;
private System.Windows.Forms.DataGridViewTextBoxColumn RepeatWeight;
}
}

@ -1,20 +1,312 @@
using System;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using HighWayIot.Repository.domain;
using HighWayIot.Repository.service;
using Models;
using HighWayIot.Winform.Business;
using System.Reflection;
namespace HighWayIot.Winform.UserControlPages.LogPages
{
public partial class ExportPreviewForm : Form
{
public ExportPreviewForm()
private string _savePath = string.Empty;
private List<ZxDailyReportEntity> _zxDailyReportEntities;
private List<ExportTableEntity> _exportTableEntities = new List<ExportTableEntity>();
private List<ZxWeightEntity> _zxWeightEntities;
private List<ZxRecipeEntity> _zxRecipeEntities;
private ZxWeightService _zxWeightService = ZxWeightService.Instance;
private ZxRecipeService _zxRecipeService = ZxRecipeService.Instance;
private DataTable dataTable;
public ExportPreviewForm(List<ZxDailyReportEntity> entity)
{
_zxDailyReportEntities = entity;
InitializeComponent();
Init();
}
}
private void Init()
{
dataGridView1.AutoGenerateColumns = false;
//查询所有称重信息
_zxWeightEntities = _zxWeightService.GetWeightInfos();
//查询所有配方信息
_zxRecipeEntities = _zxRecipeService.GetRecipeInfos();
//开始关联 生成报表
foreach(ZxDailyReportEntity rawEntity in _zxDailyReportEntities)
{
ExportTableEntity exportTableEntity = new ExportTableEntity();
ZxRecipeEntity recipeEntity = _zxRecipeEntities.Where(x => x.RecipeCode == rawEntity.RecipeCode).FirstOrDefault();
ZxWeightEntity baseWeight = _zxWeightEntities.Where(x => x.RecipeCode == rawEntity.RecipeCode && x.MaterialType == "基部胶").FirstOrDefault();
ZxWeightEntity midWeight = _zxWeightEntities.Where(x => x.RecipeCode == rawEntity.RecipeCode && x.MaterialType == "缓冲胶").FirstOrDefault();
ZxWeightEntity faceWeight = _zxWeightEntities.Where(x => x.RecipeCode == rawEntity.RecipeCode && x.MaterialType == "胎面胶").FirstOrDefault();
if (recipeEntity == null)
{
continue;
}
exportTableEntity.RecipeCode = rawEntity.RecipeCode;
exportTableEntity.RecipeName = rawEntity.RecipeName;
exportTableEntity.SpecCode = rawEntity.SpecCode;
exportTableEntity.SpecName = recipeEntity.RecipeSpecName;
exportTableEntity.StartTime = rawEntity.StartTime.ToString("yyyy-MM-dd hh:mm:ss");
//基部胶
if (baseWeight != null)
{
exportTableEntity.BaseRubName = baseWeight.MaterialName;
exportTableEntity.BaseRubThickness = baseWeight.SetThickness.ToString();
//基部胶宽度和层数(可能有两层
if (baseWeight.SetLayer2 == 0 || baseWeight.SetLayer2 == null)
{
exportTableEntity.BaseRubWidth = baseWeight.SetWidth.ToString();
exportTableEntity.BaseRubLayer = baseWeight.SetLayer.ToString();
}
else
{
exportTableEntity.BaseRubWidth = $"{baseWeight.SetWidth}/{baseWeight.SetWidth2}";
exportTableEntity.BaseRubLayer = $"{baseWeight.SetLayer}/{baseWeight.SetLayer2}";
}
exportTableEntity.BaseRubFinishTime = GeneralUtils.DateTimeToString(rawEntity.StartTime, rawEntity.BaseEndTime);
}
//中层胶
if (midWeight != null)
{
exportTableEntity.MidRubName = midWeight.MaterialName;
exportTableEntity.MidRubThickness = midWeight.SetThickness.ToString();
exportTableEntity.MidRubWidth = midWeight.SetWidth.ToString();
exportTableEntity.MidRubLayer = midWeight.SetLayer.ToString();
exportTableEntity.MidRubFinishTime = GeneralUtils.DateTimeToString(rawEntity.StartTime, rawEntity.MidEndTime);
}
//胎面胶
if (faceWeight != null)
{
exportTableEntity.FaceRubName = faceWeight.MaterialName;
exportTableEntity.FaceRubThickness = faceWeight.SetThickness.ToString();
//胎面胶宽度和层数(可能有两层
if (faceWeight.SetLayer2 == 0 || faceWeight.SetLayer2 == null)
{
exportTableEntity.FaceRubWidth = faceWeight.SetWidth.ToString();
exportTableEntity.FaceRubLayer = faceWeight.SetLayer.ToString();
}
else
{
exportTableEntity.FaceRubWidth = $"{faceWeight.SetWidth}/{faceWeight.SetWidth2}";
exportTableEntity.FaceRubLayer = $"{faceWeight.SetLayer}/{faceWeight.SetLayer2}";
}
exportTableEntity.FaceRubFinishTime = GeneralUtils.DateTimeToString(rawEntity.StartTime, rawEntity.FaceEndTime);
}
exportTableEntity.RawTireWidth = (faceWeight.SetThickness * 2 + faceWeight.SetWidth).ToString();
exportTableEntity.RawTireWeight = rawEntity.RawTireWeight.ToString();
exportTableEntity.RepeatWeight = rawEntity.RepeatWeight.ToString();
_exportTableEntities.Add(exportTableEntity);
}
dataGridView1.DataSource = null;
dataGridView1.DataSource = _exportTableEntities;
try
{
dataTable = ToDataTable(_exportTableEntities.ToArray());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
/// <summary>
/// 路径选择按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PathSelectButton_Click(object sender, EventArgs e)
{
folderBrowserDialog1.Description = "请选择文件路径";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
_savePath = folderBrowserDialog1.SelectedPath;
PathTextBox.Text = _savePath;
}
}
private void ExportButton_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(PathTextBox.Text))
{
MessageBox.Show("请先选择导出路径!");
return;
}
ExportExcel(dataTable, _savePath);
this.Close();
}
/// <summary>
/// 导出Excel
/// </summary>
/// <param name="dt"></param>
public void ExportExcel(DataTable dt, string path)
{
try
{
//创建一个工作簿
IWorkbook workbook = new HSSFWorkbook();
//创建一个 sheet 表
ISheet sheet = workbook.CreateSheet(dt.TableName);
//创建一行
IRow rowH = sheet.CreateRow(0);
//创建一个单元格
ICell cell = null;
//创建单元格样式
ICellStyle cellStyle = workbook.CreateCellStyle();
//创建格式
IDataFormat dataFormat = workbook.CreateDataFormat();
//设置为文本格式,也可以为 text即 dataFormat.GetFormat("text");
cellStyle.DataFormat = dataFormat.GetFormat("@");
//设置列名
foreach (DataColumn col in dt.Columns)
{
//创建单元格并设置单元格内容
rowH.CreateCell(col.Ordinal).SetCellValue(col.Caption);
//设置单元格格式
rowH.Cells[col.Ordinal].CellStyle = cellStyle;
}
//写入数据
for (int i = 0; i < dt.Rows.Count; i++)
{
//跳过第一行,第一行为列名
IRow row = sheet.CreateRow(i + 1);
for (int j = 0; j < dt.Columns.Count; j++)
{
cell = row.CreateCell(j);
cell.SetCellValue(dt.Rows[i][j].ToString());
cell.CellStyle = cellStyle;
}
}
//设置导出文件路径
//string path = HttpContext.Current.Server.MapPath("Export/");
//设置新建文件路径及名称
string savePath = $"{path}/203报表{DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")}.xls";
//创建文件
FileStream file = new FileStream(savePath, FileMode.CreateNew, FileAccess.Write);
//创建一个 IO 流
MemoryStream ms = new MemoryStream();
//写入到流
workbook.Write(ms);
//转换为字节数组
byte[] bytes = ms.ToArray();
file.Write(bytes, 0, bytes.Length);
file.Flush();
//还可以调用下面的方法,把流输出到浏览器下载
//OutputClient(bytes);
//释放资源
bytes = null;
ms.Close();
ms.Dispose();
file.Close();
file.Dispose();
workbook.Close();
sheet = null;
workbook = null;
MessageBox.Show("导出成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void ExportPreviewForm_FormClosing(object sender, FormClosingEventArgs e)
{
this.DialogResult = DialogResult.OK;
}
/// <summary>
/// 实体类转dt
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="entities"></param>
/// <returns></returns>
public DataTable ToDataTable<T>(T[] entities)
{
DataTable dataTable = new DataTable(typeof(T).Name);
PropertyInfo[] properties = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (PropertyInfo propInfo in properties)
{
// Get the Description attribute if it exists
var descriptionAttribute = propInfo.GetCustomAttribute<DescriptionAttribute>();
string columnName = descriptionAttribute != null ? descriptionAttribute.Description : propInfo.Name;
dataTable.Columns.Add(columnName, propInfo.PropertyType);
}
foreach (T entity in entities)
{
object[] values = new object[properties.Length];
for (int i = 0; i < properties.Length; i++)
{
values[i] = properties[i].GetValue(entity);
}
dataTable.Rows.Add(values);
}
return dataTable;
}
}
}

@ -117,4 +117,76 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="RecipeCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RecipeName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SpecCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SpecName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="StartTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BaseRubName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BaseRubThickness.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BaseRubWidth.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BaseRubLayer.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BaseRubFinishTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="MidRubName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="MidRubThickness.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="MidRubWidth.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="MidRubLayer.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="MidRubFinishTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="FaceRubName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="FaceRubThickness.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="FaceRubWidth.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="FaceRubLayer.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RawTireWidth.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RawTireFinishTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RawTireWeight.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RepeatWeight.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

@ -28,7 +28,7 @@ namespace HighWayIot.Winform.UserControlPages
private void Init()
{
LogDataGridView.AutoGenerateColumns = false;
SelectLogBeginTime.Value = DateTime.Now.AddMonths(-3);
Lists = sysLogService.GetLogInfos();
LogDataGridView.DataSource = null;
LogDataGridView.DataSource = Lists;

@ -92,6 +92,7 @@ namespace HighWayIot.Winform.UserControlPages.SysConfigPages
MessageBox.Show("物料信息添加失败!");
return;
}
SqlLogHelper.AddLog($"物料信息修添加成功 物料编号[{entity.MaterialCode}]");
this.Close();
this.Dispose();

@ -146,6 +146,7 @@ namespace HighWayIot.Winform.UserControlPages
{
MessageBox.Show($"编号为{s}的物料删除失败", "提示");
}
SqlLogHelper.AddLog($"物料信息删除成功 物料编号[{s}]");
Lists = zxMaterialService.GetMaterialInfos();
MaterialDataGridView.DataSource = null;

@ -1,4 +1,5 @@
using HighWayIot.Repository.service;
using HighWayIot.Winform.Business;
using Models;
using System;
using System.Collections.Generic;
@ -80,6 +81,8 @@ namespace HighWayIot.Winform.UserControlPages.MaterialConfigPages
MaterialTypeName = material,
});
SqlLogHelper.AddLog($"物料类型信息添加成功 名称:[{material}]");
zxMaterialTypeList = zxMaterialTypeService.GetMaterialTypeInfos();
MaterialTypeDataGridView.DataSource = null;
@ -117,6 +120,7 @@ namespace HighWayIot.Winform.UserControlPages.MaterialConfigPages
MaterialTypeName = s,
MaterialChlidTypeName = material,
});
SqlLogHelper.AddLog($"物料子类型添加成功 名称:[{material}]");
zxMaterialChildTypeList = zxMaterialChildTypeService.GetMaterialChildTypeInfos(x => x.MaterialTypeName == s);
@ -150,6 +154,7 @@ namespace HighWayIot.Winform.UserControlPages.MaterialConfigPages
{
MessageBox.Show("关联子物料类型删除失败!", "提示");
}
SqlLogHelper.AddLog($"物料类型关联的子类型删除成功 名称:[{s}]");
}
}
@ -158,6 +163,7 @@ namespace HighWayIot.Winform.UserControlPages.MaterialConfigPages
if (zxMaterialTypeService.DeleteMaterialTypeInfoById(id))
{
MessageBox.Show("删除成功!", "提示");
SqlLogHelper.AddLog($"物料类型删除成功 名称:[{s}]");
}
zxMaterialTypeList = zxMaterialTypeService.GetMaterialTypeInfos();
@ -186,6 +192,7 @@ namespace HighWayIot.Winform.UserControlPages.MaterialConfigPages
if (zxMaterialChildTypeService.DeleteMaterialChildTypeInfoById(id))
{
MessageBox.Show("删除成功!", "提示");
SqlLogHelper.AddLog($"物料子类型删除成功 名称:[{MaterialChildTypeDataGridView.Rows[a].Cells["MaterialChildTypeName"].Value.ToString()}]");
}
//获取选择的物料类型行

@ -119,6 +119,7 @@ namespace HighWayIot.Winform.UserControlPages.SysConfigPages
if (zxMaterialService.UpdateMaterialInfo(entity))
{
MessageBox.Show("物料信息修改成功!", "提示");
SqlLogHelper.AddLog($"物料信息修改成功 物料编号[{entity.MaterialCode}]");
}
else
{
@ -126,7 +127,6 @@ namespace HighWayIot.Winform.UserControlPages.SysConfigPages
return;
}
this.Close();
this.Dispose();
}

@ -1,5 +1,6 @@
using HighWayIot.Repository.domain;
using HighWayIot.Repository.service;
using HighWayIot.Winform.Business;
using Models;
using System;
using System.Collections.Generic;
@ -94,6 +95,7 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
if (zxOpenMixMaterialService.UpDateInfos(list))
{
MessageBox.Show("开炼机物料配置信息保存成功");
SqlLogHelper.AddLog($"开炼机物料配置信息保存成功 1:[{OpenMixMaterial1.Text}]|2:[{OpenMixMaterial2.Text}]|3:[{OpenMixMaterial3.Text}]|4:[{OpenMixMaterial4.Text}]|5:[{OpenMixMaterial5.Text}]");
}
else
{

@ -43,10 +43,10 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
this.UpdateConfigButton = new System.Windows.Forms.Button();
this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.DeviceNo = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RecipeCode1 = new System.Windows.Forms.DataGridViewComboBoxColumn();
this.RecipeName1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RecipeCode2 = new System.Windows.Forms.DataGridViewComboBoxColumn();
this.RecipeName2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RecipeCode2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RecipeName2 = new System.Windows.Forms.DataGridViewComboBoxColumn();
this.RecipeCode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RecipeName1 = new System.Windows.Forms.DataGridViewComboBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.SchedulingDataGridView)).BeginInit();
this.ButtonPanel.SuspendLayout();
this.SuspendLayout();
@ -60,10 +60,10 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
this.SchedulingDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Id,
this.DeviceNo,
this.RecipeCode1,
this.RecipeName1,
this.RecipeCode2,
this.RecipeName2});
this.RecipeName2,
this.RecipeCode1,
this.RecipeName1});
this.SchedulingDataGridView.Location = new System.Drawing.Point(0, 65);
this.SchedulingDataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.SchedulingDataGridView.Name = "SchedulingDataGridView";
@ -82,7 +82,7 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
this.SelectConfigButton.Name = "SelectConfigButton";
this.SelectConfigButton.Size = new System.Drawing.Size(103, 39);
this.SelectConfigButton.TabIndex = 1;
this.SelectConfigButton.Text = "查询配置信息";
this.SelectConfigButton.Text = "刷新配置信息";
this.SelectConfigButton.UseVisualStyleBackColor = true;
this.SelectConfigButton.Click += new System.EventHandler(this.SelectConfigButton_Click);
//
@ -105,7 +105,7 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
this.UpdateConfigButton.Name = "UpdateConfigButton";
this.UpdateConfigButton.Size = new System.Drawing.Size(103, 39);
this.UpdateConfigButton.TabIndex = 2;
this.UpdateConfigButton.Text = "修改配置信息";
this.UpdateConfigButton.Text = "保存配置信息";
this.UpdateConfigButton.UseVisualStyleBackColor = true;
this.UpdateConfigButton.Click += new System.EventHandler(this.UpdateConfigButton_Click);
//
@ -130,51 +130,54 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
this.DeviceNo.ReadOnly = true;
this.DeviceNo.Resizable = System.Windows.Forms.DataGridViewTriState.False;
//
// RecipeCode1
//
this.RecipeCode1.DataPropertyName = "RecipeCode1";
dataGridViewCellStyle3.BackColor = System.Drawing.Color.Transparent;
dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle3.ForeColor = System.Drawing.Color.Black;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.Transparent;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.Black;
this.RecipeCode1.DefaultCellStyle = dataGridViewCellStyle3;
this.RecipeCode1.HeaderText = "成品代号 - 上模";
this.RecipeCode1.Name = "RecipeCode1";
this.RecipeCode1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.RecipeCode1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.RecipeCode1.Width = 200;
//
// RecipeName1
//
this.RecipeName1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.RecipeName1.DataPropertyName = "RecipeName1";
dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.RecipeName1.DefaultCellStyle = dataGridViewCellStyle4;
this.RecipeName1.HeaderText = "标称尺度 - 上模";
this.RecipeName1.Name = "RecipeName1";
this.RecipeName1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
//
// RecipeCode2
//
this.RecipeCode2.DataPropertyName = "RecipeCode2";
dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.RecipeCode2.DefaultCellStyle = dataGridViewCellStyle5;
this.RecipeCode2.HeaderText = "成品代号 - 下模";
dataGridViewCellStyle3.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.RecipeCode2.DefaultCellStyle = dataGridViewCellStyle3;
this.RecipeCode2.HeaderText = "成品代号 - 上模";
this.RecipeCode2.Name = "RecipeCode2";
this.RecipeCode2.ReadOnly = true;
this.RecipeCode2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.RecipeCode2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.RecipeCode2.Width = 200;
//
// RecipeName2
//
this.RecipeName2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.RecipeName2.DataPropertyName = "RecipeName2";
dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.RecipeName2.DefaultCellStyle = dataGridViewCellStyle6;
this.RecipeName2.HeaderText = "标称尺度 - 模";
dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.RecipeName2.DefaultCellStyle = dataGridViewCellStyle4;
this.RecipeName2.HeaderText = "标称尺度 - 上模";
this.RecipeName2.Name = "RecipeName2";
this.RecipeName2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.RecipeName2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// RecipeCode1
//
this.RecipeCode1.DataPropertyName = "RecipeCode1";
dataGridViewCellStyle5.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle5.ForeColor = System.Drawing.Color.Black;
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.White;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.Black;
this.RecipeCode1.DefaultCellStyle = dataGridViewCellStyle5;
this.RecipeCode1.HeaderText = "成品代号 - 下模";
this.RecipeCode1.Name = "RecipeCode1";
this.RecipeCode1.ReadOnly = true;
this.RecipeCode1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.RecipeCode1.Width = 200;
//
// RecipeName1
//
this.RecipeName1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.RecipeName1.DataPropertyName = "RecipeName1";
dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.RecipeName1.DefaultCellStyle = dataGridViewCellStyle6;
this.RecipeName1.HeaderText = "标称尺度 - 下模";
this.RecipeName1.Name = "RecipeName1";
this.RecipeName1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.RecipeName1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// ProductionScheduling
//
@ -200,9 +203,9 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
private Button UpdateConfigButton;
private DataGridViewTextBoxColumn Id;
private DataGridViewTextBoxColumn DeviceNo;
private DataGridViewComboBoxColumn RecipeCode1;
private DataGridViewTextBoxColumn RecipeName1;
private DataGridViewComboBoxColumn RecipeCode2;
private DataGridViewTextBoxColumn RecipeName2;
private DataGridViewTextBoxColumn RecipeCode2;
private DataGridViewComboBoxColumn RecipeName2;
private DataGridViewTextBoxColumn RecipeCode1;
private DataGridViewComboBoxColumn RecipeName1;
}
}

@ -1,5 +1,6 @@
using HighWayIot.Log4net;
using HighWayIot.Repository.service;
using HighWayIot.Winform.Business;
using Models;
using System;
using System.Collections.Generic;
@ -60,17 +61,24 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
private void ComboBoxBind()
{
zxRecipeEntities = zxRecipeService.GetRecipeInfos();
RecipeCode1.DataSource = null;
RecipeCode1.DataSource = null;
RecipeName1.DataSource = null;
RecipeName2.DataSource = null;
List<string> r1 = zxRecipeEntities.Select(x => x.RecipeCode).ToList();
List<string> r1 = zxRecipeEntities.Select(x => x.RecipeName).ToList();
r1.Sort();
r1.Insert(0, "");
RecipeCode1.DataSource = r1;
List<string> r2 = zxRecipeEntities.Select(x => x.RecipeCode).ToList();
RecipeName1.DataSource = r1;
List<string> r2 = zxRecipeEntities.Select(x => x.RecipeName).ToList();
r2.Sort();
r2.Insert(0, "");
RecipeCode2.DataSource = r2;
RecipeName2.DataSource = r2;
}
/// <summary>
/// 更新设置
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UpdateConfigButton_Click(object sender, EventArgs e)
{
if (zxSchedulingService.UpdateSchedulingInfo(zxSchedulingEntity))
@ -114,10 +122,12 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
ComboBox cbo = new ComboBox();
private void SchedulingDataGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (SchedulingDataGridView.CurrentCell.OwningColumn.Name.Contains("RecipeCode") && SchedulingDataGridView.CurrentCell.RowIndex != -1)
if (SchedulingDataGridView.CurrentCell.OwningColumn.Name.Contains("RecipeName") && SchedulingDataGridView.CurrentCell.RowIndex != -1)
{
//保存当前的事件源。为了触发事件后。在取消
cbo = e.Control as ComboBox;
//cbo.AutoCompleteSource = AutoCompleteSource.CustomSource;
//cbo.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
cbo.SelectedIndexChanged += new EventHandler(cbo_SelectedIndexChanged);
}
}
@ -137,30 +147,35 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
{
int row = SchedulingDataGridView.CurrentCell.RowIndex;
int column = SchedulingDataGridView.CurrentCell.ColumnIndex;
string DeviceNo = SchedulingDataGridView.Rows[row].Cells[1].Value.ToString();
if(column == 2)
if(column == 5)
{
ZxRecipeEntity recipe = zxRecipeService.GetSingleInfoByRecipeCode(combox.Text);
ZxRecipeEntity recipe = zxRecipeService.GetSingleInfoByRecipeName(combox.Text);
if (recipe == null)
{
zxSchedulingEntity[row].RecipeName1 = string.Empty;
MessageBox.Show("存在多个相同的标称尺度或不存在,请检查并维护配方,重启排程界面");
zxSchedulingEntity[row].RecipeCode1 = string.Empty;
}
else
{
zxSchedulingEntity[row].RecipeName1 = recipe.RecipeName;
zxSchedulingEntity[row].RecipeCode1 = recipe.RecipeCode;
SqlLogHelper.AddLog($"排程信息操作 机台[{DeviceNo}下模] 配方更改为[{recipe.RecipeCode}]");
}
}
if(column == 4)
if (column == 3)
{
ZxRecipeEntity recipe = zxRecipeService.GetSingleInfoByRecipeCode(combox.Text);
ZxRecipeEntity recipe = zxRecipeService.GetSingleInfoByRecipeName(combox.Text);
if (recipe == null)
{
zxSchedulingEntity[row].RecipeName2 = string.Empty;
MessageBox.Show("存在多个相同的标称尺度或不存在,请检查并维护配方,重启排程界面");
zxSchedulingEntity[row].RecipeCode2 = string.Empty;
}
else
{
zxSchedulingEntity[row].RecipeName2 = recipe.RecipeName;
zxSchedulingEntity[row].RecipeCode2 = recipe.RecipeCode;
SqlLogHelper.AddLog($"排程信息操作 机台[{DeviceNo}上模] 配方更改为[{recipe.RecipeCode}]");
}
}
SchedulingDataGridView.Refresh();
@ -181,5 +196,7 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
//做完处理,须撤销动态事件
combox.SelectedIndexChanged -= new EventHandler(cbo_SelectedIndexChanged);
}
}
}

@ -123,16 +123,16 @@
<metadata name="DeviceNo.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RecipeCode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RecipeName1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RecipeCode2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RecipeName2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RecipeCode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="RecipeName1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

@ -37,9 +37,6 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
this.ButtonPanel = new System.Windows.Forms.Panel();
this.UpdateReaderButton = new System.Windows.Forms.Button();
this.ReaderDataGridView = new System.Windows.Forms.DataGridView();
this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RfidIp = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.WorkstationNo = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RFIDSettingGroupBox = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.panel1 = new System.Windows.Forms.Panel();
@ -48,6 +45,9 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.TagDataGridView = new System.Windows.Forms.DataGridView();
this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RfidIp = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.WorkstationNo = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RfidId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RfidEpc = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.DeviceNo = new System.Windows.Forms.DataGridViewTextBoxColumn();
@ -119,29 +119,6 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
this.ReaderDataGridView.Size = new System.Drawing.Size(688, 842);
this.ReaderDataGridView.TabIndex = 5;
//
// Id
//
this.Id.DataPropertyName = "Id";
this.Id.HeaderText = "编号";
this.Id.Name = "Id";
this.Id.Width = 40;
//
// RfidIp
//
this.RfidIp.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.RfidIp.DataPropertyName = "RfidIp";
this.RfidIp.FillWeight = 5F;
this.RfidIp.HeaderText = "设备ip";
this.RfidIp.Name = "RfidIp";
//
// WorkstationNo
//
this.WorkstationNo.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.WorkstationNo.DataPropertyName = "WorkstationNo";
this.WorkstationNo.FillWeight = 5F;
this.WorkstationNo.HeaderText = "工位编号";
this.WorkstationNo.Name = "WorkstationNo";
//
// RFIDSettingGroupBox
//
this.RFIDSettingGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -259,11 +236,36 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
this.TagDataGridView.Size = new System.Drawing.Size(689, 842);
this.TagDataGridView.TabIndex = 5;
//
// Id
//
this.Id.DataPropertyName = "Id";
this.Id.HeaderText = "编号";
this.Id.Name = "Id";
this.Id.ReadOnly = true;
this.Id.Width = 40;
//
// RfidIp
//
this.RfidIp.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.RfidIp.DataPropertyName = "RfidIp";
this.RfidIp.FillWeight = 5F;
this.RfidIp.HeaderText = "设备ip";
this.RfidIp.Name = "RfidIp";
//
// WorkstationNo
//
this.WorkstationNo.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.WorkstationNo.DataPropertyName = "WorkstationNo";
this.WorkstationNo.FillWeight = 5F;
this.WorkstationNo.HeaderText = "工位编号";
this.WorkstationNo.Name = "WorkstationNo";
//
// RfidId
//
this.RfidId.DataPropertyName = "Id";
this.RfidId.HeaderText = "编号";
this.RfidId.Name = "RfidId";
this.RfidId.ReadOnly = true;
this.RfidId.Width = 40;
//
// RfidEpc
@ -315,13 +317,13 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
private Button SelectRfidButton;
private GroupBox groupBox1;
private DataGridView TagDataGridView;
private Button UpdateReaderButton;
private Button UpdateRFIDButton;
private DataGridViewTextBoxColumn Id;
private DataGridViewTextBoxColumn RfidIp;
private DataGridViewTextBoxColumn WorkstationNo;
private DataGridViewTextBoxColumn RfidId;
private DataGridViewTextBoxColumn RfidEpc;
private DataGridViewTextBoxColumn DeviceNo;
private Button UpdateReaderButton;
private Button UpdateRFIDButton;
}
}

@ -1,5 +1,6 @@
using HighWayIot.Repository.domain;
using HighWayIot.Repository.service;
using HighWayIot.Winform.Business;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -94,6 +95,7 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
RefreshReaderGridView();
MessageBox.Show("读写器信息修改成功");
SqlLogHelper.AddLog($"读写器信息修改成功");
}
/// <summary>
@ -121,6 +123,7 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
RefreshReaderGridView();
MessageBox.Show("标签信息修改成功");
SqlLogHelper.AddLog($"标签信息修改成功");
}
}
}

@ -1,4 +1,5 @@
using HighWayIot.Repository.service;
using HighWayIot.Winform.Business;
using Models;
using System;
using System.Collections.Generic;
@ -80,6 +81,7 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages
if(zxRecipeService.InsertRecipeInfo(zxRecipeEntity))
{
MessageBox.Show("配方信息添加成功");
SqlLogHelper.AddLog($"配方信息添加成功 {zxRecipeEntity.RecipeSpecName}");
this.CloseValue = zxRecipeEntity;
this.Close();
this.Dispose();

@ -57,6 +57,10 @@
this.label12 = new System.Windows.Forms.Label();
this.SetWidthTextBox2 = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.SetLayerTextBox3 = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label();
this.SetWidthTextBox3 = new System.Windows.Forms.TextBox();
this.label15 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
@ -324,11 +328,47 @@
this.label13.TabIndex = 25;
this.label13.Text = "宽度2";
//
// SetLayerTextBox3
//
this.SetLayerTextBox3.Location = new System.Drawing.Point(450, 199);
this.SetLayerTextBox3.Name = "SetLayerTextBox3";
this.SetLayerTextBox3.Size = new System.Drawing.Size(123, 21);
this.SetLayerTextBox3.TabIndex = 32;
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(403, 203);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(47, 12);
this.label14.TabIndex = 31;
this.label14.Text = "层数3";
//
// SetWidthTextBox3
//
this.SetWidthTextBox3.Location = new System.Drawing.Point(272, 199);
this.SetWidthTextBox3.Name = "SetWidthTextBox3";
this.SetWidthTextBox3.Size = new System.Drawing.Size(123, 21);
this.SetWidthTextBox3.TabIndex = 30;
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(225, 203);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(47, 12);
this.label15.TabIndex = 29;
this.label15.Text = "宽度3";
//
// AddWeightForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(638, 294);
this.Controls.Add(this.SetLayerTextBox3);
this.Controls.Add(this.label14);
this.Controls.Add(this.SetWidthTextBox3);
this.Controls.Add(this.label15);
this.Controls.Add(this.SetLayerTextBox2);
this.Controls.Add(this.label12);
this.Controls.Add(this.SetWidthTextBox2);
@ -392,5 +432,9 @@
private System.Windows.Forms.Label label12;
private System.Windows.Forms.TextBox SetWidthTextBox2;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox SetLayerTextBox3;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.TextBox SetWidthTextBox3;
private System.Windows.Forms.Label label15;
}
}

@ -153,6 +153,13 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages
}
zxWeightEntity.SetWidth2 = width2;
if (!decimal.TryParse(SetWidthTextBox3.Text.Trim(), out decimal width3) && !string.IsNullOrEmpty(SetWidthTextBox2.Text.Trim()))
{
MessageBox.Show("宽度请填入可带小数的阿拉伯数字");
return;
}
zxWeightEntity.SetWidth3 = width3;
if (!int.TryParse(SetLayerTextBox.Text.Trim(), out int layer) && !string.IsNullOrEmpty(SetLayerTextBox.Text.Trim()))
{
MessageBox.Show("层数请填入整数阿拉伯数字");
@ -167,6 +174,13 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages
}
zxWeightEntity.SetLayer2 = layer2;
if (!int.TryParse(SetLayerTextBox3.Text.Trim(), out int layer3) && !string.IsNullOrEmpty(SetLayerTextBox2.Text.Trim()))
{
MessageBox.Show("层数请填入整数阿拉伯数字");
return;
}
zxWeightEntity.SetLayer3 = layer3;
if (!decimal.TryParse(SetWeightTextBox.Text.Trim(), out decimal weight) && !string.IsNullOrEmpty(SetWeightTextBox.Text.Trim()))
{
MessageBox.Show("重量请填入可带小数的阿拉伯数字");
@ -184,6 +198,7 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages
if (zxWeightService.InsertWeightInfo(zxWeightEntity))
{
MessageBox.Show("成型信息添加成功!");
SqlLogHelper.AddLog($"成型信息添加成功 {zxWeightEntity.RecipeCode}");
}
else
{

@ -32,18 +32,6 @@ namespace HighWayIot.Winform.UserControlPages
private void InitializeComponent()
{
this.WeightDataGridView = new System.Windows.Forms.DataGridView();
this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MaterialCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MaterialName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MaterialType = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetThickness = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetWidth1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetLayer1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetWidth2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetLayer2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetWeight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetError = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.WeightIsUse = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.AddRecipeButton = new System.Windows.Forms.Button();
this.ButtonPanel = new System.Windows.Forms.Panel();
this.SyncDataButton = new System.Windows.Forms.Button();
@ -82,6 +70,16 @@ namespace HighWayIot.Winform.UserControlPages
this.DownloadFromPlc = new System.Windows.Forms.Button();
this.UpLoadToPlc = new System.Windows.Forms.Button();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.label20 = new System.Windows.Forms.Label();
this.E15TextBox = new System.Windows.Forms.TextBox();
this.label24 = new System.Windows.Forms.Label();
this.E14TextBox = new System.Windows.Forms.TextBox();
this.label25 = new System.Windows.Forms.Label();
this.E13TextBox = new System.Windows.Forms.TextBox();
this.label33 = new System.Windows.Forms.Label();
this.E12TextBox = new System.Windows.Forms.TextBox();
this.label35 = new System.Windows.Forms.Label();
this.E11TextBox = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.E10TextBox = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
@ -154,6 +152,20 @@ 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.Id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MaterialCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MaterialName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MaterialType = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetThickness = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetWidth1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetLayer1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetWidth2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetLayer2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetWidth3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetLayer3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetWeight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SetError = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.WeightIsUse = new System.Windows.Forms.DataGridViewCheckBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.WeightDataGridView)).BeginInit();
this.ButtonPanel.SuspendLayout();
this.groupBox1.SuspendLayout();
@ -187,6 +199,8 @@ namespace HighWayIot.Winform.UserControlPages
this.SetLayer1,
this.SetWidth2,
this.SetLayer2,
this.SetWidth3,
this.SetLayer3,
this.SetWeight,
this.SetError,
this.WeightIsUse});
@ -196,111 +210,10 @@ namespace HighWayIot.Winform.UserControlPages
this.WeightDataGridView.Name = "WeightDataGridView";
this.WeightDataGridView.RowHeadersVisible = false;
this.WeightDataGridView.RowTemplate.Height = 25;
this.WeightDataGridView.Size = new System.Drawing.Size(855, 793);
this.WeightDataGridView.Size = new System.Drawing.Size(947, 722);
this.WeightDataGridView.TabIndex = 0;
this.WeightDataGridView.Tag = "";
//
// Id
//
this.Id.DataPropertyName = "Id";
this.Id.HeaderText = "ID";
this.Id.Name = "Id";
this.Id.ReadOnly = true;
this.Id.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.Id.Width = 40;
//
// MaterialCode
//
this.MaterialCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.MaterialCode.DataPropertyName = "MaterialCode";
this.MaterialCode.HeaderText = "胶料编码";
this.MaterialCode.Name = "MaterialCode";
this.MaterialCode.ReadOnly = true;
this.MaterialCode.Resizable = System.Windows.Forms.DataGridViewTriState.False;
//
// MaterialName
//
this.MaterialName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.MaterialName.DataPropertyName = "MaterialName";
this.MaterialName.HeaderText = "胶料名称";
this.MaterialName.Name = "MaterialName";
this.MaterialName.ReadOnly = true;
this.MaterialName.Resizable = System.Windows.Forms.DataGridViewTriState.False;
//
// MaterialType
//
this.MaterialType.DataPropertyName = "MaterialType";
this.MaterialType.HeaderText = "胶料类型";
this.MaterialType.Name = "MaterialType";
this.MaterialType.ReadOnly = true;
this.MaterialType.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.MaterialType.Width = 89;
//
// SetThickness
//
this.SetThickness.DataPropertyName = "SetThickness";
this.SetThickness.HeaderText = "厚度";
this.SetThickness.Name = "SetThickness";
this.SetThickness.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SetThickness.Width = 59;
//
// SetWidth1
//
this.SetWidth1.DataPropertyName = "SetWidth";
this.SetWidth1.HeaderText = "宽度1";
this.SetWidth1.Name = "SetWidth1";
this.SetWidth1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SetWidth1.Width = 60;
//
// SetLayer1
//
this.SetLayer1.DataPropertyName = "SetLayer";
this.SetLayer1.HeaderText = "层数1";
this.SetLayer1.Name = "SetLayer1";
this.SetLayer1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SetLayer1.Width = 60;
//
// SetWidth2
//
this.SetWidth2.DataPropertyName = "SetWidth2";
this.SetWidth2.HeaderText = "宽度2";
this.SetWidth2.Name = "SetWidth2";
this.SetWidth2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SetWidth2.Width = 60;
//
// SetLayer2
//
this.SetLayer2.DataPropertyName = "SetLayer2";
this.SetLayer2.HeaderText = "层数2";
this.SetLayer2.Name = "SetLayer2";
this.SetLayer2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SetLayer2.Width = 60;
//
// SetWeight
//
this.SetWeight.DataPropertyName = "SetWeight";
this.SetWeight.HeaderText = "重量";
this.SetWeight.Name = "SetWeight";
this.SetWeight.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SetWeight.Width = 70;
//
// SetError
//
this.SetError.DataPropertyName = "SetError";
this.SetError.HeaderText = "公差";
this.SetError.Name = "SetError";
this.SetError.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SetError.Width = 55;
//
// WeightIsUse
//
this.WeightIsUse.DataPropertyName = "IsUse";
this.WeightIsUse.HeaderText = "启用";
this.WeightIsUse.Name = "WeightIsUse";
this.WeightIsUse.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.WeightIsUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.WeightIsUse.Width = 40;
//
// AddRecipeButton
//
this.AddRecipeButton.Location = new System.Drawing.Point(11, 12);
@ -325,13 +238,13 @@ namespace HighWayIot.Winform.UserControlPages
this.ButtonPanel.Location = new System.Drawing.Point(0, 0);
this.ButtonPanel.Margin = new System.Windows.Forms.Padding(0);
this.ButtonPanel.Name = "ButtonPanel";
this.ButtonPanel.Size = new System.Drawing.Size(861, 63);
this.ButtonPanel.Size = new System.Drawing.Size(952, 63);
this.ButtonPanel.TabIndex = 4;
//
// SyncDataButton
//
this.SyncDataButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.SyncDataButton.Location = new System.Drawing.Point(637, 12);
this.SyncDataButton.Location = new System.Drawing.Point(728, 12);
this.SyncDataButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.SyncDataButton.Name = "SyncDataButton";
this.SyncDataButton.Size = new System.Drawing.Size(103, 39);
@ -374,7 +287,7 @@ namespace HighWayIot.Winform.UserControlPages
// DeleteRecipeButton
//
this.DeleteRecipeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.DeleteRecipeButton.Location = new System.Drawing.Point(746, 12);
this.DeleteRecipeButton.Location = new System.Drawing.Point(837, 12);
this.DeleteRecipeButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.DeleteRecipeButton.Name = "DeleteRecipeButton";
this.DeleteRecipeButton.Size = new System.Drawing.Size(103, 39);
@ -387,10 +300,10 @@ namespace HighWayIot.Winform.UserControlPages
//
this.groupBox1.Controls.Add(this.WeightDataGridView);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(861, 0);
this.groupBox1.Location = new System.Drawing.Point(952, 0);
this.groupBox1.Margin = new System.Windows.Forms.Padding(0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(861, 813);
this.groupBox1.Size = new System.Drawing.Size(953, 742);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "成型信息";
@ -402,7 +315,7 @@ namespace HighWayIot.Winform.UserControlPages
this.groupBox2.Location = new System.Drawing.Point(0, 0);
this.groupBox2.Margin = new System.Windows.Forms.Padding(0);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(861, 813);
this.groupBox2.Size = new System.Drawing.Size(952, 742);
this.groupBox2.TabIndex = 6;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "配方列表";
@ -411,7 +324,6 @@ namespace HighWayIot.Winform.UserControlPages
//
this.RecipeDataGridView.AllowUserToAddRows = false;
this.RecipeDataGridView.AllowUserToDeleteRows = false;
this.RecipeDataGridView.AllowUserToResizeColumns = false;
this.RecipeDataGridView.AllowUserToResizeRows = false;
this.RecipeDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.RecipeDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -428,9 +340,8 @@ namespace HighWayIot.Winform.UserControlPages
this.RecipeDataGridView.Location = new System.Drawing.Point(3, 17);
this.RecipeDataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.RecipeDataGridView.Name = "RecipeDataGridView";
this.RecipeDataGridView.RowHeadersVisible = false;
this.RecipeDataGridView.RowTemplate.Height = 25;
this.RecipeDataGridView.Size = new System.Drawing.Size(855, 793);
this.RecipeDataGridView.Size = new System.Drawing.Size(946, 722);
this.RecipeDataGridView.TabIndex = 0;
this.RecipeDataGridView.Tag = "";
this.RecipeDataGridView.SelectionChanged += new System.EventHandler(this.RecipeDataGridView_SelectionChanged);
@ -471,6 +382,7 @@ namespace HighWayIot.Winform.UserControlPages
this.RecipeSpecCode.Name = "RecipeSpecCode";
this.RecipeSpecCode.ReadOnly = true;
this.RecipeSpecCode.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.RecipeSpecCode.Width = 90;
//
// RecipeSpecName
//
@ -532,7 +444,7 @@ namespace HighWayIot.Winform.UserControlPages
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1722, 813);
this.tableLayoutPanel1.Size = new System.Drawing.Size(1905, 742);
this.tableLayoutPanel1.TabIndex = 7;
//
// groupBox3
@ -543,7 +455,7 @@ namespace HighWayIot.Winform.UserControlPages
this.groupBox3.Location = new System.Drawing.Point(0, 0);
this.groupBox3.Margin = new System.Windows.Forms.Padding(0);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(1722, 190);
this.groupBox3.Size = new System.Drawing.Size(1905, 190);
this.groupBox3.TabIndex = 8;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "配方参数";
@ -562,7 +474,7 @@ namespace HighWayIot.Winform.UserControlPages
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(1716, 170);
this.tableLayoutPanel3.Size = new System.Drawing.Size(1899, 170);
this.tableLayoutPanel3.TabIndex = 0;
//
// groupBox7
@ -738,6 +650,16 @@ namespace HighWayIot.Winform.UserControlPages
//
// groupBox4
//
this.groupBox4.Controls.Add(this.label20);
this.groupBox4.Controls.Add(this.E15TextBox);
this.groupBox4.Controls.Add(this.label24);
this.groupBox4.Controls.Add(this.E14TextBox);
this.groupBox4.Controls.Add(this.label25);
this.groupBox4.Controls.Add(this.E13TextBox);
this.groupBox4.Controls.Add(this.label33);
this.groupBox4.Controls.Add(this.E12TextBox);
this.groupBox4.Controls.Add(this.label35);
this.groupBox4.Controls.Add(this.E11TextBox);
this.groupBox4.Controls.Add(this.label6);
this.groupBox4.Controls.Add(this.E10TextBox);
this.groupBox4.Controls.Add(this.label7);
@ -763,31 +685,111 @@ namespace HighWayIot.Winform.UserControlPages
this.groupBox4.Location = new System.Drawing.Point(400, 0);
this.groupBox4.Margin = new System.Windows.Forms.Padding(0);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(658, 170);
this.groupBox4.Size = new System.Drawing.Size(749, 170);
this.groupBox4.TabIndex = 4;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "贴合参数";
//
// label20
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(591, 139);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(17, 12);
this.label20.TabIndex = 38;
this.label20.Text = "15";
//
// E15TextBox
//
this.E15TextBox.Location = new System.Drawing.Point(621, 136);
this.E15TextBox.Name = "E15TextBox";
this.E15TextBox.Size = new System.Drawing.Size(80, 21);
this.E15TextBox.TabIndex = 37;
//
// label24
//
this.label24.AutoSize = true;
this.label24.Location = new System.Drawing.Point(591, 112);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(17, 12);
this.label24.TabIndex = 36;
this.label24.Text = "14";
//
// E14TextBox
//
this.E14TextBox.Location = new System.Drawing.Point(621, 109);
this.E14TextBox.Name = "E14TextBox";
this.E14TextBox.Size = new System.Drawing.Size(80, 21);
this.E14TextBox.TabIndex = 35;
//
// label25
//
this.label25.AutoSize = true;
this.label25.Location = new System.Drawing.Point(591, 85);
this.label25.Name = "label25";
this.label25.Size = new System.Drawing.Size(17, 12);
this.label25.TabIndex = 34;
this.label25.Text = "13";
//
// E13TextBox
//
this.E13TextBox.Location = new System.Drawing.Point(621, 82);
this.E13TextBox.Name = "E13TextBox";
this.E13TextBox.Size = new System.Drawing.Size(80, 21);
this.E13TextBox.TabIndex = 33;
//
// label33
//
this.label33.AutoSize = true;
this.label33.Location = new System.Drawing.Point(591, 59);
this.label33.Name = "label33";
this.label33.Size = new System.Drawing.Size(17, 12);
this.label33.TabIndex = 32;
this.label33.Text = "12";
//
// E12TextBox
//
this.E12TextBox.Location = new System.Drawing.Point(621, 55);
this.E12TextBox.Name = "E12TextBox";
this.E12TextBox.Size = new System.Drawing.Size(80, 21);
this.E12TextBox.TabIndex = 31;
//
// label35
//
this.label35.AutoSize = true;
this.label35.Location = new System.Drawing.Point(591, 31);
this.label35.Name = "label35";
this.label35.Size = new System.Drawing.Size(17, 12);
this.label35.TabIndex = 30;
this.label35.Text = "11";
//
// E11TextBox
//
this.E11TextBox.Location = new System.Drawing.Point(621, 28);
this.E11TextBox.Name = "E11TextBox";
this.E11TextBox.Size = new System.Drawing.Size(80, 21);
this.E11TextBox.TabIndex = 29;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(377, 141);
this.label6.Location = new System.Drawing.Point(375, 139);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(95, 12);
this.label6.Size = new System.Drawing.Size(53, 12);
this.label6.TabIndex = 28;
this.label6.Text = "贴合补偿脉冲(P)";
this.label6.Text = "停止距离";
//
// E10TextBox
//
this.E10TextBox.Location = new System.Drawing.Point(478, 137);
this.E10TextBox.Location = new System.Drawing.Point(434, 136);
this.E10TextBox.Name = "E10TextBox";
this.E10TextBox.Size = new System.Drawing.Size(100, 21);
this.E10TextBox.Size = new System.Drawing.Size(80, 21);
this.E10TextBox.TabIndex = 27;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(377, 114);
this.label7.Location = new System.Drawing.Point(333, 113);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(95, 12);
this.label7.TabIndex = 26;
@ -795,31 +797,31 @@ namespace HighWayIot.Winform.UserControlPages
//
// E9TextBox
//
this.E9TextBox.Location = new System.Drawing.Point(478, 110);
this.E9TextBox.Location = new System.Drawing.Point(434, 109);
this.E9TextBox.Name = "E9TextBox";
this.E9TextBox.Size = new System.Drawing.Size(100, 21);
this.E9TextBox.Size = new System.Drawing.Size(80, 21);
this.E9TextBox.TabIndex = 25;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(353, 87);
this.label8.Location = new System.Drawing.Point(393, 86);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(119, 12);
this.label8.Size = new System.Drawing.Size(35, 12);
this.label8.TabIndex = 24;
this.label8.Text = "包边宽度(3/4/5工位)";
this.label8.Text = "备用3";
//
// E8TextBox
//
this.E8TextBox.Location = new System.Drawing.Point(478, 83);
this.E8TextBox.Location = new System.Drawing.Point(434, 82);
this.E8TextBox.Name = "E8TextBox";
this.E8TextBox.Size = new System.Drawing.Size(100, 21);
this.E8TextBox.Size = new System.Drawing.Size(80, 21);
this.E8TextBox.TabIndex = 23;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(377, 60);
this.label9.Location = new System.Drawing.Point(333, 59);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(95, 12);
this.label9.TabIndex = 22;
@ -827,15 +829,15 @@ namespace HighWayIot.Winform.UserControlPages
//
// E7TextBox
//
this.E7TextBox.Location = new System.Drawing.Point(478, 56);
this.E7TextBox.Location = new System.Drawing.Point(434, 55);
this.E7TextBox.Name = "E7TextBox";
this.E7TextBox.Size = new System.Drawing.Size(100, 21);
this.E7TextBox.Size = new System.Drawing.Size(80, 21);
this.E7TextBox.TabIndex = 21;
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(413, 32);
this.label10.Location = new System.Drawing.Point(369, 31);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(59, 12);
this.label10.TabIndex = 20;
@ -843,15 +845,15 @@ namespace HighWayIot.Winform.UserControlPages
//
// E6TextBox
//
this.E6TextBox.Location = new System.Drawing.Point(478, 29);
this.E6TextBox.Location = new System.Drawing.Point(434, 28);
this.E6TextBox.Name = "E6TextBox";
this.E6TextBox.Size = new System.Drawing.Size(100, 21);
this.E6TextBox.Size = new System.Drawing.Size(80, 21);
this.E6TextBox.TabIndex = 19;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(182, 138);
this.label5.Location = new System.Drawing.Point(182, 139);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(59, 12);
this.label5.TabIndex = 18;
@ -859,41 +861,41 @@ namespace HighWayIot.Winform.UserControlPages
//
// E5TextBox
//
this.E5TextBox.Location = new System.Drawing.Point(247, 135);
this.E5TextBox.Location = new System.Drawing.Point(247, 136);
this.E5TextBox.Name = "E5TextBox";
this.E5TextBox.Size = new System.Drawing.Size(100, 21);
this.E5TextBox.Size = new System.Drawing.Size(80, 21);
this.E5TextBox.TabIndex = 17;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(128, 114);
this.label4.Location = new System.Drawing.Point(182, 114);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(113, 12);
this.label4.Size = new System.Drawing.Size(59, 12);
this.label4.TabIndex = 16;
this.label4.Text = "胶片贴合时间(0.1s)";
this.label4.Text = "备用时间2";
//
// E4TextBox
//
this.E4TextBox.Location = new System.Drawing.Point(247, 110);
this.E4TextBox.Name = "E4TextBox";
this.E4TextBox.Size = new System.Drawing.Size(100, 21);
this.E4TextBox.Size = new System.Drawing.Size(80, 21);
this.E4TextBox.TabIndex = 15;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(116, 88);
this.label3.Location = new System.Drawing.Point(182, 87);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(125, 12);
this.label3.Size = new System.Drawing.Size(59, 12);
this.label3.TabIndex = 14;
this.label3.Text = "贴合末横裁延时(0.1s)";
this.label3.Text = "备用延时1";
//
// E3TextBox
//
this.E3TextBox.Location = new System.Drawing.Point(247, 83);
this.E3TextBox.Name = "E3TextBox";
this.E3TextBox.Size = new System.Drawing.Size(100, 21);
this.E3TextBox.Size = new System.Drawing.Size(80, 21);
this.E3TextBox.TabIndex = 13;
//
// label2
@ -909,7 +911,7 @@ namespace HighWayIot.Winform.UserControlPages
//
this.E2TextBox.Location = new System.Drawing.Point(247, 56);
this.E2TextBox.Name = "E2TextBox";
this.E2TextBox.Size = new System.Drawing.Size(100, 21);
this.E2TextBox.Size = new System.Drawing.Size(80, 21);
this.E2TextBox.TabIndex = 11;
//
// label1
@ -925,7 +927,7 @@ namespace HighWayIot.Winform.UserControlPages
//
this.E1TextBox.Location = new System.Drawing.Point(247, 29);
this.E1TextBox.Name = "E1TextBox";
this.E1TextBox.Size = new System.Drawing.Size(100, 21);
this.E1TextBox.Size = new System.Drawing.Size(80, 21);
this.E1TextBox.TabIndex = 9;
//
// PositionRadioButtonPanel
@ -1048,10 +1050,10 @@ namespace HighWayIot.Winform.UserControlPages
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.Location = new System.Drawing.Point(1149, 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.Size = new System.Drawing.Size(750, 170);
this.groupbox5.TabIndex = 5;
this.groupbox5.TabStop = false;
this.groupbox5.Text = "公共参数";
@ -1332,11 +1334,11 @@ namespace HighWayIot.Winform.UserControlPages
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(255, 86);
this.label13.Location = new System.Drawing.Point(273, 85);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(53, 12);
this.label13.Size = new System.Drawing.Size(35, 12);
this.label13.TabIndex = 37;
this.label13.Text = "减速距离";
this.label13.Text = "备用1";
//
// S3Check
//
@ -1358,11 +1360,11 @@ namespace HighWayIot.Winform.UserControlPages
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(255, 112);
this.label12.Location = new System.Drawing.Point(273, 112);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(53, 12);
this.label12.Size = new System.Drawing.Size(35, 12);
this.label12.TabIndex = 39;
this.label12.Text = "停止距离";
this.label12.Text = "备用2";
//
// TireWeightTextBox
//
@ -1425,7 +1427,7 @@ namespace HighWayIot.Winform.UserControlPages
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(1722, 63);
this.tableLayoutPanel2.Size = new System.Drawing.Size(1905, 63);
this.tableLayoutPanel2.TabIndex = 9;
//
// panel1
@ -1437,10 +1439,10 @@ namespace HighWayIot.Winform.UserControlPages
this.panel1.Controls.Add(this.UpdateWeightButton);
this.panel1.Controls.Add(this.AddWeightButton);
this.panel1.Controls.Add(this.DeleteWeightButton);
this.panel1.Location = new System.Drawing.Point(861, 0);
this.panel1.Location = new System.Drawing.Point(952, 0);
this.panel1.Margin = new System.Windows.Forms.Padding(0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(861, 63);
this.panel1.Size = new System.Drawing.Size(953, 63);
this.panel1.TabIndex = 5;
//
// label27
@ -1488,7 +1490,7 @@ namespace HighWayIot.Winform.UserControlPages
// DeleteWeightButton
//
this.DeleteWeightButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.DeleteWeightButton.Location = new System.Drawing.Point(746, 12);
this.DeleteWeightButton.Location = new System.Drawing.Point(838, 12);
this.DeleteWeightButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.DeleteWeightButton.Name = "DeleteWeightButton";
this.DeleteWeightButton.Size = new System.Drawing.Size(103, 39);
@ -1497,6 +1499,121 @@ namespace HighWayIot.Winform.UserControlPages
this.DeleteWeightButton.UseVisualStyleBackColor = true;
this.DeleteWeightButton.Click += new System.EventHandler(this.DeleteWeightButton_Click);
//
// Id
//
this.Id.DataPropertyName = "Id";
this.Id.HeaderText = "ID";
this.Id.Name = "Id";
this.Id.ReadOnly = true;
this.Id.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.Id.Width = 40;
//
// MaterialCode
//
this.MaterialCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.MaterialCode.DataPropertyName = "MaterialCode";
this.MaterialCode.HeaderText = "胶料编码";
this.MaterialCode.Name = "MaterialCode";
this.MaterialCode.ReadOnly = true;
this.MaterialCode.Resizable = System.Windows.Forms.DataGridViewTriState.False;
//
// MaterialName
//
this.MaterialName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.MaterialName.DataPropertyName = "MaterialName";
this.MaterialName.HeaderText = "胶料名称";
this.MaterialName.Name = "MaterialName";
this.MaterialName.ReadOnly = true;
this.MaterialName.Resizable = System.Windows.Forms.DataGridViewTriState.False;
//
// MaterialType
//
this.MaterialType.DataPropertyName = "MaterialType";
this.MaterialType.HeaderText = "胶料类型";
this.MaterialType.Name = "MaterialType";
this.MaterialType.ReadOnly = true;
this.MaterialType.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.MaterialType.Width = 89;
//
// SetThickness
//
this.SetThickness.DataPropertyName = "SetThickness";
this.SetThickness.HeaderText = "厚度";
this.SetThickness.Name = "SetThickness";
this.SetThickness.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SetThickness.Width = 59;
//
// SetWidth1
//
this.SetWidth1.DataPropertyName = "SetWidth";
this.SetWidth1.HeaderText = "宽度1";
this.SetWidth1.Name = "SetWidth1";
this.SetWidth1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SetWidth1.Width = 60;
//
// SetLayer1
//
this.SetLayer1.DataPropertyName = "SetLayer";
this.SetLayer1.HeaderText = "层数1";
this.SetLayer1.Name = "SetLayer1";
this.SetLayer1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SetLayer1.Width = 60;
//
// SetWidth2
//
this.SetWidth2.DataPropertyName = "SetWidth2";
this.SetWidth2.HeaderText = "宽度2";
this.SetWidth2.Name = "SetWidth2";
this.SetWidth2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SetWidth2.Width = 60;
//
// SetLayer2
//
this.SetLayer2.DataPropertyName = "SetLayer2";
this.SetLayer2.HeaderText = "层数2";
this.SetLayer2.Name = "SetLayer2";
this.SetLayer2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SetLayer2.Width = 60;
//
// SetWidth3
//
this.SetWidth3.DataPropertyName = "SetWidth3";
this.SetWidth3.HeaderText = "宽度3";
this.SetWidth3.Name = "SetWidth3";
this.SetWidth3.Width = 60;
//
// SetLayer3
//
this.SetLayer3.DataPropertyName = "SetLayer3";
this.SetLayer3.HeaderText = "层数3";
this.SetLayer3.Name = "SetLayer3";
this.SetLayer3.Width = 60;
//
// SetWeight
//
this.SetWeight.DataPropertyName = "SetWeight";
this.SetWeight.HeaderText = "重量";
this.SetWeight.Name = "SetWeight";
this.SetWeight.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SetWeight.Width = 70;
//
// SetError
//
this.SetError.DataPropertyName = "SetError";
this.SetError.HeaderText = "公差";
this.SetError.Name = "SetError";
this.SetError.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SetError.Width = 55;
//
// WeightIsUse
//
this.WeightIsUse.DataPropertyName = "IsUse";
this.WeightIsUse.HeaderText = "启用";
this.WeightIsUse.Name = "WeightIsUse";
this.WeightIsUse.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.WeightIsUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.WeightIsUse.Width = 40;
//
// RecipeConfigPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -1507,7 +1624,7 @@ namespace HighWayIot.Winform.UserControlPages
this.Controls.Add(this.tableLayoutPanel1);
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Name = "RecipeConfigPage";
this.Size = new System.Drawing.Size(1722, 1066);
this.Size = new System.Drawing.Size(1905, 995);
((System.ComponentModel.ISupportInitialize)(this.WeightDataGridView)).EndInit();
this.ButtonPanel.ResumeLayout(false);
this.ButtonPanel.PerformLayout();
@ -1636,18 +1753,16 @@ namespace HighWayIot.Winform.UserControlPages
private Label Station3MaterialName;
private Label Station2MaterialName;
private Label Station1MaterialName;
private DataGridViewTextBoxColumn Id;
private DataGridViewTextBoxColumn MaterialCode;
private DataGridViewTextBoxColumn MaterialName;
private DataGridViewTextBoxColumn MaterialType;
private DataGridViewTextBoxColumn SetThickness;
private DataGridViewTextBoxColumn SetWidth1;
private DataGridViewTextBoxColumn SetLayer1;
private DataGridViewTextBoxColumn SetWidth2;
private DataGridViewTextBoxColumn SetLayer2;
private DataGridViewTextBoxColumn SetWeight;
private DataGridViewTextBoxColumn SetError;
private DataGridViewCheckBoxColumn WeightIsUse;
private Label label20;
private TextBox E15TextBox;
private Label label24;
private TextBox E14TextBox;
private Label label25;
private TextBox E13TextBox;
private Label label33;
private TextBox E12TextBox;
private Label label35;
private TextBox E11TextBox;
private DataGridViewTextBoxColumn RId;
private DataGridViewTextBoxColumn RecipeCode;
private DataGridViewTextBoxColumn RecipeName;
@ -1657,5 +1772,19 @@ namespace HighWayIot.Winform.UserControlPages
private DataGridViewTextBoxColumn FixedWidth;
private DataGridViewTextBoxColumn WeightError;
private DataGridViewCheckBoxColumn IsUse;
private DataGridViewTextBoxColumn Id;
private DataGridViewTextBoxColumn MaterialCode;
private DataGridViewTextBoxColumn MaterialName;
private DataGridViewTextBoxColumn MaterialType;
private DataGridViewTextBoxColumn SetThickness;
private DataGridViewTextBoxColumn SetWidth1;
private DataGridViewTextBoxColumn SetLayer1;
private DataGridViewTextBoxColumn SetWidth2;
private DataGridViewTextBoxColumn SetLayer2;
private DataGridViewTextBoxColumn SetWidth3;
private DataGridViewTextBoxColumn SetLayer3;
private DataGridViewTextBoxColumn SetWeight;
private DataGridViewTextBoxColumn SetError;
private DataGridViewCheckBoxColumn WeightIsUse;
}
}

@ -7,6 +7,7 @@ using HighWayIot.Winform.Business;
using HighWayIot.Winform.MainForm;
using HighWayIot.Winform.UserControlPages.RecipeConfigPages;
using HighWayIot.Winform.UserControlPages.SysConfigPages;
using HslCommunication;
using HslCommunication.Profinet.Siemens.S7PlusHelper;
using Models;
using System;
@ -127,33 +128,32 @@ namespace HighWayIot.Winform.UserControlPages
WeightDataGridView.AutoGenerateColumns = false;
RecipeLists = zxRecipeService.GetRecipeInfos();
RecipeDataGridView.DataSource = null;
RecipeDataGridView.DataSource = RecipeLists;
RecipeDataGridView.DataSource = RecipeLists.OrderBy(x => x.RecipeName).ToList();
NowRecipeCode = RecipeDataGridView.Rows[0].Cells["RecipeCode"].Value.ToString();
InitPositionEntities();
try
{
var res = PlcConnect.MelsecInstance2.Read("D200", 1);
if (res.IsSuccess)
{
//读取SPEC编号
PlcSpecNoLabel.Text = PlcConnect.MelsecInstance2.ReadUInt32("D206").ToString();
//读取SPEC名称
PlcSpecNameLabel.Text = PlcConnect.MelsecInstance2.ReadString("D290", 10).ToString();
}
else
{
}
}
catch
{
PlcSpecNoLabel.Text = "PLC连接失败";
PlcSpecNameLabel.Text = "PLC连接失败";
}
//try
//{
// OperateResult res = PlcConnect.ReadByte2("D200", 1);
// if (res.IsSuccess)
// {
// //读取SPEC编号
// PlcSpecNoLabel.Text = PlcConnect.ReadUInt322("D206").Content.ToString();
// //读取SPEC名称
// PlcSpecNameLabel.Text = PlcConnect.ReadString2("D290", 10).Content.ToString();
// }
// else
// {
// MessageBox.Show(res.Message);
// }
//}
//catch
//{
// PlcSpecNoLabel.Text = "PLC连接失败";
// PlcSpecNameLabel.Text = "PLC连接失败";
//}
openMixConfig = zxOpenMixMaterialService.GetInfos();
Station1MaterialName.Text = openMixConfig.Single(x => x.StationNo == 1).MaterialName;
@ -215,7 +215,7 @@ namespace HighWayIot.Winform.UserControlPages
RecipeLists = zxRecipeService.GetRecipeInfos();
RecipeDataGridView.DataSource = null;
RecipeDataGridView.DataSource = RecipeLists;
RecipeDataGridView.DataSource = RecipeLists.OrderBy(x => x.RecipeName).ToList();
}
}
@ -246,13 +246,15 @@ namespace HighWayIot.Winform.UserControlPages
return;
}
//删除成型信息
if (zxWeightService.GetWeightInfos(NowRecipeCode).Count > 0)
{
if (MessageBox.Show("是否要删除其关联的所有称量信息?", "确认", MessageBoxButtons.OKCancel) == DialogResult.OK)
if (MessageBox.Show("是否要删除其关联的所有成型信息?", "确认", MessageBoxButtons.OKCancel) == DialogResult.OK)
{
if (zxWeightService.DeleteWeightInfoByRecipeCode(NowRecipeCode))
{
MessageBox.Show("称量信息删除成功");
MessageBox.Show("成型信息删除成功");
SqlLogHelper.AddLog($"成型信息删除成功 [{NowRecipeCode}]");
}
else
{
@ -261,6 +263,17 @@ namespace HighWayIot.Winform.UserControlPages
}
}
//删除配方字段信息
if (!zxRecipeParaService.DeleteRecipeParaInfoByRecipeCode(NowRecipeCode))
{
MessageBox.Show("配方信息删除失败");
}
if (!zxRecipePositionParaService.DeleteRecipePositionParaInfoByRecipeCode(NowRecipeCode))
{
MessageBox.Show("配方工位信息删除失败");
}
//删除硫化配方防止报错
List<ZxSchedulingEntity> schedulingEntity = ZxSchedulingService.Instance.GetSchedulingInfo();
var updateInfos = schedulingEntity.Where(x => x.RecipeCode1 == NowRecipeCode || x.RecipeCode2 == NowRecipeCode).ToList();
@ -283,6 +296,7 @@ namespace HighWayIot.Winform.UserControlPages
if (zxRecipeService.DeleteRecipeInfoById(id))
{
MessageBox.Show("配方信息删除成功!");
SqlLogHelper.AddLog($"成型信息删除成功 [{NowRecipeCode}]");
}
else
{
@ -292,7 +306,7 @@ namespace HighWayIot.Winform.UserControlPages
RecipeLists = zxRecipeService.GetRecipeInfos();
RecipeDataGridView.DataSource = null;
RecipeDataGridView.DataSource = RecipeLists;
RecipeDataGridView.DataSource = RecipeLists.OrderBy(x => x.RecipeName).ToList();
}
/// <summary>
@ -338,6 +352,7 @@ namespace HighWayIot.Winform.UserControlPages
paraentity.LightWidth = (int)entity.FixedWidth;
zxRecipeParaService.UpdateRecipeParaInfo(paraentity);
MessageBox.Show("配方更新成功!");
SqlLogHelper.AddLog($"配方更新成功 [{NowRecipeCode}]");
}
else
{
@ -347,7 +362,7 @@ namespace HighWayIot.Winform.UserControlPages
RecipeLists = zxRecipeService.GetRecipeInfos();
RecipeDataGridView.DataSource = null;
RecipeDataGridView.DataSource = RecipeLists;
RecipeDataGridView.DataSource = RecipeLists.OrderBy(x => x.RecipeName).ToList();
}
/// <summary>
@ -359,7 +374,7 @@ namespace HighWayIot.Winform.UserControlPages
{
RecipeLists = zxRecipeService.GetRecipeInfos();
RecipeDataGridView.DataSource = null;
RecipeDataGridView.DataSource = RecipeLists;
RecipeDataGridView.DataSource = RecipeLists.OrderBy(x => x.RecipeName).ToList();
}
#endregion
@ -385,7 +400,7 @@ namespace HighWayIot.Winform.UserControlPages
if (form.OutValue == null)
{
return;
}
}
//连同更新PLC字段信息
var config = openMixConfig.Where(x => x.MaterialName == form.OutValue.MaterialName).FirstOrDefault();
if (config != null)
@ -394,8 +409,12 @@ namespace HighWayIot.Winform.UserControlPages
ZxRecipeParaEntity recipePara = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(form.OutValue.RecipeCode).FirstOrDefault();
var prop = recipePara.GetType().GetProperty($"S{config.StationNo + 1}");
prop.SetValue(recipePara, true);
if (form.OutValue.MaterialType == "胎面胶")
{
recipePara.TireWeight = Convert.ToSingle(form.OutValue.SetWeight);
}
zxRecipeParaService.UpdateRecipeParaInfo(recipePara);
//更新字段
//更新工位字段
var positionInfo = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.Position == config.StationNo && x.RecipeCode == NowRecipeCode);
if(positionInfo.Count == 0)
{
@ -403,10 +422,13 @@ namespace HighWayIot.Winform.UserControlPages
{
RecipeCode = NowRecipeCode,
Position = config.StationNo,
E1 = 45,
E2 = 52,
E5 = form.OutValue.SetLayer,
E9 = (int)form.OutValue.SetWidth,
E6 = form.OutValue.SetLayer2,
E7 = (int)form.OutValue.SetWidth2,
E10 = 2900
};
zxRecipePositionParaService.InsertRecipePositionParaInfo(zxRecipePositionParaEntity);
}
@ -452,14 +474,15 @@ namespace HighWayIot.Winform.UserControlPages
return;
}
if (MessageBox.Show($"确定要删除配方编号为 [{NowRecipeCode}] 物料编码为 [{s2}] 的称重信息?", "确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
if (MessageBox.Show($"确定要删除配方编号为 [{NowRecipeCode}] 物料编码为 [{s2}] 的成型信息?", "确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
{
return;
}
if (zxWeightService.DeleteWeightInfoById(id))
{
MessageBox.Show("配方信息删除成功!");
MessageBox.Show("成型信息删除成功!");
SqlLogHelper.AddLog($"成型信息删除成功 配方编号为[{NowRecipeCode}] 物料编码为[{s2}]");
}
else
{
@ -503,8 +526,10 @@ namespace HighWayIot.Winform.UserControlPages
entity.SetThickness = decimal.Parse(Convert.ToString(nowRow.Cells["SetThickness"].Value ?? "0"));
entity.SetWidth = decimal.Parse(Convert.ToString(nowRow.Cells["SetWidth1"].Value ?? "0"));
entity.SetWidth2 = decimal.Parse(Convert.ToString(nowRow.Cells["SetWidth2"].Value ?? "0"));
entity.SetWidth3 = decimal.Parse(Convert.ToString(nowRow.Cells["SetWidth3"].Value ?? "0"));
entity.SetLayer = int.Parse(Convert.ToString(nowRow.Cells["SetLayer1"].Value ?? "0"));
entity.SetLayer2 = int.Parse(Convert.ToString(nowRow.Cells["SetLayer2"].Value ?? "0"));
entity.SetLayer3 = int.Parse(Convert.ToString(nowRow.Cells["SetLayer3"].Value ?? "0"));
entity.SetWeight = decimal.Parse(Convert.ToString(nowRow.Cells["SetWeight"].Value ?? "0"));
entity.SetError = decimal.Parse(Convert.ToString(nowRow.Cells["SetError"].Value ?? "0"));
entity.IsUse = bool.Parse(Convert.ToString(nowRow.Cells["WeightIsUse"].Value));
@ -518,6 +543,13 @@ namespace HighWayIot.Winform.UserControlPages
if (zxWeightService.UpdateWeightInfo(entity))
{
//是否更新重量
if (entity.MaterialType == "胎面胶")
{
ZxRecipeParaEntity recipePara = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(entity.RecipeCode).FirstOrDefault();
recipePara.TireWeight = Convert.ToSingle(entity.SetWeight);
zxRecipeParaService.UpdateRecipeParaInfo(recipePara);
}
//连同更新PLC字段信息
var config = openMixConfig.Where(x => x.MaterialName == entity.MaterialName).FirstOrDefault();
if (config != null)
@ -547,6 +579,7 @@ namespace HighWayIot.Winform.UserControlPages
}
}
MessageBox.Show("成型信息更新成功!");
SqlLogHelper.AddLog($"成型信息更新成功 配方编号为[{NowRecipeCode}] 物料编码为[{entity.MaterialCode}]");
}
else
{
@ -743,6 +776,7 @@ namespace HighWayIot.Winform.UserControlPages
if (flag1 && flag2)
{
BaseForm.LogRefreshAction.Invoke("更新成功");
SqlLogHelper.AddLog($"配方参数保存成功 配方编号为[{NowRecipeCode}]");
}
else
{
@ -816,6 +850,11 @@ namespace HighWayIot.Winform.UserControlPages
E8TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E8);
E9TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E9);
E10TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E10);
E11TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E11);
E12TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E12);
E13TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E13);
E14TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E14);
E15TextBox.Text = GeneralUtils.IntEmptyOrToString(entity.E15);
}
/// <summary>
@ -860,6 +899,11 @@ namespace HighWayIot.Winform.UserControlPages
e.E8 = GeneralUtils.StringNullOrToInt(E8TextBox.Text);
e.E9 = GeneralUtils.StringNullOrToInt(E9TextBox.Text);
e.E10 = GeneralUtils.StringNullOrToInt(E10TextBox.Text);
e.E11 = GeneralUtils.StringNullOrToInt(E11TextBox.Text);
e.E12 = GeneralUtils.StringNullOrToInt(E12TextBox.Text);
e.E13 = GeneralUtils.StringNullOrToInt(E13TextBox.Text);
e.E14 = GeneralUtils.StringNullOrToInt(E14TextBox.Text);
e.E15 = GeneralUtils.StringNullOrToInt(E15TextBox.Text);
e.Position = GetSelectIndex();
e.RecipeCode = NowRecipeCode;
@ -1056,6 +1100,11 @@ namespace HighWayIot.Winform.UserControlPages
E8 = entity.E8,
E9 = entity.E9,
E10 = entity.E10,
E11 = entity.E11,
E12 = entity.E12,
E13 = entity.E13,
E14 = entity.E14,
E15 = entity.E15,
Position = entity.Position,
};
PositionParaCopyBoard.Add(clone);
@ -1120,7 +1169,7 @@ namespace HighWayIot.Winform.UserControlPages
{
return;
}
if (!PlcConnect.MelsecInstance2.Read("D200", 1).IsSuccess)
if (!PlcConnect.ReadByte2("D200", 1).IsSuccess)
{
MessageBox.Show("PLC未连接");
return;
@ -1130,6 +1179,7 @@ namespace HighWayIot.Winform.UserControlPages
if (recipeParaHelper.UploadToPLC(zxRecipeParaEntity, zxRecipePositionParaEntity))
{
MessageBox.Show("下发到PLC成功");
SqlLogHelper.AddLog($"配方参数下发到PLC 配方编号为[{NowRecipeCode}]");
}
else
{
@ -1150,7 +1200,7 @@ namespace HighWayIot.Winform.UserControlPages
{
return;
}
if (!PlcConnect.MelsecInstance2.Read("D200", 1).IsSuccess)
if (!PlcConnect.ReadByte2("D200", 1).IsSuccess)
{
MessageBox.Show("PLC未连接");
return;
@ -1158,6 +1208,7 @@ namespace HighWayIot.Winform.UserControlPages
zxRecipePositionParaEntity = recipeParaHelper.DownLoadFormPlc(ref zxRecipeParaEntity);
SetPublicParaValue(zxRecipeParaEntity);
SetPrivateParaValue(zxRecipePositionParaEntity.First(x => x.Position == GetSelectIndex()));
SqlLogHelper.AddLog($"配方参数从PLC下载到本地 配方编号为[{NowRecipeCode}]");
PlcSpecNameLabel.Text = zxRecipeParaEntity.SpecName.Trim();
PlcSpecNoLabel.Text = zxRecipeParaEntity.SpecCode.Trim();
}
@ -1610,5 +1661,6 @@ namespace HighWayIot.Winform.UserControlPages
}
#endregion
}
}

@ -144,6 +144,12 @@
<metadata name="SetLayer2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SetWidth3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SetLayer3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SetWeight.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

@ -1,11 +1,14 @@
using HighWayIot.Log4net;
using HighWayIot.Plc;
using HighWayIot.Plc.PlcHelper;
using HighWayIot.Repository.domain;
using HighWayIot.Repository.service;
using HighWayIot.Rfid;
using HighWayIot.TouchSocket;
using HighWayIot.Winform.Business;
using HighWayIot.Winform.Properties;
using HslCommunication;
using Models;
using System;
using System.Collections;
using System.Collections.Generic;
@ -63,30 +66,10 @@ namespace HighWayIot.Winform.UserControlPages
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
OperateResult<byte[]> PlcResult = PlcConnect.MelsecInstance2.Read("B230", 2);
if (PlcResult.IsSuccess)
{
byte[] bytes = PlcResult.Content;
Console.WriteLine("长度" + bytes.Length.ToString());
}
else
{
Console.WriteLine("读取失败");
}
WorkStationHelper helper = new WorkStationHelper();
bool[] res = helper.ReadStationSingal();
foreach(var r in res)
{
Console.WriteLine(r.ToString());
}
//var list = xmlUtil.ConfigReader();
//foreach (var item in list)
//{
// Console.WriteLine(item.RoleIndex + item.PageName);
//}
MonitorInsert(
ZxRecipeService.Instance.GetRecipeInfos().FirstOrDefault().RecipeCode,
10.ToString()
);
}
/// <summary>
@ -96,8 +79,8 @@ namespace HighWayIot.Winform.UserControlPages
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{
var a = _touchSocketTcpClient.Send($"10.20.48.{RFIDtext.Text}", _RfidDataAnalyse.Send02H(1000));
LogHelper.Instance.Info($"10.20.48.{RFIDtext.Text} 发送" + (a ? "成功" : "失败"));
var a = _touchSocketTcpClient.Send($"192.168.0.{RFIDtext.Text}", _RfidDataAnalyse.Send02H(1000));
LogHelper.Instance.Info($"192.168.0.{RFIDtext.Text} 发送" + (a ? "成功" : "失败"));
}
/// <summary>
@ -107,7 +90,9 @@ namespace HighWayIot.Winform.UserControlPages
/// <param name="e"></param>
private void button3_Click(object sender, EventArgs e)
{
MessageBox.Show(PlcConnect.MelsecInstance2.Read("D200", 1).IsSuccess.ToString());
//MessageBox.Show(PlcConnect.ReadByte2("D200", 1).IsSuccess.ToString());
var res = PlcConnect.PlcWrite2("D310", 123, DataTypeEnum.UInt16);
MessageBox.Show(res.IsSuccess.ToString());
}
/// <summary>
@ -161,6 +146,33 @@ namespace HighWayIot.Winform.UserControlPages
//PlcShowValue.Text = res;
}
/// <summary>
/// 监控画面信息插入
/// </summary>
public void MonitorInsert(string recipeCode, string deviceNo)
{
ZxRecipeEntity recipeEntity = ZxRecipeService.Instance.GetRecipeInfosByRecipeCode(recipeCode).FirstOrDefault();
if (recipeEntity == null)
{
return;
}
ZxDailyReportEntity entity = new ZxDailyReportEntity()
{
Uuid = Guid.NewGuid().ToString("N"),
VulcanizationNo = deviceNo,
StartTime = DateTime.Now,
RecipeName = recipeEntity.RecipeName,
RecipeCode = recipeEntity.RecipeCode,
SpecCode = recipeEntity.RecipeSpecCode,
DeviceNo = RecipeSendBusiness.RecipeNeededVehicleNo,
RawTireWeight = (int)ZxRecipeParaService.Instance.GetRecipeParaInfoByRecipeCode(recipeCode).FirstOrDefault()?.TireWeight,
IsDone = 0
};
ZxDailyReportService.Instance.InsertDailyReportInfo(entity);
}
/// <summary>
/// PLC写入按钮
/// </summary>

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle.Cryptography" version="2.3.1" targetFramework="net48" />
<package id="Enums.NET" version="4.0.1" targetFramework="net48" />
<package id="ExtendedNumerics.BigDecimal" version="2025.1001.2.129" targetFramework="net48" />
<package id="MathNet.Numerics.Signed" version="5.0.0" targetFramework="net48" />
<package id="Microsoft.IO.RecyclableMemoryStream" version="3.0.0" targetFramework="net48" />
<package id="NPOI" version="2.7.3" targetFramework="net48" />
<package id="SharpZipLib" version="1.4.2" targetFramework="net48" />
<package id="SixLabors.Fonts" version="1.0.1" targetFramework="net48" />
<package id="SixLabors.ImageSharp" version="2.1.10" targetFramework="net48" />
<package id="System.Buffers" version="4.6.1" targetFramework="net48" />
<package id="System.Memory" version="4.6.3" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net48" />
<package id="System.Security.Cryptography.Pkcs" version="8.0.1" targetFramework="net48" />
<package id="System.Security.Cryptography.Xml" version="8.0.2" targetFramework="net48" />
<package id="System.Text.Encoding.CodePages" version="5.0.0" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.6.3" targetFramework="net48" />
</packages>
Loading…
Cancel
Save