using System.Dynamic; using Microsoft.AspNetCore.Mvc; using NewPdaSqlServer.Dto.service; using NewPdaSqlServer.service.Warehouse; using NewPdaSqlServer.util; namespace NewPdaSqlServer.Controllers.Warehouse; [ApiController] [Route("api/[controller]")] public class InventoryController : ControllerBase { private readonly InventoryManager m = new(); /// /// 扫描库位条码的控制器方法 /// /// 包含库位代码的查询对象 /// 扫描结果信息 /// /// 请求示例: /// POST /api/Inventory/ScanDepotNo /// { /// "DepotCode": "库位代码" /// } /// [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); } } /// /// 扫描条码的控制器方法 /// /// 包含条码、库位代码和用户名的查询对象 /// 扫描结果信息 /// /// 请求示例: /// POST /api/Inventory/ScanBarcode /// { /// "barcode": "条码", /// "DepotCode": "库位代码", /// "userName": "用户名" /// } /// [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); } } }