lu
2025-02-06 3fb5533f30f178dcdf5965a41c39fb62c61da4d8
DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.RichEdit.Export;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Grid;
using Gs.DevApp.Entity;
@@ -32,45 +30,49 @@
            toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
            toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
            toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
            toolBarMenu1.btnPiZhunClick += ToolBarMenu1_btnPiZhunClick;
            gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
            gridView1.FocusedRowChanged += (s, e) =>
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "foneChecked", "", (value) =>
            {
                UtilityHelper.SetCheckIco(s, picCheckBox, this, "foneChecked", "");
            };
            getPageList(1, UtilityHelper.GetPageSize());
                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
            });
            Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
            {
                getModel(value);
            }, (value) =>
            {
                getPageList(this.pageBar1.CurrentPage);
            });
            getPageList(1);
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            gridView1.CustomDrawRowIndicator += (s, e) =>
            {
                if (e.Info.IsRowIndicator && e.RowHandle >= 0)
                    e.Info.DisplayText = (e.RowHandle + 1).ToString();
            };
            gridView1.CustomDrawEmptyForeground += (s, e) =>
            {
                var str = "暂未查找到匹配的数据!";
                var f = new Font("微软雅黑", 16);
                var r = new Rectangle(
                    gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45,
                    e.Bounds.Right - 5, e.Bounds.Height - 5);
                e.Graphics.DrawString(str, f, Brushes.Gray, r);
            };
            //初始化物料选择和各种下拉
            _setIno();
            btnSelect.Click += (s, e) =>
            {
                var frm = new SelectCheckDt("jyxm");
                frm.UpdateParent += (ss, ee) =>
                {
                    var lst = ee.DynamicList;
                    var json = JsonConvert.SerializeObject(lst);
                    DataTable _newTable = (DataTable)JsonConvert.DeserializeObject(json, (typeof(DataTable)));
                    DataTable _oldTable = (DataTable)gridControl2.DataSource;
                    DataRow[] sourceRows = _newTable.Select();
                    for (int i = 0; i < sourceRows.Length; i++)
                    {
                        _oldTable.ImportRow(sourceRows[i]);
                    }
                    gridControl2.BindingContext = new BindingContext();
                    gridControl2.DataSource = _oldTable;
                    gridControl2.ForceInitialize();
                };
                frm.ShowDialog();
            };
            btnSave.Click += BtnSave_Click;
        }
        /// <summary>
        ///     双击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e)
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        {
            var rowGuid =
                UtilityHelper.GetCurrentDoubleRow(gridView1,
                    e, "guid");
            if (!string.IsNullOrEmpty(rowGuid))
                getModel(rowGuid, false, 999);
            Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
            Task.Delay(100);
            getPageList(1);
        }
        /// <summary>
@@ -80,7 +82,7 @@
        /// <param name="pageSize"></param>
        private void PageBar1_PagerEvent(int curPage, int pageSize)
        {
            getPageList(curPage, pageSize);
            getPageList(curPage);
        }
        /// <summary>
@@ -90,9 +92,10 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e)
        {
            var frm =
                new ShowFilter(gridView1.Columns,
                    _filterList);
            gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
            gridView1.ActiveFilter.Clear();
            gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
            var frm = new ShowFilter(gridView1.Columns, _filterList);
            frm.UpdateParent += Frm_UpdateParent;
            frm.ShowDialog();
        }
@@ -105,7 +108,7 @@
        private void Frm_UpdateParent(object sender, UpdateParentEventArgs e)
        {
            _filterList = e.FilterList;
            getPageList(1, pageBar1.RowsCount);
            getPageList(1);
        }
        /// <summary>
        /// 批准
@@ -114,39 +117,7 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnPiZhunClick(object sender, EventArgs e)
        {
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_itemNo, gridView1);
            try
            {
                string strJson = UtilityHelper.HttpPost("", _webServiceName + "Approval", JsonConvert.SerializeObject(rowGuid));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
                    getPageList(1, UtilityHelper.GetPageSize());
                }
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        ///     反审核
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e)
        {
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_itemNo, gridView1);
            toolBarMenu1.guidKey = rowGuid;
            _toolCk(2);
        }
        /// <summary>
@@ -156,11 +127,7 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnChkClick(object sender, EventArgs e)
        {
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_itemNo, gridView1);
            toolBarMenu1.guidKey = rowGuid;
            _toolCk(1);
        }
        /// <summary>
        ///     取消事件
@@ -179,37 +146,7 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
        {
            string rowGuid = "", rowName = "";
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_itemNo, gridView1);
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】的检验标准,确定删除吗?"))
                return;
            var lst = new List<dynamic>();
            lst.Add(rowGuid);
            var _obj = lst;
            try
            {
                var strJson = UtilityHelper.HttpPost("",
                    _webServiceName + "DeleteModel",
                    JsonConvert.SerializeObject(_obj));
                var _rtn =
                    UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
                    getPageList(1, UtilityHelper.GetPageSize());
                }
                MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
            _toolCk(-1);
        }
        /// <summary>
@@ -220,9 +157,19 @@
        private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
        {
            if (xtraTabControl1.SelectedTabPageIndex == 1)
                getModel(lbGuid.Text.Trim(), false, 999);
                getModel(lbGuid.Text.Trim());
            else
                getPageList(1, UtilityHelper.GetPageSize());
            {
                //_filterList.Clear();
                //if (gridView1.ActiveFilter.Count > 0)
                //{
                //    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
                //    gridView1.ActiveFilter.Clear();
                //    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
                //}
                //getPageList(1);
                getPageList(this.pageBar1.CurrentPage);
            }
        }
        /// <summary>
@@ -239,7 +186,18 @@
                MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            getModel(rowGuid, true, 1);
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
            if (xtraTabControl1.SelectedTabPageIndex == 1)
            {
                getModel(rowGuid);
            }
            else
            {
                List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                gvList.Add(gvMx1);
                gvList.Add(gridView2);
                UtilityHelper.ChangeEnableByControl(panel1.Controls, true, gvList);
            }
        }
        /// <summary>
@@ -249,14 +207,14 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
        {
            UtilityHelper.JumpToTab(xtraTabControl1, 1);
            lbGuid.Text = "";
            var gridViews =
                new List<GridView>();
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4);
            var gridViews = new List<GridView>();
            gridViews.Add(gvMx1);
            UtilityHelper.CleanValueByControl(panel1.Controls, true,
                gridViews);
            gridViews.Add(gridView2);
            UtilityHelper.CleanValueByControl(panel1.Controls, true, gridViews);
            UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
            xtraTabPageCopy.PageEnabled = false;
        }
        /// <summary>
@@ -267,106 +225,176 @@
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            string _ItemId = txt_ItemId.GetId()
;          if (string.IsNullOrEmpty(_ItemId))
            string _ItemId = txt_itemId.GetId();
            if (string.IsNullOrEmpty(_ItemId))
            {
                MsgHelper.Warning("请选择物料!");
                txt_ItemId.Focus();
                txt_itemId.Focus();
                return;
            }
            gvMx1.CloseEditor();
            gvMx1.UpdateCurrentRow();
            var lst = new List<MesQmCheckitemDt>();
            for (var i = 0; i < gvMx1.DataRowCount; i++)
            if (gvMx1.DataRowCount <= 0)
            {
                var row = gvMx1.GetDataRow(i);
                if (row != null)
                    lst.Add(new MesQmCheckitemDt
                    {
                        Guid = UtilityHelper.ToGuid(row["guid"].ToString()),
                        Forder = 1,
                        FcheckItem = row["FcheckItem"].ToString(),
                        SampleSizeNo = row["SampleSizeNo"].ToString(),
                        FcheckTool = row["FcheckTool"].ToString(),
                        FcheckLevel = row["FcheckLevel"].ToString(),
                        Fstand = row["Fstand"].ToString(),
                        FacLevel = row["FacLevel"].ToString(),
                        FspecRequ = row["FspecRequ"].ToString(),
                        Memo  = row["memo"].ToString(),
                        FupAllow = row["FupAllow"].ToString(),
                        FdownAllow = row["FdownAllow"].ToString(),
                    });
                MsgHelper.Warning("项目明细不能为空!");
                return;
            }
            var _obj = new MesQmCheckitem
            {
                Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()),
                ItemId = long.Parse(_ItemId),
                Memo = txt_memo.Text.Trim(),
                ItemNo = txt_itemNo.Text.Trim(),
                Isenabled = txt_isenabled.Checked,
                Ftype = "1",
                Fversion =Gs.DevApp.ToolBox.UtilityHelper.ToLong( txt_fversion.Text.Trim()),
                list = lst
            };
            try
            {
                var strJson = UtilityHelper.HttpPost("",
                    _webServiceName + "EditModel",
                    JsonConvert.SerializeObject(_obj));
                var _rtn =
                    UtilityHelper.ReturnToDynamic(strJson);
                MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                if (_rtn.rtnCode > 0)
                var lst = new List<MesQmCheckitemDt>();
                for (var i = 0; i < gvMx1.DataRowCount; i++)
                {
                    lbGuid.Text = _rtn.rtnData;
                    toolBarMenu1.isSetBtn = true;
                    var gridViews = new List<GridView>();
                    gridViews.Add(gvMx1);
                    UtilityHelper.ChangeEnableByControl(panel1.Controls, false,
                        gridViews);
                    var row = gvMx1.GetDataRow(i);
                    if (row != null)
                    {
                        if (string.IsNullOrEmpty(row["forder"].ToString()))
                        {
                            MsgHelper.ShowError("顺序不能为空!");
                            return;
                        }
                        if (string.IsNullOrEmpty(row["FcheckItem"].ToString()))
                        {
                            MsgHelper.ShowError("检验项目不能为空!");
                            return;
                        }
                        if (string.IsNullOrEmpty(row["FcheckTool"].ToString()))
                        {
                            MsgHelper.ShowError("检验工具不能为空!");
                            return;
                        }
                        if (string.IsNullOrEmpty(row["SampleSizeNo"].ToString()))
                        {
                            MsgHelper.ShowError("检验标准不能为空!");
                            return;
                        }
                        if (string.IsNullOrEmpty(row["FcheckLevel"].ToString()))
                        {
                            MsgHelper.ShowError("检验水平不能为空!");
                            return;
                        }
                        if (string.IsNullOrEmpty(row["FacLevel"].ToString()))
                        {
                            MsgHelper.ShowError("接受水平不能为空!");
                            return;
                        }
                        string _Fstand = row["Fstand"].ToString();
                        string _FupAllow = row["FupAllow"].ToString();
                        string _FdownAllow = row["FdownAllow"].ToString();
                        //假如三个都为空通过
                        if (string.IsNullOrEmpty(_Fstand) && string.IsNullOrEmpty(_FupAllow) && string.IsNullOrEmpty(_FdownAllow))
                        {
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(_Fstand) && !string.IsNullOrEmpty(_FupAllow) && !string.IsNullOrEmpty(_FdownAllow))
                            {
                                decimal _Fstand_f = Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(_Fstand);
                                decimal _FupAllow_f = Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(_FupAllow);
                                decimal _FdownAllow_f = Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(_FdownAllow);
                                if (_Fstand_f >= _FdownAllow_f && _Fstand_f <= _FupAllow_f) { }
                                else {
                                    MsgHelper.ShowError("标准值必须在上限和下限之间!");
                                    return;
                                }
                            }
                            else
                            {
                                MsgHelper.ShowError("请填写正确的上限,标准值,下限!");
                                return;
                            }
                        }
                        lst.Add(new MesQmCheckitemDt
                        {
                            Guid = UtilityHelper.ToGuid(row["guid"].ToString()),
                            Forder = int.Parse(row["forder"].ToString()),
                            FcheckItem = row["FcheckItem"].ToString(),
                            SampleSizeNo = row["SampleSizeNo"].ToString(),
                            FcheckTool = row["FcheckTool"].ToString(),
                            FcheckLevel = row["FcheckLevel"].ToString(),
                            Fstand = row["Fstand"].ToString(),
                            FacLevel = row["FacLevel"].ToString(),
                            FspecRequ = row["FspecRequ"].ToString(),
                            Memo = row["memo"].ToString(),
                            FupAllow = row["FupAllow"].ToString(),
                            FdownAllow = row["FdownAllow"].ToString(),
                        });
                    }
                }
                var _obj = new MesQmCheckitem
                {
                    Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()),
                    ItemId = long.Parse(_ItemId),
                    Memo = txt_memo.Text.Trim(),
                    ItemNo = txt_itemNo.Text.Trim(),
                    Ftype = "1",
                    Fversion = Gs.DevApp.ToolBox.UtilityHelper.ToLong(txt_fversion.Text.Trim()),
                    list = lst
                };
                try
                {
                    var strJson = UtilityHelper.HttpPost("",
                        _webServiceName + "EditModel",
                        JsonConvert.SerializeObject(_obj));
                    var _rtn =
                        UtilityHelper.ReturnToDynamic(strJson);
                    MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                    if (_rtn.rtnCode > 0)
                    {
                        lbGuid.Text = _rtn.rtnData;
                        toolBarMenu1.isSetBtn = true;
                        var gridViews = new List<GridView>();
                        gridViews.Add(gvMx1);
                        gridViews.Add(gridView2);
                        UtilityHelper.ChangeEnableByControl(panel1.Controls, false, gridViews);
                    }
                }
                catch (Exception ex)
                {
                    MsgHelper.Warning("提示:" + ex.Message);
                }
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
                MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// </summary>
        /// <param name="curPage">第几页</param>
        /// <param name="pageSize">每页几条</param>
        private void getPageList(int curPage, int pageSize)
        private void getPageList(int curPage)
        {
            var _sbSqlWhere =
                new StringBuilder();
            foreach (var itm in _filterList)
                _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" +
                                   itm.fileValue + "'");
            var pgq = new PageQueryModel(curPage, pageSize,
                "a.create_date", "asc", "", _sbSqlWhere.ToString());
            var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            _sbSqlWhere += " and b.guid is not null";
            var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount,
                "org.FNumber asc ,b.item_no asc,a.FVERSION desc", "", "", _sbSqlWhere.ToString());
            var json = JsonConvert.SerializeObject(pgq);
            try
            {
                var strReturn = UtilityHelper.HttpPost("",
                  //  _webServiceName + "GetListPageIQC", json);
                _webServiceName + "GetListPage", json);
                var dd =
                    UtilityHelper.ReturnToTablePage(strReturn);
                if (dd.rtnCode > 0)
                {
                    var dt = dd.rtnData.list;
                    DataTable dt = dd.rtnData.list;
                    gcMain.BindingContext = new BindingContext();
                    gcMain.DataSource = dt;
                    gcMain.ForceInitialize();
                    var dddd = dd.rtnData.pages; //总页
                    pageBar1.TotalPages = dddd;
                    pageBar1.RecordCount = dd.rtnData.total; //记录总数
                    pageBar1.CurrentPage = curPage; //当前页
                    pageBar1.RowsCount = pageSize; //每页显示
                    pageBar1.setTxt();
                    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
                    if (dt.Rows.Count > 0)
                    {
                        gcMain.DataSource = dt;
                        gcMain.ForceInitialize();
                        gridView1.BestFitColumns();
                    }
                    else
                        UtilityHelper.SetDefaultTable(gcMain, gridView1);
                    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
                    pageBar1.TotalPages = dd.rtnData.pages;//总页
                    pageBar1.CurrentPage = curPage;//当前页
                    pageBar1.RecordCount = dd.rtnData.total;//总记录数
                }
                else
                {
@@ -379,15 +407,17 @@
            }
        }
        private void getModel(string strGuid, bool isEdit, int tabIdx)
        private void getModel(string strGuid)
        {
            bool isEdit = false;
            if (toolBarMenu1.currentAction == "add") return;
            if (toolBarMenu1.currentAction == "edit") isEdit = true;
            if (string.IsNullOrEmpty(strGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
            xtraTabPageCopy.PageEnabled = !isEdit;
            var _obj = new
            {
                guid = strGuid //主建
@@ -395,7 +425,6 @@
            try
            {
                var strJson = UtilityHelper.HttpPost("",
                   // _webServiceName + "GetModelIQC",
                         _webServiceName + "GetModel",
                    JsonConvert.SerializeObject(_obj));
                var _rtn =
@@ -412,7 +441,6 @@
                    var _job = JObject.Parse(strJson);
                    var array = new JArray();
                    foreach (var a in _job["rtnData"]["list"]) array.Add(a);
                    var dt =
                        JsonConvert.DeserializeObject<DataTable>(
                            array.ToString());
@@ -421,12 +449,13 @@
                        gcMx1.BindingContext = new BindingContext();
                        gcMx1.DataSource = dt;
                        gcMx1.ForceInitialize();
                        gvMx1.BestFitColumns();
                    }
                    else
                    {
                        UtilityHelper.SetDefaultTable(gcMx1,
                            gvMx1);
                        UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
                    }
                    UtilityHelper.SetDefaultTable(gridControl2, gridView2);
                }
                else
                {
@@ -439,51 +468,56 @@
            }
        }
        #region 以下为种种下拉
        private void getCopyMx(string strGuid)
        /// <summary>
        /// 工具条事件
        /// </summary>
        /// <param name="inFieldValue"></param>
        private void _toolCk(int _inFieldValue)
        {
            if (string.IsNullOrEmpty(strGuid))
            string strMsg = "";
            switch (_inFieldValue)
            {
                MsgHelper.Warning("请先选择你要复制的行!");
                case -1:
                    strMsg = "删除";
                    break;
                case 1:
                    strMsg = "审核";
                    break;
                case 2:
                    strMsg = "批准";
                    break;
            };
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_itemNo, gridView1, "itemNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定" + strMsg + "吗?"))
                return;
            var _obj = new
            {
                guid = strGuid
                guid = rowGuid,
                inFieldValue = _inFieldValue,
            };
            try
            {
                var strJson = UtilityHelper.HttpPost("",
                    _webServiceName + "GetModelIQC",
                    _webServiceName + "EditModelSubmit",
                    JsonConvert.SerializeObject(_obj));
                var _rtn =
                    UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
                if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                {
                    var dy = _rtn.rtnData;
                    var _job = JObject.Parse(strJson);
                    var array = new JArray();
                    foreach (var a in _job["rtnData"]["list"]) array.Add(a);
                    var dt =
                        JsonConvert.DeserializeObject<DataTable>(
                            array.ToString());
                    if (dt.Rows.Count > 0)
                    if (xtraTabControl1.SelectedTabPageIndex == 1)
                    {
                        gcMx1.BindingContext = new BindingContext();
                        gcMx1.DataSource = dt;
                        gcMx1.ForceInitialize();
                        getModel(lbGuid.Text.Trim());
                    }
                    else
                    {
                        MsgHelper.Warning("提示:没找到相应的明细,请选择其它试试!");
                    }
                }
                else
                {
                    MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                    int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
                    gridView1.FocusedRowHandle = rowHandle;
                    UtilityHelper.SetCheckIco(gridView1, "foneChecked", "foneCheckor", "foneCheckdate", picCheckBox, this, _inFieldValue.ToString());
                }
            }
            catch (Exception ex)
@@ -492,25 +526,24 @@
            }
        }
        #region 以下为种种下拉
        private void _setIno()
        {
            txt_ItemId.KeyFile = "id";
            txt_ItemId.EditChanged += (s, e) =>
            this.txt_fSubsidiary.EditChanged += (s, e) =>
            {
                txt_itemModel.Text = this.txt_ItemId.GetModel();
                txt_itemNo.Text = this.txt_ItemId.GetCode();
                string _orgId = txt_fSubsidiary.GetId();
                if (string.IsNullOrEmpty(_orgId))
                    return;
                txt_itemId.getSuppler(_orgId);
                //txt_gg.Text ="";
                //txt_itemNo.Text = "";
            };
            btnSelect.Click += (s, e) =>
            txt_itemId.EditChanged += (s, e) =>
            {
                var frm = new SelectCheckDt();
                frm.UpdateParent += (ss, ee) =>
                {
                    var lst = new List<string>();
                    lst = ee.StringList;
                    getCopyMx(lst[0]);
                };
                frm.ShowDialog();
                if (!string.IsNullOrEmpty(this.txt_itemId.GetModel()))
                    txt_gg.Text = this.txt_itemId.GetModel();
                if (!string.IsNullOrEmpty(this.txt_itemId.GetCode()))
                    txt_itemNo.Text = this.txt_itemId.GetCode();
            };
            _getListJyxm();
            _getListJygj();
@@ -646,7 +679,6 @@
                gvMx1.UpdateCurrentRow();
                gvMx1.SetRowCellValue(dataIndex, "sampleSizeNo", _val);
                gvMx1.SetRowCellValue(dataIndex, "sampleSizeName", _txt);
            }
        }
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
@@ -676,7 +708,7 @@
                        _webServiceName + "DeleteModelMx",
                        JsonConvert.SerializeObject(lst));
                    var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                    if (_rtn.rtnCode > 0) getModel(lbGuid.Text, true, 1);
                    if (_rtn.rtnCode > 0) getModel(lbGuid.Text);
                    MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                }
                catch (Exception ex)
@@ -686,6 +718,72 @@
            }
        }
        #endregion
        /// <summary>
        /// 删除复制项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void repositoryItemButtonEdit3_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            gridView2.CloseEditor();
            gridView2.UpdateCurrentRow();
            var rowhandle = gridView2.FocusedRowHandle;
            if (rowhandle < 0)
                return;
            if (e.Button.Index == 0)
            {
                var dr = gridView2.GetDataRow(rowhandle);
                if (!MsgHelper.AskQuestion("你选择了1条数据,确定删除吗?"))
                    return;
                gridView2.DeleteRow(rowhandle);
                return;
            }
        }
        /// <summary>
        /// 提交物料复制
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void BtnSave_Click(object sender, EventArgs e)
        {
            int _rows = gridView2.RowCount;
            if (_rows <= 0)
            {
                MsgHelper.ShowInformation("请选择你需要复制的物料!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了" + _rows.ToString() + "条数据,确定保存吗?"))
                return;
            System.Text.StringBuilder _sbGuids = new System.Text.StringBuilder();
            for (var i = 0; i < gridView2.DataRowCount; i++)
            {
                var row = gridView2.GetDataRow(i);
                if (_sbGuids.Length > 0)
                    _sbGuids.Append(",");
                Guid? _guid = UtilityHelper.ToGuid(row["guid"].ToString());
                _sbGuids.Append(_guid.ToString());
            }
            var _obj = new
            {
                sourceGuid = UtilityHelper.ToGuid(lbGuid.Text.Trim()),
                itemGuids = _sbGuids.ToString()
            };
            try
            {
                var strJson = UtilityHelper.HttpPost("", _webServiceName + "ItemsComyMx", JsonConvert.SerializeObject(_obj));
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                if (_rtn.rtnCode > 0)
                {
                    UtilityHelper.SetDefaultTable(gridControl2, gridView2);
                }
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
    }
}