新框架PC前端标准版(祈禧6月初版本)
lg
2025-11-20 fbe33a615f1c4e798a0f8e58163e68c3ce789614
DevApp/Gs.DevApp/DevFrm/WW/WwBlcl.cs
@@ -1,5 +1,4 @@
using DevExpress.XtraEditors;
using Gs.DevApp.Entity;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
using Newtonsoft.Json;
@@ -9,15 +8,14 @@
using System.Data;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Gs.DevApp.DevFrm.WW
{
    public partial class WwBlcl : DevExpress.XtraEditors.XtraUserControl
    {
        string _ucCk = "";//仓库
        string _webServiceName = "WWBlManager/";
        List<FilterEntity> _filterList = new List<FilterEntity>();
        public string strType = "";
        string _ucGys = "";//供应商
        public WwBlcl(string _strType)
        {
            InitializeComponent();
@@ -39,6 +37,8 @@
            toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
            toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
            toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
            toolBarMenu1.btnPrintClick += ToolBarMenu1_btnPrintClick;
            toolBarMenu1.btnWjClick += ToolBarMenu1_btnWjClick;
            this.toolBarMenu1.getXmlConfig();
            Form parentForm = this.FindForm();
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
@@ -55,44 +55,63 @@
            }, lbGuid);
            getPageList(1);
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            //设置组织
            this.txt_orgId.EditChanged += (s, e) =>
            txt_orgId.EditChanged += (s, e) =>
            {
                string orgdId = txt_orgId.GetId();
                if (string.IsNullOrEmpty(orgdId)) return;
                txt_bl010.getSuppler(orgdId, _ucCk);
                var orgId = txt_orgId.GetId();
                if (string.IsNullOrEmpty(orgId))
                    return;
                txt_wwGys.getSuppler(orgId, _ucGys);
            };
            //选择委外工单
            this.txt_aboutGuid.EditChanged += (s, e) =>
            //选择需要入库的明细
            btnSelect.Click += (s, e) =>
            {
                string strGdId = txt_aboutGuid.GetId();
                if (string.IsNullOrEmpty(strGdId)) return;
                txt_bl002.Text = txt_aboutGuid.GetPrdNo();
                txt_bl014.Text = txt_aboutGuid.GetPrdName();
                txt_bl015.Text = txt_aboutGuid.GetPrdModel();
                txt_bl013.Text = txt_aboutGuid.GetRwd();
                var _obj = new
                if (string.IsNullOrEmpty(txt_wwGys.GetId()))
                {
                    currentPage = 1,
                    everyPageSize = 999999,
                    sortName = "",
                    keyWhere = "",
                    inP1 = strGdId
                };
                var json = JsonConvert.SerializeObject(_obj);
                    MsgHelper.ShowError("请选择供应商!");
                    txt_wwGys.Focus();
                    return;
                }
                var frm = new UcWwBlclSelectAll(txt_orgId.GetId(), txt_wwGys.GetId());
                //赋值给明细表
                frm.UpdateParent += (ss, ee) =>
                {
                try
                {
                    var strReturn = UtilityHelper.HttpPost("", "WWBlManager/SelectFormMx", json);
                    var rtn = UtilityHelper.ReturnToTablePage(strReturn);
                    var dt = rtn.rtnData.list;
                    this.repositoryItemSearchLookUpEdit1.DataSource = dt;
                        var lst = ee.DynamicList;
                        DataTable _Table = (DataTable)gcMx1.DataSource;
                        int idx = 1;
                        foreach (dynamic dym in lst)
                        {
                            DataRow _row = _Table.NewRow();
                            _row["bld002"] = dym.itemNo;//物料编号
                            _row["bld003"] = dym.itemName;//物料名称
                            _row["bld004"] = dym.itemModel;//规格型号
                            _row["dabGuid"] = dym.dabGuid;
                            _row["xlsl"] = dym.dab006;
                            _row["bld008"] = dym.dab007;//已领用量
                            _row["bld009"] = dym.dwName;//单位
                            _row["bld001"] = dym.bld001;//工单号
                            _Table.Rows.Add(_row);
                            idx++;
                        }
                        gcMx1.BindingContext = new BindingContext();
                        gcMx1.DataSource = _Table;
                        gcMx1.ForceInitialize();
                        gvMx1.CloseEditor();
                        gvMx1.PostEditor();
                        gvMx1.UpdateCurrentRow();
                        gvMx1.BestFitColumns();
                }
                catch (Exception ex)
                {
                    MsgHelper.Warning("提示:" + ex.Message);
                        MessageBox.Show(ex.Message);
                }
            };
                frm.ShowDialog();
            };
        }
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        {
            _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
@@ -134,7 +153,6 @@
                parentForm = this.Parent as Form;
            else
                parentForm = this.Parent.Parent as Form;
            gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
            gridView1.ActiveFilter.Clear();
            gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
@@ -175,7 +193,7 @@
                lbGuid, txt_blNo, gridView1, "blNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
                MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定删除吗?"))
@@ -193,20 +211,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>
@@ -242,7 +260,7 @@
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_blNo, gridView1, "blNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                ToolBox.MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
@@ -256,6 +274,9 @@
                gvList.Add(gvMx1);
                UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList);
            }
            //2025/07/12加上修改状态下不能修改
            txt_orgId.IsReadly = true;
            txt_wwGys.IsReadly = true;
        }
        /// <summary>
        /// 新增事件
@@ -270,7 +291,8 @@
            gridViews.Add(gvMx1);
            UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews);
            Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
            //增加时,默认组织
            string deftOrg = UtilityHelper.GetFirstOrg(txt_orgId);
        }
        /// <summary>
        /// 保存事件
@@ -280,41 +302,31 @@
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            string inGdId = txt_aboutGuid.GetId();//工单号
            string inCkId = txt_bl010.GetId();//发料仓
            string inFlOrg = txt_orgId.GetId();//发料组织
            if (string.IsNullOrEmpty(inFlOrg))
            if (string.IsNullOrEmpty(txt_bl017.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择发料组织!");
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择单据类型!");
                txt_bl017.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_orgId.GetId()))
            {
                MsgHelper.ShowError("请选择组织!");
                txt_orgId.Focus();
                return;
            }
            if (string.IsNullOrEmpty(inGdId))
            if (string.IsNullOrEmpty(txt_wwGys.GetId()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择工单!");
                txt_aboutGuid.Focus();
                return;
            }
            if (string.IsNullOrEmpty(inCkId))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择仓库!");
                txt_bl010.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_bl017.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择单据类型!");
                txt_bl017.Focus();
                MsgHelper.ShowError("请选择供应商!");
                txt_wwGys.Focus();
                return;
            }
            var _obj = new
            {
                guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建
                inOrgId = inFlOrg,//发料组织
                inGdId = inGdId,//工单号
                inCkId = inCkId,//仓库
                inYy = txt_bl007.Text.Trim(),//原因
                inType = txt_bl017.Text.Trim(),//出库类别
                inOrgId = txt_orgId.GetId(),
                inWwGys = txt_wwGys.GetId(),
                list = new List<dynamic>(),
            };
            gvMx1.CloseEditor();
@@ -351,9 +363,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_blNo.Text = _rtn.rtnData.outNo;
                    toolBarMenu1.isSetBtn = true;
@@ -363,10 +375,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);
            }
        }
@@ -377,8 +391,12 @@
        /// <param name="pageSize">每页几条</param>
        private void getPageList(int curPage)
        {
            gcMain1.DataSource = null;var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            _sbSqlWhere += " and a.bl008='" + strType + "'";
            gcMain1.DataSource = null;
            System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
            _sbSqlWhere.Append("  and a.bl008='" + strType + "'");
            _sbSqlWhere.Append(" and a.org_id 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
@@ -421,7 +439,7 @@
            if (toolBarMenu1.currentAction == "edit") isEdit = true;
            if (string.IsNullOrEmpty(strGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                ToolBox.MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            var _obj = new
@@ -435,12 +453,12 @@
                if (_rtn.rtnCode > 0)
                {
                    dynamic dy = _rtn.rtnData;
                    _ucCk = dy.bl010;
                    _ucGys = dy.wwGys;
                    lbGuid.Text = strGuid;
                    List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                    gvList.Add(gvMx1);
                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList);
                    _ucCk = "";
                    _ucGys = "";
                    JObject _job = JObject.Parse(strJson);
                    JArray array = new JArray();
                    foreach (var a in _job["rtnData"]["list"])
@@ -461,14 +479,24 @@
                    }
                }
                else
                    ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                    ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 完结事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void ToolBarMenu1_btnWjClick(object sender, EventArgs e)
        {
            _toolCk(2);
        }
        /// <summary>
        ///     审核事件
@@ -506,13 +534,17 @@
                case 0:
                    strMsg = "反审核";
                    break;
            };
                case 2:
                    strMsg = "完结";
                    break;
            }
            ;
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_blNo, gridView1, "blNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
                MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定" + strMsg + "吗?"))
@@ -528,9 +560,10 @@
                    _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());
@@ -540,23 +573,13 @@
                    Form parentForm = this.FindForm();
                    UtilityHelper.SetCheckIco(gridView1, "bl018", "bl016", "bl006", picCheckBox, parentForm, _inFieldValue.ToString());
                }
                else
                    MsgHelper.ShowError(_rtn.rtnData.outMsg.ToString());
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
                MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        private void repositoryItemSearchLookUpEdit1_EditValueChanged(object sender, EventArgs e)
        {
            SearchLookUpEdit LookupEdit = sender as SearchLookUpEdit;
            DataRowView SelectedDataRow = (DataRowView)LookupEdit.GetSelectedDataRow();
            gvMx1.SetFocusedRowCellValue("bld002", SelectedDataRow["itemNo"]);
            gvMx1.SetFocusedRowCellValue("bld003", SelectedDataRow["itemName"]);
            gvMx1.SetFocusedRowCellValue("bld004", SelectedDataRow["itemModel"]);
            gvMx1.SetFocusedRowCellValue("dabGuid", SelectedDataRow["dabGuid"]);
            gvMx1.SetFocusedRowCellValue("bld008", SelectedDataRow["dab007"]);//已领用量
            gvMx1.SetFocusedRowCellValue("bld009", SelectedDataRow["dwName"]);//单位
        }
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
@@ -588,16 +611,39 @@
                    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);
                }
            }
        }
        private void ToolBarMenu1_btnPrintClick(object sender, EventArgs e)
        {
            //guidKey, rptParameter
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_blNo, gridView1, "blNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            this.toolBarMenu1.rptParameter = "rpt_WWBL{"
                                               + ""
                                               + "," + ""
                                               + "," + ""
                                               + "," + ""
                                               + "," + ""
                                               + "}";
            this.toolBarMenu1.guidKey = rowGuid;
        }
    }
}