From 88b97e213f9e79be9ab3d22f63e296164e8eb02c Mon Sep 17 00:00:00 2001 From: maqiao <625215135@qq.com> Date: Tue, 25 Mar 2025 16:21:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=99=E6=A0=87=E7=AD=BE=E9=97=B4=E9=9A=94?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E7=94=B1150=E6=94=B9=E4=B8=BA200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DM_Weight/App.config | 2 +- .../ViewModels/AddToJiaoJieDialogViewModel.cs | 11 ++++++----- .../ViewModels/AddToJiaoJieWindowViewModel.cs | 18 +++++++++--------- .../BindingChannelDialogViewModel.cs | 10 +++++++--- .../ViewModels/CheckStockWindowViewModel.cs | 2 +- .../ViewModels/DrawerAddDrugWindowViewModel.cs | 2 +- .../DrawerTakeDrugWindowViewModel.cs | 2 +- .../ViewModels/InvoiceAddDialogViewModel.cs | 2 +- .../ViewModels/InvoiceTakeDialogViewModel.cs | 2 +- .../ViewModels/OrderReturnDialogViewModel.cs | 2 +- .../ViewModels/ReturnDrugDialogViewModel.cs | 2 +- DM_Weight/ViewModels/SelfAddDialogViewModel.cs | 2 +- .../ViewModels/SelfTakeDialogViewModel.cs | 4 ++-- DM_Weight/Views/AddToJiaoJieWindow.xaml | 1 + 14 files changed, 34 insertions(+), 28 deletions(-) diff --git a/DM_Weight/App.config b/DM_Weight/App.config index 3fc6925..ac6cf4c 100644 --- a/DM_Weight/App.config +++ b/DM_Weight/App.config @@ -42,7 +42,7 @@ - + diff --git a/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs b/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs index a21e9e6..6b0503d 100644 --- a/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs +++ b/DM_Weight/ViewModels/AddToJiaoJieDialogViewModel.cs @@ -15,6 +15,7 @@ using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; +using System.Windows.Input; namespace DM_Weight.ViewModels { @@ -88,11 +89,11 @@ namespace DM_Weight.ViewModels ChannelStock copy = TransExpV2.Trans(Jiaojie_ChannelStocks[i]); ChannelStocks.Add(copy); } - ChannelStocks = Jiaojie_ChannelStocks.GroupBy(cs => cs.DrugId).Select(g => new + ChannelStocks = Jiaojie_ChannelStocks.GroupBy(cs =>new { cs.DrugId, cs.ManuNo }).Select(g => new { - DrugId = g.Key, + Key = g.Key, AddQuantity = g.Sum(s => s.AddQuantity) - }).Select(cs => new ChannelStock() { DrugId = cs.DrugId, AddQuantity = cs.AddQuantity }).ToList(); + }).Select(cs => new ChannelStock() { DrugId = cs.Key.DrugId,ManuNo=cs.Key.ManuNo, AddQuantity = cs.AddQuantity }).ToList(); RequestData(); } @@ -198,7 +199,7 @@ namespace DM_Weight.ViewModels .Where(cs => cs.Quantity > 0) .Where(cs => cs.DrawerType == 1) .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3")) - .Where(cs => cs.DrugId == ChannelStocks[i].DrugId) + .Where(cs => cs.DrugId == ChannelStocks[i].DrugId && cs.ManuNo == ChannelStocks[i].ManuNo) .OrderBy(cs => cs.EffDate) .OrderBy(cs => cs.DrawerNo) .ToList(); @@ -603,7 +604,7 @@ namespace DM_Weight.ViewModels singleChannelsBoxSmart.ForEach(it => { _portUtil.WriteQuantityMethod((it.Quantity - it.TakeQuantity), it.DrawerNo, it.ColNo); - Thread.Sleep(150); + Thread.Sleep(200); }); } }); diff --git a/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs b/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs index 99660e5..2e48d3f 100644 --- a/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs +++ b/DM_Weight/ViewModels/AddToJiaoJieWindowViewModel.cs @@ -77,15 +77,15 @@ namespace DM_Weight.ViewModels .OrderBy(cs => cs.Chnguid) .OrderBy(cs => cs.DrawerNo) .ToList(); - ChannelStocks = ChannelStocks.GroupBy(it => new { it.DrawerNo, it.DrugId }) - .Select(it => - { - var ret = it.First(); - ret.Quantity = it.Sum(itx => itx.Quantity); - ret.NeedNum=it.Sum(itx => itx.NeedNum); - return ret; - }).Where(it=>it.BaseQuantity>it.Quantity) - .ToList(); + //ChannelStocks = ChannelStocks.GroupBy(it => new { it.DrawerNo, it.DrugId }) + // .Select(it => + // { + // var ret = it.First(); + // ret.Quantity = it.Sum(itx => itx.Quantity); + // ret.NeedNum=it.Sum(itx => itx.NeedNum); + // return ret; + // }).Where(it=>it.BaseQuantity>it.Quantity) + // .ToList(); ChannelStocks.ForEach(cs => cs.AddQuantity = cs.BaseQuantity - cs.Quantity); ICollectionView vw = CollectionViewSource.GetDefaultView(ChannelStocks); diff --git a/DM_Weight/ViewModels/BindingChannelDialogViewModel.cs b/DM_Weight/ViewModels/BindingChannelDialogViewModel.cs index b3ef41c..7eb9049 100644 --- a/DM_Weight/ViewModels/BindingChannelDialogViewModel.cs +++ b/DM_Weight/ViewModels/BindingChannelDialogViewModel.cs @@ -166,8 +166,12 @@ namespace DM_Weight.ViewModels private void GetAllDrugInfos() { - var list = SqlSugarHelper.Db.Queryable().Includes(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList(); - DrugInfos = list; + string str = @"SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit, + d.manufactory,d.max_stock,CONCAT(drug_name,' ',drug_spec)as drug_name FROM `drug_info` d"; + DrugInfos = SqlSugarHelper.Db.SqlQueryable(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList(); + + //var list = SqlSugarHelper.Db.Queryable().Includes(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList(); + //DrugInfos = list; } private void GetChannelsByDrawerNo() @@ -457,7 +461,7 @@ namespace DM_Weight.ViewModels public void UpdateComboBoxItems(string text) { string str = @"SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_name,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit, - d.manufactory,d.max_stock,CONCAT(drug_name,' ',drug_spec)as drug_name_spec FROM `drug_info` d"; + d.manufactory,d.max_stock,CONCAT(drug_name,' ',drug_spec)as DrugName FROM `drug_info` d"; if (string.IsNullOrEmpty(text)) { DrugInfos = SqlSugarHelper.Db.SqlQueryable(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList(); diff --git a/DM_Weight/ViewModels/CheckStockWindowViewModel.cs b/DM_Weight/ViewModels/CheckStockWindowViewModel.cs index b225083..692d520 100644 --- a/DM_Weight/ViewModels/CheckStockWindowViewModel.cs +++ b/DM_Weight/ViewModels/CheckStockWindowViewModel.cs @@ -215,7 +215,7 @@ namespace DM_Weight.ViewModels for (int i = 0; i < singleChannels.Count; i++) { _portUtil.WriteQuantityMethod((singleChannels[i].CheckQuantity), singleChannels[i].DrawerNo, singleChannels[i].ColNo); - Thread.Sleep(150); + Thread.Sleep(200); } } }); diff --git a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs index 144057f..6d3ff96 100644 --- a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs @@ -359,7 +359,7 @@ namespace DM_Weight.ViewModels //await _portUtil.WriteChannelIn foMethod(2, (singleChannels[i].Quantity + singleChannels[i].AddQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo); //await Task.Delay(200); //await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo); - Thread.Sleep(150); + Thread.Sleep(200); } } }); diff --git a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs index 824c9c4..3df7c31 100644 --- a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs @@ -362,7 +362,7 @@ namespace DM_Weight.ViewModels //await Task.Delay(200); //_portUtil.ShowContentMethod(it.DrawerNo, it.ColNo); _portUtil.WriteQuantityMethod((it.Quantity - it.TakeQuantity), it.DrawerNo, it.ColNo); - Thread.Sleep(150); + Thread.Sleep(200); }); } }); diff --git a/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs b/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs index 0b4745a..7c8ac31 100644 --- a/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs +++ b/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs @@ -392,7 +392,7 @@ namespace DM_Weight.ViewModels //await Task.Delay(200); //_portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo); _portUtil.WriteQuantityMethod((singleChannels[i].Quantity + singleChannels[i].AddQuantity), singleChannels[i].DrawerNo, singleChannels[i].ColNo); - Thread.Sleep(100); + Thread.Sleep(200); } } }); diff --git a/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs b/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs index f5160a8..8a3f019 100644 --- a/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs @@ -454,7 +454,7 @@ namespace DM_Weight.ViewModels //await Task.Delay(200); //_portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo); _portUtil.WriteQuantityMethod((singleChannels[i].Quantity - singleChannels[i].TakeQuantity), singleChannels[i].DrawerNo, singleChannels[i].ColNo); - Thread.Sleep(100); + Thread.Sleep(200); } } }); diff --git a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs index 66856a0..be7be6c 100644 --- a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs +++ b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs @@ -444,7 +444,7 @@ namespace DM_Weight.ViewModels for (int i = 0; i < singleChannels.Count; i++) { _portUtil.WriteQuantityMethod((singleChannels[i].Quantity + singleChannels[i].TakeQuantity), singleChannels[i].DrawerNo, singleChannels[i].ColNo); - Thread.Sleep(100); + Thread.Sleep(200); } } }); diff --git a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs index dbbd88b..c6717bf 100644 --- a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs +++ b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs @@ -374,7 +374,7 @@ namespace DM_Weight.ViewModels //await Task.Delay(200); //_portUtil.ShowContentMethod(ChannelStock.DrawerNo, ChannelStock.ColNo); _portUtil.WriteQuantityMethod((ChannelStock.Quantity + ChannelStock.TakeQuantity), ChannelStock.DrawerNo, ChannelStock.ColNo); - Thread.Sleep(100); + Thread.Sleep(200); } }); AlertMsg alertMsg = new AlertMsg diff --git a/DM_Weight/ViewModels/SelfAddDialogViewModel.cs b/DM_Weight/ViewModels/SelfAddDialogViewModel.cs index f18c4df..f0fa610 100644 --- a/DM_Weight/ViewModels/SelfAddDialogViewModel.cs +++ b/DM_Weight/ViewModels/SelfAddDialogViewModel.cs @@ -383,7 +383,7 @@ namespace DM_Weight.ViewModels //_portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo); _portUtil.WriteQuantityMethod((singleChannels[i].Quantity + singleChannels[i].AddQuantity), singleChannels[i].DrawerNo, singleChannels[i].ColNo); - Thread.Sleep(150); + Thread.Sleep(200); } //singleChannels.ForEach(async it => //{ diff --git a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs index f94b1f6..eb9029a 100644 --- a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs @@ -341,7 +341,7 @@ namespace DM_Weight.ViewModels List singleChannels = record.FindAll(it => it.BoardType != 1); if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5) { - singleChannels.ForEach(async it => + singleChannels.ForEach(it => { _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity); Thread.Sleep(150); @@ -357,7 +357,7 @@ namespace DM_Weight.ViewModels //await Task.Delay(200); //_portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo); _portUtil.WriteQuantityMethod((singleChannels[i].Quantity - singleChannels[i].TakeQuantity), singleChannels[i].DrawerNo, singleChannels[i].ColNo); - Thread.Sleep(150); + Thread.Sleep(200); } } }); diff --git a/DM_Weight/Views/AddToJiaoJieWindow.xaml b/DM_Weight/Views/AddToJiaoJieWindow.xaml index 0dd4914..3a0b7a9 100644 --- a/DM_Weight/Views/AddToJiaoJieWindow.xaml +++ b/DM_Weight/Views/AddToJiaoJieWindow.xaml @@ -166,6 +166,7 @@ +