You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.7 KiB
C#

using Admin.Core.Common;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace Admin.Core.Wpf.ViewModels
{
public partial class PrintToDevViewModel : ObservableObject
{
public PrintToDevViewModel() { }
public PrintToDevViewModel(string planCode, string orderNo, string materialName, int planAmount, string? barCode)
{
PlanCode = planCode;
OrderNo = orderNo;
MaterialName = materialName;
PlanAmount = planAmount;
if (barCode.IsNotEmptyOrNull()) BarCode = barCode;
ExecPrint(planCode, orderNo, materialName, planAmount);
}
#region 选中订单参数
#region 计划编码
private string _planCode;
public string PlanCode { get => _planCode; set => SetProperty(ref _planCode, value); }
#endregion
#region 订单编码
private string _orderNo;
public string OrderNo { get => _orderNo; set => SetProperty(ref _orderNo, value); }
#endregion
#region 物料型号
private string _materialName;
public string MaterialName { get => _materialName; set => SetProperty(ref _materialName, value); }
#endregion
#region 条码
private string _barCode;
public string BarCode { get => _barCode; set => SetProperty(ref _barCode, value); }
#endregion
#region 计划数量
private int _planAmount;
public int PlanAmount { get => _planAmount; set => SetProperty(ref _planAmount, value); }
#endregion
#endregion
#region 暂停打印、取消打印
[RelayCommand]
public void Operate(string param)
{
if (string.IsNullOrEmpty(param)) return;
switch (param)
{
case "Suspend":
MessageBox.Show("暂停打印中....","系统信息");
break;
case "Cancel":
MessageBox.Show("取消打印中....","系统信息");
break;
default:
break;
}
}
#endregion
#region 执行打印
/// <summary>
/// 执行打印
/// </summary>
/// <param name="planCode"></param>
/// <param name="orderNo"></param>
/// <param name="materialName"></param>
/// <param name="planAmount"></param>
public void ExecPrint(string planCode, string orderNo, string materialName, int planAmount)
{
//对接打印机
}
#endregion
}
}