| | |
| | | |
| | | #endregion |
| | | |
| | | Location endloc = new Location(); |
| | | Location startloc = new Location(); |
| | | Location endloc = null; |
| | | Location startloc = null; |
| | | lock (_lockCreateTask) |
| | | { |
| | | if (taskData.taskType == 1) //出库流程,通过物料机台计算线边货位 |
| | |
| | | |
| | | } |
| | | |
| | | public static object _Putin = new object(); |
| | | /// <summary> |
| | | /// 入平库 |
| | | /// </summary> |
| | |
| | | string areacode = ""; |
| | | try |
| | | { |
| | | |
| | | lock (_Putin) |
| | | { |
| | | #region 入库检查托盘物料表有无数据 |
| | | var cntritem = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First(); |
| | | if (cntritem == null) |
| | |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | } |
| | | |
| | | public static object _PutOut = new object(); |
| | | /// <summary> |
| | | /// 出平库 |
| | | /// </summary> |
| | |
| | | string Start = ""; |
| | | string End = ""; |
| | | string CntrCode = ""; |
| | | |
| | | string itemcode = model.PartNumber; |
| | | string cntrType = ""; |
| | | string areacode = ""; |
| | |
| | | #endregion |
| | | try |
| | | { |
| | | |
| | | lock (_PutOut) |
| | | { |
| | | #region 根据物料编码规则 计算出库库区 |
| | | //粉料从平库出库,其他物料需要从暂存区出库 |
| | | var locJt = db.Queryable<Location>().Where(a => a.S_AREA_CODE == model.WorkCenter).First(); |
| | |
| | | #endregion |
| | | |
| | | #region 根据物料编码计算出库货位,送往线边位置 |
| | | var Endloc = new Location(); |
| | | Location Endloc = null; |
| | | //根据物料编码计算出库货位 |
| | | var loc = airlift(areacode, itemcode, model.PartLevel); |
| | | if (loc != null) |
| | |
| | | |
| | | return result; |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.code = "1"; |
| | |
| | | string Start = model.InitialLocation; |
| | | string itemcode = ""; |
| | | int endlayer = 1; |
| | | Location loc = new Location(); |
| | | Location loc = null; |
| | | string areacode = ""; |
| | | WCSTask mst = new WCSTask(); |
| | | List<WCSTask> msts = new List<WCSTask>(); |
| | | #endregion |
| | | |
| | |
| | | #endregion |
| | | |
| | | //回库货位计算库区货位 |
| | | loc = StorageCompute(itemcode, areacode); |
| | | if (loc == null) |
| | | if (string.IsNullOrEmpty(areacode)) |
| | | { |
| | | loc = emptyRow(areacode); |
| | | result.code = "1"; |
| | | result.msg = $"起点货位{startloc.S_CODE}无法找到回库库区,请检查起点货位"; |
| | | LogHelper.Info($" {result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | loc = StorageCompute(itemcode, areacode); |
| | | if (loc == null) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"库区:{areacode}没有可用货位"; |
| | | LogHelper.Info($" {result.msg}"); |
| | | AddErrorInfo("查找库区失败", result.msg, Source); |
| | | return result; |
| | | // LogHelper.Info($"库区:{areacode}没有可用货位"); |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | |
| | | } |
| | | else |
| | | { |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"Empty==> 任务起点:{Start}找不到对应货位,请检查货位表"; |
| | | LogHelper.Info($"{result.msg}"); |
| | |
| | | AddErrorInfo("货位有锁", result.msg); |
| | | return result; |
| | | } |
| | | LogHelper.Info("创建空托回库任务,终点货位为空:" + JsonConvert.SerializeObject(loc)); |
| | | //创建wcs任务 |
| | | var wcsTask = new WCSTask |
| | | { |
| | |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"任务创建失败"; |
| | | result.msg = $"任务创建失败,请检查起点货位状态后重新下发"; |
| | | AddErrorInfo("任务创建失败", result.msg, Source); |
| | | return result; |
| | | } |
| | |
| | | |
| | | string areacode = ""; |
| | | string cntrcode = ""; |
| | | Location startloc = new Location(); |
| | | Location startloc = null; |
| | | // startloc = LocationHelper.GetLocByAreacode(areacode, model.CarrierType); |
| | | #endregion |
| | | |
| | |
| | | { |
| | | lock (_lockcallfixture) |
| | | { |
| | | |
| | | |
| | | #region 根据仓库编码判断库区 并计算出库货位 |
| | | var endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == End).First(); |
| | | //根据仓库 计算库区 |
| | |
| | | string Start = model.InitialLocation; |
| | | string End = ""; |
| | | string itemcode = model.PartNumber; |
| | | Location loc = new Location(); |
| | | Location loc = null; |
| | | string areacode = ""; |
| | | WCSTask mst = new WCSTask(); |
| | | List<WCSTask> msts = new List<WCSTask>(); |
| | | #endregion |
| | | |
| | |
| | | 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) |
| | | { |
| | | var loccntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == loc).ToList(); |
| | | if (loccntr.Count > 0) |
| | | { |
| | | foreach (var item in loccntr) |
| | | { |
| | | string cntrcode = item.S_CNTR_CODE; |
| | | LocationHelper.UnBindingLoc(loc, new List<string>() { cntrcode }); |
| | | var CntrItem = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == cntrcode).First(); |
| | | if (CntrItem != null) |
| | | { |
| | | db.Deleteable<Container>().Where(it => it.S_CODE == item.S_CNTR_CODE).ExecuteCommand(); |
| | | // db.Deleteable<LocCntrRel>().Where(it => it.S_LOC_CODE.Trim() == loc).ExecuteCommand(); |
| | | if (db.Deleteable<CntrItemDetail>().Where(it => it.S_CNTR_CODE == cntrcode).ExecuteCommand() > 0) |
| | | |
| | | var cntrcodes = loccntr.Select(a => a.S_CNTR_CODE.Trim()).ToList(); |
| | | if (LocationHelper.Clear(loc, cntrcodes)) |
| | | { |
| | | LogHelper.Info($"ClearLoc 库位清除成功"); |
| | | } |
| | |
| | | result.msg = "库位清除失败"; |
| | | AddErrorInfo("库位清除失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"库区清空=》托盘:{cntrcode}无物料数据"); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | else |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"根据货位:{loc}找不到货位关系"; |
| | | AddErrorInfo("货位为空", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | //Location result = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM == 0 && a.S_AREA_CODE.Trim() == areacode && a.N_LOCK_STATE == 0).First(); |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | Location result = new Location(); |
| | | var list = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM == 0 && a.S_AREA_CODE.Trim() == areacode && a.N_LOCK_STATE == 0).ToList(); |
| | | Location result = null; |
| | | // 867C567A-183C-413B-9891-15D8F6DE1620 |
| | | |
| | | // var aaa = db.Deleteable<Location>(a => a.S_ID == "867C567A-183C-413B-9891-15D8F6DE1620").ExecuteCommand(); |
| | | // var aaa = db.Deleteable<Location>(a => a.S_ID.Trim() == "867C567A-183C-413B-9891-15D8F6DE1620").ExecuteCommand(); |
| | | //LogHelper.Info($"方法:StorageCompute"); |
| | | var list = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM == 0 && a.S_AREA_CODE == areacode && a.N_LOCK_STATE == 0).ToList(); |
| | | // LogHelper.Info($"创建空托回库任务,终点货位集合:根据库区编码:{areacode}" + list.Count); |
| | | //list.RemoveAll(a => string.IsNullOrEmpty(a.S_CODE.Trim()) || a.S_CODE == null || string.IsNullOrWhiteSpace(a.S_CODE.Trim())); |
| | | // list = list.FindAll(a => a.N_ROW > 0 && a.N_COL > 0); |
| | | //LogHelper.Info("创建空托回库任务,终点货位集合过滤:" + list.Count); |
| | | if (list.Count > 0) |
| | | { |
| | | result= FindEndcolByLocList(list); |
| | | } |
| | | //查询所有有托盘的排没锁的排 |
| | | |
| | | // 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) |
| | | //{ |
| | | |
| | | // for (int i = 0; i < list.Count; i++) |
| | | // { |
| | | |
| | | // LogHelper.Info($"有托盘排号{list[i].N_ROW},物料编码{itemcode},库区{areacode}"); |
| | | // //查询货位绑定托盘 |
| | | // var cntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == list[i].S_CODE).First(); |
| | | // if (cntr != null) |
| | | // { |
| | | // //查询托盘物料信息 |
| | | // var iteminfo = ContainerHelper.GetCntrItemRel(cntr.S_CNTR_CODE).FirstOrDefault(); |
| | | |
| | | // if (string.IsNullOrEmpty(itemcode))//空托入库 |
| | | // { |
| | | // if (iteminfo == null) |
| | | // { |
| | | // //物料相同入货位后一位货位 |
| | | // result = db.Queryable<Location>().OrderBy(a => a.N_COL).Where(a => a.S_AREA_CODE.Trim() == areacode && a.N_ROW == list[i].N_ROW && a.N_COL > list[i].N_COL && a.N_LOCK_STATE == 0 && a.N_CURRENT_NUM == 0).First(); |
| | | // } |
| | | // } |
| | | // else//满拖入库 |
| | | // { |
| | | // if (iteminfo != null) |
| | | // { |
| | | // if (iteminfo.S_ITEM_CODE == itemcode) |
| | | // { |
| | | // //物料相同入货位后一位货位 |
| | | // result = db.Queryable<Location>().OrderBy(a => a.N_COL).Where(a => a.S_AREA_CODE.Trim() == areacode && a.N_ROW == list[i].N_ROW && a.N_COL > list[i].N_COL && a.N_LOCK_STATE == 0 && a.N_CURRENT_NUM == 0).First(); |
| | | |
| | | // } |
| | | // } |
| | | // } |
| | | // if (result != null) |
| | | // { |
| | | // return result; |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // LogHelper.Info($"根据货物编码{list[i].S_CODE}未找到托盘货位绑定关系"); |
| | | // } |
| | | // } |
| | | //} |
| | | return result; |
| | | } |
| | | |
| | |
| | | /// <returns></returns> |
| | | internal static Location Computeloc(string cntrcode, string jtcode, string cntrType) |
| | | { |
| | | Location End = new Location(); |
| | | Location End = null; |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | |
| | | |
| | |
| | | //当前排没有锁并且有空位置 |
| | | |
| | | // 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(); |
| | | other = rowList.OrderBy(a => a.N_COL).Where(a => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && !string.IsNullOrEmpty(a.S_CODE.Trim()) && !string.IsNullOrWhiteSpace(a.S_CODE.Trim())).FirstOrDefault(); |
| | | //if (full == null) |
| | | //{ |
| | | // //没有满位,那就找最小的空位 |
| | |
| | | // other = db.Queryable<Location>().OrderBy(a => a.N_LAYER).Where(a => (string.IsNullOrEmpty(a.C_ENABLE) || a.C_ENABLE.Trim() != "禁用") && a.S_AREA_CODE == other.S_AREA_CODE && a.N_ROW == other.N_ROW && a.N_COL > other.N_COL).First(); |
| | | // //LogHelper.Info($"禁用选择后一个货位{result}", "成品"); |
| | | //} |
| | | |
| | | if (other != null) |
| | | { |
| | | if (other.S_CODE != null && !string.IsNullOrEmpty(other.S_CODE)) |
| | | { |
| | | end = other; |
| | | break; |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | return end; |