0

DB2バックエンドでASP.Net3.5MVC1を使用しています。私の会社は、Microsoft SQL Server 2008 RSCLient PrintGDI+ダイアログボックスからバーコードを印刷しようとしています。これは実地棚卸アプリケーション用であるため、ファイルをPDFに保存してローカルで印刷することはできません。また、従業員がローカルのバーコードで悪いことをする可能性があるため(これらは適切なチェックです)、HTTP経由で印刷して印刷を制御する必要があります。 。各店舗にはプリントサーバーがありますが、Webサーバーは企業のITオフィスにあります。.gifを使用すると、バーコードの線がぼやけてスキャンガンで読み取れなくなるため、.jpegを使用する必要があると思います。

アプリケーションは数百のタグ(印刷スプールを完了するのに約5ページと約5分)で正常に動作しますが、2000のタグ(約+150 MBの300ページに近い)を印刷するには2時間かかります。アプリケーションでWiresharkを実行して、行き来するパケットをキャッチし、その情報をネットワークに渡しました。これが彼らの応答でした。

いいえ。タイムソース宛先プロトコル情報36628653.373235HTTP[TCPウィンドウフル]継続または非HTTPトラフィック36630654.245430TCP [TCP ZeroWindowProbe] http> 35503 [ACK] Seq = 26291213 Ack = 3730 Win = 63137 Len = 1

私は裏話で逸脱します。私の質問は、HTTPを介した印刷スプールの高速化を支援するためにどのタイプの戦略を使用できるかということです。Xページで印刷スプールを「切り取り」、残りを再スプールする必要がありますか?印刷アルゴリズムを変更する必要がありますか?.jpeg品質を失うことなく、印刷スプールのサイズを縮小する方法は何でしょうか。必要なビジネスロジックを処理するRSClientPrintのオープンソースまたは商用の代替手段はありますか?

さあ、コーディングの良さを!他に何か必要な場合はお知らせください。

        [AcceptVerbs(HttpVerbs.Post)]
    [Authorization(Roles = Roles.NonInquiry)]
    public ActionResult ReprintLabels(int eventId, int areaCode, int lowerLabelNumber, int upperLabelNumber)
    {
        if (!_eventAreaService.IsAreaEditable(eventId, areaCode))
            return RedirectToAction("Index", new { eventId = eventId });

        var printContext = _eventAreaService.ReprintLabels(eventId, areaCode, lowerLabelNumber, upperLabelNumber);

        ActionResult result = RedirectToAction("Index", new { eventId = eventId });
        if (printContext != null)
        {
            var redirectUrl = Url.RouteUrl(new { controller = "EventArea", action = "Index", eventId = eventId });
            Session[PrintContextViewModel.SessionKey] = new PrintContextViewModel(printContext, redirectUrl);

            result = RedirectToAction("PrintLabels", "LabelPrint");
        }

        return result;
    }

public InventoryAreaPrintContext ReprintLabels(int eventId, int areaCode, int lowerLabelBound, int upperLabelBound)
    {
        var user = _authentication.CurrentUser;

        if (user.IsInRole(Roles.CorporateInquiry) || user.IsInRole(Roles.StoreInquiry))
            throw new InvalidOperationException("User must be a non-inquiry role.");

        List<Fixture> fixturesToVoid = GetLabelsInRange(eventId, areaCode, lowerLabelBound, upperLabelBound).Where(f => f.StatusCode == FixtureStatus.Ready).ToList();

        if (fixturesToVoid.Count < 1) return null;

        // Void all old labels and tally the labels that to be recreated
        //      for each area involved.
        var voidFixturesByArea = new Dictionary<int, int>();
        foreach (var f in fixturesToVoid)
        {
            if (!voidFixturesByArea.ContainsKey(f.AreaCode))
                voidFixturesByArea[f.AreaCode] = 1;
            else
                voidFixturesByArea[f.AreaCode]++;

            f.StatusCode = FixtureStatus.VoidReplace;
            _fixtureRepo.Update(f);
        }

        var storeEvent = _storeEventRepository.FindEvent(user.DefaultStore, eventId);
        var lastUsedLabel = storeEvent.LastUsedLabelNumber;
        var affectedAreas = new List<InventoryArea>();

        // Create new labels for the affected areas.
        foreach (var pair in voidFixturesByArea)
        {
            var area = _areaRepo.FindByKey(user.DefaultStore.GroupCode, user.DefaultStore.ID, eventId, pair.Key);
            var fixtures = _fixtureBuilder.AddFixtures(lastUsedLabel.Value, area, pair.Value);
            fixtures.ForEach(f => _fixtureRepo.Insert(f));

            area.Fixtures = fixtures;
            affectedAreas.Add(area);
        }

        // Update the store event counts.
        var numberOfLabels = fixturesToVoid.Count();

        storeEvent.LastUsedLabelNumber += numberOfLabels;

        _storeEventRepository.Update(storeEvent);

        return new InventoryAreaPrintContext(_barcodeGenerator) { InventoryAreas = affectedAreas, StoreEvent = storeEvent, Store = user.DefaultStore };
    }

public class BarcodeGenerator : IBarcodeGenerator
{
    private readonly BarCodeImage.CodeSetEncoder _codeSetEncoder;

    public BarcodeGenerator(BarCodeImage.CodeSetEncoder codeSetEncoder)
    {
        _codeSetEncoder = codeSetEncoder;
    }

    public byte[] CreateBarcode(string barcodeText)
    {
        byte[] data;
        var generator = new BarCodeImage(barcodeText, _codeSetEncoder, true)
                            {
                                InsetText = false,
                                Font = new Font(
                                    FontFamily.GenericSansSerif,
                                    10,
                                    FontStyle.Regular,
                                    GraphicsUnit.Pixel)
                            };

        /** 
         * Keep the image dimensions at the same ratio as they will be displayed in the report.
         * Currently the report is set to a height to width ratio of 1/5 so we set the image
         * height to width at 1/5 as well. Otherwise the barcode will not scan properly.
         **/
        using (var image = generator.Render(50, 250))
        using (var ms = new MemoryStream())
        {
            image.Save(ms, ImageFormat.Jpeg);
            data = ms.GetBuffer();
        }

        return data;
    }
}
4

1 に答える 1

0

画像ラッパーを印刷スプーラーに送信する際に何か問題がありました。私がやったことは、iTextSharpのバーコード128クラスを使用し、基本的に画像ではなくフォントからバーコードを作成することでした。次に、人間が読めるテキストの場合は、バーコードオブジェクトのフィクスチャタグ文字列を渡して、その値を自分の値に設定しました。 .RDLCレポート。誰かがコードを欲しがっているなら、私にPMしてください。

于 2011-04-20T04:32:37.470 に答える