取药、加药页面添加下拉入库存不入库存

This commit is contained in:
maqiao 2024-12-10 18:01:47 +08:00
parent 96e79b2514
commit c83b5b51b1
13 changed files with 245 additions and 12 deletions

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.Models
{
/// <summary>
/// 取药或加药用途字段(如果是补库存则不加入到报表中)
/// </summary>
public class UseFor
{
/// <summary>
/// 96不用于入账册
/// </summary>
public int UseId { get; set; }
/// <summary>
/// (入账册/不入账册)
/// </summary>
public string UseName { get; set; }
}
}

View File

@ -25,6 +25,33 @@ namespace DM_Weight.ViewModels
{
public class AddDrugControlViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
{
public static List<UseFor> SelectUseList = new()
{
new UseFor{UseId=0,UseName="入账册"},
new UseFor { UseId = 96, UseName = "不入账册" }
};
private List<UseFor> _selects = SelectUseList;
public List<UseFor> Selects
{
get { return _selects; }
set
{
SetProperty(ref _selects, value);
}
}
private UseFor _selectedItem = SelectUseList[0];
/// <summary>
/// 取药或加药用途字段
/// </summary>
public UseFor SelectedItem
{
get { return _selectedItem; }
set
{
SetProperty(ref _selectedItem, value);
}
}
private readonly ILog logger = LogManager.GetLogger(typeof(AddDrugControlViewModel));
private List<int> _drawerNoList = new List<int>();
public static AddDrugControlViewModel vm;
@ -324,7 +351,7 @@ namespace DM_Weight.ViewModels
Reviewer = HomeWindowViewModel.Reviewer?.Id,
OperationTime = DateTime.Now,
Quantity = it.AddQuantity,
Type = 1,
Type = SelectedItem.UseId == 0 ? 1 : SelectedItem.UseId,
InvoiceId = InvoiceId,
StockQuantity = nowChannels.Sum(it => it.Quantity),
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity)

View File

@ -26,6 +26,34 @@ namespace DM_Weight.ViewModels
{
public class CheckStockNewWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
{
public static List<UseFor> SelectUseList = new()
{
new UseFor{UseId=0,UseName="入账册"},
new UseFor { UseId = 96, UseName = "不入账册" }
};
private List<UseFor> _selectsUseFor = SelectUseList;
public List<UseFor> SelectsUseFor
{
get { return _selectsUseFor; }
set
{
SetProperty(ref _selectsUseFor, value);
}
}
private UseFor _selectedItemUseFor = SelectUseList[0];
/// <summary>
/// 取药或加药用途字段
/// </summary>
public UseFor SelectedItemUseFor
{
get { return _selectedItemUseFor; }
set
{
SetProperty(ref _selectedItemUseFor, value);
}
}
//public static CheckStockNewWindowViewModel vm;
private readonly ILog logger = LogManager.GetLogger(typeof(CheckStockNewWindowViewModel));
public string drugId;
@ -438,7 +466,7 @@ namespace DM_Weight.ViewModels
Reviewer = HomeWindowViewModel.Reviewer?.Id,
OperationTime = DateTime.Now,
Quantity = it.CheckQuantity - it.Quantity,
Type = 4,
Type = SelectedItemUseFor.UseId == 0 ? 4 : SelectedItemUseFor.UseId,
InvoiceId = InvoiceId,
StockQuantity = nowChannels.Sum(it => it.Quantity),
CheckQuantity = it.CheckQuantity,

View File

@ -22,6 +22,34 @@ namespace DM_Weight.ViewModels
{
public class DrawerAddDrugWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
{
public static List<UseFor> SelectUseList = new()
{
new UseFor{UseId=0,UseName="入账册"},
new UseFor { UseId = 96, UseName = "不入账册" }
};
private List<UseFor> _selectsUseFor = SelectUseList;
public List<UseFor> SelectsUseFor
{
get { return _selectsUseFor; }
set
{
SetProperty(ref _selectsUseFor, value);
}
}
private UseFor _selectedItemUseFor = SelectUseList[0];
/// <summary>
/// 取药或加药用途字段
/// </summary>
public UseFor SelectedItemUseFor
{
get { return _selectedItemUseFor; }
set
{
SetProperty(ref _selectedItemUseFor, value);
}
}
private readonly ILog logger = LogManager.GetLogger(typeof(DrawerAddDrugWindowViewModel));
private List<int> _drawerNoList = new List<int>();
@ -276,7 +304,7 @@ namespace DM_Weight.ViewModels
Reviewer = HomeWindowViewModel.Reviewer?.Id,
OperationTime = DateTime.Now,
Quantity = it.AddQuantity,
Type = 1,
Type = SelectedItemUseFor.UseId==0? 1:SelectedItemUseFor.UseId,
InvoiceId = InvoiceId,
StockQuantity = nowChannels.Sum(it => it.Quantity),
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),

View File

@ -26,6 +26,34 @@ namespace DM_Weight.ViewModels
{
public class DrawerTakeDrugWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
{
public static List<UseFor> SelectUseList = new()
{
new UseFor{UseId=0,UseName="入账册"},
new UseFor { UseId = 96, UseName = "不入账册" }
};
private List<UseFor> _selectsUseFor = SelectUseList;
public List<UseFor> SelectsUseFor
{
get { return _selectsUseFor; }
set
{
SetProperty(ref _selectsUseFor, value);
}
}
private UseFor _selectedItemUseFor = SelectUseList[0];
/// <summary>
/// 取药或加药用途字段
/// </summary>
public UseFor SelectedItemUseFor
{
get { return _selectedItemUseFor; }
set
{
SetProperty(ref _selectedItemUseFor, value);
}
}
private readonly ILog logger = LogManager.GetLogger(typeof(DrawerTakeDrugWindowViewModel));
private List<ChannelStock> _channelStocks = new List<ChannelStock>();
@ -253,7 +281,7 @@ namespace DM_Weight.ViewModels
Reviewer = HomeWindowViewModel.Reviewer?.Id,
OperationTime = DateTime.Now,
Quantity = it.TakeQuantity,
Type = 2,
Type = SelectedItemUseFor.UseId==0? 2: SelectedItemUseFor.UseId,
InvoiceId = InvoiceId,
StockQuantity = nowChannels.Sum(it => it.Quantity),
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),

View File

@ -25,7 +25,34 @@ namespace DM_Weight.ViewModels
{
public class SelfAddDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
{
public static List<UseFor> SelectUseList = new()
{
new UseFor{UseId=0,UseName="入账册"},
new UseFor { UseId = 96, UseName = "不入账册" }
};
private List<UseFor> _selectsUseFor = SelectUseList;
public List<UseFor> SelectsUseFor
{
get { return _selectsUseFor; }
set
{
SetProperty(ref _selectsUseFor, value);
}
}
private UseFor _selectedItemUseFor = SelectUseList[0];
/// <summary>
/// 取药或加药用途字段
/// </summary>
public UseFor SelectedItemUseFor
{
get { return _selectedItemUseFor; }
set
{
SetProperty(ref _selectedItemUseFor, value);
}
}
private readonly ILog logger = LogManager.GetLogger(typeof(SelfAddDialogViewModel));
public string Title => "自选加药";
@ -349,7 +376,7 @@ namespace DM_Weight.ViewModels
Reviewer = HomeWindowViewModel.Reviewer?.Id,
OperationTime = DateTime.Now,
Quantity = it.AddQuantity,
Type = 1,
Type = SelectedItemUseFor.UseId == 0 ? 1 : SelectedItemUseFor.UseId,
InvoiceId = InvoiceId,
StockQuantity = nowChannels.Sum(it => it.Quantity),
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),

View File

@ -18,19 +18,47 @@ using DM_Weight.util;
using System.Threading;
using SqlSugar;
using System.Configuration;
using DM_Weight.select;
namespace DM_Weight.ViewModels
{
public class SelfTakeDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
{
public static List<UseFor> SelectUseList = new()
{
new UseFor{UseId=0,UseName="入账册"},
new UseFor { UseId = 96, UseName = "不入账册" }
};
private List<UseFor> _selects = SelectUseList;
public List<UseFor> Selects
{
get { return _selects; }
set
{
SetProperty(ref _selects, value);
}
}
private UseFor _selectedItem = SelectUseList[0];
/// <summary>
/// 取药或加药用途字段
/// </summary>
public UseFor SelectedItem
{
get { return _selectedItem; }
set
{
SetProperty(ref _selectedItem, value);
}
}
private readonly ILog logger = LogManager.GetLogger(typeof(SelfTakeDialogViewModel));
public string Title => "自选取药";
public event Action<IDialogResult> RequestClose;
private static readonly DateTime Jan1st1970 = new DateTime
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
private string WindowName = "SelfTakeWindow";
@ -238,7 +266,7 @@ namespace DM_Weight.ViewModels
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
singleChannels.Add(copy);
}
singleChannels= singleChannels
singleChannels = singleChannels
.GroupBy(it => new { it.DrawerNo, it.ColNo })
.Select(it =>
{
@ -250,7 +278,7 @@ namespace DM_Weight.ViewModels
.ToList()
.FindAll(it => it.BoardType != 1);
// 发送取药数量
singleChannels.ForEach(it =>
{
@ -308,7 +336,7 @@ namespace DM_Weight.ViewModels
OperationTime = DateTime.Now,
Quantity = it.TakeQuantity,
Reviewer = HomeWindowViewModel.Reviewer?.Id,
Type = 2,
Type = SelectedItem.UseId==0? 2: SelectedItem.UseId,
InvoiceId = InvoiceId,
StockQuantity = nowChannels.Sum(it => it.Quantity),
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
@ -323,7 +351,7 @@ namespace DM_Weight.ViewModels
// 更新屏显库存
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType != 1)
.GroupBy(it =>new { it.DrawerNo, it.ColNo })
.GroupBy(it => new { it.DrawerNo, it.ColNo })
.Select(it =>
{
var ret = it.First();
@ -341,7 +369,7 @@ namespace DM_Weight.ViewModels
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
// });
//}
if(singleChannels!=null&&singleChannels.Count>0)
if (singleChannels != null && singleChannels.Count > 0)
{
for (int i = 0; i < singleChannels.Count; i++)
{

View File

@ -175,6 +175,14 @@
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
Content="加药" />
<ComboBox Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
Grid.Column="0"
Margin="0 0 6 0"
Style="{StaticResource MaterialDesignOutlinedComboBox}"
SelectedItem="{Binding SelectedItem}"
DisplayMemberPath="UseName"
ItemsSource="{Binding Selects}"
/>
<TextBox Text="{Binding PZH, UpdateSourceTrigger=PropertyChanged}" materialDesign:HintAssist.Hint="凭证号"
materialDesign:HintAssist.IsFloating="True" Width="100"

View File

@ -42,6 +42,13 @@
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
Content="盘点" />
<ComboBox Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
Grid.Column="0"
Margin="0 0 6 0"
Style="{StaticResource MaterialDesignOutlinedComboBox}"
SelectedItem="{Binding SelectedItemUseFor}"
DisplayMemberPath="UseName"
ItemsSource="{Binding SelectsUseFor}"/>
<Button
Margin="0 0 3 0"
VerticalAlignment="Center"

View File

@ -121,6 +121,13 @@
Content="加药"
Command="{Binding OpenDrawer}">
</Button>
<ComboBox Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
Grid.Column="0"
Margin="0 6 6 6"
Style="{StaticResource MaterialDesignOutlinedComboBox}"
SelectedItem="{Binding SelectedItemUseFor}"
DisplayMemberPath="UseName"
ItemsSource="{Binding SelectsUseFor}"/>
<TextBox Text="{Binding PZH, UpdateSourceTrigger=PropertyChanged}" materialDesign:HintAssist.Hint="凭证号"
materialDesign:HintAssist.IsFloating="True" Width="100"
Margin="2"

View File

@ -121,6 +121,14 @@
Content="取药"
Command="{Binding OpenDrawer}">
</Button>
<ComboBox Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
Grid.Column="0"
Margin="0 6 6 6"
Style="{StaticResource MaterialDesignOutlinedComboBox}"
SelectedItem="{Binding SelectedItem}"
DisplayMemberPath="UseName"
ItemsSource="{Binding Selects}"
/>
<Button
Margin="2"
Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"

View File

@ -161,7 +161,13 @@
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
Content="加药" />
<ComboBox Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
Grid.Column="0"
Margin="0 0 6 0"
Style="{StaticResource MaterialDesignOutlinedComboBox}"
SelectedItem="{Binding SelectedItemUseFor}"
DisplayMemberPath="UseName"
ItemsSource="{Binding SelectsUseFor}"/>
<TextBox Text="{Binding PZH, UpdateSourceTrigger=PropertyChanged}" materialDesign:HintAssist.Hint="凭证号"
materialDesign:HintAssist.IsFloating="True" Width="100"
Margin="0 0 3 0"

View File

@ -157,6 +157,13 @@
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
Content="取药" />
<ComboBox Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
Grid.Column="0"
Margin="0 0 6 0"
Style="{StaticResource MaterialDesignOutlinedComboBox}"
SelectedItem="{Binding SelectedItemUseFor}"
DisplayMemberPath="UseName"
ItemsSource="{Binding SelectsUseFor}"/>
<Button
Margin="0 0 3 0"
VerticalAlignment="Center"