DeviceManager/TsSFCDeivceClient/pageDeviceMaintenanceFormView.cs

677 lines
27 KiB
C#
Raw Permalink Normal View History

2024-05-29 01:56:37 +00:00
using DevExpress.XtraBars.ToolbarForm;
using DevExpress.XtraEditors;
2024-05-30 15:52:57 +00:00
using DeviceRepair.Models;
using DeviceRepair.Models.Common;
2024-05-29 01:56:37 +00:00
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
using TsSFCDeivceClient.Common;
using TsSFCDeivceClient.Model;
namespace TsSFCDeivceClient
{
public partial class pageDeviceMaintenanceFormView : ToolbarForm
{
int m_SelectedCurrentRowIndex = 0;
DataRow CurrentRequestForm = null;
2024-06-04 09:25:13 +00:00
2024-05-29 01:56:37 +00:00
List<LookUpItemModel> lookupMaintenanceStatus;
2024-05-30 15:52:57 +00:00
#region
2024-05-29 01:56:37 +00:00
DeviceWarrantyRequestFormFilter _filter;
DeviceWarrantyRequestFormFilter FilterInfo
{
get
{
if (_filter == null)
_filter = new DeviceWarrantyRequestFormFilter();
_filter.EquipmentID = EquipmentID;
_filter.StartTime = Filter_Start_Date;
_filter.EndTime = Filter_End_Date.AddDays(1).AddMilliseconds(-1);
_filter.Status = Filter_Status;
_filter.DownStatus = Filter_DownStatus;
return _filter;
}
}
string EquipmentID
{
get { return txt_DeviceID.Text.Trim(); }
}
/// <summary>
/// 设备状态
/// </summary>
DeviceWarrantyRequestFormStatus Filter_Status
{
get { return (DeviceWarrantyRequestFormStatus)((int)(cb_Status.EditValue)); }
}
/// <summary>
/// 设备停机状态
/// </summary>
DeviceRunningStatus Filter_DownStatus
{
get { return (DeviceRunningStatus)cbbIsDown.SelectedIndex; }
}
/// <summary>
/// 开始时间
/// </summary>
DateTime Filter_Start_Date
{
2024-06-10 17:33:11 +00:00
get
{
if (Convert.ToDateTime(de_StartDate.EditValue) == DateTime.MinValue)
de_StartDate.EditValue = DateTime.Today.AddMonths(-1);
return Convert.ToDateTime(de_StartDate.EditValue);
}
2024-05-29 01:56:37 +00:00
}
/// <summary>
/// 结束时间
/// </summary>
DateTime Filter_End_Date
{
2024-06-10 17:33:11 +00:00
get
{
if (Convert.ToDateTime(de_EndDate.EditValue) == DateTime.MinValue)
de_EndDate.EditValue = DateTime.Today;
return Convert.ToDateTime(de_EndDate.EditValue);
}
2024-05-29 01:56:37 +00:00
}
2024-05-30 15:52:57 +00:00
#endregion
2024-05-29 01:56:37 +00:00
2024-06-04 09:25:13 +00:00
int EmployeeType = -1;
2024-05-29 01:56:37 +00:00
2024-05-30 15:52:57 +00:00
public pageDeviceMaintenanceFormView(UserInfo user, string APPVERSION = "5.0.0.0")
2024-05-29 01:56:37 +00:00
{
InitializeComponent();
Runtime.CurrentUser = user;
2024-05-30 15:52:57 +00:00
Runtime.inParams = JsonConvert.SerializeObject(new { OPERATORGUID = user.GUID, OPERATOR = user.UserCode, CLIENTIP = ComputerHelper.Instance().IpAddress, CLIENTMAC = ComputerHelper.Instance().MacAddress, CLIENTNAME = ComputerHelper.Instance().ComputerName, APPVERSION = APPVERSION });
//HasAuth = user.HasPost;
2024-05-29 01:56:37 +00:00
this.Load += PageDeviceMaintenanceFormView_Load;
}
private void PageDeviceMaintenanceFormView_Load(object sender, EventArgs e)
{
2024-05-30 15:52:57 +00:00
try
2024-05-29 01:56:37 +00:00
{
2024-05-30 15:52:57 +00:00
splashScreenManager1.ShowWaitForm();
2024-07-22 07:50:10 +00:00
layoutControl1.AllowCustomization = false;
2024-05-29 01:56:37 +00:00
2024-05-30 15:52:57 +00:00
if (Runtime.CurrentUser == null)
{
XtraMessageBoxHelper.Error($"非法的调用,请重试。");
this.Close();
}
2024-05-29 01:56:37 +00:00
2024-06-02 16:38:52 +00:00
if (string.IsNullOrWhiteSpace(RunConfig.config.ServiceApiUrl))
2024-05-30 15:52:57 +00:00
{
XtraMessageBoxHelper.Error($"缺少配置字段设备管理软件接口地址【ServiceApiUrl】。");
this.Close();
}
2024-05-29 01:56:37 +00:00
2024-05-30 15:52:57 +00:00
2024-06-02 16:38:52 +00:00
APIResponseData apiResponseData = Biz.HttpHelper.Instance.Get($"{RunConfig.config.ServiceApiUrl}{DeviceApiUrlConstValue.CurrentIsManager}?UserCode={Runtime.CurrentUser.UserCode}");
2024-05-30 15:52:57 +00:00
if (!apiResponseData.IsSuccess)
2024-05-29 01:56:37 +00:00
{
2024-05-30 15:52:57 +00:00
XtraMessageBoxHelper.Error(apiResponseData.Message);
this.Close();
}
2024-05-29 01:56:37 +00:00
2024-06-04 09:25:13 +00:00
EmployeeType = apiResponseData.ToInt();
2024-05-29 01:56:37 +00:00
2024-05-30 15:52:57 +00:00
if (lookupMaintenanceStatus == null)
lookupMaintenanceStatus = new List<LookUpItemModel>();
2024-05-29 01:56:37 +00:00
2024-05-30 15:52:57 +00:00
foreach (DeviceWarrantyRequestFormStatus item in Enum.GetValues(typeof(DeviceWarrantyRequestFormStatus)))
{
lookupMaintenanceStatus.Add(new LookUpItemModel
{
ValueMember = (int)item,
DisplayMember = item.ToDescription()
});
}
cb_Status.Properties.DataSource = lookupMaintenanceStatus;
cb_Status.Properties.DisplayMember = "DisplayMember";
cb_Status.Properties.ValueMember = "ValueMember";
cb_Status.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
cb_Status.EditValue = (int)DeviceWarrantyRequestFormStatus.All;
cbbIsDown.Properties.Items.BeginUpdate();
foreach (DeviceRunningStatus item in Enum.GetValues(typeof(DeviceRunningStatus)))
{
cbbIsDown.Properties.Items.Add(item.ToDescription());
}
cbbIsDown.Properties.Items.EndUpdate();
cbbIsDown.SelectedIndex = 0;
2024-05-29 01:56:37 +00:00
2024-05-30 15:52:57 +00:00
de_StartDate.EditValue = DateTime.Today.AddMonths(-1);
2024-06-10 17:33:11 +00:00
de_EndDate.EditValue = DateTime.Today.AddDays(1).AddMilliseconds(-1);
2024-05-29 01:56:37 +00:00
2024-05-30 15:52:57 +00:00
InitializeGridViewStyle();
splashScreenManager1.CloseWaitForm();
}
catch (Exception ex)
{
XtraMessageBoxHelper.Error(ex.Message);
splashScreenManager1.CloseWaitForm();
this.Close();
}
2024-05-29 01:56:37 +00:00
}
2024-05-30 15:52:57 +00:00
Dictionary<int, DeviceWarrantyRequestFormView> CurrentGridDatas;
//List<DeviceWarrantyRequestFormView> GridDatas = null;
2024-05-29 01:56:37 +00:00
DataTable ToDataTable(IList list)
{
DataTable result = new DataTable();
if (list.Count > 0)
{
PropertyInfo[] propertys = list[0].GetType().GetProperties();
foreach (PropertyInfo pi in propertys)
{
Type colType = pi.PropertyType;
if ((colType.IsGenericType) && (colType.GetGenericTypeDefinition() == typeof(Nullable<>)))
{
colType = colType.GetGenericArguments()[0];
}
result.Columns.Add(new DataColumn(pi.Name, colType));
}
for (int i = 0; i < list.Count; i++)
{
ArrayList tempList = new ArrayList();
foreach (PropertyInfo pi in propertys)
{
object obj = pi.GetValue(list[i], null) == null ? DBNull.Value : pi.GetValue(list[i], null);
tempList.Add(obj);
}
object[] array = tempList.ToArray();
result.LoadDataRow(array, true);
}
}
return result;
}
void InitializeGridDatas()
{
try
{
splashScreenManager1.ShowWaitForm();
2024-06-02 16:38:52 +00:00
APIResponseData apiResponseData = Biz.HttpHelper.Instance.Post($"{RunConfig.config.ServiceApiUrl}{DeviceApiUrlConstValue.GetMaintenance}", JsonConvert.SerializeObject(FilterInfo));
2024-05-29 01:56:37 +00:00
if (!apiResponseData.IsSuccess)
throw new Exception(apiResponseData.Message);
2024-05-30 15:52:57 +00:00
List<DeviceWarrantyRequestFormView> GridDatas = apiResponseData.ToDeserializeObject<List<DeviceWarrantyRequestFormView>>();
if (GridDatas != null && GridDatas.Count > 0)
CurrentGridDatas = GridDatas.ToDictionary(x => x.AutoID, x => x);
2024-05-29 01:56:37 +00:00
DataTable table = ToDataTable(GridDatas);
2024-05-30 15:52:57 +00:00
table.Columns.Add("InProductionText");
table.Columns.Add("EvaluatorPE");
table.Columns.Add("EvaluatorTimePE");
table.Columns.Add("EvaluatorQE");
table.Columns.Add("EvaluatorTimeQE");
string[] ManagerCodes = new string[] { "QE", "PE" };
foreach (DataRow item in table.Rows)
{
int AutoID = Convert.ToInt32(item["AutoID"]);
if (CurrentGridDatas.ContainsKey(AutoID) && CurrentGridDatas[AutoID] != null)
{
item["InProductionText"] = CurrentGridDatas[AutoID].InProduction ? "是" : "否";
foreach (string Code in ManagerCodes)
{
DeviceWarrantyEvaluatorInfo deviceWarrantyEvaluatorInfo = CurrentGridDatas[AutoID].EvaluatorItems.FirstOrDefault(x => x.EvaluatorCode == Code);
if (deviceWarrantyEvaluatorInfo == null)
continue;
item[$"Evaluator{Code}"] = deviceWarrantyEvaluatorInfo.CreatorName;
item[$"EvaluatorTime{Code}"] = deviceWarrantyEvaluatorInfo.CreatOn;
}
}
}
2024-06-05 17:09:59 +00:00
gridControl1.BeginUpdate();
2024-05-29 01:56:37 +00:00
gridControl1.DataSource = null;
gridControl1.DataSource = table;
2024-06-10 17:33:11 +00:00
if (table != null && table.Rows.Count > 0)
{
// 设置行号列宽度
SizeF size = this.CreateGraphics().MeasureString(table.Rows.Count.ToString(), this.Font);
gridView1.IndicatorWidth = Convert.ToInt32(size.Width) + 20;
}
2024-06-05 17:09:59 +00:00
gridControl1.RefreshDataSource();
gridControl1.EndUpdate();
//gridView1.BestFitColumns();
2024-05-29 01:56:37 +00:00
CloseWaitForm();
}
catch (Exception ex)
{
gridControl1.DataSource = null;
CloseWaitForm();
XtraMessageBoxHelper.Error(ex.Message);
}
2024-06-05 17:09:59 +00:00
this.Refresh();
2024-05-29 01:56:37 +00:00
}
/// <summary>
/// 初始化表格样式
/// </summary>
void InitializeGridViewStyle()
{
2024-06-03 17:21:11 +00:00
// 关闭列头右键菜单
2024-05-29 05:54:55 +00:00
gridView1.OptionsMenu.EnableColumnMenu = false;
2024-06-03 17:21:11 +00:00
2024-05-29 05:54:55 +00:00
gridView1.OptionsSelection.ShowCheckBoxSelectorInColumnHeader = DevExpress.Utils.DefaultBoolean.False;
2024-05-29 01:56:37 +00:00
/// 自增长行号
gridView1.CustomDrawRowIndicator += (s, e) =>
{
if (e.Info.IsRowIndicator && e.RowHandle >= 0)
{
e.Info.DisplayText = (e.RowHandle + 1).ToString();
e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
e.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
SizeF size = e.Graphics.MeasureString((e.RowHandle + 1).ToString(), e.Appearance.Font);
}
};
/// 修改字段标题
gridView1.CustomDrawColumnHeader += (s, e) =>
{
2024-06-04 09:25:13 +00:00
(new Action<DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs>(BaseControlEx.GridControlExtend.CustomDrawColumnHeader)).Invoke(e);
2024-05-29 01:56:37 +00:00
};
/// 单元格点击
gridView1.RowCellClick += (s, e) =>
{
if (e.Button == MouseButtons.Right)
{
e.Handled = true;
return;
}
if (e.Column.Caption == "Selection")
{
if (this.m_SelectedCurrentRowIndex == e.RowHandle && this.gridView1.IsRowSelected(e.RowHandle))
{
this.gridView1.UnselectRow(e.RowHandle);
return;
}
}
DataRow model = (gridView1.GetRow(e.RowHandle) as DataRowView).Row;
if (model["AutoID"]?.ToString() != CurrentRequestForm["AutoID"]?.ToString())
{
CurrentRequestForm = model;
this.gridView1.SelectRow(e.RowHandle);
}
};
/// 表格选中行更改
gridView1.FocusedRowChanged += (s, e) =>
{
try
{
if (e.FocusedRowHandle >= 0)
{
m_SelectedCurrentRowIndex = e.FocusedRowHandle;
CurrentRequestForm = (gridView1.GetRow(e.FocusedRowHandle) as DataRowView).Row;
#region
if (gridView1.SelectedRowsCount > 0)
{
for (int i = 0; i < this.gridView1.RowCount; i++)
{
if (this.gridView1.IsRowSelected(i) && this.gridView1.FocusedRowHandle.ToString().Equals(i.ToString()) == false)
{
this.gridView1.UnselectRow(i);
}
}
}
this.gridView1.SelectRow(e.FocusedRowHandle);
#endregion
bool PE = false;
bool QE = false;
bool RestorationConfirmation = false;
int AutoID = Convert.ToInt32(CurrentRequestForm["AutoID"]);
2024-05-30 15:52:57 +00:00
DeviceWarrantyRequestFormView Item = CurrentGridDatas[AutoID];// GridDatas.FirstOrDefault(x => x.AutoID == AutoID);
2024-05-29 01:56:37 +00:00
2024-06-04 09:25:13 +00:00
if (Item != null && EmployeeType != -1 && Item.FormStatus != DeviceWarrantyRequestFormStatus.BeComplate && Item.InProduction)
2024-05-29 01:56:37 +00:00
{
if (Item.EvaluatorItems != null)
{
2024-06-10 17:33:11 +00:00
if (!Item.EvaluatorItems.Any(x => x.EvaluatorCode == "QE") && EmployeeType == 0)
2024-05-29 01:56:37 +00:00
{
2024-06-10 17:33:11 +00:00
QE = true;
2024-05-29 01:56:37 +00:00
}
2024-06-10 17:33:11 +00:00
if (!Item.EvaluatorItems.Any(x => x.EvaluatorCode == "PE") && EmployeeType == 1)
2024-05-29 01:56:37 +00:00
{
2024-06-10 17:33:11 +00:00
PE = true;
2024-05-29 01:56:37 +00:00
}
}
}
if (Item != null && Item.MaintaionItems != null && Item != null && Item.MaintaionItems.SubmitBy > 0 &&
((Item.InProduction && Item.EvaluatorItems != null && Item.EvaluatorItems.Count == 2) ||
(!Item.InProduction)) && Item.MaintaionItems.ValidateBy > 0 && Item.MaintaionItems.Validate2By > 0
&& Item.RestorationConfirmationBy == 0
)
{
RestorationConfirmation = true;
}
this.Invoke(new Action(() =>
{
btn_Assessment_QE.Enabled = QE;
btn_Assessment_QE.Refresh();
2024-06-10 17:33:11 +00:00
btn_Assessment_PE.Enabled = PE;
btn_Assessment_PE.Refresh();
2024-05-29 01:56:37 +00:00
btnResumptionConfirm.Enabled = RestorationConfirmation;
btnResumptionConfirm.Refresh();
}));
}
else
{
CurrentRequestForm = null;
}
}
catch (Exception ex)
{
XtraMessageBoxHelper.Error(ex.Message);
}
};
gridView1.OptionsBehavior.Editable = false;
gridView1.OptionsBehavior.ReadOnly = true;
gridView1.OptionsSelection.MultiSelect = true;
gridView1.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect;
gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;
gridView1.OptionsScrollAnnotations.ShowSelectedRows = DevExpress.Utils.DefaultBoolean.False;
foreach (DevExpress.XtraGrid.Columns.GridColumn item in gridView1.Columns)
{
item.OptionsColumn.AllowEdit = false;
item.OptionsColumn.AllowGroup = DevExpress.Utils.DefaultBoolean.True;
item.OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.False;
item.OptionsColumn.AllowShowHide = false;
}
}
private void CloseWaitForm()
{
try
{
if (splashScreenManager1.IsSplashFormVisible)
{
splashScreenManager1.CloseWaitForm();
}
Cursor.Current = Cursors.Default;
}
catch (Exception ex)
{
//m_log.Error(ex.Message, ex);
}
}
/// <summary>
/// 新增设备维修单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btn_FormAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
try
{
using (DowntimeFormAdd view = new DowntimeFormAdd())
{
2024-07-01 16:52:48 +00:00
if (view.ShowDialog(this) == DialogResult.OK)
2024-05-29 01:56:37 +00:00
{
XtraMessageBoxHelper.Info("操作成功!");
2024-05-30 15:52:57 +00:00
InitializeGridDatas();
2024-05-29 01:56:37 +00:00
}
}
}
catch (Exception ex)
{
XtraMessageBoxHelper.Error(ex.Message);
}
}
private void btn_Query_Click(object sender, EventArgs e)
{
InitializeGridDatas();
}
private void btn_Assessment_PE_Click(object sender, EventArgs e)
{
try
{
if (CurrentRequestForm == null)
throw new Exception($"请选择要评估的维修单!");
int AutoID = 0;
if (int.TryParse(CurrentRequestForm["AutoID"] + "", out AutoID) && AutoID > 0)
{
2024-05-30 15:52:57 +00:00
DeviceWarrantyRequestFormView Item = CurrentGridDatas[AutoID];//GridDatas.FirstOrDefault(x => x.AutoID == AutoID);
2024-05-29 01:56:37 +00:00
if (Item == null)
throw new Exception($"获取维修单数据出错,请重试!");
XtraInputBoxArgs args = new XtraInputBoxArgs { Prompt = "评估内容:", Caption = "质量部评估", DefaultResponse = "" };
args.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel };
args.DefaultButtonIndex = (int)DialogResult.Cancel;
DialogResult DiaResult = DialogResult.None;
args.Showing += (a, b) =>
{
b.Buttons[DialogResult.OK].Click += (c, d) => { DiaResult = DialogResult.OK; };
};
var Description = XtraInputBox.Show(args);
if (DiaResult == DialogResult.None)
return;
else
{
if (string.IsNullOrWhiteSpace(Description + ""))
throw new Exception($"评估内容不能为空!");
2024-07-01 16:52:48 +00:00
if (Description.ToString().Length > 20)
throw new Exception($"评估内容长度不能超过20");
2024-05-29 01:56:37 +00:00
splashScreenManager1.ShowWaitForm();
DeviceWarrantyEvaluatorInfo info = new DeviceWarrantyEvaluatorInfo
{
Description = Description + "",
2024-06-10 17:33:11 +00:00
EvaluatorCode = "QE",
2024-05-29 01:56:37 +00:00
FormID = Item.AutoID,
};
2024-06-02 16:38:52 +00:00
APIResponseData apiResponseData = Biz.HttpHelper.Instance.Post($"{RunConfig.config.ServiceApiUrl}{DeviceApiUrlConstValue.MaintenanceFormAssessment}", JsonConvert.SerializeObject(info));
2024-05-29 01:56:37 +00:00
if (!apiResponseData.IsSuccess)
throw new Exception(apiResponseData.Message);
2024-05-30 15:52:57 +00:00
CloseWaitForm();
XtraMessageBoxHelper.Info("操作成功!");
InitializeGridDatas();
2024-05-29 01:56:37 +00:00
}
}
else
{
throw new Exception($"获取维修单数据出错,请重试!");
}
}
catch (Exception ex)
{
CloseWaitForm();
XtraMessageBoxHelper.Error(ex.Message);
}
}
private void btn_Assessment_QE_Click(object sender, EventArgs e)
{
try
{
if (CurrentRequestForm == null)
throw new Exception($"请选择要评估的维修单!");
int AutoID = 0;
if (int.TryParse(CurrentRequestForm["AutoID"] + "", out AutoID) && AutoID > 0)
{
2024-05-30 15:52:57 +00:00
DeviceWarrantyRequestFormView Item = CurrentGridDatas[AutoID];// GridDatas.FirstOrDefault(x => x.AutoID == AutoID);
2024-05-29 01:56:37 +00:00
if (Item == null)
throw new Exception($"获取维修单数据出错,请重试!");
2024-07-22 07:50:10 +00:00
XtraInputBoxArgs args = new XtraInputBoxArgs { Prompt = "评估内容:", Caption = "工程部评估", DefaultResponse = "" };
2024-05-29 01:56:37 +00:00
args.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel };
args.DefaultButtonIndex = (int)DialogResult.Cancel;
DialogResult DiaResult = DialogResult.None;
args.Showing += (a, b) =>
{
b.Buttons[DialogResult.OK].Click += (c, d) => { DiaResult = DialogResult.OK; };
};
var Description = XtraInputBox.Show(args);
if (DiaResult == DialogResult.None)
return;
else
{
if (string.IsNullOrWhiteSpace(Description + ""))
throw new Exception($"评估内容不能为空!");
2024-07-01 16:52:48 +00:00
if (Description.ToString().Length > 20)
throw new Exception($"评估内容长度不能超过20");
2024-05-29 01:56:37 +00:00
splashScreenManager1.ShowWaitForm();
DeviceWarrantyEvaluatorInfo info = new DeviceWarrantyEvaluatorInfo
{
Description = Description.ToString(),
2024-06-10 17:33:11 +00:00
EvaluatorCode = "PE",
2024-05-29 01:56:37 +00:00
FormID = Item.AutoID,
};
2024-06-02 16:38:52 +00:00
APIResponseData apiResponseData = Biz.HttpHelper.Instance.Post($"{RunConfig.config.ServiceApiUrl}{DeviceApiUrlConstValue.MaintenanceFormAssessment}", JsonConvert.SerializeObject(info));
2024-05-29 01:56:37 +00:00
if (!apiResponseData.IsSuccess)
throw new Exception(apiResponseData.Message);
}
}
else
{
throw new Exception($"获取维修单数据出错,请重试!");
}
CloseWaitForm();
XtraMessageBoxHelper.Info("操作成功!");
2024-05-30 15:52:57 +00:00
InitializeGridDatas();
2024-05-29 01:56:37 +00:00
}
catch (Exception ex)
{
CloseWaitForm();
XtraMessageBoxHelper.Error(ex.Message);
}
}
private void pageDeviceMaintenanceFormView_SizeChanged(object sender, EventArgs e)
{
this.Refresh();
}
/// <summary>
/// 设备恢复确认
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnResumptionConfirm_Click(object sender, EventArgs e)
{
try
{
if (CurrentRequestForm == null)
throw new Exception($"请选择要评估的维修单!");
int AutoID = 0;
if (int.TryParse(CurrentRequestForm["AutoID"] + "", out AutoID) && AutoID > 0)
{
2024-05-30 15:52:57 +00:00
DeviceWarrantyRequestFormView Item = CurrentGridDatas[AutoID];// GridDatas.FirstOrDefault(x => x.AutoID == AutoID);
2024-05-29 01:56:37 +00:00
if (Item == null)
throw new Exception($"获取维修单数据出错,请重试!");
if (Item != null && Item.MaintaionItems != null && Item != null && Item.MaintaionItems.SubmitBy > 0 &&
((Item.InProduction && Item.EvaluatorItems != null && Item.EvaluatorItems.Count == 2) ||
(!Item.InProduction)) &&
((Item.MaintaionItems.BeValidate && Item.MaintaionItems.ValidateBy > 0 && Item.MaintaionItems.Validate2By > 0)
|| !Item.MaintaionItems.BeValidate)
&& Item.RestorationConfirmationBy == 0
)
{
if (XtraMessageBoxHelper.Ask($"是否确认将维修单:<color=red>{Item.AutoID}</color>的状态修改为:<color=blue>已恢复</color>状态!") == DialogResult.OK)
{
splashScreenManager1.ShowWaitForm();
2024-06-02 16:38:52 +00:00
APIResponseData apiResponseData = Biz.HttpHelper.Instance.Post($"{RunConfig.config.ServiceApiUrl}{DeviceApiUrlConstValue.DeviceResumptionComfirm}?AutoID={AutoID}", "");
2024-05-29 01:56:37 +00:00
if (!apiResponseData.IsSuccess)
throw new Exception(apiResponseData.Message);
CloseWaitForm();
XtraMessageBoxHelper.Info("操作成功!");
2024-05-30 15:52:57 +00:00
InitializeGridDatas();
2024-05-29 01:56:37 +00:00
}
}
else
{
throw new Exception($"获取维修单状态出错,请重试!");
}
}
else
{
throw new Exception($"获取评估单数据出错,请重试!");
}
}
catch (Exception ex)
{
CloseWaitForm();
XtraMessageBoxHelper.Error(ex.Message);
}
}
2024-06-05 17:09:59 +00:00
private void cbbIsDown_SelectedIndexChanged(object sender, EventArgs e)
{
cbbIsDown.Refresh();
}
private void cb_Status_EditValueChanged(object sender, EventArgs e)
{
cb_Status.Refresh();
}
2024-05-29 01:56:37 +00:00
}
}