修改单支板通电与上电按抽屉来控制
This commit is contained in:
parent
7caa1403d3
commit
ecfe08ebeb
|
|
@ -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))
|
||||
// {
|
||||
// //弹出确认对话框
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@
|
|||
<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)
|
||||
{
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
@ -397,7 +398,7 @@
|
|||
);
|
||||
if (setting.Value.single.Contains(drawerNo))
|
||||
{
|
||||
PortUtil.PowerOff();
|
||||
PortUtil.PowerOff(drawerNo);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
@ -279,7 +280,7 @@
|
|||
);
|
||||
if (setting.Value.single.Contains(drawerNo))
|
||||
{
|
||||
PortUtil.PowerOff();
|
||||
PortUtil.PowerOff(drawerNo);
|
||||
}
|
||||
stop();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
选择
|
||||
</HeaderTemplate>
|
||||
<Template Context="LoadData">
|
||||
<RadzenCheckBox TriState="false" Value="@LoadData.IsSelected" InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "Select item" }})"
|
||||
<RadzenCheckBox TriState="false" Value="@LoadData.IsSelected" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "Select item" } })"
|
||||
TValue="bool" />
|
||||
</Template>
|
||||
</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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -30,5 +30,7 @@ namespace MasaBlazorApp3.Pojo.Config
|
|||
public string fridgePortPath { get; set; }
|
||||
//储物箱串口
|
||||
public int StorageCan { get; set; }
|
||||
//延时间隔
|
||||
public int delayTime { 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)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@
|
|||
"doorAddr": 0,
|
||||
"storageBoxAddr": 0,
|
||||
"fridgePortExist": false,
|
||||
"fridgePortPath": "COM3"
|
||||
"fridgePortPath": "COM3",
|
||||
"delayTime": 200
|
||||
},
|
||||
"drawer": {
|
||||
"single": [ 1,2 ],
|
||||
|
|
|
|||
Loading…
Reference in New Issue