|
|
|
|
using Admin.Core.IService;
|
|
|
|
|
using Admin.Core.Model;
|
|
|
|
|
using Admin.Core.Service;
|
|
|
|
|
using Aucma.Core.SheetMetal.Models;
|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
|
using log4net;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.IdentityModel.Logging;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
{
|
|
|
|
|
public partial class QuantityIssuedViewModel : ObservableObject
|
|
|
|
|
{
|
|
|
|
|
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(QuantityIssuedViewModel));
|
|
|
|
|
private IBaseBomInfoServices _bomInfoServices;
|
|
|
|
|
private IBaseSpaceDetailServices _spaceDetailServices;
|
|
|
|
|
|
|
|
|
|
#region 构造函数
|
|
|
|
|
public QuantityIssuedViewModel(ProductPlanInfoModel productPlanInfo)
|
|
|
|
|
{
|
|
|
|
|
_bomInfoServices = App.ServiceProvider.GetService<IBaseBomInfoServices>();
|
|
|
|
|
_spaceDetailServices = App.ServiceProvider.GetService<IBaseSpaceDetailServices>();
|
|
|
|
|
PlanInfo = productPlanInfo;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 属性
|
|
|
|
|
private ProductPlanInfoModel _PlanInfo = new ProductPlanInfoModel();
|
|
|
|
|
public ProductPlanInfoModel PlanInfo
|
|
|
|
|
{
|
|
|
|
|
get => _PlanInfo;
|
|
|
|
|
set => SetProperty(ref _PlanInfo, value);
|
|
|
|
|
}
|
|
|
|
|
private string _TransmitAmount = string.Empty;
|
|
|
|
|
public string TransmitAmount
|
|
|
|
|
{
|
|
|
|
|
get => _TransmitAmount;
|
|
|
|
|
set => SetProperty(ref _TransmitAmount, value);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 下传计划
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下传计划
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private void PlanInfoTransmit()
|
|
|
|
|
{
|
|
|
|
|
var productPlanInfo = _PlanInfo;
|
|
|
|
|
|
|
|
|
|
if (productPlanInfo != null)
|
|
|
|
|
{
|
|
|
|
|
//下传到PLC
|
|
|
|
|
|
|
|
|
|
//拆分计划到任务表中
|
|
|
|
|
|
|
|
|
|
//bool result = PlanTransmitByProductPlan(_PlanInfo.PlanCode, Convert.ToInt32(_TransmitAmount));
|
|
|
|
|
//if (result)
|
|
|
|
|
//{
|
|
|
|
|
// MessageBox.Show("执行计划维护成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("生产计划获取失败,加载为空", "提示", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 清除
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 清除
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private void ClearTransmitAmount()
|
|
|
|
|
{
|
|
|
|
|
string amount = _TransmitAmount.ToString();
|
|
|
|
|
if (amount.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
TransmitAmount = amount.Substring(0, amount.Length - 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region KeypadButton
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private void KeypadButton(object obj)
|
|
|
|
|
{
|
|
|
|
|
var info = obj as string;
|
|
|
|
|
|
|
|
|
|
TransmitAmount += info;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 关闭
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 关闭
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="parameter"></param>
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private void CloseWindow(object parameter)
|
|
|
|
|
{
|
|
|
|
|
var window = parameter as Window;
|
|
|
|
|
if (window != null)
|
|
|
|
|
{
|
|
|
|
|
window.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|