lg
6 天以前 cb9a9c1d0ea86d2f86bdf1c395f430d70b7274e1
DevApp/Gs.DevApp/DevFrm/BasicData/Frm_MesDepot.cs
@@ -1,17 +1,18 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraGrid.Views.Grid;
using Gs.DevApp.DevFrm.Rpt;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
using MES.Service.Modes;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Gs.DevApp.DevFrm
{
@@ -33,20 +34,61 @@
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", (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;
            #region 打印库位码,仅仅打印
            this.ucBtnPrint1.SetPlButton(true);
            this.ucBtnPrint1.SetPrintButton(false);
            //打印批量操作事件
            this.ucBtnPrint1.btnAllClick += (s, e) =>
            {
                string rowGuid = lbGuid.Text.Trim();
                SelectDeleteBar frm = new SelectDeleteBar(rowGuid, "仓位码");
                string strCodeList = "";
                frm.UpdateParent += (ss, ee) =>
                {
                    strCodeList = ee.StringSingle;
                };
                frm.ShowDialog();
                if (string.IsNullOrEmpty(strCodeList))
                    return;
                try
                {
                    string rptParameter = "rpt_KW{"
                        + "100" // 重打都是传100
                        + "," + ""
                        + "," + ""
                        + "," + ""
                        + "," + ""
                        + "," + strCodeList
                        + "}";
                    using (Form rpt = new RptPreview(rowGuid, rptParameter))
                    {
                        rpt.ShowDialog();
                    }
                    frm.Close();
                }
                catch (Exception ex)
                {
                    MsgHelper.ShowError(ex.Message);
                }
            };
            #endregion
        }
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        {
            Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
            _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
            Task.Delay(100);
            getPageList(1);
        }
@@ -70,7 +112,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();
        }
@@ -159,14 +201,14 @@
            toolBarMenu1.isSetBtn = false;
            if (string.IsNullOrEmpty(txt_depotCode.Text.Trim()))
            {
                MsgHelper.Warning("仓库编码不能为空!");
                MsgHelper.ShowError("仓库编码不能为空!");
                txt_depotCode.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_depotName.Text.Trim()))
            {
                MsgHelper.Warning("仓库名称不能为空!");
                MsgHelper.ShowError("仓库名称不能为空!");
                txt_depotName.Focus();
                return;
            }
@@ -183,11 +225,11 @@
                        MsgHelper.ShowError("编码不能为空!");
                        return;
                    }
                    if (string.IsNullOrEmpty(row["DepotSectionName"].ToString()))
                    {
                        MsgHelper.ShowError("名称不能为空!");
                        return;
                    }
                    //if (string.IsNullOrEmpty(row["DepotSectionName"].ToString()))
                    //{
                    //    MsgHelper.ShowError("名称不能为空!");
                    //    return;
                    //}
                    lst.Add(new MesDepotSections
                    {
                        Guid = UtilityHelper.ToGuid(row["guid"].ToString()),
@@ -199,33 +241,36 @@
            }
            var _obj = new MesDepots
            {
                Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()),
                Guid = lbGuid.Text.Trim(),
                DepotCode = txt_depotCode.Text,
                DepotName = txt_depotName.Text,
                Description = txt_description.Text,
                Remark5 = txt_remark5.TextTxt.Trim(),
                list = lst
            };
            try
            {
                var strJson = UtilityHelper.HttpPost("",
                    _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;
                    toolBarMenu1.isSetBtn = true;
                    var gridViews = new List<GridView>();
                    gridViews.Add(gvMx1);
                    UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gridViews);
                    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);
            }
        }
@@ -235,7 +280,11 @@
        /// <param name="pageSize">每页几条</param>
        private void getPageList(int curPage)
        {
            var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            gcMain1.DataSource = null;
            System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
            _sbSqlWhere.Append(" and a.FSubsidiary in");
            _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
            _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
            var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "org.FNumber asc ,a.depot_code", "asc",
                "", _sbSqlWhere.ToString());
            var json = JsonConvert.SerializeObject(pgq);
@@ -364,5 +413,6 @@
                }
            }
        }
    }
}