using LB_VisionProcesses.Communicators; using System.Collections; using System.Collections.Concurrent; using System.Diagnostics; namespace LB_VisionProcesses.Processes { class CheckCraftTool : BaseProcess { public CheckCraftTool() { strProcessName = "工序检查工具"; strProcessClass = "LB_VisionProcesses.Processes.CheckCraftTool"; Params.Inputs.Add("产品SN", ""); Params.Inputs.Add("工序码", "36"); } string SN = string.Empty; public override bool Run() { try { InitRunParams(); SN = Params.Inputs["产品SN"]?.ToString(); string CraftCode = Params.Inputs["工序码"].ToString(); if (string.IsNullOrEmpty(SN)) { Msg = $"产品SN为空"; Result = false; return false; } else this.SN = SN; if ("Erro" == GetWebServer.GetTVInfo("http://10.222.16.22:9006/api/PE", "GetTVInfo", SN)) { Msg = $"{SN}的GetTVInfo结果为Erro"; Result = false; return false; } string nowCraftCode = GetWebServer.GetNextProcessCode("http://10.222.16.22:9006/api/PE", "GetNextProcessCode", SN); if (CraftCode != nowCraftCode) { Msg = $"{SN}工序码为{nowCraftCode},不为设置的{CraftCode}"; Result = false; return false; } } catch (Exception ex) { Msg = $"运行出现异常,原因是:{ex.Message}【{ex.StackTrace}】"; Result = false; } return Result; } public override bool Load(string fullPath = null) { bool res = base.Load(fullPath); if (res) this.SN = Params.Inputs["SN"]?.ToString(); return res; } } }