啊鑫
9 天以前 abac1dadf2ba8674a24bb0b91c75de5c7881df72
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 - 供应商id(扩展用)
                + "," + ""  // @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;
            }
        }
    }
}