写标签添加线程休息200
This commit is contained in:
parent
4ebdcc4ac7
commit
dd4e0a6695
|
@ -19,8 +19,8 @@ namespace DM_Weight.Models
|
|||
///
|
||||
/// 默认值: NULL
|
||||
///</summary>
|
||||
//[SugarColumn(ColumnName = "order_id")]
|
||||
//public int? OrderId { get; set; }
|
||||
[SugarColumn(ColumnName = "order_id")]
|
||||
public int? OrderId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
|
|
|
@ -426,11 +426,11 @@ namespace DM_Weight.ViewModels
|
|||
Thread.Sleep(200);
|
||||
_portUtil.ShowContent(it.DrawerNo, it.ColNo);
|
||||
|
||||
Thread.Sleep(500);
|
||||
Thread.Sleep(200);
|
||||
|
||||
//写库存数量
|
||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
||||
|
||||
Thread.Sleep(200);
|
||||
});
|
||||
}
|
||||
RequestData();
|
||||
|
|
|
@ -577,6 +577,7 @@ namespace DM_Weight.ViewModels
|
|||
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteQuantity(item.DrawerNo, item.ColNo, item.totalCount);
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -459,7 +459,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
// 将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
|
||||
|
||||
Thread.Sleep(200);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -549,6 +549,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
// 将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
|
||||
Thread.Sleep(200);
|
||||
|
||||
});
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ using DM_Weight.Models;
|
|||
using DM_Weight.msg;
|
||||
using DM_Weight.Port;
|
||||
using DM_Weight.util;
|
||||
using System.Threading;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -257,6 +258,7 @@ namespace DM_Weight.ViewModels
|
|||
singleChannels.ForEach(it =>
|
||||
{
|
||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
|
||||
Thread.Sleep(200);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ using DM_Weight.msg;
|
|||
using DM_Weight.Port;
|
||||
using DM_Weight.util;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -332,6 +333,7 @@ namespace DM_Weight.ViewModels
|
|||
singleChannels.ForEach(it =>
|
||||
{
|
||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
||||
Thread.Sleep(200);
|
||||
});
|
||||
}
|
||||
RequestData();
|
||||
|
|
|
@ -415,7 +415,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
//将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) + singleChannels.Sum(it => it.AddQuantity));
|
||||
|
||||
Thread.Sleep(200);
|
||||
//singleChannels.ForEach(it =>
|
||||
//{
|
||||
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
||||
|
|
|
@ -413,7 +413,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
//将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) - singleChannels.Sum(it => it.AddQuantity));
|
||||
|
||||
Thread.Sleep(200);
|
||||
//singleChannels.ForEach(it =>
|
||||
//{
|
||||
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
||||
|
|
|
@ -9,6 +9,7 @@ using Prism.Mvvm;
|
|||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using SqlSugar;
|
||||
using SqlSugar.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
@ -382,44 +383,59 @@ namespace DM_Weight.ViewModels
|
|||
// State = 1,
|
||||
// Operator = HomeWindowViewModel.Operator?.Nickname,
|
||||
//});
|
||||
//已取药数量
|
||||
int hasTake = 0;
|
||||
for (int i = 0; i < record.Count; i++)
|
||||
{
|
||||
int ordinalNum = SqlSugarHelper.Db.Queryable<MachineRecord>()
|
||||
.Where(mr => mr.OperationTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
|
||||
.Max(mr => mr.OrdinalNum);
|
||||
int orderTakeQuantity = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
||||
//处方中该药品明细
|
||||
OrderDetail orderDetail = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
||||
.Where(od => od.OrderNo == OrderInfo[j].OrderNo && od.DrugId == record[i].DrugId && od.DetailStatus == 0)
|
||||
.GroupBy(od => new { od.DrugId, od.SetManuNo }).Sum(od => od.Quantity);
|
||||
if (hasTake > 0)
|
||||
.GroupBy(od => new { od.DrugId, od.OrderId, od.SetManuNo }).Select(od => new OrderDetail
|
||||
{
|
||||
orderTakeQuantity = orderTakeQuantity - hasTake;
|
||||
}
|
||||
OrderId = od.OrderId,
|
||||
DrugId = od.DrugId,
|
||||
Quantity = SqlFunc.AggregateSum(od.Quantity)
|
||||
}).First();
|
||||
if (orderDetail != null)
|
||||
{
|
||||
//已取药数量
|
||||
int hasTakeQuantity = SqlSugarHelper.Db.Queryable<MachineRecord>()
|
||||
.Where(mr => mr.InvoiceId == InvoiceId && mr.DrugId == record[i].DrugId && mr.GetId == orderDetail.OrderId)
|
||||
.Sum(mr => mr.Quantity);
|
||||
//处方中该药品取药数量
|
||||
int orderTakeQuantity = orderDetail.Quantity - hasTakeQuantity;
|
||||
|
||||
//当前药品库存
|
||||
int stockQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.MachineId == (record[i].MachineId)
|
||||
&& cs.DrugId == record[i].DrugId
|
||||
&& cs.ManuNo == record[i].ManuNo && cs.DrawerNo == record[i].DrawerNo
|
||||
&& cs.ColNo == record[i].ColNo).Select(cs => cs.Quantity).First();
|
||||
|
||||
|
||||
|
||||
//该处方没有这个药,跳出循环
|
||||
if (orderTakeQuantity <= 0 || record[i].Quantity <= 0)
|
||||
if (stockQuantity <= 0)
|
||||
continue;
|
||||
if (!(record[i].Quantity == orderTakeQuantity))
|
||||
if (!(stockQuantity == orderTakeQuantity))
|
||||
{
|
||||
if (record[i].Quantity > orderTakeQuantity)
|
||||
if (stockQuantity > orderTakeQuantity)
|
||||
{
|
||||
//record[i].TakeQuantity = record[i].TakeQuantity - orderTakeQuantity;
|
||||
record[i].TakeQuantity = orderTakeQuantity;
|
||||
hasTake += orderTakeQuantity;
|
||||
record[i].Quantity = record[i].Quantity - orderTakeQuantity;
|
||||
record[i].Quantity = stockQuantity - orderTakeQuantity;
|
||||
}
|
||||
else if (record[i].Quantity < orderTakeQuantity)
|
||||
else if (stockQuantity < orderTakeQuantity)
|
||||
{
|
||||
hasTake += record[i].Quantity;
|
||||
record[i].TakeQuantity = record[i].Quantity;
|
||||
record[i].TakeQuantity = stockQuantity;
|
||||
record[i].Quantity = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
record[i].TakeQuantity = orderTakeQuantity;
|
||||
record[i].Quantity = record[i].Quantity - record[i].TakeQuantity;
|
||||
hasTake += record[i].TakeQuantity;
|
||||
record[i].Quantity = stockQuantity - record[i].TakeQuantity;
|
||||
}
|
||||
ChannelStock it = record[i];
|
||||
// 更新数据 库存信息
|
||||
|
@ -456,15 +472,9 @@ namespace DM_Weight.ViewModels
|
|||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||
SupplierDept = ConfigurationManager.AppSettings["receiveDept"].ToString(),
|
||||
ReceiveDept = OrderInfo[j].DeptName
|
||||
ReceiveDept = OrderInfo[j].DeptName,
|
||||
GetId = orderDetail.OrderId
|
||||
}).ExecuteCommand();
|
||||
if (0 == record[i].Quantity)
|
||||
{
|
||||
record[i].TakeQuantity = 0;
|
||||
}
|
||||
if (record[i].TakeQuantity == orderTakeQuantity)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
//更新处方状态
|
||||
|
@ -498,6 +508,7 @@ namespace DM_Weight.ViewModels
|
|||
singleChannels.ForEach(it =>
|
||||
{
|
||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
||||
Thread.Sleep(200);
|
||||
});
|
||||
}
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
|
|
|
@ -440,6 +440,7 @@ namespace DM_Weight.ViewModels
|
|||
.Sum(it => it.Quantity);
|
||||
//将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -460,6 +460,7 @@ namespace DM_Weight.ViewModels
|
|||
.Sum(it => it.Quantity);
|
||||
//将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ using DM_Weight.msg;
|
|||
using DM_Weight.Port;
|
||||
using DM_Weight.util;
|
||||
using SqlSugar;
|
||||
using System.Threading;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -334,6 +335,7 @@ namespace DM_Weight.ViewModels
|
|||
.Sum(it => it.Quantity);
|
||||
|
||||
_portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, totalQuantity);
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
|
|
|
@ -21,6 +21,7 @@ using DM_Weight.Views;
|
|||
using SqlSugar;
|
||||
using System.Threading.Channels;
|
||||
using DM_Weight.Report;
|
||||
using System.Threading;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -50,7 +51,7 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
void DoMyPrismEvent(DeviceMsg msg)
|
||||
{
|
||||
|
||||
logger.Info($"msg.WindowName【{msg.WindowName}】WindowName【{WindowName}】Status【{Status}】EventType【{msg.EventType}】");
|
||||
if (msg.WindowName.Equals(WindowName))
|
||||
{
|
||||
|
||||
|
@ -413,6 +414,7 @@ namespace DM_Weight.ViewModels
|
|||
if (ChannelStock.BoardType == 5)
|
||||
{
|
||||
_portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, ChannelStock.Quantity + ReturnQuantity);
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
|
|
|
@ -421,6 +421,7 @@ namespace DM_Weight.ViewModels
|
|||
.Sum(it => it.Quantity);
|
||||
//将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -382,6 +382,7 @@ namespace DM_Weight.ViewModels
|
|||
.Sum(it => it.Quantity);
|
||||
//将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue