From 22f37018f11fffbc4a7bd656e1a459b3b02a8980 Mon Sep 17 00:00:00 2001 From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU> Date: 星期六, 20 九月 2025 10:31:33 +0800 Subject: [PATCH] 设备台账表、设备保养记录表、设备点检记录表的增删改和审核功能 --- DevApp/Gs.DevApp/DevFrm/Rpt/YS_sbbyjlb.cs | 304 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 291 insertions(+), 13 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/Rpt/YS_sbbyjlb.cs b/DevApp/Gs.DevApp/DevFrm/Rpt/YS_sbbyjlb.cs index 20fb04b..6a81860 100644 --- a/DevApp/Gs.DevApp/DevFrm/Rpt/YS_sbbyjlb.cs +++ b/DevApp/Gs.DevApp/DevFrm/Rpt/YS_sbbyjlb.cs @@ -1,39 +1,59 @@ +锘縰sing DevExpress.ClipboardSource.SpreadsheetML; +using DevExpress.XtraEditors; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Gs.DevApp.UserControl; using Newtonsoft.Json; +using Newtonsoft.Json.Linq; 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; +using System.Windows.Media.Animation; namespace Gs.DevApp.DevFrm { + /// <summary> + /// 璁惧淇濆吇璁板綍琛� + /// </summary> public partial class YS_sbbyjlb : DevExpress.XtraEditors.XtraForm { - //璁惧淇濆吇璁板綍琛� string _webServiceName = "YS_sbbyjlb/"; List<FilterEntity> _filterList = new List<FilterEntity>(); + public YS_sbbyjlb() { InitializeComponent(); + this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;//鏌ヨ浜嬩欢 + this.toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick;//鏂板浜嬩欢 + this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;//淇敼浜嬩欢 + this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick; this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; - this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; + this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1; + this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick; + toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick; + toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick; this.toolBarMenu1.getXmlConfig(); - Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, this, "", "", (value) => + Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "checkStatus", "", (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; } + private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) { _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1); @@ -74,6 +94,79 @@ _filterList = e.FilterList; getPageList(1); } + /// <summary> + /// 瀹℃牳浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnChkClick(object sender, EventArgs e) + { + _toolCk(1); + } + + /// <summary> + /// 鍙嶅鏍� + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + /// <exception cref="NotImplementedException"></exception> + private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e) + { + _toolCk(0); + } + /// <summary> + /// 鍙栨秷浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnEscClick(object sender, EventArgs e) + { + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 1); + } + + /// <summary> + /// 鍒犻櫎浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e) + { + string rowGuid = "", rowName = ""; + (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_Guid, gridView1); + //(rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_Guid, gridView1, "hourlyType"); + if (string.IsNullOrEmpty(rowGuid)) + { + ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鍒犻櫎鍚楋紵")) + return; + List<dynamic> lst = new List<dynamic>(); + lst.Add(rowGuid); + var _obj = new + { + guid = rowGuid, + mxGuid = Guid.Empty.ToString(), + }; + try + { + string strJson = UtilityHelper.HttpPost("", _webServiceName + "DeleteModel", JsonConvert.SerializeObject(_obj)); + ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); + if (_rtn.rtnCode > 0) + { + if (xtraTabControl1.SelectedTabPageIndex == 0) + { } + else + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2); + getPageList(this.pageBar1.CurrentPage); + } + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + } + catch (Exception ex) + { + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } /// <summary> /// 鍒锋柊浜嬩欢 @@ -82,7 +175,91 @@ /// <param name="e"></param> private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) { + if (xtraTabControl1.SelectedTabPageIndex == 1) + getModel(lbGuid.Text.Trim()); + else + { + getPageList(this.pageBar1.CurrentPage); + } + } + + /// <summary> + /// 鏂板浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnAddClick(object sender, EventArgs e) + { + lbGuid.Text = ""; + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4); + UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true); getPageList(this.pageBar1.CurrentPage); + } + private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e) + { + string rowGuid, rowName; + (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,lbGuid, txt_Guid, gridView1); + if (string.IsNullOrEmpty(rowGuid)) + { + MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); + getModel(rowGuid); + getPageList(this.pageBar1.CurrentPage); + } + + /// <summary> + /// 淇濆瓨浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e) + { + toolBarMenu1.isSetBtn = false; + string submitStatus = txt_submitStatus.Text.Trim();//鎻愪氦鐘舵�� + string customerCode = txt_customerCode.Text.Trim();//瀹㈡埛缂栫爜 + string customerName = txt_customerName.Text.Trim();//瀹㈡埛鍚嶇О + string remark = txt_remark.Text.Trim();//澶囨敞 + string createUser = txt_createUser.Text.Trim();//鍒涘缓浜� + string createTime = txt_createTime.Text.Trim();//鏃堕棿 + string lastModifyUser = txt_lastModifyUser.Text.Trim();//鏈�鍚庝慨鏀逛汉 + string lastModifyTime = txt_lastModifyTime.Text.Trim();//鏈�鍚庝慨鏀规椂闂� + string UpDataTime = txt_UpDataTime.Text.Trim();//鏇存柊鏃堕棿 + string UpDataUser = txt_UpDataUser.Text.Trim();//鏇存柊浜� + + try + { + var _obj = new + { + guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓 + submitStatus = submitStatus, + customerCode = customerCode, + customerName = customerName, + remark = remark, + createUser = createUser, + createTime = createTime, + lastModifyUser = lastModifyUser, + lastModifyTime = lastModifyTime, + UpDataTime= UpDataTime, + UpDataUser= UpDataUser + }; + string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj)); + ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + if (_rtn.rtnCode > 0) + { + lbGuid.Text = _rtn.rtnData.outGuid; + toolBarMenu1.isSetBtn = true; + UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false); + toolBarMenu1.currentAction = ""; + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6); + } + } + catch (Exception ex) + { + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } } /// <summary> @@ -93,12 +270,13 @@ private void getPageList(int curPage) { gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); - PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.INDEP_DATE", "asc", "", _sbSqlWhere.ToString()); - string json = JsonConvert.SerializeObject(pgq); + var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "", "", "", _sbSqlWhere.ToString()); + var json = JsonConvert.SerializeObject(pgq); try { - var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json); - ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); + var strReturn = UtilityHelper.HttpPost("", + _webServiceName + "GetListPage", json); + var dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; @@ -109,7 +287,6 @@ gcMain1.DataSource = dt; gcMain1.ForceInitialize(); gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1); - } else UtilityHelper.SetDefaultTable(gcMain1, gridView1); @@ -125,8 +302,109 @@ } catch (Exception ex) { - ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } + + /// <summary> + /// 瀛愯〃鏌ヨ + /// </summary> + /// <param name="strGuid">涓婚敭</param> + /// <param name="isEdit">鏄惁鍙紪杈�</param> + /// <param name="tabIdx">閫夐」鍗″簭鍙�</param> + private void getModel(string strGuid) + { + bool isEdit = false; + if (toolBarMenu1.currentAction == "add") return; + if (toolBarMenu1.currentAction == "edit") isEdit = true; + if (string.IsNullOrEmpty(strGuid)) + { + ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + var _obj = new + { + guid = strGuid,//涓诲缓 + }; + try + { + string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj)); + ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); + if (_rtn.rtnCode > 0) + { + dynamic dy = _rtn.rtnData; + lbGuid.Text = strGuid; + UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit); + + } + else + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + } + catch (Exception ex) + { + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + + /// <summary> + /// 宸ュ叿鏉′簨浠� + /// </summary> + /// <param name="inFieldValue"></param> + private void _toolCk(int _inFieldValue) + { + string strMsg = ""; + switch (_inFieldValue) + { + case 1: + strMsg = "瀹℃牳"; + break; + case 0: + strMsg = "鍙嶅鏍�"; + break; + } + ; + toolBarMenu1.guidKey = ""; + string rowGuid, rowName; + (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_Guid, gridView1); + //(rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_SalaryType, gridView1, "hourlyType"); + if (string.IsNullOrEmpty(rowGuid)) + { + MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾" + strMsg + "鍚楋紵")) + return; + var _obj = new + { + guid = rowGuid, + ckValue = _inFieldValue, + parameter = "YS_sbbyjlb,check_Date,check_Status,check_user" + }; + try + { + var strJson = UtilityHelper.HttpPost("", "General/GeneralCheck", + JsonConvert.SerializeObject(_obj)); + var _rtn = UtilityHelper.ReturnToDynamic(strJson); + 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, "checkStatus", "checkUser", "checkDate", picCheckBox, this, _inFieldValue.ToString()); + } + else + MsgHelper.ShowError(_rtn.rtnData.outMsg.ToString()); + } + catch (Exception ex) + { + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); + } + } + + } -} +} \ No newline at end of file -- Gitblit v1.9.3