From 4d2b6fea8d08c95bd6bb2b8c2b1228383110457e Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期四, 09 四月 2026 12:48:46 +0800
Subject: [PATCH] 1
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/ScheduledTaskJob.cs | 478 ++++++++++++++++++++++++++++++-----------------------------
1 files changed, 240 insertions(+), 238 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/ScheduledTaskJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/ScheduledTaskJob.cs"
index fc71cf7..d7769dc 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/ScheduledTaskJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/ScheduledTaskJob.cs"
@@ -37,253 +37,255 @@
public Task Execute(IJobExecutionContext context)
{
- try
- {
- #region 涓夋ゼ鑷姩浠诲姟
- List<string> StationCodes = new() { "0348840CC0315690", "0349350CC0315686" };
- var stations = _StationInfoService.Repository.QueryData(x => StationCodes.Contains(x.StationCode));
- #region 鍏ユ彁鍗囨満浠诲姟
- var station = stations.FirstOrDefault(x => x.StationStatus == (int)LocationStatusEnum.InStock && x.IsOccupied == 0);
- if (station != null)
- {
- var tasknum = _taskService.GetTaskNum(nameof(SequenceEnum.SeqTaskNum));
- Dt_Task dt_Task = new Dt_Task()
- {
- TaskNum = tasknum,
- WMSTaskNum = "GP" + tasknum,
- Grade = 60,
- PalletCode = station.PalletCode,
- Roadway = "",
- TaskState = (int)TaskStatusEnum.New,
- TaskType = TaskTypeEnum.RK3F.ObjToInt(),
- SourceAddress = station.StationCode,
- CurrentAddress = station.StationCode,
- NextAddress = "TSJR3F",
- TargetAddress = "TSJR3F",
- Creater = "WCS",
- };
- var content = _taskService.SendHIKROBOTTask(dt_Task);
- if (content.Status)
- {
- dt_Task.TaskState = (int)TaskStatusEnum.Execut;
- dt_Task.Dispatchertime = DateTime.Now;
- station.StationStatus = (int)LocationStatusEnum.OutLock;
- _taskService.AddData(dt_Task);
- _StationInfoService.UpdateData(station);
- }
- }
- #endregion
+ //try
+ //{
+ // #region 涓夋ゼ鑷姩浠诲姟
+ // List<string> StationCodes = new() { "0348840CC0315690", "0349350CC0315686" };
+ // var stations = _StationInfoService.Repository.QueryData(x => StationCodes.Contains(x.StationCode));
+ // #region 鍏ユ彁鍗囨満浠诲姟
+ // var station = stations.FirstOrDefault(x => x.StationStatus == (int)LocationStatusEnum.InStock && x.IsOccupied == 0);
+ // if (station != null)
+ // {
+ // var tasknum = _taskService.GetTaskNum(nameof(SequenceEnum.SeqTaskNum));
+ // Dt_Task dt_Task = new Dt_Task()
+ // {
- #region 鍑烘彁鍗囨満浠诲姟
- var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
- if (device != null && device.IsConnected)
- {
- if (device.GetValue<HoistEnum, short>(HoistEnum.SOutboundmaterialbox, "TSJC3F") == 1)
- {
- Dt_Task dt_Task = _taskService.Repository.QueryFirst(x => x.SourceAddress == "TSJC3F" /*&& x.TaskState < TaskStatusEnum.TakeFinish.ObjToInt()*/);
- if (dt_Task == null)
- {
- station = stations.FirstOrDefault(x => x.StationStatus == (int)LocationStatusEnum.Free && x.IsOccupied == 0);
- if (station != null)
- {
- var tasknum = _taskService.GetTaskNum(nameof(SequenceEnum.SeqTaskNum));
- dt_Task = new Dt_Task()
- {
- TaskNum = tasknum,
- WMSTaskNum = "GP" + tasknum,
- Grade = 60,
- PalletCode = "LXM" + tasknum,
- Roadway = "",
- TaskState = (int)TaskStatusEnum.New,
- TaskType = TaskTypeEnum.CK3F.ObjToInt(),
- SourceAddress = "TSJC3F",
- CurrentAddress = "TSJC3F",
- NextAddress = station.StationCode,
- TargetAddress = station.StationCode,
- Creater = "WCS",
- };
- var content = _taskService.SendHIKROBOTTask(dt_Task);
- if (content.Status)
- {
- dt_Task.TaskState = (int)TaskStatusEnum.Execut;
- dt_Task.Dispatchertime = DateTime.Now;
- station.StationStatus = (int)LocationStatusEnum.InLock;
- _taskService.AddData(dt_Task);
- _StationInfoService.UpdateData(station);
- }
- }
- }
- }
- }
- #endregion
+ // TaskNum = tasknum,
+ // WMSTaskNum = "GP" + tasknum,
+ // Grade = 60,
+ // PalletCode = station.PalletCode,
+ // Roadway = "",
+ // TaskState = (int)TaskStatusEnum.New,
+ // TaskType = TaskTypeEnum.RK3F.ObjToInt(),
+ // SourceAddress = station.StationCode,
+ // CurrentAddress = station.StationCode,
+ // NextAddress = "TSJR3F",
+ // TargetAddress = "TSJR3F",
+ // Creater = "WCS",
+ // };
+ // var content = _taskService.SendHIKROBOTTask(dt_Task);
+ // if (content.Status)
+ // {
+ // dt_Task.TaskState = (int)TaskStatusEnum.Execut;
+ // dt_Task.Dispatchertime = DateTime.Now;
+ // station.StationStatus = (int)LocationStatusEnum.OutLock;
+ // _taskService.AddData(dt_Task);
+ // _StationInfoService.UpdateData(station);
+ // }
+ // }
+ // #endregion
- #endregion
+ // #region 鍑烘彁鍗囨満浠诲姟
+ // var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
+ // if (device != null && device.IsConnected)
+ // {
+ // if (device.GetValue<HoistEnum, short>(HoistEnum.SOutboundmaterialbox, "TSJC3F") == 1)
+ // {
+ // Dt_Task dt_Task = _taskService.Repository.QueryFirst(x => x.SourceAddress == "TSJC3F" /*&& x.TaskState < TaskStatusEnum.TakeFinish.ObjToInt()*/);
+ // if (dt_Task == null)
+ // {
+ // station = stations.FirstOrDefault(x => x.StationStatus == (int)LocationStatusEnum.Free && x.IsOccupied == 0);
+ // if (station != null)
+ // {
+ // var tasknum = _taskService.GetTaskNum(nameof(SequenceEnum.SeqTaskNum));
+ // dt_Task = new Dt_Task()
+ // {
+ // TaskNum = tasknum,
+ // WMSTaskNum = "GP" + tasknum,
+ // Grade = 60,
+ // PalletCode = "LXM" + tasknum,
+ // Roadway = "",
+ // TaskState = (int)TaskStatusEnum.New,
+ // TaskType = TaskTypeEnum.CK3F.ObjToInt(),
+ // SourceAddress = "TSJC3F",
+ // CurrentAddress = "TSJC3F",
+ // NextAddress = station.StationCode,
+ // TargetAddress = station.StationCode,
+ // Creater = "WCS",
+ // };
+ // var content = _taskService.SendHIKROBOTTask(dt_Task);
+ // if (content.Status)
+ // {
+ // dt_Task.TaskState = (int)TaskStatusEnum.Execut;
+ // dt_Task.Dispatchertime = DateTime.Now;
+ // station.StationStatus = (int)LocationStatusEnum.InLock;
+ // _taskService.AddData(dt_Task);
+ // _StationInfoService.UpdateData(station);
+ // }
+ // }
+ // }
+ // }
+ // }
+ // #endregion
- #region 4F
- List<string> stationCodes = new() { "0319882DD0313240", "0319882DD0313750" };
- var Stations = _StationInfoService.Repository.QueryData(x => stationCodes.Contains(x.StationCode));
- #region 鍏ユ彁鍗囨満浠诲姟
- var Station = Stations.FirstOrDefault(x => x.StationStatus == (int)LocationStatusEnum.InStock && x.IsOccupied == 0);
- if (Station != null)
- {
- var tasknum = _taskService.GetTaskNum(nameof(SequenceEnum.SeqTaskNum));
- Dt_Task dt_Task = new Dt_Task()
- {
- TaskNum = tasknum,
- WMSTaskNum = "GP" + tasknum,
- Grade = 60,
- PalletCode = Station.PalletCode,
- Roadway = "",
- TaskState = (int)TaskStatusEnum.New,
- TaskType = TaskTypeEnum.F04.ObjToInt(),
- SourceAddress = Station.StationCode,
- CurrentAddress = Station.StationCode,
- NextAddress = "TSJR4F",
- TargetAddress = "TSJR4F",
- Creater = "WCS",
- };
- var content = _taskService.SendHIKROBOTTask(dt_Task);
- if (content.Status)
- {
- dt_Task.TaskState = (int)TaskStatusEnum.Execut;
- dt_Task.Dispatchertime = DateTime.Now;
- Station.StationStatus = (int)LocationStatusEnum.OutLock;
- _taskService.AddData(dt_Task);
- _StationInfoService.UpdateData(Station);
- }
- }
- #endregion
+ // #endregion
- #region 鍑烘彁鍗囨満浠诲姟
- device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
- if (device != null && device.IsConnected)
- {
- if (device.GetValue<HoistEnum, short>(HoistEnum.FOutboundmaterialbox, "TSJC4F") == 1)
- {
- Dt_Task dt_Task = _taskService.Repository.QueryFirst(x => x.SourceAddress == "TSJC4F" /*&& x.TaskState < TaskStatusEnum.TakeFinish.ObjToInt()*/);
- if (dt_Task == null)
- {
- Station = Stations.FirstOrDefault(x => x.StationStatus == (int)LocationStatusEnum.Free && x.IsOccupied == 0);
- if (Station != null)
- {
- var tasknum = _taskService.GetTaskNum(nameof(SequenceEnum.SeqTaskNum));
- dt_Task = new Dt_Task()
- {
- TaskNum = tasknum,
- WMSTaskNum = "GP" + tasknum,
- Grade = 60,
- PalletCode = "LXM" + tasknum,
- Roadway = "",
- TaskState = (int)TaskStatusEnum.New,
- TaskType = TaskTypeEnum.F03.ObjToInt(),
- SourceAddress = "TSJC4F",
- CurrentAddress = "TSJC4F",
- NextAddress = Station.StationCode,
- TargetAddress = Station.StationCode,
- Creater = "WCS",
- };
- var content = _taskService.SendHIKROBOTTask(dt_Task);
- if (content.Status)
- {
- dt_Task.TaskState = (int)TaskStatusEnum.Execut;
- dt_Task.Dispatchertime = DateTime.Now;
- Station.StationStatus = (int)LocationStatusEnum.InLock;
- _taskService.AddData(dt_Task);
- _StationInfoService.UpdateData(Station);
- }
- }
- }
- }
- }
- #endregion
+ // #region 4F
+ // List<string> stationCodes = new() { "0319882DD0313240", "0319882DD0313750"};
+ // var Stations = _StationInfoService.Repository.QueryData(x => stationCodes.Contains(x.StationCode));
+ // #region 鍏ユ彁鍗囨満浠诲姟
+ // var Station = Stations.FirstOrDefault(x => x.StationStatus == (int)LocationStatusEnum.InStock && x.IsOccupied == 0);
+ // if (Station != null)
+ // {
+ // var tasknum = _taskService.GetTaskNum(nameof(SequenceEnum.SeqTaskNum));
+ // Dt_Task dt_Task = new Dt_Task()
+ // {
+ // TaskNum = tasknum,
+ // WMSTaskNum = "GP" + tasknum,
+ // Grade = 60,
+ // PalletCode = Station.PalletCode,
+ // Roadway = "",
+ // TaskState = (int)TaskStatusEnum.New,
+ //TaskType = TaskTypeEnum.F04.ObjToInt(),
+ // SourceAddress = Station.StationCode,
+ // CurrentAddress = Station.StationCode,
+ // NextAddress = "TSJR4F",
+ // TargetAddress = "TSJR4F",
+ // Creater = "WCS",
+ // };
+ // var content = _taskService.SendHIKROBOTTask(dt_Task);
+ // if (content.Status)
+ // {
+ // dt_Task.TaskState = (int)TaskStatusEnum.Execut;
+ // dt_Task.Dispatchertime = DateTime.Now;
+ // Station.StationStatus = (int)LocationStatusEnum.OutLock;
+ // _taskService.AddData(dt_Task);
+ // _StationInfoService.UpdateData(Station);
+ // }
+ // }
+ // #endregion
- #endregion
+ // #region 鍑烘彁鍗囨満浠诲姟
+ // device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
+ // if (device != null && device.IsConnected)
+ // {
+ // var reslur = device.GetValue<HoistEnum, short>(HoistEnum.FOutboundmaterialbox, "TSJC4F");
+ // if (device.GetValue<HoistEnum, short>(HoistEnum.FOutboundmaterialbox, "TSJC4F") == 1)
+ // {
+ // Dt_Task dt_Task = _taskService.Repository.QueryFirst(x => x.SourceAddress == "TSJC4F" /*&& x.TaskState < TaskStatusEnum.TakeFinish.ObjToInt()*/);
+ // if (dt_Task == null)
+ // {
+ // Station = Stations.FirstOrDefault(x => x.StationStatus == (int)LocationStatusEnum.Free && x.IsOccupied == 0);
+ // if (Station != null)
+ // {
+ // var tasknum = _taskService.GetTaskNum(nameof(SequenceEnum.SeqTaskNum));
+ // dt_Task = new Dt_Task()
+ // {
+ // TaskNum = tasknum,
+ // WMSTaskNum = "GP" + tasknum,
+ // Grade = 60,
+ // PalletCode = "LXM" + tasknum,
+ // Roadway = "",
+ // TaskState = (int)TaskStatusEnum.New,
+ // TaskType = TaskTypeEnum.F03.ObjToInt(),
+ // SourceAddress = "TSJC4F",
+ // CurrentAddress = "TSJC4F",
+ // NextAddress = Station.StationCode,
+ // TargetAddress = Station.StationCode,
+ // Creater = "WCS",
+ // };
+ // var content = _taskService.SendHIKROBOTTask(dt_Task);
+ // if (content.Status)
+ // {
+ // dt_Task.TaskState = (int)TaskStatusEnum.Execut;
+ // dt_Task.Dispatchertime = DateTime.Now;
+ // Station.StationStatus = (int)LocationStatusEnum.InLock;
+ // _taskService.AddData(dt_Task);
+ // _StationInfoService.UpdateData(Station);
+ // }
+ // }
+ // }
+ // }
+ // }
+ // #endregion
- #region 鍥涙ゼ鑷姩浠诲姟
- //List<string> LocationCodes = new() { "RGD0303A04041", "RG0302A05041", "RG0304A05041", "RG0205A05031" };
- List<string> LocationCodes = new() { "RGD0302A05041", "RGD0304A05041", "R3CG0106A04031", "RGD0307A05012" };
- var hKLocationInfos = _HKLocationInfoService.Repository.QueryData(x => LocationCodes.Contains(x.LocationCode));
- #region 鍏ユ彁鍗囨満浠诲姟
- var hKLocation = hKLocationInfos.FirstOrDefault(x => x.LocationStatus == (int)LocationStatusEnum.InStock);
- if (hKLocation != null)
- {
- var tasknum = _taskService.GetTaskNum(nameof(SequenceEnum.SeqTaskNum));
- Dt_Task dt_Task = new Dt_Task()
- {
- TaskNum = tasknum,
- WMSTaskNum = "GP" + tasknum,
- Grade = 60,
- PalletCode = hKLocation.PalletCode,
- Roadway = "",
- TaskState = (int)TaskStatusEnum.New,
- TaskType = TaskTypeEnum.CHUKU1.ObjToInt(),
- SourceAddress = hKLocation.LocationCode,
- CurrentAddress = hKLocation.LocationCode,
- NextAddress = "TSJR4F",
- TargetAddress = "TSJR4F",
- Creater = "WCS",
- };
- var content = _taskService.SendHIKROBOTTask(dt_Task);
- if (content.Status)
- {
- dt_Task.TaskState = (int)TaskStatusEnum.Execut;
- dt_Task.Dispatchertime = DateTime.Now;
- hKLocation.LocationStatus = (int)LocationStatusEnum.OutLock;
- _taskService.AddData(dt_Task);
- _HKLocationInfoService.UpdateData(hKLocation);
- }
- }
- #endregion
+ // #endregion
- #region 鍑烘彁鍗囨満浠诲姟
- //if (device != null && device.IsConnected)
- //{
- // if (device.GetValue<HoistEnum, short>(HoistEnum.FOutboundmaterialbox, "TSJC4F") == 1)
- // {
- // Dt_Task dt_Task = _taskService.Repository.QueryFirst(x => x.SourceAddress == "TSJC4F");
- // if (dt_Task == null)
- // {
- // hKLocation = hKLocationInfos.FirstOrDefault(x => x.LocationStatus == (int)LocationStatusEnum.Free);
- // if (hKLocation != null)
- // {
- // var tasknum = _taskService.GetTaskNum(nameof(SequenceEnum.SeqTaskNum));
- // dt_Task = new Dt_Task()
- // {
- // TaskNum = tasknum,
- // WMSTaskNum = "GP" + tasknum,
- // Grade = 60,
- // PalletCode = "LXM" + tasknum,
- // Roadway = "",
- // TaskState = (int)TaskStatusEnum.New,
- // TaskType = TaskTypeEnum.Q1TSJ4.ObjToInt(),
- // SourceAddress = "TSJC4F",
- // CurrentAddress = "TSJC4F",
- // NextAddress = hKLocation.LocationCode,
- // TargetAddress = hKLocation.LocationCode,
- // Creater = "WCS",
- // };
- // var content = _taskService.SendHIKROBOTTask(dt_Task);
- // if (content.Status)
- // {
- // dt_Task.TaskState = (int)TaskStatusEnum.Execut;
- // dt_Task.Dispatchertime = DateTime.Now;
- // hKLocation.LocationStatus = (int)LocationStatusEnum.InLock;
- // _taskService.AddData(dt_Task);
- // _HKLocationInfoService.UpdateData(hKLocation);
- // }
- // }
- // }
+ // #region 鍥涙ゼ鑷姩浠诲姟
+ // //List<string> LocationCodes = new() { "RGD0303A04041", "RG0302A05041", "RG0304A05041", "RG0205A05031" };
+ // List<string> LocationCodes = new() { "RGD0302A05041", "RGD0304A05041", "R3CG0106A04031", "RGD0307A05012" };
+ // var hKLocationInfos = _HKLocationInfoService.Repository.QueryData(x => LocationCodes.Contains(x.LocationCode));
+ // #region 鍏ユ彁鍗囨満浠诲姟
+ // var hKLocation = hKLocationInfos.FirstOrDefault(x => x.LocationStatus == (int)LocationStatusEnum.InStock);
+ // if (hKLocation != null)
+ // {
+ // var tasknum = _taskService.GetTaskNum(nameof(SequenceEnum.SeqTaskNum));
+ // Dt_Task dt_Task = new Dt_Task()
+ // {
+ // TaskNum = tasknum,
+ // WMSTaskNum = "GP" + tasknum,
+ // Grade = 60,
+ // PalletCode = hKLocation.PalletCode,
+ // Roadway = "",
+ // TaskState = (int)TaskStatusEnum.New,
+ //TaskType = TaskTypeEnum.CHUKU1.ObjToInt(),
+ // SourceAddress = hKLocation.LocationCode,
+ // CurrentAddress = hKLocation.LocationCode,
+ // NextAddress = "TSJR4F",
+ // TargetAddress = "TSJR4F",
+ // Creater = "WCS",
+ // };
+ // var content = _taskService.SendHIKROBOTTask(dt_Task);
+ // if (content.Status)
+ // {
+ // dt_Task.TaskState = (int)TaskStatusEnum.Execut;
+ // dt_Task.Dispatchertime = DateTime.Now;
+ // hKLocation.LocationStatus = (int)LocationStatusEnum.OutLock;
+ // _taskService.AddData(dt_Task);
+ // _HKLocationInfoService.UpdateData(hKLocation);
+ // }
+ // }
+ // #endregion
- // }
- //}
- #endregion
+ // #region 鍑烘彁鍗囨満浠诲姟
+ // //if (device != null && device.IsConnected)
+ // //{
+ // // if (device.GetValue<HoistEnum, short>(HoistEnum.FOutboundmaterialbox, "TSJC4F") == 1)
+ // // {
+ // // Dt_Task dt_Task = _taskService.Repository.QueryFirst(x => x.SourceAddress == "TSJC4F");
+ // // if (dt_Task == null)
+ // // {
+ // // hKLocation = hKLocationInfos.FirstOrDefault(x => x.LocationStatus == (int)LocationStatusEnum.Free);
+ // // if (hKLocation != null)
+ // // {
+ // // var tasknum = _taskService.GetTaskNum(nameof(SequenceEnum.SeqTaskNum));
+ // // dt_Task = new Dt_Task()
+ // // {
+ // // TaskNum = tasknum,
+ // // WMSTaskNum = "GP" + tasknum,
+ // // Grade = 60,
+ // // PalletCode = "LXM" + tasknum,
+ // // Roadway = "",
+ // // TaskState = (int)TaskStatusEnum.New,
+ // // TaskType = TaskTypeEnum.Q1TSJ4.ObjToInt(),
+ // // SourceAddress = "TSJC4F",
+ // // CurrentAddress = "TSJC4F",
+ // // NextAddress = hKLocation.LocationCode,
+ // // TargetAddress = hKLocation.LocationCode,
+ // // Creater = "WCS",
+ // // };
+ // // var content = _taskService.SendHIKROBOTTask(dt_Task);
+ // // if (content.Status)
+ // // {
+ // // dt_Task.TaskState = (int)TaskStatusEnum.Execut;
+ // // dt_Task.Dispatchertime = DateTime.Now;
+ // // hKLocation.LocationStatus = (int)LocationStatusEnum.InLock;
+ // // _taskService.AddData(dt_Task);
+ // // _HKLocationInfoService.UpdateData(hKLocation);
+ // // }
+ // // }
+ // // }
- #endregion
- }
- catch (Exception ex)
- {
- Console.Out.WriteLine(nameof(TaskJob) + ":" + ex.Message);
- }
+ // // }
+ // //}
+ // #endregion
+
+ // #endregion
+ //}
+ //catch (Exception ex)
+ //{
+ // Console.Out.WriteLine(nameof(TaskJob) + ":" + ex.Message);
+ //}
return Task.CompletedTask;
}
}
--
Gitblit v1.9.3