From df7d830e97493f17aeea96aa262b2148d38b38d8 Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期四, 11 九月 2025 21:41:46 +0800
Subject: [PATCH] bug

---
 DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs |  113 ++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 92 insertions(+), 21 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs b/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs
index 0d34401..30cce3a 100644
--- a/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs
@@ -30,6 +30,7 @@
             toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
             toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
             toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
+            toolBarMenu1.btnPrintClick += ToolBarMenu1_btnPrintClick;
             this.toolBarMenu1.getXmlConfig();
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "status", "", (value) =>
@@ -53,7 +54,6 @@
                     return;
                 txt_suppId.getSuppler(orgId, _ucGys);
                 txt_fPurchaseDeptId.getSuppler(orgId, _ucBm);
-                // txt_fPurchaserId.getSuppler();
             };
             //閫夋嫨闇�瑕佺殑鏄庣粏
             btnSelect.Click += (s, e) =>
@@ -104,6 +104,46 @@
                     var frm2 = new SelectMesCgthSqLink(this.txt_thOrgId.GetId());
                     frm2.UpdateParent += (ss, ee) =>
                     {
+                        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; //搴撳瓨鏁伴噺
+                                _row["depotId"] = dym.depotId; //搴撳瓨鏁伴噺
+                                _row["depotName"] = dym.depotName; //搴撳瓨鏁伴噺
+                                _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;
@@ -111,10 +151,7 @@
             };
             //婧愬崟浜嬩欢
             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;
+            setSrm();
             txt_fHasLinkRad.SelectedIndexChanged += (s, e) =>
             {
                 setSrm();
@@ -138,6 +175,27 @@
             (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                 lbGuid, txt_billNo, gridView1);
             toolBarMenu1.guidKey = rowGuid;
+        }
+        private void ToolBarMenu1_btnPrintClick(object sender, EventArgs e)
+        {
+            //guidKey, rptParameter
+            string rowGuid, rowName;
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
+                lbGuid, txt_billNo, gridView1, "billNo");
+            if (string.IsNullOrEmpty(rowGuid))
+            {
+                MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                return;
+            }
+            this.toolBarMenu1.rptParameter = "rpt_CGTH{"
+                                               + ""
+                                               + "," + ""
+                                               + "," + ""
+                                               + "," + ""
+                                               + "," + ""
+                                               + "}";
+            this.toolBarMenu1.guidKey = rowGuid;
+
         }
         /// <summary>
         /// 鍒嗛〉浜嬩欢
@@ -214,7 +272,7 @@
                 lbGuid, txt_billNo, gridView1, "billNo");
             if (string.IsNullOrEmpty(rowGuid))
             {
-                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鍒犻櫎鍚楋紵"))
@@ -232,18 +290,20 @@
                 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);
                 }
+                else
 
-                MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                    MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
             }
             catch (Exception ex)
             {
-                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
 
         }
@@ -283,7 +343,7 @@
                 lbGuid, txt_billNo, gridView1);
             if (string.IsNullOrEmpty(rowGuid))
             {
-                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
@@ -305,7 +365,7 @@
             txt_fRequireOrgId.IsReadly = true;
             txt_fOwnerIdHead.IsReadly = true;
             txt_fPurchaseDeptId.IsReadly = true;
-            txt_fPurchaserId.IsReadly = true;
+            //  txt_fPurchaserId.IsReadly = true;
         }
         /// <summary>
         /// 鏂板浜嬩欢
@@ -339,7 +399,8 @@
             string _xqzz = txt_fRequireOrgId.GetId();//闇�姹傜粍缁�
             string _hz = txt_fOwnerIdHead.GetId();//璐т富
             string _bm = txt_fPurchaseDeptId.GetId();//閮ㄩ棬
-            string _ygbh = txt_fPurchaserId.GetId();//鍛樺伐
+            //string _ygbh = txt_fPurchaserId.GetId();//鍛樺伐
+            string _ygbh = "";
             if (string.IsNullOrEmpty(_orgId))
             {
                 MsgHelper.ShowError("璇烽�夋嫨缁勭粐锛�");
@@ -385,12 +446,12 @@
                     txt_fPurchaseDeptId.Focus();
                     return;
                 }
-                if (string.IsNullOrEmpty(_ygbh))
-                {
-                    MsgHelper.ShowError("璇烽�夋嫨鍛樺伐锛�");
-                    txt_fPurchaserId.Focus();
-                    return;
-                }
+                //if (string.IsNullOrEmpty(_ygbh))
+                //{
+                //    MsgHelper.ShowError("璇烽�夋嫨鍛樺伐锛�");
+                //    txt_fPurchaserId.Focus();
+                //    return;
+                //}
             }
             var _obj = new
             {
@@ -441,6 +502,7 @@
                         Quantity = decimal.Parse(row["sqNum"].ToString()),
                         Bz = row["remark"].ToString(),
                         DepotId = row["depotId"].ToString(),
+                        ItemId = row["itemId"].ToString(),
                     });
                 }
             }
@@ -478,7 +540,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.TH_ORG_ID in");
+            _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
+            _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
             PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "BILL_NO", "asc", "", _sbSqlWhere.ToString());
             string json = JsonConvert.SerializeObject(pgq);
             try
@@ -693,6 +759,9 @@
             var rowhandle = gvMx1.FocusedRowHandle;
             if (rowhandle < 0)
                 return;
+            var dr = gvMx1.GetDataRow(rowhandle);
+            var strItemId = dr["itemId"].ToString();
+
             var strOrgGuid = txt_thOrgId.GetId();
             if (string.IsNullOrEmpty(strOrgGuid))
             {
@@ -700,13 +769,15 @@
                 return;
             }
             ;
-            SelectCk frm = new SelectCk(strOrgGuid);
+            SelectCk frm = new SelectCk(strOrgGuid, strItemId);
             frm.UpdateParent += (ss, ee) =>
             {
                 var lst = new List<dynamic>();
                 lst = ee.DynamicList;
                 gvMx1.SetFocusedRowCellValue("depotName", lst[0].name);
                 gvMx1.SetFocusedRowCellValue("depotId", lst[0].guid);
+                gvMx1.SetFocusedRowCellValue("kcQty", lst[0].kcQty);
+                gvMx1.BestFitColumns();
             };
             frm.ShowDialog();
         }
@@ -719,14 +790,14 @@
             {
                 layItem1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                 layItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
-                layItem3.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;
+                //layItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                 layItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
             }
         }

--
Gitblit v1.9.3