| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection.Emit; |
| | | using System.Runtime.CompilerServices; |
| | | using System.ServiceModel; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | |
| | | |
| | | #region 佳通合肥接口业务 |
| | | |
| | | |
| | | |
| | | public static object _lockCreateTask = new object(); |
| | | /// <summary> |
| | | /// 立库任务下发=》创建任务 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | |
| | | internal static Result Createtask(CreateTask model) |
| | | { |
| | | Result result = new Result() { code = "0", msg = "创建成功" }; |
| | |
| | | |
| | | Location endloc = new Location(); |
| | | Location startloc = new Location(); |
| | | |
| | | if (taskData.taskType == 1) //出库流程,通过物料机台计算线边货位 |
| | | lock (_lockCreateTask) |
| | | { |
| | | note = "出库"; |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | if (taskData.taskType == 1) //出库流程,通过物料机台计算线边货位 |
| | | { |
| | | //创建托盘物料绑定信息,并计算终点货位 |
| | | Start = taskData.pickStation; |
| | | if (CreateCntrIteminfo(partData, taskData)) |
| | | note = "出库"; |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | | endloc = Computeloc(CntrCode, taskData.dropStation, taskData.carrierType); |
| | | if (endloc != null) |
| | | //创建托盘物料绑定信息,并计算终点货位 |
| | | Start = taskData.pickStation; |
| | | if (CreateCntrIteminfo(partData, taskData)) |
| | | { |
| | | End = endloc.S_CODE; |
| | | endloc = Computeloc(CntrCode, taskData.dropStation, taskData.carrierType); |
| | | if (endloc != null) |
| | | { |
| | | End = endloc.S_CODE; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"机台编码:{taskData.dropStation},未找到可用货位"; |
| | | AddErrorInfo("寻找出库货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"机台编码:{taskData.dropStation},未找到可用货位"; |
| | | AddErrorInfo("寻找出库货位失败", result.msg, Source); |
| | | result.msg = "创建托盘物料信息失败"; |
| | | AddErrorInfo("创建托盘失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | result.code = "1"; |
| | | result.msg = "创建托盘物料信息失败"; |
| | | AddErrorInfo("创建托盘失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"Putin==> 任务起点:{taskData.pickStation}找不到对应货位,请检查货位表"; |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | } |
| | | } |
| | | else if (taskData.taskType == 2)//入库流程,直接使用起点货位和终点货位生成任务,起点需要有托盘 |
| | | { |
| | | note = "入库"; |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | | Start = startloc.S_CODE; |
| | | var CntrRel = LocationHelper.GetLocCntrRel(startloc.S_CODE).FirstOrDefault(); |
| | | if (CntrRel != null) |
| | | { |
| | | CntrCode = CntrRel.S_CNTR_CODE; |
| | | } |
| | | //else |
| | | //{ |
| | | // result.code = "1"; |
| | | // result.msg = $"根据起点{Start},未找到托盘货位绑定关系"; |
| | | // AddErrorInfo("托盘查找失败", result.msg, Source); |
| | | // return result; |
| | | //} |
| | | |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据起点{taskData.pickStation},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | if (endloc != null) |
| | | { |
| | | End = taskData.dropStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点{End},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else if (taskData.taskType == 3)//移库流程,直接使用起点货位和终点货位生成任务, |
| | | { |
| | | note = "出库"; |
| | | //创建托盘物料绑定信息,并计算终点货位 |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | | Start = taskData.pickStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据起点{taskData.pickStation},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | if (endloc != null) |
| | | { |
| | | End = taskData.dropStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点{taskData.dropStation},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else if (taskData.taskType == 4)//原材料库需要判断是否需要分配电梯任务,创建分档任务 |
| | | { |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | | Start = taskData.pickStation; |
| | | } |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | if (endloc != null) |
| | | { |
| | | End = taskData.dropStation; |
| | | } |
| | | |
| | | //判断楼层是否相等,如果不相同需要生成分段任务进行电梯调用 |
| | | if (!string.IsNullOrEmpty(Start) && !string.IsNullOrEmpty(End)) |
| | | { |
| | | 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(); |
| | | if (startArea == null || endArea == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,起点:{startloc.S_AREA_CODE},终点:{endloc.S_AREA_CODE}未找到对应库区"; |
| | | result.msg = $"Putin==> 任务起点:{taskData.pickStation}找不到对应货位,请检查货位表"; |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | if (startArea.N_FLOOR == endArea.N_FLOOR) |
| | | } |
| | | else if (taskData.taskType == 2)//入库流程,直接使用起点货位和终点货位生成任务,起点需要有托盘 |
| | | { |
| | | note = "入库"; |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | | //创建wcs任务 |
| | | var wcsTask = new WCSTask |
| | | Start = startloc.S_CODE; |
| | | var CntrRel = LocationHelper.GetLocCntrRel(startloc.S_CODE).FirstOrDefault(); |
| | | if (CntrRel != null) |
| | | { |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = startArea.S_NAME + "->" + endArea.S_NAME, |
| | | S_EQ_NO = taskData.taskNum, |
| | | S_START_LOC = Start, |
| | | S_END_LOC = End, |
| | | 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, |
| | | N_SCHEDULE_TYPE = 1, |
| | | S_CNTR_CODE = CntrCode, |
| | | N_PRIORITY = taskData.priority, |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = 1, |
| | | S_WMS_NO = taskData.wmsTaskNo, |
| | | Z_TYPE = n_type, |
| | | |
| | | |
| | | }; |
| | | LogHelper.Info("创建任务:" + JsonConvert.SerializeObject(wcsTask), "CreateTask"); |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | // LocationHelper.LockLoc(End, 2); |
| | | |
| | | LogHelper.Info("创建任务成功"); |
| | | CntrCode = CntrRel.S_CNTR_CODE; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"任务创建失败"; |
| | | AddErrorInfo("任务创建失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else if (startArea.N_FLOOR != endArea.N_FLOOR) |
| | | { |
| | | //楼层电梯分配 |
| | | var elevatorLoc = LocationHelper.GetElevatorLoc(); |
| | | |
| | | 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 = elevatorLoc.S_CODE, |
| | | N_CNTR_COUNT = 1, |
| | | S_START_WH = startloc.S_WH_CODE, |
| | | S_START_AREA = startloc.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, |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = 1, |
| | | S_WMS_NO = taskData.wmsTaskNo, |
| | | Z_TYPE = n_type, |
| | | S_MES_NO = taskData.mesTaskNo |
| | | }; |
| | | var wcsTask1 = new WCSTask |
| | | { |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = "电梯2", |
| | | S_EQ_NO = taskData.taskNum, |
| | | S_START_LOC = elevatorLoc.S_CODE, |
| | | S_END_LOC = End, |
| | | N_CNTR_COUNT = 1, |
| | | 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_CNTR_CODE = CntrCode, |
| | | N_PRIORITY = taskData.priority, |
| | | S_WMS_NO = taskData.wmsTaskNo, |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = 1, |
| | | Z_TYPE = n_type, |
| | | S_MES_NO = taskData.mesTaskNo |
| | | |
| | | }; |
| | | LogHelper.Info("创建任务:" + JsonConvert.SerializeObject(wcsTask), "CreateTask"); |
| | | if (WCSHelper.CreateTask(wcsTask) && WCSHelper.CreateTask(wcsTask1)) |
| | | { |
| | | |
| | | // LocationHelper.LockLoc(Start, 1); |
| | | //LocationHelper.LockLoc(End, 2); |
| | | LogHelper.Info("创建任务成功"); |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"任务创建失败"; |
| | | AddErrorInfo("任务创建失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | |
| | | //else |
| | | //{ |
| | | // result.code = "1"; |
| | | // result.msg = $"根据起点{Start},未找到托盘货位绑定关系"; |
| | | // AddErrorInfo("托盘查找失败", result.msg, Source); |
| | | // return result; |
| | | //} |
| | | |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据起点{taskData.pickStation},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | if (endloc != null) |
| | | { |
| | | End = taskData.dropStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点{End},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | else if (taskData.taskType == 3)//移库流程,直接使用起点货位和终点货位生成任务, |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "创建任务失败,未找到对应的取货点或卸货点"; |
| | | return result; |
| | | } |
| | | } |
| | | else if (taskData.taskType == 5)//移库流程,直接使用起点货位和终点货位生成任务,并绑定托盘 |
| | | { |
| | | note = "出库"; |
| | | //创建托盘物料绑定信息,并计算终点货位 |
| | | if (CreateCntrIteminfo(partData, taskData)) |
| | | { |
| | | note = "出库"; |
| | | //创建托盘物料绑定信息,并计算终点货位 |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "创建托盘物料信息失败"; |
| | | AddErrorInfo("创建托盘失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | } |
| | | //暂存位回库 |
| | | else if (taskData.taskType == 6)//入库流程,直接使用起点货位和终点货位生成任务 |
| | | { |
| | | note = "入库"; |
| | | //根据托盘号找货位 |
| | | var CntrRel = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE == partData.rfid).First(); |
| | | if (CntrRel != null) |
| | | { |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == CntrRel.S_LOC_CODE).First(); |
| | | if (startloc != null) |
| | | { |
| | | Start = startloc.S_CODE; |
| | | CntrCode = CntrRel.S_CNTR_CODE; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据托盘{partData.rfid},未找到托盘货位绑定关系"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | if (endloc != null) |
| | | { |
| | | End = taskData.dropStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点{End},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | //点对库区 |
| | | else if (taskData.taskType == 7)//异常位 |
| | | { |
| | | note = "异常库区入库"; |
| | | //创建托盘物料绑定信息,并计算终点货位 |
| | | if (CreateCntrIteminfo(partData, taskData)) |
| | | else if (taskData.taskType == 4)//原材料库需要判断是否需要分配电梯任务,创建分档任务 |
| | | { |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | | Start = taskData.pickStation; |
| | | } |
| | | var EndLocs = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == taskData.dropStation).ToList(); |
| | | if (EndLocs.Count > 0) |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | if (endloc != null) |
| | | { |
| | | endloc = EndLocs.Find(a => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0); |
| | | if (endloc != null) |
| | | End = taskData.dropStation; |
| | | } |
| | | |
| | | //判断楼层是否相等,如果不相同需要生成分段任务进行电梯调用 |
| | | if (!string.IsNullOrEmpty(Start) && !string.IsNullOrEmpty(End)) |
| | | { |
| | | 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(); |
| | | if (startArea == null || endArea == null) |
| | | { |
| | | End = endloc.S_CODE; |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,起点:{startloc.S_AREA_CODE},终点:{endloc.S_AREA_CODE}未找到对应库区"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | if (startArea.N_FLOOR == endArea.N_FLOOR) |
| | | { |
| | | //创建wcs任务 |
| | | var wcsTask = new WCSTask |
| | | { |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = startArea.S_NAME + "->" + endArea.S_NAME, |
| | | S_EQ_NO = taskData.taskNum, |
| | | S_START_LOC = Start, |
| | | S_END_LOC = End, |
| | | 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, |
| | | N_SCHEDULE_TYPE = 1, |
| | | S_CNTR_CODE = CntrCode, |
| | | N_PRIORITY = taskData.priority, |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = 1, |
| | | S_WMS_NO = taskData.wmsTaskNo, |
| | | Z_TYPE = n_type, |
| | | |
| | | |
| | | }; |
| | | LogHelper.Info("创建任务:" + JsonConvert.SerializeObject(wcsTask), "CreateTask"); |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | // LocationHelper.LockLoc(End, 2); |
| | | |
| | | LogHelper.Info("创建任务成功"); |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"任务创建失败"; |
| | | AddErrorInfo("任务创建失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else if (startArea.N_FLOOR != endArea.N_FLOOR) |
| | | { |
| | | //楼层电梯分配 |
| | | var elevatorLoc = LocationHelper.GetElevatorLoc(); |
| | | |
| | | 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 = elevatorLoc.S_CODE, |
| | | N_CNTR_COUNT = 1, |
| | | S_START_WH = startloc.S_WH_CODE, |
| | | S_START_AREA = startloc.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, |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = 1, |
| | | S_WMS_NO = taskData.wmsTaskNo, |
| | | Z_TYPE = n_type, |
| | | S_MES_NO = taskData.mesTaskNo |
| | | }; |
| | | var wcsTask1 = new WCSTask |
| | | { |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = "电梯2", |
| | | S_EQ_NO = taskData.taskNum, |
| | | S_START_LOC = elevatorLoc.S_CODE, |
| | | S_END_LOC = End, |
| | | N_CNTR_COUNT = 1, |
| | | 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_CNTR_CODE = CntrCode, |
| | | N_PRIORITY = taskData.priority, |
| | | S_WMS_NO = taskData.wmsTaskNo, |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = 1, |
| | | Z_TYPE = n_type, |
| | | S_MES_NO = taskData.mesTaskNo |
| | | |
| | | }; |
| | | LogHelper.Info("创建任务:" + JsonConvert.SerializeObject(wcsTask), "CreateTask"); |
| | | if (WCSHelper.CreateTask(wcsTask) && WCSHelper.CreateTask(wcsTask1)) |
| | | { |
| | | |
| | | // LocationHelper.LockLoc(Start, 1); |
| | | //LocationHelper.LockLoc(End, 2); |
| | | LogHelper.Info("创建任务成功"); |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"任务创建失败"; |
| | | AddErrorInfo("任务创建失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "创建任务失败,未找到对应的取货点或卸货点"; |
| | | return result; |
| | | } |
| | | } |
| | | else if (taskData.taskType == 5)//移库流程,直接使用起点货位和终点货位生成任务,并绑定托盘 |
| | | { |
| | | note = "出库"; |
| | | //创建托盘物料绑定信息,并计算终点货位 |
| | | if (CreateCntrIteminfo(partData, taskData)) |
| | | { |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | | Start = taskData.pickStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"终点库区:{taskData.dropStation}无可用货位"; |
| | | result.msg = $"根据起点{taskData.pickStation},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | if (endloc != null) |
| | | { |
| | | End = taskData.dropStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点{taskData.dropStation},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "创建托盘物料信息失败"; |
| | | AddErrorInfo("创建托盘失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | } |
| | | //暂存位回库 |
| | | else if (taskData.taskType == 6)//入库流程,直接使用起点货位和终点货位生成任务 |
| | | { |
| | | note = "入库"; |
| | | //根据托盘号找货位 |
| | | var CntrRel = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE == partData.rfid).First(); |
| | | if (CntrRel != null) |
| | | { |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == CntrRel.S_LOC_CODE).First(); |
| | | if (startloc != null) |
| | | { |
| | | Start = startloc.S_CODE; |
| | | CntrCode = CntrRel.S_CNTR_CODE; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据托盘{partData.rfid},未找到托盘货位绑定关系"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | if (endloc != null) |
| | | { |
| | | End = taskData.dropStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点{End},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | //点对库区 |
| | | else if (taskData.taskType == 7)//异常位 |
| | | { |
| | | note = "异常库区入库"; |
| | | //创建托盘物料绑定信息,并计算终点货位 |
| | | if (CreateCntrIteminfo(partData, taskData)) |
| | | { |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | | Start = taskData.pickStation; |
| | | } |
| | | var EndLocs = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == taskData.dropStation).ToList(); |
| | | if (EndLocs.Count > 0) |
| | | { |
| | | endloc = EndLocs.Find(a => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0); |
| | | if (endloc != null) |
| | | { |
| | | End = endloc.S_CODE; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"终点库区:{taskData.dropStation}无可用货位"; |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点库区:{taskData.dropStation},未找到对应货位"; |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点库区:{taskData.dropStation},未找到对应货位"; |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | result.msg = "创建托盘物料信息失败"; |
| | | AddErrorInfo("创建托盘失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | else if (taskData.taskType == 8)//叠盘机空托回库 |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "创建托盘物料信息失败"; |
| | | AddErrorInfo("创建托盘失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else if (taskData.taskType == 8)//叠盘机空托回库 |
| | | { |
| | | note = "空托回库";//井松空托回库,需要与叠盘机安全交互 |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | | Start = startloc.S_CODE; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据起点:{taskData.pickStation},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | if (endloc != null) |
| | | { |
| | | End = taskData.dropStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点:{End},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"Createtask==> 任务类型有误"); |
| | | result.code = "1"; |
| | | result.msg = "任务类型:{taskData.taskType}不在规定范围内"; |
| | | AddErrorInfo("任务类型错误", result.msg, Source); |
| | | } |
| | | if (taskData.taskType != 4) |
| | | { |
| | | if (!string.IsNullOrEmpty(Start) && !string.IsNullOrEmpty(End)) |
| | | { |
| | | if (startloc.N_LOCK_STATE != 0) |
| | | note = "空托回库";//井松空托回库,需要与叠盘机安全交互 |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,起点{Start}有锁"; |
| | | AddErrorInfo("货位有锁", result.msg); |
| | | return result; |
| | | } |
| | | var startArea = db.Queryable<Area>().Where(a => a.S_CODE.Trim() == startloc.S_AREA_CODE.Trim()).First(); |
| | | var endArea = db.Queryable<Area>().Where(a => a.S_CODE.Trim() == endloc.S_AREA_CODE.Trim()).First(); |
| | | if (startArea == null || endArea == null) |
| | | { |
| | | LogHelper.Info($"起点:{JsonConvert.SerializeObject(startArea)}"); |
| | | LogHelper.Info($"终点:{JsonConvert.SerializeObject(endArea)}"); |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,起点:{startloc.S_AREA_CODE},终点{endloc.S_AREA_CODE}未找到对应库区"; |
| | | AddErrorInfo("库区查找失败", result.msg); |
| | | return result; |
| | | } |
| | | //创建wcs任务 |
| | | var wcsTask = new WCSTask |
| | | { |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = startArea.S_NAME + "->" + endArea.S_NAME, |
| | | S_EQ_NO = taskData.taskNum, |
| | | S_START_LOC = Start, |
| | | S_END_LOC = End, |
| | | N_CNTR_COUNT = 1, |
| | | S_START_WH = startloc.S_WH_CODE, |
| | | S_END_WH = endloc.S_WH_CODE, |
| | | S_END_AREA = endloc.S_AREA_CODE, |
| | | N_SCHEDULE_TYPE = 1, |
| | | S_CNTR_CODE = CntrCode, |
| | | N_PRIORITY = taskData.priority, |
| | | Z_TYPE = n_type, |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = 1, |
| | | S_WMS_NO = taskData.wmsTaskNo, |
| | | S_NOTE = note, |
| | | S_MES_NO = taskData.mesTaskNo |
| | | |
| | | }; |
| | | LogHelper.Info("创建任务:" + JsonConvert.SerializeObject(wcsTask), "CreateTask"); |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | // LocationHelper.LockLoc(Start, 2); |
| | | //LocationHelper.LockLoc(End, 1); |
| | | LogHelper.Info("创建任务成功"); |
| | | Start = startloc.S_CODE; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"任务创建失败"; |
| | | AddErrorInfo("任务创建失败", result.msg, Source); |
| | | result.msg = $"根据起点:{taskData.pickStation},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | if (endloc != null) |
| | | { |
| | | End = taskData.dropStation; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据终点:{End},找不到对应货位,请检查货位表"; |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"Createtask==> 任务类型有误"); |
| | | result.code = "1"; |
| | | result.msg = "创建任务失败,未找到对应的取货点或卸货点"; |
| | | return result; |
| | | result.msg = "任务类型:{taskData.taskType}不在规定范围内"; |
| | | AddErrorInfo("任务类型错误", result.msg, Source); |
| | | } |
| | | if (taskData.taskType != 4) |
| | | { |
| | | if (!string.IsNullOrEmpty(Start) && !string.IsNullOrEmpty(End)) |
| | | { |
| | | if (startloc.N_LOCK_STATE != 0) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,起点{Start}有锁"; |
| | | AddErrorInfo("货位有锁", result.msg); |
| | | return result; |
| | | } |
| | | var startArea = db.Queryable<Area>().Where(a => a.S_CODE.Trim() == startloc.S_AREA_CODE.Trim()).First(); |
| | | var endArea = db.Queryable<Area>().Where(a => a.S_CODE.Trim() == endloc.S_AREA_CODE.Trim()).First(); |
| | | if (startArea == null || endArea == null) |
| | | { |
| | | LogHelper.Info($"起点:{JsonConvert.SerializeObject(startArea)}"); |
| | | LogHelper.Info($"终点:{JsonConvert.SerializeObject(endArea)}"); |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,起点:{startloc.S_AREA_CODE},终点{endloc.S_AREA_CODE}未找到对应库区"; |
| | | AddErrorInfo("库区查找失败", result.msg); |
| | | return result; |
| | | } |
| | | //创建wcs任务 |
| | | var wcsTask = new WCSTask |
| | | { |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = startArea.S_NAME + "->" + endArea.S_NAME, |
| | | S_EQ_NO = taskData.taskNum, |
| | | S_START_LOC = Start, |
| | | S_END_LOC = End, |
| | | N_CNTR_COUNT = 1, |
| | | S_START_WH = startloc.S_WH_CODE, |
| | | S_END_WH = endloc.S_WH_CODE, |
| | | S_END_AREA = endloc.S_AREA_CODE, |
| | | N_SCHEDULE_TYPE = 1, |
| | | S_CNTR_CODE = CntrCode, |
| | | N_PRIORITY = taskData.priority, |
| | | Z_TYPE = n_type, |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = 1, |
| | | S_WMS_NO = taskData.wmsTaskNo, |
| | | S_NOTE = note, |
| | | S_MES_NO = taskData.mesTaskNo |
| | | |
| | | }; |
| | | LogHelper.Info("创建任务:" + JsonConvert.SerializeObject(wcsTask), "CreateTask"); |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | // LocationHelper.LockLoc(Start, 2); |
| | | //LocationHelper.LockLoc(End, 1); |
| | | LogHelper.Info("创建任务成功"); |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"任务创建失败"; |
| | | AddErrorInfo("任务创建失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "创建任务失败,未找到对应的取货点或卸货点"; |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | return result; |
| | | } |
| | |
| | | string areacode = ""; |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | #endregion |
| | | |
| | | try |
| | | { |
| | | |
| | |
| | | #endregion |
| | | |
| | | #region 任务创建 |
| | | if (!string.IsNullOrEmpty(Start) && !string.IsNullOrEmpty(End)) |
| | | if (string.IsNullOrEmpty(Start)) |
| | | { |
| | | if (loc.N_LOCK_STATE != 0) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,起点{Start}有锁"; |
| | | AddErrorInfo("货位有锁", result.msg, Source); |
| | | return result; |
| | | } |
| | | //创建wcs任务 |
| | | var wcsTask = new WCSTask |
| | | { |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = "出平库", |
| | | S_EQ_NO = model.TaskNumber, |
| | | S_START_LOC = Start, |
| | | S_END_LOC = End, |
| | | S_START_WH = loc.S_WH_CODE, |
| | | S_START_AREA = loc.S_AREA_CODE, |
| | | S_END_WH = Endloc.S_WH_CODE, |
| | | S_END_AREA = Endloc.S_AREA_CODE, |
| | | N_CNTR_COUNT = 1, |
| | | N_SCHEDULE_TYPE = 1, |
| | | S_CNTR_CODE = CntrCode, |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = 1, |
| | | Z_TYPE = n_type |
| | | result.code = "1"; |
| | | result.msg = "创建任务失败,未找到对应的取货点"; |
| | | return result; |
| | | } |
| | | if (string.IsNullOrEmpty(End)) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "创建任务失败,未找到对应的卸货点"; |
| | | return result; |
| | | } |
| | | if (loc.N_LOCK_STATE != 0) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,起点{Start}有锁"; |
| | | AddErrorInfo("货位有锁", result.msg, Source); |
| | | return result; |
| | | } |
| | | //创建wcs任务 |
| | | var wcsTask = new WCSTask |
| | | { |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = "出平库", |
| | | S_EQ_NO = model.TaskNumber, |
| | | S_START_LOC = Start, |
| | | S_END_LOC = End, |
| | | S_START_WH = loc.S_WH_CODE, |
| | | S_START_AREA = loc.S_AREA_CODE, |
| | | S_END_WH = Endloc.S_WH_CODE, |
| | | S_END_AREA = Endloc.S_AREA_CODE, |
| | | N_CNTR_COUNT = 1, |
| | | N_SCHEDULE_TYPE = 1, |
| | | S_CNTR_CODE = CntrCode, |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = 1, |
| | | Z_TYPE = n_type |
| | | |
| | | }; |
| | | LogHelper.Info("创建出平库任务:" + JsonConvert.SerializeObject(wcsTask)); |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | LogHelper.Info("创建任务成功"); |
| | | //LocationHelper.LockLoc(Start, 2); |
| | | //LocationHelper.LockLoc(End, 1); |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"任务创建失败"; |
| | | AddErrorInfo("任务创建失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | }; |
| | | LogHelper.Info("创建出平库任务:" + JsonConvert.SerializeObject(wcsTask)); |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | LogHelper.Info("创建任务成功"); |
| | | //LocationHelper.LockLoc(Start, 2); |
| | | //LocationHelper.LockLoc(End, 1); |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "创建任务失败,未找到对应的取货点或卸货点"; |
| | | result.msg = $"任务创建失败"; |
| | | AddErrorInfo("任务创建失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return result; |
| | |
| | | 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($"三楼货位叠盘位,都已经有锁或者已经叠满,请检查货位状态"); |
| | | result.code = "1"; |
| | | result.msg = $"叠盘货位不可用"; |
| | | result.msg = $"叠盘货位不可用,终点库区没有可用货位,请检查锁状态和数量"; |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | |
| | | // LogHelper.Info($"根据货位楼层:{startloc.N_LAYER},仓库编码:{startloc.S_WH_CODE},货位备注:叠盘,未找到叠盘货位"); |
| | | result.code = "1"; |
| | | result.msg = $"叠盘货位不可用"; |
| | | result.msg = $"叠盘货位不可用,未找到可叠盘货位"; |
| | | LogHelper.Info($"根据货位备注:叠盘,货位楼层:{startloc.N_LAYER},货位仓库:{startloc.S_WH_CODE},找不到叠盘货位"); |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | return result; |
| | |
| | | loc = KjDploc.FindAll(a => a.N_LOCK_STATE == 0 && a.N_CURRENT_NUM < 6).OrderByDescending(a => a.N_CURRENT_NUM).FirstOrDefault(); |
| | | if (loc == null) |
| | | { |
| | | LogHelper.Info($"片胶堆叠位,都已经有锁或者已经叠满,请检查货位状态"); |
| | | result.code = "1"; |
| | | result.msg = $"叠盘货位不可用"; |
| | | result.msg = $"叠盘货位不可用,终点库区没有可用货位,请检查锁状态和数量"; |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据起点仓库编码:{startloc.S_WH_CODE}未找到对应配置文件"; |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | LogHelper.Info($" {result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | |
| | | |
| | | //回库货位计算库区货位 |
| | | loc = StorageCompute(itemcode, areacode); |
| | | //if (loc == null) |
| | | //{ |
| | | // loc = emptyRow(areacode); |
| | | // if (loc == null) |
| | | // { |
| | | // LogHelper.Info($"库区:{areacode}没有空排"); |
| | | // } |
| | | //} |
| | | if (loc == null) |
| | | { |
| | | loc = emptyRow(areacode); |
| | | if (loc == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"库区:{areacode}没有可用货位"; |
| | | LogHelper.Info($" {result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | // LogHelper.Info($"库区:{areacode}没有可用货位"); |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | |
| | |
| | | #region 变量 |
| | | string Start = ""; |
| | | string End = model.TargetLocation; |
| | | |
| | | |
| | | string areacode = ""; |
| | | string cntrcode = ""; |
| | | Location startloc = new Location(); |
| | | // startloc = LocationHelper.GetLocByAreacode(areacode, model.CarrierType); |
| | | #endregion |
| | | |
| | | try |
| | |
| | | #region 根据仓库编码判断库区 并计算出库货位 |
| | | var endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == End).First(); |
| | | //根据仓库 计算库区 |
| | | |
| | | if (endloc != null) |
| | | { |
| | | var whcode = Settings.wareLoc.Where(a => a.AreaCode == endloc.S_WH_CODE).FirstOrDefault(); |
| | |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | //计算出库托盘 |
| | | startloc = LocationHelper.GetLocByAreacode(areacode,model.CarrierType); |
| | | startloc = LocationHelper.GetLocByAreacode(areacode, model.CarrierType); |
| | | if (startloc != null) |
| | | { |
| | | var cntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == startloc.S_CODE).First(); |
| | |
| | | AddErrorInfo("查找托盘失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建空工装呼叫任务==>根据库区:{areacode},托盘类型:{model.CarrierType}找不到对应空托"; |
| | | LogHelper.Info($"callfixture:{result.msg}"); |
| | | AddErrorInfo("查找托盘失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | if (loccntr != null) |
| | | { |
| | | |
| | | string cntrcode = loccntr.S_CNTR_CODE; |
| | | var CntrItem = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == cntrcode).First(); |
| | | if (CntrItem != null) |
| | | { |
| | | if (LocationHelper.UnBindingLoc(loc, new List<string>() { cntrcode })) |
| | | { |
| | | LogHelper.Info($"清除托盘货位关系成功"); |
| | | } |
| | | //清除托盘物料绑定关系 |
| | | db.Deleteable<CntrItemDetail>().Where(it => it.S_CNTR_CODE.Trim() == CntrItem.S_CNTR_CODE).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"ClearLocCntr 托盘{cntrcode}无物料绑定关系"); |
| | | } |
| | | if (LocationHelper.UnBindingLoc(loc, new List<string>() { cntrcode })) |
| | | { |
| | | LogHelper.Info($"清除托盘货位关系成功"); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | DeviceInfoModel device = new DeviceInfoModel(); |
| | | |
| | | List<DeviceInfos> deviceInfos = new List<DeviceInfos>();//叠盘机报错信息 |
| | | List<AgvInfos> agvInfos = new List<AgvInfos>();//agv报错信息 |
| | | // List<AgvInfos> agvInfos = new List<AgvInfos>();//agv报错信息 |
| | | |
| | | //获取内存中叠盘机的报错信息 |
| | | foreach (var dpjInfo in DeviceProcess.DpjInfoDirectory) |
| | | { |
| | | deviceInfos.Add(new DeviceInfos() { Device = dpjInfo.Value.DeviceName, DeviceInfo = dpjInfo.Value.ErrorInfo }); |
| | | } |
| | | device.DeviceInfos = deviceInfos; |
| | | // device.DeviceInfos = deviceInfos; |
| | | //获取车辆报警信息 |
| | | var agvDeviceInfo = db.Queryable<HangChaAGV>().ToList(); |
| | | if (agvDeviceInfo.Count > 0) |
| | |
| | | foreach (var agv in agvDeviceInfo) |
| | | { |
| | | string agvErrorInfo = GetAgvAlarmSendCodeTwo(agv.agvErrCode, agv.errCode2, agv.faildCode); |
| | | agvInfos.Add(new AgvInfos() { AgvNo = agv.agvNo, AgvInfo = agvErrorInfo }); |
| | | deviceInfos.Add(new DeviceInfos() { AgvNo = agv.agvNo, AgvInfo = agvErrorInfo }); |
| | | } |
| | | } |
| | | device.AgvInfos = agvInfos; |
| | | device.DeviceInfos = deviceInfos; |
| | | |
| | | return device; |
| | | } |
| | |
| | | |
| | | #region 合肥佳通业务方法 |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 托盘入库算法 |
| | | /// </summary> |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | //internal static bool CreateCntrLoc(taskData taskData) |
| | | //{ |
| | | // if ( taskData == null) |
| | | // { |
| | | // LogHelper.Info($"CreateCntrIteminfo==> 立库任务下发参数有空,创建物料托盘绑定关系失败"); |
| | | // return false; |
| | | // } |
| | | // else |
| | | // { |
| | | // LocationHelper.BindingLoc(taskData.pickStation,new List<string>() { taskData.rfid }); |
| | | |
| | | // } |
| | | |
| | | //} |
| | | private static object _lockLocation = new object(); |
| | | /// <summary> |
| | | /// 根据托盘编码,机台编码,工装类型计算机台线边区域 |