change-新线最后一枪数据

dev
liuwf 1 year ago
parent e32041e33a
commit 85ac6c05fc

@ -34,7 +34,8 @@ namespace Admin.Core.Service
try
{
var _db = baseRepository.Db;
var infos = await _db.Ado.SqlQueryAsync<BaseTest>($"SELECT ILS_TMPRD.ILS_SORT_BARCODE_PKG.GET_BARCODE_DATA({barCode}) FROM DUAL");
string sql = "SELECT ILS_TMPRD.ILS_SORT_BARCODE_PKG.GET_BARCODE_DATA('"+barCode+ "') as result FROM DUAL";
var infos = await _db.Ado.SqlQueryAsync<BaseTest>(sql);
return infos.FirstOrDefault().result;
}
catch (Exception ex)

@ -57,9 +57,14 @@ namespace Admin.Core.Tasks
/// <returns></returns>
public async Task Collect(IJobExecutionContext context)
{
await CollectLast();
}
CollectLast();
// CollectMachine();
}
/// <summary>
/// 采集最后一枪数据
/// </summary>
/// <returns></returns>
public async Task CollectLast()
{
var obj = PlcHelper.siemensList.FirstOrDefault(d => d.EquipName.Equals("Plc1"));
@ -94,16 +99,16 @@ namespace Admin.Core.Tasks
lastShotRecord.MixpistOn = StringChange.bytesToHexStr(info.Skip(74).Take(4).ToArray(), 4);
lastShotRecord.MixpistOff = StringChange.bytesToHexStr(info.Skip(78).Take(4).ToArray(), 4);
lastShotRecord.TotalYield = StringChange.bytesToHexStr(info.Skip(82).Take(4).ToArray(), 4);
lastShotRecord.PourEnd = StringChange.bytesToHexStr(info.Skip(87).Take(4).ToArray(), 4);
lastShotRecord.PourEnd = StringChange.bytesToHexStr(info.Skip(87).Take(1).ToArray(), 1);
lastShotRecord.CreateTime = DateTime.Now;
#endregion
if (tempLastRecord == null)
{
//数据库查
tempLastRecord = _lastShotRecordServices.Query(x=>x.System == lastShotRecord.System && x.ProductLineCode==lastShotRecord.ProductLineCode && x.GunCode==lastShotRecord.GunCode).OrderByDescending(x=>x.CreateTime).FirstOrDefault();
tempLastRecord = _lastShotRecordServices.Query(x => x.System == lastShotRecord.System && x.ProductLineCode == lastShotRecord.ProductLineCode && x.GunCode == lastShotRecord.GunCode).OrderByDescending(x => x.CreateTime).FirstOrDefault();
}
if (!tempLastRecord.MixpistOff.Equals(lastShotRecord.MixpistOff))
if (tempLastRecord == null || !tempLastRecord.MixpistOff.Equals(lastShotRecord.MixpistOff))
{
// 刷新页面
RefreshLastShotDataDelegateEvent?.Invoke(lastShotRecord);
@ -111,14 +116,24 @@ namespace Admin.Core.Tasks
_lastShotRecordServices.AddAsync(lastShotRecord);
tempLastRecord = lastShotRecord;
}
}
}
/// <summary>
/// 采集设备其他数据
/// </summary>
/// <returns></returns>
public async Task CollectMachine()
{
var obj = PlcHelper.siemensList.FirstOrDefault(d => d.EquipName.Equals("Plc1"));
if (obj != null && obj.plc.IsConnected)
{
byte[] info = obj.plc.ReadBytes("DB50.896", (ushort)88);
}
}
public async Task Run(IJobExecutionContext context)
}
public async Task Run(IJobExecutionContext context)
{
await SaveData();
}

@ -121,10 +121,10 @@ namespace Aucma.Core.BoxFoam.Business
// test();
// 获取任务下发plc
StartPassDown();
InStore("B23600083025024860011");
// StartPassDown();
// InStore("B23600083025024860011");
});
startTimer();
// startTimer();
}
public async void test()

@ -98,7 +98,7 @@
"ID": 1,
"Name": "InstoreJob",
"JobGroup": "DEFAULT",
"Cron": "*/1 * * * * ?",
"Cron": "*/20 * * * * ?",
"AssemblyName": "Admin.Core.Tasks",
"ClassName": "Job_BoxFoamLastData_Quartz",
"Remark": "最后一枪数据采集",

@ -8,8 +8,12 @@ using Aucma.Core.ProductOffLine;
using Aucma.Core.ProductOffLine.Models;
using log4net;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Logging;
using Microsoft.VisualBasic.ApplicationServices;
using NetTaste;
using NPOI.SS.Formula.Functions;
using Oracle.ManagedDataAccess.Client;
using RestSharp;
using StackExchange.Redis;
using System;
@ -99,8 +103,11 @@ namespace Aucma.Core.ProductOffLine.Business
public async void test()
{
// string result = await _productOffLineServices.QueryChecked("16160030000000910780");
// Console.WriteLine(result);
string result = await _productOffLineServices.QueryChecked("1531000AP0098DCU0481");
Console.WriteLine(result);
// string tt = "Y@1104@16160030000000910780@000010034895@@ @000000@000000009000004899@BCD-160C,家电下乡@@BCD-160C@皓月白-家电下乡@161601300@160@1-00版@家电下乡产品@默认@2010-09-01";
//Task.Run(() =>
//{

Loading…
Cancel
Save