CarlosAvalos.MES.MESToolkit 1.0.5

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package CarlosAvalos.MES.MESToolkit --version 1.0.5
                    
NuGet\Install-Package CarlosAvalos.MES.MESToolkit -Version 1.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CarlosAvalos.MES.MESToolkit" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CarlosAvalos.MES.MESToolkit" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="CarlosAvalos.MES.MESToolkit" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CarlosAvalos.MES.MESToolkit --version 1.0.5
                    
#r "nuget: CarlosAvalos.MES.MESToolkit, 1.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CarlosAvalos.MES.MESToolkit@1.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CarlosAvalos.MES.MESToolkit&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=CarlosAvalos.MES.MESToolkit&version=1.0.5
                    
Install as a Cake Tool

MES.MESToolkit

A .NET 9 class library for MES (Manufacturing Execution System) integration. Provides reusable components for industrial environments including scanner communication, label printing, Phidget I/O, datamatrix parsing, and structured logging.

License: MIT

Installation

dotnet add package CarlosAvalos.MES.MESToolkit

Or via NuGet Package Manager:

Install-Package CarlosAvalos.MES.MESToolkit

Features

Module Description
Scanners Serial port and TCP/IP scanner connections (Keyence, etc.) with factory pattern
Printing Zebra ZPL label printing via USB, shared network, or TCP/IP
Logging Structured logging with Serilog (console, file, optional Seq)
Helpers Datamatrix parsing, date codes (YYWW), XML config, ZPL utilities
IO/Phidgets Phidget 1012 digital I/O control

Quick Start

Scanner Connection

using MES.MESToolkit.Scanners;

// TCP/IP scanner (e.g. Keyence SR-1000)
var config = ScannerConnectionConfig.ForTcpIp("192.168.1.50", 9004);
var scanner = ScannerConnectionFactory.CreateAndConnect(config);

if (scanner != null)
{
    scanner.DataReceived += (s, data) => Console.WriteLine($"Scanned: {data}");
}

// Serial port scanner
var serialConfig = ScannerConnectionConfig.ForSerialPort("COM3", 9600);
var serialScanner = ScannerConnectionFactory.CreateAndConnect(serialConfig);

Label Printing (Zebra ZPL)

using MES.MESToolkit.Abstractions;
using MES.MESToolkit.Commands;
using MES.MESToolkit.Printing;

var printer = new ZebraPrinter();
var config = new PrinterConnectionConfig
{
    Mode = PrinterConnectionMode.TcpIp,
    Address = "192.168.1.100",
    Port = 9100
};

// From ZPL template with parameters
var label = new ZplLabelCommand("^XA^FO50,50^A0N,50,50^FD{0}^FS^XZ", "Hello World");
var result = await printer.PrintLabelAsync(config, label);

// From file
var fileLabel = ZplLabelCommand.FromFile(@"C:\Labels\template.zpl", "SN001", "PartXYZ");

Logging with DI

using MES.MESToolkit.Configuration;
using MES.MESToolkit.Logging;

// In your DI setup:
services.AddMESLogger(options =>
{
    options.LogDirectory = @"C:\Logs";
    options.LogFileName = "MyApp.log";
    options.SeqUrl = "http://my-seq-server:5341"; // Optional
});

// Usage:
public class MyService
{
    private readonly IMESLogger _logger;

    public MyService(IMESLogger logger)
    {
        _logger = logger.ForContext<MyService>();
    }

    public void DoWork()
    {
        _logger.Information("Processing started");
    }
}

Datamatrix Parsing

using MES.MESToolkit.Helpers;

string scan = "P27-1218-076-01,MUX42601300002,A,05679HM,11111777,2603,1,MX";

var data = DatamatrixHelper.ParseDatamatrix(scan);
// data.PartNumber = "P27-1218-076-01"
// data.Serial = "MUX42601300002"
// data.MFGOrder = "11111777"

var validation = DatamatrixHelper.ValidatePartNumber(scan, "P27-1218-076-01");
// validation.IsValid = true

Phidget 1012 I/O

using MES.MESToolkit.IO.Phidgets;

using var phidget = new Phidget1012Helper();
await phidget.ConnectAsync();

phidget.Input0Activated += (s, e) => Console.WriteLine("Input 0 triggered!");
phidget.SetOutputState(0, true);
await phidget.PulseOutputAsync(1, 500); // 500ms pulse on channel 1

Date Code Helper

using MES.MESToolkit.Helpers;

string dateCode = DateCodeHelper.GetTodayIsoDateCodeYYWW(); // e.g. "2531"

Project Structure

src/MES.MESToolkit/
├── Abstractions/     # Interfaces (ILabelCommand, ILabelPrinter)
├── Commands/         # Label command implementations (ZPL)
├── Configuration/    # DI extension methods
├── Helpers/          # Datamatrix, DateCode, XML, ZPL, CMD utilities
├── IO/Phidgets/      # Phidget 1012 digital I/O
├── Logging/          # IMESLogger + Serilog implementation
├── Printing/         # Printer implementations (Zebra)
└── Scanners/         # Scanner connections (Serial, TCP/IP)

Building

dotnet build

Creating NuGet Package

dotnet pack -c Release

The .nupkg will be in src/MES.MESToolkit/bin/Release/.

License

MIT License - see LICENSE for details.

Authors

CRAC - Manufacturing Engineering Solutions

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated