} //封包資料//ex: 41 42 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #endregion public bool IsBarcodeMatched(object fileobj, string barcode) { MPM_PrinterData data = fileobj as MPM_PrinterData; if (data.BoardId == barcode) { return(true); } else { return(false); } }
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); }
public object Parse(string filepath) { MPM_PrinterData ret = new MPM_PrinterData(); try { PrinterCenter.FileClass.TextReader reader = new PrinterCenter.FileClass.TextReader(filepath); reader.Run(); long lValue; int nValue; string sValue = string.Empty; string sLebel = string.Empty; char[] separator = { '=' }; foreach (string s in reader.StrList) { string[] words = s.Split(separator); if (words.Count() != 2) { continue; } sLebel = words[0]; sValue = words[1]; switch (sLebel) { case "PrinterAddress": ret.PrinterAddress = sValue; break; case "BoardNumber": if (long.TryParse(sValue, out lValue) == true) { ret.BoardNumber = lValue; } else { ret.BoardNumber = 0; } break; case "BoardIdProvided": if (int.TryParse(sValue, out nValue) == true) { ret.IsBoardIdProvided = (nValue == 1) ? true : false; } else { ret.IsBoardIdProvided = false; } break; case "BoardId": ret.BoardId = sValue; break; case "ProcessProgramName": ret.ProcessProgramName = sValue; break; case "NumFids": if (int.TryParse(sValue, out nValue) == true) { ret.NumFids = nValue; } else { ret.NumFids = 0; } break; case "FidPosX": ret.FidPosXList = GetFidPosValue(sValue); break; case "FidPosY": ret.FidPosYList = GetFidPosValue(sValue); break; case "BoardStatus": if (int.TryParse(sValue, out nValue) == true) { ret.BoardStatus = (nValue == 0) ? 0 : 1; } else { ret.BoardStatus = 0; } break; case "StrokeFrontToRear": if (int.TryParse(sValue, out nValue) == true) { ret.IsStrokeFrontToRear = (nValue == 1) ? true : false; } else { ret.IsStrokeFrontToRear = false; } break; case "ProcessedTimeStampLow": if (long.TryParse(sValue, out lValue) == true) { ret.ProcessedTimeStampLow = lValue; } else { ret.ProcessedTimeStampLow = 0; } break; case "ProcessedTimeStampHigh": if (long.TryParse(sValue, out lValue) == true) { ret.ProcessedTimeStampHigh = lValue; } else { ret.ProcessedTimeStampHigh = 0; } break; case "PackagedDataLength": if (int.TryParse(sValue, out nValue) == true) { ret.PackagedDataLength = nValue; } else { ret.PackagedDataLength = 0; } break; case "PackagedData": ret.PackagedData = GetPackagedData(sValue); break; default: break; } } reader.Dispose(); reader = null; //PrintTime = new DateTime(1970, 1, 1, 0, 0, 0).AddHours(8).AddSeconds(processedTimeStampLow); } catch (Exception exception) { Log4.PrinterLogger.ErrorFormat("MPM Printer Data Pasre Exception: {0}", filepath); Log4.PrinterLogger.ErrorFormat("Message: {0}", exception.Message); return(null); } return(ret); }