| | |
| | | |
| | | |
| | | #region 佳通合肥接口业务 |
| | | |
| | | |
| | | /// <summary> |
| | | /// 立库任务下发=》创建任务 |
| | | /// </summary> |
| | |
| | | // 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(); |
| | |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = 1, |
| | | Z_TYPE = n_type |
| | | |
| | | }; |
| | | LogHelper.Info("创建出平库任务:" + JsonConvert.SerializeObject(wcsTask)); |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | |
| | | |
| | | } |
| | | |
| | | public static object _lockEmpty = new object(); |
| | | /// <summary> |
| | | /// 空工装回库 |
| | | /// </summary> |
| | |
| | | #endregion |
| | | |
| | | try |
| | | { |
| | | lock (_lockEmpty) |
| | | { |
| | | #region 判断托盘绑定货位是否和下发绑定起点相同 |
| | | //var CntrLoc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First(); |
| | |
| | | } |
| | | #endregion |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.code = "1"; |
| | |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public static object _lockcallfixture = new object(); |
| | | |
| | | /// <summary> |
| | | /// 空工装呼叫 |
| | |
| | | #region 变量 |
| | | string Start = ""; |
| | | string End = model.TargetLocation; |
| | | string itemcode = ""; |
| | | |
| | | string areacode = ""; |
| | | string cntrcode = ""; |
| | | Location startloc = new Location(); |
| | | #endregion |
| | | |
| | | try |
| | | { |
| | | lock (_lockcallfixture) |
| | | { |
| | | #region 根据仓库编码判断库区 并计算出库货位 |
| | | var endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == End).First(); |
| | |
| | | |
| | | |
| | | //计算出库托盘 |
| | | startloc = LocationHelper.GetLocByAreacode(areacode); |
| | | 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(); |
| | |
| | | S_CNTR_CODE = cntrcode, |
| | | N_START_LAYER = 1, |
| | | N_END_LAYER = 1, |
| | | Z_TYPE = 5 |
| | | |
| | | Z_TYPE = 5, |
| | | S_NOTE = "粉料" |
| | | }; |
| | | LogHelper.Info("创建呼叫空托任务:" + JsonConvert.SerializeObject(wcsTask)); |
| | | if (WCSHelper.CreateTask(wcsTask)) |
| | |
| | | } |
| | | return result; |
| | | #endregion |
| | | } |
| | | |
| | | |
| | | } |
| | | catch (Exception ex) |
| | |
| | | |
| | | } |
| | | |
| | | public static object _lockItemBack = new object(); |
| | | /// <summary> |
| | | /// 余料返回 |
| | | /// </summary> |
| | |
| | | |
| | | try |
| | | { |
| | | lock (_lockItemBack) |
| | | { |
| | | #region 余料返回根据托盘找出库任务 |
| | | //余料返回根据托盘找出库任务 |
| | | //msts = WCSHelper.GetTaskBycntrcode(model.Rfid); |
| | |
| | | //} |
| | | #endregion |
| | | |
| | | #region 判断托盘绑定货位是否和下发绑定起点相同 |
| | | var CntrLoc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First(); |
| | | if (CntrLoc != null) |
| | | { |
| | | if (CntrLoc.S_LOC_CODE != Start) |
| | | { |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,托盘:{model.Rfid}绑定位置不是起点:{Start}"; |
| | | LogHelper.Info($"ItemBack:{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) |
| | | { |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,托盘:{model.Rfid}绑定货位{Start}失败"; |
| | | LogHelper.Info($"ItemBack:{result.msg}"); |
| | | AddErrorInfo("托盘绑定货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region 根据物料编码 判断回库还是回到对应暂存区 |
| | | var startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == Start).First(); |
| | | if (startloc != null) |
| | |
| | | } |
| | | else |
| | | { |
| | | #region 判断托盘绑定货位是否和下发绑定起点相同 |
| | | var CntrLoc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First(); |
| | | if (CntrLoc != null) |
| | | { |
| | | if (CntrLoc.S_LOC_CODE != Start) |
| | | { |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,托盘:{model.Rfid}绑定位置不是起点:{Start}"; |
| | | LogHelper.Info($"ItemBack:{result.msg}"); |
| | | AddErrorInfo("托盘绑定位置不同", result.msg, Source); |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | result.code = "1"; |
| | | result.msg = $"创建任务失败,托盘:{model.Rfid}未找到绑定货位"; |
| | | LogHelper.Info($"ItemBack:{result.msg}"); |
| | | AddErrorInfo("查找托盘货位失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | #endregion |
| | | |
| | | if (model.PartNumber.StartsWith("3")) |
| | | { |
| | |
| | | |
| | | db.Updateable(CntrItem).UpdateColumns(a => new { a.F_WEIGHT, a.S_BS_TYPE }).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | var cir = new CntrItemDetail |
| | | { |
| | | S_CNTR_CODE = model.Rfid, |
| | | S_ITEM_CODE = itemcode, |
| | | S_ITEM_NAME = model.PartNumber, |
| | | S_ITEM_SPEC = model.PartDesc, |
| | | F_QTY = float.Parse(model.LotList[0].qty), |
| | | S_BS_TYPE = "余料", |
| | | F_WEIGHT = model.LotList[0].Weight.ToString(), |
| | | S_ITEM_STATE = model.LotList[0].QualityStatus, |
| | | D_EXP_DATE = model.LotList[0].MaturityTime, |
| | | D_PRD_DATE = model.LotList[0].ProductionTime |
| | | }; |
| | | db.Insertable<CntrItemDetail>(cir).ExecuteCommand(); |
| | | } |
| | | LogHelper.Info("创建任务成功"); |
| | | } |
| | | else |
| | |
| | | return result; |
| | | } |
| | | #endregion |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | return result; |
| | | } |
| | |
| | | } |
| | | |
| | | return result; |
| | | } /// <summary> |
| | | } |
| | | /// <summary> |
| | | /// 库位清空 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | |
| | | 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(); |
| | | |
| | | if (loccntr != null) |
| | | var loccntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == loc).ToList(); |
| | | if (loccntr.Count > 0) |
| | | { |
| | | |
| | | string cntrcode = loccntr.S_CNTR_CODE; |
| | | 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) |
| | | { |
| | | |
| | | LocationHelper.UnBindingLoc(loc, new List<string>() { cntrcode }); |
| | | 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) |
| | | { |
| | |
| | | AddErrorInfo("库位清除失败", result.msg, Source); |
| | | return result; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"ClearLoc 托盘{cntrcode}无物料绑定关系"); |
| | | LogHelper.Info($"库区清空=》托盘:{cntrcode}无物料数据"); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"ClearLoc 货位{loc}无托盘货位绑定关系"); |
| | | result.code = "1"; |
| | | result.msg = $" ClearLoc 货位{loc}无托盘货位绑定关系"; |
| | | AddErrorInfo("库位清除失败", result.msg, Source); |
| | | return result; |
| | | |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | #endregion |
| | | |
| | | #region 合肥佳通业务方法 |
| | | |
| | | |
| | | /// <summary> |
| | | /// 托盘入库算法 |
| | | /// </summary> |
| | |
| | | //} |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 根据物料计算托盘出库 |
| | |
| | | Location other = null; |
| | | //当前排没有锁并且有空位置 |
| | | //先找满位,然后后面一层要么是空,要么不存在 |
| | | other = rowList.OrderBy(a => a.N_COL).Where(a => a.N_CURRENT_NUM == 0).FirstOrDefault(); |
| | | other = rowList.OrderBy(a => a.N_COL).Where(a => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0).FirstOrDefault(); |
| | | //if (full == null) |
| | | //{ |
| | | // //没有满位,那就找最小的空位 |