| | |
| | | /// <returns></returns> |
| | | internal static Result Createtask(CreateTask model) |
| | | { |
| | | |
| | | Result result = new Result() { code = "0", msg = "创建成功" }; |
| | | if (model == null) |
| | | { |
| | |
| | | |
| | | #region 根据物料编码计算出库货位,送往线边位置 |
| | | Location Endloc = null; |
| | | |
| | | //根据物料编码计算出库货位 |
| | | var loc = airlift(areacode, itemcode, model.PartLevel, model.PowderType); |
| | | if (loc != null) |
| | | { |
| | | Start = loc.S_CODE; |
| | | //根据出库货位找到绑定托盘,获取入机台货位 |
| | | |
| | | var CntrRel = LocationHelper.GetLocCntrRel(loc.S_CODE).FirstOrDefault(); |
| | | CntrCode = CntrRel.S_CNTR_CODE; |
| | | Endloc = Computeloc(CntrCode, model.WorkCenter, cntrType); |
| | | if (Endloc != null) |
| | | //给终点用终点,没给终点用机台库区计算货位 |
| | | if (string.IsNullOrEmpty(model.TargetLocation)) |
| | | { |
| | | End = Endloc.S_CODE; |
| | | |
| | | Endloc = Computeloc(CntrCode, model.WorkCenter, cntrType); |
| | | if (Endloc != null) |
| | | { |
| | | 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.code = "1"; |
| | | result.msg = $"Computeloc==》根据机台编码:{model.WorkCenter},工装类型:{cntrType} 未找到空货位数据,请检查货位表"; |
| | | LogHelper.Info($"ItemBack:{result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | |
| | | Endloc = db.Queryable<Location>().Where(a => a.S_CODE == model.TargetLocation).First(); |
| | | if (Endloc != null) |
| | | { |
| | | End = Endloc.S_CODE; |
| | | } |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"Computeloc==》根据终点货位:{model.TargetLocation} 未找到货位数据,请检查货位表"; |
| | | LogHelper.Info($"ItemBack:{result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | /// <param name="level">物料等级</param> |
| | | /// <param name="powderType">机型</param> |
| | | /// <returns></returns> |
| | | internal static Location airlift(string areacode, string itemcode, string level, string powderType) |
| | | internal static Location |
| | | airlift(string areacode, string itemcode, string level, string powderType) |
| | | { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | Location result = null; |
| | |
| | | |
| | | lock (_lockLocation) |
| | | { |
| | | var loc = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == jtcode.Trim() && a.S_NOTE == cntrType && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.S_LOCK_STATE == "无").First(); |
| | | if (loc != null) |
| | | if (string.IsNullOrEmpty(cntrType)) |
| | | { |
| | | End = loc; |
| | | End = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == jtcode.Trim() && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.S_LOCK_STATE == "无").First(); |
| | | } |
| | | else |
| | | { |
| | | End = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == jtcode.Trim() && a.S_NOTE == cntrType && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.S_LOCK_STATE == "无").First(); |
| | | } |
| | | |
| | | if (End == null) |
| | | { |
| | | LogHelper.Info($"Computeloc==》根据机台分组:{jtcode},工装类型:{cntrType} 未找到空货位数据,请检查货位表"); |
| | | } |
| | | |
| | | |
| | | } |
| | | return End; |
| | | } |