| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using static HH.WCS.JiaTong.dispatch.NDC; |
| | | |
| | |
| | | "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", |
| | | "U", "V", "W", "X", "Y", "Z" |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 根据物料找托盘 |
| | | /// </summary> |
| | |
| | | /// <returns></returns> |
| | | internal static List<Location> GetLocByItemCode(string areaCode, string ItemCode, string lev) |
| | | { |
| | | |
| | | List<Location> locs; |
| | | |
| | | |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | var queryable = db.Queryable<Location>() |
| | | .LeftJoin<LocCntrRel>((a, b) => a.S_CODE == b.S_LOC_CODE) |
| | |
| | | //.Skip(targetIndex) // 跳过高于目标等级的等级 |
| | | //.ToList(); |
| | | |
| | | // LogHelper.Info($"GetLocByItemCode=>根据库区编码:{areaCode},物料编码:{ItemCode},物料优先级:{lev},物料等级计算出有托盘货位{JsonConvert.SerializeObject(queryable.ToList())}"); |
| | | LogHelper.Info($"GetLocByItemCode=>根据库区编码:{areaCode},物料编码:{ItemCode},物料优先级:{lev},物料等级计算出有托盘货位{JsonConvert.SerializeObject(queryable.ToList())}"); |
| | | //判断需不需要物料等级查找,并优先出库余料 |
| | | if (string.IsNullOrEmpty(lev)) |
| | | { |
| | |
| | | { |
| | | queryable = queryable.Where((a, b, c) => c.S_ITEM_CODE == ItemCode); |
| | | } |
| | | // LogHelper.Info($"GetLocByItemCode=>无余料,查找全部{JsonConvert.SerializeObject(queryable.ToList())}"); |
| | | LogHelper.Info($"GetLocByItemCode=>无余料,查找全部{JsonConvert.SerializeObject(queryable.ToList())}"); |
| | | |
| | | |
| | | if (string.IsNullOrEmpty(lev)) |
| | |
| | | { |
| | | locs = queryable.Where((a, b, c) => c.LEV == lev).ToList(); |
| | | } |
| | | // LogHelper.Info($"GetLocByItemCode=>无余料,查找全部{JsonConvert.SerializeObject(locs)}"); |
| | | LogHelper.Info($"GetLocByItemCode=>无余料,查找全部{JsonConvert.SerializeObject(locs)}"); |
| | | } |
| | | |
| | | return locs; |
| | |
| | | /// </summary> |
| | | /// <param name="areaCode">库区编码</param> |
| | | /// <returns></returns> |
| | | internal static Location GetLocByAreacode(string areaCode) |
| | | internal static Location GetLocByAreacode(string areaCode, string type) |
| | | { |
| | | Location loc = new Location(); |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | string CntrCodeWith = ""; |
| | | if (type.Trim() == "PM") |
| | | { |
| | | CntrCodeWith = "MA"; |
| | | } |
| | | else if (type.Trim() == "PN") |
| | | { |
| | | CntrCodeWith = "NA"; |
| | | } |
| | | if (CntrCodeWith == "") |
| | | { |
| | | LogHelper.Info($"托盘类型{type}不在规定范围"); |
| | | } |
| | | var query = db.Queryable<Location>() |
| | | .LeftJoin<LocCntrRel>((a, b) => a.S_CODE == b.S_LOC_CODE) |
| | | .LeftJoin<CntrItemDetail>((a, b, c) => b.S_CNTR_CODE == c.S_CNTR_CODE) |
| | | .Where((a, b, c) => a.S_AREA_CODE == areaCode && a.N_CURRENT_NUM == 1 |
| | | && a.N_LOCK_STATE == 0 |
| | | && b.S_CNTR_CODE != null && c.S_ITEM_CODE == null |
| | | ); |
| | | .LeftJoin<LocCntrRel>((a, b) => a.S_CODE == b.S_LOC_CODE) |
| | | .LeftJoin<CntrItemDetail>((a, b, c) => b.S_CNTR_CODE == c.S_CNTR_CODE) |
| | | .Where((a, b, c) => a.S_AREA_CODE == areaCode && a.N_CURRENT_NUM == 1 |
| | | && a.N_LOCK_STATE == 0 |
| | | && b.S_CNTR_CODE != null && b.S_CNTR_CODE.Contains(CntrCodeWith) && c.S_ITEM_CODE == null |
| | | ); |
| | | loc = query.First(); |
| | | |
| | | |
| | | return loc; |
| | | } |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | LogHelper.Info($"锁定货位{loc}成功"); |
| | | LogHelper.Info($"锁定货位{loc}失败,重新锁"); |
| | | Task.Run(() => |
| | | { |
| | | LockLoc(loc, lockState); |
| | | }); |
| | | } |
| | | return res; |
| | | } |