protected override void OnReceiveNActionRequest(byte presentationID, ushort messageID, DicomUID requestedClass, DicomUID requestedInstance, ushort actionTypeID, DcmDataset dataset) { if (_session == null) { Log.Error("{0} -> A Basic Film Session does not exist for this association", LogID); SendAbort(DcmAbortSource.ServiceProvider, DcmAbortReason.NotSpecified); return; } DcmPrintDocument document = new DcmPrintDocument(_config, _session.Clone()); if (requestedClass == DicomUID.BasicFilmSessionSOPClass && actionTypeID == 0x0001) { foreach (DcmFilmBox box in _session.BasicFilmBoxes) document.AddFilmBox(box.Clone()); } else if (requestedClass == DicomUID.BasicFilmBoxSOPClass && actionTypeID == 0x0001) { DcmFilmBox box = _session.FindFilmBox(requestedInstance); if (box == null) { Log.Error("{0} -> Received N-ACTION request for invalid film box", LogID); SendAbort(DcmAbortSource.ServiceProvider, DcmAbortReason.NotSpecified); return; } document.AddFilmBox(box.Clone()); } else { SendAbort(DcmAbortSource.ServiceProvider, DcmAbortReason.NotSpecified); } DcmDataset result = null; NPrintState state = new NPrintState(); state.PresentationID = presentationID; state.Document = document; //DicomUID jobUid = DicomUID.Generate(_session.SOPInstanceUID, 9999); //jobUid = DicomUID.Generate(jobUid, _jobs.Count + 1); //DcmPrintJob job = new DcmPrintJob(jobUid); //job.ExecutionStatus = "PENDING"; //job.ExecutionStatusInfo = "QUEUED"; //job.CreationDateTime = DateTime.Now; //job.PrintPriority = _session.PrintPriority; //job.PrinterName = Config.Instance.PrinterSettings.PrinterName; //job.Originator = Associate.CallingAE; //result = new DcmDataset(DicomTransferSyntax.ImplicitVRLittleEndian); //result.AddReferenceSequenceItem(DicomTags.ReferencedPrintJobSequenceRETIRED, DicomUID.PrintJob, job.SOPInstanceUID); //state.Job = job; //_jobs.Add(job); new Thread(PrintJobProc).Start(state); SendNActionResponse(presentationID, messageID, requestedClass, requestedInstance, actionTypeID, result, DcmStatus.Success); if (state.Job != null) { SendNEventReportRequest(presentationID, NextMessageID(), DicomUID.PrintJobSOPClass, state.Job.SOPInstanceUID, 1, state.Job.Dataset); } }
protected override void OnReceiveNActionRequest(byte presentationID, ushort messageID, DicomUID requestedClass, DicomUID requestedInstance, ushort actionTypeID, DcmDataset dataset) { if (_session == null) { Log.Error("{0} -> A Basic Film Session does not exist for this association", LogID); SendAbort(DcmAbortSource.ServiceProvider, DcmAbortReason.NotSpecified); return; } DcmPrintDocument document = new DcmPrintDocument(_config, _session.Clone()); if (requestedClass == DicomUID.BasicFilmSessionSOPClass && actionTypeID == 0x0001) { foreach (DcmFilmBox box in _session.BasicFilmBoxes) { document.AddFilmBox(box.Clone()); } } else if (requestedClass == DicomUID.BasicFilmBoxSOPClass && actionTypeID == 0x0001) { DcmFilmBox box = _session.FindFilmBox(requestedInstance); if (box == null) { Log.Error("{0} -> Received N-ACTION request for invalid film box", LogID); SendAbort(DcmAbortSource.ServiceProvider, DcmAbortReason.NotSpecified); return; } document.AddFilmBox(box.Clone()); } else { SendAbort(DcmAbortSource.ServiceProvider, DcmAbortReason.NotSpecified); } DcmDataset result = null; NPrintState state = new NPrintState(); state.PresentationID = presentationID; state.Document = document; //DicomUID jobUid = DicomUID.Generate(_session.SOPInstanceUID, 9999); //jobUid = DicomUID.Generate(jobUid, _jobs.Count + 1); //DcmPrintJob job = new DcmPrintJob(jobUid); //job.ExecutionStatus = "PENDING"; //job.ExecutionStatusInfo = "QUEUED"; //job.CreationDateTime = DateTime.Now; //job.PrintPriority = _session.PrintPriority; //job.PrinterName = Config.Instance.PrinterSettings.PrinterName; //job.Originator = Associate.CallingAE; //result = new DcmDataset(DicomTransferSyntax.ImplicitVRLittleEndian); //result.AddReferenceSequenceItem(DicomTags.ReferencedPrintJobSequenceRETIRED, DicomUID.PrintJob, job.SOPInstanceUID); //state.Job = job; //_jobs.Add(job); new Thread(PrintJobProc).Start(state); SendNActionResponse(presentationID, messageID, requestedClass, requestedInstance, actionTypeID, result, DcmStatus.Success); if (state.Job != null) { SendNEventReportRequest(presentationID, NextMessageID(), DicomUID.PrintJobSOPClass, state.Job.SOPInstanceUID, 1, state.Job.Dataset); } }