| | |
| | | using HH.WCS.DaYang.util; |
| | | using HH.WCS.DaYang.wms; |
| | | using Newtonsoft.Json; |
| | | using NLog.Fluent; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Concurrent; |
| | |
| | | return result; |
| | | } |
| | | |
| | | #region 废弃老流程 |
| | | //internal static Result createtask(CreateTask model) |
| | | //{ |
| | | // Result result = new Result { resultCode = 0, resultMsg = "创建成功" }; |
| | | // var db = new SqlHelper<object>().GetInstance(); |
| | | // string start = model.startBit; |
| | | // string end = model.endBit; |
| | | // string Type = ""; |
| | | // string cntrcode = ""; |
| | | // int startlayer = 1; |
| | | |
| | | // int endlayer = 1; |
| | | // // string startarea = ""; |
| | | // //string endarea = ""; |
| | | // //1创建取托盘任务 |
| | | // if (model.TaskType == "1") |
| | | // { |
| | | // if (LocControl(start)) |
| | | // { |
| | | // string startZone = "HJQ"; |
| | | // //找空托盘 |
| | | // var cntr = ContainerHelper.GetItemCntrRel(model.ItemCode).ToList(); |
| | | // if (cntr.Count > 0) |
| | | // { |
| | | // string[] cntrcodes = cntr.Select(a => a.S_CNTR_CODE).ToArray(); |
| | | // // 根据托盘找货位 |
| | | // var trayInfo = db.Queryable<LocCntrRel>().Where(a => cntrcodes.Contains(a.S_CNTR_CODE)).ToList(); |
| | | // if (trayInfo.Count() > 0) |
| | | // { |
| | | // //判断起点是否是指定库区的货位 |
| | | // foreach (var item in trayInfo) |
| | | // { |
| | | // var locations = db.Queryable<Location>().Where(a => a.S_CODE == item.S_LOC_CODE && a.S_AREA_CODE == startZone).First(); |
| | | // if (locations != null) |
| | | // { |
| | | // start = locations.S_CODE; |
| | | // cntrcode = item.S_CNTR_CODE; |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // result.resultCode = -1; |
| | | // result.resultMsg = "根据托盘编码未找到所属货位编码"; |
| | | // return result; |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // result.resultCode = -1; |
| | | // result.resultMsg = "找不到空托盘"; |
| | | // return result; |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // result.resultCode = -1; |
| | | // result.resultMsg = "外侧货位有托盘"; |
| | | // return result; |
| | | // } |
| | | // } |
| | | // // 2创建取物料任务 |
| | | // else if (model.TaskType == "2") |
| | | // { |
| | | // if (LocControl(start)) |
| | | // { |
| | | // string startZone = "AGVZYQ"; |
| | | |
| | | // //根据物料编码找托盘 |
| | | // var cntr = ContainerHelper.GetItemCntrRel(model.ItemCode).FirstOrDefault(); |
| | | // if (cntr != null) |
| | | // { |
| | | // //根据托盘找货位 |
| | | // var trayInfo = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE == cntr.S_CNTR_CODE).ToList(); |
| | | // if (trayInfo.Count() > 0) |
| | | // { |
| | | // //判断起点是否是指定库区的货位 |
| | | // foreach (var item in trayInfo) |
| | | // { |
| | | // var locations = db.Queryable<Location>().Where(a => a.S_CODE == item.S_LOC_CODE && a.S_AREA_CODE == startZone).First(); |
| | | // if (locations != null) |
| | | // { |
| | | // start = locations.S_CODE; |
| | | // cntrcode = cntr.S_CNTR_CODE; |
| | | // //startlayer = locations.N_CURRENT_NUM == 1 ? 1 : 2; |
| | | // // startlayer = locations.N_LAYER; |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // result.resultCode = -1; |
| | | // result.resultMsg = "根据物料托盘编码未找到所属货位编码"; |
| | | // return result; |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // result.resultCode = -1; |
| | | // result.resultMsg = "根据物料编码未找到所属容器号"; |
| | | // return result; |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // result.resultCode = -1; |
| | | // result.resultMsg = "外侧货位有托盘,不允许生成任务"; |
| | | // return result; |
| | | // } |
| | | |
| | | // } |
| | | // //3满拖入库 |
| | | // else if (model.TaskType == "3") |
| | | // { |
| | | |
| | | // string endlloc = "JBW_01_01"; |
| | | |
| | | |
| | | // var locations = LocationHelper.GetLocList(endlloc).FirstOrDefault(); |
| | | // if (locations.S_LOCK_STATE != "无") |
| | | // { |
| | | // if (locations.N_CURRENT_NUM > 0) |
| | | // { |
| | | // result.resultCode = -1; |
| | | // result.resultMsg = $"货位{endlloc}已有托盘,不允许生成任务"; |
| | | // return result; |
| | | // } |
| | | // else |
| | | // { |
| | | // end = endlloc; |
| | | // } |
| | | |
| | | // } |
| | | // else |
| | | // { |
| | | // result.resultCode = -1; |
| | | // result.resultMsg = $"货位{endlloc}已有任务正在执行中,不允许生成任务"; |
| | | // return result; |
| | | // } |
| | | // //var locations = LocationHelper.GetLocListAny(startZone).OrderBy(a => a.N_ROW).ToList(); |
| | | // //var suo = locations.Find(a => a.S_LOCK_STATE != "无"); |
| | | // //if (suo != null) |
| | | // //{ |
| | | // // var endloc = FindEndcolByLocList(locations, model.ItemCode); |
| | | // // if (endloc != null) |
| | | // // { |
| | | // // end = endloc.S_CODE; |
| | | // // } |
| | | // //} |
| | | // //else |
| | | // //{ |
| | | // // result.resultCode = -1; |
| | | // // result.resultMsg = $"库区{suo.S_AREA_CODE}已有任务正在执行中,不允许生成任务"; |
| | | // // return result; |
| | | // //} |
| | | |
| | | |
| | | |
| | | // } |
| | | // //4分拣出 |
| | | // else if (model.TaskType == "4") |
| | | // { |
| | | // string startZone = "HJQ"; |
| | | |
| | | // //根据物料编码找托盘 |
| | | // var cntr = ContainerHelper.GetItemCntrRel(model.ItemCode).FirstOrDefault(); |
| | | // if (cntr != null) |
| | | // { |
| | | // //根据托盘找货位 |
| | | // var trayInfo = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE == cntr.S_CNTR_CODE).ToList(); |
| | | // if (trayInfo.Count() > 0) |
| | | // { |
| | | // //判断起点是否是指定库区的货位 |
| | | // foreach (var item in trayInfo) |
| | | // { |
| | | // var locations = db.Queryable<Location>().Where(a => a.S_CODE == item.S_LOC_CODE && a.S_AREA_CODE == startZone).First(); |
| | | // if (locations != null) |
| | | // { |
| | | // start = locations.S_CODE; |
| | | // cntrcode = cntr.S_CNTR_CODE; |
| | | // break; |
| | | // } |
| | | // } |
| | | |
| | | // } |
| | | // else |
| | | // { |
| | | // result.resultCode = -1; |
| | | // result.resultMsg = "根据物料托盘编码未找到所属货位编码"; |
| | | // return result; |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // result.resultCode = -1; |
| | | // result.resultMsg = "根据物料编码未找到所属容器号"; |
| | | // return result; |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // result.resultCode = -1; |
| | | // result.resultMsg = $"任务类型有误,{model.TaskType}任务类型不是规定任务类型"; |
| | | // return result; |
| | | // } |
| | | // if (!string.IsNullOrEmpty(start) && !string.IsNullOrEmpty(end)) |
| | | // { |
| | | // //创建wcs任务 |
| | | // var wcsTask = new WCSTask |
| | | // { |
| | | // S_CODE = WCSHelper.GenerateTaskNo(), |
| | | // S_TYPE = Type, |
| | | // S_START_LOC = start, |
| | | // S_END_LOC = end, |
| | | // N_CNTR_COUNT = 1, |
| | | // N_SCHEDULE_TYPE = 1, |
| | | // S_CNTR_CODE = cntrcode, |
| | | // N_START_LAYER = startlayer, |
| | | // N_END_LAYER = endlayer |
| | | |
| | | // }; |
| | | // LogHelper.Info("创建任务:" + JsonConvert.SerializeObject(wcsTask), "CreateTask"); |
| | | // if (WCSHelper.CreateTask(wcsTask)) |
| | | // { |
| | | // LocationHelper.LockLoc(start, 2); |
| | | // LocationHelper.LockLoc(end, 1); |
| | | // LogHelper.Info("创建任务成功"); |
| | | // } |
| | | // } |
| | | |
| | | // return result; |
| | | //} |
| | | #endregion |
| | | |
| | | private static object lockObj = new object(); |
| | | |
| | | /// <summary> |
| | | /// 创建任务 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | internal static Result createtask(CreateTaskModel model) |
| | | internal static Result<Empty> createtask(CreateTaskModel model) |
| | | { |
| | | Result result = new Result { resultCode = 0, resultMsg = "创建成功" }; |
| | | Result<Empty> result = new Result<Empty> { Code = 0, Msg = "创建成功" }; |
| | | if (model == null) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = "入参为空"; |
| | | result.Code = -1; |
| | | result.Msg = "入参为空"; |
| | | return result; |
| | | } |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | |
| | | { |
| | | try |
| | | { |
| | | |
| | | // 1 空托回库 |
| | | if (model.TaskType == "1") |
| | | { |
| | |
| | | |
| | | #region 获取起点信息 |
| | | startloc = LocationHelper.GetLoc(model.startBit); |
| | | if (endloc == null) |
| | | if (startloc == null) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"根据起点:{model.startBit}未找到货位信息"; |
| | | LogHelper.Info($"creattask:根据起点:{model.startBit}未找到货位信息"); |
| | | result.Code = -1; |
| | | result.Msg = $"根据起点:{model.startBit}未找到货位信息"; |
| | | LogHelper.Info($"creattask:{result.Msg}"); |
| | | return result; |
| | | } |
| | | else |
| | |
| | | var cntr = LocationHelper.GetLocCntrRel(endloc.S_CODE).FirstOrDefault(); |
| | | if (cntr == null) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"根据起点:{model.startBit}未找到绑定托盘"; |
| | | LogHelper.Info($"creattask:根据起点:{model.startBit}未找到绑定托盘"); |
| | | result.Code = -1; |
| | | result.Msg = $"根据起点:{model.startBit}未找到绑定托盘"; |
| | | LogHelper.Info($"creattask:{result.Msg}"); |
| | | return result; |
| | | } |
| | | else |
| | |
| | | endloc = LocationHelper.InStorage(startloc); |
| | | if (endloc == null) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"未计算到立库终点货位,请检查货位情况"; |
| | | LogHelper.Info($"creattask:未计算到立库终点货位,请检查货位情况"); |
| | | result.Code = -1; |
| | | result.Msg = $"未计算到立库终点货位,请检查货位情况"; |
| | | LogHelper.Info($"creattask:{result.Msg}"); |
| | | return result; |
| | | } |
| | | #endregion |
| | | |
| | | #region 创建作业 |
| | | if (startloc != null && endloc != null) |
| | | { |
| | | //创建作业 |
| | | var wcsTask = new WMSTask |
| | | { |
| | | S_CODE = WMSHelper.GenerateTaskNo(), |
| | | S_TYPE = Type, |
| | | N_TYPE = int.Parse(model.TaskType), |
| | | S_START_LOC = start, |
| | | S_END_LOC = endloc.S_CODE, |
| | | S_CNTR_CODE = cntrcode, |
| | | S_END_WH = endloc.S_WH_CODE, |
| | | S_START_WH = startloc.S_WH_CODE, |
| | | S_START_AREA = startloc.S_AREA_CODE, |
| | | S_END_AREA = endloc.S_AREA_CODE, |
| | | |
| | | }; |
| | | LogHelper.Info("创建作业:" + JsonConvert.SerializeObject(wcsTask), "CreateTask"); |
| | | if (WMSHelper.CreateTask(wcsTask)) |
| | | { |
| | | LocationHelper.LockLoc(startloc.S_CODE, 2); |
| | | LocationHelper.LockLoc(endloc.S_CODE, 1); |
| | | LogHelper.Info("创建作业成功"); |
| | | //空托回库成功,如果存在物料数据,删除 |
| | | var itemcntr = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == cntrcode).First(); |
| | | if (itemcntr != null) { db.Deleteable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == cntrcode).ExecuteCommand(); } |
| | | LogHelper.Info("创建任务成功"); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | // 2 出库 |
| | | if (model.TaskType == "2") |
| | | { |
| | | Type = "出库"; |
| | | |
| | | #region 获取终点信息 |
| | | startloc = LocationHelper.GetLoc(model.endBit); |
| | | if (startloc == null) |
| | | { |
| | | result.Code = -1; |
| | | result.Msg = $"根据终点:{model.startBit}未找到货位信息"; |
| | | LogHelper.Info($"creattask:{result.Msg}"); |
| | | return result; |
| | | } |
| | | #endregion |
| | | |
| | | #region 根据物料计算出库托盘,先进先出,优先出外侧 |
| | | //先计算内侧货位,判断是否有单组托盘 |
| | | var locations = LocationHelper.GetLocByItemCodeOrderyTime("", model.ItemCode); |
| | | if (locations.Count > 0) |
| | | { |
| | | endloc = locations.OrderBy(a => a.N_COL).First(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 创建作业 |
| | |
| | | } |
| | | else |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"任务类型有误,{model.TaskType}任务类型不是规定任务类型"; |
| | | LogHelper.Info($"creattask:任务类型有误,{model.TaskType}任务类型不是规定任务类型"); |
| | | result.Code = -1; |
| | | result.Msg = $"任务类型有误,{model.TaskType}任务类型不是规定任务类型"; |
| | | LogHelper.Info($"creattask:{result.Msg}"); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = $"{ex.ToString()}"; |
| | | result.Code = -1; |
| | | result.Msg = $"{ex.ToString()}"; |
| | | return result; |
| | | |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | internal static Result PutIn(PutInModel model) |
| | | /// <summary> |
| | | /// 设备信号反馈 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | internal static Result<Empty> NotifyDeviceSignal(NotifyDeviceSignalModel model) |
| | | { |
| | | Result result = new Result { resultCode = 0, resultMsg = "创建成功" }; |
| | | Result<Empty> result = new Result<Empty> { Code = 0, Msg = "创建成功" }; |
| | | if (model == null) |
| | | { |
| | | result.resultCode = -1; |
| | | result.resultMsg = "入参为空"; |
| | | result.Code = -1; |
| | | result.Msg = "入参为空"; |
| | | return result; |
| | | } |
| | | Location endloc = new Location(); |
| | | Location startloc = new Location(); |
| | | string cntrcode = model.CntrNo; |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | |
| | | if (model.DeviceNo == "1")//叠盘机 |
| | | { |
| | | #region 获取起点信息,并判断空托是否叠满 |
| | | //根据起点 获取绑定托盘数量 |
| | | var CntrLoc = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE == model.Loc).ToList(); |
| | | if (CntrLoc.Count < 4) |
| | | { |
| | | result.Code = -1; |
| | | result.Msg = $"根据货位:{model.Loc}获取托盘数量小于4"; |
| | | LogHelper.Info($"EquipmentInfo:{result.Msg}"); |
| | | return result; |
| | | } |
| | | else |
| | | { |
| | | //拼接托盘号 |
| | | cntrcode = CntrLoc.Select(a => a.S_CNTR_CODE).ToString(); |
| | | } |
| | | startloc = LocationHelper.GetLoc(model.Loc); |
| | | if (startloc == null) |
| | | { |
| | | result.Code = -1; |
| | | result.Msg = $"根据起点:{model.Loc}未找到货位信息"; |
| | | LogHelper.Info($"EquipmentInfo:{result.Msg}"); |
| | | return result; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算立库终点 |
| | | endloc = LocationHelper.InStorage(startloc); |
| | | if (endloc == null) |
| | | { |
| | | result.Code = -1; |
| | | result.Msg = $"未计算到立库终点货位,请检查货位情况"; |
| | | LogHelper.Info($"EquipmentInfo:{result.Msg}"); |
| | | return result; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 创建任务 |
| | | if (startloc != null && endloc != null) |
| | | { |
| | | 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 = cntrcode |
| | | }; |
| | | LogHelper.Info("创建入平库任务:" + JsonConvert.SerializeObject(wcsTask)); |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | LocationHelper.LockLoc(startloc.S_CODE, 2); |
| | | LocationHelper.LockLoc(endloc.S_CODE, 1); |
| | | LogHelper.Info("创建任务成功"); |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | else //入库空 |
| | | { |
| | | //入库口申请入库 |
| | | if (model.SignalType == 1) |
| | | { |
| | | #region 获取起点信息 |
| | | //根据托盘获取起点信息 |
| | | var CntrLoc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE == cntrcode).First(); |
| | | if (CntrLoc == null) |
| | | { |
| | | result.Code = -1; |
| | | result.Msg = $"根据托盘:{cntrcode}未找到绑定托盘"; |
| | | LogHelper.Info($"EquipmentInfo:{result.Msg}"); |
| | | return result; |
| | | } |
| | | startloc = LocationHelper.GetLoc(CntrLoc.S_LOC_CODE); |
| | | if (startloc == null) |
| | | { |
| | | result.Code = -1; |
| | | result.Msg = $"根据起点:{CntrLoc.S_LOC_CODE}未找到货位信息"; |
| | | LogHelper.Info($"EquipmentInfo:{result.Msg}"); |
| | | return result; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算立库终点 |
| | | endloc = LocationHelper.InStorage(startloc); |
| | | if (endloc == null) |
| | | { |
| | | result.Code = -1; |
| | | result.Msg = $"未计算到立库终点货位,请检查货位情况"; |
| | | LogHelper.Info($"EquipmentInfo:未计算到立库终点货位,请检查货位情况"); |
| | | return result; |
| | | } |
| | | #endregion |
| | | |
| | | #region 创建任务 |
| | | if (startloc != null && endloc != null) |
| | | { |
| | | 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 = cntrcode |
| | | }; |
| | | LogHelper.Info("创建入平库任务:" + JsonConvert.SerializeObject(wcsTask)); |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | LocationHelper.LockLoc(startloc.S_CODE, 2); |
| | | LocationHelper.LockLoc(endloc.S_CODE, 1); |
| | | LogHelper.Info("创建任务成功"); |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | //入库空申请叠盘 |
| | | else |
| | | { |
| | | //判断设备状态是否属于叠盘状态 |
| | | var DeviceStatu = db.Queryable<EquipmentStatus>().Where(a => a.deviceNo == model.DeviceNo).First(); |
| | | if (DeviceStatu != null && DeviceStatu.Status == "1") |
| | | { |
| | | #region 获取起点信息 |
| | | //根据托盘获取起点信息 |
| | | var CntrLoc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE == cntrcode).First(); |
| | | if (CntrLoc == null) |
| | | { |
| | | result.Code = -1; |
| | | result.Msg = $"根据托盘:{cntrcode}未找到绑定托盘"; |
| | | LogHelper.Info($"EquipmentInfo:{result.Msg}"); |
| | | return result; |
| | | } |
| | | startloc = LocationHelper.GetLoc(CntrLoc.S_LOC_CODE); |
| | | if (startloc == null) |
| | | { |
| | | result.Code = -1; |
| | | result.Msg = $"根据起点:{CntrLoc.S_LOC_CODE}未找到货位信息"; |
| | | LogHelper.Info($"EquipmentInfo:{result.Msg}"); |
| | | return result; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 获取终点信息 |
| | | string DiePanLoc = ""; |
| | | //根据托盘获取起点信息 |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE == DiePanLoc).First(); |
| | | if (endloc == null) |
| | | { |
| | | result.Code = -1; |
| | | result.Msg = $"根据货位编码:{DiePanLoc}未找到叠盘货位"; |
| | | LogHelper.Info($"EquipmentInfo:{result.Msg}"); |
| | | return result; |
| | | } |
| | | #endregion |
| | | |
| | | #region 创建任务 |
| | | if (startloc != null && endloc != null) |
| | | { |
| | | 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 = cntrcode |
| | | }; |
| | | LogHelper.Info("创建入平库任务:" + JsonConvert.SerializeObject(wcsTask)); |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | LocationHelper.LockLoc(startloc.S_CODE, 2); |
| | | LocationHelper.LockLoc(endloc.S_CODE, 1); |
| | | LogHelper.Info("创建任务成功"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | else |
| | | { |
| | | result.Code = -1; |
| | | result.Msg = $"当前叠盘机状态不属于叠盘状态,不允许空托叠托"; |
| | | LogHelper.Info($"EquipmentInfo:{result.Msg}"); |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取托盘物料信息 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | internal static Result<Empty> GetCntrInfo(GetCntrInfoModel model) |
| | | { |
| | | Result<Empty> result = new Result<Empty> { Code = 0, Msg = "创建成功" }; |
| | | if (model == null) |
| | | { |
| | | result.Code = -1; |
| | | result.Msg = "入参为空"; |
| | | return result; |
| | | } |
| | | |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | string cntrCode = model.CntrNo; |
| | | |
| | | var CntrItem = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE == cntrCode).ToList(); |
| | | if (CntrItem.Count > 0) |
| | | { |
| | | |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定托盘物料 |