using Leit.FrameWork.Log;
using Leit.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Leit.StationFunction
{
public class Function_OP100
{
///
/// 工位标签信息
///
public static List StationTagInfos { get; set; }
///
/// 工位报警标签信息
///
public static List StationAlarmTagInfos { get; set; }
///
/// 工位质量数据标签信息
///
public static List StationQualityTagInfos { get; set; }
///
/// 工位交互数据标签信息
///
public static List StationCommunicatedTagInfos { get; set; }
///
/// 工位信息
///
public static StationInfo StationInf { get; set; }
///
/// 托盘号
///
public static byte PalletNum { get; set; }
public static OrderRecord PresentOrder { get; set; }
public static bool PlanOk { get; set; }
///
/// 业务逻辑
///
public static void CycleRunTimer()
{
try
{
//读取托盘号
PalletNum = ServiceData.OpcTags.Where(p => p.TagId == StationCommunicatedTagInfos.Where(q => q.TagMarkCode == 1010).First().TagId).First().GetValue();
//托盘到位 完结工单
if (PalletNum > 0 && !PlanOk)
{
SqlSugarAdo.ExecuteCommand($"update Deploy_Data set process_state=4,all_time= '{DateTime.Now}' where tuopan_id='{PalletNum}' and process_state < 4");
//产品合格 修改序列号状态
SqlSugarAdo.ExecuteCommand($"update ProductSerialCodeRecord set WorkComplete=2 where PalletNum='{PalletNum}' and WorkComplete =1");
PlanOk = true;
}
if (PalletNum == 0 && PlanOk)
{
PlanOk = false;
}
}
catch (Exception ex)
{
LogHelper.WriteLog(LogHelper.GetMethodInfo(), ex);
}
}
}
}