parent
							
								
									efd7e78152
								
							
						
					
					
						commit
						659e35c35e
					
				| 
						 | 
				
			
			@ -1019,10 +1019,14 @@ namespace DM_Weight.Port
 | 
			
		|||
 | 
			
		||||
        #region 2.4寸汉显屏
 | 
			
		||||
        // 基础数据写入方法
 | 
			
		||||
        public async void WriteChannelInfo(int type, string content, int drawerNo, int colNo)
 | 
			
		||||
        public async Task WriteChannelInfo(int type, string content, int drawerNo, int colNo)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                if (content.Length > 10)
 | 
			
		||||
                {
 | 
			
		||||
                    content = content.Substring(0, 10);
 | 
			
		||||
                }
 | 
			
		||||
                canBusSerial.DiscardInBuffer();
 | 
			
		||||
                Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
 | 
			
		||||
                byte[] contentBuf = Encoding.GetEncoding("gb2312").GetBytes(trim(content));
 | 
			
		||||
| 
						 | 
				
			
			@ -1117,7 +1121,7 @@ namespace DM_Weight.Port
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
        // 写入数量
 | 
			
		||||
        public void WriteQuantity(int drawerNo, int colNo, int quantity)
 | 
			
		||||
        public async Task WriteQuantity(int drawerNo, int colNo, int quantity)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -761,11 +761,11 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            int totalQuantity = channelStockEffDate.Sum(it => it.Quantity);
 | 
			
		||||
 | 
			
		||||
                            //将库位多批次的总库存数更新标签
 | 
			
		||||
                            _portUtil.WriteQuantity(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo, totalQuantity);
 | 
			
		||||
                            await _portUtil.WriteQuantity(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo, totalQuantity);
 | 
			
		||||
                            Thread.Sleep(200);
 | 
			
		||||
                            _portUtil.WriteChannelInfo(6, channelStockEffDate[0].EffDate == null ? "" : channelStockEffDate[0].EffDate, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                            await _portUtil.WriteChannelInfo(6, channelStockEffDate[0].EffDate == null ? "" : channelStockEffDate[0].EffDate, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                            Thread.Sleep(200);
 | 
			
		||||
                            _portUtil.WriteChannelInfo(5, channelStockEffDate[0].ManuNo, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                            await _portUtil.WriteChannelInfo(5, channelStockEffDate[0].ManuNo, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                            Thread.Sleep(200);
 | 
			
		||||
                            _portUtil.ShowContent(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                            //}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -309,15 +309,15 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                {
 | 
			
		||||
                                    _portUtil.WindowName = "BindingChannelDialog";
 | 
			
		||||
                                    // 向显示屏写入库位信息
 | 
			
		||||
                                    _portUtil.WriteChannelInfo(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfo(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.WriteChannelInfo(2, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfo(2, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.WriteChannelInfo(8, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfo(8, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.WriteChannelInfo(6, DrugManuNo.ManuNo, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfo(6, DrugManuNo.ManuNo, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.WriteChannelInfo(5, String.Format("{0:yyyy-MM-dd}", DrugManuNo.EffDate), item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfo(5, String.Format("{0:yyyy-MM-dd}", DrugManuNo.EffDate), item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.ShowContent(item.DrawerNo, item.ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -201,19 +201,13 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                        {
 | 
			
		||||
                            singleChannels.ForEach(it =>
 | 
			
		||||
                            singleChannels.ForEach(async it =>
 | 
			
		||||
                            {
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            singleChannels.ForEach(it =>
 | 
			
		||||
                            {
 | 
			
		||||
                                _portUtil.WriteChannelInfoMethod(2, (it.Quantity - it.TakeQuantity).ToString(), it.DrawerNo, it.ColNo);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                            {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,10 +39,13 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        private PortUtil _portUtil;
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
 | 
			
		||||
        //开药盒
 | 
			
		||||
        public DelegateCommand<object> OpenBoxCommand { get; private set; }
 | 
			
		||||
        public DrawerAddDrugWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _portUtil = portUtil;
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
            OpenBoxCommand = new DelegateCommand<object>(param => OpenBoxAction(param));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void DoMyPrismEvent(DeviceMsg msg)
 | 
			
		||||
| 
						 | 
				
			
			@ -148,6 +151,27 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
            }, () => Status == 0).ObservesProperty(() => Status);
 | 
			
		||||
        }
 | 
			
		||||
        private void OpenBoxAction(object parameter)
 | 
			
		||||
        {
 | 
			
		||||
            ChannelStock cs = parameter as ChannelStock;
 | 
			
		||||
            if(cs.BoardType==35)
 | 
			
		||||
            {
 | 
			
		||||
                _portUtil.BoardType = cs.BoardType;
 | 
			
		||||
                _portUtil.DrawerNo = cs.DrawerNo;
 | 
			
		||||
                _portUtil.ColNos = new int[] { cs.ColNo};
 | 
			
		||||
                _portUtil.OpenBox();
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = "非药盒库位,无需开药盒",
 | 
			
		||||
                    Type = MsgType.ERROR,
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private bool _isFinishClick = false;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -311,8 +335,10 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                //将库位多批次的总库存数更新标签
 | 
			
		||||
                                //_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) - singleChannels.Sum(it => it.TakeQuantity));
 | 
			
		||||
 | 
			
		||||
                                singleChannels.ForEach(it =>
 | 
			
		||||
                                singleChannels.ForEach(async it =>
 | 
			
		||||
                                {
 | 
			
		||||
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,11 +44,13 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        private PortUtil _portUtil;
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        //开药盒
 | 
			
		||||
        public DelegateCommand<object> OpenBoxCommand { get; private set; }
 | 
			
		||||
        public DrawerTakeDrugWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _portUtil = portUtil;
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
            OpenBoxCommand = new DelegateCommand<object>(param => OpenBoxAction(param));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void DoMyPrismEvent(DeviceMsg msg)
 | 
			
		||||
| 
						 | 
				
			
			@ -151,6 +153,27 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        private void OpenBoxAction(object parameter)
 | 
			
		||||
        {
 | 
			
		||||
            ChannelStock cs = parameter as ChannelStock;
 | 
			
		||||
            if (cs.BoardType == 35)
 | 
			
		||||
            {
 | 
			
		||||
                _portUtil.BoardType = cs.BoardType;
 | 
			
		||||
                _portUtil.DrawerNo = cs.DrawerNo;
 | 
			
		||||
                _portUtil.ColNos = new int[] { cs.ColNo };
 | 
			
		||||
                _portUtil.OpenBox();
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = "非药盒库位,无需开药盒",
 | 
			
		||||
                    Type = MsgType.ERROR,
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private bool _isFinishClick = false;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -316,8 +339,9 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                //将库位多批次的总库存数更新标签
 | 
			
		||||
                                //_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) - singleChannels.Sum(it => it.TakeQuantity));
 | 
			
		||||
 | 
			
		||||
                                singleChannels.ForEach(it =>
 | 
			
		||||
                                singleChannels.ForEach(async it =>
 | 
			
		||||
                                {
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -373,8 +373,9 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                        {
 | 
			
		||||
                            singleChannels.ForEach(it =>
 | 
			
		||||
                            singleChannels.ForEach(async it =>
 | 
			
		||||
                            {
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -437,8 +437,9 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
 | 
			
		||||
                            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                            {
 | 
			
		||||
                                singleChannels.ForEach(it =>
 | 
			
		||||
                                singleChannels.ForEach(async it =>
 | 
			
		||||
                                {
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -431,8 +431,9 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                        {
 | 
			
		||||
                            singleChannels.ForEach(it =>
 | 
			
		||||
                            singleChannels.ForEach(async it =>
 | 
			
		||||
                            {
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.TakeQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -455,8 +455,9 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType == 5);
 | 
			
		||||
                            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                            {
 | 
			
		||||
                                singleChannels.ForEach(it =>
 | 
			
		||||
                                singleChannels.ForEach(async it =>
 | 
			
		||||
                                {
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -362,6 +362,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    // 更新屏显库存
 | 
			
		||||
                    if (ChannelStock.BoardType == 5)
 | 
			
		||||
                    {
 | 
			
		||||
                        await Task.Delay(200);
 | 
			
		||||
                        _portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, ChannelStock.Quantity + ReturnQuantity);
 | 
			
		||||
                    }
 | 
			
		||||
                    if(ChannelStock.BoardType==35)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -365,8 +365,10 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                        {
 | 
			
		||||
                            singleChannels.ForEach(it =>
 | 
			
		||||
                            singleChannels.ForEach(async it =>
 | 
			
		||||
                            {
 | 
			
		||||
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -339,8 +339,9 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                        {
 | 
			
		||||
                            singleChannels.ForEach(it =>
 | 
			
		||||
                            singleChannels.ForEach(async it =>
 | 
			
		||||
                            {
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -294,7 +294,15 @@
 | 
			
		|||
                            </DataTemplate>
 | 
			
		||||
                        </DataGridTemplateColumn.CellTemplate>
 | 
			
		||||
                    </DataGridTemplateColumn>
 | 
			
		||||
 | 
			
		||||
                                            <!--Visibility="{Binding BoxShow, Converter={StaticResource StatusConverter}, ConverterParameter=OpenBox}"-->
 | 
			
		||||
                    <DataGridTemplateColumn Width="100"
 | 
			
		||||
                        Header="操作">
 | 
			
		||||
                        <DataGridTemplateColumn.CellTemplate>
 | 
			
		||||
                            <DataTemplate>
 | 
			
		||||
                                <Button Content="开药盒" Command="{Binding DataContext.OpenBoxCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}" CommandParameter="{Binding}"/>
 | 
			
		||||
                            </DataTemplate>
 | 
			
		||||
                        </DataGridTemplateColumn.CellTemplate>
 | 
			
		||||
                    </DataGridTemplateColumn>
 | 
			
		||||
                </DataGrid.Columns>
 | 
			
		||||
            </DataGrid>
 | 
			
		||||
            <!--<ListView
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -259,6 +259,14 @@
 | 
			
		|||
                            </DataTemplate>
 | 
			
		||||
                        </DataGridTemplateColumn.CellTemplate>
 | 
			
		||||
                    </DataGridTemplateColumn>
 | 
			
		||||
                    <DataGridTemplateColumn Width="100"
 | 
			
		||||
                        Header="操作">
 | 
			
		||||
                        <DataGridTemplateColumn.CellTemplate>
 | 
			
		||||
                            <DataTemplate>
 | 
			
		||||
                                <Button Content="开药盒" Command="{Binding DataContext.OpenBoxCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}" CommandParameter="{Binding}"/>
 | 
			
		||||
                            </DataTemplate>
 | 
			
		||||
                        </DataGridTemplateColumn.CellTemplate>
 | 
			
		||||
                    </DataGridTemplateColumn>
 | 
			
		||||
 | 
			
		||||
                </DataGrid.Columns>
 | 
			
		||||
            </DataGrid>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue