|
|
@ -2,7 +2,7 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using log4net;
|
|
|
|
using log4net;
|
|
|
|
using Aucma.Core.DoorFoam.Common;
|
|
|
|
using Aucma.Core.CodeBinding.Common;
|
|
|
|
using LiveCharts;
|
|
|
|
using LiveCharts;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using Admin.Core.Model;
|
|
|
|
using Admin.Core.Model;
|
|
|
@ -13,7 +13,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Windows.Controls;
|
|
|
|
using System.Windows.Controls;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections;
|
|
|
|
using Aucma.Core.DoorFoam.Models;
|
|
|
|
using Aucma.Core.CodeBinding.Models;
|
|
|
|
using System.Reflection.Emit;
|
|
|
|
using System.Reflection.Emit;
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading;
|
|
|
@ -22,27 +22,23 @@ using static Admin.Core.Service.CodeBindingRecordServices;
|
|
|
|
using System.Windows.Data;
|
|
|
|
using System.Windows.Data;
|
|
|
|
using System.Windows;
|
|
|
|
using System.Windows;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using Aucma.Core.CodeBinding;
|
|
|
|
using Aucma.Core.Scanner;
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* 首页信息
|
|
|
|
* 首页信息
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
namespace Aucma.Core.DoorFoam.ViewModels
|
|
|
|
namespace Aucma.Core.CodeBinding.ViewModels
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public partial class IndexPageViewModel : ObservableObject
|
|
|
|
public partial class IndexPageViewModel : ObservableObject
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(IndexPageViewModel));
|
|
|
|
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(IndexPageViewModel));
|
|
|
|
private readonly codeBindingBusiness _codeBindingBusiness;
|
|
|
|
|
|
|
|
private readonly IDoorFoamRecordServices? _doorFoamRecordServices;
|
|
|
|
|
|
|
|
private readonly ICodeBindingRecordServices? _codeBindingRecordServices;
|
|
|
|
private readonly ICodeBindingRecordServices? _codeBindingRecordServices;
|
|
|
|
public IndexPageViewModel()
|
|
|
|
public IndexPageViewModel()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_codeBindingRecordServices = App.ServiceProvider.GetService<ICodeBindingRecordServices>();
|
|
|
|
_codeBindingRecordServices = App.ServiceProvider.GetService<ICodeBindingRecordServices>();
|
|
|
|
_doorFoamRecordServices = App.ServiceProvider.GetService<IDoorFoamRecordServices>();
|
|
|
|
MvCodeHelper.ReceiveCode1Event += receiveCode1;
|
|
|
|
_codeBindingBusiness = new codeBindingBusiness(_codeBindingRecordServices);
|
|
|
|
MvCodeHelper.ReceiveCode2Event += receiveCode2;
|
|
|
|
// var list = _codeBindingRecordServices.FirstAsync().Result;
|
|
|
|
// var list = _codeBindingRecordServices.FirstAsync().Result;
|
|
|
|
|
|
|
|
|
|
|
|
_codeBindingBusiness.RefreshCode1Event += RefreshCode1;
|
|
|
|
|
|
|
|
_codeBindingBusiness.RefreshCode2Event += RefreshCode2;
|
|
|
|
|
|
|
|
LoadData();
|
|
|
|
LoadData();
|
|
|
|
// 程序运行 5 秒后添加新数据项
|
|
|
|
// 程序运行 5 秒后添加新数据项
|
|
|
|
add();
|
|
|
|
add();
|
|
|
@ -117,7 +113,7 @@ namespace Aucma.Core.DoorFoam.ViewModels
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 条码2扫描时间
|
|
|
|
/// 条码2扫描时间
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
private string code2Time;
|
|
|
|
private string code2Time = string.Empty;
|
|
|
|
public string Code2Time
|
|
|
|
public string Code2Time
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get { return code2Time; }
|
|
|
|
get { return code2Time; }
|
|
|
@ -130,7 +126,7 @@ namespace Aucma.Core.DoorFoam.ViewModels
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 绑定提示信息
|
|
|
|
/// 绑定提示信息
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
private string bindingInfo;
|
|
|
|
private string bindingInfo = string.Empty;
|
|
|
|
public string BindingInfo
|
|
|
|
public string BindingInfo
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get { return bindingInfo; }
|
|
|
|
get { return bindingInfo; }
|
|
|
@ -189,5 +185,59 @@ namespace Aucma.Core.DoorFoam.ViewModels
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 条码绑定,条码1处理
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="materialType"></param>
|
|
|
|
|
|
|
|
private void receiveCode1(string code1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
log.Info("进入条码1处理函数receiveCode1,code1:" + code1);
|
|
|
|
|
|
|
|
DateTime time = System.DateTime.Now;
|
|
|
|
|
|
|
|
string strTime = time.ToString();
|
|
|
|
|
|
|
|
// 1.刷新界面条码信息
|
|
|
|
|
|
|
|
RefreshCode1(code1, strTime);
|
|
|
|
|
|
|
|
// 2.创建任务更新数据库条码1
|
|
|
|
|
|
|
|
CodeBindingRecord codeRecord = new CodeBindingRecord();
|
|
|
|
|
|
|
|
codeRecord.BoxCode = code1;
|
|
|
|
|
|
|
|
codeRecord.BoxName = "去数据库查询";
|
|
|
|
|
|
|
|
codeRecord.RecordTime1 = time;
|
|
|
|
|
|
|
|
codeRecord.RecordTime2 = time;
|
|
|
|
|
|
|
|
codeRecord.ProductCode = "扫码枪扫描";
|
|
|
|
|
|
|
|
codeRecord.BindingResult = "成功";
|
|
|
|
|
|
|
|
Thread.Sleep(10000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// _codeBindingRecordServices.AddAsync(codeRecord);
|
|
|
|
|
|
|
|
//log.Info("条码1记录更新");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RefreshCode2(codeRecord);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 条码绑定,条码2处理
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="materialType"></param>
|
|
|
|
|
|
|
|
private void receiveCode2(string code2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
log.Info("进入条码2处理函数receiveCode1,code2:" + code2);
|
|
|
|
|
|
|
|
// 1.刷新界面信息
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 2.数据库匹配条码1并绑定
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CodeBindingRecord record = _codeBindingRecordServices.QueryByTime().Result;
|
|
|
|
|
|
|
|
record.ProductCode = code2;
|
|
|
|
|
|
|
|
record.RecordTime2 = System.DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 产品入库?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 3.下发plc放行信号
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|