diff --git a/Aucma.Scada.Business/InStoreBusiness.cs b/Aucma.Scada.Business/InStoreBusiness.cs index 5935643a..115bb75b 100644 --- a/Aucma.Scada.Business/InStoreBusiness.cs +++ b/Aucma.Scada.Business/InStoreBusiness.cs @@ -261,8 +261,8 @@ namespace Aucma.Scada.Business if (taskInfo != null) { PrintLogInfoMessage($"下发箱壳入库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}"); - - if (taskHandle.SendShellTask_InStore(taskInfo)) + int result = taskHandle.SendShellTask_InStore(taskInfo); + if (result==1) { PrintLogInfoMessage($"箱壳入库任务:{taskInfo.taskCode};下发成功,等待PLC执行反馈"); @@ -276,11 +276,14 @@ namespace Aucma.Scada.Business RefreshInStoreTaskEvent?.Invoke(taskInfo); } + else if (result == 2) + { + PrintLogInfoMessage("箱壳入库任务下发失败,PLC接收任务未就绪"); + } else { - PrintLogInfoMessage($"箱壳入库任务:{taskInfo.taskCode};下发失败,请排查PLC连接"); + PrintLogInfoMessage($"箱壳入库任务:{taskInfo.taskCode};下发失败,请排除PLC连接"); } - } else { @@ -303,8 +306,8 @@ namespace Aucma.Scada.Business if (taskInfo != null) { PrintLogInfoMessage($"下发内胆入库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}"); - - if (taskHandle.SendLinerTask_InStore(taskInfo)) + int result = taskHandle.SendLinerTask_InStore(taskInfo); + if (result==1) { PrintLogInfoMessage($"内胆入库任务:{taskInfo.taskCode};下发成功,等待PLC执行反馈"); @@ -318,9 +321,13 @@ namespace Aucma.Scada.Business RefreshInStoreTaskEvent?.Invoke(taskInfo); } + else if (result == 2) + { + PrintLogInfoMessage("箱壳入库任务下发失败,PLC接收任务未就绪"); + } else { - PrintLogInfoMessage($"内胆入库任务:{taskInfo.taskCode};下发失败,请排除PLC连接"); + PrintLogInfoMessage($"箱壳入库任务:{taskInfo.taskCode};下发失败,请排除PLC连接"); } } else @@ -394,18 +401,18 @@ namespace Aucma.Scada.Business if (spaceInfo != null) { - taskHandle.WritePlc(spaceInfo.storeCode, spaceInfo.spaceCode, true); - //spaceInfo.materialType = taskInfo.materialType; + // taskHandle.WritePlc(spaceInfo.storeCode, spaceInfo.spaceCode, true); + spaceInfo.materialType = taskInfo.materialType; - spaceInfo.spaceStock = spaceInfo.spaceStock + 1; - spaceInfo.onRouteAmount -= 1; + // spaceInfo.spaceStock = spaceInfo.spaceStock + 1; + // spaceInfo.onRouteAmount -= 1; //读取PLC获取货道信息:存放数量、在途数量, #region Add By wenjy 2023-10-30 13:44:00 通过PLC获取货道信息 var item = taskHandle.ReadSpaceInfoByPlc(spaceInfo); spaceInfo.spaceStock = item.spaceStock; spaceInfo.onRouteAmount = item.onRouteAmount; - spaceInfo.spaceStatus = item.spaceStatus; + // spaceInfo.spaceStatus = item.spaceStatus; #endregion _spaceInfoService.UpdateSpaceInfo(spaceInfo); diff --git a/Aucma.Scada.Business/InStoreTaskHandle.cs b/Aucma.Scada.Business/InStoreTaskHandle.cs index 68c5bfe7..a699aa7e 100644 --- a/Aucma.Scada.Business/InStoreTaskHandle.cs +++ b/Aucma.Scada.Business/InStoreTaskHandle.cs @@ -2,6 +2,7 @@ using HighWayIot.Config; using HighWayIot.Log4net; using HighWayIot.Plc; +using HighWayIot.Repository.service; using System; using System.Collections.Generic; using System.Linq; @@ -56,8 +57,8 @@ namespace Aucma.Scada.Business /// /// 已下传的任务信息 /// - private List shellTaskInfos = new List(); - private List linerTaskInfos = new List(); + // private List shellTaskInfos = new List(); + // private List linerTaskInfos = new List(); #endregion #region 委托事件 @@ -78,17 +79,112 @@ namespace Aucma.Scada.Business public event InStoreAnswer InStoreAnswerEvent; #endregion + /// + /// 实时任务 + /// + private IRealTaskInfoService _taskInfoService; + private RegisterServices registerServices = RegisterServices.Instance; + + private InStoreTaskHandle() { + _taskInfoService = registerServices.GetService(); _plcDictionary = _pool.GetAll(); + RealReadFinish(); + + } + + #region 判断箱壳,内胆入库是否完成 + /// + /// 实时读取箱壳,内胆入库完成信号 + /// + private void RealReadFinish() + { + // 箱壳线程 + Task.Run(() => + { + + while (true) + { + if (_plcDictionary.Count > 0) + { + IPlc _plc = _plcDictionary[appConfig.shellStoreCode]; + if (_plc != null && _plc.IsConnected) + { + + List taskList = _taskInfoService.GetTaskInfosForInstore(appConfig.shellStoreCode, appConfig.instoreTaskType, 2); + if (taskList != null && taskList.Count > 0) + { + foreach (RealTaskInfo taskInfo in taskList) + { + SpaceAddress spaceAddress = spaceConfig.GetSpaceAddress(appConfig.shellStoreCode, taskInfo.spaceCode); + JudgeIsFinish(taskInfo, _plc, spaceAddress, appConfig.shellStoreCode); + } + } + } + else + { + logHelper.Info($"PLC信息为空或连接失败,通过{appConfig.shellStoreCode}未获取到该仓库对应的PLC信息"); + } + } + Thread.Sleep(1000); + }; + }); + //内胆线程 + Task.Run(() => + { + + while (true) + { + if (_plcDictionary.Count > 0) + { + IPlc _plc = _plcDictionary[appConfig.linerStoreCode]; + if (_plc != null && _plc.IsConnected) + { + // 修改这个方法 + List taskList = _taskInfoService.GetTaskInfosForInstore(appConfig.linerStoreCode, appConfig.instoreTaskType, 2); + if (taskList != null && taskList.Count > 0) + { + foreach (RealTaskInfo taskInfo in taskList) + { + SpaceAddress spaceAddress = spaceConfig.GetSpaceAddress(appConfig.linerStoreCode, taskInfo.spaceCode); + JudgeIsFinish(taskInfo, _plc, spaceAddress, appConfig.linerStoreCode); + } + } + } + else + { + logHelper.Info($"PLC信息为空或连接失败,通过{appConfig.linerStoreCode}未获取到该仓库对应的PLC信息"); + } + } + Thread.Sleep(1000); + }; + }); + } - RealReadPlcSpace(); + /// + /// 判断该任务对应的货道是否有完成信号 + /// + /// + /// + public void JudgeIsFinish(RealTaskInfo taskInfo, IPlc _plc, SpaceAddress spaceAddress,string storeCode) + { + //读取入库完成反馈信号 + if (_plc.readInt32ByAddress(spaceAddress.inStoreFinish) == 1) + { + _plc.writeInt32ByAddress(spaceAddress.inStoreFinish, 0); + InStoreFinsihEvent?.Invoke(storeCode, taskInfo.taskCode); + + } } + #endregion + + #region 箱壳入库任务下发处理 - public bool SendShellTask_InStore(RealTaskInfo taskInfo) + public int SendShellTask_InStore(RealTaskInfo taskInfo) { - bool result = false; + int result = 0; try { IPlc _plc = _plcDictionary[taskInfo.storeCode]; @@ -97,17 +193,24 @@ namespace Aucma.Scada.Business { if (_plc.IsConnected) { - //写入货道号 - _plc.writeStringByAddress(plcConfig.in_shell_spaceCode, taskInfo.spaceCode); - //写入应答字 - _plc.writeInt32ByAddress(plcConfig.in_shell_answer, 1); - //写入任务号 - _plc.writeStringByAddress(plcConfig.in_shell_task, taskInfo.taskCode); - - //写入完成后读取应答字进行复位 - ReadShellAnswer_InStore(taskInfo); - - result = true; + if (_plc.readInt32ByAddress(plcConfig.in_shell_answer) == 1) + { + logHelper.Info("箱壳入库应答字为1,货道号:" + plcConfig.in_shell_spaceCode + ";写" + short.Parse(taskInfo.spaceCode.Substring(5, 1))); + //写入货道号 + _plc.writeInt32ByAddress(plcConfig.in_shell_spaceCode, short.Parse(taskInfo.spaceCode.Substring(5, 1))); + //写入完成后读取应答字进行复位 + ReadShellAnswer_InStore(taskInfo); + //写入应答字 + // _plc.writeInt32ByAddress(plcConfig.in_shell_answer, 1); + //写入任务号 + // _plc.writeStringByAddress(plcConfig.in_shell_task, taskInfo.taskCode); + result = 1; + } + else + { + result = 2; + logHelper.PlcLog("应答字为2,下发新任务plc未就绪"); + } } else { @@ -149,22 +252,18 @@ namespace Aucma.Scada.Business //读取PLC应答字为2时,上位机清空写入的入库内容 if (_plc.readInt32ByAddress(plcConfig.in_shell_answer) == 2) { + logHelper.PlcLog("内胆入库应答字为2,货道号:" + plcConfig.in_shell_spaceCode + ";复位写0"); //写入货道号 - _plc.writeStringByAddress(plcConfig.in_shell_spaceCode, string.Empty); + _plc.writeInt32ByAddress(plcConfig.in_shell_spaceCode, 0); //写入应答字 - _plc.writeInt32ByAddress(plcConfig.in_shell_answer, 0); - //写入任务号 - _plc.writeStringByAddress(plcConfig.in_shell_task, string.Empty); + // _plc.writeInt32ByAddress(plcConfig.in_foam_answer, 0); + isFlag = false; - WritePlc(taskInfo.storeCode, taskInfo.spaceCode, false); - //ReadShellFinish_InStore(taskCode); InStoreAnswerEvent?.Invoke(appConfig.shellStoreCode, taskInfo.taskCode); - - shellTaskInfos.Add(taskInfo); + // shellTaskInfos.Add(taskInfo); } - - Thread.Sleep(1000); + Thread.Sleep(500); } while (isFlag); } else @@ -191,9 +290,9 @@ namespace Aucma.Scada.Business /// 内胆入库任务下发 /// /// - public bool SendLinerTask_InStore(RealTaskInfo taskInfo) + public int SendLinerTask_InStore(RealTaskInfo taskInfo) { - bool result = false; + int result = 0; try { IPlc _plc = _plcDictionary[appConfig.linerStoreCode]; @@ -202,17 +301,27 @@ namespace Aucma.Scada.Business { if (_plc.IsConnected) { - //写入货道号 - _plc.writeStringByAddress(plcConfig.in_liner_spaceCode, taskInfo.spaceCode); - //写入应答字 - _plc.writeInt32ByAddress(plcConfig.in_liner_answer, 1); - //写入任务号 - _plc.writeStringByAddress(plcConfig.in_liner_task, taskInfo.taskCode); - - //写入完成后读取应答字进行复位 - ReadLinerAnswer_InStore(taskInfo); - result = true; + if (_plc.readInt32ByAddress(plcConfig.in_liner_answer) == 1) + { + logHelper.PlcLog("内胆入库应答字为1,货道号:" + plcConfig.in_liner_spaceCode + ";写" + short.Parse(taskInfo.spaceCode.Substring(5, 1))); + //写入货道号 + _plc.writeInt32ByAddress(plcConfig.in_liner_spaceCode, short.Parse(taskInfo.spaceCode.Substring(5, 1))); + //写入应答字 + // _plc.writeInt32ByAddress(plcConfig.in_foam_answer, 1); + //写入任务号 + // _plc.writeStringByAddress(plcConfig.in_foam_task, taskInfo.taskCode); + + //写入完成后读取应答字进行复位 + ReadLinerAnswer_InStore(taskInfo); + + result = 1; + } + else + { + result = 2; + logHelper.PlcLog("内胆应答字为2,下发新任务plc未就绪"); + } } else { @@ -254,20 +363,21 @@ namespace Aucma.Scada.Business //读取PLC应答字为2时,上位机清空写入的入库内容 if (_plc.readInt32ByAddress(plcConfig.in_liner_answer) == 2) { + + logHelper.PlcLog("内胆入库应答字为2,货道号:" + plcConfig.in_liner_spaceCode + ";复位写0"); //写入货道号 - _plc.writeStringByAddress(plcConfig.in_liner_spaceCode, string.Empty); + _plc.writeInt32ByAddress(plcConfig.in_liner_spaceCode, 0); //写入应答字 - _plc.writeInt32ByAddress(plcConfig.in_liner_answer, 0); - //写入任务号 - _plc.writeStringByAddress(plcConfig.in_liner_task, string.Empty); - isFlag = false; + // _plc.writeInt32ByAddress(plcConfig.in_foam_answer, 0); + isFlag = false; + InStoreAnswerEvent?.Invoke(appConfig.linerStoreCode, taskInfo.taskCode); //ReadLinerFinish_InStore(taskCode); // WritePlc(taskInfo.storeCode, taskInfo.spaceCode, false); InStoreAnswerEvent?.Invoke(appConfig.linerStoreCode, taskInfo.taskCode); - linerTaskInfos.Add(taskInfo); + // linerTaskInfos.Add(taskInfo); } Thread.Sleep(1000); @@ -292,7 +402,7 @@ namespace Aucma.Scada.Business } #endregion - #region 读取PLC入库完成 Delete By Wenjy 2023-11-08 15:05:00,经讨论入库完成改为监测在途数量变化 + #region 读取PLC入库完成 Delete By Wenjy 2023-11-08 15:05:00,经讨论入库完成改为监测在途数量变化 /// /// 读取箱壳入库完成 /// @@ -398,139 +508,142 @@ namespace Aucma.Scada.Business } } }*/ - #endregion - #region 监测PLC在途数量变化,完成入库任务 - - private void RealReadPlcSpace() - { - Thread.Sleep(1000); - Task.Run(() => - { - while (true) - { - RealReadShellPlcSpace(); - - Thread.Sleep(500); - } - }); - - Task.Run(() => - { - while (true) - { - RealReadLinerPlcSpace(); - - Thread.Sleep(500); - } - }); - } - - /// - /// 读取箱壳已下发任务的货道信息,读取后将货道编号及在途数量写入Dictionary进行比较,在途数减少则入库完成 - /// - private void RealReadShellPlcSpace() - { - if (shellTaskInfos != null) - { - List spaceCodes = shellTaskInfos.Select(x => x.spaceCode).Distinct().ToList(); - - for (int i = 0; i < spaceCodes.Count; i++) - { - - string spaceCode = spaceCodes[i]; - - BaseSpaceInfo spaceInfo = new BaseSpaceInfo() { storeCode = appConfig.shellStoreCode, spaceCode = spaceCode }; - - spaceInfo = ReadSpaceInfoByPlc(spaceInfo); - - if (shellKeyValuePairs.ContainsKey(spaceInfo.spaceCode)) - { - shellKeyValuePairs.TryGetValue(spaceInfo.spaceCode, out int value); - //判断前次读取的数据和当前数据,如果前次数据大于当前数据则代表入库完成,然后筛选任务中对应货道的首个任务进行完成 - //如果前次数据不大于当前数据则更新字典中存放的数据 - if (value > spaceInfo.onRouteAmount) - { - //筛选任务 - var list = shellTaskInfos.Where(x => x.spaceCode == spaceInfo.spaceCode).ToList(); - if (list.Count > 0) - { - RealTaskInfo taskInfo = list.OrderBy(x => x.createTime).First(); - - InStoreFinsihEvent?.Invoke(taskInfo.storeCode, taskInfo.taskCode); - - shellTaskInfos.Remove(taskInfo); - } - shellKeyValuePairs.Remove(spaceInfo.spaceCode); - } - else - { - shellKeyValuePairs[spaceInfo.spaceCode] = spaceInfo.onRouteAmount; - } - - } - else - { - shellKeyValuePairs.Add(spaceInfo.spaceCode, spaceInfo.onRouteAmount); - } - } - - } - } - - /// - /// 读取内胆已下发任务的货道信息,读取后将货道编号及在途数量写入Dictionary进行比较,在途数减少则入库完成 - /// - private void RealReadLinerPlcSpace() - { - if (linerTaskInfos != null) - { - List spaceCodes = linerTaskInfos.Select(x => x.spaceCode).Distinct().ToList(); - - for (int i = 0; i < spaceCodes.Count; i++) - { - - string spaceCode = spaceCodes[i]; - - BaseSpaceInfo spaceInfo = new BaseSpaceInfo() { storeCode = appConfig.linerStoreCode, spaceCode = spaceCode }; - - spaceInfo = ReadSpaceInfoByPlc(spaceInfo); - - if (linerKeyValuePairs.ContainsKey(spaceInfo.spaceCode)) - { - linerKeyValuePairs.TryGetValue(spaceInfo.spaceCode, out int value); - //判断前次读取的数据和当前数据,如果前次数据大于当前数据则代表入库完成,然后筛选任务中对应货道的首个任务进行完成 - //如果前次数据不大于当前数据则更新字典中存放的数据 - if (value > spaceInfo.onRouteAmount) - { - //筛选任务 - var list = linerTaskInfos.Where(x => x.spaceCode == spaceInfo.spaceCode).ToList(); - if (list.Count > 0) - { - RealTaskInfo taskInfo = list.OrderBy(x => x.createTime).First(); - - InStoreFinsihEvent?.Invoke(taskInfo.storeCode, taskInfo.taskCode); - - linerTaskInfos.Remove(taskInfo); - } - linerKeyValuePairs.Remove(spaceInfo.spaceCode); - } - else - { - linerKeyValuePairs[spaceInfo.spaceCode] = spaceInfo.onRouteAmount; - } - - } - else - { - linerKeyValuePairs.Add(spaceInfo.spaceCode, spaceInfo.onRouteAmount); - } - } + #endregion - } - } + #region 监测PLC在途数量变化,完成入库任务 delete by liuwf 2024-01-06,入库完成改成根据每个货道完成信号完成任务 + + + //private void RealReadPlcSpace() + //{ + // Thread.Sleep(1000); + // Task.Run(() => + // { + // while (true) + // { + // RealReadShellPlcSpace(); + + // Thread.Sleep(500); + // } + // }); + + // Task.Run(() => + // { + // while (true) + // { + // RealReadLinerPlcSpace(); + + // Thread.Sleep(500); + // } + // }); + //} + + ///// + ///// 读取箱壳已下发任务的货道信息,读取后将货道编号及在途数量写入Dictionary进行比较,在途数减少则入库完成 + ///// + //private void RealReadShellPlcSpace() + //{ + // if (shellTaskInfos != null) + // { + // List spaceCodes = shellTaskInfos.Select(x => x.spaceCode).Distinct().ToList(); + + // for (int i = 0; i < spaceCodes.Count; i++) + // { + + // string spaceCode = spaceCodes[i]; + + // BaseSpaceInfo spaceInfo = new BaseSpaceInfo() { storeCode = appConfig.shellStoreCode, spaceCode = spaceCode }; + + // spaceInfo = ReadSpaceInfoByPlc(spaceInfo); + + // if (shellKeyValuePairs.ContainsKey(spaceInfo.spaceCode)) + // { + // shellKeyValuePairs.TryGetValue(spaceInfo.spaceCode, out int value); + // //判断前次读取的数据和当前数据,如果前次数据大于当前数据则代表入库完成,然后筛选任务中对应货道的首个任务进行完成 + // //如果前次数据不大于当前数据则更新字典中存放的数据 + // if (value > spaceInfo.onRouteAmount) + // { + // //筛选任务 + // var list = shellTaskInfos.Where(x => x.spaceCode == spaceInfo.spaceCode).ToList(); + // if (list.Count > 0) + // { + // RealTaskInfo taskInfo = list.OrderBy(x => x.createTime).First(); + + // InStoreFinsihEvent?.Invoke(taskInfo.storeCode, taskInfo.taskCode); + + // shellTaskInfos.Remove(taskInfo); + // } + // shellKeyValuePairs.Remove(spaceInfo.spaceCode); + // } + // else + // { + // shellKeyValuePairs[spaceInfo.spaceCode] = spaceInfo.onRouteAmount; + // } + + // } + // else + // { + // shellKeyValuePairs.Add(spaceInfo.spaceCode, spaceInfo.onRouteAmount); + // } + // } + + // } + //} + + ///// + ///// 读取内胆已下发任务的货道信息,读取后将货道编号及在途数量写入Dictionary进行比较,在途数减少则入库完成 + ///// + //private void RealReadLinerPlcSpace() + //{ + // if (linerTaskInfos != null) + // { + // List spaceCodes = linerTaskInfos.Select(x => x.spaceCode).Distinct().ToList(); + + // for (int i = 0; i < spaceCodes.Count; i++) + // { + + // string spaceCode = spaceCodes[i]; + + // BaseSpaceInfo spaceInfo = new BaseSpaceInfo() { storeCode = appConfig.linerStoreCode, spaceCode = spaceCode }; + + // spaceInfo = ReadSpaceInfoByPlc(spaceInfo); + + // if (linerKeyValuePairs.ContainsKey(spaceInfo.spaceCode)) + // { + // linerKeyValuePairs.TryGetValue(spaceInfo.spaceCode, out int value); + // //判断前次读取的数据和当前数据,如果前次数据大于当前数据则代表入库完成,然后筛选任务中对应货道的首个任务进行完成 + // //如果前次数据不大于当前数据则更新字典中存放的数据 + // if (value > spaceInfo.onRouteAmount) + // { + // //筛选任务 + // var list = linerTaskInfos.Where(x => x.spaceCode == spaceInfo.spaceCode).ToList(); + // if (list.Count > 0) + // { + // RealTaskInfo taskInfo = list.OrderBy(x => x.createTime).First(); + + // InStoreFinsihEvent?.Invoke(taskInfo.storeCode, taskInfo.taskCode); + + // linerTaskInfos.Remove(taskInfo); + // } + // linerKeyValuePairs.Remove(spaceInfo.spaceCode); + // } + // else + // { + // linerKeyValuePairs[spaceInfo.spaceCode] = spaceInfo.onRouteAmount; + // } + + // } + // else + // { + // linerKeyValuePairs.Add(spaceInfo.spaceCode, spaceInfo.onRouteAmount); + // } + // } + + // } + //} #endregion + /// /// 通过PLC获取货道信息 /// @@ -547,7 +660,7 @@ namespace Aucma.Scada.Business { spaceInfo.spaceStock = _plc.readInt32ByAddress(spaceAddress.onStore); spaceInfo.onRouteAmount = _plc.readInt32ByAddress(spaceAddress.onRoute); - spaceInfo.spaceStatus = _plc.readInt32ByAddress(spaceAddress.spaceStatus); + // spaceInfo.spaceStatus = _plc.readInt32ByAddress(spaceAddress.spaceStatus); } } diff --git a/Aucma.Scada.Business/OutStoreBusiness.cs b/Aucma.Scada.Business/OutStoreBusiness.cs index bc589e36..8a007b25 100644 --- a/Aucma.Scada.Business/OutStoreBusiness.cs +++ b/Aucma.Scada.Business/OutStoreBusiness.cs @@ -356,8 +356,8 @@ namespace Aucma.Scada.Business if(taskInfo != null) { PrintLogInfoMessage($"下发箱壳出库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}"); - - if (taskHandleBusiness.SendShellTask_OutStore(taskInfo)) + int result = taskHandleBusiness.SendShellTask_OutStore(taskInfo); + if (result==1) { PrintLogInfoMessage($"箱壳出库任务:{taskInfo.taskCode};下发成功,等待PLC执行反馈"); @@ -371,6 +371,10 @@ namespace Aucma.Scada.Business RefreshScanMateriaCodeEvent?.Invoke(taskInfo.materialCode, taskInfo.materialType, taskInfo.spaceName, taskInfo.storeCode); } + else if (result == 2) + { + PrintLogInfoMessage("箱壳出库任务下发失败,PLC接收任务未就绪"); + } else { PrintLogInfoMessage($"箱壳出库任务:{taskInfo.taskCode};下发失败,请排除PLC连接"); @@ -397,8 +401,8 @@ namespace Aucma.Scada.Business if (taskInfo != null) { PrintLogInfoMessage($"下发内胆出库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}"); - - if (taskHandleBusiness.SendLinerTask_OutStore(taskInfo)) + int result = taskHandleBusiness.SendLinerTask_OutStore(taskInfo); + if (result==1) { PrintLogInfoMessage($"内胆出库任务:{taskInfo.taskCode};下发成功,等待PLC执行反馈"); @@ -412,6 +416,10 @@ namespace Aucma.Scada.Business RefreshScanMateriaCodeEvent?.Invoke(taskInfo.materialCode, taskInfo.materialType, taskInfo.spaceName, taskInfo.storeCode); } + else if (result == 2) + { + PrintLogInfoMessage("内胆出库任务下发失败,PLC接收任务未就绪"); + } else { PrintLogInfoMessage($"内胆出库任务:{taskInfo.taskCode};下发失败,请排除PLC连接"); @@ -877,7 +885,7 @@ namespace Aucma.Scada.Business var spaceInfo = taskHandleBusiness.ReadSpaceInfoByPlc(item); item.spaceStock = spaceInfo.spaceStock; item.onRouteAmount = spaceInfo.onRouteAmount; - item.spaceStatus = spaceInfo.spaceStatus; + // item.spaceStatus = spaceInfo.spaceStatus; PrintLogInfoMessage($"通过PLC读取货道信息,货道:{spaceInfo.spaceName};在库数量:{item.spaceStock};货道状态:{item.spaceStatus}"); } diff --git a/Aucma.Scada.Business/OutStoreTaskHandle.cs b/Aucma.Scada.Business/OutStoreTaskHandle.cs index d0d7d02b..680488e4 100644 --- a/Aucma.Scada.Business/OutStoreTaskHandle.cs +++ b/Aucma.Scada.Business/OutStoreTaskHandle.cs @@ -105,9 +105,9 @@ namespace Aucma.Scada.Business /// 箱壳出库任务下发 /// /// - public bool SendShellTask_OutStore(RealTaskInfo taskInfo) + public int SendShellTask_OutStore(RealTaskInfo taskInfo) { - bool result = false; + int result = 0; try { IPlc _plc = _plcDictionary[appConfig.shellStoreCode]; @@ -116,19 +116,25 @@ namespace Aucma.Scada.Business { if (_plc.IsConnected) { - //写入货道号 - _plc.writeStringByAddress(plcConfig.out_shell_spaceCode, taskInfo.spaceCode); - //写入出库数量 - _plc.writeInt32ByAddress(plcConfig.out_shell_amount, taskInfo.planAmount); - //写入应答字 - _plc.writeInt32ByAddress(plcConfig.out_shell_answer, 1); - //写入任务号 - _plc.writeStringByAddress(plcConfig.out_shell_task, taskInfo.taskCode); - - //写入完成后读取应答字进行复位 - ReadShellAnswer_OutStore(taskInfo); - - result = true; + + if (_plc.readInt32ByAddress(plcConfig.out_shell_answer) == 1) + { + logHelper.Info("箱壳出库应答字为1,货道号:" + plcConfig.out_shell_spaceCode + ";写" + short.Parse(taskInfo.spaceCode.Substring(5, 1))); + //写入货道号 + _plc.writeInt32ByAddress(plcConfig.out_shell_spaceCode, short.Parse(taskInfo.spaceCode.Substring(5, 1))); + //写入出库数量 + _plc.writeInt32ByAddress(plcConfig.out_shell_amount, taskInfo.planAmount); + + //写入完成后读取应答字进行复位 + ReadShellAnswer_OutStore(taskInfo); + + result = 1; + } + else + { + result = 2; + logHelper.Info("应答字为2,下发新任务plc未就绪"); + } } else { @@ -168,23 +174,18 @@ namespace Aucma.Scada.Business //读取PLC应答字为2时,上位机清空写入的出库内容 if (_plc.readInt32ByAddress(plcConfig.out_shell_answer) == 2) { + + logHelper.Info("出库应答字为2,货道号:" + plcConfig.out_shell_spaceCode + ";复位写0"); //写入货道号 - _plc.writeStringByAddress(plcConfig.out_shell_spaceCode, string.Empty); + _plc.writeInt32ByAddress(plcConfig.out_shell_spaceCode, 0); //写入出库数量 _plc.writeInt32ByAddress(plcConfig.out_shell_amount, 0); - //写入应答字 - _plc.writeInt32ByAddress(plcConfig.out_shell_answer, 0); - isFlag = false; - //ReadShellFinish_OutStore(taskInfo.taskCode); - - OutStoreAnswerEvent?.Invoke(appConfig.shellStoreCode, taskInfo.taskCode); - - + OutStoreAnswerEvent?.Invoke(appConfig.shellStoreCode, taskInfo.taskCode); } + Thread.Sleep(500); - Thread.Sleep(1000); } while (isFlag); } else @@ -262,9 +263,9 @@ namespace Aucma.Scada.Business /// 内胆出库任务下发 /// /// - public bool SendLinerTask_OutStore(RealTaskInfo taskInfo) + public int SendLinerTask_OutStore(RealTaskInfo taskInfo) { - bool result = false; + int result = 0; try { IPlc _plc = _plcDictionary[appConfig.linerStoreCode]; @@ -273,19 +274,26 @@ namespace Aucma.Scada.Business { if (_plc.IsConnected) { - //写入货道号 - _plc.writeStringByAddress(plcConfig.out_liner_spaceCode, taskInfo.spaceCode); - //写入出库数量 - _plc.writeInt32ByAddress(plcConfig.out_liner_amount, taskInfo.planAmount); - //写入应答字 - _plc.writeInt32ByAddress(plcConfig.out_liner_answer, 1); - //写入任务号 - _plc.writeStringByAddress(plcConfig.out_liner_task, taskInfo.taskCode); - - //写入完成后读取应答字进行复位 - ReadLinerAnswer_OutStore(taskInfo); - - result = true; + + if (_plc.readInt32ByAddress(plcConfig.out_liner_answer) == 1) + { + logHelper.Info("内胆出库应答字为1,货道号:" + plcConfig.out_shell_spaceCode + ";写" + short.Parse(taskInfo.spaceCode.Substring(5, 1))); + //写入货道号 + _plc.writeInt32ByAddress(plcConfig.out_liner_spaceCode, short.Parse(taskInfo.spaceCode.Substring(5, 1))); + //写入出库数量 + _plc.writeInt32ByAddress(plcConfig.out_liner_amount, taskInfo.planAmount); + + //写入完成后读取应答字进行复位 + ReadLinerAnswer_OutStore(taskInfo); + + result = 1; + } + else + { + result = 2; + logHelper.Info("内胆应答字为2,下发新任务plc未就绪"); + } + } else { @@ -322,26 +330,23 @@ namespace Aucma.Scada.Business { do { + //读取PLC应答字为2时,上位机清空写入的出库内容 if (_plc.readInt32ByAddress(plcConfig.out_liner_answer) == 2) { + + logHelper.Info("出库应答字为2,货道号:" + plcConfig.out_liner_spaceCode + ";复位写0"); //写入货道号 - _plc.writeStringByAddress(plcConfig.out_liner_spaceCode, string.Empty); + _plc.writeInt32ByAddress(plcConfig.out_liner_spaceCode, 0); //写入出库数量 _plc.writeInt32ByAddress(plcConfig.out_liner_amount, 0); - //写入应答字 - _plc.writeInt32ByAddress(plcConfig.out_liner_answer, 0); - //写入任务号 - _plc.writeStringByAddress(plcConfig.out_liner_task, string.Empty); isFlag = false; - //ReadLinerFinish_OutStore(taskCode); OutStoreAnswerEvent?.Invoke(appConfig.linerStoreCode, taskInfo.taskCode); - - //linerTaskInfos.Add(taskInfo); } - Thread.Sleep(1000); + Thread.Sleep(500); + } while (isFlag); } else @@ -360,7 +365,6 @@ namespace Aucma.Scada.Business logHelper.Error("读取内胆出库应答字异常", ex); } } - /// /// 读取内胆出库完成 /// @@ -542,7 +546,7 @@ namespace Aucma.Scada.Business { spaceInfo.spaceStock = _plc.readInt32ByAddress(spaceAddress.onStore); spaceInfo.onRouteAmount = _plc.readInt32ByAddress(spaceAddress.onRoute); - spaceInfo.spaceStatus = _plc.readInt32ByAddress(spaceAddress.spaceStatus); + // spaceInfo.spaceStatus = _plc.readInt32ByAddress(spaceAddress.spaceStatus); } } diff --git a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.dll b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.dll index 06f72d5d..58f876f6 100644 Binary files a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.dll and b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.dll differ diff --git a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.pdb b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.pdb index fb0f4993..055ab574 100644 Binary files a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.pdb and b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.pdb differ diff --git a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.dll b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.dll index eb83ddd3..d9b8d2cd 100644 Binary files a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.dll and b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.dll differ diff --git a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.pdb b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.pdb index 56a632a7..6056f319 100644 Binary files a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.pdb and b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.pdb differ diff --git a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Model.pdb b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Model.pdb index 370c2987..2f9d099c 100644 Binary files a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Model.pdb and b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Model.pdb differ diff --git a/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.dll b/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.dll index 01524b50..ab4c9d87 100644 Binary files a/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.dll and b/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.dll differ diff --git a/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.pdb b/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.pdb index a3d06029..0322de15 100644 Binary files a/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.pdb and b/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.pdb differ diff --git a/Aucma.Scada.Business/bin/Debug/HighWayIot.Plc.dll b/Aucma.Scada.Business/bin/Debug/HighWayIot.Plc.dll index 304d70f2..0e2bae32 100644 Binary files a/Aucma.Scada.Business/bin/Debug/HighWayIot.Plc.dll and b/Aucma.Scada.Business/bin/Debug/HighWayIot.Plc.dll differ diff --git a/Aucma.Scada.Business/bin/Debug/HighWayIot.Plc.pdb b/Aucma.Scada.Business/bin/Debug/HighWayIot.Plc.pdb index c1fba409..bee710c9 100644 Binary files a/Aucma.Scada.Business/bin/Debug/HighWayIot.Plc.pdb and b/Aucma.Scada.Business/bin/Debug/HighWayIot.Plc.pdb differ diff --git a/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.dll b/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.dll index f669dba2..0b08b083 100644 Binary files a/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.dll and b/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.dll differ diff --git a/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.pdb b/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.pdb index 64cfc8d2..7564a7c6 100644 Binary files a/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.pdb and b/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.pdb differ diff --git a/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.dll b/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.dll index eb83ddd3..d9b8d2cd 100644 Binary files a/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.dll and b/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.dll differ diff --git a/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.pdb b/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.pdb index 56a632a7..6056f319 100644 Binary files a/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.pdb and b/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.pdb differ diff --git a/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.dll b/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.dll index 01524b50..ab4c9d87 100644 Binary files a/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.dll and b/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.dll differ diff --git a/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.pdb b/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.pdb index a3d06029..0322de15 100644 Binary files a/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.pdb and b/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.pdb differ diff --git a/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.dll b/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.dll index 535759d6..ad579f43 100644 Binary files a/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.dll and b/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.dll differ diff --git a/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.pdb b/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.pdb index 370c2987..2f9d099c 100644 Binary files a/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.pdb and b/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.pdb differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.dll b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.dll index 06f72d5d..58f876f6 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.dll and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.dll differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.pdb b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.pdb index fb0f4993..055ab574 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.pdb and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.pdb differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.dll b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.dll index eb83ddd3..d9b8d2cd 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.dll and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.dll differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.pdb b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.pdb index 56a632a7..6056f319 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.pdb and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.pdb differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.dll b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.dll index 535759d6..ad579f43 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.dll and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.dll differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.pdb b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.pdb index 370c2987..2f9d099c 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.pdb and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.pdb differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.exe b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.exe index e730db4f..7b1f8428 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.exe and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.exe differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.pdb b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.pdb index 7c9d3e5f..60031548 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.pdb and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.pdb differ diff --git a/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.dll b/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.dll index 01524b50..ab4c9d87 100644 Binary files a/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.dll and b/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.dll differ diff --git a/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.pdb b/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.pdb index a3d06029..0322de15 100644 Binary files a/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.pdb and b/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.pdb differ diff --git a/Aucma.Scada.UI/bin/Debug/HighWayIot.Plc.dll b/Aucma.Scada.UI/bin/Debug/HighWayIot.Plc.dll index 304d70f2..0e2bae32 100644 Binary files a/Aucma.Scada.UI/bin/Debug/HighWayIot.Plc.dll and b/Aucma.Scada.UI/bin/Debug/HighWayIot.Plc.dll differ diff --git a/Aucma.Scada.UI/bin/Debug/HighWayIot.Plc.pdb b/Aucma.Scada.UI/bin/Debug/HighWayIot.Plc.pdb index c1fba409..bee710c9 100644 Binary files a/Aucma.Scada.UI/bin/Debug/HighWayIot.Plc.pdb and b/Aucma.Scada.UI/bin/Debug/HighWayIot.Plc.pdb differ diff --git a/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.dll b/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.dll index f669dba2..0b08b083 100644 Binary files a/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.dll and b/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.dll differ diff --git a/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.pdb b/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.pdb index 64cfc8d2..7564a7c6 100644 Binary files a/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.pdb and b/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.pdb differ diff --git a/Aucma.Scada.UI/bin/Debug/config/PlcSpace.Ini b/Aucma.Scada.UI/bin/Debug/config/PlcSpace.Ini index c90d5ad0..b1c7ed0b 100644 --- a/Aucma.Scada.UI/bin/Debug/config/PlcSpace.Ini +++ b/Aucma.Scada.UI/bin/Debug/config/PlcSpace.Ini @@ -1,87 +1,64 @@ -#ǿϢ +#ǿϢ Ƿ=D7221 ״̬=D7231 ֿ״̬=D7300 #豸״̬,0δ״̬,1Զ,2ά޵״̬,ֹ [XKJCK-001_XK_001] ڿ=D7201 ;=D7211 -Ƿ=D7221 -״̬=D7231 -ֿ״̬=D7300 #豸״̬,0δ״̬,1Զ,2ά޵״̬,ֹ +=D7021 =D7240 + [XKJCK-001_XK_002] ڿ=D7202 ;=D7212 -Ƿ=D7222 -״̬=D7232 -ֿ״̬=D7300 #豸״̬,0δ״̬,1Զ,2ά޵״̬,ֹ +=D7022 =D7240 [XKJCK-001_XK_003] ڿ=D7203 ;=D7213 -Ƿ=D7223 -״̬=D7233 -ֿ״̬=D7300 #豸״̬,0δ״̬,1Զ,2ά޵״̬,ֹ +=D7023 =D7240 [XKJCK-001_XK_004] ڿ=D7204 ;=D7214 -Ƿ=D7224 -״̬=D7234 -ֿ״̬=D7300 #豸״̬,0δ״̬,1Զ,2ά޵״̬,ֹ +=D7024 =D7240 [XKJCK-001_XK_005] ڿ=D7205 ;=D7215 -Ƿ=D7225 -״̬=D7235 -ֿ״̬=D7300 #豸״̬,0δ״̬,1Զ,2ά޵״̬,ֹ +=D7025 =D7240 [XKJCK-001_XK_006] ڿ=D7206 ;=D7216 -Ƿ=D7226 -״̬=D7236 -ֿ״̬=D7300 #豸״̬,0δ״̬,1Զ,2ά޵״̬,ֹ +=D7026 =D7240 #ڵϢ [NDJCK-001_ND_001] ڿ=D7201 ;=D7211 -Ƿ=D7221 -״̬=D7231 -ֿ״̬=D7300 #豸״̬,0δ״̬,1Զ,2ά޵״̬,ֹ +=D7021 =D7240 [NDJCK-001_ND_002] ڿ=D7202 ;=D7212 -Ƿ=D7222 -״̬=D7232 -ֿ״̬=D7300 #豸״̬,0δ״̬,1Զ,2ά޵״̬,ֹ +=D7022 =D7240 [NDJCK-001_ND_003] ڿ=D7203 ;=D7213 -Ƿ=D7223 -״̬=D7233 -ֿ״̬=D7300 #豸״̬,0δ״̬,1Զ,2ά޵״̬,ֹ +=D7023 =D7240 [NDJCK-001_ND_004] ڿ=D7204 ;=D7214 -Ƿ=D7224 -״̬=D7234 -ֿ״̬=D7300 #豸״̬,0δ״̬,1Զ,2ά޵״̬,ֹ +=D7024 =D7240 [NDJCK-001_ND_005] ڿ=D7205 ;=D7215 -Ƿ=D7225 -״̬=D7235 -ֿ״̬=D7300 #豸״̬,0δ״̬,1Զ,2ά޵״̬,ֹ +=D7025 =D7240 [NDJCK-001_ND_006] ڿ=D7206 ;=D7216 -Ƿ=D7226 -״̬=D7236 -ֿ״̬=D7300 #豸״̬,0δ״̬,1Զ,2ά޵״̬,ֹ +=D7026 =D7240 \ No newline at end of file diff --git a/HighWayIot.Config/PlcSpaceConfig.cs b/HighWayIot.Config/PlcSpaceConfig.cs index e181e886..46d355bb 100644 --- a/HighWayIot.Config/PlcSpaceConfig.cs +++ b/HighWayIot.Config/PlcSpaceConfig.cs @@ -32,12 +32,14 @@ namespace HighWayIot.Config SpaceAddress spaceAddress = new SpaceAddress(); spaceAddress.onStore = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "在库数量"); spaceAddress.onRoute = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "在途数量"); - spaceAddress.isFull = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "是否已满"); - spaceAddress.spaceStatus = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "货道状态"); - spaceAddress.storeStatus = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "仓库状态"); - spaceAddress.alarmInfo = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "报警信息"); + spaceAddress.outStoreFinish = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "入库完成"); spaceAddress.outStoreFinish = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "出库完成"); return spaceAddress; + // spaceAddress.isFull = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "是否已满"); + // spaceAddress.spaceStatus = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "货道状态"); + // spaceAddress.storeStatus = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "仓库状态"); + // spaceAddress.alarmInfo = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "报警信息"); + } } @@ -47,15 +49,19 @@ namespace HighWayIot.Config public string onRoute { get; set; } - public string isFull { get; set; } + public string inStoreFinish { get; set; } - public string spaceStatus { get; set; } + public string outStoreFinish { get; set; } - public string storeStatus { get; set; } + // public string isFull { get; set; } + + // public string spaceStatus { get; set; } + + // public string storeStatus { get; set; } + + // public string alarmInfo { get; set; } - public string alarmInfo { get; set; } - public string outStoreFinish { get; set; } } } diff --git a/HighWayIot.Config/bin/Debug/HighWayIot.Config.dll b/HighWayIot.Config/bin/Debug/HighWayIot.Config.dll index 01524b50..ab4c9d87 100644 Binary files a/HighWayIot.Config/bin/Debug/HighWayIot.Config.dll and b/HighWayIot.Config/bin/Debug/HighWayIot.Config.dll differ diff --git a/HighWayIot.Config/bin/Debug/HighWayIot.Config.pdb b/HighWayIot.Config/bin/Debug/HighWayIot.Config.pdb index a3d06029..0322de15 100644 Binary files a/HighWayIot.Config/bin/Debug/HighWayIot.Config.pdb and b/HighWayIot.Config/bin/Debug/HighWayIot.Config.pdb differ diff --git a/HighWayIot.Plc/bin/Debug/HighWayIot.Plc.dll b/HighWayIot.Plc/bin/Debug/HighWayIot.Plc.dll index 304d70f2..0e2bae32 100644 Binary files a/HighWayIot.Plc/bin/Debug/HighWayIot.Plc.dll and b/HighWayIot.Plc/bin/Debug/HighWayIot.Plc.dll differ diff --git a/HighWayIot.Plc/bin/Debug/HighWayIot.Plc.pdb b/HighWayIot.Plc/bin/Debug/HighWayIot.Plc.pdb index c1fba409..bee710c9 100644 Binary files a/HighWayIot.Plc/bin/Debug/HighWayIot.Plc.pdb and b/HighWayIot.Plc/bin/Debug/HighWayIot.Plc.pdb differ diff --git a/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.dll b/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.dll index 535759d6..ad579f43 100644 Binary files a/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.dll and b/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.dll differ diff --git a/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.pdb b/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.pdb index 370c2987..2f9d099c 100644 Binary files a/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.pdb and b/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.pdb differ diff --git a/HighWayIot.Repository/bin/Debug/HighWayIot.Config.dll b/HighWayIot.Repository/bin/Debug/HighWayIot.Config.dll index 01524b50..ab4c9d87 100644 Binary files a/HighWayIot.Repository/bin/Debug/HighWayIot.Config.dll and b/HighWayIot.Repository/bin/Debug/HighWayIot.Config.dll differ diff --git a/HighWayIot.Repository/bin/Debug/HighWayIot.Config.pdb b/HighWayIot.Repository/bin/Debug/HighWayIot.Config.pdb index a3d06029..0322de15 100644 Binary files a/HighWayIot.Repository/bin/Debug/HighWayIot.Config.pdb and b/HighWayIot.Repository/bin/Debug/HighWayIot.Config.pdb differ diff --git a/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.dll b/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.dll index f669dba2..0b08b083 100644 Binary files a/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.dll and b/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.dll differ diff --git a/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.pdb b/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.pdb index 64cfc8d2..7564a7c6 100644 Binary files a/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.pdb and b/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.pdb differ diff --git a/HighWayIot.Repository/service/IRealTaskInfoService.cs b/HighWayIot.Repository/service/IRealTaskInfoService.cs index 11559c86..fcd30c85 100644 --- a/HighWayIot.Repository/service/IRealTaskInfoService.cs +++ b/HighWayIot.Repository/service/IRealTaskInfoService.cs @@ -5,6 +5,17 @@ namespace HighWayIot.Repository.service { public interface IRealTaskInfoService { + + /// + /// 获取指定状态的货道去重的按时间排序任务列表 + /// + /// + /// + /// + /// + List GetTaskInfosForInstore(string storeCode, int taskType, int taskStatus); + + /// /// 添加任务信息 /// diff --git a/HighWayIot.Repository/service/Impl/RealTaskInfoServiceImpl.cs b/HighWayIot.Repository/service/Impl/RealTaskInfoServiceImpl.cs index ad6c56d0..1c200c04 100644 --- a/HighWayIot.Repository/service/Impl/RealTaskInfoServiceImpl.cs +++ b/HighWayIot.Repository/service/Impl/RealTaskInfoServiceImpl.cs @@ -15,6 +15,44 @@ namespace HighWayIot.Repository.service.Impl private LogHelper logHelper = LogHelper.Instance; + + + /// + /// 获取指定状态的货道去重的按时间排序任务列表 + /// + /// + /// + /// + /// + public List GetTaskInfosForInstore(string storeCode, int taskType, int taskStatus) + { + List realTaskInfos = null; + List filteredList = null; + try + { + Expression> exp = s1 => true; + exp = exp.And(x => x.taskType == taskType && storeCode.Contains(x.storeCode)); + exp = exp.And(x => x.taskStatus == taskStatus); + realTaskInfos = _mesRepository.GetList(exp); + + if (realTaskInfos == null || realTaskInfos.Count == 0) return null; + + filteredList = realTaskInfos.GroupBy(rti => rti.spaceCode) // 按照 spaceCode 进行分组 + .Select(group => group.OrderBy(rti => rti.createTime).First()) + .ToList(); + + } + catch (Exception ex) + { + logHelper.Error("获取指定状态的任务信息异常", ex); + } + return filteredList; + } + + + + + /// /// 添加任务信息 ///