From 66e37d850e416d55f147aca37b1365f821f71f1f Mon Sep 17 00:00:00 2001
From: wbc <2597324127@qq.com>
Date: 星期四, 11 十二月 2025 23:23:08 +0800
Subject: [PATCH] Merge branch 'master' of http://43.142.96.171:8080/r/~kyy/LB_MesClient
---
DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs | 543 ++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 485 insertions(+), 58 deletions(-)
diff --git a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs
index 53d7660..4613fe1 100644
--- a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs
+++ b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Womdaa.cs
@@ -1,3 +1,6 @@
+using DevExpress.RichEdit.Export;
+using DevExpress.XtraPivotGrid.Data;
+using DevExpress.XtraRichEdit.Model;
using Gs.DevApp.DevFrm.Rpt;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
@@ -6,7 +9,11 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
+using System.Configuration;
using System.Data;
+using System.Linq;
+using System.Net;
+using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -33,7 +40,7 @@
this.splitMx98.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel2;
this.splitMx100.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel2;
this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;
- // this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick;
+ this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick;
this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
@@ -44,16 +51,24 @@
toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
this.toolBarMenu1.btnShouJianClick += ToolBarMenu1_btnShouJianClick;
this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick;
- this.toolBarMenu1.btnChbgClick += ToolBarMenu1_btnChbgClick;
+ //this.toolBarMenu1.btnChbgClick += ToolBarMenu1_btnChbgClick;
+ toolBarMenu1.btnPrintClick += ToolBarMenu1_btnPrintClick;
+ this.toolBarMenu1.btnOutClick += ToolBarMenu1_btnOutClick;
+ //this.toolBarMenu1.btnDcClick += ToolBarMenu1_btnDcClick;
+ this.toolBarMenu1.btnBDLingLiaoClick += ToolBarMenu1_btnBDLingLiaoClick;
this.toolBarMenu1.getXmlConfig();
Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2);
Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx3);
Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx4);
+ Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMxL1);
+ Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMxL2);
Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", (value) =>
{
Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
- }, tips);
+ }, tips, true, (strGuid) => {
+ getModelList(strGuid);
+ });
Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
{
getModel(value);
@@ -71,10 +86,15 @@
{
Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_1, txt_iCount_1, radOut, txt_yuliang_1);
};
+
//杩欐槸鎵樻澘鐮�
+ this.ucBtnPrint1.btnZhiJieClick += (s, e) =>
+ {
+ _print(1);
+ };
this.ucBtnPrint1.btnPrintClick += (s, e) =>
{
- _print();
+ _print(0);
};
this.ucBtnPrint1.btnAllClick += (s, e) =>
{
@@ -83,32 +103,37 @@
lbGuid, txt_daa001, gridView1);
SelectDeleteBar frm = new SelectDeleteBar(rowGuid, "鎵樻澘鐮�");
string strCodeList = "";
+ string strAction = "";
frm.UpdateParent += (ss, ee) =>
{
strCodeList = ee.StringSingle;
+ strAction = ee.Data;
};
frm.ShowDialog();
if (string.IsNullOrEmpty(strCodeList))
return;
- try
+ if (strAction == "print")
{
- string rptParameter = "rpt_daa{"
- + "100"
- + "," + ""
- + "," + ""
- + "," + ""
- + "," + ""
- + "," + strCodeList
- + "}";
- using (Form rpt = new RptPreview(rowGuid, rptParameter))
+ try
{
- rpt.ShowDialog();
+ string rptParameter = "rpt_daa{"
+ + "100"
+ + "," + ""
+ + "," + ""
+ + "," + ""
+ + "," + ""
+ + "," + strCodeList
+ + "}";
+ using (Form rpt = new RptPreview(rowGuid, rptParameter))
+ {
+ rpt.ShowDialog();
+ }
+ frm.Close();
}
- frm.Close();
- }
- catch (Exception ex)
- {
- MsgHelper.ShowError(ex.Message);
+ catch (Exception ex)
+ {
+ MsgHelper.ShowError(ex.Message);
+ }
}
};
//杩欐槸杩芥函鐮�
@@ -281,6 +306,36 @@
}
/// <summary>
+ /// 杩欐槸澶囨枡鍗曟墦鍗�
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void ToolBarMenu1_btnPrintClick(object sender, EventArgs e)
+ {
+ string rowGuid, rowName;
+ (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_daa001, gridView1);
+ if (string.IsNullOrEmpty(rowGuid))
+ {
+ this.toolBarMenu1.rptParameter = "return false";
+ MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎵撳嵃鐨勫崟鎹紒");
+ return;
+ }
+ string rptParameter = "rpt_Womdab{"
+ + rowGuid // @inOrderGuid - 鍗曟嵁guid
+ + "," + "100" // @isDesign - 閲嶆墦閮芥槸浼�100
+ + "," + "" // @in1 - 鍏ュ簱鏃堕棿锛堟墿灞曠敤锛�
+ + "," + "" // @in2 - 鐗归噰锛堟墿灞曠敤锛�
+ + "," + "" // @in3 - 渚涘簲鍟唅d锛堟墿灞曠敤锛�
+ + "," + "" // @in4 - 寮犳暟锛堟墿灞曠敤锛�
+ + "," + "" // @in5 - 鏁伴噺锛堟墿灞曠敤锛�
+ + "," + "" // @in6 - 鎵╁睍鐢�
+ + "}";
+ this.toolBarMenu1.rptParameter = rptParameter;
+ this.toolBarMenu1.guidKey = rowGuid;
+
+ }
+
+ /// <summary>
/// 鍒犻櫎宸ュ崟
/// </summary>
/// <param name="sender"></param>
@@ -374,6 +429,63 @@
}
}
+ /// <summary>
+ /// 瀵煎嚭xls
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ /// <exception cref="NotImplementedException"></exception>
+ private void ToolBarMenu1_btnOutClick(object sender, EventArgs e)
+ {
+ System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
+
+ _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
+ using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
+ {
+ folderBrowserDialog.Description = "閫夋嫨瀵煎嚭鏂囦欢鐨勪繚瀛樿矾寰�";
+ DialogResult dialogResult = folderBrowserDialog.ShowDialog();
+ if (dialogResult == DialogResult.OK)
+ {
+ string _folder = folderBrowserDialog.SelectedPath;
+ var _params = new
+ {
+ inQueryWhere = _sbSqlWhere.ToString(),//鏌ヨ鏉′欢
+ inFid = "",//澶囩敤
+ inP1 = "",//澶囩敤
+ inP2 = "",//澶囩敤澶囩敤
+ inP3 = "",//澶囩敤
+ inP4 = ""
+ };
+ var _obj = new Gs.DevApp.Entity.XlsOutModel("xlsOutDaa", "", "", "", _params);
+ try
+ {
+ string strJson = UtilityHelper.HttpPost("", "XlsInOut/XlsOutView_NEW", JsonConvert.SerializeObject(_obj));
+ ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
+ if (_rtn.rtnCode > 0)
+ {
+ string _file = _rtn.rtnData.fileUrl.ToString();
+ string _folderName = _folder + "\\" + _file.Replace("down/", "");
+ string _url = ConfigurationManager.AppSettings["WebApiUrl"].ToString() + _file;
+ using (WebClient client = new WebClient())
+ {
+ client.DownloadFile(_url, _folderName);
+ }
+ var frm = new Gs.DevApp.DevFrm.QC.Xls(_folderName);
+ frm.ShowDialog();
+ }
+ else
+ {
+ ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
+ }
+ }
+ catch (Exception ex)
+ {
+ ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
+ }
+ }
+ }
+ }
+
private void ToolBarMenu1_btnTzblClick(object sender, EventArgs e)
{
_toolCk(7);
@@ -386,6 +498,11 @@
{
_toolCk(9);
}
+ private void ToolBarMenu1_btnDcClick(object sender, EventArgs e)
+ {
+ _toolCk(12);
+ }
+
/// <summary>
/// 宸ュ崟鐘舵�侊紝鏍规嵁鍒嗗彿鎶婁腑鏂囧幓浜�
/// </summary>
@@ -456,6 +573,7 @@
toolBarMenu1.currentAction = "edit";
string rowGuid = "", rowName = "";
(rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_daa001, gridView1);
+
if (string.IsNullOrEmpty(rowGuid))
{
ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
@@ -465,6 +583,7 @@
if (xtraTabControl1.SelectedTabPageIndex == 1)
{
getModel(rowGuid);
+ txt_dptNo.ReadOnly = true;
}
else
{
@@ -482,36 +601,47 @@
/// <param name="e"></param>
private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
{
- //toolBarMenu1.isSetBtn = false;
- //var _obj = new
- //{
- // guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓
- // sjxt = txt_sjXt.GetId(), //瀹為檯绾夸綋
- // bz = txt_daa009.Text.Trim()//澶囨敞
- //};
- //try
- //{
- // 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;
- // 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);
- // toolBarMenu1.currentAction = "";
- // txt_printRemark.Enabled = txt_psnQty_1.Enabled = txt_iCount_1.Enabled = true;
- // txt_printRemark.ReadOnly = txt_psnQty_1.ReadOnly = txt_iCount_1.ReadOnly = false;
- // toolBarMenu1.currentAction = "";
- // Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
- // }
- //}
- //catch (Exception ex)
- //{
- // ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
- //}
+
+ if (string.IsNullOrEmpty(txt_daa015.GetId()))
+ {
+ ToolBox.MsgHelper.ShowError("鎻愮ず锛氱嚎浣撲笉鑳戒负绌猴紒");
+ return;
+ }
+
+ var _obj = new
+ {
+ guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓
+ sjxt = txt_daa015.GetId(), //绾夸綋
+ bz = txt_daa009.Text.Trim(),//澶囨敞
+ xgdate = txt_xgdate.Text.Trim()
+ };
+ try
+ {
+ string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj));
+ ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
+ if (_rtn.rtnCode > 0)
+ {
+ ToolBox.MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg);
+ lbGuid.Text = _rtn.rtnData;
+ 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);
+ //toolBarMenu1.currentAction = "";
+ //txt_printRemark.Enabled = txt_psnQty_1.Enabled = txt_iCount_1.Enabled = true;
+ //txt_printRemark.ReadOnly = txt_psnQty_1.ReadOnly = txt_iCount_1.ReadOnly = false;
+ //toolBarMenu1.currentAction = "";
+ Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
+ toolBarMenu1.currentAction = "";
+ }
+ else
+ ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
+ }
+ catch (Exception ex)
+ {
+ ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
+ }
+
}
/// <summary>
@@ -585,6 +715,8 @@
//string cjId = dy.daa013;
//string xjxt = dy.sjXt;
// txt_sjXt.getSuppler(cjId, xjxt);
+ string lineId = dy.daa013;
+ txt_daa015.getSuppler(txt_daa013.Text.Trim(), lineId);
//鎵樻澘鐮�
txt_zQty.Text = dy.daa008;
txt_yQty.Text = dy.yQty;
@@ -722,9 +854,9 @@
string strMsg = "";
switch (_inFieldValue)
{
- //case 1:
- // strMsg = "寰呭紑宸�";
- // break;
+ case 1:
+ strMsg = "寰呭紑宸�";
+ break;
case 2:
strMsg = "宸ュ崟鏆傚仠";
break;
@@ -743,13 +875,17 @@
case 7:
strMsg = "閫氱煡澶囨枡";
break;
- //case 8:
- // strMsg = "寮�宸�";
- // break;
+ case 8:
+ strMsg = "寮�宸�";
+ break;
case 9:
strMsg = "鎵嬪姩瀹屽伐";
break;
- };
+ case 12:
+ strMsg = "鍊掑啿棰嗘枡";
+ break;
+ }
+ ;
toolBarMenu1.guidKey = "";
string rowGuid, rowName;
(rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
@@ -794,6 +930,75 @@
MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
}
}
+ /// <summary>
+ /// 鏂板鏂规硶锛氬垪琛ㄦ樉绀�
+ /// </summary>
+ /// <param name="strGuid">涓昏〃id</param>
+
+ private void getModelList(string strGuid)
+ {
+ gcMxL1.DataSource = null;
+ gcMxL2.DataSource = null;
+
+ 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;
+
+ JArray array1 = new JArray();
+ foreach (var a in dy["list"])
+ {
+ array1.Add(a);
+ }
+ DataTable dt1 = JsonConvert.DeserializeObject<DataTable>(array1.ToString());
+ if (dt1.Rows.Count > 0)
+ {
+ gcMxL1.BindingContext = new BindingContext();
+ gcMxL1.DataSource = dt1;
+ gcMxL1.ForceInitialize();
+ gvMxL1.BestFitColumns();
+ Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMxL1);
+ }
+ else
+ {
+ Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMxL1, gvMxL1);
+ }
+ JArray array2 = new JArray();
+ foreach (var a in dy["list2"])
+ {
+ array2.Add(a);
+ }
+
+ DataTable dt2 = JsonConvert.DeserializeObject<DataTable>(array2.ToString());
+ if (dt2.Rows.Count > 0)
+ {
+ gcMxL2.BindingContext = new BindingContext();
+ gcMxL2.DataSource = dt2;
+ gcMxL2.ForceInitialize();
+ gvMxL2.BestFitColumns();
+ Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMxL2);
+ }
+ else
+ {
+ Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMxL2, gvMxL2);
+ }
+
+ }
+ else
+ ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+ }
+ catch (Exception ex)
+ {
+ ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+ }
+ }
#region 鍚勭鎵撳嵃
@@ -801,12 +1006,30 @@
/// <summary>
/// 杩欐槸鍗℃澘鐮�
/// </summary>
- private void _print()
+ private void _print(int type)
{
string rowGuid, rowName;
(rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
lbGuid, txt_daa001, gridView1);
ucBtnPrint1.guidKey = rowGuid;
+
+ string gdzt = txt_daa018Txt.Text.ToString();
+ if (gdzt == "W:瀹屽伐" || gdzt == "J:缁撴")
+ {
+ Gs.DevApp.ToolBox.MsgHelper.ShowError("宸ュ崟宸茬粡瀹屽伐鎴栫粨妗堬紒");
+ this.ucBtnPrint1.rptParameter = "return false";
+ return;
+ }
+
+ if (gdzt != "M:鐢熶骇涓�")
+ {
+ Gs.DevApp.ToolBox.MsgHelper.ShowError("鏈紑宸ヤ笉鍙墦鍗版潯鐮侊紒");
+ this.ucBtnPrint1.rptParameter = "return false";
+ return;
+ }
+
+
+
if (rowGuid.Length < 36)
{
Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨浣犺鎵撳嵃鐨勮锛�");
@@ -993,6 +1216,210 @@
}
}
+ /// <summary>
+ /// 澶囧崟棰嗘枡
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void ToolBarMenu1_btnBDLingLiaoClick(object sender, EventArgs e)
+ {
+ ExecuteBatchOperation(1, "澶囧崟棰嗘枡");
+ }
+
+ /// <summary>
+ /// 鎵归噺鎵ц鎿嶄綔
+ /// </summary>
+ /// <param name="inFieldValue">鎿嶄綔绫诲瀷鍊�</param>
+ /// <param name="operationName">鎿嶄綔鍚嶇О</param>
+ private void ExecuteBatchOperation(int inFieldValue, string operationName)
+ {
+ gridView1.PostEditor();
+ gridView1.UpdateCurrentRow();
+ DataTable dt = this.gcMain1.DataSource as DataTable;
+
+ // 鏀堕泦鎵�鏈夐�変腑鐨刧uid鍜屽伐鍗曞彿
+ List<string> selectedGuids = new List<string>();
+ List<string> selectedDaa001s = new List<string>();
+
+ foreach (DataRow dr in dt.Rows)
+ {
+ string checkBox = dr["fxk"].ToString();
+ string _guid = dr["guid"].ToString();
+ string _daa001 = dr["daa001"].ToString();
+ if (Gs.DevApp.ToolBox.UtilityHelper.ToCheck(checkBox))
+ {
+ selectedGuids.Add(_guid);
+ selectedDaa001s.Add(_daa001);
+ }
+ }
+
+ // 濡傛灉娌℃湁閫変腑鐨勮褰曪紝鐩存帴杩斿洖
+ if (selectedGuids.Count == 0)
+ {
+ MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+ return;
+ }
+
+ // 纭瀵硅瘽妗�
+ if (!MsgHelper.AskQuestion($"浣犻�夋嫨浜� {selectedGuids.Count} 鏉¤褰曪紝纭畾{operationName}鍚楋紵"))
+ return;
+
+ // 鎵ц鎵归噺鎿嶄綔
+ BatchExecuteOperation(selectedGuids, inFieldValue, operationName, selectedDaa001s);
+ }
+
+ /// <summary>
+ /// 鎵归噺鎵ц鎿嶄綔骞剁粺涓�杩斿洖缁撴灉
+ /// </summary>
+ private void BatchExecuteOperation(List<string> guids, int inFieldValue, string operationName, List<string> nos)
+ {
+ List<string> successMessages = new List<string>();
+ List<string> errorMessages = new List<string>();
+ string lastSuccessGuid = string.Empty;
+ string _webServiceplace = "";
+ switch (inFieldValue)
+ {
+ case 1:
+ _webServiceplace = "bdll";
+ break;
+ //case 2:
+ // _webServiceplace = "寮哄埗缁撴";
+ // break;
+ //case 3:
+ // _webServiceplace = "鍙嶇粨妗堬紙鍙嶆墽琛岃嚦瀹屽伐锛�";
+ // break;
+ //case 8:
+ // _webServiceplace = "瀹℃牳";
+ // break;
+ //case 9:
+ // _webServiceplace = "鍙嶅鏍�";
+ // break;
+ }
+ ;
+
+ // 浣跨敤for寰幆鏉ュ悓鏃堕亶鍘唃uid鍜屽搴旂殑宸ュ崟鍙�
+ for (int i = 0; i < guids.Count; i++)
+ {
+ string rowGuid = guids[i];
+ string workOrderNo = nos[i]; // 瀵瑰簲鐨勫伐鍗曞彿
+
+ if (string.IsNullOrEmpty(rowGuid))
+ {
+ errorMessages.Add($"宸ュ崟 {workOrderNo}锛氶亣鍒扮┖GUID锛岃烦杩囧鐞�");
+ continue;
+ }
+
+ try
+ {
+ var _obj = new
+ {
+ guid = rowGuid,
+ inFieldValue = inFieldValue,
+ };
+
+ var strJson = UtilityHelper.HttpPost("",
+ _webServiceName + _webServiceplace,
+ JsonConvert.SerializeObject(_obj));
+ var _rtn = UtilityHelper.ReturnToDynamic(strJson);
+
+ if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
+ {
+ // 鎴愬姛娑堟伅涓娇鐢ㄥ伐鍗曞彿
+ successMessages.Add($"宸ュ崟 {workOrderNo}锛歿_rtn.rtnData.outMsg}");
+ lastSuccessGuid = rowGuid;
+
+ // 鏇存柊鐣岄潰
+ UpdateUI(rowGuid, inFieldValue);
+ }
+ else
+ {
+ // 閿欒娑堟伅涓娇鐢ㄥ伐鍗曞彿
+ errorMessages.Add($"宸ュ崟 {workOrderNo}锛歿_rtn.rtnData.outMsg}");
+ }
+ }
+ catch (Exception ex)
+ {
+ // 寮傚父娑堟伅涓娇鐢ㄥ伐鍗曞彿
+ errorMessages.Add($"宸ュ崟 {workOrderNo}锛氬鐞嗗け璐� - {ex.Message}");
+ }
+ }
+
+ // 缁熶竴鏄剧ず缁撴灉
+ ShowBatchResult(successMessages, errorMessages, operationName, lastSuccessGuid);
+ }
+
+ /// <summary>
+ /// 鏇存柊鐣岄潰
+ /// </summary>
+ private void UpdateUI(string rowGuid, int inFieldValue)
+ {
+ if (xtraTabControl1.SelectedTabPageIndex == 1)
+ {
+ getModel(lbGuid.Text.Trim());
+ int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
+ gridView1.FocusedRowHandle = rowHandle;
+ }
+ else
+ {
+ getPageList(this.pageBar1.CurrentPage);
+ int rowHandle = gridView1.LocateByValue("guid", rowGuid);
+ gridView1.FocusedRowHandle = rowHandle;
+ }
+ }
+
+ /// <summary>
+ /// 鏄剧ず鎵归噺鎿嶄綔缁撴灉
+ /// </summary>
+ private void ShowBatchResult(List<string> successMessages, List<string> errorMessages, string operationName, string lastSuccessGuid)
+ {
+ StringBuilder resultMessage = new StringBuilder();
+ resultMessage.AppendLine($"{operationName}鎿嶄綔瀹屾垚锛�");
+ resultMessage.AppendLine($"鎴愬姛锛歿successMessages.Count} 鏉�");
+ resultMessage.AppendLine($"澶辫触锛歿errorMessages.Count} 鏉�");
+
+ if (successMessages.Count > 0)
+ {
+ resultMessage.AppendLine();
+ resultMessage.AppendLine("鎴愬姛璁板綍锛�");
+ foreach (var msg in successMessages.Take(5)) // 鍙樉绀哄墠5鏉℃垚鍔熶俊鎭�
+ {
+ resultMessage.AppendLine($" 鉁� {msg}");
+ }
+ if (successMessages.Count > 5)
+ {
+ resultMessage.AppendLine($" ... 杩樻湁 {successMessages.Count - 5} 鏉℃垚鍔熻褰�");
+ }
+ }
+
+ if (errorMessages.Count > 0)
+ {
+ resultMessage.AppendLine();
+ resultMessage.AppendLine("澶辫触璁板綍锛�");
+ foreach (var msg in errorMessages.Take(5)) // 鍙樉绀哄墠5鏉¢敊璇俊鎭�
+ {
+ resultMessage.AppendLine($" 鉁� {msg}");
+ }
+ if (errorMessages.Count > 5)
+ {
+ resultMessage.AppendLine($" ... 杩樻湁 {errorMessages.Count - 5} 鏉″け璐ヨ褰�");
+ }
+ }
+
+ // 鏍规嵁缁撴灉绫诲瀷鏄剧ず涓嶅悓鐨勬秷鎭
+ if (errorMessages.Count == 0)
+ {
+ MsgHelper.ShowInformation(resultMessage.ToString());
+ }
+ else if (successMessages.Count == 0)
+ {
+ MsgHelper.ShowError(resultMessage.ToString());
+ }
+ else
+ {
+ MsgHelper.ShowError(resultMessage.ToString());
+ }
+ }
+
#endregion
}
}
\ No newline at end of file
--
Gitblit v1.9.3