From 200b60701072ff421156d7fd3c4fecf1a3b5bdb3 Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期日, 07 九月 2025 10:58:58 +0800
Subject: [PATCH] Merge branch 'master' of http://git.gs-mes.com:8080/r/~tjx/GsMesClient

---
 DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesDbck.cs |  200 +++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 164 insertions(+), 36 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesDbck.cs b/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesDbck.cs
index 646d817..459dfc5 100644
--- a/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesDbck.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesDbck.cs
@@ -7,6 +7,7 @@
 using System;
 using System.Collections.Generic;
 using System.Data;
+using System.IO;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 
@@ -29,12 +30,13 @@
             toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
             toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
             toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
+            toolBarMenu1.btnShouHouChkClick += ToolBarMenu1_btnShouHouChkClick;
+            toolBarMenu1.btnShouHouFchkClick += ToolBarMenu1_btnShouHouFchkClick;
             this.toolBarMenu1.getXmlConfig();
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "chkStatus", "", (value) =>
             {
                 Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
-
             }, tips);
             Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
             {
@@ -67,7 +69,7 @@
                 }
                 catch (Exception ex)
                 {
-                    MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                    MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
                 }
             };
 
@@ -76,7 +78,6 @@
                 string _orgId = txt_fapporgid.GetId();
                 string _orgName = txt_fapporgid.GetName();
                 if (string.IsNullOrEmpty(_orgId)) return;
-
                 gvMx1.SetFocusedRowCellValue("dcOrg", _orgName);
                 gvMx1.SetFocusedRowCellValue("dcOrgGuid", _orgId);
                 gvMx1.SetFocusedRowCellValue("drOrg", _orgName);
@@ -86,6 +87,73 @@
                 gvMx1.SetFocusedRowCellValue("dcHz", _orgName);
                 gvMx1.SetFocusedRowCellValue("dcHzGuid", _orgId);
             };
+
+            #region 2025-08-27 澶嶅埗beg
+            btnCopyXls.Click += (s, e) =>
+            {
+                string kcZz = txt_fapporgid.GetId();
+                if (string.IsNullOrEmpty(kcZz))
+                {
+                    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨鐢宠缁勭粐鍚庢墠鑳戒娇鐢ㄥ鍒跺姛鑳斤紒");
+                    txt_fapporgid.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
+                        {
+                            string _orgId = txt_fapporgid.GetId();
+                            string _orgName = txt_fapporgid.GetName();
+                            var lst = ee.DynamicList;
+                            DataTable _Table = (DataTable)gcMx1.DataSource;
+                            foreach (dynamic dym in lst)
+                            {
+                                DataRow _row = _Table.NewRow();
+                                _row["itemNo"] = dym.itemNo;
+                                _row["itemName"] = dym.itemName;
+                                _row["itemModel"] = dym.itemModel;
+                                _row["itemUnit"] = dym.dwName;
+                                _row["itemId"] = dym.itemId;
+                                _row["shNum"] = dym.sl;
+                                _row["remark"] = dym.bz;
+                                if (!string.IsNullOrEmpty(_orgId))
+                                {
+                                    _row["dcOrg"] = _orgName;
+                                    _row["dcOrgGuid"] = _orgId;
+                                    _row["drOrg"] = _orgName;
+                                    _row["drOrgGuid"] = _orgId;
+                                    _row["drHz"] = _orgName;
+                                    _row["drHzGuid"] = _orgId;
+                                    _row["dcHz"] = _orgName;
+                                    _row["dcHzGuid"] = _orgId;
+                                }
+                                _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)
         {
@@ -167,19 +235,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);
                 }
-                MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                else
+                    MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
             }
             catch (Exception ex)
             {
-                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
-
         }
 
         /// <summary>
@@ -229,6 +298,11 @@
                 gvList.Add(gvMx1);
                 UtilityHelper.ChangeEnableByControl(splitMx1.Panel1.Controls, true, gvList);
             }
+            //2025/07/12鍔犱笂淇敼鐘舵�佷笅涓嶈兘淇敼渚涘簲鍟嗗拰缁勭粐srm,绂佺敤
+            txt_fapporgid.IsReadly = true;
+            txt_ftranstype.ReadOnly = true;
+            txt_fOwnerTypeIdHead.ReadOnly = true;
+            txt_fOwnerTypeInIdHead.ReadOnly = true;
         }
         /// <summary>
         /// 鏂板浜嬩欢
@@ -243,6 +317,9 @@
             gridViews.Add(gvMx1);
             UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews);
             Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
+            //澧炲姞鏃讹紝榛樿缁勭粐
+            string deftOrg = UtilityHelper.GetFirstOrg(txt_fapporgid);
+
         }
         /// <summary>
         /// 淇濆瓨浜嬩欢
@@ -267,13 +344,13 @@
             //}
             if (txt_fTransferDirect.SelectedIndex <= 0)
             {
-                Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨璋冩嫧鏂瑰悜锛�");
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨璋冩嫧鏂瑰悜锛�");
                 txt_fTransferDirect.Focus();
                 return;
             }
             if (string.IsNullOrEmpty(sqOrg))
             {
-                Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨鐢宠缁勭粐锛�");
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鐢宠缁勭粐锛�");
                 txt_fapporgid.Focus();
                 return;
             }
@@ -371,9 +448,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_fBillNo.Text = _rtn.rtnData.outNo;
                     toolBarMenu1.isSetBtn = true;
@@ -383,10 +460,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);
             }
         }
         /// <summary>
@@ -409,7 +488,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.FAPPORGID in");
+            _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
+            _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
             PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date", "asc", "", _sbSqlWhere.ToString());
             string json = JsonConvert.SerializeObject(pgq);
             try
@@ -452,7 +535,7 @@
             if (toolBarMenu1.currentAction == "edit") isEdit = true;
             if (string.IsNullOrEmpty(strGuid))
             {
-                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             var _obj = new
@@ -491,11 +574,11 @@
                     }
                 }
                 else
-                    ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                    ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
             }
             catch (Exception ex)
             {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
         }
 
@@ -520,7 +603,27 @@
         {
             _toolCk(0);
         }
+        /// <summary>
+        /// 鍞悗瀹℃牳
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        /// <exception cref="NotImplementedException"></exception>
+        private void ToolBarMenu1_btnShouHouChkClick(object sender, EventArgs e)
+        {
+            _toolCk(20);
+        }
 
+        /// <summary>
+        /// 鍞悗鍙嶅鏍�
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        /// <exception cref="NotImplementedException"></exception>
+        private void ToolBarMenu1_btnShouHouFchkClick(object sender, EventArgs e)
+        {
+            _toolCk(21);
+        }
         /// <summary>
         /// 宸ュ叿鏉′簨浠�
         /// </summary>
@@ -536,13 +639,20 @@
                 case 0:
                     strMsg = "鍙嶅鏍�";
                     break;
-            };
+                case 20:
+                    strMsg = "鍞悗瀹℃牳";
+                    break;
+                case 21:
+                    strMsg = "鍞悗鍙嶅鏍�";
+                    break;
+            }
+            ;
             toolBarMenu1.guidKey = "";
             string rowGuid, rowName;
             (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_fBillNo, gridView1, "FBillNo");
             if (string.IsNullOrEmpty(rowGuid))
             {
-                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾" + strMsg + "鍚楋紵"))
@@ -558,21 +668,31 @@
                     _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());
+                        int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
+                        gridView1.FocusedRowHandle = rowHandle;
+                        if (_inFieldValue <= 1) 
+                        UtilityHelper.SetCheckIco(gridView1, "chkStatus", "FAPPROVEBY", "FAPPROVEDATE", picCheckBox, this, _inFieldValue.ToString());
                     }
-                    int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
-                    gridView1.FocusedRowHandle = rowHandle;
-                    UtilityHelper.SetCheckIco(gridView1, "chkStatus", "FAPPROVEBY", "FAPPROVEDATE", picCheckBox, this, _inFieldValue.ToString());
+                    else
+                    {
+                        //娉ㄦ剰锛岃繖閲屽拰鍏跺畠椤甸潰鏈夌偣涓嶄竴鏍�
+                        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);
             }
         }
 
@@ -630,13 +750,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);
                 }
             }
         }
@@ -676,9 +798,10 @@
             var strOrgGuid = dr["dcOrgGuid"].ToString();
             if (string.IsNullOrEmpty(strOrgGuid))
             {
-                MsgHelper.Warning("鎻愮ず锛氳鍏堥�夋嫨璋冨嚭缁勭粐锛�");
+                MsgHelper.ShowError("鎻愮ず锛氳鍏堥�夋嫨璋冨嚭缁勭粐锛�");
                 return;
-            };
+            }
+            ;
             SelectCk frm = new SelectCk(strOrgGuid);
             frm.UpdateParent += (ss, ee) =>
             {
@@ -702,15 +825,17 @@
             var dr = gvMx1.GetDataRow(rowhandle);
             if (dr["dcCkGuid"] == null)
             {
-                MsgHelper.Warning("鎻愮ず锛氳鍏堥�夋嫨璋冨嚭浠撳簱锛�");
+                MsgHelper.ShowError("鎻愮ず锛氳鍏堥�夋嫨璋冨嚭浠撳簱锛�");
                 return;
-            };
+            }
+            ;
             var strCkGuid = dr["dcCkGuid"].ToString();
             if (string.IsNullOrEmpty(strCkGuid))
             {
-                MsgHelper.Warning("鎻愮ず锛氳鍏堥�夋嫨璋冨嚭浠撳簱锛�");
+                MsgHelper.ShowError("鎻愮ず锛氳鍏堥�夋嫨璋冨嚭浠撳簱锛�");
                 return;
-            };
+            }
+            ;
             SelectCw frm = new SelectCw(strCkGuid);
             frm.UpdateParent += (ss, ee) =>
             {
@@ -756,9 +881,10 @@
             var strOrgGuid = dr["drOrgGuid"].ToString();
             if (string.IsNullOrEmpty(strOrgGuid))
             {
-                MsgHelper.Warning("鎻愮ず锛氳鍏堥�夋嫨璋冨叆缁勭粐锛�");
+                MsgHelper.ShowError("鎻愮ず锛氳鍏堥�夋嫨璋冨叆缁勭粐锛�");
                 return;
-            };
+            }
+            ;
             SelectCk frm = new SelectCk(strOrgGuid);
             frm.UpdateParent += (ss, ee) =>
             {
@@ -782,15 +908,17 @@
             var dr = gvMx1.GetDataRow(rowhandle);
             if (dr["drCkGuid"] == null)
             {
-                MsgHelper.Warning("鎻愮ず锛氳鍏堥�夋嫨璋冨叆浠撳簱锛�");
+                MsgHelper.ShowError("鎻愮ず锛氳鍏堥�夋嫨璋冨叆浠撳簱锛�");
                 return;
-            };
+            }
+            ;
             var strCkGuid = dr["drCkGuid"].ToString();
             if (string.IsNullOrEmpty(strCkGuid))
             {
-                MsgHelper.Warning("鎻愮ず锛氳鍏堥�夋嫨璋冨叆浠撳簱锛�");
+                MsgHelper.ShowError("鎻愮ず锛氳鍏堥�夋嫨璋冨叆浠撳簱锛�");
                 return;
-            };
+            }
+            ;
             SelectCw frm = new SelectCw(strCkGuid);
             frm.UpdateParent += (ss, ee) =>
             {

--
Gitblit v1.9.3