dengjunjie
7 天以前 6c026d34f26d9c986fb1752d740deab3499f2ec5
添加接口调用:裁片入库3F到4F运输箱号校验、4F提升机出口托盘号上报WMS
已添加2个文件
已修改4个文件
227 ■■■■ 文件已修改
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSReturn.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/inboundElevatorExitDTO.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/inboundTransportCheckDTO.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TSJJob.cs 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSReturn.cs
@@ -23,11 +23,11 @@
        /// <summary>
        /// TRUE
        /// </summary>
        public string success { get; set; }
        public bool success { get; set; }
        /// <summary>
        /// æˆåŠŸ
        /// </summary>
        public string result { get; set; }
        public object result { get; set; }
        /// <summary>
        /// æ—¶é—´æˆ³
        /// </summary>
@@ -38,4 +38,16 @@
        /// </summary>
        public object data { get; set; }
    }
    public class Exists
    {
        /// <summary>
        /// æ˜¯å¦åœ¨é€”
        /// </summary>
        public bool taskExists { get; set; }
        /// <summary>
        /// å¼‚常地址
        /// </summary>
        public string errorAreaCode { get; set; }
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/inboundElevatorExitDTO.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WIDESEAWCS_DTO.WMS
{
    /// <summary>
    /// 4F提升机出口托盘号上报WMS
    /// </summary>
    public class inboundElevatorExitDTO
    {
        public string containerCode { get; set; }
        public string toLocationCode { get; set; }
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/inboundTransportCheckDTO.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WIDESEAWCS_DTO.WMS
{
    /// <summary>
    /// è£ç‰‡å…¥åº“3F到4F运输箱号校验
    /// </summary>
    public class inboundTransportCheckDTO
    {
        /// <summary>
        /// æ‰˜ç›˜å·
        /// </summary>
        public string containerCode { get; set; }
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
@@ -270,6 +270,13 @@
        /// <returns></returns>
        public WebResponseContent MaterialBoxInspection(string taskCode ,string containerCode);
        /// <summary>
        /// 4F提升机出口托盘号上报WMS
        /// </summary>
        /// <param name="LocationCode"></param>
        /// <param name="containerCode"></param>
        /// <returns></returns>
        public WebResponseContent InboundElevatorExit(string LocationCode, string containerCode);
        /// <summary>
        /// wcs移库数据回传
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -16,6 +16,7 @@
#endregion << ç‰ˆ æœ¬ æ³¨ é‡Š >>
using AutoMapper;
using Newtonsoft.Json;
using SixLabors.ImageSharp.ColorSpaces;
using SqlSugar;
using System.Collections.Generic;
@@ -1233,7 +1234,28 @@
        {
            throw new NotImplementedException();
        }
        public WebResponseContent InboundElevatorExit(string LocationCode, string containerCode)
        {
            WebResponseContent content = new WebResponseContent();
            inboundElevatorExitDTO inboundElevator=new inboundElevatorExitDTO();
            try
            {
                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(inboundElevatorExitDTO)) ?? throw new Exception("未找到4F提升机出口托盘号上报WMS接口配置信息!请检查接口配置");
                inboundElevator.containerCode= containerCode;
                inboundElevator.toLocationCode = LocationCode;
                string response = HttpHelper.Post(apiInfo.ApiAddress, inboundElevator.Serialize());
                content.OK(data: response);
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
            {
                return WebResponseContent.Instance.Error(ex.Message);
            }
            finally
            {
                _trackloginfoService.AddTrackLog(inboundElevator, content, "4F提升机出口托盘号上报WMS", "", "");
            }
        }
        /// <summary>
        /// æ–™ç®±éªŒè¯
        /// </summary>
@@ -1242,7 +1264,30 @@
        /// <returns></returns>
        public WebResponseContent MaterialBoxInspection(string taskCode, string containerCode)
        {
            throw new NotImplementedException();
            WebResponseContent content = new WebResponseContent();
            inboundTransportCheckDTO checkDTO = new inboundTransportCheckDTO();
            try
            {
                checkDTO.containerCode = containerCode;
                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(inboundTransportCheckDTO)) ?? throw new Exception("未找到裁片入库3F到4F运输箱号校验接口配置信息!请检查接口配置");
                string response = HttpHelper.Post(apiInfo.ApiAddress, checkDTO.Serialize());
                content.OK(data: response);
                WMSReturn wMSReturn = response.DeserializeObject<WMSReturn>();
                if (wMSReturn == null) throw new Exception("WMS返回结果转换失败!");
                if (!wMSReturn.success) throw new Exception(wMSReturn.message);
                string dataJson = wMSReturn.result.ToString();
                Exists? exists = JsonConvert.DeserializeObject<Exists>(dataJson);
                if (exists == null) throw new Exception($"WMS返回结果的result转换失败");
                return WebResponseContent.Instance.OK(exists.errorAreaCode);
            }
            catch (Exception ex)
            {
                return WebResponseContent.Instance.Error(ex.Message);
            }
            finally
            {
                _trackloginfoService.AddTrackLog(checkDTO, content, "裁片入库3F到4F运输箱号校验", "", "");
            }
        }
        /// <summary>
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TSJJob.cs
@@ -30,7 +30,7 @@
{
    [DisallowConcurrentExecution]
    public class TSJJob : JobBase, IJob
    {
    {
        private readonly ITaskService _taskService;
        private readonly IStationMangerService _stationMangerService;
        public TSJJob(ITaskService taskService, IStationMangerService stationMangerService)
@@ -146,7 +146,7 @@
                                    }
                                    continue;
                                }
                                if (device.GetValue<HoistEnum, short>(HoistEnum.ROutScanningCompletionSignal, task.SourceAddress) != 1)
                                {
                                    if (task.ExceptionMessage != "4楼提升机出口扫码完成信号没有完成")
@@ -172,60 +172,79 @@
                            task.ExceptionMessage = "";
                            Uptasks.Add(task);
                        }
                    }
                    #region æ‰˜ç›˜å·ç¡®è®¤ä¸­
                    //查找三楼入库任务状态为CheckPalletCodeing的任务托盘号确认中
                    var RK3FTasks = _taskService.Repository.QueryFirst(x => x.TaskType == TaskTypeEnum.RK3F.ObjToInt() && x.TaskState == (int)TaskStatusEnum.CheckPalletCodeing);
                    if (RK3FTasks != null)
                    {
                        //检查3楼入库箱号是多少,然后传给wms
                        var BinNumber = device.GetValue<HoistEnum, string>(HoistEnum.Inboxnumber, RK3FTasks.TargetAddress);
                        BinNumber = BinNumber?.TrimEnd('\0')?.Substring(2);
                        if (device.GetValue<HoistEnum, short>(HoistEnum.RInScanningCompletionSignal, RK3FTasks.TargetAddress ) !=1 )
                        {
                            RK3FTasks.ExceptionMessage = "3楼扫码完成信号没有完成";
                        }
                        else //完成就把任务状态改成托盘号确认完成
                        {
                            //根据读到的箱号进行料箱检验,检验通过就触发读码器读取,如果不通过就抛出异常
                            //var Verification = _taskService.MaterialBoxInspection(RK3FTasks.WMSTaskNum, BinNumber.ToString());
                            //if (!Verification.Status)
                            //{
                            //    if (!(RK3FTasks.ExceptionMessage == Verification.Message))
                            //    {
                            //        RK3FTasks.ExceptionMessage = Verification.Message;
                            //        Uptasks.Add(RK3FTasks);
                            //    }
                            //    //料箱验证写好后,需要更改
                            //    RK3FTasks.TargetAddress = Verification.Data.ToString();
                            //}
                            //如果料箱检验成功就写入读码器的值
                            var result = _taskService.Hikvisiontaskscontinue(RK3FTasks.WMSTaskNum, RK3FTasks.TargetAddress);
                            if (result.Status == false)
                            {
                                if (RK3FTasks.ExceptionMessage != result.Message)
                                {
                                    RK3FTasks.ExceptionMessage = result.Message;
                                    Uptasks.Add(RK3FTasks);
                                }
                            }
                            RK3FTasks.ExceptionMessage = "";
                            RK3FTasks.TaskState = (int)TaskStatusEnum.CheckPalletCodeFinish;
                        }
                        Uptasks.Add(RK3FTasks);
                    }
                    #endregion
                    if (Uptasks.Count > 0)
                    {
                        _taskService.UpdateData(Uptasks);
                    }
                    WriteInfo(device.DeviceName, "infoLog");
                    WriteDebug(device.DeviceName, "debugLog");
                    #region æ‰˜ç›˜å·ç¡®è®¤ä¸­
                    //查找三楼入库任务状态为CheckPalletCodeing的任务托盘号确认中
                    var RK3FTask = _taskService.Repository.QueryFirst(x => x.TaskType == TaskTypeEnum.RK3F.ObjToInt() && x.TaskState == (int)TaskStatusEnum.CheckPalletCodeing);
                    if (RK3FTask != null)
                    {
                        if (device.GetValue<HoistEnum, short>(HoistEnum.RInScanningCompletionSignal, RK3FTask.TargetAddress) != 1)
                        {
                            RK3FTask.ExceptionMessage = "3楼扫码完成信号没有完成";
                            _taskService.UpdateData(RK3FTask);
                        }
                        else //完成就把任务状态改成托盘号确认完成
                        {
                            //检查3楼入库箱号是多少,然后传给wms
                            var BinNumber = device.GetValue<HoistEnum, string>(HoistEnum.Inboxnumber, RK3FTask.TargetAddress);
                            if (!string.IsNullOrEmpty(BinNumber))
                            {
                                BinNumber = BinNumber.TrimEnd('\0').Substring(2);
                                //根据读到的箱号进行料箱检验,检验通过就触发读码器读取,如果不通过就抛出异常
                                var Verification = _taskService.MaterialBoxInspection(RK3FTask.WMSTaskNum, BinNumber);
                                if (!Verification.Status)
                                {
                                    if (RK3FTask.ExceptionMessage != Verification.Message)
                                    {
                                        RK3FTask.ExceptionMessage = Verification.Message;
                                        _taskService.UpdateData(RK3FTask);
                                    }
                                }
                                else
                                {
                                    if (!string.IsNullOrEmpty(Verification.Message)) RK3FTask.TargetAddress = Verification.Message;
                                    //如果料箱检验成功就写入读码器的值
                                    var result = _taskService.Hikvisiontaskscontinue(RK3FTask.WMSTaskNum, RK3FTask.TargetAddress);
                                    if (result.Status)
                                    {
                                        RK3FTask.ExceptionMessage = "";
                                        RK3FTask.TaskState = (int)TaskStatusEnum.CheckPalletCodeFinish;
                                        _taskService.UpdateData(RK3FTask);
                                    }
                                    else
                                    {
                                        if (RK3FTask.ExceptionMessage != result.Message)
                                        {
                                            RK3FTask.ExceptionMessage = result.Message;
                                            _taskService.UpdateData(RK3FTask);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    #endregion
                    #region 4F提升机出口托盘号上报WMS
                    var Address = "TSJC4F";
                    if (device.GetValue<HoistEnum, short>(HoistEnum.ROutScanningCompletionSignal, Address) == 1)
                    {
                        var BinNumber = device.GetValue<HoistEnum, string>(HoistEnum.Emptycontainernumber, Address);
                        if (!string.IsNullOrEmpty(BinNumber))
                        {
                            BinNumber = BinNumber.TrimEnd('\0').Substring(2);
                            _taskService.InboundElevatorExit(Address, BinNumber);
                        }
                    }
                    #endregion
                    //WriteInfo(device.DeviceName, "infoLog");
                    //WriteDebug(device.DeviceName, "debugLog");
                }
                catch (Exception ex)
                {