From abac1dadf2ba8674a24bb0b91c75de5c7881df72 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期二, 09 九月 2025 15:35:41 +0800
Subject: [PATCH] 同步为祈禧的代码

---
 DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesInvItemArn.cs |  220 ++++++++++++++++++++++---------------------------------
 1 files changed, 88 insertions(+), 132 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesInvItemArn.cs b/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesInvItemArn.cs
index 4193d39..24aeadc 100644
--- a/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesInvItemArn.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesInvItemArn.cs
@@ -1,9 +1,7 @@
-using DevExpress.Utils.VisualEffects;
 using DevExpress.XtraEditors;
 using DevExpress.XtraEditors.Controls;
 using DevExpress.XtraGrid.Views.Grid;
 using Gs.DevApp.DevFrm.Rk;
-using Gs.DevApp.DevFrm.Rpt;
 using Gs.DevApp.Entity;
 using Gs.DevApp.ToolBox;
 using Gs.DevApp.UserControl;
@@ -12,7 +10,6 @@
 using System;
 using System.Collections.Generic;
 using System.Data;
-using System.Drawing;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 
@@ -37,19 +34,12 @@
             toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
             toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
             toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
-            toolBarMenu1.btnHbClick += ToolBarMenu1_btnHbClick;
-            toolBarMenu1.btnPrintClick += ToolBarMenu1_btnPrintClick;
-
             this.toolBarMenu1.getXmlConfig();
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
-            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMxL1);
-            
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "fstatus", "", (value) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
-           }, tips, true, (strGuid) => {
-               getModelList(strGuid);
-           });
+           }, tips);
             Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
             {
                 getModel(value);
@@ -94,21 +84,59 @@
                     {
                         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;
+                        string strReturn = "";
+                        ReturnModel<DataTable> dt;
                         DataTable _oldTable = (DataTable)gcMx1.DataSource;
-                        DataRow[] sourceRows = _newTable.Select();
-                        for (int i = 0; i < sourceRows.Length; i++)
+                        #region 杩欐槸Srm鏉ョ殑鍗曞瓙
+                        if (lst == null)
                         {
-                            _oldTable.ImportRow(sourceRows[i]);
+                            string strSrmNo = "";
+                            List<dynamic> lstSrm = new List<dynamic>();
+                            lstSrm = ee.DynamicList;
+                            strSrmNo = lstSrm[0].guid;
+                            txt_paperBillNo.Text = strSrmNo;
+                            var _obj = new
+                            {
+                                inShdh = strSrmNo,
+                                inP1 = "",
+                                inP2 = ""
+                            };
+                            strReturn = UtilityHelper.HttpPost("", _webServiceName + "SelectSrmTo", JsonConvert.SerializeObject(_obj));
+                            dt = UtilityHelper.ReturnToList(strReturn);
+                            //绂佹淇敼鏁伴噺
+                            gvMx1quantity.OptionsColumn.ReadOnly = true;
+                            txt_paperBillNo.ReadOnly = true;
+                            txt_isSrm.Checked = true;
+                            DataTable _newTable = dt.rtnData;
+                            _oldTable = _newTable;
                         }
+                        #endregion
+                        #region 杩欐槸鏅�氱殑鍗�
+                        else
+                        {
+                            txt_paperBillNo.Text = "";
+                            var _obj = lst;
+                            strReturn = UtilityHelper.HttpPost("", _webServiceName + "SelectFormTo", JsonConvert.SerializeObject(_obj));
+                            dt = UtilityHelper.ReturnToList(strReturn);
+                            //淇敼鏁伴噺
+                            gvMx1quantity.OptionsColumn.ReadOnly = false;
+                            txt_paperBillNo.ReadOnly = false;
+                            txt_isSrm.Checked = false;
+                            DataTable _newTable = dt.rtnData;
+                            DataRow[] sourceRows = _newTable.Select();
+                            for (int i = 0; i < sourceRows.Length; i++)
+                            {
+                                _oldTable.ImportRow(sourceRows[i]);
+                            }
+                        }
+                        #endregion
                         gcMx1.BindingContext = new BindingContext();
                         gcMx1.DataSource = _oldTable;
                         gcMx1.ForceInitialize();
                         gvMx1.PostEditor();
                         gvMx1.UpdateCurrentRow();
+                        gvMx1.BestFitColumns();
+                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                     }
                     catch (Exception ex)
                     {
@@ -117,51 +145,9 @@
                 };
                 frm.ShowDialog();
             };
-            ////搴曢儴姹囨�诲惎鐢�
-            //  gvMx1.OptionsView.ShowFooter = true;
-
-            //// 涓烘煇涓�鍒楄缃眰鍜屾眹鎬�
-            //  gvMx1.Columns["quantity"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum;
-            //  gvMx1.Columns["quantity"].SummaryItem.DisplayFormat = "鍚堣: {0}";
-            /////搴曢儴姹囨��
-            UtilityHelper.SetupGridSummary(gvMx1, "quantity");
-            //鎵撳嵃姣斾緥
-            UtilityHelper.SetSimpleGridColor(gridView1, "barcodeProgress", "=100.00%", "Cell", Color.Green);
-            //鍏ュ簱姣斾緥
-            UtilityHelper.SetSimpleGridColor(gridView1, "rkbl", "=100.00%", "Cell", Color.Green);
         }
-        private void ToolBarMenu1_btnPrintClick(object sender, EventArgs e)
-        {
-            string rowGuid, rowName;
-            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1);
-            if (string.IsNullOrEmpty(rowGuid))
-            {
-                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎵撳嵃鐨勫崟鎹紒");
-                return;
-            }
 
-            try
-            {
-                string rptParameter = "rpt_Cgrk{"
-                + rowGuid  // @inOrderGuid - 鍗曟嵁guid
-                + "," + "100"  // @isDesign - 閲嶆墦閮芥槸浼�100
-                + "," + ""  // @in1 - 鍏ュ簱鏃堕棿锛堟墿灞曠敤锛�
-                + "," + ""  // @in2 - 鐗归噰锛堟墿灞曠敤锛�
-                + "," + ""  // @in3 - 渚涘簲鍟唅d锛堟墿灞曠敤锛�
-                + "," + ""  // @in4 - 寮犳暟锛堟墿灞曠敤锛�
-                + "," + ""  // @in5 - 鏁伴噺锛堟墿灞曠敤锛�
-                + "," + ""  // @in6 - 鎵╁睍鐢�
-                + "}";
-                using (Form rpt = new RptPreview(rowGuid, rptParameter))
-                {
-                    rpt.ShowDialog();
-                }
-            }
-            catch (Exception ex)
-            {
-                MsgHelper.ShowError(ex.Message);
-            }
-        }
+
         private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
         {
             _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
@@ -226,11 +212,6 @@
         {
             _toolCk("EditModelSubmitF");
         }
-
-        private void ToolBarMenu1_btnHbClick(object sender, EventArgs e)
-        {
-            _toolCk("EditModelSubmitHb");
-        }
         /// <summary>
         ///     鍙栨秷浜嬩欢
         /// </summary>
@@ -275,12 +256,14 @@
                     else
                         Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2);
                     getPageList(this.pageBar1.CurrentPage);
+                    MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg);
                 }
-                MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                else
+                MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
             }
             catch (Exception ex)
             {
-                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
         }
 
@@ -319,7 +302,7 @@
                 lbGuid, txt_billNo, gridView1);
             if (string.IsNullOrEmpty(rowGuid))
             {
-                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
@@ -333,6 +316,10 @@
                 gvList.Add(gvMx1);
                 UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList);
             }
+            //2025/07/12鍔犱笂淇敼鐘舵�佷笅涓嶈兘淇敼渚涘簲鍟嗗拰缁勭粐srm,绂佺敤
+            setSrm();
+            txt_receiveOrgId.IsReadly = true;
+            txt_suppId.IsReadly = true;
         }
 
         /// <summary>
@@ -348,9 +335,10 @@
             gridViews.Add(gvMx1);
             UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews);
             Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
-
             //澧炲姞鏃讹紝榛樿缁勭粐
             string deftOrg = UtilityHelper.GetFirstOrg(txt_receiveOrgId);
+            txt_isSrm.Checked = false;
+            setSrm();
         }
 
         /// <summary>
@@ -365,13 +353,13 @@
             string _gysId = txt_suppId.GetId(); //渚涘簲鍟嗙紪鍙�
             if (string.IsNullOrEmpty(_orgId))
             {
-                MsgHelper.Warning("璇烽�夋嫨鏀舵枡缁勭粐锛�");
+                MsgHelper.ShowError("璇烽�夋嫨鏀舵枡缁勭粐锛�");
                 txt_receiveOrgId.Focus();
                 return;
             }
             if (string.IsNullOrEmpty(_gysId))
             {
-                MsgHelper.Warning("璇烽�夋嫨渚涘簲鍟嗭紒");
+                MsgHelper.ShowError("璇烽�夋嫨渚涘簲鍟嗭紒");
                 txt_suppId.Focus();
                 return;
             }
@@ -382,6 +370,7 @@
                 Remark = txt_remark.Text.Trim(), //澶囨敞
                 SuppId = _gysId, //渚涘簲鍟�
                 OrgId = _orgId,
+                IsSrm = (txt_isSrm.Checked ? 1 : 0),
                 list = new List<dynamic>(),
             };
             gvMx1.CloseEditor();
@@ -399,7 +388,6 @@
                 {
                     Guid? _guid = UtilityHelper.ToGuid(row["guid"].ToString());
                     string _msl = row["quantity"].ToString();
-                    
                     if (string.IsNullOrEmpty(_msl))
                     {
                         MsgHelper.ShowError("鏁伴噺涓嶈兘涓虹┖锛�");
@@ -411,8 +399,7 @@
                         AboutGuid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(row["aboutGuid"].ToString()),
                         ItemId = int.Parse(row["itemId"].ToString()),
                         Quantity = decimal.Parse(row["quantity"].ToString()),
-                        
-                        UrgentFlag = Gs.DevApp.ToolBox.UtilityHelper.ToBit(row["urgentFlag"].ToString()),
+                        UrgentFlag = (row["urgentFlagTxt"].ToString().Replace(":","").Replace("鏅��", "").Replace("鎬ユ枡", "").Replace("涓�鑸�", "")),
                         Remark = row["memo"].ToString(),
                     });
                 }
@@ -423,9 +410,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;
@@ -433,19 +420,14 @@
                     gvList.Add(gvMx1);
                     UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false);
                     toolBarMenu1.currentAction = "";
-                    // 銆愭柊澧炲埛鏂伴�昏緫銆戜繚瀛樻垚鍔熷悗绔嬪嵆鍒锋柊褰撳墠妯″瀷鏁版嵁鍜屽垪琛�
-                    // 鍒锋柊褰撳墠鍗曟嵁璇︽儏
-                    getModel(lbGuid.Text.Trim());
-                    // 鍒锋柊鍒楄〃椤垫暟鎹�
-                    getPageList(this.pageBar1.CurrentPage);
-
-                    // 璺宠浆鍒版煡鐪嬬粨鏋滈〉闈�
                     Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
                 }
+                else
+                    MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
             }
             catch (Exception ex)
             {
-                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
         }
 
@@ -455,7 +437,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.ReceiveOrgId in");
+            _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
+            _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
             var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date",
                 "asc", "", _sbSqlWhere.ToString());
             var json = JsonConvert.SerializeObject(pgq);
@@ -668,7 +654,6 @@
                     _webServiceName + _meth,
                     JsonConvert.SerializeObject(_obj));
                 var _rtn = UtilityHelper.ReturnToDynamic(strJson);
-
                 if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                 {
                     MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnData.outMsg);
@@ -678,8 +663,7 @@
                     }
                     int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
                     gridView1.FocusedRowHandle = rowHandle;
-                    //鍒ゆ柇瀹℃牳鍚庢槸鍚﹀彉涓虹孩绔狅紙1锛氱孩绔犲凡瀹℃牳 锛�-1 榛戠珷鏈鏍革級
-                    int _inFieldValue = ((_meth == "EditModelSubmit" || _meth == "EditModelSubmitHb") ? 1 : -1);
+                    int _inFieldValue = (_meth == "EditModelSubmit" ? 1 : -1);
                     UtilityHelper.SetCheckIco(gridView1, "fstatus", "checkUser", "checkDate", picCheckBox, this, _inFieldValue.ToString());
                 }
                 else
@@ -707,55 +691,27 @@
             frm.ShowDialog();
         }
 
-        /// <summary>
-        ///  鏂板鏂规硶锛氬垪琛ㄦ樉绀�   
-        /// </summary>
-        /// <param name="strGuid">涓昏〃id</param>
-
-        private void getModelList(string strGuid)
+        private void setSrm()
         {
-            gcMxL1.DataSource = null;
-       
-
-            var _obj = new
+            bool isSrm = (txt_isSrm.Checked);
+            if (isSrm == true)
             {
-                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;
-
-                    JArray array1 = new JArray();
-                    foreach (var a in dy["list"])
-                    {
-                        array1.Add(a);
-                    }
-                    DataTable dt1 = JsonConvert.DeserializeObject<DataTable>(array1.ToString());
-                    if (dt1.Rows.Count > 0)
-                    {
-                        gcMxL1.BindingContext = new BindingContext();
-                        gcMxL1.DataSource = dt1;
-                        gcMxL1.ForceInitialize();
-                        gvMxL1.BestFitColumns();
-                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMxL1);
-                    }
-                    else
-                    {
-                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMxL1, gvMxL1);
-                    }
-                }
-                else
-                    ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                gvMx1quantity.OptionsColumn.ReadOnly = true;
+                txt_paperBillNo.ReadOnly = true;
+                txt_isSrm.Checked = true;
+                txt_receiveOrgId.IsReadly = true;
+                txt_suppId.IsReadly = true;
+                btnSelect.Enabled = false;
             }
-            catch (Exception ex)
+            else
             {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                gvMx1quantity.OptionsColumn.ReadOnly = false;
+                txt_paperBillNo.ReadOnly = false;
+                txt_isSrm.Checked = false;
+                txt_receiveOrgId.IsReadly = false;
+                txt_suppId.IsReadly = false;
+                btnSelect.Enabled = true;
             }
         }
-
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3