diff --git a/.vs/HighWayIot/v16/.suo b/.vs/HighWayIot/v16/.suo index 487c5496..47c2f442 100644 Binary files a/.vs/HighWayIot/v16/.suo and b/.vs/HighWayIot/v16/.suo differ diff --git a/Aucma.Scada.Business/OutStoreBusiness.cs b/Aucma.Scada.Business/OutStoreBusiness.cs index 275eb210..e1f0c9f5 100644 --- a/Aucma.Scada.Business/OutStoreBusiness.cs +++ b/Aucma.Scada.Business/OutStoreBusiness.cs @@ -39,6 +39,8 @@ namespace Aucma.Scada.Business private TaskHandleBusiness taskHandleBusiness = TaskHandleBusiness.Instance; + private Semaphore m_SendTaskSem = new Semaphore(0, 100000); + /// /// 初始化出库任务 /// @@ -235,30 +237,30 @@ namespace Aucma.Scada.Business private void StartTimerPassDown() { - try - { - if (!timer.Enabled) - { - timer.Elapsed += new System.Timers.ElapsedEventHandler(PassDownTaskInfoByTimer); - timer.AutoReset = true; - timer.Enabled = false; - timer.Start(); - PrintLogInfoMessage("StartTimerPassDown(),开启定时获取出库任务进行下发"); - } - } - catch (Exception ex) - { - PrintLogErrorMessage("开启定时下发出库任务异常", ex); - } - + //try + //{ + // if (!timer.Enabled) + // { + // timer.Elapsed += new System.Timers.ElapsedEventHandler(PassDownTaskInfoByTimer); + // timer.AutoReset = true; + // timer.Enabled = false; + // timer.Start(); + // PrintLogInfoMessage("StartTimerPassDown(),开启定时获取出库任务进行下发"); + // } + //} + //catch (Exception ex) + //{ + // PrintLogErrorMessage("开启定时下发出库任务异常", ex); + //} } /// /// 依次获取任务队列进行下发 + /// object sender, System.Timers.ElapsedEventArgs e /// /// /// - private void PassDownTaskInfoByTimer(object sender, System.Timers.ElapsedEventArgs e) + private bool PassDownTaskInfoByTimer() { List realTasks = new List(); RealTaskInfo shellTask = _taskInfoService.GetTaskInfoByStoreCode(appConfig.shellStoreCode, 2); @@ -275,22 +277,24 @@ namespace Aucma.Scada.Business if (result) { - foreach(var item in realTasks) + GetAllRelese(m_SendTaskSem); + foreach (var item in realTasks) { RefreshScanMateriaCodeEvent?.Invoke(item.materialCode, item.materialType, item.spaceName, item.storeCode); taskHandleBusiness.SendOutStoreTask(item); } - - if (timer.Enabled) + if (m_SendTaskSem.WaitOne(5000, false)) { - timer.Stop(); - timer.Close(); - timer.Dispose(); - timer = new System.Timers.Timer(5000); + return true; + } + else + { + return false; } } } } + return false; } #endregion @@ -400,5 +404,15 @@ namespace Aucma.Scada.Business RefreshLogMessageEvent?.Invoke(message); logHelper.Error(message, ex); } + + private void GetAllRelese(Semaphore sph) + { + bool res = sph.WaitOne(1, false); + if (res) + { + // LogHelper.RfidLog("信号量手动释放"); + GetAllRelese(sph); + } + } } } diff --git a/Aucma.Scada.Business/TaskHandleBusiness.cs b/Aucma.Scada.Business/TaskHandleBusiness.cs index ee2adffa..abc82244 100644 --- a/Aucma.Scada.Business/TaskHandleBusiness.cs +++ b/Aucma.Scada.Business/TaskHandleBusiness.cs @@ -46,16 +46,33 @@ namespace Aucma.Scada.Business public bool SendOutStoreTask(RealTaskInfo realTaskInfo) { bool result = false; + string spaceCode = string.Empty; + string amount = string.Empty; + string taskCode = string.Empty; + string answer = string.Empty; try { + + if(realTaskInfo.storeCode == appConfig.shellStoreCode) + { + spaceCode = plcConfig.out_shell_spaceCode; + amount = plcConfig.out_shell_amount; + taskCode = plcConfig.out_shell_task; + }else if (realTaskInfo.storeCode == appConfig.linerStoreCode) + { + spaceCode = plcConfig.out_liner_spaceCode; + amount = plcConfig.out_liner_amount; + taskCode = plcConfig.out_liner_task; + } + //写入货道号 - _plc.writeStringByAddress(plcConfig.out_shell_spaceCode, realTaskInfo.spaceCode); + _plc.writeStringByAddress(spaceCode, realTaskInfo.spaceCode); //写入出库数量 - _plc.writeInt32ByAddress(plcConfig.out_shell_amount, realTaskInfo.planAmount); + _plc.writeInt32ByAddress(amount, realTaskInfo.planAmount); //写入任务号 - _plc.writeStringByAddress(plcConfig.out_shell_task, realTaskInfo.taskCode); + _plc.writeStringByAddress(taskCode,realTaskInfo.taskCode); //写入应答字 - _plc.writeInt32ByAddress("", 1); + _plc.writeInt32ByAddress(answer, 1); result = true; } diff --git a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.dll b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.dll index 2da99684..92af0094 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 8cf1d1db..ef90b38a 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/HighWayIot.Config.dll b/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.dll index d75aea7c..c741da59 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 53983ddb..4fc7a625 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/obj/Debug/Aucma.Scada.Business.csproj.AssemblyReference.cache b/Aucma.Scada.Business/obj/Debug/Aucma.Scada.Business.csproj.AssemblyReference.cache index f9ad5af9..5191de06 100644 Binary files a/Aucma.Scada.Business/obj/Debug/Aucma.Scada.Business.csproj.AssemblyReference.cache and b/Aucma.Scada.Business/obj/Debug/Aucma.Scada.Business.csproj.AssemblyReference.cache differ diff --git a/Aucma.Scada.Business/obj/Debug/Aucma.Scada.Business.dll b/Aucma.Scada.Business/obj/Debug/Aucma.Scada.Business.dll index 2da99684..92af0094 100644 Binary files a/Aucma.Scada.Business/obj/Debug/Aucma.Scada.Business.dll and b/Aucma.Scada.Business/obj/Debug/Aucma.Scada.Business.dll differ diff --git a/Aucma.Scada.Business/obj/Debug/Aucma.Scada.Business.pdb b/Aucma.Scada.Business/obj/Debug/Aucma.Scada.Business.pdb index 8cf1d1db..ef90b38a 100644 Binary files a/Aucma.Scada.Business/obj/Debug/Aucma.Scada.Business.pdb and b/Aucma.Scada.Business/obj/Debug/Aucma.Scada.Business.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 2da99684..92af0094 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 8cf1d1db..ef90b38a 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/HighWayIot.Config.dll b/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.dll index d75aea7c..c741da59 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 53983ddb..4fc7a625 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/obj/Debug/Aucma.Scada.UI.csproj.AssemblyReference.cache b/Aucma.Scada.UI/obj/Debug/Aucma.Scada.UI.csproj.AssemblyReference.cache index 20404a4b..57fd12d4 100644 Binary files a/Aucma.Scada.UI/obj/Debug/Aucma.Scada.UI.csproj.AssemblyReference.cache and b/Aucma.Scada.UI/obj/Debug/Aucma.Scada.UI.csproj.AssemblyReference.cache differ diff --git a/HighWayIot.Common/obj/Debug/HighWayIot.Common.csproj.AssemblyReference.cache b/HighWayIot.Common/obj/Debug/HighWayIot.Common.csproj.AssemblyReference.cache index 3bba6722..0f28a564 100644 Binary files a/HighWayIot.Common/obj/Debug/HighWayIot.Common.csproj.AssemblyReference.cache and b/HighWayIot.Common/obj/Debug/HighWayIot.Common.csproj.AssemblyReference.cache differ diff --git a/HighWayIot.Config/bin/Debug/HighWayIot.Config.dll b/HighWayIot.Config/bin/Debug/HighWayIot.Config.dll index d75aea7c..c741da59 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 53983ddb..4fc7a625 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.Config/obj/Debug/HighWayIot.Config.csproj.AssemblyReference.cache b/HighWayIot.Config/obj/Debug/HighWayIot.Config.csproj.AssemblyReference.cache index 05962505..8480793b 100644 Binary files a/HighWayIot.Config/obj/Debug/HighWayIot.Config.csproj.AssemblyReference.cache and b/HighWayIot.Config/obj/Debug/HighWayIot.Config.csproj.AssemblyReference.cache differ diff --git a/HighWayIot.Config/obj/Debug/HighWayIot.Config.dll b/HighWayIot.Config/obj/Debug/HighWayIot.Config.dll index d75aea7c..c741da59 100644 Binary files a/HighWayIot.Config/obj/Debug/HighWayIot.Config.dll and b/HighWayIot.Config/obj/Debug/HighWayIot.Config.dll differ diff --git a/HighWayIot.Config/obj/Debug/HighWayIot.Config.pdb b/HighWayIot.Config/obj/Debug/HighWayIot.Config.pdb index 53983ddb..4fc7a625 100644 Binary files a/HighWayIot.Config/obj/Debug/HighWayIot.Config.pdb and b/HighWayIot.Config/obj/Debug/HighWayIot.Config.pdb differ diff --git a/HighWayIot.Log4net/obj/Debug/HighWayIot.Log4net.csproj.AssemblyReference.cache b/HighWayIot.Log4net/obj/Debug/HighWayIot.Log4net.csproj.AssemblyReference.cache deleted file mode 100644 index adf638dd..00000000 Binary files a/HighWayIot.Log4net/obj/Debug/HighWayIot.Log4net.csproj.AssemblyReference.cache and /dev/null differ diff --git a/HighWayIot.Log4net/obj/Debug/HighWayIot.Log4net.csproj.FileListAbsolute.txt b/HighWayIot.Log4net/obj/Debug/HighWayIot.Log4net.csproj.FileListAbsolute.txt index 1043c63e..ef919627 100644 --- a/HighWayIot.Log4net/obj/Debug/HighWayIot.Log4net.csproj.FileListAbsolute.txt +++ b/HighWayIot.Log4net/obj/Debug/HighWayIot.Log4net.csproj.FileListAbsolute.txt @@ -27,4 +27,3 @@ C:\项目代码\澳柯玛MES项目\Aucma.Scada\HighWayIot.Log4net\obj\Debug\High C:\项目代码\澳柯玛MES项目\Aucma.Scada\HighWayIot.Log4net\obj\Debug\HighWayIot.Log4net.csproj.CopyComplete C:\项目代码\澳柯玛MES项目\Aucma.Scada\HighWayIot.Log4net\obj\Debug\HighWayIot.Log4net.dll C:\项目代码\澳柯玛MES项目\Aucma.Scada\HighWayIot.Log4net\obj\Debug\HighWayIot.Log4net.pdb -C:\项目代码\澳柯玛MES项目\Aucma.Scada\HighWayIot.Log4net\obj\Debug\HighWayIot.Log4net.csproj.AssemblyReference.cache diff --git a/HighWayIot.Plc/obj/Debug/HighWayIot.Plc.csproj.AssemblyReference.cache b/HighWayIot.Plc/obj/Debug/HighWayIot.Plc.csproj.AssemblyReference.cache index f55b9157..6963de62 100644 Binary files a/HighWayIot.Plc/obj/Debug/HighWayIot.Plc.csproj.AssemblyReference.cache and b/HighWayIot.Plc/obj/Debug/HighWayIot.Plc.csproj.AssemblyReference.cache differ diff --git a/HighWayIot.Repository/bin/Debug/HighWayIot.Config.dll b/HighWayIot.Repository/bin/Debug/HighWayIot.Config.dll index d75aea7c..c741da59 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 53983ddb..4fc7a625 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/obj/Debug/HighWayIot.Repository.csproj.AssemblyReference.cache b/HighWayIot.Repository/obj/Debug/HighWayIot.Repository.csproj.AssemblyReference.cache index 89bba37d..ddb9ebf1 100644 Binary files a/HighWayIot.Repository/obj/Debug/HighWayIot.Repository.csproj.AssemblyReference.cache and b/HighWayIot.Repository/obj/Debug/HighWayIot.Repository.csproj.AssemblyReference.cache differ diff --git a/HighWayIot.Rfid/obj/Debug/HighWayIot.Rfid.csproj.AssemblyReference.cache b/HighWayIot.Rfid/obj/Debug/HighWayIot.Rfid.csproj.AssemblyReference.cache index af920e49..8a1b381e 100644 Binary files a/HighWayIot.Rfid/obj/Debug/HighWayIot.Rfid.csproj.AssemblyReference.cache and b/HighWayIot.Rfid/obj/Debug/HighWayIot.Rfid.csproj.AssemblyReference.cache differ diff --git a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.AssemblyReference.cache b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.AssemblyReference.cache deleted file mode 100644 index 6e5a545a..00000000 Binary files a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.AssemblyReference.cache and /dev/null differ diff --git a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.FileListAbsolute.txt b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.FileListAbsolute.txt index 7a4d0db8..ba27c485 100644 --- a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.FileListAbsolute.txt +++ b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.FileListAbsolute.txt @@ -29,4 +29,3 @@ C:\项目代码\澳柯玛MES项目\Aucma.Scada\HighWayIot.TouchSocket\obj\Debug\ C:\项目代码\澳柯玛MES项目\Aucma.Scada\HighWayIot.TouchSocket\obj\Debug\HighWayIot.TouchSocket.csproj.CopyComplete C:\项目代码\澳柯玛MES项目\Aucma.Scada\HighWayIot.TouchSocket\obj\Debug\HighWayIot.TouchSocket.dll C:\项目代码\澳柯玛MES项目\Aucma.Scada\HighWayIot.TouchSocket\obj\Debug\HighWayIot.TouchSocket.pdb -C:\项目代码\澳柯玛MES项目\Aucma.Scada\HighWayIot.TouchSocket\obj\Debug\HighWayIot.TouchSocket.csproj.AssemblyReference.cache diff --git a/HighWayIot/bin/Debug/HighWayIot.Config.dll b/HighWayIot/bin/Debug/HighWayIot.Config.dll index d75aea7c..c741da59 100644 Binary files a/HighWayIot/bin/Debug/HighWayIot.Config.dll and b/HighWayIot/bin/Debug/HighWayIot.Config.dll differ diff --git a/HighWayIot/bin/Debug/HighWayIot.Config.pdb b/HighWayIot/bin/Debug/HighWayIot.Config.pdb index 53983ddb..4fc7a625 100644 Binary files a/HighWayIot/bin/Debug/HighWayIot.Config.pdb and b/HighWayIot/bin/Debug/HighWayIot.Config.pdb differ diff --git a/HighWayIot/obj/Debug/HighWayIot.csproj.AssemblyReference.cache b/HighWayIot/obj/Debug/HighWayIot.csproj.AssemblyReference.cache index 0775088e..d12e9e24 100644 Binary files a/HighWayIot/obj/Debug/HighWayIot.csproj.AssemblyReference.cache and b/HighWayIot/obj/Debug/HighWayIot.csproj.AssemblyReference.cache differ