From b0a228ba32224a77d1ce098aedd0e78b887068cb Mon Sep 17 00:00:00 2001 From: liuwf Date: Mon, 18 Mar 2024 10:51:06 +0800 Subject: [PATCH] change. --- .../Model_New/MaterialCompletion.cs | 7 ++ .../ViewModels/IndexPageViewModel.cs | 49 +++++++----- .../Views/StatisticsPageView.xaml | 12 +-- .../Business/offLineBusiness.cs | 74 ++++++++++--------- .../ViewModels/IndexPageViewModel.cs | 2 +- .../Views/ChooseDirectionWindow.xaml.cs | 38 +--------- 6 files changed, 83 insertions(+), 99 deletions(-) diff --git a/Admin.Core.Model/Model_New/MaterialCompletion.cs b/Admin.Core.Model/Model_New/MaterialCompletion.cs index 53979b50..12b24fed 100644 --- a/Admin.Core.Model/Model_New/MaterialCompletion.cs +++ b/Admin.Core.Model/Model_New/MaterialCompletion.cs @@ -71,6 +71,13 @@ namespace Admin.Core.Model.Model_New /// [SugarColumn(ColumnName = "IS_DOWN_LINE")] public int isDownLine { get; set; } + + /// + /// 成品码 + /// + [SugarColumn(ColumnName = "PRODUCTION_CODE")] + public string ProductionCode { get; set; } + } } diff --git a/Aucma.Core.CodeBinding/ViewModels/IndexPageViewModel.cs b/Aucma.Core.CodeBinding/ViewModels/IndexPageViewModel.cs index 70813ff5..df34b13b 100644 --- a/Aucma.Core.CodeBinding/ViewModels/IndexPageViewModel.cs +++ b/Aucma.Core.CodeBinding/ViewModels/IndexPageViewModel.cs @@ -84,11 +84,9 @@ namespace Aucma.Core.CodeBinding.ViewModels //Task.Run(() => //{ // Thread.Sleep(4000); - // LoadCharts(); - // Thread.Sleep(3000); - // LoadCharts(); + //}); - + } catch (Exception ex) @@ -97,6 +95,8 @@ namespace Aucma.Core.CodeBinding.ViewModels } } + + /// /// 实时绑定条码和实时下发plc放行信号 /// @@ -240,6 +240,15 @@ namespace Aucma.Core.CodeBinding.ViewModels { List list = _codeBindingRecordServices.QueryCharts().Result; if (list == null || list.Count == 0) return; + + var result = from m in list + group m by GetSubstringBetweenCommas(m.BoxName) into g + select new CodeBindCharts() + { + BoxName = g.Key, + Amount = g.Sum(m=>m.Amount) + }; + App.Current.Dispatcher.Invoke(() => { @@ -251,10 +260,12 @@ namespace Aucma.Core.CodeBinding.ViewModels int i = 0; double total = 0; - foreach(var item in list) + + + foreach (var item in result) { - ProductionHourList.Add(GetSubstringBetweenCommas(item.BoxName)); - // achievement.Add(item.Amount); + ProductionHourList.Add(item.BoxName); + achievement.Add(new ObservablePoint(i, item.Amount)); total += item.Amount; i++; @@ -603,18 +614,18 @@ namespace Aucma.Core.CodeBinding.ViewModels { RefreshAndWriteLog("条码【" + record.BoxCode + "】与SN码【" + record.ProductCode + "】绑定成功"); #region 更新过点数据,插入记录到MATERIAL_COMPLETION表 - //PrintBarCode print = _printBarCodeServices.FirstAsync(x => x.MaterialBarcode == code1).Result; - //if (print != null) return; - //MaterialCompletion completion = new MaterialCompletion(); - //completion.OrderCode = print.OrderCode; - //completion.MaterialBarcode = code1; - //completion.MaterialCode = print.MaterialCode; - //completion.MaterialName = print.MaterialName; - //completion.StationName = "1007"; - //completion.CompleteDate = DateTime.Now; - //completion.isDownLine = 0; - //completion.ProductLineCode = "CX_02"; - //_= _iMaterialCompletionServices.AddAsync(completion).Result; + PrintBarCode print = _printBarCodeServices.FirstAsync(x => x.MaterialBarcode == code1).Result; + if (print == null) return; + MaterialCompletion completion = new MaterialCompletion(); + completion.OrderCode = print.OrderCode; + completion.MaterialBarcode = code1; + completion.MaterialCode = print.MaterialCode; + completion.MaterialName = print.MaterialName; + completion.StationName = "1008"; + completion.CompleteDate = DateTime.Now; + completion.isDownLine = 0; + completion.ProductLineCode = "CX_02"; + _ = _iMaterialCompletionServices.AddAsync(completion).Result; #endregion diff --git a/Aucma.Core.CodeBinding/Views/StatisticsPageView.xaml b/Aucma.Core.CodeBinding/Views/StatisticsPageView.xaml index 4ee3d307..3804bedc 100644 --- a/Aucma.Core.CodeBinding/Views/StatisticsPageView.xaml +++ b/Aucma.Core.CodeBinding/Views/StatisticsPageView.xaml @@ -145,12 +145,12 @@ - - - - - - + + + + + + diff --git a/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs b/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs index 48c42cea..204b1d64 100644 --- a/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs +++ b/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs @@ -31,6 +31,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; + namespace Aucma.Core.ProductOffLine.Business { /// @@ -112,7 +113,7 @@ namespace Aucma.Core.ProductOffLine.Business GunBusiness.RefreshMaterialCodeStrEvent += MaterialBarScan; HandSendPlcWindow.SendPlcPassEvent += DownLoadPassFlag; - // test(); + // test(); } #region 变量定义 /// @@ -124,27 +125,24 @@ namespace Aucma.Core.ProductOffLine.Business public void test() { + + + //OffLineInfo info11 = new OffLineInfo(); + //info11.ProductSNCode = "test11"; + //info11.PlcResult = 1; + //int flag = _offLineInfoServices.AddAsync(info11).Result; + //OffLineInfo info = _offLineInfoServices.FirstAsync(x => x.ProductSNCode == "test11").Result; + //info.PlcResult = 2; + //bool result = _offLineInfoServices.UpdateAsync(info).Result; + //Thread.Sleep(5000); + //TempOffLineInfo1.MsgInfo = "条码重复,上传间隔超过五分钟禁止放行,人工处理,上传时间:" + DateTime.Now; + //TempOffLineInfo1.MsgAlarmFlag = true; + //RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo1); + //OffLineInfo info11 = new OffLineInfo(); + //info11.ProductSNCode = "test111"; + //int flag = _offLineInfoServices.AddAsync(info11).Result; - Task.Run(() => - { - CodeBindingRecord bindingRecord1 = _codeBindingServices.FirstAsync(x => x.ProductCode == "1510080000099E3C0600").Result; - - //OffLineInfo info11 = new OffLineInfo(); - //info11.ProductSNCode = "test11"; - //info11.PlcResult = 1; - //int flag = _offLineInfoServices.AddAsync(info11).Result; - //OffLineInfo info = _offLineInfoServices.FirstAsync(x => x.ProductSNCode == "test11").Result; - //info.PlcResult = 2; - //bool result = _offLineInfoServices.UpdateAsync(info).Result; - //Thread.Sleep(5000); - //TempOffLineInfo1.MsgInfo = "条码重复,上传间隔超过五分钟禁止放行,人工处理,上传时间:" + DateTime.Now; - //TempOffLineInfo1.MsgAlarmFlag = true; - //RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo1); - //OffLineInfo info11 = new OffLineInfo(); - //info11.ProductSNCode = "test111"; - //int flag = _offLineInfoServices.AddAsync(info11).Result; - }); // private static readonly log4net.ILog log = LogManager.GetLogger(typeof(OffLineBusiness)); // string result = _productOffLineServices.QueryChecked("1520870000099E2V0004"); @@ -418,22 +416,26 @@ namespace Aucma.Core.ProductOffLine.Business return false; } - #region 暂时不启用,因为还没打箱体码,查不到数据,更新过点数据 - //PrintBarCode print = _printBarCodeServices.FirstAsync(x => x.MaterialBarcode == bindingRecord1.BoxCode).Result; - //if (print != null) - //{ - // MaterialCompletion completion = new MaterialCompletion(); - // completion.OrderCode = print.OrderCode; - // completion.MaterialBarcode = bindingRecord1.BoxCode; - // completion.MaterialCode = print.MaterialCode; - // completion.MaterialName = print.MaterialName; - // completion.StationName = "1009"; - // completion.CompleteDate = DateTime.Now; - // completion.ProductLineCode = "CX_02"; - // completion.isDownLine = 1; - // _ = _iMaterialCompletionServices.AddAsync(completion).Result; - - //} + #region 更新过点数据 + if(bindingRecord1!=null && bindingRecord1.BoxCode!="") + { + PrintBarCode print = _printBarCodeServices.FirstAsync(x => x.MaterialBarcode == bindingRecord1.BoxCode).Result; + if (print != null) + { + MaterialCompletion completion = new MaterialCompletion(); + completion.OrderCode = print.OrderCode; + completion.MaterialBarcode = bindingRecord1.BoxCode; + completion.MaterialCode = print.MaterialCode; + completion.MaterialName = print.MaterialName; + completion.StationName = "1009"; + completion.CompleteDate = DateTime.Now; + completion.ProductLineCode = "CX_02"; + completion.isDownLine = 1; + completion.ProductionCode = TempOffLineInfo.ProductSNCode; + _ = _iMaterialCompletionServices.AddAsync(completion).Result; + + } + } #endregion diff --git a/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs b/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs index b586e4bb..8fe032a2 100644 --- a/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs +++ b/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs @@ -573,7 +573,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels ProductSNCode = record.ProductSNCode, ProductModel = record.ProductModel, ProductRemark = record.ProductRemark, - QualityResult = "成功", + QualityResult = "合格", ProductScanTime = record.ProductScanTime, }); } diff --git a/Aucma.Core.ProductOffLine/Views/ChooseDirectionWindow.xaml.cs b/Aucma.Core.ProductOffLine/Views/ChooseDirectionWindow.xaml.cs index d22bf2e5..01c7fa9c 100644 --- a/Aucma.Core.ProductOffLine/Views/ChooseDirectionWindow.xaml.cs +++ b/Aucma.Core.ProductOffLine/Views/ChooseDirectionWindow.xaml.cs @@ -47,43 +47,7 @@ namespace Aucma.Core.ProductOffLine.Views } } - //private void LeftButton_Click(object sender, RoutedEventArgs e) - //{ - // ShowConfirmationAndClose("外侧提升机箱体"); - //} - - //private void RightButton_Click(object sender, RoutedEventArgs e) - //{ - // ShowConfirmationAndClose("内侧提升机箱体"); - //} - - ///// - ///// 默认放行A库 - ///// - ///// - //private void ShowConfirmationAndClose(string direction) - //{ - // if (!directionSelected) - // { - // MessageBoxResult result = MessageBox.Show("确认放行 " + direction + " 吗?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Question); - // if (result == MessageBoxResult.Yes) - // { - // directionSelected = true; - // this.Close(); - // if (direction== "外侧提升机箱体") - // { - // SendPlcPassEvent?.Invoke(2,"A"); - // } - // else - // { - // SendPlcPassEvent?.Invoke(1,"A"); - // } - - - // } - // } - //} - + private void Button_Click(object sender, RoutedEventArgs e) {