|
@@ -0,0 +1,440 @@
|
|
|
+using Mapster;
|
|
|
+using SqlSugar;
|
|
|
+using WMS.BZModels;
|
|
|
+using WMS.BZModels.Dto.KLHC.WareCellDtos;
|
|
|
+using WMS.BZModels.Models.KLHC;
|
|
|
+using WMS.BZSqlSugar;
|
|
|
+using WMS.Info;
|
|
|
+
|
|
|
+namespace WMS.BZServices.KLHC
|
|
|
+{
|
|
|
+ public class WareCellService
|
|
|
+ {
|
|
|
+ private readonly Repository<BaseWarecell> _warecellRepository;
|
|
|
+ private readonly Repository<BaseWarehouse> _warehouseRepository;
|
|
|
+
|
|
|
+ public WareCellService(Repository<BaseWarecell> warecellRepository, Repository<BaseWarehouse> warehouseRepository)
|
|
|
+ {
|
|
|
+ _warecellRepository = warecellRepository;
|
|
|
+ _warehouseRepository = warehouseRepository;
|
|
|
+ }
|
|
|
+
|
|
|
+ public IEnumerable<dynamic> GetSelectSRMNameList()
|
|
|
+ {
|
|
|
+ return _warecellRepository.Queryable().Select(o => o.SCRel).Distinct().ToList().OrderBy(o => o).Select(o => new { id = o, text = o });
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取仓库有多少排
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="houseNo">仓库编号</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public int GetMaxLine(string houseNo)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ return _warecellRepository.Queryable().Where(it => it.WarehouseCode == houseNo).Max(it => it.Row);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ throw ex;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public StockLocationViewDto GetLocList(WarecellQuery query)
|
|
|
+ {
|
|
|
+ var result = new StockLocationViewDto();
|
|
|
+ var predicate = Expressionable.Create<BaseWarecell>();
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(query.SCRel), m => m.SCRel == query.SCRel);
|
|
|
+ var list = _warecellRepository.Queryable().Where(predicate.ToExpression()).ToList();
|
|
|
+ var grouplist = from p in list
|
|
|
+ group p by p.Shelf into g
|
|
|
+ let q = list.Where(x => x.Shelf == g.Key)
|
|
|
+ orderby g.Key ascending
|
|
|
+ select new
|
|
|
+ {
|
|
|
+ Shelf = q.Select(y => y.Shelf).FirstOrDefault(),
|
|
|
+ };
|
|
|
+
|
|
|
+ string LeftShelf = string.Empty;
|
|
|
+ string RightShelf = string.Empty;
|
|
|
+ if (grouplist.Count() > 0)
|
|
|
+ {
|
|
|
+ LeftShelf = grouplist.ElementAt(0).Shelf;
|
|
|
+ var leftlist = list.Where(p => p.Shelf == LeftShelf).ToList();
|
|
|
+ result.LeftJson = new List<StockLocationItemViewDto>();
|
|
|
+ result.LeftJson = TransToLocationView(leftlist.Adapt<List<WarecellDto>>());
|
|
|
+ if (leftlist.Any())
|
|
|
+ {
|
|
|
+ result.X = leftlist.Select(p => p.Col).OrderByDescending(p => p).First();
|
|
|
+ result.Y = leftlist.Select(p => p.Layer).OrderByDescending(p => p).First();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (grouplist.Count() > 1)
|
|
|
+ {
|
|
|
+ RightShelf = grouplist.ElementAt(1).Shelf;
|
|
|
+ var rightlist = list.Where(p => p.Shelf == RightShelf).ToList();
|
|
|
+ result.RightJson = new List<StockLocationItemViewDto>();
|
|
|
+ result.RightJson = TransToLocationView(rightlist.Adapt<List<WarecellDto>>());
|
|
|
+ if (rightlist.Any())
|
|
|
+ {
|
|
|
+ int tempX = rightlist.Select(p => p.Col).OrderByDescending(p => p).First();
|
|
|
+ int tempY = rightlist.Select(p => p.Layer).OrderByDescending(p => p).First();
|
|
|
+ if (tempX > result.X)
|
|
|
+ {
|
|
|
+ result.X = tempX;
|
|
|
+ }
|
|
|
+ if (tempY > result.Y)
|
|
|
+ {
|
|
|
+ result.Y = tempY;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<StockLocationItemViewDto> TransToLocationView(List<WarecellDto> locationEntities)
|
|
|
+ {
|
|
|
+ var stockColor = "#52c41a";
|
|
|
+ var emptyColor = "#e0e0e0";
|
|
|
+ var lockColor = "#ffff00";
|
|
|
+ var faultColor = "#ff0000";//故障
|
|
|
+
|
|
|
+ var dicColor = new Dictionary<int, string>() { };
|
|
|
+ dicColor.Add((int)LocationState.LocationState_Empty, emptyColor);
|
|
|
+ dicColor.Add((int)LocationState.LocationState_Full, stockColor);
|
|
|
+ dicColor.Add((int)LocationState.LocationState_StockIn, lockColor);
|
|
|
+ dicColor.Add((int)LocationState.LocationState_StockOut, lockColor);
|
|
|
+ dicColor.Add((int)LocationState.LocationState_StockMove, lockColor);
|
|
|
+ dicColor.Add(6, faultColor);
|
|
|
+
|
|
|
+ double viewHeight = 0.3;
|
|
|
+ double viewWidth = 0.8;
|
|
|
+ double viewHeightPadding = 0.5;
|
|
|
+
|
|
|
+ var list = new List<StockLocationItemViewDto>();
|
|
|
+ if (locationEntities != null && locationEntities.Any())
|
|
|
+ {
|
|
|
+ foreach (var item in locationEntities)
|
|
|
+ {
|
|
|
+ var itemView = item.Adapt<StockLocationItemViewDto>();
|
|
|
+ //itemView.LocationState = item.StateNum.HasValue? item.StateNum.Value.ToString():"1";
|
|
|
+ itemView.LocationStateName = item.StateNum == 2 || item.StateNum == 4 ? "有货" : "无货";
|
|
|
+
|
|
|
+ double y1 = item.Depth == 1 ? item.Layer + 0.1 : viewHeightPadding + item.Layer + 0.1;
|
|
|
+ double y2 = Math.Round(y1 + viewHeight, 1, MidpointRounding.AwayFromZero);
|
|
|
+ double x1 = item.Col + 0.1;
|
|
|
+ double x2 = Math.Round(x1 + viewWidth, 1, MidpointRounding.AwayFromZero);
|
|
|
+ itemView.value = new List<double>()
|
|
|
+ {
|
|
|
+ y1,y2,x1,x2
|
|
|
+ };
|
|
|
+ string color = "";
|
|
|
+ dicColor.TryGetValue(item.StateNum.Value, out color);
|
|
|
+ //if ((!string.IsNullOrEmpty(item.LocationLock) && item.LocationLock != DictionaryConst.LocationLockNoneCode))
|
|
|
+ //{
|
|
|
+ // color = lockColor;
|
|
|
+ //}
|
|
|
+ if (item.IsStop == 1 || item.StateNum == 0)
|
|
|
+ {
|
|
|
+ color = faultColor;
|
|
|
+ }
|
|
|
+ itemView.itemStyle = new ItemStyle()
|
|
|
+ {
|
|
|
+ normal = new Normal()
|
|
|
+ {
|
|
|
+ color = color
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ list.Add(itemView);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取储位信息
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public IEnumerable<WarecellDto> GetLocList(string houserNo, int line)
|
|
|
+ {
|
|
|
+ var predicate = Expressionable.Create<BaseWarecell>().And(o => o.IsStop == 0);
|
|
|
+
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(houserNo), m => m.WarehouseCode == houserNo);
|
|
|
+ predicate = predicate.AndIF(line > 0, m => m.Row == line);
|
|
|
+
|
|
|
+ var resultList = _warecellRepository.Queryable().Where(predicate.ToExpression()).ToList().Adapt<List<WarecellDto>>();
|
|
|
+
|
|
|
+ return resultList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public IEnumerable<WarecellDto> GetListsByGroupID(long groupID)
|
|
|
+ {
|
|
|
+ if (groupID <= 0)
|
|
|
+ return new List<WarecellDto>();
|
|
|
+ var predicate = Expressionable.Create<BaseWarecell, BaseWarehouse>();
|
|
|
+ predicate = predicate.AndIF(groupID > 0, (warecell, warehouse) => warecell.GroupID == groupID);
|
|
|
+ var list = _warecellRepository.Context.Queryable<BaseWarecell, BaseWarehouse>((warecell, warehouse) => new object[] { JoinType.Left, warecell.WarehouseId == warehouse.Id }).Where(predicate.ToExpression())
|
|
|
+ .Select((warecell, warehouse) => new WarecellDto
|
|
|
+ {
|
|
|
+ Id = warecell.Id.ToString(),
|
|
|
+ WarehouseName = warehouse.Name,
|
|
|
+ WarehouseId = warecell.WarehouseId.ToString(),
|
|
|
+ WarehouseCode = warecell.WarehouseCode,
|
|
|
+ WareAreaId = warecell.WareAreaId.ToString(),
|
|
|
+ IsStop = warecell.IsStop,
|
|
|
+ Code = warecell.Code,
|
|
|
+ Name = warecell.Name,
|
|
|
+ StateNum = warecell.StateNum,
|
|
|
+ TypeNum = warecell.TypeNum,
|
|
|
+ Size = warecell.Size,
|
|
|
+ Row = warecell.Row,
|
|
|
+ Col = warecell.Col,
|
|
|
+ Layer = warecell.Layer,
|
|
|
+ Depth = warecell.Depth,
|
|
|
+ Tunnel = warecell.Tunnel,
|
|
|
+ SCRel = warecell.SCRel,
|
|
|
+ ContGrpId = warecell.ContGrpId == null ? "" : warecell.ContGrpId.ToString(),
|
|
|
+ ContGrpBarCode = warecell.ContGrpBarCode,
|
|
|
+ Shelf = warecell.Shelf,
|
|
|
+ GroupID = warecell.GroupID == null ? "" : warecell.GroupID.ToString(),
|
|
|
+ XYNO = warecell.XYNO == null ? "" : warecell.XYNO.ToString(),
|
|
|
+ Memo = warecell.Memo,
|
|
|
+ AddWho = warecell.AddWho,
|
|
|
+ AddTime = warecell.AddTime,
|
|
|
+ EditWho = warecell.EditWho,
|
|
|
+ EditTime = warecell.EditTime,
|
|
|
+ }).MergeTable()
|
|
|
+ .ToList();
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ public PagedInfo<WarecellDto> GetPageList(Pagination pagination, WarecellListQueryDto warecellListQueryDto)
|
|
|
+ {
|
|
|
+ var predicate = Expressionable.Create<BaseWarecell, BaseWarehouse>();
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.KeyWord), (warecell, warehouse) => warecell.Code.Contains(warecellListQueryDto.KeyWord) || warecell.Name.Contains(warecellListQueryDto.KeyWord));
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.WarehouseId), (warecell, warehouse) => warecell.WarehouseId.ToString().Equals(warecellListQueryDto.WarehouseId));
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.WareAreaId), (warecell, warehouse) => warecell.WareAreaId.ToString().Contains(warecellListQueryDto.WareAreaId));
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.IsStop), (warecell, warehouse) => warecell.IsStop.Equals(warecellListQueryDto.IsStop));
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.Code), (warecell, warehouse) => warecell.Code.Contains(warecellListQueryDto.Code));
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.Name), (warecell, warehouse) => warecell.Name.Contains(warecellListQueryDto.Name));
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.Tunnel), (warecell, warehouse) => warecell.Tunnel.ToString().Contains(warecellListQueryDto.Tunnel));
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.Layer), (warecell, warehouse) => warecell.Layer.Equals(warecellListQueryDto.Layer));
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.SCRel), (warecell, warehouse) => warecell.SCRel.Contains(warecellListQueryDto.SCRel));
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.Row), (warecell, warehouse) => warecell.Row == int.Parse(warecellListQueryDto.Row));
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.Col), (warecell, warehouse) => warecell.Col == int.Parse(warecellListQueryDto.Col));
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.ContGrpBarCode), (warecell, warehouse) => warecell.ContGrpBarCode.Contains(warecellListQueryDto.ContGrpBarCode));
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.TypeNum), (warecell, warehouse) => warecell.TypeNum.Equals(warecellListQueryDto.TypeNum));
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.StateNum), (warecell, warehouse) => warecell.StateNum.Equals(warecellListQueryDto.StateNum));
|
|
|
+ predicate = predicate.AndIF(warecellListQueryDto != null && warecellListQueryDto.AddTimeFrom.HasValue, (warecell, warehouse) => warecell.AddTime >= warecellListQueryDto.AddTimeFrom);
|
|
|
+ predicate = predicate.AndIF(warecellListQueryDto != null && warecellListQueryDto.AddTimeTo.HasValue, (warecell, warehouse) => warecell.AddTime <= warecellListQueryDto.AddTimeTo);
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.GroupID), (warecell, warehouse) => warecell.GroupID.ToString().Contains(warecellListQueryDto.GroupID));
|
|
|
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(warecellListQueryDto?.Size), (warecell, warehouse) => warecell.Size.ToString().Contains(warecellListQueryDto.Size));
|
|
|
+
|
|
|
+ var list = _warecellRepository.Context.Queryable<BaseWarecell, BaseWarehouse>((warecell, warehouse) => new object[] { JoinType.Left, warecell.WarehouseId == warehouse.Id }).Where(predicate.ToExpression())
|
|
|
+ .Select((warecell, warehouse) => new WarecellDto
|
|
|
+ {
|
|
|
+ Id = warecell.Id.ToString(),
|
|
|
+ WarehouseName = warehouse.Name,
|
|
|
+ WarehouseId = warecell.WarehouseId.ToString(),
|
|
|
+ WarehouseCode = warecell.WarehouseCode,
|
|
|
+ WareAreaId = warecell.WareAreaId.ToString(),
|
|
|
+ IsStop = warecell.IsStop,
|
|
|
+ Code = warecell.Code,
|
|
|
+ Name = warecell.Name,
|
|
|
+ StateNum = warecell.StateNum,
|
|
|
+ TypeNum = warecell.TypeNum,
|
|
|
+ Size = warecell.Size,
|
|
|
+ Row = warecell.Row,
|
|
|
+ Col = warecell.Col,
|
|
|
+ Layer = warecell.Layer,
|
|
|
+ Depth = warecell.Depth,
|
|
|
+ Tunnel = warecell.Tunnel,
|
|
|
+ SCRel = warecell.SCRel,
|
|
|
+ ContGrpId = warecell.ContGrpId == null ? "" : warecell.ContGrpId.ToString(),
|
|
|
+ ContGrpBarCode = warecell.ContGrpBarCode,
|
|
|
+ Shelf = warecell.Shelf,
|
|
|
+ GroupID = warecell.GroupID == null ? "" : warecell.GroupID.ToString(),
|
|
|
+ XYNO = warecell.XYNO == null ? "" : warecell.XYNO.ToString(),
|
|
|
+ Memo = warecell.Memo,
|
|
|
+ AddWho = warecell.AddWho,
|
|
|
+ AddTime = warecell.AddTime,
|
|
|
+ EditWho = warecell.EditWho,
|
|
|
+ EditTime = warecell.EditTime,
|
|
|
+ }).MergeTable()
|
|
|
+ .ToPage(pagination);
|
|
|
+ //.ToPage<BaseWarecell, WarecellDto>(pagination);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int GetEmptyWareCell()
|
|
|
+ {
|
|
|
+ var predicate = Expressionable.Create<BaseWarecell>();
|
|
|
+ predicate = predicate.And(m => m.StateNum.Equals((int)LocationState.LocationState_Empty) && m.IsStop == 0);
|
|
|
+ var count = _warecellRepository.Queryable().Where(predicate.ToExpression()).Count();
|
|
|
+ return count;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ ///
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="wareCellIds">货位编号</param>
|
|
|
+ /// <param name="locationStop">是否</param>
|
|
|
+ /// <param name="userId">操作人</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="ArgumentException"></exception>
|
|
|
+ public bool ChangeWareCells(List<string> wareCellIds, LocationStop locationStop, string userId)
|
|
|
+ {
|
|
|
+ if (wareCellIds == null || !wareCellIds.Any())
|
|
|
+ {
|
|
|
+ throw new ArgumentException("没有选择货位!");
|
|
|
+ }
|
|
|
+
|
|
|
+ var list = _warecellRepository.Queryable().Where(o => wareCellIds.Contains(o.Id.ToString())).ToList();
|
|
|
+ if (!list.Any())
|
|
|
+ {
|
|
|
+ throw new ArgumentException("没有选择货位!");
|
|
|
+ }
|
|
|
+ list.ForEach(o =>
|
|
|
+ {
|
|
|
+ o.IsStop = (int)locationStop;
|
|
|
+ o.EditWho = userId;
|
|
|
+ o.EditTime = DateTime.Now;
|
|
|
+ });
|
|
|
+ var result = _warecellRepository.UpdateRange(list.ToArray());
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void Save(LoginUserInfo loginUser, long keyValue, BaseWarecell entity)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (string.IsNullOrWhiteSpace(entity.Code))
|
|
|
+ {
|
|
|
+ throw new ArgumentException("货位编码不能为空");
|
|
|
+ }
|
|
|
+ var warehouse = _warehouseRepository.Queryable().First(o => o.Id == entity.WarehouseId);
|
|
|
+ if (warehouse == null)
|
|
|
+ {
|
|
|
+ throw new ArgumentException("不存在的仓库!");
|
|
|
+ }
|
|
|
+ if (keyValue == 0)
|
|
|
+ {
|
|
|
+ var mat = _warecellRepository.GetSingle(p => p.Code == entity.Code);
|
|
|
+ if (mat != null)
|
|
|
+ {
|
|
|
+ throw new ArgumentException("货位编码已存在");
|
|
|
+ }
|
|
|
+ BaseWarecell item = new BaseWarecell()
|
|
|
+ {
|
|
|
+ WarehouseId = warehouse.Id,
|
|
|
+ AddWho = loginUser.UserNo,
|
|
|
+ Code = entity.Code,
|
|
|
+ EditWho = loginUser.UserNo,
|
|
|
+ Name = entity.Name,
|
|
|
+ WarehouseCode = warehouse.Code,
|
|
|
+ WareAreaId = entity.WareAreaId,
|
|
|
+ IsStop = 1,
|
|
|
+ StateNum = 1,
|
|
|
+ TypeNum = 1,
|
|
|
+ Size = entity.Size,
|
|
|
+ Row = entity.Row,
|
|
|
+ Col = entity.Col,
|
|
|
+ Layer = entity.Layer,
|
|
|
+ Depth = entity.Depth,
|
|
|
+ Tunnel = entity.Tunnel,
|
|
|
+ SCRel = entity.SCRel,
|
|
|
+ ContGrpId = 0,
|
|
|
+ ContGrpBarCode = "",
|
|
|
+ Memo = string.IsNullOrWhiteSpace(entity.Memo) ? " " : entity.Memo,
|
|
|
+ Shelf = entity.Shelf
|
|
|
+ };
|
|
|
+ _warecellRepository.Insert(item);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ entity.EditTime = DateTime.Now;
|
|
|
+ entity.EditWho = loginUser.UserNo;
|
|
|
+ _warecellRepository.AsUpdateable(entity).IgnoreColumns(it => it.AddTime).IgnoreColumns(it => it.AddWho).IgnoreColumns(it => it.XYNO).
|
|
|
+ IgnoreColumns(it => it.TypeNum).IgnoreColumns(it => it.StateNum).IgnoreColumns(it => it.IsStop).IgnoreColumns(it => it.ContGrpId).IgnoreColumns(it => it.ContGrpBarCode)
|
|
|
+ .IgnoreColumns(it => it.WareAreaId).IgnoreColumns(it => it.WarehouseCode).IgnoreColumns(it => it.WarehouseId).Where(it => it.Id == keyValue).ExecuteCommand();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ throw ex;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void Delete(string ModuleNo)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ _warecellRepository.Deleteable().Where(it => it.Code == ModuleNo).ExecuteCommand();
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ throw ex;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void UpdateCellState(string CellCode, int Status, long WarehouseId, string userId)
|
|
|
+ {
|
|
|
+ var cell = _warecellRepository.GetFirst(p => p.Code == CellCode && p.WarehouseId == WarehouseId);
|
|
|
+ if (cell == null)
|
|
|
+ {
|
|
|
+ throw new ArgumentException("货位编码不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Status == 1)
|
|
|
+ {
|
|
|
+ _warecellRepository.UpdateSetColumnsTrue(p => new BaseWarecell()
|
|
|
+ {
|
|
|
+ StateNum = Status,
|
|
|
+ ContGrpBarCode = "",
|
|
|
+ ContGrpId = 0,
|
|
|
+ GroupID = 0,
|
|
|
+ XYNO = 0,
|
|
|
+ EditTime = DateTime.Now
|
|
|
+ }, p => p.Code == CellCode && p.WarehouseId == WarehouseId);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _warecellRepository.UpdateSetColumnsTrue(p => new BaseWarecell()
|
|
|
+ {
|
|
|
+ StateNum = Status,
|
|
|
+ EditTime = DateTime.Now
|
|
|
+ }, p => p.Code == CellCode && p.WarehouseId == WarehouseId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void UpdateSize(List<string> ids, string userId, int size)
|
|
|
+ {
|
|
|
+ if (!ids.Any())
|
|
|
+ {
|
|
|
+ throw new ArgumentException("没有选择任务!");
|
|
|
+ }
|
|
|
+
|
|
|
+ var list = _warecellRepository.Queryable().Where(o => ids.Contains(o.Id.ToString())).ToList();
|
|
|
+ if (!list.Any())
|
|
|
+ {
|
|
|
+ throw new ArgumentException("没有找到该任务!");
|
|
|
+ }
|
|
|
+
|
|
|
+ _warecellRepository.UseTranAction(() =>
|
|
|
+ {
|
|
|
+ foreach (var item in list)
|
|
|
+ {
|
|
|
+ _warecellRepository.AsUpdateable().SetColumns(p => new BaseWarecell()
|
|
|
+ {
|
|
|
+ Size = size,
|
|
|
+ EditTime = DateTime.Now,
|
|
|
+ EditWho = userId
|
|
|
+ }).Where(p => p.Id == item.Id).ExecuteCommand();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|