lu
2025-01-13 46f9429aefa25784468079ff0d6ce5513b6051b6
DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesItemQt.cs
@@ -42,36 +42,56 @@
            });
            getPageList(1);
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            //设置仓库选择
            txt_qt008.getSuppler("");
            //设置发料组织
            txt_qt023.EditChanged += (s, e) =>
            {
                string _orgId = txt_qt023.GetId();
                if (string.IsNullOrEmpty(_orgId))
                    return;
                txt_qt008.getSuppler(_orgId);
                var _obj = new
                {
                    currentPage = 1,
                    everyPageSize = 999999,
                    sortName = "",
                    keyWhere = "",
                };
                var json = JsonConvert.SerializeObject(_obj);
                try
                {
                    var strReturn = UtilityHelper.HttpPost("",
                        "MesItemsManager/GetListSelect", json);
                    var rtn = UtilityHelper.ReturnToTablePage(strReturn);
                    var dt = rtn.rtnData.list;
                    this.repositoryItemSearchLookUpEdit1.DataSource = dt;
                }
                catch (Exception ex)
                {
                    MsgHelper.Warning("提示:" + ex.Message);
                }
            };
            //设置发料仓库
            //txt_qt008.getSuppler("");
            this.txt_qt008.EditChanged += (s, e) =>
            {
                string _ckId = txt_qt008.GetId();
                if (string.IsNullOrEmpty(_ckId))
                    return;
            };
            var _obj = new
            //设置领用
            txt_qt024.EditChanged += (s, e) =>
            {
                currentPage = 1,
                everyPageSize = 999999,
                sortName = "",
                keyWhere = "",
                string _orgId = txt_qt024.GetId();
                if (string.IsNullOrEmpty(_orgId))
                    return;
                //txt_qt018.getSuppler(_orgId);
                //txt_qt009.getSuppler(_orgId);
            };
            var json = JsonConvert.SerializeObject(_obj);
            try
            {
                var strReturn = UtilityHelper.HttpPost("",
                    "MesItemsManager/GetListSelect", json);
                var rtn = UtilityHelper.ReturnToTablePage(strReturn);
                var dt = rtn.rtnData.list;
                this.repositoryItemSearchLookUpEdit1.DataSource = dt;
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        private   void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        {
            _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns);
           Task.Delay(100);
            Task.Delay(100);
            getPageList(1);
        }
        /// <summary>
@@ -191,7 +211,16 @@
                return;
            }
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
            UtilityHelper.ChangeEnableByControl(panel1.Controls, true);
            if (xtraTabControl1.SelectedTabPageIndex == 1)
            {
                getModel(lbGuid.Text.Trim());
            }
            else
            {
                List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                gvList.Add(gvMx1);
                UtilityHelper.ChangeEnableByControl(panel1.Controls, true, gvList);
            }
        }
        /// <summary>
        /// 新增事件
@@ -206,7 +235,6 @@
            gridViews.Add(gvMx1);
            UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews);
            Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
        }
        /// <summary>
        /// 保存事件
@@ -216,42 +244,61 @@
        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))
            string inOrgId = txt_qt023.GetId();//发料组织
            string inCkId = txt_qt008.GetId();//发料仓库
            string inLyOrg = txt_qt024.GetId();//领用组织
            string inLyCus = txt_qt018.GetId();//领用客户
            string inLyDepart = txt_qt018_1.GetId();//领用部门
            if (string.IsNullOrEmpty(inOrgId))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择客户!");
                txt_qt018.Focus();
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择发料组织!");
                txt_qt023.Focus();
                return;
            }
            if (string.IsNullOrEmpty(inCkId))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择仓库!");
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择发料仓库!");
                txt_qt008.Focus();
                return;
            }
            if (string.IsNullOrEmpty(inLlrId))
            if (string.IsNullOrEmpty(inLyOrg))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择领料人!");
                txt_qt022.Focus();
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择领用组织!");
                txt_qt024.Focus();
                return;
            }
            if (string.IsNullOrEmpty(inLyCus) && string.IsNullOrEmpty(inLyDepart))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("客户或部门必选一个!");
                return;
            }
            if (!string.IsNullOrEmpty(inLyCus) && !string.IsNullOrEmpty(inLyDepart))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("客户或部门只选一个!");
                return;
            }
            if (txt_qt019.SelectedIndex <= 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择单据类型!");
                txt_qt019.Focus();
                return;
            }
            if (txt_qt020.SelectedIndex <= 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择库存方向!");
                txt_qt020.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,//领料人
                inDjlx = txt_qt019.Text.Trim(),//单据类型
                inKcfx = txt_qt020.Text.Trim(),//库存方向
                inOrgId = inOrgId,//发料组织
                inCkId = inCkId,//发料仓库
                inLyOrg = inLyOrg,//领用组织
                inHzlx = txt_qt025.Text.Trim(),//货主类型
                inLyCusOrDpt = inLyCus,//货主客户或部门
                inRkyy = txt_qt010.Text.Trim(),//原因
                list = new List<dynamic>(),
            };
@@ -268,12 +315,12 @@
                if (row != null)
                {
                    Guid? _guid = UtilityHelper.ToGuid(row["guid"].ToString());
                    //string _msl = row["quantity"].ToString();
                    //if (string.IsNullOrEmpty(_msl))
                    //{
                    //    MsgHelper.ShowError("数量不能为空!");
                    //    return;
                    //}
                    string _msl = row["qd007"].ToString();
                    if (string.IsNullOrEmpty(_msl))
                    {
                        MsgHelper.ShowError("数量不能为空!");
                        return;
                    }
                    _obj.list.Add(new
                    {
                        Guid = _guid,
@@ -306,7 +353,7 @@
        /// </summary>
        /// <param name="curPage">第几页</param>
        /// <param name="pageSize">每页几条</param>
        private   void getPageList(int curPage)
        private void getPageList(int curPage)
        {
            var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date", "asc", "", _sbSqlWhere.ToString());
@@ -324,6 +371,7 @@
                    {
                        gcMain.DataSource = dt;
                        gcMain.ForceInitialize();
                        gridView1.BestFitColumns();
                    }
                    else
                        UtilityHelper.SetDefaultTable(gcMain, gridView1);
@@ -341,7 +389,7 @@
            {
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        private void getModel(string strGuid)
        {
@@ -380,6 +428,7 @@
                        gcMx1.BindingContext = new BindingContext();
                        gcMx1.DataSource = dt;
                        gcMx1.ForceInitialize();
                        gvMx1.BestFitColumns();
                    }
                    else
                    {
@@ -401,7 +450,7 @@
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private   void ToolBarMenu1_btnChkClick(object sender, EventArgs e)
        private void ToolBarMenu1_btnChkClick(object sender, EventArgs e)
        {
            _toolCk(1);
        }
@@ -412,7 +461,7 @@
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private   void ToolBarMenu1_btnFChkClick(object sender, EventArgs e)
        private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e)
        {
            _toolCk(0);
        }
@@ -421,7 +470,7 @@
        /// 工具条事件
        /// </summary>
        /// <param name="inFieldValue"></param>
        private   void _toolCk(int _inFieldValue)
        private void _toolCk(int _inFieldValue)
        {
            string strMsg = "";
            switch (_inFieldValue)
@@ -443,7 +492,7 @@
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定" + strMsg + "吗?"))
                return;
            var _obj = new
            {
                guid = rowGuid,
@@ -468,25 +517,16 @@
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        private void repositoryItemSearchLookUpEdit1_EditValueChanged(object sender, EventArgs e)
        {
            SearchLookUpEdit LookupEdit = sender as SearchLookUpEdit;
            DataRowView SelectedDataRow = (DataRowView)LookupEdit.GetSelectedDataRow();
            gvMx1.SetFocusedRowCellValue("qd002", SelectedDataRow["itemNo"]);
            gvMx1.SetFocusedRowCellValue("qd003", SelectedDataRow["itemName"]);
            gvMx1.SetFocusedRowCellValue("qd004", SelectedDataRow["itemModel"]);
        }
        private void repositoryItemSearchLookUpEdit1_EditValueChanged_1(object sender, EventArgs e)
        {
            SearchLookUpEdit LookupEdit = sender as SearchLookUpEdit;
            DataRowView SelectedDataRow = (DataRowView)LookupEdit.GetSelectedDataRow();
            gvMx1.SetFocusedRowCellValue("qd002", SelectedDataRow["itemNo"]);
            gvMx1.SetFocusedRowCellValue("qd003", SelectedDataRow["itemName"]);
            gvMx1.SetFocusedRowCellValue("qd004", SelectedDataRow["itemModel"]);
            gvMx1.SetFocusedRowCellValue("qd009", SelectedDataRow["dwName"]);
        }
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)