From a89f1faab22c204627d49d6731be9c94d8160184 Mon Sep 17 00:00:00 2001 From: duyongjia <adu_555@163.com> Date: 星期五, 22 十一月 2024 11:23:47 +0800 Subject: [PATCH] 优化修改提交 --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 56 ++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 36 insertions(+), 20 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" index 4102b58..2d2c8a0 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" @@ -49,6 +49,8 @@ public Task Execute(IJobExecutionContext context) { + WriteDebug("澶у爢鍨涙満杩愯鏃ュ織", "寮�濮嬫椂闂�" + DateTime.Now); + WriteDebug("澶у爢鍨涙満杩愯鏃ュ織", $"澶у爢鍨涙満浠诲姟鎵ц涓�..."); //CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); CommonStackerCrane commonStackerCrane = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "SC01") as CommonStackerCrane; try @@ -69,6 +71,7 @@ Dt_Task? task = GetTask(commonStackerCrane); if (task != null) { + WriteDebug("澶у爢鍨涙満杩愯鏃ュ織", $"澶у爢鍨涙満浠诲姟鍙穥task.TaskNum}"); StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); if (stackerCraneTaskCommand != null) { @@ -105,13 +108,13 @@ //鏌ヨ鎻愬崌鏈�/缁勭珛鏈轰俊鍙� - Task.Run(delegate - { + //Task.Run(delegate + //{ try { - if (commonStackerCrane != null) { + Dt_Task? task1001 = _taskService.QueryStackerCraneTaskByAGVRequest("SC01"); if (task1001 != null) { @@ -143,12 +146,13 @@ int IsWriteTwo = 0; if (task3001.SourceAddress == "SC01-002-000-001")//WMS 1001绔欑偣 { + //鎻愬崌鏈烘槸鍚﹀浜庡氨缁姸鎬� + int IsReady= commonStackerCrane.Communicator.Read<short>("DB2.0.0"); //鍐欏叆鎻愬崌淇℃伅 IsWriteOne = commonStackerCrane.Communicator.Read<short>("DB1.0.0"); - if(IsWriteOne == 0) + if(IsWriteOne == 0&& IsReady == 1) { - - var d= commonStackerCrane.Communicator.Write<short>("DB1.0.0", 1); + commonStackerCrane.Communicator.Write<short>("DB1.0.0", 1); } //璇诲彇鎻愬崌鏈轰俊鍙凤紝纭畾鏄惁鎻愬崌瀹屾垚 @@ -156,9 +160,11 @@ } else if (task3001.SourceAddress == "SC01-002-000-002")//WMS 1002绔欑偣 { + //鎻愬崌鏈烘槸鍚﹀浜庡氨缁姸鎬� + int IsReady = commonStackerCrane.Communicator.Read<short>("DB2.0.0"); //鍐欏叆鎻愬崌淇℃伅 IsWriteTwo = commonStackerCrane.Communicator.Read<short>("DB1.6.0"); - if (IsWriteTwo == 0) + if (IsWriteTwo == 0 && IsReady == 1) { commonStackerCrane.Communicator.Write<short>("DB1.6.0", 1); } @@ -176,8 +182,6 @@ { WriteDebug(nameof(CommonStackerCraneJob), $"鎻愬崌鏈烘彁鍗囧畬鎴愶紝鍥炰紶WMS澶辫触锛佷换鍔″彿{task3001.TaskNum}"); } - - } } @@ -195,8 +199,12 @@ if (!string.IsNullOrEmpty(Levels[0]) && !string.IsNullOrEmpty(Levels[1])) { int level = Convert.ToInt16(Levels[0]) - Convert.ToInt16(Levels[1]); + //鍓╀綑灞傛暟鍐欏叆 bool issuccess = commonStackerCrane.Communicator.Write<short>("DB28." + location.Depth + ".0", Convert.ToInt16(level)); + WriteDebug(nameof(CommonStackerCraneJob), $"鍓╀綑灞傛暟淇″彿鍐欏叆{level}-浠诲姟鍙穥taskSmall.TaskNum}"); + + //濡傛灉褰撳墠鎻愬彇灞傛暟绛変簬鎬诲眰鏁帮紝鍒欒〃绀烘枡杞︽墍鏈夌殑灞傛暟鍙栧畬 if (level == 0) { @@ -205,8 +213,21 @@ { //鏍规嵁鐩爣鍦板潃鏌ヨ缁勭珛鏈虹珯鐐逛俊鎭紝鑾峰彇鍐欏叆鏁磋溅瀹屾垚鐨凞B鍧� Depth Dt_LocationInfo location2 = _locationInfoRepository.QueryFirst(x => x.LocationCode == location.Remark); - //鏁磋溅瀹屾垚鍐欏叆 - bool issuccess2 = commonStackerCrane.Communicator.Write<short>("DB28." + location.Depth+".0", 1); + //鏁磋溅瀹屾垚鍐欏叆灞傛暟 + int sn = 0; + if(taskSmall.SourceAddress== "SC01-001-006-001"|| taskSmall.SourceAddress == "SC01-001-012-001"|| taskSmall.SourceAddress == "SC01-001-018-001" || taskSmall.SourceAddress == "SC01-001-022-001"|| taskSmall.SourceAddress == "SC01-001-026-001") + { + sn = 1; + } + else if(taskSmall.SourceAddress == "SC01-001-007-001" || taskSmall.SourceAddress == "SC01-001-013-001" || taskSmall.SourceAddress == "SC01-001-019-001" || taskSmall.SourceAddress == "SC01-001-023-001" || taskSmall.SourceAddress == "SC01-001-027-001") + { + sn = 2; + } + else + { + sn = 3; + } + bool issuccess2 = commonStackerCrane.Communicator.Write<short>("DB28." + location2.Depth+".0", Convert.ToInt16(sn)); if (issuccess2&&issuccess) { _taskService.UpdateTaskStatus(taskSmall.TaskId, (int)TaskOutStatusEnum.OutFinish); @@ -238,20 +259,15 @@ } } - - - } + + } } catch (Exception ex) { WriteError(nameof(CommonStackerCraneJob), "鏌ヨ鎴栧啓鍏LC鐘舵�佸け璐ワ紒", ex); } - - - }); - - - + WriteDebug("澶у爢鍨涙満杩愯鏃ュ織", "缁撴潫鏃堕棿" + DateTime.Now); + //}); return Task.CompletedTask; } -- Gitblit v1.9.3