| | |
| | | using MES.Service.Modes; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | |
| | | |
| | |
| | | { |
| | | public partial class Frm_MesDefectCodeShow : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | string lbGuid = ""; |
| | | string strTitle = ""; |
| | | string strGuid = ""; |
| | | string strUpGuid = ""; |
| | | string _webServiceName = "MesDefectCodeManager/"; |
| | | public Frm_MesDefectCodeShow(string _lbGuid, string _strTitle, string _strUpGuid) |
| | | public Frm_MesDefectCodeShow(string _strGuid, string _strUpGuid) |
| | | { |
| | | InitializeComponent(); |
| | | getSelect(); |
| | | this.lbGuid = _lbGuid; |
| | | this.strTitle = _strTitle; |
| | | this.strGuid = _strGuid; |
| | | this.strUpGuid = _strUpGuid; |
| | | if (string.IsNullOrEmpty(lbGuid)) |
| | | { |
| | | this.Text = strTitle; |
| | | |
| | | //这是更新 |
| | | if (!string.IsNullOrEmpty(this.strGuid)) { |
| | | getMode(strGuid); |
| | | this.Text = "更新【" + txt_defectName.Text + "】"; |
| | | txt_sType.Enabled = false; |
| | | return; |
| | | } |
| | | else |
| | | //这是增加子项 |
| | | if (!string.IsNullOrEmpty(strUpGuid)) |
| | | { |
| | | this.Text = "更新【" + strTitle + "】"; |
| | | var _obj = new |
| | | { |
| | | guid = lbGuid,//主建 |
| | | }; |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | dynamic dy = _rtn.rtnData; |
| | | UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, true); |
| | | txt_sType.Enabled = false; |
| | | } |
| | | else |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | getMode(strUpGuid); |
| | | this.Text = "增加【" + txt_defectName.Text + "】的子项目"; |
| | | txt_sType.Enabled = false; |
| | | txt_defectCode.Text = ""; |
| | | txt_defectName.Text = ""; |
| | | return; |
| | | } |
| | | |
| | | this.Text = "增加新项"; |
| | | |
| | | } |
| | | |
| | | private void btnQuery_Click(object sender, EventArgs e) |
| | |
| | | } |
| | | var _obj = new MesDefectCode() |
| | | { |
| | | Guid = UtilityHelper.ToGuid(lbGuid.Trim()), |
| | | Guid = UtilityHelper.ToGuid(strGuid.Trim()), |
| | | DefectCode = txt_defectCode.Text.Trim(), |
| | | SType = txt_sType.Text.Trim(), |
| | | DefectName = txt_defectName.Text.Trim(), |
| | | Pid= UtilityHelper.ToGuid(strUpGuid.Trim()), |
| | | Pid = UtilityHelper.ToGuid(strUpGuid.Trim()), |
| | | }; |
| | | try |
| | | { |
| | |
| | | /// </summary> |
| | | public event EventHandler<UpdateParentEventArgs> UpdateParent; |
| | | |
| | | |
| | | private void getSelect() { |
| | | private void getSelect() |
| | | { |
| | | |
| | | var _obj = new |
| | | { |
| | | |
| | | |
| | | }; |
| | | var strReturn = UtilityHelper.HttpPost("", _webServiceName + "SelectCategory", JsonConvert.SerializeObject(_obj)); |
| | | var dd = UtilityHelper.ReturnToList(strReturn); |
| | |
| | | txt_sType.Properties.Items.Add(dr["typeMemo"].ToString()); |
| | | } |
| | | } |
| | | |
| | | private void getMode(string strGuid) |
| | | { |
| | | var _obj = new |
| | | { |
| | | guid = strGuid,//主建 |
| | | }; |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | dynamic dy = _rtn.rtnData; |
| | | UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, true); |
| | | |
| | | } |
| | | else |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |