修改处方取药循环开抽屉逻辑

This commit is contained in:
maqiao 2024-09-02 12:54:15 +08:00
parent 776a1ddce2
commit eb8aa8db83
1 changed files with 147 additions and 97 deletions

View File

@ -329,7 +329,6 @@ namespace DM_Weight.ViewModels
Message = "储物箱使能失败"
});
logger.Info($"储物箱使能失败");
_portUtil.ResetData();
stop();
}
@ -367,15 +366,6 @@ namespace DM_Weight.ViewModels
// 锁是打开状态现在关闭了,说明操作完成了,告诉前台锁已关闭
_portUtil.statue = 2;
string _WindowName = "OrderTakeDialog";
// 重新初始化数据
//ResetData();
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
{
EventType = util.EventType.DRAWERCLOSE,
WindowName = _WindowName,
});
logger.Info($"储物箱关闭");
if (options._data == (enumerable.Count() - 1))
{
@ -394,8 +384,68 @@ namespace DM_Weight.ViewModels
}
}
}
// 外置抽屉
else
{
if (channelStocks[0].DrawerType == 3)
{
if (channelStocks[0].BoardType == 2)
{
if (channelStocks[0].DrawerState == 0)
{
byte[] buffer = await _portUtil.OpenRecover();
int[] r = buffer.Select(it => Convert.ToInt32(it)).ToArray();
if ((_portUtil.ColNos[0] > 3 && r[4] == 1) || (_portUtil.ColNos[0] < 4 && r[3] == 1))
{
logger.Info($"回收箱打开成功");
channelStocks[0].DrawerState = 1;
next();
}
else
{
logger.Info($"回收箱打开失败");
stop();
}
}
if(channelStocks[0].DrawerState == 1)
{
// 查询是否关闭状态
byte[] buffer = await _portUtil.CheckRecoverStatus();
int[] r = buffer.Select(it => Convert.ToInt32(it)).ToArray();
logger.Info($"GeRecoverStatus{string.Join(",", r)}");
// 回收箱关闭成功
if ((_portUtil.ColNos[0] > 3 && r[4] == 0) || (_portUtil.ColNos[0] < 4 && r[3] == 0))
{
logger.Info($"回收箱关闭");
// 查询数量
byte[] bytes = await _portUtil.CheckRecoverQuantity();
int[] r1 = bytes.Select(it => Convert.ToInt32(it)).ToArray();
// 返回消息库位关闭,放入空瓶数量
int[] quantitys = r1.Skip(3).Take(3).ToArray();
int index = _portUtil.ColNos[0] % 3 > 0 ? _portUtil.ColNos[0] % 3 - 1 : 2;
// 指定库位放入的药品数量
int InCount = quantitys[index];
logger.Info($"回收板数量变化【{string.Join(",", quantitys)}】");
enumerator.MoveNext();
next();
}
else
{
// 查询是否关闭状态
await Task.Delay(200);
next();
}
}
}
}
else
{
if (channelStocks[0].DrawerState == 0)
{
// 判断是否为单支抽屉
@ -499,8 +549,8 @@ namespace DM_Weight.ViewModels
}
}
}
}
}
}
}
catch (Exception e)