lu
2025-04-14 ecb7a60de1639f520712ce95f99414b0dd2c9713
DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesInvItemArn.cs
@@ -1,8 +1,3 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraGrid.Views.Grid;
@@ -11,6 +6,11 @@
using Gs.DevApp.UserControl;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Gs.DevApp.DevFrm
{
@@ -18,10 +18,11 @@
    {
        private List<FilterEntity> _filterList = new List<FilterEntity>();
        private readonly string _webServiceName = "MesInvItemArnManager/";
        string _ucCk = "";//仓库
        string _ucGys = "";//供应商
        public Frm_MesInvItemArn()
        {
            InitializeComponent();
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick;
            toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;
            toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick;
@@ -32,22 +33,20 @@
            toolBarMenu1.btnJianYanClick += ToolBarMenu1_btnJianYanClick;
            toolBarMenu1.btnFjianYanClick += ToolBarMenu1_btnFjianYanClick;
            toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(this.GetType().FullName, gvMx1);
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(this.GetType().FullName,gridView1,picCheckBox, this, "fstatus", "", (value) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
            });
            this.toolBarMenu1.getXmlConfig();
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "fstatus", "", (value) =>
           {
               Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
           }, tips);
            Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
            {
                getModel(value);
            }, (value) =>
            {
                getPageList(this.pageBar1.CurrentPage);
            });
            }, lbGuid);
            getPageList(1);
            //以下两行有影响性能,但目前没好方案
            txt_suppId.getSuppler("");
            txt_depotsId.getSuppler("");
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            //设置组织
            this.txt_receiveOrgId.EditChanged += (s, e) =>
@@ -55,8 +54,8 @@
                string _orgId = txt_receiveOrgId.GetId();
                if (string.IsNullOrEmpty(_orgId))
                    return;
                txt_suppId.getSuppler(_orgId);
                txt_depotsId.getSuppler(_orgId);
                txt_suppId.getSuppler(_orgId, _ucGys);
                txt_depotsId.getSuppler(_orgId, _ucCk);
            };
            //设置仓库选择
            this.txt_depotsId.EditChanged += (s, e) =>
@@ -71,12 +70,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(), txt_receiveOrgId.GetId(), (txt_fType.Checked == true ? 2 : 1).ToString());
                var frm = new SelectCgMx(this.txt_suppId.GetId(), txt_receiveOrgId.GetId());
                //赋值给明细表
                frm.UpdateParent += (ss, ee) =>
                {
@@ -97,6 +102,8 @@
                        gcMx1.BindingContext = new BindingContext();
                        gcMx1.DataSource = _oldTable;
                        gcMx1.ForceInitialize();
                        gvMx1.PostEditor();
                        gvMx1.UpdateCurrentRow();
                    }
                    catch (Exception ex)
                    {
@@ -105,11 +112,12 @@
                };
                frm.ShowDialog();
            };
        }
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        {
            Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
            _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
            Task.Delay(100);
            getPageList(1);
        }
@@ -134,7 +142,7 @@
            gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
            gridView1.ActiveFilter.Clear();
            gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
            var frm = new ShowFilter(gridView1.Columns, _filterList);
            var frm = new ShowFilter(gridView1.Columns, _filterList, this.GetType().FullName);
            frm.UpdateParent += Frm_UpdateParent;
            frm.ShowDialog();
        }
@@ -282,7 +290,7 @@
            {
                List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                gvList.Add(gvMx1);
                UtilityHelper.ChangeEnableByControl(panel1.Controls, true, gvList);
                UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList);
            }
        }
@@ -297,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);
        }
@@ -337,11 +345,11 @@
                Remark = txt_remark.Text.Trim(), //备注
                SuppId = _gysId, //供应商
                DepotsId = _ckId,//仓库
                FType = txt_fType.Checked ? 1 : 0,//0=采购,1=委外
                OrgId = _orgId,
                list = new List<dynamic>(),
            };
            gvMx1.CloseEditor();
            gvMx1.PostEditor();
            gvMx1.UpdateCurrentRow();
            if (gvMx1.DataRowCount <= 0)
            {
@@ -367,6 +375,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(),
                    });
                }
            }
@@ -380,11 +389,13 @@
                if (_rtn.rtnCode > 0)
                {
                    lbGuid.Text = _rtn.rtnData.outGuid;
                    txt_billNo.Text= _rtn.rtnData.outNo;
                    txt_billNo.Text = _rtn.rtnData.outNo;
                    toolBarMenu1.isSetBtn = true;
                    List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                    gvList.Add(gvMx1);
                    UtilityHelper.ChangeEnableByControl(panel1.Controls, false);
                    UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false);
                    toolBarMenu1.currentAction = "";
                    Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
                }
            }
            catch (Exception ex)
@@ -411,16 +422,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();
                        gridView1.BestFitColumns();
                        gcMain1.DataSource = dt;
                        gcMain1.ForceInitialize();
                        gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1);
                    }
                    else
                        UtilityHelper.SetDefaultTable(gcMain, gridView1);
                        UtilityHelper.SetDefaultTable(gcMain1, gridView1);
                    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
                    pageBar1.TotalPages = dd.rtnData.pages;//总页
                    pageBar1.CurrentPage = curPage;//当前页
@@ -460,10 +471,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);
@@ -476,6 +491,7 @@
                        gcMx1.DataSource = dt;
                        gcMx1.ForceInitialize();
                        gvMx1.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                    }
                    else
                    {