lss
2025-06-05 71129e21a35a2d4be75ee0f1e96e2c51ced5f23b
HH.WCS.Mobox3/HH.WCS.Mobox3.DaYang/wms/LocationHelper.cs
@@ -127,12 +127,47 @@
        }
        #endregion
        /// <summary>
        /// 根据物料获得对应的内测货位
        /// 根据物料和排号获得对应的未锁定托盘货位
        /// </summary>
        /// <param name="areaCode">库区编码</param>
        /// <param name="row">货位排</param>
        /// <param name="ItemCode">物料编码</param>
        /// <returns></returns>
        internal static List<Location> GetLocByItemCodeOrderyTime(string areaCode, string ItemCode)
        {
            List<Location> locs;
            var db = new SqlHelper<object>().GetInstance();
            try
            {
                locs = 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.N_CURRENT_NUM > 0 && a.N_LOCK_STATE == 0 && a.S_AREA_CODE == areaCode
                    && c.S_ITEM_CODE == ItemCode && a.N_LOCK_STATE == 0)
                   .GroupBy((a, b, c) => new { a.S_CODE, c.T_INBOUND_TIME ,a.N_POS })
                   .OrderBy((a, b, c) => c.T_INBOUND_TIME)
                   .OrderByDescending((a, b, c) => a.N_POS)
                   .ToList();
                return locs;
            }
            catch (Exception ex)
            {
                LogHelper.Info($"GetLocByItemCode Error:{ex}");
                throw;
            }
        }
        /// <summary>
        /// 根据物料和排号获得对应的未锁定托盘货位,并按托盘物料表时间分组
        /// </summary>
        /// <param name="areaCode">库区编码</param>
        /// <param name="row">货位排</param>
@@ -147,7 +182,7 @@
                var queryable = 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.N_CURRENT_NUM > 0 && a.N_LOCK_STATE == 0 && a.S_AREA_CODE == areaCode && row.Contains(a.N_ROW) && c.S_ITEM_CODE == ItemCode);
                   .Where((a, b, c) => a.N_CURRENT_NUM > 0 && a.N_LOCK_STATE == 0 && a.S_AREA_CODE == areaCode && row.Contains(a.N_ROW) && c.S_ITEM_CODE == ItemCode && a.N_LOCK_STATE == 0);
                locs = queryable.ToList();
@@ -171,6 +206,7 @@
        {
            var db = new SqlHelper<object>().GetInstance();
            Location location = null;
            try
            {
                //判断当前排可用货位小于2 如果小于2则不允许入
@@ -470,6 +506,7 @@
                model.S_LOCK_STATE = Location.GetLockStateStr(lockState);
                res = db.Updateable(model).UpdateColumns(it => new { it.N_LOCK_STATE, it.S_LOCK_STATE }).ExecuteCommand() > 0;
            }
            return res;
        }