| | |
| | | LogHelper.Info("创建任务:" + JsonConvert.SerializeObject(wcsTask), "CreateTask"); |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | LocationHelper.LockLoc(Start, 2); |
| | | LocationHelper.LockLoc(End, 2); |
| | | |
| | | LogHelper.Info("创建任务成功"); |
| | | } |
| | |
| | | else if (startArea.N_FLOOR != endArea.N_FLOOR) |
| | | { |
| | | //楼层电梯分配 |
| | | var endloc1 = Settings.elevatorLoc.Find(a => a.Floor == startArea.N_FLOOR); |
| | | var startloc1 = Settings.elevatorLoc.Find(a => a.Floor == endArea.N_FLOOR); |
| | | var elevatorLoc = LocationHelper.GetElevatorLoc(); |
| | | |
| | | //创建wcs分段任务 |
| | | if (elevatorLoc != null) |
| | | { //创建wcs分段任务 |
| | | var wcsTask = new WCSTask |
| | | { |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = "电梯1", |
| | | S_EQ_NO = taskData.taskNum, |
| | | S_START_LOC = Start, |
| | | S_END_LOC = endloc1.Location[0], |
| | | S_END_LOC = elevatorLoc.S_CODE, |
| | | N_CNTR_COUNT = 1, |
| | | 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, |
| | | S_END_WH = elevatorLoc.S_WH_CODE, |
| | | S_END_AREA = elevatorLoc.S_AREA_CODE, |
| | | N_SCHEDULE_TYPE = 1, |
| | | S_CNTR_CODE = CntrCode, |
| | | N_PRIORITY = taskData.priority, |
| | |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = "电梯2", |
| | | S_EQ_NO = taskData.taskNum, |
| | | S_START_LOC = startloc1.Location[0], |
| | | S_START_LOC = elevatorLoc.S_CODE, |
| | | S_END_LOC = End, |
| | | N_CNTR_COUNT = 1, |
| | | S_START_WH = startloc.S_WH_CODE, |
| | | S_START_AREA = startloc.S_AREA_CODE, |
| | | S_START_WH = elevatorLoc.S_WH_CODE, |
| | | S_START_AREA = elevatorLoc.S_AREA_CODE, |
| | | S_END_WH = endloc.S_WH_CODE, |
| | | S_END_AREA = endloc.S_AREA_CODE, |
| | | N_SCHEDULE_TYPE = 1, |
| | |
| | | S_MES_NO = taskData.mesTaskNo |
| | | |
| | | }; |
| | | |
| | | LogHelper.Info("创建任务:" + JsonConvert.SerializeObject(wcsTask), "CreateTask"); |
| | | if (WCSHelper.CreateTask(wcsTask) && WCSHelper.CreateTask(wcsTask1)) |
| | | { |
| | | |
| | | LocationHelper.LockLoc(endloc.S_CODE, 1); |
| | | // LocationHelper.LockLoc(Start, 1); |
| | | LocationHelper.LockLoc(End, 2); |
| | | LogHelper.Info("创建任务成功"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | else |
| | |
| | | string areacode = ""; |
| | | try |
| | | { |
| | | |
| | | #region 入库检查托盘物料表有无数据 |
| | | var cntritem = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First(); |
| | | if (cntritem == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,托盘:{model.Rfid}无绑定物料数据"; |
| | | LogHelper.Info($"ItemBack:{result.msg}"); |
| | | AddErrorInfo("托盘绑定物料数据为空", result.msg, Source); |
| | | return result; |
| | | } |
| | | #endregion |
| | | |
| | | #region 判断托盘绑定货位是否和下发绑定起点相同,如果没绑定托盘则绑定托盘 |
| | | var CntrLoc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First(); |
| | |
| | | |
| | | try |
| | | { |
| | | |
| | | |
| | | #region 余料返回根据托盘找出库任务 |
| | | //余料返回根据托盘找出库任务 |
| | | //msts = WCSHelper.GetTaskBycntrcode(model.Rfid); |
| | |
| | | if (whcode != null) |
| | | { |
| | | //粉料直接回库,其他物料需要去对应的暂存区 |
| | | #region 根据物料判断回库库区 |
| | | if (model.PartNumber.StartsWith("4X")) |
| | | { |
| | | areacode = whcode.PMK; |
| | | loc = StorageCompute(itemcode, areacode); |
| | | //loc = StorageCompute(itemcode, areacode); |
| | | //if (loc == null) |
| | | //{ |
| | | // loc = emptyRow(areacode); |
| | |
| | | AddErrorInfo("物料编码格式错误", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | var EndLocs = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == areacode).ToList(); |
| | | //查找货位库区 |
| | | if (EndLocs.Count > 0) |
| | | { |
| | | //loc = EndLocs.Find(a => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0); |
| | | loc = FindEndcolByLocList(EndLocs); |
| | | if (loc != null) |
| | | { |
| | | End = loc.S_CODE; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"终点库区:{areacode}无可用货位"; |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | } |
| | | else |
| | |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | //loc = StorageCompute(itemcode, areacode); |
| | | //if (loc == null) |
| | | //{ |
| | | // loc = emptyRow(areacode); |
| | | //} |
| | | } |
| | | |
| | | if (loc != null) |
| | | { |
| | | End = loc.S_CODE; |
| | | } |
| | | else |
| | | { |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"库区:{areacode}无可用货位"; |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | // var startArea = db.Queryable<Area>().Where(a => a.S_CODE.Trim() == startloc.S_AREA_CODE).First(); |
| | | //var endArea = db.Queryable<Area>().Where(a => a.S_CODE.Trim() == endloc.S_AREA_CODE).First(); |
| | | |
| | | string dtcode = "DT-01"; |
| | | //楼层电梯分配 |
| | | var Diantiloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == dtcode).First(); |
| | | if (Diantiloc == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,根据货位编码:{dtcode}未找到电梯货位"; |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | //string dtcode = "DT-01"; |
| | | ////楼层电梯分配 |
| | | //var Diantiloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == dtcode).First(); |
| | | //if (Diantiloc == null) |
| | | //{ |
| | | // result.code = "1"; |
| | | // result.msg = $"创建任务失败,根据货位编码:{dtcode}未找到电梯货位"; |
| | | // AddErrorInfo("查找货位失败", result.msg, Source); |
| | | // return result; |
| | | //} |
| | | |
| | | //根据电梯数量判断送往哪个电梯 (具体电梯流程根据现场电梯数量) |
| | | //根据任务数量判断送往哪个电梯 (具体电梯流程根据现场电梯数量) |
| | | var elevatorLoc = LocationHelper.GetElevatorLoc(); |
| | | |
| | | //创建wcs分段任务 |
| | | var wcsTask = new WCSTask |
| | |
| | | S_TYPE = "电梯1", |
| | | S_EQ_NO = model.Data.task_no, |
| | | S_START_LOC = startloc.S_CODE, |
| | | S_END_LOC = Diantiloc.S_CODE, |
| | | S_END_LOC = elevatorLoc.S_CODE, |
| | | N_CNTR_COUNT = 1, |
| | | 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, |
| | | S_END_WH = elevatorLoc.S_WH_CODE, |
| | | S_END_AREA = elevatorLoc.S_AREA_CODE, |
| | | N_SCHEDULE_TYPE = 1, |
| | | S_CNTR_CODE = cntr.S_CNTR_CODE, |
| | | N_END_LAYER = 1, |
| | |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = "电梯2", |
| | | S_EQ_NO = model.Data.task_no, |
| | | S_START_LOC = Diantiloc.S_CODE, |
| | | S_START_LOC = elevatorLoc.S_CODE, |
| | | S_END_LOC = endloc.S_CODE, |
| | | N_CNTR_COUNT = 1, |
| | | S_START_WH = startloc.S_WH_CODE, |
| | | S_START_AREA = startloc.S_AREA_CODE, |
| | | S_START_WH = elevatorLoc.S_WH_CODE, |
| | | S_START_AREA = elevatorLoc.S_AREA_CODE, |
| | | S_END_WH = endloc.S_WH_CODE, |
| | | S_END_AREA = endloc.S_AREA_CODE, |
| | | N_SCHEDULE_TYPE = 1, |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 库位清空 |
| | |
| | | Location other = null; |
| | | //当前排没有锁并且有空位置 |
| | | //先找满位,然后后面一层要么是空,要么不存在 |
| | | other = rowList.OrderByDescending(a => a.N_COL).Where(a => a.N_CURRENT_NUM == 0).FirstOrDefault(); |
| | | other = rowList.OrderBy(a => a.N_COL).Where(a => a.N_CURRENT_NUM == 0).FirstOrDefault(); |
| | | //if (full == null) |
| | | //{ |
| | | // //没有满位,那就找最小的空位 |