添加权限:2、管理员能开所有抽屉,留1-2层所有人能开,其他6层管理员才能开

This commit is contained in:
maqiao 2024-09-12 18:11:28 +08:00
parent 7bb4fb8fcc
commit fa7f9cc2ea
16 changed files with 226 additions and 4 deletions

View File

@ -256,6 +256,22 @@ namespace DM_Weight.ViewModels
{
if (Status == 0)
{
if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员")
{
//查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开其他6层管理员才能开
bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any();
if (bDrawer)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "当前用户没有打开抽屉的权限!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
}
enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
enumerator = enumerable.GetEnumerator();
enumerator.MoveNext();

View File

@ -508,6 +508,22 @@ namespace DM_Weight.ViewModels
{
if (Status == 0)
{
if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员")
{
//查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开其他6层管理员才能开
bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any();
if (bDrawer)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "当前用户没有打开抽屉的权限!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
}
if (AddChannels == null || AddChannels.Count <= 0)
{
AlertMsg alertMsg = new AlertMsg

View File

@ -111,6 +111,21 @@ namespace DM_Weight.ViewModels
{
get => new DelegateCommand<string>((DrawerNo) =>
{
if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员")
{
//查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开其他6层管理员才能开
if (Convert.ToInt32(DrawerNo) > 2)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "当前用户没有打开抽屉的权限!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
}
this.DrawerNo = Convert.ToInt32(DrawerNo);
RequestData();
}, (DrawerNo) => Status == 0

View File

@ -199,6 +199,21 @@ namespace DM_Weight.ViewModels
{
if (Status == 0)
{
if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员")
{
//查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开其他6层管理员才能开
if (_ChannelStock.DrawerNo>2)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "当前用户没有打开抽屉的权限!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
}
Status = 1;
//_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");

View File

@ -125,6 +125,21 @@ namespace DM_Weight.ViewModels
{
get => new DelegateCommand(() =>
{
if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员")
{
//查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开其他6层管理员才能开
if (DrawerNo>2)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "当前用户没有打开抽屉的权限!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
}
Status = 1;
try

View File

@ -135,6 +135,21 @@ namespace DM_Weight.ViewModels
{
if (Status == 0)
{
if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员")
{
//查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开其他6层管理员才能开
if (DrawerNo>2)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "当前用户没有打开抽屉的权限!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
}
Status = 1;
//_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");

View File

@ -175,6 +175,22 @@ namespace DM_Weight.ViewModels
{
if (Status == 0)
{
if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员")
{
//查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开其他6层管理员才能开
bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any();
if (bDrawer)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "当前用户没有打开抽屉的权限!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
}
enumerator.MoveNext();
Status = 1;
OpenOneByOne();

View File

@ -250,6 +250,22 @@ namespace DM_Weight.ViewModels
{
if (Status == 0)
{
if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员")
{
//查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开其他6层管理员才能开
bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any();
if (bDrawer)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "当前用户没有打开抽屉的权限!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
}
enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
enumerator = enumerable.GetEnumerator();
enumerator.MoveNext();

View File

@ -245,6 +245,22 @@ namespace DM_Weight.ViewModels
{
if (Status == 0)
{
if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员")
{
//查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开其他6层管理员才能开
bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any();
if (bDrawer)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "当前用户没有打开抽屉的权限!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
}
enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
enumerator = enumerable.GetEnumerator();
enumerator.MoveNext();

View File

@ -247,6 +247,24 @@ namespace DM_Weight.ViewModels
{
if (Status == 0)
{
if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员")
{
//查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开其他6层管理员才能开
bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any();
if (bDrawer)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "当前用户没有打开抽屉的权限!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
}
enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
enumerator = enumerable.GetEnumerator();
enumerator.MoveNext();
@ -271,7 +289,7 @@ namespace DM_Weight.ViewModels
{
if (!strNames.Contains(name))
{
strNames += name+";";
strNames += name + ";";
}
}
int sumQuantity = channelStocks.Sum(cs => cs.TakeQuantity);
@ -420,7 +438,7 @@ namespace DM_Weight.ViewModels
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
InvoiceNo = "日结存"
}).ExecuteCommand();
if(iDayResult<=0)
if (iDayResult <= 0)
{
logger.Info($"未写入日结存数据{it.DrugId}-{it.ManuNo}-{it.EffDate}-{it.AddQuantity}");
}
@ -428,7 +446,7 @@ namespace DM_Weight.ViewModels
//修改凌晨生成的日结存与总结存数据
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 4)
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)

View File

@ -191,6 +191,22 @@ namespace DM_Weight.ViewModels
{
get => new DelegateCommand(() =>
{
if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员")
{
//查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开其他6层管理员才能开
bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any();
if (bDrawer)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "当前用户没有打开抽屉的权限!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
}
if (ChannelStock != null)
{
Status = 1;

View File

@ -211,6 +211,21 @@ namespace DM_Weight.ViewModels
{
get => new DelegateCommand(() =>
{
if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员")
{
//查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开其他6层管理员才能开
if (ChannelStock.DrawerNo>2)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "当前用户没有打开抽屉的权限!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
}
if (ChannelStock != null)
{
if (Status == 0)

View File

@ -169,6 +169,22 @@ namespace DM_Weight.ViewModels
{
if (Status == 0)
{
if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员")
{
//查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开其他6层管理员才能开
bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any();
if (bDrawer)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "当前用户没有打开抽屉的权限!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
}
enumerator.MoveNext();
Status = 1;
OpenOneByOne();

View File

@ -165,6 +165,22 @@ namespace DM_Weight.ViewModels
{
if (Status == 0)
{
if (HomeWindowViewModel.Operator.Role != null && HomeWindowViewModel.Operator.Role.RoleName != "管理员")
{
//查看当前用户是否有所在药品抽屉的权限;1-2层所有人能开其他6层管理员才能开
bool bDrawer = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 2).Any();
if (bDrawer)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "当前用户没有打开抽屉的权限!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
}
enumerator.MoveNext();
Status = 1;
OpenOneByOne();

View File

@ -148,6 +148,7 @@
</DataGrid.GroupStyle>
<DataGrid.Columns>
<DataGridTextColumn IsReadOnly="True" Header="药品名称" Binding="{Binding DrugInfo.DrugName}"/>
<DataGridTextColumn IsReadOnly="True" Header="药品基数" Binding="{Binding BaseQuantity}"/>
<DataGridTextColumn IsReadOnly="True" Header="需补药数量" Binding="{Binding AddQuantity}"/>
</DataGrid.Columns>
</DataGrid>

View File

@ -51,7 +51,7 @@
/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Column="3">
<Button
Margin="0 0 3 0"
Margin="0 0 3 0" Visibility="Collapsed"
VerticalAlignment="Center"
Command="{Binding ReturnEmptyCommand}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"