提交代码
This commit is contained in:
@ -1,17 +1,23 @@
|
||||
using HandyControl.Controls;
|
||||
using Ping9719.WpfEx.Mvvm;
|
||||
using QRCoder;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Imaging;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using WCS.Model.ApiModel.OutStore;
|
||||
using 货架标准上位机.Api;
|
||||
using 货架标准上位机.Views.Controls;
|
||||
|
||||
namespace 货架标准上位机.ViewModels
|
||||
{
|
||||
@ -302,6 +308,17 @@ namespace 货架标准上位机.ViewModels
|
||||
return;
|
||||
}
|
||||
|
||||
//判断是否是信息化货架
|
||||
if (selectedOutOrder.ShelfTypeName == "信息化货架")
|
||||
{
|
||||
Growl.Info("请使用PDA进行出库");
|
||||
//生成二维码
|
||||
var qrCodeImage = GenerateQRCode(selectedOutOrder.Id.ToString() + "," + selectedOutOrder.OrderNumber);
|
||||
//展示二维码
|
||||
Dialog.Show(new ImageDialog(qrCodeImage));
|
||||
return;
|
||||
}
|
||||
|
||||
#region 调用接口开始出库
|
||||
var body = new GetOutOrderDetailRequest()
|
||||
{
|
||||
@ -340,6 +357,29 @@ namespace 货架标准上位机.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public BitmapImage GenerateQRCode(string data)
|
||||
{
|
||||
QRCodeGenerator qrGenerator = new QRCodeGenerator();
|
||||
QRCodeData qrCodeData = qrGenerator.CreateQrCode(data, QRCodeGenerator.ECCLevel.Q);
|
||||
QRCode qrCode = new QRCode(qrCodeData);
|
||||
Bitmap qrCodeImage = qrCode.GetGraphic(20, Color.Black, Color.White, true);
|
||||
// 将System.Drawing.Bitmap转换为System.Windows.Media.Imaging.BitmapImage
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
// 假设Bitmap的Save方法支持Png格式(通常是这样)
|
||||
qrCodeImage.Save(memoryStream, ImageFormat.Png);
|
||||
memoryStream.Position = 0;
|
||||
var bitmapImage = new BitmapImage();
|
||||
bitmapImage.BeginInit();
|
||||
bitmapImage.StreamSource = memoryStream;
|
||||
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
|
||||
bitmapImage.EndInit();
|
||||
|
||||
// 返回BitmapImage
|
||||
return bitmapImage;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand BtnPauseCommand { get => new DelegateCommand(BtnPause); }
|
||||
public void BtnPause()
|
||||
{
|
||||
|
Reference in New Issue
Block a user