| | |
| | | [ApiController] |
| | | [Route("[controller]")] |
| | | public class PrintController : Controller |
| | | {//{ |
| | | // private readonly IPrintService _print; |
| | | // public PrintController(IPrintService print) |
| | | // { |
| | | // _print = print; |
| | | // } |
| | | { |
| | | const string PrintName = "Deli DL-888B(NEW)"; |
| | | [HttpGet, HttpPost, Route("PrintInboundOrder"), AllowAnonymous] |
| | | public object PrintInboundOrder([FromBody] InboundOrder inbound) |
| | | public object PrintInboundOrder([FromBody] List<InboundOrder> inbounds) |
| | | { |
| | | try |
| | | { |
| | | foreach (var inbound in inbounds) |
| | | { |
| | | string ReportPathmater = System.IO.Directory.GetCurrentDirectory(); |
| | | string MFile = string.Empty; |
| | | MFile = ReportPathmater + "\\frx\\MaterMode.frx"; |
| | | MFile = ReportPathmater + "\\frx\\InboundOrder.frx"; |
| | | Report report = new Report(); |
| | | report.Load(MFile); |
| | | report.PrintSettings.ShowDialog = false; |
| | | System.Drawing.Printing.PrinterSettings oitem = new System.Drawing.Printing.PrinterSettings(); |
| | | report.PrintSettings.Printer = PrintName; |
| | | BarcodeObject OrderNoObj = report.FindObject("OrderNo") as BarcodeObject; |
| | | if (OrderNoObj != null) |
| | | { |
| | |
| | | } |
| | | report.Print(); |
| | | report.Dispose(); |
| | | return true; |
| | | } |
| | | return new { code = 200, status = false }; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | return ex.Message; |
| | | } |
| | | } |
| | | |
| | | [HttpGet, HttpPost, Route("PrintPalletCode"), AllowAnonymous] |
| | | public object PrintPalletCode([FromBody] List<string> PalletCodes) |
| | | { |
| | | try |
| | | { |
| | | foreach (var item in PalletCodes) |
| | | { |
| | | string ReportPathmater = System.IO.Directory.GetCurrentDirectory(); |
| | | string MFile = string.Empty; |
| | | MFile = ReportPathmater + "\\frx\\PalletCode.frx"; |
| | | Report report = new Report(); |
| | | report.Load(MFile); |
| | | report.PrintSettings.ShowDialog = false; |
| | | System.Drawing.Printing.PrinterSettings oitem = new System.Drawing.Printing.PrinterSettings(); |
| | | report.PrintSettings.Printer = PrintName; |
| | | BarcodeObject OrderNoObj = report.FindObject("PalletCode") as BarcodeObject; |
| | | if (OrderNoObj != null) |
| | | { |
| | | OrderNoObj.Text = item; |
| | | } |
| | | report.Print(); |
| | | report.Dispose(); |
| | | } |
| | | return new { code = 200, status = false }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return ex.Message; |
| | | } |
| | | } |
| | | |
| | | |
| | | public class InboundOrder |
| | | { |
| | | public string OrderNo { get; set; } |
| | |
| | | public decimal Weight { get; set; } |
| | | } |
| | | } |
| | | |
| | | } |