修改单支板通电与上电按抽屉来控制

This commit is contained in:
maqiao 2025-10-24 17:00:41 +08:00
parent 7caa1403d3
commit ecfe08ebeb
14 changed files with 155 additions and 103 deletions

View File

@ -77,6 +77,7 @@
@inject Radzen.DialogService dialogService;
@inject IChannelListDao channelListDao;
@inject IOptions<DrawerConfig> setting;
@inject IOptions<PortConfig> portSetting;
@inject NotificationService _message
@inject PortUtil PortUtil;
private readonly ILog logger = LogManager.GetLogger(typeof(OrderDetailDialog));
@ -107,8 +108,6 @@
async Task OpenDrawer()
{
this.status = 1;
PortUtil.PowerOn();
await Task.Delay(200);
// 解析需要打开的抽屉列表
List<BoxTakeVo> drawerNos = this.data.GroupBy(it => it.ChannelStock.DrawerNo).Select(it => it.First()).ToList();
// for (int i = 0; i < data.Count; i++)
@ -151,6 +150,8 @@
{
if (orderTakeVo.Status == 0)
{
PortUtil.PowerOn(drawerNo);
await Task.Delay(portSetting.Value.delayTime);
// 判断是否为单支抽屉
if (setting.Value.single.Contains(drawerNo))
{
@ -198,7 +199,7 @@
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
);
logger.Info($"抽屉打开失败");
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
RestData();
stop();
}
@ -276,7 +277,7 @@
}
//有单支抽屉则广播灭灯
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
// if (!string.IsNullOrEmpty(alertMessage))
// {
// //弹出确认对话框

View File

@ -60,6 +60,7 @@
@inject Radzen.DialogService dialogService;
@inject IChannelListDao channelListDao;
@inject IOptions<DrawerConfig> setting;
@inject IOptions<PortConfig> portSetting;
@inject NotificationService _message
@inject PortUtil PortUtil;
private readonly ILog logger = LogManager.GetLogger(typeof(OrderDetailDialog));
@ -90,8 +91,8 @@
async Task OpenDrawer()
{
this.status = 1;
PortUtil.PowerOn();
await Task.Delay(200);
// PortUtil.PowerOn();
// await Task.Delay(200);
// 解析需要打开的抽屉列表
List<BoxTakeVo> drawerNos = this.data.GroupBy(it => it.ChannelStock.DrawerNo).Select(it => it.First()).ToList();
@ -113,6 +114,8 @@
{
if (orderTakeVo.Status == 0)
{
PortUtil.PowerOn(drawerNo);
await Task.Delay(portSetting.Value.delayTime);
// 判断是否为单支抽屉
if (setting.Value.single.Contains(drawerNo))
{
@ -160,7 +163,7 @@
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
);
logger.Info($"抽屉打开失败");
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
RestData();
stop();
}
@ -230,7 +233,7 @@
}
//有单支抽屉则广播灭灯
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
// if (!string.IsNullOrEmpty(alertMessage))
// {
// //弹出确认对话框
@ -276,7 +279,7 @@
);
if (setting.Value.single.Contains(drawerNo))
{
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
}
stop();
}

View File

@ -92,6 +92,7 @@
@inject IChannelListDao channelListDao;
@inject IOptions<SettingConfig> setting
@inject IOptions<DrawerConfig> drawerSetting;
@inject IOptions<PortConfig> portSetting;
@inject NotificationService _message
@inject PortUtil PortUtil;
private readonly ILog logger = LogManager.GetLogger(typeof(OrderDetailDialog));
@ -268,7 +269,6 @@
async Task OpenDrawer()
{
this.status = 1;
PortUtil.PowerOn();
var selectSpl = SelectedDrawerNo.Split('-');
if (selectSpl != null && selectSpl.Count() > 0)
@ -276,7 +276,8 @@
drawerNo = Convert.ToInt32(selectSpl[0]);
colNo = Convert.ToInt32(selectSpl[1]);
}
await Task.Delay(200);
PortUtil.PowerOn(drawerNo);
await Task.Delay(portSetting.Value.delayTime);
PortUtil.DrawerNo = drawerNo;
// 根据抽屉类型来决定打开前是否需要查询数量
var promiseUtil = new PromiseUtil<object>();
@ -357,7 +358,7 @@
);
if (drawerSetting.Value.single != null && drawerSetting.Value.single.Contains(this.drawerNo))
{
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
}
RestData();
stop();

View File

@ -44,7 +44,7 @@
</RadzenListBox> *@
<RadzenListBox AllowClear="true" @bind-Value=@listBoxSelectedcsList Style="width:100%;overflow:auto" AllowFiltering="false" TValue="ChannelStock"
Data=@csList>
Data=@csList>
<Template>
<RadzenStack Orientation="Orientation.Horizontal">
<RadzenText Style="width:20vw;text-align:left">@((context as ChannelStock).Drug.ToString())</RadzenText>
@ -107,6 +107,7 @@
@code {
@inject Radzen.DialogService dialogService;
@inject IOptions<DrawerConfig> setting;
@inject IOptions<PortConfig> portSetting;
@inject PortUtil PortUtil;
@inject NotificationService _message;
@inject IOrderInfoDao orderInfoDao;
@ -135,18 +136,18 @@
if (csList[i].EmptyStock != null && csList[i].EmptyStock.ReturnQuantity > 0)
{
data.Add(new OrderTakeVo()
{
ChannelStock = csList[i].EmptyStock
});
{
ChannelStock = csList[i].EmptyStock
});
}
if (csList[i].DrawerChanneStockList != null && csList[i].DrawerChanneStockList.Count > 0)
{
for (int j = 0; j < csList[i].DrawerChanneStockList.Count; j++)
{
data.Add(new OrderTakeVo()
{
ChannelStock = csList[i].DrawerChanneStockList[j]
});
{
ChannelStock = csList[i].DrawerChanneStockList[j]
});
}
}
}
@ -160,8 +161,6 @@
async Task OpenDrawer()
{
this.status = 1;
PortUtil.PowerOn();
await Task.Delay(200);
// 解析需要打开的抽屉列表
List<OrderTakeVo> drawerNos = this.data.GroupBy(it => it.ChannelStock.DrawerNo).Select(it => it.First()).ToList();
@ -184,6 +183,8 @@
{
if (orderTakeVo.Status == 0)
{
PortUtil.PowerOn(drawerNo);
await Task.Delay(portSetting.Value.delayTime);
// 判断是否为单支抽屉
if (setting.Value.single.Contains(drawerNo))
{
@ -197,7 +198,7 @@
if (b)
{
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
if (drawerType==1)
if (drawerType == 1)
{
PortUtil.SpeakAsync($"{drawerNo}号抽屉已经打开,请,环药");
}
@ -214,7 +215,7 @@
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
);
logger.Info($"抽屉打开失败");
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
RestData();
stop();
}
@ -237,7 +238,7 @@
}
});
orderTakeVo.Status = 2;
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
if (options._data == drawerNos.Count - 1)
{
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
@ -305,7 +306,7 @@
);
if (setting.Value.single.Contains(drawerNo))
{
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
}
stop();
}

View File

@ -170,6 +170,7 @@
@inject PortUtil PortUtil;
@inject NotificationService _message
@inject IOptions<DrawerConfig> setting;
@inject IOptions<PortConfig> portSetting;
int status = 0;
int drawerNo = 1;
RadzenDataGrid<ChannelStock> grid;
@ -204,8 +205,8 @@
async Task OpenDrawer()
{
this.status = 1;
PortUtil.PowerOn();
await Task.Delay(200);
PortUtil.PowerOn(this.drawerNo);
await Task.Delay(portSetting.Value.delayTime);
PortUtil.DrawerNo = this.drawerNo;
// 根据抽屉类型来决定打开前是否需要查询数量
var promiseUtil = new PromiseUtil<object>();
@ -346,18 +347,18 @@
);
if (setting.Value.single != null && setting.Value.single.Contains(this.drawerNo))
{
PortUtil.PowerOff();
PortUtil.PowerOff(this.drawerNo);
}
RestData();
stop();
}
});
PortUtil.PowerOff();
PortUtil.PowerOff(this.drawerNo);
}
void RestData()
{
PortUtil.PowerOff();
PortUtil.PowerOff(this.drawerNo);
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
this.status = 0;
this.BeforeQuantity = new int[9];

View File

@ -150,6 +150,7 @@
@inject PortUtil PortUtil;
@inject NotificationService _message
@inject IOptions<DrawerConfig> setting;
@inject IOptions<PortConfig> portSetting;
@inject IOrderInfoDao orderInfoDao;
int status = 0;
@ -229,8 +230,8 @@
async Task OpenDrawer()
{
this.status = 1;
PortUtil.PowerOn();
await Task.Delay(200);
PortUtil.PowerOn(this.drawerNo);
await Task.Delay(portSetting.Value.delayTime);
PortUtil.DrawerNo = this.drawerNo;
// 根据抽屉类型来决定打开前是否需要查询数量
var promiseUtil = new PromiseUtil<object>();
@ -383,13 +384,13 @@
);
if (setting.Value.single.Contains(this.drawerNo))
{
PortUtil.PowerOff();
PortUtil.PowerOff(this.drawerNo);
}
RestData();
stop();
}
});
PortUtil.PowerOff();
PortUtil.PowerOff(this.drawerNo);
}
//关闭抽屉后获取称重稳定数量
public async Task GetWeightQuantity()
@ -487,7 +488,7 @@
}
void RestData()
{
PortUtil.PowerOff();
PortUtil.PowerOff(this.drawerNo);
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
this.status = 0;
this.BeforeQuantity = new int[9];

View File

@ -17,12 +17,12 @@
<RadzenStack>
<RadzenDataGrid @ref="grid" Data="@data" ExpandMode="DataGridExpandMode.Multiple"
RowRender="@RowRender"
EmptyText="无数据" AllowAlternatingRows="false">
RowRender="@RowRender"
EmptyText="无数据" AllowAlternatingRows="false">
<Template Context="di">
<RadzenDataGrid Data="@di.ChannelStocks" EmptyText="无数据" @ref="di.Grid"
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args, di.Grid))">
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args, di.Grid))">
<Columns>
<RadzenDataGridColumn Title="库位" Property="DrawerNo" Width="6vw">
<Template Context="s">
@ -38,51 +38,51 @@
@if (ManuNo.Quantity > 0)
{
<RadzenText TextStyle="TextStyle.Caption">
<RadzenText TextStyle="TextStyle.Caption">
@ManuNo.ManuNo
</RadzenText>
</RadzenText>
}
</Template>
<EditTemplate Context="channel">
@if (channel.Quantity == 0 && !String.IsNullOrEmpty(channel.DrugId))
{
<RadzenDropDown TValue="DrugManuNo" Name="ManuNo" @bind-Value="channel.drugManuNo" Data="@channel.Drug?.Manus" Style="width:100%; display: block;">
<Template>
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@((context as DrugManuNo)?.ManuNo)</RadzenText>
<RadzenDropDown TValue="DrugManuNo" Name="ManuNo" @bind-Value="channel.drugManuNo" Data="@channel.Drug?.Manus" Style="width:100%; display: block;">
<Template>
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@((context as DrugManuNo)?.ManuNo)</RadzenText>
@if ((context as DrugManuNo).EffDate != null && (context as DrugManuNo).EffDate.ToString().Length > 10)
{
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo).EffDate.ToString().Substring(0, 10))</RadzenText>
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo).EffDate.ToString().Substring(0, 10))</RadzenText>
}
else
{
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo)?.EffDate)</RadzenText>
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo)?.EffDate)</RadzenText>
}
</Template>
<ValueTemplate>
<RadzenStack Orientation="Orientation.Horizontal">
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@((context as DrugManuNo)?.ManuNo)</RadzenText>
</Template>
<ValueTemplate>
<RadzenStack Orientation="Orientation.Horizontal">
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@((context as DrugManuNo)?.ManuNo)</RadzenText>
@if ((context as DrugManuNo).EffDate != null && (context as DrugManuNo).EffDate.ToString().Length > 10)
{
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo).EffDate.ToString().Substring(0, 10))</RadzenText>
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo).EffDate.ToString().Substring(0, 10))</RadzenText>
}
else
{
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo)?.EffDate)</RadzenText>
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo)?.EffDate)</RadzenText>
}
</RadzenStack>
</ValueTemplate>
</RadzenDropDown>
<RadzenRequiredValidator Text="请选择批次" Component="ManuNo" Popup="true" />
</RadzenStack>
</ValueTemplate>
</RadzenDropDown>
<RadzenRequiredValidator Text="请选择批次" Component="ManuNo" Popup="true" />
}
else
{
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@channel.drugManuNo?.ManuNo</RadzenText>
<RadzenText TextStyle="TextStyle.Caption">@channel.drugManuNo?.EffDate</RadzenText>
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@channel.drugManuNo?.ManuNo</RadzenText>
<RadzenText TextStyle="TextStyle.Caption">@channel.drugManuNo?.EffDate</RadzenText>
}
</EditTemplate>
</RadzenDataGridColumn>
@ -116,15 +116,15 @@
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" Gap="0.5rem">
@if (status < 2)
{
<RadzenButton Click="@StartAdd" Disabled="!CanTakeDrug" IsBusy="@(status>0)" BusyText="加药中。。。" ButtonStyle="ButtonStyle.Warning" Variant="Variant.Flat" Text="加药" Style="width: 120px" />
<RadzenButton Click="@StartAdd" Disabled="!CanTakeDrug" IsBusy="@(status > 0)" BusyText="加药中。。。" ButtonStyle="ButtonStyle.Warning" Variant="Variant.Flat" Text="加药" Style="width: 120px" />
}
@if (status == 2)
{
<RadzenButton Click="@AddFinish" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Text="完成" Style="width: 120px" />
<RadzenButton Click="@AddFinish" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Text="完成" Style="width: 120px" />
}
@if (status < 2)
{
<RadzenButton Click="@((args) => CancelOpera())" Variant="Variant.Flat" Text="取消" Style="width: 120px" />
<RadzenButton Click="@((args) => CancelOpera())" Variant="Variant.Flat" Text="取消" Style="width: 120px" />
}
</RadzenStack>
</RadzenStack>
@ -133,6 +133,7 @@
@inject Radzen.DialogService dialogService;
@inject IInOutInvoiceDao inOutInvoiceDao;
@inject IOptions<DrawerConfig> setting;
@inject IOptions<PortConfig> portSetting;
@inject NotificationService _message
@inject PortUtil PortUtil;
@ -181,8 +182,6 @@
async Task OpenDrawer()
{
this.status = 1;
PortUtil.PowerOn();
await Task.Delay(200);
// 解析需要打开的抽屉列表
List<ChannelStock> channels = new();
for (int i = 0; i < data.Count; i++)
@ -210,6 +209,8 @@
{
if (options._data == 0)
{
PortUtil.PowerOn(drawerNo);
await Task.Delay(portSetting.Value.delayTime);
BeforeQuantity = new int[9];
AfterQuantity = new int[9];
for (int j = 0; j < data[index].ChannelStocks.Count; j++)
@ -257,7 +258,7 @@
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
);
logger.Info($"抽屉打开失败");
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
RestData();
stop();
}
@ -273,7 +274,7 @@
options._data = 0;
if (setting.Value.single.Contains(drawerNo))
{
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
}
if (index == drawerNos.Count - 1)
{
@ -332,7 +333,7 @@
new Dictionary<string, object>
() { { "confirmInfo", alertMessage } },
new DialogOptions()
{ Width = "45vw", Resizable = true, Draggable = true, ShowClose = false });
{ Width = "45vw", Resizable = true, Draggable = true, ShowClose = false });
if (!confirm)
{
@ -397,7 +398,7 @@
);
if (setting.Value.single.Contains(drawerNo))
{
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
}
}
});

View File

@ -72,6 +72,7 @@
@inject IOrderInfoDao orderInfoDao;
@inject IChannelListDao channelListDao;
@inject IOptions<DrawerConfig> setting;
@inject IOptions<PortConfig> portSetting;
@inject NotificationService _message
@inject PortUtil PortUtil;
private readonly ILog logger = LogManager.GetLogger(typeof(OrderDetailDialog));
@ -102,8 +103,6 @@
async Task OpenDrawer()
{
this.status = 1;
PortUtil.PowerOn();
await Task.Delay(200);
// 解析需要打开的抽屉列表
List<OrderTakeVo> drawerNos = this.data.GroupBy(it => it.ChannelStock.DrawerNo).Select(it => it.First()).ToList();
@ -125,6 +124,8 @@
{
if (orderTakeVo.Status == 0)
{
PortUtil.PowerOn(drawerNo);
await Task.Delay(portSetting.Value.delayTime);
// 判断是否为单支抽屉
if (setting.Value.single.Contains(drawerNo))
{
@ -172,7 +173,7 @@
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
);
logger.Info($"抽屉打开失败");
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
RestData();
stop();
}
@ -195,7 +196,7 @@
}
});
orderTakeVo.Status = 2;
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
if (options._data == drawerNos.Count - 1)
{
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
@ -247,7 +248,7 @@
if (!confirm)
{
RestData();
logger.Info("取消保存");
logger.Info("取消保存");
// 关闭弹窗
dialogService.Close(false);
}
@ -279,7 +280,7 @@
);
if (setting.Value.single.Contains(drawerNo))
{
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
}
stop();
}

View File

@ -11,12 +11,12 @@
<RadzenStack>
<RadzenDataGrid @ref="grid" Data="@data" ExpandMode="DataGridExpandMode.Multiple"
RowRender="@RowRender"
EmptyText="无数据" AllowAlternatingRows="false">
RowRender="@RowRender"
EmptyText="无数据" AllowAlternatingRows="false">
<Template Context="di">
<RadzenDataGrid Data="@di.ChannelStocks" EmptyText="无数据" @ref="di.Grid"
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args, di.Grid))">
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args, di.Grid))">
<Columns>
<RadzenDataGridColumn Title="库位" Property="DrawerNo">
<Template Context="s">
@ -83,6 +83,7 @@
@inject Radzen.DialogService dialogService;
@inject IMachineRecordDao machineRecordDao;
@inject IOptions<DrawerConfig> setting;
@inject IOptions<PortConfig> portSetting;
@inject NotificationService _message
@inject PortUtil PortUtil;
@ -123,8 +124,6 @@
async Task OpenDrawer()
{
this.status = 1;
PortUtil.PowerOn();
await Task.Delay(200);
// 解析需要打开的抽屉列表
List<ChannelStock> channels = new();
for (int i = 0; i < data.Count; i++)
@ -159,6 +158,8 @@
{
if (options._data == 0)
{
PortUtil.PowerOn(drawerNo);
await Task.Delay(portSetting.Value.delayTime);
BeforeQuantity = new int[9];
AfterQuantity = new int[9];
// 判断是否为单支抽屉
@ -184,7 +185,7 @@
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
);
logger.Info($"抽屉打开失败");
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
RestData();
stop();
}
@ -200,7 +201,7 @@
options._data = 0;
if (setting.Value.single.Contains(drawerNo))
{
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
}
if (index == drawerNos.Count - 1)
{
@ -251,7 +252,7 @@
);
if (setting.Value.single.Contains(drawerNo))
{
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
}
stop();
}

View File

@ -22,25 +22,25 @@
</RadzenStack>
</RadzenStack>
</RadzenFieldset>
<div Style="height:50vh;overflow:auto;">
<div Style="height:50vh;overflow:auto;">
<RadzenDataGrid @ref="grid"
LoadData="@LoadData"
IsLoading="@isLoading"
Count="@count"
EmptyText="无数据"
Data="@_returnEmptys"
AllowColumnResize="true" AllowAlternatingRows="false"
AllowRowSelectOnRowClick="true"
CellClick="@((DataGridCellMouseEventArgs<MachineRecord> args) => OnCellClick(args))"
AllowPaging="false" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
LoadData="@LoadData"
IsLoading="@isLoading"
Count="@count"
EmptyText="无数据"
Data="@_returnEmptys"
AllowColumnResize="true" AllowAlternatingRows="false"
AllowRowSelectOnRowClick="true"
CellClick="@((DataGridCellMouseEventArgs<MachineRecord> args) => OnCellClick(args))"
AllowPaging="false" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
<Columns>
<RadzenDataGridColumn Width="60px" Sortable="false" Filterable="false">
<HeaderTemplate>
选择
</HeaderTemplate>
<Template Context="LoadData">
<RadzenCheckBox TriState="false" Value="@LoadData.IsSelected" InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "Select item" }})"
TValue="bool" />
<RadzenCheckBox TriState="false" Value="@LoadData.IsSelected" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "Select item" } })"
TValue="bool" />
</Template>
</RadzenDataGridColumn>
<RadzenDataGridColumn Frozen="true" Title="操作人" Property="OperatorUser.NickName"></RadzenDataGridColumn>
@ -82,6 +82,7 @@
@inject Radzen.DialogService dialogService;
@inject IMachineRecordDao machineRecordDao;
@inject IOptions<DrawerConfig> setting;
@inject IOptions<PortConfig> portSetting;
@inject NotificationService _message
@inject PortUtil PortUtil;
@ -169,8 +170,6 @@
async Task OpenDrawer()
{
this.status = 1;
PortUtil.PowerOn();
await Task.Delay(200);
// 解析需要打开的抽屉列表
int drawerNo = records.DrawerNo;
@ -192,6 +191,8 @@
{
if (options._data == 0)
{
PortUtil.PowerOn(drawerNo);
await Task.Delay(portSetting.Value.delayTime);
BeforeQuantity = new int[9];
AfterQuantity = new int[9];
// 判断是否为单支抽屉
@ -217,7 +218,7 @@
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
);
logger.Info($"抽屉打开失败");
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
RestData();
stop();
}
@ -233,7 +234,7 @@
options._data = 0;
if (setting.Value.single.Contains(drawerNo))
{
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
}
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
PortUtil.SpeakAsync($"加药完成,请,点击完成按钮进行确认");
@ -273,7 +274,7 @@
);
if (setting.Value.single.Contains(drawerNo))
{
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
}
stop();
}

View File

@ -123,6 +123,7 @@
@inject PortUtil PortUtil;
@inject NotificationService _message
@inject IOptions<DrawerConfig> setting;
@inject IOptions<PortConfig> portSetting;
int status = 0;
int drawerNo = 1;
RadzenDataGrid<ChannelStock> grid;
@ -157,8 +158,6 @@
async Task OpenDrawer()
{
this.status = 1;
PortUtil.PowerOn();
await Task.Delay(200);
// 根据抽屉类型来决定打开前是否需要查询数量
var promiseUtil = new PromiseUtil<object>();
await promiseUtil.taskAsyncLoop(500, null, async (data, next, stop) =>
@ -172,6 +171,8 @@
// 开启抽屉
else if (this.status == 1)
{
PortUtil.PowerOn(drawerNo);
await Task.Delay(portSetting.Value.delayTime);
// 判断是否为单支抽屉
if (setting.Value.single.Contains(this.drawerNo))
{
@ -238,7 +239,7 @@
);
if (setting.Value.single.Contains(this.drawerNo))
{
PortUtil.PowerOff();
PortUtil.PowerOff(drawerNo);
}
RestData();
stop();

View File

@ -30,5 +30,7 @@ namespace MasaBlazorApp3.Pojo.Config
public string fridgePortPath { get; set; }
//储物箱串口
public int StorageCan { get; set; }
//延时间隔
public int delayTime { get; set; }
}
}

View File

@ -42,7 +42,7 @@ namespace MasaBlazorApp3.Port
public bool Operate { get; set; }
public DateTime dateTime { get; set; } = DateTime.Now;
// //鼠标点击时间
// //鼠标点击时间
public DateTime mouseClickTime { get; set; }
// 当前操作的抽屉号
@ -452,7 +452,7 @@ namespace MasaBlazorApp3.Port
var channel = Convert.ToInt32((channelDrawerNo * 10 + ColNos[i]).ToString(), 16);
byte[] buffer = new byte[] { 0xaa, (byte)channel, 0x0a, 0x00, 0x00, 0x00, 0x00, 0xee };
serialPort.Write(buffer, 0, 8);
logger.Info($"{serialPort}串口{DrawerNo}号{channelDrawerNo}抽屉{string.Join(',',ColNos)}库位有药位置亮灯发送指令:{Convert.ToHexString(buffer)}");
logger.Info($"{serialPort}串口{DrawerNo}号{channelDrawerNo}抽屉{string.Join(',', ColNos)}库位有药位置亮灯发送指令:{Convert.ToHexString(buffer)}");
await Task.Delay(TimeSpan.FromMilliseconds(20));
}
@ -490,6 +490,42 @@ namespace MasaBlazorApp3.Port
canBusSerialTwo.Write(buffer, 0, 8);
}
//单支板通电
public void PowerOn(int DrawerNo)
{
DrawerNo = (DrawerNo > 8 ? DrawerNo - 8 : DrawerNo)*10;
if (_portConfig.StorageCan == 2)
{
canBusSerial.DiscardInBuffer();
byte[] buffer = new byte[] { 0xaa, (byte)DrawerNo, 0x05, 0x01, 0x00, 0x00, 0x00, 0xee };
canBusSerial.Write(buffer, 0, 8);
}
else
{
canBusSerialTwo.DiscardInBuffer();
byte[] buffer = new byte[] { 0xaa, (byte)DrawerNo, 0x05, 0x01, 0x00, 0x00, 0x00, 0xee };
canBusSerialTwo.Write(buffer, 0, 8);
}
}
//单支板断电
public void PowerOff(int DrawerNo)
{
DrawerNo = (DrawerNo > 8 ? DrawerNo - 8 : DrawerNo)*10;
if (_portConfig.StorageCan == 2)
{
canBusSerial.DiscardInBuffer();
byte[] buffer = new byte[] { 0xaa, (byte)DrawerNo, 0x05, 0x00, 0x00, 0x00, 0x00, 0xee };
canBusSerial.Write(buffer, 0, 8);
}
else
{
canBusSerialTwo.DiscardInBuffer();
byte[] buffer = new byte[] { 0xaa, (byte)DrawerNo, 0x05, 0x00, 0x00, 0x00, 0x00, 0xee };
canBusSerialTwo.Write(buffer, 0, 8);
}
}
//单支板通电
public void PowerOn()
{
if (_portConfig.StorageCan == 2)

View File

@ -37,7 +37,8 @@
"doorAddr": 0,
"storageBoxAddr": 0,
"fridgePortExist": false,
"fridgePortPath": "COM3"
"fridgePortPath": "COM3",
"delayTime": 200
},
"drawer": {
"single": [ 1,2 ],