添加项目文件。

This commit is contained in:
2025-06-03 17:27:51 +08:00
parent 86e545c80b
commit 37b95aead5
148 changed files with 16891 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DynStatDisk.App.Com
{
public class BitStateSgl
{
public BitStateSgl(string sglName, bool state)
{
SglName = sglName;
State = state;
}
/// <summary>
/// 信号名称
/// </summary>
public string SglName { get; set; }
/// <summary>
/// 信号状态
/// </summary>
public bool State { get; set; }
}
}

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DynStatDisk.App.Com
{
public class ConfigHelper
{
Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
/// <summary>
/// 根据Key取Value值
/// </summary>
/// <param name="key"></param>
public static string GetValue(string key)
{
return ConfigurationManager.AppSettings[key].ToString().Trim();
}
/// <summary>
/// 根据Key修改Value
/// </summary>
/// <param name="key">要修改的Key</param>
/// <param name="value">要修改为的值</param>
public static void SetValue(string key, string value)
{
//ConfigurationManager.AppSettings.Set(key, value);
//cfa.AppSettings.Settings[key].Value = value;
//cfa.Save();
Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
configuration.AppSettings.Settings[key].Value = value;
configuration.Save();
ConfigurationManager.RefreshSection("appSettings");
}
/// <summary>
/// 添加新的Key Value键值对
/// </summary>
/// <param name="key">Key</param>
/// <param name="value">Value</param>
public static void Add(string key, string value)
{
ConfigurationManager.AppSettings.Add(key, value);
}
/// <summary>
/// 根据Key删除项
/// </summary>
/// <param name="key">Key</param>
public static void Remove(string key)
{
ConfigurationManager.AppSettings.Remove(key);
}
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DynStatDisk.App.Com
{
public class IntStateSgl
{
public IntStateSgl(string sglName, int state, int standardState)
{
SglName = sglName;
State = state;
StandardState = standardState;
}
/// <summary>
/// 信号名称
/// </summary>
public string SglName { get; set; }
/// <summary>
/// 信号状态 标准
/// </summary>
public int StandardState { get; set; }
/// <summary>
/// 信号状态
/// </summary>
public int State { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DynStatDisk.App.Com
{
/// <summary>
/// 操作状态
/// </summary>
public class OpActionState
{
public OpActionState(string name, string currentCategory)
{
Name = name;
CurrentCategory = currentCategory;
CurrentResult = false;
}
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 当前部品类型
/// </summary>
public string CurrentCategory { get; set; }
/// <summary>
/// 当前结果数据
/// </summary>
public bool CurrentResult { get; set; }
}
}

View File

@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DynStatDisk.App.Com
{
public class PLCSglModel
{
public delegate void CylinderNoSglDelegate(bool UpdateValue, string UpdateName);
public event CylinderNoSglDelegate CylinderNoSglEvent;
public delegate void PalletPassSglDelegate(bool UpdateValue, string UpdateName);
public event PalletPassSglDelegate PalletPassSglEvent;
public delegate void TongZhiGuiSglDelegate(bool UpdateValue, string UpdateName);
public event TongZhiGuiSglDelegate TongZhiGuiSglEvent;
public PLCSglModel()
{
_CodeEnable = false;
}
private bool _CodeEnable;
/// <summary>
/// 条码准备完毕信号
/// </summary>
public bool CodeEnable
{
get
{
return _CodeEnable;
}
set
{
if (value != _CodeEnable && value == true)
{
_CodeEnable = value;
CylinderNoSglEvent(true, "CodeReadOK");//开始动作
}
else if (value != _CodeEnable && value == false)
{
_CodeEnable = false;
//PLCCodeEnableEvent(false, "记录和计算信号OFF");
}
}
}
private bool _PalletPassEnable;
/// <summary>
/// 托盘放行信号
/// </summary>
public bool PalletPassEnable
{
get
{
return _PalletPassEnable;
}
set
{
if (value != _PalletPassEnable && value == true)
{
_PalletPassEnable = value;
PalletPassSglEvent(true, "PalletPass");//开始动作
}
else if (value != _PalletPassEnable && value == false)
{
_PalletPassEnable = false;
//PLCCodeEnableEvent(false, "记录和计算信号OFF");
}
}
}
private bool _TongZhiGuiEnable;
/// <summary>
/// 通止规信号
/// </summary>
public bool TongZhiGuiEnable
{
get
{
return _TongZhiGuiEnable;
}
set
{
if (value != _TongZhiGuiEnable && value == true)
{
_TongZhiGuiEnable = value;
//TongZhiGuiSglEvent(false, "Off");//开始动作
TongZhiGuiSglEvent(true, "ON");//开始动作
}
else if (value != _TongZhiGuiEnable && value == false)
{
//从On到Off是通止规的启用的信号
_TongZhiGuiEnable = value;
//TongZhiGuiSglEvent(true, "ON");//开始动作
TongZhiGuiSglEvent(false, "Off");//开始动作
}
}
}
}
}

View File

@@ -0,0 +1,10 @@
using System.Drawing;
namespace DynStatDisk.App.Com
{
public class PhotoImage
{
public string MachineModel { get; set; }
public Image ImageInfo { get; set; }
}
}

View File

@@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DynStatDisk.App.Com
{
public class StateModel
{
public delegate void StateSglDelegate(bool UpdateValue, string Name, string Category);
public event StateSglDelegate StateSglSglEvent;
public StateModel(string name, string category, List<BitStateSgl> listBitStateSgl)
{
Name = name;
Category = category;
ListBitStateSgl = listBitStateSgl;
}
public StateModel(string name, string category, List<IntStateSgl> listIntStateSgl)
{
Name = name;
Category = category;
ListIntStateSgl = listIntStateSgl;
}
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Category { get; set; }
/// <summary>
/// 复位状态
/// </summary>
public void ResetResult()
{
_Result = false;
}
private bool _Result;
/// <summary>
/// 结果判断
/// </summary>
public bool Result
{
get
{
return _Result;
}
set
{
if (value != _Result && value == true)
{
_Result = value;
StateSglSglEvent(true, Name, Category);//开始动作
}
else if (value != _Result && value == false)
{
_Result = false;
//StateSglSglEvent(false, Name, Category);//开始动作
}
}
}
/// <summary>
/// 临时暂存的结果
/// </summary>
public bool TempBitValue { get; set; }
/// <summary>
/// 信号状态集合 Bool
/// </summary>
public List<BitStateSgl> ListBitStateSgl { get; set; }
/// <summary>
/// 信号状态集合 Int
/// </summary>
public List<IntStateSgl> ListIntStateSgl { get; set; }
}
}