From 437425784b7612e10d4a54bd64905c508347514d Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期二, 06 五月 2025 15:12:50 +0800 Subject: [PATCH] fqc --- DevApp/Gs.DevApp/DevFrm/FQC/Frm_FqcDetect01.cs | 960 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 955 insertions(+), 5 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/FQC/Frm_FqcDetect01.cs b/DevApp/Gs.DevApp/DevFrm/FQC/Frm_FqcDetect01.cs index 599b295..3f8d670 100644 --- a/DevApp/Gs.DevApp/DevFrm/FQC/Frm_FqcDetect01.cs +++ b/DevApp/Gs.DevApp/DevFrm/FQC/Frm_FqcDetect01.cs @@ -1,11 +1,12 @@ -锘縰sing DevExpress.XtraEditors; +锘縰sing Gs.DevApp.DevFrm.Work; +using Gs.DevApp.Entity; +using Gs.DevApp.ToolBox; +using Gs.DevApp.UserControl; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -13,9 +14,958 @@ { public partial class Frm_FqcDetect01 : DevExpress.XtraEditors.XtraForm { + string _strTag= "N:涓嶅悎鏍�"; + string _webServiceName = "FqcManager/"; + List<FilterEntity> _filterList = new List<FilterEntity>(); public Frm_FqcDetect01() { InitializeComponent(); + 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; + toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick; + toolBarMenu1.btnJianYanClick += ToolBarMenu1_btnJianYanClick; + 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.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); + getPageList(1); + pageBar1.PagerEvent += PageBar1_PagerEvent; + txtJianYan.KeyDown += TxtJianYan_KeyDown; + this.btnLoad.Click += BtnLoad_Click; + xtraTabControl2.SelectedPageChanged += XtraTabControl2_SelectedPageChanged; + gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged; + btnIpt.Click += BtnIpt_Click; + txt_suppId.getSuppler(""); + //閫夋嫨宸ュ崟 + txt_lotNo.Click += (s, e) => + { + var frm = new SelectFqcDaa(); + frm.UpdateParent += (ss, ee) => + { + try + { + 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; + txt_lineName.Text = lst[0].lineName; + txt_lineId.Text = lst[0].lineId; + txt_checkStates.Text = "W:鏈煡"; + txt_fcheckResu.Text = "W:鏈煡"; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + }; + frm.ShowDialog(); + }; + //閫夋嫨绠辩爜 + txt_kbList.Click += (s, e) => + { + string _lotNo = txt_lotNo.Text.Trim(); + if (string.IsNullOrEmpty(_lotNo)) + { + Gs.DevApp.ToolBox.MsgHelper.ShowInformation("璇峰厛閫夋嫨宸ュ崟锛�"); + return; + } + var frm = new SelectFqcBox(_lotNo); + frm.UpdateParent += (ss, ee) => + { + try + { + var lst = new List<dynamic>(); + lst = ee.DynamicList; + System.Text.StringBuilder sb = new System.Text.StringBuilder(); + decimal kbSl = 0; + foreach (var item in lst) + { + if (sb.Length > 0) + sb.Append(","); + sb.Append(item.itemBarcode); + kbSl += decimal.Parse(item.sl.ToString()); + }; + txt_kbList.Text = sb.ToString(); + txt_kbSl.Text = kbSl.ToString(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + }; + frm.ShowDialog(); + }; + // 璇诲彇缂洪櫡绛夌骇 + getRptDefectLevel(); + } + + /// <summary> + /// 鎵归噺褰曞叆 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + /// <exception cref="NotImplementedException"></exception> + private void BtnIpt_Click(object sender, EventArgs e) + { + bool bl = btnLoad.Enabled; + 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); + Task.Delay(100); + getPageList(1); + } + private void GvMx1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) + { + if (e.FocusedRowHandle >= 0) + { + DataRow row = gvMx1.GetDataRow(e.FocusedRowHandle); + string rowGuid = row["guid"].ToString(); + if (string.IsNullOrEmpty(rowGuid)) + return; + getList12(rowGuid); + } + } + /// <summary> + /// 閲嶆柊鍔犺浇妫�楠� + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void BtnLoad_Click(object sender, EventArgs e) + { + if (!MsgHelper.AskQuestion("纭畾閲嶆柊鍔犺浇妫�楠岄」鐩悧锛岃鎿嶄綔灏嗕細娓呯┖涔嬪墠鐨勬楠岃褰曪紵")) + return; + string strGuid = lbGuid.Text.Trim(); + if (string.IsNullOrEmpty(strGuid)) + { + ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + var _obj = new + { + guid = strGuid, + }; + try + { + string strJson = UtilityHelper.HttpPost("", "MesQaItemsDetect01Manager/ReloadModel5", JsonConvert.SerializeObject(_obj)); + ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); + if (_rtn.rtnCode > 0) + { + getModel(lbGuid.Text.Trim(), "0"); + } + else + { + Gs.DevApp.ToolBox.MsgHelper.ShowInformation(_rtn.rtnMsg); + } + } + catch (Exception ex) + { + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + /// <summary> + /// 杈撳叆妫�楠屼簨浠� + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void TxtJianYan_KeyDown(object sender, KeyEventArgs e) + { + int intHandle = this.gvMx1.FocusedRowHandle; + if (intHandle < 0) + { + ToolBox.MsgHelper.Warning("鎻愮ず锛氳閫夋嫨妫�楠岄」鐩紒"); + return; + } + if (e.KeyCode == Keys.Enter) + { + string guid5 = this.gvMx1.GetDataRow(intHandle)["guid"].ToString(); + string _strCmd = txtJianYan.Text.Trim().ToUpper(); + string _strOK = "OK"; + string _strNG = "NG"; + if (!(_strCmd.StartsWith(_strOK) || _strCmd.StartsWith(_strNG))) + { + Gs.DevApp.ToolBox.MsgHelper.ShowError("鍛戒护杈撳叆閿欒锛氳姝g‘浣跨敤OK 鎴� NG 鍛戒护!"); + return; + } + if (!_strCmd.Contains("-")) + { + Gs.DevApp.ToolBox.MsgHelper.ShowError("鍛戒护杈撳叆閿欒锛氳姝g‘浣跨敤OK 鎴� NG 鍛戒护!"); + return; + } + string[] _ary = _strCmd.Split('-'); + if (_ary.Length != 2) + { + Gs.DevApp.ToolBox.MsgHelper.ShowError("鍛戒护杈撳叆閿欒锛氳姝g‘浣跨敤OK 鎴� NG 鍛戒护!"); + return; + } + var _obj = new + { + inOrderGuid1 = UtilityHelper.ToGuid(lbGuid.Text.Trim()), ////杩欐槸妫�楠屽崟guid + inOrderGuid5 = guid5,//杩欐槸鎶芥牱鐨刧uid + inP1 = _strCmd,//鎴栬��0k-19,鎴栬�卬g-19 + }; + try + { + var strJson = UtilityHelper.HttpPost("", + "MesQaItemsDetect01Manager/EdtModel12", + JsonConvert.SerializeObject(_obj)); + var _rtn = UtilityHelper.ReturnToDynamic(strJson); + if (_rtn.rtnCode > 0) + { + getModel(lbGuid.Text.Trim(), guid5); + } + else + { + Gs.DevApp.ToolBox.MsgHelper.ShowInformation(_rtn.rtnMsg); + } + txtJianYan.Text = ""; + } + catch (Exception ex) + { + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + } + + /// <summary> + /// 鍒嗛〉浜嬩欢 + /// </summary> + /// <param name="curPage"></param> + /// <param name="pageSize"></param> + private void PageBar1_PagerEvent(int curPage, int pageSize) + { + getPageList(curPage); + } + /// <summary> + /// 鏌ヨ浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) + { + gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + gridView1.ActiveFilter.Clear(); + gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + var frm = new ShowFilter(gridView1.Columns, _filterList, this.GetType().FullName); + frm.UpdateParent += Frm_UpdateParent; + frm.ShowDialog(); + } + /// <summary> + /// 鏌ヨ鍥炶皟 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) + { + _filterList = e.FilterList; + getPageList(1); + } + /// <summary> + /// 鏃ュ織浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnLogClick(object sender, EventArgs e) + { + toolBarMenu1.guidKey = ""; + string rowGuid, rowName; + (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, + lbGuid, txt_releaseNo, gridView1); + toolBarMenu1.guidKey = rowGuid; + } + /// <summary> + ///鎻愪氦妫�楠屼簨浠� + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + /// <exception cref="NotImplementedException"></exception> + private void ToolBarMenu1_btnJianYanClick(object sender, EventArgs e) + { + toolBarMenu1.guidKey = ""; + string rowGuid, rowName; + (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, + lbGuid, txt_releaseNo, gridView1, "releaseNo"); + toolBarMenu1.guidKey = rowGuid; + if (string.IsNullOrEmpty(rowGuid)) + { + MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鎻愪氦妫�楠屽悧锛�")) + return; + if (txt_fcheckResu.Text.Trim() == _strTag) + { + if (string.IsNullOrEmpty(txt_msg.TextTxt.Trim())) + { + MsgHelper.Warning("鍗曟嵁涓轰笉鍚堟牸鏃讹紝璇峰~鍐欒繚瑙勪俊鎭紒"); + return; + } + string _txt_fngHandle = txt_fngHandle.Text.Trim(); + string _txt_fmrmode = txt_fmrmode.GetCode(); + string _txt_fzrId = txt_fzrId.GetId(); + string _txt_workNo = txt_workNo.Text.Trim(); + string _txt_msg = txt_msg.TextTxt; + string _txt_zrType = txt_zrType.Text.Trim(); + if (txt_fngHandle.SelectedIndex <= 0) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨澶勭疆缁撴灉锛�"); + txt_fngHandle.Focus(); + return; + } + if (txt_zrType.SelectedIndex <= 0) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨璐d换鍒ゅ畾锛�"); + txt_zrType.Focus(); + return; + } + if (_txt_fzrId.Length <= 0) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨璐d换浜猴紒"); + txt_fzrId.Focus(); + return; + } + //褰撳缃粨鏋滀负鍙嶅伐鏃讹紝瑕侀�夋嫨宸ュ簭鍜屽弽宸ョ紪鍙� + if (txt_fngHandle.SelectedIndex == 1) + { + if (string.IsNullOrEmpty(_txt_workNo)) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("璇峰~鍐欏弽宸ュ崟鍙凤紒"); + txt_workNo.Focus(); + return; + } + if (string.IsNullOrEmpty(_txt_fmrmode)) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("璇峰~閫夋嫨鍙嶅伐宸ュ簭锛�"); + txt_fmrmode.Focus(); + return; + } + } + else + { + if (!string.IsNullOrEmpty(_txt_workNo)) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("涓嶉渶瑕佸~鍐欏弽宸ュ崟鍙凤紒"); + txt_workNo.Focus(); + return; + } + if (!string.IsNullOrEmpty(_txt_fmrmode)) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("涓嶉渶瑕侀�夋嫨鍙嶅伐宸ュ簭锛�"); + txt_fmrmode.Focus(); + return; + } + } + }; + + var _obj = new + { + guid = rowGuid, + }; + try + { + var strJson = UtilityHelper.HttpPost("", + _webServiceName + "EditModelSubmit", + JsonConvert.SerializeObject(_obj)); + var _rtn = UtilityHelper.ReturnToDynamic(strJson); + MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnData.outMsg); + if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0) + { + if (xtraTabControl1.SelectedTabPageIndex == 1) + { + getModel(lbGuid.Text.Trim(), "0"); + } + int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid); + gridView1.FocusedRowHandle = rowHandle; + int _inFieldValue = 1; + UtilityHelper.SetCheckIco(gridView1, "fsubmitTxt", "", "iqcDate", picCheckBox, this, _inFieldValue.ToString()); + } + } + catch (Exception ex) + { + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + + /// <summary> + /// 鍙栨秷浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnEscClick(object sender, EventArgs e) + { + 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, + }; + 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> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) + { + if (xtraTabControl1.SelectedTabPageIndex == 1) + getModel(lbGuid.Text.Trim(), "0"); + else + { + //_filterList.Clear(); + //if (gridView1.ActiveFilter.Count > 0) + //{ + // gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; + // gridView1.ActiveFilter.Clear(); + // gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; + //} + //getPageList(1); + getPageList(this.pageBar1.CurrentPage); + } + } + /// <summary> + /// 鏂板浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnAddClick(object sender, EventArgs e) + { + lbGuid.Text = ""; + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4); + List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); + gridViews.Add(gvMx1); + UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews); + Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); + this.ucUpFileList1.pGuid = ""; + this.ucChouJianList1.pGuid = ""; + } + /// <summary> + /// 淇敼浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <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_releaseNo, gridView1, "releaseNo"); + if (string.IsNullOrEmpty(rowGuid)) + { + ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); + if (xtraTabControl1.SelectedTabPageIndex == 1) + { + getModel(rowGuid, "0"); + } + else + { + List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); + gvList.Add(gvMx1); + gvList.Add(gvMx2); + UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList); + this.setEable(true); + } + } + + /// <summary> + /// 淇濆瓨浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e) + { + toolBarMenu1.isSetBtn = false; + 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 = "";//浜х嚎 + string _txt_itemId = "";//浜у搧 + 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();//鐢熶骇宸ュ崟 + string _kbList = txt_kbList.Text.Trim(); + if (txt_djType.SelectedIndex <= 0) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("鍗曟嵁绫诲瀷涓嶈兘涓虹┖锛�"); + txt_djType.Focus(); + return; + } + if (string.IsNullOrEmpty(_txt_lotNo.Trim())) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("宸ュ崟鍙蜂笉鑳戒负绌猴紒"); + txt_lotNo.Focus(); + return; + } + if (string.IsNullOrEmpty(_kbList.Trim())) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("閫佹绠辩爜涓嶈兘涓虹┖锛�"); + txt_kbList.Focus(); + return; + } + if (string.IsNullOrEmpty(txt_kbSl.Text.Trim())) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("閫佹鏁伴噺涓嶈兘涓虹┖锛�"); + txt_kbList.Focus(); + return; + } + if (string.IsNullOrEmpty(_txt_fbatchQty.Trim())) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("鎶芥鏁伴噺涓嶈兘涓虹┖锛�"); + txt_fbatchQty.Focus(); + return; + } + if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric2(_txt_fbatchQty)) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("璇疯緭鍏ユ纭殑鎶芥鏁伴噺锛�"); + txt_fbatchQty.Focus(); + return; + } + if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric2(txt_kbSl.Text.Trim())) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("璇疯緭鍏ユ纭殑閫佹鏁伴噺锛�"); + txt_kbList.Focus(); + return; + } + if (Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(_txt_fbatchQty) > Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(txt_kbSl.Text.Trim())) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("鎶芥鏁伴噺涓嶈兘澶т簬閫佹鏁伴噺锛�"); + txt_fbatchQty.Focus(); + return; + } + //褰撲笉鍚堟牸鏃剁殑妫�鏌� + string _txt_fngHandle = txt_fngHandle.Text.Trim(); + string _txt_fmrmode = txt_fmrmode.GetCode(); + string _txt_fzrId = txt_fzrId.GetId(); + string _txt_workNo = txt_workNo.Text.Trim(); + string _txt_zrType = txt_zrType.Text.Trim(); + if (txt_fcheckResu.Text.Trim() == _strTag) + { + if (string.IsNullOrEmpty(txt_msg.TextTxt.Trim())) + { + MsgHelper.Warning("褰撲笉鍚堟牸鏃讹紝璇峰~鍐欒繚瑙勪俊鎭紒"); + txt_msg.Focus(); + return; + } + + if (txt_fngHandle.SelectedIndex <= 0) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("褰撲笉鍚堟牸鏃讹紝璇烽�夋嫨澶勭疆缁撴灉锛�"); + txt_fngHandle.Focus(); + return; + } + if (txt_zrType.SelectedIndex <= 0) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("褰撲笉鍚堟牸鏃讹紝璇烽�夋嫨璐d换鍒ゅ畾锛�"); + txt_zrType.Focus(); + return; + } + if (_txt_fzrId.Length <= 0) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("褰撲笉鍚堟牸鏃讹紝璇烽�夋嫨璐d换浜猴紒"); + txt_fzrId.Focus(); + return; + } + //褰撳缃粨鏋滀负鍙嶅伐鏃讹紝瑕侀�夋嫨宸ュ簭鍜屽弽宸ョ紪鍙� + if (txt_fngHandle.SelectedIndex == 1) + { + if (string.IsNullOrEmpty(_txt_workNo)) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("褰撲笉鍚堟牸鏃讹紝璇峰~鍐欏弽宸ュ崟鍙凤紒"); + txt_workNo.Focus(); + return; + } + if (string.IsNullOrEmpty(_txt_fmrmode)) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("褰撲笉鍚堟牸鏃讹紝璇峰~閫夋嫨鍙嶅伐宸ュ簭锛�"); + txt_fmrmode.Focus(); + return; + } + } + else + { + if (!string.IsNullOrEmpty(_txt_workNo)) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("涓嶉渶瑕佸~鍐欏弽宸ュ崟鍙凤紒"); + txt_workNo.Focus(); + return; + } + if (!string.IsNullOrEmpty(_txt_fmrmode)) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("涓嶉渶瑕侀�夋嫨鍙嶅伐宸ュ簭锛�"); + txt_fmrmode.Focus(); + return; + } + } + }; + + var _obj = new + { + guid = UtilityHelper.ToGuid(lbGuid.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,//鐢熶骇宸ュ崟 + kbList = _kbList, + fngHandle = _txt_fngHandle, + fzrId = _txt_fzrId, + workNo = _txt_workNo, + fmrmode = _txt_fmrmode, + zrType = _txt_zrType, + 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 == _strTag) + { + 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.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) + { + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + + /// <summary> + /// + /// </summary> + /// <param name="curPage">绗嚑椤�</param> + /// <param name="pageSize">姣忛〉鍑犳潯</param> + private void getPageList(int curPage) + { + gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + // _sbSqlWhere += " and isnull(fsubmit,0)=0"; + PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "release_no", "asc", "", _sbSqlWhere.ToString()); + string json = JsonConvert.SerializeObject(pgq); + try + { + string strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json); + ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); + 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(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1); + } + 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) + { + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + private void getModel(string strGuid, string guid5) + { + bool isEdit = false; + if (toolBarMenu1.currentAction == "add") return; + if (toolBarMenu1.currentAction == "edit") isEdit = true; + if (string.IsNullOrEmpty(strGuid)) + { + ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + return; + } + 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; + lbGuid.Text = strGuid; + List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); + gvList.Add(gvMx1); + UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList); + setEable(isEdit); + JObject _job = JObject.Parse(strJson); + JArray array = new JArray(); + foreach (var a in _job["rtnData"]["list5"]) + { + array.Add(a); + } + DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString()); + if (dt.Rows.Count > 0) + { + gcMx1.DataSource = null; + gcMx1.BindingContext = new BindingContext(); + gcMx1.DataSource = dt; + gcMx1.ForceInitialize(); + gvMx1.BestFitColumns(); + ucUpFileList1.pGuid = lbGuid.Text.Trim(); + ucChouJianList1.pGuid = lbGuid.Text.Trim(); + if (guid5.Length > 10) + { + int rowHandle = 0; + rowHandle = gvMx1.LocateByValue(1, gvMx1.Columns["guid"], guid5); + if (rowHandle < 0) + rowHandle = 0; + gvMx1.FocusedRowHandle = rowHandle + 1; + } + } + else + { + Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); + } + } + else + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + } + catch (Exception ex) + { + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + + /// <summary> + /// 閫夐」鍗″垏鎹� + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void XtraTabControl2_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e) + { + if (e.Page.Name == "tabMxPage2") + { + ucChouJianList1.getList14(); + + } + if (e.Page.Name == "tabMxPage3") + { + ucUpFileList1.getFileList(); + } + } + /// <summary> + /// 鏍规嵁妫�楠岄」鐩鍙栨娊鏍风粨鏋� + /// </summary> + /// <param name="guid5"></param> + private void getList12(string guid5) + { + var _obj = new + { + parentGuid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓 + guid = UtilityHelper.ToGuid(guid5), //涓诲缓 + }; + try + { + var strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel12", JsonConvert.SerializeObject(_obj)); + JObject _job = JObject.Parse(strJson); + JArray array = new JArray(); + foreach (var a in _job["rtnData"]["list"]) + { + array.Add(a); + } + DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString()); + gcMx2.BindingContext = new BindingContext(); + gcMx2.DataSource = dt; + gcMx2.ForceInitialize(); + gvMx2.BestFitColumns(); + JArray array1 = new JArray(); + foreach (var a in _job["rtnData"]["list2"]) + { + array1.Add(a); + } + DataTable dt1 = JsonConvert.DeserializeObject<DataTable>(array1.ToString()); + gcMx3.BindingContext = new BindingContext(); + gcMx3.DataSource = dt1; + gcMx3.ForceInitialize(); + gvMx3.BestFitColumns(); + } + catch (Exception ex) + { + MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + + private void setEable(bool bl) + { + txtJianYan.ReadOnly = !bl; + btnLoad.Enabled = bl; + ucChouJianList1.IsReadOnly(!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