duheng
2024-12-11 17a0baa0ef883689c73e3141d148a28a48d62cd6
WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/EditPumpPartPropDlg.cs
@@ -84,21 +84,20 @@
                return;
            }
            _propList.Clear();
            _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "铭牌参数", PropName = "流量", Value = _pumpMain.RatedFlow.ToString(), KeyWorldType = "Basic_Flow" });
            _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "铭牌参数", PropName = "扬程", Value = _pumpMain.RatedHead.ToString(), KeyWorldType = "Basic_Head" });
            _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "铭牌参数", PropName = "功率", Value = _pumpMain.RatedPower.ToString(), KeyWorldType = "Basic_Power" });
            _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "铭牌参数", PropName = "转速", Value = _pumpMain.RatedSpeed.ToString(), KeyWorldType = "Basic_Speed" });
            _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "铭牌参数", PropName = "流量", Value = _pumpMain.RatedFlow.ToString(), TagName = "Basic_Flow" });
            _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "铭牌参数", PropName = "扬程", Value = _pumpMain.RatedHead.ToString(), TagName = "Basic_Head" });
            _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "铭牌参数", PropName = "功率", Value = _pumpMain.RatedPower.ToString(), TagName = "Basic_Power" });
            _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "铭牌参数", PropName = "转速", Value = _pumpMain.RatedSpeed.ToString(), TagName = "Basic_Speed" });
            foreach (var item in catlog)
            {
                foreach (var prop in item.PropList)
                {
                    _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = item.Name, PropName = prop.Name, ID = prop.ID, KeyWorldType = "Prop" });
                    _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = item.Name, PropName = prop.Name, ID = prop.ID,TagName= prop.Code });
                }
            }
            var propbll = new BLL.PumpPartPropContent();
            var alllist = await propbll.GetByPumpPartID(model.ID);
            _allPropList = alllist;
            foreach (var item in alllist)
            var propbll = new BLL.AssetsPumpPropContent();
            _allPropList = await propbll.GetByPumpPartID(model.ID);
             foreach (var item in _allPropList)
            {
                var selectProp = _propList.Find(x => x.ID == item.PropID);
                if (selectProp != null)
@@ -131,7 +130,7 @@
            updatepart.NO = TextEditNo.Text;
            updatepart.Code = TextEditProductCode.Text;
            updatepart.SeriesID = _series.ID;
            var propList = _propList.Where(x => x.KeyWorldType == "Prop").ToList(); //找到所有的额外属性
            var propList = _propList.Where(x => x.TagName == "Prop").ToList(); //找到所有的额外属性
            foreach (var item in propList)
            {
                if (_allPropList != null)
@@ -142,17 +141,23 @@
                    if (prop != null)
                    {
                        prop.PropValue = item.Value;
                    }
                     }
                    else
                    {
                        _allPropList.Add(new Vmo.AssetsPumpPropContentVmo() { SeriesID = _allPropList.First().SeriesID, PartID = _allPropList.First().PartID, PropID = item.ID, PropValue = item.Value });
                        _allPropList.Add(new Vmo.AssetsPumpPropContentVmo() {
                            SeriesID = _allPropList.First().SeriesID,
                            PartID = _allPropList.First().PartID,
                            PropID = item.ID,
                            PropValue = item.Value,
                            TagName=item.TagName
                        });
                    }
                }
            }
            var basicFlow = _propList.Find(x => x.KeyWorldType == "Basic_Flow");
            var basicHead = _propList.Find(x => x.KeyWorldType == "Basic_Head");
            var basicSpeed = _propList.Find(x => x.KeyWorldType == "Basic_Speed");
            var basicPower = _propList.Find(x => x.KeyWorldType == "Basic_Power");
            var basicFlow = _propList.Find(x => x.TagName == "Basic_Flow");
            var basicHead = _propList.Find(x => x.TagName == "Basic_Head");
            var basicSpeed = _propList.Find(x => x.TagName == "Basic_Speed");
            var basicPower = _propList.Find(x => x.TagName == "Basic_Power");
            if (double.TryParse(basicFlow.Value, out double flow))
            {
                _pumpMain.RatedFlow = flow;
@@ -217,7 +222,11 @@
            var AssetsPumpPropContent = new List<Vmo.AssetsPumpPropContentVmo>();
            foreach (var item in _propList)
            {
                AssetsPumpPropContent.Add(new Vmo.AssetsPumpPropContentVmo { PropID = item.ID, PropValue = item.Value, SeriesID = _pumpPart.SeriesID });
                AssetsPumpPropContent.Add(new Vmo.AssetsPumpPropContentVmo {
                    PropID = item.ID,
                    PropValue = item.Value,
                    SeriesID = _pumpPart.SeriesID ,
                    TagName=item.TagName});
            }
            var id = await _bll.InsertEx(_pumpPart, AssetsPumpPropContent, _partMapping);
            if (id > 0)
@@ -258,7 +267,13 @@
                {
                    foreach (var prop in item.PropList)
                    {
                        _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = item.Name, PropName = prop.Name, ID = prop.ID, Value = prop.DefaultValue });
                        _propList.Add(new PropGroupChoiceViewModel() {
                            PropGroupName = item.Name,
                            PropName = prop.Name,
                            ID = prop.ID,
                            Value = prop.DefaultValue,
                            TagName = prop.Code,
                        });
                    }
                }
                this.propGroupChoiceViewModelBindingSource.ResetBindings(false);
@@ -332,7 +347,7 @@
                    list.Add(new Yw.Vmo.SysPropMappingSetterVmo { PropID = id, UnitName = rhs.UnitName, IsNull = rhs.IsNull });
                    await _sysPropMapping.SetByCatalogID(_series.CatalogID, list);
                    var model = await bll.GetByID(id);
                    var partMain = new PropGroupChoiceViewModel() { PropGroupName = groupName, PropName = model.Name, ID = model.ID, Value = propValue, KeyWorldType = "Prop" };
                    var partMain = new PropGroupChoiceViewModel() { PropGroupName = groupName, PropName = model.Name, ID = model.ID, Value = propValue, TagName = "Prop" };
                    _propList.Add(partMain);
                    this.propGroupChoiceViewModelBindingSource.ResetBindings(false);
                    return true;