From 0249c31d8a31f1dfb94915915b177ec4a3074d60 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期二, 01 七月 2025 16:44:44 +0800
Subject: [PATCH] bug
---
DevApp/Gs.DevApp/DevFrm/RkQC/Frm_Cqfa.cs | 504 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 499 insertions(+), 5 deletions(-)
diff --git a/DevApp/Gs.DevApp/DevFrm/RkQC/Frm_Cqfa.cs b/DevApp/Gs.DevApp/DevFrm/RkQC/Frm_Cqfa.cs
index d6efb02..63142db 100644
--- a/DevApp/Gs.DevApp/DevFrm/RkQC/Frm_Cqfa.cs
+++ b/DevApp/Gs.DevApp/DevFrm/RkQC/Frm_Cqfa.cs
@@ -1,11 +1,10 @@
-锘縰sing DevExpress.XtraEditors;
+锘縰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;
@@ -13,9 +12,504 @@
{
public partial class Frm_Cqfa : DevExpress.XtraEditors.XtraForm
{
+ string _webServiceName = "RkqcfaManager/";
+ List<FilterEntity> _filterList = new List<FilterEntity>();
public Frm_Cqfa()
{
InitializeComponent();
+ this.toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick;
+ this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;
+ this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick;
+ this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
+ this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
+ this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
+ this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
+ toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
+ toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
+ this.toolBarMenu1.getXmlConfig();
+ 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;
+ //绉诲叆
+ btnIn.Click += (s, e) =>
+ {
+ if (lbGuid.Text.Length <= 0)
+ {
+ Gs.DevApp.ToolBox.MsgHelper.ShowError("鎻愮ず锛氳鍏堜繚瀛樻柟妗堬紒");
+ return;
+ }
+ string strItemsGuids = frm_CqfaItems2.GetSelect();
+ if (string.IsNullOrEmpty(strItemsGuids))
+ {
+ Gs.DevApp.ToolBox.MsgHelper.ShowError("鎻愮ず锛氳鍏堝嬀閫夐渶瑕佺Щ鍏ョ殑鐗╂枡锛�");
+ return;
+ }
+ _toolOutIn(1, strItemsGuids);
+ };
+ //绉诲嚭
+ btnOut.Click += (s, e) =>
+ {
+ if (lbGuid.Text.Length <= 0)
+ {
+ Gs.DevApp.ToolBox.MsgHelper.ShowError("鎻愮ず锛氳鍏堜繚瀛樻柟妗堬紒");
+ return;
+ }
+ string strItemsGuids = frm_CqfaItems1.GetSelect();
+ if (string.IsNullOrEmpty(strItemsGuids))
+ {
+ Gs.DevApp.ToolBox.MsgHelper.ShowError("鎻愮ず锛氳鍏堝嬀閫夐渶瑕佺Щ鍑虹殑鐗╂枡锛�");
+ return;
+ }
+ _toolOutIn(0, strItemsGuids);
+ };
+ }
+ private async void GridView1_ColumnFilterChanged(object sender, EventArgs e)
+ {
+ _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
+ await Task.Delay(100);
+ getPageList(1);
+ }
+ /// <summary>
+ /// 鍒嗛〉浜嬩欢
+ /// </summary>
+ /// <param name="curPage"></param>
+ /// <param name="pageSize"></param>
+ private void PageBar1_PagerEvent(int curPage, int pageSize)
+ {
+ getPageList(curPage);
+ }
+ /// <summary>
+ /// 鏌ヨ浜嬩欢
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e)
+ {
+ gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
+ gridView1.ActiveFilter.Clear();
+ gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
+ var frm = new ShowFilter(gridView1.Columns, _filterList, this.GetType().FullName);
+ frm.UpdateParent += Frm_UpdateParent;
+ frm.ShowDialog();
+ }
+ /// <summary>
+ /// 鏌ヨ鍥炶皟
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void Frm_UpdateParent(object sender, UpdateParentEventArgs e)
+ {
+ _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_fabm, gridView1, "fabm");
+ if (string.IsNullOrEmpty(rowGuid))
+ {
+ MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+ return;
+ }
+ if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鍒犻櫎鍚楋紵"))
+ return;
+ var _obj = new
+ {
+ guid = rowGuid,
+ mxGuid = "",
+ };
+ try
+ {
+ var strJson = UtilityHelper.HttpPost("",
+ _webServiceName + "DeleteModel",
+ JsonConvert.SerializeObject(_obj));
+ var _rtn = UtilityHelper.ReturnToDynamic(strJson);
+ if (_rtn.rtnCode > 0)
+ {
+ MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg);
+ if (xtraTabControl1.SelectedTabPageIndex == 0)
+ { }
+ else
+ Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2);
+ getPageList(this.pageBar1.CurrentPage);
+ }
+ else
+ MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
+ }
+ catch (Exception ex)
+ {
+ MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
+ }
+ }
+
+ /// <summary>
+ /// 鍒锋柊浜嬩欢
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
+ {
+ if (xtraTabControl1.SelectedTabPageIndex == 1)
+ getModel(lbGuid.Text.Trim());
+ else
+ {
+ //_filterList.Clear();
+ //if (gridView1.ActiveFilter.Count > 0)
+ //{
+ // gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
+ // gridView1.ActiveFilter.Clear();
+ // gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
+ //}
+ //getPageList(1);
+ getPageList(this.pageBar1.CurrentPage);
+ }
+ }
+ /// <summary>
+ /// 淇敼浜嬩欢
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
+ {
+ toolBarMenu1.currentAction = "edit";
+ string rowGuid = "", rowName = "";
+ (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
+ lbGuid, txt_fabm, gridView1);
+ if (string.IsNullOrEmpty(rowGuid))
+ {
+ MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+ return;
+ }
+ Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
+ if (xtraTabControl1.SelectedTabPageIndex == 1)
+ {
+ getModel(rowGuid);
+ txt_fabm.ReadOnly = true;
+ txt_fSubsidiary.Enabled = false;
+ }
+ }
+ /// <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);
+ frm_CqfaItems1.Clean();
+ frm_CqfaItems2.Clean();
+ //澧炲姞鏃讹紝榛樿缁勭粐
+ string deftOrg = UtilityHelper.GetFirstOrg(txt_fSubsidiary);
+ }
+ /// <summary>
+ /// 淇濆瓨浜嬩欢
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
+ {
+ toolBarMenu1.isSetBtn = false;
+ string _famc = txt_famc.Text.Trim();
+ string _yjrq = txt_yjrq.Text.Trim();
+ string _bzqx = txt_bzqx.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_famc.Focus();
+ return;
+ }
+ if (string.IsNullOrEmpty(_yjrq))
+ {
+ MsgHelper.ShowError("棰勮鏃ユ湡涓嶈兘涓虹┖锛�");
+ txt_yjrq.Focus();
+ return;
+ }
+ if (string.IsNullOrEmpty(_bzqx))
+ {
+ MsgHelper.ShowError("淇濊川鏈熼檺涓嶈兘涓虹┖锛�");
+ txt_bzqx.Focus();
+ return;
+ }
+ var _obj = new
+ {
+ guid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(lbGuid.Text.Trim()),
+ yjrq = (_yjrq),
+ bzqx = (_bzqx),
+ fjxz = (0),
+ famc = _famc.Trim(),
+ bz = _bz.Trim(),
+ fSubsidiary = _fSubsidiary.Trim(),
+ };
+ try
+ {
+ var strJson = UtilityHelper.HttpPost("",
+ _webServiceName + "EditModel",
+ JsonConvert.SerializeObject(_obj));
+ var _rtn = UtilityHelper.ReturnToDynamic(strJson);
+ if (_rtn.rtnCode > 0)
+ {
+ MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg);
+ lbGuid.Text = _rtn.rtnData.outGuid;
+ txt_fabm.Text = _rtn.rtnData.outNo;
+ toolBarMenu1.isSetBtn = true;
+ UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false);
+ toolBarMenu1.currentAction = "";
+ Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
+ getModel(lbGuid.Text);
+ }
+ else
+ MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
+ }
+ catch (Exception ex)
+ {
+ MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="curPage">绗嚑椤�</param>
+ /// <param name="pageSize">姣忛〉鍑犳潯</param>
+ private void getPageList(int curPage)
+ {
+ gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
+ PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.fabm", "desc", "", _sbSqlWhere.ToString());
+ string json = JsonConvert.SerializeObject(pgq);
+ try
+ {
+ var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json);
+ ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn);
+ if (dd.rtnCode > 0)
+ {
+ DataTable dt = dd.rtnData.list;
+ gcMain1.BindingContext = new BindingContext();
+ gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
+ if (dt.Rows.Count > 0)
+ {
+ gcMain1.DataSource = dt;
+ gcMain1.ForceInitialize();
+ gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1);
+ }
+ else
+ UtilityHelper.SetDefaultTable(gcMain1, gridView1);
+ gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
+ pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉
+ pageBar1.CurrentPage = curPage;//褰撳墠椤�
+ pageBar1.RecordCount = dd.rtnData.total;//鎬昏褰曟暟
+ }
+ else
+ {
+ ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + dd.rtnMsg);
+ }
+ }
+ catch (Exception ex)
+ {
+ ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
+ }
+ }
+ /// <summary>
+ /// 璇诲彇瀹炰綋
+ /// </summary>
+ /// <param name="strGuid"></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.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+ 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);
+ frm_CqfaItems1.Initialize(lbGuid.Text.Trim(), QcSeason.cqcjyes.ToString(), txt_fSubsidiary.GetId());
+ frm_CqfaItems2.Initialize(lbGuid.Text.Trim(), QcSeason.cqcjno.ToString(), txt_fSubsidiary.GetId());
+ }
+ else
+ ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
+ }
+ catch (Exception ex)
+ {
+ ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + 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_fabm, gridView1, "fabm");
+ if (string.IsNullOrEmpty(rowGuid))
+ {
+ MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+ return;
+ }
+ if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾" + strMsg + "鍚楋紵"))
+ return;
+ var _obj = new
+ {
+ guid = rowGuid,
+ ckValue = _inFieldValue,
+ parameter = "MES_CQJY_FA,checkDate,checkStatus,checkBy"
+ };
+ 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", "checkBy", "checkDate", picCheckBox, this, _inFieldValue.ToString());
+ }
+ else
+ MsgHelper.ShowError(_rtn.rtnData.outMsg.ToString());
+ }
+ catch (Exception ex)
+ {
+ MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
+ }
+ }
+
+
+ /// <summary>
+ /// 宸ュ叿鏉′簨浠�
+ /// </summary>
+ /// <param name="inFieldValue"></param>
+ private void _toolOutIn(int _inFieldValue, string _itemGuids)
+ {
+ string strMsg = "";
+ switch (_inFieldValue)
+ {
+ case 1:
+ strMsg = "绉诲叆";
+ break;
+ case 0:
+ strMsg = "绉诲嚭";
+ break;
+ };
+ string rowGuid, rowName;
+ (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_fabm, gridView1, "fabm");
+ if (string.IsNullOrEmpty(rowGuid))
+ {
+ MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+ return;
+ }
+ if (!MsgHelper.AskQuestion("纭畾鎶婃墍閫夋嫨鐨勭墿鏂欍��"+ strMsg + "銆戞柟妗堛��" + rowName + "銆戝悧锛�"))
+ return;
+ var _obj = new
+ {
+ guid = rowGuid,
+ inFieldValue = _inFieldValue,
+ inItemsGuids = _itemGuids
+ };
+ try
+ {
+ var strJson = UtilityHelper.HttpPost("",
+ _webServiceName + "EditModelOutIn",
+ JsonConvert.SerializeObject(_obj));
+ var _rtn = UtilityHelper.ReturnToDynamic(strJson);
+ if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
+ {
+ MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnData.outMsg.ToString());
+ frm_CqfaItems1.Initialize(lbGuid.Text.Trim(), QcSeason.cqcjyes.ToString(), txt_fSubsidiary.GetId());
+ frm_CqfaItems2.Initialize(lbGuid.Text.Trim(), QcSeason.cqcjno.ToString(), txt_fSubsidiary.GetId());
+ }
+ else
+ MsgHelper.ShowError(_rtn.rtnData.outMsg.ToString());
+ }
+ catch (Exception ex)
+ {
+ MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
+ }
}
}
}
\ No newline at end of file
--
Gitblit v1.9.3