|
@@ -20,6 +20,8 @@ namespace XdCxRhDW.App.EditForms
|
|
|
public partial class SatEditor : DevExpress.XtraEditors.XtraForm
|
|
|
{
|
|
|
public SatInfo info;
|
|
|
+
|
|
|
+ private List<SatInfo> infos;
|
|
|
public SatEditor()
|
|
|
{
|
|
|
InitializeComponent();
|
|
@@ -45,6 +47,12 @@ namespace XdCxRhDW.App.EditForms
|
|
|
this.txtSatTrans.Text=info.SatTrans?.ToString();
|
|
|
this.searchLookUpEdit1.EditValue = info.Sat;
|
|
|
}
|
|
|
+ infos = new List<SatInfo>();
|
|
|
+ using (RHDWContext db = new RHDWContext())
|
|
|
+ {
|
|
|
+ var res = await db.SatInfos.ToListAsync();
|
|
|
+ infos.AddRange(res);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
@@ -59,7 +67,14 @@ namespace XdCxRhDW.App.EditForms
|
|
|
var sat = searchLookUpEdit1.Text;
|
|
|
var idx = sat.LastIndexOf('(');
|
|
|
var satCodeStr = sat.Substring(idx + 1, sat.Length - idx - 2);
|
|
|
- info.SatCode = Convert.ToInt32(satCodeStr);
|
|
|
+ int satCode= Convert.ToInt32(satCodeStr);
|
|
|
+ if (infos.Any(i => i.ID != info.ID && i.SatCode == satCode))
|
|
|
+ {
|
|
|
+
|
|
|
+ DxHelper.MsgBoxHelper.ShowError($"卫星[{satCode}]已经存在!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ info.SatCode = satCode;
|
|
|
info.SatName = txtSatName.Text.Trim();
|
|
|
if (!string.IsNullOrWhiteSpace(txtSatTrans.Text))
|
|
|
info.SatTrans = Math.Round(Convert.ToDouble(txtSatTrans.Text), 3);
|