刘磊
2025-06-25 2de09bec5cc05bf875543fa8956167ca7db73021
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/Partial/UntieStation.cs
@@ -10,6 +10,9 @@
using WIDESEA_Comm.AGVInterface.Requset;
using WIDESEA_Common;
using WIDESEA_Core;
using WIDESEA_Core.Const;
using WIDESEA_Core.Helper;
using WIDESEA_DTO;
using WIDESEA_Model.Models;
namespace WIDESEA_StoragIntegrationServices
@@ -17,37 +20,54 @@
    public partial class ToAGVService
    {
        /// <summary>
        ///
        /// PDA执行agv任务直走功能
        /// </summary>
        /// <param name="taskinfo"></param>
        /// <param name="operationType">操作类型(1-绑定 2-解绑)</param>
        /// <returns></returns>
        public static WebResponseContent UntieStation(Dt_Task taskinfo, string operationType)
        public  WebResponseContent UntieStation(SaveModel saveModel)
        {
            WebResponseContent content = new WebResponseContent();
            string CZTM = saveModel.MainData["CZTM"].ToString();
            if (string.IsNullOrEmpty(CZTM)) throw new Exception("车轴条码为空");
            string TargetAddress = saveModel.MainData["TargetAddress"].ToString();
            if (string.IsNullOrEmpty(TargetAddress)) return content.Error("未选择缓存台,缓存台不可为空");
            try
            {
                bindCtnrAndBin bind = new bindCtnrAndBin()
                //调取wcs接口,读取该站台是否可放
                var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
                var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.WCSIPAddress)?.ConfigValue;
                var ReceiveByWMSTask = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.GetPlcState)?.ConfigValue;
                if (ReceiveByWMSTask == null || ipAddress == null)
                {
                    reqCode = Guid.NewGuid().ToString().Replace("-", ""),
                    clientCode = "WMS",
                    ctnrTyp = "2",
                    indBind = operationType,   // 1-绑定 2-解绑
                    stgBinCode = taskinfo.SourceAddress,
                };
                    throw new Exception("WMS IP æœªé…ç½®");
                }
                var wmsIpAddrss = ipAddress + ReceiveByWMSTask;
                string ipaddress = AGV_Interface + "/getCLInfostring";
                var respon = HttpHelper.Post(wmsIpAddrss, JsonConvert.SerializeObject(TargetAddress));   //http://localhost:9291/api/Task/ReceiveTask,
                var requestBindInfo = bind.ToDictionary();
                if (respon == null) return content.OK("生成任务成功");
                var strRespon = HttpsClient.PostAsync(ipaddress, requestBindInfo).Result;
                WebResponseContent respone = JsonConvert.DeserializeObject<WebResponseContent>(respon.ToString());
                if (!respone.Status)
                {
                    return content.Error(respone.Message);
                }
                var responBase = JsonConvert.DeserializeObject<AGVResponBase>(strRespon);
                if (responBase.code != "0") throw new Exception(responBase.message);
                //todo
                return content.OK();
                RequestTaskDto input=new RequestTaskDto();
                input.Position = TargetAddress;
                WebResponseContent agvtocon=genAgvSchedulingTask(input);
                if(agvtocon.Status)
                {
                    return content.OK("生成任务成功");
                }
                else
                {
                    return content.Error("错误信息:"+agvtocon.Message);
                }
            }
            catch (Exception ex)
            {