打开药箱页面添加判断当前归属用户是否为空的判断

设置药箱页面保存成功弹出提示
This commit is contained in:
maqiao 2024-11-04 08:46:16 +08:00
parent c800334724
commit cf98e60aa8
2 changed files with 26 additions and 3 deletions

View File

@ -436,7 +436,7 @@ namespace DM_Weight.ViewModels
{
SetBtnEnable(chl.DrawerNo);
}
if (chl.BelongUser == HomeWindowViewModel.Operator.UserBarcode)
if (!string.IsNullOrEmpty(chl.BelongUser)&& chl.BelongUser == HomeWindowViewModel.Operator.UserBarcode)
{
SetBtnEnable(chl.DrawerNo);
}

View File

@ -224,18 +224,41 @@ namespace DM_Weight.ViewModels
ChannelList channelList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cs => cs.DrawerNo == DrawerNo && cs.MachineId == "DM5").First();
if (BoxTypeSelectedItem != null)
{
int iUpdate = 0;
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();
iUpdate=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();
iUpdate=SqlSugarHelper.Db.Updateable(new ChannelList() { DrawerType = BoxTypeSelectedItem.TypeValue, Id = channelList.Id }).UpdateColumns(cl => new { cl.DrawerType }).ExecuteCommand();
}
if(iUpdate>0)
{
//提示请选择药箱
AlertMsg alertMsg = new AlertMsg
{
Message = $"保存完成",
Type = MsgType.INFO
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
else
{
//提示请选择药箱
AlertMsg alertMsg = new AlertMsg
{
Message = $"保存失败",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
}
}
else