using HH.WCS.Mobox3.YNJT_BZP_GT.api;
|
using HH.WCS.Mobox3.YNJT_BZP_GT.device;
|
using HH.WCS.Mobox3.YNJT_BZP_GT.dispatch;
|
using HH.WCS.Mobox3.YNJT_BZP_GT.models;
|
using HH.WCS.Mobox3.YNJT_BZP_GT.process;
|
using HH.WCS.Mobox3.YNJT_BZP_GT.util;
|
using HH.WCS.Mobox3.YNJT_BZP_GT.wms;
|
using Newtonsoft.Json;
|
using SqlSugar.DistributedSystem.Snowflake;
|
using System;
|
using System.Collections.Generic;
|
using System.Globalization;
|
using System.Linq;
|
using System.Reflection;
|
using System.Text;
|
using System.Threading;
|
using System.Threading.Tasks;
|
using System.Timers;
|
using static HH.WCS.Mobox3.YNJT_BZP_GT.dispatch.WMSDispatch;
|
|
namespace HH.WCS.Mobox3.YNJT_BZP_GT.core
|
{
|
/// <summary>
|
/// 定时轮询任务
|
/// </summary>
|
internal class Monitor
|
{
|
|
/// <summary>
|
/// 同步物料条码信息表
|
/// 1.查询上次记录时间
|
/// 2.根据记录时间,查询大于等于记录时间的物料条码信息
|
/// 3.将物料条码信息同步到wms
|
/// </summary>
|
internal static void MonitorMatlBarcode() {
|
try
|
{
|
var lastTimeStr = WMSDispatch.findDataLastSynTime(new SynTableModel() { tableType = 1 });
|
if (lastTimeStr != null)
|
{
|
if (DateTime.TryParse(lastTimeStr, out DateTime lastTime))
|
{
|
/* CultureInfo enGB = new CultureInfo("en-GB");*/
|
var maltInformations = WMSHelper.getMaltInfoList(lastTime);
|
if (maltInformations != null && maltInformations.Count > 0)
|
{
|
WMSDispatch.synMatlInformation(new SynMatlInformationModel() { matlInformationList = maltInformations });
|
}
|
}
|
else
|
{
|
LogHelper.Info($"同步物料条码信息错误,错误原因:日期解析错误", "WMS");
|
}
|
}
|
}
|
catch (Exception ex)
|
{
|
LogHelper.Info($"同步物料条码信息错误,错误原因:{ex.Message}", "WMS");
|
}
|
}
|
|
/// <summary>
|
/// 同步半制品物料状态
|
/// 1.查询上次记录时间
|
/// 2.根据记录时间,查询大于等于记录时间,且符合条件的物料状态信息
|
/// 3.将物料条码信息同步到wms
|
/// </summary>
|
internal static void MonitorMatlStatus()
|
{
|
try
|
{
|
var lastTimeStr = WMSDispatch.findDataLastSynTime(new SynTableModel() { tableType = 2 });
|
if (lastTimeStr != null)
|
{
|
if (DateTime.TryParse(lastTimeStr, out DateTime lastTime))
|
{
|
/* CultureInfo enGB = new CultureInfo("en-GB");*/
|
var barcodeStatuses = WMSHelper.getMaltStatusList(lastTime);
|
if (barcodeStatuses != null && barcodeStatuses.Count > 0)
|
{
|
WMSDispatch.synUpdateMatlStatus(new SynBarcodeStatusModel() { barcodeStatusList = barcodeStatuses });
|
}
|
}
|
else
|
{
|
LogHelper.Info($"同步半制品物料状态错误,错误原因:日期解析错误", "WMS");
|
}
|
}
|
}
|
catch (Exception ex)
|
{
|
LogHelper.Info($"同步半制品物料状态错误,错误原因:{ex.Message}", "WMS");
|
}
|
}
|
|
/// <summary>
|
/// 同步半制品抽检物料状态
|
/// </summary>
|
internal static void MonitorSpotCheckMatlStatus()
|
{
|
try
|
{
|
var lastTimeStr = WMSDispatch.findDataLastSynTime(new SynTableModel() { tableType = 3 });
|
if (lastTimeStr != null)
|
{
|
if (DateTime.TryParse(lastTimeStr, out DateTime lastTime))
|
{
|
/* CultureInfo enGB = new CultureInfo("en-GB");*/
|
var sampleStatuses = WMSHelper.getSampleMaltStatusList(lastTime);
|
if (sampleStatuses != null && sampleStatuses.Count > 0)
|
{
|
WMSDispatch.synUpdateSampleMatlStatus(new SynSampleStatusModel() { sampleStatusList = sampleStatuses });
|
}
|
}
|
else
|
{
|
LogHelper.Info($"同步半制品抽检物料状态错误,错误原因:日期解析错误", "WMS");
|
}
|
}
|
}
|
catch (Exception ex)
|
{
|
LogHelper.Info($"同步半制品物料状态错误,错误原因:{ex.Message}", "WMS");
|
}
|
}
|
|
}
|
}
|