| | |
| | | private readonly IPdaSoServer _pdaSoSvc;//空托出库Svc |
| | | private readonly IPdaAsnServer _paAsnSvc;//空托跺绑定 |
| | | private readonly IStockServer _stockSvc;//AGV任务完成箅 |
| | | private readonly IPdaCrServer _pdaCrServer; // PDA任务调度 |
| | | |
| | | public DownApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IPalletBindServer asnPalletBindSvc, IStockCheckServer crCheckSvc, ITaskServer taskSvc, IPdaSoServer pdaSoSvc,IPdaAsnServer paAsnSvc,IStockServer stockSvc) |
| | | public DownApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IPalletBindServer asnPalletBindSvc, IStockCheckServer crCheckSvc, ITaskServer taskSvc, IPdaSoServer pdaSoSvc,IPdaAsnServer paAsnSvc,IStockServer stockSvc,IPdaCrServer pdaCrServer) |
| | | { |
| | | _config = setting.Value; |
| | | _exNoticeSvc = exNoticeSvc; |
| | |
| | | _taskSvc = taskSvc; |
| | | _pdaSoSvc = pdaSoSvc; |
| | | _paAsnSvc = paAsnSvc; |
| | | _stockSvc = stockSvc; |
| | | _stockSvc = stockSvc; |
| | | _pdaCrServer = pdaCrServer; |
| | | } |
| | | |
| | | #region WMS接口 调用下游系统接口 |
| | |
| | | [HttpPost] |
| | | public IActionResult BindPlnInHouseWcs(PalletsBind model) |
| | | { |
| | | var logStr = $@".\log\WCS\WCS申请空托跺绑定" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | var logStr = $@".\log\WCS\WCS又叠托机申请空托入库" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | try |
| | | { |
| | | var strMsg = _paAsnSvc.BindNullPallets(model); |
| | | |
| | | return Ok(new { Success = 0, Message = "空托跺绑定成功", TaskList = strMsg }); |
| | | return Ok(new { Success = 0, Message = "空托跺绑定成功"}); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | catch (Exception e) |
| | | { |
| | | LogFile.SaveLogToFile($"WCS申请空托出库异常返回:( {e.Message} ),", logStr); |
| | | |
| | | return Ok(new ErpModel { Success = -1, Message = e.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// WMS拣货申请空托出库 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [AllowAnonymous] |
| | | [HttpPost] |
| | | public IActionResult IssuePlnCheckHouseWcs(CheckModePalletVm model) |
| | | { |
| | | var logStr = $@".\log\WCS\WMS拣货申请空托出库" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | try |
| | | { |
| | | string list = _pdaSoSvc.IssuePlnCehckHouseWcs(model, 0,_config.AgvHost+_config.GenAgvSchedulingTask); |
| | | |
| | | return Ok(new { Success = 0, Message = "拣货叫空托盘成功"}); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogFile.SaveLogToFile($"WMS拣货申请空托出库异常返回:( {e.Message} ),", logStr); |
| | | |
| | | return Ok(new ErpModel { Success = -1, Message = e.Message }); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 成品箱码拆垛拣货 |
| | | /// </summary> |
| | | /// <param name="model">入库单信息</param> |
| | | /// <returns></returns> |
| | | [AllowAnonymous] |
| | | [HttpPost] |
| | | public IActionResult ResultBoxInfoExportWcs(BoxInfoCheck model) |
| | | { |
| | | var logStr = $@".\log\WCS\WCS申请成品箱码拆垛拣货信息" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | try |
| | | { |
| | | //返回出库分拣装车口 |
| | | var list = _exNoticeSvc.BoxInfoExportWcs(model.BoxNo); |
| | | return Ok(new { Success = "1", Message = "成品箱码拆垛拣货成功", loadubgAddre = list }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogFile.SaveLogToFile($"WCS申请成品箱码拆垛拣货异常返回:( {e.Message} ),", logStr); |
| | | |
| | | return Ok(new { Success = "-1", Message = e.Message, loadubgAddre ="" }); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region AGV |
| | | |
| | |
| | | var time1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | //测试接口用 |
| | | var orderType = _taskSvc.GetTaskOrderType(model.TaskCode,"0");// 判断单据类型入出移 |
| | | var orderType = _taskSvc.GetTaskOrderType(model.TaskCode, "0");// 判断单据类型入出移 |
| | | |
| | | var taskType = _taskSvc.GetTaskType(model.TaskCode);//根据任务号获取任务类型 |
| | | switch (orderType) |
| | | { |
| | | case "0"://入库任务执行 |
| | | if (model.TaskTyp == "mid") //AGV到达入库口,请求放货 |
| | | if (model.Method == "mid") //AGV到达入库口,请求放货 |
| | | { |
| | | //下发WCS放货请求 |
| | | |
| | | var ret = _taskSvc.GetWcsPuttype(model.TaskCode,_config.WcsHost + _config.HttpInRequest); |
| | | if (ret.Contains("-1")) |
| | | { |
| | | logStr = $@".\log\WCS\任务反馈" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | LogFile.SaveLogToFile($"放货请求WCS失败,反馈执行通知:( {model.CurrentCallCode} ),", logStr); |
| | | return Ok(new OutCommanAgvDto { Code = "1", Message = "失败", ReqCode = model.ReqCode }); |
| | | } |
| | | } |
| | | else if (model.TaskTyp == "end")//AGV放货到入库口完成 |
| | | else if (model.Method == "end")//AGV放货到入库口完成 |
| | | { |
| | | _stockSvc.ArriveFinish(model.TaskCode); |
| | | _stockSvc.ArriveFinish(model.TaskCode,_config.WcsHost + _config.HttpInFinish); |
| | | } |
| | | |
| | | |
| | | break; |
| | | |
| | | case "1"://出库任务执行 |
| | | _stockSvc.SoFinish(model.TaskCode); |
| | | _stockSvc.SoFinish(model.TaskCode,_config.MesHost + _config.MesBeiLiaoUrl); |
| | | break; |
| | | |
| | | case "2"://盘库任务执行 |
| | | |
| | | case "3"://移库任务执行 |
| | | _stockSvc.MoveFinish(model.TaskCode); |
| | | _stockSvc.MoveFinish(model.TaskCode, _config.MesHost + _config.MesBeiLiaoUrl); |
| | | break; |
| | | // return Ok(new OutCommanAgvDto { Code = "0", Message = "成功", ReqCode = model.ReqCode }); |
| | | |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return Ok(new WcsModel |
| | | return Ok(new OutCommanAgvDto |
| | | { |
| | | StatusCode = -1, |
| | | Msg = ex.Message |
| | | Code = "1", |
| | | Message = ex.Message |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 任务继续执行接口 |
| | | /// 调用AGV任务模板continueTask,WCS调用接口返回该工位可放信号 |
| | | /// </summary> |
| | | /// <param name="model">入库口信息</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult AgcontinueTask(PutModel model) |
| | | { |
| | | try |
| | | { |
| | | //记录log |
| | | var logStr = $@".\log\WCS\任务反馈" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | var jsonData = JsonConvert.SerializeObject(model); |
| | | LogFile.SaveLogToFile($"WCS任务反馈执行通知:( {jsonData} ),", logStr); |
| | | |
| | | //下发AGV继续执行 |
| | | _pdaCrServer.AgvContinue(model.TaskNo,_config.AgvHost+_config.ContinueTask); |
| | | |
| | | |
| | | return Ok(new HttpReturnModel { Success = "0", Message = "成功"}); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return Ok(new HttpReturnModel { Success = "1", Message = ex.ToString() }); |
| | | throw ex; |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region PDA |
| | | |