| | |
| | | /// </summary> |
| | | public int? QtyCount { get; set; } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | /// </summary> |
| | | public class PutModel |
| | | { |
| | | public string TaskNo { get; set; } |
| | | |
| | | |
| | | public string Port { get; set; } |
| | | public string TaskNo { get; set; } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// Wms专用 下发指令Dto |
| | |
| | | //请求WCS入库口放货确认 |
| | | try |
| | | { |
| | | var res = HttpHelper.DoPost(wcsurl, EndLocat, "请求WCS入库口是否可放货", "WCS"); |
| | | var port = new |
| | | { |
| | | Port = EndLocat |
| | | }; |
| | | var json = JsonConvert.SerializeObject(port); |
| | | var res = HttpHelper.DoPost(wcsurl, json, "请求WCS入库口是否可放货", "WCS"); |
| | | |
| | | //////解析返回数据 |
| | | var ret = JsonConvert.DeserializeObject<WcsModel>(res); |
| | | if (ret.StatusCode == -1) |
| | | { |
| | | throw new Exception(EndLocat + "入库口已有其他任务占用,请选择其他入库口"); |
| | | throw new Exception(EndLocat + "号入库口已有其他任务占用,请选择其他入库口"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public void AgvContinue(string taskno,string url) |
| | | { |
| | | var data = new { reqCode =taskno }; |
| | | var jsonData = JsonConvert.SerializeObject(data); |
| | | try |
| | | { |
| | | var response = HttpHelper.DoPost(url, jsonData, "下发给AGV继续执行命令", "AGV"); |
| | | |
| | | //////解析返回数据 |
| | | var agvModel = JsonConvert.DeserializeObject<OutCommanAgvDto>(response); |
| | | if (agvModel.Code == "1") |
| | | { |
| | | throw new Exception(agvModel.Message); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 人工转运 |
| | |
| | | using System.Linq; |
| | | using System.Runtime.Intrinsics.X86; |
| | | using System.Security.Claims; |
| | | using System.Security.Policy; |
| | | using System.Text; |
| | | using Model.InterFaceModel; |
| | | using Model.ModelDto; |
| | | using Model.ModelDto.DataDto; |
| | | using Model.ModelDto.SysDto; |
| | | using Model.ModelVm.DataVm; |
| | | using Newtonsoft.Json; |
| | | using SqlSugar; |
| | | using Utility.Tools; |
| | | using WMS.BLL.LogServer; |
| | | using WMS.DAL; |
| | | using WMS.Entity.BllSoEntity; |
| | | using WMS.Entity.Context; |
| | |
| | | /// AGV入库完成 |
| | | /// </summary> |
| | | /// <param name="TaskCode">任务号</param> |
| | | /// <param name="wcsurl">下发WCS放货完成地址</param> |
| | | /// <returns></returns> |
| | | public void ArriveFinish(string TaskCode) |
| | | public void ArriveFinish(string TaskCode,string wcsurl) |
| | | { |
| | | try |
| | | { |
| | |
| | | stockDetail.WareHouseNo = ""; |
| | | Db.Updateable(stockDetail).ExecuteCommand(); |
| | | |
| | | //下发WCS申请入库 |
| | | #region 下发WCS放货完成 |
| | | var data = new |
| | | { |
| | | Port = palletNo.EndLocat |
| | | }; |
| | | var jsonData = JsonConvert.SerializeObject(data); |
| | | string response = ""; |
| | | try |
| | | { |
| | | var time1 = DateTime.Now;//发送时间 .ToString("yyyy-MM-dd HH:mm:ss") |
| | | response = HttpHelper.DoPost(wcsurl, jsonData, "下发给WCS放货完成命令", "WCS"); |
| | | var time2 = DateTime.Now;//返回时间 .ToString("yyyy-MM-dd HH:mm:ss") |
| | | |
| | | //////解析返回数据 |
| | | var res = JsonConvert.DeserializeObject<WcsModel>(response); |
| | | if (res.StatusCode == -1) |
| | | { |
| | | throw new Exception("放货失败,WCS返回信息错误"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | Db.CommitTran(); |
| | |
| | | /// <summary> |
| | | /// 反馈数字孪生系统库存信息 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <param name=""></param> |
| | | /// <returns></returns> |
| | | public List<ReLocateData> GetLocateList() |
| | | { |
| | |
| | | /// <param name="port"></param> 入库口 |
| | | /// <param name="url"></param> 请求地址 |
| | | /// <returns></returns> |
| | | public string GetWcsPuttype(string port,string url) |
| | | public string GetWcsPuttype(string taskno,string port,string url) |
| | | { |
| | | try |
| | | { |
| | | var res = HttpHelper.DoPost(url, port, "请求WCS"+ port+"入库口放货", "WCS"); |
| | | var data = new |
| | | { |
| | | Port = port, |
| | | TaskNo = taskno |
| | | }; |
| | | var jsonData = JsonConvert.SerializeObject(data); |
| | | var res = HttpHelper.DoPost(url, jsonData, "请求WCS"+ port+"入库口放货", "WCS"); |
| | | |
| | | //////解析返回数据 |
| | | var ret = JsonConvert.DeserializeObject<WcsModel>(res); |
| | | return ret.Msg.ToString(); |
| | | return ret.StatusCode.ToString(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | /// <param name="skuNo">物料编码</param> |
| | | /// <param name="skuName">物料名称</param> |
| | | /// <returns></returns> |
| | | public void ArriveFinish(string TaskCode); |
| | | public void ArriveFinish(string TaskCode,string wcsrurl); |
| | | /// <summary> |
| | | /// 出库任务完成 |
| | | /// </summary> |
| | |
| | | /// <returns>0 入库任务 1 出库任务 2移库任务</returns> |
| | | public string GetTaskType(string taskNo); |
| | | |
| | | public string GetWcsPuttype(string port,string url); |
| | | public string GetWcsPuttype(string taskno,string port,string url); |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | public void cancelTask(string taskno, string url); |
| | | |
| | | public void AgvContinue(string taskno,string url); |
| | | |
| | | #endregion |
| | | |
| | | #region 人工转运 |
| | |
| | | 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接口 调用下游系统接口 |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | if (model.TaskTyp == "mid") //AGV到达入库口,请求放货 |
| | | { |
| | | //下发WCS放货请求 |
| | | var ret = _taskSvc.GetWcsPuttype(model.CurrentCallCode,_config.WcsHost + _config.MesBeiLiaoUrl); |
| | | var ret = _taskSvc.GetWcsPuttype(model.TaskCode,model.CurrentCallCode,_config.WcsHost + _config.HttpInRequest); |
| | | if (ret.Contains("-1")) |
| | | { |
| | | logStr = $@".\log\WCS\任务反馈" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | |
| | | } |
| | | else if (model.TaskTyp == "end")//AGV放货到入库口完成 |
| | | { |
| | | _stockSvc.ArriveFinish(model.TaskCode); |
| | | _stockSvc.ArriveFinish(model.TaskCode,_config.WcsHost + _config.HttpInFinish); |
| | | |
| | | |
| | | } |
| | | |
| | | break; |
| | |
| | | var jsonData = JsonConvert.SerializeObject(model); |
| | | LogFile.SaveLogToFile($"WCS任务反馈执行通知:( {jsonData} ),", logStr); |
| | | |
| | | //下发AGV入库任务 |
| | | var taskType = _taskSvc.GetTaskType(model.TaskNo); |
| | | //下发AGV继续执行 |
| | | _pdaCrServer.AgvContinue(model.TaskNo,_config.AgvHost+_config.ContinueTask); |
| | | |
| | | |
| | | return Ok(new OutCommanAgvDto { Code = "0", Message = "成功"}); |
| | |
| | | } |
| | | |
| | | var uId = int.Parse(userId); |
| | | _pdaCrSvc.AgvTransport(model.PalletNo, model.AreaNo, model.Ruku, uId, _config.AgvHost + _config.GenAgvSchedulingTask,_config.WcsHost + _config.BoxHost); |
| | | _pdaCrSvc.AgvTransport(model.PalletNo, model.AreaNo, model.Ruku, uId, _config.AgvHost + _config.GenAgvSchedulingTask,_config.WcsHost + _config.HttpInConfirm); |
| | | |
| | | return Ok(new { data = "", code = 0, msg = "成功" }); |
| | | } |
| | |
| | | /// <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) |
| | |
| | | /// <summary> |
| | | /// 下发AGV取消任务 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <param name="taskno"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult cancelTask(string taskno) |
| | |
| | | /// <summary> |
| | | /// 释放备料区储位状态JC24 |
| | | /// </summary> |
| | | /// <param name="model">状态信息</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult UpLocate(UpLocateModel model) |
| | |
| | | /// <summary> |
| | | /// 数字孪生系统库存质量状态反馈 |
| | | /// </summary> |
| | | /// <param name="model">来源信息</param> |
| | | /// <returns></returns> |
| | | public IActionResult ReLocateData(DigitalTwinModel model) |
| | | { |
| | |
| | | /// <summary> |
| | | /// //给WCS下发入库单信息 |
| | | /// </summary> |
| | | public string AddOrderTaskUrl { get; set; } |
| | | public string AddOrderTaskUrl { get; set; } |
| | | /// <summary> |
| | | /// //给WCS下发小车入库确认 |
| | | /// </summary> |
| | | |
| | | public string HttpInConfirm { get; set; } |
| | | /// <summary> |
| | | /// //给WCS下发小车入库请求 |
| | | /// </summary> |
| | | public string HttpInRequest { get; set; } |
| | | /// <summary> |
| | | /// //给WCS下发小车入库完成 |
| | | /// </summary> |
| | | public string HttpInFinish { get; set; } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | "IssueComApiUrl": "/api/demo/wcsTasks", //下发命令(出库、移库) |
| | | "IssueComApiUrl2": "/api/demo/wcsTask", //"/api/WCSApi/AddTask", //重新下发命令(出库、移库) |
| | | "AddOrderTaskUrl": "/api/demo/orderTask", //WMS给WCS下发的入库单任务 |
| | | "HttpInConfirm": "/api/demo/HttpInConfirm", //WMS给WCS下发AGV入库请求 |
| | | "HttpInRequest": "/api/demo/HttpInRequest", //WMS给WCS下发AGV入库确认 |
| | | "HttpInFinish": "/api/demo/HttpInFinish", //WMS给WCS下发的AGV入库完成 |
| | | |
| | | // ERP |
| | | "AsnFinishUrl": "/api/wmsInterface/OutStockTask", //入库订单关闭 |
| | |
| | | |
| | | // AGV |
| | | "GenAgvSchedulingTask": "/rcms/services/rest/hikRpcService/genAgvSchedulingTask", //生成任务单接口 |
| | | "CancelTask": "/rcms/services/rest/hikRpcService/cancelTask",//取消任务接口 |
| | | "CancelTask": "/rcms/services/rest/hikRpcService/cancelTask", //取消任务接口 |
| | | "ContinueTask": "/rcms/services/rest/hikRpcService/continueTask", //继续执行任务接口 |
| | | "GenPreScheduleTask": "/rcms/services/rest/hikRpcService/genPreScheduleTask" // 预调度对外接口 |
| | | }, |