lu
2024-11-14 1a8f404f8641d38b5a2746d9d6d14b1e40f3b5bf
DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs
@@ -6,7 +6,6 @@
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Grid;
using Gs.DevApp.DevFrm.QC.Models;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
@@ -31,6 +30,9 @@
            toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
            toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
            toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
            toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
            toolBarMenu1.btnPiZhunClick += ToolBarMenu1_btnPiZhunClick;
            gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
            getPageList(1, UtilityHelper.GetPageSize());
            pageBar1.PagerEvent += PageBar1_PagerEvent;
@@ -100,7 +102,61 @@
            _filterList = e.FilterList;
            getPageList(1, pageBar1.RowsCount);
        }
        /// <summary>
        /// 批准
        /// </summary>
        /// <param name="sender"></param>
        /// <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;
        }
        /// <summary>
        ///     审核事件
        /// </summary>
        /// <param name="sender"></param>
        /// <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;
        }
        /// <summary>
        ///     取消事件
        /// </summary>
@@ -158,8 +214,10 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
        {
            UtilityHelper.JumpToTab(xtraTabControl1, 0);
            getPageList(1, UtilityHelper.GetPageSize());
            if (xtraTabControl1.SelectedTabPageIndex == 1)
                getModel(lbGuid.Text.Trim(), false, 999);
            else
                getPageList(1, UtilityHelper.GetPageSize());
        }
        /// <summary>
@@ -238,10 +296,12 @@
            var _obj = new MesQmCheckitem
            {
                Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()),
                ItemId= long.Parse( _ItemId),
                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
@@ -281,7 +341,7 @@
                                   itm.fileValue + "'");
            var pgq = new PageQueryModel(curPage, pageSize,
                "create_date", "asc", "", _sbSqlWhere.ToString());
                "a.create_date", "asc", "", _sbSqlWhere.ToString());
            var json = JsonConvert.SerializeObject(pgq);
            try
            {
@@ -513,6 +573,7 @@
                foreach (DataRow dr in dt.Rows)
                {
                    rptJYBZ.Items.Add((new CboItemEntity(dr["SampleSizeNo"].ToString(), dr["SampleSizeName"].ToString())));
                    //rptJYBZ.Items.Add((new CboItemEntity(dr["SampleSizeNo"].ToString(), dr["SampleSizeName"].ToString())));
                    //string ddddd = dr["SampleSizeName"].ToString();
                }
            }
@@ -571,20 +632,55 @@
            ComboBoxEdit comboBox = sender as ComboBoxEdit;
            if (comboBox != null)
            {
                GridView myView = (gcMx1.MainView as GridView);
                int dataIndex = myView.GetDataSourceRowIndex(myView.FocusedRowHandle);
                CboItemEntity _itm = comboBox.EditValue as CboItemEntity;
                string _val = _itm.Value.ToString();
                string _txt = _itm.Text.ToString();
                gvMx1.CloseEditor();
                gvMx1.UpdateCurrentRow();
                GridView myView = (gcMx1.MainView as GridView);
                int dataIndex = myView.GetDataSourceRowIndex(myView.FocusedRowHandle);
                myView.SetRowCellValue(dataIndex, "sampleSizeNo", _val);
                myView.SetRowCellValue(dataIndex, "sampleSizeName", _txt);
                gvMx1.SetRowCellValue(dataIndex, "sampleSizeNo", _val);
                gvMx1.SetRowCellValue(dataIndex, "sampleSizeName", _txt);
            }
        }
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            gvMx1.CloseEditor();
            gvMx1.UpdateCurrentRow();
            var rowhandle = gvMx1.FocusedRowHandle;
            if (rowhandle < 0)
                return;
            if (e.Button.Index == 0)
            {
                var dr = gvMx1.GetDataRow(rowhandle);
                var mxGuid = dr["guid"].ToString();
                if (!MsgHelper.AskQuestion("你选择了1条数据,确定删除吗?"))
                    return;
                if (string.IsNullOrEmpty(mxGuid))
                {
                    gvMx1.DeleteRow(rowhandle);
                    return;
                }
                var strJson = "";
                var lst = new List<string>();
                lst.Add(mxGuid);
                try
                {
                    strJson = UtilityHelper.HttpPost("",
                        _webServiceName + "DeleteModelMx",
                        JsonConvert.SerializeObject(lst));
                    var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                    if (_rtn.rtnCode > 0) getModel(lbGuid.Text, true, 1);
                    MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                }
                catch (Exception ex)
                {
                    MsgHelper.Warning("提示:" + ex.Message);
                }
            }
        }
        #endregion
    }
}