绑定页面添加选择药品修改药品基数功能
This commit is contained in:
		
							parent
							
								
									f18655cc80
								
							
						
					
					
						commit
						e29e7aa6e3
					
				| 
						 | 
					@ -60,7 +60,15 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
        public ChannelStock Channel
 | 
					        public ChannelStock Channel
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            get { return _channelStock; }
 | 
					            get { return _channelStock; }
 | 
				
			||||||
            set { SetProperty(ref _channelStock, value); }
 | 
					            set
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                if (value != null)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    DrugInfo = DrugInfos.Where(di => di.DrugId == value.DrugInfo.DrugId).First();
 | 
				
			||||||
 | 
					                    BaseQuantity = value.BaseQuantity.ToString();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                SetProperty(ref _channelStock, value);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -312,6 +320,44 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //保存修改的药品基数
 | 
				
			||||||
 | 
					        public DelegateCommand SaveCommand
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get => new DelegateCommand(() =>
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                if (DrugInfo.DrugId != Channel.DrugId)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
 | 
				
			||||||
 | 
					                    SnackbarMessageQueue.Enqueue("只能修改药品基数,不能更换绑定药品!");
 | 
				
			||||||
 | 
					                    return;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                int baseQty = 0;
 | 
				
			||||||
 | 
					                if (int.TryParse(BaseQuantity, out baseQty))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    Channel.BaseQuantity = Convert.ToInt32(baseQty);
 | 
				
			||||||
 | 
					                    int iUpdate= SqlSugarHelper.Db.Updateable<ChannelStock>(Channel).ExecuteCommand();
 | 
				
			||||||
 | 
					                    if (iUpdate > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00e676"));
 | 
				
			||||||
 | 
					                        SnackbarMessageQueue.Enqueue("保存修改完成!");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00e676"));
 | 
				
			||||||
 | 
					                        SnackbarMessageQueue.Enqueue("保存修改失败!");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
 | 
				
			||||||
 | 
					                    SnackbarMessageQueue.Enqueue("药品基数只能是正整数,请检查输入!");
 | 
				
			||||||
 | 
					                    return;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //刷新
 | 
					        //刷新
 | 
				
			||||||
        public DelegateCommand Query
 | 
					        public DelegateCommand Query
 | 
				
			||||||
| 
						 | 
					@ -346,7 +392,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                    IsEnable = false;
 | 
					                    IsEnable = false;
 | 
				
			||||||
                    Status = 1;
 | 
					                    Status = 1;
 | 
				
			||||||
                    Console.WriteLine($"正在打开{iList[i]}号药箱");
 | 
					                    Console.WriteLine($"正在打开{iList[i]}号药箱");
 | 
				
			||||||
                    ModbusHelper.GetInstance().OpenBoxDoor(iList[i]-1);
 | 
					                    ModbusHelper.GetInstance().OpenBoxDoor(iList[i] - 1);
 | 
				
			||||||
                    //iNumber++;
 | 
					                    //iNumber++;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -517,7 +517,7 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
                        Operator = HomeWindowViewModel.Operator?.Id,
 | 
					                        Operator = HomeWindowViewModel.Operator?.Id,
 | 
				
			||||||
                        OperationTime = DateTime.Now,
 | 
					                        OperationTime = DateTime.Now,
 | 
				
			||||||
                        Type = 55,
 | 
					                        Type = 55,
 | 
				
			||||||
                        InvoiceId = $"打开{iList[i]}号药箱",
 | 
					                        InvoiceId = $"打开{iList[i].DrawerNo}号药箱",
 | 
				
			||||||
                        OptionType= SelfContent.Substring(0,1)=="取"? 0:1
 | 
					                        OptionType= SelfContent.Substring(0,1)=="取"? 0:1
 | 
				
			||||||
                    }).ExecuteCommand();
 | 
					                    }).ExecuteCommand();
 | 
				
			||||||
                    //记录药箱打开时间
 | 
					                    //记录药箱打开时间
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -176,7 +176,7 @@
 | 
				
			||||||
                        ToolTip="解绑"
 | 
					                        ToolTip="解绑"
 | 
				
			||||||
                        Content="解绑"
 | 
					                        Content="解绑"
 | 
				
			||||||
                        Command="{Binding RemoveBinding}" />
 | 
					                        Command="{Binding RemoveBinding}" />
 | 
				
			||||||
                <Button
 | 
					                <!--<Button
 | 
				
			||||||
                        Margin="6 0 6 6"
 | 
					                        Margin="6 0 6 6"
 | 
				
			||||||
                        ToolTip="打开药箱"
 | 
					                        ToolTip="打开药箱"
 | 
				
			||||||
                        Content="打开全部药箱"
 | 
					                        Content="打开全部药箱"
 | 
				
			||||||
| 
						 | 
					@ -184,6 +184,10 @@
 | 
				
			||||||
                        Command="{Binding OpenBox}" 
 | 
					                        Command="{Binding OpenBox}" 
 | 
				
			||||||
                        materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
 | 
					                        materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
 | 
				
			||||||
                        materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
 | 
					                        materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
 | 
				
			||||||
 | 
					                        Style="{StaticResource MaterialDesignOutlinedLightButton}" />-->
 | 
				
			||||||
 | 
					                <Button Margin="6 0 6 6"
 | 
				
			||||||
 | 
					                        Content="保存修改"
 | 
				
			||||||
 | 
					                        Command="{Binding SaveCommand}" 
 | 
				
			||||||
                        Style="{StaticResource MaterialDesignOutlinedLightButton}" />
 | 
					                        Style="{StaticResource MaterialDesignOutlinedLightButton}" />
 | 
				
			||||||
                <Button
 | 
					                <Button
 | 
				
			||||||
                        Margin="0 0 6 6"
 | 
					                        Margin="0 0 6 6"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue