| | |
| | | { |
| | | lock (_lockEmpty) |
| | | { |
| | | #region 判断托盘绑定货位是否和下发绑定起点相同 |
| | | //var CntrLoc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First(); |
| | | //if (CntrLoc != null) |
| | | //{ |
| | | // if (CntrLoc.S_LOC_CODE != Start) |
| | | // { |
| | | // LogHelper.Info($"ItemBack:创建任务失败,托盘:{model.Rfid}绑定位置不是起点:{Start}"); |
| | | // result.code = "1"; |
| | | // result.msg = $"创建任务失败,托盘:{model.Rfid}绑定位置不是起点:{Start}"; |
| | | // AddErrorInfo("托盘绑定位置不同", result.msg); |
| | | // return result; |
| | | // } |
| | | //} |
| | | //else |
| | | //{ |
| | | // LogHelper.Info($"ItemBack:创建任务失败,托盘:{model.Rfid}未找到绑定货位"); |
| | | // result.code = "1"; |
| | | // result.msg = $"创建任务失败,托盘:{model.Rfid}未找到绑定货位"; |
| | | // AddErrorInfo("查找托盘货位失败", result.msg); |
| | | // return result; |
| | | //} |
| | | #endregion |
| | | |
| | | |
| | | #region 根据货位楼层判断,3楼去往叠盘位 其他的回库 |
| | | var startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == Start).First(); |
| | | if (startloc != null) |
| | | { |
| | | if (startloc.N_LAYER == 3) |
| | | if (!string.IsNullOrEmpty(startloc.S_NOTE1)) |
| | | { |
| | | //叠盘货位计算叠盘货位 |
| | | // var dploc = db.Queryable<Location>().Where(a => a.S_NOTE.Trim() == "叠盘" && a.N_LAYER == startloc.N_LAYER && a.S_WH_CODE.Trim() == startloc.S_WH_CODE && a.C_ENABLE == "Y").ToList(); |
| | | var dploc = db.Queryable<Location>().Where(a => a.S_NOTE1.Trim() == startloc.S_NOTE1 + "叠盘" && a.S_WH_CODE.Trim() == startloc.S_WH_CODE).ToList(); |
| | | if (dploc.Count > 0) |
| | | { |
| | | // LogHelper.Info($"获取叠盘货位:{JsonConvert.SerializeObject(dploc)}"); |
| | | loc = dploc.FindAll(a => a.N_LOCK_STATE == 0 && a.N_CURRENT_NUM < 6).OrderByDescending(a => a.N_CURRENT_NUM).FirstOrDefault(); |
| | | if (loc == null) |
| | | { |
| | | LogHelper.Info($"{startloc.S_NOTE1}叠盘位,都已经有锁或者已经叠满,请检查货位状态"); |
| | | result.code = "1"; |
| | | result.msg = $"{startloc.S_NOTE1}叠盘货位不可用,终点库区没有可用货位,请检查锁状态和数量"; |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | else |
| | | { |
| | | endlayer = loc.N_CURRENT_NUM + 1; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // LogHelper.Info($"根据货位楼层:{startloc.N_LAYER},仓库编码:{startloc.S_WH_CODE},货位备注:叠盘,未找到叠盘货位"); |
| | | result.code = "1"; |
| | | result.msg = $"{startloc.S_NOTE1}叠盘货位不可用,未找到可叠盘货位"; |
| | | LogHelper.Info($"根据货位备注:{startloc.S_NOTE1}叠盘,货位仓库:{startloc.S_WH_CODE},找不到叠盘货位"); |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else if (startloc.N_LAYER == 3) |
| | | { |
| | | //叠盘货位计算叠盘货位 |
| | | // var dploc = db.Queryable<Location>().Where(a => a.S_NOTE.Trim() == "叠盘" && a.N_LAYER == startloc.N_LAYER && a.S_WH_CODE.Trim() == startloc.S_WH_CODE && a.C_ENABLE == "Y").ToList(); |
| | |
| | | var list = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM == 0 && a.S_AREA_CODE.Trim() == areacode && a.N_LOCK_STATE == 0).ToList(); |
| | | if (list.Count > 0) |
| | | { |
| | | FindEndcolByLocListLock(list); |
| | | |
| | | result= FindEndcolByLocList(list); |
| | | } |
| | | //查询所有有托盘的排没锁的排 |
| | | |
| | |
| | | var rows = locations.Select(a => a.N_ROW).Distinct().ToList(); |
| | | for (int i = 0; i < rows.Count; i++) |
| | | { |
| | | |
| | | var rowList = locations.Where(r => r.N_ROW == rows[i]).ToList(); |
| | | LogHelper.Info($"当前排:{rows[i]},获得货位{JsonConvert.SerializeObject(rowList)}"); |
| | | if (rowList.Count(a => a.N_CURRENT_NUM == 0) > 0) |
| | | { |
| | | Location other = null; |
| | | //当前排没有锁并且有空位置 |
| | | |
| | | |
| | | // other = rowList.OrderBy(a => a.N_COL).Where(a => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y").FirstOrDefault(); |
| | | other = rowList.OrderBy(a => a.N_COL).Where(a => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0).FirstOrDefault(); |
| | | //if (full == null) |
| | |
| | | { |
| | | other = rowList.OrderBy(a => a.N_COL).Where(a => a.N_COL > full.N_COL).FirstOrDefault(); |
| | | } |
| | | |
| | | |
| | | if (other != null) |
| | | { |
| | | end = other; |