zhanghonglin
5 天以前 96a94a59c08f55712ba04eb413e7f61739f11f66
ÏîÄ¿´úÂë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/GZJ/GZJJob.cs
@@ -25,9 +25,11 @@
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_IWMSPart;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_Model.Models.System;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DeviceBase;
using WIDESEAWCS_QuartzJob.StackerCrane.Enum;
using WIDESEAWCS_SystemServices;
using WIDESEAWCS_TaskInfoService;
using WIDESEAWCS_Tasks.OHT;
using static System.Collections.Specialized.BitVector32;
@@ -46,6 +48,8 @@
        private readonly IRepository<dt_outstockinfo> _outStockRepository;
        private readonly IRepository<dt_batchInfo> _batchInfoRepository;
        private readonly IRepository<Dt_StockInfo> _StockInfoRepository;
        private readonly IRepository<dt_Thickness_hty> _dt_Thickness_hty;
        private readonly IRepository<dt_Weight_hty> _dt_Weight_hty;
        private readonly IRepository<Dt_LocationInfo> _LocationInfoRepository;
        private readonly IUnitOfWorkManage _unitOfWorkManage;
@@ -59,6 +63,8 @@
            IRepository<dt_storagemode> storagemodeRepository,
            IRepository<dt_batchInfo> batchInfoRepository,
            IRepository<Dt_StockInfo> StockInfoRepository,
            IRepository<dt_Thickness_hty> ThicknessHtyService,
            IRepository<dt_Weight_hty> WeightHtyService,
            IRepository<Dt_LocationInfo> LocationInfoRepository,
            IUnitOfWorkManage unitOfWorkManage)
        {
@@ -74,11 +80,30 @@
            _StockInfoRepository = StockInfoRepository;
            _LocationInfoRepository = LocationInfoRepository;
            _unitOfWorkManage = unitOfWorkManage;
            _dt_Thickness_hty = ThicknessHtyService;
            _dt_Weight_hty = WeightHtyService;
        }
        //定时清空一周的时间
        private static int shijian = 604800;
        public Task Execute(IJobExecutionContext context)
        {
            //return Task.CompletedTask;
            //定时清空重量和厚度历史记录
            Thread.Sleep(1000);
            if(shijian > 0)
            {
                shijian--;
            }
            else
            {
                List<dt_Weight_hty> weights = _dt_Weight_hty.QueryData();
                _dt_Weight_hty.DeleteData(weights);
                List<dt_Thickness_hty> Thickness = _dt_Thickness_hty.QueryData();
                _dt_Thickness_hty.DeleteData(Thickness);
                shijian = 604800;
            }
            bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
            if (flag && value != null)
            {
@@ -227,7 +252,7 @@
                                _dt_taskRepositiry.AddData(task);
                            }
                        }
                        if (OHTJob.oHTReadData.R_RGVMode && OHTJob.oHTReadData.R_DK_isready)//RGV上料模式,且东跨架子有上料信号
                        else if (OHTJob.oHTReadData.R_RGVMode && OHTJob.oHTReadData.R_DK_isready)//RGV上料模式,且东跨架子有上料信号
                        {
                            var station = _dt_stationInfoRepository.QueryFirst(v => v.msg == "东跨架子");
                            task.SourceAddress = station.Row + "-" + station.Column + "-1";
@@ -432,8 +457,7 @@
                        //查询当前需要出库的批次号,以及出库物料类型
                        var batch = _batchInfoRepository.QueryFirst(v => v.Id == 1);
                        //查询库存物料库存信息
                        var stocks = _StockInfoRepository.QueryData(v => v.Remark == batch.materType && v.BatchNo == batch.OutBatch && v.StockStatus == 0)
                            .OrderBy(v => v.CreateDate).ToList();
                        var stocks = _StockInfoRepository.QueryData(v => v.Remark == batch.materType && v.BatchNo == batch.OutBatch && v.StockStatus == 0).OrderBy(v => v.CreateDate).ToList();
                        if (stocks.Count <= 0)
                        {
                            throw new Exception($"当前库存中没有【{batch.materType}】(0自产 1外购)且批次为【{batch.OutBatch}】的物料");