diff --git a/Admin.Core.Model/Model_New/BoxLastShotRecord.cs b/Admin.Core.Model/Model_New/BoxLastShotRecord.cs index 23c94423..28e380d9 100644 --- a/Admin.Core.Model/Model_New/BoxLastShotRecord.cs +++ b/Admin.Core.Model/Model_New/BoxLastShotRecord.cs @@ -13,7 +13,7 @@ namespace Admin.Core.Model /// [SugarTable("BOX_LASTSHOTRECORD", "AUCMA_SCADA")] public class BoxLastShotRecord - { + { /// /// 主键 /// diff --git a/Admin.Core.Service/Service_New/ProductOffLineServices.cs b/Admin.Core.Service/Service_New/ProductOffLineServices.cs index e328b7e1..1642410d 100644 --- a/Admin.Core.Service/Service_New/ProductOffLineServices.cs +++ b/Admin.Core.Service/Service_New/ProductOffLineServices.cs @@ -34,7 +34,8 @@ namespace Admin.Core.Service try { var _db = baseRepository.Db; - var infos = await _db.Ado.SqlQueryAsync($"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(sql); return infos.FirstOrDefault().result; } catch (Exception ex) diff --git a/Admin.Core.Tasks/QuartzNet/Jobs/Job_BoxFoamLastData_Quartz.cs b/Admin.Core.Tasks/QuartzNet/Jobs/Job_BoxFoamLastData_Quartz.cs index a86a753d..a9e22b64 100644 --- a/Admin.Core.Tasks/QuartzNet/Jobs/Job_BoxFoamLastData_Quartz.cs +++ b/Admin.Core.Tasks/QuartzNet/Jobs/Job_BoxFoamLastData_Quartz.cs @@ -47,7 +47,7 @@ namespace Admin.Core.Tasks { // await ExecuteJob(context, async () => await Run(context)); // await ExecuteJob(context, async () => await BoxFoamDataRun(context)); - await ExecuteJob(context, async () => await Collect(context)); + await ExecuteJob(context, async () => await Collect(context)); } /// @@ -57,9 +57,14 @@ namespace Admin.Core.Tasks /// public async Task Collect(IJobExecutionContext context) { - await CollectLast(); - } + CollectLast(); + // CollectMachine(); + } + /// + /// 采集最后一枪数据 + /// + /// public async Task CollectLast() { 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.SetRatio = StringChange.bytesToHexStr(info.Skip(46).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.HpTime = StringChange.bytesToHexStr(info.Skip(62).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.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; } + } + } - + /// + /// 采集设备其他数据 + /// + /// + 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(); } diff --git a/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs b/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs index c2ac9752..63ca3041 100644 --- a/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs +++ b/Aucma.Core.BoxFoam/Business/InStoreBusiness.cs @@ -121,10 +121,10 @@ namespace Aucma.Core.BoxFoam.Business // test(); // 获取任务下发plc - StartPassDown(); - InStore("B23600083025024860011"); + // StartPassDown(); + // InStore("B23600083025024860011"); }); - startTimer(); + // startTimer(); } public async void test() diff --git a/Aucma.Core.BoxFoam/appsettings.json b/Aucma.Core.BoxFoam/appsettings.json index 3f3b9ee3..07ba5ff6 100644 --- a/Aucma.Core.BoxFoam/appsettings.json +++ b/Aucma.Core.BoxFoam/appsettings.json @@ -98,7 +98,7 @@ "ID": 1, "Name": "InstoreJob", "JobGroup": "DEFAULT", - "Cron": "*/1 * * * * ?", + "Cron": "*/20 * * * * ?", "AssemblyName": "Admin.Core.Tasks", "ClassName": "Job_BoxFoamLastData_Quartz", "Remark": "最后一枪数据采集", diff --git a/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs b/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs index ca516e79..ad65e28b 100644 --- a/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs +++ b/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs @@ -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(() => //{