diff --git a/DM_Weight/ViewModels/SettingBoxWindowViewModel.cs b/DM_Weight/ViewModels/SettingBoxWindowViewModel.cs index 0960cf1..e54f071 100644 --- a/DM_Weight/ViewModels/SettingBoxWindowViewModel.cs +++ b/DM_Weight/ViewModels/SettingBoxWindowViewModel.cs @@ -115,7 +115,7 @@ namespace DM_Weight.ViewModels { if (_userLists == null) { - _userLists = SqlSugarHelper.Db.Queryable().Where(us => us.MachineId == (ConfigurationManager.AppSettings["machineId"] ??"DM5")).Select(us => new BindUserList() { UserId = Convert.ToInt32(us.UserBarcode), UserName = us.Nickname }).ToList(); + _userLists = SqlSugarHelper.Db.Queryable().Where(us => us.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM5")).Select(us => new BindUserList() { UserId = Convert.ToInt32(us.UserBarcode), UserName = us.Nickname }).ToList(); _userListSelectedItem = _userLists[0]; } } @@ -198,7 +198,7 @@ namespace DM_Weight.ViewModels Type = 55, InvoiceId = $"打开{DrawerNo}号药箱", }).ExecuteCommand(); - ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo-1); + ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo - 1); } }); } @@ -209,19 +209,19 @@ namespace DM_Weight.ViewModels { if (DrawerNo > 0) { - ChannelList channelList=SqlSugarHelper.Db.Queryable().Where(cs=>cs.DrawerNo== DrawerNo&&cs.MachineId=="DM5").First(); - if(BoxTypeSelectedItem!=null) + ChannelList channelList = SqlSugarHelper.Db.Queryable().Where(cs => cs.DrawerNo == DrawerNo && cs.MachineId == "DM5").First(); + if (BoxTypeSelectedItem != null) { - if(BoxTypeSelectedItem.TypeValue==0&&UserListSelectedItem!=null) + if (BoxTypeSelectedItem.TypeValue == 0 && UserListSelectedItem != null) { //药箱 归属药师 - SqlSugarHelper.Db.Updateable(new ChannelList() {BelongUser= UserListSelectedItem.UserId.ToString(),DrawerType= BoxTypeSelectedItem.TypeValue ,Id= channelList.Id }).UpdateColumns(cl=>new {cl.BelongUser,cl.DrawerType}).ExecuteCommand(); + SqlSugarHelper.Db.Updateable(new ChannelList() { BelongUser = UserListSelectedItem.UserId.ToString(), DrawerType = BoxTypeSelectedItem.TypeValue, Id = channelList.Id }).UpdateColumns(cl => new { cl.BelongUser, cl.DrawerType }).ExecuteCommand(); } else { //药箱属于公共药箱 - SqlSugarHelper.Db.Updateable(new ChannelList() {DrawerType= BoxTypeSelectedItem.TypeValue ,Id= channelList.Id }).UpdateColumns(cl=>new {cl.DrawerType}).ExecuteCommand(); + SqlSugarHelper.Db.Updateable(new ChannelList() { DrawerType = BoxTypeSelectedItem.TypeValue, Id = channelList.Id }).UpdateColumns(cl => new { cl.DrawerType }).ExecuteCommand(); } } @@ -233,8 +233,8 @@ namespace DM_Weight.ViewModels { Message = $"未选择药箱,请先选择药箱", Type = MsgType.ERROR - }; - _eventAggregator.GetEvent().Publish(alertMsg); + }; + _eventAggregator.GetEvent().Publish(alertMsg); } }); }