|
|
|
@ -1,7 +1,9 @@
|
|
|
|
|
using Admin.Core.IService;
|
|
|
|
|
using Admin.Core.Model;
|
|
|
|
|
using Admin.Core.Service;
|
|
|
|
|
using Aucma.Core.HwPLc;
|
|
|
|
|
using Aucma.Core.ProductOffLine.Business;
|
|
|
|
|
using Aucma.Core.ProductOffLine.Config;
|
|
|
|
|
using Aucma.Core.ProductOffLine.Models;
|
|
|
|
|
using Aucma.Core.ProductOffLine.Views;
|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
@ -31,20 +33,50 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
private readonly IBaseMaterialInfoServices? _baseMaterialInfoServices;
|
|
|
|
|
OffLineBusiness offLineBusiness = OffLineBusiness.Instance;
|
|
|
|
|
private IndexPageView firstPage = new IndexPageView();//首页
|
|
|
|
|
private AppConfig appConfig = AppConfig.Instance;
|
|
|
|
|
private DirectionEditView directionEditView = new DirectionEditView();
|
|
|
|
|
private SelectQualityView selectQualityView = new SelectQualityView();
|
|
|
|
|
private SelectQualityView selectQualityView = new SelectQualityView();
|
|
|
|
|
public QualityPageViewModel()
|
|
|
|
|
{
|
|
|
|
|
UserContent1 = directionEditView;
|
|
|
|
|
UserContent2 = selectQualityView;
|
|
|
|
|
DirectionInit();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 传入库方向
|
|
|
|
|
offLineBusiness.getDirectioneEvent += getInstoreDirection;
|
|
|
|
|
QualityPageView.getAllQualityEvent += test;
|
|
|
|
|
_baseQualityInspectionItemInfoServices = App.ServiceProvider.GetService<IBaseQualityInspectionItemInfoServices>();
|
|
|
|
|
_baseMaterialInfoServices = App.ServiceProvider.GetService<IBaseMaterialInfoServices>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 初始化界面分垛模式及分垛方向
|
|
|
|
|
private void DirectionInit()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 默认方向
|
|
|
|
|
if (appConfig.PalletizDirection == "1")
|
|
|
|
|
{
|
|
|
|
|
_isSelectedOptionA = true;
|
|
|
|
|
_isSelectedOptionB = false;
|
|
|
|
|
}
|
|
|
|
|
else if (appConfig.PalletizDirection == "2")
|
|
|
|
|
{
|
|
|
|
|
_isSelectedOptionA = false;
|
|
|
|
|
_isSelectedOptionB = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_isSelectedOptionA = true;
|
|
|
|
|
_isSelectedOptionB = true;
|
|
|
|
|
appConfig.PalletizDirection = "1";
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -61,7 +93,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
if (SelectedMaterialType != null && SelectedMaterialType.Content.ToString() == "自动模式")
|
|
|
|
|
{
|
|
|
|
|
BaseMaterialInfo info = _baseMaterialInfoServices.Query(x => x.MaterialCode == materialType).FirstOrDefault();
|
|
|
|
|
if (info != null&& !string.IsNullOrEmpty(info.InboundDirection)) // 设置过了方向
|
|
|
|
|
if (info != null && !string.IsNullOrEmpty(info.InboundDirection)) // 设置过了方向
|
|
|
|
|
{
|
|
|
|
|
direction = info.InboundDirection;
|
|
|
|
|
}
|
|
|
|
@ -100,19 +132,14 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
public async Task<List<BaseQualityInspectionItemInfo>> test()
|
|
|
|
|
{
|
|
|
|
|
List<BaseQualityInspectionItemInfo> list = await _baseQualityInspectionItemInfoServices.query();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async void init()
|
|
|
|
|
{
|
|
|
|
|
await _baseQualityInspectionItemInfoServices.query();
|
|
|
|
|
//Task.Run(() =>
|
|
|
|
|
//{
|
|
|
|
|
// Thread.Sleep(5000);
|
|
|
|
|
// string A = getInstoreDirection("9001001802");
|
|
|
|
|
// Console.WriteLine(A);
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MaterialComplateInfo> materialComplateInfos = new List<MaterialComplateInfo>();
|
|
|
|
@ -136,24 +163,57 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#region 单选框
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private bool _isSelectedOptionA;
|
|
|
|
|
public bool IsSelectedOptionA
|
|
|
|
|
{
|
|
|
|
|
get { return _isSelectedOptionA; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (_isSelectedOptionA != value)
|
|
|
|
|
{
|
|
|
|
|
_isSelectedOptionA = value;
|
|
|
|
|
OnPropertyChanged(nameof(IsSelectedOptionA));
|
|
|
|
|
|
|
|
|
|
// 如果选择了A选项,将B选项设为false
|
|
|
|
|
if (_isSelectedOptionA)
|
|
|
|
|
if (value)
|
|
|
|
|
{
|
|
|
|
|
var result = MessageBox.Show("确认切换A库方向吗?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
IsSelectedOptionB = false;
|
|
|
|
|
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
|
|
|
|
|
// obj = null;
|
|
|
|
|
if (obj != null)
|
|
|
|
|
{
|
|
|
|
|
bool flag = obj.plc.ReadBool("B100A");
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
_isSelectedOptionA = value;
|
|
|
|
|
OnPropertyChanged(nameof(IsSelectedOptionA));
|
|
|
|
|
appConfig.PalletizDirection = "1";
|
|
|
|
|
// 如果选择了A选项,将B选项设为false
|
|
|
|
|
if (_isSelectedOptionA)
|
|
|
|
|
{
|
|
|
|
|
IsSelectedOptionB = false;
|
|
|
|
|
}
|
|
|
|
|
MessageBox.Show("切换成功");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("切换失败,请检查提升机及二楼平台是否残留箱体或数据!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Plc连接失败,请检查连接!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_isSelectedOptionA = value;
|
|
|
|
|
OnPropertyChanged(nameof(IsSelectedOptionA));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -163,22 +223,143 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
get { return _isSelectedOptionB; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (_isSelectedOptionB != value)
|
|
|
|
|
{
|
|
|
|
|
_isSelectedOptionB = value;
|
|
|
|
|
OnPropertyChanged(nameof(IsSelectedOptionB));
|
|
|
|
|
|
|
|
|
|
// 如果选择了B选项,将A选项设为false
|
|
|
|
|
if (_isSelectedOptionB)
|
|
|
|
|
if (value)
|
|
|
|
|
{
|
|
|
|
|
var result = MessageBox.Show("确认切换B方向吗?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
IsSelectedOptionA = false;
|
|
|
|
|
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
|
|
|
|
|
// obj = null;
|
|
|
|
|
if (obj != null)
|
|
|
|
|
{
|
|
|
|
|
bool flag = obj.plc.ReadBool("B100A");
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
_isSelectedOptionB = value;
|
|
|
|
|
OnPropertyChanged(nameof(IsSelectedOptionB));
|
|
|
|
|
appConfig.PalletizDirection = "2";
|
|
|
|
|
// 如果选择了B选项,将A选项设为false
|
|
|
|
|
if (_isSelectedOptionB)
|
|
|
|
|
{
|
|
|
|
|
IsSelectedOptionA = false;
|
|
|
|
|
}
|
|
|
|
|
MessageBox.Show("切换成功");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("切换失败,请检查提升机及二楼平台是否残留箱体或数据!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Plc连接失败,请检查连接!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_isSelectedOptionB = value;
|
|
|
|
|
OnPropertyChanged(nameof(IsSelectedOptionB));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#region 单选框
|
|
|
|
|
//private bool _isSelectedOptionA;
|
|
|
|
|
//public bool IsSelectedOptionA
|
|
|
|
|
//{
|
|
|
|
|
// get { return _isSelectedOptionA; }
|
|
|
|
|
// set
|
|
|
|
|
// {
|
|
|
|
|
// if (_isSelectedOptionA != value)
|
|
|
|
|
// {
|
|
|
|
|
// MessageBoxResult result = MessageBox.Show("确认切换方向吗?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
|
|
|
|
// if (result == MessageBoxResult.Yes)
|
|
|
|
|
// {
|
|
|
|
|
// // 读取plc点位判断能否切换
|
|
|
|
|
// var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
|
|
|
|
|
// if (obj != null)
|
|
|
|
|
// {
|
|
|
|
|
// bool flag = obj.plc.ReadBool("B100A");
|
|
|
|
|
// if (flag)
|
|
|
|
|
// {
|
|
|
|
|
// _isSelectedOptionA = value;
|
|
|
|
|
// OnPropertyChanged(nameof(IsSelectedOptionA));
|
|
|
|
|
|
|
|
|
|
// // 如果选择了A选项,将B选项设为false
|
|
|
|
|
// if (_isSelectedOptionA)
|
|
|
|
|
// {
|
|
|
|
|
// IsSelectedOptionB = false;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// MessageBox.Show("请检查提升机及二楼平台是否残留箱体或数据!");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// MessageBox.Show("Plc连接失败,请检查连接!");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//private bool _isSelectedOptionB;
|
|
|
|
|
//public bool IsSelectedOptionB
|
|
|
|
|
//{
|
|
|
|
|
// get { return _isSelectedOptionB; }
|
|
|
|
|
// set
|
|
|
|
|
// {
|
|
|
|
|
// if (_isSelectedOptionB != value)
|
|
|
|
|
// {
|
|
|
|
|
// MessageBoxResult result = MessageBox.Show("确认切换方向吗?","确认", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
|
|
|
|
// if (result == MessageBoxResult.Yes)
|
|
|
|
|
// {
|
|
|
|
|
// // 读取plc点位判断能否切换
|
|
|
|
|
|
|
|
|
|
// var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
|
|
|
|
|
// if (obj != null)
|
|
|
|
|
// {
|
|
|
|
|
// bool flag = obj.plc.ReadBool("B100A");
|
|
|
|
|
// if (flag)
|
|
|
|
|
// {
|
|
|
|
|
// _isSelectedOptionB = value;
|
|
|
|
|
// OnPropertyChanged(nameof(IsSelectedOptionB));
|
|
|
|
|
|
|
|
|
|
// // 如果选择了B选项,将A选项设为false
|
|
|
|
|
// if (_isSelectedOptionB)
|
|
|
|
|
// {
|
|
|
|
|
// IsSelectedOptionA = false;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// MessageBox.Show("请检查提升机及二楼平台是否残留箱体或数据!");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// MessageBox.Show("Plc连接失败,请检查连接!");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -190,7 +371,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private void ExecQuery(object obj)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|