using Microsoft.AspNetCore.Mvc; using WCS.BLL.HardWare; using WCS.BLL.Manager; using WCS.BLL.Services.IService; using WCS.BLL.Tool; using WCS.Model; namespace WebApi.Controllers { [ApiController] [Route("[controller]")] public class InstoreController : ControllerBase { private readonly ILogger _logger; private readonly IInstoreService _instoreService; public InstoreController(ILogger logger, IInstoreService instoreService) { _logger = logger; _instoreService = instoreService; } /// /// 进入入库模式 /// /// /// [Route("shelfGoInInStore")] [HttpPost(Name = "shelfGoInInStore")] public async Task shelfGoInInStore(ShelfGoInInstoreRequest request) { string content = string.Empty; try { //获取调用设备的IP地址 var IPAdress = HttpContext?.Connection?.RemoteIpAddress?.ToString(); if (string.IsNullOrEmpty(IPAdress)) { //未获取到调用设备的IP地址 //TO DO 记录日志未获取到IP } else { //获取到调用设备的Ip地址 缓存进request request.IpAdress = IPAdress; } return _instoreService.shelfGoInInStore(request); } catch (Exception ex) { return new ShelfGoInInstoreResponse() { Code = 300, Message = "货架进入入库模式失败:" + ex.Message, }; } } /// /// 退出入库模式 /// /// /// [Route("shelfGoOutInStore")] [HttpPost(Name = "shelfGoOutInStore")] public async Task shelfGoOutInStore(ShelfGoOutInStoreRequest request) { try { return _instoreService.shelfGoOutInStore(request); } catch (Exception ex) { return new ResponseCommon() { Code = 300, Message = $"货架退出入库模式失败:{ex.Message}", }; } } /// /// 扫码绑定物料 获取物料明细 /// /// /// [Route("queryByMatSn")] [HttpPost(Name = "queryByMatSn")] public async Task queryByMatSn(QueryByMatSnRequest request) { return await _instoreService.queryByMatSn(request); } /// /// 扫码绑定物料 获取物料明细 /// /// /// [Route("queryByMatSnOut")] [HttpPost(Name = "queryByMatSnOut")] public async Task queryByMatSnOut(QueryByMatSnRequest request) { return await _instoreService.queryByMatSnOut(request); } /// /// 查询入库状态 /// /// /// [Route("queryInstoreStatus")] [HttpPost(Name = "queryInstoreStatus")] public async Task queryInstoreStatus(QueryByMatSnRequest request) { try { return await _instoreService.queryInstoreStatus(request); } catch (Exception ex) { return new ResponseCommon() { Code = 300, Message = $"操作失败:{ex.Message}", }; } } /// /// 单灯货架提交入库 /// /// /// [Route("singleLightCommitInstore")] [HttpPost(Name = "singleLightCommitInstore")] public async Task singleLightCommitInstore(QueryByMatSnRequestSingle request) { //TODO:陶坤 单灯货架提交入库 try { var aa = Helper.Query(); var bb = Helper.SetId(); return await _instoreService.queryInstoreStatusSingle(request); //ShelfManager. // } catch (Exception ex) { return new ResponseCommon() { Code = 300, Message = $"操作失败:{ex.Message}", }; } } } }