using System.Dynamic; using Microsoft.AspNetCore.Mvc; using NewPdaSqlServer.Dto.service; using NewPdaSqlServer.entity; using NewPdaSqlServer.service.Warehouse; using NewPdaSqlServer.util; using static Microsoft.EntityFrameworkCore.DbLoggerCategory; namespace NewPdaSqlServer.Controllers.Warehouse; /// /// 生产补料相关接口 /// [Route("api/[controller]")] [ApiController] public class MesSttlController : ControllerBase { private readonly MesSttlManager _manager = new(); #region 基础 /***进入模版管理可以修改模版***/ /// /// 获取所有 /// /// [HttpPost("GetList")] public ResponseResult GetList() { try { dynamic resultInfos = new ExpandoObject(); resultInfos.tbBillList = _manager.GetList(); return new ResponseResult { status = 0, message = "OK", data = resultInfos }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } /// /// 根据主键获取 /// /// [HttpPost("GetById")] public ResponseResult GetById(int id) { try { dynamic resultInfos = new ExpandoObject(); resultInfos.tbBillList = _manager.GetById(id); return new ResponseResult { status = 0, message = "OK", data = resultInfos }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } /// /// 根据主键删除 /// /// [HttpPost("DeleteByIds")] public ResponseResult DeleteByIds([FromBody] object[] ids) { try { dynamic resultInfos = new ExpandoObject(); resultInfos.tbBillList = _manager.DeleteByIds(ids); return new ResponseResult { status = 0, message = "OK", data = resultInfos }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } /// /// 添加 /// /// [HttpPost("Insert")] public ResponseResult Add([FromBody] MesItemBl data) { try { dynamic resultInfos = new ExpandoObject(); resultInfos.tbBillList = _manager.Insert(data); return new ResponseResult { status = 0, message = "OK", data = resultInfos }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } /// /// 添加返回自增 /// /// [HttpPost("InsertReturnIdentity")] public ResponseResult InsertReturnIdentity([FromBody] MesItemBl data) { try { dynamic resultInfos = new ExpandoObject(); resultInfos.tbBillList = _manager.InsertReturnIdentity(data); return new ResponseResult { status = 0, message = "OK", data = resultInfos }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } /// /// 修改 /// /// [HttpPost("Update")] public ResponseResult Update([FromBody] MesItemBl data) { try { dynamic resultInfos = new ExpandoObject(); resultInfos.tbBillList = _manager.Update(data); return new ResponseResult { status = 0, message = "OK", data = resultInfos }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } #endregion /// /// 获取受托退料申请列表 /// /// /// 受托退料申请列表 [HttpPost("GetSttlBillNo")] public ResponseResult GetSttlBillNo(WarehouseQuery query) { try { dynamic resultInfos = new ExpandoObject(); resultInfos.tbBillList = _manager.GetSttlBillNo(query); return new ResponseResult { status = 0, message = "OK", data = resultInfos }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } /// /// 根据单号获取受托退料单明细 /// /// 查询参数 /// 受托退料单明细列表 [HttpPost("GetMesItemDetailByBillNo")] public ResponseResult GetMesItemDetailByBillNo( [FromBody] WarehouseQuery query) { try { dynamic resultInfos = new ExpandoObject(); resultInfos.tbBillList = _manager.GetMesItemDetailByBillNo(query); if (resultInfos.tbBillList.Count < 1) { return new ResponseResult { status = 1, message = "该申请单号不存在或未审核!!!", data = "" }; } return new ResponseResult { status = 0, message = "OK", data = resultInfos }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } /// /// 获取条码信息和物料信息 /// /// [HttpPost("SttlScanBarcode")] public ResponseResult SttlScanBarcode(WarehouseQuery unity) { try { dynamic resultInfos = new ExpandoObject(); resultInfos.tbBillList = _manager.SttlScanBarcode(unity); if (resultInfos.tbBillList.result == "2") { return new ResponseResult { status = Convert.ToInt32(resultInfos.tbBillList.result), message = resultInfos.tbBillList.strMsg, data = resultInfos }; } return new ResponseResult { status = 0, message = "OK", data = resultInfos }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } }