逐个盘点接口
This commit is contained in:
@ -69,7 +69,7 @@ namespace WCS.BLL.DbModels
|
||||
/// 物料规格
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "mat_spec", Length = 150, IsNullable = true, ColumnDescription = "物料规格")]
|
||||
public string MatSpec { get; set; }
|
||||
public string? MatSpec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料数量(原始数量)
|
||||
|
@ -72,6 +72,7 @@ namespace WCS.BLL.Manager
|
||||
|
||||
DbHelp.db.CodeFirst.InitTables(typeof(ShelfInfo), typeof(MatBaseInfo), typeof(ShelfTypeInfo)
|
||||
, typeof(LocationInfo), typeof(LocationAreaInfo), typeof(MatDetailCurrentInfo), typeof(OrderTypeInfo)
|
||||
, typeof(MatDetailStocktakingInfo)
|
||||
, typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
|
||||
, typeof(MatInfo), typeof(StoreInfo)
|
||||
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)
|
||||
|
@ -35,7 +35,7 @@ namespace WCS.BLL.Services.IService
|
||||
|
||||
|
||||
#region 赛特制冷
|
||||
public Task<ResponseBase> stockTakingById(StockTakingByIdRequest request);
|
||||
public Task<ResponseCommon> stockTakingById(StockTakingByIdRequest request);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1046,12 +1046,57 @@ namespace WCS.BLL.Services.Service
|
||||
|
||||
|
||||
#region 赛特制冷
|
||||
public async Task<ResponseBase> stockTakingById(StockTakingByIdRequest request)
|
||||
public async Task<ResponseCommon> stockTakingById(StockTakingByIdRequest request)
|
||||
{
|
||||
//先查询有无这一条库存记录
|
||||
var matDetailCurrentInfo = DbHelp.db.Queryable<MatDetailCurrentInfo>()
|
||||
var matDetailCurrentInfo = await DbHelp.db.Queryable<MatDetailCurrentInfo>()
|
||||
.Where(t => t.Id == request.MatDetailCurrentInfoId)
|
||||
.FirstAsync();
|
||||
if (matDetailCurrentInfo == null)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"操作失败:所选记录不存在!",
|
||||
Data = null,
|
||||
};
|
||||
}
|
||||
|
||||
//查询是否已经存在未提交的盘点记录
|
||||
var stocktakingInfo = await DbHelp.db.Queryable<MatDetailStocktakingInfo>()
|
||||
.Where(t => t.MatDetailCurrentId == request.MatDetailCurrentInfoId)
|
||||
.Where(t => t.StocktakingStatus == StocktakingStatusEnum.未提交)
|
||||
.FirstAsync();
|
||||
//如果存在未提交的盘点记录 将上一次的记录更新即可
|
||||
if (stocktakingInfo != null)
|
||||
{
|
||||
stocktakingInfo.StocktakingQty = request.StocktakingQty;
|
||||
stocktakingInfo.StocktakingUser = request.UserName;
|
||||
stocktakingInfo.StocktakingTime = DateTime.Now;
|
||||
DbHelp.db.Updateable(stocktakingInfo).ExecuteCommand();
|
||||
}
|
||||
//不存在盘点记录 新增即可
|
||||
else
|
||||
{
|
||||
stocktakingInfo = new MatDetailStocktakingInfo()
|
||||
{
|
||||
MatDetailCurrentId = matDetailCurrentInfo.Id,
|
||||
ShlefId = matDetailCurrentInfo.ShlefId,
|
||||
ShelfCode = matDetailCurrentInfo.ShelfCode,
|
||||
ShelfType = matDetailCurrentInfo.ShelfType,
|
||||
ShelfArea = "",
|
||||
MatCode = matDetailCurrentInfo.MatCode,
|
||||
MatName = matDetailCurrentInfo.MatName,
|
||||
MatSpec = matDetailCurrentInfo.MatSpec,
|
||||
MatQty = matDetailCurrentInfo.MatQty,
|
||||
StocktakingQty = request.StocktakingQty,
|
||||
MatSupplier = matDetailCurrentInfo.MatSupplier,
|
||||
StocktakingUser = request.UserName,
|
||||
StocktakingTime = DateTime.Now,
|
||||
StocktakingStatus = StocktakingStatusEnum.未提交,
|
||||
};
|
||||
DbHelp.db.Insertable(stocktakingInfo).ExecuteCommand();
|
||||
}
|
||||
|
||||
return new ResponseCommon()
|
||||
{
|
||||
|
@ -8,6 +8,6 @@ namespace WCS.Model.ApiModel.Stocktaking
|
||||
{
|
||||
public int MatDetailCurrentInfoId { get; set; }
|
||||
|
||||
public int MatQty { get; set; }
|
||||
public int StocktakingQty { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -19,11 +19,10 @@ namespace WCS.WebApi.Controllers
|
||||
[Route("[controller]")]
|
||||
public class PDAStocktakingController : ControllerBase
|
||||
{
|
||||
public IWarningService _warningService { get; set; }
|
||||
|
||||
public PDAStocktakingController(IWarningService warningService)
|
||||
public IStockTakingService _stockTakingService { get; set; }
|
||||
public PDAStocktakingController(IStockTakingService stockTakingService)
|
||||
{
|
||||
_warningService = warningService;
|
||||
_stockTakingService = stockTakingService;
|
||||
}
|
||||
|
||||
[Route("stockTakingById")]
|
||||
@ -44,14 +43,18 @@ namespace WCS.WebApi.Controllers
|
||||
};
|
||||
}
|
||||
|
||||
if (request.StocktakingQty < 0)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"操作失败:数量应大于等于0!",
|
||||
Data = null,
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "success",
|
||||
Data = null,
|
||||
};
|
||||
return await _stockTakingService.stockTakingById(request);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Reference in New Issue
Block a user