parent
8d8502c734
commit
c580e69347
|
@ -20,7 +20,7 @@
|
||||||
<!--2023/7/13 药房代码 有则写无则空 -->
|
<!--2023/7/13 药房代码 有则写无则空 -->
|
||||||
<add key="storage" value="" />
|
<add key="storage" value="" />
|
||||||
<!-- 登录模式 1单人登录2双人登录 -->
|
<!-- 登录模式 1单人登录2双人登录 -->
|
||||||
<add key="loginMode" value="2" />
|
<add key="loginMode" value="1" />
|
||||||
<!-- 登录顺序,指定先登录的人的名称有效值,只有在登录模式等于2时才会生效; 发药人:【operator】审核人:【reviewer】 -->
|
<!-- 登录顺序,指定先登录的人的名称有效值,只有在登录模式等于2时才会生效; 发药人:【operator】审核人:【reviewer】 -->
|
||||||
<add key="firstLogin" value="operator" />
|
<add key="firstLogin" value="operator" />
|
||||||
<!-- 按处方还药或者按取药记录还药 1:处方2:药品-->
|
<!-- 按处方还药或者按取药记录还药 1:处方2:药品-->
|
||||||
|
|
|
@ -277,8 +277,14 @@ namespace DM_Weight.ViewModels
|
||||||
List<ChannelStock> channelStocks = grouping.ToList();
|
List<ChannelStock> channelStocks = grouping.ToList();
|
||||||
channelStocks.ForEach(it => it.process = 1);
|
channelStocks.ForEach(it => it.process = 1);
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
|
for (int i = 0; i < channelStocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
|
||||||
List<ChannelStock> singleChannels = channelStocks.GroupBy(it => new
|
singleChannels = singleChannels.GroupBy(it => new
|
||||||
{
|
{
|
||||||
it.DrawerNo,
|
it.DrawerNo,
|
||||||
it.ColNo
|
it.ColNo
|
||||||
|
|
|
@ -320,8 +320,14 @@ namespace DM_Weight.ViewModels
|
||||||
List<ChannelStock> channelStocks = grouping.ToList();
|
List<ChannelStock> channelStocks = grouping.ToList();
|
||||||
channelStocks.ForEach(it => it.process = 1);
|
channelStocks.ForEach(it => it.process = 1);
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
|
for (int i = 0; i < channelStocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
|
||||||
List<ChannelStock> singleChannels = channelStocks.GroupBy(it => new
|
singleChannels = singleChannels.GroupBy(it => new
|
||||||
{
|
{
|
||||||
it.DrawerNo,
|
it.DrawerNo,
|
||||||
it.ColNo
|
it.ColNo
|
||||||
|
|
|
@ -202,15 +202,15 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||||
{
|
{
|
||||||
List<ChannelStock> ChannelLst = channelStocks.Where(it => it.BoardType != 1)
|
//List<ChannelStock> ChannelLst = channelStocks.Where(it => it.BoardType != 1)
|
||||||
.GroupBy(it => it.ColNo)
|
// .GroupBy(it => it.ColNo)
|
||||||
.Select(it =>
|
// .Select(it =>
|
||||||
{
|
// {
|
||||||
var ret = it.First();
|
// var ret = it.First();
|
||||||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
// ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||||
ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
// ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||||
return ret;
|
// return ret;
|
||||||
}).ToList();
|
// }).ToList();
|
||||||
|
|
||||||
// 发送加药数量
|
// 发送加药数量
|
||||||
singleChannels.ForEach(it =>
|
singleChannels.ForEach(it =>
|
||||||
|
|
|
@ -288,7 +288,7 @@ namespace DM_Weight.ViewModels
|
||||||
List<ChannelStock> iChannelStock = new List<ChannelStock>();
|
List<ChannelStock> iChannelStock = new List<ChannelStock>();
|
||||||
if (SelectedInvoice != null)
|
if (SelectedInvoice != null)
|
||||||
{
|
{
|
||||||
//先查询有几种药
|
//先查询入库单中有几种药
|
||||||
string strSql = @"SELECT sum(Quantity) AS SumQuantity, COUNT(ID) AS CountNum,INVOICE_NO AS InvoiceNo,drug_id AS DrugId,QUANTITY AS quantity,drug_manu_no AS drugManuNo FROM IN_OUT_INVOICE WHERE INVOICE_NO=@INVOICE_NO GROUP BY INVOICE_NO,DRUG_ID";
|
string strSql = @"SELECT sum(Quantity) AS SumQuantity, COUNT(ID) AS CountNum,INVOICE_NO AS InvoiceNo,drug_id AS DrugId,QUANTITY AS quantity,drug_manu_no AS drugManuNo FROM IN_OUT_INVOICE WHERE INVOICE_NO=@INVOICE_NO GROUP BY INVOICE_NO,DRUG_ID";
|
||||||
|
|
||||||
var invoices = SqlSugarHelper.Db.SqlQueryable<InOutInvoice>(strSql)
|
var invoices = SqlSugarHelper.Db.SqlQueryable<InOutInvoice>(strSql)
|
||||||
|
@ -317,18 +317,18 @@ namespace DM_Weight.ViewModels
|
||||||
//_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
//_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ChannelStock stock = new ChannelStock();
|
//ChannelStock stock = new ChannelStock();
|
||||||
//查询每种药有多少个批次
|
//查询每种药有多少个批次
|
||||||
var invoicesManuNo = SqlSugarHelper.Db.Queryable<InOutInvoice>()
|
var invoicesManuNo = SqlSugarHelper.Db.Queryable<InOutInvoice>()
|
||||||
.Where(iManuNo => iManuNo.InvoiceNo == invoices[i].InvoiceNo && iManuNo.DrugId == invoices[i].DrugId).ToList();
|
.Where(iManuNo => iManuNo.InvoiceNo == invoices[i].InvoiceNo && iManuNo.DrugId == invoices[i].DrugId && iManuNo.Status == 0 && iManuNo.Type != 2 && iManuNo.CancelFlag == 0).ToList();
|
||||||
for (int j = 0; j < invoicesManuNo.Count; j++)
|
for (int j = 0; j < invoicesManuNo.Count; j++)
|
||||||
{
|
{
|
||||||
//查询是否有库存
|
//查询是否有库存
|
||||||
List<ChannelStock> stockList = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> stockList = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.ManuNo == invoicesManuNo[j].DrugManuNo && cs.DrugId == invoicesManuNo[j].DrugId && cs.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
|
.Where(cs => cs.ManuNo == invoicesManuNo[j].DrugManuNo && cs.DrugId == invoicesManuNo[j].DrugId && cs.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
|
||||||
stock = stockList.Count > 0 ? stockList[0] : new ChannelStock();
|
//stock = stockList.Count > 0 ? stockList[0] : new ChannelStock();
|
||||||
List<DrugManuNo> manuNoList = SqlSugarHelper.Db.Queryable<DrugManuNo>().Where(dm => dm.ManuNo == invoicesManuNo[j].DrugManuNo && dm.DrugId == invoicesManuNo[j].DrugId).ToList();
|
List<DrugManuNo> manuNoList = SqlSugarHelper.Db.Queryable<DrugManuNo>().Where(dm => dm.ManuNo == invoicesManuNo[j].DrugManuNo && dm.DrugId == invoicesManuNo[j].DrugId).ToList();
|
||||||
if (stock == null || stock.Id is null)
|
if (stockList == null || stockList.Count<=0)
|
||||||
{
|
{
|
||||||
if (manuNoList == null || manuNoList.Count <= 0)
|
if (manuNoList == null || manuNoList.Count <= 0)
|
||||||
{
|
{
|
||||||
|
@ -342,6 +342,7 @@ namespace DM_Weight.ViewModels
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//没有库存写入一条数据
|
//没有库存写入一条数据
|
||||||
|
ChannelStock stock = new ChannelStock();
|
||||||
stock.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
stock.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
||||||
stock.DrawerNo = channelLst.DrawerNo;
|
stock.DrawerNo = channelLst.DrawerNo;
|
||||||
stock.BoardType = channelLst.BoardType;
|
stock.BoardType = channelLst.BoardType;
|
||||||
|
@ -351,13 +352,21 @@ namespace DM_Weight.ViewModels
|
||||||
stock.ManuNo = invoicesManuNo[j].DrugManuNo;
|
stock.ManuNo = invoicesManuNo[j].DrugManuNo;
|
||||||
stock.EffDate = manuNoList[0].EffDate;
|
stock.EffDate = manuNoList[0].EffDate;
|
||||||
stock.Chnguid = channelLst.Id;
|
stock.Chnguid = channelLst.Id;
|
||||||
|
stockList.Add(stock);
|
||||||
}
|
}
|
||||||
stock.AddQuantity = invoicesManuNo[j].quantity;
|
//stock.AddQuantity = invoicesManuNo[j].quantity;
|
||||||
|
stockList.GroupBy(it =>it.ManuNo)
|
||||||
|
.Select(it =>
|
||||||
|
{
|
||||||
|
var ret = it.First();
|
||||||
|
ret.AddQuantity = invoicesManuNo[j].quantity;
|
||||||
|
return ret;
|
||||||
|
}).ToList();
|
||||||
if (channelLst.channelStocks == null)
|
if (channelLst.channelStocks == null)
|
||||||
{
|
{
|
||||||
channelLst.channelStocks = new List<ChannelStock>();
|
channelLst.channelStocks = new List<ChannelStock>();
|
||||||
}
|
}
|
||||||
channelLst.channelStocks.Add(stock);
|
channelLst.channelStocks.AddRange(stockList);
|
||||||
}
|
}
|
||||||
|
|
||||||
InOutInvoice copy = TransExpV2<InOutInvoice, InOutInvoice>.Trans(invoices[i]);
|
InOutInvoice copy = TransExpV2<InOutInvoice, InOutInvoice>.Trans(invoices[i]);
|
||||||
|
@ -390,6 +399,27 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
if (Status == 0)
|
||||||
{
|
{
|
||||||
|
if (AddChannels == null || AddChannels.Count <= 0)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "请输入入库数量",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int totalNum = AddChannels.Sum(add => add.AddQuantity);
|
||||||
|
if (totalNum != SelectedInvoice.Quantity)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "各批次添加数量要与调拨单药品总数一致!",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
enumerator.MoveNext();
|
enumerator.MoveNext();
|
||||||
Status = 1;
|
Status = 1;
|
||||||
OpenOneByOne();
|
OpenOneByOne();
|
||||||
|
@ -402,7 +432,13 @@ namespace DM_Weight.ViewModels
|
||||||
List<ChannelStock> channelStocks = grouping.ToList();
|
List<ChannelStock> channelStocks = grouping.ToList();
|
||||||
channelStocks.ForEach(it => it.process = 1);
|
channelStocks.ForEach(it => it.process = 1);
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
List<ChannelStock> singleChannels = channelStocks.GroupBy(it => new
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
|
for (int i = 0; i < channelStocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy= TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
singleChannels = singleChannels.GroupBy(it => new
|
||||||
{
|
{
|
||||||
it.DrawerNo,
|
it.DrawerNo,
|
||||||
it.ColNo
|
it.ColNo
|
||||||
|
@ -422,15 +458,15 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||||
{
|
{
|
||||||
List<ChannelStock> ChannelLst = channelStocks.Where(it => it.BoardType != 1)
|
//List<ChannelStock> ChannelLst = channelStocks.Where(it => it.BoardType != 1)
|
||||||
.GroupBy(it => it.ColNo)
|
// .GroupBy(it => it.ColNo)
|
||||||
.Select(it =>
|
// .Select(it =>
|
||||||
{
|
// {
|
||||||
var ret = it.First();
|
// var ret = it.First();
|
||||||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
// ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||||
ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
// ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||||
return ret;
|
// return ret;
|
||||||
}).ToList();
|
// }).ToList();
|
||||||
// 发送加药数量
|
// 发送加药数量
|
||||||
singleChannels.ForEach(it =>
|
singleChannels.ForEach(it =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -266,7 +266,13 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
|
|
||||||
List<ChannelStock> singleChannels = channelStocks
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
|
for (int i = 0; i < channelStocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy=TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
singleChannels= singleChannels
|
||||||
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -272,7 +272,13 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
//List<ChannelStock> singleChannels = channelStocks.FindAll(it => it.BoardType != 1);
|
//List<ChannelStock> singleChannels = channelStocks.FindAll(it => it.BoardType != 1);
|
||||||
List<ChannelStock> singleChannels = channelStocks
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
|
for (int i = 0; i < channelStocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
singleChannels=singleChannels
|
||||||
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -193,7 +193,13 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
|
|
||||||
List<ChannelStock> singleChannels = channelStocks
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
|
for (int i = 0; i < channelStocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
singleChannels= singleChannels
|
||||||
.GroupBy(it => new {
|
.GroupBy(it => new {
|
||||||
it.DrawerNo, it.ColNo
|
it.DrawerNo, it.ColNo
|
||||||
})
|
})
|
||||||
|
|
|
@ -185,7 +185,13 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
|
|
||||||
List<ChannelStock> singleChannels = channelStocks
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
|
for (int i = 0; i < channelStocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
singleChannels= singleChannels
|
||||||
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -272,12 +272,12 @@
|
||||||
Binding="{Binding Quantity}"
|
Binding="{Binding Quantity}"
|
||||||
Header="库存"
|
Header="库存"
|
||||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
||||||
<DataGridTextColumn Width="100"
|
<!--<DataGridTextColumn Width="100"
|
||||||
Binding="{Binding AddQuantity}"
|
Binding="{Binding AddQuantity}"
|
||||||
Header="添加数量"
|
Header="添加数量"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>-->
|
||||||
<!--<DataGridTemplateColumn Width="60">
|
<DataGridTemplateColumn Width="60">
|
||||||
<DataGridTemplateColumn.Header>
|
<DataGridTemplateColumn.Header>
|
||||||
<TextBlock Text="添加数量" TextWrapping="Wrap"/>
|
<TextBlock Text="添加数量" TextWrapping="Wrap"/>
|
||||||
</DataGridTemplateColumn.Header>
|
</DataGridTemplateColumn.Header>
|
||||||
|
@ -294,7 +294,7 @@
|
||||||
</TextBox>
|
</TextBox>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>-->
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|
Loading…
Reference in New Issue