Exemplo n.º 1
0
        //場景: printer向spi查詢狀態 (SPI狀態更新時呼叫)
        //發送IIInspStatusRequest.txt
        public void SendSpiStatusToPrinter(eSpiExecutionStatus status)
        {
            Log4.PrinterLogger.InfoFormat("@SendSpiStatusToPrinter({0})", status.ToString());

            string fileName = _RPCPara.WorkingPath + "IIInspStatusRequest.txt";

            Log4.PrinterLogger.InfoFormat("fileName = {0}", fileName);
            FileClass.TextWriter writer = new FileClass.TextWriter(fileName);
            writer.StrList.Add(string.Format("MachineStatus={0}", (int)status));
            writer.StrList.Add(string.Format("MachineId={0}", /*exportDataReg.StationID*/ "SPI"));//暫時
            writer.Run();
            writer.Dispose();
            writer = null;
        }
Exemplo n.º 2
0
        public override bool Output(InspectedPanel currentPanel, object file)
        {
            //WriteFileToMergedFolder(原)
            MPM_PrinterData MPMData = file as MPM_PrinterData;
            string          netDrive;

            //if (!PrinterSFSetting.IsOutEnable)
            //{
            //    Log4.PrinterLogger.ErrorFormat("Doesn't have a out SharedFolder");
            //    return false;
            //}
            //else
            netDrive = _RPCPara.WorkingPath;//放在同層
            string path = netDrive + String.Format("{0:yyyyMMddHHmmss}.xml", currentPanel.InspectStartTime);

            Log4.PrinterLogger.InfoFormat(" path={0}", path);
            FileClass.TextWriter writer = new FileClass.TextWriter(path);
            writer.StrList.Add(string.Format("XCorrection={0}", Math.Round((_CenterOffsetResult.Dx * 0.001), 6).ToString()));
            writer.StrList.Add(string.Format("YCorrection={0}", Math.Round((_CenterOffsetResult.Dy * 0.001), 6).ToString()));
            writer.StrList.Add(string.Format("ThetaCorrection={0}", Math.Round(_RotationResult.Theta, 6).ToString()));
            writer.StrList.Add(string.Format("XCenterofRotation={0}", Math.Round((_RotationResult.Center.X * 0.001), 6).ToString()));
            writer.StrList.Add(string.Format("YCenterofRotation={0}", Math.Round((_RotationResult.Center.Y * 0.001), 6).ToString()));
            writer.Run();
            writer.Dispose();
            writer = null;

            //(原)SendToPrinter
            string dstPath = _RPCPara.WorkingPath + GetLane() + "IIPrtBoardInspectedData.txt";

            MoveFile(path, dstPath, true);

            long boardNumber;

            //long.TryParse(MPMData.PanelSN, out boardNumber);
            boardNumber = ViewModelLocator.Atom.PrinterWindowVM.SN;

            bool boardIDProvided = MPMData.IsBarcodeMatched(MPMData, currentPanel.Panel.PanelBarcode);

            string barCode     = (boardIDProvided == true) ? MPMData.BoardId : "NONE";
            string modelName   = currentPanel.Panel.ModelName;
            long   boardStatus = 1;

            ulong inspectedLow = (ulong)((currentPanel.InspectStartTime.AddHours(-8) - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds);

            //string dataPath = "\"" + MPMData.FullFilePath + "\"";
            string dataPath = "\"" + path + "\"";

            double dx    = Math.Round((_CenterOffsetResult.Dx * 0.001), 6);
            double dy    = Math.Round((_CenterOffsetResult.Dy * 0.001), 6);
            double theta = Math.Round(_RotationResult.Theta, 6);
            double cx    = Math.Round((_RotationResult.Center.X * 0.001), 6);
            double cy    = Math.Round((_RotationResult.Center.Y * 0.001), 6);

            modelName = modelName.Replace(" ", "");
            string argument = string.Format("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13}",
                                            "IIPrtBoardInspectedData", GetLane(), boardNumber, (boardIDProvided == true) ? "1" : "0", barCode, modelName, boardStatus, inspectedLow, dataPath,
                                            dx, dy, theta, cx, cy);

            System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
            info.WorkingDirectory = _RPCPara.WorkingPath;
            info.FileName         = "PClientExe.exe";
            info.Arguments        = argument;
            Log4.PrinterLogger.InfoFormat("info.WorkingDirectory={0}", info.WorkingDirectory);
            Log4.PrinterLogger.InfoFormat("info.FileName        ={0}", info.FileName);
            Log4.PrinterLogger.InfoFormat("info.Arguments       ={0}", info.Arguments);

            System.Diagnostics.Process proc = System.Diagnostics.Process.Start(info);
            proc.WaitForExit();

            bool IsWipe = (_WipeReason != eWipeStencilReason.NoNeedToWipe);

            if (IsWipe == true)
            {
                SendWipeNow(inspectedLow);
            }



            return(true);
        }