lu
2025-03-11 d37df25d14c9bf8ddaa4a0578dd8a84e2ffc7900
DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesInvItemArn.cs
@@ -3,7 +3,6 @@
using System.Data;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.RichEdit.Export;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraGrid.Views.Grid;
@@ -19,6 +18,8 @@
    {
        private List<FilterEntity> _filterList = new List<FilterEntity>();
        private readonly string _webServiceName = "MesInvItemArnManager/";
        string _ucCk = "";//仓库
        string _ucGys = "";//供应商
        public Frm_MesInvItemArn()
        {
            InitializeComponent();
@@ -33,11 +34,12 @@
            toolBarMenu1.btnJianYanClick += ToolBarMenu1_btnJianYanClick;
            toolBarMenu1.btnFjianYanClick += ToolBarMenu1_btnFjianYanClick;
            toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
            this.toolBarMenu1.getXmlConfig();
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", (value) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
            });
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "fstatus", "", (value) =>
           {
               Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
           });
            Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
            {
                getModel(value);
@@ -51,8 +53,10 @@
            this.txt_receiveOrgId.EditChanged += (s, e) =>
            {
                string _orgId = txt_receiveOrgId.GetId();
                txt_suppId.getSuppler(_orgId);
                txt_depotsId.getSuppler(_orgId);
                if (string.IsNullOrEmpty(_orgId))
                    return;
                txt_suppId.getSuppler(_orgId, _ucGys);
                txt_depotsId.getSuppler(_orgId, _ucCk);
            };
            //设置仓库选择
            this.txt_depotsId.EditChanged += (s, e) =>
@@ -67,12 +71,18 @@
            //选择需要入库的明细
            btnSelect.Click += (s, e) =>
            {
                if (string.IsNullOrEmpty(this.txt_receiveOrgId.GetId()))
                {
                    MsgHelper.Warning("请选择收料组织!");
                    txt_receiveOrgId.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(this.txt_suppId.GetId()))
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请先选择供应商,才能选择来料明细!");
                    return;
                }
                var frm = new SelectCgMx(this.txt_suppId.GetId());
                var frm = new SelectCgMx(this.txt_suppId.GetId(), txt_receiveOrgId.GetId(), (txt_fType.Checked == true ? 2 : 1).ToString());
                //赋值给明细表
                frm.UpdateParent += (ss, ee) =>
                {
@@ -81,9 +91,7 @@
                        var lst = new List<string>();
                        lst = ee.StringList;
                        var _obj = lst;
                        var strReturn = UtilityHelper.HttpPost("",
                            _webServiceName + "SelectDialogToView",
                            JsonConvert.SerializeObject(_obj));
                        var strReturn = UtilityHelper.HttpPost("", _webServiceName + "SelectFormTo", JsonConvert.SerializeObject(_obj));
                        var dt = UtilityHelper.ReturnToList(strReturn);
                        DataTable _newTable = dt.rtnData;
                        DataTable _oldTable = (DataTable)gcMx1.DataSource;
@@ -95,13 +103,13 @@
                        gcMx1.BindingContext = new BindingContext();
                        gcMx1.DataSource = _oldTable;
                        gcMx1.ForceInitialize();
                        gvMx1.PostEditor();
                        gvMx1.UpdateCurrentRow();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                };
                frm.ShowDialog();
            };
@@ -109,11 +117,11 @@
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        {
            _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns);
            Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
            Task.Delay(100);
            getPageList(1);
        }
        /// <summary>
        ///     分页事件
        /// </summary>
@@ -189,7 +197,7 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnEscClick(object sender, EventArgs e)
        {
            UtilityHelper.JumpToTab(xtraTabControl1, 0);
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 1);
        }
        /// <summary>
@@ -200,8 +208,7 @@
        private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
        {
            string rowGuid = "", rowName = "";
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_billNo, gridView1);
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1, "billNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
@@ -222,8 +229,11 @@
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
                    getPageList(1);
                    if (xtraTabControl1.SelectedTabPageIndex == 0)
                    { }
                    else
                        Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2);
                    getPageList(this.pageBar1.CurrentPage);
                }
                MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
@@ -244,14 +254,15 @@
                getModel(lbGuid.Text.Trim());
            else
            {
                _filterList.Clear();
                if (gridView1.ActiveFilter.Count > 0)
                {
                    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
                    gridView1.ActiveFilter.Clear();
                    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
                }
                getPageList(1);
                //_filterList.Clear();
                //if (gridView1.ActiveFilter.Count > 0)
                //{
                //    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
                //    gridView1.ActiveFilter.Clear();
                //    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
                //}
                //getPageList(1);
                getPageList(this.pageBar1.CurrentPage);
            }
        }
@@ -271,7 +282,16 @@
                return;
            }
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
            UtilityHelper.ChangeEnableByControl(panel1.Controls, true);
            if (xtraTabControl1.SelectedTabPageIndex == 1)
            {
                getModel(rowGuid);
            }
            else
            {
                List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                gvList.Add(gvMx1);
                UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList);
            }
        }
        /// <summary>
@@ -285,7 +305,7 @@
            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);
            UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews);
            Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
        }
@@ -330,6 +350,7 @@
                list = new List<dynamic>(),
            };
            gvMx1.CloseEditor();
            gvMx1.PostEditor();
            gvMx1.UpdateCurrentRow();
            if (gvMx1.DataRowCount <= 0)
            {
@@ -355,6 +376,7 @@
                        ItemId = int.Parse(row["itemId"].ToString()),
                        Quantity = decimal.Parse(row["quantity"].ToString()),
                        UrgentFlag = Gs.DevApp.ToolBox.UtilityHelper.ToBit(row["urgentFlag"].ToString()),
                        Remark = row["memo"].ToString(),
                    });
                }
            }
@@ -367,9 +389,12 @@
                MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                if (_rtn.rtnCode > 0)
                {
                    lbGuid.Text = _rtn.rtnData;
                    lbGuid.Text = _rtn.rtnData.outGuid;
                    txt_billNo.Text = _rtn.rtnData.outNo;
                    toolBarMenu1.isSetBtn = true;
                    UtilityHelper.ChangeEnableByControl(panel1.Controls, false);
                    List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                    gvList.Add(gvMx1);
                    UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false);
                }
            }
            catch (Exception ex)
@@ -396,15 +421,16 @@
                if (dd.rtnCode > 0)
                {
                    DataTable dt = dd.rtnData.list;
                    gcMain.BindingContext = new BindingContext();
                    gcMain1.BindingContext = new BindingContext();
                    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
                    if (dt.Rows.Count > 0)
                    {
                        gcMain.DataSource = dt;
                        gcMain.ForceInitialize();
                        gcMain1.DataSource = dt;
                        gcMain1.ForceInitialize();
                        gridView1.BestFitColumns();
                    }
                    else
                        UtilityHelper.SetDefaultTable(gcMain, gridView1);
                        UtilityHelper.SetDefaultTable(gcMain1, gridView1);
                    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
                    pageBar1.TotalPages = dd.rtnData.pages;//总页
                    pageBar1.CurrentPage = curPage;//当前页
@@ -444,10 +470,14 @@
                if (_rtn.rtnCode > 0)
                {
                    var dy = _rtn.rtnData;
                    _ucGys = dy.suppId;
                    _ucCk = dy.depotsId;
                    lbGuid.Text = strGuid;
                    var gvList = new List<GridView>();
                    gvList.Add(gvMx1);
                    UtilityHelper.SetValueByObj(panel1.Controls, dy, isEdit, gvList);
                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList);
                    _ucGys = "";
                    _ucCk = "";
                    var _job = JObject.Parse(strJson);
                    var array = new JArray();
                    foreach (var a in _job["rtnData"]["list"]) array.Add(a);
@@ -459,6 +489,7 @@
                        gcMx1.BindingContext = new BindingContext();
                        gcMx1.DataSource = dt;
                        gcMx1.ForceInitialize();
                        gvMx1.BestFitColumns();
                    }
                    else
                    {
@@ -562,10 +593,8 @@
                {
                    MsgHelper.Warning("提示:" + ex.Message);
                }
            }
        }
        /// <summary>
        /// 检验和反检验
@@ -573,11 +602,8 @@
        /// <param name="inFieldValue"></param>
        private void _toolCk(string _meth)
        {
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_billNo, gridView1, "billNo");
            toolBarMenu1.guidKey = rowGuid;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1, "billNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
@@ -596,12 +622,16 @@
                    JsonConvert.SerializeObject(_obj));
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                MsgHelper.Warning("提示:" + _rtn.rtnData.outMsg);
                if (_rtn.rtnCode > 0)
                if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                {
                    if (xtraTabControl1.SelectedTabPageIndex == 1)
                    {
                        getModel(lbGuid.Text.Trim());
                    else
                        getPageList(this.pageBar1.CurrentPage);
                    }
                    int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
                    gridView1.FocusedRowHandle = rowHandle;
                    int _inFieldValue = (_meth == "EditModelSubmit" ? 1 : -1);
                    UtilityHelper.SetCheckIco(gridView1, "fstatus", "checkUser", "checkDate", picCheckBox, this, _inFieldValue.ToString());
                }
            }
            catch (Exception ex)