wbc
6 天以前 e4c662a16cbecd88e64bfeea677ef2a0c97ab771
DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs
@@ -33,6 +33,12 @@
            toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
            this.toolBarMenu1.getXmlConfig();
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", (value) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
            }, tips, true, (strGuid) => {
                getModelList(strGuid);
            });
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "fstatus", "", (value) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
@@ -44,8 +50,12 @@
            {
                getPageList(this.pageBar1.CurrentPage);
            }, lbGuid);
            getPageList(1);
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            //选存组织(变明细中的物料和车间)
            txt_erpSczz.EditChanged += (s, e) =>
            {
@@ -53,6 +63,7 @@
                if (string.IsNullOrEmpty(_orgId))
                    return;
                txt_pba013.getSuppler(_orgId, _cjBm);
                _getListDepot(_orgId);
            };
            // 选择车间(变明细中产线)
            txt_pba013.EditChanged += (s, e) =>
@@ -88,6 +99,10 @@
                        {
                            _oldTable.ImportRow(sourceRows[i]);
                        }
                        // 确保自动调拨相关列存在,便于下拉赋值
                        if (!_oldTable.Columns.Contains("dbDepotId")) _oldTable.Columns.Add("dbDepotId", typeof(string));
                        if (!_oldTable.Columns.Contains("depotName")) _oldTable.Columns.Add("depotName", typeof(string));
                        if (!_oldTable.Columns.Contains("dbDepotSections")) _oldTable.Columns.Add("dbDepotSections", typeof(string));
                        gcMx1.BindingContext = new BindingContext();
                        gcMx1.DataSource = _oldTable;
                        gvMx1.CloseEditor();
@@ -99,11 +114,33 @@
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        MsgHelper.ShowError("提示:" + ex.Message);
                    }
                };
                frm.ShowDialog();
            };
            gvMx1.ShowingEditor += (s, e) =>
            {
                if (gvMx1.FocusedColumn == gvMx1DepotSections)
                {
                    string depotId = gvMx1.GetRowCellValue(gvMx1.FocusedRowHandle, "dbDepotId")?.ToString();
                    _getListDepotSections(depotId);
                }
            };
            gvMx1.CellValueChanged += (s, e) =>
            {
                if (e.RowHandle < 0) return;
                if (e.Column == gvMx1DepotName)
                {
                    var depotId = gvMx1.GetRowCellValue(e.RowHandle, "dbDepotId")?.ToString();
                    // 清空库位并根据仓库ID加载库位下拉
                    gvMx1.SetRowCellValue(e.RowHandle, "dbDepotSections", null);
                    _getListDepotSections(depotId);
                }
            };
        }
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        {
@@ -181,7 +218,7 @@
                lbGuid, txt_hNo, gridView1, "hNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
                MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定删除吗?"))
@@ -199,17 +236,19 @@
                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>
@@ -268,9 +307,10 @@
                lbGuid, txt_hNo, gridView1);
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
                MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            toolBarMenu1.currentAction = "edit";
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
            if (xtraTabControl1.SelectedTabPageIndex == 1)
            {
@@ -281,7 +321,15 @@
                List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                gvList.Add(gvMx1);
                UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList);
                gvMx1DepotName.OptionsColumn.ReadOnly = false;
                gvMx1DepotName.OptionsColumn.AllowEdit = true;
                gvMx1DepotSections.OptionsColumn.ReadOnly = false;
                gvMx1DepotSections.OptionsColumn.AllowEdit = true;
                if (btnBatchSetDepotSections != null)
                    btnBatchSetDepotSections.Enabled = true;
            }
            //2025/07/12加上修改状态下不能修改
            txt_erpSczz.IsReadly = true;
        }
        /// <summary>
        /// 新增事件
@@ -310,7 +358,7 @@
            string workId = txt_pba013.GetId();
            if (string.IsNullOrEmpty(workId.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择车间!");
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择车间!");
                txt_pba013.Focus();
                return;
            }
@@ -335,6 +383,11 @@
                if (row != null)
                {
                    Guid? _guid = UtilityHelper.ToGuid(row["guid"].ToString());
                    if (string.IsNullOrEmpty(row["daa025"].ToString()))
                    {
                        MsgHelper.ShowError("生产类型不能为空!");
                        return;
                    }
                    string _LineId = row["daa015"].ToString();
                    if (string.IsNullOrEmpty(_LineId))
                    {
@@ -352,48 +405,49 @@
                        MsgHelper.ShowError("预计开工时间不能为空!");
                        return;
                    }
                    //string _prepareTime = row["prepareTime"].ToString();
                    //if (string.IsNullOrEmpty(_prepareTime))
                    //{
                    //    MsgHelper.ShowError("预计备料时间不能为空!");
                    //    return;
                    //}
                    //string _planPersonnel = row["planPersonnel"].ToString();
                    //if (string.IsNullOrEmpty(_planPersonnel))
                    //{
                    //    MsgHelper.ShowError("计划人数!");
                    //    return;
                    //}
                    //string _changeLinetime = row["changeLinetime"].ToString();
                    //if (string.IsNullOrEmpty(_changeLinetime))
                    //{
                    //    MsgHelper.ShowError("换线时间不能为空!");
                    //    return;
                    //}
                    string _mesEndProd = row["mesEndProd"].ToString();
                    if (string.IsNullOrEmpty(_mesEndProd))
                    {
                        MsgHelper.ShowError("预计完工时间不能为空!");
                        return;
                    }
                    //string _restTime = row["restTime"].ToString();
                    //if (string.IsNullOrEmpty(_prepareTime))
                    //{
                    //    MsgHelper.ShowError("休息时间不能为空!");
                    //    return;
                    //}
                    var _isCheckObj = row["isCheck"];
                    bool _isAuto = false;
                    if (_isCheckObj is bool _b) _isAuto = _b;
                    else
                    {
                        var _s = _isCheckObj == null ? "" : _isCheckObj.ToString();
                        _isAuto = _s == "1" || string.Equals(_s, "true", System.StringComparison.OrdinalIgnoreCase);
                    }
                    if (_isAuto)
                    {
                        var _depotId = row["dbDepotId"] == null ? "" : row["dbDepotId"].ToString();
                        var _depotSections = row["dbDepotSections"] == null ? "" : row["dbDepotSections"].ToString();
                        if (string.IsNullOrWhiteSpace(_depotId))
                        {
                            MsgHelper.ShowError("自动调拨仓库不能为空!");
                            return;
                        }
                        if (string.IsNullOrWhiteSpace(_depotSections))
                        {
                            MsgHelper.ShowError("自动调拨库位不能为空!");
                            return;
                        }
                    }
                    _obj.list.Add(new
                    {
                        Guid = _guid,
                        AboutGuid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(row["caaGuid"].ToString()),
                        LineId = row["daa015"].ToString(),//产线id
                        Hxsj = row["daa025"].ToString(),//生产类型
                        Yjkgsj = (row["mesStartProd"].ToString()),//预计开工时间
                        Jhrs = row["planPersonnel"].ToString(),//计划人数
                        Hxsj = row["changeLinetime"].ToString(),//换线时间
                        Bz = row["daa009"].ToString(),//备注
                        Blsj = row["prepareTime"].ToString(),//预计备料时间
                        Yjwgsj = row["mesEndProd"].ToString(),//预计完工时间
                        Pcsl = row["daa008"].ToString(),//排产数量
                        Yjwgsj = row["mesEndProd"].ToString()//预计完工时间
                        Bz = row["daa009"].ToString(),//备注
                        IsZddb = row["isCheck"].ToString(),//是否自动调拨
                        DepotId = row["dbDepotId"].ToString(),//仓库ID
                        DepotSections = row["dbDepotSections"].ToString()//仓库库位
                    });
                }
            }
@@ -401,9 +455,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_hNo.Text = _rtn.rtnData.outNo;
                    toolBarMenu1.isSetBtn = true;
@@ -411,13 +465,116 @@
                    gvList.Add(gvMx1);
                    UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gvList);
                    toolBarMenu1.currentAction = "";
                    if (btnBatchSetDepotSections != null)
                        btnBatchSetDepotSections.Enabled = false;
                    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);
            }
        }
        private void btnBatchSetDepotSections_Click(object sender, EventArgs e)
        {
            var selected = gvMx1.GetSelectedRows();
            if (selected == null || selected.Length == 0)
            {
                MsgHelper.ShowError("请先在最左侧选择需要批量赋值的行!");
                return;
            }
            // 预加载仓库列表
            string orgId = txt_erpSczz.GetId();
            _getListDepot(orgId);
            // 构建弹框
            var dlg = new DevExpress.XtraEditors.XtraForm();
            dlg.Text = "批量赋值自动调拨库位";
            dlg.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            dlg.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            dlg.MaximizeBox = false;
            dlg.MinimizeBox = false;
            dlg.Width = 420;
            dlg.Height = 220;
            var lblDepot = new DevExpress.XtraEditors.LabelControl() { Text = "仓库名称:", Left = 15, Top = 20, Width = 80 };
            var cboDepot = new DevExpress.XtraEditors.ComboBoxEdit() { Left = 100, Top = 16, Width = 280 };
            cboDepot.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            foreach (var item in this.rptDepotName.Items)
            {
                cboDepot.Properties.Items.Add(item);
            }
            var lblSection = new DevExpress.XtraEditors.LabelControl() { Text = "库位:", Left = 15, Top = 60, Width = 80 };
            var cboSection = new DevExpress.XtraEditors.ComboBoxEdit() { Left = 100, Top = 56, Width = 280 };
            cboSection.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            var chkAuto = new DevExpress.XtraEditors.CheckEdit() { Left = 15, Top = 96, Width = 200, Text = "同时勾选自动调拨标识", Checked = true };
            var btnOk = new DevExpress.XtraEditors.SimpleButton() { Left = 200, Top = 130, Width = 80, Text = "确定" };
            var btnCancel = new DevExpress.XtraEditors.SimpleButton() { Left = 300, Top = 130, Width = 80, Text = "取消" };
            cboDepot.SelectedIndexChanged += (s, ev) =>
            {
                var itm = cboDepot.EditValue as CboItemEntity;
                var depotId = itm == null ? null : itm.Value?.ToString();
                _getListDepotSections(depotId);
                cboSection.Properties.Items.Clear();
                foreach (var sec in this.rptDepotSections.Items)
                {
                    cboSection.Properties.Items.Add(sec);
                }
                cboSection.EditValue = null;
            };
            btnCancel.Click += (s, ev) => { dlg.DialogResult = System.Windows.Forms.DialogResult.Cancel; dlg.Close(); };
            btnOk.Click += (s, ev) =>
            {
                var depotItem = cboDepot.EditValue as CboItemEntity;
                var sectionItem = cboSection.EditValue as CboItemEntity;
                if (depotItem == null)
                {
                    MsgHelper.ShowError("请选择仓库名称!");
                    return;
                }
                if (sectionItem == null)
                {
                    MsgHelper.ShowError("请选择库位!");
                    return;
                }
                var depotId = depotItem.Value?.ToString();
                var depotName = depotItem.Text?.ToString();
                var sectionCode = sectionItem.Text?.ToString();
                gvMx1.BeginUpdate();
                foreach (var handle in selected)
                {
                    if (handle < 0) continue;
                    gvMx1.SetRowCellValue(handle, "dbDepotId", depotId);
                    gvMx1.SetRowCellValue(handle, "depotName", depotName);
                    gvMx1.SetRowCellValue(handle, "dbDepotSections", sectionCode);
                    gvMx1.SetRowCellValue(handle, "isCheck", true);
                }
                gvMx1.EndUpdate();
                gvMx1.CloseEditor();
                gvMx1.PostEditor();
                gvMx1.UpdateCurrentRow();
                dlg.DialogResult = System.Windows.Forms.DialogResult.OK;
                dlg.Close();
            };
            dlg.Controls.Add(lblDepot);
            dlg.Controls.Add(cboDepot);
            dlg.Controls.Add(lblSection);
            dlg.Controls.Add(cboSection);
            dlg.Controls.Add(chkAuto);
            dlg.Controls.Add(btnOk);
            dlg.Controls.Add(btnCancel);
            dlg.ShowDialog(this);
        }
        /// <summary>
@@ -427,7 +584,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.ERP_SCZZ 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
@@ -460,7 +621,7 @@
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
@@ -471,7 +632,7 @@
            if (toolBarMenu1.currentAction == "edit") isEdit = true;
            if (string.IsNullOrEmpty(strGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
                MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            var _obj = new
@@ -500,11 +661,16 @@
                    DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString());
                    if (dt.Rows.Count > 0)
                    {
                        if (!dt.Columns.Contains("DbDepotId")) dt.Columns.Add("DbDepotId", typeof(string));
                        if (!dt.Columns.Contains("DepotName")) dt.Columns.Add("DepotName", typeof(string));
                        if (!dt.Columns.Contains("DbDepotSections")) dt.Columns.Add("DbDepotSections", typeof(string));
                        gcMx1.BindingContext = new BindingContext();
                        gcMx1.DataSource = dt;
                        gcMx1.ForceInitialize();
                        gvMx1.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                        if (btnBatchSetDepotSections != null)
                            btnBatchSetDepotSections.Enabled = isEdit;
                    }
                    else
                    {
@@ -512,11 +678,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);
            }
        }
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
@@ -548,13 +714,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);
                }
            }
        }
@@ -583,7 +751,7 @@
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
                MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        private void rptJYBZ_SelectedIndexChanged(object sender, EventArgs e)
@@ -604,6 +772,143 @@
            }
        }
        private void rptDepotName_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBoxEdit comboBox = sender as ComboBoxEdit;
            if (comboBox != null)
            {
                GridView myView = (gcMx1.MainView as GridView);
                int dataIndex = myView.GetDataSourceRowIndex(myView.FocusedRowHandle);
                CboItemEntity _itm = comboBox.EditValue as CboItemEntity;
                if (_itm == null) return;
                string depotId = _itm.Value.ToString();
                string depotName = _itm.Text.ToString();
                gvMx1.CloseEditor();
                gvMx1.PostEditor();
                gvMx1.UpdateCurrentRow();
                gvMx1.SetRowCellValue(dataIndex, "dbDepotId", depotId);
                gvMx1.SetRowCellValue(dataIndex, "depotName", depotName);
                // 清空库位并根据仓库ID加载库位列表
                gvMx1.SetRowCellValue(dataIndex, "dbDepotSections", null);
                _getListDepotSections(depotId);
            }
        }
        private void rptDepotSections_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBoxEdit comboBox = sender as ComboBoxEdit;
            if (comboBox != null)
            {
                GridView myView = (gcMx1.MainView as GridView);
                int dataIndex = myView.GetDataSourceRowIndex(myView.FocusedRowHandle);
                CboItemEntity _itm = comboBox.EditValue as CboItemEntity;
                if (_itm == null) return;
                string sectionCode = _itm.Text.ToString();
                gvMx1.CloseEditor();
                gvMx1.PostEditor();
                gvMx1.UpdateCurrentRow();
                gvMx1.SetRowCellValue(dataIndex, "dbDepotSections", sectionCode);
            }
        }
        private void _getListDepot(string orgId)
        {
            try
            {
                var pgq = new PageQueryModel(1, 999999, "org.FNumber asc ,a.depot_code", "asc", "", " and is_ng='A'" + (string.IsNullOrEmpty(orgId) ? "" : (" and a.FSubsidiary='" + orgId + "'")));
                var json = JsonConvert.SerializeObject(pgq);
                var strReturn = UtilityHelper.HttpPost("", "MesDepotsManager/GetListPage", json);
                var rtn = UtilityHelper.ReturnToTablePage(strReturn);
                var dt = rtn.rtnData.list;
                this.rptDepotName.Items.Clear();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    this.rptDepotName.Items.Add(new CboItemEntity(dr["depotId"].ToString(), dr["depotName"].ToString()));
                }
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        private void _getListDepotSections(string depotId)
        {
            try
            {
                if (string.IsNullOrEmpty(depotId))
                {
                    this.rptDepotSections.Items.Clear();
                    return;
                }
                var pgq = new PageQueryModel(1, 999999, "b.xh", "asc", "", " and is_ng='A' and a.depot_id='" + depotId + "'" );
                var json = JsonConvert.SerializeObject(pgq);
                var strReturn = UtilityHelper.HttpPost("", "MesDepotSectionsManager/GetListPage", json);
                var rtn = UtilityHelper.ReturnToTablePage(strReturn);
                var dt = rtn.rtnData.list;
                this.rptDepotSections.Items.Clear();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    this.rptDepotSections.Items.Add(new CboItemEntity(dr["depotSectionCode"].ToString(), dr["depotSectionCode"].ToString()));
                }
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        ///  新增方法:列表显示
        /// </summary>
        /// <param name="strGuid">主表id</param>
        private void getModelList(string strGuid)
        {
            gcMxL1.DataSource = null;
            var _obj = new
            {
                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();
                        gridView4.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView4);
                    }
                    else
                    {
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMxL1, gridView4);
                    }
                }
                else
                    ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 工具条事件
        /// </summary>
@@ -619,7 +924,8 @@
                case 0:
                    strMsg = "反审核";
                    break;
            };
            }
            ;
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_hNo, gridView1, "hNo");
@@ -639,9 +945,9 @@
            {
                var strJson = UtilityHelper.HttpPost("", _webServiceName + _mth, 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());
@@ -650,11 +956,96 @@
                    gridView1.FocusedRowHandle = rowHandle;
                    UtilityHelper.SetCheckIco(gridView1, "fstatus", "checkUser", "checkDate", picCheckBox, this, _inFieldValue.ToString());
                }
                else
                    MsgHelper.ShowError(_rtn.rtnData.outMsg.ToString());
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
                MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 批量处理明细按钮点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMultiSelect_Click(object sender, EventArgs e)
        {
            try
            {
                // 获取明细表格的GridView
                GridView myView = (gcMx1.MainView as GridView);
                if (myView == null)
                {
                    MsgHelper.Warning("无法获取明细表格!");
                    return;
                }
                // 获取选中的行
                int[] selectedRows = myView.GetSelectedRows();
                if (selectedRows == null || selectedRows.Length == 0)
                {
                    MsgHelper.Warning("请先选择要处理的明细行!");
                    return;
                }
                // 构建选中行的数据列表
                var selectedData = new List<object>();
                foreach (int rowHandle in selectedRows)
                {
                    if (rowHandle >= 0) // 确保是有效的数据行
                    {
                        var rowData = new
                        {
                            guid = myView.GetRowCellValue(rowHandle, "guid")?.ToString(),
                            daa002 = myView.GetRowCellValue(rowHandle, "daa002")?.ToString(),
                            daa003 = myView.GetRowCellValue(rowHandle, "daa003")?.ToString(),
                            daa005 = myView.GetRowCellValue(rowHandle, "daa005")?.ToString(),
                            daa010 = myView.GetRowCellValue(rowHandle, "daa010")?.ToString()
                        };
                        selectedData.Add(rowData);
                    }
                }
                if (selectedData.Count == 0)
                {
                    MsgHelper.Warning("没有有效的明细数据被选中!");
                    return;
                }
                // 确认操作
                if (!MsgHelper.AskQuestion($"您选择了 {selectedData.Count} 条明细记录,确定要进行批量处理吗?"))
                    return;
                // 构建API请求参数
                var requestData = new
                {
                    selectedDetails = selectedData,
                    operationType = "BatchProcess", // 操作类型
                    operatorGuid = lbGuid.Text.Trim() // 当前操作的主单据GUID
                };
                // 调用API(仿照现有的API调用模式)
                string apiUrl = "WompbaGxManager/BatchProcessDetails"; // API地址
                var strJson = UtilityHelper.HttpPost("", apiUrl, JsonConvert.SerializeObject(requestData));
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                // 处理返回结果
                MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
                if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                {
                    // 成功后刷新明细数据
                    getModel(lbGuid.Text.Trim());
                    //MsgHelper.Information("批量处理完成!");
                }
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("批量处理失败:" + ex.Message);
            }
        }
    }
}
}