From cc286e3641ef72fe7cb1312487a6d4e40bda81fe Mon Sep 17 00:00:00 2001 From: cdk <2441919651@qq.com> Date: 星期三, 03 九月 2025 09:23:31 +0800 Subject: [PATCH] Merge branch 'master' of http://git.gs-mes.com:8080/r/~tjx/GsMesClient --- DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemQtrk.cs | 277 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 239 insertions(+), 38 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemQtrk.cs b/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemQtrk.cs index d635599..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; @@ -80,10 +83,10 @@ } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } }; - //閫夋嫨srm鏄庣粏 + //閫夋嫨婧愬崟鏄庣粏 txt_qt035.ButtonClick += (s, e) => { string strSrmNo = ""; @@ -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) @@ -171,10 +312,10 @@ { string rowGuid = "", rowName = ""; (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, - lbGuid, txt_qtck, gridView1,"qtck"); + lbGuid, txt_qtck, gridView1, "qtck"); if (string.IsNullOrEmpty(rowGuid)) { - MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鍒犻櫎鍚楋紵")) @@ -192,17 +333,19 @@ 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); } - MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + else + MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } @@ -240,7 +383,7 @@ lbGuid, txt_qtck, gridView1); if (string.IsNullOrEmpty(rowGuid)) { - MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); @@ -256,6 +399,9 @@ UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList); ucLookHuoZhu1.Enabled = true; } + //2025/07/12鍔犱笂淇敼鐘舵�佷笅涓嶈兘淇敼 + txt_qt022.IsReadly = true; + ucLookHuoZhu1.Enabled = false; } /// <summary> /// 鏂板浜嬩欢 @@ -293,46 +439,47 @@ 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.Warning("璇烽�夋嫨搴撳瓨缁勭粐锛�"); + Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨搴撳瓨缁勭粐锛�"); txt_qt022.Focus(); return; } if (string.IsNullOrEmpty(inHzlx)) { - Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨璐т富绫诲瀷锛�"); + Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨璐т富绫诲瀷锛�"); return; } if (string.IsNullOrEmpty(inHz)) { - Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨璐т富锛�"); + Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨璐т富锛�"); return; } if (txt_qt003.TextTxt.Length < 0) { - Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨鍗曟嵁绫诲瀷锛�"); + Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鍗曟嵁绫诲瀷锛�"); txt_qt003.Focus(); return; } - if (txt_qt019.SelectedIndex <= 0) + if (txt_qtlx.SelectedIndex <= 0) { - Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨搴撳瓨鏂瑰悜锛�"); - txt_qt019.Focus(); + Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鍏ュ簱绫诲瀷锛�"); + txt_qtlx.Focus(); return; } if (string.IsNullOrEmpty(kcBm) && string.IsNullOrEmpty(kcGys)) { - Gs.DevApp.ToolBox.MsgHelper.Warning("閮ㄩ棬鎴栦緵搴斿晢蹇呴』閫変竴涓紒"); + Gs.DevApp.ToolBox.MsgHelper.ShowError("閮ㄩ棬鎴栦緵搴斿晢蹇呴』閫変竴涓紒"); 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()), //涓诲缓 @@ -346,6 +493,7 @@ hzlx = inHzlx,//璐т富绫诲瀷 inHz = inHz,//璐т富 inSource = txt_qt035.EditValue,//宸ュ崟鍙� + qtlx = qtlx, list = new List<dynamic>(), }; gvMx1.CloseEditor(); @@ -381,9 +529,9 @@ { 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) { + ToolBox.MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg); lbGuid.Text = _rtn.rtnData.outGuid; txt_qtck.Text = _rtn.rtnData.outNo; toolBarMenu1.isSetBtn = true; @@ -395,10 +543,12 @@ toolBarMenu1.currentAction = ""; Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6); } + else + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } @@ -409,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 @@ -456,7 +610,7 @@ if (toolBarMenu1.currentAction == "edit") isEdit = true; if (string.IsNullOrEmpty(strGuid)) { - MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } var _obj = new @@ -523,13 +677,18 @@ { Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx2, gvMx2); } + + if (txt_isIqc.Checked) + split99.PanelVisibility = SplitPanelVisibility.Panel2; + else + split99.PanelVisibility = SplitPanelVisibility.Both; } else - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } @@ -542,6 +701,9 @@ gvMx1.SetFocusedRowCellValue("qd004", SelectedDataRow["itemModel"]); gvMx1.SetFocusedRowCellValue("kcDw", SelectedDataRow["dwName"]); gvMx1.SetFocusedRowCellValue("itemId", SelectedDataRow["id"]); + gvMx1.CloseEditor(); + gvMx1.PostEditor(); + gvMx1.UpdateCurrentRow(); } /// <summary> /// 绉诲嚭鏄庣粏 @@ -577,13 +739,15 @@ var _rtn = UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { - if (_rtn.rtnCode > 0) getModel(lbGuid.Text); + MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg); + getModel(lbGuid.Text); } - MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + else + MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } } @@ -663,7 +827,7 @@ case 0: strMsg = "鍙嶅鏍�"; break; - case 30: + case 30: strMsg = "璐㈠姟瀹℃牳"; break; case 31: @@ -675,14 +839,15 @@ case 41: strMsg = "閲囪喘鍙嶅鏍�"; break; - }; + } + ; toolBarMenu1.guidKey = ""; string rowGuid, rowName; (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_qtck, gridView1, "qtck"); if (string.IsNullOrEmpty(rowGuid)) { - MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾" + strMsg + "鍚楋紵")) @@ -698,9 +863,10 @@ _webServiceName + "EditModelSubmit", JsonConvert.SerializeObject(_obj)); var _rtn = UtilityHelper.ReturnToDynamic(strJson); - MsgHelper.Warning(_rtn.rtnData.outMsg.ToString()); + if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0) { + MsgHelper.ShowInformation(_rtn.rtnData.outMsg.ToString()); if (xtraTabControl1.SelectedTabPageIndex == 1) { getModel(lbGuid.Text.Trim()); @@ -708,18 +874,24 @@ //int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid); //gridView1.FocusedRowHandle = rowHandle; //UtilityHelper.SetCheckIco(gridView1, "isSh", "qt016", "qt002", picCheckBox, this, _inFieldValue.ToString()); - //娉ㄦ剰锛岃繖閲屽拰鍏跺畠椤甸潰鏈夌偣涓嶄竴鏍� getPageList(this.pageBar1.CurrentPage); int rowHandle = gridView1.LocateByValue("guid", rowGuid); gridView1.FocusedRowHandle = rowHandle; } + else + MsgHelper.ShowError(_rtn.rtnData.outMsg.ToString()); } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + 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; @@ -733,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()); @@ -741,6 +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