| | |
| | | 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(); |
| | | public static object _lockCreateItem = new object(); |
| | | /// <summary> |
| | | /// 立库任务下发=》创建任务 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | |
| | | internal static Result Createtask(CreateTask model) |
| | | { |
| | | Result result = new Result() { code = "0", msg = "创建成功" }; |
| | |
| | | result.msg = $"Putin==> 任务起点:{taskData.pickStation}找不到对应货位,请检查货位表"; |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("货位查找失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else if (taskData.taskType == 2)//入库流程,直接使用起点货位和终点货位生成任务,起点需要有托盘 |
| | |
| | | if (startloc != null) |
| | | { |
| | | Start = startloc.S_CODE; |
| | | var CntrRel = LocationHelper.GetLocCntrRel(startloc.S_CODE).FirstOrDefault(); |
| | | var CntrRel = LocationHelper.GetLocCntrRel(startloc.S_CODE).OrderBy(a => a.T_CREATE).FirstOrDefault(); |
| | | if (CntrRel != null) |
| | | { |
| | | CntrCode = CntrRel.S_CNTR_CODE; |
| | | if (CntrRel.S_CNTR_CODE != partData.rfid) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据起点:{Start}获取托盘:{CntrRel.S_CNTR_CODE}与下发托盘:{partData.rfid}不一致,请检查托盘码是否正确"; |
| | | AddErrorInfo("托盘码校检失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | else |
| | | { |
| | | CntrCode = CntrRel.S_CNTR_CODE; |
| | | } |
| | | |
| | | } |
| | | //else |
| | | //{ |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | return result; |
| | | } |
| | |
| | | /// <returns></returns> |
| | | internal static Result TrayItembind(TrayItembind model) |
| | | { |
| | | |
| | | Result result = new Result() { code = "200", msg = "产出信息下发成功" }; |
| | | if (model == null) |
| | | { |
| | |
| | | AddErrorInfo("参数为空", result.msg); |
| | | return result; |
| | | } |
| | | try |
| | | lock (_lockCreateItem) |
| | | { |
| | | //创建托盘数据绑定关系 |
| | | if (ContainerHelper.CreateCntrItem(model.Rfid, model.PartNumber, model.PartDesc, model.LotNumber, model.Weight, model.Qty, model.ProductionTime, model.MaturityTime)) |
| | | try |
| | | { |
| | | //创建成功流程 |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "产出信息下发失败,托盘物料绑定关系创建失败"; |
| | | AddErrorInfo("创建绑定关系失败", result.msg, "Mes"); |
| | | |
| | | //创建托盘数据绑定关系 |
| | | if (ContainerHelper.CreateCntrItem(model.Rfid, model.PartNumber, model.PartDesc, model.LotNumber, model.Weight, model.Qty, model.ProductionTime, model.MaturityTime)) |
| | | { |
| | | //创建成功流程 |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "产出信息下发失败,托盘物料绑定关系创建失败"; |
| | | AddErrorInfo("创建绑定关系失败", result.msg, "Mes"); |
| | | return result; |
| | | } |
| | | return result; |
| | | } |
| | | return result; |
| | | catch (Exception ex) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = ex.ToString(); |
| | | LogHelper.Error("TrayItembind Error:" + ex.ToString(), ex); |
| | | return result; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = ex.ToString(); |
| | | LogHelper.Error("TrayItembind Error:" + ex.ToString(), ex); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | return result; |
| | | } |
| | | |
| | | //判断有无相同物料排 |
| | | loc = StorageCompute(itemcode, areacode); |
| | | //if (loc == null) |
| | | //{ |
| | | // //无相同物料排找空排 |
| | | // loc = emptyRow(areacode); |
| | | //} |
| | | |
| | | if (loc != null) |
| | | { |
| | | End = loc.S_CODE; |
| | |
| | | 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; |
| | |
| | | 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).ToList(); |
| | | // 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_NOTE.Trim() == "叠盘" && a.N_LAYER == startloc.N_LAYER && 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($"三楼货位叠盘位,都已经有锁或者已经叠满,请检查货位状态"); |
| | | 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; |
| | |
| | | else if (startloc.S_NOTE == "PB") |
| | | { |
| | | //找块胶堆叠区 |
| | | // var KjDploc = db.Queryable<Location>().Where(a => a.S_NOTE.Trim() == "片胶堆叠位" && a.S_WH_CODE.Trim() == startloc.S_WH_CODE && a.C_ENABLE == "Y").ToList(); |
| | | var KjDploc = db.Queryable<Location>().Where(a => a.S_NOTE.Trim() == "片胶堆叠位" && a.S_WH_CODE.Trim() == startloc.S_WH_CODE).ToList(); |
| | | if (KjDploc.Count > 0) |
| | | { |
| | | 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 |
| | | //{ |
| | | |
| | |
| | | // 空托回库判断托盘有无绑定物料信息 如果有则删除 |
| | | var itemcntr = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First(); |
| | | if (itemcntr != null) { db.Deleteable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).ExecuteCommand(); } |
| | | var container = db.Queryable<Container>().Where(a => a.S_CODE.Trim() == model.Rfid).First(); |
| | | if (container == null) |
| | | { |
| | | container = new Container { S_CODE = model.Rfid }; |
| | | db.Insertable<Container>(container).ExecuteCommand(); |
| | | } |
| | | LogHelper.Info("创建任务成功"); |
| | | } |
| | | else |
| | |
| | | #region 变量 |
| | | string Start = ""; |
| | | string End = model.TargetLocation; |
| | | |
| | | |
| | | string areacode = ""; |
| | | string cntrcode = ""; |
| | | Location startloc = new Location(); |
| | | // startloc = LocationHelper.GetLocByAreacode(areacode, model.CarrierType); |
| | | // 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; |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | if (db.Updateable(new LocCntrRel() { S_CNTR_CODE = model.Rfid, S_LOC_CODE = Start }).UpdateColumns().ExecuteCommand() <= 0) |
| | | if (db.Insertable(new LocCntrRel() { S_CNTR_CODE = model.Rfid, S_LOC_CODE = Start }).ExecuteCommand() <= 0) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,托盘:{model.Rfid}绑定货位{Start}失败"; |
| | |
| | | { |
| | | //loc = EndLocs.Find(a => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0); |
| | | loc = FindEndcolByLocList(EndLocs); |
| | | |
| | | |
| | | } |
| | | else |
| | |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | internal static Result CreatelevatorTask(Elevator model) |
| | | internal static Result CreatelevatorTask(ElevatorModel model) |
| | | { |
| | | Result result = new Result() { code = "200", msg = "点对点任务创建成功" }; |
| | | string Source = "MES"; |
| | | if (model == null) |
| | | Result result = new Result() { code = "200", msg = "电梯搬运任务创建成功" }; |
| | | string Source = "WMS"; |
| | | if (model.Data == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = "参数为null"; |
| | |
| | | |
| | | var startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == model.Data.start_loc_code).First(); |
| | | |
| | | // var endloc = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == model.Data.end_loc_code && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y").First(); |
| | | var endloc = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == model.Data.end_loc_code && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0).First(); |
| | | |
| | | |
| | |
| | | if (startloc.N_LOCK_STATE != 0) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,起点{startloc.S_CODE}有锁"; |
| | | result.msg = $"创建任务失败,起点{startloc.S_CODE}有锁,电梯有其他任务,请等待电梯任务完成"; |
| | | AddErrorInfo("货位有锁", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | var cntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == startloc.S_CODE).First(); |
| | | if (cntr == null) |
| | | { |
| | |
| | | //根据任务数量判断送往哪个电梯 (具体电梯流程根据现场电梯数量) |
| | | var elevatorLoc = LocationHelper.GetElevatorLoc(); |
| | | |
| | | //创建wcs分段任务 |
| | | var wcsTask = new WCSTask |
| | | { |
| | | |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = "电梯1", |
| | | S_EQ_NO = model.Data.task_no, |
| | | S_START_LOC = startloc.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 = 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, |
| | | Z_TYPE = 6 |
| | | }; |
| | | var wcsTask1 = new WCSTask |
| | | { |
| | | S_CODE = WCSHelper.GenerateTaskNo(), |
| | | S_TYPE = "电梯2", |
| | |
| | | Z_TYPE = 6 |
| | | }; |
| | | |
| | | LogHelper.Info("创建任务:" + JsonConvert.SerializeObject(wcsTask), "CreateTask"); |
| | | if (WCSHelper.CreateTask(wcsTask) && WCSHelper.CreateTask(wcsTask1)) |
| | | |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | | { |
| | | LogHelper.Info("创建任务成功"); |
| | | var device = Settings.deviceInfos.Where(a => a.TN_Location == startloc.S_CODE).FirstOrDefault(); |
| | | var loc = LocationHelper.GetLocByLoc(endloc.S_CODE); |
| | | if (device == null) |
| | | { |
| | | LogHelper.Info($"根据任务起点:{startloc.S_CODE},未找到对应电梯配置文件"); |
| | | } |
| | | if (loc == null) |
| | | { |
| | | LogHelper.Info($"根据任务起点:{endloc.S_CODE},未找到对应货位"); |
| | | } |
| | | if (device != null && loc != null) |
| | | { |
| | | int value = 0; |
| | | if (loc.N_LAYER == 1) value = 1; |
| | | else if (loc.N_LAYER == 2) value = 3; |
| | | else if (loc.N_LAYER == 3) value = 5; |
| | | |
| | | ModbusHelper.WriteSingleRegister(40089, value, device.address, 1024); |
| | | ModbusHelper.WriteSingleRegister(40102, 1, device.address, 1024); |
| | | } |
| | | |
| | | //LocationHelper.LockLoc(startloc.S_CODE, 2); |
| | | //LocationHelper.LockLoc(endloc.S_CODE, 1); |
| | | LogHelper.Info("创建任务成功"); |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"物料主数据创建失败 错误信息:{ex}"; |
| | | result.msg = $"电梯搬运任务创建失败 错误信息:{ex}"; |
| | | LogHelper.Error("点对点任务 Error:" + ex.ToString(), ex); |
| | | return result; |
| | | } |
| | |
| | | } |
| | | string loc = model.LocationNum; |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | try |
| | | lock (_lockCreateItem) |
| | | { |
| | | var location = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == loc).First(); |
| | | if (location != null) |
| | | try |
| | | { |
| | | var loccntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == loc).First(); |
| | | |
| | | if (loccntr != null) |
| | | var location = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == loc).First(); |
| | | if (location != null) |
| | | { |
| | | var loccntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == loc).First(); |
| | | |
| | | string cntrcode = loccntr.S_CNTR_CODE; |
| | | var CntrItem = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == cntrcode).First(); |
| | | if (CntrItem != null) |
| | | 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) |
| | | { |
| | | //清除托盘物料绑定关系 |
| | | 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 |
| | | { |
| | | LogHelper.Info($"ClearLocCntr 托盘{cntrcode}无物料绑定关系"); |
| | | LogHelper.Info($"ClearLocCntr 货位{loc}无托盘货位绑定关系"); |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"ClearLocCntr 货位{loc}无托盘货位绑定关系"); |
| | | result.code = "1"; |
| | | result.msg = $"根据货位:{loc}找不到货位关系"; |
| | | AddErrorInfo("货位为空", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Info($"ClearLocCntr Error:{ex}"); |
| | | db.Ado.CommitTran(); |
| | | result.code = "1"; |
| | | result.msg = $"根据货位:{loc}找不到货位关系"; |
| | | AddErrorInfo("货位为空", result.msg, Source); |
| | | result.msg = $"Error:{ex}"; |
| | | return result; |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Info($"ClearLocCntr Error:{ex}"); |
| | | db.Ado.CommitTran(); |
| | | result.code = "1"; |
| | | result.msg = $"Error:{ex}"; |
| | | return result; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | return result; |
| | | } |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | 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) |
| | |
| | | |
| | | #region 合肥佳通业务方法 |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 托盘入库算法 |
| | | /// </summary> |
| | |
| | | internal static Location StorageCompute(string itemcode, string areacode) |
| | | { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | Location result = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM == 0 && a.S_AREA_CODE.Trim() == areacode && a.N_LOCK_STATE == 0).First(); |
| | | // Location result = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM == 0 && a.S_AREA_CODE.Trim() == areacode && a.N_LOCK_STATE == 0 ).First(); |
| | | Location result = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM == 0 && a.S_AREA_CODE.Trim() == areacode && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y").First(); |
| | | //查询所有有托盘的排没锁的排 |
| | | // var list = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM > 0 && a.S_AREA_CODE.Trim() == areacode && a.N_LOCK_STATE == 0).OrderByDescending(a => a.N_COL).Take(1).PartitionBy(a => a.N_ROW).ToList(); |
| | | // if (list.Count > 0) |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | //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> |
| | | /// 根据托盘编码,机台编码,工装类型计算机台线边区域 |
| | |
| | | Location other = null; |
| | | //当前排没有锁并且有空位置 |
| | | //先找满位,然后后面一层要么是空,要么不存在 |
| | | other = rowList.OrderBy(a => a.N_COL).Where(a => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0).FirstOrDefault(); |
| | | /// 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) |
| | | //{ |
| | | // //没有满位,那就找最小的空位 |