|
|
|
|
using Admin.Core.IService;
|
|
|
|
|
using Admin.Core.Model;
|
|
|
|
|
using Admin.Core.Model.ViewModels;
|
|
|
|
|
using Admin.Core.Service;
|
|
|
|
|
using Aucma.Core.PalletizCX1.Business;
|
|
|
|
|
using Aucma.Core.PalletizCX1.Models;
|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
|
using Elasticsearch.Net.Specification.MachineLearningApi;
|
|
|
|
|
using log4net;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
|
|
|
|
namespace Aucma.Core.PalletizCX1.ViewModels
|
|
|
|
|
{
|
|
|
|
|
public partial class HandPalletizViewModel : ObservableObject
|
|
|
|
|
{
|
|
|
|
|
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(HandPalletizViewModel));
|
|
|
|
|
public static StackInfoModel tempStackInfo = new StackInfoModel();
|
|
|
|
|
private readonly IBaseSpaceInfoServices _baseSpaceInfoServices;
|
|
|
|
|
private readonly IRecordInStoreServices _recordInstoreServices;
|
|
|
|
|
private readonly ICodeBindingRecordServices? _codeBindingRecordServices;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 手动入库委托
|
|
|
|
|
/// </summary>
|
|
|
|
|
public delegate void HandSend(string spaceArea, string asciiStr);
|
|
|
|
|
public static event HandSend? HandSendEvent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public HandPalletizViewModel()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
_codeBindingRecordServices = App.ServiceProvider.GetService<ICodeBindingRecordServices>();
|
|
|
|
|
init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void init()
|
|
|
|
|
{
|
|
|
|
|
List<ProductAllModel> list = _codeBindingRecordServices.GetAllProductModel();
|
|
|
|
|
if (list == null || list.Count == 0) return;
|
|
|
|
|
list = list.OrderBy(x => x.ProductMasterModel).ToList();
|
|
|
|
|
MaterialDataGrid.Clear();
|
|
|
|
|
Application.Current.Dispatcher.Invoke(() =>
|
|
|
|
|
{
|
|
|
|
|
foreach (ProductAllModel info in list)
|
|
|
|
|
{
|
|
|
|
|
MaterialDataGrid.Add(info);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 鼠标双击事件
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 鼠标双击事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
|
public void MouseClick(object obj)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var info = SelectedDataItem;
|
|
|
|
|
if (info != null)
|
|
|
|
|
{
|
|
|
|
|
ProductCode = info.ProductCode;
|
|
|
|
|
ProductModel = info.ProductModel;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 初始化下拉列表
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化下拉列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
private ProductAllModel selectedDataItem;
|
|
|
|
|
public ProductAllModel SelectedDataItem
|
|
|
|
|
{
|
|
|
|
|
get { return selectedDataItem; }
|
|
|
|
|
set => SetProperty(ref selectedDataItem, value);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 分垛信息下传
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分垛信息下传
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
public void Save(Window window)
|
|
|
|
|
{
|
|
|
|
|
if (Area == null)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先选择区域");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(ProductCode))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先选择产品型号");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
MessageBox.Show("手动入库成功");
|
|
|
|
|
// 入库
|
|
|
|
|
HandSendEvent?.Invoke(Area.Content.ToString(), productCode);
|
|
|
|
|
|
|
|
|
|
window.Close();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分垛信息下传
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
public void Cancel(Window window)
|
|
|
|
|
{
|
|
|
|
|
window.Close();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 初始化datagrid产品信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化物料信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
private ObservableCollection<ProductAllModel> materialDataGrid = new ObservableCollection<ProductAllModel>();
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<ProductAllModel> MaterialDataGrid
|
|
|
|
|
{
|
|
|
|
|
get { return materialDataGrid; }
|
|
|
|
|
set => SetProperty(ref materialDataGrid, value);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 选中条码
|
|
|
|
|
private string productCode;
|
|
|
|
|
|
|
|
|
|
public string ProductCode
|
|
|
|
|
{
|
|
|
|
|
get => productCode;
|
|
|
|
|
set => SetProperty(ref productCode, value);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 区域
|
|
|
|
|
/// </summary>
|
|
|
|
|
private ComboBoxItem area;
|
|
|
|
|
public ComboBoxItem Area
|
|
|
|
|
{
|
|
|
|
|
get { return area; }
|
|
|
|
|
set => SetProperty(ref area, value);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 选中型号
|
|
|
|
|
private string productModel;
|
|
|
|
|
|
|
|
|
|
public string ProductModel
|
|
|
|
|
{
|
|
|
|
|
get => productModel;
|
|
|
|
|
set => SetProperty(ref productModel, value);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|