| | |
| | | using Org.BouncyCastle.Crypto; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using Org.BouncyCastle.Crypto; |
| | | using SqlSugar; |
| | | using SqlSugar.Extensions; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_DTO.Stock; |
| | |
| | | |
| | | return sugarQueryable.InnerJoin(sugarQueryable1, (a, b) => a.LocationCode == b.LocationCode).Select((a, b) => new StockViewDTO |
| | | { |
| | | WarehouseId = a.WarehouseId, |
| | | AreaId = a.AreaId, |
| | | LocationCode = b.LocationCode, |
| | | Column = a.Column, |
| | |
| | | //ISugarQueryable<Dt_StockInfo> sugarQueryable1 = Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)); |
| | | //return sugarQueryable.InnerJoin(sugarQueryable1, (a, b) => a.LocationCode == b.LocationCode).Select((a, b) => b).OrderBy(a => a.CreateDate).Includes(a => a.Details).ToList(); |
| | | } |
| | | |
| | | public List<Dt_StockInfo> GetStockInfos(string materielCode, string lotNo, List<string> locationCodes) |
| | | { |
| | | //List<Dt_StockInfo> stockInfos = null; |
| | | if (!string.IsNullOrEmpty(lotNo)) |
| | | { |
| | | return Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode)).Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode && v.BatchNo == lotNo)).ToList(); |
| | | } |
| | | else |
| | | { |
| | | return Db.Queryable<Dt_StockInfo>().Where(x => locationCodes.Contains(x.LocationCode)).Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)).ToList(); |
| | | } |
| | | |
| | | //return stockInfos; |
| | | //ISugarQueryable<Dt_LocationInfo> sugarQueryable = Db.Queryable<Dt_LocationInfo>().Where(x => locationCodes.Contains(x.LocationCode)); |
| | | //ISugarQueryable<Dt_StockInfo> sugarQueryable1 = Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode)); |
| | | //return sugarQueryable.InnerJoin(sugarQueryable1, (a, b) => a.LocationCode == b.LocationCode).Select((a, b) => b).OrderBy(a => a.CreateDate).Includes(a => a.Details).ToList(); |
| | | } |
| | | /// <summary> |
| | | /// 根据货位编号获取组盘库存信息 |
| | | /// </summary> |
| | |
| | | } |
| | | public List<Dt_StockInfo> GetStockInfosByPalletCode(List<string> palletCodes) |
| | | { |
| | | return Db.Queryable<Dt_StockInfo>().Where(x => palletCodes.Contains(x.BatchNo)).Includes(x => x.Details).ToList(); |
| | | return Db.Queryable<Dt_StockInfo>().Where(x => palletCodes.Contains(x.PalletCode)).Includes(x => x.Details).ToList(); |
| | | } |
| | | public List<Dt_StockInfo> GetStockInfosExclude(string materielCode, List<string> palletCodes) |
| | | { |
| | |
| | | |
| | | return Db.Queryable<Dt_StockInfo>().Where(x => x.StockStatus == StockStatusEmun.已入库.ObjToInt() && SqlFunc.Subqueryable<Dt_LocationInfo>().Where(v => v.LocationCode == x.LocationCode && v.RoadwayNo == roadwayNo && v.LocationStatus == LocationStatusEnum.Pallet.ObjToInt() && (v.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || EnableStatusEnum.Normal.ObjToInt() == v.EnableStatus)).Any()).OrderBy(x => x.ModifyDate).First(); |
| | | } |
| | | |
| | | public WebResponseContent GetStockDetails(SaveModel saveModel) |
| | | { |
| | | WebResponseContent responseContent = new WebResponseContent(); |
| | | try |
| | | { |
| | | var palletCode = saveModel.MainData["palletCode"].ToString(); |
| | | Dt_StockInfo stockInfo = Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); |
| | | return responseContent = WebResponseContent.Instance.OK(data: stockInfo.Details); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | } |
| | | public WebResponseContent UpdateGetStockDetails(SaveModel saveModel) |
| | | { |
| | | WebResponseContent responseContent = new WebResponseContent(); |
| | | try |
| | | { |
| | | var palletCode = saveModel.MainData["palletCode"].ToString(); |
| | | var detailsJson = saveModel.MainData["details"]; |
| | | JArray jArray = saveModel.MainData["details"] as JArray; |
| | | if (jArray == null) |
| | | { |
| | | responseContent.Message = "details不是有效的数组格式"; |
| | | return responseContent; |
| | | } |
| | | |
| | | // 转换为 List<string> |
| | | List<string> details = jArray.Select(x => x?.ToString()).ToList(); |
| | | foreach (var item in details) |
| | | { |
| | | //var stockdetailbox = BaseDal.Db.Queryable<Dt_StockInfo>().LeftJoin<Dt_StockInfoDetail>((s, d) => s.Id == d.StockId).LeftJoin<Dt_StockInfoDetailCP>((s, d, cp) => d.Id == cp.StockDetailId).Where((s, d, cp) => allBoxCodes.Contains(cp.BoxCode)).Select((s, d, cp) => cp.BoxCode) |
| | | // .Distinct() |
| | | // .ToList(); |
| | | |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | } |
| | | } |
| | | } |