1.库位禁用和启用、模组禁用启用

2.退出出库先解锁 后发指令
This commit is contained in:
hehaibing-1996
2024-05-21 18:46:51 +08:00
parent b2f9c7cc22
commit 472862a978
16 changed files with 417 additions and 36 deletions

View File

@ -19,6 +19,7 @@ using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.User;
using WCS.Model.ApiModel;
using Newtonsoft.Json.Bson;
using System.Windows;
namespace .ViewModel
{
@ -75,7 +76,7 @@ namespace 货架标准上位机.ViewModel
public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); }
public void BtnReset()
{
ModuleCode = string.Empty;
ModuleCode = string.Empty;
ShelfCode = string.Empty;
}
@ -153,6 +154,97 @@ namespace 货架标准上位机.ViewModel
}
}
}
public ICommand DisableCommand { get => new DelegateCommand<ModuleInfoModel>(Disable); }
public void Disable(ModuleInfoModel module)
{
if (module.IsEnable != true)
{
Growl.Warning("库位未被启用!");
return;
}
var result = HandyControl.Controls.MessageBox.Show("模组禁用会影响正常流程,请确认是否屏蔽?"
, "提示", MessageBoxButton.YesNo);
if (result == MessageBoxResult.Yes)
{
#region
try
{
var body = new DisableOrEnableModuleRequest()
{
ModuleId = module.Id,
ModuleCode = module.ModuleCode,
DisableOrEnable = DisableOrEnableEnum.Disable,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
};
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "storeInfo/disableOrEnableModule", body, "POST");
if (Result != null && Result.Code == 200)
{
Growl.Success("禁用成功");
BtnSearch();
}
else if (Result != null)
{
Growl.Warning(Result.Message);
}
else
{
Growl.Warning("操作失败:请重试!");
}
}
catch (Exception ex)
{
Growl.Error("操作失败:" + ex.Message);
}
#endregion
}
else
{
return;
}
}
public ICommand EnableCommand { get => new DelegateCommand<ModuleInfoModel>(Enable); }
public void Enable(ModuleInfoModel module)
{
if (module.IsEnable == true)
{
Growl.Warning("库位未被禁用!");
return;
}
#region
try
{
var body = new DisableOrEnableModuleRequest()
{
ModuleId = module.Id,
ModuleCode = module.ModuleCode,
DisableOrEnable = DisableOrEnableEnum.Enable,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
};
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "storeInfo/disableOrEnableModule", body, "POST");
if (Result != null && Result.Code == 200)
{
Growl.Success("操作成功!");
BtnSearch();
}
else if (Result != null)
{
Growl.Warning(Result.Message);
}
else
{
Growl.Warning("操作失败:请重试!");
}
}
catch (Exception ex)
{
Growl.Error("操作失败:" + ex.Message);
}
#endregion
}
#endregion
#region PageOperation

View File

@ -19,6 +19,8 @@ using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.User;
using WCS.Model.ApiModel;
using Newtonsoft.Json.Bson;
using System.Windows;
using System.Security.Cryptography;
namespace .ViewModel
{
@ -140,6 +142,94 @@ namespace 货架标准上位机.ViewModel
}
#endregion
}
public ICommand DisableCommand { get => new DelegateCommand<StoreInfoModel>(Disable); }
public void Disable(StoreInfoModel store)
{
var result = HandyControl.Controls.MessageBox.Show("库位屏蔽仅用于临时屏蔽硬件损坏识别的未扫描上架!\r\n" +
"操作时会删除对应库位的数据,需要保证对应库位物料已取出。\r\n" +
"请确认是否进行操作?"
, "提示", MessageBoxButton.YesNo);
if (result == MessageBoxResult.Yes)
{
#region
try
{
var body = new DisableOrEnableStoreRequest()
{
StoreId = store.Id,
SroreCode = store.StoreCode,
DisableOrEnable = DisableOrEnableEnum.Disable,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
};
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "storeInfo/disableOrEnableStore", body, "POST");
if (Result != null && Result.Code == 200)
{
Growl.Success("禁用成功");
BtnSearch();
}
else if (Result != null)
{
Growl.Warning(Result.Message);
}
else
{
Growl.Warning("操作失败:请重试!");
}
}
catch (Exception ex)
{
Growl.Error("操作失败:" + ex.Message);
}
#endregion
}
else
{
return;
}
}
public ICommand EnableCommand { get => new DelegateCommand<StoreInfoModel>(Enable); }
public void Enable(StoreInfoModel store)
{
if (store.CurrentMatSn != "禁用")
{
Growl.Warning("库位未被禁用!");
return;
}
#region
try
{
var body = new DisableOrEnableStoreRequest()
{
StoreId = store.Id,
SroreCode = store.StoreCode,
DisableOrEnable = DisableOrEnableEnum.Enable,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
};
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "storeInfo/disableOrEnableStore", body, "POST");
if (Result != null && Result.Code == 200)
{
Growl.Success("操作成功!");
BtnSearch();
}
else if (Result != null)
{
Growl.Warning(Result.Message);
}
else
{
Growl.Warning("操作失败:请重试!");
}
}
catch (Exception ex)
{
Growl.Error("操作失败:" + ex.Message);
}
#endregion
}
#endregion
#region PageOperation

View File

@ -1,20 +1,6 @@
using .ViewModel;
using Ping9719.WpfEx;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace
{

View File

@ -241,16 +241,16 @@
</StackPanel>
</TabItem.Header>
<TabControl Margin="5" Style="{StaticResource TabControlBaseStyle.MouseOver}">
<TabItem Header="用户管理" >
<hc:TransitioningContentControl TransitionMode="Fade">
<View:UserView Margin="0,5"/>
</hc:TransitioningContentControl>
</TabItem>
<TabItem Header="角色管理">
<hc:TransitioningContentControl TransitionMode="Fade">
<View:RoleView Margin="0,5"/>
</hc:TransitioningContentControl>
</TabItem>
<TabItem Header="用户管理" >
<hc:TransitioningContentControl TransitionMode="Fade">
<View:UserView Margin="0,5"/>
</hc:TransitioningContentControl>
</TabItem>
</TabControl>
</TabItem>

View File

@ -84,14 +84,23 @@
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="货架编码" Binding="{Binding ShelfCode}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="模组编码" Binding="{Binding ModuleCode}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="PCB板ID" Binding="{Binding BoardId}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="板ID" Binding="{Binding BoardId}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="单板灯数量" Binding="{Binding LightCount}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="TCP连接信息" Binding="{Binding CleintIp}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="R" Binding="{Binding R}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="C" Binding="{Binding C}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="是否启用" Binding="{Binding IsEnable,Converter={StaticResource Boolean2StringConverter},ConverterParameter=否;是}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="绑定后货架编码" Binding="{Binding BindShelfCode}"></DataGridTextColumn>
<DataGridTemplateColumn CanUserResize="False" Width="auto">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" IsEnabled="{Binding IsAdmin,Converter={StaticResource Boolean2BooleanReConverter}}">
<Button Style="{StaticResource ButtonWarning}" Margin="0,0,5,0" IsEnabled="True" Content="禁用" Width="60" Command="{Binding DataContext.DisableCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding }" />
<Button Style="{StaticResource ButtonDanger}" Margin="0,0,0,0" IsEnabled="True" Content="启用" Width="60" Command="{Binding DataContext.EnableCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding }"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>

View File

@ -11,10 +11,10 @@
<Border Margin="0" Background="AliceBlue" CornerRadius="3" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1.3*"></RowDefinition>
<RowDefinition Height="1.4*"></RowDefinition>
<RowDefinition Height="10*"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="0" Margin="0" Background="AliceBlue" CornerRadius="5" Padding="0">
<Border Grid.Row="0" Margin="5" Background="AliceBlue" CornerRadius="5" Padding="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"></ColumnDefinition>
@ -58,12 +58,12 @@
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding CurrentMatSN}"></TextBox>
<Button Style="{StaticResource ButtonSuccess}" hc:BorderElement.CornerRadius="15"
<Button Style="{StaticResource ButtonSuccess}" hc:BorderElement.CornerRadius="12"
Grid.Column="8" MinHeight="40" FontSize="18" Content="&#xe8b9; 搜索" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnSearchCommand}">
</Button>
<Button Style="{StaticResource ButtonWarning}" hc:BorderElement.CornerRadius="15"
<Button Style="{StaticResource ButtonWarning}" hc:BorderElement.CornerRadius="12"
Grid.Column="9" MinHeight="40" FontSize="18" Content="&#xe652; 重置" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnResetCommand}">
</Button>
@ -102,8 +102,8 @@
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" IsEnabled="{Binding IsAdmin,Converter={StaticResource Boolean2BooleanReConverter}}">
<Button Style="{StaticResource ButtonWarning}" Margin="0,0,5,0" IsEnabled="True" Content="禁用" Width="60" Command="{Binding DataContext.UpdateCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding }" />
<Button Style="{StaticResource ButtonDanger}" Margin="0,0,0,0" IsEnabled="True" Content="启用" Width="60" Command="{Binding DataContext.DelCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding }"/>
<Button Style="{StaticResource ButtonWarning}" Margin="0,0,5,0" IsEnabled="True" Content="禁用" Width="60" Command="{Binding DataContext.DisableCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding }" />
<Button Style="{StaticResource ButtonDanger}" Margin="0,0,0,0" IsEnabled="True" Content="启用" Width="60" Command="{Binding DataContext.EnableCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding }"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>

View File

@ -2,7 +2,7 @@
//连接不上加SslMode=none;
"MySql": "server=localhost;Database=db1;Uid=root;Pwd=123456;Convert Zero Datetime=True",
//货架服务器的IP和端口号
"ApiIpHost": "http://localhost:8888/",
"ApiIpHost": "http://127.0.0.1:8888/",
//WebSocket的地址
"WebSocketUrl": "ws://127.0.0.1:7789/ws",
//货架分区