namespace HStation.WinFrmUI.Xhs
|
{
|
public partial class XhsProjectSimulationMatchingListCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public XhsProjectSimulationMatchingListCtrl()
|
{
|
InitializeComponent();
|
this.elbowsMatchingCtrl1.RowClickEvent += RowClickEvent;
|
this.fourLinkMatchingCtrl1.RowClickEvent += RowClickEvent;
|
this.pipeLineMatchingCtrl1.RowClickEvent += RowClickEvent;
|
this.pumpMatchingCtrl1.RowClickEvent += RowClickEvent;
|
this.threeLinkMatchingCtrl1.RowClickEvent += RowClickEvent;
|
this.valveMatchingCtrl1.RowClickEvent += RowClickEvent;
|
}
|
|
private void RowClickEvent(string code)
|
{
|
FormRowClickEvent.Invoke(code);
|
}
|
|
public event Action<string> FormRowClickEvent = null;
|
|
public event Func<AssetsMatchingViewModel, bool> RelaodEvent = null;
|
|
private BLL.PumpMain _pumpMain = null;
|
|
private BLL.AdaptingManage _adaptingManage = null;
|
|
private BLL.PipeLineManage _pipeLineManage = null;
|
|
private BLL.ValveMain _valveMain = null;
|
|
private AssetsMatchingViewModel _assetsAutoMatching = null;
|
|
public async void SetBindingData(AssetsMatchingViewModel inputViewModel)
|
{
|
_assetsAutoMatching = inputViewModel;
|
this.elbowsMatchingCtrl1.SetBindingData(inputViewModel.ElbowsMatchingList);
|
this.pipeLineMatchingCtrl1.SetBindingData(inputViewModel.PipeMatchingList);
|
this.pumpMatchingCtrl1.SetBindingData(inputViewModel.PumpMatchingList);
|
this.threeLinkMatchingCtrl1.SetBindingData(inputViewModel.ThreelinkMatchingList);
|
this.fourLinkMatchingCtrl1.SetBindingData(inputViewModel.FourlinkMatchingList);
|
this.valveMatchingCtrl1.SetBindingData(inputViewModel.ValveMatchingList);
|
await SetMatching(inputViewModel);
|
}
|
|
/// <summary>
|
/// 自动匹配
|
/// </summary>
|
public async Task<AssetsMatchingViewModel> SetMatching(AssetsMatchingViewModel input)
|
{
|
if (input == null)
|
return null;
|
_pumpMain = new BLL.PumpMain();
|
_adaptingManage = new BLL.AdaptingManage();
|
_pipeLineManage = new BLL.PipeLineManage();
|
_valveMain = new BLL.ValveMain();
|
var allPump = await _pumpMain.GetAll();
|
var allAdapting = await _adaptingManage.GetAll();
|
var allPipeLine = await _pipeLineManage.GetAll();
|
var allValve = await _valveMain.GetAll();
|
var assetsAutoMatching = new AssetsMatchingViewModel();
|
//泵匹配
|
var pumpMatching = await this.pumpMatchingCtrl1.SetMatching(input.PumpMatchingList, allPump);
|
//三通匹配
|
var threeLinkMatching = this.threeLinkMatchingCtrl1.SetMatching(input.ThreelinkMatchingList, allAdapting);
|
//四通匹配
|
var fourLinkMatching = this.fourLinkMatchingCtrl1.SetMatching(input.FourlinkMatchingList, allAdapting);
|
//管道匹配
|
var pipeLineMatching = this.pipeLineMatchingCtrl1.SetMatching(input.PipeMatchingList, allPipeLine);
|
//阀门匹配
|
var valveMatching = this.valveMatchingCtrl1.SetMatching(input.ValveMatchingList, allValve);
|
//弯头匹配
|
var elbowsMatching = this.elbowsMatchingCtrl1.SetMatching(input.ElbowsMatchingList, allAdapting);
|
|
assetsAutoMatching.PumpMatchingList = pumpMatching;
|
assetsAutoMatching.ThreelinkMatchingList = threeLinkMatching;
|
assetsAutoMatching.FourlinkMatchingList = fourLinkMatching;
|
assetsAutoMatching.ElbowsMatchingList = elbowsMatching;
|
assetsAutoMatching.PipeMatchingList = pipeLineMatching;
|
assetsAutoMatching.ValveMatchingList = valveMatching;
|
return assetsAutoMatching;
|
}
|
|
//确定
|
private void btnComplete_Click(object sender, EventArgs e)
|
{
|
if (RelaodEvent.Invoke(_assetsAutoMatching))
|
{
|
TipFormHelper.ShowSucceed("修改成功!");
|
}
|
else
|
{
|
TipFormHelper.ShowError("修改失败!");
|
}
|
}
|
}
|
}
|