lu
2025-08-09 c6ec5dda891c9b6ef9c3ff97cc964a826c0ddbff
DevApp/Gs.DevApp/DevFrm/JJGZ/Frm_MESJJERRORJS.cs
@@ -38,6 +38,8 @@
            this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
            toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
            btnFZ.Click += btnFZ_Click;
            gridView2.CustomUnboundColumnData += gridView2_CustomUnboundColumnData;
            this.toolBarMenu1.getXmlConfig();
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "checkStatus", "", (value) =>
            {
@@ -79,7 +81,11 @@
                        }
                        DataTable _newTable = JsonConvert.DeserializeObject<DataTable>(array.ToString());
                        DataTable _oldTable = _newTable.Clone();
                        DataTable _oldTable = gridControl1.DataSource as DataTable;
                        if (_oldTable == null)
                        {
                            _oldTable = _newTable.Clone();
                        }
                        DataRow[] sourceRows = _newTable.Select();
                        for (int i = 0; i < sourceRows.Length; i++)
                        {
@@ -285,7 +291,7 @@
        private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
        {
            string rowGuid = "", rowName = "";
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_Guid, gridView1, "guid");
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_Guid, gridView1, "errorNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
@@ -354,7 +360,12 @@
        {
            lbGuid.Text = "";
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4);
            UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true);
            List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
            gridViews.Add(gridView1);
            gridViews.Add(gridView2);
            UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews);
            Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMain1, gridView1);
            Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gridControl1, gridView2);
            txt_ErrorType.EditValue = "计时工时";
            GetTimeType();
            GetWOMDAAInfo();
@@ -558,6 +569,12 @@
                    dynamic dy = _rtn.rtnData;
                    lbGuid.Text = strGuid;
                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit);
                    // 控制明细表可编辑状态
                    List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                    gvList.Add(gridView2);
                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList);
                    JObject _job = JObject.Parse(strJson);
                    JArray array = new JArray();
                    foreach (var a in _job["rtnData"]["list"])
@@ -607,7 +624,7 @@
            ;
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_Guid, gridView1, "guid");
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_Guid, gridView1, "errorNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
@@ -702,5 +719,46 @@
                }
            }
        }
        private void gridView2_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e)
        {
            if (e.Column.FieldName == "rowNo" && e.IsGetData)
            {
                e.Value = e.ListSourceRowIndex + 1;
            }
        }
        private void btnFZ_Click(object sender, EventArgs e)
        {
            // 获取当前选中行的行号
            int focusedRowHandle = gridView2.FocusedRowHandle;
            if (focusedRowHandle < 0) return;
            // 获取当前行的时长
            DataRow currentRow = gridView2.GetDataRow(focusedRowHandle);
            if (currentRow == null) return;
            var hourValue = currentRow["hour"];
            if (hourValue == null) return;
            decimal hourlySalary = 0;
            decimal hour = 0;
            decimal.TryParse(txt_HourlySalary.Text, out hourlySalary);
            // 获取时长
            decimal.TryParse(currentRow["hour"]?.ToString(), out hour);
            // 批量设置下面所有行的时长
            for (int i = focusedRowHandle + 1; i < gridView2.DataRowCount; i++)
            {
                var row = gridView2.GetDataRow(i);
                if (row != null)
                {
                    row["hour"] = hourValue;
                    // 计算计时工资
                    row["salary"] = hourlySalary * hour;
                }
            }
            gridView2.RefreshData();
        }
    }
}