1.出库单据、生成出库单据、计算物料时增加货架类型用于区分信息化货架和智能货架的物料 实现分开出

This commit is contained in:
hehaibing-1996
2024-05-21 10:32:52 +08:00
parent 649e22b4ce
commit b2f9c7cc22
48 changed files with 976 additions and 125 deletions

View File

@ -1,15 +1,26 @@
using HandyControl.Controls;
using HandyControl.Tools.Extension;
using Microsoft.Win32;
using Ping9719.WpfEx.Mvvm;
using QRCoder;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.IO.Ports;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media.Imaging;
using WCS.Model;
using .Api;
using .Views.Controls;
using static System.Net.WebRequestMethods;
namespace .ViewModel
{
@ -215,5 +226,61 @@ namespace 货架标准上位机.ViewModel
{
}
}
public ICommand AppQRCodeCommand { get => new DelegateCommand(AppQRCode); }
public void AppQRCode()
{
try
{
#region App名称
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "fileDownload/getLatestAppName", null, "GET");
if (Result != null && Result.Code == 200)
{
//拼凑url
var downLoadUrl = LocalFile.Config.ApiIpHost + $"fileDownload/downloadApp?fileName={Result.Data}";
//生成二维码
var qrCodeImage = GenerateQRCode(downLoadUrl);
//展示二维码
Dialog.Show(new ImageDialog(qrCodeImage));
}
else if (Result != null)
{
Growl.Warning(Result.Message);
}
else
{
Growl.Warning("调用接口失败!");
}
#endregion
}
catch
{
}
}
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;
}
}
}
}