From d1104a30df234dc5e28703ea2d9ea57717005442 Mon Sep 17 00:00:00 2001 From: lu <123456> Date: 星期三, 16 七月 2025 09:57:21 +0800 Subject: [PATCH] bug --- DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs | 303 ++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 244 insertions(+), 59 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs b/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs index 5de6ebb..c27778e 100644 --- a/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs +++ b/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs @@ -15,8 +15,8 @@ { string _webServiceName = "MesCgthSqManager/"; List<FilterEntity> _filterList = new List<FilterEntity>(); - string _ucCk = "";//鍙戞枡浠撳簱 string _ucGys = "";//渚涘簲鍟� + string _ucBm = "";//閮ㄩ棬 public Frm_MesCgthSq() { InitializeComponent(); @@ -35,14 +35,14 @@ Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "status", "", (value) => { Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); - }); + }, tips); Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) => { getModel(value); }, (value) => { getPageList(this.pageBar1.CurrentPage); - }); + }, lbGuid); getPageList(1); pageBar1.PagerEvent += PageBar1_PagerEvent; //閫夋嫨搴撳瓨缁勭粐锛堜粨搴撳拰渚涘簲鍟嗭級 @@ -52,7 +52,8 @@ if (string.IsNullOrEmpty(orgId)) return; txt_suppId.getSuppler(orgId, _ucGys); - txt_depotId.getSuppler(orgId, _ucCk); + txt_fPurchaseDeptId.getSuppler(orgId, _ucBm); + // txt_fPurchaserId.getSuppler(); }; //閫夋嫨闇�瑕佺殑鏄庣粏 btnSelect.Click += (s, e) => @@ -62,36 +63,99 @@ Gs.DevApp.ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨渚涘簲鍟嗭紒"); return; } - var frm = new SelectMesCgthSq(this.txt_suppId.GetId(), this.txt_thOrgId.GetId()); - //璧嬪�肩粰鏄庣粏琛� - frm.UpdateParent += (ss, ee) => + if (txt_fHasLinkRad.SelectedIndex == 0) { - try + var frm = new SelectMesCgthSq(this.txt_suppId.GetId(), this.txt_thOrgId.GetId()); + //璧嬪�肩粰鏄庣粏琛� + frm.UpdateParent += (ss, ee) => { - var lst = new List<string>(); - lst = ee.StringList; - var _obj = lst; - var strReturn = UtilityHelper.HttpPost("", - _webServiceName + "SelectFormTo", - JsonConvert.SerializeObject(_obj)); - var dt = UtilityHelper.ReturnToList(strReturn); - DataTable _newTable = dt.rtnData; - DataTable _oldTable = (DataTable)gcMx1.DataSource; - DataRow[] sourceRows = _newTable.Select(); - for (int i = 0; i < sourceRows.Length; i++) + try { - _oldTable.ImportRow(sourceRows[i]); + var lst = new List<string>(); + lst = ee.StringList; + var _obj = lst; + var strReturn = UtilityHelper.HttpPost("", + _webServiceName + "SelectFormTo", + JsonConvert.SerializeObject(_obj)); + var dt = UtilityHelper.ReturnToList(strReturn); + DataTable _newTable = dt.rtnData; + DataTable _oldTable = (DataTable)gcMx1.DataSource; + DataRow[] sourceRows = _newTable.Select(); + for (int i = 0; i < sourceRows.Length; i++) + { + _oldTable.ImportRow(sourceRows[i]); + } + gcMx1.BindingContext = new BindingContext(); + gcMx1.DataSource = _oldTable; + gcMx1.ForceInitialize(); + gvMx1.BestFitColumns(); + Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1); } - gcMx1.BindingContext = new BindingContext(); - gcMx1.DataSource = _oldTable; - gcMx1.ForceInitialize(); - } - catch (Exception ex) + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + }; + frm.ShowDialog(); + return; + } + if (txt_fHasLinkRad.SelectedIndex == 1) + { + var frm2 = new SelectMesCgthSqLink(this.txt_thOrgId.GetId()); + frm2.UpdateParent += (ss, ee) => { - MessageBox.Show(ex.Message); - } - }; - frm.ShowDialog(); + try + { + var lst = ee.DynamicList; + DataTable _Table = (DataTable)gcMx1.DataSource; + foreach (dynamic dym in lst) + { + DataRow _row = _Table.NewRow(); + _row["id"] = dym.id; + _row["mid"] = dym.mid; + _row["rkmxGuid"] = dym.rkmxGuid;//鍏ュ簱鏄庣粏琛╣uid + _row["cgdh"] = dym.cgdh;//閲囪喘鍗曞彿 + _row["invWorkLine"] = dym.invWorkLine;//琛屽彿, + _row["wlbm"] = dym.wlbm; //鐗╂枡缂栧彿, + _row["wlmc"] = dym.wlmc; //鐗╂枡鍚嶇О, + _row["wlgg"] = dym.wlgg;//瑙勬牸鍨嬪彿, + _row["rksl"] = dym.rksl; //鍏ュ簱鏁伴噺, + _row["dwName"] = dym.dwName; + _row["eid"] = dym.eid; + _row["erpid"] = dym.erpid; + _row["itemId"] = dym.itemId; //鐗╂枡id, + _row["ysNum"] = dym.ysNum;//宸叉壂鏁伴噺 + _row["remark"] = dym.remark; + _row["orderNo"] = dym.orderNo; //搴忓彿 + _row["kcQty"] = dym.kcQty; //搴撳瓨鏁伴噺 + _Table.Rows.Add(_row); + } + gcMx1.BindingContext = new BindingContext(); + gcMx1.DataSource = _Table; + gcMx1.ForceInitialize(); + gvMx1.CloseEditor(); + gvMx1.PostEditor(); + gvMx1.UpdateCurrentRow(); + gvMx1.BestFitColumns(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + }; + frm2.ShowDialog(); + return; + } + }; + //婧愬崟浜嬩欢 + txt_fHasLinkRad.SelectedIndex = 0; + layItem1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + layItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + layItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + layItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + txt_fHasLinkRad.SelectedIndexChanged += (s, e) => + { + setSrm(); }; } private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) @@ -132,7 +196,7 @@ gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; gridView1.ActiveFilter.Clear(); gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; - var frm = new ShowFilter(gridView1.Columns, _filterList); + var frm = new ShowFilter(gridView1.Columns, _filterList, this.GetType().FullName); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); } @@ -271,6 +335,15 @@ gvList.Add(gvMx1); UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList); } + //2025/07/12鍔犱笂淇敼鐘舵�佷笅涓嶈兘淇敼 + setSrm(); + txt_thOrgId.IsReadly = true; + txt_suppId.IsReadly = true; + txt_fHasLinkRad.ReadOnly = true; + txt_fRequireOrgId.IsReadly = true; + txt_fOwnerIdHead.IsReadly = true; + txt_fPurchaseDeptId.IsReadly = true; + txt_fPurchaserId.IsReadly = true; } /// <summary> /// 鏂板浜嬩欢 @@ -285,6 +358,11 @@ gridViews.Add(gvMx1); UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews); Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); + //澧炲姞鏃讹紝榛樿缁勭粐 + string deftOrg = UtilityHelper.GetFirstOrg(txt_thOrgId); + string deftXqOrg = UtilityHelper.GetFirstOrg(txt_fRequireOrgId); + string deftHzOrg = UtilityHelper.GetFirstOrg(txt_fOwnerIdHead); + setSrm(); } /// <summary> /// 淇濆瓨浜嬩欢 @@ -294,48 +372,78 @@ private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e) { toolBarMenu1.isSetBtn = false; - var _ckId = txt_depotId.GetId(); //浠撳簱缂栧彿 depots_code var _gysId = txt_suppId.GetId(); //渚涘簲鍟嗙紪鍙� - string _orgId = txt_thOrgId.GetId(); + string _orgId = txt_thOrgId.GetId();//閫�璐х粍缁� + string _xqzz = txt_fRequireOrgId.GetId();//闇�姹傜粍缁� + string _hz = txt_fOwnerIdHead.GetId();//璐т富 + string _bm = txt_fPurchaseDeptId.GetId();//閮ㄩ棬 + string _ygbh = txt_fPurchaserId.GetId();//鍛樺伐 if (string.IsNullOrEmpty(_orgId)) { - MsgHelper.Warning("璇烽�夋嫨缁勭粐锛�"); + MsgHelper.ShowError("璇烽�夋嫨缁勭粐锛�"); txt_thOrgId.Focus(); return; } if (string.IsNullOrEmpty(_gysId)) { - MsgHelper.Warning("璇烽�夋嫨渚涘簲鍟嗭紒"); + MsgHelper.ShowError("璇烽�夋嫨渚涘簲鍟嗭紒"); txt_suppId.Focus(); - return; - } - if (string.IsNullOrEmpty(_ckId)) - { - MsgHelper.Warning("璇烽�夋嫨浠撳簱锛�"); - txt_depotId.Focus(); return; } if (txt_returnMethod.SelectedIndex <= 0) { - MsgHelper.Warning("璇烽�夋嫨閫�鏂欐柟寮忥紒"); + MsgHelper.ShowError("璇烽�夋嫨閫�鏂欐柟寮忥紒"); txt_returnMethod.Focus(); return; } if (txt_returnType.SelectedIndex <= 0) { - MsgHelper.Warning("璇烽�夋嫨閫�鏂欏師鍥狅紒"); + MsgHelper.ShowError("璇烽�夋嫨閫�鏂欏師鍥狅紒"); txt_returnType.Focus(); return; + } + //鏃犳簮鍗曡鍔犱笂鏉′欢 + if (txt_fHasLinkRad.SelectedIndex == 1) + { + if (string.IsNullOrEmpty(_xqzz)) + { + MsgHelper.ShowError("璇烽�夋嫨闇�姹傜粍缁囷紒"); + txt_fRequireOrgId.Focus(); + return; + } + if (string.IsNullOrEmpty(_hz)) + { + MsgHelper.ShowError("璇烽�夋嫨璐т富锛�"); + txt_fOwnerIdHead.Focus(); + return; + } + if (string.IsNullOrEmpty(_bm)) + { + MsgHelper.ShowError("璇烽�夋嫨閮ㄩ棬锛�"); + txt_fPurchaseDeptId.Focus(); + return; + } + if (string.IsNullOrEmpty(_ygbh)) + { + MsgHelper.ShowError("璇烽�夋嫨鍛樺伐锛�"); + txt_fPurchaserId.Focus(); + return; + } } var _obj = new { Guid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(lbGuid.Text.Trim()), //鍒拌揣鍗曚富閿� Remark = txt_remark.Text.Trim(), //澶囨敞 SuppId = int.Parse(_gysId), //渚涘簲鍟� - DepotId = int.Parse(_ckId),//浠撳簱 FType = txt_isOut.Checked == true ? 1 : 0, //0=閲囪喘锛�1=濮斿 Fmrmode = txt_returnMethod.Text,//閫�鏂欐柟寮� Reason = txt_returnType.Text,//閫�鏂欏師鍥� + thOrgId = _orgId, + fHasLink = txt_fHasLinkRad.SelectedIndex, + fRequireOrgId = _xqzz, + fPurchaseDeptId = _bm, + fPurchaserId = _ygbh, + fOwnerIdHead = _hz, list = new List<dynamic>(), }; gvMx1.CloseEditor(); @@ -358,12 +466,20 @@ MsgHelper.ShowError("鐢宠鏁伴噺涓嶈兘涓虹┖锛�"); return; } + string _depotId = row["depotId"].ToString(); + if (string.IsNullOrEmpty(_depotId)) + { + MsgHelper.ShowError("浠撳簱涓嶈兘涓虹┖锛�"); + return; + } _obj.list.Add(new { Guid = _guid, AboutGuid = UtilityHelper.ToGuid(row["rkmxGuid"].ToString()), Quantity = decimal.Parse(row["sqNum"].ToString()), Bz = row["remark"].ToString(), + DepotId = row["depotId"].ToString(), + ItemId = row["itemId"].ToString(), }); } } @@ -373,9 +489,9 @@ _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj)); var _rtn = UtilityHelper.ReturnToDynamic(strJson); - MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); if (_rtn.rtnCode > 0) { + MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg); lbGuid.Text = _rtn.rtnData.outGuid; txt_billNo.Text = _rtn.rtnData.outNo; toolBarMenu1.isSetBtn = true; @@ -383,11 +499,14 @@ gvList.Add(gvMx1); UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gvList); toolBarMenu1.currentAction = ""; + Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6); } + else + MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } @@ -398,7 +517,7 @@ /// <param name="pageSize">姣忛〉鍑犳潯</param> private void getPageList(int curPage) { - var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); + gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "BILL_NO", "asc", "", _sbSqlWhere.ToString()); string json = JsonConvert.SerializeObject(pgq); try @@ -414,7 +533,7 @@ { gcMain1.DataSource = dt; gcMain1.ForceInitialize(); - gridView1.BestFitColumns(); + gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1); } else UtilityHelper.SetDefaultTable(gcMain1, gridView1); @@ -433,6 +552,10 @@ ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } + /// <summary> + /// 璇诲彇瀹炰綋 + /// </summary> + /// <param name="strGuid"></param> private void getModel(string strGuid) { bool isEdit = false; @@ -440,7 +563,7 @@ if (toolBarMenu1.currentAction == "edit") isEdit = true; if (string.IsNullOrEmpty(strGuid)) { - ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } var _obj = new @@ -455,13 +578,13 @@ { dynamic dy = _rtn.rtnData; _ucGys = dy.suppId; - _ucCk = dy.depotId; + _ucBm = dy.fPurchaseDeptId; 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); _ucGys = ""; - _ucCk = ""; + _ucBm = ""; JObject _job = JObject.Parse(strJson); JArray array = new JArray(); foreach (var a in _job["rtnData"]["list"]) @@ -475,18 +598,20 @@ gcMx1.DataSource = dt; gcMx1.ForceInitialize(); gvMx1.BestFitColumns(); + Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1); } else { Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); } + setSrm(); } else - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } /// <summary> @@ -504,13 +629,14 @@ case 0: strMsg = "鍙嶅鏍�"; break; - }; + } + ; toolBarMenu1.guidKey = ""; string rowGuid, rowName; (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1, "billNo"); if (string.IsNullOrEmpty(rowGuid)) { - MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); + MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�"); return; } if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾" + strMsg + "鍚楋紵")) @@ -526,9 +652,9 @@ _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()); @@ -537,12 +663,20 @@ gridView1.FocusedRowHandle = rowHandle; UtilityHelper.SetCheckIco(gridView1, "status", "checkUser", "checkDate", picCheckBox, this, _inFieldValue.ToString()); } + 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 repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { gvMx1.CloseEditor(); @@ -575,15 +709,66 @@ var _rtn = UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { - if (_rtn.rtnCode > 0) getModel(lbGuid.Text); + getModel(lbGuid.Text); + MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg); } - MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); + else + MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg); } catch (Exception ex) { - MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } } + + /// <summary> + /// 鏌ユ壘浠撳簱 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void rptCk_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) + { + var rowhandle = gvMx1.FocusedRowHandle; + if (rowhandle < 0) + return; + var strOrgGuid = txt_thOrgId.GetId(); + if (string.IsNullOrEmpty(strOrgGuid)) + { + MsgHelper.ShowError("鎻愮ず锛氳鍏堥�夋嫨璋冨嚭缁勭粐锛�"); + return; + } + ; + SelectCk frm = new SelectCk(strOrgGuid); + frm.UpdateParent += (ss, ee) => + { + var lst = new List<dynamic>(); + lst = ee.DynamicList; + gvMx1.SetFocusedRowCellValue("depotName", lst[0].name); + gvMx1.SetFocusedRowCellValue("depotId", lst[0].guid); + }; + frm.ShowDialog(); + } + + + private void setSrm() + { + int ddd = txt_fHasLinkRad.SelectedIndex; + if (ddd == 0) + { + layItem1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + layItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + layItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + layItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + } + else + { + layItem1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; + layItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; + layItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; + layItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; + } + } + } } \ No newline at end of file -- Gitblit v1.9.3