| | |
| | | using HH.WCS.DaYang.dispatch; |
| | | using HH.WCS.DaYang.util; |
| | | using HH.WCS.DaYang.wms; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Security.Policy; |
| | | using System.Threading; |
| | | using static HH.WCS.DaYang.api.ApiModel; |
| | | using static HH.WCS.DaYang.util.Settings; |
| | | |
| | | namespace HH.WCS.DaYang.process |
| | | { |
| | |
| | | |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 获取叠盘机状态 |
| | | /// </summary> |
| | | internal static void DijStatus() |
| | | { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | HttpHelper httpHelper = new HttpHelper(); |
| | | TableUrl tableUrl = Settings.tableUrls.Find(a => a.id == 3); |
| | | string DiePanLoc = ""; |
| | | Location startloc = null; |
| | | if (tableUrl != null) |
| | | { |
| | | Result<DeviceStatusModel> DeviceStatu = httpHelper.GetDeviceStatus(new string[] { DiePanLoc }, tableUrl.url); |
| | | if (DeviceStatu.Data != null) |
| | | { |
| | | if (int.Parse(DeviceStatu.Data.CntrQty) > 0 && int.Parse(DeviceStatu.Data.CntrQty) < 4) |
| | | { |
| | | startloc = LocationHelper.GetLocByItemCodeOrderyTime("YCLLKQ", ""); |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | startloc = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM == 4).OrderByDescending(a => a.N_POS).First(); |
| | | |
| | | } |
| | | //根据托盘获取起点信息 |
| | | var endloc = db.Queryable<Location>().Where(a => a.S_CODE == DiePanLoc).First(); |
| | | if (endloc == null) |
| | | { |
| | | return; |
| | | } |
| | | #region 创建任务 |
| | | if (startloc != null && endloc != null) |
| | | { |
| | | //获取托盘 |
| | | var Cntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == startloc.S_CODE).ToList(); |
| | | if (Cntr == null) |
| | | { |
| | | return; |
| | | } |
| | | var wcsTask = new WCSTask |
| | | { |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = "空托出库", |
| | | S_START_LOC = startloc.S_CODE, |
| | | S_END_LOC = endloc.S_CODE, |
| | | S_START_WH = startloc.S_WH_CODE, |
| | | S_START_AREA = startloc.S_AREA_CODE, |
| | | S_END_WH = endloc.S_WH_CODE, |
| | | S_END_AREA = endloc.S_AREA_CODE, |
| | | N_CNTR_COUNT = 1, |
| | | N_SCHEDULE_TYPE = 2, |
| | | S_CNTR_CODE = JsonConvert.SerializeObject(Cntr.Select(a => a.S_CNTR_CODE).ToList()) |
| | | }; |
| | | LogHelper.Info("创建入平库任务:" + JsonConvert.SerializeObject(wcsTask)); |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | LocationHelper.LockLoc(startloc.S_CODE, 2); |
| | | LocationHelper.LockLoc(endloc.S_CODE, 1); |
| | | LogHelper.Info("创建任务成功"); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |