You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.4 KiB
C#
69 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Net.NetworkInformation;
|
|
using System.Text;
|
|
using System.Linq;
|
|
using System.Data;
|
|
using System.Threading;
|
|
using Mesnac.Action.Base;
|
|
using Mesnac.Controls.Base;
|
|
using System.Windows.Forms;
|
|
using Mesnac.Codd.Session;
|
|
using System.IO;
|
|
using Mesnac.Action.Feeding.BasicInfo;
|
|
|
|
namespace Mesnac.Action.Feeding.FinishBatch
|
|
{
|
|
/// <summary>
|
|
/// 存盘信号判断
|
|
/// </summary>
|
|
public class FinishBatchFlag
|
|
{
|
|
/// <summary>
|
|
/// 获取本地连接
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private DbHelper getLocalHelper()
|
|
{
|
|
return new DatabaseAction().NewDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
}
|
|
/// <summary>
|
|
/// 判断存盘信号是否正确
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool Run()
|
|
{
|
|
if (PlcData.Instance.FinishedBatch.LastValue.ToInt() != 1)
|
|
{
|
|
return false;
|
|
}
|
|
BaseAction action = new BaseAction();
|
|
DbHelper dbHelper = getLocalHelper();
|
|
|
|
//当前计划设定车数
|
|
int planLotCount = PlcData.Instance.RecipeSetNumber.LastValue.ToInt();
|
|
//当前计划完成车数
|
|
int finishLotCount = PlcData.Instance.MixingFinishedCount.LastValue.ToInt();
|
|
if (finishLotCount == 0)
|
|
{
|
|
ICSharpCode.Core.LoggingService.Info("清除错误的存盘信号:" + finishLotCount.ToString());
|
|
new SaveFinishBatch().FinishedOneReset();
|
|
return false;
|
|
}
|
|
if (finishLotCount <= planLotCount && finishLotCount > 0)
|
|
{
|
|
ICSharpCode.Core.LoggingService.Info("存盘信号:" + finishLotCount.ToString());
|
|
if (RecipeCache.Instance.PlanInfo.PlanID.Trim() == SaveFinishBatch.LastSavePlanID.Trim() && finishLotCount == SaveFinishBatch.LastSaveRealNum)
|
|
{
|
|
ICSharpCode.Core.LoggingService.Info("清除重复的存盘信号:" + finishLotCount.ToString());
|
|
new SaveFinishBatch().FinishedOneReset();
|
|
return false;
|
|
}
|
|
//ICSharpCode.Core.LoggingService.Info("返回存盘true:" + finishLotCount.ToString());
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
}
|