Ver código fonte

药箱借药时,增加药箱库存

master
lirenjie 6 meses atrás
pai
commit
69e5b47f80

+ 35
- 0
RDH.Data/PortableStorageItemBLL.cs Ver arquivo

@@ -258,6 +258,41 @@ namespace RDH.Data.BLL
itemKey = itemKey,
}).FirstOrDefault();
}
public PortableStorageItem GetByStorageAndItem(String storageCode, Guid itemKey)
{
SqlBuilder sqlBuilder = new SqlBuilder(this);
StorageSpacePortableLinkBLL storageSpacePortableLinkBLL = new StorageSpacePortableLinkBLL();
TableJoinInfo ssplTable = new TableJoinInfo
{
LeftDal = this,
LeftColumnName = "portable_storage_key",
RightDal = storageSpacePortableLinkBLL,
RightColumnName = "portable_storage_key",
JoinType = TableJoinTypes.Inner,
DonotMapFlag = true,
};
sqlBuilder.AppendSelectionTable(ssplTable);
StorageSpaceBLL storageSpaceBLL = new StorageSpaceBLL();
TableJoinInfo storageTable = new TableJoinInfo
{
LeftDal = storageSpacePortableLinkBLL,
LeftColumnName = "storage_space_key",
RightDal = storageSpaceBLL,
RightColumnName = "key",
JoinType = TableJoinTypes.Inner,
DonotMapFlag = true,
};
sqlBuilder.AppendSelectionTable(storageTable);
sqlBuilder.AppendWherePhrases($"{storageSpaceBLL.AliasTableName}.ext02=:storageCode AND {this.AliasTableName}.ITEM_KEY=:itemKey");
return SqlMapper.Query<PortableStorageItem>(
ConnectionFactory.Current.GetSessionConnection(),
sqlBuilder.ToString(),
new
{
storageCode = storageCode,
itemKey = itemKey,
}).FirstOrDefault();
}
}

}

+ 2
- 0
Rdh.SocketServer.Client/Models/EleMedKitProtocolHelper.cs Ver arquivo

@@ -74,6 +74,8 @@ namespace Rdh.SocketServer.Client.Models
return new RequestSupplyDrugProtocol();
case EleMedKitCommand.RequestDrugLend:
return new RequestDrugLendProtocol();
case EleMedKitCommand.RequestStartPatientOperation:
return new RequestStartPatientOperationProtocol();
default:
return new UnSupportProtocol();
}

+ 37
- 11
Rdh.SocketServer.Client/ViewModels/MainWindowViewModel.cs Ver arquivo

@@ -58,11 +58,11 @@ namespace Rdh.SocketServer.Client.ViewModels
{
service.Connecting += (client, e) =>
{
Log($"{client.ID}正在建立连接");
Log($"{client.IP}:{client.Port.ToString()}正在建立连接");
};//有客户端正在连接
service.Connected += (client, e) =>
{
Log($"已从{client.ID}建立连接");
Log($"已从{client.IP}:{client.Port.ToString()}建立连接");
Application.Current.Dispatcher.Invoke(() =>
{
ListClients.Add(new TimeFlagModel<SocketClient>(client));
@@ -70,7 +70,7 @@ namespace Rdh.SocketServer.Client.ViewModels
};//有客户端连接
service.Disconnected += (client, e) =>
{
Log($"已从{client.ID}断开连接");
Log($"已从{client.IP}:{client.Port.ToString()}断开连接");
Application.Current.Dispatcher.Invoke(() =>
{
lock (ListClients)
@@ -158,7 +158,7 @@ namespace Rdh.SocketServer.Client.ViewModels
{
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
Log($"Received from:{client.IP}");
Log($"Received from:{client.IP}:{client.Port.ToString()}");
EleMedKitData? data = requestInfo as EleMedKitData;
if (data == null)
{
@@ -512,12 +512,6 @@ namespace Rdh.SocketServer.Client.ViewModels
|| d.UsageCode == DrugUsageCodes.LastUsed)
{
PortableStorageItemLot inventoryLot = portableStorageItemLotBLL.GetByItemBarcode(d.Barcode);
//if (inventoryLot == null)
//{
// Log("未找到药品条码标签:" + d.Barcode, -1);
// drugHandleFlag = false;
// break;
//}
//if (inventoryLot.PortableStorageItem.Item.Key.ToString() != d.DrugKey)
//{
// Log("上传的药品ID与数据库不符:" + d.DrugKey, -1);
@@ -538,6 +532,12 @@ namespace Rdh.SocketServer.Client.ViewModels
}
usageWithInventory.Add(new Tuple<PortableStorageItemLot, int>(inventoryLot, (Int32)usageState));
}
else
{
Log("未找到药品条码标签:" + d.Barcode, -1);
//drugHandleFlag = false;
// break;
}
}
}
}
@@ -711,6 +711,31 @@ namespace Rdh.SocketServer.Client.ViewModels
ItemTransaction itemTransaction = transactions.First().ItemTransaction;
itemTransaction.Ext10 = "1";
itemTransactionBLL.Update(itemTransaction);
#region 更新药箱库存
PortableStorageItemBLL portableStorageItemBLL = new PortableStorageItemBLL();
PortableStorageItemLotBLL portableStorageItemLotBLL = new PortableStorageItemLotBLL();
foreach (SPILItemTransaction t in transactions)
{
PortableStorageItem inventoryItem = portableStorageItemBLL.GetByStorageAndItem(
requestStorageLink.PortableStorage.Code,
t.ItemTransaction.ItemKey.GetValueOrDefault());
if (inventoryItem != null)
{
inventoryItem.CurrentQuantity = inventoryItem.CurrentQuantity.GetValueOrDefault() + 1;
portableStorageItemBLL.Update(inventoryItem);
PortableStorageItemLot inventoryItemLot = new PortableStorageItemLot();
inventoryItemLot.Quantity = 1;
inventoryItemLot.Key = Guid.NewGuid();
inventoryItemLot.ItemKey = t.ItemTransaction.ItemKey;
inventoryItemLot.LotKey = t.ItemLotKey;
inventoryItemLot.CreateTime = DateTime.Now;
inventoryItemLot.PortableStorageItemkey = inventoryItem.Key;
inventoryItemLot.Ext01 = t.Ext06;
portableStorageItemLotBLL.Save(inventoryItemLot);
}
}
#endregion
#region 测试
//ResponseLendDrugProtocol response = new ResponseLendDrugProtocol();
//response.EleMedKitCode = requestLendProtocol.EleMedKitCode;
//response.ListLendResult = new List<SimpleDrugLotProtocol>();
@@ -726,7 +751,8 @@ namespace Rdh.SocketServer.Client.ViewModels
// DrugKey = "39383086-f0aa-4ed0-bbe8-e1bf7fba719f",
// DrugLotCode = "20230817",
//});
//responseData = response;
//responseData = response;
#endregion
}
}
catch (Exception ex)

+ 1
- 1
Rdh.SocketServer.Client/appsettings.json Ver arquivo

@@ -20,7 +20,7 @@
/*
"ConnectionString": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.253)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=xe)));User ID=zhouzhuan;Password=zhouzhuan;Persist Security Info=false;",
*/
"ConnectionString": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=xe)));User ID=zhouzhuan;Password=zhouzhuan;Persist Security Info=false;"
"ConnectionString": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=xe)));User ID=srm;Password=srm;Persist Security Info=false;"
}
//{
// "Name": "Default",

+ 1
- 1
Tcp.Test2/App.config Ver arquivo

@@ -4,7 +4,7 @@
<!--<add key="ServerIp" value="192.168.2.253"/>-->
<!--<add key="ServerIp" value="192.168.2.86"/>-->
<!--<add key="ServerIp" value="192.168.8.20"/>-->
<add key="ServerIp" value="129.88.25.249"/>
<add key="ServerIp" value="192.168.0.105"/>
<add key="ServerPort" value="8308"/>
</appSettings>
</configuration>

Carregando…
Cancelar
Salvar