1
lu
2024-12-17 002774519ddd99881ded07ab99fb44c011d090d7
DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesItemQtCk.cs
@@ -19,16 +19,12 @@
{
    public partial class Frm_MesItemQtCk : DevExpress.XtraEditors.XtraForm
    {
        string _webServiceName = "MesItemQtManager/";
        string _webServiceName = "MesItemQtCkManager/";
        List<FilterEntity> _filterList = new List<FilterEntity>();
        public Frm_MesItemQtCk()
        {
            InitializeComponent();
            this.toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick;
            this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;
            this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick;
            this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
            this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
            this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
            this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
@@ -122,44 +118,6 @@
        {
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 1);
        }
        /// <summary>
        /// 删除事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
        {
            string rowGuid = "", rowName = "";
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_qtck, gridView1, "qtck");
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定删除吗?"))
                return;
            List<dynamic> lst = new List<dynamic>();
            lst.Add(rowGuid);
            var _obj = lst;
            try
            {
                string strJson = UtilityHelper.HttpPost("", _webServiceName + "DeleteModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    if (xtraTabControl1.SelectedTabPageIndex == 0)
                        getPageList(this.pageBar1.CurrentPage);
                    else
                        Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2);
                }
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 刷新事件
        /// </summary>
@@ -181,131 +139,6 @@
                getPageList(1);
            }
        }
        /// <summary>
        /// 修改事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
        {
            string rowGuid = "", rowName = "";
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_qtck, gridView1, "qtck");
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
            UtilityHelper.ChangeEnableByControl(panel1.Controls, true);
        }
        /// <summary>
        /// 新增事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
        {
            lbGuid.Text = "";
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4);
            List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
            gridViews.Add(gvMx1);
            UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews);
            Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
        }
        /// <summary>
        /// 保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            string inCusId = txt_qt018.GetId();
            string inCkId = txt_qt008.GetId();
            string inLlrId = txt_qt022.GetId();
            string inDepart = txt_qt009.GetId();
            string inScgdId = txt_qt006.Text.Trim();
            if (string.IsNullOrEmpty(inCusId))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择客户!");
                txt_qt018.Focus();
                return;
            }
            if (string.IsNullOrEmpty(inCkId))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择仓库!");
                txt_qt008.Focus();
                return;
            }
            if (string.IsNullOrEmpty(inLlrId))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择领料人!");
                txt_qt022.Focus();
                return;
            }
            var _obj = new
            {
                guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建
                inRklb = txt_qt003.Text.Trim(),//业务类别
                inYwlx = txt_qt004.Text.Trim(),//业务类型
                inRkfs = txt_qt019.Text.Trim(),//入库方式
                inRklx = txt_qt020.Text.Trim(),//入库类型
                inCusId = inCusId,//客户
                inCkId = inCkId,//仓库
                inDepart = inDepart,//申请部门
                inXsdh = txt_qt021.Text.Trim(),//销售单号
                inScgdId = inScgdId,//生产工单号
                inLlrId = inLlrId,//领料人
                inRkyy = txt_qt010.Text.Trim(),//原因
                list = new List<dynamic>(),
            };
            gvMx1.CloseEditor();
            gvMx1.UpdateCurrentRow();
            if (gvMx1.DataRowCount <= 0)
            {
                MsgHelper.ShowError("明细不能为空,请选择你的收料明细!");
                return;
            }
            for (var i = 0; i < gvMx1.DataRowCount; i++)
            {
                var row = gvMx1.GetDataRow(i);
                if (row != null)
                {
                    Guid? _guid = UtilityHelper.ToGuid(row["guid"].ToString());
                    //string _msl = row["quantity"].ToString();
                    //if (string.IsNullOrEmpty(_msl))
                    //{
                    //    MsgHelper.ShowError("数量不能为空!");
                    //    return;
                    //}
                    _obj.list.Add(new
                    {
                        Guid = _guid,
                        ItemId = (row["itemId"].ToString()),
                        Sqsl = (row["qd007"].ToString()),
                        Bz = (row["qd010"].ToString()),
                    });
                }
            }
            try
            {
                string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                if (_rtn.rtnCode > 0)
                {
                    lbGuid.Text = _rtn.rtnData;
                    toolBarMenu1.isSetBtn = true;
                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false);
                }
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 
        /// </summary>