1
dengjunjie
2025-03-18 9f225bb1f1e26d25c1652d3e1ec2a8f239f69615
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_DTO.WMSInfo;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.Service;
using WIDESEAWCS_Tasks.ProductionLineJob;
using WIDESEAWCS_Tasks.StackerCraneJob;
using static System.Collections.Specialized.BitVector32;
 
namespace WIDESEAWCS_Tasks
{
    [DisallowConcurrentExecution]
    public partial class CommonProductionLineJob : JobBase, IJob
    {
        private readonly ITaskService _taskService;
        private readonly ITaskExecuteDetailService _taskExecuteDetailService;
        private readonly ITaskRepository _taskRepository;
        private readonly IRouterService _routerService;
 
        public CommonProductionLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService)
        {
            _taskService = taskService;
            _taskExecuteDetailService = taskExecuteDetailService;
            _taskRepository = taskRepository;
            _routerService = routerService;
        }
        //static int i = 1;
        public Task Execute(IJobExecutionContext context)
        {
            try
            {
                //ProductionLineDTO MaterielGroupDTO = new ProductionLineDTO()
                //{
                //    stationCode = "MDX01",
                //    traytype = 4,
                //    Barcode = "25" + i.ToString("000000"),
                //    batchNo = "20250222T3",
                //};
                //var content = ProductionLineToWMSRequest(MaterielGroupDTO);
                //i++;
                #region MyRegion
                OtherDevice ProductionLine = (OtherDevice)context.JobDetail.JobDataMap.Get("JobParams");
                if (ProductionLine != null)
                {
                    var request = ProductionLine.GetValue<ProductionLineDBName, short>(ProductionLineDBName.request);
                    if (request == 1)
                    {
                        var traytype = ProductionLine.GetValue<ProductionLineDBName, short>(ProductionLineDBName.trayType);
                        //var content = Request(ProductionLine, traytype, ProductionLine.DeviceCode);
                        if (traytype == 4)
                        {
                            var Barcode = ProductionLine.GetValue<ProductionLineDBName, string>(ProductionLineDBName.trayBarcode);
                            var batchNo = ProductionLine.GetValue<ProductionLineDBName, string>(ProductionLineDBName.batchNo);
                            ProductionLineDTO MaterielGroupDTO = new ProductionLineDTO()
                            {
                                stationCode = ProductionLine.DeviceCode,
                                traytype = traytype,
                                Barcode = Barcode,
                                batchNo = batchNo,
                            };
                            var content = ProductionLineToWMSRequest(MaterielGroupDTO);
                            if (content.Status) ProductionLine.SetValue(ProductionLineDBName.Wrequest, 1);
                        }
                    }
                }
                #endregion
                #region MyRegion
                //short[] shorts = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 };
                //ProductionLineDTO MaterielGroupDTO = new ProductionLineDTO()
                //{
                //    Barcode = "A1001",
                //    batchNo = "20241212001T1",
                //    stationCode = "Z1",
                //    productQty = string.Join(",", shorts),
                //    traytype = 4
                //};
                //ProductionLineToWMSRequest(MaterielGroupDTO);
                //if (ProductionLine != null)
                //{
                //    switch (ProductionLine.DeviceName)
                //    {
                //        case "入库产线":
                //            ProductionLineIn(ProductionLine);
                //            break;
                //        case "出库产线":
                //            ProductionLineOut(ProductionLine);
                //            break;
                //        default:
                //            throw new Exception("未定义产线");
                //    }
                //} 
                #endregion
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine(nameof(CommonProductionLineJob) + ":" + ex.ToString());
            }
            return Task.CompletedTask;
        }
    }
}