From 66c892f6d3edc34514ff874f051637eaf69e8aef Mon Sep 17 00:00:00 2001 From: lu <123456> Date: 星期三, 03 九月 2025 10:50:13 +0800 Subject: [PATCH] bug --- DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemQtrk.cs | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 200 insertions(+), 13 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemQtrk.cs b/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemQtrk.cs index 8ff0765..1e0403b 100644 --- a/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemQtrk.cs +++ b/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemQtrk.cs @@ -1,4 +1,5 @@ using DevExpress.XtraEditors; +using Gs.DevApp.DevFrm.Rpt; using Gs.DevApp.DevFrm.Work; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; @@ -8,6 +9,7 @@ using System; using System.Collections.Generic; using System.Data; +using System.IO; using System.Threading.Tasks; using System.Windows.Forms; namespace Gs.DevApp.DevFrm @@ -24,6 +26,7 @@ public Frm_MesItemQtrk() { InitializeComponent(); + split99.PanelVisibility = SplitPanelVisibility.Panel2; this.toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick; this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick; this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick; @@ -97,6 +100,144 @@ }; frm.ShowDialog(); }; + //鎵撳嵃浜嬩欢 + this.ucBtnPrint1.btnPrintClick += (s, e) => + { + string rowGuid = lbMxGuid.Text.Trim(); + ucBtnPrint1.guidKey = rowGuid; + if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_iCount_1.Text.Trim(), txt_yuliang_1.Text.Trim())) + { + Gs.DevApp.ToolBox.MsgHelper.ShowError("璇疯緭鍏ユ纭殑鏉$爜鏁伴噺锛�"); + txt_iCount_1.Focus(); + this.ucBtnPrint1.rptParameter = "return false"; + return; + } + if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_psnQty_1.Text.Trim())) + { + Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鏉$爜鏁伴噺锛�"); + txt_psnQty_1.Focus(); + this.ucBtnPrint1.rptParameter = "return false"; + return; + } + if (lbMxGuid.Text.Trim().Length < 10) + { + Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鐨勮锛�"); + this.ucBtnPrint1.rptParameter = "return false"; + return; + } + this.ucBtnPrint1.rptParameter = "rpt_Qtrk{" + + lbMxGuid.Text.Trim()//鍏宠仈涓婚敭 + + "," + "" + + "," + Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(txt_yuliang_1.Text.Trim())//浣欐暟 + + "," + txt_iCount_1.Text.Trim()//寮犳暟 + + "," + txt_psnQty_1.Text.Trim()//姣忓紶鏉$爜鏁伴噺 + + "}"; + txt_iCount_1.Text = ""; + txt_psnQty_1.Text = ""; + }; + //鎵撳嵃鎵归噺鎿嶄綔浜嬩欢 + this.ucBtnPrint1.btnAllClick += (s, e) => + { + string rowGuid = lbMxGuid.Text.Trim(); + SelectDeleteBar frm = new SelectDeleteBar(rowGuid, QcSeason.鍏跺畠鍏ュ簱妫�.ToString()); + string strCodeList = ""; + string strAction = ""; + frm.UpdateParent += (ss, ee) => + { + strCodeList = ee.StringSingle; + strAction = ee.Data; + }; + frm.ShowDialog(); + if (string.IsNullOrEmpty(strCodeList)) + return; + if (strAction == "print") + { + try + { + string rptParameter = "rpt_Qtrk{" + + "100"//閲嶆墦閮芥槸浼�100锛� + + "," + "" + + "," + "" + + "," + "" + + "," + "" + + "," + strCodeList + + "}"; + using (Form rpt = new RptPreview(rowGuid, rptParameter)) + { + rpt.ShowDialog(); + } + frm.Close(); + } + catch (Exception ex) + { + MsgHelper.ShowError(ex.Message); + } + } + }; + gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged; + //鎵撳嵃鑷姩璁$畻 + txt_psnQty_1.TextChanged += (s, e) => + { + Gs.DevApp.ToolBox.UtilityHelper.PrintJiSuan(txt_psnQty_1, txt_iCount_1, txt_kQty.Text.Trim(), radOut, txt_yuliang_1); + }; + radOut.SelectedIndexChanged += (s, e) => + { + Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_1, txt_iCount_1, radOut, txt_yuliang_1); + }; + #region 2025-08-27 澶嶅埗beg + btnCopyXls.Click += (s, e) => + { + string kcZz = txt_qt022.GetId(); + if (string.IsNullOrEmpty(kcZz)) + { + Gs.DevApp.ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨搴撳瓨缁勭粐鍚庢墠鑳戒娇鐢ㄥ鍒跺姛鑳斤紒"); + txt_qt022.Focus(); + return; + } + string filePath = AppContext.BaseDirectory + "xlsCopy.xls"; + if (File.Exists(filePath)) + { + var frm = new CopyXls(kcZz, lbGuid.Text.Trim(), OrderType.鍏跺畠鍏ュ簱.ToString()); + frm.UpdateParent += (ss, ee) => + { + try + { + var lst = ee.DynamicList; + DataTable _Table = (DataTable)gcMx1.DataSource; + foreach (dynamic dym in lst) + { + DataRow _row = _Table.NewRow(); + _row["qd002"] = dym.itemNo; + _row["qd003"] = dym.itemName; + _row["qd004"] = dym.itemModel; + _row["kcDw"] = dym.dwName; + _row["itemId"] = dym.itemId; + _row["qd007"] = dym.sl; + _row["qd010"] = dym.bz; + _row["qd012"] = dym.bllx; + _Table.Rows.Add(_row); + } + gcMx1.BindingContext = new BindingContext(); + gcMx1.DataSource = _Table; + gcMx1.ForceInitialize(); + gvMx1.CloseEditor(); + gvMx1.PostEditor(); + gvMx1.UpdateCurrentRow(); + gvMx1.BestFitColumns(); + } + catch (Exception ex) + { + Gs.DevApp.ToolBox.MsgHelper.ShowError(ex.Message); + } + }; + frm.ShowDialog(); + } + else + { + Gs.DevApp.ToolBox.MsgHelper.ShowError("鎵句笉鍒皒lsCopy.xls鏂囦欢锛岃鑱旂郴绠$悊鍛橈紒"); + } + }; + #endregion } private void GridView1_ColumnFilterChanged(object sender, EventArgs e) @@ -298,6 +439,7 @@ string inHz = ucLookHuoZhu1.GetHzId();//璐т富 string inRkyy = txt_qt010.Text.Trim();//鍏ュ簱鍘熷洜 string kcCk = txt_qt008.GetId();//浠撳簱 + string qtlx = txt_qtlx.Text.Trim();//鍚庢潵澧炲姞鐨勭被鍨� if (string.IsNullOrEmpty(kcZz)) { Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨搴撳瓨缁勭粐锛�"); @@ -320,10 +462,10 @@ txt_qt003.Focus(); return; } - if (txt_qt019.SelectedIndex <= 0) + if (txt_qtlx.SelectedIndex <= 0) { - Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨搴撳瓨鏂瑰悜锛�"); - txt_qt019.Focus(); + Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鍏ュ簱绫诲瀷锛�"); + txt_qtlx.Focus(); return; } if (string.IsNullOrEmpty(kcBm) && string.IsNullOrEmpty(kcGys)) @@ -332,12 +474,12 @@ txt_qt009.Focus(); return; } - //if (string.IsNullOrEmpty(kcCk)) - //{ - // Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨鏀舵枡浠撳簱锛�"); - // txt_qt008.Focus(); - // return; - //} + if (string.IsNullOrEmpty(kcCk)) + { + Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鏀舵枡浠撳簱锛乗n濡傛灉涓嶆槸銆愭姤搴熶粨銆戯紒\nQC鍙互閲嶆柊璁剧疆浠撳簱锛�"); + txt_qt008.Focus(); + return; + } var _obj = new { guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓 @@ -351,6 +493,7 @@ hzlx = inHzlx,//璐т富绫诲瀷 inHz = inHz,//璐т富 inSource = txt_qt035.EditValue,//宸ュ崟鍙� + qtlx = qtlx, list = new List<dynamic>(), }; gvMx1.CloseEditor(); @@ -416,7 +559,11 @@ /// <param name="pageSize">姣忛〉鍑犳潯</param> private void getPageList(int curPage) { - gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + gcMain1.DataSource = null; + System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); + _sbSqlWhere.Append(" and a.qt022 in"); + _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere()); + _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList)); PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "qt001", "asc", "", _sbSqlWhere.ToString()); string json = JsonConvert.SerializeObject(pgq); try @@ -530,6 +677,11 @@ { Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx2, gvMx2); } + + if (txt_isIqc.Checked) + split99.PanelVisibility = SplitPanelVisibility.Panel2; + else + split99.PanelVisibility = SplitPanelVisibility.Both; } else ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); @@ -591,7 +743,7 @@ getModel(lbGuid.Text); } else - MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); + MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { @@ -711,7 +863,7 @@ _webServiceName + "EditModelSubmit", JsonConvert.SerializeObject(_obj)); var _rtn = UtilityHelper.ReturnToDynamic(strJson); - + if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0) { MsgHelper.ShowInformation(_rtn.rtnData.outMsg.ToString()); @@ -735,6 +887,11 @@ MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } + /// <summary> + /// 閫夋嫨涓嶈壇 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> private void rptBl_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { var rowhandle = gvMx1.FocusedRowHandle; @@ -748,7 +905,8 @@ foreach (dynamic dym in lst) { if (stringBuilder.Length > 0) - stringBuilder.Append("|"); + // stringBuilder.Append("|");//|鍜寏宸茶鍗犵敤 + stringBuilder.Append("&"); stringBuilder.Append(dym.dicTxt); } gvMx1.SetFocusedRowCellValue("qd012", stringBuilder.ToString()); @@ -756,5 +914,34 @@ }; frm.ShowDialog(); } + + private void GvMx1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) + { + if (e.FocusedRowHandle >= 0) + { + DataRow row = gvMx1.GetDataRow(e.FocusedRowHandle); + lbMxGuid.Text = row["guid"].ToString(); + ucBtnPrint1.guidKey = row["guid"].ToString(); + txtWlid.Text = row["qd002"].ToString(); + txtWlgg.Text = row["qd004"].ToString(); + txtWlmc.Text = row["qd003"].ToString(); + txtQuantity.Text = row["qd007"].ToString();//鐢宠鎬婚噺 + txt_yQty.Text = row["ydy"].ToString();//宸叉墦鍗版�婚噺 + txt_kQty.Text = row["kdy"].ToString();//鍙墦鍗版�婚噺 + } + else + { + lbMxGuid.Text = ""; + ucBtnPrint1.guidKey = ""; + txtWlid.Text = ""; + txtWlgg.Text = ""; + txtWlmc.Text = ""; + txtQuantity.Text = ""; + txt_yQty.Text = ""; + txt_kQty.Text = ""; + txt_psnQty_1.Text = ""; + txt_iCount_1.Text = ""; + } + } } } \ No newline at end of file -- Gitblit v1.9.3