1
huanghongfeng
2024-11-11 3ecd03b3a0a30a57153468beaed3199bfe906772
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -85,6 +85,7 @@
        public string urlWMSMovelibraryTask = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlWMSMovelibraryTask"];
        public string urlRelocationTaskCompleted = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlRelocationTaskCompleted"];
        public string urlQueryinventory = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlQueryinventory"];
        public string urlEmptyOutbound = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlEmptyOutbound"];
        /// <summary>
        /// æŽ¥æ”¶WMS任务信息
        /// </summary>
@@ -128,13 +129,22 @@
        /// <param name="palletCode">托盘号</param>
        /// <param name="sourceAddress">起始地址</param>
        /// <returns></returns>
        public class GenerateInv
        {
            public string SourceAddress { get; set; }
            public string PalletCode { get; set; }
        }
        public WebResponseContent RequestWMSTask(string palletCode, string sourceAddress)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                palletCode = "6431-jdsda-jjal333-300";
                content = HttpHelper.Get<WebResponseContent>($"{urlWMSTask}?sourceAddress={sourceAddress}&palletCode={palletCode}");
                GenerateInv generate = new GenerateInv()
                {
                    SourceAddress=sourceAddress,
                    PalletCode = palletCode
                };
                content = HttpHelper.Post<WebResponseContent>($"{urlWMSTask}", generate);
                Dt_Task task = new Dt_Task();
                if (content != null)
                {
@@ -164,7 +174,7 @@
            return content;
        }
        /// <summary>
        /// æŸ¥è¯¢åº“位
        /// è¿›è¡Œç»„盘
        /// </summary>
        /// <param name="palletCode"></param>
        /// <returns></returns>
@@ -174,7 +184,46 @@
            return  content = HttpHelper.Get<WebResponseContent>($"{urlQueryinventory}?palletCode={palletCode}");
        }
        /// <summary>
        /// æ ¹æ®æ‰˜ç›˜å·ã€èµ·å§‹åœ°å€å‘WMS请求任务
        /// </summary>
        /// <param name="palletCode">托盘号</param>
        /// <param name="sourceAddress">起始地址</param>
        /// <returns></returns>
        public WebResponseContent RequestWMSTask2(string sourceAddress)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                content = HttpHelper.Get<WebResponseContent>($"{urlEmptyOutbound}?sourceAddress={sourceAddress}");
                Dt_Task task = new Dt_Task();
                if (content != null)
                {
                    if (content.Status)
                    {
                        task = JsonConvert.DeserializeObject<Dt_Task>(content.Data.ToString());
                        task.TaskState = (int)TaskInStatusEnum.Line_InFinish;
                        task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02";
                        BaseDal.AddData(task);
                        return content = WebResponseContent.Instance.OK();
                    }
                    else
                    {
                        return content = WebResponseContent.Instance.Error();
                    }
                }
                else
                {
                    return content = WebResponseContent.Instance.Error();
                }
            }
            catch (Exception ex)
            {
                return content = WebResponseContent.Instance.Error(ex.Message);
            }
        }
        /// <summary>
        /// æ ¹æ®æ·±åº“位向wms申请判断浅库位是否有货,是否需要进行移库操作
        /// </summary>
@@ -271,8 +320,8 @@
        }
        public Dt_Task IngStackerCraneTask(string deviceNo)
        {
            string deviceNot = deviceNo == "SC01" ? "1" : "2";
            return BaseDal.QueryFirst(x => x.Roadway == deviceNot && x.TaskState == (int)TaskInStatusEnum.SC_InExecuting);
            //string deviceNot = deviceNo == "SC01" ? "1" : "2";
            return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskState == (int)TaskInStatusEnum.SC_InExecuting);
        }
        /// <summary>