diff --git a/DM_Weight/App.config b/DM_Weight/App.config index 094073c..9002993 100644 --- a/DM_Weight/App.config +++ b/DM_Weight/App.config @@ -37,7 +37,7 @@ - + diff --git a/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs b/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs index 1374bcc..14d8cc1 100644 --- a/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs +++ b/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs @@ -459,7 +459,7 @@ namespace DM_Weight.ViewModels //不够取 ChannelStock newStock = new ChannelStock(); //newStock.Chnguid = jiaoStock.Chnguid; - //newStock.BaseQuantity = jiaoStock.BaseQuantity; + newStock.BaseQuantity = jiaoStock.BaseQuantity; newStock.ManuNo = Jiaojie_ChannelStocks[i].ManuNo; newStock.EffDate = Jiaojie_ChannelStocks[i].EffDate; newStock.DrawerNo = Jiaojie_ChannelStocks[i].DrawerNo; @@ -485,7 +485,7 @@ namespace DM_Weight.ViewModels ChannelStock newStock = new ChannelStock(); //newStock.Chnguid = jiaoStock.Chnguid; - //newStock.BaseQuantity = jiaoStock.BaseQuantity; + newStock.BaseQuantity = jiaoStock.BaseQuantity; newStock.ManuNo = Jiaojie_ChannelStocks[i].ManuNo; newStock.EffDate = Jiaojie_ChannelStocks[i].EffDate; newStock.DrawerNo = Jiaojie_ChannelStocks[i].DrawerNo; diff --git a/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs b/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs index aeeb3ab..f34baa7 100644 --- a/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs +++ b/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs @@ -125,7 +125,7 @@ namespace DM_Weight.ViewModels ChannelStocks = SqlSugarHelper.Db.Queryable() .Includes(cs => cs.ChannelLst) .Includes(cs => cs.DrugInfo) - .Where(cs => cs.MachineId == (ConfigurationManager.AppSettings["jj_machineId"] ?? "DM5") && cs.NeedNum > 0) + .Where(cs => cs.MachineId == (ConfigurationManager.AppSettings["jj_machineId"] ?? "DM5") && (cs.NeedNum > 0 || cs.AddToJJNum > 0)) .OrderBy(cs => cs.Chnguid) .OrderBy(cs => cs.DrawerNo) .ToList(); @@ -159,6 +159,8 @@ namespace DM_Weight.ViewModels channelList.channelStocks.AddRange(ChannelStocks.Where(cs => cs.DrawerNo == DrawerNoList[i]&&(cs.NeedNum>0||cs.AddToJJNum>0)).ToList()); if (channelList != null) { + if (channelList.channelStocks[0].AddToJJNum>0) + channelList.State=1; //表示有补药 channelLists.Add(channelList); } } @@ -534,7 +536,7 @@ namespace DM_Weight.ViewModels { AlertMsg alertMsg = new AlertMsg { - Message = $"未选择药品,请先勾选要药箱号", + Message = $"未选择药品,请先点选药箱号", Type = MsgType.ERROR, }; _eventAggregator.GetEvent().Publish(alertMsg); @@ -606,7 +608,15 @@ namespace DM_Weight.ViewModels DialogServiceExtensions.ShowDialogHost(_dialogService, "AddToJiaoJieDialog", dialogParameters, DoDialogResult, "RootDialog"); } - + if(_ChannelList!=null&& _ChannelList.State == 1) + { + AlertMsg alertMsg = new AlertMsg + { + Message = $"药品已取出,待入库", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + } } } } diff --git a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs index 6d3ff96..a5ce4a4 100644 --- a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs @@ -194,7 +194,7 @@ namespace DM_Weight.ViewModels List record = ChannelStocks.FindAll(it => it.AddQuantity != 0).ToList(); if (record.Count > 0) { - string InvoiceId = "DRAWER_" + CurrentTimeMillis(); + string InvoiceId = "DRAWER_Add_" + CurrentTimeMillis(); var f = SqlSugarHelper.Db.UseTran(() => { @@ -215,7 +215,7 @@ namespace DM_Weight.ViewModels }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand(); // 获取更新完库存后的药品库存 List nowChannels = SqlSugarHelper.Db.Queryable() - .Where(cs => cs.MachineId.Equals(it.MachineId)) + .Where(cs => cs.MachineId.Equals(it.MachineId) || cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"])) .Where(cs => cs.DrugId.Equals(it.DrugId)) .Where(cs => cs.DrawerType == 1) .ToList(); @@ -253,8 +253,9 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - CreateTime = DateTime.Now - + CreateTime = DateTime.Now, + TotalStock = nowChannels.Sum(itx => itx.Quantity), + ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity) }).ExecuteCommand(); //修改凌晨生成的日结存数据 AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable() diff --git a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs index 3df7c31..ce4b35d 100644 --- a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs @@ -194,7 +194,7 @@ namespace DM_Weight.ViewModels logger.Info("点击完成按钮,库位数据:" + JsonConvert.SerializeObject(record)); if (record.Count > 0) { - string InvoiceId = "DRAWER_" + CurrentTimeMillis(); + string InvoiceId = "DRAWER_Take_" + CurrentTimeMillis(); var f = SqlSugarHelper.Db.UseTran(() => { @@ -213,7 +213,7 @@ namespace DM_Weight.ViewModels }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand(); // 获取更新完库存后的药品库存 List nowChannels = SqlSugarHelper.Db.Queryable() - .Where(cs => cs.MachineId.Equals(it.MachineId)) + .Where(cs => cs.MachineId.Equals(it.MachineId) || cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"])) .Where(cs => cs.DrugId.Equals(it.DrugId)) .Where(cs => cs.DrawerType == 1) .ToList(); @@ -251,7 +251,9 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - CreateTime = DateTime.Now + CreateTime = DateTime.Now, + TotalStock = nowChannels.Sum(itx => itx.Quantity), + ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity) }).ExecuteCommand(); //修改凌晨生成的日结存数据 diff --git a/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs b/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs index 8a3f019..2ce137c 100644 --- a/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs @@ -318,7 +318,7 @@ namespace DM_Weight.ViewModels }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand(); // 获取更新完库存后的药品库存 List nowChannels = SqlSugarHelper.Db.Queryable() - .Where(cs => cs.MachineId.Equals(it.MachineId)) + .Where(cs => cs.MachineId.Equals(it.MachineId) || cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"])) .Where(cs => cs.DrugId.Equals(it.DrugId)) .Where(cs => cs.DrawerType == 1) .ToList(); @@ -357,7 +357,9 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - CreateTime = DateTime.Now + CreateTime = DateTime.Now, + TotalStock = nowChannels.Sum(itx => itx.Quantity), + ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity) }).ExecuteCommand(); //修改凌晨生成的日结存数据 diff --git a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs index be7be6c..353e3d7 100644 --- a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs +++ b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs @@ -314,7 +314,7 @@ namespace DM_Weight.ViewModels }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand(); // 获取更新完库存后的药品库存 List nowChannels = SqlSugarHelper.Db.Queryable() - .Where(cs => cs.MachineId.Equals(it.MachineId)) + .Where(cs => cs.MachineId.Equals(it.MachineId) || cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"])) .Where(cs => cs.DrugId.Equals(it.DrugId)) .Where(cs => cs.DrawerType == 1) .ToList(); @@ -352,7 +352,10 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - CreateTime = DateTime.Now + CreateTime = DateTime.Now, + TotalStock = nowChannels.Sum(itx => itx.Quantity), + ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity) + }).ExecuteCommand(); //修改凌晨生成的日结存数据 diff --git a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs index 482a5fe..33b5e9d 100644 --- a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs @@ -337,7 +337,7 @@ namespace DM_Weight.ViewModels }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand(); // 获取更新完库存后的药品库存 List nowChannels = SqlSugarHelper.Db.Queryable() - .Where(cs => cs.MachineId.Equals(it.MachineId)) + .Where(cs => cs.MachineId.Equals(it.MachineId) || cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"])) .Where(cs => cs.DrugId.Equals(it.DrugId)) .Where(cs => cs.DrawerType == 1) .ToList(); @@ -375,7 +375,10 @@ namespace DM_Weight.ViewModels MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), CreateTime = DateTime.Now, - InvoiceNo = OrderInfo.OrderNo + InvoiceNo = OrderInfo.OrderNo, + TotalStock = nowChannels.Sum(itx => itx.Quantity), + ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity) + }).ExecuteCommand(); //修改凌晨生成的日结存与总结存数据 diff --git a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs index c6717bf..4d7cbf9 100644 --- a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs +++ b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs @@ -240,7 +240,7 @@ namespace DM_Weight.ViewModels // 获取更新完库存后的药品库存 List nowChannels = SqlSugarHelper.Db.Queryable() - .Where(cs => cs.MachineId.Equals(ChannelStock.MachineId)) + .Where(cs => cs.MachineId.Equals(ChannelStock.MachineId)|| cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"])) .Where(cs => cs.DrugId.Equals(ChannelStock.DrugId)) .Where(cs => cs.DrawerType == 1) .ToList(); @@ -284,7 +284,10 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - CreateTime = DateTime.Now + CreateTime = DateTime.Now, + TotalStock = nowChannels.Sum(itx => itx.Quantity), + ManuStock = nowChannels.Where(itx => itx.ManuNo == ChannelStock.ManuNo && itx.EffDate == ChannelStock.EffDate).Sum(itx => itx.Quantity) + }).ExecuteCommand(); //修改凌晨生成的日结存数据 diff --git a/DM_Weight/ViewModels/SelfAddDialogViewModel.cs b/DM_Weight/ViewModels/SelfAddDialogViewModel.cs index f0fa610..cb4a3af 100644 --- a/DM_Weight/ViewModels/SelfAddDialogViewModel.cs +++ b/DM_Weight/ViewModels/SelfAddDialogViewModel.cs @@ -245,7 +245,7 @@ namespace DM_Weight.ViewModels }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand(); // 获取更新完库存后的药品库存 List nowChannels = SqlSugarHelper.Db.Queryable() - .Where(cs => cs.MachineId.Equals(it.MachineId)) + .Where(cs => cs.MachineId.Equals(it.MachineId) || cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"])) .Where(cs => cs.DrugId.Equals(it.DrugId)) .Where(cs => cs.DrawerType == 1) .ToList(); @@ -283,7 +283,9 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - CreateTime = DateTime.Now + CreateTime = DateTime.Now, + TotalStock = nowChannels.Sum(itx => itx.Quantity), + ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity) }).ExecuteCommand(); //修改凌晨生成的日结存数据 diff --git a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs index eb9029a..cf16785 100644 --- a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs @@ -221,7 +221,7 @@ namespace DM_Weight.ViewModels }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand(); // 获取更新完库存后的药品库存 List nowChannels = SqlSugarHelper.Db.Queryable() - .Where(cs => cs.MachineId.Equals(it.MachineId)) + .Where(cs => cs.MachineId.Equals(it.MachineId) || cs.MachineId.Equals(ConfigurationManager.AppSettings["jj_machineId"])) .Where(cs => cs.DrugId.Equals(it.DrugId)) .Where(cs => cs.DrawerType == 1) .ToList(); @@ -260,7 +260,10 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - CreateTime = DateTime.Now + CreateTime = DateTime.Now, + TotalStock = nowChannels.Sum(itx => itx.Quantity), + ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity) + }).ExecuteCommand(); //修改凌晨生成的日结存数据 @@ -343,7 +346,7 @@ namespace DM_Weight.ViewModels { singleChannels.ForEach(it => { - _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity); + _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity); Thread.Sleep(150); }); }