| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection.Emit; |
| | | using System.Security.Cryptography; |
| | | using System.Text; |
| | | using static HH.WCS.DaYang.api.ApiModel; |
| | | using static HH.WCS.DaYang.util.Settings; |
| | | using static System.Net.WebRequestMethods; |
| | | |
| | | namespace HH.WCS.DaYang.process |
| | | { |
| | |
| | | internal static bool Intercept(WCSTask mst) |
| | | { |
| | | var result = false; |
| | | #region 空托回库任务需要判断有没有执行中的出库任务,接驳位有无托盘,如果有先不推送任务 |
| | | if (mst.S_TYPE == "空托回库" && mst.N_SCHEDULE_TYPE == 1) |
| | | #region 空托回库任务需要判断有没有执行中的出库任务,接驳位有无托盘,如果有先不推送任务,任务任务需要agv任务完成再推 |
| | | if (mst.S_TYPE == "空托回库") |
| | | { |
| | | //判断有无出库中的任务 |
| | | var task = WCSHelper.GetTaskbyType("出库"); |
| | | if (task.Count == 0) |
| | | { //获取接驳位设备状态 |
| | | HttpHelper httpHelper = new HttpHelper(); |
| | | TableUrl tableUrl = Settings.tableUrls.Find(a => a.id == 3); |
| | | if (tableUrl != null) |
| | | { |
| | | Result<DeviceStatusModel> DeviceStatu = httpHelper.GetDeviceStatus(new string[] { mst.S_END_LOC }, tableUrl.url); |
| | | //设备状态空则允许推送 |
| | | if (DeviceStatu != null && DeviceStatu.Data[0].PhotoStatus == 0) |
| | | if (mst.N_SCHEDULE_TYPE == 1) |
| | | { |
| | | //判断有无出库中的任务 |
| | | var task = WCSHelper.GetTaskbyType("出库"); |
| | | if (task.Count == 0) |
| | | { //获取接驳位设备状态 |
| | | HttpHelper httpHelper = new HttpHelper(); |
| | | TableUrl tableUrl = Settings.tableUrls.Find(a => a.id == 3); |
| | | if (tableUrl != null) |
| | | { |
| | | result = true; |
| | | Result<DeviceStatusModel> DeviceStatu = httpHelper.GetDeviceStatus(new string[] { mst.S_END_LOC }, tableUrl.url); |
| | | //设备状态空则允许推送 |
| | | if (DeviceStatu != null && DeviceStatu.Data[0].PhotoStatus == 0) |
| | | { |
| | | result = true; |
| | | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"Intercept:设备状态不允许推送"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"Intercept:设备状态不允许推送"); |
| | | LogHelper.Info($"Intercept:获取接口url失败"); |
| | | } |
| | | } |
| | | else |
| | | } |
| | | if (mst.N_SCHEDULE_TYPE == 2) |
| | | { |
| | | var task = WCSHelper.GetTaskByOpName(mst.S_OP_CODE, 3); |
| | | if (task != null) |
| | | { |
| | | LogHelper.Info($"Intercept:获取接口url失败"); |
| | | result = true; |
| | | } |
| | | } |
| | | } |
| | | if (mst.S_TYPE == "出库") |
| | | { |
| | | //推送agv任务,判断设备任务是否完成 |
| | | if (mst.N_SCHEDULE_TYPE == 1) |
| | | { |
| | | var task = WCSHelper.GetTaskByOpName(mst.S_OP_CODE, 3); |
| | | if (task != null) |
| | | { |
| | | result = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //如果当前任务不是移库任务,需要判断移库任务是否完成 |
| | | if (mst.S_TYPE != "移库") |
| | | { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | var ykmst = db.Queryable<WCSTask>().Where(a => a.S_OP_CODE == mst.S_OP_NAME && a.N_B_STATE == 3 && a.S_TYPE == "移库").First(); |
| | | if (ykmst != null) |
| | | { |
| | | result = true; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | #endregion |
| | |
| | | else if (mst.N_SCHEDULE_TYPE == 2)//输送线任务 |
| | | { |
| | | HttpHelper http = new HttpHelper(); |
| | | var url = Settings.tableUrls.Find(a => a.id == 1); |
| | | if (url != null) |
| | | TableUrl tableUrl = Settings.tableUrls.Find(a => a.id == 3); |
| | | if (tableUrl != null) |
| | | { |
| | | //推送输送线任务 |
| | | var SendResult = http.TaskAssignment(mst, url.url); |
| | | if (SendResult != null && SendResult.Code == 0) |
| | | var Wcsrsult = http.TaskAssignment(mst, tableUrl.url); |
| | | if (Wcsrsult.Code == 200) |
| | | { |
| | | mst.N_B_STATE = 1; |
| | | WCSHelper.UpdateStatus(mst); |
| | | result = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"未找到任务下发接口地址,请检查配置文件"); |
| | | } |
| | | } |
| | | return result; |