using System.Dynamic;
using Microsoft.AspNetCore.Mvc;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.service.Warehouse;
using NewPdaSqlServer.util;
namespace NewPdaSqlServer.Controllers.Warehouse;
[ApiController]
[Route("api/[controller]")]
public class MesXkyShdController : ControllerBase
{
private readonly MesXkyShdManager m = new();
///
/// 获取条码信息和物料信息
///
///
[HttpPost("GetShdhItems")]
public ResponseResult GetShdhItems(dynamic unity)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.GetShdhItems(unity);
resultInfos.tbMesItems = m.GetShdhBar(unity);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 获取条码信息和物料信息
///
///
[HttpPost("GetBarInfo")]
public ResponseResult GetBarInfo(WarehouseQuery unity)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.GetBarInfo(unity);
if(resultInfos.tbBillList == null)
{
return new ResponseResult
{
status = -1,
message = "此条码不存在!!!",
data = resultInfos
};
}
resultInfos.tbMesItems = m.GetItemNo(resultInfos.tbBillList.ItemId);
return new ResponseResult
{
status = 0,
message = "OK",
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
///
/// 到货单收货
///
///
[HttpPost("ScanBar")]
public ResponseResult ScanBar(dynamic unity)
{
try
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = m.ScanBar(unity);
return new ResponseResult
{
status = 0,
message = resultInfos.tbBillList,
data = resultInfos
};
}
catch (Exception ex)
{
return ResponseResult.ResponseError(ex);
}
}
}