查药盒状态返回改为bool
This commit is contained in:
parent
3554a2e824
commit
2132e14676
|
|
@ -234,7 +234,7 @@
|
||||||
{
|
{
|
||||||
int beforeQuantity = await PortUtil.CheckQuantityForSingleForErZhong(i + 1);
|
int beforeQuantity = await PortUtil.CheckQuantityForSingleForErZhong(i + 1);
|
||||||
BeforeQuantity[i] = beforeQuantity;
|
BeforeQuantity[i] = beforeQuantity;
|
||||||
logger.Info($"BeforeQuantity:{(i+1)}-{beforeQuantity}数量{string.Join(",", BeforeQuantity)}");
|
logger.Info($"BeforeQuantity:{(i + 1)}-{beforeQuantity}数量{string.Join(",", BeforeQuantity)}");
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -298,7 +298,15 @@
|
||||||
//药盒抽屉,开药盒
|
//药盒抽屉,开药盒
|
||||||
if (currentCol > 0)
|
if (currentCol > 0)
|
||||||
{
|
{
|
||||||
await PortUtil.OpenBoxByColNoForErZhong(currentCol);
|
bool boxStatus =await PortUtil.BoxLockStateForErZhong(drawerNo, currentCol);
|
||||||
|
if (boxStatus)
|
||||||
|
{
|
||||||
|
logger.Info("药盒已打开,无需再开药盒");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await PortUtil.OpenBoxByColNoForErZhong(currentCol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
currentCol = 0;
|
currentCol = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -515,6 +523,8 @@
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
PortUtil.SpeakAsync("请先点取药按钮打开抽屉");
|
PortUtil.SpeakAsync("请先点取药按钮打开抽屉");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
currentCol = args.Data.ColNo;
|
currentCol = args.Data.ColNo;
|
||||||
grid.EditRow(args.Data);
|
grid.EditRow(args.Data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -554,7 +554,15 @@
|
||||||
//药盒抽屉,开药盒
|
//药盒抽屉,开药盒
|
||||||
if (currentCol > 0)
|
if (currentCol > 0)
|
||||||
{
|
{
|
||||||
await PortUtil.OpenBoxByColNoForErZhong(currentCol);
|
bool boxStatus = await PortUtil.BoxLockStateForErZhong(drawerNo, currentCol);
|
||||||
|
if (boxStatus)
|
||||||
|
{
|
||||||
|
logger.Info("药盒已打开,无需再开药盒");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await PortUtil.OpenBoxByColNoForErZhong(currentCol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
currentCol = 0;
|
currentCol = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -786,7 +794,7 @@
|
||||||
grid.Reload();
|
grid.Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnCellClick(DataGridCellMouseEventArgs<ChannelStock> args)
|
async Task OnCellClick(DataGridCellMouseEventArgs<ChannelStock> args)
|
||||||
{
|
{
|
||||||
// if (args.Data.BoardType.ToString().Contains("3"))
|
// if (args.Data.BoardType.ToString().Contains("3"))
|
||||||
// {
|
// {
|
||||||
|
|
@ -805,7 +813,22 @@
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
PortUtil.SpeakAsync("请先点取药按钮打开抽屉");
|
PortUtil.SpeakAsync("请先点取药按钮打开抽屉");
|
||||||
}
|
}
|
||||||
currentCol = args.Data.ColNo;
|
if (setting.Value.box.Contains(args.Data.DrawerNo))
|
||||||
|
{
|
||||||
|
bool boxStatus=await PortUtil.BoxLockStateForErZhong(args.Data.DrawerNo, args.Data.ColNo);
|
||||||
|
if(boxStatus)
|
||||||
|
{
|
||||||
|
logger.Info("药盒已打开,无需再开药盒");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentCol = args.Data.ColNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentCol = args.Data.ColNo;
|
||||||
|
}
|
||||||
grid.EditRow(args.Data);
|
grid.EditRow(args.Data);
|
||||||
}
|
}
|
||||||
private IDisposable? registration;
|
private IDisposable? registration;
|
||||||
|
|
|
||||||
|
|
@ -1696,14 +1696,24 @@ namespace MasaBlazorApp3.Port
|
||||||
|
|
||||||
#region 药盒操作
|
#region 药盒操作
|
||||||
// 指定药盒状态查询
|
// 指定药盒状态查询
|
||||||
public async Task<byte[]> BoxLockStateForErZhong(int DrawerNo, int ColNo)
|
public async Task<bool> BoxLockStateForErZhong(int DrawerNo, int ColNo)
|
||||||
{
|
{
|
||||||
canBusSerial.DiscardInBuffer();
|
canBusSerial.DiscardInBuffer();
|
||||||
var channel = Convert.ToInt32(((DrawerNo == 1 ? 22 : 25) + Math.Ceiling((decimal)ColNo / (decimal)3)).ToString(), 16);
|
var channel = Convert.ToInt32(((DrawerNo == 1 ? 22 : 25) + Math.Ceiling((decimal)ColNo / (decimal)3)).ToString(), 16);
|
||||||
byte[] buffer = new byte[] { 0xaa, (byte)channel, 0x02, 0x00, 0x00, 0x00, 0x00, 0xee };
|
byte[] buffer = new byte[] { 0xaa, (byte)channel, 0x02, 0x00, 0x00, 0x00, 0x00, 0xee };
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
|
|
||||||
return await GetBufferByPort(canBusSerial, 8);
|
byte[] retBuffer = await GetBufferByPort(canBusSerial, 8);
|
||||||
|
logger.Info($"查询药盒状态返回{ColNo}【{Convert.ToHexString(retBuffer)}】");
|
||||||
|
int[] r = retBuffer.Select(it => Convert.ToInt32(it)).ToArray();
|
||||||
|
if (r[4] > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,14 @@
|
||||||
//"drawerProtocol": 485,
|
//"drawerProtocol": 485,
|
||||||
"scanCodePortPath": "COM1",
|
"scanCodePortPath": "COM1",
|
||||||
"canBusExsit": true,
|
"canBusExsit": true,
|
||||||
"canBusPortPath": "COM2",
|
"canBusPortPath": "COM9",
|
||||||
"totalDrawerCount": 16,
|
"totalDrawerCount": 16,
|
||||||
"canBusTwoExsit": true,
|
"canBusTwoExsit": true,
|
||||||
"StorageCan": 1,
|
"StorageCan": 1,
|
||||||
//第二个can总线端口
|
//第二个can总线端口
|
||||||
//"canBusPortPathTwo": "COM9",
|
//"canBusPortPathTwo": "COM9",
|
||||||
//"doorAddr": 0,
|
//"doorAddr": 0,
|
||||||
//"storageBoxAddr": 0,
|
"storageBoxAddr": 0,
|
||||||
//"fridgePortExist": false,
|
//"fridgePortExist": false,
|
||||||
//"fridgePortPath": "COM3"
|
//"fridgePortPath": "COM3"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue