示例#1
0
        private void ScnmicrSetStatusBack(int iTransactionNumber, MainStatus mainStatus, ErrorCode subStatus, string portName)
        {
            ErrorCode ret;

            switch (mainStatus)
            {
            case MainStatus.MF_FUNCTION_START:
                break;

            case MainStatus.MF_CHECKPAPER_PROCESS_START:
                break;

            case MainStatus.MF_DATARECEIVE_START:
                _mutex.WaitOne(-1);
                _documents.Add(new Document());
                break;

            case MainStatus.MF_DATARECEIVE_DONE:
                var document = _documents[_documents.Count - 1];
                document.Cmc7 = "";
                document.Id   = iTransactionNumber;
                ret           = _mObjmfDevice.GetMicrText(iTransactionNumber, _mObjmfMicr);
                if (ret != ErrorCode.ERR_MICR_NODATA)
                {
                    if (!string.IsNullOrEmpty(_mObjmfMicr.MicrStr))
                    {
                        document.Cmc7 = _mObjmfMicr.MicrStr.Substring(0, _mObjmfMicr.MicrStr.IndexOf('\0'));
                        document.Cmc7 = document.Cmc7.Trim();
                    }
                }

                /*if (_mObjmfDevice.SCNSelectScanFace(ScanSide.MF_SCAN_FACE_FRONT) == ErrorCode.SUCCESS
                 *  && _mObjmfDevice.GetScanImage(iTransactionNumber, _mObjmfScanFront) == ErrorCode.SUCCESS
                 *  && _mObjmfDevice.SCNSelectScanFace(ScanSide.MF_SCAN_FACE_BACK) == ErrorCode.SUCCESS
                 *  && _mObjmfDevice.GetScanImage(iTransactionNumber, _mObjmfScanBack) == ErrorCode.SUCCESS)*/
                if (_mObjmfDevice.SCNSelectScanFace(ScanSide.MF_SCAN_FACE_FRONT) == ErrorCode.SUCCESS &&
                    _mObjmfDevice.GetScanImage(iTransactionNumber, _mObjmfScanFront) == ErrorCode.SUCCESS)
                {
                    document.RawImageFront = new byte[_mObjmfScanFront.Data.Length];
                    _mObjmfScanFront.Data.Read(document.RawImageFront, 0, document.RawImageFront.Length);
                    //document.RawImageBack = new byte[_mObjmfScanBack.Data.Length];
                    //_mObjmfScanBack.Data.Read(document.RawImageBack, 0, document.RawImageBack.Length);
                    //document.RawImage = TiffUtil.mergeTiffPages(aux);
                }

                if (_mObjmfDevice.SCNSelectScanFace(ScanSide.MF_SCAN_FACE_BACK) == ErrorCode.SUCCESS &&
                    _mObjmfDevice.GetScanImage(iTransactionNumber, _mObjmfScanBack) == ErrorCode.SUCCESS)
                {
                    document.RawImageBack = new byte[_mObjmfScanBack.Data.Length];
                    _mObjmfScanBack.Data.Read(document.RawImageBack, 0, document.RawImageBack.Length);
                }
                _mutex.ReleaseMutex();
                break;

            case MainStatus.MF_CHECKPAPER_PROCESS_DONE:
                break;

            case MainStatus.MF_FUNCTION_DONE:
                Scan();
                break;

            case MainStatus.MF_ERROR_OCCURED:
                _mutex.ReleaseMutex();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mainStatus), mainStatus, null);
            }
        }