| | |
| | | <label class="layui-form-label" style="width: 80px;">规格</label> |
| | | <div class="layui-input-block"> |
| | | <select name="Standard" lay-filter="Standard" lay-search> |
| | | <option value="400">400L</option> |
| | | <option value="800">800L</option> |
| | | <option value="1000">1000L</option> |
| | | <option value="400L">400L</option> |
| | | <option value="800L">800L</option> |
| | | <option value="1000L">1000L</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">所属接料设备</label> |
| | | <label class="layui-form-label">桶规格(L)</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="DeviceCode" placeholder="请输入所属接料设备" lay-verify="" autocomplete="off" class="layui-input"> |
| | | <input type="text" name="DeviceCode" placeholder="请输入桶规格" lay-verify="required" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item layui-hide"> |
| | |
| | | } |
| | | public class carrierInfo |
| | | { |
| | | /// <summary> |
| | | /// 载具类型 |
| | | /// </summary> |
| | | public string carrierType { get; set; } |
| | | ///// <summary> |
| | | ///// 载具类型 |
| | | ///// </summary> |
| | | //public string carrierType { get; set; } |
| | | /// <summary> |
| | | /// 载具编号 |
| | | /// </summary> |
| | | public string carrierCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 站点编号 |
| | | /// </summary> |
| | | public string siteCode { get; set; } |
| | | /// <summary> |
| | | /// 层号: 从 0 开始、从下往上编号 |
| | | /// </summary> |
| | | public int layer { get; set; } |
| | | //public int layer { get; set; } |
| | | /// <summary> |
| | | /// 站点编号 |
| | | /// </summary> |
| | | public int? carrierDir { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 站点编号 |
| | | /// </summary> |
| | | public object extra { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public class AgvTaskDto |
| | | { |
| | | /// <summary> |
| | | /// 请求编号,每个请求都要一个唯一编号 |
| | | /// 同一个请求重复提交 使用同一编号 |
| | | /// 是否必填:是 |
| | | /// 任务号 |
| | | /// </summary> |
| | | public string reqCode { get; set; } |
| | | public string robotTaskCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 请求时间戳 |
| | | /// 格式: “yyyy-MM-ddHH:mm:ss” |
| | | /// 是否必填:是 |
| | | /// 当前执行任务的机器人唯一标识 |
| | | /// </summary> |
| | | public string reqTime { get; set; } |
| | | public string singleRobotCode { get; set; } |
| | | |
| | | public int currentSeq { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 地码 X 坐标(mm):任务完成时有值 |
| | | /// 是否必填:否 |
| | | /// 自定义扩展字段 |
| | | /// </summary> |
| | | public double cooX { get; set; } |
| | | public ExtraModel extra { get; set; } |
| | | } |
| | | |
| | | |
| | | public class ExtraModel |
| | | { |
| | | public string async { get; set; } = "0"; |
| | | |
| | | /// <summary> |
| | | /// 地码 Y 坐标(mm):任务完成时有值 |
| | | /// 是否必填:否 |
| | | /// 回调数据对象 |
| | | /// </summary> |
| | | public double cooY { get; set; } |
| | | public ExtraModelView values { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 当前位置编号 |
| | | /// 任务开始:该位置为任务起点 |
| | | /// 走出储位:该位置为任务起点 |
| | | /// 任务单取消:该位置为工作位编号 |
| | | /// 任务结束:该位置为任务终点 |
| | | /// 取放申请:取放料箱的点 |
| | | /// 是否必填:是 |
| | | /// </summary> |
| | | public string currentPositionCode { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 自定义字段,不超过 2000 个字符 |
| | | /// 是否必填:否 |
| | | /// </summary> |
| | | public string data { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 回调参数 |
| | | /// </summary> |
| | | public class ExtraModelView |
| | | { |
| | | /// <summary> |
| | | /// 地图编号 |
| | | /// 是否必填:否 |
| | | /// </summary> |
| | | public string mapCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 地码编号:任务完成时有值 |
| | | /// 是否必填:否 |
| | | /// </summary> |
| | | public string mapDataCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 仓位编号:叉车与 CTU 任务时有值 |
| | | /// 是否必填:否 |
| | | /// </summary> |
| | | public string stgBinCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 方法名, 可使用任务类型做为方法名 |
| | | /// 由 RCS-2000 任务模板配置后并告知上层系统 |
| | | /// 默认使用方式: |
| | | /// start : 任务开始 |
| | | /// outbin : 走出储位 |
| | | /// end : 任务结束 |
| | | /// cancel : 任务单取消 |
| | | /// apply:CTU 料箱取放申请 |
| | | /// 是否必填:是 |
| | | /// 回调任务 |
| | | /// <para> start:任务开始,outbin:走出储位,end:任务完成</para> |
| | | /// </summary> |
| | | public string method { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 货架编号:背货架时有值 |
| | | /// 是否必填:否 |
| | | /// 载具编号 |
| | | /// </summary> |
| | | public string podCode { get; set; } |
| | | public string carrierCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 别对应地图的任务完成时有值 |
| | | /// 左: 180 |
| | | /// 右: 0 |
| | | /// 上: 90 |
| | | /// 下: -90 |
| | | /// 是否必填:否 |
| | | /// 载具名称 |
| | | /// </summary> |
| | | public string podDir { get; set; } |
| | | public string carrierName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 物料编号 |
| | | /// 是否必填:否 |
| | | /// 载具类型 |
| | | /// </summary> |
| | | public string materialLot { get; set; } |
| | | public string carrierType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// AGV 编号(同 agvCode ) |
| | | /// 是否必填:否 |
| | | /// 载具种类 |
| | | /// </summary> |
| | | public string robotCode { get; set; } |
| | | public string carrierCategory { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 当前任务单号 |
| | | /// 是否必填:是 |
| | | /// 当前站点编号 |
| | | /// </summary> |
| | | public string taskCode { get; set; } |
| | | public string slotCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 工作位,与 RCS-2000 端配置的位置名称一致。任务完成时有值,与生成任务单接口中的 wbCode 一致 |
| | | /// 是否必填:否 |
| | | /// 站点别名 |
| | | /// <para>1.走出储位:起点。2.任务完成:目标点</para> |
| | | /// </summary> |
| | | public string wbCode { get; set; } |
| | | public string slotName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 容器编号 |
| | | /// 是否必填:否 |
| | | /// 存储类型(BIN:仓位,SITE:站点) |
| | | /// </summary> |
| | | public string ctnrCode { get; set; } |
| | | public string slotCategory { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 容器类型 |
| | | /// 是否必填:否 |
| | | /// x坐标 |
| | | /// </summary> |
| | | public string ctnrType { get; set; } |
| | | public decimal? x { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 巷道编号 |
| | | /// 是否必填:否 |
| | | /// y坐标 |
| | | /// </summary> |
| | | public string roadWayCode { get; set; } |
| | | public decimal? y { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 巷道内顺序号 |
| | | /// 巷道尾是 0,到巷道头依次递增 1 |
| | | /// 是否必填:否 |
| | | /// 机器人种类 |
| | | /// </summary> |
| | | public string seq { get; set; } |
| | | public string amrCategory { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 设备编号,如梳齿式工作站、输送线等,一般使用于 CTU 场景。系统根据仓位定位到关联的设备编号。 |
| | | /// 是否必填:否 |
| | | /// 机器人类型 |
| | | /// </summary> |
| | | public string eqpCode { get; set; } |
| | | public string amrType { get; set; } |
| | | |
| | | |
| | | public int? pileCount { get; set; } |
| | | public int? layerNo { get; set; } |
| | | public string amrCode { get; set; } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// WMS回应AGV信息 |
| | | /// </summary> |
| | | public class OutCommanAgvDto |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// WMS回应AGV信息 |
| | | /// </summary> |
| | | public class OutCommanAgvDto |
| | | { |
| | | /// <summary> |
| | | /// 返回码 |
| | |
| | | public string data { get; set; } |
| | | public string reqCode { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// agv请求接口应答 |
| | | /// </summary> |
| | | public class AgvResultModel2 |
| | | { |
| | | public string code { get; set; } |
| | | public string message { get; set; } |
| | | public Data da { get; set; } |
| | | } |
| | | public class Data |
| | | { |
| | | public string robotTaskCode { get; set; } |
| | | #endregion |
| | | } |
| | |
| | | using Model.InterFaceModel; |
| | | using SqlSugar; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using ZXing; |
| | | using static Model.InterFaceModel.RCSModel; |
| | | using WMS.Entity.Context; |
| | | using WMS.Entity.SysEntity; |
| | | |
| | | namespace Utility.Tools |
| | | { |
| | | public static class RcsHelper |
| | | { |
| | | private static readonly SqlSugarScope Db = DataContext.Db; |
| | | /// <summary> |
| | | /// 下发任务 |
| | | /// </summary> |
| | |
| | | public static bool CreateTaskForAgv(TaskDetial taskDetial, string url, out string agvMsg, string priority = null) |
| | | { |
| | | bool result = false; |
| | | var tasktype = "F12"; |
| | | |
| | | //跨楼层任务tasktype值赋值…… |
| | | //tasktype = ""; |
| | | |
| | | List<targetRoute> pahtList = new List<targetRoute>(); |
| | | //起始位置 |
| | | targetRoute royte1 = new targetRoute(); |
| | | royte1.seq = 0; |
| | | royte1.type = "ZONE"; |
| | | royte1.type = "SITE"; |
| | | royte1.code = taskDetial.Startport; |
| | | |
| | | pahtList.Add(royte1); |
| | |
| | | //目标位置 |
| | | targetRoute royte2 = new targetRoute(); |
| | | royte2.seq = 0; |
| | | royte2.type = "ZONE"; |
| | | royte2.type = "SITE"; |
| | | royte2.code = taskDetial.Endport; |
| | | |
| | | pahtList.Add(royte2); |
| | | |
| | | AgvCreateTaskModel taskModel = new AgvCreateTaskModel(); |
| | | taskModel.taskType = "PF-LMR-COMMON"; |
| | | taskModel.taskType = tasktype; |
| | | taskModel.targetRoute = pahtList; |
| | | |
| | | //AGV任务下发时增加hearder:X-LR-REQUEST-ID,值为随机数 |
| | | long ran = DateTime.Now.Ticks; |
| | | Dictionary<string, string> key = new Dictionary<string, string>(); |
| | | key.Add("X-LR-REQUEST-ID", ran.ToString()); |
| | | |
| | | // 正式运行程序放开 |
| | | var jsonData = JsonConvert.SerializeObject(taskModel); |
| | | string response = HttpHelper.DoPost(url, jsonData, "下发给AGV转运命令", "AGV"); |
| | | string response = HttpHelper.DoPost(url, jsonData, "下发给AGV转运命令", "AGV", key); |
| | | //解析返回数据 |
| | | var agvModel = JsonConvert.DeserializeObject<OutCommanAgvDto>(response); |
| | | if (agvModel.Code == "0") |
| | |
| | | |
| | | return result; |
| | | } |
| | | /// <summary> |
| | | /// 下发AGV绑定载具和站点 |
| | | /// </summary> |
| | | /// <param name="palletNo">桶号L</param> |
| | | /// <param name="url">请求地址</param> |
| | | /// <param name="agvMsg">返回信息</param> |
| | | /// <param name="locateNo">返回信息</param> |
| | | /// <returns></returns> |
| | | public static bool BindPalletAndSite(string palletNo,string locateNo,string url,out string agvMsg) |
| | | { |
| | | |
| | | bool result = false; |
| | | carrierInfo carrierInfo = new carrierInfo(); |
| | | carrierInfo.carrierCode = palletNo; |
| | | carrierInfo.siteCode = locateNo; |
| | | |
| | | //AGV任务下发时增加hearder:X-LR-REQUEST-ID,值为随机数 |
| | | long ran = DateTime.Now.Ticks; |
| | | Dictionary<string, string> key = new Dictionary<string, string>(); |
| | | key.Add("X-LR-REQUEST-ID", ran.ToString()); |
| | | |
| | | // 正式运行程序放开 |
| | | var jsonData = JsonConvert.SerializeObject(carrierInfo); |
| | | string response = HttpHelper.DoPost(url, jsonData, "下发给AGV绑定载具命令", "AGV", key); |
| | | //解析返回数据 |
| | | var agvModel = JsonConvert.DeserializeObject<OutCommanAgvDto>(response); |
| | | if (agvModel.Code == "0") |
| | | { |
| | | result = true;//给下车下发任务成功 |
| | | |
| | | agvMsg = ""; |
| | | } |
| | | else |
| | | { |
| | | var logStr = $@".\log\AGV\下发给AGV绑定载具命令" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | LogFile.SaveLogToFile($"下发给AGV绑定载具命令异常:( {agvModel.Message} ),", logStr); |
| | | |
| | | agvMsg = agvModel.Message; |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下发AGV解绑载具和站点 |
| | | /// </summary> |
| | | /// <param name="palletType">容器类型1:400L,2:800/1000L</param> |
| | | /// <param name="url">请求地址</param> |
| | | /// <param name="agvMsg">返回信息</param> |
| | | /// <param name="locateNo">返回信息</param> |
| | | /// <returns></returns> |
| | | public static bool UnBindPalletAndSite(string palletType, string locateNo,string url, out string agvMsg) |
| | | { |
| | | bool result = false; |
| | | carrierInfo carrierInfo = new carrierInfo(); |
| | | carrierInfo.carrierCode = palletType; |
| | | carrierInfo.siteCode = locateNo; |
| | | |
| | | //AGV任务下发时增加hearder:X-LR-REQUEST-ID,值为随机数 |
| | | long ran = DateTime.Now.Ticks; |
| | | Dictionary<string, string> key = new Dictionary<string, string>(); |
| | | key.Add("X-LR-REQUEST-ID", ran.ToString()); |
| | | |
| | | // 正式运行程序放开 |
| | | var jsonData = JsonConvert.SerializeObject(carrierInfo); |
| | | string response = HttpHelper.DoPost(url, jsonData, "下发给AGV绑定载具命令", "AGV", key); |
| | | //解析返回数据 |
| | | var agvModel = JsonConvert.DeserializeObject<OutCommanAgvDto>(response); |
| | | if (agvModel.Code == "0") |
| | | { |
| | | result = true;//给下车下发任务成功 |
| | | |
| | | agvMsg = ""; |
| | | } |
| | | else |
| | | { |
| | | var logStr = $@".\log\AGV\下发给AGV解绑载具命令" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | LogFile.SaveLogToFile($"下发给AGV解绑载具命令异常:( {agvModel.Message} ),", logStr); |
| | | |
| | | agvMsg = agvModel.Message; |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | try |
| | | { |
| | | |
| | | //程序正式发布后放开 |
| | | var time1 = DateTime.Now;//发送时间 .ToString("yyyy-MM-dd HH:mm:ss") |
| | | var response = HttpHelper.DoPost(url, jsonData, "下发给WCS出库命令", "WCS"); |
| | |
| | | |
| | | try |
| | | { |
| | | |
| | | var time1 = DateTime.Now;//发送时间 .ToString("yyyy-MM-dd HH:mm:ss") |
| | | response = HttpHelper.DoPost(url, jsonData, "下发给WCS出库命令", "WCS"); |
| | | var time2 = DateTime.Now;//返回时间 .ToString("yyyy-MM-dd HH:mm:ss") |
| | |
| | | string response = ""; |
| | | try |
| | | { |
| | | |
| | | var time1 = DateTime.Now;//发送时间 .ToString("yyyy-MM-dd HH:mm:ss") |
| | | response = HttpHelper.DoPost(url, jsonData, "上传ERP取样消耗量过账", "ERP"); |
| | | var time2 = DateTime.Now;//返回时间 .ToString("yyyy-MM-dd HH:mm:ss") |
| | |
| | | |
| | | try |
| | | { |
| | | |
| | | var time1 = DateTime.Now;//发送时间 .ToString("yyyy-MM-dd HH:mm:ss") |
| | | response = HttpHelper.DoPost(url, jsonData, "下发给WCS出库命令", "WCS"); |
| | | var time2 = DateTime.Now;//返回时间 .ToString("yyyy-MM-dd HH:mm:ss") |
| | |
| | | /// <param name="lotNo">批次</param> |
| | | /// <param name="userId">操作人</param> |
| | | /// <exception cref="Exception"></exception> |
| | | public void jiaoLiaoHopper(string areaNo,string endLocate,string plnStatus,string standard,string skuNo,string lotNo,string url,int userId) |
| | | public void jiaoLiaoHopper(string areaNo,string endLocate,string plnStatus,string standard,string skuNo,string lotNo,string url, string bindUrl, int userId) |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | throw new Exception("未找到对应桶信息"); |
| | | } |
| | | resultYi = YikuTask(palletModel.PalletNo, taskNo, url); |
| | | resultYi = YikuTask(palletModel.PalletNo, taskNo, url,bindUrl); |
| | | } |
| | | #endregion |
| | | //起始储位地址信息 |
| | |
| | | string agvMsg = string.Empty; |
| | | //给下车下发任务 |
| | | logTaskEntry.SendDate = DateTime.Now;//发送时间 |
| | | var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg); |
| | | if (agvResult)//成功 |
| | | //下发载具类型 |
| | | var bind = RcsHelper.BindPalletAndSite(palletModel.PalletNo, palletModel.LocatNo, url, out string agvBindMsg); |
| | | if (bind) |
| | | { |
| | | //请求成功修改任务表相应字段状态 |
| | | logTaskEntry.IsSuccess = 1; |
| | | logTaskEntry.IsSend = 0; |
| | | //logTaskEntry.IsCancel = 0; |
| | | logTaskEntry.BackDate = DateTime.Now; |
| | | logTaskEntry.Status = "1";//正在执行 |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg); |
| | | if (agvResult)//成功 |
| | | { |
| | | //请求成功修改任务表相应字段状态 |
| | | logTaskEntry.IsSuccess = 1; |
| | | logTaskEntry.IsSend = 0; |
| | | //logTaskEntry.IsCancel = 0; |
| | | logTaskEntry.BackDate = DateTime.Now; |
| | | logTaskEntry.Status = "1";//正在执行 |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | |
| | | startLoction.Status = "3";//出库中 |
| | | Db.Updateable(startLoction).ExecuteCommand(); |
| | | startLoction.Status = "3";//出库中 |
| | | Db.Updateable(startLoction).ExecuteCommand(); |
| | | |
| | | endLocateInfo.Status = "2";//入库中 |
| | | Db.Updateable(endLocateInfo).ExecuteCommand(); |
| | | endLocateInfo.Status = "2";//入库中 |
| | | Db.Updateable(endLocateInfo).ExecuteCommand(); |
| | | } |
| | | else//失败 |
| | | { |
| | | logTaskEntry.IsSuccess = 0; |
| | | logTaskEntry.Information = agvMsg; |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | } |
| | | } |
| | | else//失败 |
| | | else |
| | | { |
| | | logTaskEntry.IsSuccess = 0; |
| | | logTaskEntry.Information = agvMsg; |
| | | logTaskEntry.Information = "货架与货位绑定失败,原因:"+agvBindMsg; |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | } |
| | | |
| | | } |
| | | //提交事务 |
| | | Db.CommitTran(); |
| | |
| | | /// <param name="lotNo">批次</param> |
| | | /// <param name="userId">操作人</param> |
| | | /// <exception cref="Exception"></exception> |
| | | public void jiaoCheHopper(string areaNo, string StartLocate, string plnNo, string plnStatus, decimal weight, string skuNo, string lotNo, string url,int userId) |
| | | public void jiaoCheHopper(string areaNo, string StartLocate, string plnNo, string plnStatus, decimal weight, string skuNo, string lotNo, string url,string bindUrl,int userId) |
| | | { |
| | | try |
| | | { |
| | |
| | | string agvMsg = string.Empty; |
| | | //给下车下发任务 |
| | | logTaskEntry.SendDate = DateTime.Now;//发送时间 |
| | | var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg); |
| | | if (agvResult)//成功 |
| | | //下发载具与货位绑定 |
| | | var bind = RcsHelper.BindPalletAndSite(plnNo, StartLocate, bindUrl, out string agvBindMsg); |
| | | if (bind) |
| | | { |
| | | //请求成功修改任务表相应字段状态 |
| | | logTaskEntry.IsSuccess = 1; |
| | | logTaskEntry.IsSend = 0; |
| | | //logTaskEntry.IsCancel = 0; |
| | | logTaskEntry.BackDate = DateTime.Now; |
| | | logTaskEntry.Status = "1";//正在执行 |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg); |
| | | if (agvResult)//成功 |
| | | { |
| | | //请求成功修改任务表相应字段状态 |
| | | logTaskEntry.IsSuccess = 1; |
| | | logTaskEntry.IsSend = 0; |
| | | //logTaskEntry.IsCancel = 0; |
| | | logTaskEntry.BackDate = DateTime.Now; |
| | | logTaskEntry.Status = "1";//正在执行 |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | |
| | | startLoction.Status = "3";//出库中 |
| | | Db.Updateable(startLoction).ExecuteCommand(); |
| | | startLoction.Status = "3";//出库中 |
| | | Db.Updateable(startLoction).ExecuteCommand(); |
| | | |
| | | endLocatInfo.Status = "2";//入库中 |
| | | Db.Updateable(endLocatInfo).ExecuteCommand(); |
| | | endLocatInfo.Status = "2";//入库中 |
| | | Db.Updateable(endLocatInfo).ExecuteCommand(); |
| | | } |
| | | else//失败 |
| | | { |
| | | logTaskEntry.IsSuccess = 0; |
| | | logTaskEntry.Information = agvMsg; |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | } |
| | | |
| | | } |
| | | else//失败 |
| | | else |
| | | { |
| | | logTaskEntry.IsSuccess = 0; |
| | | logTaskEntry.Information = agvMsg; |
| | | logTaskEntry.Information = "货架与货位绑定失败,原因:"+agvBindMsg; |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | } |
| | | |
| | | |
| | | //提交事务 |
| | | Db.CommitTran(); |
| | |
| | | /// <param name="deviceStation">叫料点位:”input”-入口(叫脏桶),”output”-出口(净桶申请储位)</param> |
| | | /// <param name="status"></param> |
| | | /// <exception cref="Exception"></exception> |
| | | public void RCSCleanRequest(string deviceID,string deviceStation,string status,string url) |
| | | public void RCSCleanRequest(string deviceID,string deviceStation,string status,string url,string bindUrl) |
| | | { |
| | | try |
| | | { |
| | |
| | | string agvMsg = string.Empty; |
| | | //给下车下发任务 |
| | | logTaskEntry.SendDate = DateTime.Now;//发送时间 |
| | | var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg); |
| | | if (agvResult)//成功 |
| | | //下发载具与货位绑定 |
| | | var bind = RcsHelper.BindPalletAndSite(palletModel.PalletNo, palletModel.LocatNo, bindUrl, out string agvBindMsg); |
| | | if (bind) |
| | | { |
| | | //请求成功修改任务表相应字段状态 |
| | | logTaskEntry.IsSuccess = 1; |
| | | logTaskEntry.IsSend = 0; |
| | | //logTaskEntry.IsCancel = 0; |
| | | logTaskEntry.BackDate = DateTime.Now; |
| | | logTaskEntry.Status = "1";//正在执行 |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg); |
| | | if (agvResult)//成功 |
| | | { |
| | | //请求成功修改任务表相应字段状态 |
| | | logTaskEntry.IsSuccess = 1; |
| | | logTaskEntry.IsSend = 0; |
| | | //logTaskEntry.IsCancel = 0; |
| | | logTaskEntry.BackDate = DateTime.Now; |
| | | logTaskEntry.Status = "1";//正在执行 |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | |
| | | startLoction.Status = "3";//出库中 |
| | | Db.Updateable(startLoction).ExecuteCommand(); |
| | | startLoction.Status = "3";//出库中 |
| | | Db.Updateable(startLoction).ExecuteCommand(); |
| | | |
| | | endLoction.Status = "2";//入库中 |
| | | Db.Updateable(endLoction).ExecuteCommand(); |
| | | endLoction.Status = "2";//入库中 |
| | | Db.Updateable(endLoction).ExecuteCommand(); |
| | | } |
| | | else//失败 |
| | | { |
| | | logTaskEntry.IsSuccess = 0; |
| | | logTaskEntry.Information = agvMsg; |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | } |
| | | } |
| | | else//失败 |
| | | else |
| | | { |
| | | logTaskEntry.IsSuccess = 0; |
| | | logTaskEntry.Information = agvMsg; |
| | | logTaskEntry.Information = agvBindMsg; |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | } |
| | | |
| | | //提交事务 |
| | | Db.CommitTran(); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | private bool YikuTask(string palletNo, string taskNo, string url) |
| | | private bool YikuTask(string palletNo, string taskNo, string url,string bindUrl) |
| | | { |
| | | try |
| | | { |
| | |
| | | string agvMsg = string.Empty; |
| | | //给下车下发任务 |
| | | logTaskEntry.SendDate = DateTime.Now;//发送时间 |
| | | var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg, "70"); |
| | | if (agvResult)//成功 |
| | | //下发载具与货位绑定 |
| | | var bind = RcsHelper.BindPalletAndSite(palletInfoYi.LocatNo, palletInfoYi.PalletNo, bindUrl, out string agvBindMsg); |
| | | if (bind) |
| | | { |
| | | //请求成功修改任务表相应字段状态 |
| | | logTaskEntry.IsSuccess = 1; |
| | | logTaskEntry.IsSend = 0; |
| | | //logTaskEntry.IsCancel = 0; |
| | | logTaskEntry.BackDate = DateTime.Now; |
| | | logTaskEntry.Status = "1";//正在执行 |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg, "70"); |
| | | if (agvResult)//成功 |
| | | { |
| | | //请求成功修改任务表相应字段状态 |
| | | logTaskEntry.IsSuccess = 1; |
| | | logTaskEntry.IsSend = 0; |
| | | //logTaskEntry.IsCancel = 0; |
| | | logTaskEntry.BackDate = DateTime.Now; |
| | | logTaskEntry.Status = "1";//正在执行 |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | |
| | | //修改移出储位状态 |
| | | locatInfo.Status = "5";//移出中 |
| | | Db.Updateable(locatInfo).ExecuteCommand(); |
| | | //修改移出储位状态 |
| | | locatInfo.Status = "5";//移出中 |
| | | Db.Updateable(locatInfo).ExecuteCommand(); |
| | | |
| | | //修改移入储位状态 |
| | | transferLocat.Status = "4";//移入中 |
| | | Db.Updateable(transferLocat).ExecuteCommand(); |
| | | //修改移入储位状态 |
| | | transferLocat.Status = "4";//移入中 |
| | | Db.Updateable(transferLocat).ExecuteCommand(); |
| | | } |
| | | else//失败 |
| | | { |
| | | logTaskEntry.IsSuccess = 0; |
| | | logTaskEntry.Information = agvMsg; |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | |
| | | throw new Exception($"给小车下发移库任务失败,桶号:{palletInfoYi.PalletNo}"); |
| | | } |
| | | } |
| | | else//失败 |
| | | else |
| | | { |
| | | logTaskEntry.IsSuccess = 0; |
| | | logTaskEntry.Information = agvMsg; |
| | | logTaskEntry.Information = agvBindMsg; |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | |
| | | throw new Exception($"给小车下发移库任务失败,桶号:{palletInfoYi.PalletNo}"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return true; |
| | |
| | | /// <param name="taskNo"></param> |
| | | /// <param name="url"></param> |
| | | /// <exception cref="Exception"></exception> |
| | | public void OutBinAgv(string taskNo,string url) |
| | | public void OutBinAgv(string taskNo,string url, string bindUrl) |
| | | { |
| | | try |
| | | { |
| | |
| | | string agvMsg = string.Empty; |
| | | //给下车下发任务 |
| | | logTaskInfoZ.SendDate = DateTime.Now;//发送时间 |
| | | var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg, "70"); |
| | | if (agvResult)//成功 |
| | | //下发载具与货们绑定 |
| | | var bind = RcsHelper.BindPalletAndSite(logTaskInfoZ.PalletNo, logTaskInfoZ.StartLocat, bindUrl, out string agvBindMsg); |
| | | if (bind) |
| | | { |
| | | //请求成功修改任务表相应字段状态 |
| | | logTaskInfoZ.IsSuccess = 1; |
| | | logTaskInfoZ.IsSend = 0; |
| | | //logTaskEntry.IsCancel = 0; |
| | | logTaskInfoZ.BackDate = DateTime.Now; |
| | | logTaskInfoZ.Status = "1";//正在执行 |
| | | Db.Insertable(logTaskInfoZ).ExecuteCommand(); |
| | | var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg, "70"); |
| | | if (agvResult)//成功 |
| | | { |
| | | //请求成功修改任务表相应字段状态 |
| | | logTaskInfoZ.IsSuccess = 1; |
| | | logTaskInfoZ.IsSend = 0; |
| | | //logTaskEntry.IsCancel = 0; |
| | | logTaskInfoZ.BackDate = DateTime.Now; |
| | | logTaskInfoZ.Status = "1";//正在执行 |
| | | Db.Insertable(logTaskInfoZ).ExecuteCommand(); |
| | | |
| | | //修改移出储位状态 |
| | | startLocatInfoZ.Status = "5";//移出中 |
| | | Db.Updateable(startLocatInfoZ).ExecuteCommand(); |
| | | //修改移出储位状态 |
| | | startLocatInfoZ.Status = "5";//移出中 |
| | | Db.Updateable(startLocatInfoZ).ExecuteCommand(); |
| | | |
| | | //修改移入储位状态 |
| | | endLocatInfoZ.Status = "4";//移入中 |
| | | Db.Updateable(endLocatInfoZ).ExecuteCommand(); |
| | | //修改移入储位状态 |
| | | endLocatInfoZ.Status = "4";//移入中 |
| | | Db.Updateable(endLocatInfoZ).ExecuteCommand(); |
| | | } |
| | | else//失败 |
| | | { |
| | | logTaskInfoZ.IsSuccess = 0; |
| | | logTaskInfoZ.Information = agvMsg; |
| | | Db.Insertable(logTaskInfoZ).ExecuteCommand(); |
| | | |
| | | throw new Exception($"给小车下发移库任务失败,桶号:{logTaskInfoZ.PalletNo}"); |
| | | } |
| | | } |
| | | else//失败 |
| | | else |
| | | { |
| | | logTaskInfoZ.IsSuccess = 0; |
| | | logTaskInfoZ.Information = agvMsg; |
| | | logTaskInfoZ.Information = agvBindMsg; |
| | | Db.Insertable(logTaskInfoZ).ExecuteCommand(); |
| | | |
| | | throw new Exception($"给小车下发移库任务失败,桶号:{logTaskInfoZ.PalletNo}"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | /// </summary> |
| | | /// <param name="url"></param> |
| | | /// <exception cref="Exception"></exception> |
| | | public void TransferBackTimer(string url) |
| | | public void TransferBackTimer(string url,string bindUrl) |
| | | { |
| | | try |
| | | { |
| | |
| | | string agvMsg = string.Empty; |
| | | //给下车下发任务 |
| | | logTaskEntry.SendDate = DateTime.Now;//发送时间 |
| | | var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg); |
| | | if (agvResult)//成功 |
| | | //下发载具与货位绑定 |
| | | var bind = RcsHelper.BindPalletAndSite(detailInfo.PalletNo, detailInfo.LocatNo, bindUrl, out string agvBindMsg); |
| | | if (bind) |
| | | { |
| | | //请求成功修改任务表相应字段状态 |
| | | logTaskEntry.IsSuccess = 1; |
| | | logTaskEntry.IsSend = 0; |
| | | //logTaskEntry.IsCancel = 0; |
| | | logTaskEntry.BackDate = DateTime.Now; |
| | | logTaskEntry.Status = "1";//正在执行 |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg); |
| | | if (agvResult)//成功 |
| | | { |
| | | //请求成功修改任务表相应字段状态 |
| | | logTaskEntry.IsSuccess = 1; |
| | | logTaskEntry.IsSend = 0; |
| | | //logTaskEntry.IsCancel = 0; |
| | | logTaskEntry.BackDate = DateTime.Now; |
| | | logTaskEntry.Status = "1";//正在执行 |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | |
| | | //修改移出储位状态 |
| | | locatModel.Status = "5";//移出中 |
| | | Db.Updateable(locatModel).ExecuteCommand(); |
| | | //修改移出储位状态 |
| | | locatModel.Status = "5";//移出中 |
| | | Db.Updateable(locatModel).ExecuteCommand(); |
| | | |
| | | //修改移入储位状态 |
| | | endLocatInfo.Status = "4";//移入中 |
| | | Db.Updateable(endLocatInfo).ExecuteCommand(); |
| | | //修改移入储位状态 |
| | | endLocatInfo.Status = "4";//移入中 |
| | | Db.Updateable(endLocatInfo).ExecuteCommand(); |
| | | } |
| | | else//失败 |
| | | { |
| | | logTaskEntry.IsSuccess = 0; |
| | | logTaskEntry.Information = agvMsg; |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | |
| | | throw new Exception($"给小车下发移库任务失败,桶号:{detailInfo.PalletNo}"); |
| | | } |
| | | } |
| | | else//失败 |
| | | else |
| | | { |
| | | logTaskEntry.IsSuccess = 0; |
| | | logTaskEntry.Information = agvMsg; |
| | | logTaskEntry.Information = agvBindMsg; |
| | | Db.Insertable(logTaskEntry).ExecuteCommand(); |
| | | |
| | | throw new Exception($"给小车下发移库任务失败,桶号:{detailInfo.PalletNo}"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | //提交事务 |
| | |
| | | } |
| | | |
| | | // 正式运行程序放开 |
| | | //AGV任务下发时增加hearder:X-LR-REQUEST-ID,值为随机数 |
| | | long ran = DateTime.Now.Ticks; |
| | | Dictionary<string, string> key = new Dictionary<string, string>(); |
| | | key.Add("X-LR-REQUEST-ID", ran.ToString()); |
| | | var jsonData = JsonConvert.SerializeObject(agvTask); |
| | | string response = HttpHelper.DoPost(url, jsonData, "下发给AGV转运命令", "AGV"); |
| | | string response = HttpHelper.DoPost(url, jsonData, "下发给AGV转运命令", "AGV",key); |
| | | //解析返回数据 |
| | | var agvModel = JsonConvert.DeserializeObject<OutCommanAgvDto>(response); |
| | | if (agvModel.Code == "0") |
| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Linq.Expressions; |
| | | using System.Security.Policy; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | |
| | | using Model.ModelDto.LogDto; |
| | | using Model.ModelDto.SysDto; |
| | | using SqlSugar; |
| | | using Utility.Tools; |
| | | using WMS.BLL.LogServer; |
| | | using WMS.Entity.Context; |
| | | using WMS.Entity.DataEntity; |
| | |
| | | /// <param name="locatNo"></param> |
| | | /// <param name="userId"></param> |
| | | /// <exception cref="Exception"></exception> |
| | | public void AddPallets(string palletNo,string locatNo, string deviceCode, int userId) |
| | | public void AddPallets(string palletNo,string locatNo, string deviceCode, string url, int userId) |
| | | { |
| | | var db = DataContext.Db; |
| | | try |
| | |
| | | { |
| | | throw new Exception("新添加的桶只能绑定净桶区"); |
| | | } |
| | | //if (!string.IsNullOrEmpty(deviceCode)) |
| | | //{ |
| | | // var areaInfo = db.Queryable<SysStorageArea>().First(w => w.IsDel == "0" && w.DeviceCode.Contains(deviceCode)); |
| | | // if (areaInfo == null) |
| | | // { |
| | | // throw new Exception("未查到设备所属区域信息"); |
| | | // } |
| | | // //125设备是接料和混料一体机 |
| | | // if (deviceCode != "125") |
| | | // { |
| | | // if (!areaInfo.AreaName.Contains("接料设备")) |
| | | // { |
| | | // throw new Exception("只能绑定接料设备"); |
| | | // } |
| | | // if (areaInfo.WareHouseNo != "M03") |
| | | // { |
| | | // throw new Exception("只有大单体车间才能绑定设备"); |
| | | // } |
| | | // } |
| | | //} |
| | | if (!string.IsNullOrEmpty(deviceCode)) |
| | | { |
| | | var areaInfo = db.Queryable<SysStorageArea>().First(w => w.IsDel == "0" && w.DeviceCode.Contains(deviceCode)); |
| | | if (areaInfo == null) |
| | | switch (deviceCode) |
| | | { |
| | | throw new Exception("未查到设备所属区域信息"); |
| | | case "400": |
| | | deviceCode = "400L"; |
| | | break; |
| | | case "800": |
| | | deviceCode = "800L"; |
| | | break; |
| | | case "1000": |
| | | deviceCode = "1000L"; |
| | | break; |
| | | default: |
| | | throw new Exception("不能录入400,800,1000以外的值"); |
| | | } |
| | | //125设备是接料和混料一体机 |
| | | if (deviceCode != "125") |
| | | { |
| | | if (!areaInfo.AreaName.Contains("接料设备")) |
| | | { |
| | | throw new Exception("只能绑定接料设备"); |
| | | } |
| | | if (areaInfo.WareHouseNo != "M03") |
| | | { |
| | | throw new Exception("只有大单体车间才能绑定设备"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | //开启事务 |
| | | db.BeginTran(); |
| | | |
| | | palletModel = new SysPallets(); |
| | | palletModel.PalletNo = palletNo; |
| | | palletModel.Standard = deviceCode; |
| | | palletModel.Type = "0"; |
| | | palletModel.Status = "0"; |
| | | palletModel.CreateUser = userId; |
| | |
| | | |
| | | PalletStatus = "0",//净桶 |
| | | |
| | | UDF1 = deviceCode, |
| | | Standard = deviceCode, //规格 |
| | | |
| | | IsDel = "0", |
| | | CreateUser = userId, |
| | |
| | | locatModel.Status = "1";//有物品 |
| | | db.Updateable(locatModel).ExecuteCommand(); |
| | | |
| | | //下发AGV绑定载具接口 |
| | | //调用AGV接口下发任务 |
| | | //string agvMsg = string.Empty; |
| | | ////给下车下发任务 |
| | | //var agvResult = RcsHelper.BindPalletAndSite(palletNo, locatNo,url, out agvMsg); |
| | | //if (agvResult)//成功 |
| | | //{ |
| | | // //增加日志 |
| | | //} |
| | | //else//失败 |
| | | //{ |
| | | // throw new Exception("小车载具和库位关系绑定失败,原因:"+agvMsg); |
| | | //} |
| | | |
| | | //提交事务 |
| | | db.CommitTran(); |
| | | } |
| | |
| | | List<string> GetLotNoBySku(string skuNo); |
| | | List<string> GetSku(); |
| | | |
| | | void jiaoLiaoHopper(string areaNo, string endLocate, string plnStatus, string standard, string skuNo, string lotNo, string url, int userId); |
| | | void jiaoCheHopper(string areaNo, string StartLocate, string plnNo, string plnStatus, decimal weight, string skuNo, string lotNo, string url, int userId); |
| | | void jiaoLiaoHopper(string areaNo, string endLocate, string plnStatus, string standard, string skuNo, string lotNo, string url,string bindUrl, int userId); |
| | | void jiaoCheHopper(string areaNo, string StartLocate, string plnNo, string plnStatus, decimal weight, string skuNo, string lotNo, string url, string bindUrl, int userId); |
| | | |
| | | /// <summary> |
| | | /// 小车走出储位回传事件 |
| | |
| | | /// <param name="taskNo"></param> |
| | | /// <param name="url"></param> |
| | | /// <exception cref="Exception"></exception> |
| | | void OutBinAgv(string taskNo, string url); |
| | | void OutBinAgv(string taskNo, string url,string bindUrl); |
| | | |
| | | /// <summary> |
| | | /// 小车反馈任务完成 |
| | |
| | | /// <param name="deviceStation">叫料点位:”input”-入口(叫脏桶),”output”-出口(净桶申请储位)</param> |
| | | /// <param name="status"></param> |
| | | /// <exception cref="Exception"></exception> |
| | | void RCSCleanRequest(string deviceID, string deviceStation, string status, string url); |
| | | void RCSCleanRequest(string deviceID, string deviceStation, string status, string url,string bindUrl); |
| | | } |
| | | } |
| | |
| | | /// <param name="groupCount">组数</param> |
| | | /// <param name="userId">操作人</param> |
| | | /// <returns></returns> |
| | | void AddPallets(string palletNo, string locatNo,string deviceCode, int userId); |
| | | void AddPallets(string palletNo, string locatNo,string deviceCode,string url, int userId); |
| | | } |
| | | } |
| | |
| | | { |
| | | //记录log |
| | | var logStr = $@".\log\AGV\任务执行通知" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | AgvResultModel resultModel = null;//返回信息 |
| | | AgvResultModel2 resultModel = null;//返回信息 |
| | | try |
| | | { |
| | | var jsonData = JsonConvert.SerializeObject(model); |
| | |
| | | |
| | | |
| | | |
| | | resultModel = new AgvResultModel { code = "0", message = "成功", reqCode = model.reqCode }; |
| | | resultModel.code = "0"; |
| | | resultModel.message = "成功"; |
| | | resultModel.da.robotTaskCode = model.robotTaskCode; |
| | | var jsonData2 = JsonConvert.SerializeObject(resultModel); |
| | | LogFile.SaveLogToFile($"AGV任务执行通知-任务开始-返回报文:( {jsonData2} ),", logStr); |
| | | return Ok(resultModel); |
| | |
| | | { |
| | | LogFile.SaveLogToFile($"AGV任务执行通知-任务开始-异常:( {ex.Message} ),", logStr); |
| | | |
| | | resultModel = new AgvResultModel { code = "1", message = ex.Message, reqCode = model.reqCode }; |
| | | resultModel.code = "1"; |
| | | resultModel.message = ex.Message; |
| | | resultModel.da.robotTaskCode = model.robotTaskCode; |
| | | var jsonData2 = JsonConvert.SerializeObject(resultModel); |
| | | LogFile.SaveLogToFile($"AGV任务执行通知-任务开始-返回报文:( {jsonData2} ),", logStr); |
| | | return Ok(resultModel); |
| | |
| | | { |
| | | //记录log |
| | | var logStr = $@".\log\AGV\任务执行通知" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | AgvResultModel resultModel = null;//返回信息 |
| | | AgvResultModel2 resultModel = null;//返回信息 |
| | | try |
| | | { |
| | | var extraValue = new ExtraModel(); |
| | | extraValue = model.extra; |
| | | if (!(extraValue.values.method == "outbin")) |
| | | { |
| | | throw new Exception("小车调用方法错误"); |
| | | } |
| | | var jsonData = JsonConvert.SerializeObject(model); |
| | | LogFile.SaveLogToFile($"AGV任务执行通知-走出储位-请求报文:( {jsonData} ),", logStr); |
| | | |
| | | //具体处理方法 |
| | | _hopper.OutBinAgv(model.taskCode, _config.AgvHost + _config.GenAgvSchedulingTask); |
| | | _hopper.OutBinAgv(model.robotTaskCode, _config.AgvHost + _config.GenAgvSchedulingTask,_config.AgvHost+_config.AGVBindPallets); |
| | | |
| | | |
| | | resultModel = new AgvResultModel { code = "0", message = "成功", reqCode = model.reqCode }; |
| | | resultModel.code = "0"; |
| | | resultModel.message = "成功"; |
| | | resultModel.da.robotTaskCode = model.robotTaskCode; |
| | | var jsonData2 = JsonConvert.SerializeObject(resultModel); |
| | | LogFile.SaveLogToFile($"AGV任务执行通知-走出储位-返回报文:( {jsonData2} ),", logStr); |
| | | return Ok(resultModel); |
| | |
| | | { |
| | | LogFile.SaveLogToFile($"AGV任务执行通知-走出储位-异常:( {ex.Message} ),", logStr); |
| | | |
| | | resultModel = new AgvResultModel { code = "1", message = ex.Message, reqCode = model.reqCode }; |
| | | |
| | | resultModel.code = "1"; |
| | | resultModel.message = ex.Message; |
| | | resultModel.da.robotTaskCode = model.robotTaskCode; |
| | | var jsonData2 = JsonConvert.SerializeObject(resultModel); |
| | | LogFile.SaveLogToFile($"AGV任务执行通知-走出储位-返回报文:( {jsonData2} ),", logStr); |
| | | return Ok(resultModel); |
| | |
| | | { |
| | | //记录log |
| | | var logStr = $@".\log\AGV\任务执行通知" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | AgvResultModel resultModel = null;//返回信息 |
| | | AgvResultModel2 resultModel = null;//返回信息 |
| | | try |
| | | { |
| | | var extraValue = new ExtraModel(); |
| | | extraValue = model.extra; |
| | | if (!(extraValue.values.method == "end")) |
| | | { |
| | | throw new Exception("小车调用方法错误"); |
| | | } |
| | | var jsonData = JsonConvert.SerializeObject(model); |
| | | LogFile.SaveLogToFile($"AGV任务执行通知-任务结束-请求报文:( {jsonData} ),", logStr); |
| | | |
| | | |
| | | //具体处理方法 |
| | | _hopper.RCSFinishTask(model.taskCode, "1", "AGV"); |
| | | _hopper.RCSFinishTask(model.robotTaskCode, "1", "AGV"); |
| | | |
| | | resultModel = new AgvResultModel { code = "0", message = "成功", reqCode = model.reqCode }; |
| | | resultModel.code = "0"; |
| | | resultModel.message = "成功"; |
| | | resultModel.da.robotTaskCode = model.robotTaskCode; |
| | | |
| | | var jsonData2 = JsonConvert.SerializeObject(resultModel); |
| | | LogFile.SaveLogToFile($"AGV任务执行通知-任务结束-返回报文:( {jsonData2} ),", logStr); |
| | | return Ok(resultModel); |
| | |
| | | { |
| | | LogFile.SaveLogToFile($"AGV任务执行通知-任务结束-异常:( {ex.Message} ),", logStr); |
| | | |
| | | resultModel = new AgvResultModel { code = "1", message = ex.Message, reqCode = model.reqCode }; |
| | | resultModel.code = "1"; |
| | | resultModel.message = ex.Message; |
| | | resultModel.da.robotTaskCode = model.robotTaskCode; |
| | | var jsonData2 = JsonConvert.SerializeObject(resultModel); |
| | | LogFile.SaveLogToFile($"AGV任务执行通知-任务结束-返回报文:( {jsonData2} ),", logStr); |
| | | return Ok(resultModel); |
| | |
| | | { |
| | | //记录log |
| | | var logStr = $@".\log\AGV\任务执行通知" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; |
| | | AgvResultModel resultModel = null;//返回信息 |
| | | AgvResultModel2 resultModel = null;//返回信息 |
| | | try |
| | | { |
| | | var jsonData = JsonConvert.SerializeObject(model); |
| | |
| | | |
| | | |
| | | |
| | | resultModel = new AgvResultModel { code = "0", message = "成功", reqCode = model.reqCode }; |
| | | resultModel.code = "0"; |
| | | resultModel.message = "成功"; |
| | | resultModel.da.robotTaskCode = model.robotTaskCode; |
| | | var jsonData2 = JsonConvert.SerializeObject(resultModel); |
| | | LogFile.SaveLogToFile($"AGV任务执行通知-任务单取消-返回报文:( {jsonData2} ),", logStr); |
| | | return Ok(resultModel); |
| | |
| | | { |
| | | LogFile.SaveLogToFile($"AGV任务执行通知-任务单取消-异常:( {ex.Message} ),", logStr); |
| | | |
| | | resultModel = new AgvResultModel { code = "1", message = ex.Message, reqCode = model.reqCode }; |
| | | resultModel.code = "1"; |
| | | resultModel.message = ex.Message; |
| | | resultModel.da.robotTaskCode = model.robotTaskCode; |
| | | var jsonData2 = JsonConvert.SerializeObject(resultModel); |
| | | LogFile.SaveLogToFile($"AGV任务执行通知-任务单取消-返回报文:( {jsonData2} ),", logStr); |
| | | return Ok(resultModel); |
| | |
| | | { |
| | | return Ok(new { code = 1, msg = "未获取到当前操作人信息" }); |
| | | } |
| | | _hopper.jiaoLiaoHopper(model.AreaNo,model.LocateNo,model.PlnStatus,model.Standard,model.SkuNo,model.LotNo,"", int.Parse(userId)); |
| | | _hopper.jiaoLiaoHopper(model.AreaNo,model.LocateNo,model.PlnStatus,model.Standard,model.SkuNo,model.LotNo,_config.AgvHost+_config.GenAgvSchedulingTask,_config.AgvHost+_config.AGVBindPallets, int.Parse(userId)); |
| | | |
| | | return Ok(new { data = model, code = 0, msg = "" }); |
| | | } |
| | |
| | | { |
| | | return Ok(new { code = 1, msg = "未获取到当前操作人信息" }); |
| | | } |
| | | _hopper.jiaoCheHopper(model.AreaNo, model.LocateNo,model.PlnNo, model.PlnStatus, model.Weight , model.SkuNo, model.LotNo,"", int.Parse(userId)); |
| | | _hopper.jiaoCheHopper(model.AreaNo, model.LocateNo,model.PlnNo, model.PlnStatus, model.Weight , model.SkuNo, model.LotNo, _config.AgvHost + _config.GenAgvSchedulingTask,_config.AgvHost+_config.AGVBindPallets, int.Parse(userId)); |
| | | |
| | | return Ok(new { data = model, code = 0, msg = "" }); |
| | | } |
| | |
| | | LogFile.SaveLogToFile($"清洗机叫料-请求报文:( {jsonData} ),", logStr); |
| | | |
| | | //具体处理方法 |
| | | _hopper.RCSCleanRequest(model.deviceID,model.deviceStation,model.status, _config.AgvHost + _config.GenAgvSchedulingTask); |
| | | _hopper.RCSCleanRequest(model.deviceID,model.deviceStation,model.status, _config.AgvHost + _config.GenAgvSchedulingTask,_config.AgvHost+_config.AGVBindPallets); |
| | | |
| | | resultModel = new AgvResultModel { code = "0", message = "请求成功!"}; |
| | | var jsonData2 = JsonConvert.SerializeObject(resultModel); |
| | |
| | | { |
| | | return Ok(new { code = 1, msg = "为获取到当前操作人信息" }); |
| | | } |
| | | _palletSvc.AddPallets(model.PalletNo, model.LocatNo, model.DeviceCode, int.Parse(userId)); |
| | | _palletSvc.AddPallets(model.PalletNo, model.LocatNo, model.DeviceCode,_config.AgvHost+_config.AGVBindPallets, int.Parse(userId)); |
| | | |
| | | return Ok(new { code = 0, msg = "添加成功", data = "" }); |
| | | |
| | |
| | | private Timer _timer3; |
| | | private string _wcsUrl; |
| | | private string _agvUrl; |
| | | private string _agvBindUrl; |
| | | private Timer _periodicReport; |
| | | public DailyTaskService(string wcsUrl,string agvUrl) |
| | | public DailyTaskService(string wcsUrl,string agvUrl,string agvBindUrl) |
| | | { |
| | | _wcsUrl = wcsUrl; |
| | | _agvUrl = agvUrl; |
| | | _agvBindUrl = agvBindUrl; |
| | | } |
| | | |
| | | //创建定时任务 |
| | |
| | | { |
| | | HopperTransportServer _stockDetail = new HopperTransportServer(); |
| | | //任务逻辑 |
| | | _stockDetail.TransferBackTimer(_agvUrl); |
| | | _stockDetail.TransferBackTimer(_agvUrl,_agvBindUrl); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | "iisSettings": { |
| | | "windowsAuthentication": false, |
| | | "anonymousAuthentication": true, |
| | | "iisExpress": { |
| | | "applicationUrl": "http://localhost:50515/", |
| | | "sslPort": 44363 |
| | | } |
| | | }, |
| | | "$schema": "http://json.schemastore.org/launchsettings.json", |
| | | "profiles": { |
| | | "IIS Express": { |
| | | "commandName": "IISExpress", |
| | |
| | | }, |
| | | "applicationUrl": "https://localhost:5001;http://localhost:5000" |
| | | } |
| | | }, |
| | | "$schema": "http://json.schemastore.org/launchsettings.json", |
| | | "iisSettings": { |
| | | "windowsAuthentication": false, |
| | | "anonymousAuthentication": true, |
| | | "iisExpress": { |
| | | "applicationUrl": "http://192.168.10.201", |
| | | "sslPort": 44363 |
| | | } |
| | | } |
| | | } |
| | |
| | | var url = Configuration.GetSection("ApiUrlConfig:WcsHost").Value + Configuration.GetSection("ApiUrlConfig:IssueComApiUrl").Value; |
| | | //下发AGV路径Str |
| | | var url2 = Configuration.GetSection("ApiUrlConfig:AgvHost").Value + Configuration.GetSection("ApiUrlConfig:IssueComApiUrl").Value; |
| | | //下发AGV路径Str |
| | | var url3 = Configuration.GetSection("ApiUrlConfig:AgvHost").Value + Configuration.GetSection("ApiUrlConfig:AGVBindPallets").Value; |
| | | //调用定时任务 |
| | | services.AddHostedService<DailyTaskService>(provider => |
| | | new DailyTaskService(url,url2)); |
| | | new DailyTaskService(url,url2,url3)); |
| | | |
| | | services.AddControllers() |
| | | .AddJsonOptions(options => |
| | |
| | | /// </summary> |
| | | public string GenPreScheduleTask { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 载具与库位绑定接口 |
| | | /// </summary> |
| | | public string AGVBindPallets { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 载具与库位解绑接口 |
| | | /// </summary> |
| | | public string AGVUnBindPallets { get; set; } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | |
| | | //"ConnectionString": "Server=47.95.120.93;Database=WMS_JC09;User ID=sa;password=boxline!@#; Integrated Security=True;", |
| | | //"ConnectionString": "Server=47.95.120.53;Database=WMS_JC09;User ID=sa;Password=boxline!@#;Integrated Security=False;", |
| | | //"ConnectionString": "Server=192.168.62.106;Database=WMS_JC24;User ID=sa;Password=sql2019;Integrated Security=False;", |
| | | "ConnectionString": "Server=192.168.62.200;Database=WMS_JC37;User ID=sa;Password=sql2019;Integrated Security=False;" |
| | | //"ConnectionString": "Server=.;Database=WMS_JC09;User ID=sa;Password=sql2019;Integrated Security=False;" |
| | | //"ConnectionString": "Server=192.168.62.200;Database=WMS_JC37;User ID=sa;Password=sql2019;Integrated Security=False;" |
| | | "ConnectionString": "Server=.;Database=WMS_JC37;User ID=sa;Password=sa@123456;Integrated Security=False;" |
| | | //"ConnectionString": "Data Source=DESKTOP-0EJDG95\\MSSQLSERVER1;Initial Catalog=WMS_V01;Integrated Security=True;" |
| | | //"ConnectionString": "Server=.\\MSSQLSERVER2019;Database=WMS_JC23-2;User Id=sa;Password=admin2023@;" // SqlServer 库连接字符串 |
| | | //"ConnectionString": "Server=172.16.105.10;Database=WMS_JC23-2;User ID=sa;Password=sql2019;Integrated Security=False;" |
| | |
| | | "ErpHost": "http://10.110.24.30:8081", //erpIP |
| | | "WcsHost": "http://localhost:57061", //wcsIPhttp://localhost:57061/ |
| | | "BoxHost": "http://10.110.24.30:8081", //boxIP |
| | | "AgvHost": "http://172.15.1.74:8182", //agvIP |
| | | "AgvHost": "http://192.168.10.22", //agvIP |
| | | |
| | | "IssueComApiUrl": "/api/WCSApi/AddTasks", //下发命令(出库、移库) |
| | | "IssueComApiUrl2": "/api/WCSApi/AddTask", //重新下发命令(出库、移库) |
| | |
| | | |
| | | |
| | | // AGV |
| | | "GenAgvSchedulingTask": "/rcms/services/rest/hikRpcService/genAgvSchedulingTask", //生成任务单接口 |
| | | "ContinueTask": "/rcms/services/rest/hikRpcService/continueTask", //继续执行任务接口 |
| | | "GenPreScheduleTask": "/rcms/services/rest/hikRpcService/genPreScheduleTask" // 预调度对外接口 |
| | | "GenAgvSchedulingTask": "/rcs/rtas/api/robot/controller/task/submit", //生成任务单接口 |
| | | "ContinueTask": "/rcs/rtas/api/robot/controller/task/extend/continue", //继续执行任务接口 |
| | | "GenPreScheduleTask": "/rcms/services/rest/hikRpcService/genPreScheduleTask", // 预调度对外接口 |
| | | "AGVBindPallets": "/rcs/rtas/api/robot/controller/carrier/bind", //载具与库位绑定接口 |
| | | "AGVUnBindPallets": "/rcs/rtas/api/robot/controller/carrier/bind" //载具与库位解绑接口 |
| | | } |
| | | } |