1
pengmn
2025-07-04 fdb591381753f9eabca095fce8a2cfd506c3fe32
HH.WCS.Mobox3/HH.WCS.Mobox3.XiaoMi/dispatch/GZRobot.cs
@@ -1,10 +1,13 @@
using HH.WCS.XiaoMi.api;
using HH.WCS.XiaoMi.core;
using HH.WCS.XiaoMi.LISTA.dispatch;
using HH.WCS.XiaoMi.util;
using HH.WCS.XiaoMi.wms;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using static HH.WCS.XiaoMi.api.ApiModel;
using static HH.WCS.XiaoMi.LISTA.dispatch.XMWcsHelper;
namespace HH.WCS.XiaoMi.dispatch
{
@@ -204,6 +207,74 @@
        }
        /// <summary>
        /// agv申请绕路
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static GzResult applyReroute(orderReroute model)
        {
            GzResult result = new GzResult();
            try
            {
                var wcsTask = WCSHelper.GetTask(model.orderName);
                if (wcsTask == null)
                {
                    result.resultCode = 1;
                    result.msg = "订单不存在!";
                    return result;
                }
                if (model.orderType == 1)
                {
                    //1表示是否申请绕路
                    var endLoc = LocationHelper.GetLoc(wcsTask.S_END_LOC);
                    if (endLoc.N_CURRENT_NUM == 0 && endLoc.S_LOCK_STATE == "无")
                    {
                        result.resultCode = 0;
                        result.success = true;
                        result.msg = "目标货位已空";
                        return result;
                    }
                    else
                    {
                        result.resultCode = 1;
                        result.success = false;
                        result.msg = "目标货位为满";
                        return result;
                    }
                }
                else
                {
                    //2表示申请目标库位
                    var apply = new ApplyModel() { wcsTaskCode = wcsTask.S_WORKSHOP_NO };
                    var end = XMWcsHelper.GetPositionApply(apply);
                    if (!string.IsNullOrEmpty(end.body.pointCode))
                    {
                        result.resultCode = 0;
                        result.msg = "目标库位已申请";
                        result.orderData = end.body.pointCode;
                        return result;
                    }
                    else
                    {
                        result.resultCode = 1;
                        result.msg = "目标库位已申请";
                        result.orderData = "";
                        return result;
                    }
                }
            }
            catch (Exception ex)
            {
                result.resultCode = 1;
                result.success = false;
                result.msg = $"agv申请绕路出现错误{JsonConvert.SerializeObject(ex.Message)}";
                return result;
            }
        }
        ///// <summary>
        ///// 调用小米状态回报接口
        ///// </summary>