using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using System;
namespace Gs.DevApp.DevFrm.QC
{
public partial class MesQcExceptionalShow : DevExpress.XtraEditors.XtraForm
{
string strGuid = "";
string _webServiceName = "MesQcExceptionalManager/";
public MesQcExceptionalShow(string _strGuid)
{
InitializeComponent();
this.strGuid = _strGuid;
btnQuery.Click += BtnQuery_Click;
btnEsc.Click += BtnEsc_Click;
}
private void BtnEsc_Click(object sender, EventArgs e)
{
this.Close();
}
private void BtnQuery_Click(object sender, EventArgs e)
{
_toolCk(1);
}
///
/// 工具条事件
///
///
///
///
///
///
private void _toolCk(int _inFieldValue)
{
if (txt_freceQty.SelectedIndex <= 0)
{
Gs.DevApp.ToolBox.MsgHelper.Warning("请选择判定结果!");
txt_freceQty.Focus();
return;
}
if (txt_freceQty.SelectedIndex == 1)
{
if ((txt_fmrmode.SelectedIndex > 0) || txt_fngHandle.SelectedIndex > 0)
{
Gs.DevApp.ToolBox.MsgHelper.Warning("你判定了合格,就不能再选择其它处理方式了!");
txt_fmrmode.Focus();
return;
}
}
else
{
//当选择不合格时,要填写原因
if (txt_freceQty.SelectedIndex == 2)
{
if ((txt_fngHandle.SelectedIndex <= 0))
{
Gs.DevApp.ToolBox.MsgHelper.Warning("请选择处理结果!");
txt_fngHandle.Focus();
return;
}
if (txt_fngHandle.SelectedIndex == 1)
{
if ((txt_fmrmode.SelectedIndex <= 0))
{
Gs.DevApp.ToolBox.MsgHelper.Warning("请选择退料方式!");
txt_fmrmode.Focus();
return;
}
}
else
{
if ((txt_fmrmode.SelectedIndex > 0))
{
Gs.DevApp.ToolBox.MsgHelper.Warning("你选择了特采使用,就不能再选择退料方式了!");
txt_fmrmode.Focus();
return;
}
}
}
}
string _fmrmode = txt_fmrmode.SelectedIndex > 0 ? txt_fmrmode.Text.Trim() : "";
string _freceQty = txt_freceQty.SelectedIndex > 0 ? txt_freceQty.Text.Trim() : "";
string _fngHandle = txt_fngHandle.SelectedIndex > 0 ? txt_fngHandle.Text.Trim() : "";
var _obj = new
{
guid = strGuid,
inFieldValue = _inFieldValue,
gs001 = _freceQty,
gs002 = _fngHandle,
gs003 = _fmrmode,
};
try
{
var strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModelSubmit", JsonConvert.SerializeObject(_obj));
var _rtn = UtilityHelper.ReturnToDynamic(strJson);
MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
{
UpdateParent?.Invoke(this, new UpdateParentEventArgs { StringSingle = "" });
Close();
}
}
catch (Exception ex)
{
MsgHelper.Warning("提示:" + ex.Message);
}
}
///
/// 选择后的回调事件
///
public event EventHandler UpdateParent;
}
}