2024-12-03 13:22:42 +08:00
|
|
|
|
using MaterialDesignThemes.Wpf;
|
|
|
|
|
using Prism.Commands;
|
|
|
|
|
using Prism.Events;
|
|
|
|
|
using Prism.Mvvm;
|
|
|
|
|
using Prism.Regions;
|
|
|
|
|
using Prism.Services.Dialogs;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using DM_Weight.Models;
|
|
|
|
|
using DM_Weight.msg;
|
|
|
|
|
using DM_Weight.Port;
|
|
|
|
|
using DM_Weight.util;
|
|
|
|
|
using log4net;
|
2024-12-19 19:55:35 +08:00
|
|
|
|
using System.Threading;
|
2024-12-03 13:22:42 +08:00
|
|
|
|
|
|
|
|
|
namespace DM_Weight.ViewModels
|
|
|
|
|
{
|
|
|
|
|
public class BindingChannelDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
|
|
|
|
|
{
|
|
|
|
|
public static BindingChannelDialogViewModel vm;
|
|
|
|
|
public string Title => "库位绑定";
|
|
|
|
|
|
|
|
|
|
public event Action<IDialogResult> RequestClose;
|
|
|
|
|
|
|
|
|
|
private int _drawerNo = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SolidColorBrush _colorBrush;
|
|
|
|
|
|
|
|
|
|
public SolidColorBrush SnackbarBackground
|
|
|
|
|
{
|
|
|
|
|
get => _colorBrush;
|
|
|
|
|
set => SetProperty(ref _colorBrush, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ISnackbarMessageQueue _snackbarMessageQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(3));
|
|
|
|
|
|
|
|
|
|
public ISnackbarMessageQueue SnackbarMessageQueue
|
|
|
|
|
{
|
|
|
|
|
get => _snackbarMessageQueue;
|
|
|
|
|
set => SetProperty(ref _snackbarMessageQueue, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEventAggregator _eventAggregator;
|
|
|
|
|
PortUtil _portUtil;
|
|
|
|
|
//ScreenUtil _screenUtil;
|
|
|
|
|
|
|
|
|
|
public BindingChannelDialogViewModel(IEventAggregator eventAggregator, PortUtil portUtil//, ScreenUtil screenUtil
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
_eventAggregator = eventAggregator;
|
|
|
|
|
_portUtil = portUtil;
|
|
|
|
|
//_screenUtil = screenUtil;
|
|
|
|
|
vm = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int DrawerNo
|
|
|
|
|
{
|
|
|
|
|
get => _drawerNo;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
SetProperty(ref _drawerNo, value);
|
|
|
|
|
GetChannelsByDrawerNo();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DrugInfo? _drugInfo;
|
|
|
|
|
|
|
|
|
|
public DrugInfo? DrugInfo
|
|
|
|
|
{
|
|
|
|
|
get => _drugInfo;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
SetProperty(ref _drugInfo, value);
|
|
|
|
|
if (_drugInfo != null)
|
|
|
|
|
{
|
|
|
|
|
//DrugManuNos = _drugInfo.DrugManuNos;
|
|
|
|
|
DrugManuNos = SqlSugarHelper.Db.Queryable<DrugManuNo>().Where(m => m.DrugId == _drugInfo.DrugId.ToString()).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<DrugInfo>? _drugInfos;
|
|
|
|
|
|
|
|
|
|
public List<DrugInfo>? DrugInfos
|
|
|
|
|
{
|
|
|
|
|
get => _drugInfos;
|
|
|
|
|
set => SetProperty(ref _drugInfos, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DrugManuNo? _drugManuNo;
|
|
|
|
|
|
|
|
|
|
public DrugManuNo? DrugManuNo
|
|
|
|
|
{
|
|
|
|
|
get => _drugManuNo;
|
|
|
|
|
set => SetProperty(ref _drugManuNo, value);
|
|
|
|
|
}
|
|
|
|
|
private List<DrugManuNo>? _drugManuNos;
|
|
|
|
|
|
|
|
|
|
public List<DrugManuNo>? DrugManuNos
|
|
|
|
|
{
|
|
|
|
|
get => _drugManuNos;
|
|
|
|
|
set => SetProperty(ref _drugManuNos, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<ChannelStock>? _channels;
|
|
|
|
|
|
|
|
|
|
public List<ChannelStock>? Channels
|
|
|
|
|
{
|
|
|
|
|
get => _channels;
|
|
|
|
|
set => SetProperty(ref _channels, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int _totalCount = 0;
|
|
|
|
|
public int TotalCount { get => _totalCount; set => SetProperty(ref _totalCount, value); }
|
|
|
|
|
|
|
|
|
|
private int _pageNum = 1;
|
|
|
|
|
public int PageNum
|
|
|
|
|
{
|
|
|
|
|
get => _pageNum;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
SetProperty(ref _pageNum, value);
|
|
|
|
|
GetChannelsByDrawerNo();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int _pageCount = 1;
|
|
|
|
|
public int PageCount
|
|
|
|
|
{
|
|
|
|
|
get => _pageCount;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
SetProperty(ref _pageCount, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int _pageSize = 9;
|
|
|
|
|
public int PageSize
|
|
|
|
|
{
|
|
|
|
|
get => _pageSize;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
SetProperty(ref _pageSize, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool CanCloseDialog()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnDialogClosed()
|
|
|
|
|
{
|
|
|
|
|
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GetAllDrugInfos()
|
|
|
|
|
{
|
2025-03-25 16:21:39 +08:00
|
|
|
|
string str = @"SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit,
|
|
|
|
|
d.manufactory,d.max_stock,CONCAT(drug_name,' ',drug_spec)as drug_name FROM `drug_info` d";
|
|
|
|
|
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
|
|
|
|
|
|
|
|
|
|
//var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
|
|
|
|
|
//DrugInfos = list;
|
2024-12-03 13:22:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GetChannelsByDrawerNo()
|
|
|
|
|
{
|
|
|
|
|
Channels?.Clear();
|
|
|
|
|
int totalCount = 0;
|
|
|
|
|
var list = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
|
|
|
|
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
|
|
|
|
.WhereIF(DrawerNo > 0, cs => cs.DrawerNo == DrawerNo)
|
|
|
|
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
|
|
|
|
.OrderBy(cs => cs.DrawerNo)
|
|
|
|
|
.OrderBy(cs => cs.ColNo)
|
|
|
|
|
.ToPageList(PageNum, PageSize, ref totalCount);
|
|
|
|
|
Channels = list;
|
|
|
|
|
TotalCount = totalCount;
|
|
|
|
|
}
|
|
|
|
|
public void OnDialogOpened(IDialogParameters parameters)
|
|
|
|
|
{
|
|
|
|
|
if (parameters.ContainsKey("DrawerNo"))
|
|
|
|
|
{
|
|
|
|
|
DrawerNo = parameters.GetValue<int>("DrawerNo");
|
|
|
|
|
}
|
|
|
|
|
GetAllDrugInfos();
|
|
|
|
|
GetChannelsByDrawerNo();
|
|
|
|
|
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
|
|
|
|
}
|
|
|
|
|
public DelegateCommand Query
|
|
|
|
|
{
|
|
|
|
|
get => new DelegateCommand(() =>
|
|
|
|
|
{
|
|
|
|
|
GetChannelsByDrawerNo();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DelegateCommand BindingDrug
|
|
|
|
|
{
|
2024-12-19 19:55:35 +08:00
|
|
|
|
get => new DelegateCommand(() =>
|
2024-12-03 13:22:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var SelectChannels = Channels.FindAll(item => item.IsSelected && item.Quantity == 0);
|
|
|
|
|
|
2024-12-19 19:55:35 +08:00
|
|
|
|
if (SelectChannels is null || SelectChannels.Count <= 0)
|
2024-12-03 13:22:42 +08:00
|
|
|
|
{
|
|
|
|
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
|
|
|
|
SnackbarMessageQueue.Enqueue("未选中库位或库位还存在药品无法绑定");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SelectChannels.All(it => it.DrawerType != 1))
|
|
|
|
|
{
|
|
|
|
|
if (SelectChannels.Count == 1)
|
|
|
|
|
{
|
|
|
|
|
if (DrugInfo != null)
|
|
|
|
|
{
|
|
|
|
|
int count = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrugId.Equals(DrugInfo.DrugId.ToString())).Where(cs => cs.DrawerType != 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).Count();
|
|
|
|
|
if (count == 0)
|
|
|
|
|
{
|
|
|
|
|
var item = SelectChannels[0];
|
|
|
|
|
|
|
|
|
|
if (item.DrugId == null || !DrugInfo.DrugId.ToString().Equals(item.DrugId))
|
|
|
|
|
{
|
|
|
|
|
item.PosNo = 0;
|
|
|
|
|
}
|
|
|
|
|
item.DrugId = DrugInfo.DrugId.ToString();
|
|
|
|
|
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo }).ExecuteCommand();
|
|
|
|
|
GetChannelsByDrawerNo();
|
|
|
|
|
|
|
|
|
|
if (item.BoardType == 5)
|
|
|
|
|
{
|
|
|
|
|
_portUtil.WindowName = "BindingChannelDialog";
|
|
|
|
|
// 向显示屏写入库位信息
|
|
|
|
|
_portUtil.WriteChannelInfo(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
|
2024-12-19 19:55:35 +08:00
|
|
|
|
Task.Delay(200);
|
2024-12-03 13:22:42 +08:00
|
|
|
|
_portUtil.WriteChannelInfo(2, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
|
2024-12-19 19:55:35 +08:00
|
|
|
|
Task.Delay(200);
|
2024-12-03 13:22:42 +08:00
|
|
|
|
_portUtil.WriteChannelInfo(8, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
2024-12-19 19:55:35 +08:00
|
|
|
|
Task.Delay(200);
|
2024-12-03 13:22:42 +08:00
|
|
|
|
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
2024-12-19 19:55:35 +08:00
|
|
|
|
Task.Delay(200);
|
2024-12-03 13:22:42 +08:00
|
|
|
|
}
|
|
|
|
|
//_screenUtil.SetStockInfo(item, 1);
|
2024-12-19 19:55:35 +08:00
|
|
|
|
if (item.BoardType == 35)
|
2024-12-03 13:22:42 +08:00
|
|
|
|
{
|
|
|
|
|
_portUtil.WindowName = "BindingChannelDialog";
|
2024-12-19 19:55:35 +08:00
|
|
|
|
_portUtil.WriteChannelInfoMethod(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
|
|
|
|
|
Task.Delay(200);
|
|
|
|
|
_portUtil.WriteChannelInfoMethod(3, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
|
|
|
|
|
Task.Delay(200);
|
|
|
|
|
_portUtil.WriteChannelInfoMethod(4, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
|
|
|
|
Task.Delay(200);
|
|
|
|
|
_portUtil.WriteChannelInfoMethod(5, item.EffDate, item.DrawerNo, item.ColNo);
|
|
|
|
|
Task.Delay(200);
|
|
|
|
|
_portUtil.WriteChannelInfoMethod(6, item.ManuNo, item.DrawerNo, item.ColNo);
|
|
|
|
|
Task.Delay(200);
|
2025-05-22 11:33:49 +08:00
|
|
|
|
Task.Delay(200);
|
2024-12-19 19:55:35 +08:00
|
|
|
|
_portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
|
|
|
|
|
Task.Delay(200);
|
2024-12-03 13:22:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
|
|
|
|
SnackbarMessageQueue.Enqueue($"药品【{DrugInfo.DrugName}】已经绑定了回收库位不可再次绑定");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
|
|
|
|
SnackbarMessageQueue.Enqueue("请选择库位需要绑定的药品信息");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
|
|
|
|
SnackbarMessageQueue.Enqueue("每种药品只能绑定一个回收库位");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (DrugInfo != null && DrugManuNo != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var c = SelectChannels.Count;
|
|
|
|
|
|
|
|
|
|
if (c > 0)
|
|
|
|
|
{
|
2024-12-19 19:55:35 +08:00
|
|
|
|
SelectChannels.ForEach((item) =>
|
|
|
|
|
{
|
|
|
|
|
if (item.DrugId == null || !DrugInfo.DrugId.ToString().Equals(item.DrugId))
|
2024-12-03 13:22:42 +08:00
|
|
|
|
{
|
2024-12-19 19:55:35 +08:00
|
|
|
|
item.PosNo = 0;
|
|
|
|
|
}
|
|
|
|
|
if (DrugManuNo.EffDate != null && DrugManuNo.EffDate.Length >= 10)
|
|
|
|
|
{
|
|
|
|
|
DrugManuNo.EffDate = DrugManuNo.EffDate.Substring(0, 10);
|
|
|
|
|
}
|
|
|
|
|
item.DrugId = DrugInfo.DrugId.ToString();
|
|
|
|
|
item.ManuNo = DrugManuNo.ManuNo;
|
|
|
|
|
item.DrugInfo = DrugInfo;
|
|
|
|
|
item.EffDate = String.Format("{0:yyyy-MM-dd}", DrugManuNo.EffDate.Length >= 10 ? DrugManuNo.EffDate.Substring(0, 10) : DrugManuNo.EffDate);
|
|
|
|
|
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//_screenUtil.SetStockInfo(item, 1);
|
|
|
|
|
});
|
|
|
|
|
Task.Factory.StartNew(() =>
|
|
|
|
|
{
|
|
|
|
|
SelectChannels.ForEach((item) =>
|
2024-12-03 13:22:42 +08:00
|
|
|
|
{
|
2024-12-19 19:55:35 +08:00
|
|
|
|
if (item.BoardType == 5)
|
|
|
|
|
{
|
|
|
|
|
_portUtil.WindowName = "BindingChannelDialog";
|
|
|
|
|
// 向显示屏写入库位信息
|
|
|
|
|
_portUtil.WriteChannelInfo(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
_portUtil.WriteChannelInfo(2, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
_portUtil.WriteChannelInfo(8, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
_portUtil.WriteChannelInfo(5, DrugManuNo.ManuNo, item.DrawerNo, item.ColNo);
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
_portUtil.WriteChannelInfo(6, String.Format("{0:yyyy-MM-dd}", DrugManuNo.EffDate.Length >= 10 ? DrugManuNo.EffDate.Substring(0, 10) : DrugManuNo.EffDate), item.DrawerNo, item.ColNo);
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
|
|
|
|
}
|
|
|
|
|
if (item.BoardType == 35)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
_portUtil.WindowName = "BindingChannelDialog";
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
_portUtil.WriteChannelInfoMethod(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
_portUtil.WriteChannelInfoMethod(3, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
_portUtil.WriteChannelInfoMethod(4, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
_portUtil.WriteChannelInfoMethod(5, item.EffDate, item.DrawerNo, item.ColNo);
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
_portUtil.WriteChannelInfoMethod(6, item.ManuNo, item.DrawerNo, item.ColNo);
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
_portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-12-03 13:22:42 +08:00
|
|
|
|
});
|
|
|
|
|
GetChannelsByDrawerNo();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
|
|
|
|
SnackbarMessageQueue.Enqueue("所选库位中无可绑定库位【库位还存在药品】");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
|
|
|
|
SnackbarMessageQueue.Enqueue("请选择库位需要绑定的药品及批次信息");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DelegateCommand RemoveBinding
|
|
|
|
|
{
|
2024-12-19 19:55:35 +08:00
|
|
|
|
get => new DelegateCommand(() =>
|
2024-12-03 13:22:42 +08:00
|
|
|
|
{
|
|
|
|
|
var SelectChannels = Channels.FindAll(item => item.IsSelected && item.Quantity == 0);
|
|
|
|
|
var c = SelectChannels.Count;
|
|
|
|
|
if (c > 0)
|
|
|
|
|
{
|
2024-12-19 19:55:35 +08:00
|
|
|
|
SelectChannels.ForEach(item =>
|
2024-12-03 13:22:42 +08:00
|
|
|
|
{
|
|
|
|
|
item.DrugId = null;
|
|
|
|
|
item.ManuNo = null;
|
|
|
|
|
item.EffDate = null;
|
|
|
|
|
item.DrugInfo = null;
|
|
|
|
|
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate }).ExecuteCommand();
|
2024-12-19 19:55:35 +08:00
|
|
|
|
});
|
|
|
|
|
Task.Factory.StartNew(() =>
|
|
|
|
|
{
|
|
|
|
|
SelectChannels.ForEach(item =>
|
2024-12-03 13:22:42 +08:00
|
|
|
|
{
|
2024-12-19 19:55:35 +08:00
|
|
|
|
if (item.BoardType == 5)
|
|
|
|
|
{
|
|
|
|
|
// 清除显示屏库位信息
|
|
|
|
|
_portUtil.ClearContent(item.DrawerNo, item.ColNo);
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
|
|
|
|
}
|
|
|
|
|
if (item.BoardType == 35)
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
_portUtil.ClearContentMethod(item.DrawerNo, item.ColNo);
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
_portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
|
|
|
|
|
}
|
2024-12-03 13:22:42 +08:00
|
|
|
|
|
2024-12-19 19:55:35 +08:00
|
|
|
|
//_screenUtil.SetStockInfo(item, 1);
|
|
|
|
|
});
|
2024-12-03 13:22:42 +08:00
|
|
|
|
});
|
|
|
|
|
GetChannelsByDrawerNo();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
|
|
|
|
SnackbarMessageQueue.Enqueue("所选库位中无可解绑库位【库位还存在药品】");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DelegateCommand BtnCloseCommand
|
|
|
|
|
{
|
|
|
|
|
get => new DelegateCommand(() =>
|
|
|
|
|
{
|
|
|
|
|
//DialogParameters parameters = new DialogParameters();
|
|
|
|
|
//parameters.Add("",);
|
|
|
|
|
// 关闭当前窗口
|
|
|
|
|
RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool KeepAlive => false;
|
|
|
|
|
string message = string.Empty;
|
|
|
|
|
private void DoMyPrismEvent(DeviceMsg msg)
|
|
|
|
|
{
|
|
|
|
|
if (msg.WindowName == "BindingChannelDialog")
|
|
|
|
|
{
|
|
|
|
|
switch (msg.EventType)
|
|
|
|
|
{
|
|
|
|
|
case EventType.OPENERROR:
|
|
|
|
|
AlertMsg alertMsg = new AlertMsg
|
|
|
|
|
{
|
|
|
|
|
Message = msg.Message,
|
|
|
|
|
Type = MsgType.ERROR,
|
|
|
|
|
};
|
|
|
|
|
if (message != msg.Message)
|
|
|
|
|
{
|
|
|
|
|
message = msg.Message;
|
|
|
|
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateComboBoxItems(string text)
|
|
|
|
|
{
|
|
|
|
|
string str = @"SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_name,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit,
|
2025-03-25 16:21:39 +08:00
|
|
|
|
d.manufactory,d.max_stock,CONCAT(drug_name,' ',drug_spec)as DrugName FROM `drug_info` d";
|
2024-12-19 19:55:35 +08:00
|
|
|
|
if (string.IsNullOrEmpty(text))
|
2024-12-03 13:22:42 +08:00
|
|
|
|
{
|
|
|
|
|
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-12-19 19:55:35 +08:00
|
|
|
|
if (DrugInfos != null)
|
2024-12-03 13:22:42 +08:00
|
|
|
|
{
|
|
|
|
|
DrugInfos.Clear();
|
|
|
|
|
}
|
|
|
|
|
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).Where(di => di.DrugName.Contains(text) || di.PyCode.Contains(text)).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|