diff --git a/Aucma.Core.OldBoxFoam/Business/Collection.cs b/Aucma.Core.OldBoxFoam/Business/Collection.cs index 89358d43..0c670c95 100644 --- a/Aucma.Core.OldBoxFoam/Business/Collection.cs +++ b/Aucma.Core.OldBoxFoam/Business/Collection.cs @@ -95,11 +95,8 @@ namespace Aucma.Core.OldBoxFoam.Business { SpaceDetailModel model = new SpaceDetailModel(); model.ObjId = i + 1; - //if (BoxTypeList.Count > 0) model.FixtureBoxType = BoxTypeList[i].ToString(); - //if (HolderStatusList.Count > 0) model.Status = HolderStatusList[i]; - //if (HolderOutPutList.Count > 0) model.Yield = HolderOutPutList[i]; - //if (SolidifyTimeList.Count > 0) model.PlanCuringTime = SolidifyTimeList[i]; - + if (StoreTypeList.Count > 0) model.StoreType = StoreTypeList[i].ToString(); + if (StoreAmountList.Count > 0) model.StoreAmount =Convert.ToInt32(StoreAmountList[i]); spaceDetailModel.Add(model); } Thread.Sleep(10000); diff --git a/Aucma.Core.OldBoxFoam/Models/SpaceDetailModel.cs b/Aucma.Core.OldBoxFoam/Models/SpaceDetailModel.cs index fd918313..a6268ed7 100644 --- a/Aucma.Core.OldBoxFoam/Models/SpaceDetailModel.cs +++ b/Aucma.Core.OldBoxFoam/Models/SpaceDetailModel.cs @@ -16,5 +16,7 @@ namespace Aucma.Core.OldBoxFoam.Models /// 箱型 /// public string StoreType { get; set; } + + public int StoreAmount { get; set; } } } diff --git a/Aucma.Core.OldBoxFoam/ViewModels/OldBoxFoamPageViewModel.cs b/Aucma.Core.OldBoxFoam/ViewModels/OldBoxFoamPageViewModel.cs index 5384f3b9..a1fc437b 100644 --- a/Aucma.Core.OldBoxFoam/ViewModels/OldBoxFoamPageViewModel.cs +++ b/Aucma.Core.OldBoxFoam/ViewModels/OldBoxFoamPageViewModel.cs @@ -12,6 +12,7 @@ using Aucma.Core.Tasks; using CommunityToolkit.Mvvm.ComponentModel; using log4net; using Microsoft.Extensions.DependencyInjection; +using NPOI.SS.Formula.Functions; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -48,7 +49,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels _currentTeamTimeServices = App.ServiceProvider.GetService(); _boxFoamDataRecordServices = App.ServiceProvider.GetService(); //AucamTaskService.RefreshOldBoxFoamDataDelegateEvent += OldBoxFoamOnLoad3; - + timer1.Elapsed += new System.Timers.ElapsedEventHandler(OldBoxFoamOnLoad); //到达时间的时候执行事件; timer1.AutoReset = true;//设置是执行一次(false)还是一直执行(true); timer1.Enabled = true;//需要调用 timer.Start()或者timer.Enabled = true来启动它, @@ -79,12 +80,6 @@ namespace Aucma.Core.OldBoxFoam.ViewModels _totle = $"总产量:{num}"; foreach (var item in prderList) { - //OldBoxFoamDataModel model = new OldBoxFoamDataModel(); - //model.ObjId = item.ObjId; - //model.Fixtureboxtype = item.FixtureBoxType; - //model.Fixturestatus = item.Status; - //model.Production = item.Yield; - //model.CuringTimeSettingValue = item.PlanCuringTime.ToString(); if (item.Status == 1)//生产 { _statusColor.Add("green"); @@ -96,9 +91,9 @@ namespace Aucma.Core.OldBoxFoam.ViewModels _fixtureName.Add(item.FixtureBoxType); _production.Add(item.Yield); //_beat.Add(item.BoxBeat); - i = +item.Yield; + _totle = _totle + item.Yield; } - _totle = $"总产量:{i}"; + } catch (Exception ex) { @@ -106,6 +101,9 @@ namespace Aucma.Core.OldBoxFoam.ViewModels } finally { + var prderList = Collection.listFixtureStatus; + int num = prderList.Sum(d => d.Yield); + _totle = $"总产量:{num}"; if (GetStoreTimer != null) { GetStoreTimer.Change(20000, Timeout.Infinite); @@ -341,9 +339,10 @@ namespace Aucma.Core.OldBoxFoam.ViewModels private async void ExecHourData(string productLineCode) { var boxList = Collection.listFixtureStatus; - foreach (var item in boxList) + if (boxList == null) return; + for (int j = 0; j < boxList.Count; j++) { - OldBoxFoamType space = await _oldBoxFoamTypeServices.FirstAsync(d => d.Boxtype == item.FixtureBoxType); + OldBoxFoamType space = await _oldBoxFoamTypeServices.FirstAsync(d => d.Boxtype == boxList[j].FixtureBoxType); //根据夹具找货道,根据货道找物料 if (space != null) { @@ -353,27 +352,27 @@ namespace Aucma.Core.OldBoxFoam.ViewModels plan.CompleteAmount = plan.CompleteAmount + 1; await _boxFoamPlanServices.UpdateAsync(plan); //更新小时数据 - BoxFoamData bfd = await _oldBoxFoamDataServices.FirstAsync(d => d.Fixtureboxtype == item.FixtureBoxType && d.MainId == item.ObjId); + BoxFoamData bfd = await _oldBoxFoamDataServices.FirstAsync(d => d.Fixtureboxtype == boxList[j].FixtureBoxType && d.MainId == boxList[j].ObjId); if (bfd != null) { - UpdateBoxData(item, bfd); + UpdateBoxData(boxList[j], bfd); } else { - SaveBoxData(productLineCode, item); + SaveBoxData(productLineCode, boxList[j]); } } else { //更新小时数据 - BoxFoamData bfd = await _oldBoxFoamDataServices.FirstAsync(d => d.Fixtureboxtype == item.FixtureBoxType && d.MainId == item.ObjId); + BoxFoamData bfd = await _oldBoxFoamDataServices.FirstAsync(d => d.Fixtureboxtype == boxList[j].FixtureBoxType && d.MainId == boxList[j].ObjId); if (bfd != null) { - UpdateBoxData(item, bfd); + UpdateBoxData(boxList[j], bfd); } else { - SaveBoxData(productLineCode, item); + SaveBoxData(productLineCode, boxList[j]); } } }