|  |  |  | 
|---|
|  |  |  | List<DtStockInfoDetail> detail = _stockInfoDetailRepository.QueryData(x => x.StockId == stock.Id).ToList(); | 
|---|
|  |  |  | if (detail != null && detail.Count() > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | List<DtStockInfoDetail_Hty> details = detail.Adapt<List<DtStockInfoDetail_Hty>>(); | 
|---|
|  |  |  | await DeleteStockInfoDetailsAsync(detail); | 
|---|
|  |  |  | AddStockInfoDetailHty(details); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | await AddStockInfoHtyAsync(stockInfo_Hty); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | location.LocationStatus = (int)LocationEnum.Lock; | 
|---|
|  |  |  | BaseDal.UpdateData(location); | 
|---|
|  |  |  | 
|---|
|  |  |  | LocationType = locType, | 
|---|
|  |  |  | Remark = "", | 
|---|
|  |  |  | Depth = locType > 1 ? (((line - 1) % 4) + 1) == 2 || (((line - 1) % 4) + 1) == 3 ? 1 : 2 : 1, | 
|---|
|  |  |  | RoadwayNo = locType > 1 ? $"JZSC{((line - 1) / 4) + 1}" : $"JZSC{((line - 1) / 2) + 1}", | 
|---|
|  |  |  | RoadwayNo = locType > 1 ? $"GWSC{((line - 1) / 4) + 1}" : $"GWSC{((line - 1) / 2) + 1}", | 
|---|
|  |  |  | LocationStatus = LocationEnum.Free.ObjToInt(), | 
|---|
|  |  |  | AreaId = areaId, | 
|---|
|  |  |  | Creater = "systeam", | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private async Task AddStockInfoHtyAsync(DtStockInfo_Hty dtStock) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var isStockAdd = await SqlSugarHelper.Db.InsertNav(dtStock).IncludesAllFirstLayer().ExecuteCommandAsync(); | 
|---|
|  |  |  | var isStockAdd = await SqlSugarHelper.DbWMS.InsertNav(dtStock).IncludesAllFirstLayer().ExecuteCommandAsync(); | 
|---|
|  |  |  | if (!isStockAdd) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | throw new Exception("库存历史信息添加失败"); | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new Exception("库存详情信息更新失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private void AddStockInfoDetailHty(List<DtStockInfoDetail_Hty> details) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var isStockAdd = SqlSugarHelper.DbWMS.Insertable(details).ExecuteCommand(); | 
|---|
|  |  |  | if (isStockAdd==0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | throw new Exception("库存明细历史信息添加失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #endregion 内部方法 | 
|---|