duheng
2024-07-24 dc93db6fef81b17e572f293321a980a6c50e67f9
增加删除拓展方法
已修改13个文件
426 ■■■■■ 文件已修改
BLL/HStation.BLL.Assets.Core/01-interface/IPumpProduct/IPumpPartMain.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BLL/HStation.BLL.Assets.Core/03-localclient/PumpProduct/PumpPart.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BLL/HStation.BLL.Assets.Core/04-bll/01-PumpProdcuct/05-PumpPartMain/PumpPartMain.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Assets.Core/02-dal/01-interface/IPumpPartMain.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Assets.Core/02-dal/02-postgresql/PumpPart.cs 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Assets.Core/03-service/05-PumpPartMain/PumpPartMain.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Service/HStation.Service.Assets.Core/03-service/06-PumpPropContent/PumpPropContent.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Assets.Core/00-PumpProductManage/AddPumpProductSeriesDlg.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Assets.Core/00-PumpProductManage/EditPumpPartDlg.Designer.cs 153 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Assets.Core/00-PumpProductManage/EditPumpPartDlg.cs 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Assets.Core/00-PumpProductManage/PumpProductMainPanel.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Assets.Core/HStation.WinFrmUI.Assets.Core.csproj.user 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Core/00-core/ListBoxControlExtensions.cs 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BLL/HStation.BLL.Assets.Core/01-interface/IPumpProduct/IPumpPartMain.cs
@@ -15,5 +15,7 @@
        public Task<long> InsertEx(AddPumpPartMainDto part, List<AddPumpPropContentDto> propcontents, AddPumpMainAndPartMapDto partmap);
        public Task<bool> UpdateEx(UpdatePumpPartMainDto pumppart, List<UpdatePumpPropContentDto> updatePumpPropContentDtos);
        public Task<bool> DeleteEx(long ID);
    }
}
BLL/HStation.BLL.Assets.Core/03-localclient/PumpProduct/PumpPart.cs
@@ -241,6 +241,19 @@
            });
        }
        public async Task<bool> DeleteEx(long ID)
        {
            return await Task.Factory.StartNew(() =>
            {
                var bol = _service.DeleteExByID(ID);
                if (!bol)
                {
                    throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D999, "删除失败");
                }
                return true;
            });
        }
        /// <summary>
        /// 通过 Ids 删除
        /// </summary>
BLL/HStation.BLL.Assets.Core/04-bll/01-PumpProdcuct/05-PumpPartMain/PumpPartMain.cs
@@ -127,6 +127,12 @@
            return await _cal.DeleteByIds(Ids);
        }
        //删除拓展(删除产品表及属性表)
        public async Task<bool> DeleteEx(long ID)
        {
            return await _cal.DeleteEx(ID);
        }
        /// <summary>
        ///
        /// </summary>
Service/HStation.Service.Assets.Core/02-dal/01-interface/IPumpPartMain.cs
@@ -10,5 +10,7 @@
        long InsertsEx(Entity.PumpPartMain part, List<Entity.PumpPropContent> pumpPropContents, Entity.PumpMainAndPartMap partmap);
        bool UpdateEx(Entity.PumpPartMain part, List<Entity.PumpPropContent> pumpPropContents);
        bool DeleteEx(Entity.PumpPartMain part, List<Entity.PumpPropContent> pumpPropContents);
    }
}
Service/HStation.Service.Assets.Core/02-dal/02-postgresql/PumpPart.cs
@@ -96,8 +96,49 @@
                    {
                        if (pumpPropContents != null)
                        {
                            var mainandpartmap = db.Updateable(pumpPropContents).ExecuteCommandHasChange();
                            if (!mainandpartmap)
                            var propresult = db.Updateable(pumpPropContents).ExecuteCommandHasChange();
                            if (!propresult)
                            {
                                db.RollbackTran();
                                return default;
                            }
                        }
                    }
                    db.CommitTran();
                    return result;
                }
                catch (Exception ex)
                {
                    db.RollbackTran();
                    throw;
                }
            }
        }
        //删除拓展 (删除产品表及属性表)
        public bool DeleteEx(Entity.PumpPartMain part, List<Entity.PumpPropContent> pumpPropContents)
        {
            if (part == null)
            {
                return default;
            }
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                try
                {
                    db.BeginTran();
                    var result = db.Deleteable(part).ExecuteCommand() > 0;
                    if (!result)
                    {
                        db.RollbackTran();
                        return default;
                    }
                    else
                    {
                        if (pumpPropContents != null)
                        {
                            var propresult = db.Deleteable(pumpPropContents).ExecuteCommand() > 0;
                            if (!propresult)
                            {
                                db.RollbackTran();
                                return default;
Service/HStation.Service.Assets.Core/03-service/05-PumpPartMain/PumpPartMain.cs
@@ -327,6 +327,22 @@
            return bol;
        }
        //通过 ID 删除产品表及属性表
        public bool DeleteExByID(long ID)
        {
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IPumpPartMain>();
            var partmain = dal.GetByID(ID);
            var propmodellist = PumpPropContent.GetProplistByPartID(ID);
            var propentitylist = PumpPropContent.Model2Entities(propmodellist);
            var bol = dal.DeleteEx(partmain, propentitylist);
            if (bol)
            {
                RemoveCache(ID);
                PumpPropContent.RemoveCacheByIDs(propmodellist.Select(x => x.ID).ToList());
            }
            return bol;
        }
        #endregion Delete
    }
}
Service/HStation.Service.Assets.Core/03-service/06-PumpPropContent/PumpPropContent.cs
@@ -93,12 +93,11 @@
            PumpSeriesCacheHelper.Trigger();
        }
        //通过组ID移除缓存
        public static void RemoveCacheByGroupID(long ID)
        //移除缓存
        public static void RemoveCacheByIDs(List<long> IdS)
        {
            var all = GetCache();
            var maplist = PumpGroupAndMainMap.GetMainIDByGroupID(ID);
            all.RemoveAll(item => maplist.Any(mapItem => mapItem == item.ID));
            IdS.Select(x => all.RemoveAll(y => y.ID == x));
            PumpSeriesCacheHelper.Trigger();
        }
@@ -142,6 +141,15 @@
        }
        /// <summary>
        /// 通过 产品ID 获取
        /// </summary>
        public static List<Model.PumpPropContent> GetProplistByPartID(long ID)
        {
            var all = GetCache();
            return all.Where(x => x.PartID == ID).ToList();
        }
        /// <summary>
        /// 通过 ID 获取
        /// </summary>
        public List<Model.PumpPropContent> GetByIds(List<long> Ids)
WinFrmUI/HStation.WinFrmUI.Assets.Core/00-PumpProductManage/AddPumpProductSeriesDlg.cs
@@ -22,12 +22,7 @@
                this.dxErrorProvider1.SetError(this.NameTextEdit, "必填项");
                return false;
            }
            if (this.TextEditCatalogChoice.EditValue==null)
            {
                this.dxErrorProvider1.SetError(this.TextEditCatalogChoice, "必填项");
                return false;
            }
            if (string.IsNullOrEmpty(TextEditCatalogChoice.Text.Trim()))
            if (this.TextEditCatalogChoice.EditValue == null)
            {
                this.dxErrorProvider1.SetError(this.TextEditCatalogChoice, "必填项");
                return false;
@@ -38,11 +33,13 @@
        //完成
        private async void BtnOk_ClickAsync(object sender, EventArgs e)
        {
            if (!Valid())
                return;
            var model = new AddPumpSeriesDto();
            model.Name = NameTextEdit.Text.Trim();
            model.TagName = TagNameTextEdit.Text.Trim();
            model.MotorFrequency = MotorFrequencyTextEdit.Text.Trim();
            if (long.TryParse(TextEditCatalogChoice.EditValue?.ToString()??"", out long catalogID))
            if (long.TryParse(TextEditCatalogChoice.EditValue?.ToString() ?? "", out long catalogID))
            {
                model.CatalogID = catalogID;
            }
WinFrmUI/HStation.WinFrmUI.Assets.Core/00-PumpProductManage/EditPumpPartDlg.Designer.cs
@@ -30,9 +30,8 @@
        {
            components = new System.ComponentModel.Container();
            layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
            ListBoxPart = new DevExpress.XtraEditors.ListBoxControl();
            BtnAddPumpPart = new DevExpress.XtraEditors.SimpleButton();
            treeListPart = new DevExpress.XtraTreeList.TreeList();
            treeListColumn1 = new DevExpress.XtraTreeList.Columns.TreeListColumn();
            BtnOk = new DevExpress.XtraEditors.SimpleButton();
            simpleButton1 = new DevExpress.XtraEditors.SimpleButton();
            gridControl1 = new DevExpress.XtraGrid.GridControl();
@@ -47,15 +46,16 @@
            Root = new DevExpress.XtraLayout.LayoutControlGroup();
            layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
            layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
            layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
            emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem();
            layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem();
            layoutControlItem6 = new DevExpress.XtraLayout.LayoutControlItem();
            layoutControlItem7 = new DevExpress.XtraLayout.LayoutControlItem();
            layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
            layoutControlItem8 = new DevExpress.XtraLayout.LayoutControlItem();
            layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
            popupPumpPartMenu = new DevExpress.XtraBars.PopupMenu(components);
            BarBtnAddPumpPart = new DevExpress.XtraBars.BarButtonItem();
            barBtnDeletePart = new DevExpress.XtraBars.BarButtonItem();
            barManager1 = new DevExpress.XtraBars.BarManager(components);
            barDockControlTop = new DevExpress.XtraBars.BarDockControl();
            barDockControlBottom = new DevExpress.XtraBars.BarDockControl();
@@ -63,7 +63,7 @@
            barDockControlRight = new DevExpress.XtraBars.BarDockControl();
            ((System.ComponentModel.ISupportInitialize)layoutControl1).BeginInit();
            layoutControl1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)treeListPart).BeginInit();
            ((System.ComponentModel.ISupportInitialize)ListBoxPart).BeginInit();
            ((System.ComponentModel.ISupportInitialize)gridControl1).BeginInit();
            ((System.ComponentModel.ISupportInitialize)propGroupChoiceViewModelBindingSource).BeginInit();
            ((System.ComponentModel.ISupportInitialize)gridView1).BeginInit();
@@ -73,21 +73,21 @@
            ((System.ComponentModel.ISupportInitialize)Root).BeginInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem1).BeginInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem3).BeginInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem4).BeginInit();
            ((System.ComponentModel.ISupportInitialize)emptySpaceItem1).BeginInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem5).BeginInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem6).BeginInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem7).BeginInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem2).BeginInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem8).BeginInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem4).BeginInit();
            ((System.ComponentModel.ISupportInitialize)popupPumpPartMenu).BeginInit();
            ((System.ComponentModel.ISupportInitialize)barManager1).BeginInit();
            SuspendLayout();
            // 
            // layoutControl1
            // 
            layoutControl1.Controls.Add(ListBoxPart);
            layoutControl1.Controls.Add(BtnAddPumpPart);
            layoutControl1.Controls.Add(treeListPart);
            layoutControl1.Controls.Add(BtnOk);
            layoutControl1.Controls.Add(simpleButton1);
            layoutControl1.Controls.Add(gridControl1);
@@ -102,45 +102,39 @@
            layoutControl1.TabIndex = 0;
            layoutControl1.Text = "layoutControl1";
            // 
            // ListBoxPart
            //
            ListBoxPart.Appearance.Options.UseTextOptions = true;
            ListBoxPart.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            ListBoxPart.AppearanceDisabled.Options.UseTextOptions = true;
            ListBoxPart.AppearanceDisabled.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            ListBoxPart.Location = new Point(12, 12);
            ListBoxPart.Name = "ListBoxPart";
            ListBoxPart.Size = new Size(187, 512);
            ListBoxPart.StyleController = layoutControl1;
            ListBoxPart.TabIndex = 8;
            ListBoxPart.SelectedIndexChanged += ListBoxPart_SelectedIndexChanged;
            ListBoxPart.MouseUp += ListBoxPart_MouseUp;
            //
            // BtnAddPumpPart
            // 
            BtnAddPumpPart.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Warning;
            BtnAddPumpPart.Appearance.Options.UseBackColor = true;
            BtnAddPumpPart.Location = new Point(652, 502);
            BtnAddPumpPart.Location = new Point(722, 502);
            BtnAddPumpPart.Name = "BtnAddPumpPart";
            BtnAddPumpPart.Size = new Size(107, 22);
            BtnAddPumpPart.Size = new Size(94, 22);
            BtnAddPumpPart.StyleController = layoutControl1;
            BtnAddPumpPart.TabIndex = 5;
            BtnAddPumpPart.Text = "添加产品";
            BtnAddPumpPart.Click += BtnAddPumpPart_Click;
            // 
            // treeListPart
            //
            treeListPart.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] { treeListColumn1 });
            treeListPart.Location = new Point(12, 12);
            treeListPart.Name = "treeListPart";
            treeListPart.Size = new Size(217, 486);
            treeListPart.TabIndex = 0;
            treeListPart.ViewStyle = DevExpress.XtraTreeList.TreeListViewStyle.TreeView;
            treeListPart.FocusedNodeChanged += treeListPart_FocusedNodeChanged;
            treeListPart.MouseUp += treeListPart_MouseUp;
            //
            // treeListColumn1
            //
            treeListColumn1.Caption = "treeListColumn1";
            treeListColumn1.FieldName = "Name";
            treeListColumn1.Name = "treeListColumn1";
            treeListColumn1.OptionsColumn.AllowEdit = false;
            treeListColumn1.Visible = true;
            treeListColumn1.VisibleIndex = 0;
            //
            // BtnOk
            // 
            BtnOk.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Primary;
            BtnOk.Appearance.Options.UseBackColor = true;
            BtnOk.Location = new Point(763, 502);
            BtnOk.Location = new Point(820, 502);
            BtnOk.Name = "BtnOk";
            BtnOk.Size = new Size(101, 22);
            BtnOk.Size = new Size(86, 22);
            BtnOk.StyleController = layoutControl1;
            BtnOk.TabIndex = 4;
            BtnOk.Text = "确认编辑";
@@ -151,9 +145,9 @@
            simpleButton1.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Danger;
            simpleButton1.Appearance.Options.UseBackColor = true;
            simpleButton1.DialogResult = DialogResult.Cancel;
            simpleButton1.Location = new Point(868, 502);
            simpleButton1.Location = new Point(910, 502);
            simpleButton1.Name = "simpleButton1";
            simpleButton1.Size = new Size(121, 22);
            simpleButton1.Size = new Size(79, 22);
            simpleButton1.StyleController = layoutControl1;
            simpleButton1.TabIndex = 5;
            simpleButton1.Text = "取消";
@@ -161,10 +155,10 @@
            // gridControl1
            // 
            gridControl1.DataSource = propGroupChoiceViewModelBindingSource;
            gridControl1.Location = new Point(233, 84);
            gridControl1.Location = new Point(203, 84);
            gridControl1.MainView = gridView1;
            gridControl1.Name = "gridControl1";
            gridControl1.Size = new Size(756, 414);
            gridControl1.Size = new Size(786, 414);
            gridControl1.TabIndex = 3;
            gridControl1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { gridView1 });
            // 
@@ -216,25 +210,25 @@
            // 
            // TextEditProductName
            // 
            TextEditProductName.Location = new Point(297, 12);
            TextEditProductName.Location = new Point(267, 12);
            TextEditProductName.Name = "TextEditProductName";
            TextEditProductName.Size = new Size(692, 20);
            TextEditProductName.Size = new Size(722, 20);
            TextEditProductName.StyleController = layoutControl1;
            TextEditProductName.TabIndex = 2;
            // 
            // TextEditProductCode
            // 
            TextEditProductCode.Location = new Point(297, 36);
            TextEditProductCode.Location = new Point(267, 36);
            TextEditProductCode.Name = "TextEditProductCode";
            TextEditProductCode.Size = new Size(692, 20);
            TextEditProductCode.Size = new Size(722, 20);
            TextEditProductCode.StyleController = layoutControl1;
            TextEditProductCode.TabIndex = 6;
            // 
            // TextEditNo
            // 
            TextEditNo.Location = new Point(297, 60);
            TextEditNo.Location = new Point(267, 60);
            TextEditNo.Name = "TextEditNo";
            TextEditNo.Size = new Size(692, 20);
            TextEditNo.Size = new Size(722, 20);
            TextEditNo.StyleController = layoutControl1;
            TextEditNo.TabIndex = 7;
            // 
@@ -242,7 +236,7 @@
            // 
            Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
            Root.GroupBordersVisible = false;
            Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { layoutControlItem1, layoutControlItem3, layoutControlItem4, emptySpaceItem1, layoutControlItem5, layoutControlItem6, layoutControlItem7, layoutControlItem2, layoutControlItem8 });
            Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { layoutControlItem1, layoutControlItem3, emptySpaceItem1, layoutControlItem5, layoutControlItem6, layoutControlItem7, layoutControlItem2, layoutControlItem8, layoutControlItem4 });
            Root.Name = "Root";
            Root.Size = new Size(1001, 536);
            Root.TextVisible = false;
@@ -250,86 +244,86 @@
            // layoutControlItem1
            // 
            layoutControlItem1.Control = gridControl1;
            layoutControlItem1.Location = new Point(221, 72);
            layoutControlItem1.Location = new Point(191, 72);
            layoutControlItem1.Name = "layoutControlItem1";
            layoutControlItem1.Size = new Size(760, 418);
            layoutControlItem1.Size = new Size(790, 418);
            layoutControlItem1.TextSize = new Size(0, 0);
            layoutControlItem1.TextVisible = false;
            // 
            // layoutControlItem3
            // 
            layoutControlItem3.Control = simpleButton1;
            layoutControlItem3.Location = new Point(856, 490);
            layoutControlItem3.Location = new Point(898, 490);
            layoutControlItem3.Name = "layoutControlItem3";
            layoutControlItem3.Size = new Size(125, 26);
            layoutControlItem3.Size = new Size(83, 26);
            layoutControlItem3.TextSize = new Size(0, 0);
            layoutControlItem3.TextVisible = false;
            //
            // layoutControlItem4
            //
            layoutControlItem4.Control = treeListPart;
            layoutControlItem4.Location = new Point(0, 0);
            layoutControlItem4.Name = "layoutControlItem4";
            layoutControlItem4.Size = new Size(221, 490);
            layoutControlItem4.TextSize = new Size(0, 0);
            layoutControlItem4.TextVisible = false;
            // 
            // emptySpaceItem1
            // 
            emptySpaceItem1.AllowHotTrack = false;
            emptySpaceItem1.Location = new Point(0, 490);
            emptySpaceItem1.Location = new Point(191, 490);
            emptySpaceItem1.Name = "emptySpaceItem1";
            emptySpaceItem1.Size = new Size(640, 26);
            emptySpaceItem1.Size = new Size(519, 26);
            emptySpaceItem1.TextSize = new Size(0, 0);
            // 
            // layoutControlItem5
            // 
            layoutControlItem5.Control = TextEditProductName;
            layoutControlItem5.Location = new Point(221, 0);
            layoutControlItem5.Location = new Point(191, 0);
            layoutControlItem5.Name = "layoutControlItem5";
            layoutControlItem5.Size = new Size(760, 24);
            layoutControlItem5.Size = new Size(790, 24);
            layoutControlItem5.Text = "产品名称:";
            layoutControlItem5.TextSize = new Size(52, 14);
            // 
            // layoutControlItem6
            // 
            layoutControlItem6.Control = TextEditProductCode;
            layoutControlItem6.Location = new Point(221, 24);
            layoutControlItem6.Location = new Point(191, 24);
            layoutControlItem6.Name = "layoutControlItem6";
            layoutControlItem6.Size = new Size(760, 24);
            layoutControlItem6.Size = new Size(790, 24);
            layoutControlItem6.Text = "产品图号:";
            layoutControlItem6.TextSize = new Size(52, 14);
            // 
            // layoutControlItem7
            // 
            layoutControlItem7.Control = TextEditNo;
            layoutControlItem7.Location = new Point(221, 48);
            layoutControlItem7.Location = new Point(191, 48);
            layoutControlItem7.Name = "layoutControlItem7";
            layoutControlItem7.Size = new Size(760, 24);
            layoutControlItem7.Size = new Size(790, 24);
            layoutControlItem7.Text = "产品编号:";
            layoutControlItem7.TextSize = new Size(52, 14);
            // 
            // layoutControlItem2
            // 
            layoutControlItem2.Control = BtnOk;
            layoutControlItem2.Location = new Point(751, 490);
            layoutControlItem2.Location = new Point(808, 490);
            layoutControlItem2.Name = "layoutControlItem2";
            layoutControlItem2.Size = new Size(105, 26);
            layoutControlItem2.Size = new Size(90, 26);
            layoutControlItem2.TextSize = new Size(0, 0);
            layoutControlItem2.TextVisible = false;
            // 
            // layoutControlItem8
            // 
            layoutControlItem8.Control = BtnAddPumpPart;
            layoutControlItem8.Location = new Point(640, 490);
            layoutControlItem8.Location = new Point(710, 490);
            layoutControlItem8.Name = "layoutControlItem8";
            layoutControlItem8.Size = new Size(111, 26);
            layoutControlItem8.Size = new Size(98, 26);
            layoutControlItem8.TextSize = new Size(0, 0);
            layoutControlItem8.TextVisible = false;
            // 
            // layoutControlItem4
            //
            layoutControlItem4.Control = ListBoxPart;
            layoutControlItem4.Location = new Point(0, 0);
            layoutControlItem4.Name = "layoutControlItem4";
            layoutControlItem4.Size = new Size(191, 516);
            layoutControlItem4.TextSize = new Size(0, 0);
            layoutControlItem4.TextVisible = false;
            //
            // popupPumpPartMenu
            // 
            popupPumpPartMenu.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(BarBtnAddPumpPart) });
            popupPumpPartMenu.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(BarBtnAddPumpPart), new DevExpress.XtraBars.LinkPersistInfo(barBtnDeletePart) });
            popupPumpPartMenu.Manager = barManager1;
            popupPumpPartMenu.Name = "popupPumpPartMenu";
            // 
@@ -338,6 +332,14 @@
            BarBtnAddPumpPart.Caption = "添加产品";
            BarBtnAddPumpPart.Id = 0;
            BarBtnAddPumpPart.Name = "BarBtnAddPumpPart";
            BarBtnAddPumpPart.ItemClick += BarBtnAddPumpPart_ItemClick;
            //
            // barBtnDeletePart
            //
            barBtnDeletePart.Caption = "删除产品";
            barBtnDeletePart.Id = 1;
            barBtnDeletePart.Name = "barBtnDeletePart";
            barBtnDeletePart.ItemClick += BarBtnDeletePart_ItemClick;
            // 
            // barManager1
            // 
@@ -346,8 +348,8 @@
            barManager1.DockControls.Add(barDockControlLeft);
            barManager1.DockControls.Add(barDockControlRight);
            barManager1.Form = this;
            barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { BarBtnAddPumpPart });
            barManager1.MaxItemId = 1;
            barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { BarBtnAddPumpPart, barBtnDeletePart });
            barManager1.MaxItemId = 2;
            // 
            // barDockControlTop
            // 
@@ -396,7 +398,7 @@
            Text = "编辑产品";
            ((System.ComponentModel.ISupportInitialize)layoutControl1).EndInit();
            layoutControl1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)treeListPart).EndInit();
            ((System.ComponentModel.ISupportInitialize)ListBoxPart).EndInit();
            ((System.ComponentModel.ISupportInitialize)gridControl1).EndInit();
            ((System.ComponentModel.ISupportInitialize)propGroupChoiceViewModelBindingSource).EndInit();
            ((System.ComponentModel.ISupportInitialize)gridView1).EndInit();
@@ -406,18 +408,21 @@
            ((System.ComponentModel.ISupportInitialize)Root).EndInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem1).EndInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem3).EndInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem4).EndInit();
            ((System.ComponentModel.ISupportInitialize)emptySpaceItem1).EndInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem5).EndInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem6).EndInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem7).EndInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem2).EndInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem8).EndInit();
            ((System.ComponentModel.ISupportInitialize)layoutControlItem4).EndInit();
            ((System.ComponentModel.ISupportInitialize)popupPumpPartMenu).EndInit();
            ((System.ComponentModel.ISupportInitialize)barManager1).EndInit();
            ResumeLayout(false);
            PerformLayout();
        }
@@ -431,20 +436,17 @@
        private DevExpress.XtraGrid.Columns.GridColumn colPropName;
        private DevExpress.XtraGrid.Columns.GridColumn colValue;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1;
        private DevExpress.XtraTreeList.TreeList treeListPart;
        private DevExpress.XtraEditors.SimpleButton BtnOk;
        private DevExpress.XtraEditors.SimpleButton simpleButton1;
        private DevExpress.XtraEditors.TextEdit TextEditProductName;
        private DevExpress.XtraEditors.TextEdit TextEditProductCode;
        private DevExpress.XtraEditors.TextEdit TextEditNo;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2;
        private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem5;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem6;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem7;
        private DevExpress.XtraTreeList.Columns.TreeListColumn treeListColumn1;
        private BindingSource propGroupChoiceViewModelBindingSource;
        private DevExpress.XtraBars.PopupMenu popupPumpPartMenu;
        private DevExpress.XtraBars.BarButtonItem BarBtnAddPumpPart;
@@ -455,5 +457,8 @@
        private DevExpress.XtraBars.BarDockControl barDockControlRight;
        private DevExpress.XtraEditors.SimpleButton BtnAddPumpPart;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem8;
        private DevExpress.XtraEditors.ListBoxControl ListBoxPart;
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4;
        private DevExpress.XtraBars.BarButtonItem barBtnDeletePart;
    }
}
WinFrmUI/HStation.WinFrmUI.Assets.Core/00-PumpProductManage/EditPumpPartDlg.cs
@@ -1,4 +1,5 @@
using HStation.WinFrmUI.Xhs.PumpProduct;
using DevExpress.XtraEditors;
using HStation.WinFrmUI.Xhs.PumpProduct;
using Mapster;
namespace HStation.WinFrmUI
@@ -9,10 +10,13 @@
        {
            InitializeComponent();
            this.gridView1.Columns["PropGroupName"].Group();
            ListBoxPart.DisplayMember = "Name";
            ListBoxPart.ValueMember = "ID";
        }
        private BLL.PumpPartMain _bll = null;
        private List<PropGroupChoiceViewModel> _proplist = null;
        private List<CurrentPartMainViewModel> _allBindingList = new List<CurrentPartMainViewModel>();
        private AddPumpMainAndPartMapDto _partmap = null;
@@ -29,37 +33,41 @@
        public event Func<AddPumpPartMainDto, List<AddPumpPropContentDto>, AddPumpMainAndPartMapDto, Task<bool>> ReloadEvent;
        //数据绑定
        public async void SetBindingData(long pumpID)
        public async void SetBindingData(PumpMainDto pumpMain)
        {
            _bll = new BLL.PumpPartMain();
            var alllist = await _bll.GetByPumpMainID(pumpID);
            var series = await new BLL.PumpSeries().GetByID(alllist.First().SeriesID);
            var allpartlist = await _bll.GetByPumpMainID(pumpMain.ID);   //获取所有产品
            var series = await new BLL.PumpSeries().GetByID(pumpMain.PumpSeriesID);  //获取系列
            _pumpPart = new AddPumpPartMainDto();
            _seriesID = series.ID;
            _pumpPart.SeriesID = _seriesID;
            foreach (var item in alllist)
            if (allpartlist != null)
            {
                var model = new CurrentPartMainViewModel(item);
                _allBindingList.Add(model);
                foreach (var item in allpartlist)
                {
                    var model = new CurrentPartMainViewModel(item);
                    _allBindingList.Add(model);
                }
            }
            _catalogID = series.CatalogID;
            _proplist = new List<PropGroupChoiceViewModel>();
            _partmap = new AddPumpMainAndPartMapDto();
            _partmap.PumpID = pumpID;
            _partmap.PumpID = pumpMain.ID;
            _partmap.SeriesID = _seriesID;
            this.treeListPart.DataSource = _allBindingList;
            this.treeListPart.RefreshDataSource();
            this.ListBoxPart.DataSource = _allBindingList;
            this.ListBoxPart.Refresh();
            this.propGroupChoiceViewModelBindingSource.DataSource = _proplist;
            this.propGroupChoiceViewModelBindingSource.ResetBindings(false);
        }
        //分类选择变换
        private async void SetPropSelectedValue(CurrentPartMainViewModel viewmodel)
        private async void SetPropSelectedValue(CurrentPartMainViewModel partmain)
        {
            this.gridView1.ExpandAllGroups();
            this.TextEditNo.Text = viewmodel.NO.Trim();
            this.TextEditProductCode.Text = viewmodel.Code.Trim();
            this.TextEditProductName.Text = viewmodel.Name.Trim();
            var model = await _bll.GetByID(partmain.ID);
            if (model == null) return;
            this.TextEditNo.Text = partmain.NO.Trim();
            this.TextEditProductCode.Text = partmain.Code.Trim();
            this.TextEditProductName.Text = partmain.Name.Trim();
            _proplist.Clear();
            var bll = new Yw.BLL.SysPropStruct();
            var catlog = await bll.GetByCatalogID(_catalogID);
@@ -77,7 +85,7 @@
                }
            }
            var propbll = new BLL.PumpPartPropContent();
            var alllist = await propbll.GetByPumpPartID(viewmodel.ID);
            var alllist = await propbll.GetByPumpPartID(model.ID);
            _allPropList = alllist;
            foreach (var item in alllist)
            {
@@ -87,18 +95,20 @@
        }
        //产品列表聚焦改变
        private void treeListPart_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        private void ListBoxPart_SelectedIndexChanged(object sender, EventArgs e)
        {
            var vm = this.treeListPart.GetCurrentViewModel(_allBindingList);
            if (vm == null) return;
            var vm = this.ListBoxPart.GetCurrentViewModel(_allBindingList);
            if (vm == null)
                return;
            SetPropSelectedValue(vm);
        }
        //确认编辑
        private async void BtnOk_Click(object sender, EventArgs e)
        {
            var vm = this.treeListPart.GetCurrentViewModel(_allBindingList);
            if (vm == null) return;
            var vm = this.ListBoxPart.GetCurrentViewModel(_allBindingList);
            if (vm == null)
                return;
            var updatepart = new UpdatePumpPartMainDto();
            updatepart.ID = vm.ID;
            updatepart.Name = TextEditProductName.Text;
@@ -114,7 +124,7 @@
            if (await _bll.UpdateEx(updatepart, update))
            {
                vm.Reset(updatepart);
                this.treeListPart.Refresh();
                this.ListBoxPart.Refresh();
                MessageBoxHelper.ShowSuccess("修改成功!");
            }
            else
@@ -124,15 +134,12 @@
        }
        //左侧树右击菜单事件
        private void treeListPart_MouseUp(object sender, MouseEventArgs e)
        private void ListBoxPart_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                if (this.gridView1.GetCurrentViewModel(_allBindingList) != null)
                {
                    Point screenPoint = Cursor.Position;
                    popupPumpPartMenu.ShowPopup(screenPoint);
                }
                Point screenPoint = Cursor.Position;
                popupPumpPartMenu.ShowPopup(screenPoint);
            }
        }
@@ -153,7 +160,7 @@
                var pumppart = await _bll.GetByID(id);
                _allBindingList.Add(new CurrentPartMainViewModel(pumppart));
                this.treeListPart.RefreshDataSource();
                this.ListBoxPart.Refresh();
                MessageBoxHelper.ShowSuccess("添加成功!");
            }
            else
@@ -161,5 +168,35 @@
                MessageBoxHelper.ShowError("添加失败!");
            }
        }
        #region 菜单功能
        //添加产品
        private void BarBtnAddPumpPart_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
        }
        //  删除产品
        private async void BarBtnDeletePart_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var vm = this.ListBoxPart.GetCurrentViewModel(_allBindingList);
            if (vm == null)
                return;
            if (!MessageBoxHelper.IsClickOk("确定删除数据行"))
            {
                if (await _bll.DeleteEx(vm.ID))
                {
                    _allBindingList.Remove(vm);
                    this.ListBoxPart.Refresh();
                    MessageBoxHelper.ShowSuccess("删除成功!");
                }
                else
                {
                    MessageBoxHelper.ShowError("删除失败!");
                }
            }
        }
        #endregion 菜单功能
    }
}
WinFrmUI/HStation.WinFrmUI.Assets.Core/00-PumpProductManage/PumpProductMainPanel.cs
@@ -157,7 +157,7 @@
            var guid = new PageGuid()
            {
                Function = "泵曲线管理",
                TagName=currentVm.ID.ToString(),
                TagName = currentVm.ID.ToString(),
                Modular = ""
            };
            if (!IsExistPage(guid, true))
@@ -174,7 +174,6 @@
                page.PageTitle.Caption = guid.Function;
                page.PageGuid = guid;
                CreatePage(page, guid);
            }
        }
@@ -188,7 +187,8 @@
                return;
            }
            var dlg = new EditPumpPartDlg();
            dlg.SetBindingData(currentVm.ID);
            var pumpmain = currentVm as PumpMainDto;
            dlg.SetBindingData(pumpmain);
            dlg.ReloadEvent += async (part, content, map) =>
            {
                var bll = new BLL.PumpPartMain();
WinFrmUI/HStation.WinFrmUI.Assets.Core/HStation.WinFrmUI.Assets.Core.csproj.user
@@ -2,7 +2,25 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup />
  <ItemGroup>
    <Compile Update="00-PumpProductManage\AddPumpProductGroupDlg.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Update="00-PumpProductManage\AddPumpProductMainDlg.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Update="00-PumpProductManage\AddPumpProductSeriesDlg.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Update="00-PumpProductManage\EditPumpPartDlg.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Update="00-PumpProductManage\EditPumpProductGroupDlg.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Update="00-PumpProductManage\EditPumpProductMainDlg.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Update="00-PumpProductManage\EditPumpProductSeriesDlg.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Update="00-PumpProductManage\PumpProductMainPanel.cs">
@@ -15,24 +33,6 @@
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Update="02-UICore\00-DocumentPage\MainForm.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Update="00-PumpProductManage\AddPumpProductGroupDlg.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Update="00-PumpProductManage\AddPumpProductMainDlg.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Update="00-PumpProductManage\AddPumpProductSeriesDlg.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Update="00-PumpProductManage\EditPumpProductGroupDlg.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Update="00-PumpProductManage\EditPumpProductMainDlg.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Update="00-PumpProductManage\EditPumpProductSeriesDlg.cs">
      <SubType>Form</SubType>
    </Compile>
  </ItemGroup>
WinFrmUI/Yw.WinFrmUI.Core/00-core/ListBoxControlExtensions.cs
@@ -1,17 +1,36 @@
namespace Yw.WinFrmUI
{
    /// <summary>
    ///
    ///
    /// </summary>
    public static class ListBoxControlExtensions
    {
        /// <summary>
        ///
        ///
        /// </summary>
        public static void InitialDefaultSettings(this ListBoxControl listBox, int ItemHeight = 25)
        {
            listBox.ShowFocusRect = false;
            listBox.ItemHeight = ItemHeight;
        }
        /// <summary>
        /// 获取当前数据行
        /// </summary>
        public static T GetCurrentViewModel<T>(this ListBoxControl listBox, IEnumerable<T> source) where T : class
        {
            if (source == null)
                return default;
            if (source.Count() < 1)
            {
                return default;
            }
            var row = listBox.SelectedItem as T;
            if (row == null)
            {
                return null;
            }
            return row;
        }
    }
}
}