Commit 5cf3d1bc 张东亮

配置添加注释

1 个父辈 2a98a472
......@@ -11,31 +11,30 @@ namespace OnlineStore.Common
/// 记录配置的key
/// </summary>
public class Setting_Init
{ /// <summary>
/// 系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要
/// </summary>
public static string App_AutoRun = "App_AutoRun";
/// <summary>
/// 系统主界面标题
/// </summary>
public static string App_Title = "App_Title";
{
[MyConfigComment("系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要")]
public static MyConfig<int> App_AutoRun = 0;
[MyConfigComment("系统主界面标题")]
public static MyConfig<string> App_Title = "MIMO G2";
/// <summary>
/// 摄像机名称
/// </summary>
public static string CameraName = "CameraName";
public static string CodeType = "CodeType";
public static string CodeParamPath = "CodeParamPath";
public static string QRCodeCount = "QRCodeCount";
public static string CodeTimeOut = "CodeTimeOut";
[MyConfigComment("条码类型")]
public static MyConfig<string> CodeType = "QR Code";
[MyConfigComment("条码解码参数路径")]
public static MyConfig<string> CodeParamPath = "";
[MyConfigComment("筛选条码数量")]
public static MyConfig<int> QRCodeCount = 3;
[MyConfigComment("解码的超时时间")]
public static MyConfig<int> CodeTimeOut = 1000;
/// <summary>
/// 校准库位的料盘信息
/// </summary>
public static string FixBuffInfo = "FixBuffInfo";
[MyConfigComment("校准库位的料盘信息")]
public static MyConfig<string> FixBuffInfo = "";
[MyConfigComment("进出轴运动负载阈值")]
public static MyConfig<float> Device_InOutMaxLoadRate = 50;
......@@ -75,5 +74,69 @@ namespace OnlineStore.Common
[MyConfigComment("是否禁止单盘入库")]
public static MyConfig<bool> DisableSingleReelIn = false;
[MyConfigComment("是否启用上料提升轴的料叉检测")]
public static MyConfig<bool> Swicth_BatchFixCheck = false;
[MyConfigComment("料串门光栅触发处理方式:0-设备急停;1-仅料串门停止")]
public static MyConfig<int> StringDoor_SafetyLightCurtainsProcStrategy = 1;
[MyConfigComment("是否启用AGV")]
public static MyConfig<bool> AGV_Enable = false;
[MyConfigComment("AGV服务软件所在电脑IP")]
public static MyConfig<string> AGV_ServerIp = "127.0.0.1";
[MyConfigComment("AGV服务接口")]
public static MyConfig<int> AGV_ServerPort = 12000;
[MyConfigComment("AGV节点编号")]
public static MyConfig<int> AGV_NodeId = 1;
[MyConfigComment("AGV节点名称")]
public static MyConfig<string> AGV_NodeName = "MIMO";
[MyConfigComment("库位高低点最大相差的值")]
public static MyConfig<int> UpDownAxis_Position_MaxRange = 30000;
[MyConfigComment("湿度修正值,写负数 -5等于减5")]
public static MyConfig<int> Device_humidityadjust = 0;
[MyConfigComment("湿度修正最低值,防止修正过头")]
public static MyConfig<int> Device_humiditylimited = 0;
[MyConfigComment("是否使用一维码检测料盘在NG平台")]
public static MyConfig<bool> CamTestReel_useBarcode = false;
[MyConfigComment("NG平台一维码检测料盘:一维码的内容")]
public static MyConfig<string> CamTestReel_barcode = "RW0000015";
[MyConfigComment("NG平台一维码检测料盘:阈值设置,小于该该数量认为有料")]
public static MyConfig<int> CamTestReel_barcodeThreshold = 2;
[MyConfigComment("是否打开NG平台检测料盘调试")]
public static MyConfig<bool> CamTestReel_debug = false;
[MyConfigComment("NG平台颜色检测料盘:总的覆盖数量")]
public static MyConfig<int> CamTestReel_totalcover = 69577;
[MyConfigComment("NG平台颜色检测料盘:色相H的最低值")]
public static MyConfig<int> CamTestReel_HL = 40;
[MyConfigComment("NG平台颜色检测料盘:色相H的最大值")]
public static MyConfig<int> CamTestReel_HH = 70;
[MyConfigComment("NG平台颜色检测料盘:亮度L的最低值")]
public static MyConfig<int> CamTestReel_LL = 15;
[MyConfigComment("NG平台颜色检测料盘:亮度L的最大值")]
public static MyConfig<int> CamTestReel_LH = 100;
[MyConfigComment("NG平台颜色检测料盘:饱和度S的最小值")]
public static MyConfig<int> CamTestReel_SL = 20;
[MyConfigComment("NG平台颜色检测料盘:饱和度S的最大值")]
public static MyConfig<int> CamTestReel_SH = 100;
[MyConfigComment("NG平台颜色检测料盘:阈值设置,小于该值认为有料")]
public static MyConfig<double> CamTestReel_threshold = 0.6;
[MyConfigComment("是否单进单出")]
public static MyConfig<bool> Device_SingleInSingleOut = false;
[MyConfigComment("SMF服务器地址")]
public static MyConfig<string> http_server = "";
[MyConfigComment("料仓CID")]
public static MyConfig<string> CID = "";
[MyConfigComment("温湿度串口号")]
public static MyConfig<string> Device_Humiture_Port = "CMO1";
}
}
......@@ -95,9 +95,9 @@ namespace OnlineStore.Common
public static ASTemperateParam QueryData()
{
//修正值, 配置中写负数 -5等于减5
var humidityadjust = Config.Get("Device_humidityadjust", 0);
var humidityadjust = Setting_Init.Device_humidityadjust;
//最低值,防止修正过头
var humiditylimited = Config.Get("Device_humiditylimited", 0);
var humiditylimited = Setting_Init.Device_humiditylimited;
ASTemperateParam param = new ASTemperateParam(0, 0);
List<double> data = queryData();
if (data.Count.Equals(2))
......
......@@ -20,7 +20,7 @@ public class HIKCamera
public event EventHandler<Bitmap> camera_event;
public string DeviceName = "monitor1";
public PictureBox picture = new PictureBox();
bool enableCamera = ConfigHelper.Config.Get("Func_EnableCam", true);
//bool enableCamera = ConfigHelper.Config.Get("Func_EnableCam", true);
//public bool LoadCameraConfig(out string msg, object preview = null)
//{
// msg = "";
......
......@@ -22,9 +22,9 @@ namespace DeviceLibrary
{
public class CodeManager
{
public static string CodeType = ConfigHelper.Config.Get(Setting_Init.CodeType, "QR Code");
private static int QRCodeCount = ConfigHelper.Config.Get(Setting_Init.QRCodeCount, 3);
private static int CodeTimeOut = ConfigHelper.Config.Get(Setting_Init.CodeTimeOut, 1000);
public static string CodeType = Setting_Init.CodeType;
private static int QRCodeCount = Setting_Init.QRCodeCount;
private static int CodeTimeOut = Setting_Init.CodeTimeOut;
public static List<string> cameraNameList = new List<string>();
public static List<string> codeTypeList = new List<string>();
public static List<string> hikNameList = new List<string>();
......@@ -263,7 +263,7 @@ namespace DeviceLibrary
string logtxt = $"【" + cameraName + "】开始取图片测试是否有料盘" + "\r\n";
DateTime startTime = DateTime.Now;
Bitmap bmp = null;
bool usebarcode = ConfigHelper.Config.Get("CamTestReel_useBarcode", false);
bool usebarcode = Setting_Init.CamTestReel_useBarcode;
if (usebarcode)
{
try
......@@ -284,8 +284,8 @@ namespace DeviceLibrary
}
logtxt += $"【" + cameraName + "】获取到图像" + "\r\n";
string code = ConfigHelper.Config.Get("CamTestReel_barcode", "RW0000015");
int codeThreshold = ConfigHelper.Config.Get("CamTestReel_barcodeThreshold", 2);
string code = Setting_Init.CamTestReel_barcode;
int codeThreshold = Setting_Init.CamTestReel_barcodeThreshold;
//if (ConfigHelper.Config.Get("CamTestReel_debug", false))
// srcimg = SaveImageToFile("test", cameraName, bmp);
......@@ -318,15 +318,15 @@ namespace DeviceLibrary
});
}
logtxt += $" 一维码扫描结果:{count}[{r}],设置可扫描到条码数量:{codeThreshold},result:{((count < codeThreshold)?"有料":"无料")}\r\n";
logtxt += $" 一维码扫描结果:{count}[{r}],设置可扫描到条码数量:{codeThreshold},result:{((count < codeThreshold) ? "有料" : "无料")}\r\n";
if (hasReel != lastHasReel)
{
lastHasReel = hasReel;
}
else if (!ConfigHelper.Config.Get("CamTestReel_debug", false))
else if (!Setting_Init.CamTestReel_debug)
logtxt = "";
if (ConfigHelper.Config.Get("CamTestReel_debug", false) || (TestHasRight.HasValue && TestHasRight.Value != hasReel))
if (Setting_Init.CamTestReel_debug || (TestHasRight.HasValue && TestHasRight.Value != hasReel))
prcimg = SaveImageToFile("test2", cameraName, bmp);
TestHasRight = null;
return hasReel;
......@@ -370,17 +370,17 @@ namespace DeviceLibrary
goto retry;
}
logtxt += $"【" + cameraName + "】获取到图像" + "\r\n";
int totalcover = ConfigHelper.Config.Get("CamTestReel_totalcover", 69577);
int hl = ConfigHelper.Config.Get("CamTestReel_HL", 40);
int hh = ConfigHelper.Config.Get("CamTestReel_HH", 70);
int ll = ConfigHelper.Config.Get("CamTestReel_LL", 15);
int lh = ConfigHelper.Config.Get("CamTestReel_LH", 100);
int sl = ConfigHelper.Config.Get("CamTestReel_SL", 20);
int sh = ConfigHelper.Config.Get("CamTestReel_SH", 100);
int totalcover = Setting_Init.CamTestReel_totalcover;
int hl =Setting_Init.CamTestReel_HL;
int hh = Setting_Init.CamTestReel_HH;
int ll = Setting_Init.CamTestReel_LL;
int lh = Setting_Init.CamTestReel_LH;
int sl = Setting_Init.CamTestReel_SL;
int sh = Setting_Init.CamTestReel_SH;
double threshold = ConfigHelper.Config.Get("CamTestReel_threshold", 0.6);
double threshold = Setting_Init.CamTestReel_threshold;
if (ConfigHelper.Config.Get("CamTestReel_debug", false))
if (Setting_Init.CamTestReel_debug)
srcimg = SaveImageToFile("test", cameraName, bmp);
......@@ -391,7 +391,7 @@ namespace DeviceLibrary
g.DrawImage(bmp, 0, 0, b.Width, b.Height);
}
ImageLockMode imageLockMode = ImageLockMode.ReadOnly;
if (ConfigHelper.Config.Get("CamTestReel_debug", false))
if (Setting_Init.CamTestReel_debug)
imageLockMode = ImageLockMode.ReadWrite;
var bd = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), imageLockMode, b.PixelFormat);
......@@ -430,7 +430,7 @@ namespace DeviceLibrary
if (h.H >= hl && h.H <= hh && h.V >= ll && h.V <= lh && h.S >= sl && h.S <= sh)
{
maskcout++;
if (ConfigHelper.Config.Get("CamTestReel_debug", false))
if (Setting_Init.CamTestReel_debug)
{
Marshal.WriteByte(bd.Scan0, x, 0);
Marshal.WriteByte(bd.Scan0, x + 1, 0);
......@@ -472,10 +472,10 @@ namespace DeviceLibrary
{
lastHasReel = hasReel;
}
else if (!ConfigHelper.Config.Get("CamTestReel_debug", false))
else if (!Setting_Init.CamTestReel_debug)
logtxt = "";
if (ConfigHelper.Config.Get("CamTestReel_debug", false) || (TestHasRight.HasValue && TestHasRight.Value != hasReel))
if (Setting_Init.CamTestReel_debug || (TestHasRight.HasValue && TestHasRight.Value != hasReel))
prcimg = SaveImageToFile("test2", cameraName, b);
b.Dispose();
TestHasRight = null;
......@@ -584,7 +584,7 @@ namespace DeviceLibrary
public static string GetCodeParamFilePath(string codePath)
{
string appPath = Application.StartupPath;
string path = Path.Combine(appPath, ConfigHelper.Config.Get(Setting_Init.CodeParamPath));
string path = Path.Combine(appPath,Setting_Init.CodeParamPath);
string filePath = Path.Combine(path, codePath + ".dcm");
if (File.Exists(filePath))
{
......
......@@ -25,8 +25,8 @@ namespace DeviceLibrary
_storeStatus = value;
}
}
static string server = ConfigHelper.Config.Get("http_server");
static string CID = ConfigHelper.Config.Get("CID");
static string server = Setting_Init.http_server;
static string CID = Setting_Init.CID;
int StoreID = 1;
string StoreName = "";
......@@ -123,7 +123,7 @@ namespace DeviceLibrary
operation.op = 1;
operation.data = new Dictionary<string, string>() { { "code", code }, { "boxId", StoreID.ToString() }, { "doorReelSignal", "1" } };
if (reel.PlateH == 100 && ConfigHelper.Config.Get("Device_SingleInSingleOut", false))
if (reel.PlateH == 100 && Setting_Init.Device_SingleInSingleOut)
{
//singleIn 单盘入库
operation.data.Add("singleIn", "true");
......
......@@ -78,7 +78,7 @@ namespace DeviceLibrary
/// <summary>
/// 是否启用上料提升轴的料叉检测
/// </summary>
public bool EnableBatchFixCheck { get { return ConfigAppSettings.GetValue("Swicth_BatchFixCheck", false, "是否启用上料提升轴的料叉检测"); } }
public bool EnableBatchFixCheck { get { return Setting_Init.Swicth_BatchFixCheck; } }
public MainMachine(Robot_Config _config)
{
Config = _config;
......@@ -652,7 +652,7 @@ namespace DeviceLibrary
/// <summary>
/// 料串门光栅触发处理方式
/// </summary>
int stringdoorSafetyProcStrategy = ConfigAppSettings.GetValue("StringDoor_SafetyLightCurtainsProcStrategy", 1, "料串门光栅触发处理方式:0-设备急停;1-仅料串门停止");
int stringdoorSafetyProcStrategy = Setting_Init.StringDoor_SafetyLightCurtainsProcStrategy;
bool SafeCheck()
{
bool ok = true;
......
......@@ -13,10 +13,10 @@ namespace DeviceLibrary
{
public partial class MainMachine
{
string serverIp = ConfigAppSettings.GetValue("AGV_ServerIp", "127.0.0.1", "AGV服务软件所在电脑IP");
int serverPort = ConfigAppSettings.GetValue("AGV_ServerPort", 12000, "AGV服务接口");
int nodeId = ConfigAppSettings.GetValue("AGV_NodeId", 1, "AGV节点编号");
string nodeName = ConfigAppSettings.GetValue("AGV_NodeName", "MIMO", "AGV节点名称");
string serverIp = Setting_Init.AGV_ServerIp;
int serverPort = Setting_Init.AGV_ServerPort;
int nodeId = Setting_Init.AGV_NodeId;
string nodeName = Setting_Init.AGV_NodeName;
Client client;
Node curNode;
MoveInfo AGVMoveInfo;
......@@ -39,7 +39,7 @@ namespace DeviceLibrary
}
public bool UseAgv()
{
return ConfigAppSettings.GetValue("AGV_Enable", false, "是否启用AGV");
return Setting_Init.AGV_Enable;
}
public void SetStatus(NodeStatus nodeStatus)
{
......
......@@ -94,10 +94,10 @@ namespace DeviceLibrary
// IsLoadOk = false;
// msg += errmsg + "\r\n";
//}
if (!HumitureController.Init(ConfigHelper.Config.Get("Device_Humiture_Port")))
if (!HumitureController.Init(Setting_Init.Device_Humiture_Port))
{
IsLoadOk = false;
msg += crc.GetString(L.tempnhum_sensor_init_fail, $"温湿度传感器初始化失败,端口:") + $"{ConfigHelper.Config.Get("Device_Humiture_Port")}\n";
msg += crc.GetString(L.tempnhum_sensor_init_fail, $"温湿度传感器初始化失败,端口:") + $"{Setting_Init.Device_Humiture_Port}\n";
}
//Thread.Sleep(1000);
//if (!IOManager.ConnectionIOList(new List<string>()))
......@@ -213,7 +213,7 @@ namespace DeviceLibrary
reelParam = null;
try
{
string fix = ConfigHelper.Config.Get(Setting_Init.FixBuffInfo, "");
string fix = Setting_Init.FixBuffInfo;
if (!string.IsNullOrEmpty(fix))
{
reelParam = JsonHelper.DeserializeJsonToObject<ReelParam>(fix);
......@@ -229,11 +229,11 @@ namespace DeviceLibrary
public static void PutReelInFixPos(ReelParam reelParam)
{
if (mainMachine.AutoInOutTest) return;
ConfigHelper.Config.Set(Setting_Init.FixBuffInfo, JsonHelper.SerializeObject(reelParam));
Setting_Init.FixBuffInfo = JsonHelper.SerializeObject(reelParam);
}
public static void ClearReelInFixPos()
{
ConfigHelper.Config.Set(Setting_Init.FixBuffInfo, "");
Setting_Init.FixBuffInfo = "";
}
#endregion
}
......
......@@ -26,7 +26,7 @@ namespace TheMachine
crc.OpenResourceLog = true;
InitializeComponent();
this.FormClosing += Form1_FormClosing;
this.Text = Config.Get(Setting_Init.App_Title) + " " + Config.Get("CID");
this.Text =Setting_Init.App_Title + " " + Setting_Init.CID;
crc.GetLanguageEvent += Crc_GetLanguageEvent;
crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
crc.CurrLanguage = Crc_GetLanguageEvent();
......
......@@ -34,7 +34,7 @@ namespace TheMachine
_ = new Mutex(true, Application.ProductName, out bool ret);
if (!ret)
{
IntPtr formhwnd = FindWindow(null, Config.Get(Setting_Init.App_Title));
IntPtr formhwnd = FindWindow(null, Setting_Init.App_Title);
ShowWindow(formhwnd, SW_RESTORE);
SwitchToThisWindow(formhwnd, true);
//MessageBox.Show("该程序已经启动", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
......@@ -54,12 +54,12 @@ namespace TheMachine
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
LogUtil.error($"CurrentDomain_UnhandledException:" +e.ToString());
LogUtil.error($"CurrentDomain_UnhandledException:" + e.ToString());
}
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
LogUtil.error($"Application_ThreadException:" +e.ToString());
LogUtil.error($"Application_ThreadException:" + e.ToString());
}
......
......@@ -25,7 +25,7 @@ namespace TheMachine
InitializeComponent();
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
//chbAutoRun.Enabled = false;
chbAutoRun.Checked = Convert.ToBoolean(ConfigAppSettings.GetValue(Setting_Init.App_AutoRun,0, "系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要"));
chbAutoRun.Checked = Convert.ToBoolean(Setting_Init.App_AutoRun == 1);
this.chbAutoRun.CheckedChanged += new System.EventHandler(this.chbAutoRun_CheckedChanged);
//chbAutoRun.Enabled = true;
for (int i = 0; i < 20; i++)
......@@ -80,12 +80,12 @@ namespace TheMachine
{
if (chbAutoRun.Checked)
{
ConfigAppSettings.SetValue(Setting_Init.App_AutoRun, 1);
Setting_Init.App_AutoRun = 1;
AutoRun(Application.ExecutablePath, true);
}
else
{
ConfigAppSettings.SetValue(Setting_Init.App_AutoRun, 0);
Setting_Init.App_AutoRun = 0;
AutoRun(Application.ExecutablePath, false);
}
}
......@@ -94,7 +94,7 @@ namespace TheMachine
{
if (RobotManage.isRunning)
{
MessageBox.Show(crc.GetString(L.before_FrmPositionTool_stopmuchine,"运行库位校准程序前,需要先停止料仓的运行"));
MessageBox.Show(crc.GetString(L.before_FrmPositionTool_stopmuchine, "运行库位校准程序前,需要先停止料仓的运行"));
}
else
{
......@@ -110,7 +110,7 @@ namespace TheMachine
private void cb_tempsensorport_SelectedIndexChanged(object sender, EventArgs e)
{
HumitureController.Init(ConfigHelper.Config.Get("Device_Humiture_Port"));
HumitureController.Init(Setting_Init.Device_Humiture_Port);
}
private void timer1_Tick(object sender, EventArgs e)
......@@ -130,7 +130,7 @@ namespace TheMachine
private void button1_Click_1(object sender, EventArgs e)
{
Task.Run(()=>CodeManager.TestHasReel(CodeManager.hikNameList[0], out _, out _));
Task.Run(() => CodeManager.TestHasReel(CodeManager.hikNameList[0], out _, out _));
}
//private void button2_Click(object sender, EventArgs e)
......
......@@ -303,7 +303,7 @@ namespace TheMachine
MessageBox.Show(crc.GetString("not_allow", "禁止") + ":\r\n" + crc.GetString("UpDownAxis_IHPosition_P3", "升降轴库位入料高点P3") + $"[{_aCStorePosition.UpDownAxis_IHPosition_P3}]" + "<" + crc.GetString("UpDownAxis_ILPosition_P4", "升降轴库位入料低点P4") + $"[{_aCStorePosition.UpDownAxis_ILPosition_P4}]");
return;
}
int maxDiff = ConfigAppSettings.GetValue("UpDownAxis_Position_MaxRange", 30000, "库位高低点最大相差的值");
int maxDiff = Setting_Init.UpDownAxis_Position_MaxRange;
if ((_aCStorePosition.UpDownAxis_IHPosition_P3 - _aCStorePosition.UpDownAxis_ILPosition_P4) > maxDiff)
{
MessageBox.Show(crc.GetString("not_allow", "禁止") + ":\r\n("
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!