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.
AUCMA_SCADA/Aucma.Core.SheetMetal/ViewModels/QuantityIssuedViewModel.cs

116 lines
4.2 KiB
C#

using Admin.Core.Model;
using Aucma.Core.SheetMetal.Models;
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 Aucma.Core.SheetMetal.ViewModels
{
public partial class QuantityIssuedViewModel : ObservableObject
{
public QuantityIssuedViewModel(ProductPlanInfoModel productPlanInfo) {
PlanInfo = productPlanInfo;
}
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);
}
[RelayCommand]
private void PlanInfoTransmit()
{
var productPlanInfo = _PlanInfo;
//if (productPlanInfo != null)
//{
// var materialType = productPlanInfo.MaterialCode;
// bool shellResult = assemblyPlanBusiness.JudgmentStock(productPlanInfo, Convert.ToInt32(_TransmitAmount), appConfig.shellMaterialType, appConfig.shellStoreCode);
// if (!shellResult)
// {
// MessageBox.Show("计划下达失败,箱壳物料库存不足", "提示", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
// return;
// }
// bool linerResult = assemblyPlanBusiness.JudgmentStock(productPlanInfo, Convert.ToInt32(_TransmitAmount), appConfig.linerMaterialType, appConfig.linerStoreCode);
// if (!linerResult)
// {
// MessageBox.Show("计划下达失败,内胆物料库存不足", "提示", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
// return;
// }
//if (!shellResult && !linerResult)
//{
// MessageBox.Show("计划下达失败,箱壳、内胆物料库存不足");
// return;
//}else if(!shellResult || !linerResult)
//{
// if (!shellResult)
// {
// MessageBox.Show("计划下达失败,箱壳物料库存不足");
// return;
// }
// else if (!linerResult)
// {
// MessageBox.Show("计划下达失败,内胆物料库存不足");
// return;
// }
//}
//}
//else
//{
// MessageBox.Show("生产计划获取失败,加载为空", "提示", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
// return;
//}
//bool result = assemblyPlanBusiness.PlanTransmitByProductPlan(_PlanInfo.planCode, Convert.ToInt32(_TransmitAmount));
//if (result)
//{
// MessageBox.Show("执行计划维护成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
//}
}
[RelayCommand]
private void ClearTransmitAmount()
{
string amount = _TransmitAmount.ToString();
if (amount.Length > 0)
{
TransmitAmount = amount.Substring(0, amount.Length - 1);
}
}
[RelayCommand]
private void KeypadButton(object obj)
{
var info = obj as string;
TransmitAmount += info;
}
[RelayCommand]
private void CloseWindow(object parameter)
{
var window = parameter as Window;
if (window != null)
{
window.Close();
}
}
}
}