| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection.Emit; |
| | | using System.ServiceModel; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using System.Web.UI.WebControls; |
| | | using static HH.WCS.JiaTong.api.ApiModel; |
| | | using static HH.WCS.JiaTong.api.OtherModel; |
| | | using static HH.WCS.JiaTong.LISTA.process.HttpModel; |
| | |
| | | } |
| | | else if (taskData.taskType == 2)//入库流程,直接使用起点货位和终点货位生成任务,起点需要有托盘 |
| | | { |
| | | note = "入库"; |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | |
| | | } |
| | | |
| | | } |
| | | //判断是否是空托回库 |
| | | var CntrItem = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == CntrCode).First(); |
| | | if (CntrItem == null) |
| | | { |
| | | note = "空托回库";//井松空托回库,需要与叠盘机安全交互 |
| | | } |
| | | |
| | | endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); |
| | | if (endloc != null) |
| | | { |
| | |
| | | } |
| | | else if (taskData.taskType == 3)//移库流程,直接使用起点货位和终点货位生成任务, |
| | | { |
| | | note = "出库"; |
| | | //创建托盘物料绑定信息,并计算终点货位 |
| | | |
| | | startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); |
| | | if (startloc != null) |
| | | { |
| | |
| | | //暂存位回库 |
| | | else if (taskData.taskType == 6)//入库流程,直接使用起点货位和终点货位生成任务 |
| | | { |
| | | note = "入库"; |
| | | //根据托盘号找货位 |
| | | var CntrRel = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE == partData.rfid).First(); |
| | | if (CntrRel != null) |
| | |
| | | result.msg = $"根据起点仓库编码:{startloc.S_WH_CODE}未找到对应配置文件"; |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | //判断有无相同物料排 |
| | |
| | | result.msg = $"库区:{areacode}无可用货位"; |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | |
| | | result.msg = $"任务起点:{Start}找不到对应货位,请检查货位表"; |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("查找货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | #endregion |
| | | |
| | |
| | | result.msg = $"根据机台编码:{model.WorkCenter}未找到对应货位"; |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | //根据仓库 计算库区 |
| | | var whcode = Settings.wareLoc.Where(a => a.AreaCode == locJt.S_WH_CODE).FirstOrDefault(); |
| | |
| | | result.msg = $"根据终点库区仓库编码:{locJt.S_WH_CODE}未找到对应配置文件"; |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | #endregion |
| | | |
| | |
| | | { |
| | | End = Endloc.S_CODE; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"Computeloc==》根据机台编码:{model.WorkCenter},工装类型:{cntrType} 未找到空货位数据,请检查货位表"; |
| | | LogHelper.Info($"ItemBack:{result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | result.msg = $"任务物料:{itemcode}找不到对应库存"; |
| | | LogHelper.Info($"ItemBack:{result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | #endregion |
| | | |
| | |
| | | result.msg = $"根据起点仓库编码:{startloc.S_WH_CODE}未找到对应配置文件"; |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | #endregion |
| | | |
| | |
| | | result.msg = $"根据起点仓库编码:{endloc.S_WH_CODE}未找到对应配置文件"; |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | //计算出库托盘 |
| | | startloc = airlift(areacode, itemcode); |
| | | startloc = LocationHelper.GetLocByAreacode(areacode); |
| | | if (startloc != null) |
| | | { |
| | | var cntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == startloc.S_CODE).First(); |
| | |
| | | result.msg = $"任务起点:{End}找不到对应货位,请检查货位表"; |
| | | LogHelper.Info($"callfixture:{result.msg}"); |
| | | 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 = EndLocs.Find(a => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0); |
| | | loc = FindEndcolByLocList(EndLocs); |
| | | if (loc != null) |
| | | { |
| | | End = loc.S_CODE; |
| | |
| | | result.msg = $"根据起点仓库编码:{startloc.S_WH_CODE}未找到对应配置文件"; |
| | | LogHelper.Info($"Putin==> {result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | return result; |
| | | } |
| | | internal static DeviceInfoModel Device() |
| | | { |
| | | |
| | | DeviceInfoModel device = new DeviceInfoModel(); |
| | | |
| | | List<DeviceInfos> deviceInfos = new List<DeviceInfos>();//叠盘机报错信息 |
| | | AgvInfos gvInfos = new AgvInfos();//agv报错信息 |
| | | //获取内存中叠盘机的报错信息 |
| | | foreach (var dpjInfo in DeviceProcess.DpjInfoDirectory) |
| | | { |
| | | deviceInfos.Add(new DeviceInfos() { Device = dpjInfo.Value.DeviceName, DeviceInfo = dpjInfo.Value.ErrorInfo }); |
| | | } |
| | | device.DeviceInfos = deviceInfos; |
| | | |
| | | |
| | | return device; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 库位清空 |
| | |
| | | if (CntrItem != null) |
| | | { |
| | | |
| | | LocationHelper.UnBindingLoc(loc, new List<string>() { "cntrcode" }); |
| | | // db.Deleteable<LocCntrRel>().Where(it => it.S_LOC_CODE.Trim() == loc).ExecuteCommand(); |
| | | LocationHelper.UnBindingLoc(loc, new List<string>() { cntrcode }); |
| | | // db.Deleteable<LocCntrRel>().Where(it => it.S_LOC_CODE.Trim() == loc).ExecuteCommand(); |
| | | db.Deleteable<CntrItemDetail>().Where(it => it.S_CNTR_CODE.Trim() == cntrcode).ExecuteCommand(); |
| | | |
| | | } |
| | |
| | | #endregion |
| | | var loc = LocationHelper.GetLocByItemCode(areacode, itemcode, level); |
| | | LogHelper.Info($"airlift=>根据库区编码:{areacode},物料编码:{itemcode},物料等级计算出有托盘货位{JsonConvert.SerializeObject(loc)}"); |
| | | result = FindStartcolByLoclist(loc); |
| | | // result = FindStartcolByLoclist(loc); |
| | | if (loc.Count > 0) |
| | | { |
| | | result = loc.OrderByDescending(a => a.N_COL).First(); |
| | | } |
| | | |
| | | LogHelper.Info($"airlift=>可用货位为:{JsonConvert.SerializeObject(result)}"); |
| | | return result; |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="locations"></param> |
| | | /// <returns></returns> |
| | | internal static Location FindEndcolByLocList(List<Location> locations, string itemcode) |
| | | internal static Location FindEndcolByLocList(List<Location> locations) |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取对应错误编码的小车数量 |
| | | /// </summary> |
| | | /// <param name="Error1">错误码1</param> |
| | | /// <param name="Error2">错误码2</param> |
| | | /// <param name="faildCode"></param> |
| | | /// <returns></returns> |
| | | internal static int GetAgvQty(string Error1, string Error2 = "0", string faildCode = "0") |
| | | { |
| | | try |
| | | { |
| | | var db = new SqlHelper<HangChaAGV>().GetInstance(); |
| | | return db.Queryable<HangChaAGV>().Where(a => a.faildCode == faildCode && a.errCode2 == Error2 && a.agvErrCode == Error1).Count(); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | |