From ecb7a60de1639f520712ce95f99414b0dd2c9713 Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期一, 14 四月 2025 08:30:40 +0800 Subject: [PATCH] 自动打印 --- DevApp/Gs.DevApp/DevFrm/FQC/Frm_FqcDetect01.cs | 398 +++++++++++++++++++++++++++++++------------------------- 1 files changed, 218 insertions(+), 180 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/FQC/Frm_FqcDetect01.cs b/DevApp/Gs.DevApp/DevFrm/FQC/Frm_FqcDetect01.cs index 67ac170..fc5edf2 100644 --- a/DevApp/Gs.DevApp/DevFrm/FQC/Frm_FqcDetect01.cs +++ b/DevApp/Gs.DevApp/DevFrm/FQC/Frm_FqcDetect01.cs @@ -1,4 +1,4 @@ -锘縰sing Gs.DevApp.DevFrm.QC; +锘縰sing Gs.DevApp.DevFrm.Work; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Gs.DevApp.UserControl; @@ -6,9 +6,7 @@ using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; -using System.Configuration; using System.Data; -using System.Net; using System.Threading.Tasks; using System.Windows.Forms; @@ -16,7 +14,7 @@ { public partial class Frm_FqcDetect01 : DevExpress.XtraEditors.XtraForm { - string _webServiceName = "MesQaItemsDetect01Manager/"; + string _webServiceName = "FqcManager/"; List<FilterEntity> _filterList = new List<FilterEntity>(); public Frm_FqcDetect01() { @@ -24,6 +22,7 @@ this.toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick; this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick; this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick; + this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1; this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick; this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; @@ -33,39 +32,46 @@ 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.SetGridViewParameter(gridView1, picCheckBox, this, "fsubmitTxt", "", (value) => { Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); - }); + }, tips); Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) => { getModel(value, "0"); }, (value) => { getPageList(this.pageBar1.CurrentPage); - },lbGuid); + }, lbGuid); getPageList(1); pageBar1.PagerEvent += PageBar1_PagerEvent; txtJianYan.KeyDown += TxtJianYan_KeyDown; this.btnLoad.Click += BtnLoad_Click; - ucUpFile1.UpChanged += UcUpFile1_UpChanged; xtraTabControl2.SelectedPageChanged += XtraTabControl2_SelectedPageChanged; gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged; btnIpt.Click += BtnIpt_Click; txt_suppId.getSuppler(""); txt_lineId.getSuppler(""); - txt_itemId.Click += (s, e) => { - var frm = new SelectItem("1"); + txt_itemId.Click += (s, e) => + { + string _lineId = txt_lineId.GetId(); + if (string.IsNullOrEmpty(_lineId)) + { + Gs.DevApp.ToolBox.MsgHelper.ShowInformation("璇峰厛閫夋嫨浜х嚎锛�"); + return; + } + var frm = new SelectFqcItem(_lineId); frm.UpdateParent += (ss, ee) => { try { - var lst = ee.DynamicList; - foreach (dynamic dym in lst) - { - MessageBox.Show("d"); - } + var lst = new List<dynamic>(); + lst = ee.DynamicList; + txt_itemId.Text = lst[0].itemId; + txt_itemModel.Text = lst[0].itemModel; + txt_itemName.Text = lst[0].itemName; + txt_itemNo.Text = lst[0].itemNo; + txt_lotNo.Text = lst[0].gdbh; } catch (Exception ex) { @@ -74,11 +80,8 @@ }; frm.ShowDialog(); }; - } - - private void Txt_itemId_EditChanged(object sender, EventArgs e) - { - throw new NotImplementedException(); + // 璇诲彇缂洪櫡绛夌骇 + getRptDefectLevel(); } /// <summary> @@ -90,10 +93,9 @@ private void BtnIpt_Click(object sender, EventArgs e) { bool bl = btnLoad.Enabled; - Frm_MesQaItemsDetect01Input frm = new Frm_MesQaItemsDetect01Input(this.lbGuid.Text.Trim(), bl); + Gs.DevApp.DevFrm.QC.Frm_MesQaItemsDetect01Input frm = new Gs.DevApp.DevFrm.QC.Frm_MesQaItemsDetect01Input(this.lbGuid.Text.Trim(), bl); frm.ShowDialog(); } - private void GridView1_ColumnFilterChanged(object sender, EventArgs e) { _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1); @@ -132,7 +134,7 @@ }; try { - string strJson = UtilityHelper.HttpPost("", _webServiceName + "ReloadModel5", JsonConvert.SerializeObject(_obj)); + string strJson = UtilityHelper.HttpPost("", "MesQaItemsDetect01Manager/ReloadModel5", JsonConvert.SerializeObject(_obj)); ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { @@ -192,7 +194,7 @@ try { var strJson = UtilityHelper.HttpPost("", - _webServiceName + "EdtModel12", + "MesQaItemsDetect01Manager/EdtModel12", JsonConvert.SerializeObject(_obj)); var _rtn = UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) @@ -269,7 +271,7 @@ toolBarMenu1.guidKey = ""; string rowGuid, rowName; (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, - lbGuid, txt_releaseNo, gridView1, "lotNo"); + lbGuid, txt_releaseNo, gridView1, "releaseNo"); toolBarMenu1.guidKey = rowGuid; if (string.IsNullOrEmpty(rowGuid)) { @@ -280,9 +282,9 @@ return; if (txt_fcheckResu.Text.Trim() == "涓嶅悎鏍�") { - if (string.IsNullOrEmpty(txt_remarks.Text.Trim())) + if (string.IsNullOrEmpty(txt_msg.TextTxt.Trim())) { - MsgHelper.Warning("鍗曟嵁涓轰笉鍚堟牸鏃讹紝璇峰~鍐欏娉ㄨ鏄庯紒"); + MsgHelper.Warning("鍗曟嵁涓轰笉鍚堟牸鏃讹紝璇峰~鍐欒繚瑙勪俊鎭紒"); return; } }; @@ -326,7 +328,49 @@ 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_releaseNo, gridView1, "releaseNo"); + if (string.IsNullOrEmpty(rowGuid)) + { + MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鍒犻櫎鍚楋紵")) + return; + var _obj = new + { + guid = rowGuid, + mxGuid = Guid.Empty.ToString(), + }; + try + { + var strJson = UtilityHelper.HttpPost("", + _webServiceName + "DeleteModelOrMx", + JsonConvert.SerializeObject(_obj)); + var _rtn = UtilityHelper.ReturnToDynamic(strJson); + if (_rtn.rtnCode > 0) + { + if (xtraTabControl1.SelectedTabPageIndex == 0) + { } + else + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2); + getPageList(this.pageBar1.CurrentPage); + } + MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + } + catch (Exception ex) + { + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } /// <summary> /// 鍒锋柊浜嬩欢 /// </summary> @@ -362,6 +406,7 @@ gridViews.Add(gvMx1); UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews); Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); + this.ucUpFileList1.pGuid = ""; } /// <summary> /// 淇敼浜嬩欢 @@ -401,32 +446,114 @@ private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e) { toolBarMenu1.isSetBtn = false; - if (string.IsNullOrEmpty(txt_remarks.Text.Trim())) + string _txt_djType = txt_djType.Text.Trim();//鍗曟嵁绫诲瀷 + string _txt_fbatchQty = txt_fbatchQty.Text.Trim();//鎶芥鏁伴噺 + string _txt_lifnr = txt_lifnr.Text.Trim();//瀹㈡埛璁㈠崟 + string _txt_suppId = txt_suppId.GetId();//瀹㈡埛id + string _txt_lineId = txt_lineId.GetId();//浜х嚎 + string _txt_itemId = txt_itemId.Text.Trim();//浜у搧 + string _txt_remarks = txt_remarks.Text.Trim();//澶囨敞 + string _txt_epTag = txt_epTag.Text.Trim();//鐜繚 + string _txt_msg = txt_msg.TextTxt;//寮傚父 + string _txt_fmanageNo = txt_fmanageNo.Text.Trim();//娴佺▼缂栧彿 + string _txt_lotNo1 = txt_lotNo1.Text.Trim();//閫佹鎵瑰彿 + string _txt_lotNo = txt_lotNo.Text.Trim();//鐢熶骇宸ュ崟 + if (txt_djType.SelectedIndex <= 0) { - Gs.DevApp.ToolBox.MsgHelper.Warning("澶囨敞鑳戒负绌猴紒"); - txt_remarks.Focus(); + Gs.DevApp.ToolBox.MsgHelper.Warning("鍗曟嵁绫诲瀷涓嶈兘涓虹┖锛�"); + txt_djType.Focus(); + return; + } + if (string.IsNullOrEmpty(_txt_fbatchQty.Trim())) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("鎶芥鏁伴噺涓嶈兘涓虹┖锛�"); + txt_fbatchQty.Focus(); + return; + } + if (string.IsNullOrEmpty(_txt_lineId.Trim())) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("浜х嚎涓嶈兘涓虹┖锛�"); + txt_lineId.Focus(); + return; + } + if (string.IsNullOrEmpty(_txt_itemId.Trim())) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("浜у搧涓嶈兘涓虹┖锛�"); + txt_itemId.Focus(); + return; + } + if (string.IsNullOrEmpty(_txt_lotNo.Trim())) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("宸ュ崟鍙蜂笉鑳戒负绌猴紒"); + txt_lotNo.Focus(); return; } var _obj = new { guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓 - fngDesc = "", - remarks = txt_remarks.Text.Trim(), + djType = _txt_djType,//鍗曟嵁绫诲瀷 + fbatchQty = _txt_fbatchQty,//鎶芥鏁伴噺 + lifnr = _txt_lifnr,//瀹㈡埛璁㈠崟 + suppId = _txt_suppId,//瀹㈡埛id + lineId = _txt_lineId,//浜х嚎 + itemId = _txt_itemId,//浜у搧 + remarks = _txt_remarks,//澶囨敞 + epTag = _txt_epTag,//鐜繚 + msg = _txt_msg,//寮傚父 + fmanageNo = _txt_fmanageNo,//娴佺▼缂栧彿 + lotNo1 = _txt_lotNo1,//閫佹鎵瑰彿 + lotNo = _txt_lotNo,//鐢熶骇宸ュ崟 + edtType = 0, + list = new List<dynamic>(), }; + gvMx1.CloseEditor(); + gvMx1.PostEditor(); + gvMx1.UpdateCurrentRow(); + for (var i = 0; i < gvMx1.DataRowCount; i++) + { + var row = gvMx1.GetDataRow(i); + if (row != null) + { + Guid _guid = UtilityHelper.ToGuid(row["guid"].ToString()); + string _defectLevel = row["defectLevel"].ToString(); + string _defectDetails = row["defectDetails"].ToString(); + string _fcheckResu = row["fcheckResu"].ToString(); + if (_fcheckResu == "涓嶅悎鏍�") + { + if (string.IsNullOrEmpty(_defectLevel)) + { + MsgHelper.ShowError("璇烽�夋嫨缂洪櫡绛夌骇锛�"); + return; + } + if (string.IsNullOrEmpty(_defectDetails)) + { + MsgHelper.ShowError("璇峰~鍐欑己闄锋弿杩帮紒"); + return; + } + _obj.list.Add(new + { + guid5 = _guid, + defectLevel = _defectLevel, + defectDetails = _defectDetails, + }); + } + } + } 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; + lbGuid.Text = _rtn.rtnData.outGuid; + txt_releaseNo.Text = _rtn.rtnData.outNo; toolBarMenu1.isSetBtn = true; UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false); this.setEable(false); toolBarMenu1.currentAction = ""; Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6); + getModel(lbGuid.Text, "0"); } } catch (Exception ex) @@ -477,7 +604,6 @@ { ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } - } private void getModel(string strGuid, string guid5) { @@ -519,7 +645,7 @@ gcMx1.DataSource = dt; gcMx1.ForceInitialize(); gvMx1.BestFitColumns(); - ucUpFile1.parentGuid = lbGuid.Text.Trim(); + ucUpFileList1.pGuid = lbGuid.Text.Trim(); if (guid5.Length > 10) { int rowHandle = 0; @@ -528,7 +654,6 @@ rowHandle = 0; gvMx1.FocusedRowHandle = rowHandle + 1; } - // MessageBox.Show(rowHandle.ToString() + "**" + guid5); } else { @@ -542,7 +667,6 @@ { ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } - } /// <summary> @@ -554,46 +678,7 @@ { if (e.Page.Name == "tabMxPage2") { - getFileList(); - } - } - /// <summary> - /// 涓婁紶鍚庡埛鏂版枃浠跺垪琛� - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void UcUpFile1_UpChanged(object sender, EventArgs e) - { - getFileList(); - } - private void getFileList() - { - if (lbGuid.Text.Length <= 10) - return; - System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); - _sbSqlWhere.Append(" and parent_Guid='" + lbGuid.Text.Trim() + "'"); - PageQueryModel pgq = new PageQueryModel(1, 100, "create_date", "asc", "", _sbSqlWhere.ToString()); - string json = JsonConvert.SerializeObject(pgq); - try - { - string strReturn = UtilityHelper.HttpPost("", "MesFile/GetListPage", json); - ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); - if (dd.rtnCode > 0) - { - DataTable dt = dd.rtnData.list; - gcMx4.BindingContext = new BindingContext(); - gcMx4.DataSource = dt; - gcMx4.ForceInitialize(); - gvMx4.BestFitColumns(); - } - else - { - ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + dd.rtnMsg); - } - } - catch (Exception ex) - { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + ucUpFileList1.getFileList(); } } /// <summary> @@ -638,112 +723,65 @@ } } - /// <summary> - /// 鍒犻櫎闄勪欢 - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) - { - var rowhandle = gvMx4.FocusedRowHandle; - if (rowhandle < 0) - return; - if (e.Button.Index == 0) - { - var dr = gvMx4.GetDataRow(rowhandle); - var mxGuid = dr["guid"].ToString(); - if (!MsgHelper.AskQuestion("浣犻�夋嫨浜�1鏉℃暟鎹紝纭畾鍒犻櫎鍚楋紵")) - return; - var strJson = ""; - var lst = new List<string>(); - lst.Add(mxGuid); - try - { - strJson = UtilityHelper.HttpPost("", "MesFile/DeleteModel", - JsonConvert.SerializeObject(lst)); - var _rtn = UtilityHelper.ReturnToDynamic(strJson); - if (_rtn.rtnCode > 0) gvMx4.DeleteRow(rowhandle); - MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); - } - catch (Exception ex) - { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); - } - } - } - - /// <summary> - /// 娴忚闄勪欢 - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void repositoryItemButtonEdit2_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) - { - var rowhandle = gvMx4.FocusedRowHandle; - if (rowhandle < 0) - return; - if (e.Button.Index == 0) - { - try - { - var dr = gvMx4.GetDataRow(rowhandle); - var urlPath = dr["urlPath"].ToString(); - Gs.DevApp.UserControl.ShowFile frm = new ShowFile(urlPath); - frm.ShowDialog(); - } - catch (Exception ex) - { - Gs.DevApp.ToolBox.MsgHelper.ShowError(ex.Message); - } - - } - } - /// <summary> - /// 涓嬭浇闄勪欢 - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void repositoryItemButtonEdit3_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) - { - var rowhandle = gvMx4.FocusedRowHandle; - if (rowhandle < 0) - return; - if (e.Button.Index == 0) - { - try - { - var dr = gvMx4.GetDataRow(rowhandle); - var urlPath = dr["urlPath"].ToString(); - using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()) - { - folderBrowserDialog.Description = "閫夋嫨瀵煎嚭鏂囦欢鐨勪繚瀛樿矾寰�"; - DialogResult dialogResult = folderBrowserDialog.ShowDialog(); - if (dialogResult == DialogResult.OK) - { - string _folder = folderBrowserDialog.SelectedPath; - string _folderName = _folder + "\\" + urlPath; - string _url = ConfigurationManager.AppSettings["WebApiUrl"].ToString() + "upload/" + urlPath; - using (WebClient client = new WebClient()) - { - client.DownloadFile(_url, _folderName); - } - ToolBox.MsgHelper.ShowInformation("涓嬭浇鎴愬姛锛�"); - } - } - } - catch (Exception ex) - { - Gs.DevApp.ToolBox.MsgHelper.ShowError(ex.Message); - } - } - } private void setEable(bool bl) { - txtJianYan.ReadOnly = !bl; btnLoad.Enabled = bl; btnIpt.Text = (bl == true ? "褰曞叆鏍锋湰" : "鏌ョ湅鏍锋湰"); } - + + + /// <summary> + /// 璇诲彇缂洪櫡绛夌骇 + /// </summary> + /// <param name="curPage"></param> + private void getRptDefectLevel() + { + string _where = " and 1=1 and s_type='缂洪櫡绛夌骇'"; + var pgq = new PageQueryModel(1, 999999, "a.defect_code", "asc", "", _where); + var json = JsonConvert.SerializeObject(pgq); + try + { + var strReturn = UtilityHelper.HttpPost("", "MesDefectCodeManager/GetListPage", json); + var dd = UtilityHelper.ReturnToTablePage(strReturn); + var dt = dd.rtnData.list; + foreach (DataRow dr in dt.Rows) + { + rptDefectLevel.Items.Add(dr["defectName"].ToString()); + } + } + catch (Exception ex) + { + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + /// <summary> + /// 閫夋嫨缂洪櫡鎻忚堪 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void rptDefectDetails_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) + { + var rowhandle = gvMx1.FocusedRowHandle; + if (rowhandle < 0) + return; + UcDictionarySelect frm = new UcDictionarySelect("缂洪櫡鎻忚堪", " s_type='FQC缂洪櫡鎻忚堪'"); + frm.UpdateParent += (ss, ee) => + { + System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); + var lst = ee.DynamicList; + foreach (dynamic dym in lst) + { + if (stringBuilder.Length > 0) + stringBuilder.Append("|"); + stringBuilder.Append(dym.dicTxt); + } + gvMx1.SetFocusedRowCellValue("defectDetails", stringBuilder.ToString()); + // this.TextTxt = ; + }; + frm.ShowDialog(); + } + + } } \ No newline at end of file -- Gitblit v1.9.3