From 0dfb009511d5265194d9162008e0faf60961b666 Mon Sep 17 00:00:00 2001
From: 陈勇 <chenyong@hnkhzn.com>
Date: 星期四, 14 十一月 2024 09:51:19 +0800
Subject: [PATCH] WCS合并  WMS分容接口

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/RequsetCellInfo.cs                                      |   24 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MCS/MCSController.cs                      |   39 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/NotifyFinishTest.cs                                     |   32 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/WorkState.cs                                            |   31 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/NotifyFinishTest.cs       |   83 ++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/NotityInFinish.cs                                       |   27 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs                                        |    6 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/ConveyorLineTaskCommand_After.cs |   71 ++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequsetCellInfo.cs        |   39 +
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/ConveyorLineDBName_After.cs      |   79 ++
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine_After.cs           |  333 +++++++++++
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs   |  702 +++++++++++++++++++++++++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs                                       |   15 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/CustomProfile.cs                               |    1 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MCS/IMCSService.cs                   |   20 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/MCSService.cs                     |   26 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/ModifyAccessStatus.cs     |   58 ++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs  |   38 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/RequestReMove.cs                                        |   32 +
 19 files changed, 1,656 insertions(+), 0 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine_After.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine_After.cs
new file mode 100644
index 0000000..6be648e
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine_After.cs
@@ -0,0 +1,333 @@
+锘�#region << 鐗� 鏈� 娉� 閲� >>
+
+/*----------------------------------------------------------------
+ * 鍛藉悕绌洪棿锛歐IDESEAWCS_QuartzJob
+ * 鍒涘缓鑰咃細鑳$搴�
+ * 鍒涘缓鏃堕棿锛�2024/8/2 16:13:36
+ * 鐗堟湰锛歏1.0.0
+ * 鎻忚堪锛氫竴鑸緭閫佺嚎瀹炵幇绫�
+ *
+ * ----------------------------------------------------------------
+ * 淇敼浜猴細
+ * 淇敼鏃堕棿锛�
+ * 鐗堟湰锛歏1.0.1
+ * 淇敼璇存槑锛�
+ *
+ *----------------------------------------------------------------*/
+
+#endregion << 鐗� 鏈� 娉� 閲� >>
+
+using HslCommunication;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Communicator;
+using WIDESEAWCS_QuartzJob.ConveyorLine.Enum;
+using WIDESEAWCS_QuartzJob.DeviceBase;
+using WIDESEAWCS_QuartzJob.DTO;
+using WIDESEAWCS_QuartzJob.StackerCrane.Enum;
+
+namespace WIDESEAWCS_QuartzJob
+{
+    [Description("杈撻�佺嚎")]
+    public class CommonConveyorLine_After : IConveyorLine
+    {
+        #region Private Member
+
+        /// <summary>
+        /// 鍫嗗灈鏈洪�氳瀵硅薄
+        /// </summary>
+        private readonly BaseCommunicator _communicator;
+
+        /// <summary>
+        /// 鍫嗗灈鏈哄崗璁俊鎭�
+        /// </summary>
+        private readonly List<DeviceProDTO> _deviceProDTOs;
+
+        /// <summary>
+        /// 鍫嗗灈鏈哄崗璁槑缁嗕俊鎭�
+        /// </summary>
+        private readonly List<DeviceProtocolDetailDTO> _deviceProtocolDetailDTOs;
+
+        /// <summary>
+        /// 璁惧缂栧彿
+        /// </summary>
+        public readonly string _deviceCode;
+
+        /// <summary>
+        /// 璁惧鍚嶇О
+        /// </summary>
+        public readonly string _deviceName;
+
+        private bool _heartStatr = true;
+
+        private bool _isConnected = true;
+
+        #endregion
+
+        #region Public Member
+
+        /// <summary>
+        /// 杈撻�佺嚎閫氳瀵硅薄
+        /// </summary>
+        public BaseCommunicator Communicator => _communicator;
+
+        /// <summary>
+        /// 杈撻�佺嚎鍗忚淇℃伅
+        /// </summary>
+        public List<DeviceProDTO> DeviceProDTOs => _deviceProDTOs;
+
+        /// <summary>
+        /// 杈撻�佺嚎鍗忚鏄庣粏淇℃伅
+        /// </summary>
+        public List<DeviceProtocolDetailDTO> DeviceProtocolDetailDTOs => _deviceProtocolDetailDTOs;
+
+        /// <summary>
+        /// 璁惧缂栧彿
+        /// </summary>
+        public string DeviceCode => _deviceCode;
+
+        /// <summary>
+        /// 璁惧鍚嶇О
+        /// </summary>
+        public string DeviceName => _deviceName;
+
+        /// <summary>
+        /// 鏄惁鏈夋晠闅�
+        /// </summary>
+        public bool IsFault => false;
+
+        /// <summary>
+        /// 閫氳鏄惁宸茶繛鎺�
+        /// </summary>
+        public bool IsConnected => Communicator.IsConnected && _isConnected;
+
+        /// <summary>
+        /// 璁惧鐘舵��
+        /// </summary>
+        public DeviceStatus Status => DeviceStatus.Offline;
+
+        #endregion
+
+        #region Constructor Function
+
+        /// <summary>
+        /// 鏋勯�犲嚱鏁�
+        /// </summary>
+        /// <param name="communicator">鍫嗗灈鏈洪�氳瀵硅薄</param>
+        /// <param name="deviceProDTOs">鍫嗗灈鏈哄崗璁俊鎭�</param>
+        /// <param name="deviceProtocolDetailDTOs">鍫嗗灈鏈哄崗璁槑缁嗕俊鎭�</param>
+        /// <param name="deviceCode">璁惧缂栧彿</param>
+        /// <param name="deviceName">璁惧鍚嶇О</param>
+        public CommonConveyorLine_After(BaseCommunicator communicator, List<DeviceProDTO> deviceProDTOs, List<DeviceProtocolDetailDTO> deviceProtocolDetailDTOs, string deviceCode, string deviceName)
+        {
+            _communicator = communicator;
+            _deviceProDTOs = deviceProDTOs;
+            _deviceProtocolDetailDTOs = deviceProtocolDetailDTOs;
+            _deviceCode = deviceCode;
+            _deviceName = deviceName;
+            CheckConnect();
+        }
+
+        #endregion
+
+        #region Private Method
+
+        private void CheckConnect()
+        {
+            Task.Run(() =>
+            {
+                while (_heartStatr)
+                {
+                    try
+                    {
+                        DeviceProDTO? devicePro = _deviceProDTOs.FirstOrDefault();
+                        if (devicePro == null)
+                            _isConnected = false;
+                        else
+                            Communicator.ReadAsObj(devicePro.DeviceProAddress, devicePro.DeviceDataType);
+                        _isConnected = true;
+                    }
+                    catch (Exception ex)
+                    {
+                        _isConnected = false;
+                    }
+                    Thread.Sleep(500);
+                }
+            });
+        }
+
+        #endregion
+
+        #region Public Method
+
+        /// <summary>
+        /// 璇诲彇PLC鍗忚鍦板潃鐨勬暟鎹�
+        /// </summary>
+        /// <typeparam name="TEnum">鍗忚淇℃伅鐨勬灇涓惧璞′俊鎭��</typeparam>
+        /// <typeparam name="TRsult">璇诲彇鏁版嵁鐨勭被鍨嬪璞′俊鎭��</typeparam>
+        /// <param name="value">鏋氫妇鍊�</param>
+        /// <param name="deviceChildCode">璁惧瀛愮紪鍙�</param>
+        /// <returns>璇诲彇鍒扮殑鏁版嵁</returns>
+        public TRsult GetValue<TEnum, TRsult>(TEnum value, string deviceChildCode) where TEnum : Enum
+        {
+            if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�");
+            DeviceProDTO? devicePro = _deviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == value.ToString() && x.DeviceChildCode == deviceChildCode);
+            return devicePro == null ? throw new Exception() : (TRsult)Communicator.ReadAsObj(devicePro.DeviceProAddress, devicePro.DeviceDataType);
+        }
+
+        /// <summary>
+        /// 涓庤澶囩殑蹇冭烦
+        /// </summary>
+        public void Heartbeat()
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        ///
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="command"></param>
+        /// <param name="deviceChildCode"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public bool SendCommand<T>(T command, string deviceChildCode) where T : IDataTransfer, new()
+        {
+            if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�");
+            DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand) && x.DeviceChildCode == deviceChildCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+            if (devicePro == null)
+            {
+                return false;
+            }
+            if (Communicator.WriteCustomer(devicePro.DeviceProAddress, command))
+            {
+                return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 璇诲彇PLC鏁版嵁锛岃繑鍥炶嚜瀹氫箟瀵硅薄
+        /// </summary>
+        /// <typeparam name="T">娉涘瀷</typeparam>
+        /// <param name="deviceChildCode">瀛愯澶囩紪鍙�</param>
+        /// <returns>杩斿洖鑷畾涔夊璞℃垨鎶涘嚭寮傚父</returns>
+        /// <exception cref="Exception"></exception>
+        public T ReadCustomer<T>(string deviceChildCode) where T : IDataTransfer, new()
+        {
+            if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�");
+            DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == "ReadDeviceCommand" && x.DeviceChildCode == deviceChildCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+
+            if (devicePro == null)
+            {
+                throw new Exception("鏈壘鍒板崗璁俊鎭�");
+            }
+            else
+            {
+                return Communicator.ReadCustomer<T>(devicePro.DeviceProAddress);
+            }
+        }
+
+        /// <summary>
+        /// 璇诲彇PLC鏁版嵁锛岃繑鍥炶嚜瀹氫箟瀵硅薄
+        /// </summary>
+        /// <typeparam name="T">娉涘瀷</typeparam>
+        /// <param name="deviceChildCode">瀛愯澶囩紪鍙�</param>
+        /// <param name="deviceProParamType">鍙傛暟绫诲瀷</param>
+        /// <returns>杩斿洖鑷畾涔夊璞℃垨鎶涘嚭寮傚父</returns>
+        /// <exception cref="Exception"></exception>
+        public T ReadCustomer<T>(string deviceChildCode, string deviceProParamType) where T : IDataTransfer, new()
+        {
+            if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�");
+            DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == deviceProParamType && x.DeviceChildCode == deviceChildCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+
+            if (devicePro == null)
+            {
+                throw new Exception("鏈壘鍒板崗璁俊鎭�");
+            }
+            else
+            {
+                return Communicator.ReadCustomer<T>(devicePro.DeviceProAddress);
+            }
+        }
+
+        /// <summary>
+        /// 鏍规嵁鍙傛暟鍚嶇О銆佽澶囧瓙缂栧彿鍐欏叆瀵瑰簲鐨勬暟鎹��
+        /// </summary>
+        /// <typeparam name="TEnum">鍙傛暟鍚嶇О鏋氫妇绫诲瀷銆�</typeparam>
+        /// <typeparam name="TValue">瑕佸啓鍏ョ殑鏁版嵁绫诲瀷銆�</typeparam>
+        /// <param name="enum">鍙傛暟鍚嶇О銆�</param>
+        /// <param name="value">瑕佸啓鍏ョ殑鏁版嵁銆�</param>
+        /// <param name="deviceChildCode">璁惧瀛愮紪鍙峰啓</param>
+        /// <returns>杩斿洖鍐欏叆鎴愬姛鎴栧け璐�</returns>
+        public bool SetValue<TEnum, TValue>(TEnum @enum, TValue value, string deviceChildCode)
+            where TEnum : Enum
+            where TValue : notnull
+        {
+            if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�");
+            DeviceProDTO? devicePro = _deviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == @enum.ToString() && x.DeviceChildCode == deviceChildCode);
+            return devicePro == null ? throw new Exception() : Communicator.WriteObj(devicePro.DeviceProAddress, devicePro.DeviceDataType, value);
+        }
+
+        /// <summary>
+        /// 鏍规嵁鍙傛暟鍚嶇О銆佽澶囧瓙缂栧彿璇诲彇瀵瑰簲鐨勬暟鎹��
+        /// </summary>
+        /// <typeparam name="TEnum">鍙傛暟鍚嶇О鏋氫妇绫诲瀷銆�</typeparam>
+        /// <param name="enum">鍙傛暟鍚嶇О銆�</param>
+        /// <param name="deviceChildCode">璁惧瀛愮紪鍙峰啓</param>
+        /// <returns>杩斿洖鍐欏叆鎴愬姛鎴栧け璐�</returns>
+        public object ReadValue<TEnum>(TEnum @enum, string deviceChildCode)
+            where TEnum : Enum
+        {
+            if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�");
+            DeviceProDTO? devicePro = _deviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == @enum.ToString() && x.DeviceChildCode == deviceChildCode);
+            return devicePro == null ? throw new Exception() : Communicator.ReadAsObj(devicePro.DeviceProAddress, devicePro.DeviceDataType);
+        }
+
+        /// <summary>
+        ///
+        /// </summary>
+        /// <param name="deviceChildCode"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public bool IsOccupied(string deviceChildCode)
+        {
+            if (Communicator.IsConnected)
+            {
+                List<DeviceProDTO> devicePros = _deviceProDTOs.Where(x => x.DeviceProParamType == ConveyorLineStatus.IsOccupied.ToString()).ToList();
+                if (devicePros.Count == 0)
+                {
+                    //todo 鍗忚淇℃伅鏈幏鍙栧埌鏃舵姏鍑哄紓甯�
+                    throw new Exception();
+                }
+                for (int i = 0; i < devicePros.Count; i++)
+                {
+                    object readStatus = Communicator.ReadAsObj(devicePros[i].DeviceProAddress, devicePros[i].DeviceDataType);
+                    //todo 鍗忚鏄庣粏淇℃伅鏈幏鍙栧埌鏃舵姏鍑哄紓甯�
+                    DeviceProtocolDetailDTO? deviceProtocolDetail = _deviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == devicePros[i].DeviceProParamName) ?? throw new Exception();
+                    deviceProtocolDetail = _deviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == devicePros[i].DeviceProParamType && x.ProtocalDetailValue.Equals(readStatus.ToString()));
+                    if (deviceProtocolDetail != null)
+                    {
+                        return true;
+                    }
+                    return false;
+                }
+            }
+            //todo 閫氳鏈繛鎺ユ椂鎶涘嚭寮傚父
+            return false;
+        }
+
+        public void Dispose()
+        {
+            _heartStatr = false;
+            _communicator.Dispose();
+            GC.SuppressFinalize(this);
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/CustomProfile.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/CustomProfile.cs
index a76f5cd..194348a 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/CustomProfile.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/CustomProfile.cs
@@ -22,6 +22,7 @@
             CreateMap<Dt_DeviceInfo,DeviceInfoDTO>();
             CreateMap<WMSTaskDTO, Dt_Task>().ForMember(a => a.WMSId, b => b.MapFrom(b => b.Id));
             CreateMap<Dt_Task, ConveyorLineTaskCommand>().ForMember(a => a.TargetAddress, b => b.MapFrom(b => b.NextAddress)).ForMember(a => a.Barcode, b => b.MapFrom(b => b.PalletCode)).ForMember(a => a.TaskNum, b => b.MapFrom(b => b.TaskNum));
+            CreateMap<Dt_Task,ConveyorLineTaskCommand_After>().ForMember(a => a.ConveyorLineTargetAddress, b => b.MapFrom(b => b.NextAddress)).ForMember(a => a.ConveyorLineBarcode, b => b.MapFrom(b => b.PalletCode)).ForMember(a => a.ConveyorLineTaskNum, b => b.MapFrom(b => b.TaskNum));
         }
     }
 }
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
new file mode 100644
index 0000000..99de6e7
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
@@ -0,0 +1,702 @@
+锘�#region MyRegion
+#region << 鐗� 鏈� 娉� 閲� >>
+
+/*----------------------------------------------------------------
+ * 鍛藉悕绌洪棿锛歐IDESEAWCS_Tasks.ConveyorLineJob
+ * 鍒涘缓鑰咃細鑳$搴�
+ * 鍒涘缓鏃堕棿锛�2024/8/2 16:13:36
+ * 鐗堟湰锛歏1.0.0
+ * 鎻忚堪锛�
+ *
+ * ----------------------------------------------------------------
+ * 淇敼浜猴細
+ * 淇敼鏃堕棿锛�
+ * 鐗堟湰锛歏1.0.1
+ * 淇敼璇存槑锛�
+ *
+ *----------------------------------------------------------------*/
+
+#endregion << 鐗� 鏈� 娉� 閲� >>
+
+using AutoMapper;
+using HslCommunication;
+using Microsoft.AspNetCore.Server.HttpSys;
+using Newtonsoft.Json;
+using Quartz;
+using SqlSugar;
+using System.Diagnostics.CodeAnalysis;
+using System.Reflection;
+using System.Threading.Tasks;
+using WIDESEAWCS_Common.TaskEnum;
+using WIDESEAWCS_Core;
+using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_DTO.TaskInfo;
+using WIDESEAWCS_ITaskInfoRepository;
+using WIDESEAWCS_ITaskInfoService;
+using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_QuartzJob;
+using WIDESEAWCS_QuartzJob.DeviceBase;
+using WIDESEAWCS_QuartzJob.DTO;
+using WIDESEAWCS_QuartzJob.Service;
+using WIDESEAWCS_Tasks.ConveyorLineJob;
+
+namespace WIDESEAWCS_Tasks
+{
+    [DisallowConcurrentExecution]
+    public class CommonConveyorLine_AfterJob : JobBase, IJob
+    {
+        private readonly ITaskService _taskService;
+        private readonly ITaskRepository _taskRepository;
+        private readonly ITaskExecuteDetailService _taskExecuteDetailService;
+        private readonly IRouterService _routerService;
+        private readonly IMapper _mapper;
+
+        public CommonConveyorLine_AfterJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository)
+        {
+            _taskService = taskService;
+            _taskExecuteDetailService = taskExecuteDetailService;
+            _routerService = routerService;
+            _mapper = mapper;
+            _taskRepository = taskRepository;
+        }
+
+        public Task Execute(IJobExecutionContext context)
+        {
+            try
+            {
+                CommonConveyorLine_After conveyorLine = (CommonConveyorLine_After)context.JobDetail.JobDataMap.Get("JobParams");
+                if (conveyorLine != null)
+                {
+                    List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
+                    //List<Task> tasks = new List<Task>();
+                    foreach (string childDeviceCode in childDeviceCodes)
+                    {
+                        ConveyorLineTaskCommand_After command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(childDeviceCode);
+
+                        if (command.ConveyorLineBarcode.Trim().Contains("\0")) command.ConveyorLineBarcode = "";
+
+                        DeviceProtocolDetailDTO? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand_After.InteractiveSignal) && x.ProtocalDetailValue == command.InteractiveSignal.ToString());
+                        if (deviceProtocolDetails != null)
+                        {
+                            MethodInfo? method = GetType().GetMethod(deviceProtocolDetails.ProtocolDetailType);
+                            if (method != null)
+                            {
+                                method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode });
+                            }
+                        }
+                    }
+                    //Task.WaitAll(tasks.ToArray());
+                }
+            }
+            catch (Exception ex)
+            {
+                Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
+            }
+            finally
+            {
+                //WriteDebug("CommonConveyorLineJob", "test");
+                //Console.Out.WriteLine(DateTime.Now);
+            }
+            return Task.CompletedTask;
+        }
+
+        /// <summary>
+        /// 杈撻�佺嚎璇锋眰鍏ュ簱
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+        /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
+        public void RequestInbound(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
+        {
+            var taskNew = _taskService.QueryCraneConveyorLineTask(command.ConveyorLineTaskNum.ObjToInt(), childDeviceCode);
+            if (taskNew == null)
+            {
+                string barcode = command.ConveyorLineBarcode.TrimEnd();
+                if (_taskService.RequestWMSTask(command.ConveyorLineBarcode, childDeviceCode).Status)
+                {
+                    Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+                    if (task != null)
+                    {
+                        ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
+                        //taskCommand.InteractiveSignal = command.InteractiveSignal;
+                        taskCommand.ResponState = 1;
+                        taskCommand.ConveyorLineTaskNum = task.TaskNum;
+                        taskCommand.ConveyorLineTargetAddress = Convert.ToInt16(task.NextAddress);
+                        conveyorLine.SendCommand(taskCommand, childDeviceCode);
+
+                        //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+
+                        _taskService.UpdateTaskStatusToNext(task);
+                    }
+                }
+            }
+
+            var inTask = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum.ObjToInt(), childDeviceCode);
+            if (inTask != null)
+            {
+                ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(inTask);
+                //taskCommand.InteractiveSignal = command.InteractiveSignal;
+                taskCommand.ResponState = 1;
+                conveyorLine.SendCommand(taskCommand, childDeviceCode);
+
+                _taskService.UpdateTaskStatusToNext(inTask);
+            }
+
+
+        }
+
+        /// <summary>
+        /// 杈撻�佺嚎璇锋眰鍏ュ簱涓嬩竴鍦板潃
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+        public void RequestInNextAddress(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
+        {
+            //if(command)
+            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
+            if (task != null)
+            {
+                Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
+                if (newTask != null)
+                {
+                    ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(newTask);
+                    //taskCommand.InteractiveSignal = command.InteractiveSignal;
+                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                }
+            }
+        }
+
+        /// <summary>
+        /// 杈撻�佺嚎鍏ュ簱瀹屾垚
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+        /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
+        public void ConveyorLineInFinish(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
+        {
+            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
+            if (task != null && task.TaskState != (int)TaskInStatusEnum.Line_InFinish)
+            {
+                //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+
+                //conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode);
+                WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
+                Console.Out.WriteLine(content.Serialize());
+            }
+        }
+
+        /// <summary>
+        /// 杈撻�佺嚎璇锋眰鍑轰俊鎭�
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+        public void RequestOutbound(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
+        {
+            Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+            if (task != null)
+            {
+                // ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
+                //taskCommand.InteractiveSignal = command.InteractiveSignal;
+                // conveyorLine.SendCommand(taskCommand, childDeviceCode);
+
+                _taskService.UpdateTaskStatusToNext(task);
+            }
+        }
+
+        /// <summary>
+        /// 杈撻�佺嚎璇锋眰鍑哄簱涓嬩竴鍦板潃
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+        public void RequestOutNextAddress(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
+        {
+            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
+            if (task != null)
+            {
+                Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
+                if (newTask != null)
+                {
+                    ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(newTask);
+                    //taskCommand.InteractiveSignal = command.InteractiveSignal;
+                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                }
+            }
+        }
+
+        /// <summary>
+        /// 杈撻�佺嚎鍑哄簱瀹屾垚
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+        public void ConveyorLineOutFinish(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
+        {
+            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
+            if (task != null)
+            {
+                conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode);
+                WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
+                Console.Out.WriteLine(content.Serialize());
+            }
+        }
+
+        /// <summary>
+        /// 杈撻�佺嚎浜や簰瀹屾垚
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+        /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
+        /// <param name="value">鍊�</param>
+        public void ConveyorLineSendFinish(CommonConveyorLine_After conveyorLine, string childDeviceCode, int ProtocalDetailValue, bool value)
+        {
+            DeviceProDTO? devicePro = conveyorLine.DeviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand) && x.DeviceChildCode == childDeviceCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+            string[] x = devicePro.DeviceProAddress.Split('.');
+            x[x.Length - 1] = (ProtocalDetailValue + 1).ToString();
+            string DeviceProAddress = string.Join(".", x);
+            conveyorLine.Communicator.Write(DeviceProAddress, value);
+        }
+    }
+}
+#endregion
+
+
+
+#region MyRegion
+//using AutoMapper;
+//using HslCommunication;
+//using Newtonsoft.Json;
+//using Quartz;
+//using SqlSugar;
+//using System.Reflection;
+//using WIDESEAWCS_Common.TaskEnum;
+//using WIDESEAWCS_Core;
+//using WIDESEAWCS_Core.Helper;
+//using WIDESEAWCS_DTO.TaskInfo;
+//using WIDESEAWCS_ITaskInfoRepository;
+//using WIDESEAWCS_ITaskInfoService;
+//using WIDESEAWCS_Model.Models;
+//using WIDESEAWCS_QuartzJob;
+//using WIDESEAWCS_QuartzJob.DeviceBase;
+//using WIDESEAWCS_QuartzJob.DTO;
+//using WIDESEAWCS_QuartzJob.Service;
+//using WIDESEAWCS_Tasks.ConveyorLineJob;
+
+//namespace WIDESEAWCS_Tasks
+//{
+//    [DisallowConcurrentExecution]
+//    public class CommonConveyorLine_AfterJob : JobBase, IJob
+//    {
+//        private readonly List<string> _deviceCodes1 = new List<string>() { "1063", "1061", "1060" };
+//        private readonly List<string> _deviceCodes2 = new List<string>() { "1067", "1069", "1068" };
+//        private readonly string[] HCTrayCode = { "1012", "1013" };
+//        private readonly ITaskService _taskService;
+//        private readonly ITaskRepository _taskRepository;
+//        private readonly ITaskExecuteDetailService _taskExecuteDetailService;
+//        private readonly IRouterService _routerService;
+//        private readonly IMapper _mapper;
+
+//        public CommonConveyorLine_AfterJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository)
+//        {
+//            _taskService = taskService;
+//            _taskExecuteDetailService = taskExecuteDetailService;
+//            _routerService = routerService;
+//            _mapper = mapper;
+//            _taskRepository = taskRepository;
+//        }
+
+//        public Task Execute(IJobExecutionContext context)
+//        {
+//            try
+//            {
+//                CommonConveyorLine_After conveyorLine = (CommonConveyorLine_After)context.JobDetail.JobDataMap.Get("JobParams");
+//                if (conveyorLine != null)
+//                {
+//                    List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
+//                    List<Task> tasks = new List<Task>();
+//                    foreach (string childDeviceCode in childDeviceCodes)
+//                    {
+//                        //Task task = Task.Run(() =>
+//                        //{
+//                        ConveyorLineTaskCommand_After command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(childDeviceCode);
+//                        if (command != null)
+//                        {
+//                            var structs = BitConverter.GetBytes(command.InteractiveSignal).Reverse().ToArray().ToBoolArray();
+
+//                            List<DeviceProtocolDetailDTO>? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.Where(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand_After.InteractiveSignal)).ToList();
+
+//                            if (deviceProtocolDetails != null)
+//                            {
+//                                foreach (var item in deviceProtocolDetails)
+//                                {
+//                                    var outDeviceCodes = _routerService.QueryOutDeviceCodes(conveyorLine.DeviceCode);
+//                                    if (structs[item.ProtocalDetailValue.ObjToInt()] == true)
+//                                    {
+//                                        MethodInfo? method = GetType().GetMethod(item.ProtocolDetailType);
+//                                        if (method != null)
+//                                        {
+//                                            method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, item.ProtocalDetailValue.ObjToInt() });
+//                                        }
+//                                    }
+//                                    else
+//                                    {
+//                                        //DeviceProDTO? devicePro = conveyorLine.DeviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand) && x.DeviceChildCode == childDeviceCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+//                                        //string[] x = devicePro.DeviceProAddress.Split('.');
+//                                        //x[x.Length - 1] = (item.ProtocalDetailValue.ObjToInt() + 1).ToString();
+//                                        //string DeviceProAddress = string.Join(".", x);
+//                                        //var writeRead = conveyorLine.Communicator.Read<bool>(DeviceProAddress);
+//                                        //if (writeRead)
+//                                        //{
+//                                        //    ConveyorLineSendFinish(conveyorLine, childDeviceCode, item.ProtocalDetailValue.ObjToInt(), false);
+//                                        //}
+//                                    }
+//                                }
+//                            }
+//                        }
+//                        //});
+//                        //tasks.Add(task);
+//                    }
+//                    Task.WaitAll(tasks.ToArray());
+//                }
+//            }
+//            catch (Exception ex)
+//            {
+//                Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
+//            }
+//            finally
+//            {
+//                //WriteDebug("CommonConveyorLineJob", "test");
+//                //Console.Out.WriteLine(DateTime.Now);
+//            }
+//            return Task.CompletedTask;
+//        }
+
+//        /// <summary>
+//        /// 杈撻�佺嚎璇锋眰鍏ュ簱
+//        /// </summary>
+//        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+//        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+//        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+//        /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
+//        public void RequestInbound(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode, int ProtocalDetailValue)
+//        {
+//            var taskNew = _taskService.QueryCraneConveyorLineTask(command.Barcode.ObjToInt(), childDeviceCode);
+//            var Taskout = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+//            if (Taskout != null)
+//            {
+//                // 绌烘墭鐩樹换鍔�
+//                if (Taskout.TaskType == (int)TaskOutboundTypeEnum.OutTray)
+//                {
+//                    if (Taskout.TaskState == (int)TaskOutStatusEnum.SC_OutFinish)
+//                    {
+//                        ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(Taskout);
+//                        taskCommand.InteractiveSignal = command.InteractiveSignal;
+//                        if (command.Barcode == "")
+//                        {
+//                            taskCommand.TargetAddress = 1092;
+//                        }
+//                        conveyorLine.SendCommand(taskCommand, childDeviceCode);
+
+//                        ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+
+//                        _taskService.UpdateTaskStatusToNext(Taskout);
+//                    }
+//                    else if (Taskout.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting)
+//                    {
+//                        if (command.Barcode == "")
+//                        {
+//                            ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(Taskout);
+//                            taskCommand.InteractiveSignal = command.InteractiveSignal;
+//                            taskCommand.TargetAddress = 1092;
+//                            conveyorLine.SendCommand(taskCommand, childDeviceCode);
+
+//                            ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+//                            _taskService.UpdateTaskStatusToNext(Taskout);
+//                        }
+//                    }
+//                }
+//                else if (Taskout.TaskType == (int)TaskOutboundTypeEnum.Outbound)
+//                {
+//                    if (Taskout.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting)
+//                    {
+//                        ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(Taskout);
+//                        taskCommand.InteractiveSignal = command.InteractiveSignal;
+//                        if (command.Barcode == "")
+//                        {
+//                            //todo 娌℃湁鏄庣‘寮傚父鍙o紝閫佸埌鐩爣宸烽亾鐨凬G鍙�
+//                            //taskCommand.TargetAddress = 1092;
+//                        }
+//                        conveyorLine.SendCommand(taskCommand, childDeviceCode);
+
+//                        ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+
+//                        _taskService.UpdateTaskStatusToNext(Taskout);
+//                    }
+//                    else if (Taskout.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting)
+//                    {
+//                        if (command.Barcode == "")
+//                        {
+//                            ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(Taskout);
+//                            taskCommand.InteractiveSignal = command.InteractiveSignal;
+//                            // todo  閫佸埌鐩爣宸烽亾鐨凬G鍙�
+//                            taskCommand.TargetAddress = 1092;
+//                            conveyorLine.SendCommand(taskCommand, childDeviceCode);
+
+//                            ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+//                            _taskService.UpdateTaskStatusToNext(Taskout);
+//                        }
+//                        else
+//                        {
+//                            // todo 璋冪敤WMS浠诲姟瀹屾垚鎺ュ彛
+//                            var x = new { taskNum = Taskout.TaskNum };
+//                            var result = HttpHelper.GetAsync("http:127.0.0.1:8098/api/Task/CompleteTaskAsync", x.ToJsonString()).Result;
+//                            WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+//                            if (content.Status)
+//                            {
+//                                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+//                                _taskService.UpdateTaskStatusToNext(Taskout);
+//                            }
+//                        }
+//                    }
+//                }
+//            }
+//            if (taskNew == null)
+//            {
+//                if (_taskService.RequestWMSTask(command.Barcode, childDeviceCode).Status)
+//                {
+//                    Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+//                    if (task != null)
+//                    {
+//                        ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
+//                        taskCommand.InteractiveSignal = command.InteractiveSignal;
+//                        conveyorLine.SendCommand(taskCommand, childDeviceCode);
+
+//                        ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+
+//                        _taskService.UpdateTaskStatusToNext(task);
+//                    }
+//                }
+//            }
+//        }
+
+//        //
+//        /// <summary>
+//        /// 绌烘墭鐩樺洖娴�
+//        /// </summary>
+//        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+//        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+//        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+//        /// <param name="index">璇诲彇鐨勭涓�涓綅缃�</param>
+//        public void EmptyTrayReturn(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode, int index)
+//        {
+//            var tasks = _taskRepository.QueryData(x => (x.TaskState == (int)TaskOutStatusEnum.OutNew || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting) && x.TaskType == (int)TaskOutboundTypeEnum.OutTray);
+//            if (tasks.Count <= index)
+//            {
+//                WMSTaskDTO taskDTO = new WMSTaskDTO()
+//                {
+//                    TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
+//                    Grade = 1,
+//                    PalletCode = DateTime.Now.ToString("yyyyMMddHHmmss"),
+//                    RoadWay = "CHSC01",
+//                    SourceAddress = "001-001-001",
+//                    TargetAddress = childDeviceCode,
+//                    TaskState = (int)TaskOutStatusEnum.OutNew,
+//                    Id = 0,
+//                    TaskType = (int)TaskOutboundTypeEnum.OutTray
+//                };
+
+//                #region 鐪熷疄鏁版嵁
+
+//                // TODO: 璋冪敤鎺ュ彛鑾峰彇涓嬩竴涓湴鍧�
+//                //RequestTaskDto request = new RequestTaskDto()
+//                //{
+//                //    Position = sourceAddress,
+//                //    PalletCode = palletCode,
+//                //};
+
+//                //// 鍙戦�佽姹傚苟绛夊緟鍝嶅簲
+//                //var result = HttpHelper.PostAsync("http:127.0.0.1:8098/api/Task/RequestTaskAsync", request.ToJsonString()).Result;
+
+//                //// 鍙嶅簭鍒楀寲鍝嶅簲鍐呭
+//                //WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+
+//                //// 妫�鏌ョ姸鎬佸苟杩斿洖
+//                ////if (!content.Status)
+//                ////    return content;
+
+//                //// 鍙嶅簭鍒楀寲浠诲姟鏁版嵁
+//                //WMSTaskDTO task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
+
+//                #endregion
+
+//                var content = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
+//                if (content.Status)
+//                {
+//                    Console.WriteLine("绌烘墭鐩樺懠鍙垚鍔�");
+//                }
+//            }
+//        }
+
+//        ///// <summary>
+//        ///// 闄堝寲鍑哄簱
+//        ///// </summary>
+//        ///// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+//        ///// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+//        ///// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+//        ///// <param name="index">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
+//        //public void ChuanhuaOutbound(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode, int index)
+//        //{
+//        //    var tasks = _taskRepository.QueryData(x => (x.TaskState == (int)TaskOutStatusEnum.OutNew || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting) && x.TaskType == (int)TaskOutboundTypeEnum.Outbound);
+//        //    if (tasks.Count <= index)
+//        //    {
+//        //        WMSTaskDTO taskDTO = new WMSTaskDTO()
+//        //        {
+//        //            TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
+//        //            Grade = 1,
+//        //            PalletCode = DateTime.Now.ToString("MMddHHmmss"),
+//        //            RoadWay = "CHSC01",
+//        //            SourceAddress = "001-001-001",
+//        //            TargetAddress = childDeviceCode,
+//        //            TaskState = (int)TaskOutStatusEnum.OutNew,
+//        //            Id = 0,
+//        //            TaskType = (int)TaskOutboundTypeEnum.Outbound,
+//        //        };
+
+//        //        var content = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
+//        //        if (content.Status)
+//        //        {
+//        //            Console.WriteLine("鍑哄簱鍛煎彨鎴愬姛");
+//        //        }
+//        //    }
+//        //    else
+//        //    {
+//        //        Dt_Task task = tasks[index];
+//        //        if (task != null)
+//        //        {
+//        //            ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
+//        //            taskCommand.InteractiveSignal = command.InteractiveSignal;
+//        //            conveyorLine.SendCommand(taskCommand, childDeviceCode);
+//        //        }
+//        //    }
+//        //}
+
+//        /// <summary>
+//        /// 杈撻�佺嚎璇锋眰鍏ュ簱涓嬩竴鍦板潃
+//        /// </summary>
+//        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+//        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+//        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+//        public void RequestInNextAddress(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
+//        {
+//            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+//            if (task != null)
+//            {
+//                Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
+//                if (newTask != null)
+//                {
+//                    ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(newTask);
+//                    taskCommand.InteractiveSignal = command.InteractiveSignal;
+//                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
+//                }
+//            }
+//        }
+
+//        /// <summary>
+//        /// 杈撻�佺嚎鍏ュ簱瀹屾垚
+//        /// </summary>
+//        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+//        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+//        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+//        /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
+//        public void ConveyorLineInFinish(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode, int ProtocalDetailValue)
+//        {
+//            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+//            if (task != null && task.TaskState != (int)TaskInStatusEnum.Line_InFinish)
+//            {
+//                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+
+//                //conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode);
+//                WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
+//                Console.Out.WriteLine(content.Serialize());
+//            }
+//        }
+
+//        /// <summary>
+//        /// 杈撻�佺嚎璇锋眰鍑轰俊鎭�
+//        /// </summary>
+//        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+//        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+//        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+//        public void RequestOutbound(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
+//        {
+//            Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+//            if (task != null)
+//            {
+//                ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
+//                taskCommand.InteractiveSignal = command.InteractiveSignal;
+//                conveyorLine.SendCommand(taskCommand, childDeviceCode);
+
+//                _taskService.UpdateTaskStatusToNext(task);
+//            }
+//        }
+
+//        /// <summary>
+//        /// 杈撻�佺嚎璇锋眰鍑哄簱涓嬩竴鍦板潃
+//        /// </summary>
+//        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+//        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+//        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+//        public void RequestOutNextAddress(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
+//        {
+//            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+//            if (task != null)
+//            {
+//                Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
+//                if (newTask != null)
+//                {
+//                    ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(newTask);
+//                    taskCommand.InteractiveSignal = command.InteractiveSignal;
+//                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
+//                }
+//            }
+//        }
+
+//        /// <summary>
+//        /// 杈撻�佺嚎鍑哄簱瀹屾垚
+//        /// </summary>
+//        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+//        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+//        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+//        public void ConveyorLineOutFinish(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
+//        {
+//            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+//            if (task != null)
+//            {
+//                conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode);
+//                WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
+//                Console.Out.WriteLine(content.Serialize());
+//            }
+//        }
+
+//        /// <summary>
+//        /// 杈撻�佺嚎浜や簰瀹屾垚
+//        /// </summary>
+//        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+//        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+//        /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
+//        /// <param name="value">鍊�</param>
+//        public void ConveyorLineSendFinish(CommonConveyorLine_After conveyorLine, string childDeviceCode, int ProtocalDetailValue, bool value)
+//        {
+//            DeviceProDTO? devicePro = conveyorLine.DeviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand) && x.DeviceChildCode == childDeviceCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+//            string[] x = devicePro.DeviceProAddress.Split('.');
+//            x[x.Length - 1] = (ProtocalDetailValue + 1).ToString();
+//            string DeviceProAddress = string.Join(".", x);
+//            conveyorLine.Communicator.Write(DeviceProAddress, value);
+//        }
+//    }
+//}
+#endregion
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/ConveyorLineDBName_After.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/ConveyorLineDBName_After.cs
new file mode 100644
index 0000000..88dbe2c
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/ConveyorLineDBName_After.cs
@@ -0,0 +1,79 @@
+锘�#region << 鐗� 鏈� 娉� 閲� >>
+
+/*----------------------------------------------------------------
+ * 鍛藉悕绌洪棿锛歐IDESEAWCS_Tasks.ConveyorLineJob
+ * 鍒涘缓鑰咃細鑳$搴�
+ * 鍒涘缓鏃堕棿锛�2024/8/2 16:13:36
+ * 鐗堟湰锛歏1.0.0
+ * 鎻忚堪锛�
+ *
+ * ----------------------------------------------------------------
+ * 淇敼浜猴細
+ * 淇敼鏃堕棿锛�
+ * 鐗堟湰锛歏1.0.1
+ * 淇敼璇存槑锛�
+ *
+ *----------------------------------------------------------------*/
+
+#endregion << 鐗� 鏈� 娉� 閲� >>
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_Tasks.ConveyorLineJob
+{
+    public enum ConveyorLineDBName_After
+    {
+        #region ReadDevice
+
+        /// <summary>
+        /// 鐩殑鍦板潃
+        /// </summary>
+        ConveyorLineTargetAddress,
+
+        /// <summary>
+        /// 浠诲姟鍙�
+        /// </summary>
+        ConveyorLineTaskNum,
+
+        /// <summary>
+        /// 鎵樼洏鍙�
+        /// </summary>
+        ConveyorLineBarcode,
+
+        /// <summary>
+        /// 璇锋眰鍙嶉
+        /// </summary>
+        ResponState,
+
+        Reserve2,
+        Reserve3,
+
+        /// <summary>
+        /// 璇锋眰淇″彿
+        /// </summary>
+        InteractiveSignal,
+
+        /// <summary>
+        /// 鏈夌洏淇″彿
+        /// </summary>
+        HasPallet,
+
+        /// <summary>
+        /// 鎶ヨ浠g爜
+        /// </summary>
+        ConveyorLineAlarm,
+
+        Reserve4,
+        Reserve5,
+
+        #endregion
+
+        #region WriteDevice
+
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/ConveyorLineTaskCommand_After.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/ConveyorLineTaskCommand_After.cs
new file mode 100644
index 0000000..34d8573
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/ConveyorLineTaskCommand_After.cs
@@ -0,0 +1,71 @@
+锘�#region << 鐗� 鏈� 娉� 閲� >>
+
+/*----------------------------------------------------------------
+ * 鍛藉悕绌洪棿锛歐IDESEAWCS_Tasks.ConveyorLineJob
+ * 鍒涘缓鑰咃細鑳$搴�
+ * 鍒涘缓鏃堕棿锛�2024/8/2 16:13:36
+ * 鐗堟湰锛歏1.0.0
+ * 鎻忚堪锛�
+ *
+ * ----------------------------------------------------------------
+ * 淇敼浜猴細
+ * 淇敼鏃堕棿锛�
+ * 鐗堟湰锛歏1.0.1
+ * 淇敼璇存槑锛�
+ *
+ *----------------------------------------------------------------*/
+
+#endregion << 鐗� 鏈� 娉� 閲� >>
+
+using System.Runtime.CompilerServices;
+using WIDESEAWCS_QuartzJob.DeviceBase;
+
+namespace WIDESEAWCS_Tasks.ConveyorLineJob
+{
+    //public class ConveyorLineTaskCommand_After : DeviceCommand
+    //{
+
+    //    public short TargetAddress { get; set; }
+
+    //    public short TaskNum { get; set; }
+    //    public ushort InteractiveSignal { get; set; }
+
+    //    [DataLength(25)]
+    //    public string Barcode { get; set; }
+
+    //    public short ConveyorLineAlarm { get; set; }
+
+
+    //}
+
+    public class ConveyorLineTaskCommand_After : DeviceCommand
+    {
+
+        public short ConveyorLineTargetAddress { get; set; }
+        public int ConveyorLineTaskNum { get; set; }
+
+        [DataLength(25)]
+        public string ConveyorLineBarcode { get; set; }
+
+        public short ResponState { get; set; }
+        public short Reserved2 { get; set; }
+        public short Reserved3 { get; set; }
+        public byte InteractiveSignal { get; set; }
+        public short HasPallet { get; set; }
+        public short ConveyorLineAlarm { get; set; }
+        public short Reserved4 { get; set; }
+        public short Reserved5 { get; set; }
+    }
+
+    //public class ConveyorLineTaskCommandWrite : DeviceCommand
+    //{
+    //    public ushort WriteInteractiveSignal { get; set; }
+
+    //    [DataLength(25)]
+    //    public string Barcode { get; set; }
+
+    //    public short TargetAddress { get; set; }
+
+    //    public short TaskNum { get; set; }
+    //}
+}
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs
index e6c0f07..93d08c3 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs
@@ -20,6 +20,11 @@
         /// 閭閰嶇疆
         /// </summary>
         public const string CONFIG_SYS_RegExmail = "Sys_RegExmail";
+
+        /// <summary>
+        /// IP鎺ュ彛鍦板潃
+        /// </summary>
+        public const string CONFIG_SYS_IPAddress = "CONFIG_SYS_IPAddress";
     }
 
     /// <summary>
@@ -60,5 +65,15 @@
         ///  閭鍐呭鏍囬
         /// </summary>
         public const string SMTP_RegUser = "smtpRegUser";
+
+        /// <summary>
+        /// WCS IP
+        /// </summary>
+        public const string WCSIPAddress = "WCSIPAddress";
+
+        /// <summary>
+        /// HK IP
+        /// </summary>
+        public const string HKIPAddress = "HKIPAddress";
     }
 }
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs
index 45e2fd8..24d78ad 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs
@@ -143,6 +143,12 @@
         /// </summary>
         [Description("绌烘墭鐩樺嚭搴�")]
         OutTray = 104,
+
+        /// <summary>
+        /// NG鍑哄簱
+        /// </summary>
+        [Description("NG鍑哄簱")]
+        OutNG =105,
     }
 
     public enum TaskRelocationTypeEnum
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/NotifyFinishTest.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/NotifyFinishTest.cs
new file mode 100644
index 0000000..77a1d6b
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/NotifyFinishTest.cs
@@ -0,0 +1,32 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_DTO
+{
+    public class NotifyFinishTest
+    {
+        /// <summary>
+        /// 搴撳尯
+        /// </summary>
+        public int LocationArea { get; set; }
+
+        /// <summary>
+        /// 鎵樼洏鍙�
+        /// </summary>
+        public string PalletBarcode { get; set; }
+
+        /// <summary>
+        /// 搴撲綅鍙�
+        /// </summary>
+        public string LocationID { get; set; }
+
+        /// <summary>
+        /// 鏄惁瀛樺湪NG (1-鏈�;2-鏃�)
+        /// </summary>
+        public int IsNG { get; set; }
+
+    }
+}
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/NotityInFinish.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/NotityInFinish.cs
new file mode 100644
index 0000000..650963a
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/NotityInFinish.cs
@@ -0,0 +1,27 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_DTO
+{
+    public class NotityInFinish
+    {
+        /// <summary>
+        /// 搴撳尯
+        /// </summary>
+        public int LocationArea { get; set; }
+
+        /// <summary>
+        /// 鎵樼洏鍙�
+        /// </summary>
+        public string PalletBarcode { get; set; }
+
+        /// <summary>
+        /// 搴撲綅鍙�
+        /// </summary>
+        public string LocationID { get; set; }
+
+    }
+}
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/RequestReMove.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/RequestReMove.cs
new file mode 100644
index 0000000..43695b1
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/RequestReMove.cs
@@ -0,0 +1,32 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_DTO
+{
+    public class RequestReMove
+    {
+        /// <summary>
+        /// 搴撳尯
+        /// </summary>
+        public int LocationArea { get; set; }
+
+        /// <summary>
+        /// 鎵樼洏鍙�
+        /// </summary>
+        public string PalletBarcode { get; set; }
+
+        /// <summary>
+        /// 搴撲綅鍙�
+        /// </summary>
+        public string LocationID { get; set; }
+
+        /// <summary>
+        /// 绉诲簱绫诲瀷(1-姝e父绉诲簱/妫�淇Щ搴� 2-杞Щ鍒板紓甯歌涪鍑哄彛(绉诲叆Ng绔�)  5-娑堥槻绉诲簱(鐏))
+        /// </summary>
+        public int MoveType { get; set; }
+
+    }
+}
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/RequsetCellInfo.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/RequsetCellInfo.cs
new file mode 100644
index 0000000..d57d1c5
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/RequsetCellInfo.cs
@@ -0,0 +1,24 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_DTO
+{
+    /// <summary>
+    ///     璇锋眰搴撲綅淇℃伅
+    /// </summary>
+    public class RequsetCellInfo
+    {
+        /// <summary>
+        /// 搴撳尯
+        /// </summary>
+        public int LocationArea { get; set; }
+
+        /// <summary>
+        /// 搴撲綅鍙�
+        /// </summary>
+        public string LocationID { get; set; }
+    }
+}
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/WorkState.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/WorkState.cs
new file mode 100644
index 0000000..af63fe9
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MCS/WorkState.cs
@@ -0,0 +1,31 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_DTO
+{
+    public class WorkState
+    {
+        /// <summary>
+        /// 搴撲綅鏁版嵁锛堝純鐢�,2024骞�11鏈�5鏃ラ潰璋� 灏嗛泦鍚堝簱浣嶆暟鎹敼涓哄崟涓簱浣嶆暟鎹悓姝ワ級
+        /// </summary>
+        public List<LocationWorkState> workStates { get; set; }
+    }
+
+    public class LocationWorkState
+    {
+        public int LocationArea { get; set; }
+
+        /// <summary>
+        /// 鐘舵��
+        /// </summary>
+        public int StateCode { get; set; }
+
+        /// <summary>
+        /// 搴撲綅缂栧彿
+        /// </summary>
+        public string LocationID { get; set; }
+    }
+}
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MCS/IMCSService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MCS/IMCSService.cs
new file mode 100644
index 0000000..823bd3b
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MCS/IMCSService.cs
@@ -0,0 +1,20 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core;
+
+namespace WIDESEA_IStoragIntegrationServices
+{
+    public interface IMCSService : IDependency
+    {
+        WebResponseContent NotifyFinishTest(object json);
+
+        WebResponseContent RequestChangeLocation(object json);
+
+        WebResponseContent ModifyAccessStatus(object json);
+
+        WebResponseContent RequsetCellInfo(object json);
+    }
+}
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/MCSService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/MCSService.cs
new file mode 100644
index 0000000..99d1fa7
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/MCSService.cs
@@ -0,0 +1,26 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_IStorageBasicRepository;
+using WIDESEA_IStorageTaskRepository;
+using WIDESEA_IStoragIntegrationServices;
+
+namespace WIDESEA_StoragIntegrationServices
+{
+    public partial class MCSService : IMCSService
+    {
+        private readonly ILocationInfoRepository _locationRepository;
+        private readonly IDt_TaskRepository _taskRepository;
+        private readonly IStockInfoRepository _stockInfoRepository;
+
+
+        public MCSService(ILocationInfoRepository locationRepository,IDt_TaskRepository taskRepository,IStockInfoRepository stockInfoRepository)
+        {
+            _locationRepository = locationRepository;
+            _taskRepository = taskRepository;
+            _stockInfoRepository = stockInfoRepository;
+        }
+    }
+}
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/ModifyAccessStatus.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/ModifyAccessStatus.cs
new file mode 100644
index 0000000..22c7dfd
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/ModifyAccessStatus.cs
@@ -0,0 +1,58 @@
+锘縰sing MailKit;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core;
+using WIDESEA_DTO;
+
+namespace WIDESEA_StoragIntegrationServices
+{
+    public partial class MCSService
+    {
+        public WebResponseContent ModifyAccessStatus(object json)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                if (string.IsNullOrEmpty(json.ToString())) throw new Exception("涓婁紶鍙傛暟涓虹┖");
+
+                var result = JsonConvert.DeserializeObject<LocationWorkState>(json.ToString());
+
+                var locationinfo = _locationRepository.QueryFirst(x => x.AreaId == result.LocationArea && x.LocationCode == result.LocationID);
+                if (locationinfo != null)
+                {
+                    //妫�娴嬫煖鎻愪緵鐨勮揣浣嶇姸鎬侊紝鍙湁wms鏈攣瀹氫笖鎻愪緵鐨勭姸鎬佷负鍏佽鎵嶅厑璁告斁璐�
+                    if (locationinfo.Remark != LocationStatusByCode(result.StateCode))
+                    {
+                        locationinfo.Remark = LocationStatusByCode(result.StateCode);
+                        _locationRepository.UpdateData(locationinfo);
+                    }
+                }
+                else
+                    throw new Exception("璐т綅涓嶅瓨鍦�");
+
+                return content.OK();
+            }
+            catch (Exception ex)
+            {
+                return content.Error(ex.Message);
+            }
+        }
+        private static string LocationStatusByCode(int code)
+        {
+            string str = null;
+            switch (code)
+            {
+                case 1: str = "LocationState_Allows"; break;
+                case 2: str = "LocationState_NotAllows"; break;
+                //case 2: str = LocationState.LocationLock.ToString(); break;
+                default:
+                    str = "LocationState_NotAllows"; break;
+            }
+            return str;
+        }
+    }
+}
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/NotifyFinishTest.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/NotifyFinishTest.cs
new file mode 100644
index 0000000..01ba41e
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/NotifyFinishTest.cs
@@ -0,0 +1,83 @@
+锘縰sing Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core;
+using WIDESEA_Core.Enums;
+using WIDESEA_Core.Helper;
+using WIDESEA_DTO;
+using WIDESEA_DTO.WMS;
+using WIDESEA_Model.Models;
+using WIDESEA_StorageBasicRepository;
+
+namespace WIDESEA_StoragIntegrationServices
+{
+
+    public partial class MCSService
+    {
+        public WebResponseContent NotifyFinishTest(object json)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                if (string.IsNullOrEmpty(json.ToString())) throw new Exception("涓婁紶鍙傛暟涓虹┖");
+
+                var result = JsonConvert.DeserializeObject<NotifyFinishTest>(json.ToString());
+
+                if (string.IsNullOrEmpty(result?.PalletBarcode))
+                    throw new Exception("涓婁紶鎵樼洏鍙蜂负绌�");
+
+                var location = _locationRepository.QueryFirst(x => x.AreaId == result.LocationArea && x.LocationCode == result.LocationID);
+
+                if (location == null) throw new Exception("鏈煡搴撲綅");
+
+                int taskNum = _taskRepository.GetTaskNo().Result;
+
+                Dt_Task task = new Dt_Task
+                {
+                    CreateDate = DateTime.Now,
+                    Creater = "HK",
+                    CurrentAddress = result.LocationID,
+                    Grade = 1,
+                    PalletCode = result.PalletBarcode,
+                    Roadway = location.RoadwayNo,
+                    SourceAddress = result.LocationID,
+                    TaskState = (int)TaskOutStatusEnum.OutNew,
+                    TaskType = result.IsNG == 1 ? (int)TaskOutboundTypeEnum.OutNG : (int)TaskOutboundTypeEnum.Outbound,
+                    TargetAddress = "",
+                    TaskNum = taskNum, //_taskRepository.GetTaskNo().Result,
+                    TaskId = 0,
+                };
+
+
+                WMSTaskDTO taskDTO = new WMSTaskDTO
+                {
+                    Id = 0,
+                    Grade = 1,
+                    PalletCode = result.PalletBarcode,
+                    RoadWay = location.RoadwayNo,
+                    SourceAddress = result.LocationID,
+                    TargetAddress = result.LocationID,
+                    TaskNum = taskNum,  //_taskRepository.GetTaskNo().Result,
+                    TaskState = (int)TaskOutStatusEnum.OutNew,
+                    TaskType = result.IsNG == 1 ? (int)TaskOutboundTypeEnum.OutNG : (int)TaskOutboundTypeEnum.Outbound,
+                };
+
+                var respon = HttpHelper.Post("http://localhost:9291/api/Task/ReceiveTask", JsonConvert.SerializeObject(taskDTO));
+                if (respon != null)
+                {
+                    
+                }
+
+
+                return content.OK();
+            }
+            catch (Exception ex)
+            {
+                return content.Error(ex.Message);
+            }
+        }
+    }
+}
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs
new file mode 100644
index 0000000..f4a39da
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs
@@ -0,0 +1,38 @@
+锘縰sing Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core;
+using WIDESEA_DTO;
+
+namespace WIDESEA_StoragIntegrationServices
+{
+    public partial class MCSService
+    {
+        /// <summary>
+        /// 璇锋眰绉诲簱
+        /// </summary>
+        /// <param name="json"></param>
+        /// <returns></returns>
+        public WebResponseContent RequestChangeLocation(object json)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                if (string.IsNullOrEmpty(json.ToString())) throw new Exception("涓婁紶鍙傛暟涓虹┖");
+
+                var result = JsonConvert.DeserializeObject<RequestReMove>(json.ToString());
+
+
+
+                return content.OK();
+            }
+            catch (Exception ex)
+            {
+                return content.Error(ex.Message);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequsetCellInfo.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequsetCellInfo.cs
new file mode 100644
index 0000000..340e770
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequsetCellInfo.cs
@@ -0,0 +1,39 @@
+锘縰sing Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core;
+using WIDESEA_DTO;
+
+namespace WIDESEA_StoragIntegrationServices
+{
+    public partial class MCSService
+    {
+        /// <summary>
+        /// 鑾峰彇搴撲綅淇℃伅
+        /// </summary>
+        /// <param name="json"></param>
+        /// <returns></returns>
+        public WebResponseContent RequsetCellInfo(object json)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                if (string.IsNullOrEmpty(json.ToString())) throw new Exception("涓婁紶鍙傛暟涓虹┖");
+
+                var result = JsonConvert.DeserializeObject<RequsetCellInfo>(json.ToString());
+
+                //_stockInfoRepository.QueryFirst(x=>x.LocationCode == result.LocationID && x)
+                //todo
+
+                return content.OK();
+            }
+            catch (Exception ex)
+            {
+                return content.Error(ex.Message);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MCS/MCSController.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MCS/MCSController.cs
new file mode 100644
index 0000000..636959b
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MCS/MCSController.cs
@@ -0,0 +1,39 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using WIDESEA_DTO;
+using WIDESEA_IStoragIntegrationServices;
+
+namespace WIDESEA_WMSServer.Controllers;
+
+[Route("api/[controller]")]
+[ApiController]
+public class MCSController : Controller
+{
+    private readonly IMCSService _MCSService;
+
+    public MCSController(IMCSService MCSService) { _MCSService = MCSService; }
+
+    [HttpPost("NotifyFinishTest")]
+    public WebResponseContent NotifyFinishTest([FromBody] object input)
+    {
+        return _MCSService.NotifyFinishTest(input);
+    }
+
+    [HttpPost("RequestChangeLocation")]
+    public WebResponseContent RequestChangeLocation([FromBody] object input)
+    {
+        return _MCSService.RequestChangeLocation(input);
+    }
+
+    [HttpPost("ModifyAccessStatus")]
+    public WebResponseContent ModifyAccessStatus([FromBody] object input)
+    {
+        return _MCSService.ModifyAccessStatus(input);
+    }
+
+    [HttpPost("RequsetCellInfo")]
+    public WebResponseContent RequsetCellInfo([FromBody] object input)
+    {
+        return _MCSService.RequsetCellInfo(input);
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.3