feat - 添加排程界面,业务逻辑添加,计划下发测试完毕

master
SoulStar 2 months ago
parent a462562b09
commit 68b0d4f5ee

@ -52,6 +52,7 @@
<Compile Include="PlcEntity\RgvStationEnum.cs" />
<Compile Include="PlcEntity\StationRecipeEntity.cs" />
<Compile Include="PlcHelper\RecipeParaHelper.cs" />
<Compile Include="PlcHelper\RecipeSignal.cs" />
<Compile Include="PlcHelper\TransferSingal.cs" />
<Compile Include="PlcHelper\WorkStationHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />

@ -24,7 +24,7 @@ namespace HighWayIot.Plc.PlcHelper
//SPEC编号写入
try
{
if (!PlcConnect.PlcWrite1("D206", uint.Parse(paraEntity.SpecCode), DataTypeEnum.UInt32).IsSuccess)
if (!PlcConnect.PlcWrite2("D206", uint.Parse(paraEntity.SpecCode), DataTypeEnum.UInt32).IsSuccess)
return false;
}
catch
@ -33,7 +33,7 @@ namespace HighWayIot.Plc.PlcHelper
}
//SPEC名称写入
if (!PlcConnect.PlcWrite1("D290", paraEntity.SpecName, DataTypeEnum.String).IsSuccess)
if (!PlcConnect.PlcWrite2("D290", paraEntity.SpecName, DataTypeEnum.String).IsSuccess)
return false;
//工位参数写入
@ -57,17 +57,18 @@ namespace HighWayIot.Plc.PlcHelper
bitDatas[1] = bitDatas[1].SetBoolByIndex(1, paraEntity.S9 ?? false);
ushort bitData = bitDatas.FromBytes();
if (!PlcConnect.PlcWrite1("D390", bitData, DataTypeEnum.UInt16).IsSuccess) return false;
if (!PlcConnect.PlcWrite2("D390", bitData, DataTypeEnum.UInt16).IsSuccess)
return false;
if (!PlcConnect.PlcWrite1("D391", paraEntity.RimInch ?? 0, DataTypeEnum.UInt16).IsSuccess)
if (!PlcConnect.PlcWrite2("D391", paraEntity.RimInch ?? 0, DataTypeEnum.UInt16).IsSuccess)
return false;
if (!PlcConnect.PlcWrite1("D392", paraEntity.LightWidth ?? 0, DataTypeEnum.UInt16).IsSuccess)
if (!PlcConnect.PlcWrite2("D392", paraEntity.LightWidth ?? 0, DataTypeEnum.UInt16).IsSuccess)
return false;
if (!PlcConnect.PlcWrite1("D393", paraEntity.SlowDistance ?? 0, DataTypeEnum.UInt16).IsSuccess)
if (!PlcConnect.PlcWrite2("D393", paraEntity.SlowDistance ?? 0, DataTypeEnum.UInt16).IsSuccess)
return false;
if (!PlcConnect.PlcWrite1("D394", paraEntity.StopDistance ?? 0, DataTypeEnum.UInt16).IsSuccess)
if (!PlcConnect.PlcWrite2("D394", paraEntity.StopDistance ?? 0, DataTypeEnum.UInt16).IsSuccess)
return false;
if (!PlcConnect.PlcWrite1("D398", paraEntity.TireWeight ?? 0, DataTypeEnum.Float).IsSuccess)
if (!PlcConnect.PlcWrite2("D398", paraEntity.TireWeight ?? 0, DataTypeEnum.Float).IsSuccess)
return false;
return true;
@ -149,7 +150,7 @@ namespace HighWayIot.Plc.PlcHelper
if (value == null)
{
// 根据业务需求选择返回false或使用默认值例如0
if (!PlcConnect.PlcWrite1($"D{add}", 0, DataTypeEnum.UInt16).IsSuccess)
if (!PlcConnect.PlcWrite2($"D{add}", 0, DataTypeEnum.UInt16).IsSuccess)
return false;
}
@ -166,7 +167,7 @@ namespace HighWayIot.Plc.PlcHelper
}
// 写入PLC并检查结果
if (!PlcConnect.PlcWrite1($"D{add}", valueToWrite, DataTypeEnum.UInt16).IsSuccess)
if (!PlcConnect.PlcWrite2($"D{add}", valueToWrite, DataTypeEnum.UInt16).IsSuccess)
return false;
add++;
@ -180,7 +181,7 @@ namespace HighWayIot.Plc.PlcHelper
public List<ZxRecipePositionParaEntity> DownLoadFormPlc(ref ZxRecipeParaEntity paraEntity)
{
//一次性读取
OperateResult<byte[]> result = PlcConnect.MelsecInstance1.Read("D290", 120);
OperateResult<byte[]> result = PlcConnect.MelsecInstance2.Read("D290", 120);
byte[] data;
if (result.IsSuccess)
{
@ -192,16 +193,16 @@ namespace HighWayIot.Plc.PlcHelper
}
//读取SPEC编号
paraEntity.SpecCode = PlcConnect.ReadUInt321("D206").ToString();
paraEntity.SpecCode = PlcConnect.ReadUInt322("D206").ToString();
//读取SPEC名称
paraEntity.SpecName = PlcConnect.MelsecInstance1.ByteTransform.TransString(data, 0, 10, Encoding.ASCII);
paraEntity.SpecName = PlcConnect.MelsecInstance2.ByteTransform.TransString(data, 0, 10, Encoding.ASCII);
//读取工位参数
List<ZxRecipePositionParaEntity> positionEntitys = SelectReadPositionPara(data);
//公共参数读取
ushort bitData = PlcConnect.MelsecInstance1.ByteTransform.TransUInt16(data, (390 - 290) * 2);
ushort bitData = PlcConnect.MelsecInstance2.ByteTransform.TransUInt16(data, (390 - 290) * 2);
byte[] bitDatas = bitData.ToBytes();
paraEntity.S0 = bitDatas[0].GetBoolByIndex(0);
paraEntity.S1 = bitDatas[0].GetBoolByIndex(1);
@ -214,11 +215,11 @@ namespace HighWayIot.Plc.PlcHelper
paraEntity.S8 = bitDatas[1].GetBoolByIndex(0);
paraEntity.S9 = bitDatas[1].GetBoolByIndex(1);
paraEntity.RimInch = PlcConnect.MelsecInstance1.ByteTransform.TransInt16(data, (391 - 290) * 2);//("D391");
paraEntity.LightWidth = PlcConnect.MelsecInstance1.ByteTransform.TransInt16(data, (392 - 290) * 2);//("D392");
paraEntity.SlowDistance = PlcConnect.MelsecInstance1.ByteTransform.TransInt16(data, (393 - 290) * 2);//("D393");
paraEntity.StopDistance = PlcConnect.MelsecInstance1.ByteTransform.TransInt16(data, (394 - 290) * 2);//("D394");
paraEntity.TireWeight = PlcConnect.MelsecInstance1.ByteTransform.TransSingle(data, (398 - 290) * 2);//("D398");
paraEntity.RimInch = PlcConnect.MelsecInstance2.ByteTransform.TransInt16(data, (391 - 290) * 2);//("D391");
paraEntity.LightWidth = PlcConnect.MelsecInstance2.ByteTransform.TransInt16(data, (392 - 290) * 2);//("D392");
paraEntity.SlowDistance = PlcConnect.MelsecInstance2.ByteTransform.TransInt16(data, (393 - 290) * 2);//("D393");
paraEntity.StopDistance = PlcConnect.MelsecInstance2.ByteTransform.TransInt16(data, (394 - 290) * 2);//("D394");
paraEntity.TireWeight = PlcConnect.MelsecInstance2.ByteTransform.TransSingle(data, (398 - 290) * 2);//("D398");
return positionEntitys;
}

@ -0,0 +1,47 @@
using HighWayIot.Log4net;
using HslCommunication;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Plc.PlcHelper
{
public class RecipeSignal
{
/// <summary>
/// 读取排程信号
/// </summary>
/// <returns></returns>
public Dictionary<int, bool> ReadSchedulingSignal()
{
Dictionary<int, bool> result = new Dictionary<int, bool>();
OperateResult<byte[]> operateResult = PlcConnect.MelsecInstance1.Read("B991", 8);
if (!operateResult.IsSuccess)
{
LogHelper.Instance.Error("排程监视信息读取失败");
return null;
}
byte[] bytes = operateResult.Content;
int boolIndex = 0;
for (int i = 0x901 - 0x901; i < 0x93E - 0x901 + 1; i++)
{
result.Add(boolIndex, bytes[i / 8].GetBoolByIndex(i % 8));
boolIndex++;
}
for (int i = 0x941 - 0x941; i < 0x97E - 0x941 + 1; i++)
{
result.Add(boolIndex, bytes[i / 8].GetBoolByIndex(i % 8));
boolIndex++;
}
return result;
}
}
}

@ -86,7 +86,7 @@ namespace HighWayIot.Plc.PlcHelper
/// <returns>第一个Byte数组是第二个Byte数组是开始横裁信号第三个是结束横裁信号</returns>
public bool[][] ReadDrumReadyAndCountReadySignal()
{
OperateResult<byte[]> operateResult = PlcConnect.MelsecInstance1.Read("B991", 2);
OperateResult<byte[]> operateResult = PlcConnect.MelsecInstance1.Read("B980", 3);
if (!operateResult.IsSuccess)
{
@ -110,8 +110,8 @@ namespace HighWayIot.Plc.PlcHelper
//开始和结束横裁的信号
for (int i = 0; i < 8; i++)
{
result[1][i] = data[0].GetBoolByIndex(i);
result[2][i] = data[2].GetBoolByIndex(i);
result[1][i + 1] = data[2].GetBoolByIndex(i);
result[2][i + 1] = data[4].GetBoolByIndex(i);
}
return result;

@ -21,19 +21,17 @@ namespace HighWayIot.Plc.PlcHelper
/// <returns></returns>
public bool WriteStationSingal(int rgvStationNo, int deviceNo)
{
LogHelper.Instance.Info($"{rgvStationNo}工位, {deviceNo}号车");
return true;
//int point = 0x600;
int point = 0x600;
////选择是哪个小车
//point += (deviceNo - 1) * 32;
//选择是哪个小车
point += (deviceNo - 1) * 32;
////选择是小车的哪个点位
//point += rgvStationNo;
//选择是小车的哪个点位
point += rgvStationNo;
//bool result = PlcConnect.PlcWrite2($"B{point.ToString("X")}", true, DataTypeEnum.Bool).IsSuccess;
bool result = PlcConnect.PlcWrite2($"B{point.ToString("X")}", true, DataTypeEnum.Bool).IsSuccess;
//return result;
return result;
}
/// <summary>

@ -62,6 +62,7 @@
<Compile Include="domain\ZxMaterialTypeEntity.cs" />
<Compile Include="domain\ZxMaterialChildTypeEntity.cs" />
<Compile Include="domain\ZxMaterialEntity.cs" />
<Compile Include="domain\ZxOpenMixMaterialEntity.cs" />
<Compile Include="domain\ZxRecipePositionParaEntity.cs" />
<Compile Include="domain\ZxSchedulingEntity.cs" />
<Compile Include="domain\ZxTagSettingEntity.cs" />
@ -71,6 +72,7 @@
<Compile Include="domain\ZxReaderSettingEntity.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Repository.cs" />
<Compile Include="service\ZxOpenMixMaterialService.cs" />
<Compile Include="service\ZxRecipePositionParaService.cs" />
<Compile Include="service\ZxSchedulingService.cs" />
<Compile Include="service\ZxTagSettingService.cs" />

@ -11,7 +11,7 @@ namespace HighWayIot.Repository.domain
/// 小车参数
///</summary>
[SugarTable("zx_car_para")]
internal class ZxCarParaEntity
public class ZxCarParaEntity
{
/// <summary>
/// 备 注:

@ -0,0 +1,30 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Repository.domain
{
/// <summary>
/// 开炼机物料配置表
/// </summary>
[SugarTable("zx_open_mix_material")]
public class ZxOpenMixMaterialEntity
{
/// <summary>
/// 备 注:工位编号
/// 默认值:
///</summary>
[SugarColumn(ColumnName = "station_no", IsPrimaryKey = true, IsIdentity = true)]
public int StationNo { get; set; }
/// <summary>
/// 备 注:物料名称
/// 默认值:
///</summary>
[SugarColumn(ColumnName = "material_name")]
public string MaterialName { get; set; } = string.Empty;
}
}

@ -8,7 +8,7 @@ namespace Models
/// 生产排程实体类
///</summary>
[SugarTable("zx_scheduling")]
public class ZxScheduling
public class ZxSchedulingEntity
{
/// <summary>
/// 备 注:

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace HighWayIot.Repository.service
{
internal class ZxCarParaService
public class ZxCarParaService
{
private static readonly Lazy<ZxCarParaService> lazy = new Lazy<ZxCarParaService>(() => new ZxCarParaService());

@ -0,0 +1,61 @@
using HighWayIot.Log4net;
using HighWayIot.Repository.domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Repository.service
{
public class ZxOpenMixMaterialService
{
private static readonly Lazy<ZxOpenMixMaterialService> lazy = new Lazy<ZxOpenMixMaterialService>(() => new ZxOpenMixMaterialService());
public static ZxOpenMixMaterialService Instance
{
get
{
return lazy.Value;
}
}
private LogHelper log = LogHelper.Instance;
Repository<ZxOpenMixMaterialEntity> _repository => new Repository<ZxOpenMixMaterialEntity>("sqlserver");
/// <summary>
/// 查询配置信息
/// </summary>
/// <returns></returns>
public List<ZxOpenMixMaterialEntity> GetInfos()
{
try
{
List<ZxOpenMixMaterialEntity> entity = _repository.GetList();
return entity;
}
catch (Exception ex)
{
log.Error("开炼机配置信息获取异常", ex);
return null;
}
}
/// <summary>
/// 更新配置信息
/// </summary>
/// <returns></returns>
public bool UpDateInfos(List<ZxOpenMixMaterialEntity> entity)
{
try
{
return _repository.UpdateRange(entity);
}
catch (Exception ex)
{
log.Error("开炼机配置信息更新异常", ex);
return false;
}
}
}
}

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

@ -23,17 +23,17 @@ namespace HighWayIot.Repository.service
}
private LogHelper log = LogHelper.Instance;
Repository<ZxScheduling> _repository => new Repository<ZxScheduling>("sqlserver");
Repository<ZxSchedulingEntity> _repository => new Repository<ZxSchedulingEntity>("sqlserver");
/// <summary>
/// 查询所有排程信息
/// </summary>
/// <returns></returns>
public List<ZxScheduling> GetSchedulingInfo(Expression<Func<ZxScheduling, bool>> expression = null)
public List<ZxSchedulingEntity> GetSchedulingInfo(Expression<Func<ZxSchedulingEntity, bool>> expression = null)
{
try
{
List<ZxScheduling> entity;
List<ZxSchedulingEntity> entity;
if (expression != null)
{
entity = _repository.GetList(expression);
@ -56,7 +56,7 @@ namespace HighWayIot.Repository.service
///// </summary>
///// <param name="entity"></param>
///// <returns></returns>
//public bool InsertSchedulingInfo(ZxScheduling entity)
//public bool InsertSchedulingInfo(ZxSchedulingEntity entity)
//{
// try
// {
@ -74,11 +74,11 @@ namespace HighWayIot.Repository.service
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public bool UpdateSchedulingInfo(ZxScheduling entity)
public bool UpdateSchedulingInfo(List<ZxSchedulingEntity> entity)
{
try
{
return _repository.Update(entity);
return _repository.UpdateRange(entity);
}
catch (Exception ex)
{

@ -39,6 +39,8 @@ namespace HighWayIot.Rfid
result.Status = data[index];
index++;
result.Data = new byte[result.DataLength];
//取Data
Array.Copy(data, 5, result.Data, 0, result.DataLength);
index += result.DataLength;
@ -48,12 +50,12 @@ namespace HighWayIot.Rfid
int xor = 0;
for (int i = 0; i < 3 + result.DataLength; i++)
{
xor ^= data[i];
xor ^= data[i + 2];
}
if(xor != data[data.Length - 1])
if(xor != data[data.Length - 2])
{
_logHelper.Error("数据校验和未通过");
return new BaseReciveDataEntity();
return null;
}
return result;
@ -71,15 +73,16 @@ namespace HighWayIot.Rfid
int index = 2;
//指令头
result[0] = 0xBB;
result[1] = 0xDD;
result[0] = 0xAA;
result[1] = 0x55;
//数据长度
result[index] = (byte)entity.Data.Length;
index++;
//指令编号
result[index] = entity.Code;
index++;
//数据
Array.Copy(entity.Data, 0, result, 4, entity.Data.Length);
@ -87,9 +90,9 @@ namespace HighWayIot.Rfid
//校验和
int xor = 0;
for (int i = 2; i < 2 + entity.Data.Length; i++)
for (int i = 0; i < 2 + entity.Data.Length; i++)
{
xor ^= result[i];
xor ^= result[i + 2];
}
result[index] = (byte)xor;
index++;

@ -17,14 +17,16 @@ namespace HighWayIot.Rfid
public byte[] Send02H(ushort millisecond)
{
byte[] bytes = BitConverter.GetBytes(millisecond);
bytes = bytes.Reverse().ToArray();
BaseSendDataEntity entity = new BaseSendDataEntity()
{
Code = 0x02,
Data = bytes
};
return BaseRFIDDataAnalyse.BaseSendDataAnalyse(entity);
byte[] result = BaseRFIDDataAnalyse.BaseSendDataAnalyse(entity);
return result;
}
/// <summary>
@ -35,17 +37,28 @@ namespace HighWayIot.Rfid
public Receive02HEntity Receive02H(byte[] bytes)
{
BaseReciveDataEntity recive = BaseRFIDDataAnalyse.BaseReceiveAnalyse(bytes);
if (recive == null)
{
return null;
}
byte[] DataBytes = recive.Data;
Receive02HEntity entity = new Receive02HEntity();
//取读到多少个标签
int index = 0;
entity.TagCount = DataBytes[index];
index++;
if (DataBytes.Length != 0)
{
//取读到多少个标签
entity.TagCount = DataBytes[index];
entity.Data = new List<Single02HReceive>();
index++;
}
else
{
entity.TagCount = 0;
}
//取每一个读到的标签
entity.Data = new List<Single02HReceive>();
for (int i = 0; i < entity.TagCount; i++)
{
Single02HReceive EPCData = new Single02HReceive();
@ -63,11 +76,20 @@ namespace HighWayIot.Rfid
index++;
//取EPC区域
EPCData.PC = new byte[2];
Array.Copy(DataBytes, index, EPCData.PC, 0, 2);
index += 2;
//取读到标签的EPC
Array.Copy(DataBytes, index, EPCData.EPC, 0, 12);
EPCData.EPC = new byte[12];
try
{
Array.Copy(DataBytes, index, EPCData.EPC, 0, 12);
}
catch
{
return null;
}
index += 12;
entity.Data.Add(EPCData);

@ -29,6 +29,8 @@ namespace HighWayIot.TouchSocket
/// </summary>
public Dictionary<string, TcpClient> Clients = new Dictionary<string, TcpClient>();
public int ClientsCount = 0;
public Action<byte[], string> GetMessageAction;
public async Task<bool> CreateTcpClient(string ip, string port)
@ -53,9 +55,10 @@ namespace HighWayIot.TouchSocket
};//有客户端断开连接
tcpClient.Received = async (client, e) =>
{
GetMessageAction.Invoke(e.ByteBlock.Span.ToArray(), client.IP);
await Task.Run(() =>
{
GetMessageAction.Invoke(e.ByteBlock.Span.ToArray(), client.IP);
});
}; //接收信号
await tcpClient.SetupAsync(new TouchSocketConfig()
@ -83,7 +86,7 @@ namespace HighWayIot.TouchSocket
});
}
while (!result.IsSuccess);
_logHelper.Info($"{ip}:{port}连接成功");
_logHelper.Info($"{ip}:{port}连接成功 {++ClientsCount}/17");
Clients.Add(ip, tcpClient);
return true;

@ -0,0 +1,95 @@
using HighWayIot.Log4net;
using HighWayIot.Plc;
using HighWayIot.Plc.PlcHelper;
using HighWayIot.Repository.domain;
using HighWayIot.Repository.service;
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Schema;
using Timer = System.Threading.Timer;
namespace HighWayIot.Winform.Business
{
public class RecipeSendBusiness
{
Timer GetSchedulingTimer;
RecipeSignal recipeSignal = new RecipeSignal();
ZxSchedulingService zxSchedulingService = ZxSchedulingService.Instance;
ZxRecipeParaService zxRecipeParaService = ZxRecipeParaService.Instance;
ZxRecipePositionParaService zxRecipePositionParaService = ZxRecipePositionParaService.Instance;
RecipeParaHelper recipeParaHelper = new RecipeParaHelper();
public RecipeSendBusiness()
{
GetSchedulingTimer = new Timer(new System.Threading.TimerCallback(ReadSignal), null, 0, 1000);
}
/// <summary>
/// 重复读取
/// </summary>
/// <param name="o"></param>
public void ReadSignal(object o)
{
Dictionary<int, bool> a = recipeSignal.ReadSchedulingSignal();
if(a == null)
{
return;
}
if (a == null)
{
LogHelper.Instance.Error("排程信号读取失败");
}
foreach (var item in a)
{
if (item.Value)
{
var schedulingInfo = zxSchedulingService.GetSchedulingInfo();
if ((item.Key + 1) < 63)
{
string recipeNo = schedulingInfo.Single(x => x.Id == item.Key + 1).RecipeNo1;
ZxRecipeParaEntity recipeParaInfo = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(recipeNo).FirstOrDefault();
List<ZxRecipePositionParaEntity> zxRecipePositionParaEntities = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == recipeNo);
if (recipeParaInfo == null)
{
LogHelper.Instance.Error("配方信息获取失败");
return;
}
if (recipeParaHelper.UploadToPLC(recipeParaInfo, zxRecipePositionParaEntities))
{
PlcConnect.PlcWrite2($"B{(item.Key + 0x901).ToString("X")}", false, DataTypeEnum.Bool);
}
}
else
{
string recipeNo = schedulingInfo.Single(x => x.Id == item.Key + 1).RecipeNo2;
ZxRecipeParaEntity recipeParaInfo = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(recipeNo).FirstOrDefault();
List<ZxRecipePositionParaEntity> zxRecipePositionParaEntities = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == recipeNo);
if (recipeParaInfo == null)
{
LogHelper.Instance.Error("配方信息获取失败");
return;
}
if (recipeParaHelper.UploadToPLC(recipeParaInfo, zxRecipePositionParaEntities))
{
PlcConnect.PlcWrite2($"B{(item.Key + 0x941).ToString("X")}", false, DataTypeEnum.Bool);
}
}
return;
}
}
}
}
}

@ -110,11 +110,12 @@ namespace HighWayIot.Winform.Business
{
foreach (var setting in _readerSetting)
{
await _touchSocketTcpClient.CreateTcpClient(setting.RfidIp, "20108");
await Task.Run(() =>
{
_touchSocketTcpClient.CreateTcpClient(setting.RfidIp, "20108");
});
}
_logHelper.Info("所有读写器均连接成功");
IsAllConnected = true;
}
@ -165,6 +166,10 @@ namespace HighWayIot.Winform.Business
public void ReciveRFIDSingal(byte[] bytes, string ip)
{
Receive02HEntity entity = _rfidDataAnalyse.Receive02H(bytes);
if (entity == null || entity.Data == null)
{
return ;
}
//if(entity.TagCount != 1)
//{
// _logHelper.Error("返回多标签!");
@ -195,7 +200,8 @@ namespace HighWayIot.Winform.Business
try
{
///写入对应的PLC信号
_workStationHelper.WriteStationSingal(int.Parse(workstationNo), int.Parse(deviceNo));
//_workStationHelper.WriteStationSingal(int.Parse(workstationNo), int.Parse(deviceNo));
LogHelper.Instance.Info($"{workstationNo}工位, {deviceNo}号车");
}
catch (Exception ex)
{

@ -53,6 +53,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Business\GeneralUtils.cs" />
<Compile Include="Business\RecipeSendBusiness.cs" />
<Compile Include="Business\RoleBusiness.cs" />
<Compile Include="Business\SqlLogHelper.cs" />
<Compile Include="Business\WorkStationBusiness.cs" />

@ -92,7 +92,7 @@ namespace HighWayIot.Winform.MainForm
this.MainMenu.Location = new System.Drawing.Point(0, 0);
this.MainMenu.Name = "MainMenu";
this.MainMenu.Padding = new System.Windows.Forms.Padding(5, 1, 0, 1);
this.MainMenu.Size = new System.Drawing.Size(1475, 24);
this.MainMenu.Size = new System.Drawing.Size(1904, 24);
this.MainMenu.TabIndex = 1;
this.MainMenu.Text = "menuStrip1";
//
@ -164,7 +164,7 @@ namespace HighWayIot.Winform.MainForm
//
this.DaliyReportStripItem.Image = global::HighWayIot.Winform.Properties.Resources.;
this.DaliyReportStripItem.Name = "DaliyReportStripItem";
this.DaliyReportStripItem.Size = new System.Drawing.Size(180, 22);
this.DaliyReportStripItem.Size = new System.Drawing.Size(124, 22);
this.DaliyReportStripItem.Text = "日报表";
this.DaliyReportStripItem.Click += new System.EventHandler(this.StripMenuItemClick);
//
@ -172,7 +172,7 @@ namespace HighWayIot.Winform.MainForm
//
this.OperateLogStripMenuItem.Image = global::HighWayIot.Winform.Properties.Resources.;
this.OperateLogStripMenuItem.Name = "OperateLogStripMenuItem";
this.OperateLogStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.OperateLogStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.OperateLogStripMenuItem.Text = "操作日志";
this.OperateLogStripMenuItem.Click += new System.EventHandler(this.StripMenuItemClick);
//
@ -180,7 +180,7 @@ namespace HighWayIot.Winform.MainForm
//
this.AlarmLogStripMenuItem.Image = global::HighWayIot.Winform.Properties.Resources.;
this.AlarmLogStripMenuItem.Name = "AlarmLogStripMenuItem";
this.AlarmLogStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.AlarmLogStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.AlarmLogStripMenuItem.Text = "报警日志";
this.AlarmLogStripMenuItem.Click += new System.EventHandler(this.StripMenuItemClick);
//
@ -287,7 +287,7 @@ namespace HighWayIot.Winform.MainForm
this.UserControlTabs.Margin = new System.Windows.Forms.Padding(0);
this.UserControlTabs.Name = "UserControlTabs";
this.UserControlTabs.SelectedIndex = 0;
this.UserControlTabs.Size = new System.Drawing.Size(1476, 817);
this.UserControlTabs.Size = new System.Drawing.Size(1905, 995);
this.UserControlTabs.TabIndex = 3;
//
// ClosePageButton
@ -297,7 +297,7 @@ namespace HighWayIot.Winform.MainForm
this.ClosePageButton.Cursor = System.Windows.Forms.Cursors.Hand;
this.ClosePageButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.ClosePageButton.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.ClosePageButton.Location = new System.Drawing.Point(1455, 1);
this.ClosePageButton.Location = new System.Drawing.Point(1884, 1);
this.ClosePageButton.Name = "ClosePageButton";
this.ClosePageButton.Size = new System.Drawing.Size(20, 20);
this.ClosePageButton.TabIndex = 4;
@ -322,9 +322,9 @@ namespace HighWayIot.Winform.MainForm
this.SplitLabel4,
this.StripLabel2,
this.TimeStripLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 841);
this.statusStrip1.Location = new System.Drawing.Point(0, 1019);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(1475, 22);
this.statusStrip1.Size = new System.Drawing.Size(1904, 22);
this.statusStrip1.TabIndex = 5;
this.statusStrip1.Text = "statusStrip1";
//
@ -361,7 +361,7 @@ namespace HighWayIot.Winform.MainForm
// LogInformationToolStrip
//
this.LogInformationToolStrip.Name = "LogInformationToolStrip";
this.LogInformationToolStrip.Size = new System.Drawing.Size(851, 17);
this.LogInformationToolStrip.Size = new System.Drawing.Size(1280, 17);
this.LogInformationToolStrip.Spring = true;
this.LogInformationToolStrip.Text = "message";
//
@ -422,7 +422,7 @@ namespace HighWayIot.Winform.MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1475, 863);
this.ClientSize = new System.Drawing.Size(1904, 1041);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.ClosePageButton);
this.Controls.Add(this.UserControlTabs);

@ -42,6 +42,11 @@ namespace HighWayIot.Winform.MainForm
/// </summary>
WorkStationBusiness workStationBusiness = new WorkStationBusiness();
/// <summary>
/// 配方排程刷新类
/// </summary>
RecipeSendBusiness recipeSendBusiness = new RecipeSendBusiness();
/// <summary>
/// 底边栏消息提示刷新
/// </summary>

@ -115,7 +115,7 @@ namespace HighWayIot.Winform.MainForm
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox1.Image = global::HighWayIot.Winform.Properties.Resources.MesnacLogoHighPixel;
this.pictureBox1.Location = new System.Drawing.Point(50, 27);
this.pictureBox1.Location = new System.Drawing.Point(51, 39);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(174, 189);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;

@ -31,22 +31,27 @@ namespace HighWayIot.Winform
//Console.OutputEncoding = System.Text.Encoding.UTF8;
//Console.InputEncoding = System.Text.Encoding.UTF8;
AllocConsole();//调用系统API调用控制台窗口
// 设置控制台编码为系统默认编码(解决乱码问题)
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//创建窗体
LoginForm loginform = new LoginForm();
logger.Info("程序初始化成功");
//验证成功显示主窗体
if (loginform.ShowDialog() == DialogResult.OK)
try
{
logger.Info("登陆成功");
Application.Run(new BaseForm());
AllocConsole();//调用系统API调用控制台窗口
// 设置控制台编码为系统默认编码(解决乱码问题)
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//创建窗体
LoginForm loginform = new LoginForm();
logger.Info("程序初始化成功");
//验证成功显示主窗体
if (loginform.ShowDialog() == DialogResult.OK)
{
logger.Info("登陆成功");
Application.Run(new BaseForm());
}
FreeConsole();//释放控制台
}
FreeConsole();//释放控制台
catch(Exception ex)
{
logger.Error("程序初始化异常", ex);
}
}
}
}

@ -31,68 +31,190 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
/// </summary>
private void InitializeComponent()
{
this.RoleDataGridView = new System.Windows.Forms.DataGridView();
this.AddRole = new System.Windows.Forms.Button();
this.ButtonPanel = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.RoleDataGridView)).BeginInit();
this.ButtonPanel.SuspendLayout();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.RefreshOpenMixMaterial = new System.Windows.Forms.Button();
this.SaveOpenMixMaterial = new System.Windows.Forms.Button();
this.OpenMixMaterial5 = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.OpenMixMaterial4 = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.OpenMixMaterial3 = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.OpenMixMaterial2 = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.OpenMixMaterial1 = new System.Windows.Forms.ComboBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// RoleDataGridView
// OpenMixMaterial1
//
this.RoleDataGridView.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.RoleDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.RoleDataGridView.Location = new System.Drawing.Point(0, 65);
this.RoleDataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.RoleDataGridView.Name = "RoleDataGridView";
this.RoleDataGridView.RowTemplate.Height = 25;
this.RoleDataGridView.Size = new System.Drawing.Size(883, 497);
this.RoleDataGridView.TabIndex = 0;
this.RoleDataGridView.Tag = "";
this.OpenMixMaterial1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.OpenMixMaterial1.FormattingEnabled = true;
this.OpenMixMaterial1.Location = new System.Drawing.Point(84, 32);
this.OpenMixMaterial1.Name = "OpenMixMaterial1";
this.OpenMixMaterial1.Size = new System.Drawing.Size(234, 24);
this.OpenMixMaterial1.TabIndex = 1;
//
// AddRole
// groupBox1
//
this.AddRole.Location = new System.Drawing.Point(11, 11);
this.AddRole.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.AddRole.Name = "AddRole";
this.AddRole.Size = new System.Drawing.Size(103, 39);
this.AddRole.TabIndex = 1;
this.AddRole.Text = "查询操作信息";
this.AddRole.UseVisualStyleBackColor = true;
this.groupBox1.Controls.Add(this.RefreshOpenMixMaterial);
this.groupBox1.Controls.Add(this.SaveOpenMixMaterial);
this.groupBox1.Controls.Add(this.OpenMixMaterial5);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.OpenMixMaterial4);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.OpenMixMaterial3);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.OpenMixMaterial2);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(OpenMixMaterial1);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(3, 3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(365, 251);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "开炼机胶料配置";
//
// ButtonPanel
// RefreshOpenMixMaterial
//
this.ButtonPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ButtonPanel.Controls.Add(this.AddRole);
this.ButtonPanel.Location = new System.Drawing.Point(0, 0);
this.ButtonPanel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ButtonPanel.Name = "ButtonPanel";
this.ButtonPanel.Size = new System.Drawing.Size(883, 61);
this.ButtonPanel.TabIndex = 4;
this.RefreshOpenMixMaterial.Font = new System.Drawing.Font("宋体", 12F);
this.RefreshOpenMixMaterial.Location = new System.Drawing.Point(224, 191);
this.RefreshOpenMixMaterial.Name = "RefreshOpenMixMaterial";
this.RefreshOpenMixMaterial.Size = new System.Drawing.Size(94, 43);
this.RefreshOpenMixMaterial.TabIndex = 11;
this.RefreshOpenMixMaterial.Text = "刷新";
this.RefreshOpenMixMaterial.UseVisualStyleBackColor = true;
this.RefreshOpenMixMaterial.Click += new System.EventHandler(this.RefreshOpenMixMaterial_Click);
//
// OperateConfigPage
// SaveOpenMixMaterial
//
this.SaveOpenMixMaterial.Font = new System.Drawing.Font("宋体", 12F);
this.SaveOpenMixMaterial.Location = new System.Drawing.Point(20, 191);
this.SaveOpenMixMaterial.Name = "SaveOpenMixMaterial";
this.SaveOpenMixMaterial.Size = new System.Drawing.Size(94, 43);
this.SaveOpenMixMaterial.TabIndex = 10;
this.SaveOpenMixMaterial.Text = "保存";
this.SaveOpenMixMaterial.UseVisualStyleBackColor = true;
this.SaveOpenMixMaterial.Click += new System.EventHandler(this.SaveOpenMixMaterial_Click);
//
// OpenMixMaterial5
//
this.OpenMixMaterial5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.OpenMixMaterial5.FormattingEnabled = true;
this.OpenMixMaterial5.Location = new System.Drawing.Point(84, 152);
this.OpenMixMaterial5.Name = "OpenMixMaterial5";
this.OpenMixMaterial5.Size = new System.Drawing.Size(234, 24);
this.OpenMixMaterial5.TabIndex = 9;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label5.Location = new System.Drawing.Point(16, 153);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(62, 22);
this.label5.TabIndex = 8;
this.label5.Text = "#5工位";
//
// OpenMixMaterial4
//
this.OpenMixMaterial4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.OpenMixMaterial4.FormattingEnabled = true;
this.OpenMixMaterial4.Location = new System.Drawing.Point(84, 122);
this.OpenMixMaterial4.Name = "OpenMixMaterial4";
this.OpenMixMaterial4.Size = new System.Drawing.Size(234, 24);
this.OpenMixMaterial4.TabIndex = 7;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.Location = new System.Drawing.Point(16, 123);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(62, 22);
this.label4.TabIndex = 6;
this.label4.Text = "#4工位";
//
// OpenMixMaterial3
//
this.OpenMixMaterial3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.OpenMixMaterial3.FormattingEnabled = true;
this.OpenMixMaterial3.Location = new System.Drawing.Point(84, 92);
this.OpenMixMaterial3.Name = "OpenMixMaterial3";
this.OpenMixMaterial3.Size = new System.Drawing.Size(234, 24);
this.OpenMixMaterial3.TabIndex = 5;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(16, 93);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(62, 22);
this.label3.TabIndex = 4;
this.label3.Text = "#3工位";
//
// OpenMixMaterial2
//
this.OpenMixMaterial2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.OpenMixMaterial2.FormattingEnabled = true;
this.OpenMixMaterial2.Location = new System.Drawing.Point(84, 62);
this.OpenMixMaterial2.Name = "OpenMixMaterial2";
this.OpenMixMaterial2.Size = new System.Drawing.Size(234, 24);
this.OpenMixMaterial2.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(16, 63);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(62, 22);
this.label2.TabIndex = 2;
this.label2.Text = "#2工位";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(16, 33);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(62, 22);
this.label1.TabIndex = 0;
this.label1.Text = "#1工位";
//
// EquipParamSettingPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLight;
this.Controls.Add(this.ButtonPanel);
this.Controls.Add(this.RoleDataGridView);
this.Controls.Add(this.groupBox1);
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Name = "OperateConfigPage";
this.Size = new System.Drawing.Size(883, 562);
((System.ComponentModel.ISupportInitialize)(this.RoleDataGridView)).EndInit();
this.ButtonPanel.ResumeLayout(false);
this.Name = "EquipParamSettingPage";
this.Size = new System.Drawing.Size(1905, 995);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private DataGridView RoleDataGridView;
private Button AddRole;
private Panel ButtonPanel;
private GroupBox groupBox1;
private Label label1;
private Button RefreshOpenMixMaterial;
private Button SaveOpenMixMaterial;
private ComboBox OpenMixMaterial5;
private Label label5;
private ComboBox OpenMixMaterial4;
private Label label4;
private ComboBox OpenMixMaterial3;
private Label label3;
private ComboBox OpenMixMaterial2;
private Label label2;
private ComboBox OpenMixMaterial1;
}
}

@ -1,4 +1,7 @@
using System;
using HighWayIot.Repository.domain;
using HighWayIot.Repository.service;
using Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@ -12,14 +15,100 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
{
public partial class EquipParamSettingPage : UserControl
{
ZxMaterialService zxMaterialService = ZxMaterialService.Instance;
ZxOpenMixMaterialService zxOpenMixMaterialService = ZxOpenMixMaterialService.Instance;
List<string> zxMaterialEntities = new List<string>();
public EquipParamSettingPage()
{
InitializeComponent();
Init();
}
private void UpdateRole_Click(object sender, EventArgs e)
/// <summary>
/// 初始化
/// </summary>
private void Init()
{
zxMaterialEntities = zxMaterialService.GetMaterialInfos().Select(x => x.MaterialName).ToList();
zxMaterialEntities.Insert(0, "");
OpenMixMaterial1.DataSource = zxMaterialEntities;
List<string> zxMaterialEntities1 = new List<string>(zxMaterialEntities);
OpenMixMaterial2.DataSource = zxMaterialEntities1;
List<string> zxMaterialEntities2 = new List<string>(zxMaterialEntities);
OpenMixMaterial3.DataSource = zxMaterialEntities2;
List<string> zxMaterialEntities3 = new List<string>(zxMaterialEntities);
OpenMixMaterial4.DataSource = zxMaterialEntities3;
List<string> zxMaterialEntities4 = new List<string>(zxMaterialEntities);
OpenMixMaterial5.DataSource = zxMaterialEntities4;
List<ZxOpenMixMaterialEntity> list = zxOpenMixMaterialService.GetInfos();
if (list != null && list.Count > 0)
{
OpenMixMaterial1.SelectedItem = list[0].MaterialName;
OpenMixMaterial2.SelectedItem = list[1].MaterialName;
OpenMixMaterial3.SelectedItem = list[2].MaterialName;
OpenMixMaterial4.SelectedItem = list[3].MaterialName;
OpenMixMaterial5.SelectedItem = list[4].MaterialName;
}
}
/// <summary>
/// 保存开炼机物料配置
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SaveOpenMixMaterial_Click(object sender, EventArgs e)
{
List<ZxOpenMixMaterialEntity> list = new List<ZxOpenMixMaterialEntity>()
{
new ZxOpenMixMaterialEntity()
{
StationNo = 1,
MaterialName = OpenMixMaterial1.SelectedItem.ToString()
},
new ZxOpenMixMaterialEntity()
{
StationNo = 2,
MaterialName = OpenMixMaterial2.SelectedItem.ToString()
},
new ZxOpenMixMaterialEntity()
{
StationNo = 3,
MaterialName = OpenMixMaterial3.SelectedItem.ToString()
},
new ZxOpenMixMaterialEntity()
{
StationNo = 4,
MaterialName = OpenMixMaterial4.SelectedItem.ToString()
},
new ZxOpenMixMaterialEntity()
{
StationNo = 5,
MaterialName = OpenMixMaterial5.SelectedItem.ToString()
}
};
if (zxOpenMixMaterialService.UpDateInfos(list))
{
MessageBox.Show("开炼机物料配置信息保存成功");
}
else
{
MessageBox.Show("开炼机物料配置信息保存失败");
}
}
/// <summary>
/// 刷新开炼机物料配置
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RefreshOpenMixMaterial_Click(object sender, EventArgs e)
{
Init();
}
}
}

@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="OpenMixMaterial1.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

@ -31,38 +31,49 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
/// </summary>
private void InitializeComponent()
{
this.RoleDataGridView = new System.Windows.Forms.DataGridView();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
this.SchedulingDataGridView = new System.Windows.Forms.DataGridView();
this.SelectConfigButton = new System.Windows.Forms.Button();
this.ButtonPanel = new System.Windows.Forms.Panel();
this.UpdateConfigButton = new System.Windows.Forms.Button();
this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.DeviceNo = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RecipeName1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RecipeName1 = new System.Windows.Forms.DataGridViewComboBoxColumn();
this.SpecName1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RecipeName2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RecipeName2 = new System.Windows.Forms.DataGridViewComboBoxColumn();
this.SpecName2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.RoleDataGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.SchedulingDataGridView)).BeginInit();
this.ButtonPanel.SuspendLayout();
this.SuspendLayout();
//
// RoleDataGridView
// SchedulingDataGridView
//
this.RoleDataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.SchedulingDataGridView.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.RoleDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.RoleDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.SchedulingDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.SchedulingDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Id,
this.DeviceNo,
this.RecipeName1,
this.SpecName1,
this.RecipeName2,
this.SpecName2});
this.RoleDataGridView.Location = new System.Drawing.Point(0, 65);
this.RoleDataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.RoleDataGridView.Name = "RoleDataGridView";
this.RoleDataGridView.RowTemplate.Height = 25;
this.RoleDataGridView.Size = new System.Drawing.Size(1105, 676);
this.RoleDataGridView.TabIndex = 0;
this.RoleDataGridView.Tag = "";
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";
this.SchedulingDataGridView.RowHeadersVisible = false;
this.SchedulingDataGridView.RowTemplate.Height = 25;
this.SchedulingDataGridView.Size = new System.Drawing.Size(1105, 676);
this.SchedulingDataGridView.TabIndex = 0;
this.SchedulingDataGridView.Tag = "";
this.SchedulingDataGridView.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.SchedulingDataGridView_CellEnter);
this.SchedulingDataGridView.EditingControlShowing += new System.Windows.Forms.DataGridViewEditingControlShowingEventHandler(this.SchedulingDataGridView_EditingControlShowing);
//
// SelectConfigButton
//
@ -98,38 +109,71 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
this.UpdateConfigButton.UseVisualStyleBackColor = true;
this.UpdateConfigButton.Click += new System.EventHandler(this.UpdateConfigButton_Click);
//
// Id
//
this.Id.DataPropertyName = "Id";
dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Id.DefaultCellStyle = dataGridViewCellStyle7;
this.Id.HeaderText = "ID";
this.Id.Name = "Id";
this.Id.ReadOnly = true;
this.Id.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.Id.Width = 50;
//
// DeviceNo
//
this.DeviceNo.DataPropertyName = "DeviceNo";
dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.DeviceNo.DefaultCellStyle = dataGridViewCellStyle8;
this.DeviceNo.HeaderText = "机台编号";
this.DeviceNo.Name = "DeviceNo";
this.DeviceNo.ReadOnly = true;
this.DeviceNo.Resizable = System.Windows.Forms.DataGridViewTriState.False;
//
// RecipeName1
//
this.RecipeName1.DataPropertyName = "RecipeName1";
dataGridViewCellStyle9.BackColor = System.Drawing.Color.Transparent;
dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle9.ForeColor = System.Drawing.Color.Black;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.Transparent;
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.Black;
this.RecipeName1.DefaultCellStyle = dataGridViewCellStyle9;
this.RecipeName1.HeaderText = "成品代号 - 上模";
this.RecipeName1.Name = "RecipeName1";
this.RecipeName1.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.RecipeName1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.RecipeName1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.RecipeName1.Width = 150;
//
// SpecName1
//
this.SpecName1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.SpecName1.DataPropertyName = "SpecName1";
dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.SpecName1.DefaultCellStyle = dataGridViewCellStyle10;
this.SpecName1.HeaderText = "标称尺度 - 上模";
this.SpecName1.Name = "SpecName1";
this.SpecName1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
//
// RecipeName2
//
this.RecipeName2.DataPropertyName = "RecipeName2";
dataGridViewCellStyle11.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.RecipeName2.DefaultCellStyle = dataGridViewCellStyle11;
this.RecipeName2.HeaderText = "成品代号 - 下模";
this.RecipeName2.Name = "RecipeName2";
this.RecipeName2.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.RecipeName2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.RecipeName2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.RecipeName2.Width = 150;
//
// SpecName2
//
this.SpecName2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.SpecName2.DataPropertyName = "SpecName2";
dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.SpecName2.DefaultCellStyle = dataGridViewCellStyle12;
this.SpecName2.HeaderText = "标称尺度 - 下模";
this.SpecName2.Name = "SpecName2";
this.SpecName2.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.SpecName2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.SpecName2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// ProductionScheduling
@ -138,11 +182,11 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLight;
this.Controls.Add(this.ButtonPanel);
this.Controls.Add(this.RoleDataGridView);
this.Controls.Add(this.SchedulingDataGridView);
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Name = "ProductionScheduling";
this.Size = new System.Drawing.Size(1105, 741);
((System.ComponentModel.ISupportInitialize)(this.RoleDataGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.SchedulingDataGridView)).EndInit();
this.ButtonPanel.ResumeLayout(false);
this.ResumeLayout(false);
@ -150,14 +194,15 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
#endregion
private DataGridView RoleDataGridView;
private DataGridView SchedulingDataGridView;
private Button SelectConfigButton;
private Panel ButtonPanel;
private Button UpdateConfigButton;
private DataGridViewTextBoxColumn Id;
private DataGridViewTextBoxColumn DeviceNo;
private DataGridViewTextBoxColumn RecipeName1;
private DataGridViewComboBoxColumn RecipeName1;
private DataGridViewTextBoxColumn SpecName1;
private DataGridViewTextBoxColumn RecipeName2;
private DataGridViewComboBoxColumn RecipeName2;
private DataGridViewTextBoxColumn SpecName2;
}
}

@ -1,9 +1,13 @@
using System;
using HighWayIot.Log4net;
using HighWayIot.Repository.service;
using Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@ -12,7 +16,15 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
{
public partial class ProductionScheduling : UserControl
{
ZxSchedulingService zxSchedulingService = ZxSchedulingService.Instance;
ZxRecipeService zxRecipeService = ZxRecipeService.Instance;
List<ZxRecipeEntity> zxRecipeEntities = new List<ZxRecipeEntity>();
List<ZxSchedulingEntity> zxSchedulingEntity = new List<ZxSchedulingEntity>();
BindingSource bindingSource = new BindingSource();
public ProductionScheduling()
{
@ -22,17 +34,132 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages
private void init()
{
zxSchedulingEntity = zxSchedulingService.GetSchedulingInfo();
SchedulingDataGridView.AutoGenerateColumns = false;
bindingSource.DataSource = zxSchedulingEntity;
SchedulingDataGridView.DataSource = null;
SchedulingDataGridView.DataSource = bindingSource;
ComboBoxBind();
}
private void ComboBoxBind()
{
zxRecipeEntities = zxRecipeService.GetRecipeInfos();
RecipeName1.DataSource = null;
RecipeName2.DataSource = null;
List<string> r1 = zxRecipeEntities.Select(x => x.RecipeName).ToList();
r1.Insert(0, "");
RecipeName1.DataSource = r1;
List<string> r2 = zxRecipeEntities.Select(x => x.RecipeName).ToList();
r2.Insert(0, "");
RecipeName2.DataSource = r2;
}
private void UpdateConfigButton_Click(object sender, EventArgs e)
{
if (zxSchedulingService.UpdateSchedulingInfo(zxSchedulingEntity))
{
MessageBox.Show("更新成功");
}
else
{
MessageBox.Show("更新失败");
}
}
private void SelectConfigButton_Click(object sender, EventArgs e)
{
zxSchedulingEntity = zxSchedulingService.GetSchedulingInfo();
bindingSource.DataSource = null;
bindingSource.DataSource = zxSchedulingEntity;
}
private void SchedulingDataGridView_CellEnter(object sender, DataGridViewCellEventArgs e)
{
//实现单击一次显示下拉列表框
if (SchedulingDataGridView.Columns[e.ColumnIndex] is DataGridViewComboBoxColumn && e.RowIndex != -1)
{
SendKeys.Send("{F4}");
}
}
/**
**
**/
ComboBox cbo = new ComboBox();
private void SchedulingDataGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (SchedulingDataGridView.CurrentCell.OwningColumn.Name.Contains("RecipeName") && SchedulingDataGridView.CurrentCell.RowIndex != -1)
{
//保存当前的事件源。为了触发事件后。在取消
cbo = e.Control as ComboBox;
cbo.SelectedIndexChanged += new EventHandler(cbo_SelectedIndexChanged);
}
}
/**
**
**/
void cbo_SelectedIndexChanged(object sender, EventArgs e)
{
ComboBox combox = sender as ComboBox;
//添加离开combox的事件重要
combox.Leave += new EventHandler(combox_Leave);
try
{
//在这里就可以做值是否改变判断
if (combox.SelectedItem != null)
{
int row = SchedulingDataGridView.CurrentCell.RowIndex;
int column = SchedulingDataGridView.CurrentCell.ColumnIndex;
if(column == 2)
{
ZxRecipeEntity recipe = zxRecipeService.GetSingleInfoByRecipeName(combox.Text);
if (recipe == null)
{
zxSchedulingEntity[row].SpecName1 = string.Empty;
zxSchedulingEntity[row].RecipeNo1 = string.Empty;
}
else
{
zxSchedulingEntity[row].SpecName1 = recipe.RecipeSpecName;
zxSchedulingEntity[row].RecipeNo1 = recipe.RecipeCode;
}
}
if(column == 4)
{
ZxRecipeEntity recipe = zxRecipeService.GetSingleInfoByRecipeName(combox.Text);
if (recipe == null)
{
zxSchedulingEntity[row].SpecName2 = string.Empty;
zxSchedulingEntity[row].RecipeNo2 = string.Empty;
}
else
{
zxSchedulingEntity[row].SpecName2 = recipe.RecipeSpecName;
zxSchedulingEntity[row].RecipeNo2 = recipe.RecipeCode;
}
}
SchedulingDataGridView.Refresh();
}
}
catch (Exception ex)
{
LogHelper.Instance.Error("硫化排程发生错误", ex);
}
}
/**
**combox
**/
public void combox_Leave(object sender, EventArgs e)
{
ComboBox combox = sender as ComboBox;
//做完处理,须撤销动态事件
combox.SelectedIndexChanged -= new EventHandler(cbo_SelectedIndexChanged);
}
}
}

@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="Id.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>

@ -42,6 +42,7 @@
this.label4 = new System.Windows.Forms.Label();
this.LengthTextBox = new System.Windows.Forms.TextBox();
this.button3 = new System.Windows.Forms.Button();
this.RFIDtext = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// button1
@ -60,7 +61,7 @@
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(93, 51);
this.button2.TabIndex = 1;
this.button2.Text = "测试1连接";
this.button2.Text = "RFID测试";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
@ -169,11 +170,19 @@
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// RFIDtext
//
this.RFIDtext.Location = new System.Drawing.Point(216, 102);
this.RFIDtext.Name = "RFIDtext";
this.RFIDtext.Size = new System.Drawing.Size(93, 21);
this.RFIDtext.TabIndex = 15;
//
// TestPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLight;
this.Controls.Add(this.RFIDtext);
this.Controls.Add(this.button3);
this.Controls.Add(this.label4);
this.Controls.Add(this.LengthTextBox);
@ -211,5 +220,6 @@
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox LengthTextBox;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.TextBox RFIDtext;
}
}

@ -1,7 +1,10 @@
using HighWayIot.Log4net;
using HighWayIot.Plc;
using HighWayIot.Plc.PlcHelper;
using HighWayIot.Rfid;
using HighWayIot.TouchSocket;
using HighWayIot.Winform.Business;
using HighWayIot.Winform.Properties;
using HslCommunication;
using System;
using System.Collections;
@ -21,6 +24,16 @@ namespace HighWayIot.Winform.UserControlPages
{
private static LogHelper logger = LogHelper.Instance;
/// <summary>
/// TCP客户端
/// </summary>
private TouchSocketTcpClient _touchSocketTcpClient = TouchSocketTcpClient.Instance;
/// <summary>
/// RFID数据分析
/// </summary>
private RfidDataAnalyse _rfidDataAnalyse = new RfidDataAnalyse();
public TestPage()
{
InitializeComponent();
@ -72,12 +85,10 @@ namespace HighWayIot.Winform.UserControlPages
private async void button2_Click(object sender, EventArgs e)
{
bool res = false;
await Task.Run(() =>
{
res = PlcConnect.IsConnect1;
});
PlcShowValue.Text = res.ToString();
var a = await _touchSocketTcpClient.Send($"10.20.48.{RFIDtext.Text}", _rfidDataAnalyse.Send02H(1000));
LogHelper.Instance.Info($"10.20.48.{RFIDtext.Text} 发送" + (a ? "成功" : "失败"));
}
/// <summary>

Loading…
Cancel
Save