channel_stok实体类型drawer_type添加默认值1
交接柜入库数据添加日志 移出为位中添加是否选择药品判断 自动退出时添加关掉弹窗 所有批次列宽度调整
This commit is contained in:
		
							parent
							
								
									e41db97fd0
								
							
						
					
					
						commit
						6b99940f50
					
				| 
						 | 
					@ -78,7 +78,7 @@ namespace DM_Weight.Models
 | 
				
			||||||
        /// 默认值: 1
 | 
					        /// 默认值: 1
 | 
				
			||||||
        ///</summary>
 | 
					        ///</summary>
 | 
				
			||||||
        [SugarColumn(ColumnName = "drawer_type")]
 | 
					        [SugarColumn(ColumnName = "drawer_type")]
 | 
				
			||||||
        public int DrawerType { get; set; }
 | 
					        public int DrawerType { get; set; } = 1;
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        ///  
 | 
					        ///  
 | 
				
			||||||
        /// 默认值: 1
 | 
					        /// 默认值: 1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,7 +63,8 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
        IEventAggregator _eventAggregator;
 | 
					        IEventAggregator _eventAggregator;
 | 
				
			||||||
        //private PortUtil _portUtil;
 | 
					        //private PortUtil _portUtil;
 | 
				
			||||||
        SocketHelper _socketHelper;
 | 
					        SocketHelper _socketHelper;
 | 
				
			||||||
 | 
					        private static readonly DateTime Jan1st1970 = new DateTime
 | 
				
			||||||
 | 
					   (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
 | 
				
			||||||
        public AdditionWindowViewModel(IEventAggregator eventAggregator, SocketHelper socketHelper)
 | 
					        public AdditionWindowViewModel(IEventAggregator eventAggregator, SocketHelper socketHelper)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            //_dialogService = dialogService;
 | 
					            //_dialogService = dialogService;
 | 
				
			||||||
| 
						 | 
					@ -316,7 +317,28 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            State = 0
 | 
					                            State = 0
 | 
				
			||||||
                        }).UpdateColumns(it => it.State).Where(it => it.DrawerNo == _ChannelList.DrawerNo).ExecuteCommand();
 | 
					                        }).UpdateColumns(it => it.State).Where(it => it.DrawerNo == _ChannelList.DrawerNo).ExecuteCommand();
 | 
				
			||||||
 | 
					                        for (int i = 0; i < selectedStock.Count; i++)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            string InvoiceId = "AddJiaoJieFromDM_" + CurrentTimeMillis();
 | 
				
			||||||
 | 
					                            // 保存记录
 | 
				
			||||||
 | 
					                            SqlSugarHelper.Db.Insertable(new MachineRecord()
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                MachineId = selectedStock[i].MachineId,
 | 
				
			||||||
 | 
					                                DrawerNo = selectedStock[i].DrawerNo,
 | 
				
			||||||
 | 
					                                ColNo = selectedStock[i].ColNo,
 | 
				
			||||||
 | 
					                                DrugId = selectedStock[i].DrugId,
 | 
				
			||||||
 | 
					                                ManuNo = selectedStock[i].ManuNo,
 | 
				
			||||||
 | 
					                                EffDate = !String.IsNullOrEmpty(selectedStock[i].EffDate) ? DateTime.ParseExact(selectedStock[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
 | 
				
			||||||
 | 
					                                Operator = HomeWindowViewModel.Operator?.Id,
 | 
				
			||||||
 | 
					                                Reviewer = HomeWindowViewModel.Reviewer?.Id,
 | 
				
			||||||
 | 
					                                OperationTime = DateTime.Now,
 | 
				
			||||||
 | 
					                                Quantity = selectedStock[i].Quantity,
 | 
				
			||||||
 | 
					                                Type = 2,
 | 
				
			||||||
 | 
					                                InvoiceId = InvoiceId
 | 
				
			||||||
 | 
					                                //,StockQuantity = nowChannels.Sum(it => it.Quantity),
 | 
				
			||||||
 | 
					                                //CheckQuantity = it.CheckQuantity
 | 
				
			||||||
 | 
					                            }).ExecuteCommand();
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                        //List<ChannelStock> jiaojie = selectedStock.GroupBy(cs => cs.DrugId).Select(cs => cs.FirstOrDefault()).ToList();
 | 
					                        //List<ChannelStock> jiaojie = selectedStock.GroupBy(cs => cs.DrugId).Select(cs => cs.FirstOrDefault()).ToList();
 | 
				
			||||||
                        //if (jiaojie != null && jiaojie.Count > 0)
 | 
					                        //if (jiaojie != null && jiaojie.Count > 0)
 | 
				
			||||||
                        //{
 | 
					                        //{
 | 
				
			||||||
| 
						 | 
					@ -356,7 +378,10 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        public long CurrentTimeMillis()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        //刷新
 | 
					        //刷新
 | 
				
			||||||
        public DelegateCommand QueryCommand
 | 
					        public DelegateCommand QueryCommand
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -511,7 +511,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                            continue;
 | 
					                            continue;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        cs.Quantity = cs.Quantity - oi._OrderDetail.Quantity;
 | 
					                        cs.Quantity = cs.Quantity - oi._OrderDetail.Quantity;
 | 
				
			||||||
                        cs.NeedNum = cs.NeedNum>0? cs.NeedNum + oi._OrderDetail.Quantity: cs.NeedNum;
 | 
					                        cs.NeedNum = cs.NeedNum>0? cs.NeedNum + oi._OrderDetail.Quantity: oi._OrderDetail.Quantity;
 | 
				
			||||||
                        logger.Info($"更新手术间{cs.DrawerNo}药品{cs.DrugId}批次{cs.ManuNo}库存为{cs.Quantity},需补药数量为{cs.NeedNum}");
 | 
					                        logger.Info($"更新手术间{cs.DrawerNo}药品{cs.DrugId}批次{cs.ManuNo}库存为{cs.Quantity},需补药数量为{cs.NeedNum}");
 | 
				
			||||||
                        // 更新数据 库存信息
 | 
					                        // 更新数据 库存信息
 | 
				
			||||||
                        SqlSugarHelper.Db.Updateable(cs).UpdateColumns(it => new { it.Quantity, it.NeedNum }).ExecuteCommand();
 | 
					                        SqlSugarHelper.Db.Updateable(cs).UpdateColumns(it => new { it.Quantity, it.NeedNum }).ExecuteCommand();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -218,12 +218,25 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        private async void Remove()
 | 
					        private async void Remove()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            // 此处延时1毫秒,等待页面渲染
 | 
					            if (_ChannelStock != null)
 | 
				
			||||||
            await Task.Delay(TimeSpan.FromMilliseconds(1));
 | 
					            {
 | 
				
			||||||
            //选中药箱号下的所有药品id
 | 
					                // 此处延时1毫秒,等待页面渲染
 | 
				
			||||||
            DialogParameters dialogParameters = new DialogParameters();
 | 
					                await Task.Delay(TimeSpan.FromMilliseconds(1));
 | 
				
			||||||
            dialogParameters.Add("csStock", _ChannelStock);
 | 
					                //选中药箱号下的所有药品id
 | 
				
			||||||
            DialogServiceExtensions.ShowDialogHost(_dialogService, "RemoveDialog", dialogParameters, DoDialogResult, "RootDialog");
 | 
					                DialogParameters dialogParameters = new DialogParameters();
 | 
				
			||||||
 | 
					                dialogParameters.Add("csStock", _ChannelStock);
 | 
				
			||||||
 | 
					                DialogServiceExtensions.ShowDialogHost(_dialogService, "RemoveDialog", dialogParameters, DoDialogResult, "RootDialog");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                AlertMsg alertMsg = new AlertMsg
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    Message = "请选择要移出的药品!",
 | 
				
			||||||
 | 
					                    Type = MsgType.ERROR,
 | 
				
			||||||
 | 
					                };
 | 
				
			||||||
 | 
					                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        private void DoDialogResult(IDialogResult dialogResult)
 | 
					        private void DoDialogResult(IDialogResult dialogResult)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,6 +25,7 @@ using DM_Weight.msg;
 | 
				
			||||||
using DM_Weight.HIKVISION;
 | 
					using DM_Weight.HIKVISION;
 | 
				
			||||||
using System.Threading;
 | 
					using System.Threading;
 | 
				
			||||||
using System.Diagnostics;
 | 
					using System.Diagnostics;
 | 
				
			||||||
 | 
					using MaterialDesignThemes.Wpf;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace DM_Weight.ViewModels
 | 
					namespace DM_Weight.ViewModels
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -611,6 +612,10 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                                stop();
 | 
					                                stop();
 | 
				
			||||||
                                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
 | 
					                                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
 | 
				
			||||||
                                {
 | 
					                                {
 | 
				
			||||||
 | 
					                                    if (DialogHost.IsDialogOpen("RootDialog"))
 | 
				
			||||||
 | 
					                                    {
 | 
				
			||||||
 | 
					                                        DialogHost.Close("RootDialog");
 | 
				
			||||||
 | 
					                                    }
 | 
				
			||||||
                                    _regionManager.RequestNavigate("ContentRegion", "EmptyWindow");
 | 
					                                    _regionManager.RequestNavigate("ContentRegion", "EmptyWindow");
 | 
				
			||||||
                                    _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
					                                    _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
				
			||||||
                                }));
 | 
					                                }));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -226,14 +226,14 @@
 | 
				
			||||||
                            </DataTemplate>
 | 
					                            </DataTemplate>
 | 
				
			||||||
                        </GridViewColumn.CellTemplate>
 | 
					                        </GridViewColumn.CellTemplate>
 | 
				
			||||||
                    </GridViewColumn>
 | 
					                    </GridViewColumn>
 | 
				
			||||||
                    <GridViewColumn Header="批次" Width="100">
 | 
					                    <GridViewColumn Header="批次" Width="130">
 | 
				
			||||||
                        <GridViewColumn.CellTemplate>
 | 
					                        <GridViewColumn.CellTemplate>
 | 
				
			||||||
                            <DataTemplate>
 | 
					                            <DataTemplate>
 | 
				
			||||||
                                <ListBox ItemsSource="{Binding channelStocks}" DisplayMemberPath="ManuNo" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
 | 
					                                <ListBox ItemsSource="{Binding channelStocks}" DisplayMemberPath="ManuNo" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
 | 
				
			||||||
                            </DataTemplate>
 | 
					                            </DataTemplate>
 | 
				
			||||||
                        </GridViewColumn.CellTemplate>
 | 
					                        </GridViewColumn.CellTemplate>
 | 
				
			||||||
                    </GridViewColumn>
 | 
					                    </GridViewColumn>
 | 
				
			||||||
                    <GridViewColumn Header="待入库数" Width="100">
 | 
					                    <GridViewColumn Header="待入库数" Width="70">
 | 
				
			||||||
                        <GridViewColumn.CellTemplate>
 | 
					                        <GridViewColumn.CellTemplate>
 | 
				
			||||||
                            <DataTemplate>
 | 
					                            <DataTemplate>
 | 
				
			||||||
                                <ListBox ItemsSource="{Binding channelStocks}" DisplayMemberPath="AddToJJNum" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
 | 
					                                <ListBox ItemsSource="{Binding channelStocks}" DisplayMemberPath="AddToJJNum" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -182,10 +182,10 @@
 | 
				
			||||||
                            <GridViewColumn Width="180"
 | 
					                            <GridViewColumn Width="180"
 | 
				
			||||||
                        DisplayMemberBinding="{Binding _OrderDetail.DrugInfo.DrugName}"
 | 
					                        DisplayMemberBinding="{Binding _OrderDetail.DrugInfo.DrugName}"
 | 
				
			||||||
                        Header="药品名称"/>
 | 
					                        Header="药品名称"/>
 | 
				
			||||||
                        <GridViewColumn Width="80"
 | 
					                        <GridViewColumn Width="130"
 | 
				
			||||||
                        DisplayMemberBinding="{Binding  _OrderDetail.SetManuNo}"
 | 
					                        DisplayMemberBinding="{Binding  _OrderDetail.SetManuNo}"
 | 
				
			||||||
                        Header="药品批次"/>
 | 
					                        Header="药品批次"/>
 | 
				
			||||||
                        <GridViewColumn Width="42"
 | 
					                        <GridViewColumn Width="30"
 | 
				
			||||||
                        DisplayMemberBinding="{Binding _OrderDetail.Quantity}"
 | 
					                        DisplayMemberBinding="{Binding _OrderDetail.Quantity}"
 | 
				
			||||||
                        Header="数量"/>
 | 
					                        Header="数量"/>
 | 
				
			||||||
                        <GridViewColumn Width="80"
 | 
					                        <GridViewColumn Width="80"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -188,10 +188,10 @@
 | 
				
			||||||
                        <GridViewColumn Width="180"
 | 
					                        <GridViewColumn Width="180"
 | 
				
			||||||
                        DisplayMemberBinding="{Binding _OrderDetail.DrugInfo.DrugName}"
 | 
					                        DisplayMemberBinding="{Binding _OrderDetail.DrugInfo.DrugName}"
 | 
				
			||||||
                        Header="药品名称"/>
 | 
					                        Header="药品名称"/>
 | 
				
			||||||
                        <GridViewColumn Width="80"
 | 
					                        <GridViewColumn Width="130"
 | 
				
			||||||
                        DisplayMemberBinding="{Binding  _OrderDetail.SetManuNo}"
 | 
					                        DisplayMemberBinding="{Binding  _OrderDetail.SetManuNo}"
 | 
				
			||||||
                        Header="药品批次"/>
 | 
					                        Header="药品批次"/>
 | 
				
			||||||
                        <GridViewColumn Width="42"
 | 
					                        <GridViewColumn Width="30"
 | 
				
			||||||
                        DisplayMemberBinding="{Binding _OrderDetail.Quantity}"
 | 
					                        DisplayMemberBinding="{Binding _OrderDetail.Quantity}"
 | 
				
			||||||
                        Header="数量"/>
 | 
					                        Header="数量"/>
 | 
				
			||||||
                        <GridViewColumn Width="80"
 | 
					                        <GridViewColumn Width="80"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -168,12 +168,12 @@
 | 
				
			||||||
                        Header="基数"
 | 
					                        Header="基数"
 | 
				
			||||||
                        IsReadOnly="True"
 | 
					                        IsReadOnly="True"
 | 
				
			||||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>-->
 | 
					                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>-->
 | 
				
			||||||
                    <DataGridTextColumn Width="100"
 | 
					                    <DataGridTextColumn Width="130"
 | 
				
			||||||
                        Binding="{Binding ManuNo}"
 | 
					                        Binding="{Binding ManuNo}"
 | 
				
			||||||
                        Header="批次"
 | 
					                        Header="批次"
 | 
				
			||||||
                        IsReadOnly="True"
 | 
					                        IsReadOnly="True"
 | 
				
			||||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
					                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
				
			||||||
                    <DataGridTextColumn Width="100"
 | 
					                    <DataGridTextColumn Width="50"
 | 
				
			||||||
                        Binding="{Binding Quantity}"
 | 
					                        Binding="{Binding Quantity}"
 | 
				
			||||||
                        Header="库存"
 | 
					                        Header="库存"
 | 
				
			||||||
                        IsReadOnly="True"
 | 
					                        IsReadOnly="True"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -250,7 +250,7 @@
 | 
				
			||||||
                        <GridViewColumn Width="80"
 | 
					                        <GridViewColumn Width="80"
 | 
				
			||||||
                        DisplayMemberBinding="{Binding DrugInfo.DrugSpec}"
 | 
					                        DisplayMemberBinding="{Binding DrugInfo.DrugSpec}"
 | 
				
			||||||
                        Header="规格"/>
 | 
					                        Header="规格"/>
 | 
				
			||||||
                        <GridViewColumn Width="80"
 | 
					                        <GridViewColumn Width="130"
 | 
				
			||||||
                        DisplayMemberBinding="{Binding ManuNo}"
 | 
					                        DisplayMemberBinding="{Binding ManuNo}"
 | 
				
			||||||
                        Header="批次"/>
 | 
					                        Header="批次"/>
 | 
				
			||||||
                        <GridViewColumn Width="80"
 | 
					                        <GridViewColumn Width="80"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -136,9 +136,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        <GridViewColumn Header="规格" Width="150" DisplayMemberBinding="{Binding DrugInfo.DrugSpec}"/>
 | 
					                        <GridViewColumn Header="规格" Width="150" DisplayMemberBinding="{Binding DrugInfo.DrugSpec}"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        <GridViewColumn Header="批次" Width="100" DisplayMemberBinding="{Binding ManuNo}"/>
 | 
					                        <GridViewColumn Header="批次" Width="130" DisplayMemberBinding="{Binding ManuNo}"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        <GridViewColumn Header="库存" Width="100" DisplayMemberBinding="{Binding Quantity}"/>
 | 
					                        <GridViewColumn Header="库存" Width="50" DisplayMemberBinding="{Binding Quantity}"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    </GridView>
 | 
					                    </GridView>
 | 
				
			||||||
                </ListView.View>
 | 
					                </ListView.View>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue