Exemple #1
0
        private void SendResult(EMachineCommand command, InspectResult result)
        {
            if (_client == null)
            {
                return;
            }

            string message = string.Empty;

            switch (command)
            {
            case EMachineCommand.Result:
                //ach
                message = string.Format("{0},{1},{2},{3}\r", command, result.Judgement, result.WaferID, result.FolderPath);
                break;
            }
            byte[] buff = Encoding.ASCII.GetBytes(message);

            var stream = _client.GetStream();

            stream.Write(buff, 0, buff.Length);

            resultbufferCommand    = command.ToString();
            resultbufferJudge      = result.Judgement.ToString();
            resultbufferWaferID    = result.WaferID;
            resultbufferMessage    = result.Resultmessage;
            resultbufferFolderPath = result.FolderPath;
        }
        public InspectResult Inspect(IEnumerable <GrabInfo> grabInfos, string waferID, CancellationToken token)
        {
            if (grabInfos.Count() == 0)
            {
                return(null);
            }

            if (Directory.Exists(_coreConfig.GetTempPath()) == false)
            {
                Directory.CreateDirectory(_coreConfig.GetTempPath());
            }

            var directoryPath = _coreConfig.GetTempPath();

            if (waferID != null)
            {
                directoryPath = Path.Combine(directoryPath, waferID);
            }

            if (Directory.Exists(directoryPath) == false)
            {
                Directory.CreateDirectory(directoryPath);
            }

            int count = 1;

            foreach (var grabInfo in grabInfos)
            {
                //Modify.ach.20210601.Camera 예외처리.Start...
                if (grabInfo.Data != null)
                {
                    Save(grabInfo, Path.Combine(directoryPath, count.ToString()));
                    count++;
                }
                //Modify.ach.20210601.Camera 예외처리.End
            }

            var command = GetStat(token);

            switch (command)
            {
            case EStatCommand.Ready:
                break;

            case EStatCommand.Busy:
            case EStatCommand.Error:
            case EStatCommand.None:
                break;
            }

            Inspect(waferID, directoryPath, token);
            //결과값에 따른 result 값 변경해야함.
            var inspectResult = new InspectResult(EJudgement.Fail, ParseMessages());

            inspectResult.Resultmessage = Resultmessages;
            inspectResult.FolderPath    = directoryPath;
            inspectResult.WaferID       = waferID;

            //?
            if (Inspected != null)
            {
                Inspected(inspectResult);
            }

            //Send(Path.GetFullPath(directoryPath));

            return(inspectResult);
        }