schangxiang@126.com
2 天以前 3091217d4f4ccecde578ef1abddd810094bfc6bc
DEmon/iWareDataCore/BASE/Service/PlaceMaterialViewService.cs
@@ -43,12 +43,12 @@
        /// <summary>
        /// 获取各种状态的库位
        /// </summary>
        /// <returns></returns>
        public List<PlaceStatusNumEntity> GetPlaceStatusNum(out string msg)
        public List<PlaceStatusNumEntity> GetPlaceStatusNum(out string msg)
        {
            msg = "";
            List<PlaceStatusNumEntity> psnlst = new List<PlaceStatusNumEntity>();
@@ -77,7 +77,7 @@
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public List<PlaceMaterialViewEntity> GetPlacePreview(out string msg)
        public List<PlaceMaterialViewEntity> GetPlacePreview(out string msg)
        {
            msg = "";
            List<PlaceMaterialViewEntity> psnlst = new List<PlaceMaterialViewEntity>();
@@ -119,7 +119,7 @@
                    return mcore.BASEPlaceMaterialViews.FirstOrDefault(x => x.materialcode == materialcode).placecode;
                }
            }
            catch (Exception ex)
            {
@@ -128,5 +128,40 @@
            }
        }
        /// <summary>
        /// 根据物料信息列表找取指定的库位物料信息 【Editby shaocx,2025-09-29】
        /// </summary>
        /// <param name="materialcode"></param>
        /// <returns></returns>
        public List<int> GetPlaceMaterialViewsByCodeList(List<string> materialcodeList, out string msg)
        {
            msg = "";
            try
            {
                using (DbModelCore mcore = new DbModelCore())
                {
                    var list = mcore.BASEPlaceMaterialViews.Where(x => materialcodeList.Contains(x.materialcode)).ToList();
                    foreach (var item in list)
                    {
                        if (!materialcodeList.Contains(item.materialcode))
                        {
                            msg = $"唯一编码{item.materialcode}没有库存";
                            return null;
                        }
                    }
                    return list.Select(x => x.id).ToList();
                }
            }
            catch (Exception ex)
            {
                msg = "异常:" + ex.ToString();
                LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "GetPlaceMaterialViewsByCodeList", ex.Message);
                return null;
            }
        }
    }
}