From 41e4e091da1149150501f5c07244c44053c0309a Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期一, 23 六月 2025 16:15:10 +0800 Subject: [PATCH] 重检方案 --- DevApp/Gs.DevApp/DevFrm/RkQC/Frm_Cqfa.cs | 242 +++++++++--------------------------------------- 1 files changed, 46 insertions(+), 196 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/RkQC/Frm_Cqfa.cs b/DevApp/Gs.DevApp/DevFrm/RkQC/Frm_Cqfa.cs index 9ba2217..f72c7d1 100644 --- a/DevApp/Gs.DevApp/DevFrm/RkQC/Frm_Cqfa.cs +++ b/DevApp/Gs.DevApp/DevFrm/RkQC/Frm_Cqfa.cs @@ -1,15 +1,10 @@ -锘縰sing DevExpress.XtraEditors; -using Gs.DevApp.Entity; +锘縰sing Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Gs.DevApp.UserControl; using Newtonsoft.Json; using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -17,9 +12,8 @@ { public partial class Frm_Cqfa : DevExpress.XtraEditors.XtraForm { - string _webServiceName = "MesCgthSqManager/"; + string _webServiceName = "RkqcfaManager/"; List<FilterEntity> _filterList = new List<FilterEntity>(); - string _ucGys = "";//渚涘簲鍟� public Frm_Cqfa() { InitializeComponent(); @@ -33,8 +27,7 @@ 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, "status", "", (value) => + Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "checkStatus", "", (value) => { Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); }, tips); @@ -47,47 +40,6 @@ }, 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) { @@ -167,7 +119,7 @@ { string rowGuid = "", rowName = ""; (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, - lbGuid, txt_fabm, gridView1, "billNo"); + lbGuid, txt_fabm, gridView1, "fabm"); if (string.IsNullOrEmpty(rowGuid)) { MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); @@ -178,7 +130,7 @@ var _obj = new { guid = rowGuid, - mxGuid = Guid.Empty.ToString(), + mxGuid = "", }; try { @@ -201,7 +153,6 @@ { MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } - } /// <summary> @@ -239,20 +190,17 @@ lbGuid, txt_fabm, gridView1); if (string.IsNullOrEmpty(rowGuid)) { - MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); if (xtraTabControl1.SelectedTabPageIndex == 1) { getModel(rowGuid); + 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> /// 鏂板浜嬩欢 @@ -263,13 +211,8 @@ { 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_thOrgId); - + string deftOrg = UtilityHelper.GetFirstOrg(txt_fSubsidiary); } /// <summary> /// 淇濆瓨浜嬩欢 @@ -279,11 +222,25 @@ private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e) { toolBarMenu1.isSetBtn = false; + string _fabm = txt_fabm.Text.Trim(); string _famc = txt_famc.Text.Trim(); string _yjrq = txt_yjrq.Text.Trim(); string _bzqx = txt_bzqx.Text.Trim(); string _fjxz = txt_fjxz.Text.Trim(); string _bz = txt_bz.Text.Trim(); + string _fSubsidiary = txt_fSubsidiary.GetId(); + if (string.IsNullOrEmpty(_fSubsidiary)) + { + MsgHelper.ShowError("缁勭粐涓嶈兘涓虹┖锛�"); + txt_fSubsidiary.Focus(); + return; + } + if (string.IsNullOrEmpty(_famc)) + { + MsgHelper.ShowError("鏂规缂栫爜涓嶈兘涓虹┖锛�"); + txt_fabm.Focus(); + return; + } if (string.IsNullOrEmpty(_famc)) { MsgHelper.ShowError("鍚嶇О涓嶈兘涓虹┖锛�"); @@ -310,50 +267,15 @@ } var _obj = new { - guid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(lbGuid.Text.Trim()), //鍒拌揣鍗曚富閿� - yjrq = int.Parse(_yjrq), - bzqx = int.Parse(_bzqx), - fjxz = int.Parse(_fjxz), + guid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(lbGuid.Text.Trim()), + yjrq = (_yjrq), + bzqx = (_bzqx), + fjxz = (_fjxz), famc = _famc.Trim(), + fabm = _fabm.Trim(), bz = _bz.Trim(), - list = new List<dynamic>(), + fSubsidiary = _fSubsidiary.Trim(), }; - gvMx1.CloseEditor(); - gvMx1.PostEditor(); - gvMx1.UpdateCurrentRow(); - if (gvMx1.DataRowCount <= 0) - { - MsgHelper.ShowError("鏄庣粏涓嶈兘涓虹┖锛岃閫夋嫨浣犵殑鏀舵枡鏄庣粏锛�"); - return; - } - 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("", @@ -367,9 +289,7 @@ 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); } @@ -378,7 +298,7 @@ } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } @@ -390,7 +310,7 @@ private void getPageList(int curPage) { gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); - PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "BILL_NO", "asc", "", _sbSqlWhere.ToString()); + PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.fabm", "desc", "", _sbSqlWhere.ToString()); string json = JsonConvert.SerializeObject(pgq); try { @@ -449,38 +369,15 @@ 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.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } /// <summary> @@ -501,7 +398,7 @@ }; toolBarMenu1.guidKey = ""; string rowGuid, rowName; - (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_fabm, gridView1, "billNo"); + (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_fabm, gridView1, "fabm"); if (string.IsNullOrEmpty(rowGuid)) { MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); @@ -512,79 +409,32 @@ var _obj = new { guid = rowGuid, - inFieldValue = _inFieldValue, + ckValue = _inFieldValue, + parameter = "MES_CQJY_FA,checkDate,checkStatus,checkBy" }; try { - var strJson = UtilityHelper.HttpPost("", - _webServiceName + "EditModelSubmit", + var strJson = UtilityHelper.HttpPost("", "General/GeneralCheck", JsonConvert.SerializeObject(_obj)); var _rtn = UtilityHelper.ReturnToDynamic(strJson); - MsgHelper.Warning(_rtn.rtnData.outMsg.ToString()); - if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0) + if (_rtn.rtnCode > 0) { + MsgHelper.ShowInformation(_rtn.rtnData.outMsg.ToString()); if (xtraTabControl1.SelectedTabPageIndex == 1) { getModel(lbGuid.Text.Trim()); } int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid); gridView1.FocusedRowHandle = rowHandle; - UtilityHelper.SetCheckIco(gridView1, "status", "checkUser", "checkDate", picCheckBox, this, _inFieldValue.ToString()); + UtilityHelper.SetCheckIco(gridView1, "checkStatus", "checkBy", "checkDate", picCheckBox, this, _inFieldValue.ToString()); } + else + MsgHelper.ShowError(_rtn.rtnData.outMsg.ToString()); } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + 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); - } - } - } - } } \ No newline at end of file -- Gitblit v1.9.3