wangxinhui
2025-11-30 f2b85c65234e0dcdd3fcce4dafbe16933b7f1b48
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using Autofac.Core;
using AutoMapper;
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Common;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_IBasicInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob.Service;
 
namespace WIDESEAWCS_Tasks
{
    [DisallowConcurrentExecution]
    public partial class ConveyorLineJob2 : JobBase, IJob
    {
        public readonly ITaskService _taskService;
        private readonly ITaskExecuteDetailService _taskExecuteDetailService;
        private readonly IRouterService _routerService;
        private readonly IStationMangerRepository _stationMangerRepository;
        private readonly ILocationInfoRepository _locationInfoRepository;
        private readonly IMapper _mapper;
 
        public ConveyorLineJob2(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, ILocationInfoRepository locationInfoRepository, IMapper mapper)
        {
            _taskService = taskService;
            _taskExecuteDetailService = taskExecuteDetailService;
            _routerService = routerService;
            _stationMangerRepository = stationMangerRepository;
            _locationInfoRepository = locationInfoRepository;
            _mapper = mapper;
        }
        public Task Execute(IJobExecutionContext context)
        {
            try
            {
                CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
                if (conveyorLine != null)
                {
                    #region 站台方式
 
                    List<Dt_StationManger> stationManagers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == conveyorLine.DeviceCode);
 
                    foreach (var station in stationManagers)
                    {
                        if (station.StationType==StationTypeEnum.StationType_OnlyOutbound.ObjToInt()) //拣选申请
                        {
                            bool PickRequest = conveyorLine.GetValue<ConveyorLineDBName, bool>(ConveyorLineDBName.R_PickRequest, station.StationCode);
                            if (PickRequest)
                            {
                                string PickBarCode = conveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.R_PickBarCode, station.StationCode).Replace("\0", "");
                                //上报WMS料箱到达
                                if (PickBarCode.IsNotEmptyOrNull())
                                {
                                    WebResponseContent content = _taskService.WMSPickUp(station.PickStationCode, PickBarCode);
                                    if (content.Status)
                                    {
                                        //写入拣选确认
                                    }
                                }
                                else
                                {
                                    WriteError(nameof(conveyorLine.DeviceCode), $"{station.StationCode}拣选申请为{PickRequest}条码为空值");
                                }
                            }
                            
                        }
                        else
                        {
 
                        }
                        
                    }
                    #endregion 站台方式
                }
            }
            catch (Exception ex)
            {
                WriteError(nameof(ConveyorLineJob2), ex.Message);
            }
            return Task.CompletedTask;
        }
    }
}