using System.Dynamic;
|
using Microsoft.AspNetCore.Mvc;
|
using NewPdaSqlServer.Dto.service;
|
using NewPdaSqlServer.service.@base;
|
using NewPdaSqlServer.service.Warehouse;
|
using NewPdaSqlServer.util;
|
|
namespace NewPdaSqlServer.Controllers.Warehouse;
|
|
[ApiController]
|
[Route("api/[controller]")]
|
public class InventoryController : ControllerBase
|
{
|
private readonly InventoryManager m = new();
|
|
private readonly MesPrintMangeer _mCf = new();
|
|
/// <summary>
|
/// 扫描库位条码的控制器方法
|
/// </summary>
|
/// <param name="query">包含库位代码的查询对象</param>
|
/// <returns>扫描结果信息</returns>
|
/// <remarks>
|
/// 请求示例:
|
/// POST /api/Inventory/ScanDepotNo
|
/// {
|
/// "DepotCode": "库位代码"
|
/// }
|
/// </remarks>
|
[HttpPost("ScanDepotNo")]
|
public ResponseResult ScanDepotNo([FromBody] WarehouseQuery query)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
resultInfos.tbBillList = m.ScanDepotNo(query);
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
/// <summary>
|
/// 扫描条码的控制器方法
|
/// </summary>
|
/// <param name="query">包含条码、库位代码和用户名的查询对象</param>
|
/// <returns>扫描结果信息</returns>
|
/// <remarks>
|
/// 请求示例:
|
/// POST /api/Inventory/ScanBarcode
|
/// {
|
/// "barcode": "条码",
|
/// "DepotCode": "库位代码",
|
/// "userName": "用户名"
|
/// }
|
/// </remarks>
|
[HttpPost("ScanBarcode")]
|
public ResponseResult ScanBarcode([FromBody] WarehouseQuery query)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
resultInfos.tbBillList = m.ScanBarcode(query);
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
/// <summary>
|
/// 期初打印扫描库位获取仓库信息和库存组织信息
|
/// </summary>
|
/// <param name="query"></param>
|
/// <returns></returns>
|
[HttpPost("GetDepoptsInfo")]
|
public ResponseResult GetDepoptsInfo([FromBody] WarehouseQuery query)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
resultInfos.tbBillList = m.GetDepoptsInfo(query);
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
|
/// <summary>
|
/// 期初打印扫描库位获取仓库信息和库存组织信息
|
/// </summary>
|
/// <param name="query"></param>
|
/// <returns></returns>
|
[HttpPost("GetItemsList")]
|
public ResponseResult GetItemsList([FromBody] dynamic query)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
resultInfos.tbBillList = m.GetItemsList(query);
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
[HttpPost("printBeginBar")]
|
public ResponseResult PrintBeginBar([FromBody] dynamic query)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
resultInfos.tbBillList = new ExpandoObject();
|
resultInfos.tbBillList.printInfo = _mCf.getPrintInfo(query);
|
//var scanResult = m.BarCF(unity);
|
resultInfos.tbBillList.cfBarInfo = m.ExecuteBeginBar(query);
|
//resultInfos.tbBillList = m.ExecuteBeginBar(query);
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
}
|