You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

86 lines
2.4 KiB

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
{
/// <summary>
/// 工位标签信息
/// </summary>
public static List<StationTagInfo> StationTagInfos { get; set; }
/// <summary>
/// 工位报警标签信息
/// </summary>
public static List<StationTagInfo> StationAlarmTagInfos { get; set; }
/// <summary>
/// 工位质量数据标签信息
/// </summary>
public static List<StationTagInfo> StationQualityTagInfos { get; set; }
/// <summary>
/// 工位交互数据标签信息
/// </summary>
public static List<StationTagInfo> StationCommunicatedTagInfos { get; set; }
/// <summary>
/// 工位信息
/// </summary>
public static StationInfo StationInf { get; set; }
/// <summary>
/// 托盘号
/// </summary>
public static byte PalletNum { get; set; }
public static OrderRecord PresentOrder { get; set; }
public static bool PlanOk { get; set; }
/// <summary>
/// 业务逻辑
/// </summary>
public static void CycleRunTimer()
{
try
{
//读取托盘号
PalletNum = ServiceData.OpcTags.Where(p => p.TagId == StationCommunicatedTagInfos.Where(q => q.TagMarkCode == 1010).First().TagId).First().GetValue<byte>();
//托盘到位 完结工单
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);
}
}
}
}