bug
lu
9 天以前 aadc9c5e167801a7e845088ca160642a9e99884d
DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs
@@ -15,7 +15,6 @@
    {
        string _webServiceName = "MesCgthSqManager/";
        List<FilterEntity> _filterList = new List<FilterEntity>();
        string _ucCk = "";//发料仓库
        string _ucGys = "";//供应商
        public Frm_MesCgthSq()
        {
@@ -30,18 +29,19 @@
            toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
            toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
            toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(this.GetType().FullName, gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(this.GetType().FullName, gridView1, picCheckBox, this, "status", "", (value) =>
            this.toolBarMenu1.getXmlConfig();
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "status", "", (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);
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            //选择库存组织(仓库和供应商)
@@ -51,7 +51,6 @@
                if (string.IsNullOrEmpty(orgId))
                    return;
                txt_suppId.getSuppler(orgId, _ucGys);
                txt_depotId.getSuppler(orgId, _ucCk);
            };
            //选择需要的明细
            btnSelect.Click += (s, e) =>
@@ -61,7 +60,7 @@
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请先选择供应商!");
                    return;
                }
                var frm = new SelectMesCgthSq(this.txt_suppId.GetId(), this.txt_thOrgId.GetId(), (txt_isOut.Checked == true ? 1 : 0).ToString());
                var frm = new SelectMesCgthSq(this.txt_suppId.GetId(), this.txt_thOrgId.GetId());
                //赋值给明细表
                frm.UpdateParent += (ss, ee) =>
                {
@@ -84,6 +83,8 @@
                        gcMx1.BindingContext = new BindingContext();
                        gcMx1.DataSource = _oldTable;
                        gcMx1.ForceInitialize();
                        gvMx1.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                    }
                    catch (Exception ex)
                    {
@@ -131,7 +132,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();
        }
@@ -268,7 +269,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);
            }
        }
        /// <summary>
@@ -282,7 +283,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);
        }
        /// <summary>
@@ -293,7 +294,6 @@
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            var _ckId = txt_depotId.GetId(); //仓库编号 depots_code
            var _gysId = txt_suppId.GetId(); //供应商编号
            string _orgId = txt_thOrgId.GetId();
            if (string.IsNullOrEmpty(_orgId))
@@ -306,12 +306,6 @@
            {
                MsgHelper.Warning("请选择供应商!");
                txt_suppId.Focus();
                return;
            }
            if (string.IsNullOrEmpty(_ckId))
            {
                MsgHelper.Warning("请选择仓库!");
                txt_depotId.Focus();
                return;
            }
            if (txt_returnMethod.SelectedIndex <= 0)
@@ -331,13 +325,13 @@
                Guid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(lbGuid.Text.Trim()), //到货单主键
                Remark = txt_remark.Text.Trim(), //备注
                SuppId = int.Parse(_gysId), //供应商
                DepotId = int.Parse(_ckId),//仓库
                FType = txt_isOut.Checked == true ? 1 : 0,  //0=采购,1=委外
                Fmrmode = txt_returnMethod.Text,//退料方式
                Reason = txt_returnType.Text,//退料原因
                list = new List<dynamic>(),
            };
            gvMx1.CloseEditor();
            gvMx1.PostEditor();
            gvMx1.UpdateCurrentRow();
            if (gvMx1.DataRowCount <= 0)
            {
@@ -356,12 +350,19 @@
                        MsgHelper.ShowError("申请数量不能为空!");
                        return;
                    }
                    string _depotId = row["depotId"].ToString();
                    if (string.IsNullOrEmpty(_depotId))
                    {
                        MsgHelper.ShowError("仓库不能为空!");
                        return;
                    }
                    _obj.list.Add(new
                    {
                        Guid = _guid,
                        AboutGuid = UtilityHelper.ToGuid(row["rkmxGuid"].ToString()),
                        Quantity = decimal.Parse(row["sqNum"].ToString()),
                        Bz = row["remark"].ToString(),
                        DepotId= row["depotId"].ToString(),
                    });
                }
            }
@@ -379,8 +380,9 @@
                    toolBarMenu1.isSetBtn = true;
                    List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                    gvList.Add(gvMx1);
                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false, gvList);
                    UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gvList);
                    toolBarMenu1.currentAction = "";
                    Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
                }
            }
            catch (Exception ex)
@@ -396,7 +398,7 @@
        /// <param name="pageSize">每页几条</param>
        private void getPageList(int curPage)
        {
            var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            gcMain1.DataSource = null;var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "BILL_NO", "asc", "", _sbSqlWhere.ToString());
            string json = JsonConvert.SerializeObject(pgq);
            try
@@ -406,16 +408,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;//当前页
@@ -431,6 +433,10 @@
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 读取实体
        /// </summary>
        /// <param name="strGuid"></param>
        private void getModel(string strGuid)
        {
            bool isEdit = false;
@@ -453,13 +459,11 @@
                {
                    dynamic dy = _rtn.rtnData;
                    _ucGys = dy.suppId;
                    _ucCk = dy.depotId;
                    lbGuid.Text = strGuid;
                    List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                    gvList.Add(gvMx1);
                    UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit, gvList);
                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList);
                    _ucGys = "";
                    _ucCk = "";
                    JObject _job = JObject.Parse(strJson);
                    JArray array = new JArray();
                    foreach (var a in _job["rtnData"]["list"])
@@ -473,6 +477,7 @@
                        gcMx1.DataSource = dt;
                        gcMx1.ForceInitialize();
                        gvMx1.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                    }
                    else
                    {
@@ -541,9 +546,16 @@
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 删除明细
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            gvMx1.CloseEditor();
            gvMx1.PostEditor();
            gvMx1.UpdateCurrentRow();
            var rowhandle = gvMx1.FocusedRowHandle;
            if (rowhandle < 0)
@@ -582,5 +594,33 @@
                }
            }
        }
        /// <summary>
        /// 查找仓库
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void rptCk_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            var rowhandle = gvMx1.FocusedRowHandle;
            if (rowhandle < 0)
                return;
            //var dr = gvMx1.GetDataRow(rowhandle);
            var strOrgGuid = txt_thOrgId.GetId();
            if (string.IsNullOrEmpty(strOrgGuid))
            {
                MsgHelper.Warning("提示:请先选择调出组织!");
                return;
            };
            SelectCk frm = new SelectCk(strOrgGuid);
            frm.UpdateParent += (ss, ee) =>
            {
                var lst = new List<dynamic>();
                lst = ee.DynamicList;
                gvMx1.SetFocusedRowCellValue("depotName", lst[0].name);
                gvMx1.SetFocusedRowCellValue("depotId", lst[0].guid);
            };
            frm.ShowDialog();
        }
    }
}