交接柜补药页面添加药品分组

This commit is contained in:
maqiao 2024-12-02 10:55:28 +08:00
parent e9a3d6467d
commit afe1866439
2 changed files with 24 additions and 11 deletions

View File

@ -25,11 +25,14 @@ namespace DM_Weight.Port
private static readonly object objLock = new object(); private static readonly object objLock = new object();
private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrderNewWindowViewModel)); private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrderNewWindowViewModel));
public ModbusHelper() public ModbusHelper()
{
if (ConfigurationManager.AppSettings["test"] == null || !(ConfigurationManager.AppSettings["test"].ToString().Equals("Y")))
{ {
socket = MakeKeepALiveSocket(); socket = MakeKeepALiveSocket();
client = new TcpClient(); client = new TcpClient();
client.Client = socket; client.Client = socket;
master = ModbusIpMaster.CreateIp(client); master = ModbusIpMaster.CreateIp(client);
}
} }
public static ModbusHelper GetInstance() public static ModbusHelper GetInstance()

View File

@ -75,6 +75,13 @@ namespace DM_Weight.ViewModels
.OrderBy(cs => cs.Chnguid) .OrderBy(cs => cs.Chnguid)
.OrderBy(cs => cs.DrawerNo) .OrderBy(cs => cs.DrawerNo)
.ToList(); .ToList();
ChannelStocks= ChannelStocks.GroupBy(it=>new {it.DrawerNo,it.DrugId})
.Select(it=>
{
var ret = it.First();
ret.Quantity = it.Sum(itx => itx.Quantity);
return ret;
}).ToList();
ChannelStocks.ForEach(cs => cs.AddQuantity = cs.BaseQuantity - cs.Quantity); ChannelStocks.ForEach(cs => cs.AddQuantity = cs.BaseQuantity - cs.Quantity);
} }
//开药箱放入药品 //开药箱放入药品
@ -129,8 +136,11 @@ namespace DM_Weight.ViewModels
Quantity = jiaojie_it.BaseQuantity, Quantity = jiaojie_it.BaseQuantity,
//ManuNo = it.ManuNo, //ManuNo = it.ManuNo,
//EffDate = it.EffDate, //EffDate = it.EffDate,
Id = jiaojie_it.Id, //Id = jiaojie_it.Id,
}).UpdateColumns(jiaojie_it => new { jiaojie_it.Quantity }).ExecuteCommand(); DrugId=jiaojie_it.DrugId,
DrawerNo=jiaojie_it.DrawerNo,
MachineId=jiaojie_it.MachineId,
}).UpdateColumns(jiaojie_it => new { jiaojie_it.Quantity }).WhereColumns(jiaojie_it=>new { jiaojie_it.DrugId, jiaojie_it.DrawerNo, jiaojie_it.MachineId }).ExecuteCommand();
} }
List<ChannelStock> jiaojie = selectedStock.GroupBy(cs => cs.DrawerNo).Select(cs => cs.FirstOrDefault()).ToList(); List<ChannelStock> jiaojie = selectedStock.GroupBy(cs => cs.DrawerNo).Select(cs => cs.FirstOrDefault()).ToList();