| | |
| | | using Model.ModelVm.BllCheckVm; |
| | | using Microsoft.Extensions.Logging; |
| | | using WMS.IBLL.IPdaServer; |
| | | using WMS.IBLL.IDataServer; |
| | | using Model.ModelDto.DataDto; |
| | | using System.Collections.Generic; |
| | | using Model.ModelDto.LogDto; |
| | | |
| | | namespace Wms.Controllers |
| | | { |
| | |
| | | private readonly IArrivalNoticeServer _arrivalNoticeSvc; |
| | | private readonly IStockCheckServer _stockCheckSvc;//盘点单Svc |
| | | private readonly IPdaCrServer _daCrSvc;//PDA |
| | | public UpApiController(IOptions<ApiUrlConfig> setting,IExportNoticeServer exNoticeSvc,IArrivalNoticeServer arrivalNoticeServer,IStockCheckServer stockCheckSvc,IPdaCrServer daCrSvc) |
| | | private readonly IStockServer _stock; //库存 |
| | | public UpApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IArrivalNoticeServer arrivalNoticeServer, IStockCheckServer stockCheckSvc, IPdaCrServer daCrSvc, IStockServer stock) |
| | | { |
| | | _config = setting.Value; |
| | | _exNoticeSvc = exNoticeSvc; |
| | | _arrivalNoticeSvc = arrivalNoticeServer; |
| | | _stockCheckSvc = stockCheckSvc; |
| | | _daCrSvc = daCrSvc; |
| | | _stock = stock; |
| | | } |
| | | #endregion |
| | | |
| | |
| | | /// <param name="model">入库单号</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult FinishAsn(FinshVm model) |
| | | public IActionResult FinishAsn(FinshVm model) |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | return Ok(new { code = 1, msg = "未获取到当前操作人信息" }); |
| | | } |
| | | _arrivalNoticeSvc.FinishAsn(model.Id, _config.ErpHost + _config.AsnFinishUrl, _config.MesHost + _config.MesAsnFinishUrl, _config.MesHost + _config.MesGetTokenUrl,model.UserNo,model.Password, int.Parse(userId)); |
| | | _arrivalNoticeSvc.FinishAsn(model.Id, _config.ErpHost + _config.AsnFinishUrl, _config.MesHost + _config.MesAsnFinishUrl, _config.MesHost + _config.MesGetTokenUrl, model.UserNo, model.Password, int.Parse(userId)); |
| | | |
| | | return Ok(new { code = 0, count = 0, msg = "入库单复核并上传成功" }); |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [HttpPost] |
| | | public IActionResult FinishExportNotice(FinshVm model) |
| | | { |
| | | try |
| | |
| | | /// <summary> |
| | | /// 下发AGV调度任务 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <param name="type"></param> |
| | | /// <param name="taskno"></param> |
| | | /// <param name="positionStart"></param> |
| | | /// <param name="positionEnd"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult AGVTask(string type, string taskno, string positionStart, string positionEnd) |
| | | { |
| | | try |
| | | { |
| | | |
| | | OutCommanAgvDto agvRequest = _daCrSvc.AGVTask(type,taskno,positionStart,positionEnd, _config.AgvHost + _config.GenAgvSchedulingTask); |
| | | |
| | | OutCommanAgvDto agvRequest = _daCrSvc.AGVTask(type, taskno, positionStart, positionEnd, _config.AgvHost + _config.GenAgvSchedulingTask); |
| | | if (agvRequest.Code != "0") |
| | | { |
| | | return Ok(new { code = 1, msg = "小车任务执行失败" }); |
| | |
| | | /// <summary> |
| | | /// 下发AGV取消任务 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <param name="taskno"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult cancelTask(string taskno) |
| | |
| | | [HttpPost] |
| | | public IActionResult CreateAsn(AsnInfo model) |
| | | { |
| | | // liudl Test |
| | | var result = new HttpReturnModel { Success = "-1", Message = "" }; |
| | | var logStr = ""; |
| | | if (model.Origin == "MES") |
| | |
| | | { |
| | | logStr = $@".\log\ERP\入库单下发" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | } |
| | | |
| | | |
| | | try |
| | | { |
| | | //log日志记录 |
| | |
| | | { |
| | | logStr = $@".\log\MES\出库单下发" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | } |
| | | else if(model.Origin == "ERP") |
| | | else if (model.Origin == "ERP") |
| | | { |
| | | logStr = $@".\log\ERP\出库单下发" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | } |
| | | |
| | | |
| | | try |
| | | { |
| | | //log日志记录 |
| | | if (logStr!="") |
| | | if (logStr != "") |
| | | { |
| | | var jsonData = JsonConvert.SerializeObject(model); |
| | | LogFile.SaveLogToFile($"出库单下发:( {jsonData} ),", logStr); |
| | | } |
| | | |
| | | |
| | | _exNoticeSvc.HttpAddExportNotice(model); |
| | | |
| | | var data = new HttpReturnModel { Success = "0", Message = "成功" }; |
| | |
| | | } |
| | | |
| | | return Ok(data); |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | var data = new HttpReturnModel { Success = "-1", Message = "失败"+e.Message }; |
| | | var data = new HttpReturnModel { Success = "-1", Message = "失败" + e.Message }; |
| | | if (logStr != "") |
| | | { |
| | | var jsonData = JsonConvert.SerializeObject(data); |
| | |
| | | /// <summary> |
| | | /// 释放备料区储位状态JC24 |
| | | /// </summary> |
| | | /// <param name="model">状态信息</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult UpLocate(UpLocateModel model) |
| | |
| | | var jsonData = JsonConvert.SerializeObject(model); |
| | | LogFile.SaveLogToFile($"释放备料区储位状态:( {jsonData} ),", logStr); |
| | | } |
| | | _arrivalNoticeSvc.UpLocate(model.WareHouseNo,model.LocatNo); |
| | | _arrivalNoticeSvc.UpLocate(model.WareHouseNo, model.LocatNo); |
| | | |
| | | var data = new HttpReturnModel { Success = "0", Message = "成功" }; |
| | | |
| | |
| | | LogFile.SaveLogToFile($"释放备料区储位状态返回参数:( {jsonData} ),", logStr); |
| | | } |
| | | return Ok(data); |
| | | |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | //包装信息接口 |
| | | |
| | | |
| | | /// <summary> |
| | | /// 数字孪生系统库存质量状态反馈 |
| | | /// </summary> |
| | | /// <param name="model">来源信息</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult ReLocateData(DigitalTwinModel model) |
| | | { |
| | | //记录log |
| | | var logStr = ""; |
| | | logStr = $@".\log\数字孪生\库位信息及质量状态反馈" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | var jsonData = JsonConvert.SerializeObject(model); |
| | | LogFile.SaveLogToFile($"库位信息及质量状态反馈:( {jsonData} ),", logStr); |
| | | |
| | | //获取库存信息 |
| | | List<ReLocateDataModel> stocks = _stock.GetLocateList(); |
| | | |
| | | if (stocks.Count == 0) |
| | | { |
| | | var data = new HttpReturnModel { Success = "0", Message = "当前无库存" }; |
| | | return Ok(data); |
| | | } |
| | | return Ok(stocks); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 数字孪生系统库存质量状态反馈 |
| | | /// </summary> |
| | | /// <param name="model">来源信息</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult ReLogData(DigitalTwinModel model) |
| | | { |
| | | |
| | | //记录log |
| | | var logStr = ""; |
| | | logStr = $@".\log\数字孪生\操作日志信息反馈" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | var jsonData = JsonConvert.SerializeObject(model); |
| | | LogFile.SaveLogToFile($"操作日志信息反馈:( {jsonData} ),", logStr); |
| | | try |
| | | { |
| | | //获取库存信息 |
| | | List<OperationDto> stocks = _stock.ReLogData(); |
| | | |
| | | if (stocks.Count == 0) |
| | | { |
| | | var data = new HttpReturnModel { Success = "0", Message = "当前无操作信息" }; |
| | | return Ok(data); |
| | | } |
| | | return Ok(stocks); |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | var data = new HttpReturnModel { Success = "0", Message = "失败:" + e.Message }; |
| | | if (logStr != "") |
| | | { |
| | | jsonData = JsonConvert.SerializeObject(data); |
| | | LogFile.SaveLogToFile($"操作日志信息反馈,返回参数:( {jsonData} ),", logStr); |
| | | } |
| | | return Ok(data); |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | } |