wangxinhui
4 天以前 a0a0df2e824b6fe7e5a3c0afce78127fecf84fc9
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -27,6 +27,7 @@
using WIDESEAWCS_Core.Enums;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_Core.LogHelper;
using WIDESEAWCS_DTO;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_IBasicInfoRepository;
using WIDESEAWCS_ITaskInfoRepository;
@@ -337,7 +338,7 @@
        // <summary>
        /// å…¥åº“申请
        /// </summary>
        public WebResponseContent YLPurchaseBoxing(string palletCode)
        public WebResponseContent YLPurchaseBoxing(string palletCode, decimal weight = 0, decimal thickness = 0, decimal wide = 0,string stationCode="")
        {
            WebResponseContent? content = new WebResponseContent();
            try
@@ -347,7 +348,7 @@
                {
                    return WebResponseContent.Instance.Error($"未找到WMSApi地址");
                }
                string responseStr = HttpHelper.Get($"{address}/api/Task/YLPurchaseBoxing?palletCode={palletCode}");
                string responseStr = HttpHelper.Get($"{address}/api/Task/YLPurchaseBoxing?palletCode={palletCode}&weight={weight}&thickness={thickness}&wide={wide}&stationCode={stationCode}");
                WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
                content = responseContent;
@@ -464,6 +465,44 @@
            }
            return content;
        }
        public WebResponseContent MESBoxCodeNotice(string boxCode)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                string address = AppSettings.Get("WMSApiAddress");
                if (string.IsNullOrEmpty(address))
                {
                    return WebResponseContent.Instance.Error($"未找到WMSApi地址");
                }
                string responseStr = HttpHelper.Get($"{address}/api/Mes/MESBoxCodeNotice?boxCode={boxCode}");
                return content.OK(responseStr);
            }
            catch (Exception ex)
            {
                content = WebResponseContent.Instance.Error(ex.Message);
            }
            return content;
        }
        public WebResponseContent MESAvgArriveNotice(RequestAGVArriveDTO requestAGVArriveDTO)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                string address = AppSettings.Get("WMSApiAddress");
                if (string.IsNullOrEmpty(address))
                {
                    return WebResponseContent.Instance.Error($"未找到WMSApi地址");
                }
                string responseStr = HttpHelper.Post($"{address}/api/Mes/MESAvgArriveNotice", requestAGVArriveDTO.Serialize());
                return content.OK(responseStr);
            }
            catch (Exception ex)
            {
                content = WebResponseContent.Instance.Error(ex.Message);
            }
            return content;
        }
        public WebResponseContent CPEmptyInbound(string palletCode,string SourceAddress)
        {
            WebResponseContent content = new WebResponseContent();
@@ -496,6 +535,26 @@
            string address = AppSettings.Get("WMSApiAddress");
            if (string.IsNullOrEmpty(address)) throw new Exception("未找到WMSApi地址");
            string responseStr = HttpHelper.Get($"{address}/api/Task/AssignInboundTaskLocation?taskNum={taskNum}&roadwayNo={roadwayNo}");
            WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
            if (responseContent != null && responseContent.Status && responseContent.Data != null)
            {
                return responseContent.Data.ToString();
            }
            return "";
        }
        /// <summary>
        /// å‘WMS申请出库AGV终点
        /// </summary>
        /// <param name="taskNum">任务号</param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        public string? RequestTargetAddress(int taskNum)
        {
            string address = AppSettings.Get("WMSApiAddress");
            if (string.IsNullOrEmpty(address)) throw new Exception("未找到WMSApi地址");
            string responseStr = HttpHelper.Get($"{address}/api/Task/AssignOutTargetAddress?taskNum={taskNum}");
            WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
            if (responseContent != null && responseContent.Status && responseContent.Data != null)
@@ -596,7 +655,7 @@
                task.ModifyDate = DateTime.Now;
                BaseDal.UpdateData(task);
                _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, task.ExceptionMessage);
                _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, task.ExceptionMessage);
                content = WebResponseContent.Instance.OK();
            }
@@ -638,7 +697,7 @@
                BaseDal.UpdateData(task);
                _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"人工恢复挂起任务,恢复挂起时任务状态【{task.TaskState}】");
                _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"人工恢复挂起任务,恢复挂起时任务状态【{task.TaskState}】");
                content = WebResponseContent.Instance.OK();
            }
@@ -679,7 +738,7 @@
                BaseDal.UpdateData(task);
                _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"人工将任务状态从【{oldState}】回滚到【{task.TaskState}】");
                _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"人工将任务状态从【{oldState}】回滚到【{task.TaskState}】");
                content = WebResponseContent.Instance.OK();
            }