fix: 部署意见修改(6/8)

master
Tongg 5 months ago
parent aa090862f2
commit 3debfe0fc4
  1. 4
      App.config
  2. 23
      Model/Helper/ConfigurationHelper.cs
  3. 14
      ViewModel/BaseWindow/BaseControlVM.cs
  4. 22
      ViewModel/Grading/DiamondSelectVM.cs
  5. 70
      ViewModel/Grading/GradingResultVM.cs
  6. 2
      Views/Configuration/SettingPages/CustomSettingPage.xaml
  7. 7
      Views/Grading/DiamondSelect.xaml

@ -11,6 +11,10 @@
<add key="PrintName" value="Deli DL-770D"/>
<add key="PrintWidth" value="400"/>
<add key="PrintHeight" value="300"/>
<add key="DSSet" value="NA"/>
</appSettings>
<connectionStrings>
<add name="" connectionString=""/>

@ -0,0 +1,23 @@
using System.Configuration;
namespace SparkClient.Model.Helper;
public class ConfigurationHelper
{
static System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
public static string ReadConfigValue(string key)
{
string name = config.AppSettings.Settings[key].Value;
return name;
}
public static void SetConfigValue(string key, string value)
{
config.AppSettings.Settings[key].Value = value;
config.Save(ConfigurationSaveMode.Modified);
System.Configuration.ConfigurationManager.RefreshSection("appSettings");
}
}

@ -69,12 +69,14 @@ public class BaseControlVM : BaseViewModel
WindowManager.mainViewModel.Content = WindowManager.PreviousVM();
}
else {
MessageBox message = new MessageBox();
MessageBoxResult result = message.ShowAsk(MultilingualHelper.getString("DiamodResultCloseConfirm"));
if (MessageBoxResult.OK.Equals(result))
{
WindowManager.mainViewModel.Content = WindowManager.PreviousVM();
}
// 部署改造:2
WindowManager.mainViewModel.Content = WindowManager.PreviousVM();
// MessageBox message = new MessageBox();
// MessageBoxResult result = message.ShowAsk(MultilingualHelper.getString("DiamodResultCloseConfirm"));
// if (MessageBoxResult.OK.Equals(result))
// {
// WindowManager.mainViewModel.Content = WindowManager.PreviousVM();
// }
}
}
else

@ -117,7 +117,7 @@ public class DiamondSelectVM : BaseViewModel
};
List<ButtonViewModel> tempButtons2 = new List<ButtonViewModel>();
var bitmap = new BitmapImage(new Uri("pack://application:,,,/Resource/Images/UIResource/round_P8-P8.png", UriKind.RelativeOrAbsolute));
ButtonViewModel button = new ButtonViewModel() { Text = "P8-P8", ImageSource = bitmap, Type = "ROUND P8 P8", Command = StartGradingCommand };
ButtonViewModel button = new ButtonViewModel() { Text = "P8-P8", ImageSource = bitmap, Type = "ROUND P8 P8", Command = StartGradingCommand, IsFocused = true};
tempButtons2.Add(button);
Buttons2 = tempButtons2;
}
@ -256,7 +256,7 @@ public class DiamondSelectVM : BaseViewModel
try
{
string parameterJson = JsonConvert.SerializeObject(parameter);
;
parameterJson = JToken.Parse(parameterJson).ToString();
string outputPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs", "result");
if (!Directory.Exists(outputPath))
Directory.CreateDirectory(outputPath);
@ -458,7 +458,7 @@ public class DiamondSelectVM : BaseViewModel
}
// 生成时间戳,格式为 yyyyMMddHHmmss
string timestamp = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
string timestamp = DateTime.Now.ToString("yyyyMMdd-HHmmss");
// 组合新的文件夹路径
string newFolderPath = Path.Combine(imageHistoryPath, string.IsNullOrWhiteSpace(dCode) ? $"image-{timestamp}" : $"image-{dCode}-{timestamp}" );
@ -537,6 +537,7 @@ public class DiamondSelectVM : BaseViewModel
{
//WindowManager.mainViewModel.Content = WindowManager.PreviousVM();
BaseControlVM vm = new BaseControlVM(new GradingResultVM(param), MultilingualHelper.getString("DetectionResult"));
vm.WindowTitle = string.IsNullOrWhiteSpace(param.DiamondCode) ? vm.WindowTitle : $"{vm.WindowTitle} - {param.DiamondCode}";
vm.ShowFunctionButton = System.Windows.Visibility.Hidden;
WindowManager.mainViewModel.Content = vm;
WindowManager.openContent.Add(vm);
@ -566,7 +567,7 @@ public class ButtonViewModel : BaseViewModel
private bool _isHighlighted;
private Brush _foreground;
private Brush _background;
private bool _isFocused;
public string Text
{
get { return _text; }
@ -659,6 +660,19 @@ public class ButtonViewModel : BaseViewModel
}
}
public bool IsFocused
{
get
{
return _isFocused;
}
set
{
_isFocused = value;
OnPropertyChanged(nameof(IsFocused));
}
}
[Log]
private void UpdateStyles()
{

@ -119,7 +119,9 @@ public class GradingResultVM : BaseViewModel
/// <summary>
/// 下拉列表DS 选择的值
/// </summary>
public string DS { get { return _ds; } set { _ds = value; OnPropertyChanged(nameof(DS)); } }
public string DS { get { return _ds; } set { _ds = value; OnPropertyChanged(nameof(DS));
saveTempDS(value);
} }
/// <summary>
/// 定级下拉列表
/// </summary>
@ -192,7 +194,7 @@ public class GradingResultVM : BaseViewModel
IsEnabled = false;
}
}
DS = "NA";
DS = ConfigurationManager.AppSettings["DSSet"];
if (IsEnabled)
{
AutoSave();
@ -295,6 +297,13 @@ public class GradingResultVM : BaseViewModel
}
}
}
private void saveTempDS(string selValue)
{
ConfigurationHelper.SetConfigValue("DSSet",selValue);
}
[Log]
private void InitView(AlgorithmResultEntity result)
{
@ -1074,35 +1083,36 @@ public class GradingResultVM : BaseViewModel
Measurements info = algorithmResult.measurements;
StreamWriter stream = new StreamWriter(file);
stream.WriteLine($"IGI REPORT NUMBER={DiamondCode}");
stream.WriteLine($"SARIN WEIGHT={Wight}");
stream.WriteLine($"M1={info.M1}");
stream.WriteLine($"M2={info.M2}");
stream.WriteLine($"M3={info.M3}");
stream.WriteLine($"TABLE={info.TABLE*100}");
stream.WriteLine($"TABLE MIN={info.TABLE_MIN * 100}");
stream.WriteLine($"TABLE MAX={info.TABLE_MAX * 100}");
stream.WriteLine($"CROWN HEIGHT={info.CROWN_HEIGHT * 100}");
stream.WriteLine($"CROWN H MIN={info.CROWN_H_MIN * 100}");
stream.WriteLine($"CROWN H MAX={info.CROWN_H_MAX * 100}");
stream.WriteLine($"CROWN ANGLE={info.CROWN_ANGLE}");
stream.WriteLine($"CROWN ANGLE MIN={info.CROWN_ANGLE_MIN}");
stream.WriteLine($"CROWN ANGLE MAX={info.CROWN_ANGLE_MAX}");
stream.WriteLine($"PAV DEPTH={info.PAV_DEPTH * 100}");
stream.WriteLine($"PAV DEPTH MIN={info.PAV_DEPTH_MIN * 100}");
stream.WriteLine($"PAV DEPTH MAX={info.PAV_DEPTH_MAX * 100}");
stream.WriteLine($"PAV ANGLE={info.PAV_ANGLE}");
stream.WriteLine($"PAV ANGLE MIN={info.PAV_ANGLE_MIN}");
stream.WriteLine($"PAV ANGLE MAX={info.PAV_ANGLE_MAX}");
stream.WriteLine($"GIRDLE={info.GIRDLE * 100}");
stream.WriteLine($"GIRDLE MIN={info.GIRDLE_MIN * 100}");
stream.WriteLine($"GIRDLE MAX={info.GIRDLE_MAX * 100}");
stream.WriteLine($"TOTAL DEPTH={info.TOTAL_DEPTH * 100}");
stream.WriteLine($"CULET={info.CULET*100}");
stream.WriteLine($"SARIN WEIGHT={Double.Parse(Wight).ToString("f3")}");
stream.WriteLine($"M1={info.M1.ToString("f2")}");
stream.WriteLine($"M2={info.M2.ToString("f2")}");
stream.WriteLine($"M3={info.M3.ToString("f2")}");
stream.WriteLine($"TABLE={(info.TABLE * 100).ToString("F1")}");
stream.WriteLine($"TABLE MIN={(info.TABLE_MIN * 100).ToString("F1")}");
stream.WriteLine($"TABLE MAX={(info.TABLE_MAX * 100).ToString("F1")}");
stream.WriteLine($"CROWN HEIGHT={(info.CROWN_HEIGHT * 100).ToString("F1")}");
stream.WriteLine($"CROWN H MIN={(info.CROWN_H_MIN * 100).ToString("F1")}");
stream.WriteLine($"CROWN H MAX={(info.CROWN_H_MAX * 100).ToString("F1")}");
stream.WriteLine($"CROWN ANGLE={(info.CROWN_ANGLE).ToString("F1")}");
stream.WriteLine($"CROWN ANGLE MIN={(info.CROWN_ANGLE_MIN).ToString("F1")}");
stream.WriteLine($"CROWN ANGLE MAX={(info.CROWN_ANGLE_MAX).ToString("F1")}");
stream.WriteLine($"PAV DEPTH={(info.PAV_DEPTH * 100).ToString("F1")}");
stream.WriteLine($"PAV DEPTH MIN={(info.PAV_DEPTH_MIN * 100).ToString("F1")}");
stream.WriteLine($"PAV DEPTH MAX={(info.PAV_DEPTH_MAX * 100).ToString("F1")}");
stream.WriteLine($"PAV ANGLE={(info.PAV_ANGLE).ToString("F1")}");
stream.WriteLine($"PAV ANGLE MIN={(info.PAV_ANGLE_MIN).ToString("F1")}");
stream.WriteLine($"PAV ANGLE MAX={(info.PAV_ANGLE_MAX).ToString("F1")}");
//部署值修改
stream.WriteLine($"GIRDLE={(info.GIRDLE_BEZEL * 100).ToString("F1")}");
stream.WriteLine($"GIRDLE MIN={(info.GIRDLE_BEZEL_MIN * 100).ToString("F1")}");
stream.WriteLine($"GIRDLE MAX={(info.GIRDLE_BEZEL_MAX * 100).ToString("F1")}");
stream.WriteLine($"TOTAL DEPTH={(info.TOTAL_DEPTH * 100).ToString("F1")}");
stream.WriteLine($"CULET={(info.CULET*100).ToString("F1")}");
stream.WriteLine($"MACHINE={machine}");
stream.WriteLine($"CUTGRADE={GetGradeEnName(totalCutGrade.ToString())}");
stream.WriteLine($"LW RATIO={info.LW_RATIO}");
stream.WriteLine($"DS={DS}");
stream.WriteLine($"COC={info.COC * 100}");
stream.WriteLine($"COC={(info.COC * 100).ToString("F1")}");
stream.WriteLine($"USER={username}");
string TABLE_GRADE = DtResults.Where(x => "TABLE".Equals(x.TestItemId)).Select(x=>x.CutLevel).First()??"";
stream.WriteLine($"TABLE GRADE={GetGradeEnName(GetGradeOrder(TABLE_GRADE))}");
@ -1116,9 +1126,9 @@ public class GradingResultVM : BaseViewModel
stream.WriteLine($"PAV ANGLE GRADE={GetGradeEnName(GetGradeOrder(PAV_ANGLE_GRADE))}");
string TD_GRADE = DtResults.Where(x => "TOTAL_DEPTH".Equals(x.TestItemId)).Select(x => x.CutLevel).First() ?? "";
stream.WriteLine($"TD GRADE={GetGradeEnName(GetGradeOrder(TD_GRADE))}");
stream.WriteLine($"TA={info.TA}");
stream.WriteLine($"LGF={info.LGF * 100}");
stream.WriteLine($"STAR={info.STAR * 100}");
stream.WriteLine($"TA={info.TA.ToString("F1")}");
stream.WriteLine($"LGF={(info.LGF * 100).ToString("F1")}");
stream.WriteLine($"STAR={(info.STAR * 100).ToString("F1")}");
stream.Close();
}
}

@ -86,7 +86,7 @@
<RowDefinition />
</Grid.RowDefinitions>
<CheckBox Grid.Row="0" FontSize="16" Margin="0 5" Content="{DynamicResource SystemSettingCustomSetUploadFileText}" IsChecked="{Binding TxtFileChecked}" IsEnabled="False"/>
<CheckBox Grid.Row="1" FontSize="16" Margin="0 5" Content="{DynamicResource SystemSettingCustomSetUploadFileExcel}" IsChecked="{Binding ExcelFileChecked}" IsEnabled="False"/>
<CheckBox Grid.Row="1" FontSize="16" Margin="0 5" Content="{DynamicResource SystemSettingCustomSetUploadFileExcel}" IsChecked="{Binding ExcelFileChecked}" />
<CheckBox Grid.Row="2" FontSize="16" Margin="0 5" Content="{DynamicResource SystemSettingCustomSetUploadFileStl}" IsChecked="{Binding StlFileChecked}"/>
<CheckBox Grid.Row="3" FontSize="16" Margin="0 5" Content="{DynamicResource SystemSettingCustomSetUploadFileDat}" IsChecked="{Binding DatFileChecked}"/>
</Grid>

@ -56,12 +56,13 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Background="Transparent" Command="{Binding Command}" CommandParameter="{Binding Type}" BorderBrush="Transparent" Width="275" Height="170" FocusVisualStyle="{x:Null}" >
<Button Background="Transparent" Command="{Binding Command}" CommandParameter="{Binding Type}" BorderBrush="Transparent" Width="275" Height="170" FocusVisualStyle="{x:Null}" >
<Button.Style>
<Style TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<!-- 按钮内容 -->
<Border Background="#ebeef5" Width="255" Height="150" CornerRadius="10" >
@ -91,7 +92,11 @@
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Overlay" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter TargetName="Overlay" Property="Visibility" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>

Loading…
Cancel
Save