|
@@ -20,6 +20,8 @@ using System.Threading.Tasks;
|
|
|
using System.Web.Http.Results;
|
|
|
using System.Web.UI.WebControls;
|
|
|
using System.Windows.Forms;
|
|
|
+using XdCxRhDw.Dto;
|
|
|
+using XdCxRhDW.App.CpuCgTools;
|
|
|
using XdCxRhDW.App.EFContext;
|
|
|
using XdCxRhDW.App.WebAPI;
|
|
|
using static XdCxRhDW.App.WebAPI.BaseController;
|
|
@@ -98,6 +100,7 @@ namespace XdCxRhDW.App.CorTools
|
|
|
private async void MainForm_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
this.gridControl1.DataSource = gridSource;
|
|
|
+ btnCheck.Enabled = !ckKY.Checked && !ckIBS.Checked && !chkDama.Checked ? false : true;
|
|
|
ReadIni();
|
|
|
}
|
|
|
|
|
@@ -200,26 +203,66 @@ namespace XdCxRhDW.App.CorTools
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- var dmcResult = await XcorrUtils.DmcCheckAsync(btnFile1.Text, double.Parse(tefs.Text));
|
|
|
- gridSource.Clear();
|
|
|
-
|
|
|
- foreach (var dmcItem in dmcResult)
|
|
|
+ DmcType dmcType = DmcType.DAMA;
|
|
|
+ if (ckKY.Checked)
|
|
|
+ {
|
|
|
+ dmcType = DmcType.Ky5758;
|
|
|
+ }
|
|
|
+ else if (ckIBS.Checked)
|
|
|
+ {
|
|
|
+ dmcType = DmcType.IBS;
|
|
|
+ }
|
|
|
+ else if (chkDama.Checked)
|
|
|
+ {
|
|
|
+ dmcType = DmcType.DAMA;
|
|
|
+ }
|
|
|
+ DetectDto dto = new DetectDto();
|
|
|
+ dto.dmcType = dmcType;
|
|
|
+ try
|
|
|
{
|
|
|
- gridSource.Add(new CafResult()
|
|
|
+ using (RHDWContext db = new RHDWContext())
|
|
|
{
|
|
|
- file1 = btnFile1.Text,
|
|
|
- file2 = btnFile2.Text,
|
|
|
- smpstart = dmcItem.Start,
|
|
|
- smplen = dmcItem.Length
|
|
|
- });
|
|
|
+ var res = await db.SysSetings.FirstOrDefaultAsync();
|
|
|
+ if (res != null)
|
|
|
+ {
|
|
|
+ uploadUrL = $"http://{res.ServerIp}:{res.HttpPort}/api/DetectCg";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dto.file1 = UpLoadFile(btnFile1.Text);
|
|
|
+ // 构建上传请求的 Uri
|
|
|
+ string uploadUri = $"{uploadUrL}/DetectCalc";
|
|
|
+
|
|
|
+ var content = new StringContent(JsonConvert.SerializeObject(dto), System.Text.Encoding.UTF8, "application/json");
|
|
|
+ var dmcResult = PostRequest<IEnumerable<DetectResDto>> (uploadUri, content);
|
|
|
+ if (dmcResult!=null)
|
|
|
+ {
|
|
|
+ //var dmcResult = await XcorrUtils.DmcCheckAsync(btnFile1.Text, dmcType);// double.Parse(tefs.Text),
|
|
|
+ gridSource.Clear();
|
|
|
+ foreach (var dmcItem in dmcResult)
|
|
|
+ {
|
|
|
+ gridSource.Add(new CafResult()
|
|
|
+ {
|
|
|
+ file1 = btnFile1.Text,
|
|
|
+ file2 = btnFile2.Text,
|
|
|
+ smpstart = dmcItem.Start,
|
|
|
+ smplen = dmcItem.Length
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ WriteIni();
|
|
|
}
|
|
|
- WriteIni();
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ DxHelper.MsgBoxHelper.ShowError($"检测计算错误{ex.Message}");
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void chkDama_CheckedChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
lciStartPos.Visibility = lciSampleLength.Visibility = ckKY.Checked | ckIBS.Checked | chkDama.Checked ? LayoutVisibility.Never : LayoutVisibility.Always;
|
|
|
btnCalc.Enabled = ckKY.Checked | ckIBS.Checked | chkDama.Checked ? false : true;
|
|
|
+ btnCheck.Enabled = !ckKY.Checked && !ckIBS.Checked && !chkDama.Checked ? false : true;
|
|
|
if (chkDama.Checked)
|
|
|
{
|
|
|
ckIBS.Checked = false;
|
|
@@ -230,6 +273,7 @@ namespace XdCxRhDW.App.CorTools
|
|
|
{
|
|
|
lciStartPos.Visibility = lciSampleLength.Visibility = ckKY.Checked | ckIBS.Checked | chkDama.Checked ? LayoutVisibility.Never : LayoutVisibility.Always;
|
|
|
btnCalc.Enabled = ckKY.Checked | ckIBS.Checked | chkDama.Checked ? false : true;
|
|
|
+ btnCheck.Enabled = !ckKY.Checked && !ckIBS.Checked && !chkDama.Checked ? false : true;
|
|
|
if (ckIBS.Checked)
|
|
|
{
|
|
|
|
|
@@ -242,6 +286,7 @@ namespace XdCxRhDW.App.CorTools
|
|
|
{
|
|
|
lciStartPos.Visibility = lciSampleLength.Visibility = ckKY.Checked | ckIBS.Checked | chkDama.Checked ? LayoutVisibility.Never : LayoutVisibility.Always;
|
|
|
btnCalc.Enabled = ckKY.Checked | ckIBS.Checked | chkDama.Checked ? false : true;
|
|
|
+ btnCheck.Enabled = !ckKY.Checked && !ckIBS.Checked && !chkDama.Checked ? false : true;
|
|
|
if (ckKY.Checked)
|
|
|
{
|
|
|
ckIBS.Checked = false;
|
|
@@ -319,27 +364,21 @@ namespace XdCxRhDW.App.CorTools
|
|
|
string uploadUri = $"{uploadUrL}/EstimationCalc";
|
|
|
|
|
|
var content = new StringContent(JsonConvert.SerializeObject(xcitem), System.Text.Encoding.UTF8, "application/json");
|
|
|
- var result = PostRequest<CafResult>(uploadUri, content);
|
|
|
- // var result = await ExecuteCorAsync(xcitem);
|
|
|
- if (result != null)
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var result = PostRequest<CafResult>(uploadUri, content);
|
|
|
+ // var result = await ExecuteCorAsync(xcitem);
|
|
|
+ if (result != null)
|
|
|
+ {
|
|
|
+ gridSource.Add(result);
|
|
|
+ gridView1.FocusedRowHandle = gridSource.Count - 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
{
|
|
|
- //var smitemindex = gridSource.FindIndex(m => m.smpstart == xcitem.smpStart && m.smplen == xcitem.smpCount);
|
|
|
- //if (smitemindex == -1)
|
|
|
- //{
|
|
|
- gridSource.Add(result);
|
|
|
- gridView1.FocusedRowHandle = gridSource.Count - 1;
|
|
|
- //}
|
|
|
- //else
|
|
|
- //{
|
|
|
- // var smitem = gridSource[smitemindex];
|
|
|
- // smitem.dt = result.dt;
|
|
|
- // smitem.df = result.df;
|
|
|
- // smitem.snr = result.snr;
|
|
|
- // smitem.tm = result.tm;
|
|
|
- // gridView1.RefreshData();
|
|
|
- // gridView1.FocusedRowHandle = smitemindex;
|
|
|
- //}
|
|
|
+ continue;
|
|
|
}
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|