This commit is contained in:
ldw
2025-09-18 11:11:38 +08:00
parent 83fbe2a14d
commit b7b328eead
15 changed files with 846 additions and 460 deletions
+116 -63
View File
@@ -26,6 +26,13 @@ namespace LargeSquareOne
private List<string> NGLDTypes3 = new List<string>();//NG拉带类型
private bool isFDEditing = false;
private int editingFDRowIndex = -1;
//档位
private string Grading1 = "一档";
private string Grading2 = "二档";
private string Grading3 = "三档";
private string Grading4 = "四档";
private string Grading5 = "五档";
private string Grading6 = "六档";
private readonly string configFolderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config");
/// <summary>
/// 打印日志方法
@@ -72,8 +79,8 @@ namespace LargeSquareOne
NGLDTypes2.AddRange(new string[] { "面1", "面2", "面3" });
NGLDTypes3.AddRange(new string[] { "面1", "面2", "面3" });
SetupFDDataGridView();
//取消分档 ,有单独的分档机
// LoadFDConfig();
LoadFDConfig();
this.tog_AutoStart.IsChecked = CommonMethods.sysConfig.AutoStart;
this.tog_AutoLogin.IsChecked = CommonMethods.sysConfig.AutoLogin;
@@ -462,9 +469,11 @@ namespace LargeSquareOne
OKLD2Type = device.OKLD2Type,
OKLD3Type = device.OKLD3Type,
OKLD4Type = device.OKLD4Type,
NGLD5Type = device.NGLD5Type,
NGLD6Type = device.NGLD6Type,
NGLD7Type = device.NGLD7Type,
OKLD5Type = device.OKLD5Type,
OKLD6Type = device.OKLD6Type,
//NGLD5Type = device.NGLD5Type,
//NGLD6Type = device.NGLD6Type,
//NGLD7Type = device.NGLD7Type,
IsFDActive = device.IsFDActive,
IsNGActive = device.IsNGActive
}).ToList();
@@ -561,62 +570,78 @@ namespace LargeSquareOne
Width = 120,
ValueType = typeof(string)
},
new DataGridViewTextBoxColumn
{
Name = "OKLD5Type",
HeaderText = "OK拉带类型5",
DataPropertyName = "OKLD5Type",
Width = 120,
ValueType = typeof(string)
},
new DataGridViewTextBoxColumn
{
Name = "OKLD6Type",
HeaderText = "OK拉带类型6",
DataPropertyName = "OKLD6Type",
Width = 120,
ValueType = typeof(string)
},
#endregion
#region NG拉带类型
new DataGridViewComboBoxColumn
{
Name = "NGLD5Type",
HeaderText = "NG拉带类型5",
DataPropertyName = "NGLD5Type",//NG拉带
DataSource = new List<string>(NGLDTypes1), // 使用新列表避免引用问题
Width = 160,
ValueType = typeof(string),
FlatStyle = FlatStyle.Flat,
DefaultCellStyle = new DataGridViewCellStyle
{
BackColor = Color.FromArgb(14, 23, 38), // 深色背景
ForeColor = Color.White, // 白色文字
SelectionBackColor = Color.FromArgb(0, 122, 204), // 选中时的背景色
SelectionForeColor = Color.White, // 选中时的文字颜色
Font = new Font("微软雅黑", 9F) // 字体设置
}
},
new DataGridViewComboBoxColumn
{
Name = "NGLD6Type",
HeaderText = "NG拉带类型6",
DataPropertyName = "NGLD6Type",//NG拉带
DataSource = new List<string>(NGLDTypes2), // 使用新列表避免引用问题
Width = 160,
ValueType = typeof(string),
FlatStyle = FlatStyle.Flat,
DefaultCellStyle = new DataGridViewCellStyle
{
BackColor = Color.FromArgb(14, 23, 38), // 深色背景
ForeColor = Color.White, // 白色文字
SelectionBackColor = Color.FromArgb(0, 122, 204), // 选中时的背景色
SelectionForeColor = Color.White, // 选中时的文字颜色
Font = new Font("微软雅黑", 9F) // 字体设置
}
},
new DataGridViewComboBoxColumn
{
Name = "NGLD7Type",
HeaderText = "NG拉带类型7",
DataPropertyName = "NGLD7Type",//NG拉带
DataSource = new List<string>(NGLDTypes3), // 使用新列表避免引用问题
Width = 160,
ValueType = typeof(string),
FlatStyle = FlatStyle.Flat,
DefaultCellStyle = new DataGridViewCellStyle
{
BackColor = Color.FromArgb(14, 23, 38), // 深色背景
ForeColor = Color.White, // 白色文字
SelectionBackColor = Color.FromArgb(0, 122, 204), // 选中时的背景色
SelectionForeColor = Color.White, // 选中时的文字颜色
Font = new Font("微软雅黑", 9F) // 字体设置
}
},
// new DataGridViewComboBoxColumn
//{
// Name = "NGLD5Type",
// HeaderText = "NG拉带类型5",
// DataPropertyName = "NGLD5Type",//NG拉带
// DataSource = new List<string>(NGLDTypes1), // 使用新列表避免引用问题
// Width = 160,
// ValueType = typeof(string),
// FlatStyle = FlatStyle.Flat,
// DefaultCellStyle = new DataGridViewCellStyle
// {
// BackColor = Color.FromArgb(14, 23, 38), // 深色背景
// ForeColor = Color.White, // 白色文字
// SelectionBackColor = Color.FromArgb(0, 122, 204), // 选中时的背景色
// SelectionForeColor = Color.White, // 选中时的文字颜色
// Font = new Font("微软雅黑", 9F) // 字体设置
// }
//},
//new DataGridViewComboBoxColumn
//{
// Name = "NGLD6Type",
// HeaderText = "NG拉带类型6",
// DataPropertyName = "NGLD6Type",//NG拉带
// DataSource = new List<string>(NGLDTypes2), // 使用新列表避免引用问题
// Width = 160,
// ValueType = typeof(string),
// FlatStyle = FlatStyle.Flat,
// DefaultCellStyle = new DataGridViewCellStyle
// {
// BackColor = Color.FromArgb(14, 23, 38), // 深色背景
// ForeColor = Color.White, // 白色文字
// SelectionBackColor = Color.FromArgb(0, 122, 204), // 选中时的背景色
// SelectionForeColor = Color.White, // 选中时的文字颜色
// Font = new Font("微软雅黑", 9F) // 字体设置
// }
//},
//new DataGridViewComboBoxColumn
//{
// Name = "NGLD7Type",
// HeaderText = "NG拉带类型7",
// DataPropertyName = "NGLD7Type",//NG拉带
// DataSource = new List<string>(NGLDTypes3), // 使用新列表避免引用问题
// Width = 160,
// ValueType = typeof(string),
// FlatStyle = FlatStyle.Flat,
// DefaultCellStyle = new DataGridViewCellStyle
// {
// BackColor = Color.FromArgb(14, 23, 38), // 深色背景
// ForeColor = Color.White, // 白色文字
// SelectionBackColor = Color.FromArgb(0, 122, 204), // 选中时的背景色
// SelectionForeColor = Color.White, // 选中时的文字颜色
// Font = new Font("微软雅黑", 9F) // 字体设置
// }
//},
#endregion
#region 开启分档
new DataGridViewCheckBoxColumn
@@ -784,9 +809,11 @@ namespace LargeSquareOne
config.OKLD2Type = row.Cells["OKLD2Type"].Value?.ToString() ?? "";
config.OKLD3Type = row.Cells["OKLD3Type"].Value?.ToString() ?? "";
config.OKLD4Type = row.Cells["OKLD4Type"].Value?.ToString() ?? "";
config.NGLD5Type = row.Cells["NGLD5Type"].Value?.ToString() ?? "";
config.NGLD6Type = row.Cells["NGLD6Type"].Value?.ToString() ?? "";
config.NGLD7Type = row.Cells["NGLD7Type"].Value?.ToString() ?? "";
config.OKLD5Type = row.Cells["OKLD5Type"].Value?.ToString() ?? "";
config.OKLD6Type = row.Cells["OKLD6Type"].Value?.ToString() ?? "";
//config.NGLD5Type = row.Cells["NGLD5Type"].Value?.ToString() ?? "";
//config.NGLD6Type = row.Cells["NGLD6Type"].Value?.ToString() ?? "";
//config.NGLD7Type = row.Cells["NGLD7Type"].Value?.ToString() ?? "";
config.IsFDActive = row.Cells["IsFDActive"].Value != null &&
Convert.ToBoolean(row.Cells["IsFDActive"].Value);
@@ -833,7 +860,14 @@ namespace LargeSquareOne
string backupFile = $"{FdConfigFilePath}.bak";
File.Copy(FdConfigFilePath, backupFile, true);
}
//
Grading1 = fdConfigs[0].OKLD1Type;
Grading2 = fdConfigs[0].OKLD2Type;
Grading3 = fdConfigs[0].OKLD3Type;
Grading4 = fdConfigs[0].OKLD4Type;
Grading5 = fdConfigs[0].OKLD5Type;
Grading6 = fdConfigs[0].OKLD6Type;
SaveFD2xml();
// 直接保存到目标文件
MiniExcel.SaveAs(FdConfigFilePath, fdConfigs, overwriteFile: true);
}
@@ -860,6 +894,25 @@ namespace LargeSquareOne
{
dgvFdConfigs.DataSource = null;
dgvFdConfigs.DataSource = new BindingList<FDConfig>(fdConfigs);
}
private void SaveFD2xml()
{
CommonMethods.mesConfig.Grading1 = Grading1;
CommonMethods.mesConfig.Grading2 = Grading2;
CommonMethods.mesConfig.Grading3 = Grading3;
CommonMethods.mesConfig.Grading4 = Grading4;
CommonMethods.mesConfig.Grading5 = Grading5;
CommonMethods.mesConfig.Grading6 = Grading6;
//档位
IniConfigHelper.WriteIniData("MES配置", "Grading1", Grading1);
IniConfigHelper.WriteIniData("MES配置", "Grading2", Grading2);
IniConfigHelper.WriteIniData("MES配置", "Grading3", Grading3);
IniConfigHelper.WriteIniData("MES配置", "Grading4", Grading4);
IniConfigHelper.WriteIniData("MES配置", "Grading5", Grading5);
IniConfigHelper.WriteIniData("MES配置", "Grading6", Grading6);
}
#endregion
}