写标签添加写批次效期

This commit is contained in:
maqiao 2025-05-27 14:01:29 +08:00
parent db6eb0c339
commit d58b9967a9
9 changed files with 179 additions and 73 deletions

View File

@ -1036,6 +1036,7 @@ namespace DM_Weight.Port
#region 2.4
// 基础数据写入方法
//三色灯写标签type:1药品名称;2规格;5批次;6效期;8厂家
public void WriteChannelInfo(int type, string content, int drawerNo, int colNo)
{
try

View File

@ -565,6 +565,8 @@ namespace DM_Weight.ViewModels
}
else
{
//查询绑定库位的最近效期绑定到标签
ChannelStock cs = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == item.DrawerNo && cs.ColNo == item.ColNo&&cs.Quantity>0).OrderBy(cs => cs.EffDate).First();
DrugInfo drugSelected = item.Drug ?? new DrugInfo();
_portUtil.WindowName = "BindingChannelDialog";
// 向显示屏写入库位信息
@ -574,6 +576,10 @@ namespace DM_Weight.ViewModels
Thread.Sleep(200);
_portUtil.WriteChannelInfo(8, drugSelected.Manufactory == null ? "" : drugSelected.Manufactory.Length > 10 ? drugSelected.Manufactory.Substring(0, 10) : drugSelected.Manufactory, item.DrawerNo, item.ColNo);
Thread.Sleep(200);
_portUtil.WriteChannelInfo(5, (cs==null||cs.EffDate == null) ? "" : cs.EffDate, item.DrawerNo, item.ColNo);
Thread.Sleep(200);
_portUtil.WriteChannelInfo(6, (cs == null || cs.ManuNo == null) ? "" : cs.ManuNo, item.DrawerNo, item.ColNo);
Thread.Sleep(200);
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
Thread.Sleep(200);
_portUtil.WriteQuantity(item.DrawerNo, item.ColNo, item.totalCount);

View File

@ -531,7 +531,7 @@ namespace DM_Weight.ViewModels
{
// 更新屏显库存
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType == 5)
List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType == 5&&it.CheckQuantity>0).OrderBy(it => it.EffDate)
.GroupBy(it => new
{
it.DrawerNo,
@ -547,9 +547,16 @@ namespace DM_Weight.ViewModels
{
singleChannels.ForEach(it =>
{
//将库位多批次的总库存数更新标签
_portUtil.WriteChannelInfo(6, it.EffDate == null ? "" : it.EffDate, it.DrawerNo, it.ColNo);
Thread.Sleep(200);
_portUtil.WriteChannelInfo(5, it.ManuNo, it.DrawerNo, it.ColNo);
Thread.Sleep(200);
// 将库位多批次的总库存数更新标签
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
Thread.Sleep(200);
_portUtil.ShowContent(it.DrawerNo, it.ColNo);
Thread.Sleep(200);
});
}
@ -722,7 +729,7 @@ namespace DM_Weight.ViewModels
List<ChannelStock> q = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Includes<DrugInfo>(cs => cs.DrugInfo)
.InnerJoin<ChannelList>((cs, cl) => cs.Chnguid == cl.Id && cs.DrugId == cl.DrugId)
.Where(cs => cs.DrawerType == 1)
.Where(cs => cs.DrawerType == 1&&cs.DrawerNo==11)
.Where(cs => cs.DrugId != null)
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
.WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉双人登录开后8个抽屉

View File

@ -646,7 +646,7 @@ namespace DM_Weight.ViewModels
List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
.Where(cs => cs.ColNo == singleChannels[i].ColNo&&cs.Quantity>0)
.OrderBy(cs => cs.EffDate).ToList();
int totalQuantity = channelStockEffDate.Sum(it => it.Quantity);

View File

@ -160,23 +160,29 @@ _exitCommand ??= new DelegateCommand(Exit);
if (userList == null)
{
AlertMsg alertMsg = new AlertMsg
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
{
Message = "无此用户",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
AlertMsg alertMsg = new AlertMsg
{
Message = "无此用户",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}));
Username = "";
Password = "";
}
else if (userList.Role == null)
{
AlertMsg alertMsg = new AlertMsg
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
{
Message = "用户还未设置权限,请联系管理员",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
AlertMsg alertMsg = new AlertMsg
{
Message = "用户还未设置权限,请联系管理员",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}));
Username = "";
Password = "";
}
@ -189,12 +195,15 @@ _exitCommand ??= new DelegateCommand(Exit);
}
else
{
AlertMsg alertMsg = new AlertMsg
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
{
Message = "密码错误",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
AlertMsg alertMsg = new AlertMsg
{
Message = "密码错误",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}));
Password = "";
}
}
@ -202,12 +211,15 @@ _exitCommand ??= new DelegateCommand(Exit);
}
else
{
AlertMsg alertMsg = new AlertMsg
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
{
Message = "请输入账号或密码",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
AlertMsg alertMsg = new AlertMsg
{
Message = "请输入账号或密码",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}));
}
LoginBtnEnable = true;
}
@ -253,12 +265,15 @@ _exitCommand ??= new DelegateCommand(Exit);
}
else
{
AlertMsg alertMsg = new AlertMsg
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
{
Message = "该发药人账号已登录,请输入不同账号",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
AlertMsg alertMsg = new AlertMsg
{
Message = "该发药人账号已登录,请输入不同账号",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}));
}
}
// 如果已经录入了审核人, 已经有一个用户登录
@ -282,12 +297,15 @@ _exitCommand ??= new DelegateCommand(Exit);
}
else
{
AlertMsg alertMsg = new AlertMsg
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
{
Message = "该审核人账号已登录,请输入不同账号",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
AlertMsg alertMsg = new AlertMsg
{
Message = "该审核人账号已登录,请输入不同账号",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}));
}
}
// 第一个用户登录
@ -350,23 +368,29 @@ _exitCommand ??= new DelegateCommand(Exit);
logger.Info($"userList是空{userList == null}");
if (userList == null)
{
AlertMsg alertMsg = new AlertMsg
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
{
Message = "无此用户",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
AlertMsg alertMsg = new AlertMsg
{
Message = "无此用户",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}));
Username = "";
Password = "";
}
else if (userList.Role == null)
{
AlertMsg alertMsg = new AlertMsg
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
{
Message = "用户还未设置权限,请联系管理员",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
AlertMsg alertMsg = new AlertMsg
{
Message = "用户还未设置权限,请联系管理员",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}));
Username = "";
Password = "";
}

View File

@ -526,14 +526,36 @@ namespace DM_Weight.ViewModels
//});
// 更新屏显库存
List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType == 5);
if (singleChannels.Count > 0)
{
singleChannels.ForEach(it =>
for (int i = 0; i < singleChannels.Count; i++)
{
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
Thread.Sleep(200);
});
List<ChannelStock> csList = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
.Where(cs => cs.ColNo == singleChannels[i].ColNo && cs.Quantity > 0).OrderBy(cs => cs.EffDate).ToList();
if (csList != null && csList.Count > 0)
{
int totalQuantity = csList.Sum(c => c.Quantity);
_portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo);
Thread.Sleep(200);
_portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo);
Thread.Sleep(200);
_portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo);
Thread.Sleep(200);
_portUtil.WriteQuantity(csList[0].DrawerNo, csList[0].ColNo, totalQuantity);
Thread.Sleep(200);
}
// singleChannels.ForEach(it =>
//{
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
// Thread.Sleep(200);
//});
}
}
AlertMsg alertMsg = new AlertMsg
{

View File

@ -433,14 +433,32 @@ namespace DM_Weight.ViewModels
{
if (singleChannels[i].BoardType == 5)
{
int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
.Sum(it => it.Quantity);
//将库位多批次的总库存数更新标签
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
Thread.Sleep(200);
List<ChannelStock> csList = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
.Where(cs => cs.ColNo == singleChannels[i].ColNo && cs.Quantity > 0).OrderBy(cs => cs.EffDate).ToList();
if (csList != null && csList.Count > 0)
{
int totalQuantity = csList.Sum(c => c.Quantity);
_portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo);
Thread.Sleep(200);
_portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo);
Thread.Sleep(200);
_portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo);
Thread.Sleep(200);
//将库位多批次的总库存数更新标签
_portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity);
Thread.Sleep(200);
}
// int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
// .Where(cs => cs.MachineId == singleChannels[i].MachineId)
// .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
// .Where(cs => cs.ColNo == singleChannels[i].ColNo)
// .Sum(it => it.Quantity);
////将库位多批次的总库存数更新标签
//_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
//Thread.Sleep(200);
}
}
}

View File

@ -453,14 +453,31 @@ namespace DM_Weight.ViewModels
{
if (singleChannels[i].BoardType == 5)
{
int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
.Sum(it => it.Quantity);
//将库位多批次的总库存数更新标签
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
Thread.Sleep(200);
List<ChannelStock> csList = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
.Where(cs => cs.ColNo == singleChannels[i].ColNo&&cs.Quantity>0).OrderBy(cs => cs.EffDate).ToList();
if (csList != null && csList.Count > 0)
{
int totalQuantity = csList.Sum(c => c.Quantity);
//SqlSugarHelper.Db.Queryable<ChannelStock>()
// .Where(cs => cs.MachineId == singleChannels[i].MachineId)
// .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
// .Where(cs => cs.ColNo == singleChannels[i].ColNo)
// .Sum(it => it.Quantity);
_portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo);
Thread.Sleep(200);
_portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo);
Thread.Sleep(200);
_portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo);
Thread.Sleep(200);
//将库位多批次的总库存数更新标签
_portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity);
Thread.Sleep(200);
}
}
}
}

View File

@ -375,14 +375,25 @@ namespace DM_Weight.ViewModels
{
if (singleChannels[i].BoardType == 5)
{
int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
.Sum(it => it.Quantity);
//将库位多批次的总库存数更新标签
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
Thread.Sleep(200);
List<ChannelStock> csList = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
.Where(cs => cs.ColNo == singleChannels[i].ColNo && cs.Quantity > 0).OrderBy(cs => cs.EffDate).ToList();
if (csList != null && csList.Count > 0)
{
int totalQuantity = csList.Sum(c => c.Quantity);
_portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo);
Thread.Sleep(200);
_portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo);
Thread.Sleep(200);
_portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo);
Thread.Sleep(200);
//将库位多批次的总库存数更新标签
_portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity);
Thread.Sleep(200);
}
}
}
}