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 = 0; public Task Execute(IJobExecutionContext context) { try { //if (i < 1) //{ // i++; // ProductionLineDTO MaterielGroupDTO = new ProductionLineDTO() // { // stationCode = "MDX01", // traytype = 4, // Barcode = "A0216", // batchNo = "20250113T2", // }; // var content = ProductionLineToWMSRequest(MaterielGroupDTO); //} #region MyRegion //OtherDevice ProductionLine = (OtherDevice)context.JobDetail.JobDataMap.Get("JobParams"); //if (ProductionLine != null) //{ // var request = ProductionLine.GetValue(ProductionLineDBName.request); // if (request == 1) // { // var traytype = ProductionLine.GetValue(ProductionLineDBName.trayType); // //var content = Request(ProductionLine, traytype, ProductionLine.DeviceCode); // if (traytype == 4) // { // var Barcode = ProductionLine.GetValue(ProductionLineDBName.trayBarcode); // var batchNo = ProductionLine.GetValue(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; } } }