lixiaojun
2025-01-20 bef933e7e166b085ba7e46e38ea62d9ae0129ec6
WinFrmUI/HStation.WinFrmUI.Assets.Core/12-package/01-series/PackageTreeListCtrl.cs
@@ -51,7 +51,7 @@
        private void BtnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var dlg = new AddAssetsPackageSeriesDlg();
            dlg.ReloadDataEvent += async (rhs, currentId) =>
            dlg.ReloadDataEvent += async (rhs, currentId, manufacturerId) =>
            {
                if (currentId != null)
                {
@@ -64,6 +64,15 @@
                {
                    rhs.ID = id;
                    _allBindingList.Add(new AssetsPackageSeriesViewModel(rhs));
                    if (manufacturerId != null)
                    {
                        var mappingVmo = new Vmo.AssetsPackageMfrMappingVmo
                        {
                            ManufacturerID = Convert.ToInt64(manufacturerId),
                            SeriesID = id
                        };
                        await new BLL.AssetsPackageSeriesManufacturerMapping().Insert(mappingVmo);
                    }
                    this.treeList1.RefreshDataSource();
                    return true;
                }
@@ -78,7 +87,6 @@
            var vm = this.treeList1.GetCurrentViewModel(_allBindingList);
            if (vm == null)
            {
                //MessageBoxHelper.ShowWarning("请选择数据行!");
                return;
            }
            ReloadEvent.Invoke(vm.ID);
@@ -98,7 +106,7 @@
            if (AssetsEquipmentSeries == null)
                return;
            dlg.SetBindingData(AssetsEquipmentSeries);
            dlg.ReloadDataEvent += async (rhs, currentId) =>
            dlg.ReloadDataEvent += async (rhs, currentId, mapping) =>
            {
                if (currentId != null)
                {
@@ -108,6 +116,10 @@
                if (await BLLFactory<BLL.AssetsPackageSeries>.Instance.Update(rhs))
                {
                    vm.Reset(rhs);
                    if (mapping != null)
                    {
                        await new BLL.AssetsPackageSeriesManufacturerMapping().Update(mapping);
                    }
                    this.treeList1.RefreshDataSource();
                    return true;
                }
@@ -131,6 +143,11 @@
            if (groupresult)
            {
                _allBindingList.Remove(currentVm);
                var mapping = await new BLL.AssetsPackageSeriesManufacturerMapping().GetBySeriesID(currentVm.ID);
                if (mapping != null)
                {
                    await new BLL.AssetsPackageSeriesManufacturerMapping().DeleteByID(Convert.ToInt64(mapping.ManufacturerID));
                }
                this.treeList1.RefreshDataSource();
                TipFormHelper.ShowSucceed("删除成功!");
            }