drug_id类型修改为string 添加交接柜补药

This commit is contained in:
maqiao 2024-08-08 16:54:03 +08:00
parent 44fc240bd4
commit 386befcade
20 changed files with 476 additions and 131 deletions

View File

@ -20,7 +20,7 @@ namespace DM_Weight.Models
/// 药品id
/// </summary>
[SugarColumn(ColumnName = "drug_id")]
public int DrugId { get; set; }
public string DrugId { get; set; }
/// <summary>
/// 1领入2发出3日结4总结5转结

View File

@ -109,7 +109,7 @@ namespace DM_Weight.Models
[SugarColumn(IsIgnore = true)]
public string Location
{
get => DrawerNo + "-" + ColNo;
get => ColNo==0? DrawerNo + "号交接柜" : DrawerNo + "-" + ColNo;
}
private int _addQuantity = 0;
[SugarColumn(IsIgnore = true)]

View File

@ -29,6 +29,7 @@ using System.Runtime.InteropServices;
using DM_Weight.Common;
using System.Net;
using System.Text.RegularExpressions;
using Newtonsoft.Json.Linq;
namespace DM_Weight.Port
{
@ -128,7 +129,107 @@ namespace DM_Weight.Port
DrawerNo = 0;
ColNos = new int[] { };
}
#region
/// <summary>
/// 打开抽屉
/// </summary>
/// <param name="ColNo"></param>
/// <returns></returns>
public async Task OpenAllDrawer()
{
byte[] buffer = await OpenDrawer();
int[] r = buffer.Select(it => Convert.ToInt32(it)).ToArray();
logger.Info($"OpenDrawer{string.Join(",", r)}");
if (DrawerState(r))
{
statue = 1;
// 返回消息 抽屉已经打开
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
{
EventType = util.EventType.DRAWEROPEN,
WindowName = WindowName,
});
logger.Info($"抽屉【{DrawerNo}】打开成功");
// 查询抽屉状态
await Task.Delay(200);
}
else
{
string _WindowName = WindowName;
// 重新初始化数据
ResetData();
// 返回消息 抽屉打开失败
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
{
EventType = util.EventType.OPENERROR,
WindowName = WindowName,
Message = $"抽屉【{DrawerNo}】打开失败"
});
logger.Info($"抽屉【{DrawerNo}】打开失败");
}
}
/// <summary>
/// 查询抽屉状态
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
public async Task GetAllDrawerLockState()
{
try
{
if (Operate)
{
// 查询抽屉状态
byte[] buffer = await CheckDrawerStatus();
int[] r = buffer.Select(it => Convert.ToInt32(it)).ToArray();
logger.Info($"GetAllDrawerLockState{string.Join(",", r)}");
int[] subArray=new int[8];
for(int i=0;i<8;i++)
{
subArray[i] = r[2 + i];
}
bool state= subArray.All(r => r > 0);
if(state)
{
//抽屉全部关闭
string _WindowName = WindowName;
// 重新初始化数据
ResetData();
// 返回消息 抽屉已经关闭
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
{
EventType = util.EventType.DRAWERCLOSE,
WindowName = _WindowName,
});
logger.Info($"抽屉【{DrawerNo}】已关闭");
}
else
{
// 继续监听抽屉状态
await Task.Delay(200);
GetAllDrawerLockState();
}
}
}
catch (Exception ex)
{
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
{
EventType = util.EventType.OPENERROR,
WindowName = WindowName,
Message = $"GetDrawerStatus异常{ex.Message}"
});
logger.Info($"GetDrawerStatus异常{ex.Message}");
}
}
#endregion
public async void Start()
{

View File

@ -752,7 +752,7 @@ namespace DM_Weight.ViewModels
//保存账册
SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(stock.DrugId),
DrugId = stock.DrugId,
Type = 1,
Department = ConfigurationManager.AppSettings["department"].ToString(),
InvoiceNo = InvoiceId,
@ -770,7 +770,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(stock.MachineId))
.Where(ab => ab.Type == 3)
.Where(ab => ab.DrugId == Convert.ToInt32(stock.DrugId))
.Where(ab => ab.DrugId == stock.DrugId)
.Where(ab => ab.ManuNo == stock.ManuNo)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
@ -783,7 +783,7 @@ namespace DM_Weight.ViewModels
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(stock.DrugId),
DrugId = stock.DrugId,
Type = 3,
ManuNo = stock.ManuNo,
EffDate = stock.EffDate,
@ -805,7 +805,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(stock.MachineId))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == Convert.ToInt32(stock.DrugId))
.Where(ab => ab.DrugId == stock.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
@ -817,7 +817,7 @@ namespace DM_Weight.ViewModels
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(stock.DrugId),
DrugId = stock.DrugId,
Type = 4,
YQuantity = 0,
ManuStock = stock.ReturnQuantity,

View File

@ -21,6 +21,42 @@ namespace DM_Weight.ViewModels
public class AddToJiaoJieDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
{
private readonly ILog logger = LogManager.GetLogger(typeof(OrderTakeDialogViewModel));
private List<ChannelStock> _channelStocks=new List<ChannelStock>();
public List<ChannelStock> ChannelStocks
{
get => _channelStocks;
set => SetProperty(ref _channelStocks, value);
}
/// <summary>
/// 交接柜的库位信息
/// </summary>
private List<ChannelStock> _jiaojei_channelStocks;
public List<ChannelStock> Jiaojie_ChannelStocks
{
get => _jiaojei_channelStocks;
set => SetProperty(ref _jiaojei_channelStocks, value);
}
/// <summary>
/// 交接柜的库位信息
/// </summary>
private ChannelStock _jiaojei_cs;
public ChannelStock Jiaojie_cs
{
get => _jiaojei_cs;
set => SetProperty(ref _jiaojei_cs, value);
}
private static readonly DateTime Jan1st1970 = new DateTime
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
private IEnumerable<IGrouping<int, ChannelStock>> enumerable;
private IEnumerator<IGrouping<int, ChannelStock>> enumerator;
public string Title => "交接柜补药";
public bool KeepAlive => false;
@ -41,21 +77,20 @@ namespace DM_Weight.ViewModels
public void OnDialogOpened(IDialogParameters parameters)
{
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
ChannelStocks = parameters.GetValue<List<ChannelStock>>("ChannelStocks");
Jiaojie_ChannelStocks = parameters.GetValue<List<ChannelStock>>("ChannelStocks");
for (int i = 0; i < Jiaojie_ChannelStocks.Count; i++)
{
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(Jiaojie_ChannelStocks[i]);
ChannelStocks.Add(copy);
}
ChannelStocks = Jiaojie_ChannelStocks.GroupBy(cs => cs.DrugId).Select(g => new
{
DrugId = g.Key,
AddQuantity = g.Sum(s => s.AddQuantity)
}).Select(cs => new ChannelStock() { DrugId = cs.DrugId, AddQuantity = cs.AddQuantity }).ToList();
RequestData();
}
private List<ChannelStock> _channelStocks;
public List<ChannelStock> ChannelStocks
{
get => _channelStocks;
set => SetProperty(ref _channelStocks, value);
}
private static readonly DateTime Jan1st1970 = new DateTime
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
private IEnumerable<IGrouping<int, ChannelStock>> enumerable;
private IEnumerator<IGrouping<int, ChannelStock>> enumerator;
private PortUtil _portUtil;
IEventAggregator _eventAggregator;
@ -158,13 +193,13 @@ namespace DM_Weight.ViewModels
.Includes<DrugInfo>(cs => cs.DrugInfo)
.Where(cs => cs.Quantity > 0)
.Where(cs => cs.DrawerType == 1)
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3"))
.Where(cs => cs.DrugId == ChannelStocks[i].DrugId)
.OrderBy(cs => cs.EffDate)
.OrderBy(cs => cs.DrawerNo)
.ToList();
int total = HasQChannels.Sum(it => it.Quantity);
int TakeQ = ChannelStocks[i].Quantity;
int TakeQ = ChannelStocks[i].AddQuantity;
// 说明数量足够
if (total >= TakeQ)
{
@ -189,30 +224,30 @@ namespace DM_Weight.ViewModels
{
msg.Add($"药品【{ChannelStocks[i].DrugInfo.DrugName}】库存不足,应取【{TakeQ}】库存【{total}】");
}
if (msg.Count > 0)
{
RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
//MessageBox.Show(string.Join("\n", msg));
DialogParameters dialogParameters = new DialogParameters();
dialogParameters.Add("msgInfo", msg);
DialogServiceExtensions.ShowDialogHost(_dialogService, "ShowMessageDialog", dialogParameters, "RootDialog");
}
else
}
if (msg.Count > 0)
{
RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
//MessageBox.Show(string.Join("\n", msg));
DialogParameters dialogParameters = new DialogParameters();
dialogParameters.Add("msgInfo", msg);
DialogServiceExtensions.ShowDialogHost(_dialogService, "ShowMessageDialog", dialogParameters, "RootDialog");
}
else
{
channelStocks.Sort((a, b) =>
{
channelStocks.Sort((a, b) =>
if ((a.DrawerNo - b.DrawerNo) == 0)
{
if ((a.DrawerNo - b.DrawerNo) == 0)
{
return a.ColNo - b.ColNo;
}
return a.DrawerNo - b.DrawerNo;
});
ChannelStocks = channelStocks;
return a.ColNo - b.ColNo;
}
return a.DrawerNo - b.DrawerNo;
});
ChannelStocks = channelStocks;
}
}
}
public DelegateCommand OpenDrawer
@ -295,15 +330,25 @@ namespace DM_Weight.ViewModels
Id = it.Id,
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
// 更新数据 交接柜 库存信息
SqlSugarHelper.Db.Updateable(new ChannelStock()
//更新 交接柜 库存信息
List<ChannelStock> jiaojie = Jiaojie_ChannelStocks.Where(cs=>cs.DrugId== it.DrugId).ToList();
if(jiaojie!=null&&jiaojie.Count>0)
{
Quantity = it.Quantity - it.TakeQuantity,
ManuNo = it.ManuNo,
EffDate = it.EffDate,
Id = it.Id,
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
for (int j = 0; j < jiaojie.Count; j++)
{
// 更新数据 交接柜 库存信息
ChannelStock jiaojie_it = jiaojie[j];
SqlSugarHelper.Db.Updateable(new ChannelStock()
{
Quantity = jiaojie_it.BaseQuantity,
//ManuNo = it.ManuNo,
//EffDate = it.EffDate,
Id = jiaojie_it.Id,
}).UpdateColumns(jiaojie_it => new { jiaojie_it.Quantity}).ExecuteCommand();
}
}
// 保存数据 出库记录
SqlSugarHelper.Db.Insertable(new MachineRecord()
{

View File

@ -21,7 +21,13 @@ namespace DM_Weight.ViewModels
{
public class AddToJiaoJieWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
{
private readonly ILog logger = LogManager.GetLogger(typeof(AddToJiaoJieWindowViewModel));
private readonly ILog logger = LogManager.GetLogger(typeof(AddToJiaoJieWindowViewModel));
private static readonly DateTime Jan1st1970 = new DateTime
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public long CurrentTimeMillis()
{
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
}
public bool KeepAlive => false;
public bool IsNavigationTarget(NavigationContext navigationContext)
{
@ -109,7 +115,7 @@ namespace DM_Weight.ViewModels
//_portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
//_portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
_portUtil.DrawerNo = iDrawerNoLst[CurrentNum];
_portUtil.Start();
_portUtil.OpenAllDrawer();
}
catch (Exception ex)
@ -145,7 +151,11 @@ namespace DM_Weight.ViewModels
_portUtil.WindowName = "AddToJiaoJieWindow";
_portUtil.Operate = true;
_portUtil.DrawerNo = iDrawerNoLst[CurrentNum];
_portUtil.Start();
_portUtil.OpenAllDrawer();
}
else
{
_portUtil.GetAllDrawerLockState();
}
break;
// 抽屉关闭
@ -184,13 +194,190 @@ namespace DM_Weight.ViewModels
}
//完成按钮
//public DelegateCommand AddFinish
//{
// get => new DelegateCommand(() =>
// {
// });
//}
public DelegateCommand AddFinish
{
get => new DelegateCommand(() =>
{
if(ChannelStocks.FindAll(cs=>cs.ChannelLst.IsSelected).Count<=0)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "请选择药箱",
Type = MsgType.SUCCESS,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
List<ChannelStock> jiaojieStocks = new List<ChannelStock>();
List<ChannelStock> cs = ChannelStocks.FindAll(cs => cs.ChannelLst.IsSelected).ToList();
for (int i = 0; i < cs.Count; i++)
{
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(cs[i]);
jiaojieStocks.Add(copy);
}
csList = jiaojieStocks.FindAll(cs => cs.ChannelLst.IsSelected).GroupBy(cs => cs.DrugId).Select(g => new
{
DrugId = g.Key,
AddQuantity = g.Sum(s => s.AddQuantity)
}).Select(cs => new ChannelStock() { DrugId = cs.DrugId, AddQuantity = cs.AddQuantity }).ToList();
List<ChannelStock> channelStocks = new List<ChannelStock>();
List<string> msg = new List<string>();
for (int i = 0; i < csList.Count; i++)
{
List<ChannelStock> HasQChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Includes<DrugInfo>(cs => cs.DrugInfo)
.Where(cs => cs.Quantity > 0)
.Where(cs => cs.DrawerType == 1)
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3"))
.Where(cs => cs.DrugId == csList[i].DrugId)
.OrderBy(cs => cs.EffDate)
.OrderBy(cs => cs.DrawerNo)
.ToList();
int total = HasQChannels.Sum(it => it.Quantity);
int TakeQ = csList[i].AddQuantity;
// 说明数量足够
if (total >= TakeQ)
{
for (int j = 0; TakeQ > 0; j++)
{
ChannelStock stock = HasQChannels[j];
if (TakeQ > stock.Quantity)
{
stock.TakeQuantity = stock.Quantity;
channelStocks.Add(stock);
TakeQ -= stock.Quantity;
}
else
{
stock.TakeQuantity = TakeQ;
channelStocks.Add(stock);
TakeQ = 0;
}
}
}
else
{
msg.Add($"药品【{ChannelStocks[i].DrugInfo.DrugName}】库存不足,应取【{TakeQ}】库存【{total}】");
}
}
if (msg.Count > 0)
{
DialogParameters dialogParameters = new DialogParameters();
dialogParameters.Add("msgInfo", msg);
DialogServiceExtensions.ShowDialogHost(_dialogService, "ShowMessageDialog", dialogParameters, "RootDialog");
return;
}
else
{
channelStocks.Sort((a, b) =>
{
if ((a.DrawerNo - b.DrawerNo) == 0)
{
return a.ColNo - b.ColNo;
}
return a.DrawerNo - b.DrawerNo;
});
}
List<ChannelStock> record = channelStocks.FindAll(it => it.TakeQuantity > 0).ToList();
if (record.Count > 0)
{
string InvoiceId = "AddJiaoJie_" + CurrentTimeMillis();
var f = SqlSugarHelper.Db.UseTran(() =>
{
for (int i = 0; i < record.Count; i++)
{
ChannelStock it = record[i];
// 更新数据 库存信息
SqlSugarHelper.Db.Updateable(new ChannelStock()
{
Quantity = it.Quantity - it.TakeQuantity,
ManuNo = it.ManuNo,
EffDate = it.EffDate,
Id = it.Id,
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
//更新 交接柜 库存信息
List<ChannelStock> jiaojie = jiaojieStocks.Where(cs => cs.DrugId == it.DrugId).ToList();
if (jiaojie != null && jiaojie.Count > 0)
{
for (int j = 0; j < jiaojie.Count; j++)
{
// 更新数据 交接柜 库存信息
ChannelStock jiaojie_it = jiaojie[j];
SqlSugarHelper.Db.Updateable(new ChannelStock()
{
Quantity = jiaojie_it.BaseQuantity,
//ManuNo = it.ManuNo,
//EffDate = it.EffDate,
Id = jiaojie_it.Id,
}).UpdateColumns(jiaojie_it => new { jiaojie_it.Quantity }).ExecuteCommand();
}
}
// 保存数据 出库记录
SqlSugarHelper.Db.Insertable(new MachineRecord()
{
MachineId = it.MachineId,
DrawerNo = it.DrawerNo,
ColNo = it.ColNo,
DrugId = it.DrugId,
ManuNo = it.ManuNo,
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
Operator = HomeWindowViewModel.Operator?.Id,
Reviewer = HomeWindowViewModel.Reviewer?.Id,
OperationTime = DateTime.Now,
Quantity = it.TakeQuantity,
Type = 2,
InvoiceId = InvoiceId
}).ExecuteCommand();
}
return true;
});
if (f.Data)
{
// 更新屏显库存
List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 5);
if (singleChannels.Count > 0)
{
singleChannels.ForEach(it =>
{
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
});
}
AlertMsg alertMsg = new AlertMsg
{
Message = "补药完成,库存已更新",
Type = MsgType.SUCCESS,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
RequestData();
}
if (!f.IsSuccess)
{
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 DelegateCommand CancleAdd
@ -210,11 +397,14 @@ namespace DM_Weight.ViewModels
{
get => new DelegateCommand(async () =>
{
csList = ChannelStocks.FindAll(cs => cs.IsSelected == true).GroupBy(cs => cs.DrugId).Select(g => new {
DrugId = g.Key, Quantity = g.Sum(s => s.Quantity)
}).Select(cs=>new ChannelStock() { DrugId=cs.DrugId,Quantity=cs.Quantity}).ToList();
//选中channelStock.channel_list的isSelected则选中channelStock的isSelected
//var o= ChannelStocks.FindAll(cs => cs.ChannelLst.IsSelected).ToList();
//csList = ChannelStocks.FindAll(cs => cs.ChannelLst.IsSelected).GroupBy(cs => cs.DrugId).Select(g => new {
// DrugId = g.Key, AddQuantity = g.Sum(s => s.AddQuantity)
//}).Select(cs=>new ChannelStock() { DrugId=cs.DrugId,AddQuantity=cs.AddQuantity }).ToList();
csList= ChannelStocks.FindAll(cs => cs.ChannelLst.IsSelected).ToList();
if (csList != null && csList.Count>0)
{

View File

@ -654,7 +654,7 @@ namespace DM_Weight.ViewModels
int iInsertResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 1,
Department = dept,
OrderNo = SelectDrugPleaseClaim.PleaseNo,
@ -673,7 +673,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 3)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.ManuNo == it.ManuNo)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
@ -686,7 +686,7 @@ namespace DM_Weight.ViewModels
{
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2() {
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type=3,
ManuNo=it.ManuNo,
EffDate=it.EffDate,
@ -709,7 +709,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
@ -721,7 +721,7 @@ namespace DM_Weight.ViewModels
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
ManuStock = it.AddQuantity,

View File

@ -224,7 +224,7 @@ namespace DM_Weight.ViewModels
//保存账册
SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 1,
Department = ConfigurationManager.AppSettings["department"].ToString(),
InvoiceNo = InvoiceId,
@ -242,7 +242,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 3)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.ManuNo == it.ManuNo)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
@ -255,7 +255,7 @@ namespace DM_Weight.ViewModels
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 3,
ManuNo = it.ManuNo,
EffDate = it.EffDate,
@ -277,7 +277,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
@ -289,7 +289,7 @@ namespace DM_Weight.ViewModels
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
ManuStock = it.AddQuantity,

View File

@ -223,7 +223,7 @@ namespace DM_Weight.ViewModels
//保存账册
SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 2,
Department = ConfigurationManager.AppSettings["department"].ToString(),
InvoiceNo = InvoiceId,
@ -241,7 +241,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 3)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.ManuNo == it.ManuNo)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
@ -254,7 +254,7 @@ namespace DM_Weight.ViewModels
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 3,
ManuNo = it.ManuNo,
EffDate = it.EffDate,
@ -276,7 +276,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
@ -288,7 +288,7 @@ namespace DM_Weight.ViewModels
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
ManuStock = it.TakeQuantity,

View File

@ -294,7 +294,7 @@ namespace DM_Weight.ViewModels
//保存账册
SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 1,
Department = ConfigurationManager.AppSettings["department"].ToString(),
InvoiceNo = InvoiceId,
@ -312,7 +312,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 3)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.ManuNo == it.ManuNo)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
@ -325,7 +325,7 @@ namespace DM_Weight.ViewModels
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 3,
ManuNo = it.ManuNo,
EffDate = it.EffDate,
@ -347,7 +347,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
@ -359,7 +359,7 @@ namespace DM_Weight.ViewModels
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
ManuStock = it.AddQuantity,

View File

@ -356,7 +356,7 @@ namespace DM_Weight.ViewModels
//保存账册
SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 2,
Department = ConfigurationManager.AppSettings["department"].ToString(),
InvoiceNo = InvoiceId,
@ -374,7 +374,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 3)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.ManuNo == it.ManuNo)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
@ -387,7 +387,7 @@ namespace DM_Weight.ViewModels
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 3,
ManuNo = it.ManuNo,
EffDate = it.EffDate,
@ -409,7 +409,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
@ -421,7 +421,7 @@ namespace DM_Weight.ViewModels
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
ManuStock = it.TakeQuantity,

View File

@ -354,7 +354,7 @@ namespace DM_Weight.ViewModels
//保存账册
SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 1,
Department = ConfigurationManager.AppSettings["department"].ToString(),
InvoiceNo = InvoiceId,
@ -372,7 +372,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 3)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.ManuNo == it.ManuNo)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
@ -385,7 +385,7 @@ namespace DM_Weight.ViewModels
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 3,
ManuNo = it.ManuNo,
EffDate = it.EffDate,
@ -407,7 +407,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
@ -419,7 +419,7 @@ namespace DM_Weight.ViewModels
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
ManuStock = it.ReturnQuantity,

View File

@ -468,7 +468,7 @@ namespace DM_Weight.ViewModels
//保存账册
int iInsertResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(orderDetail.DrugId),
DrugId = orderDetail.DrugId,
Type = 2,
Department = orderInfo.DeptName,
OrderNo = orderDetail.OrderNo,
@ -487,7 +487,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(ConfigurationManager.AppSettings["machineId"].ToString()))
.Where(ab => ab.Type == 3)
.Where(ab => ab.DrugId == Convert.ToInt32(orderDetail.DrugId))
.Where(ab => ab.DrugId == orderDetail.DrugId)
.Where(ab => ab.ManuNo == cs.ManuNo)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
@ -500,7 +500,7 @@ namespace DM_Weight.ViewModels
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(orderDetail.DrugId),
DrugId = orderDetail.DrugId,
Type = 3,
ManuNo = cs.ManuNo,
EffDate = cs.EffDate,
@ -522,7 +522,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(ConfigurationManager.AppSettings["machineId"].ToString()))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == Convert.ToInt32(orderDetail.DrugId))
.Where(ab => ab.DrugId == orderDetail.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
@ -534,7 +534,7 @@ namespace DM_Weight.ViewModels
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(orderDetail.DrugId),
DrugId = orderDetail.DrugId,
Type = 4,
YQuantity = 0,
ManuStock = orderDetail.Quantity,

View File

@ -375,7 +375,7 @@ namespace DM_Weight.ViewModels
//保存账册
int iInsertResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 2,
Department = OrderInfo.DeptName,
OrderNo = OrderInfo.OrderNo,
@ -394,7 +394,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 3)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.ManuNo == it.ManuNo)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
@ -407,7 +407,7 @@ namespace DM_Weight.ViewModels
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 3,
ManuNo = it.ManuNo,
EffDate = it.EffDate,
@ -428,8 +428,8 @@ namespace DM_Weight.ViewModels
//修改凌晨生成的日结存与总结存数据
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
@ -441,7 +441,7 @@ namespace DM_Weight.ViewModels
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
ManuStock = it.TakeQuantity,

View File

@ -275,7 +275,7 @@ namespace DM_Weight.ViewModels
//保存账册
SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(ChannelStock.DrugId),
DrugId = ChannelStock.DrugId,
Type = 1,
Department = ConfigurationManager.AppSettings["department"].ToString(),
InvoiceNo = InvoiceId,
@ -293,7 +293,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(ChannelStock.MachineId))
.Where(ab => ab.Type == 3)
.Where(ab => ab.DrugId == Convert.ToInt32(ChannelStock.DrugId))
.Where(ab => ab.DrugId == ChannelStock.DrugId)
.Where(ab => ab.ManuNo == ChannelStock.ManuNo)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
@ -306,7 +306,7 @@ namespace DM_Weight.ViewModels
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(ChannelStock.DrugId),
DrugId = ChannelStock.DrugId,
Type = 3,
ManuNo = ChannelStock.ManuNo,
EffDate = ChannelStock.EffDate,
@ -328,7 +328,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(ChannelStock.MachineId))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == Convert.ToInt32(ChannelStock.DrugId))
.Where(ab => ab.DrugId == ChannelStock.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
@ -340,7 +340,7 @@ namespace DM_Weight.ViewModels
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(ChannelStock.DrugId),
DrugId = ChannelStock.DrugId,
Type = 4,
YQuantity = 0,
ManuStock = ChannelStock.ReturnQuantity,

View File

@ -283,7 +283,7 @@ namespace DM_Weight.ViewModels
//保存账册
SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 1,
Department = ConfigurationManager.AppSettings["department"].ToString(),
InvoiceNo = InvoiceId,
@ -301,7 +301,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 3)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.ManuNo == it.ManuNo)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
@ -314,7 +314,7 @@ namespace DM_Weight.ViewModels
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 3,
ManuNo = it.ManuNo,
EffDate = it.EffDate,
@ -336,7 +336,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
@ -349,7 +349,7 @@ namespace DM_Weight.ViewModels
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
ManuStock = it.AddQuantity,

View File

@ -260,7 +260,7 @@ namespace DM_Weight.ViewModels
//保存账册
SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 2,
Department = ConfigurationManager.AppSettings["department"].ToString(),
InvoiceNo = InvoiceId,
@ -278,7 +278,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 3)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.ManuNo == it.ManuNo)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
@ -291,7 +291,7 @@ namespace DM_Weight.ViewModels
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 3,
ManuNo = it.ManuNo,
EffDate = it.EffDate,
@ -313,7 +313,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(it.MachineId))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == Convert.ToInt32(it.DrugId))
.Where(ab => ab.DrugId == it.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
@ -325,7 +325,7 @@ namespace DM_Weight.ViewModels
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(it.DrugId),
DrugId = it.DrugId,
Type = 4,
YQuantity = 0,
ManuStock = it.TakeQuantity,

View File

@ -198,11 +198,12 @@ namespace DM_Weight.ViewModels
ChannelStocks.Clear();
List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
.Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
.Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1).Where(cs => (cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3")|| cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"] ?? "DM5")) && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
.WhereIF(!String.IsNullOrEmpty(SearchValue), di => di.DrugName == SearchValue)
.Where(di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3") && cs.DrugId != null))
.Where(di => di.channelStocks.Any(cs => (cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3")|| cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"] ?? "DM5")) && cs.DrugId != null))
.OrderBy(cs => cs.DrugId)
.ToList();
Drugs = q;
}

View File

@ -673,7 +673,7 @@ namespace DM_Weight.ViewModels
//保存账册
SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(stock.DrugId),
DrugId = stock.DrugId,
Type = 1,
Department = ConfigurationManager.AppSettings["department"].ToString(),
InvoiceNo = InvoiceId,
@ -691,7 +691,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(stock.MachineId))
.Where(ab => ab.Type == 3)
.Where(ab => ab.DrugId == Convert.ToInt32(stock.DrugId))
.Where(ab => ab.DrugId == stock.DrugId)
.Where(ab => ab.ManuNo == stock.ManuNo)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
@ -704,7 +704,7 @@ namespace DM_Weight.ViewModels
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(stock.DrugId),
DrugId = stock.DrugId,
Type = 3,
ManuNo = stock.ManuNo,
EffDate = stock.EffDate,
@ -726,7 +726,7 @@ namespace DM_Weight.ViewModels
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(stock.MachineId))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == Convert.ToInt32(stock.DrugId))
.Where(ab => ab.DrugId == stock.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
@ -738,7 +738,7 @@ namespace DM_Weight.ViewModels
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = Convert.ToInt32(stock.DrugId),
DrugId = stock.DrugId,
Type = 4,
YQuantity = 0,
ManuStock = stock.ReturnQuantity,

View File

@ -34,7 +34,7 @@
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
<Button
Margin="6 0 0 0"
Margin="6 0 6 0"
ToolTip="一键补药"
Content="一键补药"
Command="{Binding OpenDragCommand}"
@ -43,11 +43,11 @@
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
Style="{StaticResource MaterialDesignOutlinedLightButton}" />
<Button
Margin="0 0 3 0"
VerticalAlignment="Center"
Command="{Binding TakeDrugCommand}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
Content="取药" />
Margin="0 0 6 0"
Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
Content="完成"
Command="{Binding AddFinish}"/>
<Button
Margin="0 0 6 0"
@ -56,6 +56,14 @@
Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CancelBtn}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
Content="取消" />
<Button
Margin="3 0 3 0"
VerticalAlignment="Center"
Command="{Binding TakeDrugCommand}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
Content="取药" />
<Button
Margin="6 0 6 0"
VerticalAlignment="Center"