|
|
using Admin.Core.Common;
|
|
|
using Admin.Core.IService;
|
|
|
using Admin.Core.Model;
|
|
|
using Admin.Core.Model.Model_New;
|
|
|
using Admin.Core.Model.ViewModels;
|
|
|
using Aucma.Core.HwPLc;
|
|
|
using Aucma.Core.Tasks.Business;
|
|
|
using log4net;
|
|
|
using System.Timers;
|
|
|
|
|
|
namespace Aucma.Core.Tasks
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 任务列表
|
|
|
/// </summary>
|
|
|
public class AucamTaskService : IAucamTaskService
|
|
|
{
|
|
|
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(AucamTaskService));
|
|
|
IPerfusionRecordServices _perfusionRecordServices;
|
|
|
IExecutePlanInfoServices _executePlanInfoServices;
|
|
|
System.Timers.Timer timer1 = new System.Timers.Timer(5000);
|
|
|
|
|
|
public AucamTaskService(IPerfusionRecordServices perfusionRecordServices,
|
|
|
IPerfusionAlarmServices perfusionAlarmServices, IExecutePlanInfoServices executePlanInfoServices,
|
|
|
IPerfusionDeviceStatusServices perfusionDeviceStatusServices)
|
|
|
{
|
|
|
PerfusionCollection coll = new PerfusionCollection(perfusionRecordServices, perfusionAlarmServices, perfusionDeviceStatusServices);
|
|
|
}
|
|
|
|
|
|
#region 更新钣金工位计划数
|
|
|
bool qFlay = true;//完成
|
|
|
|
|
|
public void AucamUpdatePlanNumTask()
|
|
|
{
|
|
|
//timer1.Elapsed += new System.Timers.ElapsedEventHandler(Run1); //到达时间的时候执行事件;
|
|
|
//timer1.AutoReset = true;//设置是执行一次(false)还是一直执行(true);
|
|
|
//timer1.Enabled = true;//需要调用 timer.Start()或者timer.Enabled = true来启动它,
|
|
|
//timer1.Start();//timer.Start()的内部原理还是设置timer.Enabled = true;
|
|
|
}
|
|
|
|
|
|
private void Run1(object? sender, ElapsedEventArgs e)
|
|
|
{
|
|
|
if (qFlay)
|
|
|
{
|
|
|
qFlay = false;
|
|
|
List<SheetMetalDataView> viewList=new List<SheetMetalDataView>();
|
|
|
List<SheetMetalDataView> list= _executePlanInfoServices.QuerySheetMetalData("1001");
|
|
|
foreach (SheetMetalDataView item in list)
|
|
|
{
|
|
|
if (item.SidPanelAmount==item.BackPanelAmount)
|
|
|
{
|
|
|
SheetMetalDataView view = new SheetMetalDataView();
|
|
|
view.CompleteAmount= item.PlanAmount;
|
|
|
viewList.Add(view);
|
|
|
}
|
|
|
if (item.SidPanelAmount > item.BackPanelAmount)
|
|
|
{
|
|
|
SheetMetalDataView view = new SheetMetalDataView();
|
|
|
view.CompleteAmount = item.BackPanelAmount;
|
|
|
viewList.Add(view);
|
|
|
}
|
|
|
if (item.SidPanelAmount < item.BackPanelAmount)
|
|
|
{
|
|
|
SheetMetalDataView view = new SheetMetalDataView();
|
|
|
view.CompleteAmount = item.SidPanelAmount;
|
|
|
viewList.Add(view);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
}
|