| | |
| | | using Gs.DevApp.ToolBox; |
| | | using Gs.DevApp.UserControl; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | |
| | | { |
| | | string _webServiceName = "RkqcfaManager/"; |
| | | List<FilterEntity> _filterList = new List<FilterEntity>(); |
| | | string _ucGys = "";//供应商 |
| | | public Frm_Cqfa() |
| | | { |
| | | InitializeComponent(); |
| | |
| | | toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick; |
| | | toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick; |
| | | this.toolBarMenu1.getXmlConfig(); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "checkStatus", "", (value) => |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); |
| | |
| | | }, lbGuid); |
| | | getPageList(1); |
| | | pageBar1.PagerEvent += PageBar1_PagerEvent; |
| | | //选择需要的明细 |
| | | btnSelect.Click += (s, e) => |
| | | { |
| | | //if (string.IsNullOrEmpty(this.txt_suppId.GetId())) |
| | | //{ |
| | | // Gs.DevApp.ToolBox.MsgHelper.ShowError("请先选择供应商!"); |
| | | // return; |
| | | //} |
| | | //var frm = new SelectMesCgthSq(this.txt_suppId.GetId(), this.txt_thOrgId.GetId()); |
| | | ////赋值给明细表 |
| | | //frm.UpdateParent += (ss, ee) => |
| | | //{ |
| | | // try |
| | | // { |
| | | // var lst = new List<string>(); |
| | | // lst = ee.StringList; |
| | | // var _obj = lst; |
| | | // var strReturn = UtilityHelper.HttpPost("", |
| | | // _webServiceName + "SelectFormTo", |
| | | // JsonConvert.SerializeObject(_obj)); |
| | | // var dt = UtilityHelper.ReturnToList(strReturn); |
| | | // DataTable _newTable = dt.rtnData; |
| | | // DataTable _oldTable = (DataTable)gcMx1.DataSource; |
| | | // DataRow[] sourceRows = _newTable.Select(); |
| | | // for (int i = 0; i < sourceRows.Length; i++) |
| | | // { |
| | | // _oldTable.ImportRow(sourceRows[i]); |
| | | // } |
| | | // gcMx1.BindingContext = new BindingContext(); |
| | | // gcMx1.DataSource = _oldTable; |
| | | // gcMx1.ForceInitialize(); |
| | | // gvMx1.BestFitColumns(); |
| | | // Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // MessageBox.Show(ex.Message); |
| | | // } |
| | | //}; |
| | | //frm.ShowDialog(); |
| | | }; |
| | | } |
| | | private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) |
| | | { |
| | |
| | | txt_fabm.ReadOnly = true; |
| | | txt_fSubsidiary.Enabled = false; |
| | | } |
| | | 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> |
| | | /// 新增事件 |
| | |
| | | { |
| | | 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.layoutMx1.Controls, true, gridViews); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | //增加时,默认组织 |
| | | string deftOrg = UtilityHelper.GetFirstOrg(txt_fSubsidiary); |
| | | } |
| | |
| | | fabm = _fabm.Trim(), |
| | | bz = _bz.Trim(), |
| | | fSubsidiary = _fSubsidiary.Trim(), |
| | | list = new List<dynamic>(), |
| | | }; |
| | | gvMx1.CloseEditor(); |
| | | gvMx1.PostEditor(); |
| | | gvMx1.UpdateCurrentRow(); |
| | | for (var i = 0; i < gvMx1.DataRowCount; i++) |
| | | { |
| | | var row = gvMx1.GetDataRow(i); |
| | | if (row != null) |
| | | { |
| | | Guid _guid = UtilityHelper.ToGuid(row["id"].ToString()); |
| | | string _msl = row["sqNum"].ToString(); |
| | | if (string.IsNullOrEmpty(_msl)) |
| | | { |
| | | 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(), |
| | | }); |
| | | } |
| | | } |
| | | try |
| | | { |
| | | var strJson = UtilityHelper.HttpPost("", |
| | |
| | | lbGuid.Text = _rtn.rtnData.outGuid; |
| | | txt_fabm.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(this.layoutMx1.Controls, false, gvList); |
| | | UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false); |
| | | toolBarMenu1.currentAction = ""; |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6); |
| | | } |
| | |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | dynamic dy = _rtn.rtnData; |
| | | _ucGys = dy.suppId; |
| | | lbGuid.Text = strGuid; |
| | | List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); |
| | | gvList.Add(gvMx1); |
| | | UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList); |
| | | _ucGys = ""; |
| | | JObject _job = JObject.Parse(strJson); |
| | | JArray array = new JArray(); |
| | | foreach (var a in _job["rtnData"]["list"]) |
| | | { |
| | | array.Add(a); |
| | | } |
| | | DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString()); |
| | | if (dt.Rows.Count > 0) |
| | | { |
| | | gcMx1.BindingContext = new BindingContext(); |
| | | gcMx1.DataSource = dt; |
| | | gcMx1.ForceInitialize(); |
| | | gvMx1.BestFitColumns(); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1); |
| | | } |
| | | else |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | } |
| | | UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit); |
| | | } |
| | | else |
| | | ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg); |
| | |
| | | { |
| | | MsgHelper.ShowInformation(_rtn.rtnData.outMsg.ToString()); |
| | | 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; |
| | | UtilityHelper.SetCheckIco(gridView1, "checkStatus", "checkBy", "checkDate", picCheckBox, this, _inFieldValue.ToString()); |
| | | } |
| | | else |
| | |
| | | MsgHelper.ShowError("提示:" + 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) |
| | | return; |
| | | if (e.Button.Index == 0) |
| | | { |
| | | var dr = gvMx1.GetDataRow(rowhandle); |
| | | var mxGuid = dr["id"].ToString(); |
| | | if (!MsgHelper.AskQuestion("你选择了1条数据,确定删除吗?")) |
| | | return; |
| | | if (string.IsNullOrEmpty(mxGuid)) |
| | | { |
| | | gvMx1.DeleteRow(rowhandle); |
| | | return; |
| | | } |
| | | var _obj = new |
| | | { |
| | | guid = lbGuid.Text.Trim(), |
| | | mxGuid = mxGuid, |
| | | }; |
| | | try |
| | | { |
| | | var strJson = UtilityHelper.HttpPost("", |
| | | _webServiceName + "DeleteModelOrMx", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | var _rtn = UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | if (_rtn.rtnCode > 0) getModel(lbGuid.Text); |
| | | } |
| | | MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |