change-新线最后一枪数据

dev
liuwf 1 year ago
parent e32041e33a
commit 85ac6c05fc

@ -13,7 +13,7 @@ namespace Admin.Core.Model
/// </summary> /// </summary>
[SugarTable("BOX_LASTSHOTRECORD", "AUCMA_SCADA")] [SugarTable("BOX_LASTSHOTRECORD", "AUCMA_SCADA")]
public class BoxLastShotRecord public class BoxLastShotRecord
{ {
/// <summary> /// <summary>
/// 主键 /// 主键
/// </summary> /// </summary>

@ -34,7 +34,8 @@ namespace Admin.Core.Service
try try
{ {
var _db = baseRepository.Db; 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; return infos.FirstOrDefault().result;
} }
catch (Exception ex) catch (Exception ex)

@ -47,7 +47,7 @@ namespace Admin.Core.Tasks
{ {
// await ExecuteJob(context, async () => await Run(context)); // await ExecuteJob(context, async () => await Run(context));
// await ExecuteJob(context, async () => await BoxFoamDataRun(context)); // await ExecuteJob(context, async () => await BoxFoamDataRun(context));
await ExecuteJob(context, async () => await Collect(context)); await ExecuteJob(context, async () => await Collect(context));
} }
/// <summary> /// <summary>
@ -57,9 +57,14 @@ namespace Admin.Core.Tasks
/// <returns></returns> /// <returns></returns>
public async Task Collect(IJobExecutionContext context) public async Task Collect(IJobExecutionContext context)
{ {
await CollectLast(); CollectLast();
} // CollectMachine();
}
/// <summary>
/// 采集最后一枪数据
/// </summary>
/// <returns></returns>
public async Task CollectLast() public async Task CollectLast()
{ {
var obj = PlcHelper.siemensList.FirstOrDefault(d => d.EquipName.Equals("Plc1")); var obj = PlcHelper.siemensList.FirstOrDefault(d => d.EquipName.Equals("Plc1"));
@ -86,7 +91,7 @@ namespace Admin.Core.Tasks
lastShotRecord.SetWeight = StringChange.bytesToHexStr(info.Skip(42).Take(4).ToArray(), 4); lastShotRecord.SetWeight = StringChange.bytesToHexStr(info.Skip(42).Take(4).ToArray(), 4);
lastShotRecord.SetRatio = StringChange.bytesToHexStr(info.Skip(46).Take(4).ToArray(), 4); lastShotRecord.SetRatio = StringChange.bytesToHexStr(info.Skip(46).Take(4).ToArray(), 4);
lastShotRecord.PourWeight = StringChange.bytesToHexStr(info.Skip(50).Take(4).ToArray(), 4); lastShotRecord.PourWeight = StringChange.bytesToHexStr(info.Skip(50).Take(4).ToArray(), 4);
lastShotRecord.PourRatio = StringChange.bytesToHexStr(info.Skip(54).Take(4).ToArray(), 4); lastShotRecord.PourRatio = StringChange.bytesToHexStr(info.Skip(54).Take(4).ToArray(), 4);
lastShotRecord.MpTime = StringChange.bytesToHexStr(info.Skip(58).Take(4).ToArray(), 4); lastShotRecord.MpTime = StringChange.bytesToHexStr(info.Skip(58).Take(4).ToArray(), 4);
lastShotRecord.HpTime = StringChange.bytesToHexStr(info.Skip(62).Take(4).ToArray(), 4); lastShotRecord.HpTime = StringChange.bytesToHexStr(info.Skip(62).Take(4).ToArray(), 4);
lastShotRecord.HydrPress = StringChange.bytesToHexStr(info.Skip(66).Take(4).ToArray(), 4); lastShotRecord.HydrPress = StringChange.bytesToHexStr(info.Skip(66).Take(4).ToArray(), 4);
@ -94,16 +99,16 @@ namespace Admin.Core.Tasks
lastShotRecord.MixpistOn = StringChange.bytesToHexStr(info.Skip(74).Take(4).ToArray(), 4); lastShotRecord.MixpistOn = StringChange.bytesToHexStr(info.Skip(74).Take(4).ToArray(), 4);
lastShotRecord.MixpistOff = StringChange.bytesToHexStr(info.Skip(78).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.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; lastShotRecord.CreateTime = DateTime.Now;
#endregion #endregion
if (tempLastRecord == null) 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); RefreshLastShotDataDelegateEvent?.Invoke(lastShotRecord);
@ -111,14 +116,24 @@ namespace Admin.Core.Tasks
_lastShotRecordServices.AddAsync(lastShotRecord); _lastShotRecordServices.AddAsync(lastShotRecord);
tempLastRecord = 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(); await SaveData();
} }

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

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

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

Loading…
Cancel
Save