From 794e8cba6af8fc33146bf34caa6940fcaab5f42f Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期五, 04 四月 2025 17:35:12 +0800
Subject: [PATCH] 打印按钮
---
DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesDepot.cs | 184 +++++++++++++++++----------------------------
1 files changed, 69 insertions(+), 115 deletions(-)
diff --git a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesDepot.cs b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesDepot.cs
index 795be55..c4f1719 100644
--- a/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesDepot.cs
+++ b/DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesDepot.cs
@@ -28,13 +28,12 @@
toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
- 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);
- });
+ Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", (value) =>
+ {
+ Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
+ });
Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
{
getModel(value);
@@ -47,7 +46,7 @@
}
private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
{
- _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns);
+ _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
Task.Delay(100);
getPageList(1);
}
@@ -71,7 +70,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();
}
@@ -85,27 +84,6 @@
{
_filterList = e.FilterList;
getPageList(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_btnChkClick(object sender, EventArgs e)
- {
- _toolCk(1);
}
/// <summary>
@@ -129,14 +107,15 @@
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);
+ //_filterList.Clear();
+ //if (gridView1.ActiveFilter.Count > 0)
+ //{
+ // gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
+ // gridView1.ActiveFilter.Clear();
+ // gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
+ //}
+ //getPageList(1);
+ getPageList(this.pageBar1.CurrentPage);
}
}
@@ -147,6 +126,7 @@
/// <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_depotCode, gridView1);
@@ -156,11 +136,17 @@
return;
}
Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
- List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
- gvList.Add(gvMx1);
- UtilityHelper.ChangeEnableByControl(panel1.Controls, true, gvList);
+ if (xtraTabControl1.SelectedTabPageIndex == 1)
+ {
+ getModel(rowGuid);
+ }
+ 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>
@@ -191,16 +177,25 @@
{
var row = gvMx1.GetDataRow(i);
if (row != null)
+ {
+ if (string.IsNullOrEmpty(row["depotSectionCode"].ToString()))
+ {
+ MsgHelper.ShowError("缂栫爜涓嶈兘涓虹┖锛�");
+ return;
+ }
+ if (string.IsNullOrEmpty(row["DepotSectionName"].ToString()))
+ {
+ MsgHelper.ShowError("鍚嶇О涓嶈兘涓虹┖锛�");
+ return;
+ }
lst.Add(new MesDepotSections
{
Guid = UtilityHelper.ToGuid(row["guid"].ToString()),
DepotSectionCode = row["depotSectionCode"].ToString(),
DepotSectionName = row["DepotSectionName"].ToString(),
Description = row["Description"].ToString(),
- KbQty =Gs.DevApp.ToolBox.UtilityHelper.ToInt(row["KbQty"].ToString()),
- DepotSectionNamet = row["depotSectionNamet"].ToString(),
- CompletenessFlag = Gs.DevApp.ToolBox.UtilityHelper.ToInt(row["completenessFlag"].ToString()),
});
+ }
}
var _obj = new MesDepots
{
@@ -222,7 +217,10 @@
{
lbGuid.Text = _rtn.rtnData;
toolBarMenu1.isSetBtn = true;
- UtilityHelper.ChangeEnableByControl(panel1.Controls, false);
+ var gridViews = new List<GridView>();
+ gridViews.Add(gvMx1);
+ UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gridViews);
+ toolBarMenu1.currentAction = "";
}
}
catch (Exception ex)
@@ -238,7 +236,7 @@
private void getPageList(int curPage)
{
var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
- var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.depot_code", "asc",
+ var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "org.FNumber asc ,a.depot_code", "asc",
"", _sbSqlWhere.ToString());
var json = JsonConvert.SerializeObject(pgq);
try
@@ -246,14 +244,28 @@
var strReturn = UtilityHelper.HttpPost("",
_webServiceName + "GetListPage", json);
var dd = UtilityHelper.ReturnToTablePage(strReturn);
- var dt = dd.rtnData.list;
- gcMain.BindingContext = new BindingContext();
- gcMain.DataSource = dt;
- gcMain.ForceInitialize();
- var dddd = dd.rtnData.pages; //鎬婚〉
- pageBar1.TotalPages = dddd;
- pageBar1.RecordCount = dd.rtnData.total; //璁板綍鎬绘暟
- pageBar1.CurrentPage = curPage; //褰撳墠椤�
+ 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();
+ }
+ 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)
{
@@ -287,19 +299,17 @@
lbGuid.Text = strGuid;
var gvList = new List<GridView>();
gvList.Add(gvMx1);
- UtilityHelper.SetValueByObj(panel1.Controls, dy, isEdit,
- gvList);
+ UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList);
var _job = JObject.Parse(strJson);
var array = new JArray();
foreach (var a in _job["rtnData"]["list"]) array.Add(a);
- var dt =
- JsonConvert.DeserializeObject<DataTable>(
- array.ToString());
+ var dt = JsonConvert.DeserializeObject<DataTable>(array.ToString());
if (dt.Rows.Count > 0)
{
gcMx1.BindingContext = new BindingContext();
gcMx1.DataSource = dt;
gcMx1.ForceInitialize();
+ gvMx1.BestFitColumns();
}
else
{
@@ -354,61 +364,5 @@
}
}
}
-
-
- /// <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_depotName, gridView1, "depotName");
- if (string.IsNullOrEmpty(rowGuid))
- {
- MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
- return;
- }
- if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾" + strMsg + "鍚楋紵"))
- return;
-
- var _obj = new
- {
- guid = rowGuid,
- ckValue = _inFieldValue,
- parameter = "MES_DEPOTS,check_date,check_status,check_by"
- };
- try
- {
- var strJson = UtilityHelper.HttpPost("", "General/GeneralCheck",
- JsonConvert.SerializeObject(_obj));
- var _rtn = UtilityHelper.ReturnToDynamic(strJson);
- MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
- if (_rtn.rtnCode > 0)
- {
- if (xtraTabControl1.SelectedTabPageIndex == 1)
- getModel(lbGuid.Text.Trim());
- else
- getPageList(this.pageBar1.CurrentPage);
- }
- }
- catch (Exception ex)
- {
- MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
- }
-
- }
-
}
}
\ No newline at end of file
--
Gitblit v1.9.3