236 lines
7.2 KiB
C#
236 lines
7.2 KiB
C#
using HandyControl.Controls;
|
||
using Ping9719.WpfEx;
|
||
using Ping9719.WpfEx.Mvvm;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading;
|
||
using System.Threading.Tasks;
|
||
using System.Windows;
|
||
using System.Windows.Input;
|
||
using System.Windows.Markup;
|
||
using WCS.Model;
|
||
using WCS.Model.ApiModel.Home;
|
||
using 智能仓储WCS管理系统.Api;
|
||
|
||
namespace 智能仓储WCS管理系统.ViewModel
|
||
{
|
||
public class DeviceViewModel : BindableBase
|
||
{
|
||
public ICommand ResetAllShelfCommand { get => new DelegateCommand(ResetAllShelf); }
|
||
/// <summary>
|
||
/// 打开用户
|
||
/// </summary>
|
||
public void ResetAllShelf()
|
||
{
|
||
#region 调用接口 请求重置所有货架的状态
|
||
var body = new ResetShelfStatusRequest()
|
||
{
|
||
IsResetAll = true,
|
||
GroupNames = LocalFile.Config.GroupName,
|
||
UserName = LocalStatic.CurrentUser,
|
||
DeviceType = LocalFile.Config.DeviceType,
|
||
};
|
||
var Result = ApiHelp.GetDataFromHttp<ResponseBase>(LocalFile.Config.ApiIpHost + "home/resetShelfStatus", body, "POST");
|
||
if (Result != null && Result.Code == 200)
|
||
{
|
||
Growl.Warning("复位成功!");
|
||
}
|
||
else if (Result != null)
|
||
{
|
||
Growl.Warning(Result.Message);
|
||
}
|
||
else
|
||
{
|
||
Growl.Warning("调用接口失败!");
|
||
}
|
||
#endregion
|
||
}
|
||
|
||
|
||
public ICommand BarcodePrintTemplateCommand { get => new DelegateCommand(BarcodePrintTemplate); }
|
||
public void BarcodePrintTemplate()
|
||
{
|
||
try
|
||
{
|
||
Folder.OpenFolderAndSelectedFile(LocalFile.PrintTemplatePath);
|
||
}
|
||
catch (Exception)
|
||
{
|
||
Growl.Error("打开文件夹失败。");
|
||
}
|
||
}
|
||
|
||
public ICommand NoResponseResetCommand { get => new DelegateCommand(NoResponseReset); }
|
||
/// <summary>
|
||
/// 打开用户
|
||
/// </summary>
|
||
public void NoResponseReset()
|
||
{
|
||
var result = HandyControl.Controls.MessageBox.Show("此功能用于“未成功退出入库、出库”等异常提示\r\n建议所有货架都处于待机模式时使用,继续复位请点击[确定]", "提示", MessageBoxButton.OKCancel);
|
||
if (result == MessageBoxResult.Cancel)
|
||
return;
|
||
#region 调用接口 请求重置所有货架的状态
|
||
var body = new RequestBase()
|
||
{
|
||
UserName = LocalStatic.CurrentUser,
|
||
DeviceType = LocalFile.Config.DeviceType,
|
||
};
|
||
var Result = ApiHelp.GetDataFromHttp<ResponseBase>(LocalFile.Config.ApiIpHost + "home/noResponseReset", body, "POST");
|
||
if (Result != null && Result.Code == 200)
|
||
{
|
||
Growl.Warning("已给状态不一致的板子发送复位指令,建议点击第一个按钮[货架状态初始化]重置所有货架状态!");
|
||
}
|
||
else if (Result != null)
|
||
{
|
||
Growl.Warning(Result.Message);
|
||
}
|
||
else
|
||
{
|
||
Growl.Warning("调用接口失败!");
|
||
}
|
||
#endregion
|
||
}
|
||
}
|
||
|
||
public class DeviceReadModel : BindableBase
|
||
{
|
||
#region 属性
|
||
private string Name_;
|
||
/// <summary>
|
||
/// 名称
|
||
/// </summary>
|
||
public string Name { get => Name_; set { SetProperty(ref Name_, value); } }
|
||
|
||
private object Value_;
|
||
/// <summary>
|
||
/// 值
|
||
/// </summary>
|
||
public object Value { get => Value_; set { SetProperty(ref Value_, value); } }
|
||
|
||
/// <summary>
|
||
/// 是否可见
|
||
/// </summary>
|
||
public bool IsExpanded { get; set; }
|
||
|
||
/// <summary>
|
||
/// Excel原始数据
|
||
/// </summary>
|
||
public ExcelDeviceReadModel ExcelTag { get; set; }
|
||
#endregion
|
||
}
|
||
|
||
public class DeviceWriteModel : BindableBase
|
||
{
|
||
#region 属性
|
||
private string Name_;
|
||
/// <summary>
|
||
/// 名称
|
||
/// </summary>
|
||
public string Name { get => Name_; set { SetProperty(ref Name_, value); } }
|
||
|
||
private object Value_;
|
||
/// <summary>
|
||
/// 是否合格
|
||
/// </summary>
|
||
public object Value { get => Value_; set { SetProperty(ref Value_, value); } }
|
||
|
||
/// <summary>
|
||
/// 是否可见
|
||
/// </summary>
|
||
public bool IsExpanded { get; set; }
|
||
|
||
/// <summary>
|
||
/// Excel原始数据
|
||
/// </summary>
|
||
public ExcelDeviceWriteModel ExcelTag { get; set; }
|
||
#endregion
|
||
}
|
||
|
||
public class DeviceUrnModel : BindableBase
|
||
{
|
||
#region 属性
|
||
private string Name_;
|
||
/// <summary>
|
||
/// 名称
|
||
/// </summary>
|
||
public string Name { get => Name_; set { SetProperty(ref Name_, value); } }
|
||
|
||
private bool IsGoTo_;
|
||
/// <summary>
|
||
/// 是否推到位
|
||
/// </summary>
|
||
public bool IsGoTo { get => IsGoTo_; set { SetProperty(ref IsGoTo_, value); } }
|
||
|
||
private bool IsRetTo_;
|
||
/// <summary>
|
||
/// 是否回到位
|
||
/// </summary>
|
||
public bool IsRetTo { get => IsRetTo_; set { SetProperty(ref IsRetTo_, value); } }
|
||
|
||
/// <summary>
|
||
/// 是否可见
|
||
/// </summary>
|
||
public bool IsExpanded { get; set; }
|
||
|
||
/// <summary>
|
||
/// 自定义数据
|
||
/// </summary>
|
||
public ExcelDeviceUrnModel ExcelTag { get; set; }
|
||
#endregion
|
||
}
|
||
|
||
public class DeviceServoModel : BindableBase
|
||
{
|
||
#region 属性
|
||
private string Name_;
|
||
/// <summary>
|
||
/// 名称
|
||
/// </summary>
|
||
public string Name { get => Name_; set { SetProperty(ref Name_, value); } }
|
||
|
||
private double JogSpeed_;
|
||
/// <summary>
|
||
/// 手动模式速度
|
||
/// </summary>
|
||
public double JogSpeed { get => JogSpeed_; set { SetProperty(ref JogSpeed_, value); } }
|
||
|
||
private double AutoSpeed_;
|
||
/// <summary>
|
||
/// 自动模式速度
|
||
/// </summary>
|
||
public double AutoSpeed { get => AutoSpeed_; set { SetProperty(ref AutoSpeed_, value); } }
|
||
|
||
private double Location_;
|
||
/// <summary>
|
||
/// 伺服当前位置
|
||
/// </summary>
|
||
public double Location { get => Location_; set { SetProperty(ref Location_, value); } }
|
||
|
||
private bool IsJog_ = true;
|
||
/// <summary>
|
||
/// 是否主页显示为手动模式
|
||
/// </summary>
|
||
public bool IsJog { get => IsJog_; set { SetProperty(ref IsJog_, value); } }
|
||
|
||
private bool IsFold_ = true;
|
||
/// <summary>
|
||
/// 是否折叠
|
||
/// </summary>
|
||
public bool IsFold { get => IsFold_; set { SetProperty(ref IsFold_, value); } }
|
||
|
||
/// <summary>
|
||
/// 是否可见
|
||
/// </summary>
|
||
public bool IsExpanded { get; set; }
|
||
|
||
private ExcelDeviceServoModel ExcelTag_;
|
||
/// <summary>
|
||
/// 自定义数据
|
||
/// </summary>
|
||
public ExcelDeviceServoModel ExcelTag { get => ExcelTag_; set { SetProperty(ref ExcelTag_, value); } }
|
||
#endregion
|
||
}
|
||
}
|