1)修改调拨入库时可输入入库数量

2)修改打开抽屉时复制list副本
This commit is contained in:
maqiao 2024-03-18 15:24:06 +08:00
parent 35695d2094
commit db02d51934
15 changed files with 197 additions and 38 deletions

View File

@ -73,6 +73,8 @@ namespace DM_Weight.Models
[SugarColumn(ColumnName = "quantity")] [SugarColumn(ColumnName = "quantity")]
public int Quantity { get; set; } public int Quantity { get; set; }
/// <summary> /// <summary>
/// ///
/// 默认值: 1 /// 默认值: 1

View File

@ -1110,6 +1110,7 @@ namespace DM_Weight.Port
{ {
try try
{ {
logger.Info($"TakeQuantity{drawerNo}-{colNo},操作数量{quantity},操作后数量{stock}");
canBusSerial.DiscardInBuffer(); canBusSerial.DiscardInBuffer();
//int channel = (drawerNo * 10 + colNo); //int channel = (drawerNo * 10 + colNo);

View File

@ -238,7 +238,7 @@ namespace DM_Weight.ViewModels
try try
{ {
string machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"; string machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
//根据已生成的日结存记录 //删除已生成的日结存记录
int deleteNum = SqlSugarHelper.Db.Deleteable<MachineRecord>() int deleteNum = SqlSugarHelper.Db.Deleteable<MachineRecord>()
.Where(cs => cs.Type.Equals(5) && cs.OperationTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd") && cs.MachineId.Equals(machineId)).ExecuteCommand(); .Where(cs => cs.Type.Equals(5) && cs.OperationTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd") && cs.MachineId.Equals(machineId)).ExecuteCommand();
int inQuantity = 0; //当日入库量 int inQuantity = 0; //当日入库量

View File

@ -3,6 +3,7 @@ using DM_Weight.msg;
using DM_Weight.Port; using DM_Weight.Port;
using DM_Weight.util; using DM_Weight.util;
using log4net; using log4net;
using log4net.Repository.Hierarchy;
using Prism.Commands; using Prism.Commands;
using Prism.Events; using Prism.Events;
using Prism.Mvvm; using Prism.Mvvm;
@ -170,6 +171,7 @@ namespace DM_Weight.ViewModels
public bool Is17Drawer { get => _is17Drawer; set => SetProperty(ref _is17Drawer, value); } public bool Is17Drawer { get => _is17Drawer; set => SetProperty(ref _is17Drawer, value); }
public DelegateCommand<string> UpdateDrawerNo public DelegateCommand<string> UpdateDrawerNo
{ {
@ -426,7 +428,7 @@ namespace DM_Weight.ViewModels
}); });
} }
public bool KeepAlive => true; public bool KeepAlive => false;
@ -475,7 +477,34 @@ namespace DM_Weight.ViewModels
channelLS.channelStocks = stockList; channelLS.channelStocks = stockList;
} }
} }
//删除药品下批次库存为0的批次
private void DelManuNO(ChannelStock cstock)
{
if(cstock != null)
{
//删除ChannelStock表中该批次数据
int isOk = SqlSugarHelper.Db.Deleteable<ChannelStock>().Where(cs => cs.DrugId == cstock.DrugId && cs.ManuNo == cs.ManuNo).ExecuteCommand();
if(isOk>0 )
{
logger.Info($"删除{cstock.DrawerNo}-{cstock.ColNo}抽屉中药品{cstock.DrugId}下的批次{cstock.ManuNo},");
AlertMsg alertMsg = new AlertMsg
{
Message = "该药品批次已删除",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
else
{
AlertMsg alertMsg = new AlertMsg
{
Message = "该药品批次删除失败",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
}
}
public long CurrentTimeMillis() public long CurrentTimeMillis()
{ {
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds; return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
@ -506,7 +535,7 @@ namespace DM_Weight.ViewModels
.Where(cl => cl.DrugId != null) .Where(cl => cl.DrugId != null)
.OrderBy(cl => cl.ColNo) .OrderBy(cl => cl.ColNo)
.ToList(); .ToList();
ChannelLsts = queryData.Select(cl => ChannelLsts = queryData.AsParallel().Select(cl =>
{ {
cl.channelStocks = cl.channelStocks.Select(cs => cl.channelStocks = cl.channelStocks.Select(cs =>
{ {
@ -525,6 +554,7 @@ namespace DM_Weight.ViewModels
{ {
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent); _eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
_eventAggregator.GetEvent<AddDrugEvent>().Subscribe(AddAction); _eventAggregator.GetEvent<AddDrugEvent>().Subscribe(AddAction);
_eventAggregator.GetEvent<DelDrugManoEvent>().Subscribe(DelManuNO);
FindDrawerCount(); FindDrawerCount();
RequestData(); RequestData();
} }
@ -542,6 +572,7 @@ namespace DM_Weight.ViewModels
// 取消消息订阅 // 取消消息订阅
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent); _eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
_eventAggregator.GetEvent<AddDrugEvent>().Unsubscribe(AddAction); _eventAggregator.GetEvent<AddDrugEvent>().Unsubscribe(AddAction);
_eventAggregator.GetEvent<DelDrugManoEvent>().Unsubscribe(DelManuNO);
} }
} }
} }

View File

@ -278,7 +278,14 @@ namespace DM_Weight.ViewModels
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

View File

@ -318,15 +318,15 @@ namespace DM_Weight.ViewModels
//int DrawerNo =Convert.ToInt32(grouping.Key.Substring(0,grouping.Key.IndexOf('-'))); //int DrawerNo =Convert.ToInt32(grouping.Key.Substring(0,grouping.Key.IndexOf('-')));
int DrawerNo = grouping.Key; int DrawerNo = grouping.Key;
List<ChannelStock> Stocks = grouping.ToList(); List<ChannelStock> Stocks = grouping.ToList();
List<ChannelStock> copyStocks = new List<ChannelStock>();
foreach (var item in Stocks)
{
copyStocks.Add(item);
}
Stocks.ForEach(it => it.process = 1); Stocks.ForEach(it => it.process = 1);
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉"); _portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
List<ChannelStock> singleChannels = new List<ChannelStock>();
List<ChannelStock> singleChannels = Stocks.GroupBy(it => new for (int i = 0; i < Stocks.Count; i++)
{
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(Stocks[i]);
singleChannels.Add(copy);
}
singleChannels = singleChannels.GroupBy(it => new
{ {
it.DrawerNo, it.DrawerNo,
it.ColNo it.ColNo
@ -334,7 +334,7 @@ namespace DM_Weight.ViewModels
{ {
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().FindAll(it => it.BoardType != 1); }).ToList().FindAll(it => it.BoardType != 1);
@ -360,7 +360,7 @@ namespace DM_Weight.ViewModels
_portUtil.Operate = true; _portUtil.Operate = true;
_portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1; _portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
_portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray(); _portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
_portUtil.Stocks = singleChannels.Select(it => it.Quantity).ToArray(); //_portUtil.Stocks = singleChannels.Select(it => it.Quantity).ToArray();
_portUtil.DrawerNo = DrawerNo; _portUtil.DrawerNo = DrawerNo;
_portUtil.Start(); _portUtil.Start();
} }

View File

@ -11,6 +11,7 @@ using Prism.Regions;
using Prism.Services.Dialogs; using Prism.Services.Dialogs;
using SqlSugar; using SqlSugar;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Configuration; using System.Configuration;
@ -18,6 +19,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Documents;
namespace DM_Weight.ViewModels namespace DM_Weight.ViewModels
{ {
@ -317,18 +319,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)
{ {
@ -341,6 +343,7 @@ namespace DM_Weight.ViewModels
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg); _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
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;
@ -351,13 +354,24 @@ 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.ForEach(s => s.AddQuantity = invoicesManuNo[j].quantity);
stockList.GroupBy(x => x.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 +404,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 +437,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,7 +463,13 @@ 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 = new List<ChannelStock>();
for (int i = 0; i < channelStocks.Count; i++)
{
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
singleChannels.Add(copy);
}
ChannelLst = ChannelLst.Where(it => it.BoardType != 1)
.GroupBy(it => it.ColNo) .GroupBy(it => it.ColNo)
.Select(it => .Select(it =>
{ {
@ -501,7 +548,7 @@ namespace DM_Weight.ViewModels
} }
//查询现有库位中是否有库存为0的记录如果有直接update //查询现有库位中是否有库存为0的记录如果有直接update
ChannelStock recordHistory = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ColNo == it.ColNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.Quantity <= 0).First(); ChannelStock recordHistory = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ColNo == it.ColNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.Quantity <= 0).First();
if (recordHistory!=null&& recordHistory.Id!=null) if (recordHistory != null && recordHistory.Id != null)
{ {
SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(item => new ChannelStock() SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(item => new ChannelStock()
{ {
@ -563,7 +610,7 @@ namespace DM_Weight.ViewModels
{ {
//根据ChannelLsts中的库位删除该库位库存为0的记录 //根据ChannelLsts中的库位删除该库位库存为0的记录
SqlSugarHelper.Db.Deleteable<ChannelStock>() SqlSugarHelper.Db.Deleteable<ChannelStock>()
.Where(cs => cs.Quantity <= 0 && cs.DrawerNo == ChannelLsts[i].channelStocks[0].DrawerNo && cs.ColNo == ChannelLsts[i].channelStocks[0].ColNo).ExecuteCommand(); .Where(cs => cs.Quantity <= 0 && cs.DrugId == ChannelLsts[i].DrugId && cs.MachineId == ChannelLsts[i].MachineId).ExecuteCommand();
} }
} }
return true; return true;
@ -589,7 +636,7 @@ namespace DM_Weight.ViewModels
if (singleChannels[i].BoardType == 5) if (singleChannels[i].BoardType == 5)
{ {
List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>() List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Where(cs => cs.MachineId==singleChannels[i].MachineId) .Where(cs => cs.MachineId == singleChannels[i].MachineId)
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo) .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
.Where(cs => cs.ColNo == singleChannels[i].ColNo) .Where(cs => cs.ColNo == singleChannels[i].ColNo)
.OrderBy(cs => cs.EffDate).ToList(); .OrderBy(cs => cs.EffDate).ToList();

View File

@ -22,6 +22,7 @@ using DM_Weight.Port;
using DM_Weight.select; using DM_Weight.select;
using DM_Weight.util; using DM_Weight.util;
using System.Threading; using System.Threading;
using System.Collections;
namespace DM_Weight.ViewModels namespace DM_Weight.ViewModels
{ {
@ -265,8 +266,13 @@ namespace DM_Weight.ViewModels
channelStocks.ForEach(it => it.process = 1); channelStocks.ForEach(it => it.process = 1);
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉"); _portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
List<ChannelStock> singleChannels = new List<ChannelStock>();
List<ChannelStock> singleChannels = channelStocks 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 =>
{ {

View File

@ -272,7 +272,14 @@ 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 =>
{ {
@ -289,8 +296,7 @@ namespace DM_Weight.ViewModels
{ {
try try
{ {
_portUtil.TakeQuantity(DrawerNo, it.ColNo, it.Quantity, it.Quantity - it.TakeQuantity);
_portUtil.TakeQuantity(DrawerNo, it.ColNo, it.TakeQuantity, it.Quantity - it.TakeQuantity);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -20,6 +20,7 @@ using DM_Weight.Views;
using System.Threading; using System.Threading;
using SqlSugar; using SqlSugar;
using System.Configuration; using System.Configuration;
using System.Collections;
namespace DM_Weight.ViewModels namespace DM_Weight.ViewModels
{ {
@ -192,8 +193,13 @@ namespace DM_Weight.ViewModels
channelStocks.ForEach(it => it.process = 1); channelStocks.ForEach(it => it.process = 1);
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉"); _portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
List<ChannelStock> singleChannels = new List<ChannelStock>();
List<ChannelStock> singleChannels = channelStocks 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
}) })

View File

@ -184,8 +184,13 @@ namespace DM_Weight.ViewModels
channelStocks.ForEach(it => it.process = 1); channelStocks.ForEach(it => it.process = 1);
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉"); _portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
List<ChannelStock> singleChannels = new List<ChannelStock>();
List<ChannelStock> singleChannels = channelStocks 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 =>
{ {

View File

@ -337,7 +337,29 @@
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<!--<DataGridTemplateColumn Width="100" Header="操作">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
--><!--<TextBox Style="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}" IsReadOnly="{Binding BoardType, Converter={StaticResource InputQuantityConverter}}">
<TextBox.Text>
<Binding Path="AddQuantity" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<ExceptionValidationRule />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>--><!--
<Button Grid.Row="2" Padding="0 0 0 1 " Style="{x:Null}" BorderBrush="{x:Null}" Background="{x:Null}" Click="Button_Click_1" CommandParameter="{Binding}">
<Button.Content>
<Border Width="30" Height="30" CornerRadius="16" Background="Red" VerticalAlignment="Center" HorizontalAlignment="Center">
<Path Data="M3 3 L20 20 M 20 3 L 3 20" Stroke="WhiteSmoke" StrokeThickness="4" VerticalAlignment="Center" HorizontalAlignment="Center"></Path>
</Border>
</Button.Content>
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<!--<ListView Padding="0 6 0 0" Grid.Column="1" <!--<ListView Padding="0 6 0 0" Grid.Column="1"

View File

@ -37,5 +37,17 @@ namespace DM_Weight.Views
//vms.AddAction(cls); //vms.AddAction(cls);
_eventAggregator.GetEvent<AddDrugEvent>().Publish(cls); _eventAggregator.GetEvent<AddDrugEvent>().Publish(cls);
} }
//删除库存为0的批次
private void Button_Click_1(object sender, RoutedEventArgs e)
{
Button delBtn= (Button)sender;
ChannelStock cs = (ChannelStock)delBtn.CommandParameter;
if(cs.Quantity> 0)
{
MessageBox.Show($"该批次{cs.ManuNo}库存不为0不能删除","提示");
}
_eventAggregator.GetEvent<DelDrugManoEvent>().Publish(cs);
}
} }
} }

View File

@ -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>

View File

@ -0,0 +1,14 @@
using DM_Weight.Models;
using Prism.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.msg
{
internal class DelDrugManoEvent:PubSubEvent<ChannelStock>
{
}
}