多批次绑定回收箱时删除已有记录,新增写channel_stock数据
This commit is contained in:
parent
db6d0200cc
commit
b7cfd4e1b3
|
@ -254,7 +254,8 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
for (int i = 0; i < channelStockList.Count; i++)
|
||||
{
|
||||
int Count = accountList.Where(cs => cs.DrugId == channelStockList[i].DrugId).Count();
|
||||
string drugId = channelStockList[i].DrugId;
|
||||
int Count = accountList.Where(cs => cs.DrugId == drugId).Count();
|
||||
|
||||
if (Count <= 0)
|
||||
{
|
||||
|
@ -263,12 +264,12 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
else
|
||||
{
|
||||
inQuantity = accountList.Where(cs => cs.DrugId == channelStockList[i].DrugId).Sum(cs => cs.InQuantity);
|
||||
outQuantity = accountList.Where(cs => cs.DrugId == channelStockList[i].DrugId).Sum(cs => cs.OutQuantity);
|
||||
inQuantity = accountList.Where(cs => cs.DrugId == drugId).Sum(cs => cs.InQuantity);
|
||||
outQuantity = accountList.Where(cs => cs.DrugId == drugId).Sum(cs => cs.OutQuantity);
|
||||
}
|
||||
// 获取药品总库存
|
||||
int channelStockQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.DrugId.Equals(channelStockList[i].DrugId)).Sum(it => it.Quantity);
|
||||
.Where(cs => cs.DrugId.Equals(drugId)).Sum(it => it.Quantity);
|
||||
//没有直接插入
|
||||
// 保存数据 出/入库记录
|
||||
string InvoiceId = "Account_" + CurrentTimeMillis();
|
||||
|
@ -277,7 +278,7 @@ namespace DM_Weight.ViewModels
|
|||
MachineId = channelStockList[i].MachineId,
|
||||
DrawerNo = 0,//channelStockList[i].DrawerNo,
|
||||
ColNo = 0,// channelStockList[i].ColNo,FV
|
||||
DrugId = channelStockList[i].DrugId,
|
||||
DrugId = drugId,
|
||||
ManuNo = "",//channelStockList[i].ManuNo,
|
||||
EffDate = null,// !String.IsNullOrEmpty(channelStockList[i].EffDate) ? DateTime.ParseExact(channelStockList[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
|
|
|
@ -280,6 +280,24 @@ namespace DM_Weight.ViewModels
|
|||
item.DrugId = DrugInfo.DrugId.ToString();
|
||||
//SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo }).ExecuteCommand();
|
||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo }).ExecuteCommand();
|
||||
|
||||
|
||||
|
||||
//插入channel_stock表数据
|
||||
SqlSugarHelper.Db.Insertable(new ChannelStock()
|
||||
{
|
||||
Quantity = 0,
|
||||
Chnguid = item.Chnguid,
|
||||
DrawerNo = item.DrawerNo,
|
||||
ColNo = item.ColNo,
|
||||
DrugId = item.DrugId,
|
||||
DrawerType = item.DrawerType,
|
||||
BoardType = item.BoardType,
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
|
||||
}).ExecuteCommand();
|
||||
|
||||
|
||||
GetChannelsByDrawerNo();
|
||||
|
||||
if (item.BoardType == 5)
|
||||
|
@ -292,10 +310,10 @@ namespace DM_Weight.ViewModels
|
|||
await Task.Delay(200);
|
||||
_portUtil.WriteChannelInfo(8, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
_portUtil.WriteChannelInfo(6, DrugManuNo.EffDate == null ? "" : DrugManuNo.EffDate, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
_portUtil.WriteChannelInfo(5, DrugManuNo.ManuNo, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
//_portUtil.WriteChannelInfo(6, DrugManuNo.EffDate == null ? "" : DrugManuNo.EffDate, item.DrawerNo, item.ColNo);
|
||||
//await Task.Delay(200);
|
||||
//_portUtil.WriteChannelInfo(5, DrugManuNo.ManuNo, item.DrawerNo, item.ColNo);
|
||||
//await Task.Delay(200);
|
||||
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||
}
|
||||
//_screenUtil.SetStockInfo(item, 1);
|
||||
|
@ -462,6 +480,7 @@ namespace DM_Weight.ViewModels
|
|||
item.DrugInfo = null;
|
||||
//SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||
SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(it => new ChannelStock { DrugId = null, ManuNo = null, EffDate = null }).Where(it => it.Chnguid == item.Id).ExecuteCommand();
|
||||
if (item.BoardType == 5)
|
||||
{
|
||||
// 清除显示屏库位信息
|
||||
|
|
|
@ -21,6 +21,7 @@ using System.Threading;
|
|||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Windows.Threading;
|
||||
using System.Windows;
|
||||
using System.Reflection.PortableExecutable;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -322,6 +323,23 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
item.DrugId = DrugInfo.DrugId.ToString();
|
||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo }).ExecuteCommand();
|
||||
|
||||
int deleteNum = SqlSugarHelper.Db.Deleteable<ChannelStock>()
|
||||
.Where(cs => cs.Chnguid.Equals(item.Id) && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"])).ExecuteCommand();
|
||||
//插入channel_stock表数据
|
||||
SqlSugarHelper.Db.Insertable(new ChannelStock()
|
||||
{
|
||||
Quantity = 0,
|
||||
Chnguid = item.Id,
|
||||
DrawerNo = item.DrawerNo,
|
||||
ColNo = item.ColNo,
|
||||
DrugId = item.DrugId,
|
||||
DrawerType = item.DrawerType,
|
||||
BoardType = item.BoardType,
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
|
||||
}).ExecuteCommand();
|
||||
|
||||
GetChannelsByDrawerNo();
|
||||
|
||||
if (item.BoardType == 5)
|
||||
|
|
|
@ -47,11 +47,11 @@ namespace DM_Weight.ViewModels
|
|||
get => new DelegateCommand(() =>
|
||||
{
|
||||
|
||||
if (Channel != null && Channel.DrugId == null)
|
||||
if (Channel != null &&string.IsNullOrEmpty(Channel.DrugId))
|
||||
{
|
||||
DialogParameters dialogParameters = new DialogParameters();
|
||||
dialogParameters.Add("DrawerNo", Channel.DrawerNo);
|
||||
DialogServiceExtensions.ShowDialogHost(_dialogService, "BindingChannelDialog", dialogParameters, DoDialogResult, "RootDialog");
|
||||
DialogServiceExtensions.ShowDialogHost(_dialogService, "BindingChannelNewDialog", dialogParameters, DoDialogResult, "RootDialog");
|
||||
}
|
||||
else if(Channel != null && Channel.CanReturnQuantity > 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue