交接柜加药完成更新交接柜补药数据状态为已取药未入库

This commit is contained in:
maqiao 2024-11-19 13:27:47 +08:00
parent df3657ffe2
commit b0cad62370
5 changed files with 93 additions and 20 deletions

View File

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace DM_Weight.Converter
{
internal class StockStatusConverter : IValueConverter
{
//是否给交接柜补药已补药的则不可勾选未补药的可勾选以进行补药0未补1已补
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
int status = int.Parse(value.ToString());
if (parameter.ToString() == "EnableState")
{
if (status == 0)
{
return true;
}
else
{
return false;
}
}
if (parameter.ToString() == "TextState")
{
if (status == 0)
{
return "未取药";
}
else
{
return "已取药待入库";
}
}
return "";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@ -84,7 +84,7 @@ namespace DM_Weight.Models
[SugarColumn(ColumnName = "board_type")]
public int BoardType { get; set; }
/// <summary>
///
/// 用于标识是否给交接柜补药0未补1已补
/// 默认值: 1
///</summary>
[SugarColumn(ColumnName = "state")]

View File

@ -351,23 +351,23 @@ namespace DM_Weight.ViewModels
Id = it.Id,
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
//更新 交接柜 库存信息
List<ChannelStock> jiaojie = Jiaojie_ChannelStocks.Where(cs => cs.DrugId == it.DrugId).ToList();
if (jiaojie != null && jiaojie.Count > 0)
{
for (int j = 0; j < jiaojie.Count; j++)
{
// 更新数据 交接柜 库存信息
ChannelStock jiaojie_it = jiaojie[j];
SqlSugarHelper.Db.Updateable(new ChannelStock()
{
Quantity = jiaojie_it.BaseQuantity,
//ManuNo = it.ManuNo,
//EffDate = it.EffDate,
Id = jiaojie_it.Id,
}).UpdateColumns(jiaojie_it => new { jiaojie_it.Quantity }).ExecuteCommand();
}
}
////更新 交接柜 库存信息
//List<ChannelStock> jiaojie = Jiaojie_ChannelStocks.Where(cs => cs.DrugId == it.DrugId).ToList();
//if (jiaojie != null && jiaojie.Count > 0)
//{
// for (int j = 0; j < jiaojie.Count; j++)
// {
// // 更新数据 交接柜 库存信息
// ChannelStock jiaojie_it = jiaojie[j];
// SqlSugarHelper.Db.Updateable(new ChannelStock()
// {
// Quantity = jiaojie_it.BaseQuantity,
// //ManuNo = it.ManuNo,
// //EffDate = it.EffDate,
// Id = jiaojie_it.Id,
// }).UpdateColumns(jiaojie_it => new { jiaojie_it.Quantity }).ExecuteCommand();
// }
//}
// 保存数据 出库记录
@ -414,6 +414,21 @@ namespace DM_Weight.ViewModels
}).ExecuteCommand();
}
}
//更新交接柜状态为 已取药未入库(等在交接柜入库后再更新交接柜库存)
List<ChannelStock> jiaojie = Jiaojie_ChannelStocks.GroupBy(cs => cs.DrawerNo).Select(cs => cs.FirstOrDefault()).ToList();
if (jiaojie != null && jiaojie.Count > 0)
{
for (int j = 0; j < jiaojie.Count; j++)
{
ChannelStock jiaojie_it = jiaojie[j];
//更新交接柜状态为 已取药未入库
SqlSugarHelper.Db.Updateable(new ChannelList()
{
State = 1,
Id = jiaojie_it.ChannelLst.Id
}).UpdateColumns(it => it.State).ExecuteCommand();
}
}
return true;
});
if (f.Data)

View File

@ -465,7 +465,15 @@ namespace DM_Weight.ViewModels
{
if (channelStock != null)
{
channelStock.ChannelLst.IsSelected = !channelStock.ChannelLst.IsSelected;
//channelStock.ChannelLst.IsSelected = !channelStock.ChannelLst.IsSelected;
if (channelStock.ChannelLst.State == 0)
{
channelStock.ChannelLst.IsSelected = !channelStock.ChannelLst.IsSelected;
}
else
{
return;
}
if (channelStock != null && ChannelStocks != null)
{
ChannelStocks = ChannelStocks.Select(x =>

View File

@ -20,6 +20,7 @@
<convert:GroupSumConverter x:Key="GroupSumConverter" />
<convert:TotalCountConverter x:Key="TotalCountConverter" />
<convert:StatusConverter x:Key="StatusConverter" />
<convert:StockStatusConverter x:Key="StockStatusConverter" />
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -147,7 +148,7 @@
materialDesign:ExpanderAssist.HeaderBackground="PaleTurquoise" Expanded="Expander_Expanded" Collapsed="Expander_Collapsed">
<Expander.Header >
<StackPanel Orientation="Horizontal">
<CheckBox Margin="0 0 3 0" IsChecked="{Binding Path=Name.IsSelected}" FontSize="24" />
<CheckBox Margin="0 0 3 0" IsChecked="{Binding Path=Name.IsSelected}" IsEnabled="{Binding Name.State,Converter={StaticResource StockStatusConverter},ConverterParameter=EnableState}" FontSize="24" />
<TextBlock Text="{Binding Path=Name.DrawerNo,StringFormat={}{0}号药箱}" FontWeight="Bold" />
</StackPanel>
</Expander.Header>
@ -167,6 +168,8 @@
<DataGridTextColumn IsReadOnly="True" Header="厂家" Binding="{Binding DrugInfo.Manufactory}"/>
<DataGridTextColumn IsReadOnly="True" Header="药品基数" Binding="{Binding BaseQuantity}"/>
<DataGridTextColumn IsReadOnly="True" Header="需补药数量" Binding="{Binding AddQuantity}"/>
<DataGridTextColumn IsReadOnly="True" Header="状态" Binding="{Binding ChannelLst.State,Converter={StaticResource StockStatusConverter},ConverterParameter=TextState}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>