肖洋
2024-11-20 0f4a3549ec70f5799294a836dee3cadda2660852
MOMIP改为可配置
已修改5个文件
214 ■■■■ 文件已修改
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/Unbind/UnbindService.cs 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs
@@ -25,6 +25,11 @@
        /// IP接口地址
        /// </summary>
        public const string CONFIG_SYS_IPAddress = "CONFIG_SYS_IPAddress";
        /// <summary>
        /// MOM接口地址
        /// </summary>
        public const string SYS_MOMIPAddress = "SYS_MOMIPAddress";
    }
    /// <summary>
@@ -75,5 +80,45 @@
        /// HK IP
        /// </summary>
        public const string HKIPAddress = "HKIPAddress";
        /// <summary>
        /// MOMIP地址
        /// </summary>
        public const string MOMBaseIP = "MOMBaseIP";
        /// <summary>
        /// 单电芯属性获取
        /// </summary>
        public const string CellState = "CellState";
        /// <summary>
        /// 整盘电芯属性获取
        /// </summary>
        public const string TrayCellsStatus = "TrayCellsStatus";
        /// <summary>
        /// 静置\陈化入库(整托盘)
        /// </summary>
        public const string AgingInput = "AgingInput";
        /// <summary>
        /// 静置\陈化出库(整托盘)
        /// </summary>
        public const string AgingOutput = "AgingOutput";
        /// <summary>
        /// 工艺路线申请
        /// </summary>
        public const string ProcessApply = "ProcessApply";
        /// <summary>
        /// 托盘单电芯解绑
        /// </summary>
        public const string TrayCellUnbind = "TrayCellUnbind";
        /// <summary>
        /// 整盘电芯解绑
        /// </summary>
        public const string TrayUnbind = "TrayUnbind";
    }
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs
@@ -2,8 +2,11 @@
using Masuit.Tools;
using WIDESEA_Common;
using WIDESEA_Core;
using WIDESEA_Core.Const;
using WIDESEA_DTO;
using WIDESEA_DTO.MOM;
using WIDESEA_IServices;
using WIDESEA_IStorageBasicService;
using WIDESEA_IStoragIntegrationServices;
namespace WIDESEA_StoragIntegrationServices;
@@ -11,6 +14,12 @@
public class AgingInOrOutInputService : IAgingInOrOutInputService
{
    private readonly LogFactory LogFactory = new LogFactory();
    private readonly ISys_ConfigService _configService;
    public AgingInOrOutInputService(ISys_ConfigService configRepository)
    {
        _configService = configRepository;
    }
    /// <summary>
    /// 静置\陈化入库(整托盘)
@@ -26,11 +35,21 @@
            input.EmployeeNo = "MITest";
            input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
            var inputJson = input.ToDictionary();
            var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/AgingInput", inputJson);
            content.OK(data: x);
            var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress);
            var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue;
            var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.AgingInput)?.ConfigValue;
            if (wmsBase == null || ipAddress == null)
            {
                throw new InvalidOperationException("WMS IP 未配置");
            }
            var wmsIpAddress = wmsBase + ipAddress;
            var result = HttpsClient.PostAsync(wmsIpAddress, inputJson).Result;
            //var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/AgingInput", inputJson);
            content.OK(data: result);
            LogFactory.GetLog("静置陈化入库(整托盘)").Info(true, $"\r\r--------------------------------------");
            LogFactory.GetLog("静置陈化入库(整托盘)").Info(true, x);
            LogFactory.GetLog("静置陈化入库(整托盘)").Info(true, result);
        }
        catch (Exception err)
        {
@@ -55,10 +74,20 @@
            input.EmployeeNo = "MITest";
            input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
            var inputJson = input.ToDictionary();
            var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/AgingOutput", inputJson);
            content.OK(data: x);
            var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress);
            var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue;
            var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.AgingOutput)?.ConfigValue;
            if (wmsBase == null || ipAddress == null)
            {
                throw new InvalidOperationException("WMS IP 未配置");
            }
            var wmsIpAddress = wmsBase + ipAddress;
            var result = HttpsClient.PostAsync(wmsIpAddress, inputJson).Result;
            //var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/AgingOutput", inputJson);
            content.OK(data: result);
            LogFactory.GetLog("静置陈化出库(整托盘)").Info(true, $"\r\r--------------------------------------");
            LogFactory.GetLog("静置陈化出库(整托盘)").Info(true, x);
            LogFactory.GetLog("静置陈化出库(整托盘)").Info(true, result);
        }
        catch (Exception err)
        {
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs
@@ -3,9 +3,14 @@
using Newtonsoft.Json;
using WIDESEA_Common;
using WIDESEA_Core;
using WIDESEA_Core.Const;
using WIDESEA_Core.Helper;
using WIDESEA_DTO;
using WIDESEA_IRepository;
using WIDESEA_IServices;
using WIDESEA_IStorageBasicService;
using WIDESEA_IStoragIntegrationServices;
using static Org.BouncyCastle.Math.EC.ECCurve;
namespace WIDESEA_StoragIntegrationServices;
@@ -14,10 +19,12 @@
    private readonly LogFactory LogFactory = new LogFactory();
    private readonly IBoxingInfoService _boxingInfoService;
    private readonly ISys_ConfigService _configService;
    public CellStateService(IBoxingInfoService boxingInfoService)
    public CellStateService(IBoxingInfoService boxingInfoService, ISys_ConfigService configRepository)
    {
        _boxingInfoService = boxingInfoService;
        _configService = configRepository;
    }
    /// <summary>
@@ -34,7 +41,17 @@
            input.EmployeeNo = "MITest";
            input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
            var inputJson = input.ToDictionary();
            var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/CellState", inputJson);
            var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress);
            var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue;
            var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.CellState)?.ConfigValue;
            if (wmsBase == null || ipAddress == null)
            {
                throw new InvalidOperationException("WMS IP 未配置");
            }
            var wmsIpAddress = wmsBase + ipAddress;
            var result = HttpsClient.PostAsync(wmsIpAddress, inputJson).Result;
            //var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/CellState", inputJson);
            #region
            //if (x != null)
            //{
@@ -65,8 +82,8 @@
            #endregion
            LogFactory.GetLog("单电芯属性获取").Info(true, $"\r\r--------------------------------------");
            LogFactory.GetLog("单电芯属性获取").Info(true, x);
            return x;
            LogFactory.GetLog("单电芯属性获取").Info(true, result);
            return result;
        }
        catch (Exception err)
        {
@@ -93,36 +110,21 @@
            input.EmployeeNo = "MITest";
            input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
            var inputJson = input.ToDictionary();
            var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/TrayCellsStatus", inputJson);
            if (x != null)
            var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress);
            var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue;
            var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.TrayCellsStatus)?.ConfigValue;
            if (wmsBase == null || ipAddress == null)
            {
                // 反序列化ResultTrayCellsStatus对象
                //ResultTrayCellsStatus result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(x);
                //// 创建DtBoxingInfo对象
                //DtBoxingInfo boxingInfo = new DtBoxingInfo
                //{
                //    IsFull = true,
                //    PalletCode = result.TrayBarcode,
                //};
                //// 使用LINQ创建DtBoxingInfoDetail对象列表
                //var details = result.SerialNos.Select(item => new DtBoxingInfoDetail
                //{
                //    SerialNumber = item.SerialNo,
                //    OrderNo = item.PositionNo.ToString(),
                //    Status = item.SerialNoStatus,
                //    Remark = result.TrayBarcodePropertys.ToJsonString(),
                //    MaterielCode = result.BindCode,
                //}).ToList();
                //// 赋值DtBoxingInfoDetails
                //boxingInfo.BoxingInfoDetails = details;
                //var abc = await _boxingInfoService.AddBoxingInfoAsync(boxingInfo);
                content.OK("组盘成功", x);
                throw new InvalidOperationException("WMS IP 未配置");
            }
            var wmsIpAddress = wmsBase + ipAddress;
            var result = HttpsClient.PostAsync(wmsIpAddress, inputJson).Result;
            //var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/TrayCellsStatus", inputJson);
            LogFactory.GetLog("整盘电芯属性获取").Info(true, $"\r\r--------------------------------------");
            LogFactory.GetLog("整盘电芯属性获取").Info(true, x);
            LogFactory.GetLog("整盘电芯属性获取").Info(true, result);
            content.OK(data: result);
        }
        catch (Exception err)
        {
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
@@ -3,8 +3,10 @@
using Newtonsoft.Json;
using WIDESEA_Common;
using WIDESEA_Core;
using WIDESEA_Core.Const;
using WIDESEA_DTO;
using WIDESEA_DTO.MOM;
using WIDESEA_IServices;
using WIDESEA_IStoragIntegrationServices;
namespace WIDESEA_StoragIntegrationServices;
@@ -12,6 +14,12 @@
public class ProcessApplyService : IProcessApplyService
{
    private readonly LogFactory LogFactory = new LogFactory();
    private readonly ISys_ConfigService _configService;
    public ProcessApplyService(ISys_ConfigService configRepository)
    {
        _configService = configRepository;
    }
    /// <summary>
    /// 工艺路线申请
@@ -26,15 +34,25 @@
            input.SessionId = Guid.NewGuid().ToString();
            input.EmployeeNo = "MITest";
            input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
            var inputIson = input.ToDictionary();
            var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/ProcessApply", inputIson);
            if (x != null)
            var inputJson = input.ToDictionary();
            var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress);
            var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue;
            var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.ProcessApply)?.ConfigValue;
            if (wmsBase == null || ipAddress == null)
            {
                throw new InvalidOperationException("WMS IP 未配置");
            }
            var wmsIpAddress = wmsBase + ipAddress;
            var result = HttpsClient.PostAsync(wmsIpAddress, inputJson).Result;
            //var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/ProcessApply", inputJson);
            if (result != null)
            {
                //var ResultProcess = JsonConvert.DeserializeObject<ResultProcessApply>(x);
                content.OK(data: x);
                content.OK(data: result);
            }
            LogFactory.GetLog("工艺路线申请").Info(true, $"\r\r--------------------------------------");
            LogFactory.GetLog("工艺路线申请").Info(true, x);
            LogFactory.GetLog("工艺路线申请").Info(true, result);
        }
        catch (Exception ex)
        {
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/Unbind/UnbindService.cs
@@ -7,7 +7,9 @@
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common;
using WIDESEA_Core.Const;
using WIDESEA_DTO;
using WIDESEA_IServices;
using WIDESEA_IStoragIntegrationServices;
namespace WIDESEA_StoragIntegrationServices;
@@ -15,6 +17,12 @@
public class UnbindService : IUnbindService
{
    private readonly LogFactory LogFactory = new LogFactory();
    private readonly ISys_ConfigService _configService;
    public UnbindService(ISys_ConfigService configRepository)
    {
        _configService = configRepository;
    }
    /// <summary>
    /// 托盘单电芯解绑
@@ -32,9 +40,19 @@
            input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
            var inputJson = input.ToDictionary();
            LogFactory.GetLog("托盘单电芯解绑1").Info(true, JsonConvert.SerializeObject(inputJson));
            var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/TrayCellUnbind", inputJson);
            var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress);
            var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue;
            var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.TrayCellUnbind)?.ConfigValue;
            if (wmsBase == null || ipAddress == null)
            {
                throw new InvalidOperationException("WMS IP 未配置");
            }
            var wmsIpAddress = wmsBase + ipAddress;
            var result = HttpsClient.PostAsync(wmsIpAddress, inputJson).Result;
            //var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/TrayCellUnbind", inputJson);
            LogFactory.GetLog("托盘单电芯解绑").Info(true, $"\r\r--------------------------------------");
            LogFactory.GetLog("托盘单电芯解绑").Info(true, x);
            LogFactory.GetLog("托盘单电芯解绑").Info(true, result);
        }
        catch (Exception ex)
        {
@@ -61,9 +79,19 @@
            input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
            var inputJson = input.ToDictionary();
            Console.WriteLine(inputJson);
            var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/TrayUnbind", inputJson);
            var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress);
            var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue;
            var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.TrayUnbind)?.ConfigValue;
            if (wmsBase == null || ipAddress == null)
            {
                throw new InvalidOperationException("WMS IP 未配置");
            }
            var wmsIpAddress = wmsBase + ipAddress;
            var result = HttpsClient.PostAsync(wmsIpAddress, inputJson).Result;
            //var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/TrayUnbind", inputJson);
            LogFactory.GetLog("整盘电芯解绑").Info(true, $"\r\r--------------------------------------");
            LogFactory.GetLog("整盘电芯解绑").Info(true, x);
            LogFactory.GetLog("整盘电芯解绑").Info(true, result);
        }
        catch (Exception ex)
        {