85 lines
2.8 KiB
C#
85 lines
2.8 KiB
C#
using Cowain.Bake.BLL;
|
|
using Cowain.Bake.Common;
|
|
using Cowain.Bake.Common.Core;
|
|
using Cowain.Bake.Model;
|
|
using Prism.Commands;
|
|
using Prism.Mvvm;
|
|
using Prism.Regions;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Unity;
|
|
using JSON = Newtonsoft.Json.JsonConvert;
|
|
|
|
namespace Cowain.Bake.UI.FactoryMaintenance.ViewModels
|
|
{
|
|
public class MomOutboundViewModel : ViewModelBase
|
|
{
|
|
private string batteryCode;
|
|
public string BatteryCode
|
|
{
|
|
get => batteryCode;
|
|
set => SetProperty(ref batteryCode, value);
|
|
}
|
|
|
|
private string sendData;
|
|
public string SendData
|
|
{
|
|
get => sendData;
|
|
set => SetProperty(ref sendData, value);
|
|
}
|
|
|
|
private string recvData;
|
|
public string RecvData
|
|
{
|
|
get => recvData;
|
|
set => SetProperty(ref recvData, value);
|
|
}
|
|
|
|
public MomOutboundViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
|
{
|
|
this.PageTitle = "电芯出站信息";
|
|
_unityContainer = unityContainer;
|
|
}
|
|
public DelegateCommand<object> SendToMomCommand => new DelegateCommand<object>((x) =>
|
|
{
|
|
List<int> batterys = new List<int>();
|
|
TBatteryInfo battery = _unityContainer.Resolve<BatteryInfoService>().GetBatteryInfos(BatteryCode);
|
|
|
|
if (null == battery)
|
|
{
|
|
HandyControl.Controls.MessageBox.Fatal("找不到此电芯,请重新输入电芯条码!");
|
|
return;
|
|
}
|
|
|
|
batterys.Add(battery.Id);
|
|
//此时托盘可能已经转历史盘托了
|
|
TPalletInfo palletInfo = _unityContainer.Resolve<BLL.PalletInfoService>().GetPalletInfoOrHistory(battery.Id);
|
|
if (null == palletInfo)
|
|
{
|
|
LogHelper.Instance.Error($"找不到此电芯所属托盘!", true);
|
|
return;
|
|
}
|
|
|
|
RecvData = _unityContainer.Resolve<Common.Interface.ICommonFun>().ManualMesOutUnBinding(palletInfo, battery);
|
|
});
|
|
|
|
//public DelegateCommand<object> SendToMomCommand => new DelegateCommand<object>((x) =>
|
|
//{
|
|
// if (string.IsNullOrEmpty(SendData))
|
|
// {
|
|
// HandyControl.Controls.MessageBox.Fatal("发送数据为空!");
|
|
// return;
|
|
// }
|
|
// //var result =_unityContainer.Resolve<Common.Interface.ICommonFun>().SendData(SendData); //发送
|
|
// //if (null == result)
|
|
// //{
|
|
// // RecvData = "接收数据超时!";
|
|
// //}
|
|
// //else
|
|
// //{
|
|
// // RecvData = JSON.SerializeObject(result);
|
|
// //}
|
|
//});
|
|
}
|
|
}
|