diff --git a/DM_Weight/Models/DrugInfo.cs b/DM_Weight/Models/DrugInfo.cs index 948246c..ef9e55d 100644 --- a/DM_Weight/Models/DrugInfo.cs +++ b/DM_Weight/Models/DrugInfo.cs @@ -97,6 +97,8 @@ namespace DM_Weight.Models set { SetProperty(ref _base, value); } } + [SugarColumn(IsIgnore = true)] + public string drug_name_spec { get; set; } } diff --git a/DM_Weight/ViewModels/BindingChannelDialogViewModel.cs b/DM_Weight/ViewModels/BindingChannelDialogViewModel.cs index 6f06729..83dbe8b 100644 --- a/DM_Weight/ViewModels/BindingChannelDialogViewModel.cs +++ b/DM_Weight/ViewModels/BindingChannelDialogViewModel.cs @@ -165,8 +165,11 @@ namespace DM_Weight.ViewModels private void GetAllDrugInfos() { - var list = SqlSugarHelper.Db.Queryable().Includes(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList(); - DrugInfos = list; + //var list = SqlSugarHelper.Db.Queryable().Includes(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList(); + //DrugInfos = list; + string str = "SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_name,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit,d.manufactory,d.max_stock,CONCAT(drug_name,' / ',drug_spec,' / ',manufactory) as drug_name_spec FROM `drug_info` d"; + DrugInfos = SqlSugarHelper.Db.SqlQueryable(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList(); + } private void GetChannelsByDrawerNo() diff --git a/DM_Weight/Views/Dialog/BindingChannelDialog.xaml b/DM_Weight/Views/Dialog/BindingChannelDialog.xaml index a383533..53857ac 100644 --- a/DM_Weight/Views/Dialog/BindingChannelDialog.xaml +++ b/DM_Weight/Views/Dialog/BindingChannelDialog.xaml @@ -52,7 +52,7 @@ IsEditable="True" ItemsSource="{Binding DrugInfos}" SelectedItem="{Binding DrugInfo}" - DisplayMemberPath="DrugName" IsEnabled="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp" + DisplayMemberPath="drug_name_spec" IsEnabled="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp" />