lirenjie пре 6 месеци
родитељ
комит
a5fb166e63

+ 0
- 57
Rdh.SocketServer.Client/Models/EleMedKitCommand.cs Прегледај датотеку

@@ -1,57 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Rdh.SocketServer.Client.Models
{
public class EleMedKitCommand
{
/// <summary>
/// 药箱定位上传
/// </summary>
public const String RequestLocation = "0A";
/// <summary>
/// 药箱查询手术信息
/// </summary>
public const String RequestPatientOperation = "0B";
/// <summary>
/// 药箱上传手术用药信息
/// </summary>
public const String RequestPatientOperationUsage = "0C";
/// <summary>
/// 药箱呼叫机器人
/// </summary>
public const String RequestRobot = "0D";
/// <summary>
/// 药箱请求归还
/// </summary>
public const String RequestReturnMedKit = "0E";
/// <summary>
/// 药箱上传补药信息
/// </summary>
public const String RequestSupplyList = "0F";
/// <summary>
/// 药箱查询借药信息
/// </summary>
public const String RequestDrugLend = "0G";
/// <summary>
/// 药箱开始手术取药
/// </summary>
public const String RequestStartPatientOperation = "0H";
/// <summary>
/// 药箱同步时钟
/// </summary>
public const String RequestClock = "TT";

public const String ResponseLocation = "0A";
public const String ResponsePatientOperation = "0B";
public const String ResponsePatientOperationUsage = "0C";
public const String ResponseRobot = "0D";
public const String ResponseReturnMedKit = "0E";
public const String ResponseSupplyList = "0F";
public const String ResponseDrugLend = "0G";
public const String RepsonseClock = "TT";
}
}

+ 18
- 0
Rdh.SocketServer.Client/Models/EleMedKitDrugUsageStates.cs Прегледај датотеку

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Rdh.SocketServer.Client.Models
{
/// <summary>
/// 表示药箱药品使用状态的枚举
/// </summary>
public enum EleMedKitDrugUsageStates
{
Normal = 0,
Lost = 1,
LastUsed = 2,
}
}

+ 57
- 0
Rdh.SocketServer.Client/Models/EleMedKitProtocol/EleMedKitCommand.cs Прегледај датотеку

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Rdh.SocketServer.Client.Models
{
public class EleMedKitCommand
{
/// <summary>
/// 药箱定位上传
/// </summary>
public const string RequestLocation = "0A";
/// <summary>
/// 药箱查询手术信息
/// </summary>
public const string RequestPatientOperation = "0B";
/// <summary>
/// 药箱上传手术用药信息
/// </summary>
public const string RequestPatientOperationUsage = "0C";
/// <summary>
/// 药箱呼叫机器人
/// </summary>
public const string RequestRobot = "0D";
/// <summary>
/// 药箱请求归还
/// </summary>
public const string RequestReturnMedKit = "0E";
/// <summary>
/// 药箱上传补药信息
/// </summary>
public const string RequestSupplyList = "0F";
/// <summary>
/// 药箱查询借药信息
/// </summary>
public const string RequestDrugLend = "0G";
/// <summary>
/// 药箱开始手术取药
/// </summary>
public const string RequestStartPatientOperation = "0H";
/// <summary>
/// 药箱同步时钟
/// </summary>
public const string RequestClock = "TT";

public const string ResponseLocation = "0A";
public const string ResponsePatientOperation = "0B";
public const string ResponsePatientOperationUsage = "0C";
public const string ResponseRobot = "0D";
public const string ResponseReturnMedKit = "0E";
public const string ResponseSupplyList = "0F";
public const string ResponseDrugLend = "0G";
public const string RepsonseClock = "TT";
}
}

+ 25
- 13
Rdh.SocketServer.Client/ViewModels/MainWindowViewModel.cs Прегледај датотеку

@@ -495,7 +495,7 @@ namespace Rdh.SocketServer.Client.ViewModels
IEnumerable<OperationTakeItem> takeHistory = operationTakeItemBLL.ListTakeItemsByTakeBag(curTakeBag);
Boolean drugHandleFlag = true;
#region 根据请求的标签获取对应库存
List<PortableStorageItemLot> usageWithInventory = new List<PortableStorageItemLot>();
List<Tuple<PortableStorageItemLot, Int32>> usageWithInventory = new List<Tuple<PortableStorageItemLot, Int32>>();
foreach (DrugUsageProtocol d in requestUsageProtocol.ListDrugs)
{
OperationTakeItem? historyItem = takeHistory == null
@@ -526,7 +526,17 @@ namespace Rdh.SocketServer.Client.ViewModels
//}
if (inventoryLot != null)
{
usageWithInventory.Add(inventoryLot);
EleMedKitDrugUsageStates usageState = EleMedKitDrugUsageStates.Normal;
switch (d.UsageCode)
{
case DrugUsageCodes.Lost:
usageState = EleMedKitDrugUsageStates.Lost;
break;
case DrugUsageCodes.LastUsed:
usageState = EleMedKitDrugUsageStates.LastUsed;
break;
}
usageWithInventory.Add(new Tuple<PortableStorageItemLot, int>(inventoryLot, (Int32)usageState));
}
}
}
@@ -537,23 +547,23 @@ namespace Rdh.SocketServer.Client.ViewModels
}
#endregion
#region 更新库存和业务记录
IEnumerable<IGrouping<Guid, PortableStorageItemLot>> inventoryLogGroup = usageWithInventory
.GroupBy(x => x.LotKey.GetValueOrDefault());
IEnumerable<IGrouping<Guid, Tuple<PortableStorageItemLot, Int32>>> inventoryLogGroup = usageWithInventory
.GroupBy(x => x.Item1.LotKey.GetValueOrDefault());
//保存OperationTakeItem
foreach (IGrouping<Guid, PortableStorageItemLot> g in inventoryLogGroup)
foreach (IGrouping<Guid, Tuple<PortableStorageItemLot, Int32>> g in inventoryLogGroup)
{
OperationTakeItem operationTakeItem = new OperationTakeItem
{
Key = Guid.NewGuid(),
SnapshotKey = Guid.NewGuid(),
ItemKey = g.First().ItemKey,
Ext01 = g.First().LotKey.GetValueOrDefault().ToString(),
ItemKey = g.First().Item1.ItemKey,
Ext01 = g.First().Item1.LotKey.GetValueOrDefault().ToString(),
TakeBagKey = curTakeBag.Key,
TakeQuantity = g.Count(),
};
operationTakeItemBLL.Save(operationTakeItem);
//更新PortableStorageItem
PortableStorageItem psi = g.First().PortableStorageItem;
PortableStorageItem psi = g.First().Item1.PortableStorageItem;
psi.CurrentQuantity = psi.CurrentQuantity.GetValueOrDefault() - g.Count();
portableStorageItemBLL.Update(psi);
//保存StorageSpaceItemTransaction
@@ -569,19 +579,20 @@ namespace Rdh.SocketServer.Client.ViewModels
storageSpaceItemTransactionBLL.Save(ssiTransaction);
}
//更新批号库存
foreach (PortableStorageItemLot psil in usageWithInventory)
foreach (Tuple<PortableStorageItemLot, Int32> psil in usageWithInventory)
{
SPILItemTransaction sPILItemTransaction = new SPILItemTransaction()
{
Key = Guid.NewGuid(),
StorageSpaceItemLotKey = psil.Key,
StorageSpaceItemLotKey = psil.Item1.Key,
Quantity = 1,
ItemTransactionKey = curTakeBag.Key.GetValueOrDefault(),
ItemLotKey = psil.LotKey,
Ext01 = psil.Ext01,
ItemLotKey = psil.Item1.LotKey,
Ext01 = psil.Item1.Ext01,
Ext09 = psil.Item2.ToString(),
};
sPILItemTransactionBLL.Save(sPILItemTransaction);
portableStorageItemLotBLL.Delete(psil);
portableStorageItemLotBLL.Delete(psil.Item1);
}
#endregion
#region 更新手术状态
@@ -780,6 +791,7 @@ namespace Rdh.SocketServer.Client.ViewModels
}
catch (Exception ex)
{
RemovePocket(curPocket);
Log("服务器反馈出错:" + ex.Message, -1);
}
}

Loading…
Откажи
Сачувај